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
10821082 } __ec_align2;
10831083
10841084 /**
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.
10861086 * @version_mask: Mask of supported versions; use EC_VER_MASK() to compare with
10871087 * a desired version.
10881088 */
@@ -1300,8 +1300,18 @@ enum ec_feature_code { · 211 unmodified lines
13001300 * mux.
13011301 */
13021302 EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK = 43,
1303− /* The MCU is a System Companion Processor (SCP) 2nd Core. */
1304− EC_FEATURE_SCP_C1 = 45,
1303+ /*
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,
13051315 };
13061316
13071317 #define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
@@ -5470,7 +5480,7 @@ struct ec_response_rollback_info { · 4162 unmodified lines
54705480 /* Issue AP reset */
54715481 #define EC_CMD_AP_RESET 0x0125
54725482
5473−/**
5483+/*
54745484 * Get the number of peripheral charge ports
54755485 */
54765486 #define EC_CMD_PCHG_COUNT 0x0134
@@ -5481,7 +5491,7 @@ struct ec_response_pchg_count { · 4 unmodified lines
54815491 uint8_t port_count;
54825492 } __ec_align1;
54835493
5484−/**
5494+/*
54855495 * Get the status of a peripheral charge port
54865496 */
54875497 #define EC_CMD_PCHG 0x0135
@@ -5726,6 +5736,8 @@ enum typec_control_command { · 238 unmodified lines
57265736 TYPEC_CONTROL_COMMAND_ENTER_MODE,
57275737 TYPEC_CONTROL_COMMAND_TBT_UFP_REPLY,
57285738 TYPEC_CONTROL_COMMAND_USB_MUX_SET,
5739+ TYPEC_CONTROL_COMMAND_BIST_SHARE_MODE,
5740+ TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
57295741 };
57305742
57315743 /* 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
57395751 uint8_t mux_flags; /* USB_PD_MUX_*-encoded USB mux state to set */
57405752 } __ec_align1;
57415753
5754+#define VDO_MAX_SIZE 7
5755+
5756+struct 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+
57425765 struct ec_params_typec_control {
57435766 uint8_t port;
57445767 uint8_t command; /* enum typec_control_command */
@@ -5754,6 +5777,8 @@ struct ec_params_typec_control { · 9 unmodified lines
57545777 uint8_t mode_to_enter; /* enum typec_mode */
57555778 uint8_t tbt_ufp_reply; /* enum typec_tbt_ufp_reply */
57565779 struct typec_usb_mux_set mux_params;
5780+ /* Used for VMD_REQ */
5781+ struct typec_vdm_req vdm_req_params;
57575782 uint8_t placeholder[128];
57585783 };
57595784 } __ec_align1;
@@ -5835,6 +5860,9 @@ enum tcpc_cc_polarity { · 75 unmodified lines
58355860 #define PD_STATUS_EVENT_DISCONNECTED BIT(3)
58365861 #define PD_STATUS_EVENT_MUX_0_SET_DONE BIT(4)
58375862 #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)
58385866
58395867 struct ec_params_typec_status {
58405868 uint8_t port;
@@ -5878,6 +5906,37 @@ struct ec_response_typec_status { · 37 unmodified lines
58785906 uint32_t sink_cap_pdos[7]; /* Max 7 PDOs can be present */
58795907 } __ec_align1;
58805908
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+
5915+struct ec_params_typec_vdm_response {
5916+ uint8_t port;
5917+} __ec_align1;
5918+
5919+struct 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+
58815940 /*****************************************************************************/
58825941 /* The command range 0x200-0x2FF is reserved for Rotor. */
58835942
include/linux/platform_data/cros_ec_proto.h+23−1
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #define __LINUX_CROS_EC_PROTO_H
1010
1111 #include <linux/device.h>
12+#include <linux/lockdep_types.h>
1213 #include <linux/mutex.h>
1314 #include <linux/notifier.h>
1415
@@ -19,7 +20,6 @@ · 4 unmodified lines
1920 #define CROS_EC_DEV_ISH_NAME "cros_ish"
2021 #define CROS_EC_DEV_PD_NAME "cros_pd"
2122 #define CROS_EC_DEV_SCP_NAME "cros_scp"
22−#define CROS_EC_DEV_SCP_C1_NAME "cros_scp_c1"
2323 #define CROS_EC_DEV_TP_NAME "cros_tp"
2424
2525 #define CROS_EC_DEV_EC_INDEX 0
@@ -41,6 +41,13 @@ · 15 unmodified lines
4141 #define EC_MAX_REQUEST_OVERHEAD 1
4242 #define EC_MAX_RESPONSE_OVERHEAD 32
4343
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+
4451 /*
4552 * Command interface between EC and AP, for LPC, I2C and SPI interfaces.
4653 */
@@ -116,6 +123,8 @@ struct cros_ec_command { · 69 unmodified lines
116123 * command. The caller should check msg.result for the EC's result
117124 * code.
118125 * @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.
119128 * @lock: One transaction at a time.
120129 * @mkbp_event_supported: 0 if MKBP not supported. Otherwise its value is
121130 * the maximum supported version of the MKBP host event
@@ -125,6 +134,15 @@ struct cros_ec_command { · 3 unmodified lines
125134 * @event_data: Raw payload transferred with the MKBP event.
126135 * @event_size: Size in bytes of the event data.
127136 * @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.
128146 * @last_event_time: exact time from the hard irq when we got notified of
129147 * a new event.
130148 * @notifier_ready: The notifier_block to let the kernel re-query EC
@@ -134,6 +152,7 @@ struct cros_ec_command { · 3 unmodified lines
134152 * main EC.
135153 * @pd: The platform_device used by the mfd driver to interface with the
136154 * PD behind an EC.
155+ * @panic_notifier: EC panic notifier.
137156 */
138157 struct cros_ec_device {
139158 /* These are used by other drivers that want to talk to the EC */
@@ -160,6 +179,7 @@ struct cros_ec_device { · 20 unmodified lines
160179 struct cros_ec_command *msg);
161180 int (*pkt_xfer)(struct cros_ec_device *ec,
162181 struct cros_ec_command *msg);
182+ struct lock_class_key lockdep_key;
163183 struct mutex lock;
164184 u8 mkbp_event_supported;
165185 bool host_sleep_v1;
@@ -176,6 +196,8 @@ struct cros_ec_device { · 10 unmodified lines
176196 /* The platform devices used by the mfd driver */
177197 struct platform_device *ec;
178198 struct platform_device *pd;
199+
200+ struct blocking_notifier_head panic_notifier;
179201 };
180202
181203 /**

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