From: Malcolm Priestley <tvboxspy@gmail.com>
To: linux-media@vger.kernel.org
Subject: [PATCH] [ver 1.07] it913x-fe changes to power up and down of tuner.
Date: Sat, 01 Oct 2011 14:24:16 +0100 [thread overview]
Message-ID: <4e871485.9a67e30a.0411.2265@mx.google.com> (raw)
Currently the tuner is constantly powered causing these effects.
1. Remembering last tune channel causing corruptions of changing channel.
2. Causing corruption on other frontend.
3. Higher current in standby of demodulator with clock running.
Power sequence now follows;
Power Up
Tuner on -> Frontend suspend off -> Tuner clk on
Power Down
Frontend suspend on -> Tuner clk off -> Tuner off
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
drivers/media/dvb/frontends/it913x-fe-priv.h | 10 ++++++++-
drivers/media/dvb/frontends/it913x-fe.c | 27 ++++++++++++++++++++-----
2 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/drivers/media/dvb/frontends/it913x-fe-priv.h b/drivers/media/dvb/frontends/it913x-fe-priv.h
index 40e1d9b..1c6fb4b 100644
--- a/drivers/media/dvb/frontends/it913x-fe-priv.h
+++ b/drivers/media/dvb/frontends/it913x-fe-priv.h
@@ -312,7 +312,15 @@ static struct it913xset it9137_set[] = {
{PRO_LINK, GPIOH5_EN, {0x01}, 0x01},
{PRO_LINK, GPIOH5_ON, {0x01}, 0x01},
{PRO_LINK, GPIOH5_O, {0x00}, 0x01},
- {PRO_LINK, GPIOH5_O, {0x01}, 0x01},/* ?, but enable */
+ {PRO_LINK, GPIOH5_O, {0x01}, 0x01},
+ {0xff, 0x0000, {0x00}, 0x00}, /* Terminating Entry */
+};
+
+static struct it913xset it9137_tuner_off[] = {
+ {PRO_DMOD, 0xfba8, {0x01}, 0x01}, /* Tuner Clock Off */
+ {PRO_DMOD, 0xec40, {0x00}, 0x01}, /* Power Down Tuner */
+ {PRO_DMOD, 0xec02, {0x3f, 0x1f, 0x3f, 0x3f}, 0x04},
+ {PRO_DMOD, 0xec3f, {0x01}, 0x01},
{0xff, 0x0000, {0x00}, 0x00}, /* Terminating Entry */
};
diff --git a/drivers/media/dvb/frontends/it913x-fe.c b/drivers/media/dvb/frontends/it913x-fe.c
index 02839a8b7..d4bd24e 100644
--- a/drivers/media/dvb/frontends/it913x-fe.c
+++ b/drivers/media/dvb/frontends/it913x-fe.c
@@ -626,7 +626,7 @@ static int it913x_fe_suspend(struct it913x_fe_state *state)
for (i = 0; i < 128; i++) {
ret = it913x_read_reg(state, SUSPEND_FLAG, &b, 1);
if (ret < 0)
- return -EINVAL;
+ return -ENODEV;
if (b == 0)
break;
@@ -634,18 +634,23 @@ static int it913x_fe_suspend(struct it913x_fe_state *state)
ret |= it913x_write_reg(state, PRO_DMOD, AFE_MEM0, 0x8);
/* Turn LED off */
- ret = it913x_write_reg(state, PRO_LINK, GPIOH3_O, 0x0);
+ ret |= it913x_write_reg(state, PRO_LINK, GPIOH3_O, 0x0);
- return 0;
+ ret |= it913x_fe_script_loader(state, it9137_tuner_off);
+
+ return (ret < 0) ? -ENODEV : 0;
}
+/* Power sequence */
+/* Power Up Tuner on -> Frontend suspend off -> Tuner clk on */
+/* Power Down Frontend suspend on -> Tuner clk off -> Tuner off */
+
static int it913x_fe_sleep(struct dvb_frontend *fe)
{
struct it913x_fe_state *state = fe->demodulator_priv;
return it913x_fe_suspend(state);
}
-
static u32 compute_div(u32 a, u32 b, u32 x)
{
u32 res = 0;
@@ -738,11 +743,21 @@ static int it913x_fe_init(struct dvb_frontend *fe)
{
struct it913x_fe_state *state = fe->demodulator_priv;
int ret = 0;
+ /* Power Up Tuner - common all versions */
+ ret = it913x_write_reg(state, PRO_DMOD, 0xec40, 0x1);
- it913x_write_reg(state, PRO_DMOD, AFE_MEM0, 0x0);
+ ret |= it913x_write_reg(state, PRO_DMOD, AFE_MEM0, 0x0);
ret |= it913x_fe_script_loader(state, init_1);
+ switch (state->tuner_type) {
+ case IT9137:
+ ret |= it913x_write_reg(state, PRO_DMOD, 0xfba8, 0x0);
+ break;
+ default:
+ return -EINVAL;
+ }
+
return (ret < 0) ? -ENODEV : 0;
}
@@ -820,5 +835,5 @@ static struct dvb_frontend_ops it913x_fe_ofdm_ops = {
MODULE_DESCRIPTION("it913x Frontend and it9137 tuner");
MODULE_AUTHOR("Malcolm Priestley tvboxspy@gmail.com");
-MODULE_VERSION("1.06");
+MODULE_VERSION("1.07");
MODULE_LICENSE("GPL");
--
1.7.5.4
reply other threads:[~2011-10-01 13:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4e871485.9a67e30a.0411.2265@mx.google.com \
--to=tvboxspy@gmail.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.