Commit 02d4f8a3 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'tag-chrome-platform-for-v5.18' of...

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
parents b4902070 0e8eb5e8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4640,6 +4640,7 @@ F: drivers/input/touchscreen/chipone_icn8505.c
CHROME HARDWARE PLATFORM SUPPORT
M:	Benson Leung <bleung@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
F:	drivers/platform/chrome/
@@ -4648,6 +4649,7 @@ CHROMEOS EC CODEC DRIVER
M:	Cheng-Yi Chiang <cychiang@chromium.org>
M:	Tzung-Bi Shih <tzungbi@google.com>
R:	Guenter Roeck <groeck@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
F:	Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
F:	sound/soc/codecs/cros_ec_codec.*
@@ -4655,6 +4657,7 @@ F: sound/soc/codecs/cros_ec_codec.*
CHROMEOS EC SUBDRIVERS
M:	Benson Leung <bleung@chromium.org>
R:	Guenter Roeck <groeck@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
F:	drivers/power/supply/cros_usbpd-charger.c
N:	cros_ec
@@ -4662,11 +4665,13 @@ N: cros-ec
CHROMEOS EC USB TYPE-C DRIVER
M:	Prashant Malani <pmalani@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
F:	drivers/platform/chrome/cros_ec_typec.c
CHROMEOS EC USB PD NOTIFY DRIVER
M:	Prashant Malani <pmalani@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
F:	drivers/platform/chrome/cros_usbpd_notify.c
F:	include/linux/platform_data/cros_usbpd_notify.h
+2 −1
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

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

obj-$(CONFIG_CHROMEOS_LAPTOP)		+= chromeos_laptop.o
obj-$(CONFIG_CHROMEOS_PRIVACY_SCREEN)	+= chromeos_privacy_screen.o
@@ -21,7 +22,7 @@ obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_chardev.o
obj-$(CONFIG_CROS_EC_LIGHTBAR)		+= cros_ec_lightbar.o
obj-$(CONFIG_CROS_EC_VBC)		+= cros_ec_vbc.o
obj-$(CONFIG_CROS_EC_DEBUGFS)		+= cros_ec_debugfs.o
cros-ec-sensorhub-objs			:= cros_ec_sensorhub.o cros_ec_sensorhub_ring.o cros_ec_trace.o
cros-ec-sensorhub-objs			:= cros_ec_sensorhub.o cros_ec_sensorhub_ring.o
obj-$(CONFIG_CROS_EC_SENSORHUB)		+= cros-ec-sensorhub.o
obj-$(CONFIG_CROS_EC_SYSFS)		+= cros_ec_sysfs.o
obj-$(CONFIG_CROS_USBPD_LOGGER)		+= cros_usbpd_logger.o
+6 −6
Original line number Diff line number Diff line
@@ -25,6 +25,9 @@

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

/* waitqueue for log readers */
static DECLARE_WAIT_QUEUE_HEAD(cros_ec_debugfs_log_wq);

/**
 * struct cros_ec_debugfs - EC debugging information.
 *
@@ -33,7 +36,6 @@
 * @log_buffer: circular buffer for console log information
 * @read_msg: preallocated EC command and buffer to read console log
 * @log_mutex: mutex to protect circular buffer
 * @log_wq: waitqueue for log readers
 * @log_poll_work: recurring task to poll EC for new console log data
 * @panicinfo_blob: panicinfo debugfs blob
 */
@@ -44,7 +46,6 @@ struct cros_ec_debugfs {
	struct circ_buf log_buffer;
	struct cros_ec_command *read_msg;
	struct mutex log_mutex;
	wait_queue_head_t log_wq;
	struct delayed_work log_poll_work;
	/* EC panicinfo */
	struct debugfs_blob_wrapper panicinfo_blob;
@@ -107,7 +108,7 @@ static void cros_ec_console_log_work(struct work_struct *__work)
			buf_space--;
		}

		wake_up(&debug_info->log_wq);
		wake_up(&cros_ec_debugfs_log_wq);
	}

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

		mutex_unlock(&debug_info->log_mutex);

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

	poll_wait(file, &debug_info->log_wq, wait);
	poll_wait(file, &cros_ec_debugfs_log_wq, wait);

	mutex_lock(&debug_info->log_mutex);
	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)
	debug_info->log_buffer.tail = 0;

	mutex_init(&debug_info->log_mutex);
	init_waitqueue_head(&debug_info->log_wq);

	debugfs_create_file("console_log", S_IFREG | 0444, debug_info->dir,
			    debug_info, &cros_ec_console_log_fops);
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
#include <linux/sort.h>
#include <linux/slab.h>

#include "cros_ec_trace.h"
#define CREATE_TRACE_POINTS
#include "cros_ec_sensorhub_trace.h"

/* Precision of fixed point for the m values from the filter */
#define M_PRECISION BIT(23)
+123 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Trace events for the ChromeOS Sensorhub kernel module
 *
 * Copyright 2021 Google LLC.
 */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM cros_ec

#if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
#define _CROS_EC_SENSORHUB_TRACE_H_

#include <linux/types.h>
#include <linux/platform_data/cros_ec_sensorhub.h>

#include <linux/tracepoint.h>

TRACE_EVENT(cros_ec_sensorhub_timestamp,
	    TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_timestamp,
		     s64 current_timestamp, s64 current_time),
	TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_timestamp,
		current_time),
	TP_STRUCT__entry(
		__field(u32, ec_sample_timestamp)
		__field(u32, ec_fifo_timestamp)
		__field(s64, fifo_timestamp)
		__field(s64, current_timestamp)
		__field(s64, current_time)
		__field(s64, delta)
	),
	TP_fast_assign(
		__entry->ec_sample_timestamp = ec_sample_timestamp;
		__entry->ec_fifo_timestamp = ec_fifo_timestamp;
		__entry->fifo_timestamp = fifo_timestamp;
		__entry->current_timestamp = current_timestamp;
		__entry->current_time = current_time;
		__entry->delta = current_timestamp - current_time;
	),
	TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
		  __entry->ec_sample_timestamp,
		__entry->ec_fifo_timestamp,
		__entry->fifo_timestamp,
		__entry->current_timestamp,
		__entry->current_time,
		__entry->delta
	)
);

TRACE_EVENT(cros_ec_sensorhub_data,
	    TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp,
		     s64 current_timestamp, s64 current_time),
	TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timestamp, current_time),
	TP_STRUCT__entry(
		__field(u32, ec_sensor_num)
		__field(u32, ec_fifo_timestamp)
		__field(s64, fifo_timestamp)
		__field(s64, current_timestamp)
		__field(s64, current_time)
		__field(s64, delta)
	),
	TP_fast_assign(
		__entry->ec_sensor_num = ec_sensor_num;
		__entry->ec_fifo_timestamp = ec_fifo_timestamp;
		__entry->fifo_timestamp = fifo_timestamp;
		__entry->current_timestamp = current_timestamp;
		__entry->current_time = current_time;
		__entry->delta = current_timestamp - current_time;
	),
	TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld, curr_time: %12lld, delta %12lld",
		  __entry->ec_sensor_num,
		__entry->ec_fifo_timestamp,
		__entry->fifo_timestamp,
		__entry->current_timestamp,
		__entry->current_time,
		__entry->delta
	)
);

TRACE_EVENT(cros_ec_sensorhub_filter,
	    TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 dy),
	TP_ARGS(state, dx, dy),
	TP_STRUCT__entry(
		__field(s64, dx)
		__field(s64, dy)
		__field(s64, median_m)
		__field(s64, median_error)
		__field(s64, history_len)
		__field(s64, x)
		__field(s64, y)
	),
	TP_fast_assign(
		__entry->dx = dx;
		__entry->dy = dy;
		__entry->median_m = state->median_m;
		__entry->median_error = state->median_error;
		__entry->history_len = state->history_len;
		__entry->x = state->x_offset;
		__entry->y = state->y_offset;
	),
	TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld len: %lld x: %12lld y: %12lld",
		  __entry->dx,
		__entry->dy,
		__entry->median_m,
		__entry->median_error,
		__entry->history_len,
		__entry->x,
		__entry->y
	)
);


#endif /* _CROS_EC_SENSORHUB_TRACE_H_ */

/* this part must be outside header guard */

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .

#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace

#include <trace/define_trace.h>
Loading