On Thu, Apr 10, 2014 at 09:15:16PM -0700, Srinivas Pandruvada wrote: > ACPI specification allows multiple i2c addresses defined under one > ACPI device object. These addresses are defined using _CRS method. > The current implementation will pickup the last entry in _CRS, and > create an i2C device, ignoring all other previous entries for addresses. > > The ACPI specification does not define, whether these addresses for one > i2c device or for multiple i2c devices, which are defined under the same > ACPI device object. We need some appoach where i2c clients can enumerate > on each of the i2C address and/or have access to those extra addresses. > > This change addresses both cases: > - Create a new i2c device for each i2c address > - Allow each i2 client to get addresses of all other devices under > the same ACPI device object (companions or siblings) > > Example 1: > Here in the following example, there are two i2C address in _CRS. > They belong to two different physical chipsets, with two different i2c > address but part of a module. > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > { > Name (RBUF, ResourceTemplate () > { > I2cSerialBus (0x0068, ControllerInitiated, 0x00061A80, > AddressingMode7Bit, "\\_SB.I2C5", > 0x00, ResourceConsumer, , > ) > I2cSerialBus (0x000C, ControllerInitiated, 0x00061A80, > AddressingMode7Bit, "\\_SB.I2C5", > 0x00, ResourceConsumer, , > ) > Interrupt (ResourceConsumer, Level, ActiveHigh, Shared, ,, ) > { > 0x00000044, > } > }) > Return (RBUF) > } > This change adds i2c_new_device for each i2c address. Here contents of > /sys/bus/i2c/devices will > i2c-some_acpi_dev_name:00:068 > i2c-some_acpi_dev_name::00:00c > > Example 2 > > Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings > { > Name (SBUF, ResourceTemplate () > { > GpioIo (Exclusive, PullDefault, 0x0000, 0x0000, IoRestrictionOutputOnly, > "\\_SB.GPO1", 0x00, ResourceConsumer, , > ) > { // Pin list > 0x0018 > } > I2cSerialBus (0x0010, ControllerInitiated, 0x00061A80, > AddressingMode7Bit, "\\_SB.I2C4", > 0x00, ResourceConsumer, , > ) > I2cSerialBus (0x000C, ControllerInitiated, 0x00061A80, > AddressingMode7Bit, "\\_SB.I2C4", > 0x00, ResourceConsumer, , > ) > I2cSerialBus (0x0054, ControllerInitiated, 0x00061A80, > AddressingMode7Bit, "\\_SB.I2C4", > 0x00, ResourceConsumer, , > ) > }) > Return (SBUF) /* \_SB_.I2C4.CAM1._CRS.SBUF */ > } > } > Here there are three i2c addresses for this device. > > When there is only I2cSerialBus address is present then there is no > change. The device name will not include address. In this way if > some device is using hardcoded path, this change will not impact them. > > Here any i2c client driver simply need to add ACPI bindings. They will > be probed multiple times, the client will bind to correct i2c device, > based on checking its identity and returning error for other. > At the same time, any i2c client can call i2c_for_each_acpi_comp_client > to get the i2c client instances of companion addresses defined > under the same ACPI device. > > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx> Sorry that I need to postpone the ACPI related stuff to the next release cycle (where it has priority). It was simply too much for this one. Mika: Your review for ACPI specific details would be much appreciated here. Thanks, Wolfram
Attachment:
signature.asc
Description: Digital signature