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 5/16/2024 5:17 PM, Mark Brown wrote:
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.


Thanks for the review,

Will cleanup those.
+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.

ACK,

Will cleanup and improve.

Thanks & Regards,
Rafi.



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux