Skip to content

Commit 4a7c1ff

Browse files
committed
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (57 commits) [media] as3645a: Fix compilation by including slab.h [media] s5p-fimc: Remove linux/version.h include from fimc-mdevice.c [media] s5p-mfc: Remove linux/version.h include from s5p_mfc.c [media] ds3000: using logical && instead of bitwise & [media] v4l2-ctrls: make control names consistent [media] DVB: dib0700, add support for Nova-TD LEDs [media] DVB: dib0700, add corrected Nova-TD frontend_attach [media] DVB: dib0700, separate stk7070pd initialization [media] DVB: dib0700, move Nova-TD Stick to a separate set [media] : add MODULE_FIRMWARE to dib0700 [media] DVB-CORE: remove superfluous DTV_CMDs [media] s5p-jpeg: adapt to recent videobuf2 changes [media] s5p-g2d: fixed a bug in controls setting function [media] s5p-mfc: Fix volatile controls setup [media] drivers/media/video/s5p-mfc/s5p_mfc.c: adjust double test [media] drivers/media/video/s5p-fimc/fimc-capture.c: adjust double test [media] s5p-fimc: Fix incorrect control ID assignment [media] dvb_frontend: Don't call get_frontend() if idle [media] DocBook/dvbproperty.xml: Remove DTV_MODULATION from ISDB-T [media] DocBook/dvbproperty.xml: Fix ISDB-T delivery system parameters ...
2 parents 9278e63 + 36be126 commit 4a7c1ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+727
-679
lines changed

Documentation/DocBook/media/dvb/dvbproperty.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,16 @@ get/set up to 64 properties. The actual meaning of each property is described on
163163
<section id="DTV-FREQUENCY">
164164
<title><constant>DTV_FREQUENCY</constant></title>
165165

166-
<para>Central frequency of the channel, in HZ.</para>
166+
<para>Central frequency of the channel.</para>
167167

168168
<para>Notes:</para>
169-
<para>1)For ISDB-T, the channels are usually transmitted with an offset of 143kHz.
169+
<para>1)For satellital delivery systems, it is measured in kHz.
170+
For the other ones, it is measured in Hz.</para>
171+
<para>2)For ISDB-T, the channels are usually transmitted with an offset of 143kHz.
170172
E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of
171173
the channel which is 6MHz.</para>
172174

173-
<para>2)As in ISDB-Tsb the channel consists of only one or three segments the
175+
<para>3)As in ISDB-Tsb the channel consists of only one or three segments the
174176
frequency step is 429kHz, 3*429 respectively. As for ISDB-T the
175177
central frequency of the channel is expected.</para>
176178
</section>
@@ -735,14 +737,10 @@ typedef enum fe_hierarchy {
735737
<listitem><para><link linkend="DTV-TUNE"><constant>DTV_TUNE</constant></link></para></listitem>
736738
<listitem><para><link linkend="DTV-CLEAR"><constant>DTV_CLEAR</constant></link></para></listitem>
737739
<listitem><para><link linkend="DTV-FREQUENCY"><constant>DTV_FREQUENCY</constant></link></para></listitem>
738-
<listitem><para><link linkend="DTV-MODULATION"><constant>DTV_MODULATION</constant></link></para></listitem>
739740
<listitem><para><link linkend="DTV-BANDWIDTH-HZ"><constant>DTV_BANDWIDTH_HZ</constant></link></para></listitem>
740741
<listitem><para><link linkend="DTV-INVERSION"><constant>DTV_INVERSION</constant></link></para></listitem>
741-
<listitem><para><link linkend="DTV-CODE-RATE-HP"><constant>DTV_CODE_RATE_HP</constant></link></para></listitem>
742-
<listitem><para><link linkend="DTV-CODE-RATE-LP"><constant>DTV_CODE_RATE_LP</constant></link></para></listitem>
743742
<listitem><para><link linkend="DTV-GUARD-INTERVAL"><constant>DTV_GUARD_INTERVAL</constant></link></para></listitem>
744743
<listitem><para><link linkend="DTV-TRANSMISSION-MODE"><constant>DTV_TRANSMISSION_MODE</constant></link></para></listitem>
745-
<listitem><para><link linkend="DTV-HIERARCHY"><constant>DTV_HIERARCHY</constant></link></para></listitem>
746744
<listitem><para><link linkend="DTV-ISDBT-LAYER-ENABLED"><constant>DTV_ISDBT_LAYER_ENABLED</constant></link></para></listitem>
747745
<listitem><para><link linkend="DTV-ISDBT-PARTIAL-RECEPTION"><constant>DTV_ISDBT_PARTIAL_RECEPTION</constant></link></para></listitem>
748746
<listitem><para><link linkend="DTV-ISDBT-SOUND-BROADCASTING"><constant>DTV_ISDBT_SOUND_BROADCASTING</constant></link></para></listitem>

Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,12 @@ applications must set the array to zero.</entry>
183183
<entry>__u32</entry>
184184
<entry><structfield>ctrl_class</structfield></entry>
185185
<entry>The control class to which all controls belong, see
186-
<xref linkend="ctrl-class" />.</entry>
186+
<xref linkend="ctrl-class" />. Drivers that use a kernel framework for handling
187+
controls will also accept a value of 0 here, meaning that the controls can
188+
belong to any control class. Whether drivers support this can be tested by setting
189+
<structfield>ctrl_class</structfield> to 0 and calling <constant>VIDIOC_TRY_EXT_CTRLS</constant>
190+
with a <structfield>count</structfield> of 0. If that succeeds, then the driver
191+
supports this feature.</entry>
187192
</row>
188193
<row>
189194
<entry>__u32</entry>
@@ -194,10 +199,13 @@ also be zero.</entry>
194199
<row>
195200
<entry>__u32</entry>
196201
<entry><structfield>error_idx</structfield></entry>
197-
<entry>Set by the driver in case of an error. It is the
198-
index of the control causing the error or equal to 'count' when the
199-
error is not associated with a particular control. Undefined when the
200-
ioctl returns 0 (success).</entry>
202+
<entry>Set by the driver in case of an error. If it is equal
203+
to <structfield>count</structfield>, then no actual changes were made to
204+
controls. In other words, the error was not associated with setting a particular
205+
control. If it is another value, then only the controls up to <structfield>error_idx-1</structfield>
206+
were modified and control <structfield>error_idx</structfield> is the one that
207+
caused the error. The <structfield>error_idx</structfield> value is undefined
208+
if the ioctl returned 0 (success).</entry>
201209
</row>
202210
<row>
203211
<entry>__u32</entry>

Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,20 @@ capability and it is cleared otherwise.</entry>
364364
<row>
365365
<entry><constant>V4L2_FBUF_FLAG_OVERLAY</constant></entry>
366366
<entry>0x0002</entry>
367-
<entry>The frame buffer is an overlay surface the same
368-
size as the capture. [?]</entry>
369-
</row>
370-
<row>
371-
<entry spanname="hspan">The purpose of
372-
<constant>V4L2_FBUF_FLAG_OVERLAY</constant> was never quite clear.
373-
Most drivers seem to ignore this flag. For compatibility with the
374-
<wordasword>bttv</wordasword> driver applications should set the
375-
<constant>V4L2_FBUF_FLAG_OVERLAY</constant> flag.</entry>
367+
<entry>If this flag is set for a video capture device, then the
368+
driver will set the initial overlay size to cover the full framebuffer size,
369+
otherwise the existing overlay size (as set by &VIDIOC-S-FMT;) will be used.
370+
371+
Only one video capture driver (bttv) supports this flag. The use of this flag
372+
for capture devices is deprecated. There is no way to detect which drivers
373+
support this flag, so the only reliable method of setting the overlay size is
374+
through &VIDIOC-S-FMT;.
375+
376+
If this flag is set for a video output device, then the video output overlay
377+
window is relative to the top-left corner of the framebuffer and restricted
378+
to the size of the framebuffer. If it is cleared, then the video output
379+
overlay window is relative to the video output display.
380+
</entry>
376381
</row>
377382
<row>
378383
<entry><constant>V4L2_FBUF_FLAG_CHROMAKEY</constant></entry>

Documentation/DocBook/media/v4l/vidioc-g-frequency.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ the &v4l2-output; <structfield>modulator</structfield> field and the
9898
<entry>&v4l2-tuner-type;</entry>
9999
<entry><structfield>type</structfield></entry>
100100
<entry>The tuner type. This is the same value as in the
101-
&v4l2-tuner; <structfield>type</structfield> field. The field is not
102-
applicable to modulators, &ie; ignored by drivers.</entry>
101+
&v4l2-tuner; <structfield>type</structfield> field. The type must be set
102+
to <constant>V4L2_TUNER_RADIO</constant> for <filename>/dev/radioX</filename>
103+
device nodes, and to <constant>V4L2_TUNER_ANALOG_TV</constant>
104+
for all others. The field is not applicable to modulators, &ie; ignored
105+
by drivers.</entry>
103106
</row>
104107
<row>
105108
<entry>__u32</entry>

Documentation/DocBook/media/v4l/vidioc-g-input.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ desired input in an integer and call the
6161
<constant>VIDIOC_S_INPUT</constant> ioctl with a pointer to this
6262
integer. Side effects are possible. For example inputs may support
6363
different video standards, so the driver may implicitly switch the
64-
current standard. It is good practice to select an input before
65-
querying or negotiating any other parameters.</para>
64+
current standard. Because of these possible side effects applications
65+
must select an input before querying or negotiating any other parameters.</para>
6666

6767
<para>Information about video inputs is available using the
6868
&VIDIOC-ENUMINPUT; ioctl.</para>

Documentation/DocBook/media/v4l/vidioc-g-output.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ desired output in an integer and call the
6161
<constant>VIDIOC_S_OUTPUT</constant> ioctl with a pointer to this integer.
6262
Side effects are possible. For example outputs may support different
6363
video standards, so the driver may implicitly switch the current
64-
standard. It is good practice to select an output before querying or
65-
negotiating any other parameters.</para>
64+
standard.
65+
standard. Because of these possible side effects applications
66+
must select an output before querying or negotiating any other parameters.</para>
6667

6768
<para>Information about video outputs is available using the
6869
&VIDIOC-ENUMOUTPUT; ioctl.</para>

Documentation/feature-removal-schedule.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -439,17 +439,6 @@ Who: Jean Delvare <khali@linux-fr.org>
439439

440440
----------------------------
441441

442-
What: For VIDIOC_S_FREQUENCY the type field must match the device node's type.
443-
If not, return -EINVAL.
444-
When: 3.2
445-
Why: It makes no sense to switch the tuner to radio mode by calling
446-
VIDIOC_S_FREQUENCY on a video node, or to switch the tuner to tv mode by
447-
calling VIDIOC_S_FREQUENCY on a radio node. This is the first step of a
448-
move to more consistent handling of tv and radio tuners.
449-
Who: Hans Verkuil <hans.verkuil@cisco.com>
450-
451-
----------------------------
452-
453442
What: Opening a radio device node will no longer automatically switch the
454443
tuner mode from tv to radio.
455444
When: 3.3

Documentation/video4linux/v4l2-controls.txt

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -666,27 +666,6 @@ a control of this type whenever the first control belonging to a new control
666666
class is added.
667667

668668

669-
Differences from the Spec
670-
=========================
671-
672-
There are a few places where the framework acts slightly differently from the
673-
V4L2 Specification. Those differences are described in this section. We will
674-
have to see whether we need to adjust the spec or not.
675-
676-
1) It is no longer required to have all controls contained in a
677-
v4l2_ext_control array be from the same control class. The framework will be
678-
able to handle any type of control in the array. You need to set ctrl_class
679-
to 0 in order to enable this. If ctrl_class is non-zero, then it will still
680-
check that all controls belong to that control class.
681-
682-
If you set ctrl_class to 0 and count to 0, then it will only return an error
683-
if there are no controls at all.
684-
685-
2) Clarified the way error_idx works. For get and set it will be equal to
686-
count if nothing was done yet. If it is less than count then only the controls
687-
up to error_idx-1 were successfully applied.
688-
689-
690669
Proposals for Extensions
691670
========================
692671

drivers/media/common/tuners/tuner-xc2028.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@
2424
#include <linux/dvb/frontend.h>
2525
#include "dvb_frontend.h"
2626

27+
/* Registers (Write-only) */
28+
#define XREG_INIT 0x00
29+
#define XREG_RF_FREQ 0x02
30+
#define XREG_POWER_DOWN 0x08
31+
32+
/* Registers (Read-only) */
33+
#define XREG_FREQ_ERROR 0x01
34+
#define XREG_LOCK 0x02
35+
#define XREG_VERSION 0x04
36+
#define XREG_PRODUCT_ID 0x08
37+
#define XREG_HSYNC_FREQ 0x10
38+
#define XREG_FRAME_LINES 0x20
39+
#define XREG_SNR 0x40
40+
41+
#define XREG_ADC_ENV 0x0100
2742

2843
static int debug;
2944
module_param(debug, int, 0644);
@@ -885,7 +900,7 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)
885900
mutex_lock(&priv->lock);
886901

887902
/* Sync Lock Indicator */
888-
rc = xc2028_get_reg(priv, 0x0002, &frq_lock);
903+
rc = xc2028_get_reg(priv, XREG_LOCK, &frq_lock);
889904
if (rc < 0)
890905
goto ret;
891906

@@ -894,7 +909,7 @@ static int xc2028_signal(struct dvb_frontend *fe, u16 *strength)
894909
signal = 1 << 11;
895910

896911
/* Get SNR of the video signal */
897-
rc = xc2028_get_reg(priv, 0x0040, &signal);
912+
rc = xc2028_get_reg(priv, XREG_SNR, &signal);
898913
if (rc < 0)
899914
goto ret;
900915

@@ -1019,9 +1034,9 @@ static int generic_set_freq(struct dvb_frontend *fe, u32 freq /* in HZ */,
10191034

10201035
/* CMD= Set frequency */
10211036
if (priv->firm_version < 0x0202)
1022-
rc = send_seq(priv, {0x00, 0x02, 0x00, 0x00});
1037+
rc = send_seq(priv, {0x00, XREG_RF_FREQ, 0x00, 0x00});
10231038
else
1024-
rc = send_seq(priv, {0x80, 0x02, 0x00, 0x00});
1039+
rc = send_seq(priv, {0x80, XREG_RF_FREQ, 0x00, 0x00});
10251040
if (rc < 0)
10261041
goto ret;
10271042

@@ -1201,9 +1216,9 @@ static int xc2028_sleep(struct dvb_frontend *fe)
12011216
mutex_lock(&priv->lock);
12021217

12031218
if (priv->firm_version < 0x0202)
1204-
rc = send_seq(priv, {0x00, 0x08, 0x00, 0x00});
1219+
rc = send_seq(priv, {0x00, XREG_POWER_DOWN, 0x00, 0x00});
12051220
else
1206-
rc = send_seq(priv, {0x80, 0x08, 0x00, 0x00});
1221+
rc = send_seq(priv, {0x80, XREG_POWER_DOWN, 0x00, 0x00});
12071222

12081223
priv->cur_fw.type = 0; /* need firmware reload */
12091224

drivers/media/common/tuners/xc4000.c

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ struct xc4000_priv {
154154
#define XREG_SNR 0x06
155155
#define XREG_VERSION 0x07
156156
#define XREG_PRODUCT_ID 0x08
157+
#define XREG_SIGNAL_LEVEL 0x0A
158+
#define XREG_NOISE_LEVEL 0x0B
157159

158160
/*
159161
Basic firmware description. This will remain with
@@ -486,6 +488,16 @@ static int xc_get_quality(struct xc4000_priv *priv, u16 *quality)
486488
return xc4000_readreg(priv, XREG_QUALITY, quality);
487489
}
488490

491+
static int xc_get_signal_level(struct xc4000_priv *priv, u16 *signal)
492+
{
493+
return xc4000_readreg(priv, XREG_SIGNAL_LEVEL, signal);
494+
}
495+
496+
static int xc_get_noise_level(struct xc4000_priv *priv, u16 *noise)
497+
{
498+
return xc4000_readreg(priv, XREG_NOISE_LEVEL, noise);
499+
}
500+
489501
static u16 xc_wait_for_lock(struct xc4000_priv *priv)
490502
{
491503
u16 lock_state = 0;
@@ -1089,6 +1101,8 @@ static void xc_debug_dump(struct xc4000_priv *priv)
10891101
u32 hsync_freq_hz = 0;
10901102
u16 frame_lines;
10911103
u16 quality;
1104+
u16 signal = 0;
1105+
u16 noise = 0;
10921106
u8 hw_majorversion = 0, hw_minorversion = 0;
10931107
u8 fw_majorversion = 0, fw_minorversion = 0;
10941108

@@ -1119,6 +1133,12 @@ static void xc_debug_dump(struct xc4000_priv *priv)
11191133

11201134
xc_get_quality(priv, &quality);
11211135
dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality);
1136+
1137+
xc_get_signal_level(priv, &signal);
1138+
dprintk(1, "*** Signal level = -%ddB (%d)\n", signal >> 8, signal);
1139+
1140+
xc_get_noise_level(priv, &noise);
1141+
dprintk(1, "*** Noise level = %ddB (%d)\n", noise >> 8, noise);
11221142
}
11231143

11241144
static int xc4000_set_params(struct dvb_frontend *fe)
@@ -1432,6 +1452,71 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe,
14321452
return ret;
14331453
}
14341454

1455+
static int xc4000_get_signal(struct dvb_frontend *fe, u16 *strength)
1456+
{
1457+
struct xc4000_priv *priv = fe->tuner_priv;
1458+
u16 value = 0;
1459+
int rc;
1460+
1461+
mutex_lock(&priv->lock);
1462+
rc = xc4000_readreg(priv, XREG_SIGNAL_LEVEL, &value);
1463+
mutex_unlock(&priv->lock);
1464+
1465+
if (rc < 0)
1466+
goto ret;
1467+
1468+
/* Informations from real testing of DVB-T and radio part,
1469+
coeficient for one dB is 0xff.
1470+
*/
1471+
tuner_dbg("Signal strength: -%ddB (%05d)\n", value >> 8, value);
1472+
1473+
/* all known digital modes */
1474+
if ((priv->video_standard == XC4000_DTV6) ||
1475+
(priv->video_standard == XC4000_DTV7) ||
1476+
(priv->video_standard == XC4000_DTV7_8) ||
1477+
(priv->video_standard == XC4000_DTV8))
1478+
goto digital;
1479+
1480+
/* Analog mode has NOISE LEVEL important, signal
1481+
depends only on gain of antenna and amplifiers,
1482+
but it doesn't tell anything about real quality
1483+
of reception.
1484+
*/
1485+
mutex_lock(&priv->lock);
1486+
rc = xc4000_readreg(priv, XREG_NOISE_LEVEL, &value);
1487+
mutex_unlock(&priv->lock);
1488+
1489+
tuner_dbg("Noise level: %ddB (%05d)\n", value >> 8, value);
1490+
1491+
/* highest noise level: 32dB */
1492+
if (value >= 0x2000) {
1493+
value = 0;
1494+
} else {
1495+
value = ~value << 3;
1496+
}
1497+
1498+
goto ret;
1499+
1500+
/* Digital mode has SIGNAL LEVEL important and real
1501+
noise level is stored in demodulator registers.
1502+
*/
1503+
digital:
1504+
/* best signal: -50dB */
1505+
if (value <= 0x3200) {
1506+
value = 0xffff;
1507+
/* minimum: -114dB - should be 0x7200 but real zero is 0x713A */
1508+
} else if (value >= 0x713A) {
1509+
value = 0;
1510+
} else {
1511+
value = ~(value - 0x3200) << 2;
1512+
}
1513+
1514+
ret:
1515+
*strength = value;
1516+
1517+
return rc;
1518+
}
1519+
14351520
static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq)
14361521
{
14371522
struct xc4000_priv *priv = fe->tuner_priv;
@@ -1559,6 +1644,7 @@ static const struct dvb_tuner_ops xc4000_tuner_ops = {
15591644
.set_params = xc4000_set_params,
15601645
.set_analog_params = xc4000_set_analog_params,
15611646
.get_frequency = xc4000_get_frequency,
1647+
.get_rf_strength = xc4000_get_signal,
15621648
.get_bandwidth = xc4000_get_bandwidth,
15631649
.get_status = xc4000_get_status
15641650
};

0 commit comments

Comments
 (0)