linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] rtl28xxu changes, mainly remote controller
@ 2013-06-04 21:54 Antti Palosaari
  2013-06-04 21:54 ` [PATCH 1/7] rtl2832u: restore ir remote control support Antti Palosaari
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:54 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

It contains mainly remote controller implementation for rtl2832u.
I will pull request it soon.
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/rtl28xxu

Antti Palosaari (5):
  rtl28xxu: reimplement rtl2832u remote controller
  rtl28xxu: remove redundant IS_ENABLED macro
  rtl28xxu: correct some device names
  rtl28xxu: map remote for TerraTec Cinergy T Stick Black
  rtl28xxu: use masked reg write where possible

Miroslav Šustek (1):
  rtl28xxu: Add USB ID for Leadtek WinFast DTV Dongle mini

Rodrigo Tartajo (1):
  rtl2832u: restore ir remote control support.

 drivers/media/usb/dvb-usb-v2/dvb_usb.h  |   2 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 178 ++++++++++++++------------------
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   6 ++
 3 files changed, 85 insertions(+), 101 deletions(-)

-- 
1.7.11.7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] rtl2832u: restore ir remote control support.
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
@ 2013-06-04 21:54 ` Antti Palosaari
  2013-06-04 21:54 ` =?yes?q?=5BPATCH=202/7=5D=20rtl28xxu=3A=20reimplement=20rtl2832u=20remote=20controller?= Antti Palosaari
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:54 UTC (permalink / raw)
  To: linux-media; +Cc: Rodrigo Tartajo, Antti Palosaari

From: Rodrigo Tartajo <rtarty@gmail.com>

Hi,
This patch uses the driver from openpli[1] as a template to restore the remote control support.
I had to divert from the original to use the in kernel rc protocol decoder. The key repetition does,
not seem to work but I cant find the problem in the driver. As a raw rc provider, no key table is
hardcoded.

Rodrigo.

[1]: https://aur.archlinux.org/packages/dvb-usb-rtl2832u-openpli/?comments=all

Signed-off-by: Rodrigo Tartajo <rtarty@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/dvb_usb.h  |  2 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 83 ++++++++++++++++++++++++++++-----
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h | 11 +++++
 3 files changed, 83 insertions(+), 13 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
index 658c6d4..399916b 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
@@ -140,7 +140,7 @@ struct dvb_usb_rc {
 	int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
 	int (*query) (struct dvb_usb_device *d);
 	unsigned int interval;
-	const enum rc_driver_type driver_type;
+	enum rc_driver_type driver_type;
 	bool bulk_mode;
 };
 
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 22015fe..e592662 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1249,11 +1249,21 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
 #if IS_ENABLED(CONFIG_RC_CORE)
 static int rtl2832u_rc_query(struct dvb_usb_device *d)
 {
+#define TICSAT38KHZTONS(x) ((x) * (1000000000/38000))
 	int ret, i;
 	struct rtl28xxu_priv *priv = d->priv;
 	u8 buf[128];
 	int len;
-	struct rtl28xxu_reg_val rc_nec_tab[] = {
+	struct ir_raw_event ev; //encode single ir event (pulse or space)
+	struct rtl28xxu_xreg_val rc_sys_init_tab[] = {
+		{ SYS_DEMOD_CTL1,   OP_AND, 0xfb },
+		{ SYS_DEMOD_CTL1,   OP_AND, 0xf7 },
+		{ USB_CTRL,         OP_OR , 0x20 },
+		{ SYS_SYS1,         OP_AND, 0xf7 },
+		{ SYS_GPIO_OUT_EN,  OP_OR , 0x08 },
+		{ SYS_GPIO_OUT_VAL, OP_OR , 0x08 },
+	}; // system hard init
+	struct rtl28xxu_reg_val rc_init_tab[] = {
 		{ IR_RX_CTRL,             0x20 },
 		{ IR_RX_BUF_CTRL,         0x80 },
 		{ IR_RX_IF,               0xff },
@@ -1268,13 +1278,40 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
 		{ IR_MAX_H_TOL_LEN,       0x1e },
 		{ IR_MAX_L_TOL_LEN,       0x1e },
 		{ IR_RX_CTRL,             0x80 },
-	};
+	}; // hard init
+	struct rtl28xxu_reg_val rc_reinit_tab[] = {
+		{ IR_RX_CTRL,     0x20 },
+		{ IR_RX_BUF_CTRL, 0x80 },
+		{ IR_RX_IF,       0xff },
+		{ IR_RX_IE,       0xff },
+		{ IR_RX_CTRL,     0x80 },
+	}; // reinit IR
+	struct rtl28xxu_reg_val rc_clear_tab[] = {
+		{ IR_RX_IF,       0x03 },
+		{ IR_RX_BUF_CTRL, 0x80 },
+		{ IR_RX_CTRL,     0x80 },
+	}; // clear reception
 
 	/* init remote controller */
 	if (!priv->rc_active) {
-		for (i = 0; i < ARRAY_SIZE(rc_nec_tab); i++) {
-			ret = rtl28xx_wr_reg(d, rc_nec_tab[i].reg,
-					rc_nec_tab[i].val);
+		for (i = 0; i < ARRAY_SIZE(rc_sys_init_tab); i++) {
+			ret = rtl28xx_rd_reg(d, rc_sys_init_tab[i].reg, &buf[0]);
+			if (ret)
+				goto err;
+			if (rc_sys_init_tab[i].op == OP_AND) {
+				buf[0] &= rc_sys_init_tab[i].mask;
+			}
+			else {//OP_OR
+				buf[0] |= rc_sys_init_tab[i].mask;
+			}
+			ret = rtl28xx_wr_reg(d, rc_sys_init_tab[i].reg,
+					buf[0]);
+			if (ret)
+				goto err;
+		}
+		for (i = 0; i < ARRAY_SIZE(rc_init_tab); i++) {
+			ret = rtl28xx_wr_reg(d, rc_init_tab[i].reg,
+					rc_init_tab[i].val);
 			if (ret)
 				goto err;
 		}
@@ -1286,7 +1323,7 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
 		goto err;
 
 	if (buf[0] != 0x83)
-		goto exit;
+		goto err;
 
 	ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
 	if (ret)
@@ -1295,26 +1332,48 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
 	len = buf[0];
 	ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
 
-	/* TODO: pass raw IR to Kernel IR decoder */
+	/* pass raw IR to Kernel IR decoder */
+	init_ir_raw_event(&ev);
+	ir_raw_event_reset(d->rc_dev);
+	ev.pulse=1;
+	for(i=0; true; ++i) { // conver count to time
+		if (i >= len || !(buf[i] & 0x80) != !(ev.pulse)) {//end or transition pulse/space: flush
+			ir_raw_event_store(d->rc_dev, &ev);
+			ev.duration = 0;
+		}
+		if (i >= len)
+			break;
+		ev.pulse = buf[i] >> 7;
+		ev.duration += TICSAT38KHZTONS(((u32)(buf[i] & 0x7F)) << 1);
+	}
+	ir_raw_event_handle(d->rc_dev);
 
-	ret = rtl28xx_wr_reg(d, IR_RX_IF, 0x03);
-	ret = rtl28xx_wr_reg(d, IR_RX_BUF_CTRL, 0x80);
-	ret = rtl28xx_wr_reg(d, IR_RX_CTRL, 0x80);
+	for (i = 0; i < ARRAY_SIZE(rc_clear_tab); i++) {
+		ret = rtl28xx_wr_reg(d, rc_clear_tab[i].reg,
+				rc_clear_tab[i].val);
+		if (ret)
+			goto err;
+	}
 
-exit:
 	return ret;
 err:
+	for (i = 0; i < ARRAY_SIZE(rc_reinit_tab); i++) {
+		ret = rtl28xx_wr_reg(d, rc_reinit_tab[i].reg,
+				rc_reinit_tab[i].val);
+	}
 	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
 	return ret;
+#undef TICSAT38KHZTONS
 }
 
 static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
 		struct dvb_usb_rc *rc)
 {
 	rc->map_name = RC_MAP_EMPTY;
-	rc->allowed_protos = RC_BIT_NEC;
+	rc->allowed_protos = RC_BIT_ALL;
 	rc->query = rtl2832u_rc_query;
 	rc->interval = 400;
+	rc->driver_type = RC_DRIVER_IR_RAW;
 
 	return 0;
 }
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
index 533a331..0177b38 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -97,6 +97,17 @@ struct rtl28xxu_reg_val {
 	u8 val;
 };
 
+enum OP{
+	OP_AND	=0,
+	OP_OR
+};
+
+struct rtl28xxu_xreg_val {
+	u16 reg;
+	u8 op;
+	u8 mask;
+};
+
 /*
  * memory map
  *
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* =?yes?q?=5BPATCH=202/7=5D=20rtl28xxu=3A=20reimplement=20rtl2832u=20remote=20controller?=
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
  2013-06-04 21:54 ` [PATCH 1/7] rtl2832u: restore ir remote control support Antti Palosaari
@ 2013-06-04 21:54 ` Antti Palosaari
  2013-06-04 21:54 ` [PATCH 3/7] rtl28xxu: remove redundant IS_ENABLED macro Antti Palosaari
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:54 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari, Rodrigo Tartajo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=yes, Size: 6990 bytes --]

Thanks to Rodrigo for original implementation!

Cc: Rodrigo Tartajo <rtarty@gmail.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 152 ++++++++++++--------------------
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   9 +-
 2 files changed, 58 insertions(+), 103 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index e592662..4167011 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1114,17 +1114,6 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
 		if (ret)
 			goto err;
 	} else {
-		/* demod_ctl_1 */
-		ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL1, &val);
-		if (ret)
-			goto err;
-
-		val |= 0x0c;
-
-		ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL1, val);
-		if (ret)
-			goto err;
-
 		/* set output values */
 		ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
 		if (ret)
@@ -1249,72 +1238,44 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
 #if IS_ENABLED(CONFIG_RC_CORE)
 static int rtl2832u_rc_query(struct dvb_usb_device *d)
 {
-#define TICSAT38KHZTONS(x) ((x) * (1000000000/38000))
-	int ret, i;
+	int ret, i, len;
 	struct rtl28xxu_priv *priv = d->priv;
+	struct ir_raw_event ev;
 	u8 buf[128];
-	int len;
-	struct ir_raw_event ev; //encode single ir event (pulse or space)
-	struct rtl28xxu_xreg_val rc_sys_init_tab[] = {
-		{ SYS_DEMOD_CTL1,   OP_AND, 0xfb },
-		{ SYS_DEMOD_CTL1,   OP_AND, 0xf7 },
-		{ USB_CTRL,         OP_OR , 0x20 },
-		{ SYS_SYS1,         OP_AND, 0xf7 },
-		{ SYS_GPIO_OUT_EN,  OP_OR , 0x08 },
-		{ SYS_GPIO_OUT_VAL, OP_OR , 0x08 },
-	}; // system hard init
-	struct rtl28xxu_reg_val rc_init_tab[] = {
-		{ IR_RX_CTRL,             0x20 },
-		{ IR_RX_BUF_CTRL,         0x80 },
-		{ IR_RX_IF,               0xff },
-		{ IR_RX_IE,               0xff },
-		{ IR_MAX_DURATION0,       0xd0 },
-		{ IR_MAX_DURATION1,       0x07 },
-		{ IR_IDLE_LEN0,           0xc0 },
-		{ IR_IDLE_LEN1,           0x00 },
-		{ IR_GLITCH_LEN,          0x03 },
-		{ IR_RX_CLK,              0x09 },
-		{ IR_RX_CFG,              0x1c },
-		{ IR_MAX_H_TOL_LEN,       0x1e },
-		{ IR_MAX_L_TOL_LEN,       0x1e },
-		{ IR_RX_CTRL,             0x80 },
-	}; // hard init
-	struct rtl28xxu_reg_val rc_reinit_tab[] = {
-		{ IR_RX_CTRL,     0x20 },
-		{ IR_RX_BUF_CTRL, 0x80 },
-		{ IR_RX_IF,       0xff },
-		{ IR_RX_IE,       0xff },
-		{ IR_RX_CTRL,     0x80 },
-	}; // reinit IR
-	struct rtl28xxu_reg_val rc_clear_tab[] = {
-		{ IR_RX_IF,       0x03 },
-		{ IR_RX_BUF_CTRL, 0x80 },
-		{ IR_RX_CTRL,     0x80 },
-	}; // clear reception
+	static const struct rtl28xxu_reg_val_mask refresh_tab[] = {
+		{IR_RX_IF,               0x03, 0xff},
+		{IR_RX_BUF_CTRL,         0x80, 0xff},
+		{IR_RX_CTRL,             0x80, 0xff},
+	};
 
 	/* init remote controller */
 	if (!priv->rc_active) {
-		for (i = 0; i < ARRAY_SIZE(rc_sys_init_tab); i++) {
-			ret = rtl28xx_rd_reg(d, rc_sys_init_tab[i].reg, &buf[0]);
-			if (ret)
-				goto err;
-			if (rc_sys_init_tab[i].op == OP_AND) {
-				buf[0] &= rc_sys_init_tab[i].mask;
-			}
-			else {//OP_OR
-				buf[0] |= rc_sys_init_tab[i].mask;
-			}
-			ret = rtl28xx_wr_reg(d, rc_sys_init_tab[i].reg,
-					buf[0]);
-			if (ret)
-				goto err;
-		}
-		for (i = 0; i < ARRAY_SIZE(rc_init_tab); i++) {
-			ret = rtl28xx_wr_reg(d, rc_init_tab[i].reg,
-					rc_init_tab[i].val);
+		static const struct rtl28xxu_reg_val_mask init_tab[] = {
+			{SYS_DEMOD_CTL1,         0x00, 0x04},
+			{SYS_DEMOD_CTL1,         0x00, 0x08},
+			{USB_CTRL,               0x20, 0x20},
+			{SYS_GPIO_DIR,           0x00, 0x08},
+			{SYS_GPIO_OUT_EN,        0x08, 0x08},
+			{SYS_GPIO_OUT_VAL,       0x08, 0x08},
+			{IR_MAX_DURATION0,       0xd0, 0xff},
+			{IR_MAX_DURATION1,       0x07, 0xff},
+			{IR_IDLE_LEN0,           0xc0, 0xff},
+			{IR_IDLE_LEN1,           0x00, 0xff},
+			{IR_GLITCH_LEN,          0x03, 0xff},
+			{IR_RX_CLK,              0x09, 0xff},
+			{IR_RX_CFG,              0x1c, 0xff},
+			{IR_MAX_H_TOL_LEN,       0x1e, 0xff},
+			{IR_MAX_L_TOL_LEN,       0x1e, 0xff},
+			{IR_RX_CTRL,             0x80, 0xff},
+		};
+
+		for (i = 0; i < ARRAY_SIZE(init_tab); i++) {
+			ret = rtl28xx_wr_reg_mask(d, init_tab[i].reg,
+					init_tab[i].val, init_tab[i].mask);
 			if (ret)
 				goto err;
 		}
+
 		priv->rc_active = true;
 	}
 
@@ -1323,57 +1284,56 @@ static int rtl2832u_rc_query(struct dvb_usb_device *d)
 		goto err;
 
 	if (buf[0] != 0x83)
-		goto err;
+		goto exit;
 
 	ret = rtl28xx_rd_reg(d, IR_RX_BC, &buf[0]);
 	if (ret)
 		goto err;
 
 	len = buf[0];
-	ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
 
-	/* pass raw IR to Kernel IR decoder */
-	init_ir_raw_event(&ev);
-	ir_raw_event_reset(d->rc_dev);
-	ev.pulse=1;
-	for(i=0; true; ++i) { // conver count to time
-		if (i >= len || !(buf[i] & 0x80) != !(ev.pulse)) {//end or transition pulse/space: flush
-			ir_raw_event_store(d->rc_dev, &ev);
-			ev.duration = 0;
-		}
-		if (i >= len)
-			break;
-		ev.pulse = buf[i] >> 7;
-		ev.duration += TICSAT38KHZTONS(((u32)(buf[i] & 0x7F)) << 1);
-	}
-	ir_raw_event_handle(d->rc_dev);
+	/* read raw code from hw */
+	ret = rtl2831_rd_regs(d, IR_RX_BUF, buf, len);
+	if (ret)
+		goto err;
 
-	for (i = 0; i < ARRAY_SIZE(rc_clear_tab); i++) {
-		ret = rtl28xx_wr_reg(d, rc_clear_tab[i].reg,
-				rc_clear_tab[i].val);
+	/* let hw receive new code */
+	for (i = 0; i < ARRAY_SIZE(refresh_tab); i++) {
+		ret = rtl28xx_wr_reg_mask(d, refresh_tab[i].reg,
+				refresh_tab[i].val, refresh_tab[i].mask);
 		if (ret)
 			goto err;
 	}
 
+	/* pass data to Kernel IR decoder */
+	init_ir_raw_event(&ev);
+
+	for (i = 0; i < len; i++) {
+		ev.pulse = buf[i] >> 7;
+		ev.duration = 50800 * (buf[i] & 0x7f);
+		ir_raw_event_store_with_filter(d->rc_dev, &ev);
+	}
+
+	/* 'flush' ir_raw_event_store_with_filter() */
+	ir_raw_event_set_idle(d->rc_dev, true);
+	ir_raw_event_handle(d->rc_dev);
+exit:
 	return ret;
 err:
-	for (i = 0; i < ARRAY_SIZE(rc_reinit_tab); i++) {
-		ret = rtl28xx_wr_reg(d, rc_reinit_tab[i].reg,
-				rc_reinit_tab[i].val);
-	}
 	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
 	return ret;
-#undef TICSAT38KHZTONS
 }
 
 static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
 		struct dvb_usb_rc *rc)
 {
-	rc->map_name = RC_MAP_EMPTY;
+	/* load empty to enable rc */
+	if (!rc->map_name)
+		rc->map_name = RC_MAP_EMPTY;
 	rc->allowed_protos = RC_BIT_ALL;
+	rc->driver_type = RC_DRIVER_IR_RAW;
 	rc->query = rtl2832u_rc_query;
 	rc->interval = 400;
-	rc->driver_type = RC_DRIVER_IR_RAW;
 
 	return 0;
 }
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
index 0177b38..729b354 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -97,14 +97,9 @@ struct rtl28xxu_reg_val {
 	u8 val;
 };
 
-enum OP{
-	OP_AND	=0,
-	OP_OR
-};
-
-struct rtl28xxu_xreg_val {
+struct rtl28xxu_reg_val_mask {
 	u16 reg;
-	u8 op;
+	u8 val;
 	u8 mask;
 };
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] rtl28xxu: remove redundant IS_ENABLED macro
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
  2013-06-04 21:54 ` [PATCH 1/7] rtl2832u: restore ir remote control support Antti Palosaari
  2013-06-04 21:54 ` =?yes?q?=5BPATCH=202/7=5D=20rtl28xxu=3A=20reimplement=20rtl2832u=20remote=20controller?= Antti Palosaari
@ 2013-06-04 21:54 ` Antti Palosaari
  2013-06-04 21:55 ` [PATCH 4/7] rtl28xxu: Add USB ID for Leadtek WinFast DTV Dongle mini Antti Palosaari
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:54 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 4167011..8bbc6ab 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1231,11 +1231,7 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
 
 	return 0;
 }
-#else
-	#define rtl2831u_get_rc_config NULL
-#endif
 
-#if IS_ENABLED(CONFIG_RC_CORE)
 static int rtl2832u_rc_query(struct dvb_usb_device *d)
 {
 	int ret, i, len;
@@ -1338,7 +1334,8 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
 	return 0;
 }
 #else
-	#define rtl2832u_get_rc_config NULL
+#define rtl2831u_get_rc_config NULL
+#define rtl2832u_get_rc_config NULL
 #endif
 
 static const struct dvb_usb_device_properties rtl2831u_props = {
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] rtl28xxu: Add USB ID for Leadtek WinFast DTV Dongle mini
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
                   ` (2 preceding siblings ...)
  2013-06-04 21:54 ` [PATCH 3/7] rtl28xxu: remove redundant IS_ENABLED macro Antti Palosaari
@ 2013-06-04 21:55 ` Antti Palosaari
  2013-06-04 21:55 ` [PATCH 5/7] rtl28xxu: correct some device names Antti Palosaari
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:55 UTC (permalink / raw)
  To: linux-media; +Cc: Miroslav Šustek, Antti Palosaari

From: Miroslav Šustek <sustmidown@centrum.cz>

USB ID 0413:6a03 is Leadtek WinFast DTV Dongle mini.
Decoder Realtek RTL2832U and tuner Infineon TUA9001.

Signed-off-by: Miroslav Šustek <sustmidown@centrum.cz>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 8bbc6ab..0045b19 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1424,6 +1424,8 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
 		&rtl2832u_props, "Compro VideoMate U620F", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
 		&rtl2832u_props, "MaxMedia HU394-T", NULL) },
+	{ DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03,
+		&rtl2832u_props, "WinFast DTV Dongle mini", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] rtl28xxu: correct some device names
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
                   ` (3 preceding siblings ...)
  2013-06-04 21:55 ` [PATCH 4/7] rtl28xxu: Add USB ID for Leadtek WinFast DTV Dongle mini Antti Palosaari
@ 2013-06-04 21:55 ` Antti Palosaari
  2013-06-04 21:55 ` [PATCH 6/7] rtl28xxu: map remote for TerraTec Cinergy T Stick Black Antti Palosaari
  2013-06-04 21:55 ` [PATCH 7/7] rtl28xxu: use masked reg write where possible Antti Palosaari
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:55 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

... just because I want to be perfect ;)

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 0045b19..93313f70 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1419,13 +1419,13 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
 	{ DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd393,
 		&rtl2832u_props, "GIGABYTE U7300", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1104,
-		&rtl2832u_props, "Digivox Micro Hd", NULL) },
+		&rtl2832u_props, "MSI DIGIVOX Micro HD", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_COMPRO, 0x0620,
 		&rtl2832u_props, "Compro VideoMate U620F", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd394,
 		&rtl2832u_props, "MaxMedia HU394-T", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a03,
-		&rtl2832u_props, "WinFast DTV Dongle mini", NULL) },
+		&rtl2832u_props, "Leadtek WinFast DTV Dongle mini", NULL) },
 	{ }
 };
 MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] rtl28xxu: map remote for TerraTec Cinergy T Stick Black
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
                   ` (4 preceding siblings ...)
  2013-06-04 21:55 ` [PATCH 5/7] rtl28xxu: correct some device names Antti Palosaari
@ 2013-06-04 21:55 ` Antti Palosaari
  2013-06-04 21:55 ` [PATCH 7/7] rtl28xxu: use masked reg write where possible Antti Palosaari
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:55 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 93313f70..04da6be 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1395,7 +1395,7 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
 	{ DVB_USB_DEVICE(USB_VID_REALTEK, 0x2838,
 		&rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1,
-		&rtl2832u_props, "TerraTec Cinergy T Stick Black", NULL) },
+		&rtl2832u_props, "TerraTec Cinergy T Stick Black", RC_MAP_TERRATEC_SLIM) },
 	{ DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_DELOCK_USB2_DVBT,
 		&rtl2832u_props, "G-Tek Electronics Group Lifeview LV5TDLX DVB-T", NULL) },
 	{ DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK,
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] rtl28xxu: use masked reg write where possible
  2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
                   ` (5 preceding siblings ...)
  2013-06-04 21:55 ` [PATCH 6/7] rtl28xxu: map remote for TerraTec Cinergy T Stick Black Antti Palosaari
@ 2013-06-04 21:55 ` Antti Palosaari
  6 siblings, 0 replies; 8+ messages in thread
From: Antti Palosaari @ 2013-06-04 21:55 UTC (permalink / raw)
  To: linux-media; +Cc: Antti Palosaari

Use masked register write inside rtl2832u_power_ctrl().

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 72 ++++++++-------------------------
 1 file changed, 16 insertions(+), 56 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 04da6be..6f5a3d0 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1041,67 +1041,34 @@ err:
 static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
 {
 	int ret;
-	u8 val;
 
 	dev_dbg(&d->udev->dev, "%s: onoff=%d\n", __func__, onoff);
 
 	if (onoff) {
-		/* set output values */
-		ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
-		if (ret)
-			goto err;
-
-		val |= 0x08;
-		val &= 0xef;
-
-		ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
-		if (ret)
-			goto err;
-
-		/* demod_ctl_1 */
-		ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL1, &val);
-		if (ret)
-			goto err;
-
-		val &= 0xef;
-
-		ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL1, val);
-		if (ret)
-			goto err;
-
-		/* demod control */
-		/* PLL enable */
-		ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
+		/* GPIO3=1, GPIO4=0 */
+		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x08, 0x18);
 		if (ret)
 			goto err;
 
-		/* bit 7 to 1 */
-		val |= 0x80;
-
-		ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
+		/* suspend? */
+		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL1, 0x00, 0x10);
 		if (ret)
 			goto err;
 
-		ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
+		/* enable PLL */
+		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x80, 0x80);
 		if (ret)
 			goto err;
 
-		val |= 0x20;
-
-		ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
+		/* disable reset */
+		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x20, 0x20);
 		if (ret)
 			goto err;
 
 		mdelay(5);
 
-		/*enable ADC_Q and ADC_I */
-		ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
-		if (ret)
-			goto err;
-
-		val |= 0x48;
-
-		ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
+		/* enable ADC */
+		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x48, 0x48);
 		if (ret)
 			goto err;
 
@@ -1114,25 +1081,18 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, int onoff)
 		if (ret)
 			goto err;
 	} else {
-		/* set output values */
-		ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL, &val);
-		if (ret)
-				goto err;
-
-		val |= 0x10;
-
-		ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
+		/* GPIO4=1 */
+		ret = rtl28xx_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x10, 0x10);
 		if (ret)
 			goto err;
 
-		/* demod control */
-		ret = rtl28xx_rd_reg(d, SYS_DEMOD_CTL, &val);
+		/* disable ADC */
+		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x48);
 		if (ret)
 			goto err;
 
-		val &= 0x37;
-
-		ret = rtl28xx_wr_reg(d, SYS_DEMOD_CTL, val);
+		/* disable PLL */
+		ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
 		if (ret)
 			goto err;
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-06-04 21:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04 21:54 [PATCH 0/7] rtl28xxu changes, mainly remote controller Antti Palosaari
2013-06-04 21:54 ` [PATCH 1/7] rtl2832u: restore ir remote control support Antti Palosaari
2013-06-04 21:54 ` =?yes?q?=5BPATCH=202/7=5D=20rtl28xxu=3A=20reimplement=20rtl2832u=20remote=20controller?= Antti Palosaari
2013-06-04 21:54 ` [PATCH 3/7] rtl28xxu: remove redundant IS_ENABLED macro Antti Palosaari
2013-06-04 21:55 ` [PATCH 4/7] rtl28xxu: Add USB ID for Leadtek WinFast DTV Dongle mini Antti Palosaari
2013-06-04 21:55 ` [PATCH 5/7] rtl28xxu: correct some device names Antti Palosaari
2013-06-04 21:55 ` [PATCH 6/7] rtl28xxu: map remote for TerraTec Cinergy T Stick Black Antti Palosaari
2013-06-04 21:55 ` [PATCH 7/7] rtl28xxu: use masked reg write where possible Antti Palosaari

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).