Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commita7f2766

Browse files
committed
Merge branches 'acpi-gpio', 'acpi-button', 'acpi-battery' and 'acpi-video'
* acpi-gpio: gpio: merrifield: Add support of ACPI enabled platforms ACPI: utils: Introduce acpi_dev_get_first_match_name()* acpi-button: ACPI: button: Add a LID switch blacklist and add 1 model to it ACPI: button: Add a debug message when we're sending a LID event* acpi-battery: ACPI / battery: Add quirk for Asus GL502VSK and UX305LA ACPI: battery: Drop redundant test for failure* acpi-video: ACPI / video: Default lcd_only to true on Win8-ready and newer machines
5 parents0c81e26 +dd1dbf9 +9e811e1 +c68f067 +5928c28 commita7f2766

File tree

7 files changed

+117
-16
lines changed

7 files changed

+117
-16
lines changed

‎drivers/acpi/acpi_video.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ MODULE_PARM_DESC(report_key_events,
8080
staticbooldevice_id_scheme= false;
8181
module_param(device_id_scheme,bool,0444);
8282

83-
staticboolonly_lcd=false;
84-
module_param(only_lcd,bool,0444);
83+
staticintonly_lcd=-1;
84+
module_param(only_lcd,int,0444);
8585

8686
staticintregister_count;
8787
staticDEFINE_MUTEX(register_count_mutex);
@@ -2136,6 +2136,16 @@ int acpi_video_register(void)
21362136
gotoleave;
21372137
}
21382138

2139+
/*
2140+
* We're seeing a lot of bogus backlight interfaces on newer machines
2141+
* without a LCD such as desktops, servers and HDMI sticks. Checking
2142+
* the lcd flag fixes this, so enable this on any machines which are
2143+
* win8 ready (where we also prefer the native backlight driver, so
2144+
* normally the acpi_video code should not register there anyways).
2145+
*/
2146+
if (only_lcd==-1)
2147+
only_lcd=acpi_osi_is_win8();
2148+
21392149
dmi_check_system(video_dmi_table);
21402150

21412151
ret=acpi_bus_register_driver(&acpi_video_bus);

‎drivers/acpi/battery.c‎

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ static async_cookie_t async_cookie;
7070
staticboolbattery_driver_registered;
7171
staticintbattery_bix_broken_package;
7272
staticintbattery_notification_delay_ms;
73+
staticintbattery_full_discharging;
7374
staticunsignedintcache_time=1000;
7475
module_param(cache_time,uint,0644);
7576
MODULE_PARM_DESC(cache_time,"cache time in milliseconds");
@@ -214,9 +215,12 @@ static int acpi_battery_get_property(struct power_supply *psy,
214215
return-ENODEV;
215216
switch (psp) {
216217
casePOWER_SUPPLY_PROP_STATUS:
217-
if (battery->state&ACPI_BATTERY_STATE_DISCHARGING)
218-
val->intval=POWER_SUPPLY_STATUS_DISCHARGING;
219-
elseif (battery->state&ACPI_BATTERY_STATE_CHARGING)
218+
if (battery->state&ACPI_BATTERY_STATE_DISCHARGING) {
219+
if (battery_full_discharging&&battery->rate_now==0)
220+
val->intval=POWER_SUPPLY_STATUS_FULL;
221+
else
222+
val->intval=POWER_SUPPLY_STATUS_DISCHARGING;
223+
}elseif (battery->state&ACPI_BATTERY_STATE_CHARGING)
220224
val->intval=POWER_SUPPLY_STATUS_CHARGING;
221225
elseif (acpi_battery_is_charged(battery))
222226
val->intval=POWER_SUPPLY_STATUS_FULL;
@@ -1166,6 +1170,12 @@ battery_notification_delay_quirk(const struct dmi_system_id *d)
11661170
return0;
11671171
}
11681172

1173+
staticint__initbattery_full_discharging_quirk(conststructdmi_system_id*d)
1174+
{
1175+
battery_full_discharging=1;
1176+
return0;
1177+
}
1178+
11691179
staticconststructdmi_system_idbat_dmi_table[]__initconst= {
11701180
{
11711181
.callback=battery_bix_broken_package_quirk,
@@ -1183,6 +1193,22 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
11831193
DMI_MATCH(DMI_PRODUCT_NAME,"Aspire V5-573G"),
11841194
},
11851195
},
1196+
{
1197+
.callback=battery_full_discharging_quirk,
1198+
.ident="ASUS GL502VSK",
1199+
.matches= {
1200+
DMI_MATCH(DMI_SYS_VENDOR,"ASUSTeK COMPUTER INC."),
1201+
DMI_MATCH(DMI_PRODUCT_NAME,"GL502VSK"),
1202+
},
1203+
},
1204+
{
1205+
.callback=battery_full_discharging_quirk,
1206+
.ident="ASUS UX305LA",
1207+
.matches= {
1208+
DMI_MATCH(DMI_SYS_VENDOR,"ASUSTeK COMPUTER INC."),
1209+
DMI_MATCH(DMI_PRODUCT_NAME,"UX305LA"),
1210+
},
1211+
},
11861212
{},
11871213
};
11881214

@@ -1237,13 +1263,11 @@ static int acpi_battery_add(struct acpi_device *device)
12371263

12381264
#ifdefCONFIG_ACPI_PROCFS_POWER
12391265
result=acpi_battery_add_fs(device);
1240-
#endif
12411266
if (result) {
1242-
#ifdefCONFIG_ACPI_PROCFS_POWER
12431267
acpi_battery_remove_fs(device);
1244-
#endif
12451268
gotofail;
12461269
}
1270+
#endif
12471271

12481272
printk(KERN_INFOPREFIX"%s Slot [%s] (battery %s)\n",
12491273
ACPI_BATTERY_DEVICE_NAME,acpi_device_bid(device),

‎drivers/acpi/button.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include<linux/input.h>
3131
#include<linux/slab.h>
3232
#include<linux/acpi.h>
33+
#include<linux/dmi.h>
3334
#include<acpi/button.h>
3435

3536
#definePREFIX "ACPI: "
@@ -76,6 +77,22 @@ static const struct acpi_device_id button_device_ids[] = {
7677
};
7778
MODULE_DEVICE_TABLE(acpi,button_device_ids);
7879

80+
/*
81+
* Some devices which don't even have a lid in anyway have a broken _LID
82+
* method (e.g. pointing to a floating gpio pin) causing spurious LID events.
83+
*/
84+
staticconststructdmi_system_idlid_blacklst[]= {
85+
{
86+
/* GP-electronic T701 */
87+
.matches= {
88+
DMI_MATCH(DMI_SYS_VENDOR,"Insyde"),
89+
DMI_MATCH(DMI_PRODUCT_NAME,"T701"),
90+
DMI_MATCH(DMI_BIOS_VERSION,"BYT70A.YNCHENG.WIN.007"),
91+
},
92+
},
93+
{}
94+
};
95+
7996
staticintacpi_button_add(structacpi_device*device);
8097
staticintacpi_button_remove(structacpi_device*device);
8198
staticvoidacpi_button_notify(structacpi_device*device,u32event);
@@ -210,6 +227,8 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state)
210227
}
211228
/* Send the platform triggered reliable event */
212229
if (do_update) {
230+
acpi_handle_debug(device->handle,"ACPI LID %s\n",
231+
state ?"open" :"closed");
213232
input_report_switch(button->input,SW_LID, !state);
214233
input_sync(button->input);
215234
button->last_state= !!state;
@@ -473,6 +492,9 @@ static int acpi_button_add(struct acpi_device *device)
473492
char*name,*class;
474493
interror;
475494

495+
if (!strcmp(hid,ACPI_BUTTON_HID_LID)&&dmi_check_system(lid_blacklst))
496+
return-ENODEV;
497+
476498
button=kzalloc(sizeof(structacpi_button),GFP_KERNEL);
477499
if (!button)
478500
return-ENOMEM;

‎drivers/acpi/utils.c‎

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,16 +737,17 @@ bool acpi_dev_found(const char *hid)
737737
}
738738
EXPORT_SYMBOL(acpi_dev_found);
739739

740-
structacpi_dev_present_info {
740+
structacpi_dev_match_info {
741+
constchar*dev_name;
741742
structacpi_device_idhid[2];
742743
constchar*uid;
743744
s64hrv;
744745
};
745746

746-
staticintacpi_dev_present_cb(structdevice*dev,void*data)
747+
staticintacpi_dev_match_cb(structdevice*dev,void*data)
747748
{
748749
structacpi_device*adev=to_acpi_device(dev);
749-
structacpi_dev_present_info*match=data;
750+
structacpi_dev_match_info*match=data;
750751
unsigned long longhrv;
751752
acpi_statusstatus;
752753

@@ -757,6 +758,8 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
757758
strcmp(adev->pnp.unique_id,match->uid)))
758759
return0;
759760

761+
match->dev_name=acpi_dev_name(adev);
762+
760763
if (match->hrv==-1)
761764
return1;
762765

@@ -789,20 +792,44 @@ static int acpi_dev_present_cb(struct device *dev, void *data)
789792
*/
790793
boolacpi_dev_present(constchar*hid,constchar*uid,s64hrv)
791794
{
792-
structacpi_dev_present_infomatch= {};
795+
structacpi_dev_match_infomatch= {};
793796
structdevice*dev;
794797

795798
strlcpy(match.hid[0].id,hid,sizeof(match.hid[0].id));
796799
match.uid=uid;
797800
match.hrv=hrv;
798801

799-
dev=bus_find_device(&acpi_bus_type,NULL,&match,
800-
acpi_dev_present_cb);
801-
802+
dev=bus_find_device(&acpi_bus_type,NULL,&match,acpi_dev_match_cb);
802803
return !!dev;
803804
}
804805
EXPORT_SYMBOL(acpi_dev_present);
805806

807+
/**
808+
* acpi_dev_get_first_match_name - Return name of first match of ACPI device
809+
* @hid: Hardware ID of the device.
810+
* @uid: Unique ID of the device, pass NULL to not check _UID
811+
* @hrv: Hardware Revision of the device, pass -1 to not check _HRV
812+
*
813+
* Return device name if a matching device was present
814+
* at the moment of invocation, or NULL otherwise.
815+
*
816+
* See additional information in acpi_dev_present() as well.
817+
*/
818+
constchar*
819+
acpi_dev_get_first_match_name(constchar*hid,constchar*uid,s64hrv)
820+
{
821+
structacpi_dev_match_infomatch= {};
822+
structdevice*dev;
823+
824+
strlcpy(match.hid[0].id,hid,sizeof(match.hid[0].id));
825+
match.uid=uid;
826+
match.hrv=hrv;
827+
828+
dev=bus_find_device(&acpi_bus_type,NULL,&match,acpi_dev_match_cb);
829+
returndev ?match.dev_name :NULL;
830+
}
831+
EXPORT_SYMBOL(acpi_dev_get_first_match_name);
832+
806833
/*
807834
* acpi_backlight= handling, this is done here rather then in video_detect.c
808835
* because __setup cannot be used in modules.

‎drivers/gpio/gpio-merrifield.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* published by the Free Software Foundation.
1010
*/
1111

12+
#include<linux/acpi.h>
1213
#include<linux/bitops.h>
1314
#include<linux/gpio/driver.h>
1415
#include<linux/init.h>
@@ -380,9 +381,16 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
380381
}
381382
}
382383

384+
staticconstchar*mrfld_gpio_get_pinctrl_dev_name(void)
385+
{
386+
constchar*dev_name=acpi_dev_get_first_match_name("INTC1002",NULL,-1);
387+
returndev_name ?dev_name :"pinctrl-merrifield";
388+
}
389+
383390
staticintmrfld_gpio_probe(structpci_dev*pdev,conststructpci_device_id*id)
384391
{
385392
conststructmrfld_gpio_pinrange*range;
393+
constchar*pinctrl_dev_name;
386394
structmrfld_gpio*priv;
387395
u32gpio_base,irq_base;
388396
void__iomem*base;
@@ -439,10 +447,11 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
439447
returnretval;
440448
}
441449

450+
pinctrl_dev_name=mrfld_gpio_get_pinctrl_dev_name();
442451
for (i=0;i<ARRAY_SIZE(mrfld_gpio_ranges);i++) {
443452
range=&mrfld_gpio_ranges[i];
444453
retval=gpiochip_add_pin_range(&priv->chip,
445-
"pinctrl-merrifield",
454+
pinctrl_dev_name,
446455
range->gpio_base,
447456
range->pin_base,
448457
range->npins);

‎include/acpi/acpi_bus.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
9191
boolacpi_dev_found(constchar*hid);
9292
boolacpi_dev_present(constchar*hid,constchar*uid,s64hrv);
9393

94+
constchar*
95+
acpi_dev_get_first_match_name(constchar*hid,constchar*uid,s64hrv);
96+
9497
#ifdefCONFIG_ACPI
9598

9699
#include<linux/proc_fs.h>

‎include/linux/acpi.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
640640
return false;
641641
}
642642

643+
staticinlineconstchar*
644+
acpi_dev_get_first_match_name(constchar*hid,constchar*uid,s64hrv)
645+
{
646+
returnNULL;
647+
}
648+
643649
staticinlineboolis_acpi_node(structfwnode_handle*fwnode)
644650
{
645651
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp