[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <91f581ef-58ea-4b98-80e2-dd9b14a61c60@sirena.org.uk>
Date: Thu, 16 May 2024 12:47:00 +0100
From: Mark Brown <broonie@...nel.org>
To: Mohammad Rafi Shaik <quic_mohs@...cinc.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Banajit Goswami <bgoswami@...cinc.com>,
Liam Girdwood <lgirdwood@...il.com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
alsa-devel@...a-project.org, linux-arm-msm@...r.kernel.org,
linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, quic_rohkumar@...cinc.com,
quic_pkumpatl@...cinc.com
Subject: Re: [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver
On Thu, May 16, 2024 at 10:17:56AM +0530, Mohammad Rafi Shaik wrote:
> +static const struct reg_default wcd937x_defaults[] = {
> + { WCD937X_DIGITAL_EFUSE_REG_0, 0x00 },
> + { WCD937X_DIGITAL_EFUSE_REG_1, 0xff },
> + { WCD937X_DIGITAL_EFUSE_REG_2, 0xff },
> + { WCD937X_DIGITAL_EFUSE_REG_3, 0xff },
Given the name I'd expect these to vary per device so not have default
values. In general ID, status or volatile registers probably shouldn't
have defaults since they should be read from the device.
> +static bool wcd937x_readonly_register(struct device *dev, unsigned int reg)
> +{
> + switch (reg) {
> + case WCD937X_DIGITAL_CHIP_ID0:
> + case WCD937X_DIGITAL_CHIP_ID1:
> + case WCD937X_DIGITAL_CHIP_ID2:
> + case WCD937X_DIGITAL_CHIP_ID3:
> + case WCD937X_DIGITAL_EFUSE_REG_0:
> + case WCD937X_DIGITAL_EFUSE_REG_1:
> + case WCD937X_DIGITAL_EFUSE_REG_2:
> + .readable_reg = wcd937x_readable_register,
> + .writeable_reg = wcd937x_rdwr_register,
> + .volatile_reg = wcd937x_readonly_register,
It's not a bug per se since things will work but you should probably
have separate volatile and read only checks, things like the ID and
efuse registers are read only but they shouldn't vary at runtime so
could be cached and not volatile.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists