Commit b996c10e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

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

Pull chrome platform updates from Benson Leung:
 "Lots of changes to the cros_ec_typec driver for 5.12.

  A portion of this this set of cros_ec_typec driver's changes was
  merged through GregKH's USB tree in order to satisfy cros_ec_typec
  driver and typec connector class subsystem dependencies of subsequent
  changes.

  Summary:

  cros_ec_typec:
   - Registration of cable plug information
   - Support for SOP' plug registration and altmodes
   - Support for reporting number of altmodes supported by partners and
     plugs
   - Send mux configuration ack to EC via a new host command
   - Support mux control with no port partner present
   - Decouple cable removal from partner removal

  cros_ec misc:
   - Fix some event masking in cros_ec_proto.
   - Gwendal reworked cros_ec's top and bottom half for consistency in
     ishtp and rpmsg
   - Constify static attribute_group structs"

* tag 'tag-chrome-platform-for-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec_typec: Flush pending work
  platform/chrome: cros_ec_types: Support disconnect events without partners
  platform/chrome: cros_ec_typec: Skip port partner check in configure_mux()
  platform/chrome: cros_ec_typec: Decouple partner removal
  platform/chrome: cros_ec: Call interrupt bottom half at probe time
  platform/chrome: cros_ec: Call interrupt bottom half in ISH or RPMSG mode
  platform/chrome: cros_ec_sysfs: Add cold-ap-off to sysfs reboot.
  platform/chrome: cros_ec_commands: Add host command to keep AP off after EC reset.
  platform/chrome: Constify static attribute_group structs
  platform/chrome: cros_ec_proto: Add LID and BATTERY to default mask
  platform/chrome: cros_ec_proto: Use EC_HOST_EVENT_MASK not BIT
parents f158bbee a59e1221
Loading
Loading
Loading
Loading
+27 −6
Original line number Diff line number Diff line
@@ -32,7 +32,14 @@ static struct cros_ec_platform pd_p = {
	.cmd_offset = EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX),
};

static irqreturn_t ec_irq_handler(int irq, void *data)
/**
 * cros_ec_irq_handler() - top half part of the interrupt handler
 * @irq: IRQ id
 * @data: (ec_dev) Device with events to process.
 *
 * Return: Wakeup the bottom half
 */
static irqreturn_t cros_ec_irq_handler(int irq, void *data)
{
	struct cros_ec_device *ec_dev = data;

@@ -51,7 +58,7 @@ static irqreturn_t ec_irq_handler(int irq, void *data)
 * Return: true if more events are still pending and this function should be
 * called again.
 */
bool cros_ec_handle_event(struct cros_ec_device *ec_dev)
static bool cros_ec_handle_event(struct cros_ec_device *ec_dev)
{
	bool wake_event;
	bool ec_has_more_events;
@@ -73,9 +80,15 @@ bool cros_ec_handle_event(struct cros_ec_device *ec_dev)

	return ec_has_more_events;
}
EXPORT_SYMBOL(cros_ec_handle_event);

static irqreturn_t ec_irq_thread(int irq, void *data)
/**
 * cros_ec_irq_thread() - bottom half part of the interrupt handler
 * @irq: IRQ id
 * @data: (ec_dev) Device with events to process.
 *
 * Return: Interrupt handled.
 */
irqreturn_t cros_ec_irq_thread(int irq, void *data)
{
	struct cros_ec_device *ec_dev = data;
	bool ec_has_more_events;
@@ -86,6 +99,7 @@ static irqreturn_t ec_irq_thread(int irq, void *data)

	return IRQ_HANDLED;
}
EXPORT_SYMBOL(cros_ec_irq_thread);

static int cros_ec_sleep_event(struct cros_ec_device *ec_dev, u8 sleep_event)
{
@@ -194,8 +208,8 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

	if (ec_dev->irq > 0) {
		err = devm_request_threaded_irq(dev, ec_dev->irq,
						ec_irq_handler,
						ec_irq_thread,
						cros_ec_irq_handler,
						cros_ec_irq_thread,
						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
						"chromeos-ec", ec_dev);
		if (err) {
@@ -269,6 +283,13 @@ int cros_ec_register(struct cros_ec_device *ec_dev)

	dev_info(dev, "Chrome EC device registered\n");

	/*
	 * Unlock EC that may be waiting for AP to process MKBP events.
	 * If the AP takes to long to answer, the EC would stop sending events.
	 */
	if (ec_dev->mkbp_event_supported)
		cros_ec_irq_thread(0, ec_dev);

	return 0;
}
EXPORT_SYMBOL(cros_ec_register);
+3 −1
Original line number Diff line number Diff line
@@ -8,12 +8,14 @@
#ifndef __CROS_EC_H
#define __CROS_EC_H

#include <linux/interrupt.h>

int cros_ec_register(struct cros_ec_device *ec_dev);
int cros_ec_unregister(struct cros_ec_device *ec_dev);

int cros_ec_suspend(struct cros_ec_device *ec_dev);
int cros_ec_resume(struct cros_ec_device *ec_dev);

bool cros_ec_handle_event(struct cros_ec_device *ec_dev);
irqreturn_t cros_ec_irq_thread(int irq, void *data);

#endif /* __CROS_EC_H */
+1 −5
Original line number Diff line number Diff line
@@ -140,12 +140,8 @@ static void ish_evt_handler(struct work_struct *work)
{
	struct ishtp_cl_data *client_data =
		container_of(work, struct ishtp_cl_data, work_ec_evt);
	struct cros_ec_device *ec_dev = client_data->ec_dev;
	bool ec_has_more_events;

	do {
		ec_has_more_events = cros_ec_handle_event(ec_dev);
	} while (ec_has_more_events);
	cros_ec_irq_thread(0, client_data->ec_dev);
}

/**
+1 −1
Original line number Diff line number Diff line
@@ -523,7 +523,7 @@ static struct attribute *__lb_cmds_attrs[] = {
	NULL,
};

static struct attribute_group cros_ec_lightbar_attr_group = {
static const struct attribute_group cros_ec_lightbar_attr_group = {
	.name = "lightbar",
	.attrs = __lb_cmds_attrs,
};
+7 −5
Original line number Diff line number Diff line
@@ -526,11 +526,13 @@ int cros_ec_query_all(struct cros_ec_device *ec_dev)
		 * power), not wake up.
		 */
		ec_dev->host_event_wake_mask = U32_MAX &
			~(BIT(EC_HOST_EVENT_AC_DISCONNECTED) |
			  BIT(EC_HOST_EVENT_BATTERY_LOW) |
			  BIT(EC_HOST_EVENT_BATTERY_CRITICAL) |
			  BIT(EC_HOST_EVENT_PD_MCU) |
			  BIT(EC_HOST_EVENT_BATTERY_STATUS));
			~(EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_CLOSED) |
			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |
			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_LOW) |
			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_CRITICAL) |
			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY) |
			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_PD_MCU) |
			  EC_HOST_EVENT_MASK(EC_HOST_EVENT_BATTERY_STATUS));
		/*
		 * Old ECs may not support this command. Complain about all
		 * other errors.
Loading