summaryrefslogtreecommitdiff
path: root/drivers/platform/chrome
Commit message (Collapse)AuthorAgeFilesLines
* platform/chrome: cros_ec_debugfs: cancel/schedule logging work only if supportedGuenter Roeck2019-03-191-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following traceback was reported on ASUS C201, which does not support console logging. ------------[ cut here ]------------ WARNING: CPU: 2 PID: 361 at kernel/workqueue.c:3030 __flush_work+0x38/0x154 Modules linked in: snd_soc_hdmi_codec cros_ec_debugfs cros_ec_sysfs uvcvideo dw_hdmi_cec dw_hdmi_i2s_audio videobuf2_vmalloc cfg80211 gpio_charger rk_crypto rfkill videobuf2_memops videobuf2_v4l2 des_generic videobuf2_common ofpart m25p80 spi_nor tpm_i2c_infineon sbs_battery mtd tpm joydev cros_ec_dev coreboot_table evdev mousedev ip_tables x_tables [last unloaded: brcmutil] CPU: 2 PID: 361 Comm: systemd-sleep Not tainted 5.1.0-rc1-1-ARCH+ #1 Hardware name: Rockchip (Device Tree) [<c020e4b0>] (unwind_backtrace) from [<c020ac18>] (show_stack+0x10/0x14) [<c020ac18>] (show_stack) from [<c07a3e04>] (dump_stack+0x7c/0x9c) [<c07a3e04>] (dump_stack) from [<c0222748>] (__warn+0xd0/0xec) [<c0222748>] (__warn) from [<c022279c>] (warn_slowpath_null+0x38/0x44) [<c022279c>] (warn_slowpath_null) from [<c02365d0>] (__flush_work+0x38/0x154) [<c02365d0>] (__flush_work) from [<c023786c>] (__cancel_work_timer+0x114/0x1a4) [<c023786c>] (__cancel_work_timer) from [<bf33233c>] (cros_ec_debugfs_suspend+0x14/0x1c [cros_ec_debugfs]) [<bf33233c>] (cros_ec_debugfs_suspend [cros_ec_debugfs]) from [<c056a888>] (dpm_run_callback+0x64/0xcc) [<c056a888>] (dpm_run_callback) from [<c056ad2c>] (__device_suspend+0x174/0x3a8) [<c056ad2c>] (__device_suspend) from [<c056b9e0>] (dpm_suspend+0x174/0x1e0) [<c056b9e0>] (dpm_suspend) from [<c026b3e0>] (suspend_devices_and_enter+0x6c/0x50c) [<c026b3e0>] (suspend_devices_and_enter) from [<c026ba8c>] (pm_suspend+0x20c/0x274) [<c026ba8c>] (pm_suspend) from [<c026a628>] (state_store+0x54/0x88) [<c026a628>] (state_store) from [<c03cd2d0>] (kernfs_fop_write+0x114/0x180) [<c03cd2d0>] (kernfs_fop_write) from [<c035d48c>] (__vfs_write+0x1c/0x154) [<c035d48c>] (__vfs_write) from [<c035f9e8>] (vfs_write+0xb8/0x198) [<c035f9e8>] (vfs_write) from [<c035fbc0>] (ksys_write+0x3c/0x74) [<c035fbc0>] (ksys_write) from [<c0201000>] (ret_fast_syscall+0x0/0x4c) Exception stack(0xe9365fa8 to 0xe9365ff0) 5fa0: 00000004 beef8b28 00000004 beef8b28 00000004 00000000 5fc0: 00000004 beef8b28 02319170 00000004 beef8b28 00000004 b6f3d900 beef8b74 5fe0: 0000006c beef8a98 b6c0adac b6c66534 ---[ end trace f4ee5df14e8ea0ec ]--- If console logging is not supported, the work structure is never initialized, resulting in the traceback. Calling cancel/schedule functions conditionally fixes the problem. While at it, also fix error handling in the probe function. Reported-by: Urja Rannikko <urjaman@gmail.com> Cc: Urja Rannikko <urjaman@gmail.com> Fixes: 6fce0a2cf5a05 ("mfd / platform: cros_ec: Move debugfs attributes to its own driver") Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Benson Leung <bleung@chromium.org>
* platform/chrome: Fix locking pattern in wilco_ec_mailbox()Nick Crews2019-03-181-1/+1
| | | | | | | | | | | Before, ec->data_buffer could be written to from multiple contexts at the same time. Since the ec is shared data, it needs to be inside the mutex as well. Fixes: 7b3d4f44abf0 ("platform/chrome: Add new driver for Wilco EC") Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Benson Leung <bleung@chromium.org>
* platform/chrome: fix wilco-ec dependenciesArnd Bergmann2019-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | When CROS_EC_LPC is set to =m, we get a link failure for a builtin wilco-ec module: drivers/platform/chrome/wilco_ec/core.o: In function `wilco_ec_remove': core.c:(.text+0x26): undefined reference to `cros_ec_lpc_mec_destroy' drivers/platform/chrome/wilco_ec/core.o: In function `wilco_ec_probe': core.c:(.text+0x18c): undefined reference to `cros_ec_lpc_mec_init' core.c:(.text+0x224): undefined reference to `cros_ec_lpc_mec_destroy' drivers/platform/chrome/wilco_ec/mailbox.o: In function `wilco_ec_mailbox': mailbox.c:(.text+0x104): undefined reference to `cros_ec_lpc_io_bytes_mec' The problem with the existing CROS_EC_LPC_MEC dependency is that this is only for a 'bool' symbol, so the information about the exported functions being in a module is lost on the way, and we actually have to depend on both CROS_EC_LPC and CROS_EC_LPC_MEC. Fixes: 7b3d4f44abf0 ("platform/chrome: Add new driver for Wilco EC") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: wilco_ec: Add RTC driverNick Crews2019-02-211-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This Embedded Controller has an internal RTC that is exposed as a standard RTC class driver with read/write functionality. The driver is added to the drivers/rtc/ so that the maintainer of that directory will be able to comment on this change, as that maintainer is the expert on this system. In addition, the driver code is called indirectly after a corresponding device is registered from core.c, as opposed to core.c registering the driver callbacks directly. To test: > hwclock --show --rtc /dev/rtc1 2007-12-31 16:01:20.460959-08:00 > hwclock --systohc --rtc /dev/rtc1 > hwclock --show --rtc /dev/rtc1 2018-11-29 17:08:00.780793-08:00 > hwclock --show --rtc /dev/rtc1 2007-12-31 16:01:20.460959-08:00 > hwclock --systohc --rtc /dev/rtc1 > hwclock --show --rtc /dev/rtc1 2018-11-29 17:08:00.780793-08:00 Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> [Fix the sparse warning: symbol 'wilco_ec_rtc_read/write' was not declared] Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: wilco_ec: Add support for raw commands in debugfsNick Crews2019-02-214-0/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a debugfs attribute that allows sending raw commands to the EC. This is useful for development and debug but should not be enabled in a production environment. To test: Get the EC firmware build date First send the request command > echo 00 f0 38 00 03 00 > raw Then read the result. "12/21/18" is in the middle of the response > cat raw 00 31 32 2f 32 31 2f 31 38 00 00 0f 01 00 01 00 .12/21/18....... Get the EC firmware build date First send the request command > echo 00 f0 38 00 03 00 > raw Then read the result. "12/21/18" is in the middle of the response > cat raw 00 31 32 2f 32 31 2f 31 38 00 00 0f 01 00 01 00 .12/21/18....... Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> [Fix off-by-one error in wilco_ec/debugfs.c] Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: Add new driver for Wilco ECNick Crews2019-02-216-0/+359
| | | | | | | | | | | | | | | | | This EC is an incompatible variant of the typical Chrome OS embedded controller. It uses the same low-level communication and a similar protocol with some significant differences. The EC firmware does not support the same mailbox commands so it is not registered as a cros_ec device type. This commit exports the wilco_ec_mailbox() function so that other modules can use it to communicate with the EC. Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> [Fix the sparse warning: symbol 'wilco_ec_transfer' was not declared] Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> [Fix Kconfig dependencies for wilco_ec] Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: cros_ec: Remove cros_ec dependency in lpc_mecNick Crews2019-02-113-59/+83
| | | | | | | | | | | | | | | | | | | | | | | | | In order to allow this code to be re-used, remove the dependency on the rest of the cros_ec code from the cros_ec_lpc_mec functions. Instead of using a hardcoded register base address of 0x800 have this be passed in to cros_ec_lpc_mec_init(). The existing cros_ec use case now passes in the 0x800 base address this way. There are some error checks that happen in cros_ec_lpc_mec_in_range() that probably shouldn't be there, as they are checking kernel-space callers and not user-space input. However, we'll just do the refactor in this patch, and in a future patch might remove this error checking and fix all the instances of code that calls this. There's a similar problem in cros_ec_lpc_read_bytes(), where we return a checksum, but on error just return 0. This should probably be changed so that it returns int, but we don't want to have to mess with all the calling code for this fix. Maybe we'll come back through later and fix this. Signed-off-by: Duncan Laurie <dlaurie@google.com> Signed-off-by: Nick Crews <ncrews@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
* platform/chrome: cros_ec_sysfs: remove pr_fmt() defineEnric Balletbo i Serra2019-02-011-2/+0
| | | | | | | This driver no longer has any pr_{level} messages. Remove the pr_fmt(). Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_lightbar: remove pr_fmt() defineEnric Balletbo i Serra2019-02-011-2/+0
| | | | | | | This driver no longer has any pr_{level} messages. Remove the pr_fmt(). Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_kbd_led_backlight: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-15/+4
| | | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Also change the term 'Chrome OS' for 'ChromeOS' to be coherent with other drivers. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_spi: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-15/+5
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Also change the description for one more appropriate. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_proto: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-15/+4
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_lpc: switch to SPDX identifierEnric Balletbo i Serra2019-02-015-102/+24
| | | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Also remove the license boiler-plate and redundant driver description. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_i2c: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-16/+6
| | | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Also fix the module license mismatch and change the description for a more descriptive phrase. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_vbc: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-19/+5
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_sysfs: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-19/+5
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Also change the description for one more appropriate. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_lightbar: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-18/+4
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_debugfs: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-18/+4
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cromeos_pstore: switch to SPDX identifierEnric Balletbo i Serra2019-02-011-11/+6
| | | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Also fix the module license mismatch and change the term 'Chrome OS' for 'ChromeOS' to be coherent with other drivers. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org>
* platform/chrome: cros_ec_lightbar: Instantiate only if the EC has a lightbarEnric Balletbo i Serra2019-02-011-35/+18
| | | | | | | | | | | | | | | | | | | | | | | Due to the way attribute groups visibility work, the function cros_ec_lightbar_attrs_are_visible is called multiple times, once per attribute, and each of these calls makes an EC transaction. For what is worth the EC log reports multiple errors on boot when the lightbar is not available. Instead, check if the EC has a lightbar in the probe function and only instantiate the device. Ideally we should have instantiate the driver only if the EC_FEATURE_LIGHTBAR is defined, but that's not possible because that flag is not in the very first Pixel Chromebook (Link), only on Samus. So, the driver is instantiated by his parent always. This patch changes a bit the actual behaviour. Before the patch if an EC doesn't have a lightbar an empty lightbar folder is created in /sys/class/chromeos/<ec-device-name>, after the patch the empty folder is not created, so, the folder is only created if the lightbar exists. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd / platform: cros_ec_vbc: Instantiate only if the EC has a VBC NVRAMEnric Balletbo i Serra2019-02-011-16/+0
| | | | | | | | | | | | | | | | | The cros-ec-vbc driver is DT-only and there is a DT property that indicates if the EC has the VCB NVRAM, in such case instantiate the driver but don't instantiate on the other cases. To do this move the check code to its parent instead of play with the attribute group visibility. This changes a bit the actual behaviour. Before the patch if an EC doesn't have a VBC NVRAM an empty vbc folder is created in /sys/class/chromeos/<ec-device-name>, after the patch the empty folder is not created, so, the folder is only created if the vbc is set. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd / platform: cros_ec: Move device sysfs attributes to its own driverEnric Balletbo i Serra2019-02-014-7/+48
| | | | | | | | | | | | The entire way how cros debugfs attibutes are created is broken. cros_ec_sysfs should be its own driver and its attributes should be associated with the sysfs driver not the mfd driver. The patch also adds the sysfs documentation. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd / platform: cros_ec: Move debugfs attributes to its own driverEnric Balletbo i Serra2019-02-013-22/+55
| | | | | | | | | | The entire way how cros debugfs attibutes are created is broken. cros_ec_debugfs should be its own driver and its attributes should be associated with a debugfs driver not the mfd driver. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd / platform: cros_ec: Move vbc attributes to its own driverEnric Balletbo i Serra2019-02-013-2/+55
| | | | | | | | | | | | | The entire way how cros sysfs attibutes are created is broken. cros_ec_vbc should be its own driver and its attributes should be associated with a vbc driver not the mfd driver. In order to retain the path, the vbc attributes are attached to the cros_class. The patch also adds the sysfs documentation. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd / platform: cros_ec: Move lightbar attributes to its own driverEnric Balletbo i Serra2019-02-013-23/+86
| | | | | | | | | | | | | The entire way how cros sysfs attibutes are created is broken. cros_ec_lightbar should be its own driver and its attributes should be associated with a lightbar driver not the mfd driver. In order to retain the path, the lightbar attributes are attached to the cros_class. The patch also adds the sysfs documentation. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* mfd / platform: cros_ec: Use devm_mfd_add_devicesEnric Balletbo i Serra2019-02-013-25/+0
| | | | | | | | | | Use devm_mfd_add_devices() for adding cros-ec core MFD child devices. This reduces the need of remove callback from platform/chrome for removing the MFD child devices. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* platform/chrome: don't report EC_MKBP_EVENT_SENSOR_FIFO as wakeupBrian Norris2018-11-131-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | EC_MKBP_EVENT_SENSOR_FIFO events can be triggered for a variety of reasons, and there are very few cases in which they should be treated as wakeup interrupts (particularly, when a certain MOTIONSENSE_MODULE_FLAG_* is set, but this is not even supported in the mainline cros_ec_sensor driver yet). Most of the time, they are benign sensor readings. In any case, the top-level cros_ec device doesn't know enough to determine that they should wake the system, and so it should not report the event. This would be the job of the cros_ec_sensors driver to parse. This patch adds checks to cros_ec_get_next_event() such that it doesn't signal 'wakeup' for events of type EC_MKBP_EVENT_SENSOR_FIFO. This patch is particularly relevant on devices like Scarlet (Rockchip RK3399 tablet, known as Acer Chromebook Tab 10), where the EC firmware reports sensor events much more frequently. This was causing /sys/power/wakeup_count to increase very frequently, often needlessly interrupting our ability to suspend the system. Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org>
* platform/chrome: straighten out cros_ec_get_{next,host}_event() error codesBrian Norris2018-11-131-2/+2
| | | | | | | | | | | | | | | | | | | cros_ec_get_next_event() is documented to return 0 for success and negative for errors. It currently returns negative for some errors, and non-negative (number of bytes received) for success (including some "no data available" responses as zero). This mostly works out OK, because the callers were more or less ignoring the documentation, and only treating positive values as success (and indepdently checking the modification of 'wakeup'). Let's button this up by avoiding pretending to handle event/wakeup distinctions when no event info was retrieved (i.e., returned 0 bytes). And fix the documentation of cros_ec_get_host_event() and cros_ec_get_next_event() to accurately describe their behavior. Signed-off-by: Brian Norris <briannorris@chromium.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Benson Leung <bleung@chromium.org>
* platform/chrome: chromeos_tbmc - Remove unneeded constNathan Chancellor2018-10-091-1/+1
| | | | | | | | | | | | | | | | | | | Clang warns: drivers/platform/chrome/chromeos_tbmc.c:102:14: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier] static const SIMPLE_DEV_PM_OPS(chromeos_tbmc_pm_ops, NULL, ^ ./include/linux/pm.h:365:56: note: expanded from macro 'SIMPLE_DEV_PM_OPS' ^ 1 warning generated. SIMPLE_DEV_PM_OPS is already declared as const, this one is unnecessary so remove it. Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
* platform/chrome: Add a new interrupt path for cros_ec_lpcEnrico Granata2018-10-091-1/+14
| | | | | | | | | | | | This commit allows cros_ec_lpc to register a direct IRQ instead of relying on the ACPI notification chain to receive MKBP events. This change is done in the interest of allowing reduced jitter in the communication path between the CrOS EC and the host for receiving sensor data. Signed-off-by: Enrico Granata <egranata@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org>
* Merge remote-tracking branch ↵Benson Leung2018-10-095-3/+157
|\ | | | | | | 'origin/ib-chrome-platform-mfd-move-cros_ec_lpc' into working-branch-for-4.20
| * platform/chrome: Move mfd/cros_ec_lpc* includes to drivers/platform.Enric Balletbo i Serra2018-09-075-3/+157
| | | | | | | | | | | | | | | | | | | | | | | | The cros-ec-lpc driver lives in drivers/platform because is platform specific, however there are two includes (cros_ec_lpc_mec.h and cros_ec_lpc_reg.h) that lives in include/linux/mfd. These two includes are only used for the platform driver and are not really related to the MFD subsystem, so move the includes from include/linux/mfd to drivers/platform/chrome. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Benson Leung <bleung@chromium.org>
* | mfd: cros-ec: copy the whole event in get_next_event_xferEmil Karlson2018-10-091-1/+1
|/ | | | | | | | | | | | | | | | | Commit 57e94c8b974db2d83c60e1139c89a70806abbea0 caused cros-ec keyboard events be truncated on many chromebooks so that Left and Right keys on Column 12 were always 0. Use ret as memcpy len to fix this. The old code was using ec_dev->event_size, which is the event payload/data size excluding event_type header, for the length of the memcpy operation. Use ret as memcpy length to avoid the off by one and copy the whole msg->data. Fixes: 57e94c8b974d ("mfd: cros-ec: Increase maximum mkbp event size") Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Tested-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Emil Karlson <jekarlson@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
* Merge tag 'chrome-platform-for-linus-4.19' of ↵Linus Torvalds2018-08-211-1/+9
|\ | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform Pull chrome platform updates from Benson Leung. Everything but the SPDX identifier updates actually came in earlier through the MFD merge. * tag 'chrome-platform-for-linus-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: platform/chrome: chromeos_tbmc - fix SPDX identifier
| * Merge tag 'ib-platform-chrome-mfd-move-cros-ec-transport-for-4.19' into ↵Benson Leung2018-07-094-0/+1151
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | working-branch-for-4.19 Immutable branch (mfd, chrome) due for the v4.19 window Immutable Branch which moves the cros_ec_i2c and cros_ec_spi transport drivers from mfd to platform/chrome. Changes in arm are a simple rename in defconfigs. Change in input is a rename in help text.
| * | platform/chrome: chromeos_tbmc - fix SPDX identifierBenson Leung2018-06-161-1/+9
| | | | | | | | | | | | | | | | | | | | | Original submission was GPLv2 only, so mark as GPL-2.0. Also restored some descriptive lines that were there before. Signed-off-by: Benson Leung <bleung@chromium.org>
| | |
| \ \
| \ \
| \ \
*---. \ \ Merge branches 'ib-mfd-4.19', 'ib-mfd-gpio-pinctrl-4.19', ↵Lee Jones2018-07-275-9/+1182
|\ \ \ \ \ | |_|_|/ / |/| | | / | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | 'ib-mfd-i915-media-platform-4.19' and 'ib-mfd-regulator-4.19', tag 'ib-platform-chrome-mfd-move-cros-ec-transport-for-4.19' into ibs-for-mfd-merged Immutable branch (mfd, chrome) due for the v4.19 window Immutable Branch which moves the cros_ec_i2c and cros_ec_spi transport drivers from mfd to platform/chrome. Changes in arm are a simple rename in defconfigs. Change in input is a rename in help text.
| | | * platform/chrome: Move cros-ec transport drivers to drivers/platform.Enric Balletbo i Serra2018-07-034-0/+1151
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are some cros-ec transport drivers (I2C, SPI) living in MFD, while others (LPC) living in drivers/platform. The transport drivers are more platform specific. So, move the I2C and SPI transport drivers to the platform/chrome directory. The patch also removes the MFD_ prefix of their Kconfig symbols. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Benson Leung <bleung@chromium.org>
| | * mfd: cros-ec: Increase maximum mkbp event sizeNeil Armstrong2018-07-131-9/+31
| |/ |/| | | | | | | | | | | | | | | | | | | | | Having a 16 byte mkbp event size makes it possible to send CEC messages from the EC to the AP directly inside the mkbp event instead of first doing a notification and then a read. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Tested-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* | Merge tag 'mfd-next-4.18' of ↵Linus Torvalds2018-06-111-0/+20
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Device Support: - Add support for AXP813 ADC to AXP20x - Add support for PM8005, PM8998 and PMI8998 New Functionality: - Add support for Battery Power Supply to AXP813 - Add support for SYSCON to SPARD SC27XX SPI - Add support for RTC to ChromeOS Embedded-Controller Fix-ups: - Remove unused code; exynos{4,5}-pmu, cros_ec, cros_ec_acpi_gpe - Remove duplicate error messages (-ENOMEM, etc); htc-i2cpld, janz-cmodio, max8997, rc5t583, sm501, smsc-ece1099, abx500-core, si476x-i2c, ti_am335x_tscadc, tps65090, tps6586x, tps65910, tps80031, twl6030-irq, viperboard - Succinctly use ptr to struct in sizeof(); rc5t583, abx500-core, sm501, smsc-ece1099 - Simplify syntax for NULL ptr checking; abx500-core, sm501 - No not unnecessarily initialise variables; tps65910, tps65910 - Reorganise and simplify driver data; omap-usb-tll - Move to SPDX license statement; tps68470 - Probe ADCs via DT; axp20x - Use new GPIOD API; arizona-core - Constify things; axp20x - Reduce code-size (use MACROS, etc); axp20x, omap-usb-host - Add DT support/docs; motorola-cpcap - Remove VLAs; rave-sp - Use devm_* managed resources; cros_ec - Interrogate HW for firmware version; rave-sp - Provide ACPI support for ChromeOS Embedded-Controller Bug Fixes: - Reorder ordered (enum) device list; tps65218 - Only accept valid data from the offset; rave-sp - Refrain from copying junk from failed SPI read; cros_ec_dev - Fix potential memory leaks; pcf50633-core - Fix clock initialisation; twl-core - Fix build-issue; tps65911 - Fix off-by-one error; tps65911 - Fix code ordering issues; intel-lpss - Fix COMPILE_TEST related issues; pwm-stm32 - Fix broken MMC card detection; asic3 - Fix clocking related issues; intel-lpss-pci" * tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (84 commits) mfd: cros_ec: Remove unused __remove function mfd: wm97xx-core: Platform data can be NULL mfd: cros_ec_dev: Don't advertise junk features on failure mfd: cros_ec: Use devm_kzalloc for private data mfd: intel-lpss: Fix Intel Cannon Lake LPSS I2C input clock mfd: asic3: Fix broken MMC card detection mfd: timberdale: Fix spelling mistake "Uknown" -> "Unknown" mfd: omap-usb-host: Use match_string() helper mfd: stm32-timers: Fix pwm-stm32 linker issue with COMPILE_TEST pwm: stm32: Initialize raw local variables mfd: arizona: Update DT doc to support more standard Reset binding dt-bindings: mfd: Add bindings for DA9063L mfd: intel-lpss: Correct names of RESETS register bits mfd: qcom-spmi-pmic: Add support for pm8005, pm8998 and pmi8998 mfd: intel-lpss: Program REMAP register in PIO mode mfd: cros_ec_i2c: Moving the system sleep pm ops to late mfd: cros_ec_i2c: Add ACPI module device table mfd: cros_ec_dev: Register shutdown function for debugfs mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice mfd: cros_ec: Don't try to grab log when suspended ...
| * | mfd: cros_ec: Don't try to grab log when suspendedDouglas Anderson2018-05-291-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should stop our worker thread while we're suspended. If we don't then we'll get messages like: cros-ec-spi spi5.0: spi transfer failed: -108 cros-ec-spi spi5.0: cs-deassert spi transfer failed: -108 cros-ec-ctl cros-ec-ctl.0.auto: EC communication failed Signed-off-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
* | | Merge tag 'chrome-platform-for-linus-4.18' of ↵Linus Torvalds2018-06-048-57/+426
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform Pull chrome platform updates from Benson Leung: - further changes from Dmitry related to the removal of platform data from atmel_mxt_ts and chromeos_laptop. This time, we have some changes that teach chromeos_laptop how to supply acpi properties for some input devices so that the peripheral driver doesn't have to do dmi matching on some Chromebook platforms. - new Chromebook Tablet switch driver, which is useful for x86 convertible Chromebooks. - other misc cleanup * tag 'chrome-platform-for-linus-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: platform/chrome: Use to_cros_ec_dev more broadly platform/chrome: chromeos_laptop: fix touchpad button mapping on Celes platform: chrome: Add input dependency for tablet switch driver platform/chrome: chromeos_laptop - supply properties for ACPI devices platform/chrome: chromeos_tbmc - add SPDX identifier platform: chrome: Add Tablet Switch ACPI driver platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device found
| * | platform/chrome: Use to_cros_ec_dev more broadlyGwendal Grignou2018-05-303-22/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move to_cros_ec_dev macro to cros_ec.h and use it when the private ec object is needed from device object. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Benson Leung <bleung@chromium.org>
| * | platform/chrome: chromeos_laptop: fix touchpad button mapping on CelesDmitry Torokhov2018-05-291-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Celes has newer touch controller (compared to the controllers used in older BayTrail-based devices) and so uses the same button mapping as Samus. This fixes the issue with mouse button being stuck in pressed state after the first click. Reported-by: Sultan Alsawaf <sultanxda@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
| * | Merge branch 'ib-chrome-platform-atmel-mxt-ts-device-properties' into ↵Benson Leung2018-05-281-29/+278
| |\ \ | | | | | | | | | | | | | | | | | | | | working-branch-for-4.18 Signed-off-by: Benson Leung <bleung@chromium.org>
| | * | platform/chrome: chromeos_laptop - supply properties for ACPI devicesDmitry Torokhov2018-05-231-29/+278
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BayTrail-based and newer Chromebooks describe their peripherals in ACPI; unfortunately their description is not complete, and peripherals drivers, such as driver for Atmel Touch controllers, has to resort to DMI-matching to configure the peripherals properly. To avoid polluting peripheral driver code, let's teach chromeos_laptop driver to supply missing data via generic device properties. Note we supply "compatible" string for Atmel peripherals not because it is needed for matching devices and driver (matching is still done on ACPI HID entries), but because peripherals driver will be using presence of "compatible" property to determine if device properties have been attached to the device, and fail to bind if they are absent. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
| * | | platform: chrome: Add input dependency for tablet switch driverArnd Bergmann2018-05-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without CONFIG_INPUT, or with a modular input layer and built-in tablet driver, we get a link error: ERROR: "input_event" [drivers/platform/chrome/chromeos_tbmc.ko] undefined! ERROR: "input_register_device" [drivers/platform/chrome/chromeos_tbmc.ko] undefined! ERROR: "input_set_capability" [drivers/platform/chrome/chromeos_tbmc.ko] undefined! ERROR: "devm_input_allocate_device" [drivers/platform/chrome/chromeos_tbmc.ko] undefined! This adds the corresponding Kconfig dependency Fixes: b418f74170d7 ("platform: chrome: Add Tablet Switch ACPI driver") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Benson Leung <bleung@chromium.org>
| * | | platform/chrome: chromeos_tbmc - add SPDX identifierBenson Leung2018-05-231-22/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the original license statement with the SPDX identifier. Add also one line of description as recommended by the COPYING file. Signed-off-by: Benson Leung <bleung@chromium.org>
| * | | platform: chrome: Add Tablet Switch ACPI driverGwendal Grignou2018-05-233-0/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a kernel driver for GOOG0006, an ACPI driver reporting an event when the tablet switch status changes. On an ACPI based convertible chromebook check evtest display tablet mode switch changes: Available devices: .. /dev/input/event3: Tablet Mode Switch .. Testing ... (interrupt to exit) Event: time 1484879712.604360, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1 Event: time 1484879712.604360, -------------- SYN_REPORT ------------ Event: time 1484879715.132228, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0 Event: time 1484879715.132228, -------------- SYN_REPORT ------------ ... Check state is updated at resume time when different from suspend time. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org>
| * | | platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device foundDmitry Torokhov2018-05-221-6/+7
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Older models of Chromebooks did not describe the LPC EC in their ACPI tables; starting with Strago-based devices Google is using GOOG0004 device to describe EC LPC. DMI-based match is fragile and does not work reliably, especially when using custom firmware. It is also not needed when we can locate the right ACPI device, so let's stop bailing out when DMI does not match but the right ACPI device is present. Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>