Skip to content

Commit

Permalink
Merge tag 'tag-chrome-platform-for-v5.6' of git://git.kernel.org/pub/…
Browse files Browse the repository at this point in the history
…scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:
 "CrOS EC:

   - Refactoring of some of cros_ec's headers:

     include/linux/mfd/cros_ec.h now removed, new cros_ec.h added to
     drivers/platform/chrome which contains shared operations of cros_ec
     transport drivers.

   - Response tracing in cros_ec_proto

  Wilco EC:

   - Fix unregistration order.

   - Fix keyboard backlight probing on systems without keyboard
     backlight

   - Minor cleanup (newlines in printks, COMPILE_TEST)

  Misc:

   - chromeos_laptop converted to use i2c_new_scanned_device instead of
     i2c_new_probed_device"

* tag 'tag-chrome-platform-for-v5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec: Match implementation with headers
  platform/chrome: cros_ec: Drop unaligned.h include
  platform/chrome: wilco_ec: Allow wilco to be compiled in COMPILE_TEST
  platform/chrome: wilco_ec: Add newlines to printks
  platform/chrome: wilco_ec: Fix unregistration order
  cros_ec: treewide: Remove 'include/linux/mfd/cros_ec.h'
  platform/chrome: cros_ec_ishtp: Make init_lock static
  platform/chrome: chromeos_laptop: Convert to i2c_new_scanned_device
  platform/chrome: cros_ec_lpc: Use platform_get_irq_optional() for optional IRQs
  platform/chrome: cros_ec_proto: Add response tracing
  platform/chrome: cros_ec_trace: Match trace commands with EC commands
  • Loading branch information
Linus Torvalds committed Feb 4, 2020
2 parents eadc4e4 + 034dbec commit 79703e0
Show file tree
Hide file tree
Showing 34 changed files with 190 additions and 97 deletions.
1 change: 0 additions & 1 deletion drivers/iio/accel/cros_ec_accel_legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/kernel.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_data/cros_ec_commands.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/kernel.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/iio/kfifo_buf.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/kernel.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_data/cros_ec_commands.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/iio/light/cros_ec_light_prox.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/kernel.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/iio/pressure/cros_ec_baro.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/kernel.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/platform_data/cros_ec_commands.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/media/platform/cros-ec-cec/cros-ec-cec.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/cec.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/mfd/cros_ec.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <media/cec.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/mfd/cros_ec_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <linux/kconfig.h>
#include <linux/mfd/core.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/of_platform.h>
Expand Down
18 changes: 10 additions & 8 deletions drivers/platform/chrome/chromeos_laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct acpi_peripheral {
struct chromeos_laptop {
/*
* Note that we can't mark this pointer as const because
* i2c_new_probed_device() changes passed in I2C board info, so.
* i2c_new_scanned_device() changes passed in I2C board info, so.
*/
struct i2c_peripheral *i2c_peripherals;
unsigned int num_i2c_peripherals;
Expand All @@ -87,8 +87,8 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
* 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) {
client = i2c_new_scanned_device(adapter, info, addr_list, NULL);
if (IS_ERR(client) && alt_addr) {
struct i2c_board_info dummy_info = {
I2C_BOARD_INFO("dummy", info->addr),
};
Expand All @@ -97,22 +97,24 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter,
};
struct i2c_client *dummy;

dummy = i2c_new_probed_device(adapter, &dummy_info,
alt_addr_list, NULL);
if (dummy) {
dummy = i2c_new_scanned_device(adapter, &dummy_info,
alt_addr_list, NULL);
if (!IS_ERR(dummy)) {
pr_debug("%d-%02x is probed at %02x\n",
adapter->nr, info->addr, dummy->addr);
i2c_unregister_device(dummy);
client = i2c_new_device(adapter, info);
}
}

if (!client)
if (IS_ERR(client)) {
client = NULL;
pr_debug("failed to register device %d-%02x\n",
adapter->nr, info->addr);
else
} else {
pr_debug("added i2c device %d-%02x\n",
adapter->nr, info->addr);
}

return client;
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/platform/chrome/cros_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/suspend.h>
#include <asm/unaligned.h>

#include "cros_ec.h"

#define CROS_EC_DEV_EC_INDEX 0
#define CROS_EC_DEV_PD_INDEX 1
Expand Down
19 changes: 19 additions & 0 deletions drivers/platform/chrome/cros_ec.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* ChromeOS Embedded Controller core interface.
*
* Copyright (C) 2020 Google LLC
*/

#ifndef __CROS_EC_H
#define __CROS_EC_H

int cros_ec_register(struct cros_ec_device *ec_dev);
int cros_ec_unregister(struct cros_ec_device *ec_dev);

int cros_ec_suspend(struct cros_ec_device *ec_dev);
int cros_ec_resume(struct cros_ec_device *ec_dev);

bool cros_ec_handle_event(struct cros_ec_device *ec_dev);

#endif /* __CROS_EC_H */
1 change: 0 additions & 1 deletion drivers/platform/chrome/cros_ec_chardev.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/mfd/cros_ec.h>
#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/notifier.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/platform/chrome/cros_ec_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_data/cros_ec_commands.h>
Expand Down
2 changes: 2 additions & 0 deletions drivers/platform/chrome/cros_ec_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <linux/platform_device.h>
#include <linux/slab.h>

#include "cros_ec.h"

/**
* Request format for protocol v3
* byte 0 0xda (EC_COMMAND_PROTOCOL_3)
Expand Down
4 changes: 3 additions & 1 deletion drivers/platform/chrome/cros_ec_ishtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/intel-ish-client-if.h>

#include "cros_ec.h"

/*
* ISH TX/RX ring buffer pool size
*
Expand Down Expand Up @@ -76,7 +78,7 @@ struct cros_ish_in_msg {
*
* The writers are .reset() and .probe() function.
*/
DECLARE_RWSEM(init_lock);
static DECLARE_RWSEM(init_lock);

/**
* struct response_info - Encapsulate firmware response related
Expand Down
1 change: 0 additions & 1 deletion drivers/platform/chrome/cros_ec_lightbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
Expand Down
3 changes: 2 additions & 1 deletion drivers/platform/chrome/cros_ec_lpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/printk.h>
#include <linux/suspend.h>

#include "cros_ec.h"
#include "cros_ec_lpc_mec.h"

#define DRV_NAME "cros_ec_lpcs"
Expand Down Expand Up @@ -396,7 +397,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
* Some boards do not have an IRQ allotted for cros_ec_lpc,
* which makes ENXIO an expected (and safe) scenario.
*/
irq = platform_get_irq(pdev, 0);
irq = platform_get_irq_optional(pdev, 0);
if (irq > 0)
ec_dev->irq = irq;
else if (irq != -ENXIO) {
Expand Down
6 changes: 4 additions & 2 deletions drivers/platform/chrome/cros_ec_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ static int send_command(struct cros_ec_device *ec_dev,
int ret;
int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);

trace_cros_ec_cmd(msg);

if (ec_dev->proto_version > 2)
xfer_fxn = ec_dev->pkt_xfer;
else
Expand All @@ -72,7 +70,9 @@ static int send_command(struct cros_ec_device *ec_dev,
return -EIO;
}

trace_cros_ec_request_start(msg);
ret = (*xfer_fxn)(ec_dev, msg);
trace_cros_ec_request_done(msg, ret);
if (msg->result == EC_RES_IN_PROGRESS) {
int i;
struct cros_ec_command *status_msg;
Expand All @@ -95,7 +95,9 @@ static int send_command(struct cros_ec_device *ec_dev,
for (i = 0; i < EC_COMMAND_RETRIES; i++) {
usleep_range(10000, 11000);

trace_cros_ec_request_start(status_msg);
ret = (*xfer_fxn)(ec_dev, status_msg);
trace_cros_ec_request_done(status_msg, ret);
if (ret == -EAGAIN)
continue;
if (ret < 0)
Expand Down
2 changes: 2 additions & 0 deletions drivers/platform/chrome/cros_ec_rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <linux/rpmsg.h>
#include <linux/slab.h>

#include "cros_ec.h"

#define EC_MSG_TIMEOUT_MS 200
#define HOST_COMMAND_MARK 1
#define HOST_EVENT_MARK 2
Expand Down
1 change: 0 additions & 1 deletion drivers/platform/chrome/cros_ec_sensorhub.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <linux/init.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/mfd/cros_ec.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_data/cros_ec_sensorhub.h>
Expand Down
2 changes: 2 additions & 0 deletions drivers/platform/chrome/cros_ec_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <linux/spi/spi.h>
#include <uapi/linux/sched/types.h>

#include "cros_ec.h"

/* The header byte, which follows the preamble */
#define EC_MSG_HEADER 0xec

Expand Down
1 change: 0 additions & 1 deletion drivers/platform/chrome/cros_ec_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/mfd/cros_ec.h>
#include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
Expand Down
Loading

0 comments on commit 79703e0

Please sign in to comment.