public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ideapad: Use define for cfg bits
@ 2011-06-02  9:22 Ike Panhc
  2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
  2011-06-02  9:24 ` [PATCH 3/3] ideapad: Show negative when no camera Ike Panhc
  0 siblings, 2 replies; 9+ messages in thread
From: Ike Panhc @ 2011-06-02  9:22 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: Matthew Garrett

instead of hard code the number.

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 drivers/platform/x86/ideapad-laptop.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index bfdda33..a5c0efa 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -35,10 +35,15 @@
 
 #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 rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
 	struct platform_device *platform_device;
 	struct input_dev *inputdev;
+	unsigned long	cfg;
 };
 
 static acpi_handle ideapad_handle;
@@ -197,9 +202,9 @@ struct 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)
@@ -393,10 +398,11 @@ MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
 
 static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
 {
-	int ret, i, cfg;
+	int ret, i;
+	unsigned long cfg;
 	struct ideapad_private *priv;
 
-	if (read_method_int(adevice->handle, "_CFG", &cfg))
+	if (read_method_int(adevice->handle, "_CFG", (int *)&cfg))
 		return -ENODEV;
 
 	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -404,6 +410,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
 		return -ENOMEM;
 	dev_set_drvdata(&adevice->dev, priv);
 	ideapad_handle = adevice->handle;
+	priv->cfg = cfg;
 
 	ret = ideapad_platform_init(priv);
 	if (ret)
@@ -414,7 +421,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
 		goto input_failed;
 
 	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);
 		else
 			priv->rfk[i] = NULL;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] ideapad: Add nodes in sysfs
  2011-06-02  9:22 [PATCH 1/3] ideapad: Use define for cfg bits Ike Panhc
@ 2011-06-02  9:24 ` Ike Panhc
  2011-06-02  9:48   ` Corentin Chary
  2011-06-03 20:21   ` Dmitry Torokhov
  2011-06-02  9:24 ` [PATCH 3/3] ideapad: Show negative when no camera Ike Panhc
  1 sibling, 2 replies; 9+ messages in thread
From: Ike Panhc @ 2011-06-02  9:24 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel, linux-doc
  Cc: Matthew Garrett, Randy Dunlap

Create the following nodes in sysfs
	/sys/devices/platform/ideapad/brightness
	/sys/devices/platform/ideapad/touchpad
	/sys/devices/platform/ideapad/cfg
	/sys/devices/platform/ideapad/backlight

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 .../ABI/testing/sysfs-platform-ideapad-laptop      |   30 +++++
 drivers/platform/x86/ideapad-laptop.c              |  128 +++++++++++++++++---
 2 files changed, 140 insertions(+), 18 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-platform-ideapad-laptop b/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
index 807fca2..869f0c4 100644
--- a/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
+++ b/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
@@ -4,3 +4,33 @@ KernelVersion:	2.6.37
 Contact:	"Ike Panhc <ike.pan@canonical.com>"
 Description:
 		Control the power of camera module. 1 means on, 0 means off.
+
+What:		/sys/devices/platform/ideapad/brightness
+Date:		Jun 2011
+KernelVersion:	3.0.1
+Contact:	"Ike Panhc <ike.pan@canonical.com>"
+Description:
+		Brightness control. When reading, it shows <current>/<max>.
+		When writing, it accepts new brightness value.
+
+What:		/sys/devices/platform/ideapad/touchpad
+Date:		Jun 2011
+KernelVersion:	3.0.1
+Contact:	"Ike Panhc <ike.pan@canonical.com>"
+Description:
+		Control the power of touchpad. 1 means on, 0 means off.
+
+What:		/sys/devices/platform/ideapad/cfg
+Date:		Jun 2011
+KernelVersion:	3.0.1
+Contact:	"Ike Panhc <ike.pan@canonical.com>"
+Description:
+		Ideapad capability bits.
+
+What:		/sys/devices/platform/ideapad/backlight
+Date:		Jun 2011
+KernelVersion:	3.0.1
+Contact:	"Ike Panhc <ike.pan@canonical.com>"
+Description:
+		Control the power of backlight. 1 means on, 0 means off.
+
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index a5c0efa..9c09891 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -160,22 +160,25 @@ static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data)
 }
 
 /*
- * camera power
+ * sysfs helper
  */
-static ssize_t show_ideapad_cam(struct device *dev,
-				struct device_attribute *attr,
-				char *buf)
+static ssize_t show_ideapad_helper(struct device *dev,
+				   struct device_attribute *attr,
+				   char *buf,
+				   int cmd)
 {
 	unsigned long result;
 
-	if (read_ec_data(ideapad_handle, 0x1D, &result))
+	if (read_ec_data(ideapad_handle, cmd, &result))
 		return sprintf(buf, "-1\n");
 	return sprintf(buf, "%lu\n", result);
 }
 
-static ssize_t store_ideapad_cam(struct device *dev,
-				 struct device_attribute *attr,
-				 const char *buf, size_t count)
+static ssize_t store_ideapad_helper(struct device *dev,
+				    struct device_attribute *attr,
+				    const char *buf,
+				    size_t count,
+				    int cmd)
 {
 	int ret, state;
 
@@ -183,14 +186,112 @@ static ssize_t store_ideapad_cam(struct device *dev,
 		return 0;
 	if (sscanf(buf, "%i", &state) != 1)
 		return -EINVAL;
-	ret = write_ec_cmd(ideapad_handle, 0x1E, state);
+	ret = write_ec_cmd(ideapad_handle, cmd, state);
 	if (ret < 0)
 		return ret;
 	return count;
 }
 
+/*
+ * sysfs node
+ */
+static ssize_t show_ideapad_cam(struct device *dev,
+				struct device_attribute *attr,
+				char *buf)
+{
+	return show_ideapad_helper(dev, attr, buf, 0x1D);
+}
+
+static ssize_t store_ideapad_cam(struct device *dev,
+				 struct device_attribute *attr,
+				 const char *buf, size_t count)
+{
+	return store_ideapad_helper(dev, attr, buf, count, 0x1E);
+}
+
 static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
 
+static ssize_t show_ideapad_touchpad(struct device *dev,
+				     struct device_attribute *attr,
+				     char *buf)
+{
+	return show_ideapad_helper(dev, attr, buf, 0x1B);
+}
+
+static ssize_t store_ideapad_touchpad(struct device *dev,
+				      struct device_attribute *attr,
+				      const char *buf, size_t count)
+{
+	return store_ideapad_helper(dev, attr, buf, count, 0x1C);
+}
+
+static DEVICE_ATTR(touchpad, 0644, show_ideapad_touchpad,
+		   store_ideapad_touchpad);
+
+static ssize_t show_ideapad_brightness(struct device *dev,
+				       struct device_attribute *attr,
+				       char *buf)
+{
+	unsigned long now, max;
+
+	if (read_ec_data(ideapad_handle, 0x11, &max))
+		max = -1;
+	if (read_ec_data(ideapad_handle, 0x12, &now))
+		now = -1;
+	return sprintf(buf, "%lu/%lu\n", now, max);
+}
+
+static ssize_t store_ideapad_brightness(struct device *dev,
+					struct device_attribute *attr,
+					const char *buf, size_t count)
+{
+	return store_ideapad_helper(dev, attr, buf, count, 0x13);
+}
+
+static DEVICE_ATTR(brightness, 0644, show_ideapad_brightness,
+		   store_ideapad_brightness);
+
+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%.8X\n", (unsigned int)(priv->cfg));
+}
+
+static DEVICE_ATTR(cfg, 0444, show_ideapad_cfg, NULL);
+
+static ssize_t show_ideapad_backlight(struct device *dev,
+				      struct device_attribute *attr,
+				      char *buf)
+{
+	return show_ideapad_helper(dev, attr, buf, 0x18);
+}
+
+static ssize_t store_ideapad_backlight(struct device *dev,
+				       struct device_attribute *attr,
+				       const char *buf, size_t count)
+{
+	return store_ideapad_helper(dev, attr, buf, count, 0x33);
+}
+
+static DEVICE_ATTR(backlight, 0644, show_ideapad_backlight,
+		   store_ideapad_backlight);
+
+static struct attribute *ideapad_attributes[] = {
+	&dev_attr_camera_power.attr,
+	&dev_attr_brightness.attr,
+	&dev_attr_touchpad.attr,
+	&dev_attr_cfg.attr,
+	&dev_attr_backlight.attr,
+	NULL
+};
+
+static struct attribute_group ideapad_attribute_group = {
+	.attrs = ideapad_attributes
+};
+
 /*
  * Rfkill
  */
@@ -285,15 +386,6 @@ static void __devexit ideapad_unregister_rfkill(struct acpi_device *adevice,
 /*
  * 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)
 {
 	int result;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] ideapad: Show negative when no camera
  2011-06-02  9:22 [PATCH 1/3] ideapad: Use define for cfg bits Ike Panhc
  2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
@ 2011-06-02  9:24 ` Ike Panhc
  2011-06-02  9:43   ` Corentin Chary
  1 sibling, 1 reply; 9+ messages in thread
From: Ike Panhc @ 2011-06-02  9:24 UTC (permalink / raw)
  To: platform-driver-x86, linux-kernel; +Cc: Matthew Garrett

Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 drivers/platform/x86/ideapad-laptop.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 9c09891..4a54ed1 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -38,6 +38,7 @@
 #define CFG_BT_BIT	(16)
 #define CFG_3G_BIT	(17)
 #define CFG_WIFI_BIT	(18)
+#define CFG_CAMERA_BIT	(19)
 
 struct ideapad_private {
 	struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
@@ -199,6 +200,10 @@ static ssize_t show_ideapad_cam(struct device *dev,
 				struct device_attribute *attr,
 				char *buf)
 {
+	struct ideapad_private *priv = dev_get_drvdata(dev);
+
+	if (!test_bit(CFG_CAMERA_BIT, &(priv->cfg)))
+		return sprintf(buf, "-1\n");
 	return show_ideapad_helper(dev, attr, buf, 0x1D);
 }
 
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] ideapad: Show negative when no camera
  2011-06-02  9:24 ` [PATCH 3/3] ideapad: Show negative when no camera Ike Panhc
@ 2011-06-02  9:43   ` Corentin Chary
  2011-06-02 10:17     ` Ike Panhc
  0 siblings, 1 reply; 9+ messages in thread
From: Corentin Chary @ 2011-06-02  9:43 UTC (permalink / raw)
  To: Ike Panhc; +Cc: platform-driver-x86, linux-kernel, Matthew Garrett

On Thu, Jun 2, 2011 at 11:24 AM, Ike Panhc <ike.pan@canonical.com> wrote:
> Signed-off-by: Ike Panhc <ike.pan@canonical.com>
> ---
>  drivers/platform/x86/ideapad-laptop.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 9c09891..4a54ed1 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -38,6 +38,7 @@
>  #define CFG_BT_BIT     (16)
>  #define CFG_3G_BIT     (17)
>  #define CFG_WIFI_BIT   (18)
> +#define CFG_CAMERA_BIT (19)
>
>  struct ideapad_private {
>        struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
> @@ -199,6 +200,10 @@ static ssize_t show_ideapad_cam(struct device *dev,
>                                struct device_attribute *attr,
>                                char *buf)
>  {
> +       struct ideapad_private *priv = dev_get_drvdata(dev);
> +
> +       if (!test_bit(CFG_CAMERA_BIT, &(priv->cfg)))
> +               return sprintf(buf, "-1\n");
>        return show_ideapad_helper(dev, attr, buf, 0x1D);
>  }
>
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

I think it would be better to not add the file when the camera is not
available. Another option is to return -ENODEV. But printing -1
doesn't seems right.

-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] ideapad: Add nodes in sysfs
  2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
@ 2011-06-02  9:48   ` Corentin Chary
  2011-06-02 10:14     ` Ike Panhc
  2011-06-03 20:21   ` Dmitry Torokhov
  1 sibling, 1 reply; 9+ messages in thread
From: Corentin Chary @ 2011-06-02  9:48 UTC (permalink / raw)
  To: Ike Panhc
  Cc: platform-driver-x86, linux-kernel, linux-doc, Matthew Garrett,
	Randy Dunlap

On Thu, Jun 2, 2011 at 11:24 AM, Ike Panhc <ike.pan@canonical.com> wrote:
> Create the following nodes in sysfs
>        /sys/devices/platform/ideapad/brightness
>        /sys/devices/platform/ideapad/touchpad
>        /sys/devices/platform/ideapad/cfg
>        /sys/devices/platform/ideapad/backlight
>
> Signed-off-by: Ike Panhc <ike.pan@canonical.com>
> ---
>  .../ABI/testing/sysfs-platform-ideapad-laptop      |   30 +++++
>  drivers/platform/x86/ideapad-laptop.c              |  128 +++++++++++++++++---
>  2 files changed, 140 insertions(+), 18 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-platform-ideapad-laptop b/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
> index 807fca2..869f0c4 100644
> --- a/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
> +++ b/Documentation/ABI/testing/sysfs-platform-ideapad-laptop
> @@ -4,3 +4,33 @@ KernelVersion: 2.6.37
>  Contact:       "Ike Panhc <ike.pan@canonical.com>"
>  Description:
>                Control the power of camera module. 1 means on, 0 means off.
> +
> +What:          /sys/devices/platform/ideapad/brightness
> +Date:          Jun 2011
> +KernelVersion: 3.0.1
> +Contact:       "Ike Panhc <ike.pan@canonical.com>"
> +Description:
> +               Brightness control. When reading, it shows <current>/<max>.
> +               When writing, it accepts new brightness value.
> +
> +What:          /sys/devices/platform/ideapad/touchpad
> +Date:          Jun 2011
> +KernelVersion: 3.0.1
> +Contact:       "Ike Panhc <ike.pan@canonical.com>"
> +Description:
> +               Control the power of touchpad. 1 means on, 0 means off.
> +
> +What:          /sys/devices/platform/ideapad/cfg
> +Date:          Jun 2011
> +KernelVersion: 3.0.1
> +Contact:       "Ike Panhc <ike.pan@canonical.com>"
> +Description:
> +               Ideapad capability bits.
> +
> +What:          /sys/devices/platform/ideapad/backlight
> +Date:          Jun 2011
> +KernelVersion: 3.0.1
> +Contact:       "Ike Panhc <ike.pan@canonical.com>"
> +Description:
> +               Control the power of backlight. 1 means on, 0 means off.
> +
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index a5c0efa..9c09891 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -160,22 +160,25 @@ static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data)
>  }
>
>  /*
> - * camera power
> + * sysfs helper
>  */
> -static ssize_t show_ideapad_cam(struct device *dev,
> -                               struct device_attribute *attr,
> -                               char *buf)
> +static ssize_t show_ideapad_helper(struct device *dev,
> +                                  struct device_attribute *attr,
> +                                  char *buf,
> +                                  int cmd)
>  {
>        unsigned long result;
>
> -       if (read_ec_data(ideapad_handle, 0x1D, &result))
> +       if (read_ec_data(ideapad_handle, cmd, &result))
>                return sprintf(buf, "-1\n");
>        return sprintf(buf, "%lu\n", result);
>  }
>
> -static ssize_t store_ideapad_cam(struct device *dev,
> -                                struct device_attribute *attr,
> -                                const char *buf, size_t count)
> +static ssize_t store_ideapad_helper(struct device *dev,
> +                                   struct device_attribute *attr,
> +                                   const char *buf,
> +                                   size_t count,
> +                                   int cmd)
>  {
>        int ret, state;
>
> @@ -183,14 +186,112 @@ static ssize_t store_ideapad_cam(struct device *dev,
>                return 0;
>        if (sscanf(buf, "%i", &state) != 1)
>                return -EINVAL;
> -       ret = write_ec_cmd(ideapad_handle, 0x1E, state);
> +       ret = write_ec_cmd(ideapad_handle, cmd, state);
>        if (ret < 0)
>                return ret;
>        return count;
>  }
>
> +/*
> + * sysfs node
> + */
> +static ssize_t show_ideapad_cam(struct device *dev,
> +                               struct device_attribute *attr,
> +                               char *buf)
> +{
> +       return show_ideapad_helper(dev, attr, buf, 0x1D);
> +}
> +
> +static ssize_t store_ideapad_cam(struct device *dev,
> +                                struct device_attribute *attr,
> +                                const char *buf, size_t count)
> +{
> +       return store_ideapad_helper(dev, attr, buf, count, 0x1E);
> +}
> +
>  static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
>
> +static ssize_t show_ideapad_touchpad(struct device *dev,
> +                                    struct device_attribute *attr,
> +                                    char *buf)
> +{
> +       return show_ideapad_helper(dev, attr, buf, 0x1B);
> +}
> +
> +static ssize_t store_ideapad_touchpad(struct device *dev,
> +                                     struct device_attribute *attr,
> +                                     const char *buf, size_t count)
> +{
> +       return store_ideapad_helper(dev, attr, buf, count, 0x1C);
> +}
> +
> +static DEVICE_ATTR(touchpad, 0644, show_ideapad_touchpad,
> +                  store_ideapad_touchpad);
> +
> +static ssize_t show_ideapad_brightness(struct device *dev,
> +                                      struct device_attribute *attr,
> +                                      char *buf)
> +{
> +       unsigned long now, max;
> +
> +       if (read_ec_data(ideapad_handle, 0x11, &max))
> +               max = -1;
> +       if (read_ec_data(ideapad_handle, 0x12, &now))
> +               now = -1;
> +       return sprintf(buf, "%lu/%lu\n", now, max);
> +}
> +
> +static ssize_t store_ideapad_brightness(struct device *dev,
> +                                       struct device_attribute *attr,
> +                                       const char *buf, size_t count)
> +{
> +       return store_ideapad_helper(dev, attr, buf, count, 0x13);
> +}
> +
> +static DEVICE_ATTR(brightness, 0644, show_ideapad_brightness,
> +                  store_ideapad_brightness);
> +
> +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%.8X\n", (unsigned int)(priv->cfg));
> +}
> +
> +static DEVICE_ATTR(cfg, 0444, show_ideapad_cfg, NULL);
> +
> +static ssize_t show_ideapad_backlight(struct device *dev,
> +                                     struct device_attribute *attr,
> +                                     char *buf)
> +{
> +       return show_ideapad_helper(dev, attr, buf, 0x18);
> +}
> +
> +static ssize_t store_ideapad_backlight(struct device *dev,
> +                                      struct device_attribute *attr,
> +                                      const char *buf, size_t count)
> +{
> +       return store_ideapad_helper(dev, attr, buf, count, 0x33);
> +}
> +
> +static DEVICE_ATTR(backlight, 0644, show_ideapad_backlight,
> +                  store_ideapad_backlight);
> +
> +static struct attribute *ideapad_attributes[] = {
> +       &dev_attr_camera_power.attr,
> +       &dev_attr_brightness.attr,
> +       &dev_attr_touchpad.attr,
> +       &dev_attr_cfg.attr,
> +       &dev_attr_backlight.attr,
> +       NULL
> +};
> +
> +static struct attribute_group ideapad_attribute_group = {
> +       .attrs = ideapad_attributes
> +};
> +
>  /*
>  * Rfkill
>  */
> @@ -285,15 +386,6 @@ static void __devexit ideapad_unregister_rfkill(struct acpi_device *adevice,
>  /*
>  * 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)
>  {
>        int result;
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Hi Ike,
Why do you want to add /sys/devices/platform/ideapad/brightness and
    /sys/devices/platform/ideapad/backlight ?
Both of these files should be handled by the generic backlight class
(using brightness and bl_power).

Also, could you describe what are these "capabilities" in the sysfs doc file ?

Thanks


-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] ideapad: Add nodes in sysfs
  2011-06-02  9:48   ` Corentin Chary
@ 2011-06-02 10:14     ` Ike Panhc
  2011-06-02 11:22       ` Corentin Chary
  0 siblings, 1 reply; 9+ messages in thread
From: Ike Panhc @ 2011-06-02 10:14 UTC (permalink / raw)
  To: Corentin Chary
  Cc: platform-driver-x86, linux-kernel, linux-doc, Matthew Garrett,
	Randy Dunlap

On 06/02/2011 05:48 PM, Corentin Chary wrote:
> Hi Ike,
> Why do you want to add /sys/devices/platform/ideapad/brightness and
>     /sys/devices/platform/ideapad/backlight ?
> Both of these files should be handled by the generic backlight class
> (using brightness and bl_power).

This is within VPC2004. In DSDT they are different device from generic
backlight.

and I try bl_power but can not turning off power of whole LCD. No idea
how screensaver do it, looks like just cut off video signal.
  

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] ideapad: Show negative when no camera
  2011-06-02  9:43   ` Corentin Chary
@ 2011-06-02 10:17     ` Ike Panhc
  0 siblings, 0 replies; 9+ messages in thread
From: Ike Panhc @ 2011-06-02 10:17 UTC (permalink / raw)
  To: Corentin Chary; +Cc: platform-driver-x86, linux-kernel, Matthew Garrett

On 06/02/2011 05:43 PM, Corentin Chary wrote:
> I think it would be better to not add the file when the camera is not
> available. Another option is to return -ENODEV. But printing -1
> doesn't seems right.
> 

Agree, making the node invisible is better.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] ideapad: Add nodes in sysfs
  2011-06-02 10:14     ` Ike Panhc
@ 2011-06-02 11:22       ` Corentin Chary
  0 siblings, 0 replies; 9+ messages in thread
From: Corentin Chary @ 2011-06-02 11:22 UTC (permalink / raw)
  To: Ike Panhc
  Cc: platform-driver-x86, linux-kernel, linux-doc, Matthew Garrett,
	Randy Dunlap

On Thu, Jun 2, 2011 at 12:14 PM, Ike Panhc <ike.pan@canonical.com> wrote:
> On 06/02/2011 05:48 PM, Corentin Chary wrote:
>> Hi Ike,
>> Why do you want to add /sys/devices/platform/ideapad/brightness and
>>     /sys/devices/platform/ideapad/backlight ?
>> Both of these files should be handled by the generic backlight class
>> (using brightness and bl_power).
>
> This is within VPC2004. In DSDT they are different device from generic
> backlight.
>
> and I try bl_power but can not turning off power of whole LCD. No idea
> how screensaver do it, looks like just cut off video signal.

What I wanted to say is that you should use the generic backlight
class (!=driver) to expose these. You can look at asus-wmi.c to see
how it's done.
Then users will be able to choose the backlight implementation using
acpi_backlight=vendor or acpi_backlight=video.

-- 
Corentin Chary
http://xf.iksaif.net

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] ideapad: Add nodes in sysfs
  2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
  2011-06-02  9:48   ` Corentin Chary
@ 2011-06-03 20:21   ` Dmitry Torokhov
  1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2011-06-03 20:21 UTC (permalink / raw)
  To: Ike Panhc
  Cc: platform-driver-x86, linux-kernel, linux-doc, Matthew Garrett,
	Randy Dunlap

On Thursday, June 02, 2011 02:24:05 AM Ike Panhc wrote:
> +What:          /sys/devices/platform/ideapad/touchpad
> +Date:          Jun 2011
> +KernelVersion: 3.0.1
> +Contact:       "Ike Panhc <ike.pan@canonical.com>"
> +Description:
> +               Control the power of touchpad. 1 means on, 0 means off.

I do not think that we should be adding attributes like this one.
Is there any way to pug it into device core/PM infrastructure?

Also, what is the driver for having this attribute? Is it power savings
or is it because some people prefer to turn off the touchpad because
it interferes with typing?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-06-03 20:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-02  9:22 [PATCH 1/3] ideapad: Use define for cfg bits Ike Panhc
2011-06-02  9:24 ` [PATCH 2/3] ideapad: Add nodes in sysfs Ike Panhc
2011-06-02  9:48   ` Corentin Chary
2011-06-02 10:14     ` Ike Panhc
2011-06-02 11:22       ` Corentin Chary
2011-06-03 20:21   ` Dmitry Torokhov
2011-06-02  9:24 ` [PATCH 3/3] ideapad: Show negative when no camera Ike Panhc
2011-06-02  9:43   ` Corentin Chary
2011-06-02 10:17     ` Ike Panhc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox