aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-09-20 13:09:26 -0400
committerLen Brown <len.brown@intel.com>2009-09-20 13:48:31 -0400
commit8b468c0c85f41c4c55227c17271b4187d8911fb0 (patch)
tree77e543f876fc0618a96b2217860ee8ed9a37665d /drivers/platform
parent0d922e3b84dc4923fc67901580a3c166006fba7a (diff)
thinkpad-acpi: add internal hotkey event API
Add an internal API to the driver, to allow subdrivers to request and receive HKEY 0x1000 events. This API will be used by the backlight (brightness up/down) and upcoming ALSA mixer (volume up/down/mute) subdrivers. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 50aa4c112b28..ffd584c35808 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2014,6 +2014,9 @@ static u16 *hotkey_keycode_map;
2014 2014
2015static struct attribute_set *hotkey_dev_attributes; 2015static struct attribute_set *hotkey_dev_attributes;
2016 2016
2017static void tpacpi_driver_event(const unsigned int hkey_event);
2018static void hotkey_driver_event(const unsigned int scancode);
2019
2017/* HKEY.MHKG() return bits */ 2020/* HKEY.MHKG() return bits */
2018#define TP_HOTKEY_TABLET_MASK (1 << 3) 2021#define TP_HOTKEY_TABLET_MASK (1 << 3)
2019 2022
@@ -2168,6 +2171,35 @@ static int hotkey_user_mask_set(const u32 mask)
2168 return rc; 2171 return rc;
2169} 2172}
2170 2173
2174/*
2175 * Sets the driver hotkey mask.
2176 *
2177 * Can be called even if the hotkey subdriver is inactive
2178 */
2179static int tpacpi_hotkey_driver_mask_set(const u32 mask)
2180{
2181 int rc;
2182
2183 /* Do the right thing if hotkey_init has not been called yet */
2184 if (!tp_features.hotkey) {
2185 hotkey_driver_mask = mask;
2186 return 0;
2187 }
2188
2189 mutex_lock(&hotkey_mutex);
2190
2191 HOTKEY_CONFIG_CRITICAL_START
2192 hotkey_driver_mask = mask;
2193 hotkey_source_mask |= (mask & ~hotkey_all_mask);
2194 HOTKEY_CONFIG_CRITICAL_END
2195
2196 rc = hotkey_mask_set((hotkey_acpi_mask | hotkey_driver_mask) &
2197 ~hotkey_source_mask);
2198 mutex_unlock(&hotkey_mutex);
2199
2200 return rc;
2201}
2202
2171static int hotkey_status_get(int *status) 2203static int hotkey_status_get(int *status)
2172{ 2204{
2173 if (!acpi_evalf(hkey_handle, status, "DHKC", "d")) 2205 if (!acpi_evalf(hkey_handle, status, "DHKC", "d"))
@@ -2227,6 +2259,7 @@ static void tpacpi_input_send_key(const unsigned int scancode)
2227/* Do NOT call without validating scancode first */ 2259/* Do NOT call without validating scancode first */
2228static void tpacpi_input_send_key_masked(const unsigned int scancode) 2260static void tpacpi_input_send_key_masked(const unsigned int scancode)
2229{ 2261{
2262 hotkey_driver_event(scancode);
2230 if (hotkey_user_mask & (1 << scancode)) 2263 if (hotkey_user_mask & (1 << scancode))
2231 tpacpi_input_send_key(scancode); 2264 tpacpi_input_send_key(scancode);
2232} 2265}
@@ -7625,6 +7658,21 @@ static struct ibm_struct fan_driver_data = {
7625 **************************************************************************** 7658 ****************************************************************************
7626 ****************************************************************************/ 7659 ****************************************************************************/
7627 7660
7661/*
7662 * HKEY event callout for other subdrivers go here
7663 * (yes, it is ugly, but it is quick, safe, and gets the job done
7664 */
7665static void tpacpi_driver_event(const unsigned int hkey_event)
7666{
7667}
7668
7669
7670
7671static void hotkey_driver_event(const unsigned int scancode)
7672{
7673 tpacpi_driver_event(0x1001 + scancode);
7674}
7675
7628/* sysfs name ---------------------------------------------------------- */ 7676/* sysfs name ---------------------------------------------------------- */
7629static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev, 7677static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev,
7630 struct device_attribute *attr, 7678 struct device_attribute *attr,