Commit e67bcf3e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] saa7134: change the debug macros for saa7134-tvaudio

use just one macro instead of 2, naming it as audio_dbg() and
using pr_fmt().
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent af5d20ce
...@@ -49,13 +49,8 @@ static int audio_clock_tweak; ...@@ -49,13 +49,8 @@ static int audio_clock_tweak;
module_param(audio_clock_tweak, int, 0644); module_param(audio_clock_tweak, int, 0644);
MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with audio crystal that's slightly off (range [-1024 .. 1024])"); MODULE_PARM_DESC(audio_clock_tweak, "Audio clock tick fine tuning for cards with audio crystal that's slightly off (range [-1024 .. 1024])");
#define dprintk(fmt, arg...) if (audio_debug) \ #define audio_dbg(level, fmt, arg...) if (audio_debug >= level) \
printk(KERN_DEBUG "%s/audio: " fmt, dev->name , ## arg) printk(KERN_DEBUG pr_fmt("audio: " fmt), ## arg)
#define d2printk(fmt, arg...) if (audio_debug > 1) \
printk(KERN_DEBUG "%s/audio: " fmt, dev->name, ## arg)
#define print_regb(reg) printk("%s: reg 0x%03x [%-16s]: 0x%02x\n", \
dev->name,(SAA7134_##reg),(#reg),saa_readb((SAA7134_##reg)))
/* msecs */ /* msecs */
#define SCAN_INITIAL_DELAY 1000 #define SCAN_INITIAL_DELAY 1000
...@@ -206,13 +201,14 @@ static void mute_input_7134(struct saa7134_dev *dev) ...@@ -206,13 +201,14 @@ static void mute_input_7134(struct saa7134_dev *dev)
if (dev->hw_mute == mute && if (dev->hw_mute == mute &&
dev->hw_input == in && !dev->insuspend) { dev->hw_input == in && !dev->insuspend) {
dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", audio_dbg(1, "mute/input: nothing to do [mute=%d,input=%s]\n",
mute,in->name); mute, in->name);
return; return;
} }
dprintk("ctl_mute=%d automute=%d input=%s => mute=%d input=%s\n", audio_dbg(1, "ctl_mute=%d automute=%d input=%s => mute=%d input=%s\n",
dev->ctl_mute,dev->automute,dev->input->name,mute,in->name); dev->ctl_mute, dev->automute,
dev->input->name, mute, in->name);
dev->hw_mute = mute; dev->hw_mute = mute;
dev->hw_input = in; dev->hw_input = in;
...@@ -265,8 +261,8 @@ static void tvaudio_setmode(struct saa7134_dev *dev, ...@@ -265,8 +261,8 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
tweak = audio_clock_tweak; tweak = audio_clock_tweak;
if (note) if (note)
dprintk("tvaudio_setmode: %s %s [%d.%03d/%d.%03d MHz] acpf=%d%+d\n", audio_dbg(1, "tvaudio_setmode: %s %s [%d.%03d/%d.%03d MHz] acpf=%d%+d\n",
note,audio->name, note, audio->name,
audio->carr1 / 1000, audio->carr1 % 1000, audio->carr1 / 1000, audio->carr1 % 1000,
audio->carr2 / 1000, audio->carr2 % 1000, audio->carr2 / 1000, audio->carr2 % 1000,
acpf, tweak); acpf, tweak);
...@@ -334,14 +330,14 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) ...@@ -334,14 +330,14 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan)
if (!(dev->tvnorm->id & scan->std)) { if (!(dev->tvnorm->id & scan->std)) {
value = 0; value = 0;
dprintk("skipping %d.%03d MHz [%4s]\n", audio_dbg(1, "skipping %d.%03d MHz [%4s]\n",
scan->carr / 1000, scan->carr % 1000, scan->name); scan->carr / 1000, scan->carr % 1000, scan->name);
return 0; return 0;
} }
if (audio_debug > 1) { if (audio_debug > 1) {
int i; int i;
dprintk("debug %d:",scan->carr); audio_dbg(1, "debug %d:", scan->carr);
for (i = -150; i <= 150; i += 30) { for (i = -150; i <= 150; i += 30) {
tvaudio_setcarrier(dev,scan->carr+i,scan->carr+i); tvaudio_setcarrier(dev,scan->carr+i,scan->carr+i);
saa_readl(SAA7134_LEVEL_READOUT1 >> 2); saa_readl(SAA7134_LEVEL_READOUT1 >> 2);
...@@ -349,11 +345,11 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) ...@@ -349,11 +345,11 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan)
return -1; return -1;
value = saa_readl(SAA7134_LEVEL_READOUT1 >> 2); value = saa_readl(SAA7134_LEVEL_READOUT1 >> 2);
if (0 == i) if (0 == i)
printk(" # %6d # ",value >> 16); pr_cont(" # %6d # ",value >> 16);
else else
printk(" %6d",value >> 16); pr_cont(" %6d",value >> 16);
} }
printk("\n"); pr_cont("\n");
} }
tvaudio_setcarrier(dev,scan->carr-90,scan->carr-90); tvaudio_setcarrier(dev,scan->carr-90,scan->carr-90);
...@@ -371,7 +367,7 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan) ...@@ -371,7 +367,7 @@ static int tvaudio_checkcarrier(struct saa7134_dev *dev, struct mainscan *scan)
left >>= 16; left >>= 16;
right >>= 16; right >>= 16;
value = left > right ? left - right : right - left; value = left > right ? left - right : right - left;
dprintk("scanning %d.%03d MHz [%4s] => dc is %5d [%d/%d]\n", audio_dbg(1, "scanning %d.%03d MHz [%4s] => dc is %5d [%d/%d]\n",
scan->carr / 1000, scan->carr % 1000, scan->carr / 1000, scan->carr % 1000,
scan->name, value, left, right); scan->name, value, left, right);
return value; return value;
...@@ -389,7 +385,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au ...@@ -389,7 +385,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
case TVAUDIO_FM_K_STEREO: case TVAUDIO_FM_K_STEREO:
case TVAUDIO_FM_BG_STEREO: case TVAUDIO_FM_BG_STEREO:
idp = (saa_readb(SAA7134_IDENT_SIF) & 0xe0) >> 5; idp = (saa_readb(SAA7134_IDENT_SIF) & 0xe0) >> 5;
dprintk("getstereo: fm/stereo: idp=0x%x\n",idp); audio_dbg(1, "getstereo: fm/stereo: idp=0x%x\n", idp);
if (0x03 == (idp & 0x03)) if (0x03 == (idp & 0x03))
retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
else if (0x05 == (idp & 0x05)) else if (0x05 == (idp & 0x05))
...@@ -403,10 +399,10 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au ...@@ -403,10 +399,10 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
case TVAUDIO_NICAM_FM: case TVAUDIO_NICAM_FM:
case TVAUDIO_NICAM_AM: case TVAUDIO_NICAM_AM:
nicam = saa_readb(SAA7134_AUDIO_STATUS); nicam = saa_readb(SAA7134_AUDIO_STATUS);
dprintk("getstereo: nicam=0x%x\n",nicam); audio_dbg(1, "getstereo: nicam=0x%x\n", nicam);
if (nicam & 0x1) { if (nicam & 0x1) {
nicam_status = saa_readb(SAA7134_NICAM_STATUS); nicam_status = saa_readb(SAA7134_NICAM_STATUS);
dprintk("getstereo: nicam_status=0x%x\n", nicam_status); audio_dbg(1, "getstereo: nicam_status=0x%x\n", nicam_status);
switch (nicam_status & 0x03) { switch (nicam_status & 0x03) {
case 0x01: case 0x01:
...@@ -424,7 +420,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au ...@@ -424,7 +420,7 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
break; break;
} }
if (retval != -1) if (retval != -1)
dprintk("found audio subchannels:%s%s%s%s\n", audio_dbg(1, "found audio subchannels:%s%s%s%s\n",
(retval & V4L2_TUNER_SUB_MONO) ? " mono" : "", (retval & V4L2_TUNER_SUB_MONO) ? " mono" : "",
(retval & V4L2_TUNER_SUB_STEREO) ? " stereo" : "", (retval & V4L2_TUNER_SUB_STEREO) ? " stereo" : "",
(retval & V4L2_TUNER_SUB_LANG1) ? " lang1" : "", (retval & V4L2_TUNER_SUB_LANG1) ? " lang1" : "",
...@@ -459,8 +455,8 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au ...@@ -459,8 +455,8 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au
case TVAUDIO_FM_BG_STEREO: case TVAUDIO_FM_BG_STEREO:
case TVAUDIO_NICAM_AM: case TVAUDIO_NICAM_AM:
case TVAUDIO_NICAM_FM: case TVAUDIO_NICAM_FM:
dprintk("setstereo [fm] => %s\n", audio_dbg(1, "setstereo [fm] => %s\n",
name[ mode % ARRAY_SIZE(name) ]); name[mode % ARRAY_SIZE(name)]);
reg = fm[ mode % ARRAY_SIZE(fm) ]; reg = fm[ mode % ARRAY_SIZE(fm) ];
saa_writeb(SAA7134_FM_DEMATRIX, reg); saa_writeb(SAA7134_FM_DEMATRIX, reg);
break; break;
...@@ -489,7 +485,8 @@ static int tvaudio_thread(void *data) ...@@ -489,7 +485,8 @@ static int tvaudio_thread(void *data)
try_to_freeze(); try_to_freeze();
dev->thread.scan1 = dev->thread.scan2; dev->thread.scan1 = dev->thread.scan2;
dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1); audio_dbg(1, "tvaudio thread scan start [%d]\n",
dev->thread.scan1);
dev->tvaudio = NULL; dev->tvaudio = NULL;
saa_writeb(SAA7134_MONITOR_SELECT, 0xa0); saa_writeb(SAA7134_MONITOR_SELECT, 0xa0);
...@@ -519,7 +516,7 @@ static int tvaudio_thread(void *data) ...@@ -519,7 +516,7 @@ static int tvaudio_thread(void *data)
if (1 == nscan) { if (1 == nscan) {
/* only one candidate -- skip scan ;) */ /* only one candidate -- skip scan ;) */
dprintk("only one main carrier candidate - skipping scan\n"); audio_dbg(1, "only one main carrier candidate - skipping scan\n");
max1 = 12345; max1 = 12345;
carrier = default_carrier; carrier = default_carrier;
} else { } else {
...@@ -544,7 +541,7 @@ static int tvaudio_thread(void *data) ...@@ -544,7 +541,7 @@ static int tvaudio_thread(void *data)
if (0 != carrier && max1 > 2000 && max1 > max2*3) { if (0 != carrier && max1 > 2000 && max1 > max2*3) {
/* found good carrier */ /* found good carrier */
dprintk("found %s main sound carrier @ %d.%03d MHz [%d/%d]\n", audio_dbg(1, "found %s main sound carrier @ %d.%03d MHz [%d/%d]\n",
dev->tvnorm->name, carrier/1000, carrier%1000, dev->tvnorm->name, carrier/1000, carrier%1000,
max1, max2); max1, max2);
dev->last_carrier = carrier; dev->last_carrier = carrier;
...@@ -553,16 +550,14 @@ static int tvaudio_thread(void *data) ...@@ -553,16 +550,14 @@ static int tvaudio_thread(void *data)
} else if (0 != dev->last_carrier) { } else if (0 != dev->last_carrier) {
/* no carrier -- try last detected one as fallback */ /* no carrier -- try last detected one as fallback */
carrier = dev->last_carrier; carrier = dev->last_carrier;
dprintk("audio carrier scan failed, " audio_dbg(1, "audio carrier scan failed, using %d.%03d MHz [last detected]\n",
"using %d.%03d MHz [last detected]\n",
carrier/1000, carrier%1000); carrier/1000, carrier%1000);
dev->automute = 1; dev->automute = 1;
} else { } else {
/* no carrier + no fallback -- use default */ /* no carrier + no fallback -- use default */
carrier = default_carrier; carrier = default_carrier;
dprintk("audio carrier scan failed, " audio_dbg(1, "audio carrier scan failed, using %d.%03d MHz [default]\n",
"using %d.%03d MHz [default]\n",
carrier/1000, carrier%1000); carrier/1000, carrier%1000);
dev->automute = 1; dev->automute = 1;
} }
...@@ -661,7 +656,7 @@ static inline int saa_dsp_reset_error_bit(struct saa7134_dev *dev) ...@@ -661,7 +656,7 @@ static inline int saa_dsp_reset_error_bit(struct saa7134_dev *dev)
{ {
int state = saa_readb(SAA7135_DSP_RWSTATE); int state = saa_readb(SAA7135_DSP_RWSTATE);
if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) { if (unlikely(state & SAA7135_DSP_RWSTATE_ERR)) {
d2printk("%s: resetting error bit\n", dev->name); audio_dbg(2, "%s: resetting error bit\n", dev->name);
saa_writeb(SAA7135_DSP_RWCLEAR, SAA7135_DSP_RWCLEAR_RERR); saa_writeb(SAA7135_DSP_RWCLEAR, SAA7135_DSP_RWCLEAR_RERR);
} }
return 0; return 0;
...@@ -699,7 +694,7 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value) ...@@ -699,7 +694,7 @@ int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value)
{ {
int err; int err;
d2printk("dsp write reg 0x%x = 0x%06x\n",reg<<2,value); audio_dbg(2, "dsp write reg 0x%x = 0x%06x\n", reg << 2, value);
err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_WRR); err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_WRR);
if (err < 0) if (err < 0)
return err; return err;
...@@ -786,14 +781,16 @@ static int tvaudio_thread_ddep(void *data) ...@@ -786,14 +781,16 @@ static int tvaudio_thread_ddep(void *data)
try_to_freeze(); try_to_freeze();
dev->thread.scan1 = dev->thread.scan2; dev->thread.scan1 = dev->thread.scan2;
dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1); audio_dbg(1, "tvaudio thread scan start [%d]\n",
dev->thread.scan1);
if (audio_ddep >= 0x04 && audio_ddep <= 0x0e) { if (audio_ddep >= 0x04 && audio_ddep <= 0x0e) {
/* insmod option override */ /* insmod option override */
norms = (audio_ddep << 2) | 0x01; norms = (audio_ddep << 2) | 0x01;
dprintk("ddep override: %s\n",stdres[audio_ddep]); audio_dbg(1, "ddep override: %s\n",
stdres[audio_ddep]);
} else if (&card(dev).radio == dev->input) { } else if (&card(dev).radio == dev->input) {
dprintk("FM Radio\n"); audio_dbg(1, "FM Radio\n");
if (dev->tuner_type == TUNER_PHILIPS_TDA8290) { if (dev->tuner_type == TUNER_PHILIPS_TDA8290) {
norms = (0x11 << 2) | 0x01; norms = (0x11 << 2) | 0x01;
/* set IF frequency to 5.5 MHz */ /* set IF frequency to 5.5 MHz */
...@@ -816,7 +813,7 @@ static int tvaudio_thread_ddep(void *data) ...@@ -816,7 +813,7 @@ static int tvaudio_thread_ddep(void *data)
norms |= 0x10; norms |= 0x10;
if (0 == norms) if (0 == norms)
norms = 0x7c; /* all */ norms = 0x7c; /* all */
dprintk("scanning:%s%s%s%s%s\n", audio_dbg(1, "scanning:%s%s%s%s%s\n",
(norms & 0x04) ? " B/G" : "", (norms & 0x04) ? " B/G" : "",
(norms & 0x08) ? " D/K" : "", (norms & 0x08) ? " D/K" : "",
(norms & 0x10) ? " L/L'" : "", (norms & 0x10) ? " L/L'" : "",
...@@ -836,12 +833,11 @@ static int tvaudio_thread_ddep(void *data) ...@@ -836,12 +833,11 @@ static int tvaudio_thread_ddep(void *data)
goto restart; goto restart;
value = saa_readl(0x528 >> 2) & 0xffffff; value = saa_readl(0x528 >> 2) & 0xffffff;
dprintk("tvaudio thread status: 0x%x [%s%s%s]\n", audio_dbg(1, "tvaudio thread status: 0x%x [%s%s%s]\n",
value, stdres[value & 0x1f], value, stdres[value & 0x1f],
(value & 0x000020) ? ",stereo" : "", (value & 0x000020) ? ",stereo" : "",
(value & 0x000040) ? ",dual" : ""); (value & 0x000040) ? ",dual" : "");
dprintk("detailed status: " audio_dbg(1, "detailed status: %s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s\n",
"%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s#%s\n",
(value & 0x000080) ? " A2/EIAJ pilot tone " : "", (value & 0x000080) ? " A2/EIAJ pilot tone " : "",
(value & 0x000100) ? " A2/EIAJ dual " : "", (value & 0x000100) ? " A2/EIAJ dual " : "",
(value & 0x000200) ? " A2/EIAJ stereo " : "", (value & 0x000200) ? " A2/EIAJ stereo " : "",
...@@ -1061,7 +1057,7 @@ int saa7134_tvaudio_fini(struct saa7134_dev *dev) ...@@ -1061,7 +1057,7 @@ int saa7134_tvaudio_fini(struct saa7134_dev *dev)
int saa7134_tvaudio_do_scan(struct saa7134_dev *dev) int saa7134_tvaudio_do_scan(struct saa7134_dev *dev)
{ {
if (dev->input->amux != TV) { if (dev->input->amux != TV) {
dprintk("sound IF not in use, skipping scan\n"); audio_dbg(1, "sound IF not in use, skipping scan\n");
dev->automute = 0; dev->automute = 0;
saa7134_tvaudio_setmute(dev); saa7134_tvaudio_setmute(dev);
} else if (dev->thread.thread) { } else if (dev->thread.thread) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment