From: "istvan_v@mailbox.hu" <istvan_v@mailbox.hu>
To: linux-media@vger.kernel.org
Subject: XC4000: debug message improvements
Date: Sat, 04 Jun 2011 17:08:29 +0200 [thread overview]
Message-ID: <4DEA4A6D.8010607@mailbox.hu> (raw)
In-Reply-To: <BANLkTimEEGsMP6PDXf5W5p9wW7wdWEEOiA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
The following patch makes a few minor changes to the printing
of debug messages, and reporting the tuner status. The 'debug'
module parameter can now be set from 0 to 2 to control the
verbosity of debug messages.
Signed-off-by: Istvan Varga <istvan_v@mailbox.hu>
[-- Attachment #2: xc4000_debug.patch --]
[-- Type: text/x-patch, Size: 3811 bytes --]
diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c xc4000/drivers/media/common/tuners/xc4000.c
--- xc4000_orig/drivers/media/common/tuners/xc4000.c 2011-06-04 14:13:47.000000000 +0200
+++ xc4000/drivers/media/common/tuners/xc4000.c 2011-06-04 14:44:49.000000000 +0200
@@ -39,7 +39,7 @@
static int debug;
module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
+MODULE_PARM_DESC(debug, "\n\t\tDebugging level (0 to 2, default: 0 (off)).");
static int no_poweroff;
module_param(no_poweroff, int, 0644);
@@ -239,6 +239,7 @@
static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val);
static int xc4000_TunerReset(struct dvb_frontend *fe);
+static void xc_debug_dump(struct xc4000_priv *priv);
static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len)
{
@@ -515,6 +516,15 @@
found = 1;
}
+ /* Wait for stats to stabilize.
+ * Frame Lines needs two frame times after initial lock
+ * before it is valid.
+ */
+ xc_wait(debug ? 100 : 10);
+
+ if (debug)
+ xc_debug_dump(priv);
+
return found;
}
@@ -1085,12 +1095,6 @@
u8 hw_majorversion = 0, hw_minorversion = 0;
u8 fw_majorversion = 0, fw_minorversion = 0;
- /* Wait for stats to stabilize.
- * Frame Lines needs two frame times after initial lock
- * before it is valid.
- */
- xc_wait(100);
-
xc_get_ADC_Envelope(priv, &adc_envelope);
dprintk(1, "*** ADC envelope (0-1023) = %d\n", adc_envelope);
@@ -1103,16 +1107,18 @@
xc_get_version(priv, &hw_majorversion, &hw_minorversion,
&fw_majorversion, &fw_minorversion);
-
dprintk(1, "*** HW: V%02x.%02x, FW: V%02x.%02x\n",
hw_majorversion, hw_minorversion,
fw_majorversion, fw_minorversion);
- xc_get_hsync_freq(priv, &hsync_freq_hz);
- dprintk(1, "*** Horizontal sync frequency = %d Hz\n", hsync_freq_hz);
+ if (priv->video_standard < XC4000_DTV6) {
+ xc_get_hsync_freq(priv, &hsync_freq_hz);
+ dprintk(1, "*** Horizontal sync frequency = %d Hz\n",
+ hsync_freq_hz);
- xc_get_frame_lines(priv, &frame_lines);
- dprintk(1, "*** Frame lines = %d\n", frame_lines);
+ xc_get_frame_lines(priv, &frame_lines);
+ dprintk(1, "*** Frame lines = %d\n", frame_lines);
+ }
xc_get_quality(priv, &quality);
dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
@@ -1223,9 +1229,6 @@
}
xc_tune_channel(priv, priv->freq_hz, XC_TUNE_DIGITAL);
- if (debug)
- xc_debug_dump(priv);
-
ret = 0;
fail:
@@ -1320,9 +1323,6 @@
xc_tune_channel(priv, priv->freq_hz, XC_TUNE_ANALOG);
- if (debug)
- xc_debug_dump(priv);
-
ret = 0;
fail:
@@ -1334,8 +1334,26 @@
static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq)
{
struct xc4000_priv *priv = fe->tuner_priv;
- dprintk(1, "%s()\n", __func__);
+
*freq = priv->freq_hz;
+
+ if (debug) {
+ mutex_lock(&priv->lock);
+ if ((priv->cur_fw.type
+ & (BASE | FM | DTV6 | DTV7 | DTV78 | DTV8)) == BASE) {
+ u16 snr = 0;
+ if (xc4000_readreg(priv, XREG_SNR, &snr) == 0) {
+ mutex_unlock(&priv->lock);
+ dprintk(1, "%s() freq = %u, SNR = %d\n",
+ __func__, *freq, snr);
+ return 0;
+ }
+ }
+ mutex_unlock(&priv->lock);
+ }
+
+ dprintk(1, "%s()\n", __func__);
+
return 0;
}
@@ -1355,13 +1373,17 @@
mutex_lock(&priv->lock);
- xc_get_lock_status(priv, &lock_status);
+ if (priv->cur_fw.type & BASE)
+ xc_get_lock_status(priv, &lock_status);
- mutex_unlock(&priv->lock);
+ *status = (lock_status == 1 ?
+ TUNER_STATUS_LOCKED | TUNER_STATUS_STEREO : 0);
+ if (priv->cur_fw.type & (DTV6 | DTV7 | DTV78 | DTV8))
+ *status &= (~TUNER_STATUS_STEREO);
- dprintk(1, "%s() lock_status = 0x%08x\n", __func__, lock_status);
+ mutex_unlock(&priv->lock);
- *status = lock_status;
+ dprintk(2, "%s() lock_status = %d\n", __func__, lock_status);
return 0;
}
next prev parent reply other threads:[~2011-06-04 15:08 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 14:54 [linux-dvb] XC4000 patches for kernel 2.6.37.2 Mirek Slugeň
2011-05-31 2:48 ` Dmitri Belimov
2011-05-31 3:49 ` Devin Heitmueller
2011-05-31 7:43 ` Dmitri Belimov
2011-06-02 10:52 ` Devin Heitmueller
2011-06-02 14:41 ` Mauro Carvalho Chehab
2011-06-02 15:17 ` Devin Heitmueller
2011-06-02 16:35 ` Mauro Carvalho Chehab
2011-06-03 1:41 ` Dmitri Belimov
2011-06-03 12:12 ` Mauro Carvalho Chehab
2011-06-02 15:53 ` Mohammad Bahathir Hashim
2011-06-02 17:05 ` Mauro Carvalho Chehab
2011-06-03 3:54 ` Mohammad Bahathir Hashim
[not found] ` <4DE8D5AC.7060002@mailbox.hu>
2011-06-03 12:46 ` [linux-dvb] XC4000: added card_type Devin Heitmueller
[not found] ` <4DE8DEC6.6080008@mailbox.hu>
2011-06-03 14:00 ` Mauro Carvalho Chehab
2011-06-03 14:22 ` istvan_v
2011-06-03 13:17 ` Mauro Carvalho Chehab
2011-06-03 13:55 ` XC4000: updated standards table istvan_v
2011-06-03 15:17 ` XC4000: added support for 7 MHz DVB-T istvan_v
2011-06-03 15:23 ` XC4000: added mutex istvan_v
2011-06-03 15:27 ` XC4000: fixed frequency error istvan_v
2011-06-04 14:48 ` XC4000: added firmware_name parameter istvan_v
2011-06-04 14:52 ` XC4000: simplified seek_firmware() istvan_v
2011-06-04 14:56 ` XC4000: simplified load_scode istvan_v
2011-06-04 14:59 ` XC4000: check_firmware() cleanup istvan_v
2011-06-04 15:03 ` XC4000: implemented power management istvan_v
2011-06-04 15:04 ` XC4000: firmware initialization istvan_v
2011-06-04 15:08 ` istvan_v [this message]
2011-06-04 15:12 ` XC4000: setting registers istvan_v
2011-06-05 12:05 ` Mauro Carvalho Chehab
2011-06-05 12:28 ` Istvan Varga
2011-06-05 12:56 ` Mauro Carvalho Chehab
2011-06-05 14:30 ` Istvan Varga
2011-06-04 15:15 ` XC4000: added audio_std module parameter istvan_v
2011-06-04 15:17 ` XC4000: implemented analog TV and radio istvan_v
2011-06-04 15:18 ` XC4000: xc_tune_channel() cleanup istvan_v
2011-06-04 15:21 ` XC4000: removed redundant tuner reset istvan_v
2011-06-04 15:25 ` XC4000: detect XC4100 istvan_v
2011-06-02 4:58 ` [linux-dvb] XC4000 patches for kernel 2.6.37.2 Mohammad Bahathir Hashim
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=4DEA4A6D.8010607@mailbox.hu \
--to=istvan_v@mailbox.hu \
--cc=linux-media@vger.kernel.org \
/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