From patchwork Wed Jan 24 16:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529415 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C2DE7E768 for ; Wed, 24 Jan 2024 16:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115372; cv=none; b=V8qWWwHawaobrUm0c0CJq8nw+elgWhs2H8fvlFGOzCMO4xrlDerAfp5ZHxiUunk7GgBkfa3Zi4z+5vWNZ46wRixurKVU2kASrbrHD7XgGPb/uoeBp2cQklkogv2fSyv2HkUoNZ8YFwW6i0zq+kShdY+gdEBSvbzQAQWyHBJBFhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115372; c=relaxed/simple; bh=a1HguVsqtkibfnCsqigz2NZCOqz//9IFy1JRq8o2WdA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pPmi+wzl2V8Dck6evPYH06IBiVey9geZWQweal+lefsvAzoxggoCc0EsRyOck0KV16zRQyqUfrOh+VBOUuMZ3VW2vA5UCrRhVb7lCRVXpdJgRTwyTk3hNcNi+GwPkx017VJWK2WjiVEnhSSb/9VagXZddxMdmjotoPJkQNQXwGQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=cy2iYVnf; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="cy2iYVnf" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O7L4kt000450; Wed, 24 Jan 2024 10:56:02 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PODMain02222019; bh=1 EeeXooNVx6FHXV/l/u+FrpuJmEB2sYqBuE8cmw6cKI=; b=cy2iYVnfuUaJwNrfg o82uQPhCayu+07iUBUxqbk3AKDbRptQr9aN+bD+sMo2RM+BA9Ut1rUCvj5JzisTG L/1zE5o9u5vRrk7f5YGDPqkYwx8icZKBZJlZRAGmz6cXw84c02/1d3Us6idhBqpk HGtpIj/e2f3sCH/0H9VbDscU7N5U36CedmtbQGmaVD3RV4+p9hKvQ0IGdZSFM1KD D32jjUdq1vEcYAQIZk2xZLJIuJhhB+NyPv53GkWGcqqJ2VkE/dVsjiOf5Y2ZO2xT QuX6rAEOaZAXuFRGp9hYR9o7N3muPTLaOLwXh/yFCHVK5bNsmxtAoJJakML5rTGY x+WqQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:01 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:58 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id E09E3820246; Wed, 24 Jan 2024 16:55:58 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 1/7] ASoC: cs42l43: Tidy up header includes Date: Wed, 24 Jan 2024 16:55:52 +0000 Message-ID: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 0k54TIZoG0mSAqSEBMAJHDWt6DsXDcRu X-Proofpoint-GUID: 0k54TIZoG0mSAqSEBMAJHDWt6DsXDcRu X-Proofpoint-Spam-Reason: safe Use more forward declarations, move header guards to cover other includes, and rely less on including headers through other headers. Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax --- sound/soc/codecs/cs42l43-jack.c | 5 +++++ sound/soc/codecs/cs42l43-sdw.c | 1 + sound/soc/codecs/cs42l43.c | 8 ++++++++ sound/soc/codecs/cs42l43.h | 19 ++++++++++--------- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c index 24a598f2ed9a3..1d8d7bf0a6b0d 100644 --- a/sound/soc/codecs/cs42l43-jack.c +++ b/sound/soc/codecs/cs42l43-jack.c @@ -6,19 +6,24 @@ // Cirrus Logic International Semiconductor Ltd. #include +#include #include #include #include #include #include #include +#include #include #include +#include +#include #include #include #include #include #include +#include #include #include "cs42l43.h" diff --git a/sound/soc/codecs/cs42l43-sdw.c b/sound/soc/codecs/cs42l43-sdw.c index 388f95853b699..60c00c05da055 100644 --- a/sound/soc/codecs/cs42l43-sdw.c +++ b/sound/soc/codecs/cs42l43-sdw.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index 6a64681767de8..f2332f90f8337 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -6,17 +6,25 @@ // Cirrus Logic International Semiconductor Ltd. #include +#include +#include #include #include #include #include +#include #include #include #include +#include #include +#include #include +#include #include +#include #include +#include #include #include #include diff --git a/sound/soc/codecs/cs42l43.h b/sound/soc/codecs/cs42l43.h index 125e36861d5d5..a491e9254568e 100644 --- a/sound/soc/codecs/cs42l43.h +++ b/sound/soc/codecs/cs42l43.h @@ -6,19 +6,14 @@ * Cirrus Logic International Semiconductor Ltd. */ -#include +#ifndef CS42L43_ASOC_INT_H +#define CS42L43_ASOC_INT_H + #include -#include #include -#include -#include #include -#include +#include #include -#include - -#ifndef CS42L43_ASOC_INT_H -#define CS42L43_ASOC_INT_H #define CS42L43_INTERNAL_SYSCLK 24576000 #define CS42L43_DEFAULT_SLOTS 0x3F @@ -37,6 +32,12 @@ #define CS42L43_N_BUTTONS 6 +struct device; +struct cs42l43; +struct snd_soc_component; +struct snd_soc_jack; +struct clk; + struct cs42l43_codec { struct device *dev; struct cs42l43 *core; From patchwork Wed Jan 24 16:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529417 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4951B7E574 for ; Wed, 24 Jan 2024 16:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115373; cv=none; b=dpb7Z4l8PYR/RJWd49QFfT7MQV1VFK+2nNNgiak3QUno0jG7W94ns54cD+n1v59kbb3/vx5KuRTXvRIbVzUkoaprnRlHbNZidS+CFz3FhsE77n0DHjOga/WjN+ZoLCoEAAuR0YOzKDTOc8IYWD/4ji6Qbj2ueY0KOkmIgVJPsFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115373; c=relaxed/simple; bh=Wy9pIpf6eX4Ri0vITNMjiPt6WEp/izVERkHt6NmTVHc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FCi3/jyoH1PmF4dHUT5beH+E2V4dKkjFVlZSYQl6ZjG8miOPMzTxSxWK74MgJ3i2D+syUvXWM2WFRjuU+HxM3RyUAW8/z3KcKBxjeUqbQSlDtCN4ZM6C7tWDsJ+cgs5qnXt3iwCGa/hGPRrkFks8fMMCZYm2IQn0jPjlKo0IUW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=DxhPMY4X; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="DxhPMY4X" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O6Pu37003749; Wed, 24 Jan 2024 10:56:02 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=0SF6Z1h2+pLbvBnKKBy2eO4gwbSn/AxvgqqTGIftTz0=; b= DxhPMY4XWTw9m5flg4w9qFfviAZqvbo9X8vEiVD/PVzv2p4gHjFOsD86EAOjipad u03xWhWikRLP6yJoFBHW3m1Rs2XhfmW01Kj/ugI/Co/pdsJytnKhjQiKh25NxL2a 9nsGVxAgynPiLik8ytU8RjxiROXvT0Aw6Dlmp0AMgiJYg1X6E2r8jBOBseHkoKEQ M/uRojNZnq8FgbMpcwRJyJ3wbbaHNedYqrdR0CjzL1gLGl7d5CuQxZG8W7I0hKLe sdW18JCDIO59YB3vPFG3brqlqjuLNeWXP7FsFgFsvPri8+77yNZ2xRHQ3CpoEuoM UFsjigjpuiFUL0bwxAWN4A== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:01 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:58 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id E2F3B820247; Wed, 24 Jan 2024 16:55:58 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 2/7] ASoC: cs42l43: Minor code tidy ups Date: Wed, 24 Jan 2024 16:55:53 +0000 Message-ID: <20240124165558.1876407-2-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> References: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: zZMzEbccrEhRRewhYAsYCuEx_dr1M6ea X-Proofpoint-GUID: zZMzEbccrEhRRewhYAsYCuEx_dr1M6ea X-Proofpoint-Spam-Reason: safe Add some missing commas, refactor a couple small bits of code. Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax --- sound/soc/codecs/cs42l43-jack.c | 8 ++++---- sound/soc/codecs/cs42l43.c | 12 ++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c index 1d8d7bf0a6b0d..d0569577a8699 100644 --- a/sound/soc/codecs/cs42l43-jack.c +++ b/sound/soc/codecs/cs42l43-jack.c @@ -29,11 +29,11 @@ #include "cs42l43.h" static const unsigned int cs42l43_accdet_us[] = { - 20, 100, 1000, 10000, 50000, 75000, 100000, 200000 + 20, 100, 1000, 10000, 50000, 75000, 100000, 200000, }; static const unsigned int cs42l43_accdet_db_ms[] = { - 0, 125, 250, 500, 750, 1000, 1250, 1500 + 0, 125, 250, 500, 750, 1000, 1250, 1500, }; static const unsigned int cs42l43_accdet_ramp_ms[] = { 10, 40, 90, 170 }; @@ -873,8 +873,8 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; unsigned int override = ucontrol->value.integer.value[0]; - BUILD_BUG_ON(ARRAY_SIZE(cs42l43_jack_override_modes) != - ARRAY_SIZE(cs42l43_jack_text) - 1); + static_assert(ARRAY_SIZE(cs42l43_jack_override_modes) == + ARRAY_SIZE(cs42l43_jack_text) - 1); if (override >= e->items) return -EINVAL; diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index f2332f90f8337..d418c0b0ce9aa 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -1059,12 +1059,10 @@ static int cs42l43_decim_get(struct snd_kcontrol *kcontrol, int ret; ret = cs42l43_shutter_get(priv, CS42L43_STATUS_MIC_SHUTTER_MUTE_SHIFT); - if (ret < 0) - return ret; + if (ret > 0) + ret = cs42l43_dapm_get_volsw(kcontrol, ucontrol); else if (!ret) ucontrol->value.integer.value[0] = ret; - else - ret = cs42l43_dapm_get_volsw(kcontrol, ucontrol); return ret; } @@ -1077,12 +1075,10 @@ static int cs42l43_spk_get(struct snd_kcontrol *kcontrol, int ret; ret = cs42l43_shutter_get(priv, CS42L43_STATUS_SPK_SHUTTER_MUTE_SHIFT); - if (ret < 0) - return ret; + if (ret > 0) + ret = snd_soc_get_volsw(kcontrol, ucontrol); else if (!ret) ucontrol->value.integer.value[0] = ret; - else - ret = snd_soc_get_volsw(kcontrol, ucontrol); return ret; } From patchwork Wed Jan 24 16:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529420 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97B007E782 for ; Wed, 24 Jan 2024 16:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115375; cv=none; b=ZGNq8g30FyP/g/QUg8B2grQOkOG4wvrlPCIzYudE58zp29Upd5wFgYqzAtkkRTy2Trp2KhrP0gJ8UYqPju/9z2KqAJL5rxGb4AXZ03klgWQkFqzbALtQD5vcFi347kDgAlDneaQOssonPXPetZJZ7407W7xY3ctFy9cDmzBBccE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115375; c=relaxed/simple; bh=rFXo5D5SioFkDyK6VjhPmdr1bMROSvMpZp+Tvd6jOS0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PwncMbikqYAGxtOe0gSyqkV31lM6QWk0BimFLPtI5GDNmkvK2ptm37RXU8w1dyTOGQJepy7eOUzGRh7mpGAWfgQ8qP459nMl0vhlI2c3tuad7vDRkVOx+3u0NX04SHBFFGjsHephZsTf+bRWaU5bIP0ZMjbJ1ewVkvWRdefMRD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=c291I6d4; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="c291I6d4" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O7L4kv000450; Wed, 24 Jan 2024 10:56:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=/bB0aWLQIcUMUN+oS7zZcyIt9YxzCPVG8bPGBsbkSkE=; b= c291I6d4a+NvHKcJuTAtmvHKkXG8bse2IpVDpZ/QOWFV1EEKA5KdH8SZ5vK6OAgA MwgA+EFdnaHdOlOt6M8CbalowrFtSHpCSg9yQSSxGQqHpmhH3y1J/f1KASJK0A0Z CWKpdEOLOFW6/Hd4fVRKLNYmKD202v3Ew4IiKXKewP/A/z/9Sg7cdm5+BYEkfurj gNxMGbiq2bjF484RxotHy+WCvg24v1CZLobjVt0hQfqqixeNUTnyZt/BIzFtuUG2 UwuZj1bP7KrV570S/sqbUQG+OMB0YHdRAIxeDfdsrL6BMWLxifp9tc8SMoTzbIoF Xmpsc+7/MwdSOt8e0n9Y2Q== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44s-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:03 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id E52D4820248; Wed, 24 Jan 2024 16:55:58 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 3/7] ASoC: cs42l43: Check error from device_property_read_u32_array Date: Wed, 24 Jan 2024 16:55:54 +0000 Message-ID: <20240124165558.1876407-3-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> References: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: o9VnvcpiXupZQOhTmdGd170qep8uftSS X-Proofpoint-GUID: o9VnvcpiXupZQOhTmdGd170qep8uftSS X-Proofpoint-Spam-Reason: safe Whilst reading cirrus,buttons-ohms the error from device_property_read_u32_array is not checked, whilst there is a preceding device_property_count_u32 which is checked the property read can still fail. Add the missing check. Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax Reviewed-by: Andy Shevchenko --- sound/soc/codecs/cs42l43-jack.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c index d0569577a8699..147c7017fd8b6 100644 --- a/sound/soc/codecs/cs42l43-jack.c +++ b/sound/soc/codecs/cs42l43-jack.c @@ -106,8 +106,13 @@ int cs42l43_set_jack(struct snd_soc_component *component, goto error; } - device_property_read_u32_array(cs42l43->dev, "cirrus,buttons-ohms", - priv->buttons, ret); + ret = device_property_read_u32_array(cs42l43->dev, "cirrus,buttons-ohms", + priv->buttons, ret); + if (ret < 0) { + dev_err(priv->dev, "Property cirrus,button-ohms malformed: %d\n", + ret); + goto error; + } } else { priv->buttons[0] = 70; priv->buttons[1] = 185; From patchwork Wed Jan 24 16:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529416 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3A847E76C for ; Wed, 24 Jan 2024 16:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115373; cv=none; b=l4p1fBL00KOyFIbKwcbSkY0KEBsY9UjOlz1W0tdaN/kYr004jkS7yOkkiWAGQI/rz3O7+jq+ylVO0I9h0mkAcRaq/vytR0pD6V1ixVqBOksqHlfaYmk1hZLbQGvCN8qHgb24YeVb8/HDpifF43w/WRknmtNNGDCiwRKBPv1p+sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115373; c=relaxed/simple; bh=5KNYbqRyLWNS+MwizZFGzQ2Dhc3qcL3+uy+mbhyjmQQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HeqoYjObvkToIkk85FG+HMPROnGkvmw83QNoR/ILC8uL2Wzm64gUAM9SEmd0CiA0wdUM7AHoVn9O8NXam4xWK7Snekjux3/fwsKZG+W2C/PsR2Bqaxtkl91TIPxRaXaXGvOW+jjSGcPYXKkVYtN520B3DhrVb7VXhP0ahJtqqPo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=C2DZNL38; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="C2DZNL38" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O7L4ku000450; Wed, 24 Jan 2024 10:56:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=uf+mIUoUA58TF7kJUpUzS/CCL6qpa30sbJehHm5UEGY=; b= C2DZNL3869BynGzES4XMwIeZV5DIX8kT1T+sdkn3e7f7lz7y+pgxcLFw1G5GASUJ u3KTZuEHN1QscfQ+Vwe4Gcw8+TdEPIH24GrwcH0Ae5cctk67PwZ+NTh2VHdZeor0 jxofYfiLv3JRvBWqx5PVlP0es3GP0ET4jvP7bm4Z95SY4jC7Ea5fQR3/bmDHLdbb kgn2Fh7dQKytLWsLCUrGcUico+3pVl2+QWwkkVvbZnBpVmgSBojigox89hvdXvFg xWZZuNKc/MFtN0bCwG1D16gIWCm8ZdfZgPvU3i9OfGR3AlziaDpo7se4MJ1E6rms kkzRfQw01r1obI59rPFcPA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44s-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:02 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id F0E99820249; Wed, 24 Jan 2024 16:55:58 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 4/7] ASoC: cs42l43: Add pm_ptr around the power ops Date: Wed, 24 Jan 2024 16:55:55 +0000 Message-ID: <20240124165558.1876407-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> References: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: PIQDtVSCP88wy5j6gbUIAiHCFud6VbJN X-Proofpoint-GUID: PIQDtVSCP88wy5j6gbUIAiHCFud6VbJN X-Proofpoint-Spam-Reason: safe Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax --- sound/soc/codecs/cs42l43.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index d418c0b0ce9aa..1852cb072bd0e 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -2349,7 +2349,7 @@ MODULE_DEVICE_TABLE(platform, cs42l43_codec_id_table); static struct platform_driver cs42l43_codec_driver = { .driver = { .name = "cs42l43-codec", - .pm = &cs42l43_codec_pm_ops, + .pm = pm_ptr(&cs42l43_codec_pm_ops), }, .probe = cs42l43_codec_probe, From patchwork Wed Jan 24 16:55:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529421 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 735DE7E772 for ; Wed, 24 Jan 2024 16:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115375; cv=none; b=lf0FsK8i4s7hnUSLmcD3R1ZRU+k2Ke9FGv2smh83/RiOdOa8mxMmUSMyVhMdfBZS6h+OGmQ/nrybzhtQIIcQ6/f4tpKRtzpXFDOqKJGAF/wvvDzRRza6CDuKreckri3KN4IPnEJpaFgFljgDFUd08iN+C0vVvC9wPUVwPvvyzYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115375; c=relaxed/simple; bh=Q598g3ES9DwULDvPn3Tu0gZTULbU0YAUntODedh3iwg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qe+uRv4MXDlIOFoVolKFSt7xsz4SV1dxW69Q5EsbnS63vAPLUV3ALfzive+0dL9XkBwSxAoCOHx53p0Xc5G+3JMeYeksWdmXgN/n3uDTjLjsX4XMvH67bBas8gbxLmN6u8gAKoiFV50PHa0M8RI1tJtacJa39Gdt3BrbkXLsmgk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=LAb8MMgJ; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="LAb8MMgJ" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O7L4kw000450; Wed, 24 Jan 2024 10:56:04 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=przA4QwCommAhJfz+ziW6gvkL1al7pQyEzCeV5NJhkc=; b= LAb8MMgJ3s/tPLDHUmCmCEB2Ls9H3/Mm9L4bfGp/fn+Zt5vDzgmwT/XrgKZLIRYJ gI2VQy+wUmAxFiJthAoT9/WzZOkmHdru+j0MemFpwsCGfD2XRHmBbeB5U9XvsauR jxcSGpuotFaReh6CJvFyfaz2UqmGkquH13ITygF6mTi9YCQbK+8ZDienMRUP2DKN Ia1+ZufRjF8J5JvpcO+MVrfK20ks4qLqisgbYoLAq4zP5poBPXknQmBdWM0PArN/ 26fQYz3Kae7wGxpGaagNKAK8BJ243C28fm4wLcsAto38KUjml5c1+xz8cE5V9/5i hqVV5XtTn66HZidxWAkI+Q== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44s-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:04 -0600 (CST) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 0911782024A; Wed, 24 Jan 2024 16:55:59 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 5/7] ASoC: cs42l43: Use USEC_PER_MSEC rather than hard coding Date: Wed, 24 Jan 2024 16:55:56 +0000 Message-ID: <20240124165558.1876407-5-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> References: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Sc98E8Olr60-OpbYMNmPfSJRpSv6PJAM X-Proofpoint-GUID: Sc98E8Olr60-OpbYMNmPfSJRpSv6PJAM X-Proofpoint-Spam-Reason: safe Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax Reviewed-by: Andy Shevchenko --- sound/soc/codecs/cs42l43-jack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c index 147c7017fd8b6..4bcf66cff566a 100644 --- a/sound/soc/codecs/cs42l43-jack.c +++ b/sound/soc/codecs/cs42l43-jack.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -647,7 +648,7 @@ static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic) static int cs42l43_run_type_detect(struct cs42l43_codec *priv) { struct cs42l43 *cs42l43 = priv->core; - int timeout_ms = ((2 * priv->detect_us) / 1000) + 200; + int timeout_ms = ((2 * priv->detect_us) / USEC_PER_MSEC) + 200; unsigned int type = 0xff; unsigned long time_left; From patchwork Wed Jan 24 16:55:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529418 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94B6F7E776 for ; Wed, 24 Jan 2024 16:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115374; cv=none; b=FiORixeo6goN5u7S6JWvxt62+mnnz+oJpDs6T8+abn+lwzrCnf3eS4b5266UOeFfVSdXcXnmvCGrh8M7NAbJrZNQb3So9y5IL1269thXdQLv5rMgg6dTouvKMZYmcqgBL7CnZYboiJn4ODahOrU5hqv6q+N0e+rK6FEKkRX9QnE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115374; c=relaxed/simple; bh=wxtf97Sxw5G039m04Tp+rFCFkJ640+gy+kvY5O170Mc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D+VxfHnQTp0JOpmQ3TDuSOWus7W4/iGO70dIIduVCychLBq4hlyG6p/z85nalKjYIk9BLA0LGsFUO8TwXI+INmpXdrb9cUXqdX7zH5l2Y0CmLZ0lMYLlbd2jaEZzuS7HcdtrED0flNP4DUoTs6hiW/9BcB/6Vbbfe6ACQBN19FQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=MQpST+QA; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="MQpST+QA" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O6Pu38003749; Wed, 24 Jan 2024 10:56:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=ZzQMAAWOXu0vUBEJnnr8IfbgwcLjZg00jUj7hF5DxuM=; b= MQpST+QAGvydOF5NrLlR3DclXvnt0CDt4qvzDoAJj0UiI5AGk6q7ShhqRypA3CtV uxwocwWTAnM2ZkR70r6O5r2i8tq6jpCPopAEmxCL766R6jZ8nitFvqxLB8how/6r huI6USEX7na9f38ewMFj/1oDzCJ/VmTiBhsPdwWLXc4jjl4TkB8gCdsPxizupfP9 kI0R7llHoO0gr7OSitLd7rwNmCzmGePLh89vEoGmW6+OTs55V9BTJNNo1xcpNvve cN0NcHdk1AL74/q5bikMCe+r+RY6YJBWeFSbsOpwpoadfTkLEUNrukgPgFmHl19I 5+gZ+uuvZIthL4PYIzFgkA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44r-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:02 -0600 (CST) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 1532382024B; Wed, 24 Jan 2024 16:55:59 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 6/7] ASoC: cs42l43: Refactor to use for_each_set_bit Date: Wed, 24 Jan 2024 16:55:57 +0000 Message-ID: <20240124165558.1876407-6-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> References: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: TTkhn6GQgW9qAi99FLDbHR2rRIJAhX2S X-Proofpoint-GUID: TTkhn6GQgW9qAi99FLDbHR2rRIJAhX2S X-Proofpoint-Spam-Reason: safe Refactor the code in cs42l43_mask_to_slots to use for_each_set_bit. Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax --- sound/soc/codecs/cs42l43.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index 1852cb072bd0e..05ca20d4fd622 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -6,10 +6,12 @@ // Cirrus Logic International Semiconductor Ltd. #include +#include #include #include #include #include +#include #include #include #include @@ -547,23 +549,22 @@ static int cs42l43_asp_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return 0; } -static void cs42l43_mask_to_slots(struct cs42l43_codec *priv, unsigned int mask, int *slots) +static void cs42l43_mask_to_slots(struct cs42l43_codec *priv, + unsigned long mask, int *slots) { - int i; + int i = 0; + int slot; - for (i = 0; i < CS42L43_ASP_MAX_CHANNELS; ++i) { - int slot = ffs(mask) - 1; - - if (slot < 0) + for_each_set_bit(slot, &mask, sizeof(mask) * BITS_PER_BYTE) { + if (i == CS42L43_ASP_MAX_CHANNELS) { + dev_warn(priv->dev, "Too many channels in TDM mask: %lx\n", + mask); return; + } - slots[i] = slot; - - mask &= ~(1 << slot); + slots[i++] = slot; } - if (mask) - dev_warn(priv->dev, "Too many channels in TDM mask\n"); } static int cs42l43_asp_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, From patchwork Wed Jan 24 16:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Keepax X-Patchwork-Id: 13529419 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEF777E76D for ; Wed, 24 Jan 2024 16:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.149.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115374; cv=none; b=HcTICNRAPbSCksUjJTm8gjwjgHFtoohABs1dXQxwNyTJCjhjtyJ7YxK8KtfteAC8PgQlq00T+8d23LK5WhysRm78XpELTTbr4UiRB4AWt0/cHPrKm2oESsGgXjSUHLp6hOVCLwlsvrehl2t1yWD6+d+iuKemQQ5pzhVu/v+etb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706115374; c=relaxed/simple; bh=/pWbttwiVFqyzU/ga3b2z9b+79klev0KH/busw3OVWc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d46E2CYVhjn1JHDBQHDizRykU0B23zNkUjYhrxUP6SwbIJ8Kk5SFlJAXcugsQnvxhUcI22sWYvqR6zaA9wLvudV14S0T5cbNemO5a7gqFNE+9nFQ0v+106a5CRezsa1yGuJ5uh0gBlFnjxhos+enlxFrezAbMRQcuVaU7R9r/1o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=ZgjyqDES; arc=none smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="ZgjyqDES" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40O6Pu39003749; Wed, 24 Jan 2024 10:56:03 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=nlLlsNCSpaOmPb1UHn6JHOCtAJ0NsxCp2Jj9FnLQWWU=; b= ZgjyqDESZK8q5cg5lJzyAFGWpTSIMLgsX2/WaGNbholUx76JADOerFkz04pX5LQz y20Mbn3/w9lHNXD4k0b3cU+Tl712MPLKFcJk7Z4qiYni0W416J5b7kXI+8r/SBC8 kva1WB9VEMcjyvknEevB2wuKNlv0q3kq/D7jFw6acC4Qb8HHWvMcO1pgIUY5Kjiy vfv97Mo7VqG3UX1Af+IWz+sLoCXVGBxTZyqeLRwBfLYtj1gF+iwapT5CvakNABnO X9WWrYuZgP1vtVb6aQEUOevoJgrBVIQzBZtFFgts1Ete9UwCfsGeKzfYZiNvveOf 5CU1ztVqlzIL6F6BBE7uCQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmfhh44r-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Jan 2024 10:56:03 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40 via Frontend Transport; Wed, 24 Jan 2024 16:55:59 +0000 Received: from ediswws07.ad.cirrus.com (ediswws07.ad.cirrus.com [198.90.208.14]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 18122820270; Wed, 24 Jan 2024 16:55:59 +0000 (UTC) From: Charles Keepax To: CC: , , , , Subject: [PATCH 7/7] ASoC: cs42l43: Use fls to calculate the pre-divider for the PLL Date: Wed, 24 Jan 2024 16:55:58 +0000 Message-ID: <20240124165558.1876407-7-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> References: <20240124165558.1876407-1-ckeepax@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 934ndI-eOfSMlnBIa0sWJ-vOVgV6wF3O X-Proofpoint-GUID: 934ndI-eOfSMlnBIa0sWJ-vOVgV6wF3O X-Proofpoint-Spam-Reason: safe Suggested-by: Andy Shevchenko Signed-off-by: Charles Keepax --- sound/soc/codecs/cs42l43.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c index 05ca20d4fd622..ef154aa76d576 100644 --- a/sound/soc/codecs/cs42l43.c +++ b/sound/soc/codecs/cs42l43.c @@ -1336,10 +1336,9 @@ static int cs42l43_enable_pll(struct cs42l43_codec *priv) dev_dbg(priv->dev, "Enabling PLL at %uHz\n", freq); - while (freq > cs42l43_pll_configs[ARRAY_SIZE(cs42l43_pll_configs) - 1].freq) { - div++; - freq /= 2; - } + div = fls(freq) - + fls(cs42l43_pll_configs[ARRAY_SIZE(cs42l43_pll_configs) - 1].freq); + freq /= 1 << div; if (div <= CS42L43_PLL_REFCLK_DIV_MASK) { int i;