aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-10-09platform/chrome: chromeos_tbmc - Remove unneeded constNathan Chancellor1-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>
2018-10-09platform/chrome: Add a new interrupt path for cros_ec_lpcEnrico Granata1-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>
2018-10-09Merge remote-tracking branch 'origin/ib-chrome-platform-mfd-move-cros_ec_lpc' into working-branch-for-4.20Benson Leung5-3/+157
2018-10-09mfd: cros-ec: copy the whole event in get_next_event_xferEmil Karlson1-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>
2018-09-07platform/chrome: Move mfd/cros_ec_lpc* includes to drivers/platform.Enric Balletbo i Serra5-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>
2018-08-21Merge tag 'chrome-platform-for-linus-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platformLinus Torvalds1-1/+9
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
2018-07-27Merge branches 'ib-mfd-4.19', 'ib-mfd-gpio-pinctrl-4.19', '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-mergedLee Jones5-9/+1182
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.
2018-07-13mfd: cros-ec: Increase maximum mkbp event sizeNeil Armstrong1-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>
2018-07-09Merge tag 'ib-platform-chrome-mfd-move-cros-ec-transport-for-4.19' into working-branch-for-4.19Benson Leung4-0/+1151
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.
2018-07-03platform/chrome: Move cros-ec transport drivers to drivers/platform.Enric Balletbo i Serra4-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>
2018-06-16platform/chrome: chromeos_tbmc - fix SPDX identifierBenson Leung1-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>
2018-06-11Merge tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfdLinus Torvalds1-0/+20
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 ...
2018-06-04Merge tag 'chrome-platform-for-linus-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platformLinus Torvalds8-57/+426
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
2018-05-30platform/chrome: Use to_cros_ec_dev more broadlyGwendal Grignou3-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>
2018-05-29platform/chrome: chromeos_laptop: fix touchpad button mapping on CelesDmitry Torokhov1-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>
2018-05-29mfd: cros_ec: Don't try to grab log when suspendedDouglas Anderson1-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>
2018-05-28Merge branch 'ib-chrome-platform-atmel-mxt-ts-device-properties' into working-branch-for-4.18Benson Leung1-29/+278
Signed-off-by: Benson Leung <bleung@chromium.org>
2018-05-28platform: chrome: Add input dependency for tablet switch driverArnd Bergmann1-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>
2018-05-23platform/chrome: chromeos_laptop - supply properties for ACPI devicesDmitry Torokhov1-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>
2018-05-23platform/chrome: chromeos_tbmc - add SPDX identifierBenson Leung1-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>
2018-05-23platform: chrome: Add Tablet Switch ACPI driverGwendal Grignou3-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>
2018-05-23mfd: cros_ec: Retry commands when EC is known to be busyBrian Norris1-0/+2
Commit 001dde9400d5 ("mfd: cros ec: spi: Fix "in progress" error signaling") pointed out some bad code, but its analysis and conclusion was not 100% correct. It *is* correct that we should not propagate result==EC_RES_IN_PROGRESS for transport errors, because this has a special meaning -- that we should follow up with EC_CMD_GET_COMMS_STATUS until the EC is no longer busy. This is definitely the wrong thing for many commands, because among other problems, EC_CMD_GET_COMMS_STATUS doesn't actually retrieve any RX data from the EC, so commands that expected some data back will instead start processing junk. For such commands, the right answer is to either propagate the error (and return that error to the caller) or resend the original command (*not* EC_CMD_GET_COMMS_STATUS). Unfortunately, commit 001dde9400d5 forgets a crucial point: that for some long-running operations, the EC physically cannot respond to commands any more. For example, with EC_CMD_FLASH_ERASE, the EC may be re-flashing its own code regions, so it can't respond to SPI interrupts. Instead, the EC prepares us ahead of time for being busy for a "long" time, and fills its hardware buffer with EC_SPI_PAST_END. Thus, we expect to see several "transport" errors (or, messages filled with EC_SPI_PAST_END). So we should really translate that to a retryable error (-EAGAIN) and continue sending EC_CMD_GET_COMMS_STATUS until we get a ready status. IOW, it is actually important to treat some of these "junk" values as retryable errors. Together with commit 001dde9400d5, this resolves bugs like the following: 1. EC_CMD_FLASH_ERASE now works again (with commit 001dde9400d5, we would abort the first time we saw EC_SPI_PAST_END) 2. Before commit 001dde9400d5, transport errors (e.g., EC_SPI_RX_BAD_DATA) seen in other commands (e.g., EC_CMD_RTC_GET_VALUE) used to yield junk data in the RX buffer; they will now yield -EAGAIN return values, and tools like 'hwclock' will simply fail instead of retrieving and re-programming undefined time values Fixes: 001dde9400d5 ("mfd: cros ec: spi: Fix "in progress" error signaling") Signed-off-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-05-22platform/chrome: cros_ec_lpc: do not try DMI match when ACPI device foundDmitry Torokhov1-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>
2018-04-10Merge remote-tracking branch 'origin/ib-chrome-platform-cros-ec-sysfs-debugfs-for-v4.17' into working-branch-for-4.17Benson Leung2-41/+176
Merging Enric's cros-ec sysfs and debugfs fixes from immutable branch. Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10platform/chrome: mfd/cros_ec_dev: Add sysfs entry to set keyboard wake lid angleGwendal Grignou1-0/+81
This adds a sysfs attribute (/sys/class/chromeos/cros_ec/kb_wake_angle) used to set and get the keyboard wake lid angle. This attribute is present only if 2 accelerometers are controlled by the EC. This patch also moves the cros_ec features check before the device is added so the features map obtained from the EC is ready on time. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10platform/chrome: cros_ec_debugfs: Add PD port info to debugfsShawn Nematbakhsh1-0/+72
Add info useful for debugging USB-PD port state. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10platform/chrome: cros_ec_debugfs: Use octal permissions '0444'Enric Balletbo i Serra1-2/+2
Fixed the following checkpatch warning: WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10platform/chrome: cros_ec_sysfs: use permission-specific DEVICE_ATTR variantsEnric Balletbo i Serra1-12/+12
Use DEVICE_ATTR variants for read/write attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10platform/chrome: cros_ec_sysfs: introduce to_cros_ec_dev define.Enric Balletbo i Serra1-6/+5
Add a define to get the cros_ec_dev from device and use it. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-10platform/chrome: cros_ec_sysfs: Modify error handlingGwendal Grignou1-21/+4
When accessing a sysfs attribute, if the EC command fails, -EPROTO is now returned instead of an error message as it is unlikely an app is parsing the error message to do something meaningful. Also, this patch makes use of cros_ec_cmd_xfer_status() instead of cros_ec_cmd_xfer() so an error message is printed in the syslog. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09Merge remote-tracking branch 'chrome-platform-stop-being-a-platform-driver-plus-atmel_mxt_ts-for-v4.17' into working-branch-for-4.17Benson Leung1-440/+456
2018-04-09platform/chrome: cros_ec_lpc: Add support for Google devices using custom coreboot firmwareSalvatore Bellizzi1-0/+12
This patch adds generic device information to the DMI table of the cros_ec_lpc driver, needed for Chromebooks/boxes using a custom coreboot firmware. The DMI info would not contain "Google_*" as BIOS version string, instead the system vendor string would still be "GOOGLE", so this seems to be a reasonable match for every Chromebook/box running a custom firmware. Signed-off-by: Salvatore Bellizzi <lkml@seppia.net> Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: cros_ec_lpc: wake up from s2idle on Chrome ECWenkai Du1-0/+4
Chrome platform installed a Chrome EC notify handler which prevents default EC GPE handler getting called. Add pm_system_wakeup to the Chrome EC notify handler so wake up from s2idle can happen. Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Wenkai Du <wenkai.du@intel.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - discard data for unneeded boardsDmitry Torokhov1-212/+264
Mark board data as __intconst/__initdata and make a copy of appropriate entry once we identified the board we are running on. The rest of the data will be discarded once the kernel finished booting (or module finished loading). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - use device properties for PixelDmitry Torokhov1-6/+6
Now that Atmel driver uses generic device properties we can use them instead of platform data when setting up touchpad on the original Google Pixel. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - rely on I2C to set up interrupt triggerDmitry Torokhov1-7/+14
Instead of passing interrupt flags via platform data to drivers, or hoping that drivers will do the right thing and set it up the way we need, let's set up IRQ resource and attach it to the I2C board info, and let I2C core set it up for us. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - use I2C notifier to create devicesDmitry Torokhov1-145/+102
Instead of using platform device and deferrals to handle the case when i2C adapters appear late in the game, and not handling device unbinding all that well, let's switch to using I2C bus notifier to get told when a new I2C adapter appears in the system, and attempt to add appropriate devices at that time. In case when we have 2 Designware adapters in the system (Acer C720), instead of counting and hoping they get enumerate din the right order, let's switch to using their PCI devids (slot/function) that should be stable. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - parse DMI IRQ data onceDmitry Torokhov1-56/+64
Instead of trying to parse DMI IRQ data every time we try to instantiate a device, let's do it once, when we identify the device we are working with. This allows us to mark chromeos_laptop_get_irq_from_dmi() as __init and discard it once module is initialized. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - rework i2c peripherals initializationDmitry Torokhov1-232/+235
Instead of having separate setup() functions responsible for instantiating i2c client for each peripheral, let's generalize the behavior and use common code for instantiating all i2c peripherals. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - factor out getting IRQ from DMIDmitry Torokhov1-12/+23
This will make code instantiating I2C device a bit clearer. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - introduce pr_fmt()Dmitry Torokhov1-17/+14
Define pr_fmt() to standardize driver messages. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - stop setting suspend mode for Atmel devicesDmitry Torokhov1-2/+0
Atmel touch controller driver no longer respects suspend mode specified in platform data, so let's stop setting it. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-04-09platform/chrome: chromeos_laptop - add SPDX identifierDmitry Torokhov1-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: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-03-07Revert "platform/chrome: chromeos_laptop: make chromeos_laptop const"Dmitry Torokhov1-11/+11
This reverts commit a376cd91606365609d8fbd57247618bd51da1fc6 because chromeos_laptop instances should not be marked as "const" (at this time), since i2c_peripheral is being modified (we change "state" and "tries") when we instantiate devices. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2018-02-11vfs: do bulk POLL* -> EPOLL* replacementLinus Torvalds1-1/+1
This is the mindless scripted replacement of kernel use of POLL* variables as described by Al, done by this script: for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'` for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done done with de-mangling cleanups yet to come. NOTE! On almost all architectures, the EPOLL* constants have the same values as the POLL* constants do. But they keyword here is "almost". For various bad reasons they aren't the same, and epoll() doesn't actually work quite correctly in some cases due to this on Sparc et al. The next patch from Al will sort out the final differences, and we should be all done. Scripted-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-10Merge tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platformLinus Torvalds4-19/+57
Pull chrome platform updates from Benson Leung: - move cros_ec_dev to drivers/mfd - other small maintenance fixes [ The cros_ec_dev movement came in earlier through the MFD tree - Linus ] * tag 'chrome-platform-for-linus-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bleung/chrome-platform: platform/chrome: Use proper protocol transfer function platform/chrome: cros_ec_lpc: Add support for Google Glimmer platform/chrome: cros_ec_lpc: Register the driver if ACPI entry is missing. platform/chrome: cros_ec_lpc: remove redundant pointer request cros_ec: fix nul-termination for firmware build info platform/chrome: chromeos_laptop: make chromeos_laptop const
2018-01-30Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfsLinus Torvalds1-2/+2
Pull poll annotations from Al Viro: "This introduces a __bitwise type for POLL### bitmap, and propagates the annotations through the tree. Most of that stuff is as simple as 'make ->poll() instances return __poll_t and do the same to local variables used to hold the future return value'. Some of the obvious brainos found in process are fixed (e.g. POLLIN misspelled as POLL_IN). At that point the amount of sparse warnings is low and most of them are for genuine bugs - e.g. ->poll() instance deciding to return -EINVAL instead of a bitmap. I hadn't touched those in this series - it's large enough as it is. Another problem it has caught was eventpoll() ABI mess; select.c and eventpoll.c assumed that corresponding POLL### and EPOLL### were equal. That's true for some, but not all of them - EPOLL### are arch-independent, but POLL### are not. The last commit in this series separates userland POLL### values from the (now arch-independent) kernel-side ones, converting between them in the few places where they are copied to/from userland. AFAICS, this is the least disruptive fix preserving poll(2) ABI and making epoll() work on all architectures. As it is, it's simply broken on sparc - try to give it EPOLLWRNORM and it will trigger only on what would've triggered EPOLLWRBAND on other architectures. EPOLLWRBAND and EPOLLRDHUP, OTOH, are never triggered at all on sparc. With this patch they should work consistently on all architectures" * 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (37 commits) make kernel-side POLL... arch-independent eventpoll: no need to mask the result of epi_item_poll() again eventpoll: constify struct epoll_event pointers debugging printk in sg_poll() uses %x to print POLL... bitmap annotate poll(2) guts 9p: untangle ->poll() mess ->si_band gets POLL... bitmap stored into a user-visible long field ring_buffer_poll_wait() return value used as return value of ->poll() the rest of drivers/*: annotate ->poll() instances media: annotate ->poll() instances fs: annotate ->poll() instances ipc, kernel, mm: annotate ->poll() instances net: annotate ->poll() instances apparmor: annotate ->poll() instances tomoyo: annotate ->poll() instances sound: annotate ->poll() instances acpi: annotate ->poll() instances crypto: annotate ->poll() instances block: annotate ->poll() instances x86: annotate ->poll() instances ...
2017-12-17platform/chrome: Use proper protocol transfer functionShawn Nematbakhsh1-3/+5
pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had one instance of these functions correct, but not the second, fall-back case. We use the fall-back only when the first command returns an IN_PROGRESS status, which is only used on some EC firmwares where we don't want to constantly poll the bus, but instead back off and sleep/retry for a little while. Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton") Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Benson Leung <bleung@chromium.org>
2017-12-17platform/chrome: cros_ec_lpc: Add support for Google GlimmerThierry Escande1-0/+7
This patch adds device information to the DMI table of the cros_ec_lpc driver for Google Glimmer devices. Since Google BIOS does not enumerate devices in the LPC bus, the cros_ec_lpc driver checks for system compatibility and registers the cros_ec device itself. Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org>
2017-12-17platform/chrome: cros_ec_lpc: Register the driver if ACPI entry is missing.Enric Balletbo i Serra1-1/+33
Commit 12278dc7c572 ("platform/chrome: cros_ec_lpc: Add support for GOOG004 ACPI device") added support when the firmware reports the ACPI device, there are some firmwares though that doesn't report this device but have it. In such cases we need to instantiate the driver explicitly if it is not instantiated through ACPI. Fixes: 12278dc7c572 ("platform/chrome: cros_ec_lpc: Add support for GOOG004 ACPI device") Signed-off-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Thierry Escande <thierry.escande@collabora.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org>