From mboxrd@z Thu Jan 1 00:00:00 1970 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 EF5CF14F9FB; Mon, 24 Mar 2025 08:13:22 +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=1742804003; cv=none; b=VGtB8jq5vfN4Loww1P2ZxChKGeCSu56/RHoe8yFrxDu3RXtrWFyY2V4N0O/pKhqsgMembc0RXNo0bieEfvnXmPcSSAzojhdrCRyiTNQZidJtyfTVtleUT3068LgSm/HyCKhtUsltOJjNlMshhoddcgHOtazxG1jo84JOcqjWmPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742804003; c=relaxed/simple; bh=E39d+lttBV/+aG+RVDxp3Vp3axsJukiiE8ph8/Qv0vo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tdXpbu3e6zLp1CzJMZTPDGXRRIZcuZtbszxtUMl9xLCyfRLqjVFwn94DfV2MAEGPfX484kVw/kc++Ti6ETIRl/k9XrMb9O7XcMS9hJcT1CbKHOErzkKjmAbyJJEp/ktp7XmOeTlf9tXUgogbAhI2hahNMgYZE1UopNaFXHRntxI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EXyUc87S; 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="EXyUc87S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A35DC4CEDD; Mon, 24 Mar 2025 08:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742804002; bh=E39d+lttBV/+aG+RVDxp3Vp3axsJukiiE8ph8/Qv0vo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EXyUc87SzfL70lsGZtGdygVrxoGNYigJRRki3STcdq3jiTrWllYAgd8LMvZeiXM+T 6RwrRmKw3iqD+fPWUztn8QB+Hw/eGxzfQ+e4NR+xy3l7M6Kb5wmH0t8W7wPIkdaSVe mgUCDbJRusQGoJOfBpFEWoFOU/I+KY46CjquELUS3IJWzDMQ9E1IO/vKipkrJS7kPt cVtjC4kwXRS2KQHm9oMH8R4na1BbKFWbnPyI9TXmc3dKOSIpbWe6JKXPpbOQ06Sz/5 UaENBe0IGQ6aroBqPxC3WWuZn8iYSxL06yOafDK+ojpIsptavxWZvrcXDRZNNp9HXP hjKq0MRq3RF0w== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1twcvw-000000004Ev-2Kpu; Mon, 24 Mar 2025 09:13:21 +0100 Date: Mon, 24 Mar 2025 09:13:20 +0100 From: Johan Hovold To: Steev Klimaszewski Cc: "Peng Fan (OSS)" , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Linus Walleij , Bartosz Golaszewski , Srinivas Kandagatla , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-msm@vger.kernel.org, Peng Fan Subject: Re: [PATCH 2/3] ASoC: codec: wcd938x: Convert to GPIO descriptors Message-ID: References: <20250324-wcd-gpiod-v1-0-27afa472e331@nxp.com> <20250324-wcd-gpiod-v1-2-27afa472e331@nxp.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sun, Mar 23, 2025 at 10:40:51PM -0500, Steev Klimaszewski wrote: > On Sun, Mar 23, 2025 at 9:28 PM Peng Fan (OSS) wrote: > > > > From: Peng Fan > > > > of_gpio.h is deprecated, update the driver to use GPIO descriptors. > > - Use dev_gpiod_get to get GPIO descriptor. > > - Use gpiod_set_value to configure output value. > > > > With legacy of_gpio API, the driver set gpio value 0 to assert reset, > > and 1 to deassert reset. And the reset-gpios use GPIO_ACTIVE_LOW flag in > > DTS, so set GPIOD_ASIS when get GPIO descriptors, and set value 1 means > > output low, set value 0 means output high with gpiod API. > > > > Signed-off-by: Peng Fan > > @@ -3251,9 +3250,9 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device > > struct wcd_mbhc_config *cfg = &wcd938x->mbhc_cfg; > > int ret; > > > > - wcd938x->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpios", 0); > > - if (wcd938x->reset_gpio < 0) > > - return dev_err_probe(dev, wcd938x->reset_gpio, > > + wcd938x->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_ASIS); > > + if (IS_ERR(wcd938x->reset_gpio)) > > + return dev_err_probe(dev, PTR_ERR(wcd938x->reset_gpio), > > "Failed to get reset gpio\n"); > > > > wcd938x->us_euro_gpio = devm_gpiod_get_optional(dev, "us-euro", > > @@ -3297,10 +3296,10 @@ static int wcd938x_populate_dt_data(struct wcd938x_priv *wcd938x, struct device > > > > static int wcd938x_reset(struct wcd938x_priv *wcd938x) > > { > > - gpio_direction_output(wcd938x->reset_gpio, 0); > > + gpiod_set_value(wcd938x->reset_gpio, 1); This may be what is causing the regression; the driver no longer configures the reset line as an output. From the docs: * GPIOD_ASIS or 0 to not initialize the GPIO at all. The direction must be set later with one of the dedicated functions. > > /* 20us sleep required after pulling the reset gpio to LOW */ > > usleep_range(20, 30); > > - gpio_set_value(wcd938x->reset_gpio, 1); > > + gpiod_set_value(wcd938x->reset_gpio, 0); > > /* 20us sleep required after pulling the reset gpio to HIGH */ > > usleep_range(20, 30); > With this patchset applied, the wcd938x codec used in the Thinkpad > X13s stops working: > > wcd938x_codec audio-codec: soundwire device init timeout > wcd938x_codec audio-codec: ASoC: error at snd_soc_component_probe on > audio-codec: -110 > snd-sc8280xp sound: ASoC: failed to instantiate card -110 > snd-sc8280xp sound: probe with driver snd-sc8280xp failed with error -110 Johan