History

Merge tag 'tag-chrome-platform-for-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Tzung-Bi Shih: "New drivers: - cros_ec_uart for ChromeOS EC protocol over UART - cros_typec_vdm for USB PD Vendor Defined Message Improvements: - Preserve logs as much as possible when EC panics - Shutdown to refrain from potential HW damages when EC panics Fixes: - Fix DP_PORT_VDO to include DP_CAP_RECEPTACLE - Fix a lockdep false positive Cleanups: - Use sysfs_emit*() instead of scnprintf() - Use asm instead of asm-generic for unaligned.h Misc: - Rename module name from cros_ec_typec to cros-ec-typec - Minor fixes" * tag 'tag-chrome-platform-for-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (34 commits) platform/chrome: cros_ec_typec: Fix spelling mistake platform/chrome: cros_typec_vdm: Add Attention support platform/chrome: cros_ec: Add VDM attention headers platform/chrome: cros_typec_vdm: Fix VDO copy platform/chrome: cros_ec_typec: allow deferred probe of switch handles platform/chrome: cros_ec_proto: remove big stub objects from stack platform/chrome: cros_ec_uart: fix negative type promoted to high platform/chrome: cros_ec: Use per-device lockdep key platform/chrome: fix kernel-doc warnings for cros_ec_command platform/chrome: fix kernel-doc warning for last_resume_result platform/chrome: fix kernel-doc warning for suspend_timeout_ms platform/chrome: fix kernel-doc warnings for panic notifier platform/chrome: cros_ec_lpc: initialize the buf variable platform/chrome: cros_ec: Fix panic notifier registration platform/chrome: cros_typec_switch: Check for retimer flag platform/chrome: cros_typec_switch: Use fwnode* prop check platform/chrome: cros_typec_vdm: Add VDM send support platform/chrome: cros_typec_vdm: Add VDM reply support platform/chrome: cros_ec_typec: Add initial VDM support platform/chrome: cros_ec_typec: Alter module name with hyphens ...

Linus Torvalds committed 3 years ago

Commit 5f5ce6b2 parents 239451e b0d8a6719 files · +846 −147Browse files

Showing the changes to include/linux/platform_data (2 of 19 files). Show all

Unified · Split

2 files
  1. include/linux/platform_data/cros_ec_commands.h +64 −5
  2. include/linux/platform_data/cros_ec_proto.h +23 −1
include/linux/platform_data/cros_ec_commands.h+64−5
@@ -1082,7 +1082,7 @@ struct ec_params_get_cmd_versions_v1 { · 1081 unmodified lines
1082} __ec_align2;1082} __ec_align2;
1083 1083
1084/**1084/**
1085 * struct ec_response_get_cmd_version - Response to the get command versions.1085 * struct ec_response_get_cmd_versions - Response to the get command versions.
1086 * @version_mask: Mask of supported versions; use EC_VER_MASK() to compare with1086 * @version_mask: Mask of supported versions; use EC_VER_MASK() to compare with
1087 * a desired version.1087 * a desired version.
1088 */1088 */
@@ -1300,8 +1300,18 @@ enum ec_feature_code { · 211 unmodified lines
1300 * mux.1300 * mux.
1301 */1301 */
1302 EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK = 43,1302 EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK = 43,
1303 /* The MCU is a System Companion Processor (SCP) 2nd Core. */1303 /*
1304 EC_FEATURE_SCP_C1 = 45,1304 * The EC supports entering and residing in S4.
1305 */
1306 EC_FEATURE_S4_RESIDENCY = 44,
1307 /*
1308 * The EC supports the AP directing mux sets for the board.
1309 */
1310 EC_FEATURE_TYPEC_AP_MUX_SET = 45,
1311 /*
1312 * The EC supports the AP composing VDMs for us to send.
1313 */
1314 EC_FEATURE_TYPEC_AP_VDM_SEND = 46,
1305};1315};
1306 1316
1307#define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)1317#define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
@@ -5470,7 +5480,7 @@ struct ec_response_rollback_info { · 4162 unmodified lines
5470/* Issue AP reset */5480/* Issue AP reset */
5471#define EC_CMD_AP_RESET 0x01255481#define EC_CMD_AP_RESET 0x0125
5472 5482
5473/**5483/*
5474 * Get the number of peripheral charge ports5484 * Get the number of peripheral charge ports
5475 */5485 */
5476#define EC_CMD_PCHG_COUNT 0x01345486#define EC_CMD_PCHG_COUNT 0x0134
@@ -5481,7 +5491,7 @@ struct ec_response_pchg_count { · 4 unmodified lines
5481 uint8_t port_count;5491 uint8_t port_count;
5482} __ec_align1;5492} __ec_align1;
5483 5493
5484/**5494/*
5485 * Get the status of a peripheral charge port5495 * Get the status of a peripheral charge port
5486 */5496 */
5487#define EC_CMD_PCHG 0x01355497#define EC_CMD_PCHG 0x0135
@@ -5726,6 +5736,8 @@ enum typec_control_command { · 238 unmodified lines
5726 TYPEC_CONTROL_COMMAND_ENTER_MODE,5736 TYPEC_CONTROL_COMMAND_ENTER_MODE,
5727 TYPEC_CONTROL_COMMAND_TBT_UFP_REPLY,5737 TYPEC_CONTROL_COMMAND_TBT_UFP_REPLY,
5728 TYPEC_CONTROL_COMMAND_USB_MUX_SET,5738 TYPEC_CONTROL_COMMAND_USB_MUX_SET,
5739 TYPEC_CONTROL_COMMAND_BIST_SHARE_MODE,
5740 TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
5729};5741};
5730 5742
5731/* Replies the AP may specify to the TBT EnterMode command as a UFP */5743/* Replies the AP may specify to the TBT EnterMode command as a UFP */
@@ -5739,6 +5751,17 @@ struct typec_usb_mux_set { · 7 unmodified lines
5739 uint8_t mux_flags; /* USB_PD_MUX_*-encoded USB mux state to set */5751 uint8_t mux_flags; /* USB_PD_MUX_*-encoded USB mux state to set */
5740} __ec_align1;5752} __ec_align1;
5741 5753
5754#define VDO_MAX_SIZE 7
5755
5756struct typec_vdm_req {
5757 /* VDM data, including VDM header */
5758 uint32_t vdm_data[VDO_MAX_SIZE];
5759 /* Number of 32-bit fields filled in */
5760 uint8_t vdm_data_objects;
5761 /* Partner to address - see enum typec_partner_type */
5762 uint8_t partner_type;
5763} __ec_align1;
5764
5742struct ec_params_typec_control {5765struct ec_params_typec_control {
5743 uint8_t port;5766 uint8_t port;
5744 uint8_t command; /* enum typec_control_command */5767 uint8_t command; /* enum typec_control_command */
@@ -5754,6 +5777,8 @@ struct ec_params_typec_control { · 9 unmodified lines
5754 uint8_t mode_to_enter; /* enum typec_mode */5777 uint8_t mode_to_enter; /* enum typec_mode */
5755 uint8_t tbt_ufp_reply; /* enum typec_tbt_ufp_reply */5778 uint8_t tbt_ufp_reply; /* enum typec_tbt_ufp_reply */
5756 struct typec_usb_mux_set mux_params;5779 struct typec_usb_mux_set mux_params;
5780 /* Used for VMD_REQ */
5781 struct typec_vdm_req vdm_req_params;
5757 uint8_t placeholder[128];5782 uint8_t placeholder[128];
5758 };5783 };
5759} __ec_align1;5784} __ec_align1;
@@ -5835,6 +5860,9 @@ enum tcpc_cc_polarity { · 75 unmodified lines
5835#define PD_STATUS_EVENT_DISCONNECTED BIT(3)5860#define PD_STATUS_EVENT_DISCONNECTED BIT(3)
5836#define PD_STATUS_EVENT_MUX_0_SET_DONE BIT(4)5861#define PD_STATUS_EVENT_MUX_0_SET_DONE BIT(4)
5837#define PD_STATUS_EVENT_MUX_1_SET_DONE BIT(5)5862#define PD_STATUS_EVENT_MUX_1_SET_DONE BIT(5)
5863#define PD_STATUS_EVENT_VDM_REQ_REPLY BIT(6)
5864#define PD_STATUS_EVENT_VDM_REQ_FAILED BIT(7)
5865#define PD_STATUS_EVENT_VDM_ATTENTION BIT(8)
5838 5866
5839struct ec_params_typec_status {5867struct ec_params_typec_status {
5840 uint8_t port;5868 uint8_t port;
@@ -5878,6 +5906,37 @@ struct ec_response_typec_status { · 37 unmodified lines
5878 uint32_t sink_cap_pdos[7]; /* Max 7 PDOs can be present */5906 uint32_t sink_cap_pdos[7]; /* Max 7 PDOs can be present */
5879} __ec_align1;5907} __ec_align1;
5880 5908
5909/*
5910 * Gather the response to the most recent VDM REQ from the AP, as well
5911 * as popping the oldest VDM:Attention from the DPM queue
5912 */
5913#define EC_CMD_TYPEC_VDM_RESPONSE 0x013C
5914
5915struct ec_params_typec_vdm_response {
5916 uint8_t port;
5917} __ec_align1;
5918
5919struct ec_response_typec_vdm_response {
5920 /* Number of 32-bit fields filled in */
5921 uint8_t vdm_data_objects;
5922 /* Partner to address - see enum typec_partner_type */
5923 uint8_t partner_type;
5924 /* enum ec_status describing VDM response */
5925 uint16_t vdm_response_err;
5926 /* VDM data, including VDM header */
5927 uint32_t vdm_response[VDO_MAX_SIZE];
5928 /* Number of 32-bit Attention fields filled in */
5929 uint8_t vdm_attention_objects;
5930 /* Number of remaining messages to consume */
5931 uint8_t vdm_attention_left;
5932 /* Reserved */
5933 uint16_t reserved1;
5934 /* VDM:Attention contents */
5935 uint32_t vdm_attention[2];
5936} __ec_align1;
5937
5938#undef VDO_MAX_SIZE
5939
5881/*****************************************************************************/5940/*****************************************************************************/
5882/* The command range 0x200-0x2FF is reserved for Rotor. */5941/* The command range 0x200-0x2FF is reserved for Rotor. */
5883 5942
include/linux/platform_data/cros_ec_proto.h+23−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
9#define __LINUX_CROS_EC_PROTO_H9#define __LINUX_CROS_EC_PROTO_H
10 10
11#include <linux/device.h>11#include <linux/device.h>
12#include <linux/lockdep_types.h>
12#include <linux/mutex.h>13#include <linux/mutex.h>
13#include <linux/notifier.h>14#include <linux/notifier.h>
14 15
@@ -19,7 +20,6 @@ · 4 unmodified lines
19#define CROS_EC_DEV_ISH_NAME "cros_ish"20#define CROS_EC_DEV_ISH_NAME "cros_ish"
20#define CROS_EC_DEV_PD_NAME "cros_pd"21#define CROS_EC_DEV_PD_NAME "cros_pd"
21#define CROS_EC_DEV_SCP_NAME "cros_scp"22#define CROS_EC_DEV_SCP_NAME "cros_scp"
22#define CROS_EC_DEV_SCP_C1_NAME "cros_scp_c1"
23#define CROS_EC_DEV_TP_NAME "cros_tp"23#define CROS_EC_DEV_TP_NAME "cros_tp"
24 24
25#define CROS_EC_DEV_EC_INDEX 025#define CROS_EC_DEV_EC_INDEX 0
@@ -41,6 +41,13 @@ · 15 unmodified lines
41#define EC_MAX_REQUEST_OVERHEAD 141#define EC_MAX_REQUEST_OVERHEAD 1
42#define EC_MAX_RESPONSE_OVERHEAD 3242#define EC_MAX_RESPONSE_OVERHEAD 32
43 43
44/*
45 * EC panic is not covered by the standard (0-F) ACPI notify values.
46 * Arbitrarily choosing B0 to notify ec panic, which is in the 84-BF
47 * device specific ACPI notify range.
48 */
49#define ACPI_NOTIFY_CROS_EC_PANIC 0xB0
50
44/*51/*
45 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.52 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
46 */53 */
@@ -116,6 +123,8 @@ struct cros_ec_command { · 69 unmodified lines
116 * command. The caller should check msg.result for the EC's result123 * command. The caller should check msg.result for the EC's result
117 * code.124 * code.
118 * @pkt_xfer: Send packet to EC and get response.125 * @pkt_xfer: Send packet to EC and get response.
126 * @lockdep_key: Lockdep class for each instance. Unused if CONFIG_LOCKDEP is
127 * not enabled.
119 * @lock: One transaction at a time.128 * @lock: One transaction at a time.
120 * @mkbp_event_supported: 0 if MKBP not supported. Otherwise its value is129 * @mkbp_event_supported: 0 if MKBP not supported. Otherwise its value is
121 * the maximum supported version of the MKBP host event130 * the maximum supported version of the MKBP host event
@@ -125,6 +134,15 @@ struct cros_ec_command { · 3 unmodified lines
125 * @event_data: Raw payload transferred with the MKBP event.134 * @event_data: Raw payload transferred with the MKBP event.
126 * @event_size: Size in bytes of the event data.135 * @event_size: Size in bytes of the event data.
127 * @host_event_wake_mask: Mask of host events that cause wake from suspend.136 * @host_event_wake_mask: Mask of host events that cause wake from suspend.
137 * @suspend_timeout_ms: The timeout in milliseconds between when sleep event
138 * is received and when the EC will declare sleep
139 * transition failure if the sleep signal is not
140 * asserted. See also struct
141 * ec_params_host_sleep_event_v1 in cros_ec_commands.h.
142 * @last_resume_result: The number of sleep power signal transitions that
143 * occurred since the suspend message. The high bit
144 * indicates a timeout occurred. See also struct
145 * ec_response_host_sleep_event_v1 in cros_ec_commands.h.
128 * @last_event_time: exact time from the hard irq when we got notified of146 * @last_event_time: exact time from the hard irq when we got notified of
129 * a new event.147 * a new event.
130 * @notifier_ready: The notifier_block to let the kernel re-query EC148 * @notifier_ready: The notifier_block to let the kernel re-query EC
@@ -134,6 +152,7 @@ struct cros_ec_command { · 3 unmodified lines
134 * main EC.152 * main EC.
135 * @pd: The platform_device used by the mfd driver to interface with the153 * @pd: The platform_device used by the mfd driver to interface with the
136 * PD behind an EC.154 * PD behind an EC.
155 * @panic_notifier: EC panic notifier.
137 */156 */
138struct cros_ec_device {157struct cros_ec_device {
139 /* These are used by other drivers that want to talk to the EC */158 /* These are used by other drivers that want to talk to the EC */
@@ -160,6 +179,7 @@ struct cros_ec_device { · 20 unmodified lines
160 struct cros_ec_command *msg);179 struct cros_ec_command *msg);
161 int (*pkt_xfer)(struct cros_ec_device *ec,180 int (*pkt_xfer)(struct cros_ec_device *ec,
162 struct cros_ec_command *msg);181 struct cros_ec_command *msg);
182 struct lock_class_key lockdep_key;
163 struct mutex lock;183 struct mutex lock;
164 u8 mkbp_event_supported;184 u8 mkbp_event_supported;
165 bool host_sleep_v1;185 bool host_sleep_v1;
@@ -176,6 +196,8 @@ struct cros_ec_device { · 10 unmodified lines
176 /* The platform devices used by the mfd driver */196 /* The platform devices used by the mfd driver */
177 struct platform_device *ec;197 struct platform_device *ec;
178 struct platform_device *pd;198 struct platform_device *pd;
199
200 struct blocking_notifier_head panic_notifier;
179};201};
180 202
181/**203/**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t