[media] rc-core: remove the LIRC "protocol"
authorDavid Härdeman <david@hardeman.nu>
Tue, 19 May 2015 22:03:22 +0000 (19:03 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 6 Jul 2015 11:26:15 +0000 (08:26 -0300)
The LIRC protocol was always a bad fit and if we're ever going to expose
protocol numbers in a user-space API, it'd be better to get rid of the
LIRC "protocol" first.

The sysfs API is kept backwards compatible by always listing the lirc
protocol as present and enabled.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/rc/ir-lirc-codec.c
drivers/media/rc/keymaps/rc-lirc.c
drivers/media/rc/rc-main.c
include/media/rc-map.h

index 98893a8332c7aa502aa269eaa6c1c5d081ac120d..a32659fcd266c5d36cbde8ce5ea86e6cc4609977 100644 (file)
@@ -35,9 +35,6 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
        struct lirc_codec *lirc = &dev->raw->lirc;
        int sample;
 
-       if (!(dev->enabled_protocols & RC_BIT_LIRC))
-               return 0;
-
        if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
                return -EINVAL;
 
@@ -424,7 +421,7 @@ static int ir_lirc_unregister(struct rc_dev *dev)
 }
 
 static struct ir_raw_handler lirc_handler = {
-       .protocols      = RC_BIT_LIRC,
+       .protocols      = 0,
        .decode         = ir_lirc_decode,
        .raw_register   = ir_lirc_register,
        .raw_unregister = ir_lirc_unregister,
index fbf08fa6f46e7bee61d165a71ca987e3822415d1..e172f5db580354bed975cb901e14b1789fb982c6 100644 (file)
@@ -20,7 +20,7 @@ static struct rc_map_list lirc_map = {
        .map = {
                .scan    = lirc,
                .size    = ARRAY_SIZE(lirc),
-               .rc_type = RC_TYPE_LIRC,
+               .rc_type = RC_TYPE_OTHER,
                .name    = RC_MAP_LIRC,
        }
 };
index 20914edd5a102c1c0ef1242489f671011295bd7e..c80816561181bc6def3c2caf3203bfecb16f90c3 100644 (file)
@@ -800,7 +800,6 @@ static struct {
        { RC_BIT_SANYO,         "sanyo"         },
        { RC_BIT_SHARP,         "sharp"         },
        { RC_BIT_MCE_KBD,       "mce_kbd"       },
-       { RC_BIT_LIRC,          "lirc"          },
        { RC_BIT_XMP,           "xmp"           },
 };
 
@@ -885,6 +884,9 @@ static ssize_t show_protocols(struct device *device,
                        allowed &= ~proto_names[i].type;
        }
 
+       if (dev->driver_type == RC_DRIVER_IR_RAW)
+               tmp += sprintf(tmp, "[lirc] ");
+
        if (tmp != buf)
                tmp--;
        *tmp = '\n';
@@ -936,8 +938,12 @@ static int parse_protocol_change(u64 *protocols, const char *buf)
                }
 
                if (i == ARRAY_SIZE(proto_names)) {
-                       IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
-                       return -EINVAL;
+                       if (!strcasecmp(tmp, "lirc"))
+                               mask = 0;
+                       else {
+                               IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
+                               return -EINVAL;
+                       }
                }
 
                count++;
@@ -1425,8 +1431,6 @@ int rc_register_device(struct rc_dev *dev)
 
        if (dev->change_protocol) {
                u64 rc_type = (1ll << rc_map->rc_type);
-               if (dev->driver_type == RC_DRIVER_IR_RAW)
-                       rc_type |= RC_BIT_LIRC;
                rc = dev->change_protocol(dev, &rc_type);
                if (rc < 0)
                        goto out_raw;
index 27763d5bd2612569126fa06f2a23c4c571c2956f..7c4bbc4dfab4b72c49e6432dcbf6a42cc94e7d89 100644 (file)
 enum rc_type {
        RC_TYPE_UNKNOWN         = 0,    /* Protocol not known */
        RC_TYPE_OTHER           = 1,    /* Protocol known but proprietary */
-       RC_TYPE_LIRC            = 2,    /* Pass raw IR to lirc userspace */
-       RC_TYPE_RC5             = 3,    /* Philips RC5 protocol */
-       RC_TYPE_RC5X            = 4,    /* Philips RC5x protocol */
-       RC_TYPE_RC5_SZ          = 5,    /* StreamZap variant of RC5 */
-       RC_TYPE_JVC             = 6,    /* JVC protocol */
-       RC_TYPE_SONY12          = 7,    /* Sony 12 bit protocol */
-       RC_TYPE_SONY15          = 8,    /* Sony 15 bit protocol */
-       RC_TYPE_SONY20          = 9,    /* Sony 20 bit protocol */
-       RC_TYPE_NEC             = 10,   /* NEC protocol */
-       RC_TYPE_SANYO           = 11,   /* Sanyo protocol */
-       RC_TYPE_MCE_KBD         = 12,   /* RC6-ish MCE keyboard/mouse */
-       RC_TYPE_RC6_0           = 13,   /* Philips RC6-0-16 protocol */
-       RC_TYPE_RC6_6A_20       = 14,   /* Philips RC6-6A-20 protocol */
-       RC_TYPE_RC6_6A_24       = 15,   /* Philips RC6-6A-24 protocol */
-       RC_TYPE_RC6_6A_32       = 16,   /* Philips RC6-6A-32 protocol */
-       RC_TYPE_RC6_MCE         = 17,   /* MCE (Philips RC6-6A-32 subtype) protocol */
-       RC_TYPE_SHARP           = 18,   /* Sharp protocol */
-       RC_TYPE_XMP             = 19,   /* XMP protocol */
+       RC_TYPE_RC5             = 2,    /* Philips RC5 protocol */
+       RC_TYPE_RC5X            = 3,    /* Philips RC5x protocol */
+       RC_TYPE_RC5_SZ          = 4,    /* StreamZap variant of RC5 */
+       RC_TYPE_JVC             = 5,    /* JVC protocol */
+       RC_TYPE_SONY12          = 6,    /* Sony 12 bit protocol */
+       RC_TYPE_SONY15          = 7,    /* Sony 15 bit protocol */
+       RC_TYPE_SONY20          = 8,    /* Sony 20 bit protocol */
+       RC_TYPE_NEC             = 9,    /* NEC protocol */
+       RC_TYPE_SANYO           = 10,   /* Sanyo protocol */
+       RC_TYPE_MCE_KBD         = 11,   /* RC6-ish MCE keyboard/mouse */
+       RC_TYPE_RC6_0           = 12,   /* Philips RC6-0-16 protocol */
+       RC_TYPE_RC6_6A_20       = 13,   /* Philips RC6-6A-20 protocol */
+       RC_TYPE_RC6_6A_24       = 14,   /* Philips RC6-6A-24 protocol */
+       RC_TYPE_RC6_6A_32       = 15,   /* Philips RC6-6A-32 protocol */
+       RC_TYPE_RC6_MCE         = 16,   /* MCE (Philips RC6-6A-32 subtype) protocol */
+       RC_TYPE_SHARP           = 17,   /* Sharp protocol */
+       RC_TYPE_XMP             = 18,   /* XMP protocol */
 };
 
 #define RC_BIT_NONE            0
 #define RC_BIT_UNKNOWN         (1 << RC_TYPE_UNKNOWN)
 #define RC_BIT_OTHER           (1 << RC_TYPE_OTHER)
-#define RC_BIT_LIRC            (1 << RC_TYPE_LIRC)
 #define RC_BIT_RC5             (1 << RC_TYPE_RC5)
 #define RC_BIT_RC5X            (1 << RC_TYPE_RC5X)
 #define RC_BIT_RC5_SZ          (1 << RC_TYPE_RC5_SZ)
@@ -56,7 +54,7 @@ enum rc_type {
 #define RC_BIT_SHARP           (1 << RC_TYPE_SHARP)
 #define RC_BIT_XMP             (1 << RC_TYPE_XMP)
 
-#define RC_BIT_ALL     (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \
+#define RC_BIT_ALL     (RC_BIT_UNKNOWN | RC_BIT_OTHER | \
                         RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
                         RC_BIT_JVC | \
                         RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \