How is i2c clock frequency value passed from BIOS to driver?

1.2k views Asked by At

My i2c clock-frequency values is coming from BIOS.

I have extracted the DSDT and the i2c clock-frequency field is as follows:

         Device (I2C1)
        {
            Name (_ADR, 0x00160001)  // _ADR: Address
            Name (_DDN, "Intel(R) I2C Controller #1")  // _DDN: DOS Device Name
            Name (_UID, 0x02)  // _UID: Unique ID
            Name (LINK, "\\_SB.PCI0.I2C1")
            Name (RBUF, ResourceTemplate ()
            {
            })
            Name (_DSD, Package (0x02)
            {
                Buffer (0x10)
                {
                    /* 0000 */   0x14, 0xD8, 0xFF, 0xDA, 0xBA, 0x6E, 0x8C, 0x4D,
                    /* 0008 */   0x8A, 0x91, 0xBC, 0x9B, 0xBF, 0x4A, 0xA3, 0x01
                }, 

                Package (0x01)
                {
                    Package (0x02)
                    {
                        "clock-frequency", 
                        IC1S
                    }
                }
            })

But there is no mention of i2c clock frequency values for different modes like 400k, 1M etc. Where are these values defined? How is it being passed from BIOS to driver?

1

There are 1 answers

0
Sachin Mokashi On BEST ANSWER

These i2c-clock-frequency values have been defined in the BIOS source code (apparently). Because since we have the options in BIOS to select either Standard Mode (100k), Fast Mode (400k), Fast Plus (1M) & High Speed (3.4M), these values should be matched somewhere in the BIOS source code. The kernel API

`device_property_read_u32(&pdev->dev, "clock-frequency", &dev->clk_freq);` 

matches the "clock-frequency" propname field in ACPI & fetches the i2c-clock-frequency value from the ACPI object.