summaryrefslogtreecommitdiff
path: root/driver/touchpad_elan.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@chromium.org>2019-06-25 12:44:16 -0600
committerCommit Bot <commit-bot@chromium.org>2019-07-19 21:11:02 +0000
commitd1a18f82ed831d4e640336ff5571f5fa64bc7b36 (patch)
treec46aeb6136de1c27c66e3d5f662e9620161bef7b /driver/touchpad_elan.c
parent1f14229fa7e499dfcee07d17add187598ff0a46c (diff)
downloadchrome-ec-d1a18f82ed831d4e640336ff5571f5fa64bc7b36.tar.gz
Use 7bit I2C/SPI slave addresses in EC
Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'driver/touchpad_elan.c')
-rw-r--r--driver/touchpad_elan.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/driver/touchpad_elan.c b/driver/touchpad_elan.c
index 10a2038158..247c85894f 100644
--- a/driver/touchpad_elan.c
+++ b/driver/touchpad_elan.c
@@ -115,8 +115,9 @@ static int elan_tp_read_cmd(uint16_t reg, uint16_t *val)
buf[0] = reg;
buf[1] = reg >> 8;
- return i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT, CONFIG_TOUCHPAD_I2C_ADDR,
- buf, sizeof(buf), (uint8_t *)val, sizeof(*val));
+ return i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ buf, sizeof(buf), (uint8_t *)val, sizeof(*val));
}
static int elan_tp_write_cmd(uint16_t reg, uint16_t val)
@@ -128,8 +129,9 @@ static int elan_tp_write_cmd(uint16_t reg, uint16_t val)
buf[2] = val;
buf[3] = val >> 8;
- return i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT, CONFIG_TOUCHPAD_I2C_ADDR,
- buf, sizeof(buf), NULL, 0);
+ return i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR__7BF,
+ buf, sizeof(buf), NULL, 0);
}
/* Power is on by default. */
@@ -189,7 +191,8 @@ static int elan_tp_read_report(void)
/* Compute and save timestamp early in case another interrupt comes. */
timestamp = irq_ts / USB_HID_TOUCHPAD_TIMESTAMP_UNIT;
- rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT, CONFIG_TOUCHPAD_I2C_ADDR,
+ rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR__7BF,
NULL, 0, tp_buf, ETP_I2C_REPORT_LEN);
if (rv) {
@@ -277,7 +280,8 @@ static void elan_tp_init(void)
elan_tp_write_cmd(ETP_I2C_STAND_CMD, ETP_I2C_RESET);
msleep(100);
- rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT, CONFIG_TOUCHPAD_I2C_ADDR,
+ rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR__7BF,
NULL, 0, val, sizeof(val));
CPRINTS("reset rv %d buf=%04x", rv, *((uint16_t *)val));
@@ -467,7 +471,8 @@ static int touchpad_update_page(const uint8_t *data)
page_store[FW_PAGE_SIZE + 2 + 0] = checksum & 0xff;
page_store[FW_PAGE_SIZE + 2 + 1] = (checksum >> 8) & 0xff;
- rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT, CONFIG_TOUCHPAD_I2C_ADDR,
+ rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR__7BF,
page_store, sizeof(page_store), NULL, 0);
if (rv)
return rv;
@@ -631,8 +636,8 @@ int touchpad_debug(const uint8_t *param, unsigned int param_size,
memset(buffer, 0, buffer_size);
}
- rv = i2c_xfer(CONFIG_TOUCHPAD_I2C_PORT,
- CONFIG_TOUCHPAD_I2C_ADDR,
+ rv = i2c_xfer__7bf(CONFIG_TOUCHPAD_I2C_PORT,
+ CONFIG_TOUCHPAD_I2C_ADDR__7BF,
&param[offset], write_length,
buffer, read_length);