summaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/toshiba_acpi.c
Commit message (Collapse)AuthorAgeFilesLines
* platform/x86: toshiba: constify pointers to hwmon_channel_infoKrzysztof Kozlowski2023-05-161-1/+1
| | | | | | | | | | Statically allocated array of pointers to hwmon_channel_info can be made const for safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230511175627.282246-4-krzysztof.kozlowski@linaro.org Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Merge tag 'acpi-6.2-rc1' of ↵Linus Torvalds2022-12-121-3/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull ACPI and PNP updates from Rafael Wysocki: "These include new code (for instance, support for the FFH address space type and support for new firmware data structures in ACPICA), some new quirks (mostly related to backlight handling and I2C enumeration), a number of fixes and a fair amount of cleanups all over. Specifics: - Update the ACPICA code in the kernel to the 20221020 upstream version and fix a couple of issues in it: - Make acpi_ex_load_op() match upstream implementation (Rafael Wysocki) - Add support for loong_arch-specific APICs in MADT (Huacai Chen) - Add support for fixed PCIe wake event (Huacai Chen) - Add EBDA pointer sanity checks (Vit Kabele) - Avoid accessing VGA memory when EBDA < 1KiB (Vit Kabele) - Add CCEL table support to both compiler/disassembler (Kuppuswamy Sathyanarayanan) - Add a couple of new UUIDs to the known UUID list (Bob Moore) - Add support for FFH Opregion special context data (Sudeep Holla) - Improve warning message for "invalid ACPI name" (Bob Moore) - Add support for CXL 3.0 structures (CXIMS & RDPAS) in the CEDT table (Alison Schofield) - Prepare IORT support for revision E.e (Robin Murphy) - Finish support for the CDAT table (Bob Moore) - Fix error code path in acpi_ds_call_control_method() (Rafael Wysocki) - Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() (Li Zetao) - Update the version of the ACPICA code in the kernel (Bob Moore) - Use ZERO_PAGE(0) instead of empty_zero_page in the ACPI device enumeration code (Giulio Benetti) - Change the return type of the ACPI driver remove callback to void and update its users accordingly (Dawei Li) - Add general support for FFH address space type and implement the low- level part of it for ARM64 (Sudeep Holla) - Fix stale comments in the ACPI tables parsing code and make it print more messages related to MADT (Hanjun Guo, Huacai Chen) - Replace invocations of generic library functions with more kernel- specific counterparts in the ACPI sysfs interface (Christophe JAILLET, Xu Panda) - Print full name paths of ACPI power resource objects during enumeration (Kane Chen) - Eliminate a compiler warning regarding a missing function prototype in the ACPI power management code (Sudeep Holla) - Fix and clean up the ACPI processor driver (Rafael Wysocki, Li Zhong, Colin Ian King, Sudeep Holla) - Add quirk for the HP Pavilion Gaming 15-cx0041ur to the ACPI EC driver (Mia Kanashi) - Add some mew ACPI backlight handling quirks and update some existing ones (Hans de Goede) - Make the ACPI backlight driver prefer the native backlight control over vendor backlight control when possible (Hans de Goede) - Drop unsetting ACPI APEI driver data on remove (Uwe Kleine-König) - Use xchg_release() instead of cmpxchg() for updating new GHES cache slots (Ard Biesheuvel) - Clean up the ACPI APEI code (Sudeep Holla, Christophe JAILLET, Jay Lu) - Add new I2C device enumeration quirks for Medion Lifetab S10346 and Lenovo Yoga Tab 3 Pro (YT3-X90F) (Hans de Goede) - Make the ACPI battery driver notify user space about adding new battery hooks and removing the existing ones (Armin Wolf) - Modify the pfr_update and pfr_telemetry drivers to use ACPI_FREE() for freeing acpi_object structures to help diagnostics (Wang ShaoBo) - Make the ACPI fan driver use sysfs_emit_at() in its sysfs interface code (ye xingchen) - Fix the _FIF package extraction failure handling in the ACPI fan driver (Hanjun Guo) - Fix the PCC mailbox handling error code path (Huisong Li) - Avoid using PCC Opregions if there is no platform interrupt allocated for this purpose (Huisong Li) - Use sysfs_emit() instead of scnprintf() in the ACPI PAD driver and CPPC library (ye xingchen) - Fix some kernel-doc issues in the ACPI GSI processing code (Xiongfeng Wang) - Fix name memory leak in pnp_alloc_dev() (Yang Yingliang) - Do not disable PNP devices on suspend when they cannot be re-enabled on resume (Hans de Goede) - Clean up the ACPI thermal driver a bit (Rafael Wysocki)" * tag 'acpi-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (67 commits) ACPI: x86: Add skip i2c clients quirk for Medion Lifetab S10346 ACPI: APEI: EINJ: Refactor available_error_type_show() ACPI: APEI: EINJ: Fix formatting errors ACPI: processor: perflib: Adjust acpi_processor_notify_smm() return value ACPI: processor: perflib: Rearrange acpi_processor_notify_smm() ACPI: processor: perflib: Rearrange unregistration routine ACPI: processor: perflib: Drop redundant parentheses ACPI: processor: perflib: Adjust white space ACPI: processor: idle: Drop unnecessary statements and parens ACPI: thermal: Adjust critical.flags.valid check ACPI: fan: Convert to use sysfs_emit_at() API ACPICA: Fix use-after-free in acpi_ut_copy_ipackage_to_ipackage() ACPI: battery: Call power_supply_changed() when adding hooks ACPI: use sysfs_emit() instead of scnprintf() ACPI: x86: Add skip i2c clients quirk for Lenovo Yoga Tab 3 Pro (YT3-X90F) ACPI: APEI: Remove a useless include PNP: Do not disable devices on suspend when they cannot be re-enabled on resume ACPI: processor: Silence missing prototype warnings ACPI: processor_idle: Silence missing prototype warnings ACPI: PM: Silence missing prototype warning ...
| * ACPI: make remove callback of ACPI driver voidDawei Li2022-11-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For bus-based driver, device removal is implemented as: 1 device_remove()-> 2 bus->remove()-> 3 driver->remove() Driver core needs no inform from callee(bus driver) about the result of remove callback. In that case, commit fc7a6209d571 ("bus: Make remove callback return void") forces bus_type::remove be void-returned. Now we have the situation that both 1 & 2 of calling chain are void-returned, so it does not make much sense for 3(driver->remove) to return non-void to its caller. So the basic idea behind this change is making remove() callback of any bus-based driver to be void-returned. This change, for itself, is for device drivers based on acpi-bus. Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Lee Jones <lee@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dawei Li <set_pte_at@outlook.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for drivers/platform/surface/* Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | ACPI: battery: Pass battery hook pointer to hook callbacksArmin Wolf2022-11-161-2/+2
|/ | | | | | | | | | | | | | | | | Right now, is impossible for battery hook callbacks to access instance-specific data, forcing most drivers to provide some sort of global state. This however is difficult for drivers which can be instantiated multiple times and/or are hotplug-capable. Pass a pointer to the battery hook to those callbacks for usage with container_of(). Signed-off-by: Armin Wolf <W_Armin@gmx.de> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://lore.kernel.org/r/20220927204521.601887-2-W_Armin@gmx.de Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: change turn_on_panel_on_resume to staticYang Yingliang2022-09-221-1/+1
| | | | | | | | | | | turn_on_panel_on_resume is only used in toshiba_acpi.c now, change it to static. Fixes: 3cb1f40dfdc3 ("drivers/platform: toshiba_acpi: Call HCI_PANEL_POWER_ON on resume on some models") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20220920084434.3739493-1-yangyingliang@huawei.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: Remove duplicate includeYihao Han2022-09-191-1/+0
| | | | | | | | | Remove duplicate include in toshiba_acpi.c. Signed-off-by: Yihao Han <hanyihao@vivo.com> Link: https://lore.kernel.org/r/20220919111519.19491-1-hanyihao@vivo.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: Set correct parent for input device.Arvid Norlander2022-09-191-0/+1
| | | | | | | | | This solves the input device showing up as a virtual device. Signed-off-by: Arvid Norlander <lkml@vorpal.se> Link: https://lore.kernel.org/r/20220911193106.555938-1-lkml@vorpal.se Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* drivers/platform: toshiba_acpi: Call HCI_PANEL_POWER_ON on resume on some modelsHans de Goede2022-09-091-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some Toshibas have a broken acpi-video interface for brightness control, so far these have been using a special workaround in drivers/acpi/acpi_video.c which gets activated by the disable_backlight_sysfs_if module-param/quirks. The recent x86/acpi backlight refactoring has broken this workaround: 1. This workaround relies on acpi_video_get_backlight_type() returning acpi_video so that the acpi_video code actually runs; and 2. this relies on the actual native GPU driver to offer the sysfs backlight interface to userspace. After the refactor this breaks since the native driver will no longer register its backlight-device if acpi_video_get_backlight_type() does not return native and making it return native breaks 1. Keeping the acpi_video backlight handling on resume active, while not using it to set the brightness, is necessary because it does a _BCM call on resume which is necessary to turn the panel back on on resume. Looking at the DSDT shows that this _BCM call results in a Toshiba HCI_SET HCI_LCD_BRIGHTNESS call, which turns the panel back on. This commit makes toshiba_acpi do a HCI_SET HCI_PANEL_POWER_ON call on resume on the affected models, so that the (now broken) acpi_video disable_backlight_sysfs_if workaround will no longer be necessary. Note this uses HCI_PANEL_POWER_ON instead of HCI_LCD_BRIGHTNESS to avoid changing the configured brightness level. Tested-by: Arvid Norlander <lkml@vorpal.se> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: Battery charge mode in toshiba_acpi (sysfs)Arvid Norlander2022-09-091-0/+96
| | | | | | | | | | | | | | | | | | | | | This commit adds the ACPI battery hook which in turns adds the sysfs entries. Because the Toshiba laptops only support two modes (eco or normal), which in testing correspond to 80% and 100% we simply round to the nearest possible level when set. It is possible that Toshiba laptops other than the Z830 has different set points for the charging. If so, a quirk table could be introduced in the future for this. For now, assume that all laptops that support this feature work the same way. Tested on a Toshiba Satellite Z830. Signed-off-by: Arvid Norlander <lkml@vorpal.se> Link: https://lore.kernel.org/r/20220902180037.1728546-3-lkml@vorpal.se Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: Battery charge mode in toshiba_acpi (internals)Arvid Norlander2022-09-091-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the internal functions to control the Toshiba laptop. Unlike for example ThinkPads where this control is granular here it is just off/on. When off it charges to 100%. When on it charges to about 80%. Controlling this setting is done via HCI register 0x00ba. Setting to value 1 will result in limiting the charing to 80% of the battery capacity, while setting it to 0 will allow charging to 100%. Reading the current state is a bit weird, and needs a 1 set in the last position of the query for whatever reason. In addition, the read may return 0x8d20 (Data not available) rarely, so a retry mechanism is needed. According to the Windows program used to control the feature the setting will not take effect until the battery has been discharged to around 50%. However, in my testing it takes effect as soon as the charge drops below 80%. On Windows Toshiba branded this feature as "Eco charging". Signed-off-by: Arvid Norlander <lkml@vorpal.se> Link: https://lore.kernel.org/r/20220902180037.1728546-2-lkml@vorpal.se Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: Add fan RPM reading (hwmon interface)Arvid Norlander2022-09-091-0/+69
| | | | | | | | | | | | | | | | | This expands on the previous commit, exporting the fan RPM via hwmon. This will look something like the following when using the "sensors" command from lm_sensors: toshiba_acpi_sensors-acpi-0 Adapter: ACPI interface fan1: 0 RPM Signed-off-by: Arvid Norlander <lkml@vorpal.se> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220902174018.1720029-3-lkml@vorpal.se Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: Add fan RPM reading (internals)Arvid Norlander2022-09-091-0/+30
| | | | | | | | | | | | | | | | | This add the internal feature detection and reading function for fan RPM. The approach is based on tracing ACPI calls using AMLI (a tracer/debugger built into ACPI.sys) while using the Windows cooling self-test software. The call used is {HCI_GET, 0x45, 0, 1, 0, 0} which returns: {0x0, 0x45, fan_rpm, probably_max_rpm, 0x0, 0x0} What is probably the max RPM is not currently used. Signed-off-by: Arvid Norlander <lkml@vorpal.se> Link: https://lore.kernel.org/r/20220902174018.1720029-2-lkml@vorpal.se Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Merge tag 'backlight-detect-refactor-1' into review-hansHans de Goede2022-09-051-16/+0
|\ | | | | | | | | | | | | | | Immutable backlight-detect-refactor branch between acpi, drm-* and pdx86 Tag (immutable branch) with v6.0-rc1 + the (acpi/x86) backlight detect refactor work. For merging into the acpi, drm-* and pdx86 subsystems.
| * platform/x86: toshiba_acpi: Stop using acpi_video_set_dmi_backlight_type()Hans de Goede2022-09-031-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | acpi_video_set_dmi_backlight_type() is troublesome because it may end up getting called after other backlight drivers have already called acpi_video_get_backlight_type() resulting in the other drivers already being registered even though they should not. In case of the acpi_video backlight, acpi_video_set_dmi_backlight_type() actually calls acpi_video_unregister_backlight() since that is often probed earlier, leading to userspace seeing the acpi_video0 class device being briefly available, leading to races in userspace where udev probe-rules try to access the device and it is already gone. In case of toshiba_acpi there are no DMI quirks to move to acpi/video_detect.c, but it also (ab)uses it for transflective displays. Adding transflective display support to video_detect.c would be quite involved. But luckily there are only 2 known models with a transflective display, so we can just add DMI quirks for those. Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* | platform/x86: toshiba_acpi: Fix ECO LED control on Toshiba Z830Arvid Norlander2022-08-261-1/+4
|/ | | | | | | | | | | The toshiba_acpi driver checks for TOS_INPUT_DATA_ERROR and tries a different format. On the Z830 the error returned is TOS_NOT_SUPPORTED though the different format still works. Allow either error. Signed-off-by: Arvid Norlander <lkml@vorpal.se> Link: https://lore.kernel.org/r/20220821200821.1837460-2-lkml@vorpal.se Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: use kobj_to_dev()Minghao Chi2022-05-121-1/+1
| | | | | | | | | Use kobj_to_dev() instead of open-coding it. Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220511021638.1488650-1-chi.minghao@zte.com.cn Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* proc: remove PDE_DATA() completelyMuchun Song2022-01-221-8/+8
| | | | | | | | | | | | | | | Remove PDE_DATA() completely and replace it with pde_data(). [akpm@linux-foundation.org: fix naming clash in drivers/nubus/proc.c] [akpm@linux-foundation.org: now fix it properly] Link: https://lkml.kernel.org/r/20211124081956.87711-2-songmuchun@bytedance.com Signed-off-by: Muchun Song <songmuchun@bytedance.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Alexey Gladkov <gladkov.alexey@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* platform/x86: toshiba_acpi: Fix missing error code in ↵Jiapeng Chong2021-06-161-0/+1
| | | | | | | | | | | | | | | | | toshiba_acpi_setup_keyboard() The error code is missing in this code scenario, add the error code '-EINVAL' to the return value 'error'. Eliminate the follow smatch warning: drivers/platform/x86/toshiba_acpi.c:2834 toshiba_acpi_setup_keyboard() warn: missing error code 'error'. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/1622628348-87035-1-git-send-email-jiapeng.chong@linux.alibaba.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* platform/x86: toshiba_acpi: Fix the wrong variable assignmentKaixu Xia2020-11-261-2/+1
| | | | | | | | | | | | | | The commit 78429e55e4057 ("platform/x86: toshiba_acpi: Clean up variable declaration") cleans up variable declaration in video_proc_write(). Seems it does the variable assignment in the wrong place, this results in dead code and changes the source code logic. Fix it by doing the assignment at the beginning of the funciton. Fixes: 78429e55e4057 ("platform/x86: toshiba_acpi: Clean up variable declaration") Reported-by: Tosk Robot <tencent_os_robot@tencent.com> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com> Link: https://lore.kernel.org/r/1606024177-16481-1-git-send-email-kaixuxia@tencent.com Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva2020-08-231-1/+1
| | | | | | | | | | Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
* iio: core: pass parent device as parameter during allocationAlexandru Ardelean2020-06-141-2/+1
| | | | | | | | | | | | | | | | | | | | The change passes the parent device to the iio_device_alloc() call. This also updates the devm_iio_device_alloc() call to consider the device object as the parent device by default. Having it passed like this, should ensure that any IIO device object already has a device object as parent, allowing for neater control, like passing the 'indio_dev' object for other stuff [like buffers/triggers/etc], and potentially creating iiom_xxx(indio_dev) functions. With this patch, only the 'drivers/platform/x86/toshiba_acpi.c' needs an update to pass the parent object as a parameter. In the next patch all devm_iio_device_alloc() calls will be handled. Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* platform/x86: toshiba_acpi: Drop duplicate check for led_classdev_unregister()Andy Shevchenko2020-05-071-20/+6
| | | | | | | led_classdev_unregister() already has the similar check, so, drop a duplicate in the driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* proc: convert everything to "struct proc_ops"Alexey Dobriyan2020-02-041-32/+28
| | | | | | | | | | | | | | | | | | | | | | | The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in seq_file.h. Conversion rule is: llseek => proc_lseek unlocked_ioctl => proc_ioctl xxx => proc_xxx delete ".owner = THIS_MODULE" line [akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c] [sfr@canb.auug.org.au: fix kernel/sched/psi.c] Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2 Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 7Thomas Gleixner2019-05-211-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details the full gnu general public license is included in this distribution in the file called copying extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 9 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Steve Winslow <swinslow@gmail.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Jilayne Lovejoy <opensource@jilayne.com> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190519154041.244154651@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* platform/x86: toshiba_acpi: Fix defined but not used build warningsRandy Dunlap2018-07-211-1/+2
| | | | | | | | | | | | | Fix a build warning in toshiba_acpi.c when CONFIG_PROC_FS is not enabled by marking the unused function as __maybe_unused. ../drivers/platform/x86/toshiba_acpi.c:1685:12: warning: 'version_proc_show' defined but not used [-Wunused-function] Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Azael Avalos <coproscefalo@gmail.com> Cc: platform-driver-x86@vger.kernel.org Cc: Andy Shevchenko <andy@infradead.org> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: toshiba_acpi: Update KBD backlight LED on second gen laptopsAzael Avalos2018-06-261-8/+22
| | | | | | | | | | | | | | | | | | | | Second generation keyboard backlight (type 2) laptops can switch on the keyboard LED on their own via hardware/firmware, but the LED subsystem is unaware of such change since the LED interface was only being created on first generation keyboard backlight (type 1) laptops. This patch creates the LED interface for second gen keyboards and calls the *_hw_changed API whenever userspace changes the state of the keyboard backlight LED. While we are at it, remove an unneeded asignment to the acpi_dev struct under *_kbd_bl_work, and also update the kbd_event_generated variable in the main toshiba struct instead of the global struct. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> [dvhart: correct int* and int compare with dev->kbd_mode] Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* proc: introduce proc_create_single{,_data}Christoph Hellwig2018-05-161-15/+2
| | | | | | | | | Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by: Christoph Hellwig <hch@lst.de>
* platform/x86: toshiba_acpi: drop assignment of iio_info.driver_moduleJonathan Cameron2017-08-221-1/+0
| | | | | | | | | | | This is now handled by use of a macro for device registration. The field in iio_info will be going away shortly as it is no longer used. Cc: <platform-driver-x86@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Azael Avalos <coproscefalo@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
* platform/x86: toshiba_acpi: constify attribute_group structures.Arvind Yadav2017-07-111-1/+1
| | | | | | | | | | | | | | | | | attribute_groups are not supposed to change at runtime. All functions working with attribute_groups provided by <linux/sysfs.h> work with const attribute_group. So mark the non-const structs as const. File size before: text data bss dec hex filename 26360 1072 24 27456 6b40 drivers/platform/x86/toshiba_acpi.o File size After adding 'const': text data bss dec hex filename 26424 1008 24 27456 6b40 drivers/platform/x86/toshiba_acpi.o Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
* platform/x86: toshiba_acpi: use memdup_user_nulGeliang Tang2017-05-151-8/+3
| | | | | | | | Use memdup_user_nul() helper instead of open-coding to simplify the code. Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: toshiba_acpi: remove sparse_keymap_free() callsMichał Kępień2017-03-141-6/+2
| | | | | | | | | As sparse_keymap_setup() now uses a managed memory allocation for the keymap copy it creates, the latter is freed automatically. Remove all calls to sparse_keymap_free(). Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* platform/x86: toshiba_acpi: Fix typo in *_cooling_method_set functionAzael Avalos2016-08-311-1/+1
| | | | | | | | This patch simply fixes a typo in the error string printed in the *_cooling_method_set function. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* platform/x86: toshiba_acpi: Change error checking logic from TCI functionsAzael Avalos2016-08-311-88/+138
| | | | | | | | | | | | | | | Currently the success/error checking logic is intermixed, making the code a bit cumbersome to understand. This patch changes the affected functions to first check for errors and take appropriate actions, then check for the supported features. This patch also separates the error check from the acpi_status and the tci_raw function call error check, as those two are completely unrelated and were nested in if/else statements. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* platform/x86: toshiba_acpi: Clean up variable declarationAzael Avalos2016-08-311-16/+13
| | | | | | | | | | | | This patch moves all the multiple line variable declaration to a single line declaration (except variables being initialized) following the reverse tree order, to conform to the practices of the kernel. [dvhart: corrected a couple minor inconsistencies in declaration ordering] Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Bump driver version and update copyright yearAzael Avalos2016-06-281-2/+2
| | | | | | | | | | | After several fixes, and added support for more features (WWAN, Cooling Method and IIO accelometer axis data), bump the driver version to 0.24. Also update the copyright year. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Remove the position sysfs entryAzael Avalos2016-06-281-25/+0
| | | | | | | | | | Now that we have proper support for the acceleromeer under the IIO subsystem, the _position_ sysfs file is now deprecated. This patch removes all code related to the position sysfs entry. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add IIO interface for accelerometer axis dataAzael Avalos2016-06-281-0/+107
| | | | | | | | | | | | This patch adds the accelerometer axis data to the IIO subsystem. Currently reporting the X, Y and Z values, as no other data can be queried given the fact that the accelerometer chip itself is hidden behind the Toshiba proprietary interface. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Fix regression caused by hotkey enabling valueAzael Avalos2016-04-251-1/+1
| | | | | | | | | | | | | | | | | | Commit 52cbae0127ad ("toshiba_acpi: Change default Hotkey enabling value") changed the hotkeys enabling value, as it was the same value Windows uses, however, it turns out that the value tells the EC that the driver will now take care of the hardware events like the physical RFKill switch or the pointing device toggle button. This patch reverts such commit by changing the default hotkey enabling value to 0x09, which enables hotkey events only, making the hardware buttons working again. Fixes bugs 113331 and 114941. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add a module parameter to disable hotkeys registrationAzael Avalos2016-03-231-0/+10
| | | | | | | | | | | | | | Some laptop models have working hotkeys without the need of the driver to activate them. This patch adds a module parameter to tell the driver not to register the hotkeys. The new parameter is useful in DE less installations or where the DE does not handle the hotkeys (see bug 99501). Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add sysfs entries for the Cooling Method featureAzael Avalos2016-03-231-0/+51
| | | | | | | This patch adds the sysfs entry Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add support for cooling method featureAzael Avalos2016-03-231-0/+54
| | | | | | | | | | | | | | | This patch adds support to query and set the "Cooling Method" feature, which basically changes how the system fan behaves, depending on the supported cooling methods. Depending on the laptop model, these are the (so far...) available cooling methods: - Maximum Performance - Performance - Battery Optimized Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Fix keyboard backlight sysfs entries not being updatedAzael Avalos2016-01-191-4/+43
| | | | | | | | | | | | | | | | | | | | Certain Toshiba models with the second generation keyboard backlight (type 2) do not generate the keyboard backlight changed event (0x92), and thus, the sysfs entries are never being updated. This patch adds a workquee and a global boolean variable to address the issue. For those models that do generate the event, the sysfs entries are being updated via the *notify function and the boolean is set to true to avoid a second call to update the entries. For those models that do not generate the event, the workquee is used to update the sysfs entries and also to emulate the event via netlink, to make userspace aware of such change. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add WWAN RFKill supportAzael Avalos2015-11-231-3/+76
| | | | | | | | | | | | | A previuos patch added WWAN support to the driver, allowing to query and set the device status. This patch adds RFKill support for the recently introduced WWAN device, making use of the WWAN and *wireless_status functions to query the killswitch and (de)activate the device accordingly to its status. Signed-off-by: Fabian Koester <fabian.koester@bringnow.com> Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add support for WWAN devicesAzael Avalos2015-11-231-0/+109
| | | | | | | | | | | | | | | Toshiba laptops with WWAN devices installed cannot use the device unless it is attached and powered, similar to how Toshiba Bluetooth devices work. This patch adds support to WWAN devices, introducing three functions, one to query the overall status of the wireless devices (RFKill, WLAN, BT, WWAN), the second queries WWAN support, and finally the third (de)activates the device. Signed-off-by: Fabian Koester <fabian.koester@bringnow.com> Signed-off-by: Azael Avalos <coproscefalo@gmail.com>ZZ Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Fix blank screen at boot if transflective backlight is supportedAzael Avalos2015-11-201-0/+8
| | | | | | | | | | | | | | If transflective backlight is supported and the brightness is zero (lowest brightness level), the set_lcd_brightness function will activate the transflective backlight, making the LCD appear to be turned off. This patch fixes the issue by incrementing the brightness level, and by doing so, avoiding the activation of the tranflective backlight. Cc: <stable@vger.kernel.org> # 4.3+ Reported-and-tested-by: Fabian Koester <fabian.koester@bringnow.com> Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Propagate the hotkey value via genetlinkAzael Avalos2015-11-201-1/+2
| | | | | | | | | | | | The driver uses genetlink to inform userspace of events generated by the system, but the data passed is always zero as there is no data to pass, except for the hotkey event. This patch propagates the hotkey value via genetlink so userspace can make use of it. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Initialize hotkey_event_type variableAzael Avalos2015-11-051-0/+1
| | | | | | | | | | | | | | Commit 53147b6cabee5e8d1997b5682fcc0c3b72ddf9c2 ("toshiba_acpi: Fix hotkeys registration on some toshiba models") fixed an issue on some laptops regarding hotkeys registration, however, if failed to address the initialization of the hotkey_event_type variable, and thus, it can lead to potential unwanted effects as the variable is being checked. This patch initializes such variable to avoid such unwanted effects. Cc: <stable@vger.kernel.org> # 4.1+ Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Remove unneeded u32 variables from *setup_keyboardAzael Avalos2015-10-031-13/+7
| | | | | | | | | | | | | The function toshiba_acpi_setup_keyboard currently has two u32 variables used to store the Hotkey Event Type and the result of the HCI_SYSTEM_EVENT query. This patch removes those two variables, as we already have a global variable named "hotkey_event_type" and the result of the HCI_SYSTEM_EVENT query can be checked directly from the function. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Add 0x prefix to available_kbd_modes_show functionAzael Avalos2015-10-031-2/+2
| | | | | | | | | | | | This patch adds the 0x prefix to the values printed by such function, the values are already being printed in hex, but without the prefix, causing confusion, even though the file under Documentation/ABI clearly states that hey are hex values. Simply add the 0x prefix to avoid such confusion. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
* toshiba_acpi: Change default Hotkey enabling valueAzael Avalos2015-10-031-1/+1
| | | | | | | | | | | | | | | | | The driver currently uses the hotkey enabling value of 0x09 to enable hotkey events, but windows uses a different value (0x01). All Toshiba laptops accept the following "hotkey" parameters: 0x01 - Enable hotkey and system events. 0x03 - Enable system events only. 0x09 - Enable hotkey events only. 0x0b - Disable (hotkey and system) events. This patch changes the default hotkey enabling value from 0x09 to 0x01, enabling both the hotkey and system events. Signed-off-by: Azael Avalos <coproscefalo@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>