Re: Question regarding write-back operation to STATUS register

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

 



On 9/4/24 08:24, Patryk wrote:
[ ... ]
 >>> We'll need to add some code to detect that condition and
 >>> refrain from clearing the status register if the chip doesn't support
 >>> writes (or maybe ignore errors from the clear operation). Ignoring the
 >>> error might be the easiest fix.
 >>
 >> I will apply this fix to our codebase then, unless I come up with a better idea.
 >>
 >
 > If yyou don't mind and have the time, it would be great if you can send a
 > patch to be applied to the upstream kernel. If not, please let me know and
 > I'll write one myself.
 >
 > Thanks,
 > Guenter
 >

Sure, I'll send a patch.


Thanks. Additional background: The ability to clear status registers was
added with PMBus version 1.2, so it is not surprising that older chips
don't support it. The best fix would probably be to read the revision
register and use its content to decide if the individual status register
should be cleared or if the clear_faults command should be executed.
Something like

struct pmbus_data {
	...
	u8 revision;
	...
};

In pmbus.h:
	#define PMBUS_REV_10	0x00
	#define PMBUS_REV_11	0x11
	#define PMBUS_REV_12	0x22
	#definw PMBUS_REV_13	0x33

In pmbus_init_common():

	ret = i2c_smbus_read_byte_data(client, PMBUS_REVISION);
	if (!ret)
		data->revision = ret;

In pmbus_show_boolean():

	if (regval) {
		if (data->revision >= PMBUS_REV_12)
	                ret = _pmbus_write_byte_data(client, page, reg, regval);
		else
			ret = pmbus_clear_fault_page(client, page);

                if (ret)
                        goto unlock;
        }

Thanks,
Guenter





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux