Skip to content

Commit 02d4f8a

Browse files
committed
Merge tag 'tag-chrome-platform-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux
Pull chrome platform updates from Benson Leung: "cros_ec_typec: - Check for EC device - Fix a crash when using the cros_ec_typec driver on older hardware not capable of typec commands - Make try power role optional - Mux configuration reorganization series from Prashant cros_ec_debugfs: - Fix use after free. Thanks Tzung-bi sensorhub: - cros_ec_sensorhub fixup - Split trace include file misc: - Add new mailing list for chrome-platform development: chrome-platform@lists.linux.dev Now with patchwork!" * tag 'tag-chrome-platform-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: platform/chrome: cros_ec_debugfs: detach log reader wq from devm platform: chrome: Split trace include file platform/chrome: cros_ec_typec: Update mux flags during partner removal platform/chrome: cros_ec_typec: Configure muxes at start of port update platform/chrome: cros_ec_typec: Get mux state inside configure_mux platform/chrome: cros_ec_typec: Move mux flag checks platform/chrome: cros_ec_typec: Check for EC device platform/chrome: cros_ec_typec: Make try power role optional MAINTAINERS: platform-chrome: Add new chrome-platform@lists.linux.dev list
2 parents b490207 + 0e8eb5e commit 02d4f8a

File tree

7 files changed

+186
-152
lines changed

7 files changed

+186
-152
lines changed

MAINTAINERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,6 +4640,7 @@ F: drivers/input/touchscreen/chipone_icn8505.c
46404640

46414641
CHROME HARDWARE PLATFORM SUPPORT
46424642
M: Benson Leung <bleung@chromium.org>
4643+
L: chrome-platform@lists.linux.dev
46434644
S: Maintained
46444645
T: git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
46454646
F: drivers/platform/chrome/
@@ -4648,25 +4649,29 @@ CHROMEOS EC CODEC DRIVER
46484649
M: Cheng-Yi Chiang <cychiang@chromium.org>
46494650
M: Tzung-Bi Shih <tzungbi@google.com>
46504651
R: Guenter Roeck <groeck@chromium.org>
4652+
L: chrome-platform@lists.linux.dev
46514653
S: Maintained
46524654
F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
46534655
F: sound/soc/codecs/cros_ec_codec.*
46544656

46554657
CHROMEOS EC SUBDRIVERS
46564658
M: Benson Leung <bleung@chromium.org>
46574659
R: Guenter Roeck <groeck@chromium.org>
4660+
L: chrome-platform@lists.linux.dev
46584661
S: Maintained
46594662
F: drivers/power/supply/cros_usbpd-charger.c
46604663
N: cros_ec
46614664
N: cros-ec
46624665

46634666
CHROMEOS EC USB TYPE-C DRIVER
46644667
M: Prashant Malani <pmalani@chromium.org>
4668+
L: chrome-platform@lists.linux.dev
46654669
S: Maintained
46664670
F: drivers/platform/chrome/cros_ec_typec.c
46674671

46684672
CHROMEOS EC USB PD NOTIFY DRIVER
46694673
M: Prashant Malani <pmalani@chromium.org>
4674+
L: chrome-platform@lists.linux.dev
46704675
S: Maintained
46714676
F: drivers/platform/chrome/cros_usbpd_notify.c
46724677
F: include/linux/platform_data/cros_usbpd_notify.h

drivers/platform/chrome/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# tell define_trace.h where to find the cros ec trace header
44
CFLAGS_cros_ec_trace.o:= -I$(src)
5+
CFLAGS_cros_ec_sensorhub_ring.o:= -I$(src)
56

67
obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o
78
obj-$(CONFIG_CHROMEOS_PRIVACY_SCREEN) += chromeos_privacy_screen.o
@@ -21,7 +22,7 @@ obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_chardev.o
2122
obj-$(CONFIG_CROS_EC_LIGHTBAR) += cros_ec_lightbar.o
2223
obj-$(CONFIG_CROS_EC_VBC) += cros_ec_vbc.o
2324
obj-$(CONFIG_CROS_EC_DEBUGFS) += cros_ec_debugfs.o
24-
cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o cros_ec_trace.o
25+
cros-ec-sensorhub-objs := cros_ec_sensorhub.o cros_ec_sensorhub_ring.o
2526
obj-$(CONFIG_CROS_EC_SENSORHUB) += cros-ec-sensorhub.o
2627
obj-$(CONFIG_CROS_EC_SYSFS) += cros_ec_sysfs.o
2728
obj-$(CONFIG_CROS_USBPD_LOGGER) += cros_usbpd_logger.o

drivers/platform/chrome/cros_ec_debugfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
#define CIRC_ADD(idx, size, value) (((idx) + (value)) & ((size) - 1))
2727

28+
/* waitqueue for log readers */
29+
static DECLARE_WAIT_QUEUE_HEAD(cros_ec_debugfs_log_wq);
30+
2831
/**
2932
* struct cros_ec_debugfs - EC debugging information.
3033
*
@@ -33,7 +36,6 @@
3336
* @log_buffer: circular buffer for console log information
3437
* @read_msg: preallocated EC command and buffer to read console log
3538
* @log_mutex: mutex to protect circular buffer
36-
* @log_wq: waitqueue for log readers
3739
* @log_poll_work: recurring task to poll EC for new console log data
3840
* @panicinfo_blob: panicinfo debugfs blob
3941
*/
@@ -44,7 +46,6 @@ struct cros_ec_debugfs {
4446
struct circ_buf log_buffer;
4547
struct cros_ec_command *read_msg;
4648
struct mutex log_mutex;
47-
wait_queue_head_t log_wq;
4849
struct delayed_work log_poll_work;
4950
/* EC panicinfo */
5051
struct debugfs_blob_wrapper panicinfo_blob;
@@ -107,7 +108,7 @@ static void cros_ec_console_log_work(struct work_struct *__work)
107108
buf_space--;
108109
}
109110

110-
wake_up(&debug_info->log_wq);
111+
wake_up(&cros_ec_debugfs_log_wq);
111112
}
112113

113114
mutex_unlock(&debug_info->log_mutex);
@@ -141,7 +142,7 @@ static ssize_t cros_ec_console_log_read(struct file *file, char __user *buf,
141142

142143
mutex_unlock(&debug_info->log_mutex);
143144

144-
ret = wait_event_interruptible(debug_info->log_wq,
145+
ret = wait_event_interruptible(cros_ec_debugfs_log_wq,
145146
CIRC_CNT(cb->head, cb->tail, LOG_SIZE));
146147
if (ret < 0)
147148
return ret;
@@ -173,7 +174,7 @@ static __poll_t cros_ec_console_log_poll(struct file *file,
173174
struct cros_ec_debugfs *debug_info = file->private_data;
174175
__poll_t mask = 0;
175176

176-
poll_wait(file, &debug_info->log_wq, wait);
177+
poll_wait(file, &cros_ec_debugfs_log_wq, wait);
177178

178179
mutex_lock(&debug_info->log_mutex);
179180
if (CIRC_CNT(debug_info->log_buffer.head,
@@ -377,7 +378,6 @@ static int cros_ec_create_console_log(struct cros_ec_debugfs *debug_info)
377378
debug_info->log_buffer.tail = 0;
378379

379380
mutex_init(&debug_info->log_mutex);
380-
init_waitqueue_head(&debug_info->log_wq);
381381

382382
debugfs_create_file("console_log", S_IFREG | 0444, debug_info->dir,
383383
debug_info, &cros_ec_console_log_fops);

drivers/platform/chrome/cros_ec_sensorhub_ring.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#include <linux/sort.h>
1818
#include <linux/slab.h>
1919

20-
#include "cros_ec_trace.h"
20+
#define CREATE_TRACE_POINTS
21+
#include "cros_ec_sensorhub_trace.h"
2122

2223
/* Precision of fixed point for the m values from the filter */
2324
#define M_PRECISION BIT(23)
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Trace events for the ChromeOS Sensorhub kernel module
4+
*
5+
* Copyright 2021 Google LLC.
6+
*/
7+
8+
#undef TRACE_SYSTEM
9+
#define TRACE_SYSTEM cros_ec
10+
11+
#if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
12+
#define _CROS_EC_SENSORHUB_TRACE_H_
13+
14+
#include <linux/types.h>
15+
#include <linux/platform_data/cros_ec_sensorhub.h>
16+
17+
#include <linux/tracepoint.h>
18+
19+
TRACE_EVENT(cros_ec_sensorhub_timestamp,
20+
TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp,
21+
s64 current_timestamp, s64 current_time),
22+
TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp,
23+
current_time),
24+
TP_STRUCT__entry(
25+
__field(u32, ec_sample_timestamp)
26+
__field(u32, ec_fifo_timestamp)
27+
__field(s64, fifo_timestamp)
28+
__field(s64, current_timestamp)
29+
__field(s64, current_time)
30+
__field(s64, delta)
31+
),
32+
TP_fast_assign(
33+
__entry->ec_sample_timestamp = ec_sample_timestamp;
34+
__entry->ec_fifo_timestamp = ec_fifo_timestamp;
35+
__entry->fifo_timestamp = fifo_timestamp;
36+
__entry->current_timestamp = current_timestamp;
37+
__entry->current_time = current_time;
38+
__entry->delta = current_timestamp - current_time;
39+
),
40+
TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
41+
__entry->ec_sample_timestamp,
42+
__entry->ec_fifo_timestamp,
43+
__entry->fifo_timestamp,
44+
__entry->current_timestamp,
45+
__entry->current_time,
46+
__entry->delta
47+
)
48+
);
49+
50+
TRACE_EVENT(cros_ec_sensorhub_data,
51+
TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp,
52+
s64 current_timestamp, s64 current_time),
53+
TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time),
54+
TP_STRUCT__entry(
55+
__field(u32, ec_sensor_num)
56+
__field(u32, ec_fifo_timestamp)
57+
__field(s64, fifo_timestamp)
58+
__field(s64, current_timestamp)
59+
__field(s64, current_time)
60+
__field(s64, delta)
61+
),
62+
TP_fast_assign(
63+
__entry->ec_sensor_num = ec_sensor_num;
64+
__entry->ec_fifo_timestamp = ec_fifo_timestamp;
65+
__entry->fifo_timestamp = fifo_timestamp;
66+
__entry->current_timestamp = current_timestamp;
67+
__entry->current_time = current_time;
68+
__entry->delta = current_timestamp - current_time;
69+
),
70+
TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
71+
__entry->ec_sensor_num,
72+
__entry->ec_fifo_timestamp,
73+
__entry->fifo_timestamp,
74+
__entry->current_timestamp,
75+
__entry->current_time,
76+
__entry->delta
77+
)
78+
);
79+
80+
TRACE_EVENT(cros_ec_sensorhub_filter,
81+
TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy),
82+
TP_ARGS(state, dx, dy),
83+
TP_STRUCT__entry(
84+
__field(s64, dx)
85+
__field(s64, dy)
86+
__field(s64, median_m)
87+
__field(s64, median_error)
88+
__field(s64, history_len)
89+
__field(s64, x)
90+
__field(s64, y)
91+
),
92+
TP_fast_assign(
93+
__entry->dx = dx;
94+
__entry->dy = dy;
95+
__entry->median_m = state->median_m;
96+
__entry->median_error = state->median_error;
97+
__entry->history_len = state->history_len;
98+
__entry->x = state->x_offset;
99+
__entry->y = state->y_offset;
100+
),
101+
TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld",
102+
__entry->dx,
103+
__entry->dy,
104+
__entry->median_m,
105+
__entry->median_error,
106+
__entry->history_len,
107+
__entry->x,
108+
__entry->y
109+
)
110+
);
111+
112+
113+
#endif /* _CROS_EC_SENSORHUB_TRACE_H_ */
114+
115+
/* this part must be outside header guard */
116+
117+
#undef TRACE_INCLUDE_PATH
118+
#define TRACE_INCLUDE_PATH .
119+
120+
#undef TRACE_INCLUDE_FILE
121+
#define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace
122+
123+
#include <trace/define_trace.h>

drivers/platform/chrome/cros_ec_trace.h

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/types.h>
1616
#include <linux/platform_data/cros_ec_commands.h>
1717
#include <linux/platform_data/cros_ec_proto.h>
18-
#include <linux/platform_data/cros_ec_sensorhub.h>
1918

2019
#include <linux/tracepoint.h>
2120

@@ -71,100 +70,6 @@ TRACE_EVENT(cros_ec_request_done,
7170
__entry->retval)
7271
);
7372

74-
TRACE_EVENT(cros_ec_sensorhub_timestamp,
75-
TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp,
76-
s64 current_timestamp, s64 current_time),
77-
TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp,
78-
current_time),
79-
TP_STRUCT__entry(
80-
__field(u32, ec_sample_timestamp)
81-
__field(u32, ec_fifo_timestamp)
82-
__field(s64, fifo_timestamp)
83-
__field(s64, current_timestamp)
84-
__field(s64, current_time)
85-
__field(s64, delta)
86-
),
87-
TP_fast_assign(
88-
__entry->ec_sample_timestamp = ec_sample_timestamp;
89-
__entry->ec_fifo_timestamp = ec_fifo_timestamp;
90-
__entry->fifo_timestamp = fifo_timestamp;
91-
__entry->current_timestamp = current_timestamp;
92-
__entry->current_time = current_time;
93-
__entry->delta = current_timestamp - current_time;
94-
),
95-
TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
96-
__entry->ec_sample_timestamp,
97-
__entry->ec_fifo_timestamp,
98-
__entry->fifo_timestamp,
99-
__entry->current_timestamp,
100-
__entry->current_time,
101-
__entry->delta
102-
)
103-
);
104-
105-
TRACE_EVENT(cros_ec_sensorhub_data,
106-
TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp,
107-
s64 current_timestamp, s64 current_time),
108-
TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time),
109-
TP_STRUCT__entry(
110-
__field(u32, ec_sensor_num)
111-
__field(u32, ec_fifo_timestamp)
112-
__field(s64, fifo_timestamp)
113-
__field(s64, current_timestamp)
114-
__field(s64, current_time)
115-
__field(s64, delta)
116-
),
117-
TP_fast_assign(
118-
__entry->ec_sensor_num = ec_sensor_num;
119-
__entry->ec_fifo_timestamp = ec_fifo_timestamp;
120-
__entry->fifo_timestamp = fifo_timestamp;
121-
__entry->current_timestamp = current_timestamp;
122-
__entry->current_time = current_time;
123-
__entry->delta = current_timestamp - current_time;
124-
),
125-
TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
126-
__entry->ec_sensor_num,
127-
__entry->ec_fifo_timestamp,
128-
__entry->fifo_timestamp,
129-
__entry->current_timestamp,
130-
__entry->current_time,
131-
__entry->delta
132-
)
133-
);
134-
135-
TRACE_EVENT(cros_ec_sensorhub_filter,
136-
TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy),
137-
TP_ARGS(state, dx, dy),
138-
TP_STRUCT__entry(
139-
__field(s64, dx)
140-
__field(s64, dy)
141-
__field(s64, median_m)
142-
__field(s64, median_error)
143-
__field(s64, history_len)
144-
__field(s64, x)
145-
__field(s64, y)
146-
),
147-
TP_fast_assign(
148-
__entry->dx = dx;
149-
__entry->dy = dy;
150-
__entry->median_m = state->median_m;
151-
__entry->median_error = state->median_error;
152-
__entry->history_len = state->history_len;
153-
__entry->x = state->x_offset;
154-
__entry->y = state->y_offset;
155-
),
156-
TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld",
157-
__entry->dx,
158-
__entry->dy,
159-
__entry->median_m,
160-
__entry->median_error,
161-
__entry->history_len,
162-
__entry->x,
163-
__entry->y
164-
)
165-
);
166-
167-
16873
#endif /* _CROS_EC_TRACE_H_ */
16974

17075
/* this part must be outside header guard */

0 commit comments

Comments
 (0)