diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-19 17:07:07 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2015-06-19 17:07:07 +0300 |
commit | c0b59fafe31bf91f589736be304d739b13952fdd (patch) | |
tree | 0088a41c6b68132739294643be06734e3af67677 /drivers/platform/chrome/chromeos_laptop.c | |
parent | 28bceeaaf81140d69647acd0eb7dc9312f27844a (diff) | |
parent | bfa1ce5f38938cc9e6c7f2d1011f88eba2b9e2b2 (diff) | |
download | linux-c0b59fafe31bf91f589736be304d739b13952fdd.tar.xz |
Merge branch 'mvebu/drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Merge the mvebu/drivers branch of the arm-soc tree which contains
just a single patch bfa1ce5f38938cc9e6c7f2d1011f88eba2b9e2b2 ("bus:
mvebu-mbus: add mv_mbus_dram_info_nooverlap()") that happens to be
a prerequisite of the new marvell/cesa crypto driver.
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; |