|
@@ -35,10 +35,15 @@
|
|
|
|
|
|
#define IDEAPAD_RFKILL_DEV_NUM (3)
|
|
#define IDEAPAD_RFKILL_DEV_NUM (3)
|
|
|
|
|
|
|
|
+#define CFG_BT_BIT (16)
|
|
|
|
+#define CFG_3G_BIT (17)
|
|
|
|
+#define CFG_WIFI_BIT (18)
|
|
|
|
+
|
|
struct ideapad_private {
|
|
struct ideapad_private {
|
|
struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
|
|
struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
|
|
struct platform_device *platform_device;
|
|
struct platform_device *platform_device;
|
|
struct input_dev *inputdev;
|
|
struct input_dev *inputdev;
|
|
|
|
+ unsigned long cfg;
|
|
};
|
|
};
|
|
|
|
|
|
static acpi_handle ideapad_handle;
|
|
static acpi_handle ideapad_handle;
|
|
@@ -155,7 +160,7 @@ static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * camera power
|
|
|
|
|
|
+ * sysfs
|
|
*/
|
|
*/
|
|
static ssize_t show_ideapad_cam(struct device *dev,
|
|
static ssize_t show_ideapad_cam(struct device *dev,
|
|
struct device_attribute *attr,
|
|
struct device_attribute *attr,
|
|
@@ -186,6 +191,27 @@ static ssize_t store_ideapad_cam(struct device *dev,
|
|
|
|
|
|
static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
|
|
static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
|
|
|
|
|
|
|
|
+static ssize_t show_ideapad_cfg(struct device *dev,
|
|
|
|
+ struct device_attribute *attr,
|
|
|
|
+ char *buf)
|
|
|
|
+{
|
|
|
|
+ struct ideapad_private *priv = dev_get_drvdata(dev);
|
|
|
|
+
|
|
|
|
+ return sprintf(buf, "0x%.8lX\n", priv->cfg);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static DEVICE_ATTR(cfg, 0444, show_ideapad_cfg, NULL);
|
|
|
|
+
|
|
|
|
+static struct attribute *ideapad_attributes[] = {
|
|
|
|
+ &dev_attr_camera_power.attr,
|
|
|
|
+ &dev_attr_cfg.attr,
|
|
|
|
+ NULL
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct attribute_group ideapad_attribute_group = {
|
|
|
|
+ .attrs = ideapad_attributes
|
|
|
|
+};
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Rfkill
|
|
* Rfkill
|
|
*/
|
|
*/
|
|
@@ -197,9 +223,9 @@ struct ideapad_rfk_data {
|
|
};
|
|
};
|
|
|
|
|
|
const struct ideapad_rfk_data ideapad_rfk_data[] = {
|
|
const struct ideapad_rfk_data ideapad_rfk_data[] = {
|
|
- { "ideapad_wlan", 18, 0x15, RFKILL_TYPE_WLAN },
|
|
|
|
- { "ideapad_bluetooth", 16, 0x17, RFKILL_TYPE_BLUETOOTH },
|
|
|
|
- { "ideapad_3g", 17, 0x20, RFKILL_TYPE_WWAN },
|
|
|
|
|
|
+ { "ideapad_wlan", CFG_WIFI_BIT, 0x15, RFKILL_TYPE_WLAN },
|
|
|
|
+ { "ideapad_bluetooth", CFG_BT_BIT, 0x17, RFKILL_TYPE_BLUETOOTH },
|
|
|
|
+ { "ideapad_3g", CFG_3G_BIT, 0x20, RFKILL_TYPE_WWAN },
|
|
};
|
|
};
|
|
|
|
|
|
static int ideapad_rfk_set(void *data, bool blocked)
|
|
static int ideapad_rfk_set(void *data, bool blocked)
|
|
@@ -280,15 +306,6 @@ static void __devexit ideapad_unregister_rfkill(struct acpi_device *adevice,
|
|
/*
|
|
/*
|
|
* Platform device
|
|
* Platform device
|
|
*/
|
|
*/
|
|
-static struct attribute *ideapad_attributes[] = {
|
|
|
|
- &dev_attr_camera_power.attr,
|
|
|
|
- NULL
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
-static struct attribute_group ideapad_attribute_group = {
|
|
|
|
- .attrs = ideapad_attributes
|
|
|
|
-};
|
|
|
|
-
|
|
|
|
static int __devinit ideapad_platform_init(struct ideapad_private *priv)
|
|
static int __devinit ideapad_platform_init(struct ideapad_private *priv)
|
|
{
|
|
{
|
|
int result;
|
|
int result;
|
|
@@ -393,10 +410,11 @@ MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
|
|
|
|
|
|
static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
|
|
static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
|
|
{
|
|
{
|
|
- int ret, i, cfg;
|
|
|
|
|
|
+ int ret, i;
|
|
|
|
+ unsigned long cfg;
|
|
struct ideapad_private *priv;
|
|
struct ideapad_private *priv;
|
|
|
|
|
|
- if (read_method_int(adevice->handle, "_CFG", &cfg))
|
|
|
|
|
|
+ if (read_method_int(adevice->handle, "_CFG", (int *)&cfg))
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
|
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
|
@@ -404,6 +422,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
dev_set_drvdata(&adevice->dev, priv);
|
|
dev_set_drvdata(&adevice->dev, priv);
|
|
ideapad_handle = adevice->handle;
|
|
ideapad_handle = adevice->handle;
|
|
|
|
+ priv->cfg = cfg;
|
|
|
|
|
|
ret = ideapad_platform_init(priv);
|
|
ret = ideapad_platform_init(priv);
|
|
if (ret)
|
|
if (ret)
|
|
@@ -414,7 +433,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
|
|
goto input_failed;
|
|
goto input_failed;
|
|
|
|
|
|
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
|
|
for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
|
|
- if (test_bit(ideapad_rfk_data[i].cfgbit, (unsigned long *)&cfg))
|
|
|
|
|
|
+ if (test_bit(ideapad_rfk_data[i].cfgbit, &cfg))
|
|
ideapad_register_rfkill(adevice, i);
|
|
ideapad_register_rfkill(adevice, i);
|
|
else
|
|
else
|
|
priv->rfk[i] = NULL;
|
|
priv->rfk[i] = NULL;
|