Skip to content

Commit

Permalink
Merge tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pu…
Browse files Browse the repository at this point in the history
…b/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
  • Loading branch information
torvalds committed Feb 10, 2018
2 parents 15303ba + d48b8c5 commit e9d46f7
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 19 deletions.
22 changes: 11 additions & 11 deletions drivers/platform/chrome/chromeos_laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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 },
Expand All @@ -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 },
Expand All @@ -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 },
Expand All @@ -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 },
Expand Down
44 changes: 40 additions & 4 deletions drivers/platform/chrome/cros_ec_lpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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");
Expand All @@ -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();
}
Expand Down
8 changes: 5 additions & 3 deletions drivers/platform/chrome/cros_ec_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion drivers/platform/chrome/cros_ec_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e9d46f7

Please sign in to comment.