diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-02-04 10:17:41 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-02-04 10:17:41 +0300 |
commit | 79703e014ba02ad86af4bcdf0c16e4b208cca406 (patch) | |
tree | 2d7f0345352218cc3b2b46eda6073d385c94e069 /drivers | |
parent | eadc4e40e68832fc61ae5e3ef2ef5cfcd9308b2c (diff) | |
parent | 034dbec179e5d2820480f477c43acbc50245e56d (diff) | |
download | linux-79703e014ba02ad86af4bcdf0c16e4b208cca406.tar.xz |
Merge tag 'tag-chrome-platform-for-v5.6' of git://git.kernel.org/pub/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
Diffstat (limited to 'drivers')
32 files changed, 170 insertions, 53 deletions
diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/cros_ec_accel_legacy.c index 65f85faf6f31..68e847c6255e 100644 --- a/drivers/iio/accel/cros_ec_accel_legacy.c +++ b/drivers/iio/accel/cros_ec_accel_legacy.c @@ -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> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c index 7dce04473467..576e45faafaf 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c @@ -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> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 81a7f692de2f..d3a3626c7cd8 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -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> diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cros_ec_light_prox.c index d85a391e50c5..7a838e2956f4 100644 --- a/drivers/iio/light/cros_ec_light_prox.c +++ b/drivers/iio/light/cros_ec_light_prox.c @@ -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> diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c index 52f53f3123b1..b521bebd551c 100644 --- a/drivers/iio/pressure/cros_ec_baro.c +++ b/drivers/iio/pressure/cros_ec_baro.c @@ -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> diff --git a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c index f048e8994785..0e7e2772f08f 100644 --- a/drivers/media/platform/cros-ec-cec/cros-ec-cec.c +++ b/drivers/media/platform/cros-ec-cec/cros-ec-cec.c @@ -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> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index d0c28a4c10ad..39e611695053 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -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> diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index 8723bcf10c93..4f3651fcd9fe 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -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; @@ -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), }; @@ -97,9 +97,9 @@ 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); @@ -107,12 +107,14 @@ chromes_laptop_instantiate_i2c_device(struct i2c_adapter *adapter, } } - 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; } diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cros_ec.c index 6d6ce86a1408..6fc8f2c3ac51 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -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 diff --git a/drivers/platform/chrome/cros_ec.h b/drivers/platform/chrome/cros_ec.h new file mode 100644 index 000000000000..e69fc1ff68b4 --- /dev/null +++ b/drivers/platform/chrome/cros_ec.h @@ -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 */ diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c index 74ded441bb50..c65e70bc168d 100644 --- a/drivers/platform/chrome/cros_ec_chardev.c +++ b/drivers/platform/chrome/cros_ec_chardev.c @@ -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> diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c index 6ae484989d1f..ecfada00e6c5 100644 --- a/drivers/platform/chrome/cros_ec_debugfs.c +++ b/drivers/platform/chrome/cros_ec_debugfs.c @@ -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> diff --git a/drivers/platform/chrome/cros_ec_i2c.c b/drivers/platform/chrome/cros_ec_i2c.c index 9bd97bc8454b..6119eccd8a18 100644 --- a/drivers/platform/chrome/cros_ec_i2c.c +++ b/drivers/platform/chrome/cros_ec_i2c.c @@ -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) diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c index e5996821d08b..93a71e93a2f1 100644 --- a/drivers/platform/chrome/cros_ec_ishtp.c +++ b/drivers/platform/chrome/cros_ec_ishtp.c @@ -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 * @@ -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 diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c index c0f2eec35a48..b4c110c5fee0 100644 --- a/drivers/platform/chrome/cros_ec_lightbar.c +++ b/drivers/platform/chrome/cros_ec_lightbar.c @@ -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> diff --git a/drivers/platform/chrome/cros_ec_lpc.c b/drivers/platform/chrome/cros_ec_lpc.c index dccf479c6625..1f7861944044 100644 --- a/drivers/platform/chrome/cros_ec_lpc.c +++ b/drivers/platform/chrome/cros_ec_lpc.c @@ -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" @@ -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) { diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index da1b1c450433..3cfa643f1d07 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -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 @@ -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; @@ -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) diff --git a/drivers/platform/chrome/cros_ec_rpmsg.c b/drivers/platform/chrome/cros_ec_rpmsg.c index bd068afe43b5..dbc3f5523b83 100644 --- a/drivers/platform/chrome/cros_ec_rpmsg.c +++ b/drivers/platform/chrome/cros_ec_rpmsg.c @@ -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 diff --git a/drivers/platform/chrome/cros_ec_sensorhub.c b/drivers/platform/chrome/cros_ec_sensorhub.c index 04d8879689e9..79fefd3bb0fa 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub.c +++ b/drivers/platform/chrome/cros_ec_sensorhub.c @@ -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> diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c index a831bd5a5b2f..46786d2d679a 100644 --- a/drivers/platform/chrome/cros_ec_spi.c +++ b/drivers/platform/chrome/cros_ec_spi.c @@ -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 diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c index 74d36b8d4f46..07dac97ad57c 100644 --- a/drivers/platform/chrome/cros_ec_sysfs.c +++ b/drivers/platform/chrome/cros_ec_sysfs.c @@ -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> diff --git a/drivers/platform/chrome/cros_ec_trace.c b/drivers/platform/chrome/cros_ec_trace.c index 5af1d66d9eca..523a39bd0ff6 100644 --- a/drivers/platform/chrome/cros_ec_trace.c +++ b/drivers/platform/chrome/cros_ec_trace.c @@ -8,6 +8,11 @@ // Generate the list using the following script: // sed -n 's/^#define \(EC_CMD_[[:alnum:]_]*\)\s.*/\tTRACE_SYMBOL(\1), \\/p' include/linux/platform_data/cros_ec_commands.h #define EC_CMDS \ + TRACE_SYMBOL(EC_CMD_ACPI_READ), \ + TRACE_SYMBOL(EC_CMD_ACPI_WRITE), \ + TRACE_SYMBOL(EC_CMD_ACPI_BURST_ENABLE), \ + TRACE_SYMBOL(EC_CMD_ACPI_BURST_DISABLE), \ + TRACE_SYMBOL(EC_CMD_ACPI_QUERY_EVENT), \ TRACE_SYMBOL(EC_CMD_PROTO_VERSION), \ TRACE_SYMBOL(EC_CMD_HELLO), \ TRACE_SYMBOL(EC_CMD_GET_VERSION), \ @@ -22,6 +27,8 @@ TRACE_SYMBOL(EC_CMD_GET_PROTOCOL_INFO), \ TRACE_SYMBOL(EC_CMD_GSV_PAUSE_IN_S5), \ TRACE_SYMBOL(EC_CMD_GET_FEATURES), \ + TRACE_SYMBOL(EC_CMD_GET_SKU_ID), \ + TRACE_SYMBOL(EC_CMD_SET_SKU_ID), \ TRACE_SYMBOL(EC_CMD_FLASH_INFO), \ TRACE_SYMBOL(EC_CMD_FLASH_READ), \ TRACE_SYMBOL(EC_CMD_FLASH_WRITE), \ @@ -29,6 +36,8 @@ TRACE_SYMBOL(EC_CMD_FLASH_PROTECT), \ TRACE_SYMBOL(EC_CMD_FLASH_REGION_INFO), \ TRACE_SYMBOL(EC_CMD_VBNV_CONTEXT), \ + TRACE_SYMBOL(EC_CMD_FLASH_SPI_INFO), \ + TRACE_SYMBOL(EC_CMD_FLASH_SELECT), \ TRACE_SYMBOL(EC_CMD_PWM_GET_FAN_TARGET_RPM), \ TRACE_SYMBOL(EC_CMD_PWM_SET_FAN_TARGET_RPM), \ TRACE_SYMBOL(EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT), \ @@ -40,6 +49,8 @@ TRACE_SYMBOL(EC_CMD_LED_CONTROL), \ TRACE_SYMBOL(EC_CMD_VBOOT_HASH), \ TRACE_SYMBOL(EC_CMD_MOTION_SENSE_CMD), \ + TRACE_SYMBOL(EC_CMD_FORCE_LID_OPEN), \ + TRACE_SYMBOL(EC_CMD_CONFIG_POWER_BUTTON), \ TRACE_SYMBOL(EC_CMD_USB_CHARGE_SET_MODE), \ TRACE_SYMBOL(EC_CMD_PSTORE_INFO), \ TRACE_SYMBOL(EC_CMD_PSTORE_READ), \ @@ -50,6 +61,9 @@ TRACE_SYMBOL(EC_CMD_RTC_SET_ALARM), \ TRACE_SYMBOL(EC_CMD_PORT80_LAST_BOOT), \ TRACE_SYMBOL(EC_CMD_PORT80_READ), \ + TRACE_SYMBOL(EC_CMD_VSTORE_INFO), \ + TRACE_SYMBOL(EC_CMD_VSTORE_READ), \ + TRACE_SYMBOL(EC_CMD_VSTORE_WRITE), \ TRACE_SYMBOL(EC_CMD_THERMAL_SET_THRESHOLD), \ TRACE_SYMBOL(EC_CMD_THERMAL_GET_THRESHOLD), \ TRACE_SYMBOL(EC_CMD_THERMAL_AUTO_FAN_CTRL), \ @@ -59,10 +73,12 @@ TRACE_SYMBOL(EC_CMD_MKBP_STATE), \ TRACE_SYMBOL(EC_CMD_MKBP_INFO), \ TRACE_SYMBOL(EC_CMD_MKBP_SIMULATE_KEY), \ + TRACE_SYMBOL(EC_CMD_GET_KEYBOARD_ID), \ TRACE_SYMBOL(EC_CMD_MKBP_SET_CONFIG), \ TRACE_SYMBOL(EC_CMD_MKBP_GET_CONFIG), \ TRACE_SYMBOL(EC_CMD_KEYSCAN_SEQ_CTRL), \ TRACE_SYMBOL(EC_CMD_GET_NEXT_EVENT), \ + TRACE_SYMBOL(EC_CMD_KEYBOARD_FACTORY_TEST), \ TRACE_SYMBOL(EC_CMD_TEMP_SENSOR_GET_INFO), \ TRACE_SYMBOL(EC_CMD_HOST_EVENT_GET_B), \ TRACE_SYMBOL(EC_CMD_HOST_EVENT_GET_SMI_MASK), \ @@ -73,6 +89,7 @@ TRACE_SYMBOL(EC_CMD_HOST_EVENT_CLEAR), \ TRACE_SYMBOL(EC_CMD_HOST_EVENT_SET_WAKE_MASK), \ TRACE_SYMBOL(EC_CMD_HOST_EVENT_CLEAR_B), \ + TRACE_SYMBOL(EC_CMD_HOST_EVENT), \ TRACE_SYMBOL(EC_CMD_SWITCH_ENABLE_BKLIGHT), \ TRACE_SYMBOL(EC_CMD_SWITCH_ENABLE_WIRELESS), \ TRACE_SYMBOL(EC_CMD_GPIO_SET), \ @@ -92,36 +109,102 @@ TRACE_SYMBOL(EC_CMD_CHARGE_STATE), \ TRACE_SYMBOL(EC_CMD_CHARGE_CURRENT_LIMIT), \ TRACE_SYMBOL(EC_CMD_EXTERNAL_POWER_LIMIT), \ + TRACE_SYMBOL(EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT), \ + TRACE_SYMBOL(EC_CMD_HIBERNATION_DELAY), \ TRACE_SYMBOL(EC_CMD_HOST_SLEEP_EVENT), \ + TRACE_SYMBOL(EC_CMD_DEVICE_EVENT), \ TRACE_SYMBOL(EC_CMD_SB_READ_WORD), \ TRACE_SYMBOL(EC_CMD_SB_WRITE_WORD), \ TRACE_SYMBOL(EC_CMD_SB_READ_BLOCK), \ TRACE_SYMBOL(EC_CMD_SB_WRITE_BLOCK), \ TRACE_SYMBOL(EC_CMD_BATTERY_VENDOR_PARAM), \ + TRACE_SYMBOL(EC_CMD_SB_FW_UPDATE), \ + TRACE_SYMBOL(EC_CMD_ENTERING_MODE), \ + TRACE_SYMBOL(EC_CMD_I2C_PASSTHRU_PROTECT), \ + TRACE_SYMBOL(EC_CMD_CEC_WRITE_MSG), \ + TRACE_SYMBOL(EC_CMD_CEC_SET), \ + TRACE_SYMBOL(EC_CMD_CEC_GET), \ TRACE_SYMBOL(EC_CMD_EC_CODEC), \ TRACE_SYMBOL(EC_CMD_EC_CODEC_DMIC), \ TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \ TRACE_SYMBOL(EC_CMD_EC_CODEC_WOV), \ TRACE_SYMBOL(EC_CMD_REBOOT_EC), \ TRACE_SYMBOL(EC_CMD_GET_PANIC_INFO), \ - TRACE_SYMBOL(EC_CMD_ACPI_READ), \ - TRACE_SYMBOL(EC_CMD_ACPI_WRITE), \ - TRACE_SYMBOL(EC_CMD_ACPI_QUERY_EVENT), \ - TRACE_SYMBOL(EC_CMD_CEC_WRITE_MSG), \ - TRACE_SYMBOL(EC_CMD_CEC_SET), \ - TRACE_SYMBOL(EC_CMD_CEC_GET), \ TRACE_SYMBOL(EC_CMD_REBOOT), \ TRACE_SYMBOL(EC_CMD_RESEND_RESPONSE), \ TRACE_SYMBOL(EC_CMD_VERSION0), \ TRACE_SYMBOL(EC_CMD_PD_EXCHANGE_STATUS), \ + TRACE_SYMBOL(EC_CMD_PD_HOST_EVENT_STATUS), \ TRACE_SYMBOL(EC_CMD_USB_PD_CONTROL), \ TRACE_SYMBOL(EC_CMD_USB_PD_PORTS), \ TRACE_SYMBOL(EC_CMD_USB_PD_POWER_INFO), \ TRACE_SYMBOL(EC_CMD_CHARGE_PORT_COUNT), \ + TRACE_SYMBOL(EC_CMD_USB_PD_FW_UPDATE), \ + TRACE_SYMBOL(EC_CMD_USB_PD_RW_HASH_ENTRY), \ + TRACE_SYMBOL(EC_CMD_USB_PD_DEV_INFO), \ TRACE_SYMBOL(EC_CMD_USB_PD_DISCOVERY), \ TRACE_SYMBOL(EC_CMD_PD_CHARGE_PORT_OVERRIDE), \ TRACE_SYMBOL(EC_CMD_PD_GET_LOG_ENTRY), \ - TRACE_SYMBOL(EC_CMD_USB_PD_MUX_INFO) + TRACE_SYMBOL(EC_CMD_USB_PD_GET_AMODE), \ + TRACE_SYMBOL(EC_CMD_USB_PD_SET_AMODE), \ + TRACE_SYMBOL(EC_CMD_PD_WRITE_LOG_ENTRY), \ + TRACE_SYMBOL(EC_CMD_PD_CONTROL), \ + TRACE_SYMBOL(EC_CMD_USB_PD_MUX_INFO), \ + TRACE_SYMBOL(EC_CMD_PD_CHIP_INFO), \ + TRACE_SYMBOL(EC_CMD_RWSIG_CHECK_STATUS), \ + TRACE_SYMBOL(EC_CMD_RWSIG_ACTION), \ + TRACE_SYMBOL(EC_CMD_EFS_VERIFY), \ + TRACE_SYMBOL(EC_CMD_GET_CROS_BOARD_INFO), \ + TRACE_SYMBOL(EC_CMD_SET_CROS_BOARD_INFO), \ + TRACE_SYMBOL(EC_CMD_GET_UPTIME_INFO), \ + TRACE_SYMBOL(EC_CMD_ADD_ENTROPY), \ + TRACE_SYMBOL(EC_CMD_ADC_READ), \ + TRACE_SYMBOL(EC_CMD_ROLLBACK_INFO), \ + TRACE_SYMBOL(EC_CMD_AP_RESET), \ + TRACE_SYMBOL(EC_CMD_CR51_BASE), \ + TRACE_SYMBOL(EC_CMD_CR51_LAST), \ + TRACE_SYMBOL(EC_CMD_FP_PASSTHRU), \ + TRACE_SYMBOL(EC_CMD_FP_MODE), \ + TRACE_SYMBOL(EC_CMD_FP_INFO), \ + TRACE_SYMBOL(EC_CMD_FP_FRAME), \ + TRACE_SYMBOL(EC_CMD_FP_TEMPLATE), \ + TRACE_SYMBOL(EC_CMD_FP_CONTEXT), \ + TRACE_SYMBOL(EC_CMD_FP_STATS), \ + TRACE_SYMBOL(EC_CMD_FP_SEED), \ + TRACE_SYMBOL(EC_CMD_FP_ENC_STATUS), \ + TRACE_SYMBOL(EC_CMD_TP_SELF_TEST), \ + TRACE_SYMBOL(EC_CMD_TP_FRAME_INFO), \ + TRACE_SYMBOL(EC_CMD_TP_FRAME_SNAPSHOT), \ + TRACE_SYMBOL(EC_CMD_TP_FRAME_GET), \ + TRACE_SYMBOL(EC_CMD_BATTERY_GET_STATIC), \ + TRACE_SYMBOL(EC_CMD_BATTERY_GET_DYNAMIC), \ + TRACE_SYMBOL(EC_CMD_CHARGER_CONTROL), \ + TRACE_SYMBOL(EC_CMD_BOARD_SPECIFIC_BASE), \ + TRACE_SYMBOL(EC_CMD_BOARD_SPECIFIC_LAST) + +/* See the enum ec_status in include/linux/platform_data/cros_ec_commands.h */ +#define EC_RESULT \ + TRACE_SYMBOL(EC_RES_SUCCESS), \ + TRACE_SYMBOL(EC_RES_INVALID_COMMAND), \ + TRACE_SYMBOL(EC_RES_ERROR), \ + TRACE_SYMBOL(EC_RES_INVALID_PARAM), \ + TRACE_SYMBOL(EC_RES_ACCESS_DENIED), \ + TRACE_SYMBOL(EC_RES_INVALID_RESPONSE), \ + TRACE_SYMBOL(EC_RES_INVALID_VERSION), \ + TRACE_SYMBOL(EC_RES_INVALID_CHECKSUM), \ + TRACE_SYMBOL(EC_RES_IN_PROGRESS), \ + TRACE_SYMBOL(EC_RES_UNAVAILABLE), \ + TRACE_SYMBOL(EC_RES_TIMEOUT), \ + TRACE_SYMBOL(EC_RES_OVERFLOW), \ + TRACE_SYMBOL(EC_RES_INVALID_HEADER), \ + TRACE_SYMBOL(EC_RES_REQUEST_TRUNCATED), \ + TRACE_SYMBOL(EC_RES_RESPONSE_TOO_BIG), \ + TRACE_SYMBOL(EC_RES_BUS_ERROR), \ + TRACE_SYMBOL(EC_RES_BUSY), \ + TRACE_SYMBOL(EC_RES_INVALID_HEADER_VERSION), \ + TRACE_SYMBOL(EC_RES_INVALID_HEADER_CRC), \ + TRACE_SYMBOL(EC_RES_INVALID_DATA_CRC), \ + TRACE_SYMBOL(EC_RES_DUP_UNAVAILABLE) #define CREATE_TRACE_POINTS #include "cros_ec_trace.h" diff --git a/drivers/platform/chrome/cros_ec_trace.h b/drivers/platform/chrome/cros_ec_trace.h index 0dd4df30fa89..e9fb05f89ef0 100644 --- a/drivers/platform/chrome/cros_ec_trace.h +++ b/drivers/platform/chrome/cros_ec_trace.h @@ -18,7 +18,7 @@ #include <linux/tracepoint.h> -DECLARE_EVENT_CLASS(cros_ec_cmd_class, +TRACE_EVENT(cros_ec_request_start, TP_PROTO(struct cros_ec_command *cmd), TP_ARGS(cmd), TP_STRUCT__entry( @@ -33,10 +33,26 @@ DECLARE_EVENT_CLASS(cros_ec_cmd_class, __print_symbolic(__entry->command, EC_CMDS)) ); - -DEFINE_EVENT(cros_ec_cmd_class, cros_ec_cmd, - TP_PROTO(struct cros_ec_command *cmd), - TP_ARGS(cmd) +TRACE_EVENT(cros_ec_request_done, + TP_PROTO(struct cros_ec_command *cmd, int retval), + TP_ARGS(cmd, retval), + TP_STRUCT__entry( + __field(uint32_t, version) + __field(uint32_t, command) + __field(uint32_t, result) + __field(int, retval) + ), + TP_fast_assign( + __entry->version = cmd->version; + __entry->command = cmd->command; + __entry->result = cmd->result; + __entry->retval = retval; + ), + TP_printk("version: %u, command: %s, ec result: %s, retval: %d", + __entry->version, + __print_symbolic(__entry->command, EC_CMDS), + __print_symbolic(__entry->result, EC_RESULT), + __entry->retval) ); diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/platform/chrome/cros_ec_vbc.c index f11a1283e5c8..8edae465105c 100644 --- a/drivers/platform/chrome/cros_ec_vbc.c +++ b/drivers/platform/chrome/cros_ec_vbc.c @@ -6,7 +6,6 @@ #include <linux/of.h> #include <linux/platform_device.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> diff --git a/drivers/platform/chrome/cros_usbpd_logger.c b/drivers/platform/chrome/cros_usbpd_logger.c index 374cdd1e868a..7de3ea75ef46 100644 --- a/drivers/platform/chrome/cros_usbpd_logger.c +++ b/drivers/platform/chrome/cros_usbpd_logger.c @@ -6,7 +6,6 @@ */ #include <linux/ktime.h> -#include <linux/mfd/cros_ec.h> #include <linux/math64.h> #include <linux/module.h> #include <linux/platform_data/cros_ec_commands.h> diff --git a/drivers/platform/chrome/wilco_ec/Kconfig b/drivers/platform/chrome/wilco_ec/Kconfig index 365f30e116ee..49e8530ca0ac 100644 --- a/drivers/platform/chrome/wilco_ec/Kconfig +++ b/drivers/platform/chrome/wilco_ec/Kconfig @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only config WILCO_EC tristate "ChromeOS Wilco Embedded Controller" - depends on ACPI && X86 && CROS_EC_LPC && LEDS_CLASS + depends on X86 || COMPILE_TEST + depends on ACPI && CROS_EC_LPC && LEDS_CLASS help If you say Y here, you get support for talking to the ChromeOS Wilco EC over an eSPI bus. This uses a simple byte-level protocol diff --git a/drivers/platform/chrome/wilco_ec/core.c b/drivers/platform/chrome/wilco_ec/core.c index 5210c357feef..5b42992bff38 100644 --- a/drivers/platform/chrome/wilco_ec/core.c +++ b/drivers/platform/chrome/wilco_ec/core.c @@ -94,7 +94,7 @@ static int wilco_ec_probe(struct platform_device *pdev) ret = wilco_ec_add_sysfs(ec); if (ret < 0) { - dev_err(dev, "Failed to create sysfs entries: %d", ret); + dev_err(dev, "Failed to create sysfs entries: %d\n", ret); goto unregister_rtc; } @@ -137,9 +137,9 @@ static int wilco_ec_remove(struct platform_device *pdev) { struct wilco_ec_device *ec = platform_get_drvdata(pdev); + platform_device_unregister(ec->telem_pdev); platform_device_unregister(ec->charger_pdev); wilco_ec_remove_sysfs(ec); - platform_device_unregister(ec->telem_pdev); platform_device_unregister(ec->rtc_pdev); if (ec->debugfs_pdev) platform_device_unregister(ec->debugfs_pdev); diff --git a/drivers/platform/chrome/wilco_ec/keyboard_leds.c b/drivers/platform/chrome/wilco_ec/keyboard_leds.c index 5731d1b60e28..6ce9c6782065 100644 --- a/drivers/platform/chrome/wilco_ec/keyboard_leds.c +++ b/drivers/platform/chrome/wilco_ec/keyboard_leds.c @@ -69,7 +69,7 @@ static int send_kbbl_msg(struct wilco_ec_device *ec, ret = wilco_ec_mailbox(ec, &msg); if (ret < 0) { dev_err(ec->dev, - "Failed sending keyboard LEDs command: %d", ret); + "Failed sending keyboard LEDs command: %d\n", ret); return ret; } @@ -94,7 +94,7 @@ static int set_kbbl(struct wilco_ec_device *ec, enum led_brightness brightness) if (response.status) { dev_err(ec->dev, - "EC reported failure sending keyboard LEDs command: %d", + "EC reported failure sending keyboard LEDs command: %d\n", response.status); return -EIO; } @@ -147,7 +147,7 @@ static int kbbl_init(struct wilco_ec_device *ec) if (response.status) { dev_err(ec->dev, - "EC reported failure sending keyboard LEDs command: %d", + "EC reported failure sending keyboard LEDs command: %d\n", response.status); return -EIO; } @@ -179,7 +179,7 @@ int wilco_keyboard_leds_init(struct wilco_ec_device *ec) ret = kbbl_exist(ec, &leds_exist); if (ret < 0) { dev_err(ec->dev, - "Failed checking keyboard LEDs support: %d", ret); + "Failed checking keyboard LEDs support: %d\n", ret); return ret; } if (!leds_exist) diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c index ced1f9f3dcee..0f98358ea824 100644 --- a/drivers/platform/chrome/wilco_ec/mailbox.c +++ b/drivers/platform/chrome/wilco_ec/mailbox.c @@ -163,13 +163,13 @@ static int wilco_ec_transfer(struct wilco_ec_device *ec, } if (rs->data_size != EC_MAILBOX_DATA_SIZE) { - dev_dbg(ec->dev, "unexpected packet size (%u != %u)", + dev_dbg(ec->dev, "unexpected packet size (%u != %u)\n", rs->data_size, EC_MAILBOX_DATA_SIZE); return -EMSGSIZE; } if (rs->data_size < msg->response_size) { - dev_dbg(ec->dev, "EC didn't return enough data (%u < %zu)", + dev_dbg(ec->dev, "EC didn't return enough data (%u < %zu)\n", rs->data_size, msg->response_size); return -EMSGSIZE; } diff --git a/drivers/platform/chrome/wilco_ec/telemetry.c b/drivers/platform/chrome/wilco_ec/telemetry.c index 1176d543191a..e06d96fb9426 100644 --- a/drivers/platform/chrome/wilco_ec/telemetry.c +++ b/drivers/platform/chrome/wilco_ec/telemetry.c @@ -367,7 +367,7 @@ static int telem_device_probe(struct platform_device *pdev) minor = ida_alloc_max(&telem_ida, TELEM_MAX_DEV-1, GFP_KERNEL); if (minor < 0) { error = minor; - dev_err(&pdev->dev, "Failed to find minor number: %d", error); + dev_err(&pdev->dev, "Failed to find minor number: %d\n", error); return error; } @@ -427,14 +427,14 @@ static int __init telem_module_init(void) ret = class_register(&telem_class); if (ret) { - pr_err(DRV_NAME ": Failed registering class: %d", ret); + pr_err(DRV_NAME ": Failed registering class: %d\n", ret); return ret; } /* Request the kernel for device numbers, starting with minor=0 */ ret = alloc_chrdev_region(&dev_num, 0, TELEM_MAX_DEV, TELEM_DEV_NAME); if (ret) { - pr_err(DRV_NAME ": Failed allocating dev numbers: %d", ret); + pr_err(DRV_NAME ": Failed allocating dev numbers: %d\n", ret); goto destroy_class; } telem_major = MAJOR(dev_num); diff --git a/drivers/power/supply/cros_usbpd-charger.c b/drivers/power/supply/cros_usbpd-charger.c index ffad9ee03a68..30c3d37511c9 100644 --- a/drivers/power/supply/cros_usbpd-charger.c +++ b/drivers/power/supply/cros_usbpd-charger.c @@ -5,7 +5,6 @@ * Copyright (c) 2014 - 2018 Google, Inc */ -#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> diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c index d043d30f05bc..f7343c289cab 100644 --- a/drivers/rtc/rtc-cros-ec.c +++ b/drivers/rtc/rtc-cros-ec.c @@ -5,7 +5,6 @@ // Author: Stephen Barber <smbarber@chromium.org> #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> |