* [PATCH v2 0/2] Add reset-gpios handling for max98927 @ 2021-08-30 10:44 ` Alejandro Tafalla 0 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-08-30 10:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, alsa-devel Cc: Alejandro Tafalla, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree, linux-kernel The max98927 codec on some devices (i.e. Xiaomi Mi A2 Lite phone) require hardware-resetting the codec by driving a reset-gpio. This series add support for it through an optional reset-gpios property. 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 | 15 +++++++++++++++ 2 files changed, 18 insertions(+) -- 2.32.0 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 0/2] Add reset-gpios handling for max98927 @ 2021-08-30 10:44 ` Alejandro Tafalla 0 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-08-30 10:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, alsa-devel Cc: devicetree, linux-kernel, Takashi Iwai, Rob Herring, Alejandro Tafalla The max98927 codec on some devices (i.e. Xiaomi Mi A2 Lite phone) require hardware-resetting the codec by driving a reset-gpio. This series add support for it through an optional reset-gpios property. 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 | 15 +++++++++++++++ 2 files changed, 18 insertions(+) -- 2.32.0 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c 2021-08-30 10:44 ` Alejandro Tafalla @ 2021-08-30 10:44 ` Alejandro Tafalla -1 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-08-30 10:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, alsa-devel Cc: Alejandro Tafalla, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree, linux-kernel Drive the reset gpio if defined in the DTS node. Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> --- sound/soc/codecs/max98927.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 8b206ee77709..84a159de4b26 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -868,6 +868,7 @@ static int max98927_i2c_probe(struct i2c_client *i2c, int ret = 0, value; int reg = 0; struct max98927_priv *max98927 = NULL; + struct gpio_desc *reset_gpio; max98927 = devm_kzalloc(&i2c->dev, sizeof(*max98927), GFP_KERNEL); @@ -898,6 +899,20 @@ static int max98927_i2c_probe(struct i2c_client *i2c, return ret; } + reset_gpio + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) { + ret = PTR_ERR(reset_gpio); + return dev_err_probe(&i2c->dev, ret, + "failed to request GPIO reset pin"); + } + + if (reset_gpio) { + usleep_range(8000, 10000); + gpiod_set_value_cansleep(reset_gpio, 1); + usleep_range(1000, 5000); + } + /* Check Revision ID */ ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); -- 2.32.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c @ 2021-08-30 10:44 ` Alejandro Tafalla 0 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-08-30 10:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, alsa-devel Cc: devicetree, linux-kernel, Takashi Iwai, Rob Herring, Alejandro Tafalla Drive the reset gpio if defined in the DTS node. Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> --- sound/soc/codecs/max98927.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c index 8b206ee77709..84a159de4b26 100644 --- a/sound/soc/codecs/max98927.c +++ b/sound/soc/codecs/max98927.c @@ -868,6 +868,7 @@ static int max98927_i2c_probe(struct i2c_client *i2c, int ret = 0, value; int reg = 0; struct max98927_priv *max98927 = NULL; + struct gpio_desc *reset_gpio; max98927 = devm_kzalloc(&i2c->dev, sizeof(*max98927), GFP_KERNEL); @@ -898,6 +899,20 @@ static int max98927_i2c_probe(struct i2c_client *i2c, return ret; } + reset_gpio + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) { + ret = PTR_ERR(reset_gpio); + return dev_err_probe(&i2c->dev, ret, + "failed to request GPIO reset pin"); + } + + if (reset_gpio) { + usleep_range(8000, 10000); + gpiod_set_value_cansleep(reset_gpio, 1); + usleep_range(1000, 5000); + } + /* Check Revision ID */ ret = regmap_read(max98927->regmap, MAX98927_R01FF_REV_ID, ®); -- 2.32.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c 2021-08-30 10:44 ` Alejandro Tafalla @ 2021-08-30 10:56 ` Andy Shevchenko -1 siblings, 0 replies; 12+ messages in thread From: Andy Shevchenko @ 2021-08-30 10:56 UTC (permalink / raw) To: Alejandro Tafalla Cc: Liam Girdwood, Mark Brown, ALSA Development Mailing List, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree, Linux Kernel Mailing List On Mon, Aug 30, 2021 at 1:48 PM Alejandro Tafalla <atafalla@dnyon.com> wrote: > > Drive the reset gpio if defined in the DTS node. ... > + reset_gpio > + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); A bit of a strange indentation, shouldn't it be one line? > + if (IS_ERR(reset_gpio)) { > + ret = PTR_ERR(reset_gpio); > + return dev_err_probe(&i2c->dev, ret, > + "failed to request GPIO reset pin"); It simply as return dev_err_probe(&i2c->dev, PTR_ERR(reset_gpio), "failed to request GPIO reset pin"); > + } -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c @ 2021-08-30 10:56 ` Andy Shevchenko 0 siblings, 0 replies; 12+ messages in thread From: Andy Shevchenko @ 2021-08-30 10:56 UTC (permalink / raw) To: Alejandro Tafalla Cc: devicetree, ALSA Development Mailing List, Linux Kernel Mailing List, Takashi Iwai, Rob Herring, Liam Girdwood, Mark Brown On Mon, Aug 30, 2021 at 1:48 PM Alejandro Tafalla <atafalla@dnyon.com> wrote: > > Drive the reset gpio if defined in the DTS node. ... > + reset_gpio > + = devm_gpiod_get_optional(&i2c->dev, "reset", GPIOD_OUT_LOW); A bit of a strange indentation, shouldn't it be one line? > + if (IS_ERR(reset_gpio)) { > + ret = PTR_ERR(reset_gpio); > + return dev_err_probe(&i2c->dev, ret, > + "failed to request GPIO reset pin"); It simply as return dev_err_probe(&i2c->dev, PTR_ERR(reset_gpio), "failed to request GPIO reset pin"); > + } -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c 2021-08-30 10:56 ` Andy Shevchenko @ 2021-09-01 17:00 ` Alejandro Tafalla -1 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-09-01 17:00 UTC (permalink / raw) To: Andy Shevchenko Cc: Liam Girdwood, Mark Brown, ALSA Development Mailing List, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree, Linux Kernel Mailing List On lunes, 30 de agosto de 2021 12:56:23 (CEST) Andy Shevchenko wrote: > It simply as > > return dev_err_probe(&i2c->dev, PTR_ERR(reset_gpio), > "failed to request GPIO reset pin"); > > > + } Alright, I'll make that change. Thank you. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c @ 2021-09-01 17:00 ` Alejandro Tafalla 0 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-09-01 17:00 UTC (permalink / raw) To: Andy Shevchenko Cc: devicetree, ALSA Development Mailing List, Linux Kernel Mailing List, Takashi Iwai, Rob Herring, Liam Girdwood, Mark Brown On lunes, 30 de agosto de 2021 12:56:23 (CEST) Andy Shevchenko wrote: > It simply as > > return dev_err_probe(&i2c->dev, PTR_ERR(reset_gpio), > "failed to request GPIO reset pin"); > > > + } Alright, I'll make that change. Thank you. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-08-30 10:44 ` Alejandro Tafalla @ 2021-08-30 10:44 ` Alejandro Tafalla -1 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-08-30 10:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, alsa-devel Cc: Alejandro Tafalla, Rob Herring, Jaroslav Kysela, Takashi Iwai, devicetree, linux-kernel Add the reset-gpios as an optional property because some devices might not need it to work properly. 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.32.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v2 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property @ 2021-08-30 10:44 ` Alejandro Tafalla 0 siblings, 0 replies; 12+ messages in thread From: Alejandro Tafalla @ 2021-08-30 10:44 UTC (permalink / raw) To: Liam Girdwood, Mark Brown, Andy Shevchenko, alsa-devel Cc: devicetree, linux-kernel, Takashi Iwai, Rob Herring, Alejandro Tafalla Add the reset-gpios as an optional property because some devices might not need it to work properly. 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.32.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property 2021-08-30 10:44 ` Alejandro Tafalla @ 2021-09-01 1:32 ` Rob Herring -1 siblings, 0 replies; 12+ messages in thread From: Rob Herring @ 2021-09-01 1:32 UTC (permalink / raw) To: Alejandro Tafalla Cc: devicetree, Mark Brown, alsa-devel, Jaroslav Kysela, Takashi Iwai, Andy Shevchenko, Rob Herring, Liam Girdwood, linux-kernel On Mon, 30 Aug 2021 12:44:24 +0200, Alejandro Tafalla wrote: > Add the reset-gpios as an optional property because some devices might > not need it to work properly. > > Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> > --- > Documentation/devicetree/bindings/sound/max9892x.txt | 3 +++ > 1 file changed, 3 insertions(+) > Acked-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property @ 2021-09-01 1:32 ` Rob Herring 0 siblings, 0 replies; 12+ messages in thread From: Rob Herring @ 2021-09-01 1:32 UTC (permalink / raw) To: Alejandro Tafalla Cc: devicetree, alsa-devel, Liam Girdwood, linux-kernel, Takashi Iwai, Rob Herring, Andy Shevchenko, Mark Brown On Mon, 30 Aug 2021 12:44:24 +0200, Alejandro Tafalla wrote: > Add the reset-gpios as an optional property because some devices might > not need it to work properly. > > Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com> > --- > Documentation/devicetree/bindings/sound/max9892x.txt | 3 +++ > 1 file changed, 3 insertions(+) > Acked-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-09-01 17:03 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-30 10:44 [PATCH v2 0/2] Add reset-gpios handling for max98927 Alejandro Tafalla 2021-08-30 10:44 ` Alejandro Tafalla 2021-08-30 10:44 ` [PATCH v2 1/2] ASoC: max98927: Handle reset gpio when probing i2c Alejandro Tafalla 2021-08-30 10:44 ` Alejandro Tafalla 2021-08-30 10:56 ` Andy Shevchenko 2021-08-30 10:56 ` Andy Shevchenko 2021-09-01 17:00 ` Alejandro Tafalla 2021-09-01 17:00 ` Alejandro Tafalla 2021-08-30 10:44 ` [PATCH v2 2/2] dt-bindings: sound: max98927: Add reset-gpios optional property Alejandro Tafalla 2021-08-30 10:44 ` Alejandro Tafalla 2021-09-01 1:32 ` Rob Herring 2021-09-01 1:32 ` Rob Herring
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.