public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Stezenbach <js@linuxtv.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, thomas schorpp <t.schorpp@gmx.de>
Subject: [DVB patch 45/54] av7110: Siemens DVB-C analog video input support
Date: Mon, 05 Sep 2005 01:23:44 +0200	[thread overview]
Message-ID: <20050904232333.688686000@abc> (raw)
In-Reply-To: 20050904232259.777473000@abc

[-- Attachment #1: dvb-ttpci-siemens-dvb-c-analog-input.patch --]
[-- Type: text/plain, Size: 5713 bytes --]

From: thomas schorpp <t.schorpp@gmx.de>

Add support for analog video inputs (CVBS and Y/C) of the
analog module for the Siemens DVB-C card.

Signed-off-by: thomas schorpp <t.schorpp@gmx.de>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 drivers/media/dvb/ttpci/av7110_v4l.c |   74 +++++++++++++++++++++++++----------
 1 file changed, 54 insertions(+), 20 deletions(-)

--- linux-2.6.13-git4.orig/drivers/media/dvb/ttpci/av7110_v4l.c	2005-09-04 22:03:40.000000000 +0200
+++ linux-2.6.13-git4/drivers/media/dvb/ttpci/av7110_v4l.c	2005-09-04 22:30:54.000000000 +0200
@@ -70,7 +70,7 @@ static int msp_readreg(struct av7110 *av
 	return 0;
 }
 
-static struct v4l2_input inputs[2] = {
+static struct v4l2_input inputs[4] = {
 	{
 		.index		= 0,
 		.name		= "DVB",
@@ -87,6 +87,22 @@ static struct v4l2_input inputs[2] = {
 		.tuner		= 0,
 		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
 		.status		= 0,
+	}, {
+		.index		= 2,
+		.name		= "Video",
+		.type		= V4L2_INPUT_TYPE_CAMERA,
+		.audioset	= 0,
+		.tuner		= 0,
+		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
+		.status		= 0,
+	}, {
+		.index		= 3,
+		.name		= "Y/C",
+		.type		= V4L2_INPUT_TYPE_CAMERA,
+		.audioset	= 0,
+		.tuner		= 0,
+		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
+		.status		= 0,
 	}
 };
 
@@ -212,24 +228,44 @@ static int av7110_dvb_c_switch(struct sa
 	}
 
 	if (0 != av7110->current_input) {
+		dprintk(1, "switching to analog TV:\n");
 		adswitch = 1;
 		source = SAA7146_HPS_SOURCE_PORT_B;
 		sync = SAA7146_HPS_SYNC_PORT_B;
 		memcpy(standard, analog_standard, sizeof(struct saa7146_standard) * 2);
-		dprintk(1, "switching to analog TV\n");
-		msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source
-		msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source
-		msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source
-		msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono
-		msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone
-		msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume
 
-		if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
-			if (ves1820_writereg(dev, 0x09, 0x0f, 0x60))
-				dprintk(1, "setting band in demodulator failed.\n");
-		} else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
-			saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD)
-			saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF)
+		switch (av7110->current_input) {
+		case 1:
+			dprintk(1, "switching SAA7113 to Analog Tuner Input.\n");
+			msp_writereg(av7110, MSP_WR_DSP, 0x0008, 0x0000); // loudspeaker source
+			msp_writereg(av7110, MSP_WR_DSP, 0x0009, 0x0000); // headphone source
+			msp_writereg(av7110, MSP_WR_DSP, 0x000a, 0x0000); // SCART 1 source
+			msp_writereg(av7110, MSP_WR_DSP, 0x000e, 0x3000); // FM matrix, mono
+			msp_writereg(av7110, MSP_WR_DSP, 0x0000, 0x4f00); // loudspeaker + headphone
+			msp_writereg(av7110, MSP_WR_DSP, 0x0007, 0x4f00); // SCART 1 volume
+
+			if (av7110->analog_tuner_flags & ANALOG_TUNER_VES1820) {
+				if (ves1820_writereg(dev, 0x09, 0x0f, 0x60))
+					dprintk(1, "setting band in demodulator failed.\n");
+			} else if (av7110->analog_tuner_flags & ANALOG_TUNER_STV0297) {
+				saa7146_setgpio(dev, 1, SAA7146_GPIO_OUTHI); // TDA9198 pin9(STD)
+				saa7146_setgpio(dev, 3, SAA7146_GPIO_OUTHI); // TDA9198 pin30(VIF)
+			}
+			if (i2c_writereg(av7110, 0x48, 0x02, 0xd0) != 1)
+				dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
+			break;
+		case 2:
+			dprintk(1, "switching SAA7113 to Video AV CVBS Input.\n");
+			if (i2c_writereg(av7110, 0x48, 0x02, 0xd2) != 1)
+				dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
+			break;
+		case 3:
+			dprintk(1, "switching SAA7113 to Video AV Y/C Input.\n");
+			if (i2c_writereg(av7110, 0x48, 0x02, 0xd9) != 1)
+				dprintk(1, "saa7113 write failed @ card %d", av7110->dvb_adapter.num);
+			break;
+		default:
+			dprintk(1, "switching SAA7113 to Input: AV7110: SAA7113: invalid input.\n");
 		}
 	} else {
 		adswitch = 0;
@@ -300,7 +336,6 @@ static int av7110_ioctl(struct saa7146_f
 		// FIXME: standard / stereo detection is still broken
 		msp_readreg(av7110, MSP_RD_DEM, 0x007e, &stereo_det);
 		dprintk(1, "VIDIOC_G_TUNER: msp3400 TV standard detection: 0x%04x\n", stereo_det);
-
 		msp_readreg(av7110, MSP_RD_DSP, 0x0018, &stereo_det);
 		dprintk(1, "VIDIOC_G_TUNER: msp3400 stereo detection: 0x%04x\n", stereo_det);
 		stereo = (s8)(stereo_det >> 8);
@@ -310,7 +345,7 @@ static int av7110_ioctl(struct saa7146_f
 			t->audmode = V4L2_TUNER_MODE_STEREO;
 		}
 		else if (stereo < -0x10) {
-			/* bilingual*/
+			/* bilingual */
 			t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
 			t->audmode = V4L2_TUNER_MODE_LANG1;
 		}
@@ -344,7 +379,7 @@ static int av7110_ioctl(struct saa7146_f
 			fm_matrix = 0x3000; // mono
 			src = 0x0010;
 			break;
-		default: /* case V4L2_TUNER_MODE_MONO: {*/
+		default: /* case V4L2_TUNER_MODE_MONO: */
 			dprintk(2, "VIDIOC_S_TUNER: TDA9840_SET_MONO\n");
 			fm_matrix = 0x3000; // mono
 			src = 0x0030;
@@ -406,7 +441,7 @@ static int av7110_ioctl(struct saa7146_f
 		dprintk(2, "VIDIOC_ENUMINPUT: %d\n", i->index);
 
 		if (av7110->analog_tuner_flags) {
-			if (i->index < 0 || i->index >= 2)
+			if (i->index < 0 || i->index >= 4)
 				return -EINVAL;
 		} else {
 			if (i->index != 0)
@@ -433,10 +468,9 @@ static int av7110_ioctl(struct saa7146_f
 		if (!av7110->analog_tuner_flags)
 			return 0;
 
-		if (input < 0 || input >= 2)
+		if (input < 0 || input >= 4)
 			return -EINVAL;
 
-		/* FIXME: switch inputs here */
 		av7110->current_input = input;
 		return av7110_dvb_c_switch(fh);
 	}

--


  parent reply	other threads:[~2005-09-04 23:31 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-04 23:22 [DVB patch 00/54] DVB update Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 01/54] email address update Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 02/54] remove version.h dependencies Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 03/54] avoid building empty built-in.o Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 04/54] core: glue code for DMX_GET_CAPS and DMX_SET_SOURCE Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 05/54] core: dvb_demux: fix continuity counter error handling Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 06/54] core: dvb_demux: remove unused cruft Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 07/54] core: dvb_demux: remove unsused descramble callbacks Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 08/54] core: dvb_demux: remove more unused cruft Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 09/54] core: dvb_demux: use INIT_LIST_HEAD Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 10/54] core: dvb_demux formatting fixes Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 11/54] core: CI timeout fix Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 12/54] frontend: mt352: fix signal strength reading Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 13/54] frontend: stv0299: pass i2c bus to pll callback Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 14/54] frontend: s5h1420: fixes Johannes Stezenbach
2005-09-04 23:56   ` Nish Aravamudan
2005-09-05  8:45     ` Andrew de Quincey
2005-09-04 23:23 ` [DVB patch 15/54] frontend: stv0299: support reading both BER and UCBLOCKS Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 16/54] frontend: tda1004x: fix SNR reading Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 17/54] frontend: ves1820: improve tuning Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 18/54] frontend: cx24110: DiSEqC fix Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 19/54] frontend: cx24110: another " Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 20/54] frontend: cx24110: clean up timeout handling Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 21/54] frontend: stv0297: QAM128 tuning improvement Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 22/54] frontend: or51132: remove bogus optimization attempt Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 23/54] usb: add TwinhanDTV StarBox support Johannes Stezenbach
2005-09-04 23:52   ` Nish Aravamudan
2005-09-04 23:23 ` [DVB patch 24/54] usb: dibusb: Kworld Xpert DVB-T USB2.0 support Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 25/54] usb: removed empty module_init/exit calls Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 26/54] usb: dtt200u: copy frontend_ops before modifying Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 27/54] usb: dtt200u: add proper device names Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 28/54] usb: core: change dvb_usb_device_init() API Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 29/54] usb: digitv: support for nxt6000 demod Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 30/54] usb: white space cleanup Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 31/54] usb: cxusb: fixes for new firmware Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 32/54] remove noisy debug print Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 33/54] bt8xx: endianness fix Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 34/54] bt8xx: cleanup Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 35/54] bt8xx: Nebula DigiTV mt352 support Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 36/54] Nebula DigiTV nxt6000 fix Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 37/54] dst: fix symbol rate setting Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 38/54] dst: remove unnecessary code Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 39/54] dst: dprrintk cleanup Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 40/54] dst: identify boards Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 41/54] dst: fix DVB-C tuning Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 42/54] dst: ci doc update Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 43/54] dst: Updated Documentation Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 44/54] cinergyT2: remote control fixes Johannes Stezenbach
2005-09-04 23:23 ` Johannes Stezenbach [this message]
2005-09-04 23:23 ` [DVB patch 46/54] budget-ci: add support for TT DVB-C CI card Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 47/54] budget-av: fixes for CI interface Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 48/54] budget-av: enable frontend on KNC1 Plus cards Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 49/54] av7110: disable superflous firmware handshake Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 50/54] av7110: conditionally disable workaround for broken firmware Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 51/54] ttpci: av7110: RC5+ remote control support Johannes Stezenbach
2005-09-04 23:41   ` Nish Aravamudan
2005-09-05  0:13     ` Johannes Stezenbach
2005-09-05  0:16       ` Nish Aravamudan
2005-09-05  0:27         ` Johannes Stezenbach
2005-09-05  0:34           ` Nish Aravamudan
2005-09-04 23:23 ` [DVB patch 52/54] ttpci: add PCI ids for old Siemens/TT DVB-C card Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 53/54] saa7146: i2c vs. sysfs fix Johannes Stezenbach
2005-09-04 23:23 ` [DVB patch 54/54] ttusb-budget: use time_after_eq() Johannes Stezenbach
2005-09-04 23:45   ` Nish Aravamudan
2005-09-05  0:07     ` Johannes Stezenbach
2005-09-05  0:14       ` Nish Aravamudan
2005-09-05  0:19         ` Johannes Stezenbach

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=20050904232333.688686000@abc \
    --to=js@linuxtv.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=t.schorpp@gmx.de \
    /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