public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Lennart Poettering <mzxreary@0pointer.de>
Cc: Chun-Yi <jlee@novell.com>, linux-kernel@vger.kernel.org
Subject: [02/02] msi-laptop: Add threeg sysfs file for support query 3G state by standard 66/62 ec command
Date: Fri, 15 Jan 2010 15:48:28 -0800	[thread overview]
Message-ID: <20100115234828.GC22890@kroah.com> (raw)
In-Reply-To: <20100115234710.GA22890@kroah.com>

From: Lee, Chun-Yi <jlee@novell.com>

Add threeg sysfs file for support query 3G state by standard 66/62 ec
command, the MSI standard ec interface supported this feature.

Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Cc: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -70,6 +70,7 @@
 #define MSI_STANDARD_EC_BLUETOOTH_MASK	(1 << 0)
 #define MSI_STANDARD_EC_WEBCAM_MASK	(1 << 1)
 #define MSI_STANDARD_EC_WLAN_MASK	(1 << 3)
+#define MSI_STANDARD_EC_3G_MASK		(1 << 4)
 
 static int force;
 module_param(force, bool, 0);
@@ -80,7 +81,7 @@ module_param(auto_brightness, int, 0);
 MODULE_PARM_DESC(auto_brightness, "Enable automatic brightness control (0: disabled; 1: enabled; 2: don't touch)");
 
 static bool old_ec_model;
-static int wlan_s, bluetooth_s;
+static int wlan_s, bluetooth_s, threeg_s;
 
 /* Hardware access */
 
@@ -169,6 +170,8 @@ static int get_wireless_state_ec_standard(void)
 
 	bluetooth_s = !!(rdata & MSI_STANDARD_EC_BLUETOOTH_MASK);
 
+	threeg_s = !!(rdata & MSI_STANDARD_EC_3G_MASK);
+
 	return 0;
 }
 
@@ -230,6 +233,23 @@ static ssize_t show_bluetooth(struct device *dev,
 	return sprintf(buf, "%i\n", enabled);
 }
 
+static ssize_t show_threeg(struct device *dev,
+	struct device_attribute *attr, char *buf)
+{
+
+	int ret;
+
+	/* old msi ec not support 3G */
+	if (old_ec_model)
+		return -1;
+
+	ret = get_wireless_state_ec_standard();
+	if (ret < 0)
+		return ret;
+
+	return sprintf(buf, "%i\n", threeg_s);
+}
+
 static ssize_t show_lcd_level(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
@@ -292,6 +312,7 @@ static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
 static DEVICE_ATTR(auto_brightness, 0644, show_auto_brightness, store_auto_brightness);
 static DEVICE_ATTR(bluetooth, 0444, show_bluetooth, NULL);
 static DEVICE_ATTR(wlan, 0444, show_wlan, NULL);
+static DEVICE_ATTR(threeg, 0444, show_threeg, NULL);
 
 static struct attribute *msipf_attributes[] = {
 	&dev_attr_lcd_level.attr,
@@ -412,6 +433,12 @@ static int __init msi_init(void)
 	if (ret)
 		goto fail_platform_device2;
 
+	if (!old_ec_model) {
+		ret = device_create_file(&msipf_device->dev, &dev_attr_threeg);
+		if (ret)
+			goto fail_platform_device2;
+	}
+
 	/* Disable automatic brightness control by default because
 	 * this module was probably loaded to do brightness control in
 	 * software. */
@@ -446,6 +473,8 @@ static void __exit msi_cleanup(void)
 {
 
 	sysfs_remove_group(&msipf_device->dev.kobj, &msipf_attribute_group);
+	if (!old_ec_model)
+		device_remove_file(&msipf_device->dev, &dev_attr_threeg);
 	platform_device_unregister(msipf_device);
 	platform_driver_unregister(&msipf_driver);
 	backlight_device_unregister(msibl_device);
-- 
1.6.0.2


  parent reply	other threads:[~2010-01-15 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-15 23:47 [00/02] msi-laptop patches for N034 laptop Greg KH
2010-01-15 23:47 ` [01/02] msi-laptop: Support standard ec 66/62 command on MSI notebook and nebook Greg KH
2010-01-15 23:48 ` Greg KH [this message]
2010-01-16  2:33 ` [00/02] msi-laptop patches for N034 laptop Lennart Poettering
2010-01-16  3:30   ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100115234828.GC22890@kroah.com \
    --to=greg@kroah.com \
    --cc=jlee@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mzxreary@0pointer.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox