Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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
...

+729 -681
+5 -7
Documentation/DocBook/media/dvb/dvbproperty.xml
··· 163 163 <section id="DTV-FREQUENCY"> 164 164 <title><constant>DTV_FREQUENCY</constant></title> 165 165 166 - <para>Central frequency of the channel, in HZ.</para> 166 + <para>Central frequency of the channel.</para> 167 167 168 168 <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. 170 172 E.g. a valid frequncy could be 474143 kHz. The stepping is bound to the bandwidth of 171 173 the channel which is 6MHz.</para> 172 174 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 174 176 frequency step is 429kHz, 3*429 respectively. As for ISDB-T the 175 177 central frequency of the channel is expected.</para> 176 178 </section> ··· 737 735 <listitem><para><link linkend="DTV-TUNE"><constant>DTV_TUNE</constant></link></para></listitem> 738 736 <listitem><para><link linkend="DTV-CLEAR"><constant>DTV_CLEAR</constant></link></para></listitem> 739 737 <listitem><para><link linkend="DTV-FREQUENCY"><constant>DTV_FREQUENCY</constant></link></para></listitem> 740 - <listitem><para><link linkend="DTV-MODULATION"><constant>DTV_MODULATION</constant></link></para></listitem> 741 738 <listitem><para><link linkend="DTV-BANDWIDTH-HZ"><constant>DTV_BANDWIDTH_HZ</constant></link></para></listitem> 742 739 <listitem><para><link linkend="DTV-INVERSION"><constant>DTV_INVERSION</constant></link></para></listitem> 743 - <listitem><para><link linkend="DTV-CODE-RATE-HP"><constant>DTV_CODE_RATE_HP</constant></link></para></listitem> 744 - <listitem><para><link linkend="DTV-CODE-RATE-LP"><constant>DTV_CODE_RATE_LP</constant></link></para></listitem> 745 740 <listitem><para><link linkend="DTV-GUARD-INTERVAL"><constant>DTV_GUARD_INTERVAL</constant></link></para></listitem> 746 741 <listitem><para><link linkend="DTV-TRANSMISSION-MODE"><constant>DTV_TRANSMISSION_MODE</constant></link></para></listitem> 747 - <listitem><para><link linkend="DTV-HIERARCHY"><constant>DTV_HIERARCHY</constant></link></para></listitem> 748 742 <listitem><para><link linkend="DTV-ISDBT-LAYER-ENABLED"><constant>DTV_ISDBT_LAYER_ENABLED</constant></link></para></listitem> 749 743 <listitem><para><link linkend="DTV-ISDBT-PARTIAL-RECEPTION"><constant>DTV_ISDBT_PARTIAL_RECEPTION</constant></link></para></listitem> 750 744 <listitem><para><link linkend="DTV-ISDBT-SOUND-BROADCASTING"><constant>DTV_ISDBT_SOUND_BROADCASTING</constant></link></para></listitem>
+13 -5
Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
··· 183 183 <entry>__u32</entry> 184 184 <entry><structfield>ctrl_class</structfield></entry> 185 185 <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> 187 192 </row> 188 193 <row> 189 194 <entry>__u32</entry> ··· 199 194 <row> 200 195 <entry>__u32</entry> 201 196 <entry><structfield>error_idx</structfield></entry> 202 - <entry>Set by the driver in case of an error. It is the 203 - index of the control causing the error or equal to 'count' when the 204 - error is not associated with a particular control. Undefined when the 205 - ioctl returns 0 (success).</entry> 197 + <entry>Set by the driver in case of an error. If it is equal 198 + to <structfield>count</structfield>, then no actual changes were made to 199 + controls. In other words, the error was not associated with setting a particular 200 + control. If it is another value, then only the controls up to <structfield>error_idx-1</structfield> 201 + were modified and control <structfield>error_idx</structfield> is the one that 202 + caused the error. The <structfield>error_idx</structfield> value is undefined 203 + if the ioctl returned 0 (success).</entry> 206 204 </row> 207 205 <row> 208 206 <entry>__u32</entry>
+14 -9
Documentation/DocBook/media/v4l/vidioc-g-fbuf.xml
··· 364 364 <row> 365 365 <entry><constant>V4L2_FBUF_FLAG_OVERLAY</constant></entry> 366 366 <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> 376 381 </row> 377 382 <row> 378 383 <entry><constant>V4L2_FBUF_FLAG_CHROMAKEY</constant></entry>
+5 -2
Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
··· 98 98 <entry>&v4l2-tuner-type;</entry> 99 99 <entry><structfield>type</structfield></entry> 100 100 <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> 103 106 </row> 104 107 <row> 105 108 <entry>__u32</entry>
+2 -2
Documentation/DocBook/media/v4l/vidioc-g-input.xml
··· 61 61 <constant>VIDIOC_S_INPUT</constant> ioctl with a pointer to this 62 62 integer. Side effects are possible. For example inputs may support 63 63 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> 66 66 67 67 <para>Information about video inputs is available using the 68 68 &VIDIOC-ENUMINPUT; ioctl.</para>
+3 -2
Documentation/DocBook/media/v4l/vidioc-g-output.xml
··· 61 61 <constant>VIDIOC_S_OUTPUT</constant> ioctl with a pointer to this integer. 62 62 Side effects are possible. For example outputs may support different 63 63 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> 66 67 67 68 <para>Information about video outputs is available using the 68 69 &VIDIOC-ENUMOUTPUT; ioctl.</para>
-11
Documentation/feature-removal-schedule.txt
··· 439 439 440 440 ---------------------------- 441 441 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 - 453 442 What: Opening a radio device node will no longer automatically switch the 454 443 tuner mode from tv to radio. 455 444 When: 3.3
-21
Documentation/video4linux/v4l2-controls.txt
··· 666 666 class is added. 667 667 668 668 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 - 690 669 Proposals for Extensions 691 670 ======================== 692 671
+21 -6
drivers/media/common/tuners/tuner-xc2028.c
··· 24 24 #include <linux/dvb/frontend.h> 25 25 #include "dvb_frontend.h" 26 26 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 27 42 28 43 static int debug; 29 44 module_param(debug, int, 0644); ··· 900 885 mutex_lock(&priv->lock); 901 886 902 887 /* Sync Lock Indicator */ 903 - rc = xc2028_get_reg(priv, 0x0002, &frq_lock); 888 + rc = xc2028_get_reg(priv, XREG_LOCK, &frq_lock); 904 889 if (rc < 0) 905 890 goto ret; 906 891 ··· 909 894 signal = 1 << 11; 910 895 911 896 /* Get SNR of the video signal */ 912 - rc = xc2028_get_reg(priv, 0x0040, &signal); 897 + rc = xc2028_get_reg(priv, XREG_SNR, &signal); 913 898 if (rc < 0) 914 899 goto ret; 915 900 ··· 1034 1019 1035 1020 /* CMD= Set frequency */ 1036 1021 if (priv->firm_version < 0x0202) 1037 - rc = send_seq(priv, {0x00, 0x02, 0x00, 0x00}); 1022 + rc = send_seq(priv, {0x00, XREG_RF_FREQ, 0x00, 0x00}); 1038 1023 else 1039 - rc = send_seq(priv, {0x80, 0x02, 0x00, 0x00}); 1024 + rc = send_seq(priv, {0x80, XREG_RF_FREQ, 0x00, 0x00}); 1040 1025 if (rc < 0) 1041 1026 goto ret; 1042 1027 ··· 1216 1201 mutex_lock(&priv->lock); 1217 1202 1218 1203 if (priv->firm_version < 0x0202) 1219 - rc = send_seq(priv, {0x00, 0x08, 0x00, 0x00}); 1204 + rc = send_seq(priv, {0x00, XREG_POWER_DOWN, 0x00, 0x00}); 1220 1205 else 1221 - rc = send_seq(priv, {0x80, 0x08, 0x00, 0x00}); 1206 + rc = send_seq(priv, {0x80, XREG_POWER_DOWN, 0x00, 0x00}); 1222 1207 1223 1208 priv->cur_fw.type = 0; /* need firmware reload */ 1224 1209
+86
drivers/media/common/tuners/xc4000.c
··· 154 154 #define XREG_SNR 0x06 155 155 #define XREG_VERSION 0x07 156 156 #define XREG_PRODUCT_ID 0x08 157 + #define XREG_SIGNAL_LEVEL 0x0A 158 + #define XREG_NOISE_LEVEL 0x0B 157 159 158 160 /* 159 161 Basic firmware description. This will remain with ··· 486 484 static int xc_get_quality(struct xc4000_priv *priv, u16 *quality) 487 485 { 488 486 return xc4000_readreg(priv, XREG_QUALITY, quality); 487 + } 488 + 489 + static int xc_get_signal_level(struct xc4000_priv *priv, u16 *signal) 490 + { 491 + return xc4000_readreg(priv, XREG_SIGNAL_LEVEL, signal); 492 + } 493 + 494 + static int xc_get_noise_level(struct xc4000_priv *priv, u16 *noise) 495 + { 496 + return xc4000_readreg(priv, XREG_NOISE_LEVEL, noise); 489 497 } 490 498 491 499 static u16 xc_wait_for_lock(struct xc4000_priv *priv) ··· 1101 1089 u32 hsync_freq_hz = 0; 1102 1090 u16 frame_lines; 1103 1091 u16 quality; 1092 + u16 signal = 0; 1093 + u16 noise = 0; 1104 1094 u8 hw_majorversion = 0, hw_minorversion = 0; 1105 1095 u8 fw_majorversion = 0, fw_minorversion = 0; 1106 1096 ··· 1133 1119 1134 1120 xc_get_quality(priv, &quality); 1135 1121 dprintk(1, "*** Quality (0:<8dB, 7:>56dB) = %d\n", quality); 1122 + 1123 + xc_get_signal_level(priv, &signal); 1124 + dprintk(1, "*** Signal level = -%ddB (%d)\n", signal >> 8, signal); 1125 + 1126 + xc_get_noise_level(priv, &noise); 1127 + dprintk(1, "*** Noise level = %ddB (%d)\n", noise >> 8, noise); 1136 1128 } 1137 1129 1138 1130 static int xc4000_set_params(struct dvb_frontend *fe) ··· 1452 1432 return ret; 1453 1433 } 1454 1434 1435 + static int xc4000_get_signal(struct dvb_frontend *fe, u16 *strength) 1436 + { 1437 + struct xc4000_priv *priv = fe->tuner_priv; 1438 + u16 value = 0; 1439 + int rc; 1440 + 1441 + mutex_lock(&priv->lock); 1442 + rc = xc4000_readreg(priv, XREG_SIGNAL_LEVEL, &value); 1443 + mutex_unlock(&priv->lock); 1444 + 1445 + if (rc < 0) 1446 + goto ret; 1447 + 1448 + /* Informations from real testing of DVB-T and radio part, 1449 + coeficient for one dB is 0xff. 1450 + */ 1451 + tuner_dbg("Signal strength: -%ddB (%05d)\n", value >> 8, value); 1452 + 1453 + /* all known digital modes */ 1454 + if ((priv->video_standard == XC4000_DTV6) || 1455 + (priv->video_standard == XC4000_DTV7) || 1456 + (priv->video_standard == XC4000_DTV7_8) || 1457 + (priv->video_standard == XC4000_DTV8)) 1458 + goto digital; 1459 + 1460 + /* Analog mode has NOISE LEVEL important, signal 1461 + depends only on gain of antenna and amplifiers, 1462 + but it doesn't tell anything about real quality 1463 + of reception. 1464 + */ 1465 + mutex_lock(&priv->lock); 1466 + rc = xc4000_readreg(priv, XREG_NOISE_LEVEL, &value); 1467 + mutex_unlock(&priv->lock); 1468 + 1469 + tuner_dbg("Noise level: %ddB (%05d)\n", value >> 8, value); 1470 + 1471 + /* highest noise level: 32dB */ 1472 + if (value >= 0x2000) { 1473 + value = 0; 1474 + } else { 1475 + value = ~value << 3; 1476 + } 1477 + 1478 + goto ret; 1479 + 1480 + /* Digital mode has SIGNAL LEVEL important and real 1481 + noise level is stored in demodulator registers. 1482 + */ 1483 + digital: 1484 + /* best signal: -50dB */ 1485 + if (value <= 0x3200) { 1486 + value = 0xffff; 1487 + /* minimum: -114dB - should be 0x7200 but real zero is 0x713A */ 1488 + } else if (value >= 0x713A) { 1489 + value = 0; 1490 + } else { 1491 + value = ~(value - 0x3200) << 2; 1492 + } 1493 + 1494 + ret: 1495 + *strength = value; 1496 + 1497 + return rc; 1498 + } 1499 + 1455 1500 static int xc4000_get_frequency(struct dvb_frontend *fe, u32 *freq) 1456 1501 { 1457 1502 struct xc4000_priv *priv = fe->tuner_priv; ··· 1644 1559 .set_params = xc4000_set_params, 1645 1560 .set_analog_params = xc4000_set_analog_params, 1646 1561 .get_frequency = xc4000_get_frequency, 1562 + .get_rf_strength = xc4000_get_signal, 1647 1563 .get_bandwidth = xc4000_get_bandwidth, 1648 1564 .get_status = xc4000_get_status 1649 1565 };
+20 -21
drivers/media/dvb/dvb-core/dvb_frontend.c
··· 904 904 { 905 905 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 906 906 int i; 907 + u32 delsys; 907 908 909 + delsys = c->delivery_system; 908 910 memset(c, 0, sizeof(struct dtv_frontend_properties)); 911 + c->delivery_system = delsys; 909 912 910 913 c->state = DTV_CLEAR; 911 914 ··· 1011 1008 _DTV_CMD(DTV_ISDBT_LAYERC_MODULATION, 1, 0), 1012 1009 _DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 1, 0), 1013 1010 _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 1, 0), 1014 - 1015 - _DTV_CMD(DTV_ISDBT_PARTIAL_RECEPTION, 0, 0), 1016 - _DTV_CMD(DTV_ISDBT_SOUND_BROADCASTING, 0, 0), 1017 - _DTV_CMD(DTV_ISDBT_SB_SUBCHANNEL_ID, 0, 0), 1018 - _DTV_CMD(DTV_ISDBT_SB_SEGMENT_IDX, 0, 0), 1019 - _DTV_CMD(DTV_ISDBT_SB_SEGMENT_COUNT, 0, 0), 1020 - _DTV_CMD(DTV_ISDBT_LAYER_ENABLED, 0, 0), 1021 - _DTV_CMD(DTV_ISDBT_LAYERA_FEC, 0, 0), 1022 - _DTV_CMD(DTV_ISDBT_LAYERA_MODULATION, 0, 0), 1023 - _DTV_CMD(DTV_ISDBT_LAYERA_SEGMENT_COUNT, 0, 0), 1024 - _DTV_CMD(DTV_ISDBT_LAYERA_TIME_INTERLEAVING, 0, 0), 1025 - _DTV_CMD(DTV_ISDBT_LAYERB_FEC, 0, 0), 1026 - _DTV_CMD(DTV_ISDBT_LAYERB_MODULATION, 0, 0), 1027 - _DTV_CMD(DTV_ISDBT_LAYERB_SEGMENT_COUNT, 0, 0), 1028 - _DTV_CMD(DTV_ISDBT_LAYERB_TIME_INTERLEAVING, 0, 0), 1029 - _DTV_CMD(DTV_ISDBT_LAYERC_FEC, 0, 0), 1030 - _DTV_CMD(DTV_ISDBT_LAYERC_MODULATION, 0, 0), 1031 - _DTV_CMD(DTV_ISDBT_LAYERC_SEGMENT_COUNT, 0, 0), 1032 - _DTV_CMD(DTV_ISDBT_LAYERC_TIME_INTERLEAVING, 0, 0), 1033 1011 1034 1012 _DTV_CMD(DTV_ISDBS_TS_ID, 1, 0), 1035 1013 _DTV_CMD(DTV_DVBT2_PLP_ID, 1, 0), ··· 1397 1413 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1398 1414 enum dvbv3_emulation_type type; 1399 1415 1416 + /* 1417 + * It was reported that some old DVBv5 applications were 1418 + * filling delivery_system with SYS_UNDEFINED. If this happens, 1419 + * assume that the application wants to use the first supported 1420 + * delivery system. 1421 + */ 1422 + if (c->delivery_system == SYS_UNDEFINED) 1423 + c->delivery_system = fe->ops.delsys[0]; 1424 + 1400 1425 if (desired_system == SYS_UNDEFINED) { 1401 1426 /* 1402 1427 * A DVBv3 call doesn't know what's the desired system. ··· 1725 1732 { 1726 1733 struct dvb_device *dvbdev = file->private_data; 1727 1734 struct dvb_frontend *fe = dvbdev->priv; 1735 + struct dvb_frontend_private *fepriv = fe->frontend_priv; 1728 1736 struct dtv_frontend_properties *c = &fe->dtv_property_cache; 1729 1737 int err = 0; 1730 1738 ··· 1792 1798 1793 1799 /* 1794 1800 * Fills the cache out struct with the cache contents, plus 1795 - * the data retrieved from get_frontend. 1801 + * the data retrieved from get_frontend, if the frontend 1802 + * is not idle. Otherwise, returns the cached content 1796 1803 */ 1797 - dtv_get_frontend(fe, NULL); 1804 + if (fepriv->state != FESTATE_IDLE) { 1805 + err = dtv_get_frontend(fe, NULL); 1806 + if (err < 0) 1807 + goto out; 1808 + } 1798 1809 for (i = 0; i < tvps->num; i++) { 1799 1810 err = dtv_property_process_get(fe, c, tvp + i, file); 1800 1811 if (err < 0)
+7 -13
drivers/media/dvb/dvb-usb/anysee.c
··· 877 877 case ANYSEE_HW_508T2C: /* 20 */ 878 878 /* E7 T2C */ 879 879 880 + if (state->fe_id) 881 + break; 882 + 880 883 /* enable DVB-T/T2/C demod on IOE[5] */ 881 884 ret = anysee_wr_reg_mask(adap->dev, REG_IOE, (1 << 5), 0x20); 882 885 if (ret) 883 886 goto error; 884 887 885 - if (state->fe_id == 0) { 886 - /* DVB-T/T2 */ 887 - adap->fe_adap[state->fe_id].fe = 888 - dvb_attach(cxd2820r_attach, 889 - &anysee_cxd2820r_config, 890 - &adap->dev->i2c_adap, NULL); 891 - } else { 892 - /* DVB-C */ 893 - adap->fe_adap[state->fe_id].fe = 894 - dvb_attach(cxd2820r_attach, 895 - &anysee_cxd2820r_config, 896 - &adap->dev->i2c_adap, adap->fe_adap[0].fe); 897 - } 888 + /* attach demod */ 889 + adap->fe_adap[state->fe_id].fe = dvb_attach(cxd2820r_attach, 890 + &anysee_cxd2820r_config, &adap->dev->i2c_adap, 891 + NULL); 898 892 899 893 state->has_ci = true; 900 894
+2
drivers/media/dvb/dvb-usb/dib0700.h
··· 48 48 u8 disable_streaming_master_mode; 49 49 u32 fw_version; 50 50 u32 nb_packet_buffer_size; 51 + int (*read_status)(struct dvb_frontend *, fe_status_t *); 52 + int (*sleep)(struct dvb_frontend* fe); 51 53 u8 buf[255]; 52 54 }; 53 55
+1
drivers/media/dvb/dvb-usb/dib0700_core.c
··· 834 834 835 835 module_usb_driver(dib0700_driver); 836 836 837 + MODULE_FIRMWARE("dvb-usb-dib0700-1.20.fw"); 837 838 MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>"); 838 839 MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge"); 839 840 MODULE_VERSION("1.0");
+139 -15
drivers/media/dvb/dvb-usb/dib0700_devices.c
··· 3066 3066 } 3067 3067 }; 3068 3068 3069 + static void stk7070pd_init(struct dvb_usb_device *dev) 3070 + { 3071 + dib0700_set_gpio(dev, GPIO6, GPIO_OUT, 1); 3072 + msleep(10); 3073 + dib0700_set_gpio(dev, GPIO9, GPIO_OUT, 1); 3074 + dib0700_set_gpio(dev, GPIO4, GPIO_OUT, 1); 3075 + dib0700_set_gpio(dev, GPIO7, GPIO_OUT, 1); 3076 + dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 0); 3077 + 3078 + dib0700_ctrl_clock(dev, 72, 1); 3079 + 3080 + msleep(10); 3081 + dib0700_set_gpio(dev, GPIO10, GPIO_OUT, 1); 3082 + } 3083 + 3069 3084 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) 3070 3085 { 3071 - dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); 3072 - msleep(10); 3073 - dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); 3074 - dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); 3075 - dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); 3076 - dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); 3086 + stk7070pd_init(adap->dev); 3077 3087 3078 - dib0700_ctrl_clock(adap->dev, 72, 1); 3079 - 3080 - msleep(10); 3081 - dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); 3082 3088 msleep(10); 3083 3089 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); 3084 3090 ··· 3103 3097 { 3104 3098 adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]); 3105 3099 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; 3100 + } 3101 + 3102 + static int novatd_read_status_override(struct dvb_frontend *fe, 3103 + fe_status_t *stat) 3104 + { 3105 + struct dvb_usb_adapter *adap = fe->dvb->priv; 3106 + struct dvb_usb_device *dev = adap->dev; 3107 + struct dib0700_state *state = dev->priv; 3108 + int ret; 3109 + 3110 + ret = state->read_status(fe, stat); 3111 + 3112 + if (!ret) 3113 + dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 3114 + !!(*stat & FE_HAS_LOCK)); 3115 + 3116 + return ret; 3117 + } 3118 + 3119 + static int novatd_sleep_override(struct dvb_frontend* fe) 3120 + { 3121 + struct dvb_usb_adapter *adap = fe->dvb->priv; 3122 + struct dvb_usb_device *dev = adap->dev; 3123 + struct dib0700_state *state = dev->priv; 3124 + 3125 + /* turn off LED */ 3126 + dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0); 3127 + 3128 + return state->sleep(fe); 3129 + } 3130 + 3131 + /** 3132 + * novatd_frontend_attach - Nova-TD specific attach 3133 + * 3134 + * Nova-TD has GPIO0, 1 and 2 for LEDs. So do not fiddle with them except for 3135 + * information purposes. 3136 + */ 3137 + static int novatd_frontend_attach(struct dvb_usb_adapter *adap) 3138 + { 3139 + struct dvb_usb_device *dev = adap->dev; 3140 + struct dib0700_state *st = dev->priv; 3141 + 3142 + if (adap->id == 0) { 3143 + stk7070pd_init(dev); 3144 + 3145 + /* turn the power LED on, the other two off (just in case) */ 3146 + dib0700_set_gpio(dev, GPIO0, GPIO_OUT, 0); 3147 + dib0700_set_gpio(dev, GPIO1, GPIO_OUT, 0); 3148 + dib0700_set_gpio(dev, GPIO2, GPIO_OUT, 1); 3149 + 3150 + if (dib7000p_i2c_enumeration(&dev->i2c_adap, 2, 18, 3151 + stk7070pd_dib7000p_config) != 0) { 3152 + err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", 3153 + __func__); 3154 + return -ENODEV; 3155 + } 3156 + } 3157 + 3158 + adap->fe_adap[0].fe = dvb_attach(dib7000p_attach, &dev->i2c_adap, 3159 + adap->id == 0 ? 0x80 : 0x82, 3160 + &stk7070pd_dib7000p_config[adap->id]); 3161 + 3162 + if (adap->fe_adap[0].fe == NULL) 3163 + return -ENODEV; 3164 + 3165 + st->read_status = adap->fe_adap[0].fe->ops.read_status; 3166 + adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override; 3167 + st->sleep = adap->fe_adap[0].fe->ops.sleep; 3168 + adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override; 3169 + 3170 + return 0; 3106 3171 } 3107 3172 3108 3173 /* S5H1411 */ ··· 3947 3870 .pid_filter_count = 32, 3948 3871 .pid_filter = stk70x0p_pid_filter, 3949 3872 .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 3873 + .frontend_attach = novatd_frontend_attach, 3874 + .tuner_attach = dib7070p_tuner_attach, 3875 + 3876 + DIB0700_DEFAULT_STREAMING_CONFIG(0x02), 3877 + }}, 3878 + .size_of_priv = sizeof(struct dib0700_adapter_state), 3879 + }, { 3880 + .num_frontends = 1, 3881 + .fe = {{ 3882 + .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 3883 + .pid_filter_count = 32, 3884 + .pid_filter = stk70x0p_pid_filter, 3885 + .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 3886 + .frontend_attach = novatd_frontend_attach, 3887 + .tuner_attach = dib7070p_tuner_attach, 3888 + 3889 + DIB0700_DEFAULT_STREAMING_CONFIG(0x03), 3890 + }}, 3891 + .size_of_priv = sizeof(struct dib0700_adapter_state), 3892 + } 3893 + }, 3894 + 3895 + .num_device_descs = 1, 3896 + .devices = { 3897 + { "Hauppauge Nova-TD Stick (52009)", 3898 + { &dib0700_usb_id_table[35], NULL }, 3899 + { NULL }, 3900 + }, 3901 + }, 3902 + 3903 + .rc.core = { 3904 + .rc_interval = DEFAULT_RC_INTERVAL, 3905 + .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3906 + .module_name = "dib0700", 3907 + .rc_query = dib0700_rc_query_old_firmware, 3908 + .allowed_protos = RC_TYPE_RC5 | 3909 + RC_TYPE_RC6 | 3910 + RC_TYPE_NEC, 3911 + .change_protocol = dib0700_change_protocol, 3912 + }, 3913 + }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3914 + 3915 + .num_adapters = 2, 3916 + .adapter = { 3917 + { 3918 + .num_frontends = 1, 3919 + .fe = {{ 3920 + .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, 3921 + .pid_filter_count = 32, 3922 + .pid_filter = stk70x0p_pid_filter, 3923 + .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, 3950 3924 .frontend_attach = stk7070pd_frontend_attach0, 3951 3925 .tuner_attach = dib7070p_tuner_attach, 3952 3926 ··· 4020 3892 } 4021 3893 }, 4022 3894 4023 - .num_device_descs = 6, 3895 + .num_device_descs = 5, 4024 3896 .devices = { 4025 3897 { "DiBcom STK7070PD reference design", 4026 3898 { &dib0700_usb_id_table[17], NULL }, ··· 4028 3900 }, 4029 3901 { "Pinnacle PCTV Dual DVB-T Diversity Stick", 4030 3902 { &dib0700_usb_id_table[18], NULL }, 4031 - { NULL }, 4032 - }, 4033 - { "Hauppauge Nova-TD Stick (52009)", 4034 - { &dib0700_usb_id_table[35], NULL }, 4035 3903 { NULL }, 4036 3904 }, 4037 3905 { "Hauppauge Nova-TD-500 (84xxx)",
+8 -2
drivers/media/dvb/frontends/cxd2820r_core.c
··· 309 309 310 310 static int cxd2820r_get_frontend(struct dvb_frontend *fe) 311 311 { 312 + struct cxd2820r_priv *priv = fe->demodulator_priv; 312 313 int ret; 313 314 314 315 dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); 316 + 317 + if (priv->delivery_system == SYS_UNDEFINED) 318 + return 0; 319 + 315 320 switch (fe->dtv_property_cache.delivery_system) { 316 321 case SYS_DVBT: 317 322 ret = cxd2820r_get_frontend_t(fe); ··· 481 476 dbg("%s: delsys=%d", __func__, fe->dtv_property_cache.delivery_system); 482 477 483 478 /* switch between DVB-T and DVB-T2 when tune fails */ 484 - if (priv->last_tune_failed && (priv->delivery_system != SYS_DVBC_ANNEX_A)) { 479 + if (priv->last_tune_failed) { 485 480 if (priv->delivery_system == SYS_DVBT) 486 481 c->delivery_system = SYS_DVBT2; 487 - else 482 + else if (priv->delivery_system == SYS_DVBT2) 488 483 c->delivery_system = SYS_DVBT; 489 484 } 490 485 ··· 497 492 /* frontend lock wait loop count */ 498 493 switch (priv->delivery_system) { 499 494 case SYS_DVBT: 495 + case SYS_DVBC_ANNEX_A: 500 496 i = 20; 501 497 break; 502 498 case SYS_DVBT2:
+1 -1
drivers/media/dvb/frontends/ds3000.c
··· 1195 1195 1196 1196 for (i = 0; i < 30 ; i++) { 1197 1197 ds3000_read_status(fe, &status); 1198 - if (status && FE_HAS_LOCK) 1198 + if (status & FE_HAS_LOCK) 1199 1199 break; 1200 1200 1201 1201 msleep(10);
+4 -4
drivers/media/dvb/frontends/mb86a20s.c
··· 402 402 [2] = 0x8e, /* Layer C */ 403 403 }; 404 404 405 - if (layer > ARRAY_SIZE(reg)) 405 + if (layer >= ARRAY_SIZE(reg)) 406 406 return -EINVAL; 407 407 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 408 408 if (rc < 0) ··· 435 435 [2] = 0x8f, /* Layer C */ 436 436 }; 437 437 438 - if (layer > ARRAY_SIZE(reg)) 438 + if (layer >= ARRAY_SIZE(reg)) 439 439 return -EINVAL; 440 440 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 441 441 if (rc < 0) ··· 470 470 [2] = 0x90, /* Layer C */ 471 471 }; 472 472 473 - if (layer > ARRAY_SIZE(reg)) 473 + if (layer >= ARRAY_SIZE(reg)) 474 474 return -EINVAL; 475 475 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 476 476 if (rc < 0) ··· 494 494 [2] = 0x91, /* Layer C */ 495 495 }; 496 496 497 - if (layer > ARRAY_SIZE(reg)) 497 + if (layer >= ARRAY_SIZE(reg)) 498 498 return -EINVAL; 499 499 rc = mb86a20s_writereg(state, 0x6d, reg[layer]); 500 500 if (rc < 0)
-1
drivers/media/dvb/frontends/tda18271c2dd.c
··· 29 29 #include <linux/delay.h> 30 30 #include <linux/firmware.h> 31 31 #include <linux/i2c.h> 32 - #include <linux/version.h> 33 32 #include <asm/div64.h> 34 33 35 34 #include "dvb_frontend.h"
+1
drivers/media/video/as3645a.c
··· 29 29 #include <linux/i2c.h> 30 30 #include <linux/module.h> 31 31 #include <linux/mutex.h> 32 + #include <linux/slab.h> 32 33 33 34 #include <media/as3645a.h> 34 35 #include <media/v4l2-ctrls.h>
+14 -27
drivers/media/video/cx18/cx18-fileops.c
··· 751 751 752 752 CX18_DEBUG_IOCTL("close() of %s\n", s->name); 753 753 754 - v4l2_fh_del(fh); 755 - v4l2_fh_exit(fh); 756 - 757 - /* Easy case first: this stream was never claimed by us */ 758 - if (s->id != id->open_id) { 759 - kfree(id); 760 - return 0; 761 - } 762 - 763 - /* 'Unclaim' this stream */ 764 - 765 - /* Stop radio */ 766 754 mutex_lock(&cx->serialize_lock); 767 - if (id->type == CX18_ENC_STREAM_TYPE_RAD) { 755 + /* Stop radio */ 756 + if (id->type == CX18_ENC_STREAM_TYPE_RAD && 757 + v4l2_fh_is_singular_file(filp)) { 768 758 /* Closing radio device, return to TV mode */ 769 759 cx18_mute(cx); 770 760 /* Mark that the radio is no longer in use */ ··· 771 781 } 772 782 /* Done! Unmute and continue. */ 773 783 cx18_unmute(cx); 774 - cx18_release_stream(s); 775 - } else { 776 - cx18_stop_capture(id, 0); 777 784 } 785 + 786 + v4l2_fh_del(fh); 787 + v4l2_fh_exit(fh); 788 + 789 + /* 'Unclaim' this stream */ 790 + if (s->id == id->open_id) 791 + cx18_stop_capture(id, 0); 778 792 kfree(id); 779 793 mutex_unlock(&cx->serialize_lock); 780 794 return 0; ··· 804 810 805 811 item->open_id = cx->open_id++; 806 812 filp->private_data = &item->fh; 813 + v4l2_fh_add(&item->fh); 807 814 808 - if (item->type == CX18_ENC_STREAM_TYPE_RAD) { 809 - /* Try to claim this stream */ 810 - if (cx18_claim_stream(item, item->type)) { 811 - /* No, it's already in use */ 812 - v4l2_fh_exit(&item->fh); 813 - kfree(item); 814 - return -EBUSY; 815 - } 816 - 815 + if (item->type == CX18_ENC_STREAM_TYPE_RAD && 816 + v4l2_fh_is_singular_file(filp)) { 817 817 if (!test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { 818 818 if (atomic_read(&cx->ana_capturing) > 0) { 819 819 /* switching to radio while capture is 820 820 in progress is not polite */ 821 - cx18_release_stream(s); 821 + v4l2_fh_del(&item->fh); 822 822 v4l2_fh_exit(&item->fh); 823 823 kfree(item); 824 824 return -EBUSY; ··· 830 842 /* Done! Unmute and continue. */ 831 843 cx18_unmute(cx); 832 844 } 833 - v4l2_fh_add(&item->fh); 834 845 return 0; 835 846 } 836 847
+1 -1
drivers/media/video/cx231xx/cx231xx-cards.c
··· 1052 1052 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 1053 1053 if (dev == NULL) { 1054 1054 cx231xx_err(DRIVER_NAME ": out of memory!\n"); 1055 - clear_bit(dev->devno, &cx231xx_devused); 1055 + clear_bit(nr, &cx231xx_devused); 1056 1056 return -ENOMEM; 1057 1057 } 1058 1058
+2 -2
drivers/media/video/cx23885/cx23885-cards.c
··· 213 213 .portc = CX23885_MPEG_DVB, 214 214 .tuner_type = TUNER_XC4000, 215 215 .tuner_addr = 0x61, 216 - .radio_type = TUNER_XC4000, 217 - .radio_addr = 0x61, 216 + .radio_type = UNSET, 217 + .radio_addr = ADDR_UNSET, 218 218 .input = {{ 219 219 .type = CX23885_VMUX_TELEVISION, 220 220 .vmux = CX25840_VIN2_CH1 |
+5
drivers/media/video/cx23885/cx23885-dvb.c
··· 943 943 944 944 fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, 945 945 &dev->i2c_bus[1].i2c_adap, &cfg); 946 + if (!fe) { 947 + printk(KERN_ERR "%s/2: xc4000 attach failed\n", 948 + dev->name); 949 + goto frontend_detach; 950 + } 946 951 } 947 952 break; 948 953 case CX23885_BOARD_TBS_6920:
+4 -3
drivers/media/video/cx23885/cx23885-video.c
··· 1550 1550 struct v4l2_control ctrl; 1551 1551 struct videobuf_dvb_frontend *vfe; 1552 1552 struct dvb_frontend *fe; 1553 - int err = 0; 1554 1553 1555 1554 struct analog_parameters params = { 1556 1555 .mode = V4L2_TUNER_ANALOG_TV, ··· 1571 1572 params.frequency, f->tuner, params.std); 1572 1573 1573 1574 vfe = videobuf_dvb_get_frontend(&dev->ts2.frontends, 1); 1574 - if (!vfe) 1575 - err = -EINVAL; 1575 + if (!vfe) { 1576 + mutex_unlock(&dev->lock); 1577 + return -EINVAL; 1578 + } 1576 1579 1577 1580 fe = vfe->dvb.frontend; 1578 1581
+12 -12
drivers/media/video/cx88/cx88-cards.c
··· 1573 1573 .name = "Pinnacle Hybrid PCTV", 1574 1574 .tuner_type = TUNER_XC2028, 1575 1575 .tuner_addr = 0x61, 1576 - .radio_type = TUNER_XC2028, 1577 - .radio_addr = 0x61, 1576 + .radio_type = UNSET, 1577 + .radio_addr = ADDR_UNSET, 1578 1578 .input = { { 1579 1579 .type = CX88_VMUX_TELEVISION, 1580 1580 .vmux = 0, ··· 1611 1611 .name = "Leadtek TV2000 XP Global", 1612 1612 .tuner_type = TUNER_XC2028, 1613 1613 .tuner_addr = 0x61, 1614 - .radio_type = TUNER_XC2028, 1615 - .radio_addr = 0x61, 1614 + .radio_type = UNSET, 1615 + .radio_addr = ADDR_UNSET, 1616 1616 .input = { { 1617 1617 .type = CX88_VMUX_TELEVISION, 1618 1618 .vmux = 0, ··· 2115 2115 .name = "Terratec Cinergy HT PCI MKII", 2116 2116 .tuner_type = TUNER_XC2028, 2117 2117 .tuner_addr = 0x61, 2118 - .radio_type = TUNER_XC2028, 2119 - .radio_addr = 0x61, 2118 + .radio_type = UNSET, 2119 + .radio_addr = ADDR_UNSET, 2120 2120 .input = { { 2121 2121 .type = CX88_VMUX_TELEVISION, 2122 2122 .vmux = 0, ··· 2154 2154 [CX88_BOARD_WINFAST_DTV1800H] = { 2155 2155 .name = "Leadtek WinFast DTV1800 Hybrid", 2156 2156 .tuner_type = TUNER_XC2028, 2157 - .radio_type = TUNER_XC2028, 2157 + .radio_type = UNSET, 2158 2158 .tuner_addr = 0x61, 2159 - .radio_addr = 0x61, 2159 + .radio_addr = ADDR_UNSET, 2160 2160 /* 2161 2161 * GPIO setting 2162 2162 * ··· 2195 2195 [CX88_BOARD_WINFAST_DTV1800H_XC4000] = { 2196 2196 .name = "Leadtek WinFast DTV1800 H (XC4000)", 2197 2197 .tuner_type = TUNER_XC4000, 2198 - .radio_type = TUNER_XC4000, 2198 + .radio_type = UNSET, 2199 2199 .tuner_addr = 0x61, 2200 - .radio_addr = 0x61, 2200 + .radio_addr = ADDR_UNSET, 2201 2201 /* 2202 2202 * GPIO setting 2203 2203 * ··· 2236 2236 [CX88_BOARD_WINFAST_DTV2000H_PLUS] = { 2237 2237 .name = "Leadtek WinFast DTV2000 H PLUS", 2238 2238 .tuner_type = TUNER_XC4000, 2239 - .radio_type = TUNER_XC4000, 2239 + .radio_type = UNSET, 2240 2240 .tuner_addr = 0x61, 2241 - .radio_addr = 0x61, 2241 + .radio_addr = ADDR_UNSET, 2242 2242 /* 2243 2243 * GPIO 2244 2244 * 2: 1: mute audio
-3
drivers/media/video/ivtv/ivtv-driver.c
··· 731 731 732 732 init_kthread_work(&itv->irq_work, ivtv_irq_work_handler); 733 733 734 - /* start counting open_id at 1 */ 735 - itv->open_id = 1; 736 - 737 734 /* Initial settings */ 738 735 itv->cxhdl.port = CX2341X_PORT_MEMORY; 739 736 itv->cxhdl.capabilities = CX2341X_CAP_HAS_SLICED_VBI;
+1 -2
drivers/media/video/ivtv/ivtv-driver.h
··· 332 332 const char *name; /* name of the stream */ 333 333 int type; /* stream type */ 334 334 335 - u32 id; 335 + struct v4l2_fh *fh; /* pointer to the streaming filehandle */ 336 336 spinlock_t qlock; /* locks access to the queues */ 337 337 unsigned long s_flags; /* status flags, see above */ 338 338 int dma; /* can be PCI_DMA_TODEVICE, PCI_DMA_FROMDEVICE or PCI_DMA_NONE */ ··· 379 379 380 380 struct ivtv_open_id { 381 381 struct v4l2_fh fh; 382 - u32 open_id; /* unique ID for this file descriptor */ 383 382 int type; /* stream type */ 384 383 int yuv_frames; /* 1: started OUT_UDMA_YUV output mode */ 385 384 struct ivtv *itv;
+44 -74
drivers/media/video/ivtv/ivtv-fileops.c
··· 50 50 51 51 if (test_and_set_bit(IVTV_F_S_CLAIMED, &s->s_flags)) { 52 52 /* someone already claimed this stream */ 53 - if (s->id == id->open_id) { 53 + if (s->fh == &id->fh) { 54 54 /* yes, this file descriptor did. So that's OK. */ 55 55 return 0; 56 56 } 57 - if (s->id == -1 && (type == IVTV_DEC_STREAM_TYPE_VBI || 57 + if (s->fh == NULL && (type == IVTV_DEC_STREAM_TYPE_VBI || 58 58 type == IVTV_ENC_STREAM_TYPE_VBI)) { 59 59 /* VBI is handled already internally, now also assign 60 60 the file descriptor to this stream for external 61 61 reading of the stream. */ 62 - s->id = id->open_id; 62 + s->fh = &id->fh; 63 63 IVTV_DEBUG_INFO("Start Read VBI\n"); 64 64 return 0; 65 65 } ··· 67 67 IVTV_DEBUG_INFO("Stream %d is busy\n", type); 68 68 return -EBUSY; 69 69 } 70 - s->id = id->open_id; 70 + s->fh = &id->fh; 71 71 if (type == IVTV_DEC_STREAM_TYPE_VBI) { 72 72 /* Enable reinsertion interrupt */ 73 73 ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT); ··· 104 104 struct ivtv *itv = s->itv; 105 105 struct ivtv_stream *s_vbi; 106 106 107 - s->id = -1; 107 + s->fh = NULL; 108 108 if ((s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type == IVTV_ENC_STREAM_TYPE_VBI) && 109 109 test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { 110 110 /* this stream is still in use internally */ ··· 136 136 /* was already cleared */ 137 137 return; 138 138 } 139 - if (s_vbi->id != -1) { 139 + if (s_vbi->fh) { 140 140 /* VBI stream still claimed by a file descriptor */ 141 141 return; 142 142 } ··· 268 268 } 269 269 270 270 /* wait for more data to arrive */ 271 + mutex_unlock(&itv->serialize_lock); 271 272 prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE); 272 273 /* New buffers might have become available before we were added to the waitqueue */ 273 274 if (!s->q_full.buffers) 274 275 schedule(); 275 276 finish_wait(&s->waitq, &wait); 277 + mutex_lock(&itv->serialize_lock); 276 278 if (signal_pending(current)) { 277 279 /* return if a signal was received */ 278 280 IVTV_DEBUG_INFO("User stopped %s\n", s->name); ··· 359 357 size_t tot_written = 0; 360 358 int single_frame = 0; 361 359 362 - if (atomic_read(&itv->capturing) == 0 && s->id == -1) { 360 + if (atomic_read(&itv->capturing) == 0 && s->fh == NULL) { 363 361 /* shouldn't happen */ 364 362 IVTV_DEBUG_WARN("Stream %s not initialized before read\n", s->name); 365 363 return -EIO; ··· 509 507 510 508 IVTV_DEBUG_HI_FILE("read %zd bytes from %s\n", count, s->name); 511 509 512 - mutex_lock(&itv->serialize_lock); 513 510 rc = ivtv_start_capture(id); 514 - mutex_unlock(&itv->serialize_lock); 515 511 if (rc) 516 512 return rc; 517 513 return ivtv_read_pos(s, buf, count, pos, filp->f_flags & O_NONBLOCK); ··· 584 584 set_bit(IVTV_F_S_APPL_IO, &s->s_flags); 585 585 586 586 /* Start decoder (returns 0 if already started) */ 587 - mutex_lock(&itv->serialize_lock); 588 587 rc = ivtv_start_decoding(id, itv->speed); 589 - mutex_unlock(&itv->serialize_lock); 590 588 if (rc) { 591 589 IVTV_DEBUG_WARN("Failed start decode stream %s\n", s->name); 592 590 ··· 625 627 break; 626 628 if (filp->f_flags & O_NONBLOCK) 627 629 return -EAGAIN; 630 + mutex_unlock(&itv->serialize_lock); 628 631 prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE); 629 632 /* New buffers might have become free before we were added to the waitqueue */ 630 633 if (!s->q_free.buffers) 631 634 schedule(); 632 635 finish_wait(&s->waitq, &wait); 636 + mutex_lock(&itv->serialize_lock); 633 637 if (signal_pending(current)) { 634 638 IVTV_DEBUG_INFO("User stopped %s\n", s->name); 635 639 return -EINTR; ··· 686 686 if (mode == OUT_YUV) 687 687 ivtv_yuv_setup_stream_frame(itv); 688 688 689 + mutex_unlock(&itv->serialize_lock); 689 690 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); 690 691 while (!(got_sig = signal_pending(current)) && 691 692 test_bit(IVTV_F_S_DMA_PENDING, &s->s_flags)) { 692 693 schedule(); 693 694 } 694 695 finish_wait(&itv->dma_waitq, &wait); 696 + mutex_lock(&itv->serialize_lock); 695 697 if (got_sig) { 696 698 IVTV_DEBUG_INFO("User interrupted %s\n", s->name); 697 699 return -EINTR; ··· 758 756 if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags)) { 759 757 int rc; 760 758 761 - mutex_lock(&itv->serialize_lock); 762 759 rc = ivtv_start_capture(id); 763 - mutex_unlock(&itv->serialize_lock); 764 760 if (rc) { 765 761 IVTV_DEBUG_INFO("Could not start capture for %s (%d)\n", 766 762 s->name, rc); ··· 808 808 id->type == IVTV_ENC_STREAM_TYPE_VBI) && 809 809 test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) { 810 810 /* Also used internally, don't stop capturing */ 811 - s->id = -1; 811 + s->fh = NULL; 812 812 } 813 813 else { 814 814 ivtv_stop_v4l2_encode_stream(s, gop_end); ··· 861 861 862 862 IVTV_DEBUG_FILE("close %s\n", s->name); 863 863 864 - v4l2_fh_del(fh); 865 - v4l2_fh_exit(fh); 866 - 867 - /* Easy case first: this stream was never claimed by us */ 868 - if (s->id != id->open_id) { 869 - kfree(id); 870 - return 0; 871 - } 872 - 873 - /* 'Unclaim' this stream */ 874 - 875 864 /* Stop radio */ 876 - mutex_lock(&itv->serialize_lock); 877 - if (id->type == IVTV_ENC_STREAM_TYPE_RAD) { 865 + if (id->type == IVTV_ENC_STREAM_TYPE_RAD && 866 + v4l2_fh_is_singular_file(filp)) { 878 867 /* Closing radio device, return to TV mode */ 879 868 ivtv_mute(itv); 880 869 /* Mark that the radio is no longer in use */ ··· 879 890 if (atomic_read(&itv->capturing) > 0) { 880 891 /* Undo video mute */ 881 892 ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1, 882 - v4l2_ctrl_g_ctrl(itv->cxhdl.video_mute) | 883 - (v4l2_ctrl_g_ctrl(itv->cxhdl.video_mute_yuv) << 8)); 893 + v4l2_ctrl_g_ctrl(itv->cxhdl.video_mute) | 894 + (v4l2_ctrl_g_ctrl(itv->cxhdl.video_mute_yuv) << 8)); 884 895 } 885 896 /* Done! Unmute and continue. */ 886 897 ivtv_unmute(itv); 887 - ivtv_release_stream(s); 888 - } else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { 898 + } 899 + 900 + v4l2_fh_del(fh); 901 + v4l2_fh_exit(fh); 902 + 903 + /* Easy case first: this stream was never claimed by us */ 904 + if (s->fh != &id->fh) { 905 + kfree(id); 906 + return 0; 907 + } 908 + 909 + /* 'Unclaim' this stream */ 910 + 911 + if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { 889 912 struct ivtv_stream *s_vout = &itv->streams[IVTV_DEC_STREAM_TYPE_VOUT]; 890 913 891 914 ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0); ··· 912 911 ivtv_stop_capture(id, 0); 913 912 } 914 913 kfree(id); 915 - mutex_unlock(&itv->serialize_lock); 916 914 return 0; 917 915 } 918 916 919 - static int ivtv_serialized_open(struct ivtv_stream *s, struct file *filp) 917 + int ivtv_v4l2_open(struct file *filp) 920 918 { 921 - #ifdef CONFIG_VIDEO_ADV_DEBUG 922 919 struct video_device *vdev = video_devdata(filp); 923 - #endif 920 + struct ivtv_stream *s = video_get_drvdata(vdev); 924 921 struct ivtv *itv = s->itv; 925 922 struct ivtv_open_id *item; 926 923 int res = 0; 927 924 928 925 IVTV_DEBUG_FILE("open %s\n", s->name); 926 + 927 + if (ivtv_init_on_first_open(itv)) { 928 + IVTV_ERR("Failed to initialize on device %s\n", 929 + video_device_node_name(vdev)); 930 + return -ENXIO; 931 + } 929 932 930 933 #ifdef CONFIG_VIDEO_ADV_DEBUG 931 934 /* Unless ivtv_fw_debug is set, error out if firmware dead. */ ··· 971 966 return -ENOMEM; 972 967 } 973 968 v4l2_fh_init(&item->fh, s->vdev); 974 - if (res < 0) { 975 - v4l2_fh_exit(&item->fh); 976 - kfree(item); 977 - return res; 978 - } 979 969 item->itv = itv; 980 970 item->type = s->type; 981 971 982 - item->open_id = itv->open_id++; 983 972 filp->private_data = &item->fh; 973 + v4l2_fh_add(&item->fh); 984 974 985 - if (item->type == IVTV_ENC_STREAM_TYPE_RAD) { 986 - /* Try to claim this stream */ 987 - if (ivtv_claim_stream(item, item->type)) { 988 - /* No, it's already in use */ 989 - v4l2_fh_exit(&item->fh); 990 - kfree(item); 991 - return -EBUSY; 992 - } 993 - 975 + if (item->type == IVTV_ENC_STREAM_TYPE_RAD && 976 + v4l2_fh_is_singular_file(filp)) { 994 977 if (!test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { 995 978 if (atomic_read(&itv->capturing) > 0) { 996 979 /* switching to radio while capture is 997 980 in progress is not polite */ 998 - ivtv_release_stream(s); 981 + v4l2_fh_del(&item->fh); 999 982 v4l2_fh_exit(&item->fh); 1000 983 kfree(item); 1001 984 return -EBUSY; ··· 1015 1022 1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31); 1016 1023 itv->yuv_info.stream_size = 0; 1017 1024 } 1018 - v4l2_fh_add(&item->fh); 1019 1025 return 0; 1020 - } 1021 - 1022 - int ivtv_v4l2_open(struct file *filp) 1023 - { 1024 - int res; 1025 - struct ivtv *itv = NULL; 1026 - struct ivtv_stream *s = NULL; 1027 - struct video_device *vdev = video_devdata(filp); 1028 - 1029 - s = video_get_drvdata(vdev); 1030 - itv = s->itv; 1031 - 1032 - mutex_lock(&itv->serialize_lock); 1033 - if (ivtv_init_on_first_open(itv)) { 1034 - IVTV_ERR("Failed to initialize on device %s\n", 1035 - video_device_node_name(vdev)); 1036 - mutex_unlock(&itv->serialize_lock); 1037 - return -ENXIO; 1038 - } 1039 - res = ivtv_serialized_open(s, filp); 1040 - mutex_unlock(&itv->serialize_lock); 1041 - return res; 1042 1026 } 1043 1027 1044 1028 void ivtv_mute(struct ivtv *itv)
+5 -17
drivers/media/video/ivtv/ivtv-ioctl.c
··· 179 179 ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1, 0); 180 180 181 181 /* Wait for any DMA to finish */ 182 + mutex_unlock(&itv->serialize_lock); 182 183 prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE); 183 184 while (test_bit(IVTV_F_I_DMA, &itv->i_flags)) { 184 185 got_sig = signal_pending(current); ··· 189 188 schedule(); 190 189 } 191 190 finish_wait(&itv->dma_waitq, &wait); 191 + mutex_lock(&itv->serialize_lock); 192 192 if (got_sig) 193 193 return -EINTR; 194 194 ··· 1109 1107 * happens within the first 100 lines of the top field. 1110 1108 * Make 4 attempts to sync to the decoder before giving up. 1111 1109 */ 1110 + mutex_unlock(&itv->serialize_lock); 1112 1111 for (f = 0; f < 4; f++) { 1113 1112 prepare_to_wait(&itv->vsync_waitq, &wait, 1114 1113 TASK_UNINTERRUPTIBLE); ··· 1118 1115 schedule_timeout(msecs_to_jiffies(25)); 1119 1116 } 1120 1117 finish_wait(&itv->vsync_waitq, &wait); 1118 + mutex_lock(&itv->serialize_lock); 1121 1119 1122 1120 if (f == 4) 1123 1121 IVTV_WARN("Mode change failed to sync to decoder\n"); ··· 1846 1842 return 0; 1847 1843 } 1848 1844 1849 - static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, 1850 - unsigned int cmd, unsigned long arg) 1845 + long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 1851 1846 { 1852 1847 struct video_device *vfd = video_devdata(filp); 1853 1848 long ret; ··· 1856 1853 ret = video_ioctl2(filp, cmd, arg); 1857 1854 vfd->debug = 0; 1858 1855 return ret; 1859 - } 1860 - 1861 - long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) 1862 - { 1863 - struct ivtv_open_id *id = fh2id(filp->private_data); 1864 - struct ivtv *itv = id->itv; 1865 - long res; 1866 - 1867 - /* DQEVENT can block, so this should not run with the serialize lock */ 1868 - if (cmd == VIDIOC_DQEVENT) 1869 - return ivtv_serialized_ioctl(itv, filp, cmd, arg); 1870 - mutex_lock(&itv->serialize_lock); 1871 - res = ivtv_serialized_ioctl(itv, filp, cmd, arg); 1872 - mutex_unlock(&itv->serialize_lock); 1873 - return res; 1874 1856 } 1875 1857 1876 1858 static const struct v4l2_ioctl_ops ivtv_ioctl_ops = {
+2 -2
drivers/media/video/ivtv/ivtv-irq.c
··· 288 288 ivtv_process_vbi_data(itv, buf, 0, s->type); 289 289 s->q_dma.bytesused += buf->bytesused; 290 290 } 291 - if (s->id == -1) { 291 + if (s->fh == NULL) { 292 292 ivtv_queue_move(s, &s->q_dma, NULL, &s->q_free, 0); 293 293 return; 294 294 } 295 295 } 296 296 ivtv_queue_move(s, &s->q_dma, NULL, &s->q_full, s->q_dma.bytesused); 297 - if (s->id != -1) 297 + if (s->fh) 298 298 wake_up(&s->waitq); 299 299 } 300 300
+1 -1
drivers/media/video/ivtv/ivtv-streams.c
··· 159 159 s->buffers = (itv->options.kilobytes[type] * 1024 + s->buf_size - 1) / s->buf_size; 160 160 spin_lock_init(&s->qlock); 161 161 init_waitqueue_head(&s->waitq); 162 - s->id = -1; 163 162 s->sg_handle = IVTV_DMA_UNMAPPED; 164 163 ivtv_queue_init(&s->q_free); 165 164 ivtv_queue_init(&s->q_full); ··· 213 214 s->vdev->fops = ivtv_stream_info[type].fops; 214 215 s->vdev->release = video_device_release; 215 216 s->vdev->tvnorms = V4L2_STD_ALL; 217 + s->vdev->lock = &itv->serialize_lock; 216 218 set_bit(V4L2_FL_USE_FH_PRIO, &s->vdev->flags); 217 219 ivtv_set_funcs(s->vdev); 218 220 return 0;
+19 -3
drivers/media/video/ivtv/ivtv-yuv.c
··· 1149 1149 { 1150 1150 struct yuv_playback_info *yi = &itv->yuv_info; 1151 1151 struct ivtv_dma_frame dma_args; 1152 + int res; 1152 1153 1153 1154 ivtv_yuv_setup_stream_frame(itv); 1154 1155 1155 1156 /* We only need to supply source addresses for this */ 1156 1157 dma_args.y_source = src; 1157 1158 dma_args.uv_source = src + 720 * ((yi->v4l2_src_h + 31) & ~31); 1158 - return ivtv_yuv_udma_frame(itv, &dma_args); 1159 + /* Wait for frame DMA. Note that serialize_lock is locked, 1160 + so to allow other processes to access the driver while 1161 + we are waiting unlock first and later lock again. */ 1162 + mutex_unlock(&itv->serialize_lock); 1163 + res = ivtv_yuv_udma_frame(itv, &dma_args); 1164 + mutex_lock(&itv->serialize_lock); 1165 + return res; 1159 1166 } 1160 1167 1161 1168 /* IVTV_IOC_DMA_FRAME ioctl handler */ 1162 1169 int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args) 1163 1170 { 1164 - /* IVTV_DEBUG_INFO("yuv_prep_frame\n"); */ 1171 + int res; 1165 1172 1173 + /* IVTV_DEBUG_INFO("yuv_prep_frame\n"); */ 1166 1174 ivtv_yuv_next_free(itv); 1167 1175 ivtv_yuv_setup_frame(itv, args); 1168 - return ivtv_yuv_udma_frame(itv, args); 1176 + /* Wait for frame DMA. Note that serialize_lock is locked, 1177 + so to allow other processes to access the driver while 1178 + we are waiting unlock first and later lock again. */ 1179 + mutex_unlock(&itv->serialize_lock); 1180 + res = ivtv_yuv_udma_frame(itv, args); 1181 + mutex_lock(&itv->serialize_lock); 1182 + return res; 1169 1183 } 1170 1184 1171 1185 void ivtv_yuv_close(struct ivtv *itv) ··· 1188 1174 int h_filter, v_filter_1, v_filter_2; 1189 1175 1190 1176 IVTV_DEBUG_YUV("ivtv_yuv_close\n"); 1177 + mutex_unlock(&itv->serialize_lock); 1191 1178 ivtv_waitq(&itv->vsync_waitq); 1179 + mutex_lock(&itv->serialize_lock); 1192 1180 1193 1181 yi->running = 0; 1194 1182 atomic_set(&yi->next_dma_frame, -1);
+5 -2
drivers/media/video/omap/omap_vout.c
··· 1042 1042 strlcpy(cap->driver, VOUT_NAME, sizeof(cap->driver)); 1043 1043 strlcpy(cap->card, vout->vfd->name, sizeof(cap->card)); 1044 1044 cap->bus_info[0] = '\0'; 1045 - cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT; 1045 + cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_OUTPUT | 1046 + V4L2_CAP_VIDEO_OUTPUT_OVERLAY; 1046 1047 1047 1048 return 0; 1048 1049 } ··· 1826 1825 ovid = &vout->vid_info; 1827 1826 ovl = ovid->overlays[0]; 1828 1827 1829 - a->flags = 0x0; 1828 + /* The video overlay must stay within the framebuffer and can't be 1829 + positioned independently. */ 1830 + a->flags = V4L2_FBUF_FLAG_OVERLAY; 1830 1831 a->capability = V4L2_FBUF_CAP_LOCAL_ALPHA | V4L2_FBUF_CAP_CHROMAKEY 1831 1832 | V4L2_FBUF_CAP_SRC_CHROMAKEY; 1832 1833
+102 -137
drivers/media/video/pwc/pwc-ctrl.c
··· 104 104 105 105 /****************************************************************************/ 106 106 107 - static int _send_control_msg(struct pwc_device *pdev, 108 - u8 request, u16 value, int index, void *buf, int buflen) 109 - { 110 - int rc; 111 - void *kbuf = NULL; 112 - 113 - if (buflen) { 114 - kbuf = kmemdup(buf, buflen, GFP_KERNEL); /* not allowed on stack */ 115 - if (kbuf == NULL) 116 - return -ENOMEM; 117 - } 118 - 119 - rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), 120 - request, 121 - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 122 - value, 123 - index, 124 - kbuf, buflen, USB_CTRL_SET_TIMEOUT); 125 - 126 - kfree(kbuf); 127 - return rc; 128 - } 129 - 130 107 static int recv_control_msg(struct pwc_device *pdev, 131 - u8 request, u16 value, void *buf, int buflen) 108 + u8 request, u16 value, int recv_count) 132 109 { 133 110 int rc; 134 - void *kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */ 135 - 136 - if (kbuf == NULL) 137 - return -ENOMEM; 138 111 139 112 rc = usb_control_msg(pdev->udev, usb_rcvctrlpipe(pdev->udev, 0), 140 113 request, 141 114 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 142 - value, 143 - pdev->vcinterface, 144 - kbuf, buflen, USB_CTRL_GET_TIMEOUT); 145 - memcpy(buf, kbuf, buflen); 146 - kfree(kbuf); 147 - 115 + value, pdev->vcinterface, 116 + pdev->ctrl_buf, recv_count, USB_CTRL_GET_TIMEOUT); 148 117 if (rc < 0) 149 118 PWC_ERROR("recv_control_msg error %d req %02x val %04x\n", 150 119 rc, request, value); ··· 121 152 } 122 153 123 154 static inline int send_video_command(struct pwc_device *pdev, 124 - int index, void *buf, int buflen) 155 + int index, const unsigned char *buf, int buflen) 125 156 { 126 - return _send_control_msg(pdev, 127 - SET_EP_STREAM_CTL, 128 - VIDEO_OUTPUT_CONTROL_FORMATTER, 129 - index, 130 - buf, buflen); 157 + int rc; 158 + 159 + memcpy(pdev->ctrl_buf, buf, buflen); 160 + 161 + rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), 162 + SET_EP_STREAM_CTL, 163 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 164 + VIDEO_OUTPUT_CONTROL_FORMATTER, index, 165 + pdev->ctrl_buf, buflen, USB_CTRL_SET_TIMEOUT); 166 + if (rc >= 0) 167 + memcpy(pdev->cmd_buf, buf, buflen); 168 + else 169 + PWC_ERROR("send_video_command error %d\n", rc); 170 + 171 + return rc; 131 172 } 132 173 133 174 int send_control_msg(struct pwc_device *pdev, 134 175 u8 request, u16 value, void *buf, int buflen) 135 176 { 136 - return _send_control_msg(pdev, 137 - request, value, pdev->vcinterface, buf, buflen); 177 + return usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), 178 + request, 179 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 180 + value, pdev->vcinterface, 181 + buf, buflen, USB_CTRL_SET_TIMEOUT); 138 182 } 139 183 140 - static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames, 141 - int *compression) 184 + static int set_video_mode_Nala(struct pwc_device *pdev, int size, int pixfmt, 185 + int frames, int *compression, int send_to_cam) 142 186 { 143 - unsigned char buf[3]; 144 - int ret, fps; 187 + int fps, ret = 0; 145 188 struct Nala_table_entry *pEntry; 146 189 int frames2frames[31] = 147 190 { /* closest match of framerate */ ··· 175 194 7 /* 30 */ 176 195 }; 177 196 178 - if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) 197 + if (size < 0 || size > PSZ_CIF) 179 198 return -EINVAL; 199 + if (frames < 4) 200 + frames = 4; 201 + else if (frames > 25) 202 + frames = 25; 180 203 frames = frames2frames[frames]; 181 204 fps = frames2table[frames]; 182 205 pEntry = &Nala_table[size][fps]; 183 206 if (pEntry->alternate == 0) 184 207 return -EINVAL; 185 208 186 - memcpy(buf, pEntry->mode, 3); 187 - ret = send_video_command(pdev, pdev->vendpoint, buf, 3); 188 - if (ret < 0) { 189 - PWC_DEBUG_MODULE("Failed to send video command... %d\n", ret); 209 + if (send_to_cam) 210 + ret = send_video_command(pdev, pdev->vendpoint, 211 + pEntry->mode, 3); 212 + if (ret < 0) 190 213 return ret; 191 - } 192 - if (pEntry->compressed && pdev->pixfmt == V4L2_PIX_FMT_YUV420) { 193 - ret = pwc_dec1_init(pdev, pdev->type, pdev->release, buf); 194 - if (ret < 0) 195 - return ret; 196 - } 197 214 198 - pdev->cmd_len = 3; 199 - memcpy(pdev->cmd_buf, buf, 3); 215 + if (pEntry->compressed && pixfmt == V4L2_PIX_FMT_YUV420) 216 + pwc_dec1_init(pdev, pEntry->mode); 200 217 201 218 /* Set various parameters */ 219 + pdev->pixfmt = pixfmt; 202 220 pdev->vframes = frames; 203 221 pdev->valternate = pEntry->alternate; 204 222 pdev->width = pwc_image_sizes[size][0]; ··· 223 243 } 224 244 225 245 226 - static int set_video_mode_Timon(struct pwc_device *pdev, int size, int frames, 227 - int *compression) 246 + static int set_video_mode_Timon(struct pwc_device *pdev, int size, int pixfmt, 247 + int frames, int *compression, int send_to_cam) 228 248 { 229 - unsigned char buf[13]; 230 249 const struct Timon_table_entry *pChoose; 231 - int ret, fps; 250 + int fps, ret = 0; 232 251 233 - if (size >= PSZ_MAX || frames < 5 || frames > 30 || 234 - *compression < 0 || *compression > 3) 252 + if (size >= PSZ_MAX || *compression < 0 || *compression > 3) 235 253 return -EINVAL; 236 - if (size == PSZ_VGA && frames > 15) 237 - return -EINVAL; 254 + if (frames < 5) 255 + frames = 5; 256 + else if (size == PSZ_VGA && frames > 15) 257 + frames = 15; 258 + else if (frames > 30) 259 + frames = 30; 238 260 fps = (frames / 5) - 1; 239 261 240 262 /* Find a supported framerate with progressively higher compression */ ··· 250 268 if (pChoose == NULL || pChoose->alternate == 0) 251 269 return -ENOENT; /* Not supported. */ 252 270 253 - memcpy(buf, pChoose->mode, 13); 254 - ret = send_video_command(pdev, pdev->vendpoint, buf, 13); 271 + if (send_to_cam) 272 + ret = send_video_command(pdev, pdev->vendpoint, 273 + pChoose->mode, 13); 255 274 if (ret < 0) 256 275 return ret; 257 276 258 - if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) { 259 - ret = pwc_dec23_init(pdev, pdev->type, buf); 260 - if (ret < 0) 261 - return ret; 262 - } 263 - 264 - pdev->cmd_len = 13; 265 - memcpy(pdev->cmd_buf, buf, 13); 277 + if (pChoose->bandlength > 0 && pixfmt == V4L2_PIX_FMT_YUV420) 278 + pwc_dec23_init(pdev, pChoose->mode); 266 279 267 280 /* Set various parameters */ 268 - pdev->vframes = frames; 281 + pdev->pixfmt = pixfmt; 282 + pdev->vframes = (fps + 1) * 5; 269 283 pdev->valternate = pChoose->alternate; 270 284 pdev->width = pwc_image_sizes[size][0]; 271 285 pdev->height = pwc_image_sizes[size][1]; ··· 274 296 } 275 297 276 298 277 - static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, 278 - int *compression) 299 + static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int pixfmt, 300 + int frames, int *compression, int send_to_cam) 279 301 { 280 302 const struct Kiara_table_entry *pChoose = NULL; 281 - int fps, ret; 282 - unsigned char buf[12]; 303 + int fps, ret = 0; 283 304 284 - if (size >= PSZ_MAX || frames < 5 || frames > 30 || 285 - *compression < 0 || *compression > 3) 305 + if (size >= PSZ_MAX || *compression < 0 || *compression > 3) 286 306 return -EINVAL; 287 - if (size == PSZ_VGA && frames > 15) 288 - return -EINVAL; 307 + if (frames < 5) 308 + frames = 5; 309 + else if (size == PSZ_VGA && frames > 15) 310 + frames = 15; 311 + else if (frames > 30) 312 + frames = 30; 289 313 fps = (frames / 5) - 1; 290 314 291 315 /* Find a supported framerate with progressively higher compression */ ··· 300 320 if (pChoose == NULL || pChoose->alternate == 0) 301 321 return -ENOENT; /* Not supported. */ 302 322 303 - PWC_TRACE("Using alternate setting %d.\n", pChoose->alternate); 304 - 305 - /* usb_control_msg won't take staticly allocated arrays as argument?? */ 306 - memcpy(buf, pChoose->mode, 12); 307 - 308 323 /* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ 309 - ret = send_video_command(pdev, 4 /* pdev->vendpoint */, buf, 12); 324 + if (send_to_cam) 325 + ret = send_video_command(pdev, 4, pChoose->mode, 12); 310 326 if (ret < 0) 311 327 return ret; 312 328 313 - if (pChoose->bandlength > 0 && pdev->pixfmt == V4L2_PIX_FMT_YUV420) { 314 - ret = pwc_dec23_init(pdev, pdev->type, buf); 315 - if (ret < 0) 316 - return ret; 317 - } 329 + if (pChoose->bandlength > 0 && pixfmt == V4L2_PIX_FMT_YUV420) 330 + pwc_dec23_init(pdev, pChoose->mode); 318 331 319 - pdev->cmd_len = 12; 320 - memcpy(pdev->cmd_buf, buf, 12); 321 332 /* All set and go */ 322 - pdev->vframes = frames; 333 + pdev->pixfmt = pixfmt; 334 + pdev->vframes = (fps + 1) * 5; 323 335 pdev->valternate = pChoose->alternate; 324 336 pdev->width = pwc_image_sizes[size][0]; 325 337 pdev->height = pwc_image_sizes[size][1]; ··· 326 354 } 327 355 328 356 int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, 329 - int frames, int *compression) 357 + int pixfmt, int frames, int *compression, int send_to_cam) 330 358 { 331 359 int ret, size; 332 360 333 - PWC_DEBUG_FLOW("set_video_mode(%dx%d @ %d, pixfmt %08x).\n", width, height, frames, pdev->pixfmt); 361 + PWC_DEBUG_FLOW("set_video_mode(%dx%d @ %d, pixfmt %08x).\n", 362 + width, height, frames, pixfmt); 334 363 size = pwc_get_size(pdev, width, height); 335 364 PWC_TRACE("decode_size = %d.\n", size); 336 365 337 366 if (DEVICE_USE_CODEC1(pdev->type)) { 338 - ret = set_video_mode_Nala(pdev, size, frames, compression); 339 - 367 + ret = set_video_mode_Nala(pdev, size, pixfmt, frames, 368 + compression, send_to_cam); 340 369 } else if (DEVICE_USE_CODEC3(pdev->type)) { 341 - ret = set_video_mode_Kiara(pdev, size, frames, compression); 342 - 370 + ret = set_video_mode_Kiara(pdev, size, pixfmt, frames, 371 + compression, send_to_cam); 343 372 } else { 344 - ret = set_video_mode_Timon(pdev, size, frames, compression); 373 + ret = set_video_mode_Timon(pdev, size, pixfmt, frames, 374 + compression, send_to_cam); 345 375 } 346 376 if (ret < 0) { 347 377 PWC_ERROR("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret); ··· 410 436 int pwc_get_u8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) 411 437 { 412 438 int ret; 413 - u8 buf; 414 439 415 - ret = recv_control_msg(pdev, request, value, &buf, sizeof(buf)); 440 + ret = recv_control_msg(pdev, request, value, 1); 416 441 if (ret < 0) 417 442 return ret; 418 443 419 - *data = buf; 444 + *data = pdev->ctrl_buf[0]; 420 445 return 0; 421 446 } 422 447 ··· 423 450 { 424 451 int ret; 425 452 426 - ret = send_control_msg(pdev, request, value, &data, sizeof(data)); 453 + pdev->ctrl_buf[0] = data; 454 + ret = send_control_msg(pdev, request, value, pdev->ctrl_buf, 1); 427 455 if (ret < 0) 428 456 return ret; 429 457 ··· 434 460 int pwc_get_s8_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) 435 461 { 436 462 int ret; 437 - s8 buf; 438 463 439 - ret = recv_control_msg(pdev, request, value, &buf, sizeof(buf)); 464 + ret = recv_control_msg(pdev, request, value, 1); 440 465 if (ret < 0) 441 466 return ret; 442 467 443 - *data = buf; 468 + *data = ((s8 *)pdev->ctrl_buf)[0]; 444 469 return 0; 445 470 } 446 471 447 472 int pwc_get_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, int *data) 448 473 { 449 474 int ret; 450 - u8 buf[2]; 451 475 452 - ret = recv_control_msg(pdev, request, value, buf, sizeof(buf)); 476 + ret = recv_control_msg(pdev, request, value, 2); 453 477 if (ret < 0) 454 478 return ret; 455 479 456 - *data = (buf[1] << 8) | buf[0]; 480 + *data = (pdev->ctrl_buf[1] << 8) | pdev->ctrl_buf[0]; 457 481 return 0; 458 482 } 459 483 460 484 int pwc_set_u16_ctrl(struct pwc_device *pdev, u8 request, u16 value, u16 data) 461 485 { 462 486 int ret; 463 - u8 buf[2]; 464 487 465 - buf[0] = data & 0xff; 466 - buf[1] = data >> 8; 467 - ret = send_control_msg(pdev, request, value, buf, sizeof(buf)); 488 + pdev->ctrl_buf[0] = data & 0xff; 489 + pdev->ctrl_buf[1] = data >> 8; 490 + ret = send_control_msg(pdev, request, value, pdev->ctrl_buf, 2); 468 491 if (ret < 0) 469 492 return ret; 470 493 ··· 482 511 /* POWER */ 483 512 void pwc_camera_power(struct pwc_device *pdev, int power) 484 513 { 485 - char buf; 486 514 int r; 487 515 488 516 if (!pdev->power_save) ··· 491 521 return; /* Not supported by Nala or Timon < release 6 */ 492 522 493 523 if (power) 494 - buf = 0x00; /* active */ 524 + pdev->ctrl_buf[0] = 0x00; /* active */ 495 525 else 496 - buf = 0xFF; /* power save */ 497 - r = send_control_msg(pdev, 498 - SET_STATUS_CTL, SET_POWER_SAVE_MODE_FORMATTER, 499 - &buf, sizeof(buf)); 500 - 526 + pdev->ctrl_buf[0] = 0xFF; /* power save */ 527 + r = send_control_msg(pdev, SET_STATUS_CTL, 528 + SET_POWER_SAVE_MODE_FORMATTER, pdev->ctrl_buf, 1); 501 529 if (r < 0) 502 530 PWC_ERROR("Failed to power %s camera (%d)\n", 503 531 power ? "on" : "off", r); ··· 503 535 504 536 int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) 505 537 { 506 - unsigned char buf[2]; 507 538 int r; 508 539 509 540 if (pdev->type < 730) ··· 518 551 if (off_value > 0xff) 519 552 off_value = 0xff; 520 553 521 - buf[0] = on_value; 522 - buf[1] = off_value; 554 + pdev->ctrl_buf[0] = on_value; 555 + pdev->ctrl_buf[1] = off_value; 523 556 524 557 r = send_control_msg(pdev, 525 - SET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf)); 558 + SET_STATUS_CTL, LED_FORMATTER, pdev->ctrl_buf, 2); 526 559 if (r < 0) 527 560 PWC_ERROR("Failed to set LED on/off time (%d)\n", r); 528 561 ··· 532 565 #ifdef CONFIG_USB_PWC_DEBUG 533 566 int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) 534 567 { 535 - unsigned char buf; 536 568 int ret = -1, request; 537 569 538 570 if (pdev->type < 675) ··· 541 575 else 542 576 request = SENSOR_TYPE_FORMATTER2; 543 577 544 - ret = recv_control_msg(pdev, 545 - GET_STATUS_CTL, request, &buf, sizeof(buf)); 578 + ret = recv_control_msg(pdev, GET_STATUS_CTL, request, 1); 546 579 if (ret < 0) 547 580 return ret; 548 581 if (pdev->type < 675) 549 - *sensor = buf | 0x100; 582 + *sensor = pdev->ctrl_buf[0] | 0x100; 550 583 else 551 - *sensor = buf; 584 + *sensor = pdev->ctrl_buf[0]; 552 585 return 0; 553 586 } 554 587 #endif
+4 -12
drivers/media/video/pwc/pwc-dec1.c
··· 22 22 along with this program; if not, write to the Free Software 23 23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 24 */ 25 - #include "pwc-dec1.h" 25 + #include "pwc.h" 26 26 27 - int pwc_dec1_init(struct pwc_device *pwc, int type, int release, void *buffer) 27 + void pwc_dec1_init(struct pwc_device *pdev, const unsigned char *cmd) 28 28 { 29 - struct pwc_dec1_private *pdec; 29 + struct pwc_dec1_private *pdec = &pdev->dec1; 30 30 31 - if (pwc->decompress_data == NULL) { 32 - pdec = kmalloc(sizeof(struct pwc_dec1_private), GFP_KERNEL); 33 - if (pdec == NULL) 34 - return -ENOMEM; 35 - pwc->decompress_data = pdec; 36 - } 37 - pdec = pwc->decompress_data; 38 - 39 - return 0; 31 + pdec->version = pdev->release; 40 32 }
+4 -2
drivers/media/video/pwc/pwc-dec1.h
··· 25 25 #ifndef PWC_DEC1_H 26 26 #define PWC_DEC1_H 27 27 28 - #include "pwc.h" 28 + #include <linux/mutex.h> 29 + 30 + struct pwc_device; 29 31 30 32 struct pwc_dec1_private 31 33 { 32 34 int version; 33 35 }; 34 36 35 - int pwc_dec1_init(struct pwc_device *pwc, int type, int release, void *buffer); 37 + void pwc_dec1_init(struct pwc_device *pdev, const unsigned char *cmd); 36 38 37 39 #endif
+18 -23
drivers/media/video/pwc/pwc-dec23.c
··· 294 294 295 295 296 296 /* If the type or the command change, we rebuild the lookup table */ 297 - int pwc_dec23_init(struct pwc_device *pwc, int type, unsigned char *cmd) 297 + void pwc_dec23_init(struct pwc_device *pdev, const unsigned char *cmd) 298 298 { 299 299 int flags, version, shift, i; 300 - struct pwc_dec23_private *pdec; 301 - 302 - if (pwc->decompress_data == NULL) { 303 - pdec = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); 304 - if (pdec == NULL) 305 - return -ENOMEM; 306 - pwc->decompress_data = pdec; 307 - } 308 - pdec = pwc->decompress_data; 300 + struct pwc_dec23_private *pdec = &pdev->dec23; 309 301 310 302 mutex_init(&pdec->lock); 311 303 312 - if (DEVICE_USE_CODEC3(type)) { 304 + if (pdec->last_cmd_valid && pdec->last_cmd == cmd[2]) 305 + return; 306 + 307 + if (DEVICE_USE_CODEC3(pdev->type)) { 313 308 flags = cmd[2] & 0x18; 314 309 if (flags == 8) 315 310 pdec->nbits = 7; /* More bits, mean more bits to encode the stream, but better quality */ ··· 351 356 pwc_crop_table[MAX_OUTER_CROP_VALUE+256+i] = 255; 352 357 #endif 353 358 354 - return 0; 359 + pdec->last_cmd = cmd[2]; 360 + pdec->last_cmd_valid = 1; 355 361 } 356 362 357 363 /* ··· 655 659 * src: raw data 656 660 * dst: image output 657 661 */ 658 - void pwc_dec23_decompress(const struct pwc_device *pwc, 662 + void pwc_dec23_decompress(struct pwc_device *pdev, 659 663 const void *src, 660 664 void *dst) 661 665 { 662 666 int bandlines_left, bytes_per_block; 663 - struct pwc_dec23_private *pdec = pwc->decompress_data; 667 + struct pwc_dec23_private *pdec = &pdev->dec23; 664 668 665 669 /* YUV420P image format */ 666 670 unsigned char *pout_planar_y; ··· 670 674 671 675 mutex_lock(&pdec->lock); 672 676 673 - bandlines_left = pwc->height / 4; 674 - bytes_per_block = pwc->width * 4; 675 - plane_size = pwc->height * pwc->width; 677 + bandlines_left = pdev->height / 4; 678 + bytes_per_block = pdev->width * 4; 679 + plane_size = pdev->height * pdev->width; 676 680 677 681 pout_planar_y = dst; 678 682 pout_planar_u = dst + plane_size; 679 683 pout_planar_v = dst + plane_size + plane_size / 4; 680 684 681 685 while (bandlines_left--) { 682 - DecompressBand23(pwc->decompress_data, 683 - src, 686 + DecompressBand23(pdec, src, 684 687 pout_planar_y, pout_planar_u, pout_planar_v, 685 - pwc->width, pwc->width); 686 - src += pwc->vbandlength; 688 + pdev->width, pdev->width); 689 + src += pdev->vbandlength; 687 690 pout_planar_y += bytes_per_block; 688 - pout_planar_u += pwc->width; 689 - pout_planar_v += pwc->width; 691 + pout_planar_u += pdev->width; 692 + pout_planar_v += pdev->width; 690 693 } 691 694 mutex_unlock(&pdec->lock); 692 695 }
+6 -3
drivers/media/video/pwc/pwc-dec23.h
··· 25 25 #ifndef PWC_DEC23_H 26 26 #define PWC_DEC23_H 27 27 28 - #include "pwc.h" 28 + struct pwc_device; 29 29 30 30 struct pwc_dec23_private 31 31 { 32 32 struct mutex lock; 33 + 34 + unsigned char last_cmd, last_cmd_valid; 33 35 34 36 unsigned int scalebits; 35 37 unsigned int nbitsmask, nbits; /* Number of bits of a color in the compressed stream */ 36 38 37 39 unsigned int reservoir; 38 40 unsigned int nbits_in_reservoir; 41 + 39 42 const unsigned char *stream; 40 43 int temp_colors[16]; 41 44 ··· 54 51 55 52 }; 56 53 57 - int pwc_dec23_init(struct pwc_device *pwc, int type, unsigned char *cmd); 58 - void pwc_dec23_decompress(const struct pwc_device *pwc, 54 + void pwc_dec23_init(struct pwc_device *pdev, const unsigned char *cmd); 55 + void pwc_dec23_decompress(struct pwc_device *pdev, 59 56 const void *src, 60 57 void *dst); 61 58 #endif
+16 -159
drivers/media/video/pwc/pwc-if.c
··· 128 128 #define MAX_DEV_HINTS 20 129 129 #define MAX_ISOC_ERRORS 20 130 130 131 - static int default_fps = 10; 132 131 #ifdef CONFIG_USB_PWC_DEBUG 133 132 int pwc_trace = PWC_DEBUG_LEVEL; 134 133 #endif 135 134 static int power_save = -1; 136 - static int led_on = 100, led_off; /* defaults to LED that is on while in use */ 137 - static struct { 138 - int type; 139 - char serial_number[30]; 140 - int device_node; 141 - struct pwc_device *pdev; 142 - } device_hint[MAX_DEV_HINTS]; 135 + static int leds[2] = { 100, 0 }; 143 136 144 137 /***/ 145 138 ··· 379 386 retry: 380 387 /* We first try with low compression and then retry with a higher 381 388 compression setting if there is not enough bandwidth. */ 382 - ret = pwc_set_video_mode(pdev, pdev->width, pdev->height, 383 - pdev->vframes, &compression); 389 + ret = pwc_set_video_mode(pdev, pdev->width, pdev->height, pdev->pixfmt, 390 + pdev->vframes, &compression, 1); 384 391 385 392 /* Get the current alternate interface, adjust packet size */ 386 393 intf = usb_ifnum_to_if(udev, 0); ··· 590 597 static void pwc_video_release(struct v4l2_device *v) 591 598 { 592 599 struct pwc_device *pdev = container_of(v, struct pwc_device, v4l2_dev); 593 - int hint; 594 - 595 - /* search device_hint[] table if we occupy a slot, by any chance */ 596 - for (hint = 0; hint < MAX_DEV_HINTS; hint++) 597 - if (device_hint[hint].pdev == pdev) 598 - device_hint[hint].pdev = NULL; 599 - 600 - /* Free intermediate decompression buffer & tables */ 601 - if (pdev->decompress_data != NULL) { 602 - PWC_DEBUG_MEMORY("Freeing decompression buffer at %p.\n", 603 - pdev->decompress_data); 604 - kfree(pdev->decompress_data); 605 - pdev->decompress_data = NULL; 606 - } 607 600 608 601 v4l2_ctrl_handler_free(&pdev->ctrl_handler); 609 - 602 + kfree(pdev->ctrl_buf); 610 603 kfree(pdev); 611 604 } 612 605 ··· 737 758 738 759 /* Turn on camera and set LEDS on */ 739 760 pwc_camera_power(pdev, 1); 740 - pwc_set_leds(pdev, led_on, led_off); 761 + pwc_set_leds(pdev, leds[0], leds[1]); 741 762 742 763 r = pwc_isoc_init(pdev); 743 764 if (r) { ··· 792 813 struct usb_device *udev = interface_to_usbdev(intf); 793 814 struct pwc_device *pdev = NULL; 794 815 int vendor_id, product_id, type_id; 795 - int hint, rc; 816 + int rc; 796 817 int features = 0; 797 818 int compression = 0; 798 - int video_nr = -1; /* default: use next available device */ 799 819 int my_power_save = power_save; 800 820 char serial_number[30], *name; 801 821 ··· 1054 1076 return -ENOMEM; 1055 1077 } 1056 1078 pdev->type = type_id; 1057 - pdev->vframes = default_fps; 1058 1079 pdev->features = features; 1059 1080 pwc_construct(pdev); /* set min/max sizes correct */ 1060 1081 ··· 1084 1107 pdev->release = le16_to_cpu(udev->descriptor.bcdDevice); 1085 1108 PWC_DEBUG_PROBE("Release: %04x\n", pdev->release); 1086 1109 1087 - /* Now search device_hint[] table for a match, so we can hint a node number. */ 1088 - for (hint = 0; hint < MAX_DEV_HINTS; hint++) { 1089 - if (((device_hint[hint].type == -1) || (device_hint[hint].type == pdev->type)) && 1090 - (device_hint[hint].pdev == NULL)) { 1091 - /* so far, so good... try serial number */ 1092 - if ((device_hint[hint].serial_number[0] == '*') || !strcmp(device_hint[hint].serial_number, serial_number)) { 1093 - /* match! */ 1094 - video_nr = device_hint[hint].device_node; 1095 - PWC_DEBUG_PROBE("Found hint, will try to register as /dev/video%d\n", video_nr); 1096 - break; 1097 - } 1098 - } 1110 + /* Allocate USB command buffers */ 1111 + pdev->ctrl_buf = kmalloc(sizeof(pdev->cmd_buf), GFP_KERNEL); 1112 + if (!pdev->ctrl_buf) { 1113 + PWC_ERROR("Oops, could not allocate memory for pwc_device.\n"); 1114 + rc = -ENOMEM; 1115 + goto err_free_mem; 1099 1116 } 1100 - 1101 - /* occupy slot */ 1102 - if (hint < MAX_DEV_HINTS) 1103 - device_hint[hint].pdev = pdev; 1104 1117 1105 1118 #ifdef CONFIG_USB_PWC_DEBUG 1106 1119 /* Query sensor type */ ··· 1105 1138 pwc_set_leds(pdev, 0, 0); 1106 1139 1107 1140 /* Setup intial videomode */ 1108 - rc = pwc_set_video_mode(pdev, MAX_WIDTH, MAX_HEIGHT, pdev->vframes, 1109 - &compression); 1141 + rc = pwc_set_video_mode(pdev, MAX_WIDTH, MAX_HEIGHT, 1142 + V4L2_PIX_FMT_YUV420, 30, &compression, 1); 1110 1143 if (rc) 1111 1144 goto err_free_mem; 1112 1145 ··· 1131 1164 pdev->v4l2_dev.ctrl_handler = &pdev->ctrl_handler; 1132 1165 pdev->vdev.v4l2_dev = &pdev->v4l2_dev; 1133 1166 1134 - rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr); 1167 + rc = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, -1); 1135 1168 if (rc < 0) { 1136 1169 PWC_ERROR("Failed to register as video device (%d).\n", rc); 1137 1170 goto err_unregister_v4l2_dev; ··· 1174 1207 err_free_controls: 1175 1208 v4l2_ctrl_handler_free(&pdev->ctrl_handler); 1176 1209 err_free_mem: 1177 - if (hint < MAX_DEV_HINTS) 1178 - device_hint[hint].pdev = NULL; 1210 + kfree(pdev->ctrl_buf); 1179 1211 kfree(pdev); 1180 1212 return rc; 1181 1213 } ··· 1209 1243 * Initialization code & module stuff 1210 1244 */ 1211 1245 1212 - static int fps; 1213 - static int leds[2] = { -1, -1 }; 1214 1246 static unsigned int leds_nargs; 1215 - static char *dev_hint[MAX_DEV_HINTS]; 1216 - static unsigned int dev_hint_nargs; 1217 1247 1218 - module_param(fps, int, 0444); 1219 1248 #ifdef CONFIG_USB_PWC_DEBUG 1220 1249 module_param_named(trace, pwc_trace, int, 0644); 1221 1250 #endif 1222 1251 module_param(power_save, int, 0644); 1223 1252 module_param_array(leds, int, &leds_nargs, 0444); 1224 - module_param_array(dev_hint, charp, &dev_hint_nargs, 0444); 1225 1253 1226 - MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30"); 1227 1254 #ifdef CONFIG_USB_PWC_DEBUG 1228 1255 MODULE_PARM_DESC(trace, "For debugging purposes"); 1229 1256 #endif 1230 1257 MODULE_PARM_DESC(power_save, "Turn power saving for new cameras on or off"); 1231 1258 MODULE_PARM_DESC(leds, "LED on,off time in milliseconds"); 1232 - MODULE_PARM_DESC(dev_hint, "Device node hints"); 1233 1259 1234 1260 MODULE_DESCRIPTION("Philips & OEM USB webcam driver"); 1235 1261 MODULE_AUTHOR("Luc Saillard <luc@saillard.org>"); ··· 1231 1273 1232 1274 static int __init usb_pwc_init(void) 1233 1275 { 1234 - int i; 1235 - 1236 - #ifdef CONFIG_USB_PWC_DEBUG 1237 - PWC_INFO("Philips webcam module version " PWC_VERSION " loaded.\n"); 1238 - PWC_INFO("Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.\n"); 1239 - PWC_INFO("Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,\n"); 1240 - PWC_INFO("the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n"); 1241 - 1242 - if (pwc_trace >= 0) { 1243 - PWC_DEBUG_MODULE("Trace options: 0x%04x\n", pwc_trace); 1244 - } 1245 - #endif 1246 - 1247 - if (fps) { 1248 - if (fps < 4 || fps > 30) { 1249 - PWC_ERROR("Framerate out of bounds (4-30).\n"); 1250 - return -EINVAL; 1251 - } 1252 - default_fps = fps; 1253 - PWC_DEBUG_MODULE("Default framerate set to %d.\n", default_fps); 1254 - } 1255 - 1256 - if (leds[0] >= 0) 1257 - led_on = leds[0]; 1258 - if (leds[1] >= 0) 1259 - led_off = leds[1]; 1260 - 1261 - /* Big device node whoopla. Basically, it allows you to assign a 1262 - device node (/dev/videoX) to a camera, based on its type 1263 - & serial number. The format is [type[.serialnumber]:]node. 1264 - 1265 - Any camera that isn't matched by these rules gets the next 1266 - available free device node. 1267 - */ 1268 - for (i = 0; i < MAX_DEV_HINTS; i++) { 1269 - char *s, *colon, *dot; 1270 - 1271 - /* This loop also initializes the array */ 1272 - device_hint[i].pdev = NULL; 1273 - s = dev_hint[i]; 1274 - if (s != NULL && *s != '\0') { 1275 - device_hint[i].type = -1; /* wildcard */ 1276 - strcpy(device_hint[i].serial_number, "*"); 1277 - 1278 - /* parse string: chop at ':' & '/' */ 1279 - colon = dot = s; 1280 - while (*colon != '\0' && *colon != ':') 1281 - colon++; 1282 - while (*dot != '\0' && *dot != '.') 1283 - dot++; 1284 - /* Few sanity checks */ 1285 - if (*dot != '\0' && dot > colon) { 1286 - PWC_ERROR("Malformed camera hint: the colon must be after the dot.\n"); 1287 - return -EINVAL; 1288 - } 1289 - 1290 - if (*colon == '\0') { 1291 - /* No colon */ 1292 - if (*dot != '\0') { 1293 - PWC_ERROR("Malformed camera hint: no colon + device node given.\n"); 1294 - return -EINVAL; 1295 - } 1296 - else { 1297 - /* No type or serial number specified, just a number. */ 1298 - device_hint[i].device_node = 1299 - simple_strtol(s, NULL, 10); 1300 - } 1301 - } 1302 - else { 1303 - /* There's a colon, so we have at least a type and a device node */ 1304 - device_hint[i].type = 1305 - simple_strtol(s, NULL, 10); 1306 - device_hint[i].device_node = 1307 - simple_strtol(colon + 1, NULL, 10); 1308 - if (*dot != '\0') { 1309 - /* There's a serial number as well */ 1310 - int k; 1311 - 1312 - dot++; 1313 - k = 0; 1314 - while (*dot != ':' && k < 29) { 1315 - device_hint[i].serial_number[k++] = *dot; 1316 - dot++; 1317 - } 1318 - device_hint[i].serial_number[k] = '\0'; 1319 - } 1320 - } 1321 - PWC_TRACE("device_hint[%d]:\n", i); 1322 - PWC_TRACE(" type : %d\n", device_hint[i].type); 1323 - PWC_TRACE(" serial# : %s\n", device_hint[i].serial_number); 1324 - PWC_TRACE(" node : %d\n", device_hint[i].device_node); 1325 - } 1326 - else 1327 - device_hint[i].type = 0; /* not filled */ 1328 - } /* ..for MAX_DEV_HINTS */ 1329 - 1330 - PWC_DEBUG_PROBE("Registering driver at address 0x%p.\n", &pwc_driver); 1331 1276 return usb_register(&pwc_driver); 1332 1277 } 1333 1278 1334 1279 static void __exit usb_pwc_exit(void) 1335 1280 { 1336 - PWC_DEBUG_MODULE("Deregistering driver.\n"); 1337 1281 usb_deregister(&pwc_driver); 1338 - PWC_INFO("Philips webcam module removed.\n"); 1339 1282 } 1340 1283 1341 1284 module_init(usb_pwc_init); 1342 1285 module_exit(usb_pwc_exit); 1343 - 1344 - /* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */
-1
drivers/media/video/pwc/pwc-misc.c
··· 90 90 pdev->frame_header_size = 0; 91 91 pdev->frame_trailer_size = 0; 92 92 } 93 - pdev->pixfmt = V4L2_PIX_FMT_YUV420; /* default */ 94 93 }
+72 -18
drivers/media/video/pwc/pwc-v4l.c
··· 493 493 (pixelformat>>24)&255); 494 494 495 495 ret = pwc_set_video_mode(pdev, f->fmt.pix.width, f->fmt.pix.height, 496 - pdev->vframes, &compression); 496 + pixelformat, 30, &compression, 0); 497 497 498 498 PWC_DEBUG_IOCTL("pwc_set_video_mode(), return=%d\n", ret); 499 499 500 - if (ret == 0) { 501 - pdev->pixfmt = pixelformat; 502 - pwc_vidioc_fill_fmt(f, pdev->width, pdev->height, 503 - pdev->pixfmt); 504 - } 505 - 500 + pwc_vidioc_fill_fmt(f, pdev->width, pdev->height, pdev->pixfmt); 506 501 leave: 507 502 mutex_unlock(&pdev->udevlock); 508 503 return ret; ··· 772 777 static int pwc_set_motor(struct pwc_device *pdev) 773 778 { 774 779 int ret; 775 - u8 buf[4]; 776 780 777 - buf[0] = 0; 781 + pdev->ctrl_buf[0] = 0; 778 782 if (pdev->motor_pan_reset->is_new) 779 - buf[0] |= 0x01; 783 + pdev->ctrl_buf[0] |= 0x01; 780 784 if (pdev->motor_tilt_reset->is_new) 781 - buf[0] |= 0x02; 785 + pdev->ctrl_buf[0] |= 0x02; 782 786 if (pdev->motor_pan_reset->is_new || pdev->motor_tilt_reset->is_new) { 783 787 ret = send_control_msg(pdev, SET_MPT_CTL, 784 - PT_RESET_CONTROL_FORMATTER, buf, 1); 788 + PT_RESET_CONTROL_FORMATTER, 789 + pdev->ctrl_buf, 1); 785 790 if (ret < 0) 786 791 return ret; 787 792 } 788 793 789 - memset(buf, 0, sizeof(buf)); 794 + memset(pdev->ctrl_buf, 0, 4); 790 795 if (pdev->motor_pan->is_new) { 791 - buf[0] = pdev->motor_pan->val & 0xFF; 792 - buf[1] = (pdev->motor_pan->val >> 8); 796 + pdev->ctrl_buf[0] = pdev->motor_pan->val & 0xFF; 797 + pdev->ctrl_buf[1] = (pdev->motor_pan->val >> 8); 793 798 } 794 799 if (pdev->motor_tilt->is_new) { 795 - buf[2] = pdev->motor_tilt->val & 0xFF; 796 - buf[3] = (pdev->motor_tilt->val >> 8); 800 + pdev->ctrl_buf[2] = pdev->motor_tilt->val & 0xFF; 801 + pdev->ctrl_buf[3] = (pdev->motor_tilt->val >> 8); 797 802 } 798 803 if (pdev->motor_pan->is_new || pdev->motor_tilt->is_new) { 799 804 ret = send_control_msg(pdev, SET_MPT_CTL, 800 805 PT_RELATIVE_CONTROL_FORMATTER, 801 - buf, sizeof(buf)); 806 + pdev->ctrl_buf, 4); 802 807 if (ret < 0) 803 808 return ret; 804 809 } ··· 1089 1094 return 0; 1090 1095 } 1091 1096 1097 + static int pwc_g_parm(struct file *file, void *fh, 1098 + struct v4l2_streamparm *parm) 1099 + { 1100 + struct pwc_device *pdev = video_drvdata(file); 1101 + 1102 + if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1103 + return -EINVAL; 1104 + 1105 + memset(parm, 0, sizeof(*parm)); 1106 + 1107 + parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1108 + parm->parm.capture.readbuffers = MIN_FRAMES; 1109 + parm->parm.capture.capability |= V4L2_CAP_TIMEPERFRAME; 1110 + parm->parm.capture.timeperframe.denominator = pdev->vframes; 1111 + parm->parm.capture.timeperframe.numerator = 1; 1112 + 1113 + return 0; 1114 + } 1115 + 1116 + static int pwc_s_parm(struct file *file, void *fh, 1117 + struct v4l2_streamparm *parm) 1118 + { 1119 + struct pwc_device *pdev = video_drvdata(file); 1120 + int compression = 0; 1121 + int ret, fps; 1122 + 1123 + if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || 1124 + parm->parm.capture.timeperframe.numerator == 0) 1125 + return -EINVAL; 1126 + 1127 + if (pwc_test_n_set_capt_file(pdev, file)) 1128 + return -EBUSY; 1129 + 1130 + fps = parm->parm.capture.timeperframe.denominator / 1131 + parm->parm.capture.timeperframe.numerator; 1132 + 1133 + mutex_lock(&pdev->udevlock); 1134 + if (!pdev->udev) { 1135 + ret = -ENODEV; 1136 + goto leave; 1137 + } 1138 + 1139 + if (pdev->iso_init) { 1140 + ret = -EBUSY; 1141 + goto leave; 1142 + } 1143 + 1144 + ret = pwc_set_video_mode(pdev, pdev->width, pdev->height, pdev->pixfmt, 1145 + fps, &compression, 0); 1146 + 1147 + pwc_g_parm(file, fh, parm); 1148 + 1149 + leave: 1150 + mutex_unlock(&pdev->udevlock); 1151 + return ret; 1152 + } 1153 + 1092 1154 static int pwc_log_status(struct file *file, void *priv) 1093 1155 { 1094 1156 struct pwc_device *pdev = video_drvdata(file); ··· 1172 1120 .vidioc_log_status = pwc_log_status, 1173 1121 .vidioc_enum_framesizes = pwc_enum_framesizes, 1174 1122 .vidioc_enum_frameintervals = pwc_enum_frameintervals, 1123 + .vidioc_g_parm = pwc_g_parm, 1124 + .vidioc_s_parm = pwc_s_parm, 1175 1125 };
+8 -6
drivers/media/video/pwc/pwc.h
··· 44 44 #ifdef CONFIG_USB_PWC_INPUT_EVDEV 45 45 #include <linux/input.h> 46 46 #endif 47 + #include "pwc-dec1.h" 48 + #include "pwc-dec23.h" 47 49 48 50 /* Version block */ 49 51 #define PWC_VERSION "10.0.15" ··· 133 131 #define DEVICE_USE_CODEC2(x) ((x)>=675 && (x)<700) 134 132 #define DEVICE_USE_CODEC3(x) ((x)>=700) 135 133 #define DEVICE_USE_CODEC23(x) ((x)>=675) 136 - 137 - /* from pwc-dec.h */ 138 - #define PWCX_FLAG_PLANAR 0x0001 139 134 140 135 /* Request types: video */ 141 136 #define SET_LUM_CTL 0x01 ··· 247 248 char vmirror; /* for ToUCaM series */ 248 249 char power_save; /* Do powersaving for this cam */ 249 250 250 - int cmd_len; 251 251 unsigned char cmd_buf[13]; 252 + unsigned char *ctrl_buf; 252 253 253 254 struct urb *urbs[MAX_ISO_BUFS]; 254 255 char iso_init; ··· 271 272 int frame_total_size; /* including header & trailer */ 272 273 int drop_frames; 273 274 274 - void *decompress_data; /* private data for decompression engine */ 275 + union { /* private data for decompression engine */ 276 + struct pwc_dec1_private dec1; 277 + struct pwc_dec23_private dec23; 278 + }; 275 279 276 280 /* 277 281 * We have an 'image' and a 'view', where 'image' is the fixed-size img ··· 366 364 /** Functions in pwc-ctrl.c */ 367 365 /* Request a certain video mode. Returns < 0 if not possible */ 368 366 extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, 369 - int frames, int *compression); 367 + int pixfmt, int frames, int *compression, int send_to_cam); 370 368 extern unsigned int pwc_get_fps(struct pwc_device *pdev, unsigned int index, unsigned int size); 371 369 extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value); 372 370 extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor);
+4 -3
drivers/media/video/s5p-fimc/fimc-capture.c
··· 693 693 mf->code = 0; 694 694 continue; 695 695 } 696 - if (mf->width != tfmt->width || mf->width != tfmt->width) { 696 + if (mf->width != tfmt->width || mf->height != tfmt->height) { 697 697 u32 fcc = ffmt->fourcc; 698 698 tfmt->width = mf->width; 699 699 tfmt->height = mf->height; ··· 702 702 NULL, &fcc, FIMC_SD_PAD_SOURCE); 703 703 if (ffmt && ffmt->mbus_code) 704 704 mf->code = ffmt->mbus_code; 705 - if (mf->width != tfmt->width || mf->width != tfmt->width) 705 + if (mf->width != tfmt->width || 706 + mf->height != tfmt->height) 706 707 continue; 707 708 tfmt->code = mf->code; 708 709 } ··· 711 710 ret = v4l2_subdev_call(csis, pad, set_fmt, NULL, &sfmt); 712 711 713 712 if (mf->code == tfmt->code && 714 - mf->width == tfmt->width && mf->width == tfmt->width) 713 + mf->width == tfmt->width && mf->height == tfmt->height) 715 714 break; 716 715 } 717 716
+3 -3
drivers/media/video/s5p-fimc/fimc-core.c
··· 848 848 v4l2_ctrl_handler_init(&ctx->ctrl_handler, 4); 849 849 850 850 ctx->ctrl_rotate = v4l2_ctrl_new_std(&ctx->ctrl_handler, &fimc_ctrl_ops, 851 - V4L2_CID_HFLIP, 0, 1, 1, 0); 851 + V4L2_CID_ROTATE, 0, 270, 90, 0); 852 852 ctx->ctrl_hflip = v4l2_ctrl_new_std(&ctx->ctrl_handler, &fimc_ctrl_ops, 853 - V4L2_CID_VFLIP, 0, 1, 1, 0); 853 + V4L2_CID_HFLIP, 0, 1, 1, 0); 854 854 ctx->ctrl_vflip = v4l2_ctrl_new_std(&ctx->ctrl_handler, &fimc_ctrl_ops, 855 - V4L2_CID_ROTATE, 0, 270, 90, 0); 855 + V4L2_CID_VFLIP, 0, 1, 1, 0); 856 856 if (variant->has_alpha) 857 857 ctx->ctrl_alpha = v4l2_ctrl_new_std(&ctx->ctrl_handler, 858 858 &fimc_ctrl_ops, V4L2_CID_ALPHA_COMPONENT,
-1
drivers/media/video/s5p-fimc/fimc-mdevice.c
··· 21 21 #include <linux/pm_runtime.h> 22 22 #include <linux/types.h> 23 23 #include <linux/slab.h> 24 - #include <linux/version.h> 25 24 #include <media/v4l2-ctrls.h> 26 25 #include <media/media-device.h> 27 26
+1
drivers/media/video/s5p-g2d/g2d.c
··· 184 184 ctx->rop = ROP4_INVERT; 185 185 else 186 186 ctx->rop = ROP4_COPY; 187 + break; 187 188 default: 188 189 v4l2_err(&ctx->dev->v4l2_dev, "unknown control\n"); 189 190 return -EINVAL;
+4 -3
drivers/media/video/s5p-jpeg/jpeg-core.c
··· 989 989 * ============================================================================ 990 990 */ 991 991 992 - static int s5p_jpeg_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, 993 - unsigned int *nplanes, unsigned int sizes[], 994 - void *alloc_ctxs[]) 992 + static int s5p_jpeg_queue_setup(struct vb2_queue *vq, 993 + const struct v4l2_format *fmt, 994 + unsigned int *nbuffers, unsigned int *nplanes, 995 + unsigned int sizes[], void *alloc_ctxs[]) 995 996 { 996 997 struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(vq); 997 998 struct s5p_jpeg_q_data *q_data = NULL;
+1 -2
drivers/media/video/s5p-mfc/s5p_mfc.c
··· 18 18 #include <linux/platform_device.h> 19 19 #include <linux/sched.h> 20 20 #include <linux/slab.h> 21 - #include <linux/version.h> 22 21 #include <linux/videodev2.h> 23 22 #include <linux/workqueue.h> 24 23 #include <media/videobuf2-core.h> ··· 474 475 ctx->mv_size = 0; 475 476 } 476 477 ctx->dpb_count = s5p_mfc_get_dpb_count(); 477 - if (ctx->img_width == 0 || ctx->img_width == 0) 478 + if (ctx->img_width == 0 || ctx->img_height == 0) 478 479 ctx->state = MFCINST_ERROR; 479 480 else 480 481 ctx->state = MFCINST_HEAD_PARSED;
+1 -1
drivers/media/video/s5p-mfc/s5p_mfc_dec.c
··· 165 165 .maximum = 32, 166 166 .step = 1, 167 167 .default_value = 1, 168 - .flags = V4L2_CTRL_FLAG_VOLATILE, 168 + .is_volatile = 1, 169 169 }, 170 170 }; 171 171
-4
drivers/media/video/saa7164/saa7164-cards.c
··· 269 269 .portb = SAA7164_MPEG_DVB, 270 270 .portc = SAA7164_MPEG_ENCODER, 271 271 .portd = SAA7164_MPEG_ENCODER, 272 - .portc = SAA7164_MPEG_ENCODER, 273 - .portd = SAA7164_MPEG_ENCODER, 274 272 .porte = SAA7164_MPEG_VBI, 275 273 .portf = SAA7164_MPEG_VBI, 276 274 .chiprev = SAA7164_CHIP_REV3, ··· 329 331 .portb = SAA7164_MPEG_DVB, 330 332 .portc = SAA7164_MPEG_ENCODER, 331 333 .portd = SAA7164_MPEG_ENCODER, 332 - .porte = SAA7164_MPEG_VBI, 333 - .portf = SAA7164_MPEG_VBI, 334 334 .porte = SAA7164_MPEG_VBI, 335 335 .portf = SAA7164_MPEG_VBI, 336 336 .chiprev = SAA7164_CHIP_REV3,
+2 -2
drivers/media/video/tlg2300/pd-main.c
··· 374 374 } 375 375 #endif 376 376 377 - static bool check_firmware(struct usb_device *udev, int *down_firmware) 377 + static int check_firmware(struct usb_device *udev, int *down_firmware) 378 378 { 379 379 void *buf; 380 380 int ret; ··· 398 398 *down_firmware = 1; 399 399 return firmware_download(udev); 400 400 } 401 - return ret; 401 + return 0; 402 402 } 403 403 404 404 static int poseidon_probe(struct usb_interface *interface,
+27 -27
drivers/media/video/v4l2-ctrls.c
··· 465 465 case V4L2_CID_CHROMA_GAIN: return "Chroma Gain"; 466 466 case V4L2_CID_ILLUMINATORS_1: return "Illuminator 1"; 467 467 case V4L2_CID_ILLUMINATORS_2: return "Illuminator 2"; 468 - case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: return "Minimum Number of Capture Buffers"; 469 - case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: return "Minimum Number of Output Buffers"; 468 + case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: return "Min Number of Capture Buffers"; 469 + case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: return "Min Number of Output Buffers"; 470 470 case V4L2_CID_ALPHA_COMPONENT: return "Alpha Component"; 471 471 472 472 /* MPEG controls */ ··· 506 506 case V4L2_CID_MPEG_VIDEO_MUTE_YUV: return "Video Mute YUV"; 507 507 case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: return "Decoder Slice Interface"; 508 508 case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: return "MPEG4 Loop Filter Enable"; 509 - case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "The Number of Intra Refresh MBs"; 509 + case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "Number of Intra Refresh MBs"; 510 510 case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: return "Frame Level Rate Control Enable"; 511 511 case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control"; 512 512 case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return "Sequence Header Mode"; 513 - case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "The Max Number of Reference Picture"; 513 + case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "Max Number of Reference Pics"; 514 514 case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP: return "H263 I-Frame QP Value"; 515 - case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P frame QP Value"; 516 - case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B frame QP Value"; 515 + case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P-Frame QP Value"; 516 + case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B-Frame QP Value"; 517 517 case V4L2_CID_MPEG_VIDEO_H263_MIN_QP: return "H263 Minimum QP Value"; 518 518 case V4L2_CID_MPEG_VIDEO_H263_MAX_QP: return "H263 Maximum QP Value"; 519 519 case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP: return "H264 I-Frame QP Value"; 520 - case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP: return "H264 P frame QP Value"; 521 - case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP: return "H264 B frame QP Value"; 520 + case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP: return "H264 P-Frame QP Value"; 521 + case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP: return "H264 B-Frame QP Value"; 522 522 case V4L2_CID_MPEG_VIDEO_H264_MAX_QP: return "H264 Maximum QP Value"; 523 523 case V4L2_CID_MPEG_VIDEO_H264_MIN_QP: return "H264 Minimum QP Value"; 524 524 case V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM: return "H264 8x8 Transform Enable"; 525 525 case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE: return "H264 CPB Buffer Size"; 526 - case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: return "H264 Entorpy Mode"; 527 - case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD: return "H264 I Period"; 526 + case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: return "H264 Entropy Mode"; 527 + case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD: return "H264 I-Frame Period"; 528 528 case V4L2_CID_MPEG_VIDEO_H264_LEVEL: return "H264 Level"; 529 529 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA: return "H264 Loop Filter Alpha Offset"; 530 530 case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA: return "H264 Loop Filter Beta Offset"; ··· 535 535 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: return "Aspect Ratio VUI Enable"; 536 536 case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC: return "VUI Aspect Ratio IDC"; 537 537 case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP: return "MPEG4 I-Frame QP Value"; 538 - case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP: return "MPEG4 P frame QP Value"; 539 - case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP: return "MPEG4 B frame QP Value"; 538 + case V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP: return "MPEG4 P-Frame QP Value"; 539 + case V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP: return "MPEG4 B-Frame QP Value"; 540 540 case V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP: return "MPEG4 Minimum QP Value"; 541 541 case V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP: return "MPEG4 Maximum QP Value"; 542 542 case V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL: return "MPEG4 Level"; 543 543 case V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE: return "MPEG4 Profile"; 544 544 case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL: return "Quarter Pixel Search Enable"; 545 - case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES: return "The Maximum Bytes Per Slice"; 546 - case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB: return "The Number of MB in a Slice"; 547 - case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return "The Slice Partitioning Method"; 545 + case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES: return "Maximum Bytes in a Slice"; 546 + case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB: return "Number of MBs in a Slice"; 547 + case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return "Slice Partitioning Method"; 548 548 case V4L2_CID_MPEG_VIDEO_VBV_SIZE: return "VBV Buffer Size"; 549 549 550 550 /* CAMERA controls */ ··· 580 580 case V4L2_CID_AUDIO_LIMITER_ENABLED: return "Audio Limiter Feature Enabled"; 581 581 case V4L2_CID_AUDIO_LIMITER_RELEASE_TIME: return "Audio Limiter Release Time"; 582 582 case V4L2_CID_AUDIO_LIMITER_DEVIATION: return "Audio Limiter Deviation"; 583 - case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Feature Enabled"; 583 + case V4L2_CID_AUDIO_COMPRESSION_ENABLED: return "Audio Compression Enabled"; 584 584 case V4L2_CID_AUDIO_COMPRESSION_GAIN: return "Audio Compression Gain"; 585 585 case V4L2_CID_AUDIO_COMPRESSION_THRESHOLD: return "Audio Compression Threshold"; 586 586 case V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME: return "Audio Compression Attack Time"; ··· 588 588 case V4L2_CID_PILOT_TONE_ENABLED: return "Pilot Tone Feature Enabled"; 589 589 case V4L2_CID_PILOT_TONE_DEVIATION: return "Pilot Tone Deviation"; 590 590 case V4L2_CID_PILOT_TONE_FREQUENCY: return "Pilot Tone Frequency"; 591 - case V4L2_CID_TUNE_PREEMPHASIS: return "Pre-emphasis settings"; 591 + case V4L2_CID_TUNE_PREEMPHASIS: return "Pre-Emphasis"; 592 592 case V4L2_CID_TUNE_POWER_LEVEL: return "Tune Power Level"; 593 593 case V4L2_CID_TUNE_ANTENNA_CAPACITOR: return "Tune Antenna Capacitor"; 594 594 595 595 /* Flash controls */ 596 - case V4L2_CID_FLASH_CLASS: return "Flash controls"; 597 - case V4L2_CID_FLASH_LED_MODE: return "LED mode"; 598 - case V4L2_CID_FLASH_STROBE_SOURCE: return "Strobe source"; 596 + case V4L2_CID_FLASH_CLASS: return "Flash Controls"; 597 + case V4L2_CID_FLASH_LED_MODE: return "LED Mode"; 598 + case V4L2_CID_FLASH_STROBE_SOURCE: return "Strobe Source"; 599 599 case V4L2_CID_FLASH_STROBE: return "Strobe"; 600 - case V4L2_CID_FLASH_STROBE_STOP: return "Stop strobe"; 601 - case V4L2_CID_FLASH_STROBE_STATUS: return "Strobe status"; 602 - case V4L2_CID_FLASH_TIMEOUT: return "Strobe timeout"; 603 - case V4L2_CID_FLASH_INTENSITY: return "Intensity, flash mode"; 604 - case V4L2_CID_FLASH_TORCH_INTENSITY: return "Intensity, torch mode"; 605 - case V4L2_CID_FLASH_INDICATOR_INTENSITY: return "Intensity, indicator"; 600 + case V4L2_CID_FLASH_STROBE_STOP: return "Stop Strobe"; 601 + case V4L2_CID_FLASH_STROBE_STATUS: return "Strobe Status"; 602 + case V4L2_CID_FLASH_TIMEOUT: return "Strobe Timeout"; 603 + case V4L2_CID_FLASH_INTENSITY: return "Intensity, Flash Mode"; 604 + case V4L2_CID_FLASH_TORCH_INTENSITY: return "Intensity, Torch Mode"; 605 + case V4L2_CID_FLASH_INDICATOR_INTENSITY: return "Intensity, Indicator"; 606 606 case V4L2_CID_FLASH_FAULT: return "Faults"; 607 607 case V4L2_CID_FLASH_CHARGE: return "Charge"; 608 - case V4L2_CID_FLASH_READY: return "Ready to strobe"; 608 + case V4L2_CID_FLASH_READY: return "Ready to Strobe"; 609 609 610 610 default: 611 611 return NULL;
+7 -1
drivers/media/video/v4l2-ioctl.c
··· 1871 1871 case VIDIOC_S_FREQUENCY: 1872 1872 { 1873 1873 struct v4l2_frequency *p = arg; 1874 + enum v4l2_tuner_type type; 1874 1875 1875 1876 if (!ops->vidioc_s_frequency) 1876 1877 break; ··· 1879 1878 ret = ret_prio; 1880 1879 break; 1881 1880 } 1881 + type = (vfd->vfl_type == VFL_TYPE_RADIO) ? 1882 + V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 1882 1883 dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", 1883 1884 p->tuner, p->type, p->frequency); 1884 - ret = ops->vidioc_s_frequency(file, fh, p); 1885 + if (p->type != type) 1886 + ret = -EINVAL; 1887 + else 1888 + ret = ops->vidioc_s_frequency(file, fh, p); 1885 1889 break; 1886 1890 } 1887 1891 case VIDIOC_G_SLICED_VBI_CAP:
-1
drivers/media/video/zoran/zoran_driver.c
··· 1958 1958 mutex_unlock(&zr->resource_lock); 1959 1959 fb->fmt.colorspace = V4L2_COLORSPACE_SRGB; 1960 1960 fb->fmt.field = V4L2_FIELD_INTERLACED; 1961 - fb->flags = V4L2_FBUF_FLAG_OVERLAY; 1962 1961 fb->capability = V4L2_FBUF_CAP_LIST_CLIPPING; 1963 1962 1964 1963 return 0;
+2 -1
include/media/tuner.h
··· 127 127 #define TUNER_PHILIPS_FMD1216MEX_MK3 78 128 128 #define TUNER_PHILIPS_FM1216MK5 79 129 129 #define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */ 130 - #define TUNER_XC4000 81 /* Xceive Silicon Tuner */ 131 130 132 131 #define TUNER_PARTSNIC_PTI_5NF05 81 133 132 #define TUNER_PHILIPS_CU1216L 82 ··· 134 135 #define TUNER_SONY_BTF_PXN01Z 84 135 136 #define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */ 136 137 #define TUNER_TENA_TNF_5337 86 138 + 139 + #define TUNER_XC4000 87 /* Xceive Silicon Tuner */ 137 140 138 141 /* tv card specific */ 139 142 #define TDA9887_PRESENT (1<<0)