diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-26 13:36:02 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-26 13:36:02 -0700 |
commit | 36a8032d77649430f5ef11fbf0df2bb026be0b04 (patch) | |
tree | 18e386a957bde5f71e9efd2cddf1d8aadafe48e4 /drivers/platform/chrome/chromeos_laptop.c | |
parent | 7f9f44308c8993c9ab8078d174dad34bea3e82d7 (diff) | |
parent | 96cba9b00e297303774bec59e192064d20adeb3d (diff) |
Merge tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform
Pull chrome platform updates from Olof Johansson:
"Here's a set of updates to the Chrome OS platform drivers for this
merge window.
Main new things this cycle is:
- Driver changes to expose the lightbar to users. With this, you can
make your own blinkenlights on Chromebook Pixels.
- Changes in the way that the atmel_mxt trackpads are probed. The
laptop driver is trying to be smart and not instantiate the devices
that don't answer to probe. For the trackpad that can come up in
two modes (bootloader or regular), this gets complicated since the
driver already knows how to handle the two modes including the
actual addresses used. So now the laptop driver needs to know more
too, instantiating the regular address even if the bootloader one
is the probe that passed.
- mfd driver improvements by Javier Martines Canillas, and a few
bugfixes from him, kbuild and myself"
* tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
platform/chrome: chromeos_laptop - instantiate Atmel at primary address
platform/chrome: cros_ec_lpc - Depend on X86 || COMPILE_TEST
platform/chrome: cros_ec_lpc - Include linux/io.h header file
platform/chrome: fix platform_no_drv_owner.cocci warnings
platform/chrome: cros_ec_lightbar - fix duplicate const warning
platform/chrome: cros_ec_dev - fix Unknown escape '%' warning
platform/chrome: Expose Chrome OS Lightbar to users
platform/chrome: Create sysfs attributes for the ChromeOS EC
mfd: cros_ec: Instantiate ChromeOS EC character device
platform/chrome: Add Chrome OS EC userspace device interface
platform/chrome: Add cros_ec_lpc driver for x86 devices
mfd: cros_ec: Add char dev and virtual dev pointers
mfd: cros_ec: Use fixed size arrays to transfer data with the EC
Diffstat (limited to 'drivers/platform/chrome/chromeos_laptop.c')
-rw-r--r-- | drivers/platform/chrome/chromeos_laptop.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index b84fdd6b629b..a04019ab9feb 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -133,12 +133,13 @@ static struct i2c_client *__add_probed_i2c_device( const char *name, int bus, struct i2c_board_info *info, - const unsigned short *addrs) + const unsigned short *alt_addr_list) { const struct dmi_device *dmi_dev; const struct dmi_dev_onboard *dev_data; struct i2c_adapter *adapter; - struct i2c_client *client; + struct i2c_client *client = NULL; + const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END }; if (bus < 0) return NULL; @@ -169,8 +170,28 @@ static struct i2c_client *__add_probed_i2c_device( return NULL; } - /* add the i2c device */ - client = i2c_new_probed_device(adapter, info, addrs, NULL); + /* + * Add the i2c device. If we can't detect it at the primary + * address we scan secondary addresses. In any case the client + * structure gets assigned primary address. + */ + client = i2c_new_probed_device(adapter, info, addr_list, NULL); + if (!client && alt_addr_list) { + struct i2c_board_info dummy_info = { + I2C_BOARD_INFO("dummy", info->addr), + }; + struct i2c_client *dummy; + + dummy = i2c_new_probed_device(adapter, &dummy_info, + alt_addr_list, NULL); + if (dummy) { + pr_debug("%s %d-%02x is probed at %02x\n", + __func__, bus, info->addr, dummy->addr); + i2c_unregister_device(dummy); + client = i2c_new_device(adapter, info); + } + } + if (!client) pr_notice("%s failed to register device %d-%02x\n", __func__, bus, info->addr); @@ -254,12 +275,10 @@ static struct i2c_client *add_i2c_device(const char *name, enum i2c_adapter_type type, struct i2c_board_info *info) { - const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END }; - return __add_probed_i2c_device(name, find_i2c_adapter_num(type), info, - addr_list); + NULL); } static int setup_cyapa_tp(enum i2c_adapter_type type) @@ -275,7 +294,6 @@ static int setup_cyapa_tp(enum i2c_adapter_type type) static int setup_atmel_224s_tp(enum i2c_adapter_type type) { const unsigned short addr_list[] = { ATMEL_TP_I2C_BL_ADDR, - ATMEL_TP_I2C_ADDR, I2C_CLIENT_END }; if (tp) return 0; @@ -289,7 +307,6 @@ static int setup_atmel_224s_tp(enum i2c_adapter_type type) static int setup_atmel_1664s_ts(enum i2c_adapter_type type) { const unsigned short addr_list[] = { ATMEL_TS_I2C_BL_ADDR, - ATMEL_TS_I2C_ADDR, I2C_CLIENT_END }; if (ts) return 0; |