Re: [PATCH v2 05/29] ASoC: tas2764: Extend driver to SN012776
From: Mark Brown
Date: Tue Feb 18 2025 - 10:15:59 EST
On Tue, Feb 18, 2025 at 06:35:39PM +1000, James Calligeros wrote:
> + if (tas2764->devid == DEVID_SN012776) {
> + ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL,
> + TAS2764_PWR_CTRL_BOP_SRC,
> + TAS2764_PWR_CTRL_BOP_SRC);
This sort of code is generally better written with switch statements for
extensibility.
> + if (device_is_compatible(&client->dev, "ti,sn012776"))
> + tas2764->devid = DEVID_SN012776;
> + else
> + tas2764->devid = DEVID_TAS2764;
> +
> #if defined(CONFIG_OF)
> static const struct of_device_id tas2764_of_match[] = {
> - { .compatible = "ti,tas2764" },
> + { .compatible = "ti,tas2764", },
> + { .compatible = "ti,sn012776", },
It would be more usual to use the data field in the of_device_id to look
up the enum.
Attachment:
signature.asc
Description: PGP signature