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
- References:
- [PATCH v2 00/29] ASoC: tas27{64,70}: improve support for Apple codec variants
- From: James Calligeros
- [PATCH v2 05/29] ASoC: tas2764: Extend driver to SN012776
- From: James Calligeros
- [PATCH v2 00/29] ASoC: tas27{64,70}: improve support for Apple codec variants
- Prev by Date: Re: [PATCH v2 02/29] ASoC: tas2770: Fix volume scale
- Next by Date: Re: [PATCH 0/7] Adjust all AMD audio drivers to use AMD_NODE
- Previous by thread: [PATCH v2 05/29] ASoC: tas2764: Extend driver to SN012776
- Next by thread: [PATCH v2 02/29] ASoC: tas2770: Fix volume scale
- Index(es):
![]() |