public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH 7/8] [media] saa7134: Fix digital mode on Kworld SBTVD
Date: Sat, 15 Jan 2011 16:04:23 -0200	[thread overview]
Message-ID: <20110115160423.37980983@pedra> (raw)
In-Reply-To: <cover.1295114145.git.mchehab@redhat.com>

This patch fixes digital mode on Kworld SBTVD. Unfortunately, it disables
analog mode.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index b242600..dea90a1 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -5179,7 +5179,11 @@ struct saa7134_board saa7134_boards[] = {
 	[SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = {
 		.name           = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid",
 		.audio_clock    = 0x00187de7,
+#if 0
 		.tuner_type     = TUNER_PHILIPS_TDA8290,
+#else
+		.tuner_type	= UNSET,
+#endif
 		.tuner_addr     = ADDR_UNSET,
 		.radio_type     = UNSET,
 		.radio_addr	= ADDR_UNSET,
@@ -5191,7 +5195,6 @@ struct saa7134_board saa7134_boards[] = {
 			.vmux   = 1,
 			.amux   = TV,
 			.tv     = 1,
-			.gpio	= 0x4000,
 #if 0	/* FIXME */
 		}, {
 			.name   = name_comp1,
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 064bf2c..d2a12df 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -236,13 +236,38 @@ static struct tda18271_std_map mb86a20s_tda18271_std_map = {
 
 static struct tda18271_config kworld_tda18271_config = {
 	.std_map = &mb86a20s_tda18271_std_map,
-	.gate    = TDA18271_GATE_ANALOG,
+	.gate    = TDA18271_GATE_DIGITAL,
 };
 
 static const struct mb86a20s_config kworld_mb86a20s_config = {
 	.demod_address = 0x10,
 };
 
+static int kworld_sbtvd_gate_ctrl(struct dvb_frontend* fe, int enable)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+
+	unsigned char initmsg[] = {0x45, 0x97};
+	unsigned char msg_enable[] = {0x45, 0xc1};
+	unsigned char msg_disable[] = {0x45, 0x81};
+	struct i2c_msg msg = {.addr = 0x4b, .flags = 0, .buf = initmsg, .len = 2};
+
+	if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
+		wprintk("could not access the I2C gate\n");
+		return -EIO;
+	}
+	if (enable)
+		msg.buf = msg_enable;
+	else
+		msg.buf = msg_disable;
+	if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) {
+		wprintk("could not access the I2C gate\n");
+		return -EIO;
+	}
+	msleep(20);
+	return 0;
+}
+
 /* ==================================================================
  * tda1004x based DVB-T cards, helper functions
  */
@@ -1639,10 +1664,21 @@ static int dvb_init(struct saa7134_dev *dev)
 					       &kworld_mb86a20s_config,
 					       &dev->i2c_adap);
 		if (fe0->dvb.frontend != NULL) {
+#if 0
+			dvb_attach(tda829x_attach, fe0->dvb.frontend,
+				   &dev->i2c_adap, 0x4b,
+				   &tda829x_no_probe);
+#else
+			dvb_attach(tda829x_attach, fe0->dvb.frontend,
+				   &dev->i2c_adap, 0x4b, NULL);
+#endif
 			dvb_attach(tda18271_attach, fe0->dvb.frontend,
 				   0x60, &dev->i2c_adap,
 				   &kworld_tda18271_config);
+			fe0->dvb.frontend->ops.i2c_gate_ctrl = kworld_sbtvd_gate_ctrl;
 		}
+
+		/* mb86a20s need to use the I2C gateway */
 		break;
 	default:
 		wprintk("Huh? unknown DVB card?\n");
-- 
1.7.1



  parent reply	other threads:[~2011-01-15 16:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1295114145.git.mchehab@redhat.com>
2011-01-15 18:04 ` [PATCH 1/8] [media] tda8290: Make all read operations atomic Mauro Carvalho Chehab
2011-01-15 18:04 ` [PATCH 2/8] [media] tda8290: Fix a bug if no tuner is detected Mauro Carvalho Chehab
2011-01-15 18:04 ` [PATCH 3/8] [media] tda8290: Turn tda829x on before touching at the I2C gate Mauro Carvalho Chehab
2011-01-15 18:04 ` [PATCH 6/8] [media] saa7134: Fix analog mode for Kworld SBTVD Mauro Carvalho Chehab
2011-01-15 18:04 ` [PATCH 4/8] [media] mb86a20s: Fix i2c read/write error messages Mauro Carvalho Chehab
2011-01-15 18:04 ` [PATCH 5/8] [media] mb86a20s: Be sure that device is initialized before starting DVB Mauro Carvalho Chehab
2011-01-15 18:04 ` Mauro Carvalho Chehab [this message]
2011-01-15 18:04 ` [PATCH 8/8] [media] saa7134: Kworld SBTVD: make both analog and digital to work Mauro Carvalho Chehab
2011-01-17 14:14   ` Matti J. Aaltonen

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=20110115160423.37980983@pedra \
    --to=mchehab@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox