On Mon, Sep 15, 2014 at 07:58:29PM +0800, carl peng wrote:
> Hi Mika,
>
> Excuse me, Could I consult one more question with you?
Sure.
> Could I add the AMD i2c controller private data like clk rate in the
> platform_driver-->id_table but not in the
> platform_driver-->acpi_match_table? The cause is as follow:
>
>
> As you suggestion, I try to pass the clock rate in the ->driver_data,
> so I add a line in the
> dw_i2c_acpi_match[] array (drivers/i2c/busses/i2c-designware-platdrv.c):
>
> static const struct acpi_device_id dw_i2c_acpi_match[] = {
> ...
> { "AMD0010", (unsigned long)&amd_i2c_config}
> ...
> }
> define the clock rate as a member of the amd_i2c_config structure.
>
> But I find that I can not pass the clock rate by this way, since when
> platform device match with with platform driver,
> The driver_data of platform_driver-->acpi_match_table will not be
> assigned to pdev->id_entry,
> just the driver_data of platform_driver-->id_table will be assigned to
> pdev->id_entry, as you know, AMD i2c controller
> is a ACPI device, should use platform_driver-->acpi_match_table not
> platform_driver-->id_table.
>
> platform_match(drivers/base/platform.c)
> |
> acpi_driver_match_device(dev, drv)
> |
> return !!acpi_match_device(drv->acpi_match_table, dev);
> |
> return __acpi_match_device(adev, ids)(drivers/acpi/scan.c)
> |
> return id
> Just return id, but will not assign id to pdev->id_entry.
You can call acpi_match_device(dw_i2c_acpi_match, &pdev->dev) in the
driver and look up the id->driver_data from the returned pointer.
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html