diff options
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/Kconfig | 10 | ||||
-rw-r--r-- | drivers/input/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/misc/ati_remote.c | 18 | ||||
-rw-r--r-- | drivers/input/misc/ati_remote2.c | 18 | ||||
-rw-r--r-- | drivers/input/misc/keyspan_remote.c | 20 | ||||
-rw-r--r-- | drivers/input/misc/powermate.c | 6 | ||||
-rw-r--r-- | drivers/input/misc/sgi_btns.c | 178 | ||||
-rw-r--r-- | drivers/input/misc/wistron_btns.c | 19 | ||||
-rw-r--r-- | drivers/input/misc/yealink.c | 50 |
9 files changed, 270 insertions, 50 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 432699d61c5..e99b7882f38 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -189,6 +189,16 @@ config INPUT_UINPUT To compile this driver as a module, choose M here: the module will be called uinput. +config INPUT_SGI_BTNS + tristate "SGI Indy/O2 volume button interface" + depends on SGI_IP22 || SGI_IP32 + select INPUT_POLLDEV + help + Say Y here if you want to support SGI Indy/O2 volume button interface. + + To compile this driver as a module, choose M here: the + module will be called sgi_btns. + config HP_SDC_RTC tristate "HP SDC Real Time Clock" depends on GSC || HP300 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index ebd39f291d2..f48009b5222 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_INPUT_YEALINK) += yealink.o obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o obj-$(CONFIG_INPUT_UINPUT) += uinput.o obj-$(CONFIG_INPUT_APANEL) += apanel.o +obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o diff --git a/drivers/input/misc/ati_remote.c b/drivers/input/misc/ati_remote.c index f3b86c2b079..debfc1af9d9 100644 --- a/drivers/input/misc/ati_remote.c +++ b/drivers/input/misc/ati_remote.c @@ -330,7 +330,7 @@ static int ati_remote_open(struct input_dev *inputdev) ati_remote->irq_urb->dev = ati_remote->udev; if (usb_submit_urb(ati_remote->irq_urb, GFP_KERNEL)) { dev_err(&ati_remote->interface->dev, - "%s: usb_submit_urb failed!\n", __FUNCTION__); + "%s: usb_submit_urb failed!\n", __func__); return -EIO; } @@ -356,7 +356,7 @@ static void ati_remote_irq_out(struct urb *urb) if (urb->status) { dev_dbg(&ati_remote->interface->dev, "%s: status %d\n", - __FUNCTION__, urb->status); + __func__, urb->status); return; } @@ -601,17 +601,17 @@ static void ati_remote_irq_in(struct urb *urb) case -ENOENT: case -ESHUTDOWN: dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", - __FUNCTION__); + __func__); return; default: /* error */ dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", - __FUNCTION__, urb->status); + __func__, urb->status); } retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", - __FUNCTION__, retval); + __func__, retval); } /* @@ -734,7 +734,7 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de int err = -ENOMEM; if (iface_host->desc.bNumEndpoints != 2) { - err("%s: Unexpected desc.bNumEndpoints\n", __FUNCTION__); + err("%s: Unexpected desc.bNumEndpoints\n", __func__); return -ENODEV; } @@ -742,11 +742,11 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de endpoint_out = &iface_host->endpoint[1].desc; if (!usb_endpoint_is_int_in(endpoint_in)) { - err("%s: Unexpected endpoint_in\n", __FUNCTION__); + err("%s: Unexpected endpoint_in\n", __func__); return -ENODEV; } if (le16_to_cpu(endpoint_in->wMaxPacketSize) == 0) { - err("%s: endpoint_in message size==0? \n", __FUNCTION__); + err("%s: endpoint_in message size==0? \n", __func__); return -ENODEV; } @@ -814,7 +814,7 @@ static void ati_remote_disconnect(struct usb_interface *interface) ati_remote = usb_get_intfdata(interface); usb_set_intfdata(interface, NULL); if (!ati_remote) { - warn("%s - null device?\n", __FUNCTION__); + warn("%s - null device?\n", __func__); return; } diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index f2709b82485..a7fabafbd94 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c @@ -137,14 +137,14 @@ static int ati_remote2_open(struct input_dev *idev) r = usb_submit_urb(ar2->urb[0], GFP_KERNEL); if (r) { dev_err(&ar2->intf[0]->dev, - "%s: usb_submit_urb() = %d\n", __FUNCTION__, r); + "%s: usb_submit_urb() = %d\n", __func__, r); return r; } r = usb_submit_urb(ar2->urb[1], GFP_KERNEL); if (r) { usb_kill_urb(ar2->urb[0]); dev_err(&ar2->intf[1]->dev, - "%s: usb_submit_urb() = %d\n", __FUNCTION__, r); + "%s: usb_submit_urb() = %d\n", __func__, r); return r; } @@ -294,17 +294,17 @@ static void ati_remote2_complete_mouse(struct urb *urb) case -ECONNRESET: case -ESHUTDOWN: dev_dbg(&ar2->intf[0]->dev, - "%s(): urb status = %d\n", __FUNCTION__, urb->status); + "%s(): urb status = %d\n", __func__, urb->status); return; default: dev_err(&ar2->intf[0]->dev, - "%s(): urb status = %d\n", __FUNCTION__, urb->status); + "%s(): urb status = %d\n", __func__, urb->status); } r = usb_submit_urb(urb, GFP_ATOMIC); if (r) dev_err(&ar2->intf[0]->dev, - "%s(): usb_submit_urb() = %d\n", __FUNCTION__, r); + "%s(): usb_submit_urb() = %d\n", __func__, r); } static void ati_remote2_complete_key(struct urb *urb) @@ -321,17 +321,17 @@ static void ati_remote2_complete_key(struct urb *urb) case -ECONNRESET: case -ESHUTDOWN: dev_dbg(&ar2->intf[1]->dev, - "%s(): urb status = %d\n", __FUNCTION__, urb->status); + "%s(): urb status = %d\n", __func__, urb->status); return; default: dev_err(&ar2->intf[1]->dev, - "%s(): urb status = %d\n", __FUNCTION__, urb->status); + "%s(): urb status = %d\n", __func__, urb->status); } r = usb_submit_urb(urb, GFP_ATOMIC); if (r) dev_err(&ar2->intf[1]->dev, - "%s(): usb_submit_urb() = %d\n", __FUNCTION__, r); + "%s(): usb_submit_urb() = %d\n", __func__, r); } static int ati_remote2_input_init(struct ati_remote2 *ar2) @@ -438,7 +438,7 @@ static int ati_remote2_setup(struct ati_remote2 *ar2) channel, 0x0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (r) { dev_err(&ar2->udev->dev, "%s - failed to set channel due to error: %d\n", - __FUNCTION__, r); + __func__, r); return r; } diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c index 952938a8e99..86afdd1fdf9 100644 --- a/drivers/input/misc/keyspan_remote.c +++ b/drivers/input/misc/keyspan_remote.c @@ -159,7 +159,7 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) if (dev->data.pos >= dev->data.len) { dev_dbg(&dev->udev->dev, "%s - Error ran out of data. pos: %d, len: %d\n", - __FUNCTION__, dev->data.pos, dev->data.len); + __func__, dev->data.pos, dev->data.len); return -1; } @@ -267,7 +267,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Unknown sequence found in system data.\n", __FUNCTION__); + err("%s - Unknown sequence found in system data.\n", __func__); remote->stage = 0; return; } @@ -286,7 +286,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Unknown sequence found in button data.\n", __FUNCTION__); + err("%s - Unknown sequence found in button data.\n", __func__); remote->stage = 0; return; } @@ -302,7 +302,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) remote->data.tester = remote->data.tester >> 6; remote->data.bits_left -= 6; } else { - err("%s - Error in message, invalid toggle.\n", __FUNCTION__); + err("%s - Error in message, invalid toggle.\n", __func__); remote->stage = 0; return; } @@ -317,7 +317,7 @@ static void keyspan_check_data(struct usb_keyspan *remote) dev_dbg(&remote->udev->dev, "%s found valid message: system: %d, button: %d, toggle: %d\n", - __FUNCTION__, message.system, message.button, message.toggle); + __func__, message.system, message.button, message.toggle); if (message.toggle != remote->toggle) { keyspan_report_button(remote, message.button, 1); @@ -341,7 +341,7 @@ static int keyspan_setup(struct usb_device* dev) 0x11, 0x40, 0x5601, 0x0, NULL, 0, 0); if (retval) { dev_dbg(&dev->dev, "%s - failed to set bit rate due to error: %d\n", - __FUNCTION__, retval); + __func__, retval); return(retval); } @@ -349,7 +349,7 @@ static int keyspan_setup(struct usb_device* dev) 0x44, 0x40, 0x0, 0x0, NULL, 0, 0); if (retval) { dev_dbg(&dev->dev, "%s - failed to set resume sensitivity due to error: %d\n", - __FUNCTION__, retval); + __func__, retval); return(retval); } @@ -357,11 +357,11 @@ static int keyspan_setup(struct usb_device* dev) 0x22, 0x40, 0x0, 0x0, NULL, 0, 0); if (retval) { dev_dbg(&dev->dev, "%s - failed to turn receive on due to error: %d\n", - __FUNCTION__, retval); + __func__, retval); return(retval); } - dev_dbg(&dev->dev, "%s - Setup complete.\n", __FUNCTION__); + dev_dbg(&dev->dev, "%s - Setup complete.\n", __func__); return(retval); } @@ -397,7 +397,7 @@ static void keyspan_irq_recv(struct urb *urb) resubmit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) - err ("%s - usb_submit_urb failed with result: %d", __FUNCTION__, retval); + err ("%s - usb_submit_urb failed with result: %d", __func__, retval); } static int keyspan_open(struct input_dev *dev) diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c index 7a7b8c7b963..a53c4885fba 100644 --- a/drivers/input/misc/powermate.c +++ b/drivers/input/misc/powermate.c @@ -96,10 +96,10 @@ static void powermate_irq(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); + dbg("%s - urb shutting down with status: %d", __func__, urb->status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); + dbg("%s - nonzero urb status received: %d", __func__, urb->status); goto exit; } @@ -112,7 +112,7 @@ exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c new file mode 100644 index 00000000000..ce238f59b3c --- /dev/null +++ b/drivers/input/misc/sgi_btns.c @@ -0,0 +1,178 @@ +/* + * SGI Volume Button interface driver + * + * Copyright (C) 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include <linux/init.h> +#include <linux/input-polldev.h> +#include <linux/ioport.h> +#include <linux/module.h> +#include <linux/platform_device.h> + +#ifdef CONFIG_SGI_IP22 +#include <asm/sgi/ioc.h> + +static inline u8 button_status(void) +{ + u8 status; + + status = readb(&sgioc->panel) ^ 0xa0; + return ((status & 0x80) >> 6) | ((status & 0x20) >> 5); +} +#endif + +#ifdef CONFIG_SGI_IP32 +#include <asm/ip32/mace.h> + +static inline u8 button_status(void) +{ + u64 status; + + status = readq(&mace->perif.audio.control); + writeq(status & ~(3U << 23), &mace->perif.audio.control); + + return (status >> 23) & 3; +} +#endif + +#define BUTTONS_POLL_INTERVAL 30 /* msec */ +#define BUTTONS_COUNT_THRESHOLD 3 + +static const unsigned short sgi_map[] = { + KEY_VOLUMEDOWN, + KEY_VOLUMEUP +}; + +struct buttons_dev { + struct input_polled_dev *poll_dev; + unsigned short keymap[ARRAY_SIZE(sgi_map)]; + int count[ARRAY_SIZE(sgi_map)]; +}; + +static void handle_buttons(struct input_polled_dev *dev) +{ + struct buttons_dev *bdev = dev->private; + struct input_dev *input = dev->input; + u8 status; + int i; + + status = button_status(); + + for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) { + if (status & (1U << i)) { + if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) { + input_event(input, EV_MSC, MSC_SCAN, i); + input_report_key(input, bdev->keymap[i], 1); + input_sync(input); + } + } else { + if (bdev->count[i] >= BUTTONS_COUNT_THRESHOLD) { + input_event(input, EV_MSC, MSC_SCAN, i); + input_report_key(input, bdev->keymap[i], 0); + input_sync(input); + } + bdev->count[i] = 0; + } + } +} + +static int __devinit sgi_buttons_probe(struct platform_device *pdev) +{ + struct buttons_dev *bdev; + struct input_polled_dev *poll_dev; + struct input_dev *input; + int error, i; + + bdev = kzalloc(sizeof(struct buttons_dev), GFP_KERNEL); + poll_dev = input_allocate_polled_device(); + if (!bdev || !poll_dev) { + error = -ENOMEM; + goto err_free_mem; + } + + memcpy(bdev->keymap, sgi_map, sizeof(bdev->keymap)); + + poll_dev->private = bdev; + poll_dev->poll = handle_buttons; + poll_dev->poll_interval = BUTTONS_POLL_INTERVAL; + + input = poll_dev->input; + input->name = "SGI buttons"; + input->phys = "sgi/input0"; + input->id.bustype = BUS_HOST; + input->dev.parent = &pdev->dev; + + input->keycode = bdev->keymap; + input->keycodemax = ARRAY_SIZE(bdev->keymap); + input->keycodesize = sizeof(unsigned short); + + input_set_capability(input, EV_MSC, MSC_SCAN); + __set_bit(EV_KEY, input->evbit); + for (i = 0; i < ARRAY_SIZE(sgi_map); i++) + __set_bit(bdev->keymap[i], input->keybit); + __clear_bit(KEY_RESERVED, input->keybit); + + bdev->poll_dev = poll_dev; + dev_set_drvdata(&pdev->dev, bdev); + + error = input_register_polled_device(poll_dev); + if (error) + goto err_free_mem; + + return 0; + + err_free_mem: + input_free_polled_device(poll_dev); + kfree(bdev); + dev_set_drvdata(&pdev->dev, NULL); + return error; +} + +static int __devexit sgi_buttons_remove(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct buttons_dev *bdev = dev_get_drvdata(dev); + + input_unregister_polled_device(bdev->poll_dev); + input_free_polled_device(bdev->poll_dev); + kfree(bdev); + dev_set_drvdata(dev, NULL); + + return 0; +} + +static struct platform_driver sgi_buttons_driver = { + .probe = sgi_buttons_probe, + .remove = __devexit_p(sgi_buttons_remove), + .driver = { + .name = "sgibtns", + .owner = THIS_MODULE, + }, +}; + +static int __init sgi_buttons_init(void) +{ + return platform_driver_register(&sgi_buttons_driver); +} + +static void __exit sgi_buttons_exit(void) +{ + platform_driver_unregister(&sgi_buttons_driver); +} + +module_init(sgi_buttons_init); +module_exit(sgi_buttons_exit); diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 72176f3d49c..fe268be3293 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -1186,7 +1186,7 @@ static int wistron_setkeycode(struct input_dev *dev, int scancode, int keycode) static int __devinit setup_input_dev(void) { - const struct key_entry *key; + struct key_entry *key; struct input_dev *input_dev; int error; @@ -1219,6 +1219,23 @@ static int __devinit setup_input_dev(void) set_bit(key->sw.code, input_dev->swbit); break; + /* if wifi or bluetooth are not available, create normal keys */ + case KE_WIFI: + if (!have_wifi) { + key->type = KE_KEY; + key->keycode = KEY_WLAN; + key--; + } + break; + + case KE_BLUETOOTH: + if (!have_bluetooth) { + key->type = KE_KEY; + key->keycode = KEY_BLUETOOTH; + key--; + } + break; + default: break; } diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c index 46279ef2b64..facefd3dba2 100644 --- a/drivers/input/misc/yealink.c +++ b/drivers/input/misc/yealink.c @@ -119,6 +119,8 @@ struct yealink_dev { u8 lcdMap[ARRAY_SIZE(lcdMap)]; /* state of LCD, LED ... */ int key_code; /* last reported key */ + unsigned int shutdown:1; + int stat_ix; union { struct yld_status s; @@ -424,10 +426,10 @@ send_update: static void urb_irq_callback(struct urb *urb) { struct yealink_dev *yld = urb->context; - int ret; + int ret, status = urb->status; - if (urb->status) - err("%s - urb status %d", __FUNCTION__, urb->status); + if (status) + err("%s - urb status %d", __func__, status); switch (yld->irq_data->cmd) { case CMD_KEYPRESS: @@ -447,33 +449,38 @@ static void urb_irq_callback(struct urb *urb) yealink_do_idle_tasks(yld); - ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); - if (ret) - err("%s - usb_submit_urb failed %d", __FUNCTION__, ret); + if (!yld->shutdown) { + ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); + if (ret && ret != -EPERM) + err("%s - usb_submit_urb failed %d", __func__, ret); + } } static void urb_ctl_callback(struct urb *urb) { struct yealink_dev *yld = urb->context; - int ret; + int ret = 0, status = urb->status; - if (urb->status) - err("%s - urb status %d", __FUNCTION__, urb->status); + if (status) + err("%s - urb status %d", __func__, status); switch (yld->ctl_data->cmd) { case CMD_KEYPRESS: case CMD_SCANCODE: /* ask for a response */ - ret = usb_submit_urb(yld->urb_irq, GFP_ATOMIC); + if (!yld->shutdown) + ret = usb_submit_urb(yld->urb_irq, GFP_ATOMIC); break; default: /* send new command */ yealink_do_idle_tasks(yld); - ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); + if (!yld->shutdown) + ret = usb_submit_urb(yld->urb_ctl, GFP_ATOMIC); + break; } - if (ret) - err("%s - usb_submit_urb failed %d", __FUNCTION__, ret); + if (ret && ret != -EPERM) + err("%s - usb_submit_urb failed %d", __func__, ret); } /******************************************************************************* @@ -505,7 +512,7 @@ static int input_open(struct input_dev *dev) struct yealink_dev *yld = input_get_drvdata(dev); int i, ret; - dbg("%s", __FUNCTION__); + dbg("%s", __func__); /* force updates to device */ for (i = 0; i<sizeof(yld->master); i++) @@ -521,7 +528,7 @@ static int input_open(struct input_dev *dev) yld->ctl_data->sum = 0x100-CMD_INIT-10; if ((ret = usb_submit_urb(yld->urb_ctl, GFP_KERNEL)) != 0) { dbg("%s - usb_submit_urb failed with result %d", - __FUNCTION__, ret); + __func__, ret); return ret; } return 0; @@ -531,8 +538,18 @@ static void input_close(struct input_dev *dev) { struct yealink_dev *yld = input_get_drvdata(dev); + yld->shutdown = 1; + /* + * Make sure the flag is seen by other CPUs before we start + * killing URBs so new URBs won't be submitted + */ + smp_wmb(); + usb_kill_urb(yld->urb_ctl); usb_kill_urb(yld->urb_irq); + + yld->shutdown = 0; + smp_wmb(); } /******************************************************************************* @@ -809,9 +826,6 @@ static int usb_cleanup(struct yealink_dev *yld, int err) if (yld == NULL) return err; - usb_kill_urb(yld->urb_irq); /* parameter validation in core/urb */ - usb_kill_urb(yld->urb_ctl); /* parameter validation in core/urb */ - if (yld->idev) { if (err) input_free_device(yld->idev); |