[media] drivers/media/IR/imon.c: Use pr_err instead of err
[cascardo/linux.git] / drivers / media / IR / imon.c
index d36fe72..0391c3b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *   imon.c:   input and display driver for SoundGraph iMON IR/VFD/LCD
  *
- *   Copyright(C) 2009  Jarod Wilson <jarod@wilsonet.com>
+ *   Copyright(C) 2010  Jarod Wilson <jarod@wilsonet.com>
  *   Portions based on the original lirc_imon driver,
  *     Copyright(C) 2004  Venky Raju(dev@venky.ws)
  *
@@ -26,6 +26,8 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
+
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -125,6 +127,7 @@ struct imon_context {
        struct input_dev *idev;         /* input device for panel & IR mouse */
        struct input_dev *touch;        /* input device for touchscreen */
 
+       spinlock_t kc_lock;             /* make sure we get keycodes right */
        u32 kc;                         /* current input keycode */
        u32 last_keycode;               /* last reported input keycode */
        u32 rc_scancode;                /* the computed remote scancode */
@@ -291,6 +294,9 @@ static const struct {
        { 0x000100000000ffeell, KEY_VOLUMEUP },
        { 0x010000000000ffeell, KEY_VOLUMEDOWN },
        { 0x000000000100ffeell, KEY_MUTE },
+       /* 0xffdc iMON MCE VFD */
+       { 0x00010000ffffffeell, KEY_VOLUMEUP },
+       { 0x01000000ffffffeell, KEY_VOLUMEDOWN },
        /* iMON Knob values */
        { 0x000100ffffffffeell, KEY_VOLUMEUP },
        { 0x010000ffffffffeell, KEY_VOLUMEDOWN },
@@ -367,15 +373,14 @@ static int display_open(struct inode *inode, struct file *file)
        subminor = iminor(inode);
        interface = usb_find_interface(&imon_driver, subminor);
        if (!interface) {
-               err("%s: could not find interface for minor %d",
-                   __func__, subminor);
+               pr_err("could not find interface for minor %d\n", subminor);
                retval = -ENODEV;
                goto exit;
        }
        ictx = usb_get_intfdata(interface);
 
        if (!ictx) {
-               err("%s: no context found for minor %d", __func__, subminor);
+               pr_err("no context found for minor %d\n", subminor);
                retval = -ENODEV;
                goto exit;
        }
@@ -383,10 +388,10 @@ static int display_open(struct inode *inode, struct file *file)
        mutex_lock(&ictx->lock);
 
        if (!ictx->display_supported) {
-               err("%s: display not supported by device", __func__);
+               pr_err("display not supported by device\n");
                retval = -ENODEV;
        } else if (ictx->display_isopen) {
-               err("%s: display port is already open", __func__);
+               pr_err("display port is already open\n");
                retval = -EBUSY;
        } else {
                ictx->display_isopen = true;
@@ -413,17 +418,17 @@ static int display_close(struct inode *inode, struct file *file)
        ictx = file->private_data;
 
        if (!ictx) {
-               err("%s: no context for device", __func__);
+               pr_err("no context for device\n");
                return -ENODEV;
        }
 
        mutex_lock(&ictx->lock);
 
        if (!ictx->display_supported) {
-               err("%s: display not supported by device", __func__);
+               pr_err("display not supported by device\n");
                retval = -ENODEV;
        } else if (!ictx->display_isopen) {
-               err("%s: display is not open", __func__);
+               pr_err("display is not open\n");
                retval = -EIO;
        } else {
                ictx->display_isopen = false;
@@ -502,19 +507,19 @@ static int send_packet(struct imon_context *ictx)
        if (retval) {
                ictx->tx.busy = false;
                smp_rmb(); /* ensure later readers know we're not busy */
-               err("%s: error submitting urb(%d)", __func__, retval);
+               pr_err("error submitting urb(%d)\n", retval);
        } else {
                /* Wait for transmission to complete (or abort) */
                mutex_unlock(&ictx->lock);
                retval = wait_for_completion_interruptible(
                                &ictx->tx.finished);
                if (retval)
-                       err("%s: task interrupted", __func__);
+                       pr_err("task interrupted\n");
                mutex_lock(&ictx->lock);
 
                retval = ictx->tx.status;
                if (retval)
-                       err("%s: packet tx failed (%d)", __func__, retval);
+                       pr_err("packet tx failed (%d)\n", retval);
        }
 
        kfree(control_req);
@@ -546,12 +551,12 @@ static int send_associate_24g(struct imon_context *ictx)
                                          0x00, 0x00, 0x00, 0x20 };
 
        if (!ictx) {
-               err("%s: no context for device", __func__);
+               pr_err("no context for device\n");
                return -ENODEV;
        }
 
        if (!ictx->dev_present_intf0) {
-               err("%s: no iMON device present", __func__);
+               pr_err("no iMON device present\n");
                return -ENODEV;
        }
 
@@ -579,7 +584,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
        int i;
 
        if (!ictx) {
-               err("%s: no context for device", __func__);
+               pr_err("no context for device\n");
                return -ENODEV;
        }
 
@@ -640,8 +645,7 @@ static int send_set_imon_clock(struct imon_context *ictx,
                memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8);
                retval = send_packet(ictx);
                if (retval) {
-                       err("%s: send_packet failed for packet %d",
-                           __func__, i);
+                       pr_err("send_packet failed for packet %d\n", i);
                        break;
                }
        }
@@ -817,20 +821,20 @@ static ssize_t vfd_write(struct file *file, const char *buf,
 
        ictx = file->private_data;
        if (!ictx) {
-               err("%s: no context for device", __func__);
+               pr_err("no context for device\n");
                return -ENODEV;
        }
 
        mutex_lock(&ictx->lock);
 
        if (!ictx->dev_present_intf0) {
-               err("%s: no iMON device present", __func__);
+               pr_err("no iMON device present\n");
                retval = -ENODEV;
                goto exit;
        }
 
        if (n_bytes <= 0 || n_bytes > 32) {
-               err("%s: invalid payload size", __func__);
+               pr_err("invalid payload size\n");
                retval = -EINVAL;
                goto exit;
        }
@@ -856,8 +860,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
 
                retval = send_packet(ictx);
                if (retval) {
-                       err("%s: send packet failed for packet #%d",
-                                       __func__, seq/2);
+                       pr_err("send packet failed for packet #%d\n", seq / 2);
                        goto exit;
                } else {
                        seq += 2;
@@ -871,8 +874,7 @@ static ssize_t vfd_write(struct file *file, const char *buf,
        ictx->usb_tx_buf[7] = (unsigned char) seq;
        retval = send_packet(ictx);
        if (retval)
-               err("%s: send packet failed for packet #%d",
-                   __func__, seq / 2);
+               pr_err("send packet failed for packet #%d\n", seq / 2);
 
 exit:
        mutex_unlock(&ictx->lock);
@@ -901,21 +903,20 @@ static ssize_t lcd_write(struct file *file, const char *buf,
 
        ictx = file->private_data;
        if (!ictx) {
-               err("%s: no context for device", __func__);
+               pr_err("no context for device\n");
                return -ENODEV;
        }
 
        mutex_lock(&ictx->lock);
 
        if (!ictx->display_supported) {
-               err("%s: no iMON display present", __func__);
+               pr_err("no iMON display present\n");
                retval = -ENODEV;
                goto exit;
        }
 
        if (n_bytes != 8) {
-               err("%s: invalid payload size: %d (expecting 8)",
-                   __func__, (int) n_bytes);
+               pr_err("invalid payload size: %d (expected 8)\n", (int)n_bytes);
                retval = -EINVAL;
                goto exit;
        }
@@ -927,7 +928,7 @@ static ssize_t lcd_write(struct file *file, const char *buf,
 
        retval = send_packet(ictx);
        if (retval) {
-               err("%s: send packet failed!", __func__);
+               pr_err("send packet failed!\n");
                goto exit;
        } else {
                dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n",
@@ -1210,6 +1211,9 @@ static bool imon_mouse_event(struct imon_context *ictx,
        u8 right_shift = 1;
        bool mouse_input = true;
        int dir = 0;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ictx->kc_lock, flags);
 
        /* newer iMON device PAD or mouse button */
        if (ictx->product != 0xffdc && (buf[0] & 0x01) && len == 5) {
@@ -1241,6 +1245,8 @@ static bool imon_mouse_event(struct imon_context *ictx,
        } else
                mouse_input = false;
 
+       spin_unlock_irqrestore(&ictx->kc_lock, flags);
+
        if (mouse_input) {
                dev_dbg(ictx->dev, "sending mouse data via input subsystem\n");
 
@@ -1255,7 +1261,9 @@ static bool imon_mouse_event(struct imon_context *ictx,
                                         buf[1] >> right_shift & 0x1);
                }
                input_sync(ictx->idev);
+               spin_lock_irqsave(&ictx->kc_lock, flags);
                ictx->last_keycode = ictx->kc;
+               spin_unlock_irqrestore(&ictx->kc_lock, flags);
        }
 
        return mouse_input;
@@ -1278,6 +1286,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
        char rel_x = 0x00, rel_y = 0x00;
        u16 timeout, threshold;
        u32 scancode = KEY_RESERVED;
+       unsigned long flags;
 
        /*
         * The imon directional pad functions more like a touchpad. Bytes 3 & 4
@@ -1301,7 +1310,11 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
                                dir = stabilize((int)rel_x, (int)rel_y,
                                                timeout, threshold);
                                if (!dir) {
+                                       spin_lock_irqsave(&ictx->kc_lock,
+                                                         flags);
                                        ictx->kc = KEY_UNKNOWN;
+                                       spin_unlock_irqrestore(&ictx->kc_lock,
+                                                              flags);
                                        return;
                                }
                                buf[2] = dir & 0xFF;
@@ -1363,7 +1376,9 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
                        dir = stabilize((int)rel_x, (int)rel_y,
                                        timeout, threshold);
                        if (!dir) {
+                               spin_lock_irqsave(&ictx->kc_lock, flags);
                                ictx->kc = KEY_UNKNOWN;
+                               spin_unlock_irqrestore(&ictx->kc_lock, flags);
                                return;
                        }
                        buf[2] = dir & 0xFF;
@@ -1392,8 +1407,11 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
                }
        }
 
-       if (scancode)
+       if (scancode) {
+               spin_lock_irqsave(&ictx->kc_lock, flags);
                ictx->kc = imon_remote_key_lookup(ictx, scancode);
+               spin_unlock_irqrestore(&ictx->kc_lock, flags);
+       }
 }
 
 /**
@@ -1405,6 +1423,9 @@ static int imon_parse_press_type(struct imon_context *ictx,
                                 unsigned char *buf, u8 ktype)
 {
        int press_type = 0;
+       unsigned long flags;
+
+       spin_lock_irqsave(&ictx->kc_lock, flags);
 
        /* key release of 0x02XXXXXX key */
        if (ictx->kc == KEY_RESERVED && buf[0] == 0x02 && buf[3] == 0x00)
@@ -1437,6 +1458,8 @@ static int imon_parse_press_type(struct imon_context *ictx,
        else
                press_type = 1;
 
+       spin_unlock_irqrestore(&ictx->kc_lock, flags);
+
        return press_type;
 }
 
@@ -1449,6 +1472,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
        int len = urb->actual_length;
        unsigned char *buf = urb->transfer_buffer;
        struct device *dev = ictx->dev;
+       unsigned long flags;
        u32 kc;
        bool norelease = false;
        int i;
@@ -1486,6 +1510,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
                }
        }
 
+       spin_lock_irqsave(&ictx->kc_lock, flags);
        /* keyboard/mouse mode toggle button */
        if (kc == KEY_KEYBOARD && !ictx->release_code) {
                ictx->last_keycode = kc;
@@ -1493,6 +1518,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
                        ictx->pad_mouse = ~(ictx->pad_mouse) & 0x1;
                        dev_dbg(dev, "toggling to %s mode\n",
                                ictx->pad_mouse ? "mouse" : "keyboard");
+                       spin_unlock_irqrestore(&ictx->kc_lock, flags);
                        return;
                } else {
                        ictx->pad_mouse = 0;
@@ -1501,6 +1527,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
        }
 
        ictx->kc = kc;
+       spin_unlock_irqrestore(&ictx->kc_lock, flags);
 
        /* send touchscreen events through input subsystem if touchpad data */
        if (ictx->display_type == IMON_DISPLAY_TYPE_VGA && len == 8 &&
@@ -1534,8 +1561,10 @@ static void imon_incoming_packet(struct imon_context *ictx,
        if (press_type < 0)
                goto not_input_data;
 
+       spin_lock_irqsave(&ictx->kc_lock, flags);
        if (ictx->kc == KEY_UNKNOWN)
                goto unknown_key;
+       spin_unlock_irqrestore(&ictx->kc_lock, flags);
 
        if (ktype != IMON_KEY_PANEL) {
                if (press_type == 0)
@@ -1543,33 +1572,43 @@ static void imon_incoming_packet(struct imon_context *ictx,
                else {
                        ir_keydown(ictx->rdev, ictx->rc_scancode,
                                   ictx->rc_toggle);
+                       spin_lock_irqsave(&ictx->kc_lock, flags);
                        ictx->last_keycode = ictx->kc;
+                       spin_unlock_irqrestore(&ictx->kc_lock, flags);
                }
                return;
        }
 
        /* Only panel type events left to process now */
+       spin_lock_irqsave(&ictx->kc_lock, flags);
+
        /* KEY_MUTE repeats from knob need to be suppressed */
        if (ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) {
                do_gettimeofday(&t);
                msec = tv2int(&t, &prev_time);
                prev_time = t;
-               if (msec < idev->rep[REP_DELAY])
+               if (msec < idev->rep[REP_DELAY]) {
+                       spin_unlock_irqrestore(&ictx->kc_lock, flags);
                        return;
+               }
        }
+       kc = ictx->kc;
 
-       input_report_key(idev, ictx->kc, press_type);
+       spin_unlock_irqrestore(&ictx->kc_lock, flags);
+
+       input_report_key(idev, kc, press_type);
        input_sync(idev);
 
        /* panel keys don't generate a release */
-       input_report_key(idev, ictx->kc, 0);
+       input_report_key(idev, kc, 0);
        input_sync(idev);
 
-       ictx->last_keycode = ictx->kc;
+       ictx->last_keycode = kc;
 
        return;
 
 unknown_key:
+       spin_unlock_irqrestore(&ictx->kc_lock, flags);
        dev_info(dev, "%s: unknown keypress, code 0x%llx\n", __func__,
                 (long long)scancode);
        return;
@@ -1662,11 +1701,128 @@ static void usb_rx_callback_intf1(struct urb *urb)
        usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC);
 }
 
+/*
+ * The 0x15c2:0xffdc device ID was used for umpteen different imon
+ * devices, and all of them constantly spew interrupts, even when there
+ * is no actual data to report. However, byte 6 of this buffer looks like
+ * its unique across device variants, so we're trying to key off that to
+ * figure out which display type (if any) and what IR protocol the device
+ * actually supports. These devices have their IR protocol hard-coded into
+ * their firmware, they can't be changed on the fly like the newer hardware.
+ */
+static void imon_get_ffdc_type(struct imon_context *ictx)
+{
+       u8 ffdc_cfg_byte = ictx->usb_rx_buf[6];
+       u8 detected_display_type = IMON_DISPLAY_TYPE_NONE;
+       u64 allowed_protos = IR_TYPE_OTHER;
+
+       switch (ffdc_cfg_byte) {
+       /* iMON Knob, no display, iMON IR + vol knob */
+       case 0x21:
+               dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR");
+               ictx->display_supported = false;
+               break;
+       /* iMON 2.4G LT (usb stick), no display, iMON RF */
+       case 0x4e:
+               dev_info(ictx->dev, "0xffdc iMON 2.4G LT, iMON RF");
+               ictx->display_supported = false;
+               ictx->rf_device = true;
+               break;
+       /* iMON VFD, no IR (does have vol knob tho) */
+       case 0x35:
+               dev_info(ictx->dev, "0xffdc iMON VFD + knob, no IR");
+               detected_display_type = IMON_DISPLAY_TYPE_VFD;
+               break;
+       /* iMON VFD, iMON IR */
+       case 0x24:
+       case 0x85:
+               dev_info(ictx->dev, "0xffdc iMON VFD, iMON IR");
+               detected_display_type = IMON_DISPLAY_TYPE_VFD;
+               break;
+       /* iMON VFD, MCE IR */
+       case 0x9e:
+               dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
+               detected_display_type = IMON_DISPLAY_TYPE_VFD;
+               allowed_protos = IR_TYPE_RC6;
+               break;
+       /* iMON LCD, MCE IR */
+       case 0x9f:
+               dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
+               detected_display_type = IMON_DISPLAY_TYPE_LCD;
+               allowed_protos = IR_TYPE_RC6;
+               break;
+       default:
+               dev_info(ictx->dev, "Unknown 0xffdc device, "
+                        "defaulting to VFD and iMON IR");
+               detected_display_type = IMON_DISPLAY_TYPE_VFD;
+               break;
+       }
+
+       printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
+
+       ictx->display_type = detected_display_type;
+       ictx->props->allowed_protos = allowed_protos;
+       ictx->ir_type = allowed_protos;
+}
+
+static void imon_set_display_type(struct imon_context *ictx)
+{
+       u8 configured_display_type = IMON_DISPLAY_TYPE_VFD;
+
+       /*
+        * Try to auto-detect the type of display if the user hasn't set
+        * it by hand via the display_type modparam. Default is VFD.
+        */
+
+       if (display_type == IMON_DISPLAY_TYPE_AUTO) {
+               switch (ictx->product) {
+               case 0xffdc:
+                       /* set in imon_get_ffdc_type() */
+                       configured_display_type = ictx->display_type;
+                       break;
+               case 0x0034:
+               case 0x0035:
+                       configured_display_type = IMON_DISPLAY_TYPE_VGA;
+                       break;
+               case 0x0038:
+               case 0x0039:
+               case 0x0045:
+                       configured_display_type = IMON_DISPLAY_TYPE_LCD;
+                       break;
+               case 0x003c:
+               case 0x0041:
+               case 0x0042:
+               case 0x0043:
+                       configured_display_type = IMON_DISPLAY_TYPE_NONE;
+                       ictx->display_supported = false;
+                       break;
+               case 0x0036:
+               case 0x0044:
+               default:
+                       configured_display_type = IMON_DISPLAY_TYPE_VFD;
+                       break;
+               }
+       } else {
+               configured_display_type = display_type;
+               if (display_type == IMON_DISPLAY_TYPE_NONE)
+                       ictx->display_supported = false;
+               else
+                       ictx->display_supported = true;
+               dev_info(ictx->dev, "%s: overriding display type to %d via "
+                        "modparam\n", __func__, display_type);
+       }
+
+       ictx->display_type = configured_display_type;
+}
+
 static struct input_dev *imon_init_rdev(struct imon_context *ictx)
 {
        struct input_dev *rdev;
        struct ir_dev_props *props;
        int ret;
+       char *ir_codes = NULL;
+       const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00,
+                                           0x00, 0x00, 0x00, 0x88 };
 
        rdev = input_allocate_device();
        props = kzalloc(sizeof(*props), GFP_KERNEL);
@@ -1694,7 +1850,24 @@ static struct input_dev *imon_init_rdev(struct imon_context *ictx)
        props->change_protocol = imon_ir_change_protocol;
        ictx->props = props;
 
-       ret = ir_input_register(rdev, RC_MAP_IMON_PAD, props, MOD_NAME);
+       /* Enable front-panel buttons and/or knobs */
+       memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
+       ret = send_packet(ictx);
+       /* Not fatal, but warn about it */
+       if (ret)
+               dev_info(ictx->dev, "panel buttons/knobs setup failed\n");
+
+       if (ictx->product == 0xffdc)
+               imon_get_ffdc_type(ictx);
+
+       imon_set_display_type(ictx);
+
+       if (ictx->ir_type == IR_TYPE_RC6)
+               ir_codes = RC_MAP_IMON_MCE;
+       else
+               ir_codes = RC_MAP_IMON_PAD;
+
+       ret = ir_input_register(rdev, ir_codes, props, MOD_NAME);
        if (ret < 0) {
                dev_err(ictx->dev, "remote input dev register failed\n");
                goto out;
@@ -1889,7 +2062,7 @@ static bool imon_find_endpoints(struct imon_context *ictx,
 
        /* Input endpoint is mandatory */
        if (!ir_ep_found)
-               err("%s: no valid input (IR) endpoint found.", __func__);
+               pr_err("no valid input (IR) endpoint found\n");
 
        ictx->tx_control = tx_control;
 
@@ -1927,6 +2100,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
        }
 
        mutex_init(&ictx->lock);
+       spin_lock_init(&ictx->kc_lock);
 
        mutex_lock(&ictx->lock);
 
@@ -1967,8 +2141,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf)
 
        ret = usb_submit_urb(ictx->rx_urb_intf0, GFP_KERNEL);
        if (ret) {
-               err("%s: usb_submit_urb failed for intf0 (%d)",
-                   __func__, ret);
+               pr_err("usb_submit_urb failed for intf0 (%d)\n", ret);
                goto urb_submit_failed;
        }
 
@@ -2001,7 +2174,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
 
        rx_urb = usb_alloc_urb(0, GFP_KERNEL);
        if (!rx_urb) {
-               err("%s: usb_alloc_urb failed for IR urb", __func__);
+               pr_err("usb_alloc_urb failed for IR urb\n");
                goto rx_urb_alloc_failed;
        }
 
@@ -2039,8 +2212,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
        ret = usb_submit_urb(ictx->rx_urb_intf1, GFP_KERNEL);
 
        if (ret) {
-               err("%s: usb_submit_urb failed for intf1 (%d)",
-                   __func__, ret);
+               pr_err("usb_submit_urb failed for intf1 (%d)\n", ret);
                goto urb_submit_failed;
        }
 
@@ -2059,116 +2231,6 @@ rx_urb_alloc_failed:
        return NULL;
 }
 
-/*
- * The 0x15c2:0xffdc device ID was used for umpteen different imon
- * devices, and all of them constantly spew interrupts, even when there
- * is no actual data to report. However, byte 6 of this buffer looks like
- * its unique across device variants, so we're trying to key off that to
- * figure out which display type (if any) and what IR protocol the device
- * actually supports. These devices have their IR protocol hard-coded into
- * their firmware, they can't be changed on the fly like the newer hardware.
- */
-static void imon_get_ffdc_type(struct imon_context *ictx)
-{
-       u8 ffdc_cfg_byte = ictx->usb_rx_buf[6];
-       u8 detected_display_type = IMON_DISPLAY_TYPE_NONE;
-       u64 allowed_protos = IR_TYPE_OTHER;
-
-       switch (ffdc_cfg_byte) {
-       /* iMON Knob, no display, iMON IR + vol knob */
-       case 0x21:
-               dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR");
-               ictx->display_supported = false;
-               break;
-       /* iMON 2.4G LT (usb stick), no display, iMON RF */
-       case 0x4e:
-               dev_info(ictx->dev, "0xffdc iMON 2.4G LT, iMON RF");
-               ictx->display_supported = false;
-               ictx->rf_device = true;
-               break;
-       /* iMON VFD, no IR (does have vol knob tho) */
-       case 0x35:
-               dev_info(ictx->dev, "0xffdc iMON VFD + knob, no IR");
-               detected_display_type = IMON_DISPLAY_TYPE_VFD;
-               break;
-       /* iMON VFD, iMON IR */
-       case 0x24:
-       case 0x85:
-               dev_info(ictx->dev, "0xffdc iMON VFD, iMON IR");
-               detected_display_type = IMON_DISPLAY_TYPE_VFD;
-               break;
-       /* iMON LCD, MCE IR */
-       case 0x9e:
-       case 0x9f:
-               dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
-               detected_display_type = IMON_DISPLAY_TYPE_LCD;
-               allowed_protos = IR_TYPE_RC6;
-               break;
-       default:
-               dev_info(ictx->dev, "Unknown 0xffdc device, "
-                        "defaulting to VFD and iMON IR");
-               detected_display_type = IMON_DISPLAY_TYPE_VFD;
-               break;
-       }
-
-       printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
-
-       ictx->display_type = detected_display_type;
-       ictx->props->allowed_protos = allowed_protos;
-       ictx->ir_type = allowed_protos;
-}
-
-static void imon_set_display_type(struct imon_context *ictx,
-                                 struct usb_interface *intf)
-{
-       u8 configured_display_type = IMON_DISPLAY_TYPE_VFD;
-
-       /*
-        * Try to auto-detect the type of display if the user hasn't set
-        * it by hand via the display_type modparam. Default is VFD.
-        */
-
-       if (display_type == IMON_DISPLAY_TYPE_AUTO) {
-               switch (ictx->product) {
-               case 0xffdc:
-                       /* set in imon_get_ffdc_type() */
-                       configured_display_type = ictx->display_type;
-                       break;
-               case 0x0034:
-               case 0x0035:
-                       configured_display_type = IMON_DISPLAY_TYPE_VGA;
-                       break;
-               case 0x0038:
-               case 0x0039:
-               case 0x0045:
-                       configured_display_type = IMON_DISPLAY_TYPE_LCD;
-                       break;
-               case 0x003c:
-               case 0x0041:
-               case 0x0042:
-               case 0x0043:
-                       configured_display_type = IMON_DISPLAY_TYPE_NONE;
-                       ictx->display_supported = false;
-                       break;
-               case 0x0036:
-               case 0x0044:
-               default:
-                       configured_display_type = IMON_DISPLAY_TYPE_VFD;
-                       break;
-               }
-       } else {
-               configured_display_type = display_type;
-               if (display_type == IMON_DISPLAY_TYPE_NONE)
-                       ictx->display_supported = false;
-               else
-                       ictx->display_supported = true;
-               dev_info(ictx->dev, "%s: overriding display type to %d via "
-                        "modparam\n", __func__, display_type);
-       }
-
-       ictx->display_type = configured_display_type;
-}
-
 static void imon_init_display(struct imon_context *ictx,
                              struct usb_interface *intf)
 {
@@ -2209,8 +2271,6 @@ static int __devinit imon_probe(struct usb_interface *interface,
        struct imon_context *ictx = NULL;
        struct imon_context *first_if_ctx = NULL;
        u16 vendor, product;
-       const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00,
-                                           0x00, 0x00, 0x00, 0x88 };
 
        code_length = BUF_CHUNK_SIZE * 8;
 
@@ -2232,7 +2292,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
        if (ifnum == 0) {
                ictx = imon_init_intf0(interface);
                if (!ictx) {
-                       err("%s: failed to initialize context!\n", __func__);
+                       pr_err("failed to initialize context!\n");
                        ret = -ENODEV;
                        goto fail;
                }
@@ -2241,7 +2301,7 @@ static int __devinit imon_probe(struct usb_interface *interface,
        /* this is the secondary interface on the device */
                ictx = imon_init_intf1(interface, first_if_ctx);
                if (!ictx) {
-                       err("%s: failed to attach to context!\n", __func__);
+                       pr_err("failed to attach to context!\n");
                        ret = -ENODEV;
                        goto fail;
                }
@@ -2251,25 +2311,12 @@ static int __devinit imon_probe(struct usb_interface *interface,
        usb_set_intfdata(interface, ictx);
 
        if (ifnum == 0) {
-               /* Enable front-panel buttons and/or knobs */
-               memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
-               ret = send_packet(ictx);
-               /* Not fatal, but warn about it */
-               if (ret)
-                       dev_info(dev, "failed to enable panel buttons "
-                                "and/or knobs\n");
-
-               if (product == 0xffdc)
-                       imon_get_ffdc_type(ictx);
-
-               imon_set_display_type(ictx, interface);
-
                if (product == 0xffdc && ictx->rf_device) {
                        sysfs_err = sysfs_create_group(&interface->dev.kobj,
                                                       &imon_rf_attribute_group);
                        if (sysfs_err)
-                               err("%s: Could not create RF sysfs entries(%d)",
-                                   __func__, sysfs_err);
+                               pr_err("Could not create RF sysfs entries(%d)\n",
+                                      sysfs_err);
                }
 
                if (ictx->display_supported)
@@ -2417,7 +2464,7 @@ static int __init imon_init(void)
 
        rc = usb_register(&imon_driver);
        if (rc) {
-               err("%s: usb register failed(%d)", __func__, rc);
+               pr_err("usb register failed(%d)\n", rc);
                rc = -ENODEV;
        }