Skip to contentSkip to conversation

Fix tm6010 audio

PATCH In review Dmitri Belimov 2 participants 4 messages Nov 8, 2011 – Nov 25, 2011 3 messages not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

PATCH 1/1 Fix tm6010 audio

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.

tm6000-core.c +5 -0
diff -r -U 3 tm6000.old/tm6000-core.c tm6000/tm6000-core.c
@@ -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 */
tm6000-stds.c +58 -8

116 lines not on this page · raw message

With my best regards, Dmitry.

tm6000-core.c +5 -0
diff -r -U 3 tm6000.old/tm6000-core.c tm6000/tm6000-core.c
@@ -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 */
tm6000-stds.c +58 -8

116 lines not on this page · raw message

#4 lore raw

Em 07-11-2011 22:45, Dmitri Belimov escreveu:

Quoted 2 lines

Hi

...

Quoted 7 lines

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.

Those ioctl's are gone since kernel 2.6.39, as they are part of the V4L1 API. You need to update your radio applications to the ones that implement V4L2 calls. The xawtv's radio application works with V4L2 API. AFAIKT, there are also some versions of gnomeradio implementing V4L2.

Regards,
Mauro

#5 lore raw
In reply to Dmitri Belimov

Em 07-11-2011 22:45, Dmitri Belimov escreveu:

Quoted 17 lines

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.

Quoted 6 lines

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.

This patch has several issues. The usage of switch for video doesn't work well. A better approach follows. Not tested yet.

PS.: I couldn't test it: not sure why, but the audio source is not working for me: arecord is not able to read from the device input.

-
[media] tm6000: Fix tm6010 audio standard selection

A V4L2 standards mask may contain several standards. A more restricted mask with just one standard is used when user needs to bind to an specific standard that can't be auto-detect among a more generic mask.

So, Improve the autodetection logic to detect the correct audio standard most of the time.

Based on a patch made by Dmitri Belimov <[email protected]>.

drivers/media/video/tm6000/tm6000-core.c +5 -0
index 9783616..55d097e 100644
@@ -696,11 +696,13 @@ int tm6000_set_audio_rinput(struct tm6000_core *dev)
 	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;
@@ -720,6 +722,9 @@ int tm6000_set_audio_rinput(struct tm6000_core *dev)
 		/* 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 */
drivers/media/video/tm6000/tm6000-stds.c +35 -54

139 lines not on this page · raw message

#6 lore raw

Hi

Quoted 24 lines

Em 07-11-2011 22:45, Dmitri Belimov escreveu:

Quoted 23 lines

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

Quoted 7 lines
Quoted 1 line

Try found what happens with radio.

This patch has several issues. The usage of switch for video doesn't work well. A better approach follows. Not tested yet.

PS.: I couldn't test it: not sure why, but the audio source is not working for me: arecord is not able to read from the device input.

URB_MSG_AUDIO is zero size no data for fill to audio buffer.

for watch TV I used this command

mplayer -v tv:// -tv driver=v4l2:fps=25:outfmt=i420:width=720:height=576:alsa:adevice=hw.1,0:amode=1:audiorate=48000:forceaudio:immediatemode=0:freq=77.25:normid=15 -aspect 4:3 -vo xv

AFTER this command radio can works

URB_MSG_AUDIO is not zero and audio buffer filled.

I think incorrect init a register. When I start mplayer a register set correct mode and audio via arecord and sox can work.

I try found it.

With my best regards, Dmitry.

Quoted 23 lines

-
[media] tm6000: Fix tm6010 audio standard selection

A V4L2 standards mask may contain several standards. A more restricted mask with just one standard is used when user needs to bind to an specific standard that can't be auto-detect among a more generic mask.

So, Improve the autodetection logic to detect the correct audio standard most of the time.

Based on a patch made by Dmitri Belimov <[email protected]>.

(quoted diff) +0 -0

b/drivers/media/video/tm6000/tm6000-core.c index 9783616..55d097e 100644 --- a/drivers/media/video/tm6000/tm6000-core.c +++ b/drivers/media/video/tm6000/tm6000-core.c

drivers/media/video/tm6000/tm6000-core.c +0 -0
@@ -696,11 +696,13 @@ int tm6000_set_audio_rinput(struct tm6000_core
 *dev) if (dev->dev_type == TM6010) {
 		/* Audio crossbar setting, default SIF1 */
 		u8 areg_f0;

<snip>

Quoted 4 lines
drivers/media/video/tm6000/tm6000-stds.c +1 -0
+				0x30, 0xf0);
 			break;
 		default:
 			break;