All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] V4L/DVB: Update tuner initialization sequence
@ 2014-08-05  5:46 Bimow Chen
  2014-08-09 20:47 ` Antti Palosaari
  0 siblings, 1 reply; 2+ messages in thread
From: Bimow Chen @ 2014-08-05  5:46 UTC (permalink / raw)
  To: linux-media

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: 0003-Update-tuner-initialization-sequence.patch --]
[-- Type: text/x-patch, Size: 1726 bytes --]

>From 68df717c82f5da425a807a417872de0a9566211c Mon Sep 17 00:00:00 2001
From: Bimow Chen <Bimow.Chen@ite.com.tw>
Date: Tue, 5 Aug 2014 11:14:47 +0800
Subject: [PATCH 3/4] Update tuner initialization sequence.


Signed-off-by: Bimow Chen <Bimow.Chen@ite.com.tw>
---
 drivers/media/tuners/tuner_it913x.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/media/tuners/tuner_it913x.c b/drivers/media/tuners/tuner_it913x.c
index 6f30d7e..728de57 100644
--- a/drivers/media/tuners/tuner_it913x.c
+++ b/drivers/media/tuners/tuner_it913x.c
@@ -200,10 +200,7 @@ static int it913x_init(struct dvb_frontend *fe)
 		}
 	}
 
-	/* Power Up Tuner - common all versions */
-	ret = it913x_wr_reg(state, PRO_DMOD, 0xec40, 0x1);
-	ret |= it913x_wr_reg(state, PRO_DMOD, 0xfba8, 0x0);
-	ret |= it913x_wr_reg(state, PRO_DMOD, 0xec57, 0x0);
+	ret = it913x_wr_reg(state, PRO_DMOD, 0xec57, 0x0);
 	ret |= it913x_wr_reg(state, PRO_DMOD, 0xec58, 0x0);
 
 	return it913x_wr_reg(state, PRO_DMOD, 0xed81, val);
@@ -396,6 +393,7 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
 		struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config)
 {
 	struct it913x_state *state = NULL;
+	int ret;
 
 	/* allocate memory for the internal state */
 	state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL);
@@ -429,6 +427,13 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe,
 	memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops,
 			sizeof(struct dvb_tuner_ops));
 
+	/* tuner RF initial */
+	ret = it913x_wr_reg(state, PRO_DMOD, 0xec4c, 0x68);
+	if (ret < 0)
+		goto error;
+
+	msleep(30);
+
 	dev_info(&i2c_adap->dev,
 			"%s: ITE Tech IT913X successfully attached\n",
 			KBUILD_MODNAME);
-- 
1.7.0.4


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

* Re: [PATCH 3/4] V4L/DVB: Update tuner initialization sequence
  2014-08-05  5:46 [PATCH 3/4] V4L/DVB: Update tuner initialization sequence Bimow Chen
@ 2014-08-09 20:47 ` Antti Palosaari
  0 siblings, 0 replies; 2+ messages in thread
From: Antti Palosaari @ 2014-08-09 20:47 UTC (permalink / raw)
  To: Bimow Chen, linux-media

I applied that patch too, but reverted register writes you removed / 
moved to af9033 demod driver. Also, register write added for attach() 
happens too late leaving tuner ops populated even it fails. That causes 
surely kernel crash when tuner attach fails and DVB-core sees tuner 
callbacks are populated. So I moved it happen few lines earlier. Also 
removed sleep as I didn't see any need for it.

There should be commit description on each patch saying what it does and 
why. I did a lot of reverse-engineering to understand these patches.


regards
Antti

-- 
http://palosaari.fi/

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

end of thread, other threads:[~2014-08-09 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05  5:46 [PATCH 3/4] V4L/DVB: Update tuner initialization sequence Bimow Chen
2014-08-09 20:47 ` Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.