From patchwork Fri Jun 30 14:27:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 13299725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F8B8EB64DC for ; Mon, 3 Jul 2023 08:35:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3A8ACA4E; Mon, 3 Jul 2023 10:34:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3A8ACA4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688373308; bh=P6YVdCFm2ZOkpCnCJ7xlyVk9dprYs6KAI7jlHUrVE5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=JW2Rx2gpekzR/K3ksog3vwUqs9Y3a579Mo58q+nRqAw2d7uZRUW//W2k+hryjYN3z Ge9G7vjhbVZdonyBqlj7zgOK4zql+5OS7qnPTDfNoUd66vgbKZ1YegvssiKH481Lx+ 75tTXBGBzV1hf4FzazymNqx8mMxhXP8U6JNBXA4s= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 39C9AF805BE; Mon, 3 Jul 2023 10:32:38 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D1CB0F805BE; Mon, 3 Jul 2023 10:32:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 81241F80124; Fri, 30 Jun 2023 16:27:34 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 28157F8051E for ; Fri, 30 Jun 2023 16:27:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 28157F8051E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=D424TjQi Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D13346176C; Fri, 30 Jun 2023 14:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B36E4C433CD; Fri, 30 Jun 2023 14:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688135238; bh=P6YVdCFm2ZOkpCnCJ7xlyVk9dprYs6KAI7jlHUrVE5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D424TjQiXcZcj4i/3v89N3a4BuqKXQtLcEZgEl+wCzeh7iNUv9wFPGkfd+0jwWfcF p4pMrS4+tXjRGn/TwKglozLY4ew3h/f+zgCLPdyKpxacvKwkQA1ab0X9/DTvw15rGy 2SzNG29ZYSKYlrOtNDqgn3Y0WMNdqhEPRR3xPTg4Y9ZUzgjl1j7bPYSboYsYysFPHY +rMGkUb3Kg96Cul1BwADFXFtywQbLLUwaJUL0T0bS+qPNzIgEJz0lDRm/Sd5uu1olg 04l1NbsWscLKr++r95aPcKmkuLf90puLbVydfB0tcAUzmSQeKxeFhputmq4UrPxsrk qBS6Ed5P+q0tA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1qFF5p-0001OS-Ds; Fri, 30 Jun 2023 16:27:25 +0200 From: Johan Hovold To: Mark Brown , Srinivas Kandagatla Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 3/5] ASoC: codecs: wcd938x: use dev_printk() for impedance logging Date: Fri, 30 Jun 2023 16:27:15 +0200 Message-Id: <20230630142717.5314-4-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230630142717.5314-1-johan+linaro@kernel.org> References: <20230630142717.5314-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-MailFrom: johan+linaro@kernel.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: D5CVOO3K67LRA6M74DTOAG2F7EHL3FLB X-Message-ID-Hash: D5CVOO3K67LRA6M74DTOAG2F7EHL3FLB X-Mailman-Approved-At: Mon, 03 Jul 2023 08:32:30 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Pass the component structure also to the wcd938x_mbhc_get_result_params() helper so that the component device can be used for logging consistently. Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd938x.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 5ce15b622a91..ddefe4af0b1e 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2124,10 +2124,11 @@ static int wcd938x_mbhc_micb_ctrl_threshold_mic(struct snd_soc_component *compon return wcd938x_mbhc_micb_adjust_voltage(component, micb_mv, MIC_BIAS_2); } -static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, +static void wcd938x_mbhc_get_result_params(struct snd_soc_component *component, s16 *d1_a, u16 noff, int32_t *zdet) { + struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); int i; int val, val1; s16 c1; @@ -2154,8 +2155,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, usleep_range(5000, 5050); if (!c1 || !x1) { - pr_err("%s: Impedance detect ramp error, c1=%d, x1=0x%x\n", - __func__, c1, x1); + dev_err(component->dev, "Impedance detect ramp error, c1=%d, x1=0x%x\n", + c1, x1); goto ramp_down; } d1 = d1_a[c1]; @@ -2165,8 +2166,8 @@ static void wcd938x_mbhc_get_result_params(struct wcd938x_priv *wcd938x, else if (x1 < minCode_param[noff]) *zdet = WCD938X_ZDET_FLOATING_IMPEDANCE; - pr_debug("%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", - __func__, d1, c1, x1, *zdet); + dev_dbg(component->dev, "%s: d1=%d, c1=%d, x1=0x%x, z_val=%d (milliohm)\n", + __func__, d1, c1, x1, *zdet); ramp_down: i = 0; while (x1) { @@ -2210,7 +2211,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, WCD938X_ANA_MBHC_ZDET, 0x80, 0x80); dev_dbg(component->dev, "%s: ramp for HPH_L, noff = %d\n", __func__, zdet_param->noff); - wcd938x_mbhc_get_result_params(wcd938x, d1_a, zdet_param->noff, &zdet); + wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); regmap_update_bits(wcd938x->regmap, WCD938X_ANA_MBHC_ZDET, 0x80, 0x00); @@ -2224,7 +2225,7 @@ static void wcd938x_mbhc_zdet_ramp(struct snd_soc_component *component, WCD938X_ANA_MBHC_ZDET, 0x40, 0x40); dev_dbg(component->dev, "%s: ramp for HPH_R, noff = %d\n", __func__, zdet_param->noff); - wcd938x_mbhc_get_result_params(wcd938x, d1_a, zdet_param->noff, &zdet); + wcd938x_mbhc_get_result_params(component, d1_a, zdet_param->noff, &zdet); regmap_update_bits(wcd938x->regmap, WCD938X_ANA_MBHC_ZDET, 0x40, 0x00);