Re: [PATCH 2/2] hwmon: (pmbus/max20830) add driver for max20830

Guenter Roeck <[email protected]>
Newsgroups dev.linux.lists.sashiko,org.kernel.vger.linux-hwmon
Message-ID <[email protected]>
On 4/15/26 20:04, Torreno, Alexis Czezar wrote:
>>>
>>> I may need to keep i2c_smbus_read_i2c_block_data. I'm testing this on
>>> an rpi4 and it seems i2c_smbus_read_block_data isn't supported by the
>> adapter.
>>>
>>
>> Odd. I can see that the bcm2835 controller driver sets
>> I2C_FUNC_SMBUS_EMUL but not I2C_FUNC_SMBUS_BLOCK_DATA. That
>> makes me wonder if the controller really does not support block reads. Any
>> chance you can try setting that flag in ./drivers/i2c/busses/i2c-bcm2835.c and
>> see what happens ?
>>
> 
> I tried using i2c_smbus_read_block_data, and here's some log messages
> 
> [ 6857.261998] max20830: adapter does NOT support I2C_FUNC_SMBUS_BLOCK_DATA
> [ 6857.262006] max20830: adapter supports I2C_FUNC_SMBUS_READ_I2C_BLOCK
> [ 6857.265228] max20830: i2c_block_data read 32 bytes: '        MAX20830'
> [ 6857.265648] max20830: smbus_block_data read 9 bytes: ''
> 
> i2c_smbus_read_i2c_block_data returns 32 for 32 bytes read
> and the buffer content is expected "MAX20830"
> 
> i2c_smbus_read_block_data returned 9 so I think it read the payload length of 1byte
> but no data beyond it, hence buffer = ''
> 

Ok, worth a try. The "correct" fix would be to implement support for the command
in the I2C controller driver, but that would be too much to ask for.

Ok to use i2c_smbus_read_i2c_block_data, but please add a comment describing
the reason, i.e., that this is to support drivers/controllers which don't support
i2c_smbus_read_block_data(). Also, please implement code to address the
differences: The first returned byte is the real length, so please check that.
Also, please fix the "Unsupported device" log to not print the first byte.

Thanks,
Guenter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.