[pddf]: Support for idle_state device parameter is required for muxes using i2c_mux_pca954x driver (#10060)

As per linux kernel 5.10, 'force_deselct_on_exit' parameter used for driver i2c_mux_pca954x is no longer valid. Instead an attribute 'idle_state' is added per MUX device. This needs to be set to
-1 : For leaving the mux state as is
-2 : For deselecting the channel upon exit
: To always set a channel upon exit

This needs to be accommodated inside the PDDF JSON parser as well.
This commit is contained in:
FuzailBrcm 2022-03-04 05:28:34 +05:30 committed by GitHub
parent 34a4817ad0
commit 482ff1ca50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -359,9 +359,18 @@ class PddfParse():
ret = self.runcmd(cmd)
if ret != 0:
return create_ret.append(ret)
self.create_device(dev['i2c']['dev_attr'], "pddf/devices/mux", ops)
cmd = "echo %s > /sys/kernel/pddf/devices/mux/virt_bus" % (dev['i2c']['dev_attr']['virt_bus'])
ret = self.runcmd(cmd)
if ret != 0:
return create_ret.append(ret)
cmd = "echo 'add' > /sys/kernel/pddf/devices/mux/dev_ops"
ret = self.runcmd(cmd)
# Check if the dev_attr array contain idle_state
if 'idle_state' in dev['i2c']['dev_attr']:
cmd = "echo {} > /sys/bus/i2c/devices/{}-00{:02x}/idle_state".format(dev['i2c']['dev_attr']['idle_state'],
int(dev['i2c']['topo_info']['parent_bus'],0), int(dev['i2c']['topo_info']['dev_addr'],0))
ret = self.runcmd(cmd)
return create_ret.append(ret)
def create_xcvr_i2c_device(self, dev, ops):