From nobody Fri Dec 19 16:00:45 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1ACCD27A13F; Tue, 15 Apr 2025 07:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744702926; cv=none; b=mCvBh2A1vp/N/L77KF90LjK/iS9xROcJhSCt6tqKZ/ryTLBJm8iCUcwrGxf91YoTJLBRSRLp/jVgoV9wSkGrn9TcTL/jNviKZHZ0axIKfzaqNtEPL9JSxH5vx2DShACGwjU9JBJRPpnbtK0UIFITgBRyHwqp9uGeNm1TQgDxOsw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744702926; c=relaxed/simple; bh=NnA1MjE1iS6qh1kJ4h8uRlhFyDx9zS+qVFI5xM9AivY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O3UZmoTQzF52GV+AhLAq3YVYSOsKh2myLA6iTjNn8gZmZ+1EJQUGtX8nR+E1BV3aUzM2irn59CDz45Pjy98fMk5OuxGpzyTbnlCTbH4tPNsnt8ttC9fsWQJtDMUcGKLQz3Ib0acuGexBadp1dInscs8BPb9UuvNLk8UJF0ktOc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UzytD6AH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UzytD6AH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B02B1C4CEED; Tue, 15 Apr 2025 07:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744702925; bh=NnA1MjE1iS6qh1kJ4h8uRlhFyDx9zS+qVFI5xM9AivY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UzytD6AHr9B5rgzeHRkdAHcgxDZaa0zv+755PTpNfXnXowsH2z9m7xl69U8Ujr+AJ MOOISO8HVYn6yucLa0CIQiZ5IHuHnHRDRutdsPFgPp825udbuzO8CgYhJhpQwlr2Qz W3ey1yeVckD9+LKRBp0S3mCVsLtzeY2aCJQ7NX3n4/Q7UXGufKblmGgTbBIcGb8ONs i5wRPRMwq5WuUp+141/FfdwDrFaHU7wy/Y8E5t6EUk0a9N3xiLgqHA0KuZ7ZCKep4S n8P8fRjlRGS3FYIfvkVL04RseJ2yVwdCMzr6ZhFWPeLWQaeJG7epKA05JTZBzRboma 7m+Wzfj0z+pWQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1u4avi-000000001se-0Fwd; Tue, 15 Apr 2025 09:42:02 +0200 From: Johan Hovold To: Mark Brown Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Peter Rosin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 1/2] ASoC: codecs: wcd938x: fix mux error handling Date: Tue, 15 Apr 2025 09:41:44 +0200 Message-ID: <20250415074145.7202-2-johan+linaro@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250415074145.7202-1-johan+linaro@kernel.org> References: <20250415074145.7202-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A recent change added support for looking up an optional mux control before falling back to gpio control for us-euro plug selection. The mux framework does however not yet support optional muxes and an error message is now incorrectly logged on machines like the Lenovo ThinkPad X13s which do not have one: wcd938x_codec audio-codec: /audio-codec: failed to get mux-control (0) Suppress the bogus error and add the missing mux error handling by making sure that the 'mux-controls' DT property is present before looking up the mux control. Fixes: eec611d26f84 ("ASoC: codecs: wcd938x: add mux control support for hp= audio mux") Link: https://lore.kernel.org/lkml/Z-z_ZAyVBK5ui50k@hovoldconsulting.com/ Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd938x.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 585a92772c2a..55031c16e4e1 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3271,18 +3271,13 @@ static int wcd938x_populate_dt_data(struct wcd938x_= priv *wcd938x, struct device return dev_err_probe(dev, wcd938x->reset_gpio, "Failed to get reset gpio\n"); =20 - wcd938x->us_euro_mux =3D devm_mux_control_get(dev, NULL); - if (IS_ERR(wcd938x->us_euro_mux)) { - if (PTR_ERR(wcd938x->us_euro_mux) =3D=3D -EPROBE_DEFER) - return -EPROBE_DEFER; + if (of_property_present(dev->of_node, "mux-controls")) { + wcd938x->us_euro_mux =3D devm_mux_control_get(dev, NULL); + if (IS_ERR(wcd938x->us_euro_mux)) { + ret =3D PTR_ERR(wcd938x->us_euro_mux); + return dev_err_probe(dev, ret, "failed to get mux control\n"); + } =20 - /* mux is optional and now fallback to using gpio */ - wcd938x->us_euro_mux =3D NULL; - wcd938x->us_euro_gpio =3D devm_gpiod_get_optional(dev, "us-euro", GPIOD_= OUT_LOW); - if (IS_ERR(wcd938x->us_euro_gpio)) - return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio), - "us-euro swap Control GPIO not found\n"); - } else { ret =3D mux_control_try_select(wcd938x->us_euro_mux, wcd938x->mux_state); if (ret) { dev_err(dev, "Error (%d) Unable to select us/euro mux state\n", ret); @@ -3290,6 +3285,11 @@ static int wcd938x_populate_dt_data(struct wcd938x_p= riv *wcd938x, struct device return ret; } wcd938x->mux_setup_done =3D true; + } else { + wcd938x->us_euro_gpio =3D devm_gpiod_get_optional(dev, "us-euro", GPIOD_= OUT_LOW); + if (IS_ERR(wcd938x->us_euro_gpio)) + return dev_err_probe(dev, PTR_ERR(wcd938x->us_euro_gpio), + "us-euro swap Control GPIO not found\n"); } =20 cfg->swap_gnd_mic =3D wcd938x_swap_gnd_mic; --=20 2.49.0 From nobody Fri Dec 19 16:00:45 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DC99A2741D2; Tue, 15 Apr 2025 07:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744702926; cv=none; b=LbuOYAr1gczPjN+xnOKEMQ3z6/XJaypvhXhVSRwd4DAUnoph8qeVMQ4RR1itK3sl9+9IsBI4Jg/oeR6dJXM4H83pOoGg1iRjhwctVGUDJJIcPIYj6ohavQ6TROp1BtGpy3+QmIk6JLE/PjTgk78irX6U5n4Ud6abg9bGtaQn/ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744702926; c=relaxed/simple; bh=WdZ2M4MN5sOyCFES6rqpJQ8kGAODCf2hpo5rXfxebgc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pxXUTr34ZPMlbvoQGMoDxisb1XgFNQfLi8gxv/uIXBgr6iwQw76h0w9YThj+NkUKUYWmOQ30Nady8VYo5cs8cDF+HuNupAak6MvonA//un2rM+vWAT5ZgmvMEhIKJCtG3TW53yc72Oh0q2hY/HGYuaKbFAgrKV9SYGy2j5CLh5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kRVlMHtE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kRVlMHtE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AB99C4CEDD; Tue, 15 Apr 2025 07:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744702925; bh=WdZ2M4MN5sOyCFES6rqpJQ8kGAODCf2hpo5rXfxebgc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRVlMHtExBrNPupjMnjtNdYq/UxGF7x5aA1lvT1cOQFZLTVN+JMPNnEGntsUf1c6x aCG0iSfmNDVrcGBLYri0a6ZLTNKEL6eglgwyiwiu6mWj71rSx6fDgfN3zK3q/s0QrE z4L0G7Dt5ckIzPONmFfyzWUTDvFNXt4egjE00+VlIGauRqBBmt1aREUwkdvJUTlhvV 85iXbPwwmafa9hRBqADpk7MwGKsJLqucQHRDfUtz+Ltw48OqtK2zVQacZ3yFMj7L2z Vt/cBkhAqqfUkZkr6J4QqI/yQnUCenoMCGdkejJt/wkRwyEtVixSEVjMOqLHdigrSl W/2jTPrCyNKiQ== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1u4avi-000000001sg-0Yml; Tue, 15 Apr 2025 09:42:02 +0200 From: Johan Hovold To: Mark Brown Cc: Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Srinivas Kandagatla , Peter Rosin , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 2/2] ASoC: codecs: wcd938x: drop unnecessary mux flag assignment Date: Tue, 15 Apr 2025 09:41:45 +0200 Message-ID: <20250415074145.7202-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250415074145.7202-1-johan+linaro@kernel.org> References: <20250415074145.7202-1-johan+linaro@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The codec driver data is allocated using kzalloc() so there's no need to clear the mux setup flag when mux selection fails during probe. Signed-off-by: Johan Hovold --- sound/soc/codecs/wcd938x.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 55031c16e4e1..8c9f67dedb83 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3281,7 +3281,6 @@ static int wcd938x_populate_dt_data(struct wcd938x_pr= iv *wcd938x, struct device ret =3D mux_control_try_select(wcd938x->us_euro_mux, wcd938x->mux_state); if (ret) { dev_err(dev, "Error (%d) Unable to select us/euro mux state\n", ret); - wcd938x->mux_setup_done =3D false; return ret; } wcd938x->mux_setup_done =3D true; --=20 2.49.0