Commit 58d08e3b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform

Pull chrome platform updates from Olof Johansson:
 "Updates to the Chromebook/box platform drivers:

   - a bugfix to pstore registration that makes it also work on
     non-Google systems
   - addition of new shipped Chromebooks (later models have more probing
     through ACPI so the need for these updates will be less over time).
   - A couple of minor coding style updates"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
  platform/chrome: chromeos_laptop - Add a limit for deferred retries
  platform/chrome: Add support for the acer c720p touchscreen.
  platform/chrome: pstore: fix dmi table to match all chrome systems
  platform/chrome: coding style fixes
  platform/chrome: chromeos_laptop - Add Toshiba CB35 Touch
  platform/chrome: chromeos_laptop - Add Dell Chromebook 11 touch
  platform/chrome: chromeos_laptop - Add HP Chromebook 14
  platform/chrome: chromeos_laptop - Add support for Acer C720
parents 64e3bbc7 5502486a
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#define ISL_ALS_I2C_ADDR 0x44 #define ISL_ALS_I2C_ADDR 0x44
#define TAOS_ALS_I2C_ADDR 0x29 #define TAOS_ALS_I2C_ADDR 0x29
#define MAX_I2C_DEVICE_DEFERRALS 5
static struct i2c_client *als; static struct i2c_client *als;
static struct i2c_client *tp; static struct i2c_client *tp;
static struct i2c_client *ts; static struct i2c_client *ts;
...@@ -45,6 +47,8 @@ static const char *i2c_adapter_names[] = { ...@@ -45,6 +47,8 @@ static const char *i2c_adapter_names[] = {
"SMBus I801 adapter", "SMBus I801 adapter",
"i915 gmbus vga", "i915 gmbus vga",
"i915 gmbus panel", "i915 gmbus panel",
"i2c-designware-pci",
"i2c-designware-pci",
}; };
/* Keep this enum consistent with i2c_adapter_names */ /* Keep this enum consistent with i2c_adapter_names */
...@@ -52,11 +56,21 @@ enum i2c_adapter_type { ...@@ -52,11 +56,21 @@ enum i2c_adapter_type {
I2C_ADAPTER_SMBUS = 0, I2C_ADAPTER_SMBUS = 0,
I2C_ADAPTER_VGADDC, I2C_ADAPTER_VGADDC,
I2C_ADAPTER_PANEL, I2C_ADAPTER_PANEL,
I2C_ADAPTER_DESIGNWARE_0,
I2C_ADAPTER_DESIGNWARE_1,
};
enum i2c_peripheral_state {
UNPROBED = 0,
PROBED,
TIMEDOUT,
}; };
struct i2c_peripheral { struct i2c_peripheral {
int (*add)(enum i2c_adapter_type type); int (*add)(enum i2c_adapter_type type);
enum i2c_adapter_type type; enum i2c_adapter_type type;
enum i2c_peripheral_state state;
int tries;
}; };
#define MAX_I2C_PERIPHERALS 3 #define MAX_I2C_PERIPHERALS 3
...@@ -158,7 +172,7 @@ static struct i2c_client *__add_probed_i2c_device( ...@@ -158,7 +172,7 @@ static struct i2c_client *__add_probed_i2c_device(
/* add the i2c device */ /* add the i2c device */
client = i2c_new_probed_device(adapter, info, addrs, NULL); client = i2c_new_probed_device(adapter, info, addrs, NULL);
if (!client) if (!client)
pr_err("%s failed to register device %d-%02x\n", pr_notice("%s failed to register device %d-%02x\n",
__func__, bus, info->addr); __func__, bus, info->addr);
else else
pr_debug("%s added i2c device %d-%02x\n", pr_debug("%s added i2c device %d-%02x\n",
...@@ -168,29 +182,43 @@ static struct i2c_client *__add_probed_i2c_device( ...@@ -168,29 +182,43 @@ static struct i2c_client *__add_probed_i2c_device(
return client; return client;
} }
struct i2c_lookup {
const char *name;
int instance;
int n;
};
static int __find_i2c_adap(struct device *dev, void *data) static int __find_i2c_adap(struct device *dev, void *data)
{ {
const char *name = data; struct i2c_lookup *lookup = data;
static const char *prefix = "i2c-"; static const char *prefix = "i2c-";
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0) if (strncmp(dev_name(dev), prefix, strlen(prefix)) != 0)
return 0; return 0;
adapter = to_i2c_adapter(dev); adapter = to_i2c_adapter(dev);
return (strncmp(adapter->name, name, strlen(name)) == 0); if (strncmp(adapter->name, lookup->name, strlen(lookup->name)) == 0 &&
lookup->n++ == lookup->instance)
return 1;
return 0;
} }
static int find_i2c_adapter_num(enum i2c_adapter_type type) static int find_i2c_adapter_num(enum i2c_adapter_type type)
{ {
struct device *dev = NULL; struct device *dev = NULL;
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
const char *name = i2c_adapter_names[type]; struct i2c_lookup lookup;
memset(&lookup, 0, sizeof(lookup));
lookup.name = i2c_adapter_names[type];
lookup.instance = (type == I2C_ADAPTER_DESIGNWARE_1) ? 1 : 0;
/* find the adapter by name */ /* find the adapter by name */
dev = bus_find_device(&i2c_bus_type, NULL, (void *)name, dev = bus_find_device(&i2c_bus_type, NULL, &lookup, __find_i2c_adap);
__find_i2c_adap);
if (!dev) { if (!dev) {
/* Adapters may appear later. Deferred probing will retry */ /* Adapters may appear later. Deferred probing will retry */
pr_notice("%s: i2c adapter %s not found on system.\n", __func__, pr_notice("%s: i2c adapter %s not found on system.\n", __func__,
name); lookup.name);
return -ENODEV; return -ENODEV;
} }
adapter = to_i2c_adapter(dev); adapter = to_i2c_adapter(dev);
...@@ -227,6 +255,7 @@ static struct i2c_client *add_i2c_device(const char *name, ...@@ -227,6 +255,7 @@ static struct i2c_client *add_i2c_device(const char *name,
struct i2c_board_info *info) struct i2c_board_info *info)
{ {
const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END }; const unsigned short addr_list[] = { info->addr, I2C_CLIENT_END };
return __add_probed_i2c_device(name, return __add_probed_i2c_device(name,
find_i2c_adapter_num(type), find_i2c_adapter_num(type),
info, info,
...@@ -324,9 +353,36 @@ static int chromeos_laptop_probe(struct platform_device *pdev) ...@@ -324,9 +353,36 @@ static int chromeos_laptop_probe(struct platform_device *pdev)
if (i2c_dev->add == NULL) if (i2c_dev->add == NULL)
break; break;
/* Add the device. Set -EPROBE_DEFER on any failure */ if (i2c_dev->state == TIMEDOUT || i2c_dev->state == PROBED)
if (i2c_dev->add(i2c_dev->type)) continue;
/*
* Check that the i2c adapter is present.
* -EPROBE_DEFER if missing as the adapter may appear much
* later.
*/
if (find_i2c_adapter_num(i2c_dev->type) == -ENODEV) {
ret = -EPROBE_DEFER;
continue;
}
/* Add the device. */
if (i2c_dev->add(i2c_dev->type) == -EAGAIN) {
/*
* Set -EPROBE_DEFER a limited num of times
* if device is not successfully added.
*/
if (++i2c_dev->tries < MAX_I2C_DEVICE_DEFERRALS) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
} else {
/* Ran out of tries. */
pr_notice("%s: Ran out of tries for device.\n",
__func__);
i2c_dev->state = TIMEDOUT;
}
} else {
i2c_dev->state = PROBED;
}
} }
return ret; return ret;
...@@ -359,6 +415,27 @@ static struct chromeos_laptop chromebook_pixel = { ...@@ -359,6 +415,27 @@ static struct chromeos_laptop chromebook_pixel = {
}, },
}; };
static struct chromeos_laptop hp_chromebook_14 = {
.i2c_peripherals = {
/* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
},
};
static struct chromeos_laptop dell_chromebook_11 = {
.i2c_peripherals = {
/* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
},
};
static struct chromeos_laptop toshiba_cb35 = {
.i2c_peripherals = {
/* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
},
};
static struct chromeos_laptop acer_c7_chromebook = { static struct chromeos_laptop acer_c7_chromebook = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
...@@ -373,6 +450,17 @@ static struct chromeos_laptop acer_ac700 = { ...@@ -373,6 +450,17 @@ static struct chromeos_laptop acer_ac700 = {
}, },
}; };
static struct chromeos_laptop acer_c720 = {
.i2c_peripherals = {
/* Touchscreen. */
{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 },
/* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
/* Light Sensor. */
{ .add = setup_isl29018_als, I2C_ADAPTER_DESIGNWARE_1 },
},
};
static struct chromeos_laptop hp_pavilion_14_chromebook = { static struct chromeos_laptop hp_pavilion_14_chromebook = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
...@@ -415,6 +503,30 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = { ...@@ -415,6 +503,30 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = {
}, },
_CBDD(chromebook_pixel), _CBDD(chromebook_pixel),
}, },
{
.ident = "Wolf",
.matches = {
DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
DMI_MATCH(DMI_PRODUCT_NAME, "Wolf"),
},
_CBDD(dell_chromebook_11),
},
{
.ident = "HP Chromebook 14",
.matches = {
DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
DMI_MATCH(DMI_PRODUCT_NAME, "Falco"),
},
_CBDD(hp_chromebook_14),
},
{
.ident = "Toshiba CB35",
.matches = {
DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
DMI_MATCH(DMI_PRODUCT_NAME, "Leon"),
},
_CBDD(toshiba_cb35),
},
{ {
.ident = "Acer C7 Chromebook", .ident = "Acer C7 Chromebook",
.matches = { .matches = {
...@@ -429,6 +541,13 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = { ...@@ -429,6 +541,13 @@ static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = {
}, },
_CBDD(acer_ac700), _CBDD(acer_ac700),
}, },
{
.ident = "Acer C720",
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"),
},
_CBDD(acer_c720),
},
{ {
.ident = "HP Pavilion 14 Chromebook", .ident = "HP Pavilion 14 Chromebook",
.matches = { .matches = {
...@@ -460,6 +579,7 @@ static struct platform_driver cros_platform_driver = { ...@@ -460,6 +579,7 @@ static struct platform_driver cros_platform_driver = {
static int __init chromeos_laptop_init(void) static int __init chromeos_laptop_init(void)
{ {
int ret; int ret;
if (!dmi_check_system(chromeos_laptop_dmi_table)) { if (!dmi_check_system(chromeos_laptop_dmi_table)) {
pr_debug("%s unsupported system.\n", __func__); pr_debug("%s unsupported system.\n", __func__);
return -ENODEV; return -ENODEV;
......
...@@ -16,23 +16,13 @@ ...@@ -16,23 +16,13 @@
static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = { static struct dmi_system_id chromeos_pstore_dmi_table[] __initdata = {
{ {
/* /*
* Today all Chromebooks/boxes ship with GOOGLE as vendor and * Today all Chromebooks/boxes ship with Google_* as version and
* coreboot as bios vendor. No other systems with this * coreboot as bios vendor. No other systems with this
* combination are known to date. * combination are known to date.
*/ */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
},
},
{
/*
* The first Samsung Chromebox and Chromebook Series 5 550 use
* coreboot but with Samsung as the system vendor.
*/
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG"),
DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"), DMI_MATCH(DMI_BIOS_VENDOR, "coreboot"),
DMI_MATCH(DMI_BIOS_VERSION, "Google_"),
}, },
}, },
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment