From: Mattia Dongili <malattia@linux.it>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: platform-driver-x86@vger.kernel.org,
Javier Achirica <jachirica@gmail.com>,
Mattia Dongili <malattia@linux.it>
Subject: [PATCH 03/11] sony-laptop: add panel_id function
Date: Fri, 21 Mar 2014 08:01:14 +0900 [thread overview]
Message-ID: <1395356482-7446-4-git-send-email-malattia@linux.it> (raw)
In-Reply-To: <1395356482-7446-1-git-send-email-malattia@linux.it>
From: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Javier Achirica <jachirica@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
---
drivers/platform/x86/sony-laptop.c | 59 ++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index de17390..d1f712e 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -164,6 +164,9 @@ static int __sony_nc_gfx_switch_status_get(void);
static int sony_nc_highspeed_charging_setup(struct platform_device *pd);
static void sony_nc_highspeed_charging_cleanup(struct platform_device *pd);
+static int sony_nc_panelid_setup(struct platform_device *pd);
+static void sony_nc_panelid_cleanup(struct platform_device *pd);
+
static int sony_nc_touchpad_setup(struct platform_device *pd,
unsigned int handle);
static void sony_nc_touchpad_cleanup(struct platform_device *pd);
@@ -1385,6 +1388,12 @@ static void sony_nc_function_setup(struct acpi_device *device,
pr_err("couldn't set up keyboard backlight function (%d)\n",
result);
break;
+ case 0x011D:
+ result = sony_nc_panelid_setup(pf_device);
+ if (result)
+ pr_err("couldn't set up panel ID function (%d)\n",
+ result);
+ break;
default:
continue;
}
@@ -1449,6 +1458,9 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
case 0x0163:
sony_nc_kbd_backlight_cleanup(pd, handle);
break;
+ case 0x011D:
+ sony_nc_panelid_cleanup(pd);
+ break;
default:
continue;
}
@@ -2540,6 +2552,53 @@ static void sony_nc_highspeed_charging_cleanup(struct platform_device *pd)
}
}
+/* Panel ID function */
+static struct device_attribute *panel_handle;
+
+static ssize_t sony_nc_panelid_show(struct device *dev,
+ struct device_attribute *attr, char *buffer)
+{
+ unsigned int result;
+
+ if (sony_call_snc_handle(0x011D, 0x0000, &result))
+ return -EIO;
+
+ return snprintf(buffer, PAGE_SIZE, "%d\n", result);
+}
+
+static int sony_nc_panelid_setup(struct platform_device *pd)
+{
+ unsigned int result;
+
+ panel_handle = kzalloc(sizeof(struct device_attribute), GFP_KERNEL);
+ if (!panel_handle)
+ return -ENOMEM;
+
+ sysfs_attr_init(&panel_handle->attr);
+ panel_handle->attr.name = "panel_id";
+ panel_handle->attr.mode = S_IRUGO;
+ panel_handle->show = sony_nc_panelid_show;
+ panel_handle->store = NULL;
+
+ result = device_create_file(&pd->dev, panel_handle);
+ if (result) {
+ kfree(panel_handle);
+ panel_handle = NULL;
+ return result;
+ }
+
+ return 0;
+}
+
+static void sony_nc_panelid_cleanup(struct platform_device *pd)
+{
+ if (panel_handle) {
+ device_remove_file(&pd->dev, panel_handle);
+ kfree(panel_handle);
+ panel_handle = NULL;
+ }
+}
+
/* Touchpad enable/disable */
struct touchpad_control {
struct device_attribute attr;
--
1.9.0
next prev parent reply other threads:[~2014-03-20 23:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 23:01 [PATCH 00/11] ALS and other new functions Mattia Dongili
2014-03-20 23:01 ` [PATCH 01/11] sony-laptop: add support as Fn+1 as a hot key Mattia Dongili
2014-03-20 23:01 ` [PATCH 02/11] sony-laptop: Add support for lid resume settings on Vaio Pro Mattia Dongili
2014-03-20 23:01 ` Mattia Dongili [this message]
2014-03-20 23:01 ` [PATCH 04/11] sony-laptop: add usb charge function Mattia Dongili
2014-03-20 23:01 ` [PATCH 05/11] sony-laptop: add fan speed regulation function Mattia Dongili
2014-03-20 23:01 ` [PATCH 06/11] sony-laptop: add hibernate on low battery function Mattia Dongili
2014-03-20 23:01 ` [PATCH 07/11] sony-laptop: adjust keyboard backlight values for off/auto/on Mattia Dongili
2014-03-20 23:01 ` [PATCH 08/11] sony-laptop: add smart connect control function Mattia Dongili
2014-03-20 23:01 ` [PATCH 09/11] backlight: introduce inter-driver notification of changes Mattia Dongili
[not found] ` <1395356482-7446-1-git-send-email-malattia-k2GhghHVRtY@public.gmane.org>
2014-03-20 23:01 ` [PATCH 10/11] sony-laptop: als support Mattia Dongili
2014-03-23 19:32 ` Jonathan Cameron
2014-03-24 23:06 ` Mattia Dongili
2014-03-25 6:50 ` Jonathan Cameron
2014-03-25 6:50 ` Jonathan Cameron
2014-03-25 11:57 ` Javier Achirica
2014-03-20 23:01 ` [PATCH 11/11] sony-laptop: remove useless sony-laptop versioning Mattia Dongili
2014-03-27 21:23 ` [PATCH 00/11] ALS and other new functions Mattia Dongili
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=1395356482-7446-4-git-send-email-malattia@linux.it \
--to=malattia@linux.it \
--cc=jachirica@gmail.com \
--cc=mjg59@srcf.ucam.org \
--cc=platform-driver-x86@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.