Commit 59729c8a authored by Linus Torvalds's avatar Linus Torvalds

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

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

Pull chrome platform updates from Tzung-Bi Shih:
 "New:
   - Support Framework Laptop 13 and 16 (AMD Ryzen)

  Improvements:
   - Use sysfs_emit() instead of sprintf() for sysfs' show()

  Fixes:
   - Fix flex-array-member-not-at-end compiler warnings by using
     DEFINE_RAW_FLEX()
   - Add HAS_IOPORT dependencies
   - Fix long pending events during suspend after resume

  Misc cleanups:
   - Provide ID tables for avoiding fallback match
   - Replace deprecated UNIVERSAL_DEV_PM_OPS()"

* tag 'tag-chrome-platform-for-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux: (22 commits)
  platform/chrome: cros_ec: Handle events during suspend after resume completion
  platform/chrome: cros_ec_lpc: add quirks for the Framework Laptop (AMD)
  platform/chrome: cros_ec_lpc: add a "quirks" system
  platform/chrome: cros_ec_lpc: pass driver_data from DMI to the device
  platform/chrome: cros_ec_lpc: introduce a priv struct for the lpc device
  platform/chrome: add HAS_IOPORT dependencies
  platform/chrome: cros_hps_i2c: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  platform/chrome: cros_kbd_led_backlight: provide ID table for avoiding fallback match
  platform/chrome: wilco_ec: core: provide ID table for avoiding fallback match
  platform/chrome: wilco_ec: event: remove redundant MODULE_ALIAS
  platform/chrome: wilco_ec: debugfs: provide ID table for avoiding fallback match
  platform/chrome: wilco_ec: telemetry: provide ID table for avoiding fallback match
  platform/chrome: cros_ec_vbc: provide ID table for avoiding fallback match
  platform/chrome: cros_ec_lightbar: provide ID table for avoiding fallback match
  platform/chrome: cros_ec_sysfs: provide ID table for avoiding fallback match
  platform/chrome: cros_ec_debugfs: provide ID table for avoiding fallback match
  platform/chrome: cros_ec_chardev: provide ID table for avoiding fallback match
  platform/chrome: cros_usbpd_notify: provide ID table for avoiding fallback match
  platform/chrome: cros_usbpd_logger: provide ID table for avoiding fallback match
  platform/chrome: cros_ec_sensorhub: provide ID table for avoiding fallback match
  ...
parents 8f5b5f78 2fbe479c
...@@ -132,6 +132,7 @@ config CROS_EC_UART ...@@ -132,6 +132,7 @@ config CROS_EC_UART
config CROS_EC_LPC config CROS_EC_LPC
tristate "ChromeOS Embedded Controller (LPC)" tristate "ChromeOS Embedded Controller (LPC)"
depends on CROS_EC && ACPI && (X86 || COMPILE_TEST) depends on CROS_EC && ACPI && (X86 || COMPILE_TEST)
depends on HAS_IOPORT
help help
If you say Y here, you get support for talking to the ChromeOS EC If you say Y here, you get support for talking to the ChromeOS EC
over an LPC bus, including the LPC Microchip EC (MEC) variant. over an LPC bus, including the LPC Microchip EC (MEC) variant.
......
...@@ -432,6 +432,12 @@ static void cros_ec_send_resume_event(struct cros_ec_device *ec_dev) ...@@ -432,6 +432,12 @@ static void cros_ec_send_resume_event(struct cros_ec_device *ec_dev)
void cros_ec_resume_complete(struct cros_ec_device *ec_dev) void cros_ec_resume_complete(struct cros_ec_device *ec_dev)
{ {
cros_ec_send_resume_event(ec_dev); cros_ec_send_resume_event(ec_dev);
/*
* Let the mfd devices know about events that occur during
* suspend. This way the clients know what to do with them.
*/
cros_ec_report_events_during_suspend(ec_dev);
} }
EXPORT_SYMBOL(cros_ec_resume_complete); EXPORT_SYMBOL(cros_ec_resume_complete);
...@@ -442,12 +448,6 @@ static void cros_ec_enable_irq(struct cros_ec_device *ec_dev) ...@@ -442,12 +448,6 @@ static void cros_ec_enable_irq(struct cros_ec_device *ec_dev)
if (ec_dev->wake_enabled) if (ec_dev->wake_enabled)
disable_irq_wake(ec_dev->irq); disable_irq_wake(ec_dev->irq);
/*
* Let the mfd devices know about events that occur during
* suspend. This way the clients know what to do with them.
*/
cros_ec_report_events_during_suspend(ec_dev);
} }
/** /**
...@@ -475,8 +475,8 @@ EXPORT_SYMBOL(cros_ec_resume_early); ...@@ -475,8 +475,8 @@ EXPORT_SYMBOL(cros_ec_resume_early);
*/ */
int cros_ec_resume(struct cros_ec_device *ec_dev) int cros_ec_resume(struct cros_ec_device *ec_dev)
{ {
cros_ec_enable_irq(ec_dev); cros_ec_resume_early(ec_dev);
cros_ec_send_resume_event(ec_dev); cros_ec_resume_complete(ec_dev);
return 0; return 0;
} }
EXPORT_SYMBOL(cros_ec_resume); EXPORT_SYMBOL(cros_ec_resume);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/miscdevice.h> #include <linux/miscdevice.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/platform_data/cros_ec_chardev.h> #include <linux/platform_data/cros_ec_chardev.h>
...@@ -403,17 +404,23 @@ static void cros_ec_chardev_remove(struct platform_device *pdev) ...@@ -403,17 +404,23 @@ static void cros_ec_chardev_remove(struct platform_device *pdev)
misc_deregister(&data->misc); misc_deregister(&data->misc);
} }
static const struct platform_device_id cros_ec_chardev_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_ec_chardev_id);
static struct platform_driver cros_ec_chardev_driver = { static struct platform_driver cros_ec_chardev_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_ec_chardev_probe, .probe = cros_ec_chardev_probe,
.remove_new = cros_ec_chardev_remove, .remove_new = cros_ec_chardev_remove,
.id_table = cros_ec_chardev_id,
}; };
module_platform_driver(cros_ec_chardev_driver); module_platform_driver(cros_ec_chardev_driver);
MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Enric Balletbo i Serra <enric.balletbo@collabora.com>"); MODULE_AUTHOR("Enric Balletbo i Serra <enric.balletbo@collabora.com>");
MODULE_DESCRIPTION("ChromeOS EC Miscellaneous Character Driver"); MODULE_DESCRIPTION("ChromeOS EC Miscellaneous Character Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
...@@ -564,6 +565,12 @@ static int __maybe_unused cros_ec_debugfs_resume(struct device *dev) ...@@ -564,6 +565,12 @@ static int __maybe_unused cros_ec_debugfs_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_debugfs_pm_ops, static SIMPLE_DEV_PM_OPS(cros_ec_debugfs_pm_ops,
cros_ec_debugfs_suspend, cros_ec_debugfs_resume); cros_ec_debugfs_suspend, cros_ec_debugfs_resume);
static const struct platform_device_id cros_ec_debugfs_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_ec_debugfs_id);
static struct platform_driver cros_ec_debugfs_driver = { static struct platform_driver cros_ec_debugfs_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
...@@ -572,10 +579,10 @@ static struct platform_driver cros_ec_debugfs_driver = { ...@@ -572,10 +579,10 @@ static struct platform_driver cros_ec_debugfs_driver = {
}, },
.probe = cros_ec_debugfs_probe, .probe = cros_ec_debugfs_probe,
.remove_new = cros_ec_debugfs_remove, .remove_new = cros_ec_debugfs_remove,
.id_table = cros_ec_debugfs_id,
}; };
module_platform_driver(cros_ec_debugfs_driver); module_platform_driver(cros_ec_debugfs_driver);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Debug logs for ChromeOS EC"); MODULE_DESCRIPTION("Debug logs for ChromeOS EC");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/kstrtox.h> #include <linux/kstrtox.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
...@@ -594,6 +595,12 @@ static int __maybe_unused cros_ec_lightbar_suspend(struct device *dev) ...@@ -594,6 +595,12 @@ static int __maybe_unused cros_ec_lightbar_suspend(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_ec_lightbar_pm_ops, static SIMPLE_DEV_PM_OPS(cros_ec_lightbar_pm_ops,
cros_ec_lightbar_suspend, cros_ec_lightbar_resume); cros_ec_lightbar_suspend, cros_ec_lightbar_resume);
static const struct platform_device_id cros_ec_lightbar_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_ec_lightbar_id);
static struct platform_driver cros_ec_lightbar_driver = { static struct platform_driver cros_ec_lightbar_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
...@@ -602,10 +609,10 @@ static struct platform_driver cros_ec_lightbar_driver = { ...@@ -602,10 +609,10 @@ static struct platform_driver cros_ec_lightbar_driver = {
}, },
.probe = cros_ec_lightbar_probe, .probe = cros_ec_lightbar_probe,
.remove_new = cros_ec_lightbar_remove, .remove_new = cros_ec_lightbar_remove,
.id_table = cros_ec_lightbar_id,
}; };
module_platform_driver(cros_ec_lightbar_driver); module_platform_driver(cros_ec_lightbar_driver);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Expose the Chromebook Pixel's lightbar to userspace"); MODULE_DESCRIPTION("Expose the Chromebook Pixel's lightbar to userspace");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -34,6 +34,32 @@ ...@@ -34,6 +34,32 @@
/* True if ACPI device is present */ /* True if ACPI device is present */
static bool cros_ec_lpc_acpi_device_found; static bool cros_ec_lpc_acpi_device_found;
/*
* Indicates that lpc_driver_data.quirk_mmio_memory_base should
* be used as the base port for EC mapped memory.
*/
#define CROS_EC_LPC_QUIRK_REMAP_MEMORY BIT(0)
/**
* struct lpc_driver_data - driver data attached to a DMI device ID to indicate
* hardware quirks.
* @quirks: a bitfield composed of quirks from CROS_EC_LPC_QUIRK_*
* @quirk_mmio_memory_base: The first I/O port addressing EC mapped memory (used
* when quirk ...REMAP_MEMORY is set.)
*/
struct lpc_driver_data {
u32 quirks;
u16 quirk_mmio_memory_base;
};
/**
* struct cros_ec_lpc - LPC device-specific data
* @mmio_memory_base: The first I/O port addressing EC mapped memory.
*/
struct cros_ec_lpc {
u16 mmio_memory_base;
};
/** /**
* struct lpc_driver_ops - LPC driver operations * struct lpc_driver_ops - LPC driver operations
* @read: Copy length bytes from EC address offset into buffer dest. Returns * @read: Copy length bytes from EC address offset into buffer dest. Returns
...@@ -290,6 +316,7 @@ static int cros_ec_cmd_xfer_lpc(struct cros_ec_device *ec, ...@@ -290,6 +316,7 @@ static int cros_ec_cmd_xfer_lpc(struct cros_ec_device *ec,
static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset, static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset,
unsigned int bytes, void *dest) unsigned int bytes, void *dest)
{ {
struct cros_ec_lpc *ec_lpc = ec->priv;
int i = offset; int i = offset;
char *s = dest; char *s = dest;
int cnt = 0; int cnt = 0;
...@@ -299,13 +326,13 @@ static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset, ...@@ -299,13 +326,13 @@ static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset,
/* fixed length */ /* fixed length */
if (bytes) { if (bytes) {
cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + offset, bytes, s); cros_ec_lpc_ops.read(ec_lpc->mmio_memory_base + offset, bytes, s);
return bytes; return bytes;
} }
/* string */ /* string */
for (; i < EC_MEMMAP_SIZE; i++, s++) { for (; i < EC_MEMMAP_SIZE; i++, s++) {
cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + i, 1, s); cros_ec_lpc_ops.read(ec_lpc->mmio_memory_base + i, 1, s);
cnt++; cnt++;
if (!*s) if (!*s)
break; break;
...@@ -353,8 +380,28 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) ...@@ -353,8 +380,28 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
struct acpi_device *adev; struct acpi_device *adev;
acpi_status status; acpi_status status;
struct cros_ec_device *ec_dev; struct cros_ec_device *ec_dev;
struct cros_ec_lpc *ec_lpc;
struct lpc_driver_data *driver_data;
u8 buf[2] = {}; u8 buf[2] = {};
int irq, ret; int irq, ret;
u32 quirks;
ec_lpc = devm_kzalloc(dev, sizeof(*ec_lpc), GFP_KERNEL);
if (!ec_lpc)
return -ENOMEM;
ec_lpc->mmio_memory_base = EC_LPC_ADDR_MEMMAP;
driver_data = platform_get_drvdata(pdev);
if (driver_data) {
quirks = driver_data->quirks;
if (quirks)
dev_info(dev, "loaded with quirks %8.08x\n", quirks);
if (quirks & CROS_EC_LPC_QUIRK_REMAP_MEMORY)
ec_lpc->mmio_memory_base = driver_data->quirk_mmio_memory_base;
}
/* /*
* The Framework Laptop (and possibly other non-ChromeOS devices) * The Framework Laptop (and possibly other non-ChromeOS devices)
...@@ -380,7 +427,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) ...@@ -380,7 +427,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes; cros_ec_lpc_ops.write = cros_ec_lpc_mec_write_bytes;
cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf); cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, buf);
if (buf[0] != 'E' || buf[1] != 'C') { if (buf[0] != 'E' || buf[1] != 'C') {
if (!devm_request_region(dev, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE, if (!devm_request_region(dev, ec_lpc->mmio_memory_base, EC_MEMMAP_SIZE,
dev_name(dev))) { dev_name(dev))) {
dev_err(dev, "couldn't reserve memmap region\n"); dev_err(dev, "couldn't reserve memmap region\n");
return -EBUSY; return -EBUSY;
...@@ -389,7 +436,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) ...@@ -389,7 +436,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
/* Re-assign read/write operations for the non MEC variant */ /* Re-assign read/write operations for the non MEC variant */
cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes; cros_ec_lpc_ops.read = cros_ec_lpc_read_bytes;
cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes; cros_ec_lpc_ops.write = cros_ec_lpc_write_bytes;
cros_ec_lpc_ops.read(EC_LPC_ADDR_MEMMAP + EC_MEMMAP_ID, 2, cros_ec_lpc_ops.read(ec_lpc->mmio_memory_base + EC_MEMMAP_ID, 2,
buf); buf);
if (buf[0] != 'E' || buf[1] != 'C') { if (buf[0] != 'E' || buf[1] != 'C') {
dev_err(dev, "EC ID not detected\n"); dev_err(dev, "EC ID not detected\n");
...@@ -423,6 +470,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev) ...@@ -423,6 +470,7 @@ static int cros_ec_lpc_probe(struct platform_device *pdev)
ec_dev->din_size = sizeof(struct ec_host_response) + ec_dev->din_size = sizeof(struct ec_host_response) +
sizeof(struct ec_response_get_protocol_info); sizeof(struct ec_response_get_protocol_info);
ec_dev->dout_size = sizeof(struct ec_host_request); ec_dev->dout_size = sizeof(struct ec_host_request);
ec_dev->priv = ec_lpc;
/* /*
* Some boards do not have an IRQ allotted for cros_ec_lpc, * Some boards do not have an IRQ allotted for cros_ec_lpc,
...@@ -479,6 +527,11 @@ static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = { ...@@ -479,6 +527,11 @@ static const struct acpi_device_id cros_ec_lpc_acpi_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids); MODULE_DEVICE_TABLE(acpi, cros_ec_lpc_acpi_device_ids);
static const struct lpc_driver_data framework_laptop_amd_lpc_driver_data __initconst = {
.quirks = CROS_EC_LPC_QUIRK_REMAP_MEMORY,
.quirk_mmio_memory_base = 0xE00,
};
static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = { static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
{ {
/* /*
...@@ -533,7 +586,16 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = { ...@@ -533,7 +586,16 @@ static const struct dmi_system_id cros_ec_lpc_dmi_table[] __initconst = {
}, },
/* A small number of non-Chromebook/box machines also use the ChromeOS EC */ /* A small number of non-Chromebook/box machines also use the ChromeOS EC */
{ {
/* the Framework Laptop */ /* the Framework Laptop 13 (AMD Ryzen) and 16 (AMD Ryzen) */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
DMI_MATCH(DMI_PRODUCT_NAME, "AMD Ryzen"),
DMI_MATCH(DMI_PRODUCT_FAMILY, "Laptop"),
},
.driver_data = (void *)&framework_laptop_amd_lpc_driver_data,
},
{
/* the Framework Laptop (Intel 11th, 12th, 13th Generation) */
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Framework"), DMI_MATCH(DMI_SYS_VENDOR, "Framework"),
DMI_MATCH(DMI_PRODUCT_NAME, "Laptop"), DMI_MATCH(DMI_PRODUCT_NAME, "Laptop"),
...@@ -610,14 +672,16 @@ static int __init cros_ec_lpc_init(void) ...@@ -610,14 +672,16 @@ static int __init cros_ec_lpc_init(void)
{ {
int ret; int ret;
acpi_status status; acpi_status status;
const struct dmi_system_id *dmi_match;
status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device, status = acpi_get_devices(ACPI_DRV_NAME, cros_ec_lpc_parse_device,
&cros_ec_lpc_acpi_device_found, NULL); &cros_ec_lpc_acpi_device_found, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME); pr_warn(DRV_NAME ": Looking for %s failed\n", ACPI_DRV_NAME);
if (!cros_ec_lpc_acpi_device_found && dmi_match = dmi_first_match(cros_ec_lpc_dmi_table);
!dmi_check_system(cros_ec_lpc_dmi_table)) {
if (!cros_ec_lpc_acpi_device_found && !dmi_match) {
pr_err(DRV_NAME ": unsupported system.\n"); pr_err(DRV_NAME ": unsupported system.\n");
return -ENODEV; return -ENODEV;
} }
...@@ -630,6 +694,9 @@ static int __init cros_ec_lpc_init(void) ...@@ -630,6 +694,9 @@ static int __init cros_ec_lpc_init(void)
} }
if (!cros_ec_lpc_acpi_device_found) { if (!cros_ec_lpc_acpi_device_found) {
/* Pass the DMI match's driver data down to the platform device */
platform_set_drvdata(&cros_ec_lpc_device, dmi_match->driver_data);
/* Register the device, and it'll get hooked up automatically */ /* Register the device, and it'll get hooked up automatically */
ret = platform_device_register(&cros_ec_lpc_device); ret = platform_device_register(&cros_ec_lpc_device);
if (ret) { if (ret) {
......
...@@ -1543,21 +1543,18 @@ static void cros_ec_proto_test_cmd_xfer_normal(struct kunit *test) ...@@ -1543,21 +1543,18 @@ static void cros_ec_proto_test_cmd_xfer_normal(struct kunit *test)
struct cros_ec_device *ec_dev = &priv->ec_dev; struct cros_ec_device *ec_dev = &priv->ec_dev;
struct ec_xfer_mock *mock; struct ec_xfer_mock *mock;
int ret; int ret;
struct { DEFINE_RAW_FLEX(struct cros_ec_command, buf, data, 0x100);
struct cros_ec_command msg;
u8 data[0x100];
} __packed buf;
ec_dev->max_request = 0xff; ec_dev->max_request = 0xff;
ec_dev->max_response = 0xee; ec_dev->max_response = 0xee;
ec_dev->max_passthru = 0xdd; ec_dev->max_passthru = 0xdd;
buf.msg.version = 0; buf->version = 0;
buf.msg.command = EC_CMD_HELLO; buf->command = EC_CMD_HELLO;
buf.msg.insize = 4; buf->insize = 4;
buf.msg.outsize = 2; buf->outsize = 2;
buf.data[0] = 0x55; buf->data[0] = 0x55;
buf.data[1] = 0xaa; buf->data[1] = 0xaa;
{ {
u8 *data; u8 *data;
...@@ -1572,7 +1569,7 @@ static void cros_ec_proto_test_cmd_xfer_normal(struct kunit *test) ...@@ -1572,7 +1569,7 @@ static void cros_ec_proto_test_cmd_xfer_normal(struct kunit *test)
data[3] = 0x33; data[3] = 0x33;
} }
ret = cros_ec_cmd_xfer(ec_dev, &buf.msg); ret = cros_ec_cmd_xfer(ec_dev, buf);
KUNIT_EXPECT_EQ(test, ret, 4); KUNIT_EXPECT_EQ(test, ret, 4);
{ {
...@@ -1590,10 +1587,10 @@ static void cros_ec_proto_test_cmd_xfer_normal(struct kunit *test) ...@@ -1590,10 +1587,10 @@ static void cros_ec_proto_test_cmd_xfer_normal(struct kunit *test)
KUNIT_EXPECT_EQ(test, data[0], 0x55); KUNIT_EXPECT_EQ(test, data[0], 0x55);
KUNIT_EXPECT_EQ(test, data[1], 0xaa); KUNIT_EXPECT_EQ(test, data[1], 0xaa);
KUNIT_EXPECT_EQ(test, buf.data[0], 0xaa); KUNIT_EXPECT_EQ(test, buf->data[0], 0xaa);
KUNIT_EXPECT_EQ(test, buf.data[1], 0x55); KUNIT_EXPECT_EQ(test, buf->data[1], 0x55);
KUNIT_EXPECT_EQ(test, buf.data[2], 0xcc); KUNIT_EXPECT_EQ(test, buf->data[2], 0xcc);
KUNIT_EXPECT_EQ(test, buf.data[3], 0x33); KUNIT_EXPECT_EQ(test, buf->data[3], 0x33);
} }
} }
...@@ -1603,26 +1600,23 @@ static void cros_ec_proto_test_cmd_xfer_excess_msg_insize(struct kunit *test) ...@@ -1603,26 +1600,23 @@ static void cros_ec_proto_test_cmd_xfer_excess_msg_insize(struct kunit *test)
struct cros_ec_device *ec_dev = &priv->ec_dev; struct cros_ec_device *ec_dev = &priv->ec_dev;
struct ec_xfer_mock *mock; struct ec_xfer_mock *mock;
int ret; int ret;
struct { DEFINE_RAW_FLEX(struct cros_ec_command, buf, data, 0x100);
struct cros_ec_command msg;
u8 data[0x100];
} __packed buf;
ec_dev->max_request = 0xff; ec_dev->max_request = 0xff;
ec_dev->max_response = 0xee; ec_dev->max_response = 0xee;
ec_dev->max_passthru = 0xdd; ec_dev->max_passthru = 0xdd;
buf.msg.version = 0; buf->version = 0;
buf.msg.command = EC_CMD_HELLO; buf->command = EC_CMD_HELLO;
buf.msg.insize = 0xee + 1; buf->insize = 0xee + 1;
buf.msg.outsize = 2; buf->outsize = 2;
{ {
mock = cros_kunit_ec_xfer_mock_add(test, 0xcc); mock = cros_kunit_ec_xfer_mock_add(test, 0xcc);
KUNIT_ASSERT_PTR_NE(test, mock, NULL); KUNIT_ASSERT_PTR_NE(test, mock, NULL);
} }
ret = cros_ec_cmd_xfer(ec_dev, &buf.msg); ret = cros_ec_cmd_xfer(ec_dev, buf);
KUNIT_EXPECT_EQ(test, ret, 0xcc); KUNIT_EXPECT_EQ(test, ret, 0xcc);
{ {
...@@ -1641,21 +1635,18 @@ static void cros_ec_proto_test_cmd_xfer_excess_msg_outsize_without_passthru(stru ...@@ -1641,21 +1635,18 @@ static void cros_ec_proto_test_cmd_xfer_excess_msg_outsize_without_passthru(stru
struct cros_ec_proto_test_priv *priv = test->priv; struct cros_ec_proto_test_priv *priv = test->priv;
struct cros_ec_device *ec_dev = &priv->ec_dev; struct cros_ec_device *ec_dev = &priv->ec_dev;
int ret; int ret;
struct { DEFINE_RAW_FLEX(struct cros_ec_command, buf, data, 0x100);
struct cros_ec_command msg;
u8 data[0x100];
} __packed buf;
ec_dev->max_request = 0xff; ec_dev->max_request = 0xff;
ec_dev->max_response = 0xee; ec_dev->max_response = 0xee;
ec_dev->max_passthru = 0xdd; ec_dev->max_passthru = 0xdd;
buf.msg.version = 0; buf->version = 0;
buf.msg.command = EC_CMD_HELLO; buf->command = EC_CMD_HELLO;
buf.msg.insize = 4; buf->insize = 4;
buf.msg.outsize = 0xff + 1; buf->outsize = 0xff + 1;
ret = cros_ec_cmd_xfer(ec_dev, &buf.msg); ret = cros_ec_cmd_xfer(ec_dev, buf);
KUNIT_EXPECT_EQ(test, ret, -EMSGSIZE); KUNIT_EXPECT_EQ(test, ret, -EMSGSIZE);
} }
...@@ -1664,21 +1655,18 @@ static void cros_ec_proto_test_cmd_xfer_excess_msg_outsize_with_passthru(struct ...@@ -1664,21 +1655,18 @@ static void cros_ec_proto_test_cmd_xfer_excess_msg_outsize_with_passthru(struct
struct cros_ec_proto_test_priv *priv = test->priv; struct cros_ec_proto_test_priv *priv = test->priv;
struct cros_ec_device *ec_dev = &priv->ec_dev; struct cros_ec_device *ec_dev = &priv->ec_dev;
int ret; int ret;
struct { DEFINE_RAW_FLEX(struct cros_ec_command, buf, data, 0x100);
struct cros_ec_command msg;
u8 data[0x100];
} __packed buf;
ec_dev->max_request = 0xff; ec_dev->max_request = 0xff;
ec_dev->max_response = 0xee; ec_dev->max_response = 0xee;
ec_dev->max_passthru = 0xdd; ec_dev->max_passthru = 0xdd;
buf.msg.version = 0; buf->version = 0;
buf.msg.command = EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX) + EC_CMD_HELLO; buf->command = EC_CMD_PASSTHRU_OFFSET(CROS_EC_DEV_PD_INDEX) + EC_CMD_HELLO;
buf.msg.insize = 4; buf->insize = 4;
buf.msg.outsize = 0xdd + 1; buf->outsize = 0xdd + 1;
ret = cros_ec_cmd_xfer(ec_dev, &buf.msg); ret = cros_ec_cmd_xfer(ec_dev, buf);
KUNIT_EXPECT_EQ(test, ret, -EMSGSIZE); KUNIT_EXPECT_EQ(test, ret, -EMSGSIZE);
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
...@@ -247,17 +248,23 @@ static SIMPLE_DEV_PM_OPS(cros_ec_sensorhub_pm_ops, ...@@ -247,17 +248,23 @@ static SIMPLE_DEV_PM_OPS(cros_ec_sensorhub_pm_ops,
cros_ec_sensorhub_suspend, cros_ec_sensorhub_suspend,
cros_ec_sensorhub_resume); cros_ec_sensorhub_resume);
static const struct platform_device_id cros_ec_sensorhub_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_ec_sensorhub_id);
static struct platform_driver cros_ec_sensorhub_driver = { static struct platform_driver cros_ec_sensorhub_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.pm = &cros_ec_sensorhub_pm_ops, .pm = &cros_ec_sensorhub_pm_ops,
}, },
.probe = cros_ec_sensorhub_probe, .probe = cros_ec_sensorhub_probe,
.id_table = cros_ec_sensorhub_id,
}; };
module_platform_driver(cros_ec_sensorhub_driver); module_platform_driver(cros_ec_sensorhub_driver);
MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Gwendal Grignou <gwendal@chromium.org>"); MODULE_AUTHOR("Gwendal Grignou <gwendal@chromium.org>");
MODULE_DESCRIPTION("ChromeOS EC MEMS Sensor Hub Driver"); MODULE_DESCRIPTION("ChromeOS EC MEMS Sensor Hub Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
...@@ -347,16 +348,22 @@ static void cros_ec_sysfs_remove(struct platform_device *pd) ...@@ -347,16 +348,22 @@ static void cros_ec_sysfs_remove(struct platform_device *pd)
sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_attr_group); sysfs_remove_group(&ec_dev->class_dev.kobj, &cros_ec_attr_group);
} }
static const struct platform_device_id cros_ec_sysfs_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_ec_sysfs_id);
static struct platform_driver cros_ec_sysfs_driver = { static struct platform_driver cros_ec_sysfs_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_ec_sysfs_probe, .probe = cros_ec_sysfs_probe,
.remove_new = cros_ec_sysfs_remove, .remove_new = cros_ec_sysfs_remove,
.id_table = cros_ec_sysfs_id,
}; };
module_platform_driver(cros_ec_sysfs_driver); module_platform_driver(cros_ec_sysfs_driver);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Expose the ChromeOS EC through sysfs"); MODULE_DESCRIPTION("Expose the ChromeOS EC through sysfs");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
...@@ -133,16 +134,22 @@ static void cros_ec_vbc_remove(struct platform_device *pd) ...@@ -133,16 +134,22 @@ static void cros_ec_vbc_remove(struct platform_device *pd)
&cros_ec_vbc_attr_group); &cros_ec_vbc_attr_group);
} }
static const struct platform_device_id cros_ec_vbc_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_ec_vbc_id);
static struct platform_driver cros_ec_vbc_driver = { static struct platform_driver cros_ec_vbc_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_ec_vbc_probe, .probe = cros_ec_vbc_probe,
.remove_new = cros_ec_vbc_remove, .remove_new = cros_ec_vbc_remove,
.id_table = cros_ec_vbc_id,
}; };
module_platform_driver(cros_ec_vbc_driver); module_platform_driver(cros_ec_vbc_driver);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Expose the vboot context nvram to userspace"); MODULE_DESCRIPTION("Expose the vboot context nvram to userspace");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -126,7 +126,7 @@ static int hps_resume(struct device *dev) ...@@ -126,7 +126,7 @@ static int hps_resume(struct device *dev)
hps_set_power(hps, true); hps_set_power(hps, true);
return 0; return 0;
} }
static UNIVERSAL_DEV_PM_OPS(hps_pm_ops, hps_suspend, hps_resume, NULL); static DEFINE_RUNTIME_DEV_PM_OPS(hps_pm_ops, hps_suspend, hps_resume, NULL);
static const struct i2c_device_id hps_i2c_id[] = { static const struct i2c_device_id hps_i2c_id[] = {
{ "cros-hps", 0 }, { "cros-hps", 0 },
...@@ -148,7 +148,7 @@ static struct i2c_driver hps_i2c_driver = { ...@@ -148,7 +148,7 @@ static struct i2c_driver hps_i2c_driver = {
.id_table = hps_i2c_id, .id_table = hps_i2c_id,
.driver = { .driver = {
.name = "cros-hps", .name = "cros-hps",
.pm = &hps_pm_ops, .pm = pm_ptr(&hps_pm_ops),
.acpi_match_table = ACPI_PTR(hps_acpi_id), .acpi_match_table = ACPI_PTR(hps_acpi_id),
}, },
}; };
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
...@@ -247,17 +248,23 @@ static const struct of_device_id keyboard_led_of_match[] = { ...@@ -247,17 +248,23 @@ static const struct of_device_id keyboard_led_of_match[] = {
MODULE_DEVICE_TABLE(of, keyboard_led_of_match); MODULE_DEVICE_TABLE(of, keyboard_led_of_match);
#endif #endif
static const struct platform_device_id keyboard_led_id[] = {
{ "cros-keyboard-leds", 0 },
{}
};
MODULE_DEVICE_TABLE(platform, keyboard_led_id);
static struct platform_driver keyboard_led_driver = { static struct platform_driver keyboard_led_driver = {
.driver = { .driver = {
.name = "chromeos-keyboard-leds", .name = "cros-keyboard-leds",
.acpi_match_table = ACPI_PTR(keyboard_led_acpi_match), .acpi_match_table = ACPI_PTR(keyboard_led_acpi_match),
.of_match_table = of_match_ptr(keyboard_led_of_match), .of_match_table = of_match_ptr(keyboard_led_of_match),
}, },
.probe = keyboard_led_probe, .probe = keyboard_led_probe,
.id_table = keyboard_led_id,
}; };
module_platform_driver(keyboard_led_driver); module_platform_driver(keyboard_led_driver);
MODULE_AUTHOR("Simon Que <sque@chromium.org>"); MODULE_AUTHOR("Simon Que <sque@chromium.org>");
MODULE_DESCRIPTION("ChromeOS Keyboard backlight LED Driver"); MODULE_DESCRIPTION("ChromeOS Keyboard backlight LED Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:chromeos-keyboard-leds");
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/math64.h> #include <linux/math64.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_commands.h> #include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
...@@ -249,6 +250,12 @@ static int __maybe_unused cros_usbpd_logger_suspend(struct device *dev) ...@@ -249,6 +250,12 @@ static int __maybe_unused cros_usbpd_logger_suspend(struct device *dev)
static SIMPLE_DEV_PM_OPS(cros_usbpd_logger_pm_ops, cros_usbpd_logger_suspend, static SIMPLE_DEV_PM_OPS(cros_usbpd_logger_pm_ops, cros_usbpd_logger_suspend,
cros_usbpd_logger_resume); cros_usbpd_logger_resume);
static const struct platform_device_id cros_usbpd_logger_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_usbpd_logger_id);
static struct platform_driver cros_usbpd_logger_driver = { static struct platform_driver cros_usbpd_logger_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
...@@ -256,10 +263,10 @@ static struct platform_driver cros_usbpd_logger_driver = { ...@@ -256,10 +263,10 @@ static struct platform_driver cros_usbpd_logger_driver = {
}, },
.probe = cros_usbpd_logger_probe, .probe = cros_usbpd_logger_probe,
.remove_new = cros_usbpd_logger_remove, .remove_new = cros_usbpd_logger_remove,
.id_table = cros_usbpd_logger_id,
}; };
module_platform_driver(cros_usbpd_logger_driver); module_platform_driver(cros_usbpd_logger_driver);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Logging driver for ChromeOS EC USBPD Charger."); MODULE_DESCRIPTION("Logging driver for ChromeOS EC USBPD Charger.");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/cros_ec_proto.h> #include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_data/cros_usbpd_notify.h> #include <linux/platform_data/cros_usbpd_notify.h>
...@@ -218,12 +219,19 @@ static void cros_usbpd_notify_remove_plat(struct platform_device *pdev) ...@@ -218,12 +219,19 @@ static void cros_usbpd_notify_remove_plat(struct platform_device *pdev)
&pdnotify->nb); &pdnotify->nb);
} }
static const struct platform_device_id cros_usbpd_notify_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, cros_usbpd_notify_id);
static struct platform_driver cros_usbpd_notify_plat_driver = { static struct platform_driver cros_usbpd_notify_plat_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = cros_usbpd_notify_probe_plat, .probe = cros_usbpd_notify_probe_plat,
.remove_new = cros_usbpd_notify_remove_plat, .remove_new = cros_usbpd_notify_remove_plat,
.id_table = cros_usbpd_notify_id,
}; };
static int __init cros_usbpd_notify_init(void) static int __init cros_usbpd_notify_init(void)
...@@ -258,4 +266,3 @@ module_exit(cros_usbpd_notify_exit); ...@@ -258,4 +266,3 @@ module_exit(cros_usbpd_notify_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("ChromeOS power delivery notifier device"); MODULE_DESCRIPTION("ChromeOS power delivery notifier device");
MODULE_AUTHOR("Jon Flatley <jflat@chromium.org>"); MODULE_AUTHOR("Jon Flatley <jflat@chromium.org>");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -3,6 +3,7 @@ config WILCO_EC ...@@ -3,6 +3,7 @@ config WILCO_EC
tristate "ChromeOS Wilco Embedded Controller" tristate "ChromeOS Wilco Embedded Controller"
depends on X86 || COMPILE_TEST depends on X86 || COMPILE_TEST
depends on ACPI && CROS_EC_LPC && LEDS_CLASS depends on ACPI && CROS_EC_LPC && LEDS_CLASS
depends on HAS_IOPORT
help help
If you say Y here, you get support for talking to the ChromeOS If you say Y here, you get support for talking to the ChromeOS
Wilco EC over an eSPI bus. This uses a simple byte-level protocol Wilco EC over an eSPI bus. This uses a simple byte-level protocol
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/wilco-ec.h> #include <linux/platform_data/wilco-ec.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -150,6 +151,12 @@ static const struct acpi_device_id wilco_ec_acpi_device_ids[] = { ...@@ -150,6 +151,12 @@ static const struct acpi_device_id wilco_ec_acpi_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, wilco_ec_acpi_device_ids); MODULE_DEVICE_TABLE(acpi, wilco_ec_acpi_device_ids);
static const struct platform_device_id wilco_ec_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, wilco_ec_id);
static struct platform_driver wilco_ec_driver = { static struct platform_driver wilco_ec_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
...@@ -157,6 +164,7 @@ static struct platform_driver wilco_ec_driver = { ...@@ -157,6 +164,7 @@ static struct platform_driver wilco_ec_driver = {
}, },
.probe = wilco_ec_probe, .probe = wilco_ec_probe,
.remove_new = wilco_ec_remove, .remove_new = wilco_ec_remove,
.id_table = wilco_ec_id,
}; };
module_platform_driver(wilco_ec_driver); module_platform_driver(wilco_ec_driver);
...@@ -165,4 +173,3 @@ MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>"); ...@@ -165,4 +173,3 @@ MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>");
MODULE_AUTHOR("Duncan Laurie <dlaurie@chromium.org>"); MODULE_AUTHOR("Duncan Laurie <dlaurie@chromium.org>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("ChromeOS Wilco Embedded Controller driver"); MODULE_DESCRIPTION("ChromeOS Wilco Embedded Controller driver");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/wilco-ec.h> #include <linux/platform_data/wilco-ec.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -265,17 +266,23 @@ static void wilco_ec_debugfs_remove(struct platform_device *pdev) ...@@ -265,17 +266,23 @@ static void wilco_ec_debugfs_remove(struct platform_device *pdev)
debugfs_remove_recursive(debug_info->dir); debugfs_remove_recursive(debug_info->dir);
} }
static const struct platform_device_id wilco_ec_debugfs_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, wilco_ec_debugfs_id);
static struct platform_driver wilco_ec_debugfs_driver = { static struct platform_driver wilco_ec_debugfs_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.probe = wilco_ec_debugfs_probe, .probe = wilco_ec_debugfs_probe,
.remove_new = wilco_ec_debugfs_remove, .remove_new = wilco_ec_debugfs_remove,
.id_table = wilco_ec_debugfs_id,
}; };
module_platform_driver(wilco_ec_debugfs_driver); module_platform_driver(wilco_ec_debugfs_driver);
MODULE_ALIAS("platform:" DRV_NAME);
MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>"); MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Wilco EC debugfs driver"); MODULE_DESCRIPTION("Wilco EC debugfs driver");
...@@ -575,4 +575,3 @@ module_exit(event_module_exit); ...@@ -575,4 +575,3 @@ module_exit(event_module_exit);
MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>"); MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>");
MODULE_DESCRIPTION("Wilco EC ACPI event driver"); MODULE_DESCRIPTION("Wilco EC ACPI event driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
...@@ -192,7 +192,7 @@ static ssize_t usb_charge_show(struct device *dev, ...@@ -192,7 +192,7 @@ static ssize_t usb_charge_show(struct device *dev,
if (ret < 0) if (ret < 0)
return ret; return ret;
return sprintf(buf, "%d\n", rs.val); return sysfs_emit(buf, "%d\n", rs.val);
} }
static ssize_t usb_charge_store(struct device *dev, static ssize_t usb_charge_store(struct device *dev,
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/cdev.h> #include <linux/cdev.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_data/wilco-ec.h> #include <linux/platform_data/wilco-ec.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -409,12 +410,19 @@ static void telem_device_remove(struct platform_device *pdev) ...@@ -409,12 +410,19 @@ static void telem_device_remove(struct platform_device *pdev)
put_device(&dev_data->dev); put_device(&dev_data->dev);
} }
static const struct platform_device_id telem_id[] = {
{ DRV_NAME, 0 },
{}
};
MODULE_DEVICE_TABLE(platform, telem_id);
static struct platform_driver telem_driver = { static struct platform_driver telem_driver = {
.probe = telem_device_probe, .probe = telem_device_probe,
.remove_new = telem_device_remove, .remove_new = telem_device_remove,
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
}, },
.id_table = telem_id,
}; };
static int __init telem_module_init(void) static int __init telem_module_init(void)
...@@ -466,4 +474,3 @@ module_exit(telem_module_exit); ...@@ -466,4 +474,3 @@ module_exit(telem_module_exit);
MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>"); MODULE_AUTHOR("Nick Crews <ncrews@chromium.org>");
MODULE_DESCRIPTION("Wilco EC telemetry driver"); MODULE_DESCRIPTION("Wilco EC telemetry driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:" DRV_NAME);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment