* [PATCH v3 0/7] Move dell-led to drivers/platform/x86
@ 2017-02-17 7:57 Michał Kępień
2017-02-17 7:57 ` [PATCH v3 1/7] dell-led: remove GUID check from dell_micmute_led_set() Michał Kępień
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: Alex Hung, linux-leds, platform-driver-x86, alsa-devel,
linux-kernel
This patch series moves the dell-led driver from the LED subsystem to
the x86 platform driver subsystem.
The original motivation behind this effort was to move all code using
the dell-smbios module to the x86 platform driver subsystem. While I
was investigating the possibilities to do that, it quickly emerged that
dell-led can and in fact should be moved to the x86 platform driver
subsystem in its entirety.
dell-led consists of two major parts:
- the part exposing a microphone mute LED interface, introduced in
db6d8cc00773 ("dell-led: add mic mute led interface"); this
interface is used by sound/pci/hda/dell_wmi_helper.c; while the
original implementation used a WMI interface, it was changed to use
dell-smbios in cf0d7ea33596 ("dell-led: use dell_smbios_find_token()
for finding mic DMI tokens") and 0c41a08e131d ("dell-led: use
dell_smbios_send_request() for performing SMBIOS calls"),
- the part handling an activity LED present in Dell Latitude 2100
netbooks, introduced in 72dcd8d08aca ("leds: Add Dell Business Class
Netbook LED driver"); it binds to a specific WMI GUID and then
registers a LED device which is controlled using WMI (i.e. it is
essentially a WMI driver).
Patches 1 and 2 clean up the microphone mute LED interface to minimize
the amount of code moved around.
Patch 3 updates a variable name in sound/pci/hda/dell_wmi_helper.c so
that it better matches that variable's role.
Patch 4 moves the microphone mute LED interface to
drivers/platform/x86/dell-laptop.c, effectively causing
sound/pci/hda/dell_wmi_helper.c to depend on CONFIG_DELL_LAPTOP instead
of CONFIG_LEDS_DELL_NETBOOKS.
Patch 5 reverts dell-led to the state it was in after its initial commit
72dcd8d08aca ("leds: Add Dell Business Class Netbook LED driver") by
removing all remnants of the microphone mute LED handling code.
Patch 6 moves all that is left of dell-led (i.e. the activity LED part,
as originally implemented), to a new module which is placed in
drivers/platform/x86/dell-wmi-led.c.
Patch 7 fixes coding style issues in drivers/platform/x86/dell-wmi-led.c
to make sure it gets a clean start in the x86 platform driver subsystem.
As all patches except patch 3 in this series affect the LED subsystem,
the series is based on linux-leds/for-next.
Changes from v2:
- Add patch 7 fixing coding style issues (feedback from Joe and Andy
taken into account).
- Add leading zero to constants in patch 4.
- Move dell-led.h include one line higher in patch 4.
Changes from v1:
- Squash patches 2-4 from v1 into a single patch (#2 in v2).
- Add patch 3.
- Fix subject pattern in patch 4.
- Slight commit message adjustments, including fixing a typo
("COFIG_LEDS_DELL_NETBOOKS") in patch 6.
- Remove the name of the module's source file from the header comment
in drivers/platform/x86/dell-wmi-led.c to avoid the need to update
it in the future.
drivers/leds/Kconfig | 9 --
drivers/leds/Makefile | 1 -
drivers/platform/x86/Kconfig | 8 ++
drivers/platform/x86/Makefile | 1 +
drivers/platform/x86/dell-laptop.c | 28 ++++
.../dell-led.c => platform/x86/dell-wmi-led.c} | 141 +++++----------------
include/linux/dell-led.h | 6 +-
sound/pci/hda/dell_wmi_helper.c | 30 ++---
8 files changed, 86 insertions(+), 138 deletions(-)
rename drivers/{leds/dell-led.c => platform/x86/dell-wmi-led.c} (56%)
--
2.11.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/7] dell-led: remove GUID check from dell_micmute_led_set()
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 7:57 ` [PATCH v3 2/7] ALSA: hda - use dell_micmute_led_set() instead of dell_app_wmi_led_set() Michał Kępień
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: linux-kernel, Alex Hung, alsa-devel, linux-leds,
platform-driver-x86
As dell_micmute_led_set() no longer uses the dell_wmi_perform_query()
method, which was removed in commit 0c41a08e131d ("dell-led: use
dell_smbios_send_request() for performing SMBIOS calls"), the
DELL_APP_GUID check is redundant and thus can be safely removed.
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/leds/dell-led.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/leds/dell-led.c b/drivers/leds/dell-led.c
index b3d6e9c15cf9..e8e8f67224c1 100644
--- a/drivers/leds/dell-led.c
+++ b/drivers/leds/dell-led.c
@@ -51,9 +51,6 @@ static int dell_micmute_led_set(int state)
struct calling_interface_buffer *buffer;
struct calling_interface_token *token;
- if (!wmi_has_guid(DELL_APP_GUID))
- return -ENODEV;
-
if (state == 0)
token = dell_smbios_find_token(GLOBAL_MIC_MUTE_DISABLE);
else if (state == 1)
--
2.11.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 2/7] ALSA: hda - use dell_micmute_led_set() instead of dell_app_wmi_led_set()
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
2017-02-17 7:57 ` [PATCH v3 1/7] dell-led: remove GUID check from dell_micmute_led_set() Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 7:57 ` [PATCH v3 3/7] ALSA: hda - rename dell_led_set_func to dell_micmute_led_set_func Michał Kępień
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: linux-kernel, Alex Hung, alsa-devel, linux-leds,
platform-driver-x86
The dell_app_wmi_led_set() method introduced in commit db6d8cc00773
("dell-led: add mic mute led interface") was implemented as an easily
extensible entry point for other modules to set the state of various
LEDs. However, almost three years later it is still only used to
control the mic mute LED, so it will be replaced with direct calls to
dell_micmute_led_set().
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
---
drivers/leds/dell-led.c | 20 ++------------------
include/linux/dell-led.h | 6 +-----
sound/pci/hda/dell_wmi_helper.c | 12 ++++++------
3 files changed, 9 insertions(+), 29 deletions(-)
diff --git a/drivers/leds/dell-led.c b/drivers/leds/dell-led.c
index e8e8f67224c1..f9002d9bb757 100644
--- a/drivers/leds/dell-led.c
+++ b/drivers/leds/dell-led.c
@@ -46,7 +46,7 @@ MODULE_ALIAS("wmi:" DELL_LED_BIOS_GUID);
#define GLOBAL_MIC_MUTE_ENABLE 0x364
#define GLOBAL_MIC_MUTE_DISABLE 0x365
-static int dell_micmute_led_set(int state)
+int dell_micmute_led_set(int state)
{
struct calling_interface_buffer *buffer;
struct calling_interface_token *token;
@@ -69,23 +69,7 @@ static int dell_micmute_led_set(int state)
return state;
}
-
-int dell_app_wmi_led_set(int whichled, int on)
-{
- int state = 0;
-
- switch (whichled) {
- case DELL_LED_MICMUTE:
- state = dell_micmute_led_set(on);
- break;
- default:
- pr_warn("led type %x is not supported\n", whichled);
- break;
- }
-
- return state;
-}
-EXPORT_SYMBOL_GPL(dell_app_wmi_led_set);
+EXPORT_SYMBOL_GPL(dell_micmute_led_set);
struct bios_args {
unsigned char length;
diff --git a/include/linux/dell-led.h b/include/linux/dell-led.h
index 7009b8bec77b..3f033c48071e 100644
--- a/include/linux/dell-led.h
+++ b/include/linux/dell-led.h
@@ -1,10 +1,6 @@
#ifndef __DELL_LED_H__
#define __DELL_LED_H__
-enum {
- DELL_LED_MICMUTE,
-};
-
-int dell_app_wmi_led_set(int whichled, int on);
+int dell_micmute_led_set(int on);
#endif
diff --git a/sound/pci/hda/dell_wmi_helper.c b/sound/pci/hda/dell_wmi_helper.c
index 19d41da79f93..e128c8096772 100644
--- a/sound/pci/hda/dell_wmi_helper.c
+++ b/sound/pci/hda/dell_wmi_helper.c
@@ -6,7 +6,7 @@
#include <linux/dell-led.h>
static int dell_led_value;
-static int (*dell_led_set_func)(int, int);
+static int (*dell_led_set_func)(int);
static void (*dell_old_cap_hook)(struct hda_codec *,
struct snd_kcontrol *,
struct snd_ctl_elem_value *);
@@ -27,7 +27,7 @@ static void update_dell_wmi_micmute_led(struct hda_codec *codec,
return;
dell_led_value = val;
if (dell_led_set_func)
- dell_led_set_func(DELL_LED_MICMUTE, dell_led_value);
+ dell_led_set_func(dell_led_value);
}
}
@@ -40,14 +40,14 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec,
if (action == HDA_FIXUP_ACT_PROBE) {
if (!dell_led_set_func)
- dell_led_set_func = symbol_request(dell_app_wmi_led_set);
+ dell_led_set_func = symbol_request(dell_micmute_led_set);
if (!dell_led_set_func) {
- codec_warn(codec, "Failed to find dell wmi symbol dell_app_wmi_led_set\n");
+ codec_warn(codec, "Failed to find dell wmi symbol dell_micmute_led_set\n");
return;
}
removefunc = true;
- if (dell_led_set_func(DELL_LED_MICMUTE, false) >= 0) {
+ if (dell_led_set_func(false) >= 0) {
dell_led_value = 0;
if (spec->gen.num_adc_nids > 1 && !spec->gen.dyn_adc_switch)
codec_dbg(codec, "Skipping micmute LED control due to several ADCs");
@@ -61,7 +61,7 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec,
}
if (dell_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
- symbol_put(dell_app_wmi_led_set);
+ symbol_put(dell_micmute_led_set);
dell_led_set_func = NULL;
dell_old_cap_hook = NULL;
}
--
2.11.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 3/7] ALSA: hda - rename dell_led_set_func to dell_micmute_led_set_func
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
2017-02-17 7:57 ` [PATCH v3 1/7] dell-led: remove GUID check from dell_micmute_led_set() Michał Kępień
2017-02-17 7:57 ` [PATCH v3 2/7] ALSA: hda - use dell_micmute_led_set() instead of dell_app_wmi_led_set() Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 7:57 ` [PATCH v3 4/7] platform/x86: dell-laptop: import dell_micmute_led_set() from drivers/leds/dell-led.c Michał Kępień
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: linux-kernel, Alex Hung, alsa-devel, linux-leds,
platform-driver-x86
With dell_app_wmi_led_set() replaced by dell_micmute_led_set(), rename
the function pointer to the latter for consistency.
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/dell_wmi_helper.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/sound/pci/hda/dell_wmi_helper.c b/sound/pci/hda/dell_wmi_helper.c
index e128c8096772..516237ad6ef5 100644
--- a/sound/pci/hda/dell_wmi_helper.c
+++ b/sound/pci/hda/dell_wmi_helper.c
@@ -6,7 +6,7 @@
#include <linux/dell-led.h>
static int dell_led_value;
-static int (*dell_led_set_func)(int);
+static int (*dell_micmute_led_set_func)(int);
static void (*dell_old_cap_hook)(struct hda_codec *,
struct snd_kcontrol *,
struct snd_ctl_elem_value *);
@@ -18,7 +18,7 @@ static void update_dell_wmi_micmute_led(struct hda_codec *codec,
if (dell_old_cap_hook)
dell_old_cap_hook(codec, kcontrol, ucontrol);
- if (!ucontrol || !dell_led_set_func)
+ if (!ucontrol || !dell_micmute_led_set_func)
return;
if (strcmp("Capture Switch", ucontrol->id.name) == 0 && ucontrol->id.index == 0) {
/* TODO: How do I verify if it's a mono or stereo here? */
@@ -26,8 +26,8 @@ static void update_dell_wmi_micmute_led(struct hda_codec *codec,
if (val == dell_led_value)
return;
dell_led_value = val;
- if (dell_led_set_func)
- dell_led_set_func(dell_led_value);
+ if (dell_micmute_led_set_func)
+ dell_micmute_led_set_func(dell_led_value);
}
}
@@ -39,15 +39,15 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec,
bool removefunc = false;
if (action == HDA_FIXUP_ACT_PROBE) {
- if (!dell_led_set_func)
- dell_led_set_func = symbol_request(dell_micmute_led_set);
- if (!dell_led_set_func) {
+ if (!dell_micmute_led_set_func)
+ dell_micmute_led_set_func = symbol_request(dell_micmute_led_set);
+ if (!dell_micmute_led_set_func) {
codec_warn(codec, "Failed to find dell wmi symbol dell_micmute_led_set\n");
return;
}
removefunc = true;
- if (dell_led_set_func(false) >= 0) {
+ if (dell_micmute_led_set_func(false) >= 0) {
dell_led_value = 0;
if (spec->gen.num_adc_nids > 1 && !spec->gen.dyn_adc_switch)
codec_dbg(codec, "Skipping micmute LED control due to several ADCs");
@@ -60,9 +60,9 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec,
}
- if (dell_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
+ if (dell_micmute_led_set_func && (action == HDA_FIXUP_ACT_FREE || removefunc)) {
symbol_put(dell_micmute_led_set);
- dell_led_set_func = NULL;
+ dell_micmute_led_set_func = NULL;
dell_old_cap_hook = NULL;
}
}
--
2.11.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 4/7] platform/x86: dell-laptop: import dell_micmute_led_set() from drivers/leds/dell-led.c
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
` (2 preceding siblings ...)
2017-02-17 7:57 ` [PATCH v3 3/7] ALSA: hda - rename dell_led_set_func to dell_micmute_led_set_func Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 7:57 ` [PATCH v3 5/7] dell-led: remove code related to mic mute LED Michał Kępień
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: Alex Hung, linux-leds, platform-driver-x86, alsa-devel,
linux-kernel
To ensure all users of dell-smbios are in drivers/platform/x86, move the
dell_micmute_led_set() method from drivers/leds/dell-led.c to
drivers/platform/x86/dell-laptop.c.
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
---
drivers/leds/dell-led.c | 29 -----------------------------
drivers/platform/x86/dell-laptop.c | 28 ++++++++++++++++++++++++++++
sound/pci/hda/dell_wmi_helper.c | 6 +++---
3 files changed, 31 insertions(+), 32 deletions(-)
diff --git a/drivers/leds/dell-led.c b/drivers/leds/dell-led.c
index f9002d9bb757..c9cc36a7c890 100644
--- a/drivers/leds/dell-led.c
+++ b/drivers/leds/dell-led.c
@@ -16,7 +16,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/dmi.h>
-#include <linux/dell-led.h>
#include "../platform/x86/dell-smbios.h"
MODULE_AUTHOR("Louis Davis/Jim Dailey");
@@ -43,34 +42,6 @@ MODULE_ALIAS("wmi:" DELL_LED_BIOS_GUID);
#define CMD_LED_OFF 17
#define CMD_LED_BLINK 18
-#define GLOBAL_MIC_MUTE_ENABLE 0x364
-#define GLOBAL_MIC_MUTE_DISABLE 0x365
-
-int dell_micmute_led_set(int state)
-{
- struct calling_interface_buffer *buffer;
- struct calling_interface_token *token;
-
- if (state == 0)
- token = dell_smbios_find_token(GLOBAL_MIC_MUTE_DISABLE);
- else if (state == 1)
- token = dell_smbios_find_token(GLOBAL_MIC_MUTE_ENABLE);
- else
- return -EINVAL;
-
- if (!token)
- return -ENODEV;
-
- buffer = dell_smbios_get_buffer();
- buffer->input[0] = token->location;
- buffer->input[1] = token->value;
- dell_smbios_send_request(1, 0);
- dell_smbios_release_buffer();
-
- return state;
-}
-EXPORT_SYMBOL_GPL(dell_micmute_led_set);
-
struct bios_args {
unsigned char length;
unsigned char result_code;
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 14392a01ab36..9e35205779c0 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -29,6 +29,7 @@
#include <linux/mm.h>
#include <linux/i8042.h>
#include <linux/debugfs.h>
+#include <linux/dell-led.h>
#include <linux/seq_file.h>
#include <acpi/video.h>
#include "dell-rbtn.h"
@@ -42,6 +43,8 @@
#define KBD_LED_AUTO_50_TOKEN 0x02EB
#define KBD_LED_AUTO_75_TOKEN 0x02EC
#define KBD_LED_AUTO_100_TOKEN 0x02F6
+#define GLOBAL_MIC_MUTE_ENABLE 0x0364
+#define GLOBAL_MIC_MUTE_DISABLE 0x0365
struct quirk_entry {
u8 touchpad_led;
@@ -1972,6 +1975,31 @@ static void kbd_led_exit(void)
led_classdev_unregister(&kbd_led);
}
+int dell_micmute_led_set(int state)
+{
+ struct calling_interface_buffer *buffer;
+ struct calling_interface_token *token;
+
+ if (state == 0)
+ token = dell_smbios_find_token(GLOBAL_MIC_MUTE_DISABLE);
+ else if (state == 1)
+ token = dell_smbios_find_token(GLOBAL_MIC_MUTE_ENABLE);
+ else
+ return -EINVAL;
+
+ if (!token)
+ return -ENODEV;
+
+ buffer = dell_smbios_get_buffer();
+ buffer->input[0] = token->location;
+ buffer->input[1] = token->value;
+ dell_smbios_send_request(1, 0);
+ dell_smbios_release_buffer();
+
+ return state;
+}
+EXPORT_SYMBOL_GPL(dell_micmute_led_set);
+
static int __init dell_init(void)
{
struct calling_interface_buffer *buffer;
diff --git a/sound/pci/hda/dell_wmi_helper.c b/sound/pci/hda/dell_wmi_helper.c
index 516237ad6ef5..7efa7bd7acb2 100644
--- a/sound/pci/hda/dell_wmi_helper.c
+++ b/sound/pci/hda/dell_wmi_helper.c
@@ -2,7 +2,7 @@
* to be included from codec driver
*/
-#if IS_ENABLED(CONFIG_LEDS_DELL_NETBOOKS)
+#if IS_ENABLED(CONFIG_DELL_LAPTOP)
#include <linux/dell-led.h>
static int dell_led_value;
@@ -67,10 +67,10 @@ static void alc_fixup_dell_wmi(struct hda_codec *codec,
}
}
-#else /* CONFIG_LEDS_DELL_NETBOOKS */
+#else /* CONFIG_DELL_LAPTOP */
static void alc_fixup_dell_wmi(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
}
-#endif /* CONFIG_LEDS_DELL_NETBOOKS */
+#endif /* CONFIG_DELL_LAPTOP */
--
2.11.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 5/7] dell-led: remove code related to mic mute LED
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
` (3 preceding siblings ...)
2017-02-17 7:57 ` [PATCH v3 4/7] platform/x86: dell-laptop: import dell_micmute_led_set() from drivers/leds/dell-led.c Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 7:57 ` [PATCH v3 6/7] dell-led: move driver to drivers/platform/x86/dell-wmi-led.c Michał Kępień
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: Alex Hung, linux-leds, platform-driver-x86, alsa-devel,
linux-kernel
With dell_micmute_led_set() moved to drivers/platform/x86/dell-laptop.c,
all remnants of the mic mute LED handling code can be removed from
drivers/leds/dell-led.c, restoring it back to the state it was in before
commit db6d8cc00773 ("dell-led: add mic mute led interface").
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
---
drivers/leds/Kconfig | 1 -
drivers/leds/dell-led.c | 25 +++++++------------------
2 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 275f467956ee..8d1b4c9b3bda 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -467,7 +467,6 @@ config LEDS_DELL_NETBOOKS
tristate "External LED on Dell Business Netbooks"
depends on LEDS_CLASS
depends on X86 && ACPI_WMI
- depends on DELL_SMBIOS
help
This adds support for the Latitude 2100 and similar
notebooks that have an external LED.
diff --git a/drivers/leds/dell-led.c b/drivers/leds/dell-led.c
index c9cc36a7c890..e5c57389efd6 100644
--- a/drivers/leds/dell-led.c
+++ b/drivers/leds/dell-led.c
@@ -15,15 +15,12 @@
#include <linux/leds.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/dmi.h>
-#include "../platform/x86/dell-smbios.h"
MODULE_AUTHOR("Louis Davis/Jim Dailey");
MODULE_DESCRIPTION("Dell LED Control Driver");
MODULE_LICENSE("GPL");
#define DELL_LED_BIOS_GUID "F6E4FE6E-909D-47cb-8BAB-C9F6F2F8D396"
-#define DELL_APP_GUID "A80593CE-A997-11DA-B012-B622A1EF5492"
MODULE_ALIAS("wmi:" DELL_LED_BIOS_GUID);
/* Error Result Codes: */
@@ -184,29 +181,21 @@ static int __init dell_led_init(void)
{
int error = 0;
- if (!wmi_has_guid(DELL_LED_BIOS_GUID) && !wmi_has_guid(DELL_APP_GUID))
+ if (!wmi_has_guid(DELL_LED_BIOS_GUID))
return -ENODEV;
- if (wmi_has_guid(DELL_LED_BIOS_GUID)) {
- error = led_off();
- if (error != 0)
- return -ENODEV;
-
- error = led_classdev_register(NULL, &dell_led);
- }
+ error = led_off();
+ if (error != 0)
+ return -ENODEV;
- return error;
+ return led_classdev_register(NULL, &dell_led);
}
static void __exit dell_led_exit(void)
{
- int error = 0;
+ led_classdev_unregister(&dell_led);
- if (wmi_has_guid(DELL_LED_BIOS_GUID)) {
- error = led_off();
- if (error == 0)
- led_classdev_unregister(&dell_led);
- }
+ led_off();
}
module_init(dell_led_init);
--
2.11.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 6/7] dell-led: move driver to drivers/platform/x86/dell-wmi-led.c
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
` (4 preceding siblings ...)
2017-02-17 7:57 ` [PATCH v3 5/7] dell-led: remove code related to mic mute LED Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 7:57 ` [PATCH v3 7/7] platform/x86: dell-wmi-led: fix coding style issues Michał Kępień
2017-02-17 22:15 ` [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Jacek Anaszewski
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: Alex Hung, linux-leds, platform-driver-x86, alsa-devel,
linux-kernel
The dell-led driver handles a specific WMI GUID present on some Dell
laptops and as such it belongs in the x86 platform driver subsystem.
Source code is moved along with the relevant Kconfig and Makefile
entries, with some minor modifications:
- Kconfig option is renamed from CONFIG_LEDS_DELL_NETBOOKS to
CONFIG_DELL_WMI_LED,
- the X86 Kconfig dependency is removed as the whole
drivers/platform/x86 menu depends on it, so there is no need to
duplicate it,
- the name of the module's source file is removed from the header
comment to avoid the need to update it in the future.
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Alex Hung <alex.hung@canonical.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/leds/Kconfig | 8 --------
drivers/leds/Makefile | 1 -
drivers/platform/x86/Kconfig | 8 ++++++++
drivers/platform/x86/Makefile | 1 +
drivers/{leds/dell-led.c => platform/x86/dell-wmi-led.c} | 2 --
5 files changed, 9 insertions(+), 11 deletions(-)
rename drivers/{leds/dell-led.c => platform/x86/dell-wmi-led.c} (99%)
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 8d1b4c9b3bda..6a88474b2970 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -463,14 +463,6 @@ config LEDS_ADP5520
To compile this driver as a module, choose M here: the module will
be called leds-adp5520.
-config LEDS_DELL_NETBOOKS
- tristate "External LED on Dell Business Netbooks"
- depends on LEDS_CLASS
- depends on X86 && ACPI_WMI
- help
- This adds support for the Latitude 2100 and similar
- notebooks that have an external LED.
-
config LEDS_MC13783
tristate "LED Support for MC13XXX PMIC"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 6b8273736478..558d24675454 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -52,7 +52,6 @@ obj-$(CONFIG_LEDS_REGULATOR) += leds-regulator.o
obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o
obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
-obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o
obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 5fe8be089b8b..6683e2e9cfb7 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -143,6 +143,14 @@ config DELL_WMI_AIO
To compile this driver as a module, choose M here: the module will
be called dell-wmi-aio.
+config DELL_WMI_LED
+ tristate "External LED on Dell Business Netbooks"
+ depends on LEDS_CLASS
+ depends on ACPI_WMI
+ help
+ This adds support for the Latitude 2100 and similar
+ notebooks that have an external LED.
+
config DELL_SMO8800
tristate "Dell Latitude freefall driver (ACPI SMO88XX)"
depends on ACPI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index d4111f0f8a78..e46114930877 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_DELL_SMBIOS) += dell-smbios.o
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
obj-$(CONFIG_DELL_WMI) += dell-wmi.o
obj-$(CONFIG_DELL_WMI_AIO) += dell-wmi-aio.o
+obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o
obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o
obj-$(CONFIG_DELL_RBTN) += dell-rbtn.o
obj-$(CONFIG_ACER_WMI) += acer-wmi.o
diff --git a/drivers/leds/dell-led.c b/drivers/platform/x86/dell-wmi-led.c
similarity index 99%
rename from drivers/leds/dell-led.c
rename to drivers/platform/x86/dell-wmi-led.c
index e5c57389efd6..d0232c7f1909 100644
--- a/drivers/leds/dell-led.c
+++ b/drivers/platform/x86/dell-wmi-led.c
@@ -1,6 +1,4 @@
/*
- * dell_led.c - Dell LED Driver
- *
* Copyright (C) 2010 Dell Inc.
* Louis Davis <louis_davis@dell.com>
* Jim Dailey <jim_dailey@dell.com>
--
2.11.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 7/7] platform/x86: dell-wmi-led: fix coding style issues
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
` (5 preceding siblings ...)
2017-02-17 7:57 ` [PATCH v3 6/7] dell-led: move driver to drivers/platform/x86/dell-wmi-led.c Michał Kępień
@ 2017-02-17 7:57 ` Michał Kępień
2017-02-17 22:15 ` [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Jacek Anaszewski
7 siblings, 0 replies; 9+ messages in thread
From: Michał Kępień @ 2017-02-17 7:57 UTC (permalink / raw)
To: Richard Purdie, Jacek Anaszewski, Pavel Machek, Matthew Garrett,
Pali Rohár, Darren Hart, Andy Shevchenko, Jaroslav Kysela,
Takashi Iwai
Cc: Alex Hung, linux-leds, platform-driver-x86, alsa-devel,
linux-kernel
Fix coding style issues in dell-wmi-led to make sure the module gets a
clean start in the x86 platform driver subsystem.
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
---
drivers/platform/x86/dell-wmi-led.c | 66 +++++++++++++++----------------------
1 file changed, 26 insertions(+), 40 deletions(-)
diff --git a/drivers/platform/x86/dell-wmi-led.c b/drivers/platform/x86/dell-wmi-led.c
index d0232c7f1909..a0c7e99530ef 100644
--- a/drivers/platform/x86/dell-wmi-led.c
+++ b/drivers/platform/x86/dell-wmi-led.c
@@ -46,37 +46,29 @@ struct bios_args {
unsigned char off_time;
};
-static int dell_led_perform_fn(u8 length,
- u8 result_code,
- u8 device_id,
- u8 command,
- u8 on_time,
- u8 off_time)
+static int dell_led_perform_fn(u8 length, u8 result_code, u8 device_id,
+ u8 command, u8 on_time, u8 off_time)
{
- struct bios_args *bios_return;
- u8 return_code;
- union acpi_object *obj;
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
+ struct bios_args *bios_return;
struct acpi_buffer input;
+ union acpi_object *obj;
acpi_status status;
+ u8 return_code;
- struct bios_args args;
- args.length = length;
- args.result_code = result_code;
- args.device_id = device_id;
- args.command = command;
- args.on_time = on_time;
- args.off_time = off_time;
+ struct bios_args args = {
+ .length = length,
+ .result_code = result_code,
+ .device_id = device_id,
+ .command = command,
+ .on_time = on_time,
+ .off_time = off_time
+ };
input.length = sizeof(struct bios_args);
input.pointer = &args;
- status = wmi_evaluate_method(DELL_LED_BIOS_GUID,
- 1,
- 1,
- &input,
- &output);
-
+ status = wmi_evaluate_method(DELL_LED_BIOS_GUID, 1, 1, &input, &output);
if (ACPI_FAILURE(status))
return status;
@@ -84,7 +76,7 @@ static int dell_led_perform_fn(u8 length,
if (!obj)
return -EINVAL;
- else if (obj->type != ACPI_TYPE_BUFFER) {
+ if (obj->type != ACPI_TYPE_BUFFER) {
kfree(obj);
return -EINVAL;
}
@@ -117,8 +109,7 @@ static int led_off(void)
0); /* not used */
}
-static int led_blink(unsigned char on_eighths,
- unsigned char off_eighths)
+static int led_blink(unsigned char on_eighths, unsigned char off_eighths)
{
return dell_led_perform_fn(5, /* Length of command */
INTERFACE_ERROR, /* Init to INTERFACE_ERROR */
@@ -129,7 +120,7 @@ static int led_blink(unsigned char on_eighths,
}
static void dell_led_set(struct led_classdev *led_cdev,
- enum led_brightness value)
+ enum led_brightness value)
{
if (value == LED_OFF)
led_off();
@@ -138,27 +129,22 @@ static void dell_led_set(struct led_classdev *led_cdev,
}
static int dell_led_blink(struct led_classdev *led_cdev,
- unsigned long *delay_on,
- unsigned long *delay_off)
+ unsigned long *delay_on, unsigned long *delay_off)
{
unsigned long on_eighths;
unsigned long off_eighths;
- /* The Dell LED delay is based on 125ms intervals.
- Need to round up to next interval. */
+ /*
+ * The Dell LED delay is based on 125ms intervals.
+ * Need to round up to next interval.
+ */
- on_eighths = (*delay_on + 124) / 125;
- if (0 == on_eighths)
- on_eighths = 1;
- if (on_eighths > 255)
- on_eighths = 255;
+ on_eighths = DIV_ROUND_UP(*delay_on, 125);
+ on_eighths = clamp_t(unsigned long, on_eighths, 1, 255);
*delay_on = on_eighths * 125;
- off_eighths = (*delay_off + 124) / 125;
- if (0 == off_eighths)
- off_eighths = 1;
- if (off_eighths > 255)
- off_eighths = 255;
+ off_eighths = DIV_ROUND_UP(*delay_off, 125);
+ off_eighths = clamp_t(unsigned long, off_eighths, 1, 255);
*delay_off = off_eighths * 125;
led_blink(on_eighths, off_eighths);
--
2.11.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 0/7] Move dell-led to drivers/platform/x86
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
` (6 preceding siblings ...)
2017-02-17 7:57 ` [PATCH v3 7/7] platform/x86: dell-wmi-led: fix coding style issues Michał Kępień
@ 2017-02-17 22:15 ` Jacek Anaszewski
7 siblings, 0 replies; 9+ messages in thread
From: Jacek Anaszewski @ 2017-02-17 22:15 UTC (permalink / raw)
To: Michał Kępień, Richard Purdie, Pavel Machek,
Matthew Garrett, Pali Rohár, Darren Hart, Andy Shevchenko,
Jaroslav Kysela, Takashi Iwai
Cc: Alex Hung, linux-leds, platform-driver-x86, alsa-devel,
linux-kernel
Hi Michał,
Thanks for collecting relevant credits.
I've applied the patchset to the for-4.12 branch of linux-leds.git.
Best regards,
Jacek Anaszewski
On 02/17/2017 08:57 AM, Michał Kępień wrote:
> This patch series moves the dell-led driver from the LED subsystem to
> the x86 platform driver subsystem.
>
> The original motivation behind this effort was to move all code using
> the dell-smbios module to the x86 platform driver subsystem. While I
> was investigating the possibilities to do that, it quickly emerged that
> dell-led can and in fact should be moved to the x86 platform driver
> subsystem in its entirety.
>
> dell-led consists of two major parts:
>
> - the part exposing a microphone mute LED interface, introduced in
> db6d8cc00773 ("dell-led: add mic mute led interface"); this
> interface is used by sound/pci/hda/dell_wmi_helper.c; while the
> original implementation used a WMI interface, it was changed to use
> dell-smbios in cf0d7ea33596 ("dell-led: use dell_smbios_find_token()
> for finding mic DMI tokens") and 0c41a08e131d ("dell-led: use
> dell_smbios_send_request() for performing SMBIOS calls"),
>
> - the part handling an activity LED present in Dell Latitude 2100
> netbooks, introduced in 72dcd8d08aca ("leds: Add Dell Business Class
> Netbook LED driver"); it binds to a specific WMI GUID and then
> registers a LED device which is controlled using WMI (i.e. it is
> essentially a WMI driver).
>
> Patches 1 and 2 clean up the microphone mute LED interface to minimize
> the amount of code moved around.
>
> Patch 3 updates a variable name in sound/pci/hda/dell_wmi_helper.c so
> that it better matches that variable's role.
>
> Patch 4 moves the microphone mute LED interface to
> drivers/platform/x86/dell-laptop.c, effectively causing
> sound/pci/hda/dell_wmi_helper.c to depend on CONFIG_DELL_LAPTOP instead
> of CONFIG_LEDS_DELL_NETBOOKS.
>
> Patch 5 reverts dell-led to the state it was in after its initial commit
> 72dcd8d08aca ("leds: Add Dell Business Class Netbook LED driver") by
> removing all remnants of the microphone mute LED handling code.
>
> Patch 6 moves all that is left of dell-led (i.e. the activity LED part,
> as originally implemented), to a new module which is placed in
> drivers/platform/x86/dell-wmi-led.c.
>
> Patch 7 fixes coding style issues in drivers/platform/x86/dell-wmi-led.c
> to make sure it gets a clean start in the x86 platform driver subsystem.
>
> As all patches except patch 3 in this series affect the LED subsystem,
> the series is based on linux-leds/for-next.
>
> Changes from v2:
>
> - Add patch 7 fixing coding style issues (feedback from Joe and Andy
> taken into account).
>
> - Add leading zero to constants in patch 4.
>
> - Move dell-led.h include one line higher in patch 4.
>
> Changes from v1:
>
> - Squash patches 2-4 from v1 into a single patch (#2 in v2).
>
> - Add patch 3.
>
> - Fix subject pattern in patch 4.
>
> - Slight commit message adjustments, including fixing a typo
> ("COFIG_LEDS_DELL_NETBOOKS") in patch 6.
>
> - Remove the name of the module's source file from the header comment
> in drivers/platform/x86/dell-wmi-led.c to avoid the need to update
> it in the future.
>
> drivers/leds/Kconfig | 9 --
> drivers/leds/Makefile | 1 -
> drivers/platform/x86/Kconfig | 8 ++
> drivers/platform/x86/Makefile | 1 +
> drivers/platform/x86/dell-laptop.c | 28 ++++
> .../dell-led.c => platform/x86/dell-wmi-led.c} | 141 +++++----------------
> include/linux/dell-led.h | 6 +-
> sound/pci/hda/dell_wmi_helper.c | 30 ++---
> 8 files changed, 86 insertions(+), 138 deletions(-)
> rename drivers/{leds/dell-led.c => platform/x86/dell-wmi-led.c} (56%)
>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-02-17 22:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17 7:57 [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Michał Kępień
2017-02-17 7:57 ` [PATCH v3 1/7] dell-led: remove GUID check from dell_micmute_led_set() Michał Kępień
2017-02-17 7:57 ` [PATCH v3 2/7] ALSA: hda - use dell_micmute_led_set() instead of dell_app_wmi_led_set() Michał Kępień
2017-02-17 7:57 ` [PATCH v3 3/7] ALSA: hda - rename dell_led_set_func to dell_micmute_led_set_func Michał Kępień
2017-02-17 7:57 ` [PATCH v3 4/7] platform/x86: dell-laptop: import dell_micmute_led_set() from drivers/leds/dell-led.c Michał Kępień
2017-02-17 7:57 ` [PATCH v3 5/7] dell-led: remove code related to mic mute LED Michał Kępień
2017-02-17 7:57 ` [PATCH v3 6/7] dell-led: move driver to drivers/platform/x86/dell-wmi-led.c Michał Kępień
2017-02-17 7:57 ` [PATCH v3 7/7] platform/x86: dell-wmi-led: fix coding style issues Michał Kępień
2017-02-17 22:15 ` [PATCH v3 0/7] Move dell-led to drivers/platform/x86 Jacek Anaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox