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: 114738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10419032vqr; Fri, 30 Jun 2023 07:40:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlF9kfB1Kcdd1mrBUily+CXvrPkwk/iz3nlJcUfRaP6U4n+Dr1qXJ1LSjL+C5QudBDRTpzKs X-Received: by 2002:a17:90b:2551:b0:263:a37:fcc3 with SMTP id nw17-20020a17090b255100b002630a37fcc3mr2098157pjb.5.1688136055301; Fri, 30 Jun 2023 07:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688136055; cv=none; d=google.com; s=arc-20160816; b=RKDRk6SRmVKYs0d1Gpkholm2X3MWzoa0xTs8OmGbBG/meXcYHg1QqMLDAlnIQnOa6J BD1Hm7K2mqnRAUTNsk9HPwrPw5njbNl5N1AJmYX1r7HBLbCv3TwPV1FKDzeAReMPPuMo F3u2oho73f121bcYKxZbO4qfx38xWAX9WKiPbuS3YjQJXFIZ12utFDMOljKyJlzDMcbf 4J0rL/R8DgM4FajKlzBT65z+94Wrjg41zMLFP71PvfFrLv2KEX7Tt04IYI3DYjOkXyMP FawFVefR4YtDCz1iaEUyi4vYRFtO8JqkQsb3dJaNk7gs14JPpSP+Ap1tukcEY0tAVS1o pu+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=m+7yl9ujpfdqfQH67tzVsP9io5DxMZctSHuxh5Dt77k=; fh=0TkepFmYXz4U6PH+EYFSuuWUUWn95KEjZbqs8NbnrCg=; b=G+f1Op97F1Go3xmw07dD1/47xx6SvdJ92ufzX3o3sDT+aCyIcgvHMx1AaDbFfOLP08 b6pk4CnwvM8pYZygcgoTfo54bBscQN8rzozH6846z1q8vd/DHEon/gqSL+BhYEn6B7fX b+WoWNVW3twwnjEZKFl93NxW7q/wFKj1QgAC68XQaJfOiLUu2s6R4vpQSCqE0I+Oo2c8 vgfXg4gr9uFQUFVNsS2i6pz3YR55hQ8QQJlp+EbRx88dedVLB1L2w3CQ+e+ptCXQ23Qf RzGzjbArxXPdS2OWEGLdXjNXM851FA4j/2QhkcKAyFKCq0fP1xpWoHRtmzoX6QhPYUpZ o63Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D424TjQi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a17090a08cd00b00263355e8183si5460194pjn.114.2023.06.30.07.40.40; Fri, 30 Jun 2023 07:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D424TjQi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232176AbjF3O1p (ORCPT + 99 others); Fri, 30 Jun 2023 10:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231675AbjF3O1Y (ORCPT ); Fri, 30 Jun 2023 10:27:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1114935AF for ; Fri, 30 Jun 2023 07:27:23 -0700 (PDT) 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 D61B061771 for ; 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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770138952006006147?= X-GMAIL-MSGID: =?utf-8?q?1770138952006006147?= 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);