Re: [PATCH v2] hwmon (max6639): Use regmap

From: Naresh Solanki
Date: Thu May 02 2024 - 14:34:49 EST


Hi Guenter,

On Thu, 2 May 2024 at 23:52, Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
>
> On 5/2/24 10:25, Naresh Solanki wrote:
> [ ... ]
>
> >>> + u8 pwm[MAX6639_NDEV]; /* Register value: Duty cycle 0..120 */
> >>
> >> pwm caching needs to be dropped as well. It is no longer initialized in
> >> max6639_init_client(), but updated and later used in pwm_store() and
> >> pwm_show(). Looking at the datasheet, the pwm registers are volatile
> >> and should not be cached in the first place.
> > Yes. I did that but found that the register is write only. i.e.,
>
> Odd. The datasheet says that it is r/w or, rather, that reading it returns
> the _current_ pwm value and writing it sets the target pwm value in pwm mode.
>
> What happens when the register is read ?
Upon revisiting the datasheet and conducting further testing, it appears that
my previous response was inaccurate.
After testing, it's clear that it reads what is being written & hence
it's perfectly
fine to remove variable pwm[] from local caching.
Verified using below command:
----
i2cset -f -y 130 0x2e 0x26 0x10; i2cget -f -y 130 0x2e 0x26
0x10
----

Regards,
Naresh

>
> Thanks,
> Guenter
>