i2c: Add a generic driver to generate ACPI info

Many I2C devices produce roughly the same ACPI data with just things like
the GPIO/interrupt information being different.

This can be handled by a generic driver along with some information in the
device tree.

Add a generic i2c driver for this purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
Simon Glass
2020-09-22 12:45:01 -06:00
committed by Bin Meng
parent bddbaf5edf
commit fd42f263ce
7 changed files with 381 additions and 0 deletions

View File

@@ -58,6 +58,12 @@ enum i2c_address_mode {
I2C_MODE_10_BIT
};
/** enum i2c_device_t - Types of I2C devices, used for compatible strings */
enum i2c_device_t {
I2C_DEVICE_GENERIC,
I2C_DEVICE_HID_OVER_I2C,
};
struct udevice;
/**
* struct dm_i2c_chip - information about an i2c chip
@@ -558,6 +564,23 @@ int i2c_emul_find(struct udevice *dev, struct udevice **emulp);
*/
struct udevice *i2c_emul_get_device(struct udevice *emul);
/* ACPI operations for generic I2C devices */
extern struct acpi_ops i2c_acpi_ops;
/**
* acpi_i2c_ofdata_to_platdata() - Read properties intended for ACPI
*
* This reads the generic I2C properties from the device tree, so that these
* can be used to create ACPI information for the device.
*
* See the i2c/generic-acpi.txt binding file for information about the
* properties.
*
* @dev: I2C device to process
* @return 0 if OK, -EINVAL if acpi,hid is not present
*/
int acpi_i2c_ofdata_to_platdata(struct udevice *dev);
#ifndef CONFIG_DM_I2C
/*