ASoC: ak4458 reset polarity

Eliot Blennerhassett eliot at blennerhassett.gen.nz
Fri Jan 22 08:57:53 CET 2021


On 21/01/21 8:07 am, Mark Brown wrote:
> On Wed, Jan 20, 2021 at 12:41:18PM +1300, Eliot Blennerhassett wrote:
> 
> It would be a bit easier to have one discussion per mail 

taking up the topic of ak4458 reset polarity alone

ak4458.txt documents:

Optional properties:
- reset-gpios: A GPIO specifier for the power down & reset pin
Example
	reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>

Existing code in ak4458.c:
static void ak4458_power_off(struct ak4458_priv *ak4458)
 {
 	if (ak4458->reset_gpiod) {
		gpiod_set_value_cansleep(ak4458->reset_gpiod, 0);
		usleep_range(1000, 2000);
	}
}

I suspect the value 0 represents the raw value for an active-low gpio,
but this is wrong when used with gpiod_set_value_cansleep() function
whose doc says "Set the logical value of the GPIO, i.e. taking its
ACTIVE_LOW status into account"

Setting the value to 0 makes the GPIO *inactive* i.e. high if it is
specified in the DT as ACTIVE_LOW.  This is the wrong way round for the
power_off/on functions.

Because the DT property is optional, perhaps nobody has tried to use it
until now?

Patch to follow

--
Eliot



More information about the Alsa-devel mailing list