* [PATCH v4 0/2] Add reset-gpios handling for max98927
@ 2021-10-07 2:38 Alejandro Tafalla
2021-10-07 2:38 ` [PATCH v4 1/2] ASoC: max98927: Handle reset gpio when probing i2c Alejandro Tafalla
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Alejandro Tafalla @ 2021-10-07 2:38 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Andy Shevchenko, Péter Ujfalusi,
~postmarketos/upstreaming, alsa-devel, linux-kernel
Cc: Alejandro Tafalla, Rob Herring, Jaroslav Kysela, Takashi Iwai,
devicetree
The max98927 codec on some devices (i.e. Xiaomi Mi A2 Lite phone) requires
hardware-resetting the codec by driving a reset-gpio. This series adds
support for it through an optional reset-gpios property.
v4:
* Correctly assert/deassert the GPIO states
* Wait for the i2c port to be ready after reset
* Reset device when removed
v3:
* Fix indentation on the dev_err_probe line
v2:
* Use dev_err_probe instead of dev_err
Alejandro Tafalla (2):
ASoC: max98927: Handle reset gpio when probing i2c
dt-bindings: sound: max98927: Add reset-gpios optional property
.../devicetree/bindings/sound/max9892x.txt | 3 +++
sound/soc/codecs/max98927.c | 25 +++++++++++++++++++
sound/soc/codecs/max98927.h | 1 +
3 files changed, 29 insertions(+)
--
2.33.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v4 1/2] ASoC: max98927: Handle reset gpio when probing i2c 2021-10-07 2:38 [PATCH v4 0/2] Add reset-gpios handling for max98927 Alejandro Tafalla @ 2021-10-07 2:38 ` Alejandro Tafalla 2021-10-07 2:38 ` [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property Alejandro Tafalla 2021-10-07 21:37 ` [PATCH v4 0/2] Add reset-gpios handling for max98927 Mark Brown 2 siblings, 0 replies; 8+ messages in thread From: Alejandro Tafalla @ 2021-10-07 2:38 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, Péter Ujfalusi, ~postmarketos/upstreaming, alsa-devel, linux-kernel Cc: Alejandro Tafalla, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree The max98927 codec on some devices requires pulling a reset gpio before responding to any i2c command. This commit adds support for it through an optional reset-gpios property. Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> --- sound/soc/codecs/max98927.c | 25 +++++++++++++++++++++++++ sound/soc/codecs/max98927.h | 1 + 2 files changed, 26 insertions(+) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 8b206ee77709..5ba5f876eab8 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -897,6 +897,19 @@ static int max98927_i2c_probe(struct i2c_client *i2c, "Failed to allocate regmap: %d\n", ret); return ret; } + + max98927->reset_gpio + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(max98927->reset_gpio)) { + ret = PTR_ERR(max98927->reset_gpio); + return dev_err_probe(&i2c->dev, ret, "failed to request GPIO reset pin"); + } + + if (max98927->reset_gpio) { + gpiod_set_value_cansleep(max98927->reset_gpio, 0); + /* Wait for i2c port to be ready */ + usleep_range(5000, 6000); + } /* Check Revision ID */ ret = regmap_read(max98927->regmap, @@ -921,6 +934,17 @@ static int max98927_i2c_probe(struct i2c_client *i2c, return ret; } +static int max98927_i2c_remove(struct i2c_client *i2c) +{ + struct max98927_priv *max98927 = i2c_get_clientdata(i2c); + + if (max98927->reset_gpio) { + gpiod_set_value_cansleep(max98927->reset_gpio, 1); + } + + return 0; +} + static const struct i2c_device_id max98927_i2c_id[] = { { "max98927", 0}, { }, @@ -952,6 +976,7 @@ static struct i2c_driver max98927_i2c_driver = { .pm = &max98927_pm, }, .probe = max98927_i2c_probe, + .remove = max98927_i2c_remove, .id_table = max98927_i2c_id, }; diff --git a/sound/soc/codecs/max98927.h b/sound/soc/codecs/max98927.h index 05f495db914d..13f5066d7419 100644 --- a/sound/soc/codecs/max98927.h +++ b/sound/soc/codecs/max98927.h @@ -255,6 +255,7 @@ struct max98927_priv { struct regmap *regmap; struct snd_soc_component *component; struct max98927_pdata *pdata; + struct gpio_desc *reset_gpio; unsigned int spk_gain; unsigned int sysclk; unsigned int v_l_slot; -- 2.33.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-10-07 2:38 [PATCH v4 0/2] Add reset-gpios handling for max98927 Alejandro Tafalla 2021-10-07 2:38 ` [PATCH v4 1/2] ASoC: max98927: Handle reset gpio when probing i2c Alejandro Tafalla @ 2021-10-07 2:38 ` Alejandro Tafalla 2021-10-07 2:44 ` Alejandro Tafalla 2021-10-07 14:03 ` Mark Brown 2021-10-07 21:37 ` [PATCH v4 0/2] Add reset-gpios handling for max98927 Mark Brown 2 siblings, 2 replies; 8+ messages in thread From: Alejandro Tafalla @ 2021-10-07 2:38 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, Péter Ujfalusi, ~postmarketos/upstreaming, alsa-devel, linux-kernel Cc: Alejandro Tafalla, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> --- Documentation/devicetree/bindings/sound/max9892x.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/max9892x.txt b/Documentation/devicetree/bindings/sound/max9892x.txt index f6171591ddc6..98cb9ba5b328 100644 --- a/Documentation/devicetree/bindings/sound/max9892x.txt +++ b/Documentation/devicetree/bindings/sound/max9892x.txt @@ -30,6 +30,9 @@ Required properties: - reg : the I2C address of the device for I2C +Optional properties: + - reset-gpios : GPIO to reset the device + Example: codec: max98927@3a { -- 2.33.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-10-07 2:38 ` [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property Alejandro Tafalla @ 2021-10-07 2:44 ` Alejandro Tafalla 2021-10-07 7:06 ` Andy Shevchenko 2021-10-07 14:03 ` Mark Brown 1 sibling, 1 reply; 8+ messages in thread From: Alejandro Tafalla @ 2021-10-07 2:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, Péter Ujfalusi, ~postmarketos/upstreaming, alsa-devel, linux-kernel Cc: Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree On 7/10/21 4:38 Alejandro Tafalla wrote: > Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> > --- > Documentation/devicetree/bindings/sound/max9892x.txt | 3 +++ > 1 file changed, 3 insertions(+) Sorry, I forgot to add: Acked-by: Rob Herring <robh@kernel.org> -- Alejandro Tafalla ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-10-07 2:44 ` Alejandro Tafalla @ 2021-10-07 7:06 ` Andy Shevchenko 2021-10-07 9:47 ` Alejandro Tafalla 0 siblings, 1 reply; 8+ messages in thread From: Andy Shevchenko @ 2021-10-07 7:06 UTC (permalink / raw) To: Alejandro Tafalla Cc: Liam Girdwood, Mark Brown, Péter Ujfalusi, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS <devicetree@vger.kernel.org>, Hans de Goede <hdegoede@redhat.com>, Andy Shevchenko <andy.shevchenko@gmail.com>,, ALSA Development Mailing List, Linux Kernel Mailing List, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree On Thu, Oct 7, 2021 at 5:45 AM Alejandro Tafalla <atafalla@dnyon.com> wrote: > On 7/10/21 4:38 Alejandro Tafalla wrote: > > Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> > > --- > > Documentation/devicetree/bindings/sound/max9892x.txt | 3 +++ > > 1 file changed, 3 insertions(+) > > Sorry, I forgot to add: Acked-by: Rob Herring <robh@kernel.org> And commit messages? -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-10-07 7:06 ` Andy Shevchenko @ 2021-10-07 9:47 ` Alejandro Tafalla 0 siblings, 0 replies; 8+ messages in thread From: Alejandro Tafalla @ 2021-10-07 9:47 UTC (permalink / raw) To: Andy Shevchenko Cc: Liam Girdwood, Mark Brown, Péter Ujfalusi, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS <devicetree@vger.kernel.org>, Hans de Goede <hdegoede@redhat.com>, Andy Shevchenko <andy.shevchenko@gmail.com>,, ALSA Development Mailing List, Linux Kernel Mailing List, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree On 7/10/21 9:06 Andy Shevchenko wrote: > On Thu, Oct 7, 2021 at 5:45 AM Alejandro Tafalla <atafalla@dnyon.com> wrote: > > On 7/10/21 4:38 Alejandro Tafalla wrote: > > > Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> > > > --- > > > > > > Documentation/devicetree/bindings/sound/max9892x.txt | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > Sorry, I forgot to add: Acked-by: Rob Herring <robh@kernel.org> > > And commit messages? Right, can I resend this patch with the commit message or I have to resend the other one too? -- Alejandro Tafalla ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-10-07 2:38 ` [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property Alejandro Tafalla 2021-10-07 2:44 ` Alejandro Tafalla @ 2021-10-07 14:03 ` Mark Brown 1 sibling, 0 replies; 8+ messages in thread From: Mark Brown @ 2021-10-07 14:03 UTC (permalink / raw) To: Alejandro Tafalla Cc: Liam Girdwood, Andy Shevchenko, Péter Ujfalusi, ~postmarketos/upstreaming, alsa-devel, linux-kernel, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree [-- Attachment #1: Type: text/plain, Size: 454 bytes --] On Thu, Oct 07, 2021 at 04:38:58AM +0200, Alejandro Tafalla wrote: > Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v4 0/2] Add reset-gpios handling for max98927 2021-10-07 2:38 [PATCH v4 0/2] Add reset-gpios handling for max98927 Alejandro Tafalla 2021-10-07 2:38 ` [PATCH v4 1/2] ASoC: max98927: Handle reset gpio when probing i2c Alejandro Tafalla 2021-10-07 2:38 ` [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property Alejandro Tafalla @ 2021-10-07 21:37 ` Mark Brown 2 siblings, 0 replies; 8+ messages in thread From: Mark Brown @ 2021-10-07 21:37 UTC (permalink / raw) To: Péter Ujfalusi, Alejandro Tafalla, ~postmarketos/upstreaming, linux-kernel, alsa-devel, Andy Shevchenko, Liam Girdwood Cc: Mark Brown, devicetree, Rob Herring, Takashi Iwai, Jaroslav Kysela On Thu, 7 Oct 2021 04:38:54 +0200, Alejandro Tafalla wrote: > The max98927 codec on some devices (i.e. Xiaomi Mi A2 Lite phone) requires > hardware-resetting the codec by driving a reset-gpio. This series adds > support for it through an optional reset-gpios property. > > v4: > * Correctly assert/deassert the GPIO states > * Wait for the i2c port to be ready after reset > * Reset device when removed > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [1/2] ASoC: max98927: Handle reset gpio when probing i2c commit: 4d67dc1998f1890a9d22d03208037075ea9f2562 [2/2] dt-bindings: sound: max98927: Add reset-gpios optional property commit: b23d3189c038c091adc8de382d20a8f5321645a1 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-10-07 21:37 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-10-07 2:38 [PATCH v4 0/2] Add reset-gpios handling for max98927 Alejandro Tafalla 2021-10-07 2:38 ` [PATCH v4 1/2] ASoC: max98927: Handle reset gpio when probing i2c Alejandro Tafalla 2021-10-07 2:38 ` [PATCH v4 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property Alejandro Tafalla 2021-10-07 2:44 ` Alejandro Tafalla 2021-10-07 7:06 ` Andy Shevchenko 2021-10-07 9:47 ` Alejandro Tafalla 2021-10-07 14:03 ` Mark Brown 2021-10-07 21:37 ` [PATCH v4 0/2] Add reset-gpios handling for max98927 Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).