leds: core: Add support for poll()ing the sysfs brightness attr for changes.
Subsystems (2)
PATCH v3 1/5 leds: core: Add support for poll()ing the sysfs brightness attr for changes.
Add support for userspace using poll() for POLL_PRI on the sysfs brightness attr to watch for brightness changes.
This commit adds a led_notify_brightness_change helper function for waking up any poll() waiters; and calls this after any brightness changes (after any led_classdev->brightness_set[_blocking] calls have completed).
In some use-cases led hardware may autonomously change its brightness, e.g. the keyboard backlight used on some laptops is controlled by a hardwired (firmware handled) hotkey. led_notify_brightness_change is exported for use by drivers which can detect such autonomous changes.
This commit also updates the Documentation/ABI/testing/sysfs-class-led documentation to document that userspace may now poll on the brightness attribute.
---
Changes in v2:
-Wakeup / notify userspace on any brightness changes, not just on
autonomous changes done by the hw
Changes in v3:
-Rebase on linux-leds/for-next
--- Documentation/ABI/testing/sysfs-class-led | 8 ++++++-- drivers/leds/led-class.c | 9 +++++++++ drivers/leds/led-core.c | 16 +++++++++++++++- include/linux/leds.h | 12 ++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-)
Documentation/ABI/testing/sysfs-class-led +6 -2
@@ -1,12 +1,16 @@ What: /sys/class/leds/<led>/brightness -Date: March 2006 -KernelVersion: 2.6.17 +Date: March 2006 (poll October 2016) +KernelVersion: 2.6.17 (poll since 4.10) Contact: Richard Purdie <[email protected]> Description: Set the brightness of the LED. Most LEDs don't have hardware brightness support, so will just be turned on for non-zero brightness settings. The value is between 0 and /sys/class/leds/<led>/max_brightness. + The file supports poll() to detect brightness changes, in + some cases the hardware / firmware may change the brightness + autonomously, poll() should be woken up in this case too, + but not all drivers may support this. Writing 0 to this file clears active trigger.
drivers/leds/led-class.c +9 -0
@@ -204,6 +204,14 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev)dev_warn (parent,"Led %s renamed to %s due to name collision" , led_cdev->name,dev_name (led_cdev->dev)); + led_cdev->brightness_kn =sysfs_get_dirent (led_cdev->dev->kobj.sd, +"brightness" ); +if (!led_cdev->brightness_kn) { +dev_err (led_cdev->dev,"Error getting brightness kernfs_node\n" ); +device_unregister (led_cdev->dev); +return -ENODEV ; + } +#ifdef CONFIG_LEDS_TRIGGERS init_rwsem (&led_cdev->trigger_lock);#endif
@@ -255,6 +263,7 @@ void led_classdev_unregister(struct led_classdev *led_cdev)flush_work (&led_cdev->set_brightness_work); +sysfs_put (led_cdev->brightness_kn);device_unregister (led_cdev->dev);down_write (&leds_list_lock);
drivers/leds/led-core.c +15 -1
@@ -33,16 +33,24 @@ static int __led_set_brightness(struct led_classdev *led_cdev, led_cdev->brightness_set (led_cdev, value); +led_notify_brightness_change (led_cdev); +return 0 ; }static int __led_set_brightness_blocking (struct led_classdev *led_cdev,enum led_brightness value) { +int ret; +if (!led_cdev->brightness_set_blocking)return -ENOTSUPP ; -return led_cdev->brightness_set_blocking (led_cdev, value); + ret = led_cdev->brightness_set_blocking (led_cdev, value); +if (ret >=0 ) +led_notify_brightness_change (led_cdev); + +return ret; }static void led_timer_function (unsigned long data)
@@ -308,6 +316,12 @@ int led_update_brightness(struct led_classdev *led_cdev) }EXPORT_SYMBOL_GPL (led_update_brightness); +void led_notify_brightness_change (struct led_classdev *led_cdev) +{ +sysfs_notify_dirent (led_cdev->brightness_kn); +} +EXPORT_SYMBOL_GPL (led_notify_brightness_change); +/* Caller must ensure led_cdev->led_access held */ void led_sysfs_disable (struct led_classdev *led_cdev) {
include/linux/leds.h +12 -0
@@ -13,6 +13,7 @@#define __LINUX_LEDS_H_INCLUDED#include <linux/device.h> +#include <linux/kernfs.h> #include <linux/list.h> #include <linux/mutex.h> #include <linux/rwsem.h>
@@ -93,6 +94,8 @@ struct led_classdev {struct work_struct set_brightness_work; +struct kernfs_node *brightness_kn; +#ifdef CONFIG_LEDS_TRIGGERS /* Protects the trigger data below */ struct rw_semaphore trigger_lock;
@@ -192,6 +195,15 @@ extern int led_set_brightness_sync(struct led_classdev *led_cdev,extern int led_update_brightness (struct led_classdev *led_cdev);/** +* led_notify_brightness_change - Notify userspace of brightness changes +* @led_cdev: the LED to do the notify on +* +* Let any users waiting for POLL_PRI on the led's brightness sysfs +* atrribute know that the brightness has been changed. +*/ +extern void led_notify_brightness_change (struct led_classdev *led_cdev); + +/** * led_sysfs_disable - disable LED sysfs interface * @led_cdev: the LED to set *
Signature · 1 line
2.9.3
PATCH v3 2/5 platform: x86: thinkpad: Call led_notify_brightness_change on kbd brightness change
Make thinkpad_acpi call led_notify_brightness_change on the kbd_led led_classdev registered by thinkpad_acpi when the kbd backlight brightness changes.
---
Changes in v3:
-This is a new patch in v3 of this patch-set
--- drivers/platform/x86/thinkpad_acpi.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/platform/x86/thinkpad_acpi.c +5 -0
@@ -162,6 +162,7 @@ enum tpacpi_hkey_event_t {TP_HKEY_EV_HOTKEY_BASE =0x1001 ,/* first hotkey (FN+F1) */ TP_HKEY_EV_BRGHT_UP =0x1010 ,/* Brightness up */ TP_HKEY_EV_BRGHT_DOWN =0x1011 ,/* Brightness down */ +TP_HKEY_EV_THINKLIGHT =0x1012 ,/* Thinklight/kbd backlight */ TP_HKEY_EV_VOL_UP =0x1015 ,/* Volume up or unmute */ TP_HKEY_EV_VOL_DOWN =0x1016 ,/* Volume down or unmute */ TP_HKEY_EV_VOL_MUTE = 0x1017, /* Mixer output mute */
@@ -5167,6 +5168,8 @@ static int __init kbdlight_init(struct ibm_init_struct *iibm)return rc; } +tpacpi_hotkey_driver_mask_set (hotkey_driver_mask | +TP_ACPI_HKEY_THNKLGHT_MASK );return 0 ; }
@@ -9114,6 +9117,8 @@ static void tpacpi_driver_event(const unsigned int hkey_event)volume_alsa_notify_change (); } } +if (tp_features.kbdlight && hkey_event ==TP_HKEY_EV_THINKLIGHT ) +led_notify_brightness_change (&tpacpi_led_kbdlight.led_classdev); }static void hotkey_driver_event (const unsigned int scancode)
Signature · 1 line
2.9.3
PATCH v3 3/5 platform: x86: dell-smbios: Add a generic dell-smbios notifier chain
In reply to Hans de GoedeThere are several cases where events handled in one of the dell-* drivers need to be propagated to another dell-* driver.
This commits add 3 generic functions:dell_smbios_register_notifier()dell_smbios_unregister_notifier()dell_smbios_call_notifier()
It currently only defines 1 action:dell_smbios_kbd_backlight_brightness_changed
Which is intended to propagate kbd_backlight_brightness_changed wmi events from dell-wmi to dell-laptop (which contains the actual kbd backlight driver).
This is only somewhat dell smbios related, both dell-wmi and dell-laptop use smbios functions and I do not want to put the notifier head in either driver, as that will make the 2 drivers depend on each other.
---
Changes in v2:
-This is a new patch in v2 of this patch-set
Changes in v3:
-No changes
--- drivers/platform/x86/dell-smbios.c | 20 ++++++++++++++++++++ drivers/platform/x86/dell-smbios.h | 11 +++++++++++ 2 files changed, 31 insertions(+)
drivers/platform/x86/dell-smbios.c +20 -0
@@ -105,6 +105,26 @@ struct calling_interface_token *dell_smbios_find_token(int tokenid) }EXPORT_SYMBOL_GPL (dell_smbios_find_token); +static ATOMIC_NOTIFIER_HEAD (dell_smbios_chain_head); + +int dell_smbios_register_notifier (struct notifier_block *nb) +{ +return atomic_notifier_chain_register (&dell_smbios_chain_head, nb); +} +EXPORT_SYMBOL_GPL (dell_smbios_register_notifier); + +int dell_smbios_unregister_notifier (struct notifier_block *nb) +{ +return atomic_notifier_chain_unregister (&dell_smbios_chain_head, nb); +} +EXPORT_SYMBOL_GPL (dell_smbios_unregister_notifier); + +void dell_smbios_call_notifier (unsigned long action,void *data) +{ +atomic_notifier_call_chain (&dell_smbios_chain_head, action, data); +} +EXPORT_SYMBOL_GPL (dell_smbios_call_notifier); +static void __init parse_da_table (const struct dmi_header *dm) {/* Final token is a terminator, so we don't want to copy it */
drivers/platform/x86/dell-smbios.h +11 -0
@@ -16,6 +16,8 @@#ifndef _DELL_SMBIOS_H_#define _DELL_SMBIOS_H_ +struct notifier_block ; +/* This structure will be modified by the firmware when we enter * system management mode, hence the volatiles */
@@ -43,4 +45,13 @@ void dell_smbios_release_buffer(void);void dell_smbios_send_request (int class,int select);struct calling_interface_token *dell_smbios_find_token (int tokenid); + +enum dell_smbios_notifier_actions { + dell_smbios_kbd_backlight_brightness_changed, +}; + +int dell_smbios_register_notifier (struct notifier_block *nb); +int dell_smbios_unregister_notifier (struct notifier_block *nb); +void dell_smbios_call_notifier (unsigned long action,void *data); +#endif
Signature · 1 line
2.9.3
PATCH v3 4/5 platform: x86: dell-*: Call led_notify_brightness_change on kbd brightness change
In reply to Hans de GoedeMake dell-wmi call led_notify_brightness_change on the kbd_led led_classdev registered by dell-laptop when the kbd backlight brightness changes.
---
Changes in v2:
-Use the new dell_smbios*notify functionality
Changes in v3:
-Simplify the if condition for calling led_notify_brightness_change
--- drivers/platform/x86/dell-laptop.c | 28 +++++++++++++++++++++++++++- drivers/platform/x86/dell-wmi.c | 14 +++++++++----- 2 files changed, 36 insertions(+), 6 deletions(-)
drivers/platform/x86/dell-laptop.c +27 -1
@@ -1942,6 +1942,8 @@ static struct led_classdev kbd_led = {static int __init kbd_led_init (struct device *dev) { +int ret; +kbd_init ();if (!kbd_led_present)return -ENODEV ;
@@ -1953,7 +1955,11 @@ static int __init kbd_led_init(struct device *dev)if (kbd_led.max_brightness) kbd_led.max_brightness--; } -return led_classdev_register (dev, &kbd_led); + ret =led_classdev_register (dev, &kbd_led); +if (ret) + kbd_led_present = false; + +return ret; } static void brightness_set_exit(struct led_classdev *led_cdev,
@@ -1970,6 +1976,23 @@ static void kbd_led_exit(void)led_classdev_unregister (&kbd_led); } +static int dell_laptop_notifier_call (struct notifier_block *nb, +unsigned long action,void *data) +{ +switch (action) { +case dell_smbios_kbd_backlight_brightness_changed: +if (kbd_led_present) +led_notify_brightness_change (&kbd_led); +break ; + } + +return NOTIFY_OK ; +} + +static struct notifier_block dell_laptop_notifier = { + .notifier_call = dell_laptop_notifier_call, +}; +static int __init dell_init (void ) {struct calling_interface_buffer *buffer;
@@ -2013,6 +2036,8 @@ static int __init dell_init(void)debugfs_create_file ("rfkill" ,0444 , dell_laptop_dir,NULL , &dell_debugfs_fops); +dell_smbios_register_notifier (&dell_laptop_notifier); +if (acpi_video_get_backlight_type () != acpi_backlight_vendor)return 0 ;
@@ -2064,6 +2089,7 @@ static int __init dell_init(void) static void __exit dell_exit(void) { +dell_smbios_unregister_notifier (&dell_laptop_notifier);debugfs_remove_recursive (dell_laptop_dir);if (quirks && quirks->touchpad_led)touchpad_led_exit ();
drivers/platform/x86/dell-wmi.c +9 -5
@@ -287,11 +287,11 @@ static const struct key_entry dell_wmi_keymap_type_0011[] __initconst = { { KE_IGNORE, 0xfff1, { KEY_RESERVED } },/* Keyboard backlight level changed */ - { KE_IGNORE, 0x01e1, { KEY_RESERVED } }, - { KE_IGNORE, 0x02ea, { KEY_RESERVED } }, - { KE_IGNORE, 0x02eb, { KEY_RESERVED } }, - { KE_IGNORE, 0x02ec, { KEY_RESERVED } }, - { KE_IGNORE, 0x02f6, { KEY_RESERVED } }, + { KE_IGNORE, 0x01e1, { KEY_KBDILLUMTOGGLE } }, + { KE_IGNORE, 0x02ea, { KEY_KBDILLUMTOGGLE } }, + { KE_IGNORE, 0x02eb, { KEY_KBDILLUMTOGGLE } }, + { KE_IGNORE, 0x02ec, { KEY_KBDILLUMTOGGLE } }, + { KE_IGNORE, 0x02f6, { KEY_KBDILLUMTOGGLE } }, };static struct input_dev *dell_wmi_input_dev;
@@ -319,6 +319,10 @@ static void dell_wmi_process_key(int type, int code)if (type ==0x0000 && code ==0xe025 && !wmi_requires_smbios_request)return ; +if (key->keycode ==KEY_KBDILLUMTOGGLE ) +dell_smbios_call_notifier ( + dell_smbios_kbd_backlight_brightness_changed,NULL ); +sparse_keymap_report_entry (dell_wmi_input_dev, key,1 , true); }
Signature · 1 line
2.9.3
PATCH v3 5/5 platform: x86: dell-*: Simplify dell-rbtn integration with dell-laptop [untested]
In reply to Hans de GoedeUse dell_smbios*notifier for dell-laptop to listen to dell-rbtn slider events, replace dell_rbtn_notifier_register() / dell_rbtn_notifier_unregister() with a single dell_rbtn_has_rfkill() used by dell-laptop to decide whether or not to use the i8042 filter and used by dell-rbtn to auto-remove its rfkill interface when called.
This results in a nice cleanup, downside is that the rfkill interface of dell-rbtn is not automatically re-enabled on rmmod dell-laptop, this now requires rmmod + insmod of dell-rbtn. But people who do not want dell-laptop for some reason will have it blacklisted anyways, so this is not an issue and there is a work-around.
---
Changes in v2:
-This is a new patch in v2 of my platform/x86/dell-* notifier set intended
to show how dell_smbios*notifier can be used to improve the dell-rbtn integration too
Changes in v3:
-Call dell_rbtn_has_rfkill_func instead of dell_rbtn_has_rfkill, so that the
dynamic symbol dance we do to allow loading without dell-rbtn actually works.
--- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/dell-laptop.c | 53 +++++++------------------------- drivers/platform/x86/dell-rbtn.c | 63 +++++++++----------------------------- drivers/platform/x86/dell-rbtn.h | 5 +-- drivers/platform/x86/dell-smbios.h | 1 + 5 files changed, 29 insertions(+), 94 deletions(-)
drivers/platform/x86/Kconfig +1 -0
@@ -158,6 +158,7 @@ config DELL_RBTN depends on ACPI depends on INPUT depends on RFKILL + depends on DELL_SMBIOS ---help--- Say Y here if you want to support Dell Airplane Mode Switch ACPI device on Dell laptops. Sometimes it has names: DELLABCE or DELRBTN.
drivers/platform/x86/dell-laptop.c +11 -42
84 lines not on this page · raw message
drivers/platform/x86/dell-rbtn.c +15 -48
110 lines not on this page · raw message
drivers/platform/x86/dell-rbtn.h +1 -4
@@ -16,9 +16,6 @@#ifndef _DELL_RBTN_H_#define _DELL_RBTN_H_ -struct notifier_block ; - -int dell_rbtn_notifier_register (struct notifier_block *nb); -int dell_rbtn_notifier_unregister (struct notifier_block *nb); +int dell_rbtn_has_rfkill (void );#endif
drivers/platform/x86/dell-smbios.h +1 -0
@@ -48,6 +48,7 @@ struct calling_interface_token *dell_smbios_find_token(int tokenid);enum dell_smbios_notifier_actions { dell_smbios_kbd_backlight_brightness_changed, + dell_smbios_rbtn_slider, };int dell_smbios_register_notifier (struct notifier_block *nb);
Signature · 1 line
2.9.3
Re: [PATCH v3 2/5] platform: x86: thinkpad: Call led_notify_brightness_change on kbd brightness change
In reply to Hans de Goededrivers/platform/x86/thinkpad_acpi.c enum tpacpi_hkey_event_t { · line 165
Quoted 1 line · On Wednesday 26 October 2016 19:41:15 Hans de Goede wrote:
drivers/platform/x86/thinkpad_acpi.c +1
-0+ TP_HKEY_EV_THINKLIGHT = 0x1012, /* Thinklight/kbd backlight */
Hi! Do you have some documentation for this number? When it is send? When keyboard baklight level is changed or when thinklight is turned on/off? Or in both cases?
Signature · 2 lines
Pali Rohár [email protected]
Re: [PATCH v3 5/5] platform: x86: dell-*: Simplify dell-rbtn integration with dell-laptop [untested]
In reply to Hans de GoedeQuoted 21 lines · On Wednesday 26 October 2016 19:41:18 Hans de Goede wrote:
Use dell_smbios*notifier for dell-laptop to listen to dell-rbtn slider events, replace
dell_rbtn_notifier_register()/dell_rbtn_notifier_unregister()with a singledell_rbtn_has_rfkill()used by dell-laptop to decide whether or not to use the i8042 filter and used by dell-rbtn to auto-remove its rfkill interface when called.This results in a nice cleanup, downside is that the rfkill interface of dell-rbtn is not automatically re-enabled on rmmod dell-laptop, this now requires rmmod + insmod of dell-rbtn. But people who do not want dell-laptop for some reason will have it blacklisted anyways, so this is not an issue and there is a work-around.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2:
-This is a new patch in v2 of my platform/x86/dell-* notifier set intended
to show how dell_smbios*notifier can be used to improve the dell-rbtn integration too
Changes in v3:
-Calldell_rbtn_has_rfkill_funcinstead ofdell_rbtn_has_rfkill, so that the
dynamic symbol dance we do to allow loading without dell-rbtn actually works.
Quoted 7 lines
--- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/dell-laptop.c | 53 +++++++------------------------- drivers/platform/x86/dell-rbtn.c | 63 +++++++++----------------------------- drivers/platform/x86/dell-rbtn.h | 5 +-- drivers/platform/x86/dell-smbios.h | 1 + 5 files changed, 29 insertions(+), 94 deletions(-)
Looks like that for preventing sending event that rfkill switch was changed by hardware slider we must always drop atk i8042 keycode...
Needs to check if key is really send by both dell-rbtn and also by atk i8042 keyboard driver and if yes then i8042_install_filter() is always needed (if rbtn is there or not)...
Signature · 2 lines
Pali Rohár [email protected]
Re: [PATCH v3 5/5] platform: x86: dell-*: Simplify dell-rbtn integration with dell-laptop [untested]
Hi,
Quoted 33 lines · Pali Rohár
Quoted 21 lines · On Wednesday 26 October 2016 19:41:18 Hans de Goede wrote:
Use dell_smbios*notifier for dell-laptop to listen to dell-rbtn slider events, replace
dell_rbtn_notifier_register()/dell_rbtn_notifier_unregister()with a singledell_rbtn_has_rfkill()used by dell-laptop to decide whether or not to use the i8042 filter and used by dell-rbtn to auto-remove its rfkill interface when called.This results in a nice cleanup, downside is that the rfkill interface of dell-rbtn is not automatically re-enabled on rmmod dell-laptop, this now requires rmmod + insmod of dell-rbtn. But people who do not want dell-laptop for some reason will have it blacklisted anyways, so this is not an issue and there is a work-around.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2:
-This is a new patch in v2 of my platform/x86/dell-* notifier set intended
to show how dell_smbios*notifier can be used to improve the dell-rbtn integration too
Changes in v3:
-Calldell_rbtn_has_rfkill_funcinstead ofdell_rbtn_has_rfkill, so that the
dynamic symbol dance we do to allow loading without dell-rbtn actually works.Quoted 7 lines
--- drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/dell-laptop.c | 53 +++++++------------------------- drivers/platform/x86/dell-rbtn.c | 63 +++++++++----------------------------- drivers/platform/x86/dell-rbtn.h | 5 +-- drivers/platform/x86/dell-smbios.h | 1 + 5 files changed, 29 insertions(+), 94 deletions(-)Looks like that for preventing sending event that rfkill switch was changed by hardware slider we must always drop atk i8042 keycode...
Quoted 3 lines
Needs to check if key is really send by both dell-rbtn and also by atk i8042 keyboard driver and if yes then
i8042_install_filter()is always needed (if rbtn is there or not)...
But this is not related to this patch, right? This patch does not change any behavior. Other then your concerns about where to put the notifier, do you like the approach of this patch?
Regards,
Hans
------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
ibm-acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
Re: [PATCH v3 5/5] platform: x86: dell-*: Simplify dell-rbtn integration with dell-laptop [untested]
Quoted 36 lines · On Thursday 27 October 2016 13:46:33 Hans de Goede wrote:
Hi,
Quoted 33 lines · Pali Rohár
Quoted 22 lines · On Wednesday 26 October 2016 19:41:18 Hans de Goede wrote:
Use dell_smbios*notifier for dell-laptop to listen to dell-rbtn slider events, replace
dell_rbtn_notifier_register()/dell_rbtn_notifier_unregister()with a singledell_rbtn_has_rfkill()used by dell-laptop to decide whether or not to use the i8042 filter and used by dell-rbtn to auto-remove its rfkill interface when called.This results in a nice cleanup, downside is that the rfkill interface of dell-rbtn is not automatically re-enabled on rmmod dell-laptop, this now requires rmmod + insmod of dell-rbtn. But people who do not want dell-laptop for some reason will have it blacklisted anyways, so this is not an issue and there is a work-around.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2:
-This is a new patch in v2 of my platform/x86/dell-* notifier set intended to show how dell_smbios*notifier can be used to improve the dell-rbtn integration too
Changes in v3:
-Calldell_rbtn_has_rfkill_funcinstead ofdell_rbtn_has_rfkill, so that the dynamic symbol dance we do to allow loading without dell-rbtn actually works.
---Quoted 6 lines
drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/dell-laptop.c | 53 +++++++------------------------- drivers/platform/x86/dell-rbtn.c | 63 +++++++++----------------------------- drivers/platform/x86/dell-rbtn.h | 5 +-- drivers/platform/x86/dell-smbios.h | 1 + 5 files changed, 29 insertions(+), 94 deletions(-)Looks like that for preventing sending event that rfkill switch was changed by hardware slider we must always drop atk i8042 keycode...
Quoted 7 lines
Quoted 3 lines
Needs to check if key is really send by both dell-rbtn and also by atk i8042 keyboard driver and if yes then
i8042_install_filter()is always needed (if rbtn is there or not)...But this is not related to this patch, right? This patch does not change any behavior. Other then your concerns about where to put the notifier, do you like the approach of this patch?
It is not related, but if above is truth, then another rewrite (also of those your changes!) is needed. So maybe it would be better to postpone (or drop this patch from your patch series) so we do not invest time for something which will be again rewritten...
Signature · 2 lines
Pali Rohár [email protected]
Re: [PATCH v3 5/5] platform: x86: dell-*: Simplify dell-rbtn integration with dell-laptop [untested]
Hi,
Quoted 41 lines · Pali Rohár
Quoted 40 lines · On Thursday 27 October 2016 13:46:33 Hans de Goede wrote:
Hi,
Quoted 36 lines · Pali Rohár
Quoted 22 lines · On Wednesday 26 October 2016 19:41:18 Hans de Goede wrote:
Use dell_smbios*notifier for dell-laptop to listen to dell-rbtn slider events, replace
dell_rbtn_notifier_register()/dell_rbtn_notifier_unregister()with a singledell_rbtn_has_rfkill()used by dell-laptop to decide whether or not to use the i8042 filter and used by dell-rbtn to auto-remove its rfkill interface when called.This results in a nice cleanup, downside is that the rfkill interface of dell-rbtn is not automatically re-enabled on rmmod dell-laptop, this now requires rmmod + insmod of dell-rbtn. But people who do not want dell-laptop for some reason will have it blacklisted anyways, so this is not an issue and there is a work-around.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2:
-This is a new patch in v2 of my platform/x86/dell-* notifier set intended to show how dell_smbios*notifier can be used to improve the dell-rbtn integration too
Changes in v3:
-Calldell_rbtn_has_rfkill_funcinstead ofdell_rbtn_has_rfkill, so that the dynamic symbol dance we do to allow loading without dell-rbtn actually works.
---Quoted 6 lines
drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/dell-laptop.c | 53 +++++++------------------------- drivers/platform/x86/dell-rbtn.c | 63 +++++++++----------------------------- drivers/platform/x86/dell-rbtn.h | 5 +-- drivers/platform/x86/dell-smbios.h | 1 + 5 files changed, 29 insertions(+), 94 deletions(-)Looks like that for preventing sending event that rfkill switch was changed by hardware slider we must always drop atk i8042 keycode...
Needs to check if key is really send by both dell-rbtn and also by atk i8042 keyboard driver and if yes then
i8042_install_filter()is always needed (if rbtn is there or not)...
Quoted 8 lines
Quoted 3 lines
But this is not related to this patch, right? This patch does not change any behavior. Other then your concerns about where to put the notifier, do you like the approach of this patch?
It is not related, but if above is truth, then another rewrite (also of those your changes!) is needed. So maybe it would be better to postpone (or drop this patch from your patch series) so we do not invest time for something which will be again rewritten...
Ok, I'm fine with delaying this cleanup till your questions are answered.
Maybe we should then also move ahead with the notifier in dell-smbios, because without this patch it is only used by dell-wmi and dell-laptop both of which already depend on dell-smbios.
Regards,
Hans
------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
ibm-acpi-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
Re: [PATCH v3 5/5] platform: x86: dell-*: Simplify dell-rbtn integration with dell-laptop [untested]
Quoted 53 lines · Hans de Goede
Hi,
Quoted 41 lines · Pali Rohár
Quoted 40 lines · On Thursday 27 October 2016 13:46:33 Hans de Goede wrote:
Hi,
Quoted 36 lines · Pali Rohár
Quoted 22 lines · On Wednesday 26 October 2016 19:41:18 Hans de Goede wrote:
Use dell_smbios*notifier for dell-laptop to listen to dell-rbtn slider events, replace
dell_rbtn_notifier_register()/dell_rbtn_notifier_unregister()with a singledell_rbtn_has_rfkill()used by dell-laptop to decide whether or not to use the i8042 filter and used by dell-rbtn to auto-remove its rfkill interface when called.This results in a nice cleanup, downside is that the rfkill interface of dell-rbtn is not automatically re-enabled on rmmod dell-laptop, this now requires rmmod + insmod of dell-rbtn. But people who do not want dell-laptop for some reason will have it blacklisted anyways, so this is not an issue and there is a work-around.
Signed-off-by Hans de Goede <[email protected]>---
Changes in v2:
-This is a new patch in v2 of my platform/x86/dell-* notifier set intended to show how dell_smbios*notifier can be used to improve the dell-rbtn integration too
Changes in v3:
-Calldell_rbtn_has_rfkill_funcinstead ofdell_rbtn_has_rfkill, so that the dynamic symbol dance we do to allow loading without dell-rbtn actually works.
---Quoted 6 lines
drivers/platform/x86/Kconfig | 1 + drivers/platform/x86/dell-laptop.c | 53 +++++++------------------------- drivers/platform/x86/dell-rbtn.c | 63 +++++++++----------------------------- drivers/platform/x86/dell-rbtn.h | 5 +-- drivers/platform/x86/dell-smbios.h | 1 + 5 files changed, 29 insertions(+), 94 deletions(-)Looks like that for preventing sending event that rfkill switch was changed by hardware slider we must always drop atk i8042 keycode...
Needs to check if key is really send by both dell-rbtn and also by atk i8042 keyboard driver and if yes then
i8042_install_filter()is always needed (if rbtn is there or not)...Quoted 8 lines
Quoted 3 lines
But this is not related to this patch, right? This patch does not change any behavior. Other then your concerns about where to put the notifier, do you like the approach of this patch?
It is not related, but if above is truth, then another rewrite (also of those your changes!) is needed. So maybe it would be better to postpone (or drop this patch from your patch series) so we do not invest time for something which will be again rewritten...
Quoted 5 lines
Ok, I'm fine with delaying this cleanup till your questions are answered.
Maybe we should then also move ahead with the notifier in dell-smbios, because without this patch it is only used by dell-wmi and dell-laptop both of which already depend on dell-smbios.
This one has been at the bottom of my queue for a while, but as far as I know we haven't moved forward with the testing and/or clarification we needed. I'm dropping for now (from the patchwork list), but please feel free to resurrect if I've missed something, or new information is available.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center