Skip to contentSkip to conversation

media: ttpci: use rc-core for the IR receiver

PATCH New Sean Young 1 participant 1 message Jun 4, 2019

Subsystems (2)
lore
Share & tools
lore

Sean Young

author maintainer
#0 lore raw

PATCH 1/1 media: ttpci: use rc-core for the IR receiver

The IR protocol can be set via the rc protocols sysfs file rather than via module parameters and a custom procfs file. So, it is no longer necessary to periodically check for protocol changes.

The IR_RCMM protocol does not match the Philips RC-MM protocol (12, 24 or 32 bit variants) so this is marked RC_PROTO_UNKNOWN for now. This protocol not used by the remote for this device.

Tested on Technotrend/Hauppauge WinTV Nexus-S rev2.1, which comes with a small black hauppauge remote.

---
 drivers/media/pci/ttpci/av7110.c        |  14 +-
 drivers/media/pci/ttpci/av7110.h        |  21 +-
 drivers/media/pci/ttpci/av7110_ir.c     | 423 ++++++------------------
 drivers/media/rc/keymaps/rc-hauppauge.c |   1 +
 4 files changed, 112 insertions(+), 347 deletions(-)
drivers/media/pci/ttpci/av7110.c +6 -8
index e6ee23544a6e..d0cdee1c6eb0 100644
@@ -218,7 +218,7 @@ static void recover_arm(struct av7110 *av7110)
 	restart_feeds(av7110);
 
 #if IS_ENABLED(CONFIG_DVB_AV7110_IR)
-	av7110_check_ir_config(av7110, true);
+	av7110_set_ir_config(av7110);
 #endif
 }
 
@@ -250,10 +250,6 @@ static int arm_thread(void *data)
 		if (!av7110->arm_ready)
 			continue;
 
-#if IS_ENABLED(CONFIG_DVB_AV7110_IR)
-		av7110_check_ir_config(av7110, false);
-#endif
-
 		if (mutex_lock_interruptible(&av7110->dcomlock))
 			break;
 		newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2);
@@ -659,9 +655,11 @@ static void gpioirq(unsigned long cookie)
 		return;
 
 	case DATA_IRCOMMAND:
-		if (av7110->ir.ir_handler)
-			av7110->ir.ir_handler(av7110,
-				swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4)));
+#if IS_ENABLED(CONFIG_DVB_AV7110_IR)
+		av7110_ir_handler(av7110,
+				  swahw32(irdebi(av7110, DEBINOSWAP, Reserved,
+						 0, 4)));
+#endif
 		iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
 		break;
 
drivers/media/pci/ttpci/av7110.h +5 -16
index 8606ef5ebbe2..809d938ae166 100644
@@ -81,23 +81,11 @@ struct av7110;
 
 /* infrared remote control */
 struct infrared {
-	u16	key_map[256];
-	struct input_dev	*input_dev;
+	struct rc_dev		*rcdev;
 	char			input_phys[32];
-	struct timer_list	keyup_timer;
-	struct tasklet_struct	ir_tasklet;
-	void			(*ir_handler)(struct av7110 *av7110, u32 ircom);
-	u32			ir_command;
 	u32			ir_config;
-	u32			device_mask;
-	u8			protocol;
-	u8			inversion;
-	u16			last_key;
-	u16			last_toggle;
-	bool			keypressed;
 };
 
-
 /* place to store all the necessary device information */
 struct av7110 {
 
@@ -304,9 +292,10 @@ struct av7110 {
 extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
 		       u16 subpid, u16 pcrpid);
 
-extern int av7110_check_ir_config(struct av7110 *av7110, int force);
-extern int av7110_ir_init(struct av7110 *av7110);
-extern void av7110_ir_exit(struct av7110 *av7110);
+void av7110_ir_handler(struct av7110 *av7110, u32 ircom);
+int av7110_set_ir_config(struct av7110 *av7110);
+int av7110_ir_init(struct av7110 *av7110);
+void av7110_ir_exit(struct av7110 *av7110);
 
 /* msp3400 i2c subaddresses */
 #define MSP_WR_DEM 0x10
drivers/media/pci/ttpci/av7110_ir.c +100 -323

479 lines not on this page · raw message

drivers/media/rc/keymaps/rc-hauppauge.c +1 -0
index 582aa9012443..c117e9fc2697 100644
@@ -233,6 +233,7 @@ static struct rc_map_table rc5_hauppauge_new[] = {
 	 * This one also uses RC-5 protocol
 	 * Keycodes start with address = 0x00
 	 */
+	{ 0x000f, KEY_TV },
 	{ 0x001f, KEY_TV },
 	{ 0x0020, KEY_CHANNELUP },
 	{ 0x000c, KEY_RADIO },
Signature · 1 line
2.21.0