chrome platform changes for 5.6
* CrOS EC - Refactoring of some of cros_ec's headers. include/linux/mfd/cros_ec.h now removed, new cros_ec.h added 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 -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQQCtZK6p/AktxXfkOlzbaomhzOwwgUCXjij4AAKCRBzbaomhzOw wrFjAP0bU5PFkxprCOTY9kF/cMgHPDljEPES4FVV11eGyYr3HgD/StpuIhFGrh7+ Fz96dDdNu1melyGjmMqSN/M9JFo+Hw4= =FB/I -----END PGP SIGNATURE----- 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
This commit is contained in:
Коммит
79703e014b
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* ChromeOS EC multi-function device
|
||||
*
|
||||
* Copyright (C) 2012 Google, Inc
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_MFD_CROS_EC_H
|
||||
#define __LINUX_MFD_CROS_EC_H
|
||||
|
||||
#include <linux/device.h>
|
||||
|
||||
/**
|
||||
* struct cros_ec_dev - ChromeOS EC device entry point.
|
||||
* @class_dev: Device structure used in sysfs.
|
||||
* @ec_dev: cros_ec_device structure to talk to the physical device.
|
||||
* @dev: Pointer to the platform device.
|
||||
* @debug_info: cros_ec_debugfs structure for debugging information.
|
||||
* @has_kb_wake_angle: True if at least 2 accelerometer are connected to the EC.
|
||||
* @cmd_offset: Offset to apply for each command.
|
||||
* @features: Features supported by the EC.
|
||||
*/
|
||||
struct cros_ec_dev {
|
||||
struct device class_dev;
|
||||
struct cros_ec_device *ec_dev;
|
||||
struct device *dev;
|
||||
struct cros_ec_debugfs *debug_info;
|
||||
bool has_kb_wake_angle;
|
||||
u16 cmd_offset;
|
||||
u32 features[2];
|
||||
};
|
||||
|
||||
#define to_cros_ec_dev(dev) container_of(dev, struct cros_ec_dev, class_dev)
|
||||
|
||||
#endif /* __LINUX_MFD_CROS_EC_H */
|
|
@ -12,7 +12,6 @@
|
|||
#include <linux/mutex.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
#include <linux/mfd/cros_ec.h>
|
||||
#include <linux/platform_data/cros_ec_commands.h>
|
||||
|
||||
#define CROS_EC_DEV_NAME "cros_ec"
|
||||
|
@ -185,9 +184,27 @@ struct cros_ec_platform {
|
|||
u16 cmd_offset;
|
||||
};
|
||||
|
||||
int cros_ec_suspend(struct cros_ec_device *ec_dev);
|
||||
/**
|
||||
* struct cros_ec_dev - ChromeOS EC device entry point.
|
||||
* @class_dev: Device structure used in sysfs.
|
||||
* @ec_dev: cros_ec_device structure to talk to the physical device.
|
||||
* @dev: Pointer to the platform device.
|
||||
* @debug_info: cros_ec_debugfs structure for debugging information.
|
||||
* @has_kb_wake_angle: True if at least 2 accelerometer are connected to the EC.
|
||||
* @cmd_offset: Offset to apply for each command.
|
||||
* @features: Features supported by the EC.
|
||||
*/
|
||||
struct cros_ec_dev {
|
||||
struct device class_dev;
|
||||
struct cros_ec_device *ec_dev;
|
||||
struct device *dev;
|
||||
struct cros_ec_debugfs *debug_info;
|
||||
bool has_kb_wake_angle;
|
||||
u16 cmd_offset;
|
||||
u32 features[2];
|
||||
};
|
||||
|
||||
int cros_ec_resume(struct cros_ec_device *ec_dev);
|
||||
#define to_cros_ec_dev(dev) container_of(dev, struct cros_ec_dev, class_dev)
|
||||
|
||||
int cros_ec_prepare_tx(struct cros_ec_device *ec_dev,
|
||||
struct cros_ec_command *msg);
|
||||
|
@ -201,10 +218,6 @@ int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev,
|
|||
int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev,
|
||||
struct cros_ec_command *msg);
|
||||
|
||||
int cros_ec_register(struct cros_ec_device *ec_dev);
|
||||
|
||||
int cros_ec_unregister(struct cros_ec_device *ec_dev);
|
||||
|
||||
int cros_ec_query_all(struct cros_ec_device *ec_dev);
|
||||
|
||||
int cros_ec_get_next_event(struct cros_ec_device *ec_dev,
|
||||
|
@ -217,8 +230,6 @@ int cros_ec_check_features(struct cros_ec_dev *ec, int feature);
|
|||
|
||||
int cros_ec_get_sensor_count(struct cros_ec_dev *ec);
|
||||
|
||||
bool cros_ec_handle_event(struct cros_ec_device *ec_dev);
|
||||
|
||||
/**
|
||||
* cros_ec_get_time_ns() - Return time in ns.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче