summaryrefslogtreecommitdiff
path: root/src/soc/intel/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r--src/soc/intel/common/block/i2c/i2c.c10
-rw-r--r--src/soc/intel/common/block/i2c/lpss_i2c.c15
-rw-r--r--src/soc/intel/common/block/i2c/lpss_i2c.h8
3 files changed, 26 insertions, 7 deletions
diff --git a/src/soc/intel/common/block/i2c/i2c.c b/src/soc/intel/common/block/i2c/i2c.c
index aeb6d8f2ed..625bb991d4 100644
--- a/src/soc/intel/common/block/i2c/i2c.c
+++ b/src/soc/intel/common/block/i2c/i2c.c
@@ -150,8 +150,14 @@ static void lpss_i2c_acpi_fill_ssdt(struct device *dev)
acpigen_pop_len();
}
-static struct i2c_bus_operations i2c_bus_ops = {
- .dev_to_bus = &lpss_i2c_dev_to_bus,
+static int lpss_i2c_dev_transfer(struct device *dev,
+ const struct i2c_msg *msg, size_t count)
+{
+ return lpss_i2c_transfer(lpss_i2c_dev_to_bus(dev), msg, count);
+}
+
+static const struct i2c_bus_operations i2c_bus_ops = {
+ .transfer = lpss_i2c_dev_transfer,
};
static struct device_operations i2c_dev_ops = {
diff --git a/src/soc/intel/common/block/i2c/lpss_i2c.c b/src/soc/intel/common/block/i2c/lpss_i2c.c
index 868a6ad300..7db3fe9668 100644
--- a/src/soc/intel/common/block/i2c/lpss_i2c.c
+++ b/src/soc/intel/common/block/i2c/lpss_i2c.c
@@ -258,7 +258,7 @@ static int lpss_i2c_wait_for_bus_idle(struct lpss_i2c_regs *regs)
/* Transfer one byte of one segment, sending stop bit if requested */
static int lpss_i2c_transfer_byte(struct lpss_i2c_regs *regs,
- struct i2c_msg *segment,
+ const struct i2c_msg *segment,
size_t byte, int send_stop)
{
struct stopwatch sw;
@@ -297,16 +297,15 @@ static int lpss_i2c_transfer_byte(struct lpss_i2c_regs *regs,
return 0;
}
-/* Global I2C bus handler, defined in include/i2c.h */
-int platform_i2c_transfer(unsigned int bus, struct i2c_msg *segments,
- int count)
+int lpss_i2c_transfer(unsigned int bus,
+ const struct i2c_msg *segments, size_t count)
{
struct stopwatch sw;
struct lpss_i2c_regs *regs;
size_t byte;
int ret = -1;
- if (count <= 0 || !segments)
+ if (count == 0 || !segments)
return -1;
regs = (struct lpss_i2c_regs *)lpss_i2c_base_address(bus);
@@ -396,6 +395,12 @@ out:
return ret;
}
+/* Global I2C bus handler, defined in include/device/i2c_simple.h */
+int platform_i2c_transfer(unsigned int bus, struct i2c_msg *msg, int count)
+{
+ return lpss_i2c_transfer(bus, msg, count < 0 ? 0 : count);
+}
+
static int lpss_i2c_set_speed_config(unsigned int bus,
const struct lpss_i2c_speed_config *config)
{
diff --git a/src/soc/intel/common/block/i2c/lpss_i2c.h b/src/soc/intel/common/block/i2c/lpss_i2c.h
index 2cb3d5ed52..72341621c0 100644
--- a/src/soc/intel/common/block/i2c/lpss_i2c.h
+++ b/src/soc/intel/common/block/i2c/lpss_i2c.h
@@ -89,3 +89,11 @@ int lpss_i2c_gen_speed_config(struct lpss_i2c_regs *regs,
enum i2c_speed speed,
const struct lpss_i2c_bus_config *bcfg,
struct lpss_i2c_speed_config *config);
+
+/*
+ * Process given I2C segments in a single transfer
+ * Return value:
+ * -1 = failure
+ * 0 = success
+ */
+int lpss_i2c_transfer(unsigned int bus, const struct i2c_msg *, size_t count);