aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenson Leung <bleung@chromium.org>2017-12-15 23:54:41 -0500
committerBenson Leung <bleung@chromium.org>2017-12-15 23:54:50 -0500
commit4398ef0ee62f3eb6d4b2f2acc69e098b3f4c3f81 (patch)
treed2a6eff73e8b621fd106e5742c48c435e08b5d7f
parent50c4c4e268a2d7a3e58ebb698ac74da0de40ae36 (diff)
parent5e0115581bbc367c7958bf5ab8c511b808558533 (diff)
Merge branch 'ibs-for-chrome-platform-merged' into working-branch-for-4.16
Signed-off-by: Benson Leung <bleung@chromium.org>
-rw-r--r--drivers/mfd/Kconfig10
-rw-r--r--drivers/mfd/Makefile1
-rw-r--r--drivers/mfd/cros_ec.c4
-rw-r--r--drivers/mfd/cros_ec_dev.c (renamed from drivers/platform/chrome/cros_ec_dev.c)8
-rw-r--r--drivers/mfd/cros_ec_dev.h (renamed from drivers/platform/chrome/cros_ec_dev.h)0
-rw-r--r--drivers/platform/chrome/Kconfig10
-rw-r--r--drivers/platform/chrome/Makefile7
-rw-r--r--drivers/platform/chrome/cros_ec_debugfs.c5
-rw-r--r--drivers/platform/chrome/cros_ec_debugfs.h27
-rw-r--r--drivers/platform/chrome/cros_ec_lightbar.c6
-rw-r--r--drivers/platform/chrome/cros_ec_sysfs.c5
-rw-r--r--drivers/platform/chrome/cros_ec_vbc.c1
-rw-r--r--include/linux/mfd/cros_ec.h4
13 files changed, 37 insertions, 51 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 1d20a800e967..538a2ae8bd25 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -222,6 +222,16 @@ config MFD_CROS_EC_SPI
222 response time cannot be guaranteed, we support ignoring 222 response time cannot be guaranteed, we support ignoring
223 'pre-amble' bytes before the response actually starts. 223 'pre-amble' bytes before the response actually starts.
224 224
225config MFD_CROS_EC_CHARDEV
226 tristate "Chrome OS Embedded Controller userspace device interface"
227 depends on MFD_CROS_EC
228 select CROS_EC_CTL
229 ---help---
230 This driver adds support to talk with the ChromeOS EC from userspace.
231
232 If you have a supported Chromebook, choose Y or M here.
233 The module will be called cros_ec_dev.
234
225config MFD_ASIC3 235config MFD_ASIC3
226 bool "Compaq ASIC3" 236 bool "Compaq ASIC3"
227 depends on GPIOLIB && ARM 237 depends on GPIOLIB && ARM
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index d9474ade32e6..fcd8af88110e 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -17,6 +17,7 @@ cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o
17obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o 17obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o
18obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o 18obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o
19obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o 19obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o
20obj-$(CONFIG_MFD_CROS_EC_CHARDEV) += cros_ec_dev.o
20obj-$(CONFIG_MFD_EXYNOS_LPASS) += exynos-lpass.o 21obj-$(CONFIG_MFD_EXYNOS_LPASS) += exynos-lpass.o
21 22
22rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o 23rtsx_pci-objs := rtsx_pcr.o rts5209.o rts5229.o rtl8411.o rts5227.o rts5249.o
diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
index b0ca5a4c841e..d61024141e2b 100644
--- a/drivers/mfd/cros_ec.c
+++ b/drivers/mfd/cros_ec.c
@@ -40,13 +40,13 @@ static struct cros_ec_platform pd_p = {
40}; 40};
41 41
42static const struct mfd_cell ec_cell = { 42static const struct mfd_cell ec_cell = {
43 .name = "cros-ec-ctl", 43 .name = "cros-ec-dev",
44 .platform_data = &ec_p, 44 .platform_data = &ec_p,
45 .pdata_size = sizeof(ec_p), 45 .pdata_size = sizeof(ec_p),
46}; 46};
47 47
48static const struct mfd_cell ec_pd_cell = { 48static const struct mfd_cell ec_pd_cell = {
49 .name = "cros-ec-ctl", 49 .name = "cros-ec-dev",
50 .platform_data = &pd_p, 50 .platform_data = &pd_p,
51 .pdata_size = sizeof(pd_p), 51 .pdata_size = sizeof(pd_p),
52}; 52};
diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index cf6c4f0846b8..e4fafdd96e5e 100644
--- a/drivers/platform/chrome/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -25,9 +25,10 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/uaccess.h> 26#include <linux/uaccess.h>
27 27
28#include "cros_ec_debugfs.h"
29#include "cros_ec_dev.h" 28#include "cros_ec_dev.h"
30 29
30#define DRV_NAME "cros-ec-dev"
31
31/* Device variables */ 32/* Device variables */
32#define CROS_MAX_DEV 128 33#define CROS_MAX_DEV 128
33static int ec_major; 34static int ec_major;
@@ -461,7 +462,7 @@ static int ec_device_remove(struct platform_device *pdev)
461} 462}
462 463
463static const struct platform_device_id cros_ec_id[] = { 464static const struct platform_device_id cros_ec_id[] = {
464 { "cros-ec-ctl", 0 }, 465 { DRV_NAME, 0 },
465 { /* sentinel */ }, 466 { /* sentinel */ },
466}; 467};
467MODULE_DEVICE_TABLE(platform, cros_ec_id); 468MODULE_DEVICE_TABLE(platform, cros_ec_id);
@@ -493,7 +494,7 @@ static const struct dev_pm_ops cros_ec_dev_pm_ops = {
493 494
494static struct platform_driver cros_ec_dev_driver = { 495static struct platform_driver cros_ec_dev_driver = {
495 .driver = { 496 .driver = {
496 .name = "cros-ec-ctl", 497 .name = DRV_NAME,
497 .pm = &cros_ec_dev_pm_ops, 498 .pm = &cros_ec_dev_pm_ops,
498 }, 499 },
499 .probe = ec_device_probe, 500 .probe = ec_device_probe,
@@ -544,6 +545,7 @@ static void __exit cros_ec_dev_exit(void)
544module_init(cros_ec_dev_init); 545module_init(cros_ec_dev_init);
545module_exit(cros_ec_dev_exit); 546module_exit(cros_ec_dev_exit);
546 547
548MODULE_ALIAS("platform:" DRV_NAME);
547MODULE_AUTHOR("Bill Richardson <wfrichar@chromium.org>"); 549MODULE_AUTHOR("Bill Richardson <wfrichar@chromium.org>");
548MODULE_DESCRIPTION("Userspace interface to the Chrome OS Embedded Controller"); 550MODULE_DESCRIPTION("Userspace interface to the Chrome OS Embedded Controller");
549MODULE_VERSION("1.0"); 551MODULE_VERSION("1.0");
diff --git a/drivers/platform/chrome/cros_ec_dev.h b/drivers/mfd/cros_ec_dev.h
index 45e9453608c5..45e9453608c5 100644
--- a/drivers/platform/chrome/cros_ec_dev.h
+++ b/drivers/mfd/cros_ec_dev.h
diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig
index 0ad6e290bbda..e728a96cabfd 100644
--- a/drivers/platform/chrome/Kconfig
+++ b/drivers/platform/chrome/Kconfig
@@ -38,14 +38,8 @@ config CHROMEOS_PSTORE
38 If you have a supported Chromebook, choose Y or M here. 38 If you have a supported Chromebook, choose Y or M here.
39 The module will be called chromeos_pstore. 39 The module will be called chromeos_pstore.
40 40
41config CROS_EC_CHARDEV 41config CROS_EC_CTL
42 tristate "Chrome OS Embedded Controller userspace device interface" 42 tristate
43 depends on MFD_CROS_EC
44 ---help---
45 This driver adds support to talk with the ChromeOS EC from userspace.
46
47 If you have a supported Chromebook, choose Y or M here.
48 The module will be called cros_ec_dev.
49 43
50config CROS_EC_LPC 44config CROS_EC_LPC
51 tristate "ChromeOS Embedded Controller (LPC)" 45 tristate "ChromeOS Embedded Controller (LPC)"
diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile
index a077b1f0211d..ff3b369911f0 100644
--- a/drivers/platform/chrome/Makefile
+++ b/drivers/platform/chrome/Makefile
@@ -2,10 +2,9 @@
2 2
3obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o 3obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o
4obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o 4obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o
5cros_ec_devs-objs := cros_ec_dev.o cros_ec_sysfs.o \ 5cros_ec_ctl-objs := cros_ec_sysfs.o cros_ec_lightbar.o \
6 cros_ec_lightbar.o cros_ec_vbc.o \ 6 cros_ec_vbc.o cros_ec_debugfs.o
7 cros_ec_debugfs.o 7obj-$(CONFIG_CROS_EC_CTL) += cros_ec_ctl.o
8obj-$(CONFIG_CROS_EC_CHARDEV) += cros_ec_devs.o
9cros_ec_lpcs-objs := cros_ec_lpc.o cros_ec_lpc_reg.o 8cros_ec_lpcs-objs := cros_ec_lpc.o cros_ec_lpc_reg.o
10cros_ec_lpcs-$(CONFIG_CROS_EC_LPC_MEC) += cros_ec_lpc_mec.o 9cros_ec_lpcs-$(CONFIG_CROS_EC_LPC_MEC) += cros_ec_lpc_mec.o
11obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpcs.o 10obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpcs.o
diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index 4cc66f405760..98a35d32f9dd 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -29,9 +29,6 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/wait.h> 30#include <linux/wait.h>
31 31
32#include "cros_ec_dev.h"
33#include "cros_ec_debugfs.h"
34
35#define LOG_SHIFT 14 32#define LOG_SHIFT 14
36#define LOG_SIZE (1 << LOG_SHIFT) 33#define LOG_SIZE (1 << LOG_SHIFT)
37#define LOG_POLL_SEC 10 34#define LOG_POLL_SEC 10
@@ -390,6 +387,7 @@ remove_debugfs:
390 debugfs_remove_recursive(debug_info->dir); 387 debugfs_remove_recursive(debug_info->dir);
391 return ret; 388 return ret;
392} 389}
390EXPORT_SYMBOL(cros_ec_debugfs_init);
393 391
394void cros_ec_debugfs_remove(struct cros_ec_dev *ec) 392void cros_ec_debugfs_remove(struct cros_ec_dev *ec)
395{ 393{
@@ -399,3 +397,4 @@ void cros_ec_debugfs_remove(struct cros_ec_dev *ec)
399 debugfs_remove_recursive(ec->debug_info->dir); 397 debugfs_remove_recursive(ec->debug_info->dir);
400 cros_ec_cleanup_console_log(ec->debug_info); 398 cros_ec_cleanup_console_log(ec->debug_info);
401} 399}
400EXPORT_SYMBOL(cros_ec_debugfs_remove);
diff --git a/drivers/platform/chrome/cros_ec_debugfs.h b/drivers/platform/chrome/cros_ec_debugfs.h
deleted file mode 100644
index 1ff3a50aa1b8..000000000000
--- a/drivers/platform/chrome/cros_ec_debugfs.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * Copyright 2015 Google, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef _DRV_CROS_EC_DEBUGFS_H_
19#define _DRV_CROS_EC_DEBUGFS_H_
20
21#include "cros_ec_dev.h"
22
23/* debugfs stuff */
24int cros_ec_debugfs_init(struct cros_ec_dev *ec);
25void cros_ec_debugfs_remove(struct cros_ec_dev *ec);
26
27#endif /* _DRV_CROS_EC_DEBUGFS_H_ */
diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index fd2b047a2748..6ea79d495aa2 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -33,8 +33,6 @@
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35 35
36#include "cros_ec_dev.h"
37
38/* Rate-limit the lightbar interface to prevent DoS. */ 36/* Rate-limit the lightbar interface to prevent DoS. */
39static unsigned long lb_interval_jiffies = 50 * HZ / 1000; 37static unsigned long lb_interval_jiffies = 50 * HZ / 1000;
40 38
@@ -414,6 +412,7 @@ error:
414 412
415 return ret; 413 return ret;
416} 414}
415EXPORT_SYMBOL(lb_manual_suspend_ctrl);
417 416
418int lb_suspend(struct cros_ec_dev *ec) 417int lb_suspend(struct cros_ec_dev *ec)
419{ 418{
@@ -422,6 +421,7 @@ int lb_suspend(struct cros_ec_dev *ec)
422 421
423 return lb_send_empty_cmd(ec, LIGHTBAR_CMD_SUSPEND); 422 return lb_send_empty_cmd(ec, LIGHTBAR_CMD_SUSPEND);
424} 423}
424EXPORT_SYMBOL(lb_suspend);
425 425
426int lb_resume(struct cros_ec_dev *ec) 426int lb_resume(struct cros_ec_dev *ec)
427{ 427{
@@ -430,6 +430,7 @@ int lb_resume(struct cros_ec_dev *ec)
430 430
431 return lb_send_empty_cmd(ec, LIGHTBAR_CMD_RESUME); 431 return lb_send_empty_cmd(ec, LIGHTBAR_CMD_RESUME);
432} 432}
433EXPORT_SYMBOL(lb_resume);
433 434
434static ssize_t sequence_store(struct device *dev, struct device_attribute *attr, 435static ssize_t sequence_store(struct device *dev, struct device_attribute *attr,
435 const char *buf, size_t count) 436 const char *buf, size_t count)
@@ -622,3 +623,4 @@ struct attribute_group cros_ec_lightbar_attr_group = {
622 .attrs = __lb_cmds_attrs, 623 .attrs = __lb_cmds_attrs,
623 .is_visible = cros_ec_lightbar_attrs_are_visible, 624 .is_visible = cros_ec_lightbar_attrs_are_visible,
624}; 625};
626EXPORT_SYMBOL(cros_ec_lightbar_attr_group);
diff --git a/drivers/platform/chrome/cros_ec_sysfs.c b/drivers/platform/chrome/cros_ec_sysfs.c
index f3baf9973989..d6eebe872187 100644
--- a/drivers/platform/chrome/cros_ec_sysfs.c
+++ b/drivers/platform/chrome/cros_ec_sysfs.c
@@ -34,8 +34,6 @@
34#include <linux/types.h> 34#include <linux/types.h>
35#include <linux/uaccess.h> 35#include <linux/uaccess.h>
36 36
37#include "cros_ec_dev.h"
38
39/* Accessor functions */ 37/* Accessor functions */
40 38
41static ssize_t show_ec_reboot(struct device *dev, 39static ssize_t show_ec_reboot(struct device *dev,
@@ -294,4 +292,7 @@ static struct attribute *__ec_attrs[] = {
294struct attribute_group cros_ec_attr_group = { 292struct attribute_group cros_ec_attr_group = {
295 .attrs = __ec_attrs, 293 .attrs = __ec_attrs,
296}; 294};
295EXPORT_SYMBOL(cros_ec_attr_group);
297 296
297MODULE_LICENSE("GPL");
298MODULE_DESCRIPTION("ChromeOS EC control driver");
diff --git a/drivers/platform/chrome/cros_ec_vbc.c b/drivers/platform/chrome/cros_ec_vbc.c
index 564a0d08c8bf..6d38e6b08334 100644
--- a/drivers/platform/chrome/cros_ec_vbc.c
+++ b/drivers/platform/chrome/cros_ec_vbc.c
@@ -135,3 +135,4 @@ struct attribute_group cros_ec_vbc_attr_group = {
135 .bin_attrs = cros_ec_vbc_bin_attrs, 135 .bin_attrs = cros_ec_vbc_bin_attrs,
136 .is_bin_visible = cros_ec_vbc_is_visible, 136 .is_bin_visible = cros_ec_vbc_is_visible,
137}; 137};
138EXPORT_SYMBOL(cros_ec_vbc_attr_group);
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 4e887ba22635..c61535979b8f 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -322,6 +322,10 @@ extern struct attribute_group cros_ec_attr_group;
322extern struct attribute_group cros_ec_lightbar_attr_group; 322extern struct attribute_group cros_ec_lightbar_attr_group;
323extern struct attribute_group cros_ec_vbc_attr_group; 323extern struct attribute_group cros_ec_vbc_attr_group;
324 324
325/* debugfs stuff */
326int cros_ec_debugfs_init(struct cros_ec_dev *ec);
327void cros_ec_debugfs_remove(struct cros_ec_dev *ec);
328
325/* ACPI GPE handler */ 329/* ACPI GPE handler */
326#ifdef CONFIG_ACPI 330#ifdef CONFIG_ACPI
327 331