All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitri Belimov <d.belimov@gmail.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Stefan Ringel <stefan.ringel@arcor.de>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH] tm6000: fix s-video input
Date: Fri, 18 Mar 2011 09:08:55 +0900	[thread overview]
Message-ID: <20110318090855.773af168@glory.local> (raw)
In-Reply-To: <4D5D8BFB.4070802@redhat.com>

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

Hi

Add compatibility for composite and s-video inputs. Some TV cards hasn't it.
Fix S-Video input, the s-video cable has only video signals no audio. Call the function of audio configure kill chroma in signal. only b/w video.

Known bugs:
after s-video the audio for radio didn't work, TV crashed hardly
after composite TV crashed hardly too.

P.S. After this patch I'll want to rework the procedure of configure video. Now it has a lot of junk and dubles.

diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 88144a1..146c7e8 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -235,11 +235,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 1,
-			.has_zl10353  = 1,
-			.has_eeprom   = 1,
-			.has_remote   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 1,
+			.has_zl10353    = 1,
+			.has_eeprom     = 1,
+			.has_remote     = 1,
+			.has_input_comp = 1,
+			.has_input_svid = 1,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
@@ -255,11 +257,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 0,
-			.has_zl10353  = 0,
-			.has_eeprom   = 1,
-			.has_remote   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 0,
+			.has_zl10353    = 0,
+			.has_eeprom     = 1,
+			.has_remote     = 1,
+			.has_input_comp = 1,
+			.has_input_svid = 1,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
@@ -327,10 +331,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 1,
-			.has_zl10353  = 1,
-			.has_eeprom   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 1,
+			.has_zl10353    = 1,
+			.has_eeprom     = 1,
+			.has_remote     = 0,
+			.has_input_comp = 0,
+			.has_input_svid = 0,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
@@ -346,10 +353,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 0,
-			.has_zl10353  = 0,
-			.has_eeprom   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 0,
+			.has_zl10353    = 0,
+			.has_eeprom     = 1,
+			.has_remote     = 0,
+			.has_input_comp = 0,
+			.has_input_svid = 0,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c
index a4c07e5..da3e51b 100644
--- a/drivers/staging/tm6000/tm6000-stds.c
+++ b/drivers/staging/tm6000/tm6000-stds.c
@@ -1161,8 +1161,6 @@ int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm)
 				rc = tm6000_load_std(dev, svideo_stds[i].common,
 						     sizeof(svideo_stds[i].
 							    common));
-				tm6000_set_audio_std(dev, svideo_stds[i].audio_default_std);
-
 				goto ret;
 			}
 		}
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index b550340..c80a316 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -1080,18 +1080,27 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm)
 static int vidioc_enum_input(struct file *file, void *priv,
 				struct v4l2_input *inp)
 {
+	struct tm6000_fh   *fh = priv;
+	struct tm6000_core *dev = fh->dev;
+
 	switch (inp->index) {
 	case TM6000_INPUT_TV:
 		inp->type = V4L2_INPUT_TYPE_TUNER;
 		strcpy(inp->name, "Television");
 		break;
 	case TM6000_INPUT_COMPOSITE:
-		inp->type = V4L2_INPUT_TYPE_CAMERA;
-		strcpy(inp->name, "Composite");
+		if (dev->caps.has_input_comp) {
+			inp->type = V4L2_INPUT_TYPE_CAMERA;
+			strcpy(inp->name, "Composite");
+		} else
+			return -EINVAL;
 		break;
 	case TM6000_INPUT_SVIDEO:
-		inp->type = V4L2_INPUT_TYPE_CAMERA;
-		strcpy(inp->name, "S-Video");
+		if (dev->caps.has_input_svid) {
+			inp->type = V4L2_INPUT_TYPE_CAMERA;
+			strcpy(inp->name, "S-Video");
+		} else
+			return -EINVAL;
 		break;
 	default:
 		return -EINVAL;
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index ccd120f..99ae50e 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -129,6 +129,8 @@ struct tm6000_capabilities {
 	unsigned int    has_zl10353:1;
 	unsigned int    has_eeprom:1;
 	unsigned int    has_remote:1;
+	unsigned int    has_input_comp:1;
+	unsigned int    has_input_svid:1;
 };
 
 struct tm6000_dvb {

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>

With my best regards, Dmitry.

[-- Attachment #2: tm6000_svideo.patch --]
[-- Type: text/x-patch, Size: 4271 bytes --]

diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 88144a1..146c7e8 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -235,11 +235,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 1,
-			.has_zl10353  = 1,
-			.has_eeprom   = 1,
-			.has_remote   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 1,
+			.has_zl10353    = 1,
+			.has_eeprom     = 1,
+			.has_remote     = 1,
+			.has_input_comp = 1,
+			.has_input_svid = 1,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
@@ -255,11 +257,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 0,
-			.has_zl10353  = 0,
-			.has_eeprom   = 1,
-			.has_remote   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 0,
+			.has_zl10353    = 0,
+			.has_eeprom     = 1,
+			.has_remote     = 1,
+			.has_input_comp = 1,
+			.has_input_svid = 1,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
@@ -327,10 +331,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 1,
-			.has_zl10353  = 1,
-			.has_eeprom   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 1,
+			.has_zl10353    = 1,
+			.has_eeprom     = 1,
+			.has_remote     = 0,
+			.has_input_comp = 0,
+			.has_input_svid = 0,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
@@ -346,10 +353,13 @@ struct tm6000_board tm6000_boards[] = {
 		.avideo       = TM6000_AIP_SIF1,
 		.aradio       = TM6000_AIP_LINE1,
 		.caps = {
-			.has_tuner    = 1,
-			.has_dvb      = 0,
-			.has_zl10353  = 0,
-			.has_eeprom   = 1,
+			.has_tuner      = 1,
+			.has_dvb        = 0,
+			.has_zl10353    = 0,
+			.has_eeprom     = 1,
+			.has_remote     = 0,
+			.has_input_comp = 0,
+			.has_input_svid = 0,
 		},
 		.gpio = {
 			.tuner_reset	= TM6010_GPIO_0,
diff --git a/drivers/staging/tm6000/tm6000-stds.c b/drivers/staging/tm6000/tm6000-stds.c
index a4c07e5..da3e51b 100644
--- a/drivers/staging/tm6000/tm6000-stds.c
+++ b/drivers/staging/tm6000/tm6000-stds.c
@@ -1161,8 +1161,6 @@ int tm6000_set_standard(struct tm6000_core *dev, v4l2_std_id * norm)
 				rc = tm6000_load_std(dev, svideo_stds[i].common,
 						     sizeof(svideo_stds[i].
 							    common));
-				tm6000_set_audio_std(dev, svideo_stds[i].audio_default_std);
-
 				goto ret;
 			}
 		}
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c
index b550340..c80a316 100644
--- a/drivers/staging/tm6000/tm6000-video.c
+++ b/drivers/staging/tm6000/tm6000-video.c
@@ -1080,18 +1080,27 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *norm)
 static int vidioc_enum_input(struct file *file, void *priv,
 				struct v4l2_input *inp)
 {
+	struct tm6000_fh   *fh = priv;
+	struct tm6000_core *dev = fh->dev;
+
 	switch (inp->index) {
 	case TM6000_INPUT_TV:
 		inp->type = V4L2_INPUT_TYPE_TUNER;
 		strcpy(inp->name, "Television");
 		break;
 	case TM6000_INPUT_COMPOSITE:
-		inp->type = V4L2_INPUT_TYPE_CAMERA;
-		strcpy(inp->name, "Composite");
+		if (dev->caps.has_input_comp) {
+			inp->type = V4L2_INPUT_TYPE_CAMERA;
+			strcpy(inp->name, "Composite");
+		} else
+			return -EINVAL;
 		break;
 	case TM6000_INPUT_SVIDEO:
-		inp->type = V4L2_INPUT_TYPE_CAMERA;
-		strcpy(inp->name, "S-Video");
+		if (dev->caps.has_input_svid) {
+			inp->type = V4L2_INPUT_TYPE_CAMERA;
+			strcpy(inp->name, "S-Video");
+		} else
+			return -EINVAL;
 		break;
 	default:
 		return -EINVAL;
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index ccd120f..99ae50e 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -129,6 +129,8 @@ struct tm6000_capabilities {
 	unsigned int    has_zl10353:1;
 	unsigned int    has_eeprom:1;
 	unsigned int    has_remote:1;
+	unsigned int    has_input_comp:1;
+	unsigned int    has_input_svid:1;
 };
 
 struct tm6000_dvb {

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>

  parent reply	other threads:[~2011-03-18  0:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07  5:28 [RFC PATCH] Audio standards on tm6000 Mauro Carvalho Chehab
2010-10-08 19:03 ` Dmitri Belimov
2010-10-08 11:52   ` Mauro Carvalho Chehab
2010-10-12 18:28     ` Dmitri Belimov
2010-10-12 16:54       ` Stefan Ringel
2010-10-13 14:13         ` Dmitri Belimov
     [not found]         ` <20101129174412.08f2001c@glory.local>
     [not found]           ` <4CF51C9E.6040600@arcor.de>
     [not found]             ` <20101201144704.43b58f2c@glory.local>
     [not found]               ` <4CF67AB9.6020006@arcor.de>
     [not found]                 ` <20101202134128.615bbfa0@glory.local>
     [not found]                   ` <4CF71CF6.7080603@redhat.com>
     [not found]                     ` <20101206010934.55d07569@glory.local>
     [not found]                       ` <4CFBF62D.7010301@arcor.de>
     [not found]                         ` <20101206190230.2259d7ab@glory.local>
     [not found]                           ` <4CFEA3D2.4050309@arcor.de>
     [not found]                             ` <20101208125539.739e2ed2@glory.local>
     [not found]                               ` <4CFFAD1E.7040004@arcor.de>
2010-12-14  3:23                                 ` tm6000 and IR Dmitri Belimov
2010-12-14 16:27                                   ` Stefan Ringel
2010-12-15  7:46                                     ` Dmitri Belimov
2010-12-15 15:52                                       ` Stefan Ringel
2010-12-16  3:26                                         ` Dmitri Belimov
2010-12-16  9:38                                         ` Dmitri Belimov
2010-12-16 17:12                                           ` Stefan Ringel
2010-12-17  1:46                                             ` Dmitri Belimov
2010-12-17  5:18                                               ` Stefan Ringel
2010-12-17  7:08                                                 ` Dmitri Belimov
2010-12-18  0:24                                                   ` Mauro Carvalho Chehab
2010-12-18 13:56                                                     ` Andy Walls
2010-12-18 15:55                                                       ` Stefan Ringel
2010-12-20  5:41                                                     ` Dmitri Belimov
2010-12-21 22:36                                                       ` Jarod Wilson
2010-12-22  8:57                                                         ` [PATCH] Rework and fix IR Dmitri Belimov
2011-01-13  3:46                                                     ` [PATCH] tm6000: rework init code Dmitri Belimov
2011-01-20  6:05                                                     ` [PATCH] tm6000: add/rework reg.defines Dmitri Belimov
2011-01-20 19:25                                                       ` Stefan Ringel
2011-01-20 23:20                                                         ` Dmitri Belimov
2011-02-17  5:12                                                         ` tm6000 and radio Dmitri Belimov
2011-02-17 20:58                                                           ` Mauro Carvalho Chehab
2011-02-18  1:11                                                             ` [PATCH] tm6000: add radio Dmitri Belimov
2011-03-01  4:55                                                             ` [PATCH] tm6000: add audio conf for new cards Dmitri Belimov
2011-03-18  0:08                                                             ` Dmitri Belimov [this message]
2011-03-19  6:46                                                               ` [PATCH] tm6000: fix s-video input Stefan Ringel
2011-03-23  2:49                                                                 ` Dmitri Belimov
2011-04-19  5:29                                                             ` [PATCH v1] tm6000: rework standards Dmitri Belimov
2011-04-19  6:42                                                               ` Stefan Ringel
2011-05-04 16:18                                                                 ` Stefan Ringel

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=20110318090855.773af168@glory.local \
    --to=d.belimov@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=stefan.ringel@arcor.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 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.