aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/imon.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r--drivers/media/rc/imon.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 5dd0386604f0..8f6a28921ed4 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1001,7 +1001,7 @@ static void imon_touch_display_timeout(unsigned long data)
1001 * it is not, so we must acquire it prior to calling send_packet, which 1001 * it is not, so we must acquire it prior to calling send_packet, which
1002 * requires that the lock is held. 1002 * requires that the lock is held.
1003 */ 1003 */
1004static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) 1004static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_type)
1005{ 1005{
1006 int retval; 1006 int retval;
1007 struct imon_context *ictx = rc->priv; 1007 struct imon_context *ictx = rc->priv;
@@ -1010,31 +1010,27 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
1010 unsigned char ir_proto_packet[] = { 1010 unsigned char ir_proto_packet[] = {
1011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; 1011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
1012 1012
1013 if (rc_type && !(rc_type & rc->allowed_protos)) 1013 if (*rc_type && !(*rc_type & rc->allowed_protos))
1014 dev_warn(dev, "Looks like you're trying to use an IR protocol " 1014 dev_warn(dev, "Looks like you're trying to use an IR protocol "
1015 "this device does not support\n"); 1015 "this device does not support\n");
1016 1016
1017 switch (rc_type) { 1017 if (*rc_type & RC_BIT_RC6_MCE) {
1018 case RC_TYPE_RC6:
1019 dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); 1018 dev_dbg(dev, "Configuring IR receiver for MCE protocol\n");
1020 ir_proto_packet[0] = 0x01; 1019 ir_proto_packet[0] = 0x01;
1021 break; 1020 *rc_type = RC_BIT_RC6_MCE;
1022 case RC_TYPE_UNKNOWN: 1021 } else if (*rc_type & RC_BIT_OTHER) {
1023 case RC_TYPE_OTHER:
1024 dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); 1022 dev_dbg(dev, "Configuring IR receiver for iMON protocol\n");
1025 if (!pad_stabilize) 1023 if (!pad_stabilize)
1026 dev_dbg(dev, "PAD stabilize functionality disabled\n"); 1024 dev_dbg(dev, "PAD stabilize functionality disabled\n");
1027 /* ir_proto_packet[0] = 0x00; // already the default */ 1025 /* ir_proto_packet[0] = 0x00; // already the default */
1028 rc_type = RC_TYPE_OTHER; 1026 *rc_type = RC_BIT_OTHER;
1029 break; 1027 } else {
1030 default:
1031 dev_warn(dev, "Unsupported IR protocol specified, overriding " 1028 dev_warn(dev, "Unsupported IR protocol specified, overriding "
1032 "to iMON IR protocol\n"); 1029 "to iMON IR protocol\n");
1033 if (!pad_stabilize) 1030 if (!pad_stabilize)
1034 dev_dbg(dev, "PAD stabilize functionality disabled\n"); 1031 dev_dbg(dev, "PAD stabilize functionality disabled\n");
1035 /* ir_proto_packet[0] = 0x00; // already the default */ 1032 /* ir_proto_packet[0] = 0x00; // already the default */
1036 rc_type = RC_TYPE_OTHER; 1033 *rc_type = RC_BIT_OTHER;
1037 break;
1038 } 1034 }
1039 1035
1040 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); 1036 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet));
@@ -1048,7 +1044,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
1048 if (retval) 1044 if (retval)
1049 goto out; 1045 goto out;
1050 1046
1051 ictx->rc_type = rc_type; 1047 ictx->rc_type = *rc_type;
1052 ictx->pad_mouse = false; 1048 ictx->pad_mouse = false;
1053 1049
1054out: 1050out:
@@ -1323,7 +1319,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1323 rel_x = buf[2]; 1319 rel_x = buf[2];
1324 rel_y = buf[3]; 1320 rel_y = buf[3];
1325 1321
1326 if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { 1322 if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) {
1327 if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { 1323 if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) {
1328 dir = stabilize((int)rel_x, (int)rel_y, 1324 dir = stabilize((int)rel_x, (int)rel_y,
1329 timeout, threshold); 1325 timeout, threshold);
@@ -1390,7 +1386,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1390 buf[0] = 0x01; 1386 buf[0] = 0x01;
1391 buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; 1387 buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0;
1392 1388
1393 if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { 1389 if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) {
1394 dir = stabilize((int)rel_x, (int)rel_y, 1390 dir = stabilize((int)rel_x, (int)rel_y,
1395 timeout, threshold); 1391 timeout, threshold);
1396 if (!dir) { 1392 if (!dir) {
@@ -1511,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
1511 kc = imon_panel_key_lookup(scancode); 1507 kc = imon_panel_key_lookup(scancode);
1512 } else { 1508 } else {
1513 scancode = be32_to_cpu(*((u32 *)buf)); 1509 scancode = be32_to_cpu(*((u32 *)buf));
1514 if (ictx->rc_type == RC_TYPE_RC6) { 1510 if (ictx->rc_type == RC_BIT_RC6_MCE) {
1515 ktype = IMON_KEY_IMON; 1511 ktype = IMON_KEY_IMON;
1516 if (buf[0] == 0x80) 1512 if (buf[0] == 0x80)
1517 ktype = IMON_KEY_MCE; 1513 ktype = IMON_KEY_MCE;
@@ -1744,7 +1740,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1744{ 1740{
1745 u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; 1741 u8 ffdc_cfg_byte = ictx->usb_rx_buf[6];
1746 u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; 1742 u8 detected_display_type = IMON_DISPLAY_TYPE_NONE;
1747 u64 allowed_protos = RC_TYPE_OTHER; 1743 u64 allowed_protos = RC_BIT_OTHER;
1748 1744
1749 switch (ffdc_cfg_byte) { 1745 switch (ffdc_cfg_byte) {
1750 /* iMON Knob, no display, iMON IR + vol knob */ 1746 /* iMON Knob, no display, iMON IR + vol knob */
@@ -1775,13 +1771,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1775 case 0x9e: 1771 case 0x9e:
1776 dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); 1772 dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
1777 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1773 detected_display_type = IMON_DISPLAY_TYPE_VFD;
1778 allowed_protos = RC_TYPE_RC6; 1774 allowed_protos = RC_BIT_RC6_MCE;
1779 break; 1775 break;
1780 /* iMON LCD, MCE IR */ 1776 /* iMON LCD, MCE IR */
1781 case 0x9f: 1777 case 0x9f:
1782 dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); 1778 dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
1783 detected_display_type = IMON_DISPLAY_TYPE_LCD; 1779 detected_display_type = IMON_DISPLAY_TYPE_LCD;
1784 allowed_protos = RC_TYPE_RC6; 1780 allowed_protos = RC_BIT_RC6_MCE;
1785 break; 1781 break;
1786 default: 1782 default:
1787 dev_info(ictx->dev, "Unknown 0xffdc device, " 1783 dev_info(ictx->dev, "Unknown 0xffdc device, "
@@ -1789,7 +1785,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1789 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1785 detected_display_type = IMON_DISPLAY_TYPE_VFD;
1790 /* We don't know which one it is, allow user to set the 1786 /* We don't know which one it is, allow user to set the
1791 * RC6 one from userspace if OTHER wasn't correct. */ 1787 * RC6 one from userspace if OTHER wasn't correct. */
1792 allowed_protos |= RC_TYPE_RC6; 1788 allowed_protos |= RC_BIT_RC6_MCE;
1793 break; 1789 break;
1794 } 1790 }
1795 1791
@@ -1875,7 +1871,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1875 1871
1876 rdev->priv = ictx; 1872 rdev->priv = ictx;
1877 rdev->driver_type = RC_DRIVER_SCANCODE; 1873 rdev->driver_type = RC_DRIVER_SCANCODE;
1878 rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ 1874 rdev->allowed_protos = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */
1879 rdev->change_protocol = imon_ir_change_protocol; 1875 rdev->change_protocol = imon_ir_change_protocol;
1880 rdev->driver_name = MOD_NAME; 1876 rdev->driver_name = MOD_NAME;
1881 1877
@@ -1893,7 +1889,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1893 1889
1894 imon_set_display_type(ictx); 1890 imon_set_display_type(ictx);
1895 1891
1896 if (ictx->rc_type == RC_TYPE_RC6) 1892 if (ictx->rc_type == RC_BIT_RC6_MCE)
1897 rdev->map_name = RC_MAP_IMON_MCE; 1893 rdev->map_name = RC_MAP_IMON_MCE;
1898 else 1894 else
1899 rdev->map_name = RC_MAP_IMON_PAD; 1895 rdev->map_name = RC_MAP_IMON_PAD;