diff mbox

[8/9] ASoC: tlv320aic31xx: Fix the reset GPIO OF name

Message ID 20171108212505.28320-9-afd@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Davis Nov. 8, 2017, 9:25 p.m. UTC
The correct DT property for specifying a GPIO used for reset
is "reset-gpio", fix this here.

Fixes: e00447fafbf7 ("ASoC: tlv320aic31xx: Add basic codec driver implementation")

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 sound/soc/codecs/tlv320aic31xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Nov. 8, 2017, 9:36 p.m. UTC | #1
On Wed, Nov 08, 2017 at 03:25:04PM -0600, Andrew F. Davis wrote:

> -	ret = of_get_named_gpio(np, "gpio-reset", 0);
> +	ret = of_get_named_gpio(np, "reset-gpio", 0);

This is obviously an incompatible change in the binding which will break
any production DTs relying on the current behaviour.  You need to keep
support for the existing property.

It also doesn't look like a good fix if we're aiming for conformance
with DT naming conventions as unless things changed all GPIO related
properties are supposed to end -gpios even if they can only ever specify
a single GPIO.
Andrew Davis Nov. 8, 2017, 9:53 p.m. UTC | #2
On 11/08/2017 03:36 PM, Mark Brown wrote:
> On Wed, Nov 08, 2017 at 03:25:04PM -0600, Andrew F. Davis wrote:
> 
>> -	ret = of_get_named_gpio(np, "gpio-reset", 0);
>> +	ret = of_get_named_gpio(np, "reset-gpio", 0);
> 
> This is obviously an incompatible change in the binding which will break
> any production DTs relying on the current behaviour.  You need to keep
> support for the existing property.
> 

I understand the reasons not to change driver behavior wrt DT, but this
driver did not make functional use of this gpio, only going forward will
this gpio be used for actually reseting the device (in some patches I
will post soon). So I would like to fix this incorrect binding *before*
fixing it will cause behavior incompatibilities.

> It also doesn't look like a good fix if we're aiming for conformance
> with DT naming conventions as unless things changed all GPIO related
> properties are supposed to end -gpios even if they can only ever specify
> a single GPIO.
> 

If that is the new standard I can fix this patch to use -gpios.

I know we cant change all messed up DT bindings, but I hope an exception
can be make in this case for sanity sake.
Mark Brown Nov. 8, 2017, 10:18 p.m. UTC | #3
On Wed, Nov 08, 2017 at 03:53:51PM -0600, Andrew F. Davis wrote:
> On 11/08/2017 03:36 PM, Mark Brown wrote:
> > On Wed, Nov 08, 2017 at 03:25:04PM -0600, Andrew F. Davis wrote:

> > This is obviously an incompatible change in the binding which will break
> > any production DTs relying on the current behaviour.  You need to keep
> > support for the existing property.

> I understand the reasons not to change driver behavior wrt DT, but this
> driver did not make functional use of this gpio, only going forward will
> this gpio be used for actually reseting the device (in some patches I
> will post soon). So I would like to fix this incorrect binding *before*
> fixing it will cause behavior incompatibilities.

There is code in the driver to use the GPIO, including in the probe
where the GPIO is requested and set to high (which will bring it out of
reset if the default state was low).  At least the probe seems rather
likely to have a concrete effect.

> > It also doesn't look like a good fix if we're aiming for conformance
> > with DT naming conventions as unless things changed all GPIO related
> > properties are supposed to end -gpios even if they can only ever specify
> > a single GPIO.

> If that is the new standard I can fix this patch to use -gpios.

It's always been the standard AFAIK.
Andrew Davis Nov. 8, 2017, 11:25 p.m. UTC | #4
On 11/08/2017 04:18 PM, Mark Brown wrote:
> On Wed, Nov 08, 2017 at 03:53:51PM -0600, Andrew F. Davis wrote:
>> On 11/08/2017 03:36 PM, Mark Brown wrote:
>>> On Wed, Nov 08, 2017 at 03:25:04PM -0600, Andrew F. Davis wrote:
> 
>>> This is obviously an incompatible change in the binding which will break
>>> any production DTs relying on the current behaviour.  You need to keep
>>> support for the existing property.
> 
>> I understand the reasons not to change driver behavior wrt DT, but this
>> driver did not make functional use of this gpio, only going forward will
>> this gpio be used for actually reseting the device (in some patches I
>> will post soon). So I would like to fix this incorrect binding *before*
>> fixing it will cause behavior incompatibilities.
> 
> There is code in the driver to use the GPIO, including in the probe
> where the GPIO is requested and set to high (which will bring it out of
> reset if the default state was low).  At least the probe seems rather
> likely to have a concrete effect.
> 

None of the 4 boards that defined this gpio have this pulled low in the
pin control, boards should have an external pull-up on the reset line.

At any-rate, I'm pushing this fix to allow the driver to use new kernel
frameworks that depend on the correct binding being used. This is not a
case of a badly designed binding or trying to add incompatible
functionality, it is a typo fix. If we have to keep this driver back
using old frameworks and needlessly bloat the code solely for the sake
of compatibility with a typo, then DT "stability" here is causing more
issues than it solves. </rant>




I guess the alternative would be to have of_find_gpio() also consider
prefixing, the 'gpio_suffixes' to 'con_id' and checking for those. That
is rather ugly and probably encourages the spread of this bad binding
property, but whatever the best fix is it cannot be to force bloat into
the driver.

>>> It also doesn't look like a good fix if we're aiming for conformance
>>> with DT naming conventions as unless things changed all GPIO related
>>> properties are supposed to end -gpios even if they can only ever specify
>>> a single GPIO.
> 
>> If that is the new standard I can fix this patch to use -gpios.
> 
> It's always been the standard AFAIK.
> 

Will fix for v2.
Mark Brown Nov. 9, 2017, 1:22 p.m. UTC | #5
On Wed, Nov 08, 2017 at 05:25:20PM -0600, Andrew F. Davis wrote:
> On 11/08/2017 04:18 PM, Mark Brown wrote:

> > There is code in the driver to use the GPIO, including in the probe
> > where the GPIO is requested and set to high (which will bring it out of
> > reset if the default state was low).  At least the probe seems rather
> > likely to have a concrete effect.

> None of the 4 boards that defined this gpio have this pulled low in the
> pin control, boards should have an external pull-up on the reset line.

None of the boards in mainline...

> At any-rate, I'm pushing this fix to allow the driver to use new kernel
> frameworks that depend on the correct binding being used. This is not a
> case of a badly designed binding or trying to add incompatible
> functionality, it is a typo fix. If we have to keep this driver back
> using old frameworks and needlessly bloat the code solely for the sake
> of compatibility with a typo, then DT "stability" here is causing more
> issues than it solves. </rant>

This isn't a typographical error, that'd be a spelling mistake or
something.

> I guess the alternative would be to have of_find_gpio() also consider
> prefixing, the 'gpio_suffixes' to 'con_id' and checking for those. That
> is rather ugly and probably encourages the spread of this bad binding
> property, but whatever the best fix is it cannot be to force bloat into
> the driver.

Another option is to add an interface for telling the DT code about
renaming properties then the core code can do the fallback transparently
to the upper layers (when asked for X if it's not there then try the
legacy name Y).
diff mbox

Patch

diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 54a87a905eb6..359eba15bb89 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -1279,7 +1279,7 @@  static void aic31xx_pdata_from_of(struct aic31xx_priv *aic31xx)
 		aic31xx->pdata.micbias_vg = MICBIAS_2_0V;
 	}
 
-	ret = of_get_named_gpio(np, "gpio-reset", 0);
+	ret = of_get_named_gpio(np, "reset-gpio", 0);
 	if (ret > 0)
 		aic31xx->pdata.gpio_reset = ret;
 }