Commit 3475b91f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

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

Pull chrome platform updates from Tzung-Bi Shih:
 "Improvements:

   - Annotate flexible array members with __counted_by

   - Convert platform drivers' .remove callbacks to return void

  Fixes:

   - Avoid MKBP event timeouts by disabling/enabling IRQ later/earlier

  Misc:

   - Minor cleanups and fixes"

* tag 'tag-chrome-platform-for-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (21 commits)
  platform/chrome: cros_ec_lpc: Separate host command and irq disable
  platform/chrome: kunit: make EC protocol tests independent
  platform/chrome: kunit: initialize lock for fake ec_dev
  platform/chrome: cros_ec: fix compilation warning
  platform/chrome: cros_ec_proto: Mark outdata as const
  platform/chrome: cros_typec_vdm: Mark port_amode_ops const
  platform/chrome: cros_ec_typec: Use dev_err_probe() more
  platform/chrome: cros_ec_typec: Use semi-colons instead of commas
  platform/chrome/wilco_ec: telemetry: Convert to platform remove callback returning void
  platform/chrome/wilco_ec: debugfs: Convert to platform remove callback returning void
  platform/chrome/wilco_ec: core: Convert to platform remove callback returning void
  platform/chrome: cros_usbpd_notify: Convert to platform remove callback returning void
  platform/chrome: cros_usbpd_logger: Convert to platform remove callback returning void
  platform/chrome: cros_typec_switch: Convert to platform remove callback returning void
  platform/chrome: cros_ec_vbc: Convert to platform remove callback returning void
  platform/chrome: cros_ec_sysfs: Convert to platform remove callback returning void
  platform/chrome: cros_ec_lpc: Convert to platform remove callback returning void
  platform/chrome: cros_ec_lightbar: Convert to platform remove callback returning void
  platform/chrome: cros_ec_debugfs: Convert to platform remove callback returning void
  platform/chrome: cros_ec_chardev: Convert to platform remove callback returning void
  ...
parents f9a7eda4 47ea0ddb
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -299,12 +299,12 @@ config CROS_TYPEC_SWITCH
source "drivers/platform/chrome/wilco_ec/Kconfig"

# Kunit test cases
config CROS_KUNIT
	tristate "Kunit tests for ChromeOS" if !KUNIT_ALL_TESTS
config CROS_KUNIT_EC_PROTO_TEST
	tristate "Kunit tests for ChromeOS EC protocol" if !KUNIT_ALL_TESTS
	depends on KUNIT && CROS_EC
	default KUNIT_ALL_TESTS
	select CROS_EC_PROTO
	help
	  ChromeOS Kunit tests.
	  Kunit tests for ChromeOS EC protocol.

endif # CHROMEOS_PLATFORMS
+2 −3
Original line number Diff line number Diff line
@@ -36,6 +36,5 @@ obj-$(CONFIG_CROS_USBPD_NOTIFY) += cros_usbpd_notify.o
obj-$(CONFIG_WILCO_EC)			+= wilco_ec/

# Kunit test cases
obj-$(CONFIG_CROS_KUNIT)		+= cros_kunit.o
cros_kunit-objs				:= cros_kunit_util.o
cros_kunit-objs				+= cros_ec_proto_test.o
obj-$(CONFIG_CROS_KUNIT_EC_PROTO_TEST)	+= cros_kunit_proto_test.o
cros_kunit_proto_test-objs		:= cros_ec_proto_test_util.o cros_ec_proto_test.o
+94 −22
Original line number Diff line number Diff line
@@ -321,17 +321,8 @@ void cros_ec_unregister(struct cros_ec_device *ec_dev)
EXPORT_SYMBOL(cros_ec_unregister);

#ifdef CONFIG_PM_SLEEP
/**
 * cros_ec_suspend() - Handle a suspend operation for the ChromeOS EC device.
 * @ec_dev: Device to suspend.
 *
 * This can be called by drivers to handle a suspend event.
 *
 * Return: 0 on success or negative error code.
 */
int cros_ec_suspend(struct cros_ec_device *ec_dev)
static void cros_ec_send_suspend_event(struct cros_ec_device *ec_dev)
{
	struct device *dev = ec_dev->dev;
	int ret;
	u8 sleep_event;

@@ -343,7 +334,26 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
	if (ret < 0)
		dev_dbg(ec_dev->dev, "Error %d sending suspend event to ec\n",
			ret);
}

/**
 * cros_ec_suspend_prepare() - Handle a suspend prepare operation for the ChromeOS EC device.
 * @ec_dev: Device to suspend.
 *
 * This can be called by drivers to handle a suspend prepare stage of suspend.
 *
 * Return: 0 always.
 */
int cros_ec_suspend_prepare(struct cros_ec_device *ec_dev)
{
	cros_ec_send_suspend_event(ec_dev);
	return 0;
}
EXPORT_SYMBOL(cros_ec_suspend_prepare);

static void cros_ec_disable_irq(struct cros_ec_device *ec_dev)
{
	struct device *dev = ec_dev->dev;
	if (device_may_wakeup(dev))
		ec_dev->wake_enabled = !enable_irq_wake(ec_dev->irq);
	else
@@ -351,7 +361,35 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)

	disable_irq(ec_dev->irq);
	ec_dev->suspended = true;
}

/**
 * cros_ec_suspend_late() - Handle a suspend late operation for the ChromeOS EC device.
 * @ec_dev: Device to suspend.
 *
 * This can be called by drivers to handle a suspend late stage of suspend.
 *
 * Return: 0 always.
 */
int cros_ec_suspend_late(struct cros_ec_device *ec_dev)
{
	cros_ec_disable_irq(ec_dev);
	return 0;
}
EXPORT_SYMBOL(cros_ec_suspend_late);

/**
 * cros_ec_suspend() - Handle a suspend operation for the ChromeOS EC device.
 * @ec_dev: Device to suspend.
 *
 * This can be called by drivers to handle a suspend event.
 *
 * Return: 0 always.
 */
int cros_ec_suspend(struct cros_ec_device *ec_dev)
{
	cros_ec_send_suspend_event(ec_dev);
	cros_ec_disable_irq(ec_dev);
	return 0;
}
EXPORT_SYMBOL(cros_ec_suspend);
@@ -370,22 +408,11 @@ static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev)
	}
}

/**
 * cros_ec_resume() - Handle a resume operation for the ChromeOS EC device.
 * @ec_dev: Device to resume.
 *
 * This can be called by drivers to handle a resume event.
 *
 * Return: 0 on success or negative error code.
 */
int cros_ec_resume(struct cros_ec_device *ec_dev)
static void cros_ec_send_resume_event(struct cros_ec_device *ec_dev)
{
	int ret;
	u8 sleep_event;

	ec_dev->suspended = false;
	enable_irq(ec_dev->irq);

	sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
		      HOST_SLEEP_EVENT_S3_RESUME :
		      HOST_SLEEP_EVENT_S0IX_RESUME;
@@ -394,6 +421,24 @@ int cros_ec_resume(struct cros_ec_device *ec_dev)
	if (ret < 0)
		dev_dbg(ec_dev->dev, "Error %d sending resume event to ec\n",
			ret);
}

/**
 * cros_ec_resume_complete() - Handle a resume complete operation for the ChromeOS EC device.
 * @ec_dev: Device to resume.
 *
 * This can be called by drivers to handle a resume complete stage of resume.
 */
void cros_ec_resume_complete(struct cros_ec_device *ec_dev)
{
	cros_ec_send_resume_event(ec_dev);
}
EXPORT_SYMBOL(cros_ec_resume_complete);

static void cros_ec_enable_irq(struct cros_ec_device *ec_dev)
{
	ec_dev->suspended = false;
	enable_irq(ec_dev->irq);

	if (ec_dev->wake_enabled)
		disable_irq_wake(ec_dev->irq);
@@ -403,8 +448,35 @@ int cros_ec_resume(struct cros_ec_device *ec_dev)
	 * suspend. This way the clients know what to do with them.
	 */
	cros_ec_report_events_during_suspend(ec_dev);
}

/**
 * cros_ec_resume_early() - Handle a resume early operation for the ChromeOS EC device.
 * @ec_dev: Device to resume.
 *
 * This can be called by drivers to handle a resume early stage of resume.
 *
 * Return: 0 always.
 */
int cros_ec_resume_early(struct cros_ec_device *ec_dev)
{
	cros_ec_enable_irq(ec_dev);
	return 0;
}
EXPORT_SYMBOL(cros_ec_resume_early);

/**
 * cros_ec_resume() - Handle a resume operation for the ChromeOS EC device.
 * @ec_dev: Device to resume.
 *
 * This can be called by drivers to handle a resume event.
 *
 * Return: 0 always.
 */
int cros_ec_resume(struct cros_ec_device *ec_dev)
{
	cros_ec_enable_irq(ec_dev);
	cros_ec_send_resume_event(ec_dev);
	return 0;
}
EXPORT_SYMBOL(cros_ec_resume);
+6 −0
Original line number Diff line number Diff line
@@ -10,11 +10,17 @@

#include <linux/interrupt.h>

struct cros_ec_device;

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

int cros_ec_suspend(struct cros_ec_device *ec_dev);
int cros_ec_suspend_late(struct cros_ec_device *ec_dev);
int cros_ec_suspend_prepare(struct cros_ec_device *ec_dev);
int cros_ec_resume(struct cros_ec_device *ec_dev);
int cros_ec_resume_early(struct cros_ec_device *ec_dev);
void cros_ec_resume_complete(struct cros_ec_device *ec_dev);

irqreturn_t cros_ec_irq_thread(int irq, void *data);

+2 −4
Original line number Diff line number Diff line
@@ -396,13 +396,11 @@ static int cros_ec_chardev_probe(struct platform_device *pdev)
	return misc_register(&data->misc);
}

static int cros_ec_chardev_remove(struct platform_device *pdev)
static void cros_ec_chardev_remove(struct platform_device *pdev)
{
	struct chardev_data *data = dev_get_drvdata(&pdev->dev);

	misc_deregister(&data->misc);

	return 0;
}

static struct platform_driver cros_ec_chardev_driver = {
@@ -410,7 +408,7 @@ static struct platform_driver cros_ec_chardev_driver = {
		.name = DRV_NAME,
	},
	.probe = cros_ec_chardev_probe,
	.remove = cros_ec_chardev_remove,
	.remove_new = cros_ec_chardev_remove,
};

module_platform_driver(cros_ec_chardev_driver);
Loading