[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7SkIUs_d7ty-GU3@finisterre.sirena.org.uk>
Date: Tue, 18 Feb 2025 15:15:45 +0000
From: Mark Brown <broonie@...nel.org>
To: James Calligeros <jcalligeros99@...il.com>
Cc: Liam Girdwood <lgirdwood@...il.com>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Shenghao Ding <shenghao-ding@...com>,
Kevin Lu <kevin-lu@...com>, Baojun Xu <baojun.xu@...com>,
Dan Murphy <dmurphy@...com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Shi Fu <shifu0704@...ndersoft.com>,
Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Alyssa Rosenzweig <alyssa@...enzweig.io>,
Martin PoviĊĦer <povik+lin@...ebit.org>,
Hector Martin <marcan@...can.st>, linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
asahi@...ts.linux.dev, linux-hwmon@...r.kernel.org,
Neal Gompa <neal@...pa.dev>
Subject: Re: [PATCH v2 05/29] ASoC: tas2764: Extend driver to SN012776
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.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists