Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aec3eadf authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab
Browse files

media: mceusb: MCE_CMD_SETIRTIMEOUT cause strange behaviour on device



If the IR timeout is set on vid 1784 pid 0011, the device starts
behaving strangely.

Reported-by: default avatarMatthias Reichl <hias@horus.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 09c2cc98
Loading
Loading
Loading
Loading
+19 −3
Original line number Original line Diff line number Diff line
@@ -181,6 +181,7 @@ enum mceusb_model_type {
	MCE_GEN2 = 0,		/* Most boards */
	MCE_GEN2 = 0,		/* Most boards */
	MCE_GEN1,
	MCE_GEN1,
	MCE_GEN3,
	MCE_GEN3,
	MCE_GEN3_BROKEN_IRTIMEOUT,
	MCE_GEN2_TX_INV,
	MCE_GEN2_TX_INV,
	MCE_GEN2_TX_INV_RX_GOOD,
	MCE_GEN2_TX_INV_RX_GOOD,
	POLARIS_EVK,
	POLARIS_EVK,
@@ -199,6 +200,7 @@ struct mceusb_model {
	u32 mce_gen3:1;
	u32 mce_gen3:1;
	u32 tx_mask_normal:1;
	u32 tx_mask_normal:1;
	u32 no_tx:1;
	u32 no_tx:1;
	u32 broken_irtimeout:1;
	/*
	/*
	 * 2nd IR receiver (short-range, wideband) for learning mode:
	 * 2nd IR receiver (short-range, wideband) for learning mode:
	 *     0, absent 2nd receiver (rx2)
	 *     0, absent 2nd receiver (rx2)
@@ -242,6 +244,12 @@ static const struct mceusb_model mceusb_model[] = {
		.tx_mask_normal = 1,
		.tx_mask_normal = 1,
		.rx2 = 2,
		.rx2 = 2,
	},
	},
	[MCE_GEN3_BROKEN_IRTIMEOUT] = {
		.mce_gen3 = 1,
		.tx_mask_normal = 1,
		.rx2 = 2,
		.broken_irtimeout = 1
	},
	[POLARIS_EVK] = {
	[POLARIS_EVK] = {
		/*
		/*
		 * In fact, the EVK is shipped without
		 * In fact, the EVK is shipped without
@@ -352,7 +360,7 @@ static const struct usb_device_id mceusb_dev_table[] = {
	  .driver_info = MCE_GEN2_TX_INV },
	  .driver_info = MCE_GEN2_TX_INV },
	/* Topseed eHome Infrared Transceiver */
	/* Topseed eHome Infrared Transceiver */
	{ USB_DEVICE(VENDOR_TOPSEED, 0x0011),
	{ USB_DEVICE(VENDOR_TOPSEED, 0x0011),
	  .driver_info = MCE_GEN3 },
	  .driver_info = MCE_GEN3_BROKEN_IRTIMEOUT },
	/* Ricavision internal Infrared Transceiver */
	/* Ricavision internal Infrared Transceiver */
	{ USB_DEVICE(VENDOR_RICAVISION, 0x0010) },
	{ USB_DEVICE(VENDOR_RICAVISION, 0x0010) },
	/* Itron ione Libra Q-11 */
	/* Itron ione Libra Q-11 */
@@ -1441,8 +1449,16 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
	rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
	rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
	rc->min_timeout = US_TO_NS(MCE_TIME_UNIT);
	rc->min_timeout = US_TO_NS(MCE_TIME_UNIT);
	rc->timeout = MS_TO_NS(100);
	rc->timeout = MS_TO_NS(100);
	rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
	if (!mceusb_model[ir->model].broken_irtimeout) {
		rc->s_timeout = mceusb_set_timeout;
		rc->s_timeout = mceusb_set_timeout;
		rc->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
	} else {
		/*
		 * If we can't set the timeout using CMD_SETIRTIMEOUT, we can
		 * rely on software timeouts for timeouts < 100ms.
		 */
		rc->max_timeout = rc->timeout;
	}
	if (!ir->flags.no_tx) {
	if (!ir->flags.no_tx) {
		rc->s_tx_mask = mceusb_set_tx_mask;
		rc->s_tx_mask = mceusb_set_tx_mask;
		rc->s_tx_carrier = mceusb_set_tx_carrier;
		rc->s_tx_carrier = mceusb_set_tx_carrier;