diff options
author | Sean Young <sean@mess.org> | 2017-08-07 16:20:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-08-20 10:02:48 -0400 |
commit | 6d741bfed5ed06ed42a16d30f1ed7afdcaf7f092 (patch) | |
tree | ba80456506b89d858a91daddde92237b93fabe1c /include | |
parent | a9a249a2c997506a64eaee22f1458fda893f62a8 (diff) |
media: rc: rename RC_TYPE_* to RC_PROTO_* and RC_BIT_* to RC_PROTO_BIT_*
RC_TYPE is confusing and it's just the protocol. So rename it.
Suggested-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Sean Young <sean@mess.org>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/media/i2c/ir-kbd-i2c.h | 8 | ||||
-rw-r--r-- | include/media/rc-core.h | 33 | ||||
-rw-r--r-- | include/media/rc-map.h | 215 |
3 files changed, 135 insertions, 121 deletions
diff --git a/include/media/i2c/ir-kbd-i2c.h b/include/media/i2c/ir-kbd-i2c.h index d8564354debb..ac8c55617a79 100644 --- a/include/media/i2c/ir-kbd-i2c.h +++ b/include/media/i2c/ir-kbd-i2c.h @@ -20,7 +20,8 @@ struct IR_i2c { struct delayed_work work; char name[32]; char phys[32]; - int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol, + int (*get_key)(struct IR_i2c *ir, + enum rc_proto *protocol, u32 *scancode, u8 *toggle); }; @@ -38,14 +39,15 @@ enum ir_kbd_get_key_fn { struct IR_i2c_init_data { char *ir_codes; const char *name; - u64 type; /* RC_BIT_RC5, etc */ + u64 type; /* RC_PROTO_BIT_RC5, etc */ u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ /* * Specify either a function pointer or a value indicating one of * ir_kbd_i2c's internal get_key functions */ - int (*get_key)(struct IR_i2c *ir, enum rc_type *protocol, + int (*get_key)(struct IR_i2c *ir, + enum rc_proto *protocol, u32 *scancode, u8 *toggle); enum ir_kbd_get_key_fn internal_get_key_func; diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 5be527ff851d..314a1edb6189 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -87,11 +87,12 @@ enum rc_filter_type { * @idle: used to keep track of RX state * @encode_wakeup: wakeup filtering uses IR encode API, therefore the allowed * wakeup protocols is the set of all raw encoders - * @allowed_protocols: bitmask with the supported RC_BIT_* protocols - * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols - * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols - * @wakeup_protocol: the enabled RC_TYPE_* wakeup protocol or - * RC_TYPE_UNKNOWN if disabled. + * @allowed_protocols: bitmask with the supported RC_PROTO_BIT_* protocols + * @enabled_protocols: bitmask with the enabled RC_PROTO_BIT_* protocols + * @allowed_wakeup_protocols: bitmask with the supported RC_PROTO_BIT_* wakeup + * protocols + * @wakeup_protocol: the enabled RC_PROTO_* wakeup protocol or + * RC_PROTO_UNKNOWN if disabled. * @scancode_filter: scancode filter * @scancode_wakeup_filter: scancode wakeup filters * @scancode_mask: some hardware decoders are not capable of providing the full @@ -154,7 +155,7 @@ struct rc_dev { u64 allowed_protocols; u64 enabled_protocols; u64 allowed_wakeup_protocols; - enum rc_type wakeup_protocol; + enum rc_proto wakeup_protocol; struct rc_scancode_filter scancode_filter; struct rc_scancode_filter scancode_wakeup_filter; u32 scancode_mask; @@ -165,7 +166,7 @@ struct rc_dev { unsigned long keyup_jiffies; struct timer_list timer_keyup; u32 last_keycode; - enum rc_type last_protocol; + enum rc_proto last_protocol; u32 last_scancode; u8 last_toggle; u32 timeout; @@ -173,7 +174,7 @@ struct rc_dev { u32 max_timeout; u32 rx_resolution; u32 tx_resolution; - int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); + int (*change_protocol)(struct rc_dev *dev, u64 *rc_proto); int (*open)(struct rc_dev *dev); void (*close)(struct rc_dev *dev); int (*s_tx_mask)(struct rc_dev *dev, u32 mask); @@ -262,8 +263,10 @@ int rc_open(struct rc_dev *rdev); void rc_close(struct rc_dev *rdev); void rc_repeat(struct rc_dev *dev); -void rc_keydown(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 toggle); -void rc_keydown_notimeout(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 toggle); +void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u32 scancode, + u8 toggle); +void rc_keydown_notimeout(struct rc_dev *dev, enum rc_proto protocol, + u32 scancode, u8 toggle); void rc_keyup(struct rc_dev *dev); u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode); @@ -304,7 +307,7 @@ int ir_raw_event_store_edge(struct rc_dev *dev, bool pulse); int ir_raw_event_store_with_filter(struct rc_dev *dev, struct ir_raw_event *ev); void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); -int ir_raw_encode_scancode(enum rc_type protocol, u32 scancode, +int ir_raw_encode_scancode(enum rc_proto protocol, u32 scancode, struct ir_raw_event *events, unsigned int max); static inline void ir_raw_event_reset(struct rc_dev *dev) @@ -335,7 +338,7 @@ static inline u32 ir_extract_bits(u32 data, u32 mask) /* Get NEC scancode and protocol type from address and command bytes */ static inline u32 ir_nec_bytes_to_scancode(u8 address, u8 not_address, u8 command, u8 not_command, - enum rc_type *protocol) + enum rc_proto *protocol) { u32 scancode; @@ -347,17 +350,17 @@ static inline u32 ir_nec_bytes_to_scancode(u8 address, u8 not_address, address << 16 | not_command << 8 | command; - *protocol = RC_TYPE_NEC32; + *protocol = RC_PROTO_NEC32; } else if ((address ^ not_address) != 0xff) { /* Extended NEC */ scancode = address << 16 | not_address << 8 | command; - *protocol = RC_TYPE_NECX; + *protocol = RC_PROTO_NECX; } else { /* Normal NEC */ scancode = address << 8 | command; - *protocol = RC_TYPE_NEC; + *protocol = RC_PROTO_NEC; } return scancode; diff --git a/include/media/rc-map.h b/include/media/rc-map.h index c69482852f29..2a160e6e823c 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -12,113 +12,122 @@ #include <linux/input.h> /** - * enum rc_type - type of the Remote Controller protocol + * enum rc_proto - the Remote Controller protocol * - * @RC_TYPE_UNKNOWN: Protocol not known - * @RC_TYPE_OTHER: Protocol known but proprietary - * @RC_TYPE_RC5: Philips RC5 protocol - * @RC_TYPE_RC5X_20: Philips RC5x 20 bit protocol - * @RC_TYPE_RC5_SZ: StreamZap variant of RC5 - * @RC_TYPE_JVC: JVC protocol - * @RC_TYPE_SONY12: Sony 12 bit protocol - * @RC_TYPE_SONY15: Sony 15 bit protocol - * @RC_TYPE_SONY20: Sony 20 bit protocol - * @RC_TYPE_NEC: NEC protocol - * @RC_TYPE_NECX: Extended NEC protocol - * @RC_TYPE_NEC32: NEC 32 bit protocol - * @RC_TYPE_SANYO: Sanyo protocol - * @RC_TYPE_MCIR2_KBD: RC6-ish MCE keyboard - * @RC_TYPE_MCIR2_MSE: RC6-ish MCE mouse - * @RC_TYPE_RC6_0: Philips RC6-0-16 protocol - * @RC_TYPE_RC6_6A_20: Philips RC6-6A-20 protocol - * @RC_TYPE_RC6_6A_24: Philips RC6-6A-24 protocol - * @RC_TYPE_RC6_6A_32: Philips RC6-6A-32 protocol - * @RC_TYPE_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol - * @RC_TYPE_SHARP: Sharp protocol - * @RC_TYPE_XMP: XMP protocol - * @RC_TYPE_CEC: CEC protocol + * @RC_PROTO_UNKNOWN: Protocol not known + * @RC_PROTO_OTHER: Protocol known but proprietary + * @RC_PROTO_RC5: Philips RC5 protocol + * @RC_PROTO_RC5X_20: Philips RC5x 20 bit protocol + * @RC_PROTO_RC5_SZ: StreamZap variant of RC5 + * @RC_PROTO_JVC: JVC protocol + * @RC_PROTO_SONY12: Sony 12 bit protocol + * @RC_PROTO_SONY15: Sony 15 bit protocol + * @RC_PROTO_SONY20: Sony 20 bit protocol + * @RC_PROTO_NEC: NEC protocol + * @RC_PROTO_NECX: Extended NEC protocol + * @RC_PROTO_NEC32: NEC 32 bit protocol + * @RC_PROTO_SANYO: Sanyo protocol + * @RC_PROTO_MCIR2_KBD: RC6-ish MCE keyboard + * @RC_PROTO_MCIR2_MSE: RC6-ish MCE mouse + * @RC_PROTO_RC6_0: Philips RC6-0-16 protocol + * @RC_PROTO_RC6_6A_20: Philips RC6-6A-20 protocol + * @RC_PROTO_RC6_6A_24: Philips RC6-6A-24 protocol + * @RC_PROTO_RC6_6A_32: Philips RC6-6A-32 protocol + * @RC_PROTO_RC6_MCE: MCE (Philips RC6-6A-32 subtype) protocol + * @RC_PROTO_SHARP: Sharp protocol + * @RC_PROTO_XMP: XMP protocol + * @RC_PROTO_CEC: CEC protocol */ -enum rc_type { - RC_TYPE_UNKNOWN = 0, - RC_TYPE_OTHER = 1, - RC_TYPE_RC5 = 2, - RC_TYPE_RC5X_20 = 3, - RC_TYPE_RC5_SZ = 4, - RC_TYPE_JVC = 5, - RC_TYPE_SONY12 = 6, - RC_TYPE_SONY15 = 7, - RC_TYPE_SONY20 = 8, - RC_TYPE_NEC = 9, - RC_TYPE_NECX = 10, - RC_TYPE_NEC32 = 11, - RC_TYPE_SANYO = 12, - RC_TYPE_MCIR2_KBD = 13, - RC_TYPE_MCIR2_MSE = 14, - RC_TYPE_RC6_0 = 15, - RC_TYPE_RC6_6A_20 = 16, - RC_TYPE_RC6_6A_24 = 17, - RC_TYPE_RC6_6A_32 = 18, - RC_TYPE_RC6_MCE = 19, - RC_TYPE_SHARP = 20, - RC_TYPE_XMP = 21, - RC_TYPE_CEC = 22, +enum rc_proto { + RC_PROTO_UNKNOWN = 0, + RC_PROTO_OTHER = 1, + RC_PROTO_RC5 = 2, + RC_PROTO_RC5X_20 = 3, + RC_PROTO_RC5_SZ = 4, + RC_PROTO_JVC = 5, + RC_PROTO_SONY12 = 6, + RC_PROTO_SONY15 = 7, + RC_PROTO_SONY20 = 8, + RC_PROTO_NEC = 9, + RC_PROTO_NECX = 10, + RC_PROTO_NEC32 = 11, + RC_PROTO_SANYO = 12, + RC_PROTO_MCIR2_KBD = 13, + RC_PROTO_MCIR2_MSE = 14, + RC_PROTO_RC6_0 = 15, + RC_PROTO_RC6_6A_20 = 16, + RC_PROTO_RC6_6A_24 = 17, + RC_PROTO_RC6_6A_32 = 18, + RC_PROTO_RC6_MCE = 19, + RC_PROTO_SHARP = 20, + RC_PROTO_XMP = 21, + RC_PROTO_CEC = 22, }; -#define RC_BIT_NONE 0ULL -#define RC_BIT_UNKNOWN BIT_ULL(RC_TYPE_UNKNOWN) -#define RC_BIT_OTHER BIT_ULL(RC_TYPE_OTHER) -#define RC_BIT_RC5 BIT_ULL(RC_TYPE_RC5) -#define RC_BIT_RC5X_20 BIT_ULL(RC_TYPE_RC5X_20) -#define RC_BIT_RC5_SZ BIT_ULL(RC_TYPE_RC5_SZ) -#define RC_BIT_JVC BIT_ULL(RC_TYPE_JVC) -#define RC_BIT_SONY12 BIT_ULL(RC_TYPE_SONY12) -#define RC_BIT_SONY15 BIT_ULL(RC_TYPE_SONY15) -#define RC_BIT_SONY20 BIT_ULL(RC_TYPE_SONY20) -#define RC_BIT_NEC BIT_ULL(RC_TYPE_NEC) -#define RC_BIT_NECX BIT_ULL(RC_TYPE_NECX) -#define RC_BIT_NEC32 BIT_ULL(RC_TYPE_NEC32) -#define RC_BIT_SANYO BIT_ULL(RC_TYPE_SANYO) -#define RC_BIT_MCIR2_KBD BIT_ULL(RC_TYPE_MCIR2_KBD) -#define RC_BIT_MCIR2_MSE BIT_ULL(RC_TYPE_MCIR2_MSE) -#define RC_BIT_RC6_0 BIT_ULL(RC_TYPE_RC6_0) -#define RC_BIT_RC6_6A_20 BIT_ULL(RC_TYPE_RC6_6A_20) -#define RC_BIT_RC6_6A_24 BIT_ULL(RC_TYPE_RC6_6A_24) -#define RC_BIT_RC6_6A_32 BIT_ULL(RC_TYPE_RC6_6A_32) -#define RC_BIT_RC6_MCE BIT_ULL(RC_TYPE_RC6_MCE) -#define RC_BIT_SHARP BIT_ULL(RC_TYPE_SHARP) -#define RC_BIT_XMP BIT_ULL(RC_TYPE_XMP) -#define RC_BIT_CEC BIT_ULL(RC_TYPE_CEC) +#define RC_PROTO_BIT_NONE 0ULL +#define RC_PROTO_BIT_UNKNOWN BIT_ULL(RC_PROTO_UNKNOWN) +#define RC_PROTO_BIT_OTHER BIT_ULL(RC_PROTO_OTHER) +#define RC_PROTO_BIT_RC5 BIT_ULL(RC_PROTO_RC5) +#define RC_PROTO_BIT_RC5X_20 BIT_ULL(RC_PROTO_RC5X_20) +#define RC_PROTO_BIT_RC5_SZ BIT_ULL(RC_PROTO_RC5_SZ) +#define RC_PROTO_BIT_JVC BIT_ULL(RC_PROTO_JVC) +#define RC_PROTO_BIT_SONY12 BIT_ULL(RC_PROTO_SONY12) +#define RC_PROTO_BIT_SONY15 BIT_ULL(RC_PROTO_SONY15) +#define RC_PROTO_BIT_SONY20 BIT_ULL(RC_PROTO_SONY20) +#define RC_PROTO_BIT_NEC BIT_ULL(RC_PROTO_NEC) +#define RC_PROTO_BIT_NECX BIT_ULL(RC_PROTO_NECX) +#define RC_PROTO_BIT_NEC32 BIT_ULL(RC_PROTO_NEC32) +#define RC_PROTO_BIT_SANYO BIT_ULL(RC_PROTO_SANYO) +#define RC_PROTO_BIT_MCIR2_KBD BIT_ULL(RC_PROTO_MCIR2_KBD) +#define RC_PROTO_BIT_MCIR2_MSE BIT_ULL(RC_PROTO_MCIR2_MSE) +#define RC_PROTO_BIT_RC6_0 BIT_ULL(RC_PROTO_RC6_0) +#define RC_PROTO_BIT_RC6_6A_20 BIT_ULL(RC_PROTO_RC6_6A_20) +#define RC_PROTO_BIT_RC6_6A_24 BIT_ULL(RC_PROTO_RC6_6A_24) +#define RC_PROTO_BIT_RC6_6A_32 BIT_ULL(RC_PROTO_RC6_6A_32) +#define RC_PROTO_BIT_RC6_MCE BIT_ULL(RC_PROTO_RC6_MCE) +#define RC_PROTO_BIT_SHARP BIT_ULL(RC_PROTO_SHARP) +#define RC_PROTO_BIT_XMP BIT_ULL(RC_PROTO_XMP) +#define RC_PROTO_BIT_CEC BIT_ULL(RC_PROTO_CEC) -#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | \ - RC_BIT_RC5 | RC_BIT_RC5X_20 | RC_BIT_RC5_SZ | \ - RC_BIT_JVC | \ - RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ - RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | \ - RC_BIT_SANYO | \ - RC_BIT_MCIR2_KBD | RC_BIT_MCIR2_MSE | \ - RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ - RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ - RC_BIT_XMP | RC_BIT_CEC) +#define RC_PROTO_BIT_ALL \ + (RC_PROTO_BIT_UNKNOWN | RC_PROTO_BIT_OTHER | \ + RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \ + RC_PROTO_BIT_RC5_SZ | RC_PROTO_BIT_JVC | \ + RC_PROTO_BIT_SONY12 | RC_PROTO_BIT_SONY15 | \ + RC_PROTO_BIT_SONY20 | RC_PROTO_BIT_NEC | \ + RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32 | \ + RC_PROTO_BIT_SANYO | \ + RC_PROTO_BIT_MCIR2_KBD | RC_PROTO_BIT_MCIR2_MSE | \ + RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \ + RC_PROTO_BIT_RC6_6A_24 | RC_PROTO_BIT_RC6_6A_32 | \ + RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_SHARP | \ + RC_PROTO_BIT_XMP | RC_PROTO_BIT_CEC) /* All rc protocols for which we have decoders */ -#define RC_BIT_ALL_IR_DECODER \ - (RC_BIT_RC5 | RC_BIT_RC5X_20 | RC_BIT_RC5_SZ | \ - RC_BIT_JVC | \ - RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ - RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | \ - RC_BIT_SANYO | RC_BIT_MCIR2_KBD | RC_BIT_MCIR2_MSE | \ - RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ - RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | RC_BIT_SHARP | \ - RC_BIT_XMP) +#define RC_PROTO_BIT_ALL_IR_DECODER \ + (RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \ + RC_PROTO_BIT_RC5_SZ | RC_PROTO_BIT_JVC | \ + RC_PROTO_BIT_SONY12 | RC_PROTO_BIT_SONY15 | \ + RC_PROTO_BIT_SONY20 | RC_PROTO_BIT_NEC | \ + RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32 | \ + RC_PROTO_BIT_SANYO | RC_PROTO_BIT_MCIR2_KBD | \ + RC_PROTO_BIT_MCIR2_MSE | \ + RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \ + RC_PROTO_BIT_RC6_6A_24 | RC_PROTO_BIT_RC6_6A_32 | \ + RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_SHARP | \ + RC_PROTO_BIT_XMP) -#define RC_BIT_ALL_IR_ENCODER \ - (RC_BIT_RC5 | RC_BIT_RC5X_20 | RC_BIT_RC5_SZ | \ - RC_BIT_JVC | \ - RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ - RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | \ - RC_BIT_SANYO | RC_BIT_MCIR2_KBD | RC_BIT_MCIR2_MSE | \ - RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ - RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE | \ - RC_BIT_SHARP) +#define RC_PROTO_BIT_ALL_IR_ENCODER \ + (RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC5X_20 | \ + RC_PROTO_BIT_RC5_SZ | RC_PROTO_BIT_JVC | \ + RC_PROTO_BIT_SONY12 | RC_PROTO_BIT_SONY15 | \ + RC_PROTO_BIT_SONY20 | RC_PROTO_BIT_NEC | \ + RC_PROTO_BIT_NECX | RC_PROTO_BIT_NEC32 | \ + RC_PROTO_BIT_SANYO | RC_PROTO_BIT_MCIR2_KBD | \ + RC_PROTO_BIT_MCIR2_MSE | \ + RC_PROTO_BIT_RC6_0 | RC_PROTO_BIT_RC6_6A_20 | \ + RC_PROTO_BIT_RC6_6A_24 | \ + RC_PROTO_BIT_RC6_6A_32 | RC_PROTO_BIT_RC6_MCE | \ + RC_PROTO_BIT_SHARP) #define RC_SCANCODE_UNKNOWN(x) (x) #define RC_SCANCODE_OTHER(x) (x) @@ -148,8 +157,8 @@ struct rc_map_table { * @size: Max number of entries * @len: Number of entries that are in use * @alloc: size of \*scan, in bytes - * @rc_type: type of the remote controller protocol, as defined at - * enum &rc_type + * @rc_proto: type of the remote controller protocol, as defined at + * enum &rc_proto * @name: name of the key map table * @lock: lock to protect access to this structure */ @@ -158,7 +167,7 @@ struct rc_map { unsigned int size; unsigned int len; unsigned int alloc; - enum rc_type rc_type; + enum rc_proto rc_proto; const char *name; spinlock_t lock; }; |