2 * Driver for the VoIP USB phones with CM109 chipsets.
4 * Copyright (C) 2007 - 2008 Alfred E. Heggestad <aeh@db.org>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
13 * - Komunikate KIP1000
15 * - Allied-Telesis Corega USBPH01
18 * This driver is based on the yealink.c driver
21 * - Authors of yealink.c
23 * - Oliver Neukum for good review comments and code
24 * - Shaun Jackman <sjackman@gmail.com> for Genius G-talk keymap
25 * - Dmitry Torokhov for valuable input and review
31 #include <linux/kernel.h>
32 #include <linux/init.h>
33 #include <linux/slab.h>
34 #include <linux/module.h>
35 #include <linux/moduleparam.h>
36 #include <linux/rwsem.h>
37 #include <linux/usb/input.h>
39 #define DRIVER_VERSION "20080805"
40 #define DRIVER_AUTHOR "Alfred E. Heggestad"
41 #define DRIVER_DESC "CM109 phone driver"
43 static char *phone = "kip1000";
44 module_param(phone, charp, S_IRUSR);
45 MODULE_PARM_DESC(phone, "Phone name {kip1000, gtalk, usbph01}");
49 HID_IR0 = 0x00, /* Record/Playback-mute button, Volume up/down */
50 HID_IR1 = 0x01, /* GPI, generic registers or EEPROM_DATA0 */
51 HID_IR2 = 0x02, /* Generic registers or EEPROM_DATA1 */
52 HID_IR3 = 0x03, /* Generic registers or EEPROM_CTRL */
53 HID_OR0 = 0x00, /* Mapping control, buzzer, SPDIF (offset 0x04) */
54 HID_OR1 = 0x01, /* GPO - General Purpose Output */
55 HID_OR2 = 0x02, /* Set GPIO to input/output mode */
56 HID_OR3 = 0x03, /* SPDIF status channel or EEPROM_CTRL */
60 PLAYBACK_MUTE = 1 << 2,
66 0: HID_OR1-2 are used for GPO; HID_OR0, 3 are used for buzzer
68 1: HID_OR0-3 are used as generic HID registers
69 2: Values written to HID_OR0-3 are also mapped to MCU_CTRL,
70 EEPROM_DATA0-1, EEPROM_CTRL (see Note)
73 HID_OR_GPO_BUZ_SPDIF = 0 << 6,
74 HID_OR_GENERIC_HID_REG = 1 << 6,
75 HID_OR_MAP_MCU_EEPROM = 2 << 6,
79 /* up to 256 normal keys, up to 16 special keys */
80 KEYMAP_SIZE = 256 + 16,
83 /* CM109 protocol packet */
84 struct cm109_ctl_packet {
86 } __attribute__ ((packed));
88 enum { USB_PKT_LEN = sizeof(struct cm109_ctl_packet) };
90 /* CM109 device structure */
92 struct input_dev *idev; /* input device */
93 struct usb_device *udev; /* usb device */
94 struct usb_interface *intf;
96 /* irq input channel */
97 struct cm109_ctl_packet *irq_data;
101 /* control output channel */
102 struct cm109_ctl_packet *ctl_data;
104 struct usb_ctrlrequest *ctl_req;
105 dma_addr_t ctl_req_dma;
108 * The 3 bitfields below are protected by ctl_submit_lock.
109 * They have to be separate since they are accessed from IRQ
112 unsigned irq_urb_pending:1; /* irq_urb is in flight */
113 unsigned ctl_urb_pending:1; /* ctl_urb is in flight */
114 unsigned buzzer_pending:1; /* need to issue buzz command */
115 spinlock_t ctl_submit_lock;
117 unsigned char buzzer_state; /* on/off */
121 unsigned resetting:1;
124 /* This mutex protects writes to the above flags */
125 struct mutex pm_mutex;
127 unsigned short keymap[KEYMAP_SIZE];
129 char phys[64]; /* physical device path */
130 int key_code; /* last reported key */
131 int keybit; /* 0=new scan 1,2,4,8=scan columns */
132 u8 gpi; /* Cached value of GPI (high nibble) */
135 /******************************************************************************
136 * CM109 key interface
137 *****************************************************************************/
139 static unsigned short special_keymap(int code)
142 switch (code - 0xff) {
143 case RECORD_MUTE: return KEY_MUTE;
144 case PLAYBACK_MUTE: return KEY_MUTE;
145 case VOLUME_DOWN: return KEY_VOLUMEDOWN;
146 case VOLUME_UP: return KEY_VOLUMEUP;
152 /* Map device buttons to internal key events.
154 * The "up" and "down" keys, are symbolised by arrows on the button.
155 * The "pickup" and "hangup" keys are symbolised by a green and red phone
158 Komunikate KIP1000 Keyboard Matrix
160 -> -- 1 -- 2 -- 3 --> GPI pin 4 (0x10)
162 <- -- 4 -- 5 -- 6 --> GPI pin 5 (0x20)
164 END - 7 -- 8 -- 9 --> GPI pin 6 (0x40)
166 OK -- * -- 0 -- # --> GPI pin 7 (0x80)
176 static unsigned short keymap_kip1000(int scancode)
178 switch (scancode) { /* phone key: */
179 case 0x82: return KEY_NUMERIC_0; /* 0 */
180 case 0x14: return KEY_NUMERIC_1; /* 1 */
181 case 0x12: return KEY_NUMERIC_2; /* 2 */
182 case 0x11: return KEY_NUMERIC_3; /* 3 */
183 case 0x24: return KEY_NUMERIC_4; /* 4 */
184 case 0x22: return KEY_NUMERIC_5; /* 5 */
185 case 0x21: return KEY_NUMERIC_6; /* 6 */
186 case 0x44: return KEY_NUMERIC_7; /* 7 */
187 case 0x42: return KEY_NUMERIC_8; /* 8 */
188 case 0x41: return KEY_NUMERIC_9; /* 9 */
189 case 0x81: return KEY_NUMERIC_POUND; /* # */
190 case 0x84: return KEY_NUMERIC_STAR; /* * */
191 case 0x88: return KEY_ENTER; /* pickup */
192 case 0x48: return KEY_ESC; /* hangup */
193 case 0x28: return KEY_LEFT; /* IN */
194 case 0x18: return KEY_RIGHT; /* OUT */
195 default: return special_keymap(scancode);
200 Contributed by Shaun Jackman <sjackman@gmail.com>
202 Genius G-Talk keyboard matrix
209 static unsigned short keymap_gtalk(int scancode)
212 case 0x11: return KEY_NUMERIC_0;
213 case 0x21: return KEY_NUMERIC_1;
214 case 0x41: return KEY_NUMERIC_2;
215 case 0x81: return KEY_NUMERIC_3;
216 case 0x12: return KEY_NUMERIC_4;
217 case 0x22: return KEY_NUMERIC_5;
218 case 0x42: return KEY_NUMERIC_6;
219 case 0x82: return KEY_NUMERIC_7;
220 case 0x14: return KEY_NUMERIC_8;
221 case 0x24: return KEY_NUMERIC_9;
222 case 0x44: return KEY_NUMERIC_POUND; /* # */
223 case 0x84: return KEY_NUMERIC_STAR; /* * */
224 case 0x18: return KEY_ENTER; /* Talk (green handset) */
225 case 0x28: return KEY_ESC; /* End (red handset) */
226 case 0x48: return KEY_UP; /* Menu up (rocker switch) */
227 case 0x88: return KEY_DOWN; /* Menu down (rocker switch) */
228 default: return special_keymap(scancode);
233 * Keymap for Allied-Telesis Corega USBPH01
234 * http://www.alliedtelesis-corega.com/2/1344/1437/1360/chprd.html
236 * Contributed by july@nat.bg
238 static unsigned short keymap_usbph01(int scancode)
241 case 0x11: return KEY_NUMERIC_0; /* 0 */
242 case 0x21: return KEY_NUMERIC_1; /* 1 */
243 case 0x41: return KEY_NUMERIC_2; /* 2 */
244 case 0x81: return KEY_NUMERIC_3; /* 3 */
245 case 0x12: return KEY_NUMERIC_4; /* 4 */
246 case 0x22: return KEY_NUMERIC_5; /* 5 */
247 case 0x42: return KEY_NUMERIC_6; /* 6 */
248 case 0x82: return KEY_NUMERIC_7; /* 7 */
249 case 0x14: return KEY_NUMERIC_8; /* 8 */
250 case 0x24: return KEY_NUMERIC_9; /* 9 */
251 case 0x44: return KEY_NUMERIC_POUND; /* # */
252 case 0x84: return KEY_NUMERIC_STAR; /* * */
253 case 0x18: return KEY_ENTER; /* pickup */
254 case 0x28: return KEY_ESC; /* hangup */
255 case 0x48: return KEY_LEFT; /* IN */
256 case 0x88: return KEY_RIGHT; /* OUT */
257 default: return special_keymap(scancode);
261 static unsigned short (*keymap)(int) = keymap_kip1000;
264 * Completes a request by converting the data into events for the
267 static void report_key(struct cm109_dev *dev, int key)
269 struct input_dev *idev = dev->idev;
271 if (dev->key_code >= 0) {
273 input_report_key(idev, dev->key_code, 0);
279 input_report_key(idev, key, 1);
285 /******************************************************************************
286 * CM109 usb communication interface
287 *****************************************************************************/
289 static void cm109_submit_buzz_toggle(struct cm109_dev *dev)
293 if (dev->buzzer_state)
294 dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
296 dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
298 error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
300 err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error);
306 static void cm109_urb_irq_callback(struct urb *urb)
308 struct cm109_dev *dev = urb->context;
309 const int status = urb->status;
312 dev_dbg(&urb->dev->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n",
313 dev->irq_data->byte[0],
314 dev->irq_data->byte[1],
315 dev->irq_data->byte[2],
316 dev->irq_data->byte[3],
320 if (status == -ESHUTDOWN)
322 err("%s: urb status %d", __func__, status);
326 if (dev->irq_data->byte[HID_IR0] & 0x0f) {
327 const int code = (dev->irq_data->byte[HID_IR0] & 0x0f);
328 report_key(dev, dev->keymap[0xff + code]);
331 /* Scan key column */
332 if (dev->keybit == 0xf) {
335 if ((dev->gpi & 0xf0) == (dev->irq_data->byte[HID_IR1] & 0xf0))
338 dev->gpi = dev->irq_data->byte[HID_IR1] & 0xf0;
341 report_key(dev, dev->keymap[dev->irq_data->byte[HID_IR1]]);
344 if (dev->keybit > 0x8)
350 spin_lock(&dev->ctl_submit_lock);
352 dev->irq_urb_pending = 0;
354 if (likely(!dev->shutdown)) {
356 if (dev->buzzer_state)
357 dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
359 dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
361 dev->ctl_data->byte[HID_OR1] = dev->keybit;
362 dev->ctl_data->byte[HID_OR2] = dev->keybit;
364 dev->buzzer_pending = 0;
365 dev->ctl_urb_pending = 1;
367 error = usb_submit_urb(dev->urb_ctl, GFP_ATOMIC);
369 err("%s: usb_submit_urb (urb_ctl) failed %d",
373 spin_unlock(&dev->ctl_submit_lock);
376 static void cm109_urb_ctl_callback(struct urb *urb)
378 struct cm109_dev *dev = urb->context;
379 const int status = urb->status;
382 dev_dbg(&urb->dev->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n",
383 dev->ctl_data->byte[0],
384 dev->ctl_data->byte[1],
385 dev->ctl_data->byte[2],
386 dev->ctl_data->byte[3]);
389 err("%s: urb status %d", __func__, status);
391 spin_lock(&dev->ctl_submit_lock);
393 dev->ctl_urb_pending = 0;
395 if (likely(!dev->shutdown)) {
397 if (dev->buzzer_pending) {
398 dev->buzzer_pending = 0;
399 dev->ctl_urb_pending = 1;
400 cm109_submit_buzz_toggle(dev);
401 } else if (likely(!dev->irq_urb_pending)) {
402 /* ask for key data */
403 dev->irq_urb_pending = 1;
404 error = usb_submit_urb(dev->urb_irq, GFP_ATOMIC);
406 err("%s: usb_submit_urb (urb_irq) failed %d",
411 spin_unlock(&dev->ctl_submit_lock);
414 static void cm109_toggle_buzzer_async(struct cm109_dev *dev)
418 spin_lock_irqsave(&dev->ctl_submit_lock, flags);
420 if (dev->ctl_urb_pending) {
421 /* URB completion will resubmit */
422 dev->buzzer_pending = 1;
424 dev->ctl_urb_pending = 1;
425 cm109_submit_buzz_toggle(dev);
428 spin_unlock_irqrestore(&dev->ctl_submit_lock, flags);
431 static void cm109_toggle_buzzer_sync(struct cm109_dev *dev, int on)
436 dev->ctl_data->byte[HID_OR0] |= BUZZER_ON;
438 dev->ctl_data->byte[HID_OR0] &= ~BUZZER_ON;
440 error = usb_control_msg(dev->udev,
441 usb_sndctrlpipe(dev->udev, 0),
442 dev->ctl_req->bRequest,
443 dev->ctl_req->bRequestType,
444 le16_to_cpu(dev->ctl_req->wValue),
445 le16_to_cpu(dev->ctl_req->wIndex),
447 USB_PKT_LEN, USB_CTRL_SET_TIMEOUT);
448 if (error && error != EINTR)
449 err("%s: usb_control_msg() failed %d", __func__, error);
452 static void cm109_stop_traffic(struct cm109_dev *dev)
456 * Make sure other CPUs see this
460 usb_kill_urb(dev->urb_ctl);
461 usb_kill_urb(dev->urb_irq);
463 cm109_toggle_buzzer_sync(dev, 0);
469 static void cm109_restore_state(struct cm109_dev *dev)
473 * Restore buzzer state.
474 * This will also kick regular URB submission
476 cm109_toggle_buzzer_async(dev);
480 /******************************************************************************
481 * input event interface
482 *****************************************************************************/
484 static int cm109_input_open(struct input_dev *idev)
486 struct cm109_dev *dev = input_get_drvdata(idev);
489 error = usb_autopm_get_interface(dev->intf);
491 err("%s - cannot autoresume, result %d",
496 mutex_lock(&dev->pm_mutex);
498 dev->buzzer_state = 0;
499 dev->key_code = -1; /* no keys pressed */
503 dev->ctl_data->byte[HID_OR0] = HID_OR_GPO_BUZ_SPDIF;
504 dev->ctl_data->byte[HID_OR1] = dev->keybit;
505 dev->ctl_data->byte[HID_OR2] = dev->keybit;
506 dev->ctl_data->byte[HID_OR3] = 0x00;
508 error = usb_submit_urb(dev->urb_ctl, GFP_KERNEL);
510 err("%s: usb_submit_urb (urb_ctl) failed %d", __func__, error);
514 mutex_unlock(&dev->pm_mutex);
517 usb_autopm_put_interface(dev->intf);
522 static void cm109_input_close(struct input_dev *idev)
524 struct cm109_dev *dev = input_get_drvdata(idev);
526 mutex_lock(&dev->pm_mutex);
529 * Once we are here event delivery is stopped so we
530 * don't need to worry about someone starting buzzer
533 cm109_stop_traffic(dev);
536 mutex_unlock(&dev->pm_mutex);
538 usb_autopm_put_interface(dev->intf);
541 static int cm109_input_ev(struct input_dev *idev, unsigned int type,
542 unsigned int code, int value)
544 struct cm109_dev *dev = input_get_drvdata(idev);
546 dev_dbg(&dev->udev->dev,
547 "input_ev: type=%u code=%u value=%d\n", type, code, value);
555 dev->buzzer_state = !!value;
557 cm109_toggle_buzzer_async(dev);
566 /******************************************************************************
567 * Linux interface and usb initialisation
568 *****************************************************************************/
574 static const struct driver_info info_cm109 = {
575 .name = "CM109 USB driver",
579 VENDOR_ID = 0x0d8c, /* C-Media Electronics */
580 PRODUCT_ID_CM109 = 0x000e, /* CM109 defines range 0x0008 - 0x000f */
583 /* table of devices that work with this driver */
584 static const struct usb_device_id cm109_usb_table[] = {
586 .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
587 USB_DEVICE_ID_MATCH_INT_INFO,
588 .idVendor = VENDOR_ID,
589 .idProduct = PRODUCT_ID_CM109,
590 .bInterfaceClass = USB_CLASS_HID,
591 .bInterfaceSubClass = 0,
592 .bInterfaceProtocol = 0,
593 .driver_info = (kernel_ulong_t) &info_cm109
595 /* you can add more devices here with product ID 0x0008 - 0x000f */
599 static void cm109_usb_cleanup(struct cm109_dev *dev)
602 usb_buffer_free(dev->udev, sizeof(*(dev->ctl_req)),
603 dev->ctl_req, dev->ctl_req_dma);
605 usb_buffer_free(dev->udev, USB_PKT_LEN,
606 dev->ctl_data, dev->ctl_dma);
608 usb_buffer_free(dev->udev, USB_PKT_LEN,
609 dev->irq_data, dev->irq_dma);
611 usb_free_urb(dev->urb_irq); /* parameter validation in core/urb */
612 usb_free_urb(dev->urb_ctl); /* parameter validation in core/urb */
616 static void cm109_usb_disconnect(struct usb_interface *interface)
618 struct cm109_dev *dev = usb_get_intfdata(interface);
620 usb_set_intfdata(interface, NULL);
621 input_unregister_device(dev->idev);
622 cm109_usb_cleanup(dev);
625 static int cm109_usb_probe(struct usb_interface *intf,
626 const struct usb_device_id *id)
628 struct usb_device *udev = interface_to_usbdev(intf);
629 struct driver_info *nfo = (struct driver_info *)id->driver_info;
630 struct usb_host_interface *interface;
631 struct usb_endpoint_descriptor *endpoint;
632 struct cm109_dev *dev;
633 struct input_dev *input_dev = NULL;
637 interface = intf->cur_altsetting;
638 endpoint = &interface->endpoint[0].desc;
640 if (!usb_endpoint_is_int_in(endpoint))
643 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
647 spin_lock_init(&dev->ctl_submit_lock);
648 mutex_init(&dev->pm_mutex);
653 dev->idev = input_dev = input_allocate_device();
657 /* allocate usb buffers */
658 dev->irq_data = usb_buffer_alloc(udev, USB_PKT_LEN,
659 GFP_KERNEL, &dev->irq_dma);
663 dev->ctl_data = usb_buffer_alloc(udev, USB_PKT_LEN,
664 GFP_KERNEL, &dev->ctl_dma);
668 dev->ctl_req = usb_buffer_alloc(udev, sizeof(*(dev->ctl_req)),
669 GFP_KERNEL, &dev->ctl_req_dma);
673 /* allocate urb structures */
674 dev->urb_irq = usb_alloc_urb(0, GFP_KERNEL);
678 dev->urb_ctl = usb_alloc_urb(0, GFP_KERNEL);
682 /* get a handle to the interrupt data pipe */
683 pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
684 ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
685 if (ret != USB_PKT_LEN)
686 err("invalid payload size %d, expected %d", ret, USB_PKT_LEN);
688 /* initialise irq urb */
689 usb_fill_int_urb(dev->urb_irq, udev, pipe, dev->irq_data,
691 cm109_urb_irq_callback, dev, endpoint->bInterval);
692 dev->urb_irq->transfer_dma = dev->irq_dma;
693 dev->urb_irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
694 dev->urb_irq->dev = udev;
696 /* initialise ctl urb */
697 dev->ctl_req->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE |
699 dev->ctl_req->bRequest = USB_REQ_SET_CONFIGURATION;
700 dev->ctl_req->wValue = cpu_to_le16(0x200);
701 dev->ctl_req->wIndex = cpu_to_le16(interface->desc.bInterfaceNumber);
702 dev->ctl_req->wLength = cpu_to_le16(USB_PKT_LEN);
704 usb_fill_control_urb(dev->urb_ctl, udev, usb_sndctrlpipe(udev, 0),
705 (void *)dev->ctl_req, dev->ctl_data, USB_PKT_LEN,
706 cm109_urb_ctl_callback, dev);
707 dev->urb_ctl->setup_dma = dev->ctl_req_dma;
708 dev->urb_ctl->transfer_dma = dev->ctl_dma;
709 dev->urb_ctl->transfer_flags |= URB_NO_SETUP_DMA_MAP |
710 URB_NO_TRANSFER_DMA_MAP;
711 dev->urb_ctl->dev = udev;
713 /* find out the physical bus location */
714 usb_make_path(udev, dev->phys, sizeof(dev->phys));
715 strlcat(dev->phys, "/input0", sizeof(dev->phys));
717 /* register settings for the input device */
718 input_dev->name = nfo->name;
719 input_dev->phys = dev->phys;
720 usb_to_input_id(udev, &input_dev->id);
721 input_dev->dev.parent = &intf->dev;
723 input_set_drvdata(input_dev, dev);
724 input_dev->open = cm109_input_open;
725 input_dev->close = cm109_input_close;
726 input_dev->event = cm109_input_ev;
728 input_dev->keycode = dev->keymap;
729 input_dev->keycodesize = sizeof(unsigned char);
730 input_dev->keycodemax = ARRAY_SIZE(dev->keymap);
732 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_SND);
733 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
735 /* register available key events */
736 for (i = 0; i < KEYMAP_SIZE; i++) {
737 unsigned short k = keymap(i);
739 __set_bit(k, input_dev->keybit);
741 __clear_bit(KEY_RESERVED, input_dev->keybit);
743 error = input_register_device(dev->idev);
747 usb_set_intfdata(intf, dev);
752 input_free_device(input_dev);
753 cm109_usb_cleanup(dev);
757 static int cm109_usb_suspend(struct usb_interface *intf, pm_message_t message)
759 struct cm109_dev *dev = usb_get_intfdata(intf);
761 dev_info(&intf->dev, "cm109: usb_suspend (event=%d)\n", message.event);
763 mutex_lock(&dev->pm_mutex);
764 cm109_stop_traffic(dev);
765 mutex_unlock(&dev->pm_mutex);
770 static int cm109_usb_resume(struct usb_interface *intf)
772 struct cm109_dev *dev = usb_get_intfdata(intf);
774 dev_info(&intf->dev, "cm109: usb_resume\n");
776 mutex_lock(&dev->pm_mutex);
777 cm109_restore_state(dev);
778 mutex_unlock(&dev->pm_mutex);
783 static int cm109_usb_pre_reset(struct usb_interface *intf)
785 struct cm109_dev *dev = usb_get_intfdata(intf);
787 mutex_lock(&dev->pm_mutex);
790 * Make sure input events don't try to toggle buzzer
791 * while we are resetting
796 cm109_stop_traffic(dev);
801 static int cm109_usb_post_reset(struct usb_interface *intf)
803 struct cm109_dev *dev = usb_get_intfdata(intf);
808 cm109_restore_state(dev);
810 mutex_unlock(&dev->pm_mutex);
815 static struct usb_driver cm109_driver = {
817 .probe = cm109_usb_probe,
818 .disconnect = cm109_usb_disconnect,
819 .suspend = cm109_usb_suspend,
820 .resume = cm109_usb_resume,
821 .reset_resume = cm109_usb_resume,
822 .pre_reset = cm109_usb_pre_reset,
823 .post_reset = cm109_usb_post_reset,
824 .id_table = cm109_usb_table,
825 .supports_autosuspend = 1,
828 static int __init cm109_select_keymap(void)
830 /* Load the phone keymap */
831 if (!strcasecmp(phone, "kip1000")) {
832 keymap = keymap_kip1000;
833 printk(KERN_INFO KBUILD_MODNAME ": "
834 "Keymap for Komunikate KIP1000 phone loaded\n");
835 } else if (!strcasecmp(phone, "gtalk")) {
836 keymap = keymap_gtalk;
837 printk(KERN_INFO KBUILD_MODNAME ": "
838 "Keymap for Genius G-talk phone loaded\n");
839 } else if (!strcasecmp(phone, "usbph01")) {
840 keymap = keymap_usbph01;
841 printk(KERN_INFO KBUILD_MODNAME ": "
842 "Keymap for Allied-Telesis Corega USBPH01 phone loaded\n");
844 printk(KERN_ERR KBUILD_MODNAME ": "
845 "Unsupported phone: %s\n", phone);
852 static int __init cm109_init(void)
856 err = cm109_select_keymap();
860 err = usb_register(&cm109_driver);
864 printk(KERN_INFO KBUILD_MODNAME ": "
865 DRIVER_DESC ": " DRIVER_VERSION " (C) " DRIVER_AUTHOR "\n");
870 static void __exit cm109_exit(void)
872 usb_deregister(&cm109_driver);
875 module_init(cm109_init);
876 module_exit(cm109_exit);
878 MODULE_DEVICE_TABLE(usb, cm109_usb_table);
880 MODULE_AUTHOR(DRIVER_AUTHOR);
881 MODULE_DESCRIPTION(DRIVER_DESC);
882 MODULE_LICENSE("GPL");