mirror of https://gitee.com/openkylin/linux.git
chrome-platform-for-linus-4.16
Moving cros_ec_dev to drivers/mfd. Other small maintenance fixes. -----BEGIN PGP SIGNATURE----- iQJIBAABCgAyFiEE6gYDF28Li+nEiKLaHwn1ewov5lgFAlp+l8YUHGJsZXVuZ0Bj aHJvbWl1bS5vcmcACgkQHwn1ewov5ljXzw/+MAcTYwIBdUyIZXBhA/FMYvAyouyN 0xzi/J7raKGhewG0Art28t+KT5j4T7Rz8Pd6zas6k4lGVfvWN5YBhz0ggMyCn3Lc 6t5aDzp4wG5OSl30Y1uA5x2mZ4uXDSskcgSCng0BooJptY1jxGwmt/97m/hxzDdH ChiaRab+rhMeV2K2haONHWXGPi472fqPsXOb1uyIoX2quRdt1XbWrCGGmR81Tp/e uQZC5DYOti1I3EYz+jOecbOkr42YIJyZxGTK6Mtk2NgUAsFNxhpg7vF6LGV39ynr t4BAZk0qrIY/kP0xHl13+laW3w6eh/Rnrw/mSMaeo1CZ8K0X9NDRKb7hoSPcEkVe Jzz6h+Gs4K2cds/VgOjjF8l/OzoZ5sIWaBoJf4tZKuEZ5JSIPeXH72k6ufg9/d72 0ArHQunxdAuZYrq1pwizduW/h5nG0nlHI9tGx1dQ9lS5TFl82EWkj6cE5gr8kFfo FmUOyt0AM4ZYGqF1qgwEDXdSpbKrBA/CKB/K2xkcEl426DZlbO08TZ9bpsmX6pqb d9ZbN9OvZxpDmb2XIXBPWCs6z/oWEyDTa011IJPkbq7SZ2Gckrt6x5FkgIBQFR7e whEa9S0EMApEkCWVEF83Hpw/HL9UtLduRAMoxgjd81hJpQkBZ/jrwpU4aZOo3kAn 20AdipHKII3+6V8= =YEO6 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
e9d46f74ec
|
@ -423,7 +423,7 @@ static int chromeos_laptop_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct chromeos_laptop samsung_series_5_550 = {
|
||||
static const struct chromeos_laptop samsung_series_5_550 = {
|
||||
.i2c_peripherals = {
|
||||
/* Touchpad. */
|
||||
{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
|
||||
|
@ -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 = {
|
||||
/* Light Sensor. */
|
||||
{ .add = setup_tsl2583_als, I2C_ADAPTER_SMBUS },
|
||||
},
|
||||
};
|
||||
|
||||
static struct chromeos_laptop chromebook_pixel = {
|
||||
static const struct chromeos_laptop chromebook_pixel = {
|
||||
.i2c_peripherals = {
|
||||
/* Touch Screen. */
|
||||
{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_PANEL },
|
||||
|
@ -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 = {
|
||||
/* Touchpad. */
|
||||
{ .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 = {
|
||||
/* Touchpad. */
|
||||
{ .add = setup_cyapa_tp, I2C_ADAPTER_DESIGNWARE_0 },
|
||||
|
@ -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 = {
|
||||
/* Touchpad. */
|
||||
{ .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 = {
|
||||
/* Touchpad. */
|
||||
{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
|
||||
},
|
||||
};
|
||||
|
||||
static struct chromeos_laptop acer_ac700 = {
|
||||
static const struct chromeos_laptop acer_ac700 = {
|
||||
.i2c_peripherals = {
|
||||
/* Light Sensor. */
|
||||
{ .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },
|
||||
},
|
||||
};
|
||||
|
||||
static struct chromeos_laptop acer_c720 = {
|
||||
static const struct chromeos_laptop acer_c720 = {
|
||||
.i2c_peripherals = {
|
||||
/* Touchscreen. */
|
||||
{ .add = setup_atmel_1664s_ts, I2C_ADAPTER_DESIGNWARE_1 },
|
||||
|
@ -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 = {
|
||||
/* Touchpad. */
|
||||
{ .add = setup_cyapa_tp, I2C_ADAPTER_SMBUS },
|
||||
},
|
||||
};
|
||||
|
||||
static struct chromeos_laptop cr48 = {
|
||||
static const struct chromeos_laptop cr48 = {
|
||||
.i2c_peripherals = {
|
||||
/* Light Sensor. */
|
||||
{ .add = setup_tsl2563_als, I2C_ADAPTER_SMBUS },
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
#define DRV_NAME "cros_ec_lpcs"
|
||||
#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)
|
||||
{
|
||||
unsigned long one_second = jiffies + HZ;
|
||||
|
@ -54,7 +57,6 @@ static int ec_response_timed_out(void)
|
|||
static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec,
|
||||
struct cros_ec_command *msg)
|
||||
{
|
||||
struct ec_host_request *request;
|
||||
struct ec_host_response response;
|
||||
u8 sum;
|
||||
int ret = 0;
|
||||
|
@ -65,8 +67,6 @@ static int cros_ec_pkt_xfer_lpc(struct cros_ec_device *ec,
|
|||
/* Write buffer */
|
||||
cros_ec_lpc_write_bytes(EC_LPC_ADDR_HOST_PACKET, ret, ec->dout);
|
||||
|
||||
request = (struct ec_host_request *)ec->dout;
|
||||
|
||||
/* Here we go */
|
||||
sum = EC_COMMAND_PROTOCOL_3;
|
||||
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 = {
|
|||
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 */ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(dmi, cros_ec_lpc_dmi_table);
|
||||
|
@ -396,9 +403,21 @@ static struct platform_driver cros_ec_lpc_driver = {
|
|||
.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)
|
||||
{
|
||||
int ret;
|
||||
acpi_status status;
|
||||
|
||||
if (!dmi_check_system(cros_ec_lpc_dmi_table)) {
|
||||
pr_err(DRV_NAME ": unsupported system.\n");
|
||||
|
@ -415,11 +434,28 @@ static int __init cros_ec_lpc_init(void)
|
|||
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)
|
||||
{
|
||||
if (!cros_ec_lpc_acpi_device_found)
|
||||
platform_device_unregister(&cros_ec_lpc_device);
|
||||
platform_driver_unregister(&cros_ec_lpc_driver);
|
||||
cros_ec_lpc_reg_destroy();
|
||||
}
|
||||
|
|
|
@ -60,12 +60,14 @@ static int send_command(struct cros_ec_device *ec_dev,
|
|||
struct cros_ec_command *msg)
|
||||
{
|
||||
int ret;
|
||||
int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
|
||||
|
||||
if (ec_dev->proto_version > 2)
|
||||
ret = ec_dev->pkt_xfer(ec_dev, msg);
|
||||
xfer_fxn = ec_dev->pkt_xfer;
|
||||
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) {
|
||||
int i;
|
||||
struct cros_ec_command *status_msg;
|
||||
|
@ -88,7 +90,7 @@ static int send_command(struct cros_ec_device *ec_dev,
|
|||
for (i = 0; i < EC_COMMAND_RETRIES; i++) {
|
||||
usleep_range(10000, 11000);
|
||||
|
||||
ret = ec_dev->cmd_xfer(ec_dev, status_msg);
|
||||
ret = (*xfer_fxn)(ec_dev, status_msg);
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ static ssize_t show_ec_version(struct device *dev,
|
|||
count += scnprintf(buf + count, PAGE_SIZE - count,
|
||||
"Build info: EC error %d\n", msg->result);
|
||||
else {
|
||||
msg->data[sizeof(msg->data) - 1] = '\0';
|
||||
msg->data[EC_HOST_PARAM_SIZE - 1] = '\0';
|
||||
count += scnprintf(buf + count, PAGE_SIZE - count,
|
||||
"Build info: %s\n", msg->data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue