Re: [PATCH 13/13] ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier

Richard Fitzgerald
2023-05-26T12:21:06Z

On 26/5/23 05:40, Claudiu.Beznea@microchip.com wrote:
> On 25.05.2023 18:06, Richard Fitzgerald wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> From: Simon Trimmer <simont@opensource.cirrus.com>
>>
>> Add a driver for the Cirrus Logic CS35L56 amplifier. This uses the same
>> component binding API as the CS35L41 driver. This is not a standalone
>> HDA device; it provides control of the CS35L56 for systems that use a
>> combination of an HDA codec and CS35L56 amplifiers with audio routed
>> through the HDA codec.
>>

<SNIP>

>> +
>> + cs35l56->base.reset_gpio = devm_gpiod_get_index_optional(cs35l56->base.dev,
>> + "reset",
>> + cs35l56->index,
>> + GPIOD_OUT_LOW);
>> + if (IS_ERR(cs35l56->base.reset_gpio)) {
>
> devm_gpiod_get_index_optional() can also return NULL.
>

Yes, that is expected. It's optional. It's not an error.
In that case cs35l56->base.reset_gpio will already be NULL.

>> + ret = PTR_ERR(cs35l56->base.reset_gpio);
>> +
>> + /*
>> + * If RESET is shared the first amp to probe will grab the reset
>> + * line and reset all the amps
>> + */
>> + if (ret != -EBUSY)
>> + return dev_err_probe(cs35l56->base.dev, ret, "Failed to get reset GPIO\n");
>> +
>> + dev_info(cs35l56->base.dev, "Reset GPIO busy, assume shared reset\n");
>> + cs35l56->base.reset_gpio = NULL;
>> + }
>> +
>> + return 0;
>> +
>> +err:
>> + dev_err(cs35l56->base.dev, "Failed property %s: %d\n", property, ret);
>> +
>> + return ret;
>> +}