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.
Attachment:
signature.asc
Description: PGP signature
- Follow-Ups:
- Re: [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver
- From: Mohammad Rafi Shaik
- Re: [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver
- References:
- [PATCH v4 0/7] ASoC: codecs: wcd937x: add wcd937x audio codec support
- From: Mohammad Rafi Shaik
- [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver
- From: Mohammad Rafi Shaik
- [PATCH v4 0/7] ASoC: codecs: wcd937x: add wcd937x audio codec support
- Prev by Date: [PATCH] ASoC: SOF: ipc4-topology: Add support for NHLT with 16-bit only DMIC blob
- Next by Date: Re: [PATCH v4 4/7] ASoC: codecs: wcd937x: add basic controls
- Previous by thread: [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver
- Next by thread: Re: [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver
- Index(es):