Skip to content

Commit cd619e2

Browse files
committed
Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86
Pull x86 platform updates from Matthew Garrett: "Nothing amazing here, almost entirely cleanups and minor bugfixes and one bit of hardware enablement in the amilo-rfkill driver" * 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: platform/x86: panasonic-laptop: reuse module_acpi_driver samsung-laptop: fix config build error platform: x86: remove unnecessary platform_set_drvdata() amilo-rfkill: Enable using amilo-rfkill with the FSC Amilo L1310. wmi: parse_wdg() should return kernel error codes hp_wmi: Fix unregister order in hp_wmi_rfkill_setup() platform: replace strict_strto*() with kstrto*() x86: irst: use module_acpi_driver to simplify the code x86: smartconnect: use module_acpi_driver to simplify the code platform samsung-q10: use ACPI instead of direct EC calls thinkpad_acpi: add the ability setting TPACPI_LED_NONE by quirk thinkpad_acpi: return -NODEV while operating uninitialized LEDs
2 parents 0375ec5 + 5c07eae commit cd619e2

13 files changed

+66
-114
lines changed

drivers/platform/x86/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ config SAMSUNG_LAPTOP
732732
tristate "Samsung Laptop driver"
733733
depends on X86
734734
depends on RFKILL || RFKILL = n
735+
depends on ACPI_VIDEO || ACPI_VIDEO = n
735736
depends on BACKLIGHT_CLASS_DEVICE
736737
select LEDS_CLASS
737738
select NEW_LEDS
@@ -764,7 +765,7 @@ config INTEL_OAKTRAIL
764765

765766
config SAMSUNG_Q10
766767
tristate "Samsung Q10 Extras"
767-
depends on SERIO_I8042
768+
depends on ACPI
768769
select BACKLIGHT_CLASS_DEVICE
769770
---help---
770771
This driver provides support for backlight control on Samsung Q10

drivers/platform/x86/amilo-rfkill.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ static const struct dmi_system_id amilo_rfkill_id_table[] = {
8282
},
8383
.driver_data = (void *)&amilo_a1655_rfkill_ops
8484
},
85+
{
86+
.matches = {
87+
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
88+
DMI_MATCH(DMI_BOARD_NAME, "AMILO L1310"),
89+
},
90+
.driver_data = (void *)&amilo_a1655_rfkill_ops
91+
},
8592
{
8693
.matches = {
8794
DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),

drivers/platform/x86/classmate-laptop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static ssize_t cmpc_accel_sensitivity_store(struct device *dev,
590590
inputdev = dev_get_drvdata(&acpi->dev);
591591
accel = dev_get_drvdata(&inputdev->dev);
592592

593-
r = strict_strtoul(buf, 0, &sensitivity);
593+
r = kstrtoul(buf, 0, &sensitivity);
594594
if (r)
595595
return r;
596596

drivers/platform/x86/compal-laptop.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ static ssize_t pwm_enable_store(struct device *dev,
425425
struct compal_data *data = dev_get_drvdata(dev);
426426
long val;
427427
int err;
428-
err = strict_strtol(buf, 10, &val);
428+
429+
err = kstrtol(buf, 10, &val);
429430
if (err)
430431
return err;
431432
if (val < 0)
@@ -463,7 +464,8 @@ static ssize_t pwm_store(struct device *dev, struct device_attribute *attr,
463464
struct compal_data *data = dev_get_drvdata(dev);
464465
long val;
465466
int err;
466-
err = strict_strtol(buf, 10, &val);
467+
468+
err = kstrtol(buf, 10, &val);
467469
if (err)
468470
return err;
469471
if (val < 0 || val > 255)
@@ -1081,7 +1083,6 @@ static int compal_remove(struct platform_device *pdev)
10811083
hwmon_device_unregister(data->hwmon_dev);
10821084
power_supply_unregister(&data->psy);
10831085

1084-
platform_set_drvdata(pdev, NULL);
10851086
kfree(data);
10861087

10871088
sysfs_remove_group(&pdev->dev.kobj, &compal_attribute_group);

drivers/platform/x86/hp-wmi.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -725,15 +725,15 @@ static int hp_wmi_rfkill_setup(struct platform_device *device)
725725
(void *) HPWMI_WWAN);
726726
if (!wwan_rfkill) {
727727
err = -ENOMEM;
728-
goto register_gps_error;
728+
goto register_bluetooth_error;
729729
}
730730
rfkill_init_sw_state(wwan_rfkill,
731731
hp_wmi_get_sw_state(HPWMI_WWAN));
732732
rfkill_set_hw_state(wwan_rfkill,
733733
hp_wmi_get_hw_state(HPWMI_WWAN));
734734
err = rfkill_register(wwan_rfkill);
735735
if (err)
736-
goto register_wwan_err;
736+
goto register_wwan_error;
737737
}
738738

739739
if (wireless & 0x8) {
@@ -743,7 +743,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device)
743743
(void *) HPWMI_GPS);
744744
if (!gps_rfkill) {
745745
err = -ENOMEM;
746-
goto register_bluetooth_error;
746+
goto register_wwan_error;
747747
}
748748
rfkill_init_sw_state(gps_rfkill,
749749
hp_wmi_get_sw_state(HPWMI_GPS));
@@ -755,16 +755,16 @@ static int hp_wmi_rfkill_setup(struct platform_device *device)
755755
}
756756

757757
return 0;
758-
register_wwan_err:
759-
rfkill_destroy(wwan_rfkill);
760-
wwan_rfkill = NULL;
761-
if (gps_rfkill)
762-
rfkill_unregister(gps_rfkill);
763758
register_gps_error:
764759
rfkill_destroy(gps_rfkill);
765760
gps_rfkill = NULL;
766761
if (bluetooth_rfkill)
767762
rfkill_unregister(bluetooth_rfkill);
763+
register_wwan_error:
764+
rfkill_destroy(wwan_rfkill);
765+
wwan_rfkill = NULL;
766+
if (gps_rfkill)
767+
rfkill_unregister(gps_rfkill);
768768
register_bluetooth_error:
769769
rfkill_destroy(bluetooth_rfkill);
770770
bluetooth_rfkill = NULL;

drivers/platform/x86/intel-rst.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,17 +193,6 @@ static struct acpi_driver irst_driver = {
193193
},
194194
};
195195

196-
static int irst_init(void)
197-
{
198-
return acpi_bus_register_driver(&irst_driver);
199-
}
200-
201-
static void irst_exit(void)
202-
{
203-
acpi_bus_unregister_driver(&irst_driver);
204-
}
205-
206-
module_init(irst_init);
207-
module_exit(irst_exit);
196+
module_acpi_driver(irst_driver);
208197

209198
MODULE_DEVICE_TABLE(acpi, irst_ids);

drivers/platform/x86/intel-smartconnect.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,6 @@ static struct acpi_driver smartconnect_driver = {
7474
},
7575
};
7676

77-
static int smartconnect_init(void)
78-
{
79-
return acpi_bus_register_driver(&smartconnect_driver);
80-
}
81-
82-
static void smartconnect_exit(void)
83-
{
84-
acpi_bus_unregister_driver(&smartconnect_driver);
85-
}
86-
87-
module_init(smartconnect_init);
88-
module_exit(smartconnect_exit);
77+
module_acpi_driver(smartconnect_driver);
8978

9079
MODULE_DEVICE_TABLE(acpi, smartconnect_ids);

drivers/platform/x86/intel_mid_powerbtn.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ static int mfld_pb_remove(struct platform_device *pdev)
128128

129129
free_irq(irq, input);
130130
input_unregister_device(input);
131-
platform_set_drvdata(pdev, NULL);
132131

133132
return 0;
134133
}

drivers/platform/x86/intel_mid_thermal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,6 @@ static int mid_thermal_remove(struct platform_device *pdev)
542542
}
543543

544544
kfree(pinfo);
545-
platform_set_drvdata(pdev, NULL);
546545

547546
/* Stop the ADC */
548547
return configure_adc(0);

drivers/platform/x86/panasonic-laptop.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -643,23 +643,6 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
643643
return result;
644644
}
645645

646-
static int __init acpi_pcc_init(void)
647-
{
648-
int result = 0;
649-
650-
if (acpi_disabled)
651-
return -ENODEV;
652-
653-
result = acpi_bus_register_driver(&acpi_pcc_driver);
654-
if (result < 0) {
655-
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
656-
"Error registering hotkey driver\n"));
657-
return -ENODEV;
658-
}
659-
660-
return 0;
661-
}
662-
663646
static int acpi_pcc_hotkey_remove(struct acpi_device *device)
664647
{
665648
struct pcc_acpi *pcc = acpi_driver_data(device);
@@ -679,10 +662,4 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device)
679662
return 0;
680663
}
681664

682-
static void __exit acpi_pcc_exit(void)
683-
{
684-
acpi_bus_unregister_driver(&acpi_pcc_driver);
685-
}
686-
687-
module_init(acpi_pcc_init);
688-
module_exit(acpi_pcc_exit);
665+
module_acpi_driver(acpi_pcc_driver);

drivers/platform/x86/samsung-q10.c

Lines changed: 21 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,12 @@
1414
#include <linux/init.h>
1515
#include <linux/platform_device.h>
1616
#include <linux/backlight.h>
17-
#include <linux/i8042.h>
1817
#include <linux/dmi.h>
18+
#include <acpi/acpi_drivers.h>
1919

20-
#define SAMSUNGQ10_BL_MAX_INTENSITY 255
21-
#define SAMSUNGQ10_BL_DEFAULT_INTENSITY 185
20+
#define SAMSUNGQ10_BL_MAX_INTENSITY 7
2221

23-
#define SAMSUNGQ10_BL_8042_CMD 0xbe
24-
#define SAMSUNGQ10_BL_8042_DATA { 0x89, 0x91 }
25-
26-
static int samsungq10_bl_brightness;
22+
static acpi_handle ec_handle;
2723

2824
static bool force;
2925
module_param(force, bool, 0);
@@ -33,50 +29,33 @@ MODULE_PARM_DESC(force,
3329
static int samsungq10_bl_set_intensity(struct backlight_device *bd)
3430
{
3531

36-
int brightness = bd->props.brightness;
37-
unsigned char c[3] = SAMSUNGQ10_BL_8042_DATA;
32+
acpi_status status;
33+
int i;
3834

39-
c[2] = (unsigned char)brightness;
40-
i8042_lock_chip();
41-
i8042_command(c, (0x30 << 8) | SAMSUNGQ10_BL_8042_CMD);
42-
i8042_unlock_chip();
43-
samsungq10_bl_brightness = brightness;
35+
for (i = 0; i < SAMSUNGQ10_BL_MAX_INTENSITY; i++) {
36+
status = acpi_evaluate_object(ec_handle, "_Q63", NULL, NULL);
37+
if (ACPI_FAILURE(status))
38+
return -EIO;
39+
}
40+
for (i = 0; i < bd->props.brightness; i++) {
41+
status = acpi_evaluate_object(ec_handle, "_Q64", NULL, NULL);
42+
if (ACPI_FAILURE(status))
43+
return -EIO;
44+
}
4445

4546
return 0;
4647
}
4748

4849
static int samsungq10_bl_get_intensity(struct backlight_device *bd)
4950
{
50-
return samsungq10_bl_brightness;
51+
return bd->props.brightness;
5152
}
5253

5354
static const struct backlight_ops samsungq10_bl_ops = {
5455
.get_brightness = samsungq10_bl_get_intensity,
5556
.update_status = samsungq10_bl_set_intensity,
5657
};
5758

58-
#ifdef CONFIG_PM_SLEEP
59-
static int samsungq10_suspend(struct device *dev)
60-
{
61-
return 0;
62-
}
63-
64-
static int samsungq10_resume(struct device *dev)
65-
{
66-
67-
struct backlight_device *bd = dev_get_drvdata(dev);
68-
69-
samsungq10_bl_set_intensity(bd);
70-
return 0;
71-
}
72-
#else
73-
#define samsungq10_suspend NULL
74-
#define samsungq10_resume NULL
75-
#endif
76-
77-
static SIMPLE_DEV_PM_OPS(samsungq10_pm_ops,
78-
samsungq10_suspend, samsungq10_resume);
79-
8059
static int samsungq10_probe(struct platform_device *pdev)
8160
{
8261

@@ -93,9 +72,6 @@ static int samsungq10_probe(struct platform_device *pdev)
9372

9473
platform_set_drvdata(pdev, bd);
9574

96-
bd->props.brightness = SAMSUNGQ10_BL_DEFAULT_INTENSITY;
97-
samsungq10_bl_set_intensity(bd);
98-
9975
return 0;
10076
}
10177

@@ -104,9 +80,6 @@ static int samsungq10_remove(struct platform_device *pdev)
10480

10581
struct backlight_device *bd = platform_get_drvdata(pdev);
10682

107-
bd->props.brightness = SAMSUNGQ10_BL_DEFAULT_INTENSITY;
108-
samsungq10_bl_set_intensity(bd);
109-
11083
backlight_device_unregister(bd);
11184

11285
return 0;
@@ -116,7 +89,6 @@ static struct platform_driver samsungq10_driver = {
11689
.driver = {
11790
.name = KBUILD_MODNAME,
11891
.owner = THIS_MODULE,
119-
.pm = &samsungq10_pm_ops,
12092
},
12193
.probe = samsungq10_probe,
12294
.remove = samsungq10_remove,
@@ -172,6 +144,11 @@ static int __init samsungq10_init(void)
172144
if (!force && !dmi_check_system(samsungq10_dmi_table))
173145
return -ENODEV;
174146

147+
ec_handle = ec_get_handle();
148+
149+
if (!ec_handle)
150+
return -ENODEV;
151+
175152
samsungq10_device = platform_create_bundle(&samsungq10_driver,
176153
samsungq10_probe,
177154
NULL, 0, NULL, 0);

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ struct tpacpi_led_classdev {
369369
struct led_classdev led_classdev;
370370
struct work_struct work;
371371
enum led_status_t new_state;
372-
unsigned int led;
372+
int led;
373373
};
374374

375375
/* brightness level capabilities */
@@ -5296,6 +5296,16 @@ static int __init led_init(struct ibm_init_struct *iibm)
52965296

52975297
led_supported = led_init_detect_mode();
52985298

5299+
if (led_supported != TPACPI_LED_NONE) {
5300+
useful_leds = tpacpi_check_quirks(led_useful_qtable,
5301+
ARRAY_SIZE(led_useful_qtable));
5302+
5303+
if (!useful_leds) {
5304+
led_handle = NULL;
5305+
led_supported = TPACPI_LED_NONE;
5306+
}
5307+
}
5308+
52995309
vdbg_printk(TPACPI_DBG_INIT, "LED commands are %s, mode %d\n",
53005310
str_supported(led_supported), led_supported);
53015311

@@ -5309,10 +5319,9 @@ static int __init led_init(struct ibm_init_struct *iibm)
53095319
return -ENOMEM;
53105320
}
53115321

5312-
useful_leds = tpacpi_check_quirks(led_useful_qtable,
5313-
ARRAY_SIZE(led_useful_qtable));
5314-
53155322
for (i = 0; i < TPACPI_LED_NUMLEDS; i++) {
5323+
tpacpi_leds[i].led = -1;
5324+
53165325
if (!tpacpi_is_led_restricted(i) &&
53175326
test_bit(i, &useful_leds)) {
53185327
rc = tpacpi_init_led(i);
@@ -5370,9 +5379,13 @@ static int led_write(char *buf)
53705379
return -ENODEV;
53715380

53725381
while ((cmd = next_cmd(&buf))) {
5373-
if (sscanf(cmd, "%d", &led) != 1 || led < 0 || led > 15)
5382+
if (sscanf(cmd, "%d", &led) != 1)
53745383
return -EINVAL;
53755384

5385+
if (led < 0 || led > (TPACPI_LED_NUMLEDS - 1) ||
5386+
tpacpi_leds[led].led < 0)
5387+
return -ENODEV;
5388+
53765389
if (strstr(cmd, "off")) {
53775390
s = TPACPI_LED_OFF;
53785391
} else if (strstr(cmd, "on")) {

0 commit comments

Comments
 (0)