linux icon indicating copy to clipboard operation
linux copied to clipboard

mcp23s17 fixes

Open 6by9 opened this issue 8 months ago • 4 comments

#6763

6by9 avatar Apr 03 '25 15:04 6by9

Is doing a get on BIAS_DISABLE really a thing?

pelwell avatar Apr 03 '25 15:04 pelwell

Is doing a get on BIAS_DISABLE really a thing?

Most drivers seem to think so: https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/pinctrl/pinctrl-as3722.c#L332 https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/pinctrl/pinctrl-at91-pio4.c#L751 https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/pinctrl/pinctrl-bm1880.c#L1173 https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/pinctrl/bcm/pinctrl-bcm2835.c#L1135 https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/pinctrl/pinctrl-rp1.c#L1470

Although I can't find the definitive docs for what it meant to be returned when, and what the argument part of the configs array is meant to mean for set and get for each param value. That one may need to be refined.

6by9 avatar Apr 03 '25 15:04 6by9

I'd say this is an exemplary implementation: https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/pinctrl/pinctrl-rp1.c#L1470-L1472

pelwell avatar Apr 03 '25 20:04 pelwell

If we treat the pinconf_get semantics for the individual bias modes as a boolean query as to whether or not that mode is selected, then the implementation of the BIAS_DISABLE query is wrong - the status should be (data & BIT(pin)) ? 0 : 1 (or !(data & BIT(pin)) if you prefer).

pelwell avatar Apr 05 '25 10:04 pelwell