Re: [PATCH v4 2/7] ASoC: codecs: wcd937x-sdw: add SoundWire driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux