Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62547
b: refs/heads/master
c: 74941a6
h: refs/heads/master
i:
  62545: 3feab85
  62543: 2c0d82c
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and Len Brown committed Jul 22, 2007
1 parent 46c6cc7 commit 15c9154
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b010de59cb6dcab7e167dd2a0fa5d3b31447fea
refs/heads/master: 74941a69afcc06722685d492784414ec042ab492
6 changes: 6 additions & 0 deletions trunk/Documentation/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ sysfs notes:
supported hot keys, except those which are handled by
the firmware. Echo it to hotkey_mask above, to use.

hotkey_radio_sw:
if the ThinkPad has a hardware radio switch, this
attribute will read 0 if the switch is in the "radios
disabled" postition, and 1 if the switch is in the
"radios enabled" position.


Bluetooth
---------
Expand Down
38 changes: 36 additions & 2 deletions trunk/drivers/misc/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,13 @@ static u32 hotkey_reserved_mask = 0x00778000;

static struct attribute_set *hotkey_dev_attributes;

static int hotkey_get_wlsw(int *status)
{
if (!acpi_evalf(hkey_handle, status, "WLSW", "d"))
return -EIO;
return 0;
}

/* sysfs hotkey enable ------------------------------------------------- */
static ssize_t hotkey_enable_show(struct device *dev,
struct device_attribute *attr,
Expand Down Expand Up @@ -853,6 +860,22 @@ static struct device_attribute dev_attr_hotkey_recommended_mask =
__ATTR(hotkey_recommended_mask, S_IRUGO,
hotkey_recommended_mask_show, NULL);

/* sysfs hotkey radio_sw ----------------------------------------------- */
static ssize_t hotkey_radio_sw_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
int res, s;
res = hotkey_get_wlsw(&s);
if (res < 0)
return res;

return snprintf(buf, PAGE_SIZE, "%d\n", !!s);
}

static struct device_attribute dev_attr_hotkey_radio_sw =
__ATTR(hotkey_radio_sw, S_IRUGO, hotkey_radio_sw_show, NULL);

/* --------------------------------------------------------------------- */

static struct attribute *hotkey_mask_attributes[] = {
Expand All @@ -866,6 +889,7 @@ static struct attribute *hotkey_mask_attributes[] = {
static int __init hotkey_init(struct ibm_init_struct *iibm)
{
int res;
int status;

vdbg_printk(TPACPI_DBG_INIT, "initializing hotkey subdriver\n");

Expand All @@ -879,7 +903,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
str_supported(tp_features.hotkey));

if (tp_features.hotkey) {
hotkey_dev_attributes = create_attr_set(6, NULL);
hotkey_dev_attributes = create_attr_set(7, NULL);
if (!hotkey_dev_attributes)
return -ENOMEM;
res = add_to_attr_set(hotkey_dev_attributes,
Expand Down Expand Up @@ -908,11 +932,21 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
hotkey_mask_attributes,
ARRAY_SIZE(hotkey_mask_attributes));
}

/* Not all thinkpads have a hardware radio switch */
if (!res && acpi_evalf(hkey_handle, &status, "WLSW", "qd")) {
tp_features.hotkey_wlsw = 1;
printk(IBM_INFO
"radio switch found; radios are %s\n",
enabled(status, 0));
res = add_to_attr_set(hotkey_dev_attributes,
&dev_attr_hotkey_radio_sw.attr);
}

if (!res)
res = register_attr_set_with_sysfs(
hotkey_dev_attributes,
&tpacpi_pdev->dev.kobj);

if (res)
return res;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/misc/thinkpad_acpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ static struct {
u16 bluetooth:1;
u16 hotkey:1;
u16 hotkey_mask:1;
u16 hotkey_wlsw:1;
u16 light:1;
u16 light_status:1;
u16 wan:1;
Expand Down

0 comments on commit 15c9154

Please sign in to comment.