Commit e9d46f74 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'chrome-platform-for-linus-4.16' of...

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

Pull chrome platform updates from Benson Leung:

 - move cros_ec_dev to drivers/mfd

 - other small maintenance fixes

[ The cros_ec_dev movement came in earlier through the MFD tree  - Linus ]

* tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform:
  platform/chrome: Use proper protocol transfer function
  platform/chrome: cros_ec_lpc: Add support for Google Glimmer
  platform/chrome: cros_ec_lpc: Register the driver if ACPI entry is missing.
  platform/chrome: cros_ec_lpc: remove redundant pointer request
  cros_ec: fix nul-termination for firmware build info
  platform/chrome: chromeos_laptop: make chromeos_laptop const
parents 15303ba5 d48b8c58
...@@ -423,7 +423,7 @@ static int chromeos_laptop_probe(struct platform_device *pdev) ...@@ -423,7 +423,7 @@ static int chromeos_laptop_probe(struct platform_device *pdev)
return ret; return ret;
} }
static struct chromeos_laptop samsung_series_5_550 = { static const struct chromeos_laptop samsung_series_5_550 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
...@@ -432,14 +432,14 @@ static struct chromeos_laptop samsung_series_5_550 = { ...@@ -432,14 +432,14 @@ static struct chromeos_laptop samsung_series_5_550 = {
}, },
}; };
static struct chromeos_laptop samsung_series_5 = { static const struct chromeos_laptop samsung_series_5 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Light Sensor. */ /* Light Sensor. */
{ .add = setup_tsl2583_als, I2C_ADAPTER_SMBUS }, { .add = setup_tsl2583_als, I2C_ADAPTER_SMBUS },
}, },
}; };
static struct chromeos_laptop chromebook_pixel = { static const struct chromeos_laptop chromebook_pixel = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touch Screen. */ /* Touch Screen. */
{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL }, { .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL },
...@@ -450,14 +450,14 @@ static struct chromeos_laptop chromebook_pixel = { ...@@ -450,14 +450,14 @@ static struct chromeos_laptop chromebook_pixel = {
}, },
}; };
static struct chromeos_laptop hp_chromebook_14 = { static const struct chromeos_laptop hp_chromebook_14 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
}, },
}; };
static struct chromeos_laptop dell_chromebook_11 = { static const struct chromeos_laptop dell_chromebook_11 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
...@@ -466,28 +466,28 @@ static struct chromeos_laptop dell_chromebook_11 = { ...@@ -466,28 +466,28 @@ static struct chromeos_laptop dell_chromebook_11 = {
}, },
}; };
static struct chromeos_laptop toshiba_cb35 = { static const struct chromeos_laptop toshiba_cb35 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 }, { .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
}, },
}; };
static struct chromeos_laptop acer_c7_chromebook = { static const struct chromeos_laptop acer_c7_chromebook = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
}, },
}; };
static struct chromeos_laptop acer_ac700 = { static const struct chromeos_laptop acer_ac700 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Light Sensor. */ /* Light Sensor. */
{ .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },
}, },
}; };
static struct chromeos_laptop acer_c720 = { static const struct chromeos_laptop acer_c720 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchscreen. */ /* Touchscreen. */
{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 }, { .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 },
...@@ -500,14 +500,14 @@ static struct chromeos_laptop acer_c720 = { ...@@ -500,14 +500,14 @@ static struct chromeos_laptop acer_c720 = {
}, },
}; };
static struct chromeos_laptop hp_pavilion_14_chromebook = { static const struct chromeos_laptop hp_pavilion_14_chromebook = {
.i2c_peripherals = { .i2c_peripherals = {
/* Touchpad. */ /* Touchpad. */
{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS }, { .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
}, },
}; };
static struct chromeos_laptop cr48 = { static const struct chromeos_laptop cr48 = {
.i2c_peripherals = { .i2c_peripherals = {
/* Light Sensor. */ /* Light Sensor. */
{ .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS }, { .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#define DRV_NAME "cros_ec_lpcs" #define DRV_NAME "cros_ec_lpcs"
#define ACPI_DRV_NAME "GOOG0004" #define ACPI_DRV_NAME "GOOG0004"
/* True if ACPI device is present */
static bool cros_ec_lpc_acpi_device_found;
static int ec_response_timed_out(void) static int ec_response_timed_out(void)
{ {
unsigned long one_second = jiffies + HZ; unsigned long one_second = jiffies + HZ;
...@@ -54,7 +57,6 @@ static int ec_response_timed_out(void) ...@@ -54,7 +57,6 @@ static int ec_response_timed_out(void)
static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec, static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec,
struct cros_ec_command *msg) struct cros_ec_command *msg)
{ {
struct ec_host_request *request;
struct ec_host_response response; struct ec_host_response response;
u8 sum; u8 sum;
int ret = 0; int ret = 0;
...@@ -65,8 +67,6 @@ static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec, ...@@ -65,8 +67,6 @@ static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec,
/* Write buffer */ /* Write buffer */
cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_PACKET, ret, ec->dout); cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_PACKET, ret, ec->dout);
request = (struct ec_host_request *)ec->dout;
/* Here we go */ /* Here we go */
sum = EC_COMMAND_PROTOCOL_3; sum = EC_COMMAND_PROTOCOL_3;
cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_CMD, 1, &sum); cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_CMD, 1, &sum);
...@@ -362,6 +362,13 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = { ...@@ -362,6 +362,13 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"), DMI_MATCH(DMI_PRODUCT_NAME, "Peppy"),
}, },
}, },
{
/* x86-glimmer, the Lenovo Thinkpad Yoga 11e. */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
DMI_MATCH(DMI_PRODUCT_NAME, "Glimmer"),
},
},
{ /* sentinel */ } { /* sentinel */ }
}; };
MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table); MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table);
...@@ -396,9 +403,21 @@ static struct platform_driver cros_ec_lpc_driver = { ...@@ -396,9 +403,21 @@ static struct platform_driver cros_ec_lpc_driver = {
.remove = cros_ec_lpc_remove, .remove = cros_ec_lpc_remove,
}; };
static struct platform_device cros_ec_lpc_device = {
.name = DRV_NAME
};
static acpi_status cros_ec_lpc_parse_device(acpi_handle handle, u32 level,
void *context, void **retval)
{
*(bool *)context = true;
return AE_CTRL_TERMINATE;
}
static int __init cros_ec_lpc_init(void) static int __init cros_ec_lpc_init(void)
{ {
int ret; int ret;
acpi_status status;
if (!dmi_check_system(cros_ec_lpc_dmi_table)) { if (!dmi_check_system(cros_ec_lpc_dmi_table)) {
pr_err(DRV_NAME ": unsupported system.\n"); pr_err(DRV_NAME ": unsupported system.\n");
...@@ -415,11 +434,28 @@ static int __init cros_ec_lpc_init(void) ...@@ -415,11 +434,28 @@ static int __init cros_ec_lpc_init(void)
return ret; return ret;
} }
return 0; status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device,
&cros_ec_lpc_acpi_device_found, NULL);
if (ACPI_FAILURE(status))
pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME);
if (!cros_ec_lpc_acpi_device_found) {
/* Register the device, and it'll get hooked up automatically */
ret = platform_device_register(&cros_ec_lpc_device);
if (ret) {
pr_err(DRV_NAME ": can't register device: %d\n", ret);
platform_driver_unregister(&cros_ec_lpc_driver);
cros_ec_lpc_reg_destroy();
}
}
return ret;
} }
static void __exit cros_ec_lpc_exit(void) static void __exit cros_ec_lpc_exit(void)
{ {
if (!cros_ec_lpc_acpi_device_found)
platform_device_unregister(&cros_ec_lpc_device);
platform_driver_unregister(&cros_ec_lpc_driver); platform_driver_unregister(&cros_ec_lpc_driver);
cros_ec_lpc_reg_destroy(); cros_ec_lpc_reg_destroy();
} }
......
...@@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev, ...@@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev,
struct cros_ec_command *msg) struct cros_ec_command *msg)
{ {
int ret; int ret;
int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
if (ec_dev->proto_version > 2) if (ec_dev->proto_version > 2)
ret = ec_dev->pkt_xfer(ec_dev, msg); xfer_fxn = ec_dev->pkt_xfer;
else else
ret = ec_dev->cmd_xfer(ec_dev, msg); xfer_fxn = ec_dev->cmd_xfer;
ret = (*xfer_fxn)(ec_dev, msg);
if (msg->result == EC_RES_IN_PROGRESS) { if (msg->result == EC_RES_IN_PROGRESS) {
int i; int i;
struct cros_ec_command *status_msg; struct cros_ec_command *status_msg;
...@@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev, ...@@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev,
for (i = 0; i < EC_COMMAND_RETRIES; i++) { for (i = 0; i < EC_COMMAND_RETRIES; i++) {
usleep_range(10000, 11000); usleep_range(10000, 11000);
ret = ec_dev->cmd_xfer(ec_dev, status_msg); ret = (*xfer_fxn)(ec_dev, status_msg);
if (ret < 0) if (ret < 0)
break; break;
......
...@@ -185,7 +185,7 @@ static ssize_t show_ec_version(struct device *dev, ...@@ -185,7 +185,7 @@ static ssize_t show_ec_version(struct device *dev,
count += scnprintf(buf + count, PAGE_SIZE - count, count += scnprintf(buf + count, PAGE_SIZE - count,
"Build info: EC error %d\n", msg->result); "Build info: EC error %d\n", msg->result);
else { else {
msg->data[sizeof(msg->data) - 1] = '\0'; msg->data[EC_HOST_PARAM_SIZE - 1] = '\0';
count += scnprintf(buf + count, PAGE_SIZE - count, count += scnprintf(buf + count, PAGE_SIZE - count,
"Build info: %s\n", msg->data); "Build info: %s\n", msg->data);
} }
......
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