Commit 1c2daf52 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'tag-chrome-platform-for-v6.1' of...

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

Pull chrome platform updates from Tzung-Bi Shih:
 "cros_ec_proto:
   - Fix protocol failure if EC firmware jumps to RO part

  cros_typec_switch:
   - Add USB Type-C switch driver for mode switches and retimers
   - Integrate to EC for retimers, status update, and mode switches
   - Clean-ups

  cros_ec_typec:
   - Clean-ups
   - Use partner PDOs to register USB PD capabilities

  chromeos_laptop:
   - Fix a double-free

  cros_ec_chardev:
   - Check data length from userland to avoid a memory corruption

  cros_ec:
   - Expose suspend_timeout_ms in debugfs
   - Notify the PM about wake events during resume"

* tag 'tag-chrome-platform-for-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec: Notify the PM of wake events during resume
  platform/chrome: cros_ec_typec: Register partner PDOs
  platform/chrome: cros_typec_switch: Inline DRV_NAME
  platform/chrome: cros_typec_switch: Use PTR_ERR_OR_ZERO() to simplify
  platform/chrome: cros_typec_switch: Remove impossible condition
  platform/chrome: cros_typec_switch: Add missing newline on printk
  platform/chrome: cros_ec_typec: Correct alt mode index
  platform/chrome: cros_ec_typec: Add bit offset for DP VDO
  platform/chrome: cros_ec: Expose suspend_timeout_ms in debugfs
  platform/chrome: fix memory corruption in ioctl
  platform/chrome: fix double-free in chromeos_laptop_prepare()
  platform/chrome: cros_ec_typec: Get retimer handle
  platform/chrome: cros_ec_typec: Cleanup switch handle return paths
  platform/chrome: cros_typec_switch: Register mode switches
  platform/chrome: cros_typec_switch: Add event check
  platform/chrome: cros_typec_switch: Set EC retimer
  platform/chrome: cros_typec_switch: Add switch driver
  platform/chrome: Add Type-C mux set command definitions
  platform/chrome: cros_ec_proto: Update version on GET_NEXT_EVENT failure
parents c3f13bbf 8edd2752
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -54,3 +54,25 @@ Description:
		this feature.

		Output will be in the format: "0x%08x\n".

What:		/sys/kernel/debug/<cros-ec-device>/suspend_timeout_ms
Date:		August 2022
KernelVersion:	6.1
Description:
		Some ECs have a feature where they will track transitions of
		a hardware-controlled sleep line, such as Intel's SLP_S0 line,
		in order to detect cases where a system failed to go into deep
		sleep states. The suspend_timeout_ms file controls the amount of
		time in milliseconds the EC will wait before declaring a sleep
		timeout event and attempting to wake the system.

		Supply 0 to use the default value coded into EC firmware. Supply
		65535 (EC_HOST_SLEEP_TIMEOUT_INFINITE) to disable the EC sleep
		failure detection mechanism. Values in between 0 and 65535
		indicate the number of milliseconds the EC should wait after a
		sleep transition before declaring a timeout. This includes both
		the duration after a sleep command was received but before the
		hardware line changed, as well as the duration between when the
		hardware line changed and the kernel sent an EC resume command.

		Output will be in the format: "%u\n".
+1 −0
Original line number Diff line number Diff line
@@ -4904,6 +4904,7 @@ M: Prashant Malani <pmalani@chromium.org>
L:	chrome-platform@lists.linux.dev
S:	Maintained
F:	drivers/platform/chrome/cros_ec_typec.c
F:	drivers/platform/chrome/cros_typec_switch.c
CHROMEOS EC USB PD NOTIFY DRIVER
M:	Prashant Malani <pmalani@chromium.org>
+11 −0
Original line number Diff line number Diff line
@@ -265,6 +265,17 @@ config CHROMEOS_PRIVACY_SCREEN
	  this should probably always be built into the kernel to avoid or
	  minimize drm probe deferral.

config CROS_TYPEC_SWITCH
	tristate "ChromeOS EC Type-C Switch Control"
	depends on MFD_CROS_EC_DEV && TYPEC && ACPI
	default MFD_CROS_EC_DEV
	help
	  If you say Y here, you get support for configuring the ChromeOS EC Type-C
	  muxes and retimers.

	  To compile this driver as a module, choose M here: the module will be
	  called cros_typec_switch.

source "drivers/platform/chrome/wilco_ec/Kconfig"

# Kunit test cases
+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ obj-$(CONFIG_CHROMEOS_TBMC) += chromeos_tbmc.o
obj-$(CONFIG_CROS_EC)			+= cros_ec.o
obj-$(CONFIG_CROS_EC_I2C)		+= cros_ec_i2c.o
obj-$(CONFIG_CROS_EC_ISHTP)		+= cros_ec_ishtp.o
obj-$(CONFIG_CROS_TYPEC_SWITCH)		+= cros_typec_switch.o
obj-$(CONFIG_CROS_EC_RPMSG)		+= cros_ec_rpmsg.o
obj-$(CONFIG_CROS_EC_SPI)		+= cros_ec_spi.o
cros_ec_lpcs-objs			:= cros_ec_lpc.o cros_ec_lpc_mec.o
+13 −11
Original line number Diff line number Diff line
@@ -740,6 +740,7 @@ static int __init
chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,
					const struct chromeos_laptop *src)
{
	struct i2c_peripheral *i2c_peripherals;
	struct i2c_peripheral *i2c_dev;
	struct i2c_board_info *info;
	int i;
@@ -748,17 +749,15 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,
	if (!src->num_i2c_peripherals)
		return 0;

	cros_laptop->i2c_peripherals = kmemdup(src->i2c_peripherals,
	i2c_peripherals = kmemdup(src->i2c_peripherals,
					      src->num_i2c_peripherals *
					  sizeof(*src->i2c_peripherals),
					  GFP_KERNEL);
	if (!cros_laptop->i2c_peripherals)
	if (!i2c_peripherals)
		return -ENOMEM;

	cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals;

	for (i = 0; i < cros_laptop->num_i2c_peripherals; i++) {
		i2c_dev = &cros_laptop->i2c_peripherals[i];
	for (i = 0; i < src->num_i2c_peripherals; i++) {
		i2c_dev = &i2c_peripherals[i];
		info = &i2c_dev->board_info;

		error = chromeos_laptop_setup_irq(i2c_dev);
@@ -775,16 +774,19 @@ chromeos_laptop_prepare_i2c_peripherals(struct chromeos_laptop *cros_laptop,
		}
	}

	cros_laptop->i2c_peripherals = i2c_peripherals;
	cros_laptop->num_i2c_peripherals = src->num_i2c_peripherals;

	return 0;

err_out:
	while (--i >= 0) {
		i2c_dev = &cros_laptop->i2c_peripherals[i];
		i2c_dev = &i2c_peripherals[i];
		info = &i2c_dev->board_info;
		if (!IS_ERR_OR_NULL(info->fwnode))
			fwnode_remove_software_node(info->fwnode);
	}
	kfree(cros_laptop->i2c_peripherals);
	kfree(i2c_peripherals);
	return error;
}

Loading