public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitri Belimov <d.belimov@gmail.com>
To: Stefan Ringel <stefan.ringel@arcor.de>
Cc: mchehab@redhat.com, linux-media@vger.kernel.org
Subject: [PATCH] Fix tm6010 audio
Date: Tue, 8 Nov 2011 10:45:00 +1000	[thread overview]
Message-ID: <20111108104500.2f0fc14f@glory.local> (raw)
In-Reply-To: <4E9C65CD.2070409@arcor.de>

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

Hi

I found why audio dosn't work for me and fix it.

2Stefan:
The V4L2_STD_DK has V4L2_STD_SECAM_DK but not equal 
switch-case statement not worked

you can use 
if (dev->norm & V4L2_STD_DK) { 
}

This patch fix this problem.

Other, please don't remove any workarounds without important reason.
For your chip revision it can be work but for other audio will be bad.

I can watch TV but radio not work. After start Gnomeradio I see 
VIDIOCGAUDIO incorrect
VIDIOCSAUDIO incorrect
VIDIOCSFREQ incorrect

Try found what happens with radio.

diff -r -U 3 tm6000.old/tm6000-core.c tm6000/tm6000-core.c
--- tm6000.old/tm6000-core.c	2011-08-29 14:16:01.000000000 +1000
+++ tm6000/tm6000-core.c	2011-11-08 02:31:48.000000000 +1000
@@ -640,11 +640,13 @@
 	if (dev->dev_type == TM6010) {
 		/* Audio crossbar setting, default SIF1 */
 		u8 areg_f0;
+		u8 areg_07 = 0x10;
 
 		switch (dev->rinput.amux) {
 		case TM6000_AMUX_SIF1:
 		case TM6000_AMUX_SIF2:
 			areg_f0 = 0x03;
+			areg_07 = 0x30;
 			break;
 		case TM6000_AMUX_ADC1:
 			areg_f0 = 0x00;
@@ -664,6 +666,9 @@
 		/* Set audio input crossbar */
 		tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 							areg_f0, 0x0f);
+		/* Mux overflow workaround */
+		tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+			areg_07, 0xf0);
 	} else {
 		u8 areg_eb;
 		/* Audio setting, default LINE1 */
diff -r -U 3 tm6000.old/tm6000-stds.c tm6000/tm6000-stds.c
--- tm6000.old/tm6000-stds.c	2011-08-29 14:16:01.000000000 +1000
+++ tm6000/tm6000-stds.c	2011-11-08 03:04:37.000000000 +1000
@@ -394,7 +394,14 @@
 		case V4L2_STD_SECAM_L:
 			areg_05 |= 0x00;
 			break;
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 |= 0x10;
 			break;
 		}
@@ -402,11 +409,23 @@
 	/* A2 */
 	case 1:
 		switch (dev->norm) {
-		case V4L2_STD_B:
-		case V4L2_STD_GH:
+		case V4L2_STD_PAL_B:
+		case V4L2_STD_PAL_B1:
+		case V4L2_STD_SECAM_B:
+		case V4L2_STD_PAL_G:
+		case V4L2_STD_PAL_H:
+		case V4L2_STD_SECAM_G:
+		case V4L2_STD_SECAM_H:
 			areg_05 = 0x05;
 			break;
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 = 0x09;
 			break;
 		}
@@ -414,11 +433,23 @@
 	/* NICAM */
 	case 2:
 		switch (dev->norm) {
-		case V4L2_STD_B:
-		case V4L2_STD_GH:
+		case V4L2_STD_PAL_B:
+		case V4L2_STD_PAL_B1:
+		case V4L2_STD_SECAM_B:
+		case V4L2_STD_PAL_G:
+		case V4L2_STD_PAL_H:
+		case V4L2_STD_SECAM_G:
+		case V4L2_STD_SECAM_H:
 			areg_05 = 0x07;
 			break;
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 = 0x06;
 			break;
 		case V4L2_STD_PAL_I:
@@ -435,7 +466,14 @@
 	case 3:
 		switch (dev->norm) {
 		/* DK3_A2 */
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 = 0x0b;
 			break;
 		/* Korea */
@@ -571,10 +609,16 @@
 		case TM6000_AMUX_ADC1:
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x00, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x10, 0xf0);
 			break;
 		case TM6000_AMUX_ADC2:
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x08, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x10, 0xf0);
 			break;
 		case TM6000_AMUX_SIF1:
 			reg_08_e2 |= 0x02;
@@ -584,6 +628,9 @@
 			tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3);
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x02, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x30, 0xf0);
 			break;
 		case TM6000_AMUX_SIF2:
 			reg_08_e2 |= 0x02;
@@ -593,6 +640,9 @@
 			tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf7);
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x02, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x30, 0xf0);
 			break;
 		default:
 			break;

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


With my best regards, Dmitry.

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

diff -r -U 3 tm6000.old/tm6000-core.c tm6000/tm6000-core.c
--- tm6000.old/tm6000-core.c	2011-08-29 14:16:01.000000000 +1000
+++ tm6000/tm6000-core.c	2011-11-08 02:31:48.000000000 +1000
@@ -640,11 +640,13 @@
 	if (dev->dev_type == TM6010) {
 		/* Audio crossbar setting, default SIF1 */
 		u8 areg_f0;
+		u8 areg_07 = 0x10;
 
 		switch (dev->rinput.amux) {
 		case TM6000_AMUX_SIF1:
 		case TM6000_AMUX_SIF2:
 			areg_f0 = 0x03;
+			areg_07 = 0x30;
 			break;
 		case TM6000_AMUX_ADC1:
 			areg_f0 = 0x00;
@@ -664,6 +666,9 @@
 		/* Set audio input crossbar */
 		tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 							areg_f0, 0x0f);
+		/* Mux overflow workaround */
+		tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+			areg_07, 0xf0);
 	} else {
 		u8 areg_eb;
 		/* Audio setting, default LINE1 */
diff -r -U 3 tm6000.old/tm6000-stds.c tm6000/tm6000-stds.c
--- tm6000.old/tm6000-stds.c	2011-08-29 14:16:01.000000000 +1000
+++ tm6000/tm6000-stds.c	2011-11-08 03:04:37.000000000 +1000
@@ -394,7 +394,14 @@
 		case V4L2_STD_SECAM_L:
 			areg_05 |= 0x00;
 			break;
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 |= 0x10;
 			break;
 		}
@@ -402,11 +409,23 @@
 	/* A2 */
 	case 1:
 		switch (dev->norm) {
-		case V4L2_STD_B:
-		case V4L2_STD_GH:
+		case V4L2_STD_PAL_B:
+		case V4L2_STD_PAL_B1:
+		case V4L2_STD_SECAM_B:
+		case V4L2_STD_PAL_G:
+		case V4L2_STD_PAL_H:
+		case V4L2_STD_SECAM_G:
+		case V4L2_STD_SECAM_H:
 			areg_05 = 0x05;
 			break;
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 = 0x09;
 			break;
 		}
@@ -414,11 +433,23 @@
 	/* NICAM */
 	case 2:
 		switch (dev->norm) {
-		case V4L2_STD_B:
-		case V4L2_STD_GH:
+		case V4L2_STD_PAL_B:
+		case V4L2_STD_PAL_B1:
+		case V4L2_STD_SECAM_B:
+		case V4L2_STD_PAL_G:
+		case V4L2_STD_PAL_H:
+		case V4L2_STD_SECAM_G:
+		case V4L2_STD_SECAM_H:
 			areg_05 = 0x07;
 			break;
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 = 0x06;
 			break;
 		case V4L2_STD_PAL_I:
@@ -435,7 +466,14 @@
 	case 3:
 		switch (dev->norm) {
 		/* DK3_A2 */
-		case V4L2_STD_DK:
+		case V4L2_STD_SECAM_D:
+		case V4L2_STD_SECAM_K:
+		case V4L2_STD_SECAM_K1:
+		case V4L2_STD_SECAM_DK:
+		case V4L2_STD_PAL_D:
+		case V4L2_STD_PAL_D1:
+		case V4L2_STD_PAL_K:
+		case V4L2_STD_PAL_DK:
 			areg_05 = 0x0b;
 			break;
 		/* Korea */
@@ -571,10 +609,16 @@
 		case TM6000_AMUX_ADC1:
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x00, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x10, 0xf0);
 			break;
 		case TM6000_AMUX_ADC2:
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x08, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x10, 0xf0);
 			break;
 		case TM6000_AMUX_SIF1:
 			reg_08_e2 |= 0x02;
@@ -584,6 +628,9 @@
 			tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf3);
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x02, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x30, 0xf0);
 			break;
 		case TM6000_AMUX_SIF2:
 			reg_08_e2 |= 0x02;
@@ -593,6 +640,9 @@
 			tm6000_set_reg(dev, TM6010_REQ08_RE4_ADC_IN2_SEL, 0xf7);
 			tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
 				0x02, 0x0f);
+			/* Mux overflow workaround */
+			tm6000_set_reg_mask(dev, TM6010_REQ07_R07_OUTPUT_CONTROL,
+				0x30, 0xf0);
 			break;
 		default:
 			break;

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

       reply	other threads:[~2011-11-08  0:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E8C5675.8070604@arcor.de>
     [not found] ` <20111017155537.6c55aec8@glory.local>
     [not found]   ` <4E9C65CD.2070409@arcor.de>
2011-11-08  0:45     ` Dmitri Belimov [this message]
2011-11-08  9:12       ` [PATCH] Fix tm6010 audio Mauro Carvalho Chehab
2011-11-24 16:20       ` Mauro Carvalho Chehab
2011-11-25  0:13         ` Dmitri Belimov

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=20111108104500.2f0fc14f@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox