Re: [PATCH v4.1 3/3] v4l: Add V4L2_BUF_FLAG_TIMESTAMP_SOF and use it

2014-02-05 Thread Sakari Ailus
On Sun, Feb 02, 2014 at 10:27:49AM +0100, Laurent Pinchart wrote:
 Hi Hans,
 
 On Friday 31 January 2014 18:21:15 Hans Verkuil wrote:
  On 01/31/2014 05:42 PM, Sakari Ailus wrote:
   On Fri, Jan 31, 2014 at 04:45:56PM +0100, Hans Verkuil wrote:
  
   How about defining a capability for use with ENUMINPUT/OUTPUT? I agree
   that this won't change between buffers, but it is a property of a
   specific input or output.
  
   Over 80 characters per line. :-P
  
  Stupid thunderbird doesn't show the column, and I can't enable
  automatic word-wrap because that plays hell with patches. Solutions
  welcome!
  
   There are more than enough bits available in v4l2_input/output to add one
   for SOF timestamps.
   
   In complex devices with a non-linear media graph inputs and outputs are
   not very relevant, and for that reason many drivers do not even implement
   them. I'd rather not bind video buffer queues to inputs or outputs.
  
  Then we end up again with buffer flags. It's a property of the selected
  input or output, so if you can't/don't want to use that, then it's buffer
  flags.
  
  Which I like as well, but it's probably useful that the documentation states
  that it can only change if the input or output changes as well.
  
   My personal favourite is still to use controls for the purpose but the
   buffer flags come close, too, especially now that we're using them for
   timestamp sources.
  
  Laurent, can we please end this discussion? It makes perfect sense to store
  this information as a BUF_FLAG IMHO. You can just do a QUERYBUF once after
  you called REQBUFS and you know what you have to deal with.
 
 I'm OK with a buffer flag. Can we state in the documentation that the same 
 timestamp flag will be used for all buffers and that QUERYBUF can be used to 
 query it before the first buffer gets dequeued ?

I think that'd be reasonable. Otherwise it'd be quite painful to use. I'll
resend.

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/9] DocBook: document RF tuner bandwidth controls

2014-02-05 Thread Antti Palosaari
Add documentation for RF tuner bandwidth controls. These controls are
used to set filters on tuner signal path.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 Documentation/DocBook/media/v4l/controls.xml | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 0145341..345b6e5 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -5007,6 +5007,25 @@ descriptor. Calling VIDIOC-QUERYCTRL; for this control 
will return a
 description of this control class./entry
 /row
 row
+  entry 
spanname=idconstantV4L2_CID_BANDWIDTH_AUTO/constantnbsp;/entry
+  entryboolean/entry
+/row
+row
+  entry spanname=descrEnables/disables tuner radio channel
+bandwidth configuration. In automatic mode bandwidth configuration is performed
+by the driver./entry
+/row
+row
+  entry 
spanname=idconstantV4L2_CID_BANDWIDTH/constantnbsp;/entry
+  entryinteger/entry
+/row
+row
+  entry spanname=descrFilter(s) on tuner signal path are used 
to
+filter signal according to receiving party needs. Driver configures filters to
+fulfill desired bandwidth requirement. Used when V4L2_CID_BANDWIDTH_AUTO is not
+set. The range and step are driver-specific./entry
+/row
+row
   entry 
spanname=idconstantV4L2_CID_LNA_GAIN_AUTO/constantnbsp;/entry
   entryboolean/entry
 /row
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 9/9] msi3101: provide RF tuner bands from sub-device

2014-02-05 Thread Antti Palosaari
Let the msi001 tuner driver report its frequency bands.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/msi3101/sdr-msi3101.c | 48 +
 1 file changed, 15 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c 
b/drivers/staging/media/msi3101/sdr-msi3101.c
index 36990cb..6bd7b67 100644
--- a/drivers/staging/media/msi3101/sdr-msi3101.c
+++ b/drivers/staging/media/msi3101/sdr-msi3101.c
@@ -57,7 +57,7 @@
 #define V4L2_PIX_FMT_SDR_S14v4l2_fourcc('D', 'S', '1', '4') /* signed 
14-bit */
 #define V4L2_PIX_FMT_SDR_MSI2500_384 v4l2_fourcc('M', '3', '8', '4') /* Mirics 
MSi2500 format 384 */
 
-static const struct v4l2_frequency_band bands_adc[] = {
+static const struct v4l2_frequency_band bands[] = {
{
.tuner = 0,
.type = V4L2_TUNER_ADC,
@@ -68,24 +68,6 @@ static const struct v4l2_frequency_band bands_adc[] = {
},
 };
 
-static const struct v4l2_frequency_band bands_rf[] = {
-   {
-   .tuner = 1,
-   .type = V4L2_TUNER_RF,
-   .index = 0,
-   .capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS,
-   .rangelow   =   4900,
-   .rangehigh  =  26300,
-   }, {
-   .tuner = 1,
-   .type = V4L2_TUNER_RF,
-   .index = 1,
-   .capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS,
-   .rangelow   =  39000,
-   .rangehigh  =  96000,
-   },
-};
-
 /* stream formats */
 struct msi3101_format {
char*name;
@@ -1268,8 +1250,8 @@ static int msi3101_s_frequency(struct file *file, void 
*priv,
 
if (f-tuner == 0) {
s-f_adc = clamp_t(unsigned int, f-frequency,
-   bands_adc[0].rangelow,
-   bands_adc[0].rangehigh);
+   bands[0].rangelow,
+   bands[0].rangehigh);
dev_dbg(s-udev-dev, %s: ADC frequency=%u Hz\n,
__func__, s-f_adc);
ret = msi3101_set_usb_adc(s);
@@ -1286,25 +1268,25 @@ static int msi3101_enum_freq_bands(struct file *file, 
void *priv,
struct v4l2_frequency_band *band)
 {
struct msi3101_state *s = video_drvdata(file);
+   int ret;
dev_dbg(s-udev-dev, %s: tuner=%d type=%d index=%d\n,
__func__, band-tuner, band-type, band-index);
 
if (band-tuner == 0) {
-   if (band-index = ARRAY_SIZE(bands_adc))
-   return -EINVAL;
-
-   *band = bands_adc[band-index];
+   if (band-index = ARRAY_SIZE(bands)) {
+   ret = -EINVAL;
+   } else {
+   *band = bands[band-index];
+   ret = 0;
+   }
} else if (band-tuner == 1) {
-   /* TODO: add that to v4l2_subdev_tuner_ops */
-   if (band-index = ARRAY_SIZE(bands_rf))
-   return -EINVAL;
-
-   *band = bands_rf[band-index];
+   ret = v4l2_subdev_call(s-v4l2_subdev, tuner,
+   enum_freq_bands, band);
} else {
-   return -EINVAL;
+   ret = -EINVAL;
}
 
-   return 0;
+   return ret;
 }
 
 static const struct v4l2_ioctl_ops msi3101_ioctl_ops = {
@@ -1413,7 +1395,7 @@ static int msi3101_probe(struct usb_interface *intf,
spin_lock_init(s-queued_bufs_lock);
INIT_LIST_HEAD(s-queued_bufs);
s-udev = udev;
-   s-f_adc = bands_adc[0].rangelow;
+   s-f_adc = bands[0].rangelow;
s-pixelformat = V4L2_SDR_FMT_CU8;
 
/* Init videobuf2 queue structure */
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/9] rtl2832_sdr: use formats defined in V4L2 API

2014-02-05 Thread Antti Palosaari
Switch new formats V4L2_SDR_FMT_CU8 and V4L2_SDR_FMT_CU16LE as those
are now defined in API.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 18 +++---
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index c26c084..e89abd8 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -37,10 +37,6 @@
 #include linux/jiffies.h
 #include linux/math64.h
 
-/* TODO: These should be moved to V4L2 API */
-#define V4L2_PIX_FMT_SDR_U8v4l2_fourcc('D', 'U', '0', '8')
-#define V4L2_PIX_FMT_SDR_U16LE v4l2_fourcc('D', 'U', '1', '6')
-
 #define MAX_BULK_BUFS(10)
 #define BULK_BUFFER_SIZE (128 * 512)
 
@@ -90,11 +86,11 @@ struct rtl2832_sdr_format {
 
 static struct rtl2832_sdr_format formats[] = {
{
-   .name   = 8-bit unsigned,
-   .pixelformat= V4L2_PIX_FMT_SDR_U8,
+   .name   = IQ U8,
+   .pixelformat=  V4L2_SDR_FMT_CU8,
}, {
-   .name   = 16-bit unsigned little endian,
-   .pixelformat= V4L2_PIX_FMT_SDR_U16LE,
+   .name   = IQ U16LE (emulated),
+   .pixelformat= V4L2_SDR_FMT_CU16LE,
},
 };
 
@@ -346,11 +342,11 @@ static unsigned int rtl2832_sdr_convert_stream(struct 
rtl2832_sdr_state *s,
 {
unsigned int dst_len;
 
-   if (s-pixelformat == V4L2_PIX_FMT_SDR_U8) {
+   if (s-pixelformat ==  V4L2_SDR_FMT_CU8) {
/* native stream, no need to convert */
memcpy(dst, src, src_len);
dst_len = src_len;
-   } else if (s-pixelformat == V4L2_PIX_FMT_SDR_U16LE) {
+   } else if (s-pixelformat == V4L2_SDR_FMT_CU16LE) {
/* convert u8 to u16 */
unsigned int i;
u16 *u16dst = dst;
@@ -1410,7 +1406,7 @@ struct dvb_frontend *rtl2832_sdr_attach(struct 
dvb_frontend *fe,
s-i2c = i2c;
s-cfg = cfg;
s-f_adc = bands_adc[0].rangelow;
-   s-pixelformat = V4L2_PIX_FMT_SDR_U8;
+   s-pixelformat =  V4L2_SDR_FMT_CU8;
 
mutex_init(s-v4l2_lock);
mutex_init(s-vb_queue_lock);
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/9] msi001: implement .enum_freq_bands()

2014-02-05 Thread Antti Palosaari
Implement .enum_freq_bands() in order to provide
VIDIOC_ENUM_FREQ_BANDS IOCTL from sub-device.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/msi3101/msi001.c | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/drivers/staging/media/msi3101/msi001.c 
b/drivers/staging/media/msi3101/msi001.c
index 9ccfd9b..6b586dc 100644
--- a/drivers/staging/media/msi3101/msi001.c
+++ b/drivers/staging/media/msi3101/msi001.c
@@ -343,11 +343,29 @@ static int msi001_s_frequency(struct v4l2_subdev *sd,
return msi001_set_tuner(s);
 }
 
+static int msi001_enum_freq_bands(struct v4l2_subdev *sd,
+   struct v4l2_frequency_band *band)
+{
+   struct msi001 *s = sd_to_msi001(sd);
+   dev_dbg(s-spi-dev, %s: tuner=%d type=%d index=%d\n,
+   __func__, band-tuner, band-type, band-index);
+
+   if (band-index = ARRAY_SIZE(bands))
+   return -EINVAL;
+
+   band-capability = bands[band-index].capability;
+   band-rangelow = bands[band-index].rangelow;
+   band-rangehigh = bands[band-index].rangehigh;
+
+   return 0;
+}
+
 static const struct v4l2_subdev_tuner_ops msi001_tuner_ops = {
.g_tuner  = msi001_g_tuner,
.s_tuner  = msi001_s_tuner,
.g_frequency  = msi001_g_frequency,
.s_frequency  = msi001_s_frequency,
+   .enum_freq_bands  = msi001_enum_freq_bands,
 };
 
 static const struct v4l2_subdev_ops msi001_ops = {
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/9] v4l: uapi: add SDR formats CU8 and CU16LE

2014-02-05 Thread Antti Palosaari
V4L2_SDR_FMT_CU8 — Complex unsigned 8-bit IQ sample
V4L2_SDR_FMT_CU16LE — Complex unsigned 16-bit little endian IQ sample

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 include/uapi/linux/videodev2.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 27fedfe..3411215 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -436,6 +436,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SE401  v4l2_fourcc('S', '4', '0', '1') /* se401 
janggu compressed rgb */
 #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 
interleaved UYVY/JPEG */
 
+/* SDR formats - used only for Software Defined Radio devices */
+#define V4L2_SDR_FMT_CU8  v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
+#define V4L2_SDR_FMT_CU16LE   v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le 
*/
+
 /*
  * F O R M A T   E N U M E R A T I O N
  */
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/9] v4l: reorganize RF tuner control ID numbers

2014-02-05 Thread Antti Palosaari
It appears that controls are ordered by ID number. Change order of
controls by reorganizing assigned IDs now as we can. It is not
reasonable possible after the API is released. Leave some spare
space between IDs too for future extensions.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 include/uapi/linux/v4l2-controls.h | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 3cf68a6..cc488c3 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -899,13 +899,13 @@ enum v4l2_deemphasis {
 #define V4L2_CID_RF_TUNER_CLASS_BASE   (V4L2_CTRL_CLASS_RF_TUNER | 
0x900)
 #define V4L2_CID_RF_TUNER_CLASS
(V4L2_CTRL_CLASS_RF_TUNER | 1)
 
-#define V4L2_CID_LNA_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 
1)
-#define V4L2_CID_LNA_GAIN  (V4L2_CID_RF_TUNER_CLASS_BASE + 
2)
-#define V4L2_CID_MIXER_GAIN_AUTO   (V4L2_CID_RF_TUNER_CLASS_BASE + 
3)
-#define V4L2_CID_MIXER_GAIN(V4L2_CID_RF_TUNER_CLASS_BASE + 
4)
-#define V4L2_CID_IF_GAIN_AUTO  (V4L2_CID_RF_TUNER_CLASS_BASE + 
5)
-#define V4L2_CID_IF_GAIN   (V4L2_CID_RF_TUNER_CLASS_BASE + 
6)
-#define V4L2_CID_BANDWIDTH_AUTO
(V4L2_CID_RF_TUNER_CLASS_BASE + 7)
-#define V4L2_CID_BANDWIDTH (V4L2_CID_RF_TUNER_CLASS_BASE + 
8)
+#define V4L2_CID_BANDWIDTH_AUTO
(V4L2_CID_RF_TUNER_CLASS_BASE + 11)
+#define V4L2_CID_BANDWIDTH (V4L2_CID_RF_TUNER_CLASS_BASE + 
12)
+#define V4L2_CID_LNA_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 
41)
+#define V4L2_CID_LNA_GAIN  (V4L2_CID_RF_TUNER_CLASS_BASE + 
42)
+#define V4L2_CID_MIXER_GAIN_AUTO   (V4L2_CID_RF_TUNER_CLASS_BASE + 
51)
+#define V4L2_CID_MIXER_GAIN(V4L2_CID_RF_TUNER_CLASS_BASE + 
52)
+#define V4L2_CID_IF_GAIN_AUTO  (V4L2_CID_RF_TUNER_CLASS_BASE + 
61)
+#define V4L2_CID_IF_GAIN   (V4L2_CID_RF_TUNER_CLASS_BASE + 
62)
 
 #endif
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/9] v4l: add enum_freq_bands support to tuner sub-device

2014-02-05 Thread Antti Palosaari
Add VIDIOC_ENUM_FREQ_BANDS, enumerate supported frequency bands,
IOCTL support for sub-device tuners too.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 include/media/v4l2-subdev.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d67210a..4682aad 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -192,6 +192,7 @@ struct v4l2_subdev_tuner_ops {
int (*s_radio)(struct v4l2_subdev *sd);
int (*s_frequency)(struct v4l2_subdev *sd, const struct v4l2_frequency 
*freq);
int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
+   int (*enum_freq_bands)(struct v4l2_subdev *sd, struct 
v4l2_frequency_band *band);
int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
int (*s_tuner)(struct v4l2_subdev *sd, const struct v4l2_tuner *vt);
int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/9] rtl28xxu: fix switch-case style issue

2014-02-05 Thread Antti Palosaari
Use break, not return, for every case.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 73348bf..afafe92 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -906,7 +906,6 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
/* attach SDR */
dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
rtl28xxu_rtl2832_fc0012_config);
-   return 0;
break;
case TUNER_RTL2832_FC0013:
fe = dvb_attach(fc0013_attach, adap-fe[0],
@@ -919,7 +918,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
/* attach SDR */
dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
rtl28xxu_rtl2832_fc0013_config);
-   return 0;
+   break;
case TUNER_RTL2832_E4000: {
struct e4000_config e4000_config = {
.fe = adap-fe[0],
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/9] msi3101: use formats defined in V4L2 API

2014-02-05 Thread Antti Palosaari
Switch new formats V4L2_SDR_FMT_CU8 and V4L2_SDR_FMT_CU16LE as those
are now defined in API.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/msi3101/sdr-msi3101.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/media/msi3101/sdr-msi3101.c 
b/drivers/staging/media/msi3101/sdr-msi3101.c
index df1a3a1..36990cb 100644
--- a/drivers/staging/media/msi3101/sdr-msi3101.c
+++ b/drivers/staging/media/msi3101/sdr-msi3101.c
@@ -52,8 +52,6 @@
 #define MAX_ISOC_ERRORS 20
 
 /* TODO: These should be moved to V4L2 API */
-#define V4L2_PIX_FMT_SDR_U8 v4l2_fourcc('D', 'U', '0', '8') /* unsigned 
8-bit */
-#define V4L2_PIX_FMT_SDR_U16LE  v4l2_fourcc('D', 'U', '1', '6') /* unsigned 
16-bit LE */
 #define V4L2_PIX_FMT_SDR_S8 v4l2_fourcc('D', 'S', '0', '8') /* signed 
8-bit */
 #define V4L2_PIX_FMT_SDR_S12v4l2_fourcc('D', 'S', '1', '2') /* signed 
12-bit */
 #define V4L2_PIX_FMT_SDR_S14v4l2_fourcc('D', 'S', '1', '4') /* signed 
14-bit */
@@ -97,11 +95,11 @@ struct msi3101_format {
 /* format descriptions for capture and preview */
 static struct msi3101_format formats[] = {
{
-   .name   = 8-bit unsigned,
-   .pixelformat= V4L2_PIX_FMT_SDR_U8,
+   .name   = IQ U8,
+   .pixelformat= V4L2_SDR_FMT_CU8,
}, {
-   .name   = 16-bit unsigned little endian,
-   .pixelformat= V4L2_PIX_FMT_SDR_U16LE,
+   .name   = IQ U16LE,
+   .pixelformat=  V4L2_SDR_FMT_CU16LE,
 #if 0
}, {
.name   = 8-bit signed,
@@ -940,11 +938,11 @@ static int msi3101_set_usb_adc(struct msi3101_state *s)
 
/* select stream format */
switch (s-pixelformat) {
-   case V4L2_PIX_FMT_SDR_U8:
+   case V4L2_SDR_FMT_CU8:
s-convert_stream = msi3101_convert_stream_504_u8;
reg7 = 0x000c9407;
break;
-   case V4L2_PIX_FMT_SDR_U16LE:
+   case  V4L2_SDR_FMT_CU16LE:
s-convert_stream = msi3101_convert_stream_252_u16;
reg7 = 0x9407;
break;
@@ -1416,7 +1414,7 @@ static int msi3101_probe(struct usb_interface *intf,
INIT_LIST_HEAD(s-queued_bufs);
s-udev = udev;
s-f_adc = bands_adc[0].rangelow;
-   s-pixelformat = V4L2_PIX_FMT_SDR_U8;
+   s-pixelformat = V4L2_SDR_FMT_CU8;
 
/* Init videobuf2 queue structure */
s-vb_queue.type = V4L2_BUF_TYPE_SDR_CAPTURE;
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] uvcvideo: Enable VIDIOC_CREATE_BUFS

2014-02-05 Thread Hans Verkuil
On 02/05/14 08:57, Hans Verkuil wrote:
 On 02/05/2014 12:04 AM, Sylwester Nawrocki wrote:
 Hi,

 On 02/03/2014 10:03 AM, Hans Verkuil wrote:
 Hi Philipp, Laurent,

 On 02/02/2014 02:04 PM, Philipp Zabel wrote:
 On Sun, Feb 02, 2014 at 11:21:13AM +0100, Laurent Pinchart wrote:
 Hi Hans,

 On Friday 31 January 2014 09:43:00 Hans Verkuil wrote:
 I think you might want to add a check in uvc_queue_setup to verify the
 fmt that create_bufs passes. The spec says that: Unsupported formats
 will result in an error. In this case I guess that the format basically
 should match the current selected format.

 I'm unhappy with the current implementations of create_bufs (see also 
 this
 patch:
 http://www.mail-archive.com/linux-media@vger.kernel.org/msg70796.html).

 Nobody is actually checking the format today, which isn't good.

 The fact that the spec says that the fmt field isn't changed by the 
 driver
 isn't helping as it invalidated my patch from above, although that can be
 fixed.

 I need to think about this some more, but for this particular case you 
 can
 just do a memcmp of the v4l2_pix_format against the currently selected
 format and return an error if they differ. Unless you want to support
 different buffer sizes as well?

 Isn't the whole point of VIDIOC_CREATE_BUFS being able to create buffers 
 of
 different resolutions than the current active resolution ?

 Or just additional buffers with the same resolution (or really, the same 
 size).

 For that to work the driver in question would need to keep track of 
 per-buffer
 format and resolution, and not only of per-queue format and resolution.

 For now, would something like the following be enough? Unfortunately the 
 uvc
 driver doesn't keep a v4l2_format around that we could just memcmp against:

 diff --git a/drivers/media/usb/uvc/uvc_v4l2.c 
 b/drivers/media/usb/uvc/uvc_v4l2.c
 index fa58131..7fa469b 100644
 --- a/drivers/media/usb/uvc/uvc_v4l2.c
 +++ b/drivers/media/usb/uvc/uvc_v4l2.c
 @@ -1003,10 +1003,26 @@ static long uvc_v4l2_do_ioctl(struct file *file, 
 unsigned int cmd, void *arg)
case VIDIOC_CREATE_BUFS:
{
struct v4l2_create_buffers *cb = arg;
 +  struct v4l2_pix_format *pix;
 +  struct uvc_format *format;
 +  struct uvc_frame *frame;

if (!uvc_has_privileges(handle))
return -EBUSY;

 +  format = stream-cur_format;
 +  frame = stream-cur_frame;
 +  pix =cb-format.fmt.pix;
 +
 +  if (pix-pixelformat != format-fcc ||
 +  pix-width != frame-wWidth ||
 +  pix-height != frame-wHeight ||
 +  pix-field != V4L2_FIELD_NONE ||
 +  pix-bytesperline != format-bpp * frame-wWidth / 8 ||
 +  pix-sizeimage != stream-ctrl.dwMaxVideoFrameSize ||
 +  pix-colorspace != format-colorspace)

 I would drop the field and colorspace checks (those do not really affect
 any size calculations), other than that it looks good.

 That seems completely wrong to me, AFAICT the VIDIOC_CREATE_BUFS was 
 designed
 so that the driver is supposed to allow any format which is supported by the
 hardware.
 What has currently selected format to do with the format passed to
 VIDIOC_CREATE_BUFS ? It should be allowed to create buffers of any size
 (implied by the passed v4l2_pix_format). It is supposed to be checked if
 a buffer meets constraints of current configuration of
 the hardware at QBUF, not at VIDIOC_CREATE_BUFS time. User space may well
 allocate buffers when one image format is set, keep them aside and then
 just before queueing them to the driver may set the format to a different
 one, so the hardware set up matches buffers allocated with 
 VIDIOC_CREATE_BUFS.

 What's the point of having VIDIOC_CREATE_BUFS when you are doing checks
 like above ? Unless I'm missing something that is completely wrong. :)
 Adjusting cb-format.fmt.pix as in VIDIOC_TRY_FORMAT seems more appropriate
 thing to do.
 
 OK, I agree that the code above is wrong. So ignore that.
 
 What should CREATE_BUFS do when it is called?
 
 Should I go back to this patch: 
 http://www.spinics.net/lists/linux-media/msg72171.html
 
 It will at least ensure that the fmt is consistent. It is however not quite
 according to the spec since invalid formats are generally 'reformatted' by
 TRY_FMT to something valid, and the spec says invalid formats should return
 an error. It is possible to do something more advanced here, though: you
 could make a copy of v4l2_format, call TRY_FMT on it, and check if there
 are any differences with what was passed in. If there are, return an
 error.
 
 It's a bit of work, but probably better to do it in the core rather than
 depend on drivers to do it (since they won't :-) ).
 
 If queue_setup can rely on fmt to be a valid format, then sizeimage can
 just be used as the buffer size.
 
 With regards to checking constraints on QBUF: I see a problem there. For
 a regular buffer it can be checked in 

Re: [PATCH] e4000: implement controls via v4l2 control framework

2014-02-05 Thread Antti Palosaari

Moi Hans

On 05.02.2014 09:28, Hans Verkuil wrote:

Hi Antti,

Hmm, it's a bit ugly this code. I have some suggestions below...


Yeah, there is some redundancy, I though also the same. But 
functionality is now correct what I see.


It is mostly that DVB gate-control logic which I personally dislike. 
There is quite big changes on my TODO list in order to improve overall 
situation. I already converted that driver to I2C model, it was the 
first step. Next thing is to implement I2C adapter properly = get rid 
of those gate-control callbacks. I did it already [1], but there is 
still some things to study (gate closing, regmap). After driver is 100% 
I2C model (I2C client + no I2C gate hacks) I could switch to regmap, 
which gives some nice stuff like register shadowing and I2C message 
splitting?. So there is a long road to learn and improve things towards 
to current kernel practices, due to payload from history...


After that I likely try to separate tuner functionality out from DVB / 
V4L APIs, still keeping those in same driver, but wrapping functionality.


So lets see if I get some inspiration to rebase that anymore at that 
point :]



[1] 
http://git.linuxtv.org/anttip/media_tree.git/shortlog/refs/heads/mn88472_dvbc


regards
Antti




On 02/05/2014 01:05 AM, Antti Palosaari wrote:

Implement gain and bandwidth controls using v4l2 control framework.
Pointer to control handler is provided by exported symbol.

Cc: Mauro Carvalho Chehab m.che...@samsung.com
Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
  drivers/media/tuners/e4000.c  | 210 +-
  drivers/media/tuners/e4000.h  |  14 +++
  drivers/media/tuners/e4000_priv.h |  12 +++
  3 files changed, 235 insertions(+), 1 deletion(-)

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 9187190..77318e9 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -448,6 +448,178 @@ err:
return ret;
  }

+static int e4000_set_lna_gain(struct dvb_frontend *fe)


I would change this to:

  e4000_set_lna_if_gain(struct dvb_frontend *fe, bool lna_auto, bool if_auto, 
bool set_lna)


+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int ret;
+   u8 u8tmp;


General comment: always add a newline after variable declarations.


+   dev_dbg(priv-client-dev, %s: lna auto=%d-%d val=%d-%d\n,
+   __func__, priv-lna_gain_auto-cur.val,
+   priv-lna_gain_auto-val, priv-lna_gain-cur.val,
+   priv-lna_gain-val);
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 1);
+
+   if (priv-lna_gain_auto-val  priv-if_gain_auto-cur.val)
+   u8tmp = 0x17;
+   else if (priv-lna_gain_auto-val)
+   u8tmp = 0x19;
+   else if (priv-if_gain_auto-cur.val)
+   u8tmp = 0x16;
+   else
+   u8tmp = 0x10;
+
+   ret = e4000_wr_reg(priv, 0x1a, u8tmp);
+   if (ret)
+   goto err;
+
+   if (priv-lna_gain_auto-val == false) {
+   ret = e4000_wr_reg(priv, 0x14, priv-lna_gain-val);
+   if (ret)
+   goto err;
+   }


Set lna gain if set_lna is true and lna_auto is false, set if gain if
set_lna is false and if_gain is false.


+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   return 0;


I would remove the 4 lines above, and instead just...


+err:
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+


...add this:

if (ret)


+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+   return ret;
+}
+
+static int e4000_set_mixer_gain(struct dvb_frontend *fe)
+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int ret;
+   u8 u8tmp;
+   dev_dbg(priv-client-dev, %s: mixer auto=%d-%d val=%d-%d\n,
+   __func__, priv-mixer_gain_auto-cur.val,
+   priv-mixer_gain_auto-val, priv-mixer_gain-cur.val,
+   priv-mixer_gain-val);
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 1);
+
+   if (priv-mixer_gain_auto-val)
+   u8tmp = 0x15;
+   else
+   u8tmp = 0x14;
+
+   ret = e4000_wr_reg(priv, 0x20, u8tmp);
+   if (ret)
+   goto err;
+
+   if (priv-mixer_gain_auto-val == false) {
+   ret = e4000_wr_reg(priv, 0x15, priv-mixer_gain-val);
+   if (ret)
+   goto err;
+   }
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   return 0;
+err:
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+   return ret;
+}
+
+static int e4000_set_if_gain(struct dvb_frontend *fe)
+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int 

Re: [RFC PATCH 0/4] rc: Adding support for sysfs wakeup scancodes

2014-02-05 Thread Mauro Carvalho Chehab
Hi Antti,

Em Wed, 05 Feb 2014 09:03:29 +0200
Antti Seppälä a.sepp...@gmail.com escreveu:

 On 4 February 2014 19:54, Mauro Carvalho Chehab m.che...@samsung.com wrote:
  Em Thu, 23 Jan 2014 21:11:09 +0200
  Antti Seppälä a.sepp...@gmail.com escreveu:
 
  On 23 January 2014 00:01, Mauro Carvalho Chehab m.che...@samsung.com 
  wrote:
   Not sure if you saw it, but there's already another patchset proposing
   that, that got submitted before this changeset:
   https://patchwork.linuxtv.org/patch/21625/
 
  I actually didn't notice that until now. Seems quite a similar kind of
  approach with even more advanced features than what I had in mind
  (namely the scancode filtering and masking).
 
  However it looks like that patchset has the same drawback about not
  knowing which protocol to use for the wakeup scancode as was pointed
  from my patch.
 
  Well, the protocol is important only if there are two or more active
  RCs that produce the same IR code on different protocols.
 
  Also, from the sysfs description made by James, it seems clear to me
  that the protocol to be used is the current protocol.
 
  I think is an unlikely border case to have some hardware that supports
  more than one IR protocols enabled for the wakeup to work, so James
  patch looks ok on my eyes.
 
  Also, nothing prevents to add latter a wakeup_filter_protocol sysfs node
  to allow to filter the wakeup scancode to a protocol set different than
  the one(s) currently enabled.
 
  I think I'll try to come up with a new patch addressing the comments
  I've seen so far.
 
  I guess I'll merge James approach, as there are a pile of other patches
  depending on it. If we need latter to distinguish between current_protocol
  and the wakeup one, as I said, a latter patch can add a
  wakeup_filter_protocol sysfs node to specify it.
 
  Regards,
  Mauro
 
 Hi Mauro.
 
 How do you want to proceed with the nuvoton wakeup I initially set out to do?
 
 To wake up with nuvoton-cir we need to program several raw ir
 pulse/space lengths to the hardware and not a scancode. James's
 approach doesn't support this.
 
 To keep things simple maybe module parameters in my first patch
 (http://www.mail-archive.com/linux-media@vger.kernel.org/msg69782.html)
 are then the best thing to do for nuvoton? Other drivers can probably
 adapt to the suggested filter api.

Well, you're basically telling that you need an IR encoder to convert
from protocol/scancode into pulse/space lengths. 

As we need/want a portable interface that will provide the same API
to  userspace, no matter what hardware, I can see two alternatives:

1) Use a lirc-like API for that, using the IR encoder code in userspace;

2) The same way as we mapped IR decoders, add IR encoders that can be
used either for IR TX or to provide IR wakeup codes.

IMO, (2) is a much more elegant option.

Regards,
Mauro
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/4] rc: Adding support for sysfs wakeup scancodes

2014-02-05 Thread James Hogan
Hi Antti,

On 05/02/14 07:03, Antti Seppälä wrote:
 To wake up with nuvoton-cir we need to program several raw ir
 pulse/space lengths to the hardware and not a scancode. James's
 approach doesn't support this.

Do the raw pulse/space lengths your hardware requires correspond to a
single IR packet (mapping to a single scancode)?

If so then my API is simply at a higher level of abstraction. I think
this has the following advantages:
* userspace sees a consistent interface at the same level of abstraction
as it already has access to from input subsystem (i.e. scancodes). I.e.
it doesn't need to care which IR device is in use, whether it does
raw/hardware decode, or the details of the timings of the current protocol.
* it supports hardware decoders which filter on the demodulated data
rather than the raw pulse/space lengths.

Of course to support this we'd need some per-protocol code to convert a
scancode back to pulse/space lengths. I'd like to think that code could
be generic, maybe as helper functions which multiple drivers could use,
which could also handle corner cases of the API in a consistent way
(e.g. user providing filter mask covering multiple scancodes, which
presumably pulse/space).

I see I've just crossed emails with Mauro who has just suggested
something similar. I agree that his (2) is the more elegant option.

Cheers
James

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/4] rc: Adding support for sysfs wakeup scancodes

2014-02-05 Thread James Hogan
On 05/02/14 09:39, James Hogan wrote:
 Hi Antti,
 
 On 05/02/14 07:03, Antti Seppälä wrote:
 To wake up with nuvoton-cir we need to program several raw ir
 pulse/space lengths to the hardware and not a scancode. James's
 approach doesn't support this.
 
 Do the raw pulse/space lengths your hardware requires correspond to a
 single IR packet (mapping to a single scancode)?
 
 If so then my API is simply at a higher level of abstraction. I think
 this has the following advantages:
 * userspace sees a consistent interface at the same level of abstraction
 as it already has access to from input subsystem (i.e. scancodes). I.e.
 it doesn't need to care which IR device is in use, whether it does
 raw/hardware decode, or the details of the timings of the current protocol.
 * it supports hardware decoders which filter on the demodulated data
 rather than the raw pulse/space lengths.
 
 Of course to support this we'd need some per-protocol code to convert a
 scancode back to pulse/space lengths. I'd like to think that code could
 be generic, maybe as helper functions which multiple drivers could use,
 which could also handle corner cases of the API in a consistent way
 (e.g. user providing filter mask covering multiple scancodes, which
 presumably pulse/space).

hmm, I didn't complete that sentence :(.
I meant:
..., which presumably pulse/space can't really represent very easily).

Cheers
James

 
 I see I've just crossed emails with Mauro who has just suggested
 something similar. I agree that his (2) is the more elegant option.
 
 Cheers
 James
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: au0828 errors and mangled video with Hauppauge 950Q

2014-02-05 Thread Devin Heitmueller
On Wed, Feb 5, 2014 at 1:05 AM, Connor Behan connor.be...@gmail.com wrote:
 Ccing Devin. I'm pretty sure the analog side has a problem at the driver
 level.

 On most days, one cannot pickup an ATSC signal where I am, so I am
 trying to capture analog video with a Hauppauge WinTV HVR 950Q. Whether
 I use Television, Composite or S-Video, I see the same corrupted video
 such as this: http://imgur.com/c398F4v

Looks like insufficient USB bandwidth available to support the 24
MB/second required for uncompressed analog video.

Is this on an x86 PC?  Or some embedded target such as ARM?  If the
latter, then the answer is almost certainly that the USB host
controller implementation is garbage and cannot handle the throughput.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linuxtv-media:master 89/499] WARNING: usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt

2014-02-05 Thread Fengguang Wu

Hi Sergio,

FYI, there are new warnings show up in

tree:   git://linuxtv.org/media_tree.git master
head:   9fd9330c2d0ae6c149ec817ec71797f943db98b4
commit: b4a0477c0b87c5b7a20a84df8cf81311d1efb226 [89/499] [media] v4l: 
omap4iss: Add support for OMAP4 camera interface - CSI receivers
:: branch date: 11 minutes ago
:: commit date: 9 weeks ago

scripts/checkpatch.pl 
0001-media-v4l-omap4iss-Add-support-for-OMAP4-camera-inte.patch
# many are suggestions rather than must-fix

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#548: drivers/staging/media/omap4iss/iss_csi2.c:516:
+   usleep_range(100, 100);

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#552: drivers/staging/media/omap4iss/iss_csi2.c:520:
+   printk(KERN_ERR CSI2: Soft reset try count exceeded!\n);

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#566: drivers/staging/media/omap4iss/iss_csi2.c:534:
+   usleep_range(100, 100);

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#570: drivers/staging/media/omap4iss/iss_csi2.c:538:
+   printk(KERN_ERR

WARNING: quoted string split across lines
#789: drivers/staging/media/omap4iss/iss_csi2.c:757:
+   dev_dbg(iss-dev, CSI2: ComplexIO Error IRQ 
+   %x\n, cpxio1_irqstatus);

WARNING: quoted string split across lines
#799: drivers/staging/media/omap4iss/iss_csi2.c:767:
+   dev_dbg(iss-dev, CSI2 Err:
+OCP:%d,

WARNING: quoted string split across lines
#800: drivers/staging/media/omap4iss/iss_csi2.c:768:
+OCP:%d,
+Short_pack:%d,

WARNING: quoted string split across lines
#801: drivers/staging/media/omap4iss/iss_csi2.c:769:
+Short_pack:%d,
+ECC:%d,

WARNING: quoted string split across lines
#802: drivers/staging/media/omap4iss/iss_csi2.c:770:
+ECC:%d,
+CPXIO:%d,

WARNING: quoted string split across lines
#803: drivers/staging/media/omap4iss/iss_csi2.c:771:
+CPXIO:%d,
+FIFO_OVF:%d,

WARNING: quoted string split across lines
#804: drivers/staging/media/omap4iss/iss_csi2.c:772:
+FIFO_OVF:%d,
+   \n,

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#1649: drivers/staging/media/omap4iss/iss_csiphy.c:81:
+   printk(KERN_ERR CSI2 CIO set power failed!\n);

WARNING: line over 80 characters
#1749: drivers/staging/media/omap4iss/iss_csiphy.c:181:
+   if (lanes-data[i].pol  1 || lanes-data[i].pos  
(csi2-phy-max_data_lanes + 1))

WARNING: line over 80 characters
#1759: drivers/staging/media/omap4iss/iss_csiphy.c:191:
+   if (lanes-clk.pol  1 || lanes-clk.pos  (csi2-phy-max_data_lanes + 
1))

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linuxtv-media:master 100/499] WARNING: usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt

2014-02-05 Thread Fengguang Wu

Hi Laurent,

FYI, there are new warnings show up in

tree:   git://linuxtv.org/media_tree.git master
head:   9fd9330c2d0ae6c149ec817ec71797f943db98b4
commit: ca6f19b1cf0fac0fdf1ef06d6bed0f07f8f37ae9 [100/499] [media] v4l: 
omap4iss: Replace udelay/msleep with usleep_range
:: branch date: 15 minutes ago
:: commit date: 9 weeks ago

scripts/checkpatch.pl 
0001-media-v4l-omap4iss-Replace-udelay-msleep-with-usleep.patch
# many are suggestions rather than must-fix

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#31: drivers/staging/media/omap4iss/iss.c:649:
+   usleep_range(10, 10);

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linuxtv-media:master 91/499] WARNING: usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt

2014-02-05 Thread Fengguang Wu

Hi Sergio,

FYI, there are new warnings show up in

tree:   git://linuxtv.org/media_tree.git master
head:   c29b8f3149f2916e98fc3b8d6c1df2137d003979
commit: b4a0477c0b87c5b7a20a84df8cf81311d1efb226 [91/499] [media] v4l: 
omap4iss: Add support for OMAP4 camera interface - CSI receivers
:: branch date: 44 minutes ago
:: commit date: 9 weeks ago

scripts/checkpatch.pl 
0001-media-v4l-omap4iss-Add-support-for-OMAP4-camera-inte.patch
# many are suggestions rather than must-fix

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#548: drivers/staging/media/omap4iss/iss_csi2.c:516:
+   usleep_range(100, 100);

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#552: drivers/staging/media/omap4iss/iss_csi2.c:520:
+   printk(KERN_ERR CSI2: Soft reset try count exceeded!\n);

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#566: drivers/staging/media/omap4iss/iss_csi2.c:534:
+   usleep_range(100, 100);

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#570: drivers/staging/media/omap4iss/iss_csi2.c:538:
+   printk(KERN_ERR

WARNING: quoted string split across lines
#789: drivers/staging/media/omap4iss/iss_csi2.c:757:
+   dev_dbg(iss-dev, CSI2: ComplexIO Error IRQ 
+   %x\n, cpxio1_irqstatus);

WARNING: quoted string split across lines
#799: drivers/staging/media/omap4iss/iss_csi2.c:767:
+   dev_dbg(iss-dev, CSI2 Err:
+OCP:%d,

WARNING: quoted string split across lines
#800: drivers/staging/media/omap4iss/iss_csi2.c:768:
+OCP:%d,
+Short_pack:%d,

WARNING: quoted string split across lines
#801: drivers/staging/media/omap4iss/iss_csi2.c:769:
+Short_pack:%d,
+ECC:%d,

WARNING: quoted string split across lines
#802: drivers/staging/media/omap4iss/iss_csi2.c:770:
+ECC:%d,
+CPXIO:%d,

WARNING: quoted string split across lines
#803: drivers/staging/media/omap4iss/iss_csi2.c:771:
+CPXIO:%d,
+FIFO_OVF:%d,

WARNING: quoted string split across lines
#804: drivers/staging/media/omap4iss/iss_csi2.c:772:
+FIFO_OVF:%d,
+   \n,

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#1649: drivers/staging/media/omap4iss/iss_csiphy.c:81:
+   printk(KERN_ERR CSI2 CIO set power failed!\n);

WARNING: line over 80 characters
#1749: drivers/staging/media/omap4iss/iss_csiphy.c:181:
+   if (lanes-data[i].pol  1 || lanes-data[i].pos  
(csi2-phy-max_data_lanes + 1))

WARNING: line over 80 characters
#1759: drivers/staging/media/omap4iss/iss_csiphy.c:191:
+   if (lanes-clk.pol  1 || lanes-clk.pos  (csi2-phy-max_data_lanes + 
1))

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[media:v4l_for_linus 91/499] WARNING: usleep_range should not use min == max args; see Documentation/timers/timers-howto.txt

2014-02-05 Thread Fengguang Wu

Hi Sergio,

FYI, there are new warnings show up in

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
v4l_for_linus
head:   6c3df5da67f1f53df78c7e20cd53a481dc28eade
commit: b4a0477c0b87c5b7a20a84df8cf81311d1efb226 [91/499] [media] v4l: 
omap4iss: Add support for OMAP4 camera interface - CSI receivers
:: branch date: 2 days ago
:: commit date: 8 weeks ago

scripts/checkpatch.pl 
0001-media-v4l-omap4iss-Add-support-for-OMAP4-camera-inte.patch
# many are suggestions rather than must-fix

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#548: drivers/staging/media/omap4iss/iss_csi2.c:516:
+   usleep_range(100, 100);

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#552: drivers/staging/media/omap4iss/iss_csi2.c:520:
+   printk(KERN_ERR CSI2: Soft reset try count exceeded!\n);

WARNING: usleep_range should not use min == max args; see 
Documentation/timers/timers-howto.txt
#566: drivers/staging/media/omap4iss/iss_csi2.c:534:
+   usleep_range(100, 100);

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#570: drivers/staging/media/omap4iss/iss_csi2.c:538:
+   printk(KERN_ERR

WARNING: quoted string split across lines
#789: drivers/staging/media/omap4iss/iss_csi2.c:757:
+   dev_dbg(iss-dev, CSI2: ComplexIO Error IRQ 
+   %x\n, cpxio1_irqstatus);

WARNING: quoted string split across lines
#799: drivers/staging/media/omap4iss/iss_csi2.c:767:
+   dev_dbg(iss-dev, CSI2 Err:
+OCP:%d,

WARNING: quoted string split across lines
#800: drivers/staging/media/omap4iss/iss_csi2.c:768:
+OCP:%d,
+Short_pack:%d,

WARNING: quoted string split across lines
#801: drivers/staging/media/omap4iss/iss_csi2.c:769:
+Short_pack:%d,
+ECC:%d,

WARNING: quoted string split across lines
#802: drivers/staging/media/omap4iss/iss_csi2.c:770:
+ECC:%d,
+CPXIO:%d,

WARNING: quoted string split across lines
#803: drivers/staging/media/omap4iss/iss_csi2.c:771:
+CPXIO:%d,
+FIFO_OVF:%d,

WARNING: quoted string split across lines
#804: drivers/staging/media/omap4iss/iss_csi2.c:772:
+FIFO_OVF:%d,
+   \n,

WARNING: Prefer netdev_err(netdev, ... then dev_err(dev, ... then pr_err(...  
to printk(KERN_ERR ...
#1649: drivers/staging/media/omap4iss/iss_csiphy.c:81:
+   printk(KERN_ERR CSI2 CIO set power failed!\n);

WARNING: line over 80 characters
#1749: drivers/staging/media/omap4iss/iss_csiphy.c:181:
+   if (lanes-data[i].pol  1 || lanes-data[i].pos  
(csi2-phy-max_data_lanes + 1))

WARNING: line over 80 characters
#1759: drivers/staging/media/omap4iss/iss_csiphy.c:191:
+   if (lanes-clk.pol  1 || lanes-clk.pos  (csi2-phy-max_data_lanes + 
1))

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linuxtv-media:master 224/499] WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends

2014-02-05 Thread Fengguang Wu

Hi Dinesh,

FYI, there are new warnings show up in

tree:   git://linuxtv.org/media_tree.git master
head:   c29b8f3149f2916e98fc3b8d6c1df2137d003979
commit: 5173332c1e420d49829bd7e4bc5c83b0205037c5 [224/499] [media] si4713: 
Modified i2c driver to handle cases where interrupts are not used
:: branch date: 2 hours ago
:: commit date: 7 weeks ago

scripts/checkpatch.pl 
0001-media-si4713-Modified-i2c-driver-to-handle-cases-whe.patch
# many are suggestions rather than must-fix

WARNING: msleep  20ms can sleep for up to 20ms; see 
Documentation/timers/timers-howto.txt
+   msleep(1);
WARNING: Comparing jiffies is almost always wrong; prefer time_after, 
time_before and friends
#95: drivers/media/radio/si4713/si4713.c:262:
+   } while (jiffies = until_jiffies);

WARNING: line over 80 characters
#153: drivers/media/radio/si4713/si4713.c:489:
+   !wait_for_completion_timeout(sdev-work, usecs_to_jiffies(usecs) + 
1))

WARNING: line over 80 characters
#175: drivers/media/radio/si4713/si4713.c:491:
+   (%s) Device took too much time to answer.\n, 
__func__);

WARNING: msleep  20ms can sleep for up to 20ms; see 
Documentation/timers/timers-howto.txt
+   msleep(3);

---
0-DAY kernel build testing backend  Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Conexant PCI-8604PW 4 channel BNC Video capture card (bttv)

2014-02-05 Thread Robert Longbottom


On 28 Jan 2014, at 02:02 AM, Daniel Glöckner daniel...@gmx.net wrote:

 On Mon, Jan 27, 2014 at 08:55:00PM +, Robert Longbottom wrote:
 As for the CPLD, there is not much we can do. I count 23 GPIOs going
 to that chip. And we don't know if some of these are outputs of the
 CPLD, making it a bit risky to just randomly drive values on those
 pins.
 
 Is that because it might do some damage to the card, or to the host
 computer, or both?
 
 If there is damage, it will most likely be restricted to the card.
 
 Or is it just too hard to make random guesses at
 what it should be doing?
 
 When we cycle through all combinations in one minute, there are about
 a hundred PCI cycles per combination left for the chip to be granted
 access to the bus. I expect most of the pins to provide a priority
 or weighting value for each BT878A, so there should be many combinations
 that do something.

How difficult is it for me to do this?  And is it obvious when it works? I have 
an old pc that I can put the card in that doesn't matter. And given I can't get 
the card to work in windows or Linux its not much use to me as it is, so if it 
breaks then so be it. 

I've not done any Linux driver development, but I'm happy enough compiling 
stuff for the most part. 

 Maybe the seller is nice person and provides the contents of the CD for
 free.

I tried contacting the seller via eBay, but no response so far, so I'm guessing 
he's not interested, which is a shame. 

Cheers,
Rob. 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] media: i2c: Kconfig: create dependency to MEDIA_CONTROLLER for adv7*

2014-02-05 Thread Marcus Folkesson
These chips makes use of the media_entity in the v4l2_subdev struct
and is therefor dependent of the  MEDIA_CONTROLLER config.

Signed-off-by: Marcus Folkesson marcus.folkes...@gmail.com
---
 drivers/media/i2c/Kconfig |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index d18be19..1771b77 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -196,7 +196,7 @@ config VIDEO_ADV7183
 
 config VIDEO_ADV7604
tristate Analog Devices ADV7604 decoder
-   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
---help---
  Support for the Analog Devices ADV7604 video decoder.
 
@@ -208,7 +208,7 @@ config VIDEO_ADV7604
 
 config VIDEO_ADV7842
tristate Analog Devices ADV7842 decoder
-   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
---help---
  Support for the Analog Devices ADV7842 video decoder.
 
@@ -431,7 +431,7 @@ config VIDEO_ADV7393
 
 config VIDEO_ADV7511
tristate Analog Devices ADV7511 encoder
-   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API
+   depends on VIDEO_V4L2  I2C  VIDEO_V4L2_SUBDEV_API  
MEDIA_CONTROLLER
---help---
  Support for the Analog Devices ADV7511 video encoder.
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 39/47] adv7604: Inline the to_sd function

2014-02-05 Thread Laurent Pinchart
This one line function is called in a single location. Inline it.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4815063..be75fa5 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -350,11 +350,6 @@ static inline struct adv7604_state *to_state(struct 
v4l2_subdev *sd)
return container_of(sd, struct adv7604_state, sd);
 }
 
-static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
-{
-   return container_of(ctrl-handler, struct adv7604_state, hdl)-sd;
-}
-
 static inline unsigned hblanking(const struct v4l2_bt_timings *t)
 {
return V4L2_DV_BT_BLANKING_WIDTH(t);
@@ -1280,7 +1275,9 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
 
 static int adv7604_s_ctrl(struct v4l2_ctrl *ctrl)
 {
-   struct v4l2_subdev *sd = to_sd(ctrl);
+   struct v4l2_subdev *sd =
+   container_of(ctrl-handler, struct adv7604_state, hdl)-sd;
+
struct adv7604_state *state = to_state(sd);
 
switch (ctrl-id) {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/47] adv7511: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7511.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index f8c75c6..de7ddf5 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -692,8 +692,6 @@ static const struct v4l2_subdev_video_ops adv7511_video_ops 
= {
.s_stream = adv7511_s_stream,
.s_dv_timings = adv7511_s_dv_timings,
.g_dv_timings = adv7511_g_dv_timings,
-   .enum_dv_timings = adv7511_enum_dv_timings,
-   .dv_timings_cap = adv7511_dv_timings_cap,
 };
 
 /* -- AUDIO OPS -- */
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/47] s5p-tv: hdmi: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/s5p-tv/hdmi_drv.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c 
b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 3db496c..754740f 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -693,7 +693,7 @@ static int hdmi_dv_timings_cap(struct v4l2_subdev *sd,
return -EINVAL;
 
/* Let the phy fill in the pixelclock range */
-   v4l2_subdev_call(hdev-phy_sd, video, dv_timings_cap, cap);
+   v4l2_subdev_call(hdev-phy_sd, pad, dv_timings_cap, cap);
cap-type = V4L2_DV_BT_656_1120;
cap-bt.min_width = 720;
cap-bt.max_width = 1920;
@@ -712,8 +712,6 @@ static const struct v4l2_subdev_core_ops hdmi_sd_core_ops = 
{
 static const struct v4l2_subdev_video_ops hdmi_sd_video_ops = {
.s_dv_timings = hdmi_s_dv_timings,
.g_dv_timings = hdmi_g_dv_timings,
-   .enum_dv_timings = hdmi_enum_dv_timings,
-   .dv_timings_cap = hdmi_dv_timings_cap,
.g_mbus_fmt = hdmi_g_mbus_fmt,
.s_stream = hdmi_s_stream,
 };
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 44/47] adv7604: Specify the default input through platform data

2014-02-05 Thread Laurent Pinchart
And set input routing when initializing the device.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 7 +++
 include/media/adv7604.h | 2 ++
 2 files changed, 9 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2f38071..e586c1c 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2419,6 +2419,13 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
 
disable_input(sd);
 
+   if (pdata-default_input = 0 
+   pdata-default_input  state-source_pad) {
+   state-selected_input = pdata-default_input;
+   select_input(sd);
+   enable_input(sd);
+   }
+
/* power */
io_write(sd, 0x0c, 0x42);   /* Power up part and power down VDP */
io_write(sd, 0x0b, 0x44);   /* Power down ESDP block */
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index dddb0cb..0cad7a7 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -94,6 +94,8 @@ struct adv7604_platform_data {
int hpd_gpio[4];
bool hpd_gpio_low[4];
 
+   int default_input;
+
/* Analog input muxing mode */
enum adv7604_ain_sel ain_sel;
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/47] tvp7002: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings operation is deprecated. Implement the
pad-level version of the operation to prepare for the removal of the
video version.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/tvp7002.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 912e1cc..9f56fd5 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -832,6 +832,9 @@ static int tvp7002_log_status(struct v4l2_subdev *sd)
 static int tvp7002_enum_dv_timings(struct v4l2_subdev *sd,
struct v4l2_enum_dv_timings *timings)
 {
+   if (timings-pad != 0)
+   return -EINVAL;
+
/* Check requested format index is within range */
if (timings-index = NUM_TIMINGS)
return -EINVAL;
@@ -937,6 +940,7 @@ static const struct v4l2_subdev_pad_ops tvp7002_pad_ops = {
.enum_mbus_code = tvp7002_enum_mbus_code,
.get_fmt = tvp7002_get_pad_format,
.set_fmt = tvp7002_set_pad_format,
+   .enum_dv_timings = tvp7002_enum_dv_timings,
 };
 
 /* V4L2 top level operation handlers */
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/47] ths8200: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/ths8200.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c
index e17e5155..0f1e952 100644
--- a/drivers/media/i2c/ths8200.c
+++ b/drivers/media/i2c/ths8200.c
@@ -432,8 +432,6 @@ static const struct v4l2_subdev_video_ops ths8200_video_ops 
= {
.s_stream = ths8200_s_stream,
.s_dv_timings = ths8200_s_dv_timings,
.g_dv_timings = ths8200_g_dv_timings,
-   .enum_dv_timings = ths8200_enum_dv_timings,
-   .dv_timings_cap = ths8200_dv_timings_cap,
 };
 
 static const struct v4l2_subdev_pad_ops ths8200_pad_ops = {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/47] v4l: of: Support empty port nodes

2014-02-05 Thread Laurent Pinchart
Empty port nodes are allowed but currently unsupported as the
v4l2_of_get_next_endpoint() function assumes that all port nodes have at
least an endpoint. Fix this.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/v4l2-core/v4l2-of.c | 52 +--
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index 42e3e8a..4c07343 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -166,43 +166,51 @@ struct device_node *v4l2_of_get_next_endpoint(const 
struct device_node *parent,
struct device_node *prev)
 {
struct device_node *endpoint;
-   struct device_node *port = NULL;
+   struct device_node *port;
 
if (!parent)
return NULL;
 
+   /*
+* Start by locating the port node. If no previous endpoint is specified
+* search for the first port node, otherwise get the previous endpoint
+* parent port node.
+*/
if (!prev) {
struct device_node *node;
-   /*
-* It's the first call, we have to find a port subnode
-* within this node or within an optional 'ports' node.
-*/
+
node = of_get_child_by_name(parent, ports);
if (node)
parent = node;
 
port = of_get_child_by_name(parent, port);
+   of_node_put(node);
 
-   if (port) {
-   /* Found a port, get an endpoint. */
-   endpoint = of_get_next_child(port, NULL);
-   of_node_put(port);
-   } else {
-   endpoint = NULL;
-   }
-
-   if (!endpoint)
-   pr_err(%s(): no endpoint nodes specified for %s\n,
+   if (!port) {
+   pr_err(%s(): no port node found in %s\n,
   __func__, parent-full_name);
-   of_node_put(node);
+   return NULL;
+   }
} else {
port = of_get_parent(prev);
-   if (!port)
+   if (!port) {
/* Hm, has someone given us the root node ?... */
return NULL;
+   }
 
-   /* Avoid dropping prev node refcount to 0. */
+   /*
+* Avoid dropping prev node refcount to 0 when getting the next
+* child below.
+*/
of_node_get(prev);
+   }
+
+   while (1) {
+   /*
+* Now that we have a port node, get the next endpoint by
+* getting the next child. If the previous endpoint is NULL this
+* will return the first child.
+*/
endpoint = of_get_next_child(port, prev);
if (endpoint) {
of_node_put(port);
@@ -210,18 +218,14 @@ struct device_node *v4l2_of_get_next_endpoint(const 
struct device_node *parent,
}
 
/* No more endpoints under this port, try the next one. */
+   prev = NULL;
+
do {
port = of_get_next_child(parent, port);
if (!port)
return NULL;
} while (of_node_cmp(port-name, port));
-
-   /* Pick up the first endpoint in this port. */
-   endpoint = of_get_next_child(port, NULL);
-   of_node_put(port);
}
-
-   return endpoint;
 }
 EXPORT_SYMBOL(v4l2_of_get_next_endpoint);
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 47/47] adv7604: Add endpoint properties to DT bindings

2014-02-05 Thread Laurent Pinchart
Add support for the hsync-active, vsync-active and pclk-sample
properties to the DT bindings and control BT.656 mode implicitly.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 13 +
 drivers/media/i2c/adv7604.c| 31 --
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 0845c50..2b62c06 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -30,6 +30,19 @@ Optional Properties:
   - adi,disable-cable-reset: Boolean property. When set disables the HDMI
 receiver automatic reset when the HDMI cable is unplugged.
 
+Optional Endpoint Properties:
+
+  The following three properties are defined in video-interfaces.txt and are
+  valid for source endpoints only.
+
+  - hsync-active: Horizontal synchronization polarity. Defaults to active low.
+  - vsync-active: Vertical synchronization polarity. Defaults to active low.
+  - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
+
+  If none of hsync-active, vsync-active and pclk-sample is specified the
+  endpoint will use embedded BT.656 synchronization.
+
+
 Example:
 
hdmi_receiver@4c {
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 064e57e..c5bc8bf 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -42,6 +42,7 @@
 #include media/v4l2-ctrls.h
 #include media/v4l2-device.h
 #include media/v4l2-dv-timings.h
+#include media/v4l2-of.h
 
 static int debug;
 module_param(debug, int, 0644);
@@ -2659,13 +2660,41 @@ MODULE_DEVICE_TABLE(of, adv7604_of_id);
 
 static int adv7604_parse_dt(struct adv7604_state *state)
 {
+   struct v4l2_of_endpoint bus_cfg;
+   struct device_node *endpoint;
struct device_node *np;
+   unsigned int flags;
unsigned int i;
int ret;
 
np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
state-info = of_match_node(adv7604_of_id, np)-data;
 
+   /* Parse the endpoint. */
+   endpoint = v4l2_of_get_next_endpoint(np, NULL);
+   if (!endpoint)
+   return -EINVAL;
+
+   v4l2_of_parse_endpoint(endpoint, bus_cfg);
+   of_node_put(endpoint);
+
+   flags = bus_cfg.bus.parallel.flags;
+
+   if (flags  V4L2_MBUS_HSYNC_ACTIVE_HIGH)
+   state-pdata.inv_hs_pol = 1;
+
+   if (flags  V4L2_MBUS_VSYNC_ACTIVE_HIGH)
+   state-pdata.inv_vs_pol = 1;
+
+   if (flags  V4L2_MBUS_PCLK_SAMPLE_RISING)
+   state-pdata.inv_llc_pol = 1;
+
+   if (bus_cfg.bus_type == V4L2_MBUS_BT656) {
+   state-pdata.insert_av_codes = 1;
+   state-pdata.op_656_range = 1;
+   }
+
+   /* Parse device-specific properties. */
state-pdata.disable_pwrdnb =
of_property_read_bool(np, adi,disable-power-down);
state-pdata.disable_cable_det_rst =
@@ -2706,9 +2735,7 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 
/* HACK: Hardcode the remaining platform data fields. */
state-pdata.blank_data = 1;
-   state-pdata.op_656_range = 1;
state-pdata.alt_data_sat = 1;
-   state-pdata.insert_av_codes = 1;
state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
 
return 0;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/47] v4l: Add 12-bit YUV 4:2:0 media bus pixel codes

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 288 +
 include/uapi/linux/v4l2-mediabus.h |   6 +-
 2 files changed, 293 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index e3cbbb4..a0fa7e0 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -2718,6 +2718,294 @@
  entryvsubscript1/subscript/entry
  entryvsubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-UYVY12-2X12
+ entryV4L2_MBUS_FMT_UYVY12_2X12/entry
+ entry0x201c/entry
+ entry/entry
+ dash-ent-20;
+ entryusubscript11/subscript/entry
+ entryusubscript10/subscript/entry
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ entryusubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryvsubscript11/subscript/entry
+ entryvsubscript10/subscript/entry
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row id=V4L2-MBUS-FMT-VYUY12-2X12
+ entryV4L2_MBUS_FMT_VYUY12_2X12/entry
+ entry0x201d/entry
+ entry/entry
+ dash-ent-20;
+ entryvsubscript11/subscript/entry
+ entryvsubscript10/subscript/entry
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-20;
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   

[PATCH 43/47] adv7604: Control hot-plug detect through a GPIO

2014-02-05 Thread Laurent Pinchart
Replace the ADV7604-specific hotplug notifier with a GPIO to control the
HPD pin directly instead of going through the bridge driver.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 47 +
 include/media/adv7604.h |  5 -
 2 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 369cb1e..2f38071 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -28,6 +28,7 @@
  */
 
 #include linux/delay.h
+#include linux/gpio.h
 #include linux/i2c.h
 #include linux/kernel.h
 #include linux/module.h
@@ -608,6 +609,23 @@ static inline int edid_write_block(struct v4l2_subdev *sd,
return err;
 }
 
+static void adv7604_set_hpd(struct adv7604_state *state, unsigned int hpd)
+{
+   unsigned int i;
+
+   for (i = 0; i  state-info-num_dv_ports; ++i) {
+   unsigned int enable = hpd  BIT(i);
+
+   if (IS_ERR_VALUE(state-pdata.hpd_gpio[i]))
+   continue;
+
+   if (state-pdata.hpd_gpio_low[i])
+   enable = !enable;
+
+   gpio_set_value_cansleep(state-pdata.hpd_gpio[i], enable);
+   }
+}
+
 static void adv7604_delayed_work_enable_hotplug(struct work_struct *work)
 {
struct delayed_work *dwork = to_delayed_work(work);
@@ -617,7 +635,7 @@ static void adv7604_delayed_work_enable_hotplug(struct 
work_struct *work)
 
v4l2_dbg(2, debug, sd, %s: enable hotplug\n, __func__);
 
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present);
+   adv7604_set_hpd(state, state-edid.present);
 }
 
 static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg)
@@ -2022,7 +2040,6 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
struct adv7604_state *state = to_state(sd);
const struct adv7604_chip_info *info = state-info;
int spa_loc;
-   int tmp = 0;
int err;
int i;
 
@@ -2033,7 +2050,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
if (edid-blocks == 0) {
/* Disable hotplug and I2C access to EDID RAM from DDC port */
state-edid.present = ~(1  edid-pad);
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void 
*)state-edid.present);
+   adv7604_set_hpd(state, state-edid.present);
rep_write_clr_set(sd, info-edid_enable_reg, 0x0f, 
state-edid.present);
 
/* Fall back to a 16:9 aspect ratio */
@@ -2059,7 +2076,7 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
 
/* Disable hotplug and I2C access to EDID RAM from DDC port */
cancel_delayed_work_sync(state-delayed_work_enable_hotplug);
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)tmp);
+   adv7604_set_hpd(state, 0);
rep_write_clr_set(sd, info-edid_enable_reg, 0x0f, 0x00);
 
spa_loc = get_edid_spa_location(edid-edid);
@@ -2655,6 +2672,28 @@ static int adv7604_probe(struct i2c_client *client,
return -ENODEV;
}
state-pdata = *pdata;
+
+   /* Request GPIOs. */
+   for (i = 0; i  state-info-num_dv_ports; ++i) {
+   char name[5];
+
+   if (IS_ERR_VALUE(state-pdata.hpd_gpio[i]))
+   continue;
+
+   sprintf(name, hpd%u, i);
+   err = devm_gpio_request_one(client-dev,
+   state-pdata.hpd_gpio[i],
+   state-pdata.hpd_gpio_low[i] ?
+   GPIOF_OUT_INIT_HIGH :
+   GPIOF_OUT_INIT_LOW,
+   name);
+   if (err  0) {
+   v4l_err(client, Failed to request HPD %u GPIO (%u)\n,
+   i, state-pdata.hpd_gpio[i]);
+   return err;
+   }
+   }
+
state-timings = cea640x480;
state-format = adv7604_format_info(state, V4L2_MBUS_FMT_YUYV8_2X8);
 
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index 4da678c..dddb0cb 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -90,6 +90,10 @@ struct adv7604_platform_data {
/* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */
unsigned disable_cable_det_rst:1;
 
+   /* Hot-Plug Detect control GPIOs */
+   int hpd_gpio[4];
+   bool hpd_gpio_low[4];
+
/* Analog input muxing mode */
enum adv7604_ain_sel ain_sel;
 
@@ -133,7 +137,6 @@ struct adv7604_platform_data {
 #define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 
0x1002)
 
 /* notify events */
-#define ADV7604_HOTPLUG1
 #define ADV7604_FMT_CHANGE 2
 
 #endif
-- 
1.8.3.2

--
To 

[PATCH 40/47] adv7604: Store I2C addresses and clients in arrays

2014-02-05 Thread Laurent Pinchart
This allows replacing duplicate code blocks by loops over the arrays.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 248 +---
 include/media/adv7604.h |  30 +++---
 2 files changed, 88 insertions(+), 190 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index be75fa5..2733584 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -169,18 +169,7 @@ struct adv7604_state {
bool restart_stdi_once;
 
/* i2c clients */
-   struct i2c_client *i2c_avlink;
-   struct i2c_client *i2c_cec;
-   struct i2c_client *i2c_infoframe;
-   struct i2c_client *i2c_esdp;
-   struct i2c_client *i2c_dpp;
-   struct i2c_client *i2c_afe;
-   struct i2c_client *i2c_repeater;
-   struct i2c_client *i2c_edid;
-   struct i2c_client *i2c_hdmi;
-   struct i2c_client *i2c_test;
-   struct i2c_client *i2c_cp;
-   struct i2c_client *i2c_vdp;
+   struct i2c_client *i2c_clients[ADV7604_PAGE_MAX];
 
/* controls */
struct v4l2_ctrl *detect_tx_5v_ctrl;
@@ -387,14 +376,18 @@ static s32 adv_smbus_read_byte_data_check(struct 
i2c_client *client,
return -EIO;
 }
 
-static s32 adv_smbus_read_byte_data(struct i2c_client *client, u8 command)
+static s32 adv_smbus_read_byte_data(struct adv7604_state *state,
+   enum adv7604_page page, u8 command)
 {
-   return adv_smbus_read_byte_data_check(client, command, true);
+   return adv_smbus_read_byte_data_check(state-i2c_clients[page],
+ command, true);
 }
 
-static s32 adv_smbus_write_byte_data(struct i2c_client *client,
-   u8 command, u8 value)
+static s32 adv_smbus_write_byte_data(struct adv7604_state *state,
+enum adv7604_page page, u8 command,
+u8 value)
 {
+   struct i2c_client *client = state-i2c_clients[page];
union i2c_smbus_data data;
int err;
int i;
@@ -414,9 +407,11 @@ static s32 adv_smbus_write_byte_data(struct i2c_client 
*client,
return err;
 }
 
-static s32 adv_smbus_write_i2c_block_data(struct i2c_client *client,
-  u8 command, unsigned length, const u8 *values)
+static s32 adv_smbus_write_i2c_block_data(struct adv7604_state *state,
+ enum adv7604_page page, u8 command,
+ unsigned length, const u8 *values)
 {
+   struct i2c_client *client = state-i2c_clients[page];
union i2c_smbus_data data;
 
if (length  I2C_SMBUS_BLOCK_MAX)
@@ -432,16 +427,16 @@ static s32 adv_smbus_write_i2c_block_data(struct 
i2c_client *client,
 
 static inline int io_read(struct v4l2_subdev *sd, u8 reg)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_read_byte_data(client, reg);
+   return adv_smbus_read_byte_data(state, ADV7604_PAGE_IO, reg);
 }
 
 static inline int io_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_write_byte_data(client, reg, val);
+   return adv_smbus_write_byte_data(state, ADV7604_PAGE_IO, reg, val);
 }
 
 static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
@@ -453,28 +448,28 @@ static inline int avlink_read(struct v4l2_subdev *sd, u8 
reg)
 {
struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_read_byte_data(state-i2c_avlink, reg);
+   return adv_smbus_read_byte_data(state, ADV7604_PAGE_AVLINK, reg);
 }
 
 static inline int avlink_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_write_byte_data(state-i2c_avlink, reg, val);
+   return adv_smbus_write_byte_data(state, ADV7604_PAGE_AVLINK, reg, val);
 }
 
 static inline int cec_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_read_byte_data(state-i2c_cec, reg);
+   return adv_smbus_read_byte_data(state, ADV7604_PAGE_CEC, reg);
 }
 
 static inline int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_write_byte_data(state-i2c_cec, reg, val);
+   return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val);
 }
 
 static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
@@ -486,70 +481,71 @@ static inline int infoframe_read(struct v4l2_subdev *sd, 
u8 reg)
 {
struct adv7604_state *state = to_state(sd);
 
-   return adv_smbus_read_byte_data(state-i2c_infoframe, reg);
+   return 

[PATCH 28/47] adv7604: Add missing include to linux/types.h

2014-02-05 Thread Laurent Pinchart
From: Lars-Peter Clausen l...@metafoo.de

The file is using u8 which is defined in linux/types.h.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/adv7604.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index d262a3a..c6b3937 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -21,6 +21,8 @@
 #ifndef _ADV7604_
 #define _ADV7604_
 
+#include linux/types.h
+
 /* Analog input muxing modes (AFE register 0x02, [2:0]) */
 enum adv7604_ain_sel {
ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 41/47] adv7604: Replace *_and_or() functions with *_clr_set()

2014-02-05 Thread Laurent Pinchart
The *_and_or() functions take an 'and' bitmask to be ANDed with the
register value before ORing it with th 'or' bitmask. As the functions
are used to mask and set bits selectively, this requires the caller to
invert the 'and' bitmask and is thus error prone. Replace those
functions with a *_clr_set() variant that takes a mask of bits to be
cleared instead of a mask of bits to be kept.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 86 ++---
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2733584..c34cfd6 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -439,9 +439,9 @@ static inline int io_write(struct v4l2_subdev *sd, u8 reg, 
u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_IO, reg, val);
 }
 
-static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
+static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
 {
-   return io_write(sd, reg, (io_read(sd, reg)  mask) | val);
+   return io_write(sd, reg, (io_read(sd, reg)  ~mask) | val);
 }
 
 static inline int avlink_read(struct v4l2_subdev *sd, u8 reg)
@@ -472,9 +472,9 @@ static inline int cec_write(struct v4l2_subdev *sd, u8 reg, 
u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_CEC, reg, val);
 }
 
-static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
+static inline int cec_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
 {
-   return cec_write(sd, reg, (cec_read(sd, reg)  mask) | val);
+   return cec_write(sd, reg, (cec_read(sd, reg)  ~mask) | val);
 }
 
 static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg)
@@ -548,9 +548,9 @@ static inline int rep_write(struct v4l2_subdev *sd, u8 reg, 
u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_REP, reg, val);
 }
 
-static inline int rep_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
+static inline int rep_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
 {
-   return rep_write(sd, reg, (rep_read(sd, reg)  mask) | val);
+   return rep_write(sd, reg, (rep_read(sd, reg)  ~mask) | val);
 }
 
 static inline int edid_read(struct v4l2_subdev *sd, u8 reg)
@@ -639,9 +639,9 @@ static inline int hdmi_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_HDMI, reg, val);
 }
 
-static inline int hdmi_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
+static inline int hdmi_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
 {
-   return hdmi_write(sd, reg, (hdmi_read(sd, reg)  mask) | val);
+   return hdmi_write(sd, reg, (hdmi_read(sd, reg)  ~mask) | val);
 }
 
 static inline int test_read(struct v4l2_subdev *sd, u8 reg)
@@ -677,9 +677,9 @@ static inline int cp_write(struct v4l2_subdev *sd, u8 reg, 
u8 val)
return adv_smbus_write_byte_data(state, ADV7604_PAGE_CP, reg, val);
 }
 
-static inline int cp_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
+static inline int cp_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
 {
-   return cp_write(sd, reg, (cp_read(sd, reg)  mask) | val);
+   return cp_write(sd, reg, (cp_read(sd, reg)  ~mask) | val);
 }
 
 static inline int vdp_read(struct v4l2_subdev *sd, u8 reg)
@@ -957,7 +957,7 @@ static int configure_predefined_video_timings(struct 
v4l2_subdev *sd,
io_write(sd, 0x17, 0x5a);
}
/* disable embedded syncs for auto graphics mode */
-   cp_write_and_or(sd, 0x81, 0xef, 0x00);
+   cp_write_clr_set(sd, 0x81, 0x10, 0x00);
cp_write(sd, 0x8f, 0x00);
cp_write(sd, 0x90, 0x00);
cp_write(sd, 0xa2, 0x00);
@@ -1015,7 +1015,7 @@ static void configure_custom_video_timings(struct 
v4l2_subdev *sd,
io_write(sd, 0x00, 0x07); /* video std */
io_write(sd, 0x01, 0x02); /* prim mode */
/* enable embedded syncs for auto graphics mode */
-   cp_write_and_or(sd, 0x81, 0xef, 0x10);
+   cp_write_clr_set(sd, 0x81, 0x10, 0x10);
 
/* Should only be set in auto-graphics mode [REF_02, p. 91-92] 
*/
/* setup PLL_DIV_MAN_EN and PLL_DIV_RATIO */
@@ -1125,21 +1125,21 @@ static void set_rgb_quantization_range(struct 
v4l2_subdev *sd)
if (state-selected_input == ADV7604_PAD_VGA_RGB) {
/* Receiving analog RGB signal
 * Set RGB full range (0-255) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   io_write_clr_set(sd, 0x02, 0xf0, 0x10);
break;
}
 
if (state-selected_input == ADV7604_PAD_VGA_COMP) {
/* Receiving analog 

[PATCH 30/47] adv7604: Don't put info string arrays on the stack

2014-02-05 Thread Laurent Pinchart
From: Lars-Peter Clausen l...@metafoo.de

We do not want to modify the info string arrays ever, so no need to
waste stack space for them. While we are at it also make them const.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 98ac383..cfcbb6d 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1886,13 +1886,13 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
struct stdi_readback stdi;
u8 reg_io_0x02 = io_read(sd, 0x02);
 
-   char *csc_coeff_sel_rb[16] = {
+   static const char * const csc_coeff_sel_rb[16] = {
bypassed, YPbPr601 - RGB, reserved, YPbPr709 - RGB,
reserved, RGB - YPbPr601, reserved, RGB - YPbPr709,
reserved, YPbPr709 - YPbPr601, YPbPr601 - YPbPr709,
reserved, reserved, reserved, reserved, manual
};
-   char *input_color_space_txt[16] = {
+   static const char * const input_color_space_txt[16] = {
RGB limited range (16-235), RGB full range (0-255),
YCbCr Bt.601 (16-235), YCbCr Bt.709 (16-235),
xvYCC Bt.601, xvYCC Bt.709,
@@ -1900,12 +1900,12 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
invalid, invalid, invalid, invalid, invalid,
invalid, invalid, automatic
};
-   char *rgb_quantization_range_txt[] = {
+   static const char * const rgb_quantization_range_txt[] = {
Automatic,
RGB limited range (16-235),
RGB full range (0-255),
};
-   char *deep_color_mode_txt[4] = {
+   static const char * const deep_color_mode_txt[4] = {
8-bits per channel,
10-bits per channel,
12-bits per channel,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/47] ADV7611 support

2014-02-05 Thread Laurent Pinchart
Hello,

This patch set implements support for the ADV7611 in the adv7604 driver. It
also comes up with new features such as output format configuration through
pad format operations, hot-plug detect control through GPIO and DT support.

Patches 06/47 to 27/47 replace the subdev video DV timings query cap and enum
operations with pad-level equivalents. I've split driver changes in one patch
per driver to make review easier, but I can squash them together if desired.

Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Tomasz Stanislawski t.stanisl...@samsung.com
Cc: Scott Jiang scott.jiang.li...@gmail.com
Cc: Prabhakar Lad prabhakar.cse...@gmail.com

Lars-Peter Clausen (4):
  adv7604: Add missing include to linux/types.h
  adv7604: Add support for asynchronous probing
  adv7604: Don't put info string arrays on the stack
  adv7604: Add adv7611 support

Laurent Pinchart (43):
  v4l: of: Support empty port nodes
  v4l: Add UYVY10_2X10 and VYUY10_2X10 media bus pixel codes
  v4l: Add UYVY10_1X20 and VYUY10_1X20 media bus pixel codes
  v4l: Add 12-bit YUV 4:2:0 media bus pixel codes
  v4l: Add 12-bit YUV 4:2:2 media bus pixel codes
  v4l: Add pad-level DV timings subdev operations
  ad9389b: Add pad-level DV timings operations
  adv7511: Add pad-level DV timings operations
  adv7842: Add pad-level DV timings operations
  s5p-tv: hdmi: Add pad-level DV timings operations
  s5p-tv: hdmiphy: Add pad-level DV timings operations
  ths8200: Add pad-level DV timings operations
  tvp7002: Add pad-level DV timings operations
  media: bfin_capture: Switch to pad-level DV operations
  media: davinci: vpif: Switch to pad-level DV operations
  media: staging: davinci: vpfe: Switch to pad-level DV operations
  s5p-tv: mixer: Switch to pad-level DV operations
  ad9389b: Remove deprecated video-level DV timings operations
  adv7511: Remove deprecated video-level DV timings operations
  adv7842: Remove deprecated video-level DV timings operations
  s5p-tv: hdmi: Remove deprecated video-level DV timings operations
  s5p-tv: hdmiphy: Remove deprecated video-level DV timings operation
  ths8200: Remove deprecated video-level DV timings operations
  tvp7002: Remove deprecated video-level DV timings operations
  v4l: subdev: Remove deprecated video-level DV timings operations
  v4l: Improve readability by not wrapping ioctl number #define's
  v4l: Add support for DV timings ioctls on subdev nodes
  adv7604: Add 16-bit read functions for CP and HDMI
  adv7604: Cache register contents when reading multiple bits
  adv7604: Remove subdev control handlers
  adv7604: Add sink pads
  adv7604: Make output format configurable through pad format operations
  adv7604: Add pad-level DV timings support
  adv7604: Remove deprecated video-level DV timings operations
  adv7604: Inline the to_sd function
  adv7604: Store I2C addresses and clients in arrays
  adv7604: Replace *_and_or() functions with *_clr_set()
  adv7604: Sort headers alphabetically
  adv7604: Control hot-plug detect through a GPIO
  adv7604: Specify the default input through platform data
  adv7604: Add DT support
  adv7604: Add LLC polarity configuration
  adv7604: Add endpoint properties to DT bindings

 Documentation/DocBook/media/v4l/subdev-formats.xml |  760 ++
 .../DocBook/media/v4l/vidioc-dv-timings-cap.xml|   27 +-
 .../DocBook/media/v4l/vidioc-enum-dv-timings.xml   |   27 +-
 .../devicetree/bindings/media/i2c/adv7604.txt  |   69 +
 drivers/media/i2c/ad9389b.c|   67 +-
 drivers/media/i2c/adv7511.c|   69 +-
 drivers/media/i2c/adv7604.c| 1465 ++--
 drivers/media/i2c/adv7842.c|   10 +-
 drivers/media/i2c/ths8200.c|   10 +
 drivers/media/i2c/tvp7002.c|5 +-
 drivers/media/platform/blackfin/bfin_capture.c |4 +-
 drivers/media/platform/davinci/vpif_capture.c  |4 +-
 drivers/media/platform/davinci/vpif_display.c  |4 +-
 drivers/media/platform/s5p-tv/hdmi_drv.c   |   14 +-
 drivers/media/platform/s5p-tv/hdmiphy_drv.c|9 +-
 drivers/media/platform/s5p-tv/mixer_video.c|8 +-
 drivers/media/v4l2-core/v4l2-of.c  |   52 +-
 drivers/media/v4l2-core/v4l2-subdev.c  |   15 +
 drivers/staging/media/davinci_vpfe/vpfe_video.c|4 +-
 include/media/adv7604.h|  109 +-
 include/media/v4l2-subdev.h|8 +-
 include/uapi/linux/v4l2-mediabus.h |   14 +-
 include/uapi/linux/v4l2-subdev.h   |   38 +-
 include/uapi/linux/videodev2.h |8 +-
 24 files changed, 2164 insertions(+), 636 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More 

[PATCH 42/47] adv7604: Sort headers alphabetically

2014-02-05 Thread Laurent Pinchart
This helps locating duplicates and inserting new headers.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index c34cfd6..369cb1e 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -27,19 +27,19 @@
  * REF_03 - Analog devices, ADV7604, Hardware Manual, Rev. F, August 2010
  */
 
-
+#include linux/delay.h
+#include linux/i2c.h
 #include linux/kernel.h
 #include linux/module.h
 #include linux/slab.h
-#include linux/i2c.h
-#include linux/delay.h
+#include linux/v4l2-dv-timings.h
 #include linux/videodev2.h
 #include linux/workqueue.h
-#include linux/v4l2-dv-timings.h
-#include media/v4l2-device.h
+
+#include media/adv7604.h
 #include media/v4l2-ctrls.h
+#include media/v4l2-device.h
 #include media/v4l2-dv-timings.h
-#include media/adv7604.h
 
 static int debug;
 module_param(debug, int, 0644);
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 32/47] adv7604: Cache register contents when reading multiple bits

2014-02-05 Thread Laurent Pinchart
When extracting multiple bits from a single register read the register
once and extract the bits on the read value.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 3d6876d..2a044d1 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1207,6 +1207,8 @@ static int stdi2dv_timings(struct v4l2_subdev *sd,
 
 static int read_stdi(struct v4l2_subdev *sd, struct stdi_readback *stdi)
 {
+   u8 polarity;
+
if (no_lock_stdi(sd) || no_lock_sspd(sd)) {
v4l2_dbg(2, debug, sd, %s: STDI and/or SSPD not locked\n, 
__func__);
return -1;
@@ -1219,11 +1221,12 @@ static int read_stdi(struct v4l2_subdev *sd, struct 
stdi_readback *stdi)
stdi-interlaced = io_read(sd, 0x12)  0x10;
 
/* read SSPD */
-   if ((cp_read(sd, 0xb5)  0x03) == 0x01) {
-   stdi-hs_pol = ((cp_read(sd, 0xb5)  0x10) ?
-   ((cp_read(sd, 0xb5)  0x08) ? '+' : '-') : 'x');
-   stdi-vs_pol = ((cp_read(sd, 0xb5)  0x40) ?
-   ((cp_read(sd, 0xb5)  0x20) ? '+' : '-') : 'x');
+   polarity = cp_read(sd, 0xb5);
+   if ((polarity  0x03) == 0x01) {
+   stdi-hs_pol = polarity  0x10
+? (polarity  0x08 ? '+' : '-') : 'x';
+   stdi-vs_pol = polarity  0x40
+? (polarity  0x20 ? '+' : '-') : 'x';
} else {
stdi-hs_pol = 'x';
stdi-vs_pol = 'x';
@@ -1885,6 +1888,8 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
struct v4l2_dv_timings timings;
struct stdi_readback stdi;
u8 reg_io_0x02 = io_read(sd, 0x02);
+   u8 edid_enabled;
+   u8 cable_det;
 
static const char * const csc_coeff_sel_rb[16] = {
bypassed, YPbPr601 - RGB, reserved, YPbPr709 - RGB,
@@ -1914,20 +1919,22 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
 
v4l2_info(sd, -Chip status-\n);
v4l2_info(sd, Chip power: %s\n, no_power(sd) ? off : on);
+   edid_enabled = rep_read(sd, 0x7d);
v4l2_info(sd, EDID enabled port A: %s, B: %s, C: %s, D: %s\n,
-   ((rep_read(sd, 0x7d)  0x01) ? Yes : No),
-   ((rep_read(sd, 0x7d)  0x02) ? Yes : No),
-   ((rep_read(sd, 0x7d)  0x04) ? Yes : No),
-   ((rep_read(sd, 0x7d)  0x08) ? Yes : No));
+   ((edid_enabled  0x01) ? Yes : No),
+   ((edid_enabled  0x02) ? Yes : No),
+   ((edid_enabled  0x04) ? Yes : No),
+   ((edid_enabled  0x08) ? Yes : No));
v4l2_info(sd, CEC: %s\n, !!(cec_read(sd, 0x2a)  0x01) ?
enabled : disabled);
 
v4l2_info(sd, -Signal status-\n);
+   cable_det = io_read(sd, 0x6f);
v4l2_info(sd, Cable detected (+5V power) port A: %s, B: %s, C: %s, D: 
%s\n,
-   ((io_read(sd, 0x6f)  0x10) ? Yes : No),
-   ((io_read(sd, 0x6f)  0x08) ? Yes : No),
-   ((io_read(sd, 0x6f)  0x04) ? Yes : No),
-   ((io_read(sd, 0x6f)  0x02) ? Yes : No));
+   ((cable_det  0x10) ? Yes : No),
+   ((cable_det  0x08) ? Yes : No),
+   ((cable_det  0x04) ? Yes : No),
+   ((cable_det  0x02) ? Yes : No));
v4l2_info(sd, TMDS signal detected: %s\n,
no_signal_tmds(sd) ? false : true);
v4l2_info(sd, TMDS signal locked: %s\n,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/47] v4l: Add UYVY10_1X20 and VYUY10_1X20 media bus pixel codes

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 104 +
 include/uapi/linux/v4l2-mediabus.h |   4 +-
 2 files changed, 107 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 6fb58de..e3cbbb4 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -2436,6 +2436,110 @@
  entryvsubscript1/subscript/entry
  entryvsubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-UYVY10-1X20
+ entryV4L2_MBUS_FMT_UYVY10_1X20/entry
+ entry0x201a/entry
+ entry/entry
+ dash-ent-12;
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ entryusubscript0/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-12;
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row id=V4L2-MBUS-FMT-VYUY10-1X20
+ entryV4L2_MBUS_FMT_VYUY10_1X20/entry
+ entry0x201b/entry
+ entry/entry
+ dash-ent-12;
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-12;
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ entryusubscript0/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ 

[PATCH 31/47] adv7604: Add 16-bit read functions for CP and HDMI

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 48 ++---
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cfcbb6d..3d6876d 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -542,6 +542,11 @@ static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg)
return adv_smbus_read_byte_data(state-i2c_hdmi, reg);
 }
 
+static u16 hdmi_read16(struct v4l2_subdev *sd, u8 reg, u16 mask)
+{
+   return ((hdmi_read(sd, reg)  8) | hdmi_read(sd, reg + 1))  mask;
+}
+
 static inline int hdmi_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
struct adv7604_state *state = to_state(sd);
@@ -575,6 +580,11 @@ static inline int cp_read(struct v4l2_subdev *sd, u8 reg)
return adv_smbus_read_byte_data(state-i2c_cp, reg);
 }
 
+static u16 cp_read16(struct v4l2_subdev *sd, u8 reg, u16 mask)
+{
+   return ((cp_read(sd, reg)  8) | cp_read(sd, reg + 1))  mask;
+}
+
 static inline int cp_write(struct v4l2_subdev *sd, u8 reg, u8 val)
 {
struct adv7604_state *state = to_state(sd);
@@ -1203,8 +1213,8 @@ static int read_stdi(struct v4l2_subdev *sd, struct 
stdi_readback *stdi)
}
 
/* read STDI */
-   stdi-bl = ((cp_read(sd, 0xb1)  0x3f)  8) | cp_read(sd, 0xb2);
-   stdi-lcf = ((cp_read(sd, 0xb3)  0x7)  8) | cp_read(sd, 0xb4);
+   stdi-bl = cp_read16(sd, 0xb1, 0x3fff);
+   stdi-lcf = cp_read16(sd, 0xb3, 0x7ff);
stdi-lcvs = cp_read(sd, 0xb3)  3;
stdi-interlaced = io_read(sd, 0x12)  0x10;
 
@@ -1315,8 +1325,8 @@ static int adv7604_query_dv_timings(struct v4l2_subdev 
*sd,
 
timings-type = V4L2_DV_BT_656_1120;
 
-   bt-width = (hdmi_read(sd, 0x07)  0x0f) * 256 + hdmi_read(sd, 
0x08);
-   bt-height = (hdmi_read(sd, 0x09)  0x0f) * 256 + hdmi_read(sd, 
0x0a);
+   bt-width = hdmi_read16(sd, 0x07, 0xfff);
+   bt-height = hdmi_read16(sd, 0x09, 0xfff);
freq = (hdmi_read(sd, 0x06) * 100) +
((hdmi_read(sd, 0x3b)  0x30)  4) * 25;
if (is_hdmi(sd)) {
@@ -1326,29 +1336,19 @@ static int adv7604_query_dv_timings(struct v4l2_subdev 
*sd,
freq = freq * 8 / bits_per_channel;
}
bt-pixelclock = freq;
-   bt-hfrontporch = (hdmi_read(sd, 0x20)  0x03) * 256 +
-   hdmi_read(sd, 0x21);
-   bt-hsync = (hdmi_read(sd, 0x22)  0x03) * 256 +
-   hdmi_read(sd, 0x23);
-   bt-hbackporch = (hdmi_read(sd, 0x24)  0x03) * 256 +
-   hdmi_read(sd, 0x25);
-   bt-vfrontporch = ((hdmi_read(sd, 0x2a)  0x1f) * 256 +
-   hdmi_read(sd, 0x2b)) / 2;
-   bt-vsync = ((hdmi_read(sd, 0x2e)  0x1f) * 256 +
-   hdmi_read(sd, 0x2f)) / 2;
-   bt-vbackporch = ((hdmi_read(sd, 0x32)  0x1f) * 256 +
-   hdmi_read(sd, 0x33)) / 2;
+   bt-hfrontporch = hdmi_read16(sd, 0x20, 0x3ff);
+   bt-hsync = hdmi_read16(sd, 0x22, 0x3ff);
+   bt-hbackporch = hdmi_read16(sd, 0x24, 0x3ff);
+   bt-vfrontporch = hdmi_read16(sd, 0x2a, 0x1fff) / 2;
+   bt-vsync = hdmi_read16(sd, 0x2e, 0x1fff) / 2;
+   bt-vbackporch = hdmi_read16(sd, 0x32, 0x1fff) / 2;
bt-polarities = ((hdmi_read(sd, 0x05)  0x10) ? 
V4L2_DV_VSYNC_POS_POL : 0) |
((hdmi_read(sd, 0x05)  0x20) ? V4L2_DV_HSYNC_POS_POL : 
0);
if (bt-interlaced == V4L2_DV_INTERLACED) {
-   bt-height += (hdmi_read(sd, 0x0b)  0x0f) * 256 +
-   hdmi_read(sd, 0x0c);
-   bt-il_vfrontporch = ((hdmi_read(sd, 0x2c)  0x1f) * 
256 +
-   hdmi_read(sd, 0x2d)) / 2;
-   bt-il_vsync = ((hdmi_read(sd, 0x30)  0x1f) * 256 +
-   hdmi_read(sd, 0x31)) / 2;
-   bt-vbackporch = ((hdmi_read(sd, 0x34)  0x1f) * 256 +
-   hdmi_read(sd, 0x35)) / 2;
+   bt-height += hdmi_read16(sd, 0x0b, 0xfff);
+   bt-il_vfrontporch = hdmi_read16(sd, 0x2c, 0x1fff) / 2;
+   bt-il_vsync = hdmi_read16(sd, 0x30, 0x1fff) / 2;
+   bt-vbackporch = hdmi_read16(sd, 0x34, 0x1fff) / 2;
}
adv7604_fill_optional_dv_timings_fields(sd, timings);
} else {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 38/47] adv7604: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 35 +--
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 0925fe8..4815063 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1537,16 +1537,20 @@ static int adv7604_enum_dv_timings(struct v4l2_subdev 
*sd,
return 0;
 }
 
-static int __adv7604_dv_timings_cap(struct v4l2_subdev *sd,
-   struct v4l2_dv_timings_cap *cap,
-   unsigned int pad)
+static int adv7604_dv_timings_cap(struct v4l2_subdev *sd,
+   struct v4l2_dv_timings_cap *cap)
 {
+   struct adv7604_state *state = to_state(sd);
+
+   if (cap-pad = state-source_pad)
+   return -EINVAL;
+
cap-type = V4L2_DV_BT_656_1120;
cap-bt.max_width = 1920;
cap-bt.max_height = 1200;
cap-bt.min_pixelclock = 2500;
 
-   switch (pad) {
+   switch (cap-pad) {
case ADV7604_PAD_HDMI_PORT_A:
case ADV7604_PAD_HDMI_PORT_B:
case ADV7604_PAD_HDMI_PORT_C:
@@ -1567,25 +1571,6 @@ static int __adv7604_dv_timings_cap(struct v4l2_subdev 
*sd,
return 0;
 }
 
-static int adv7604_dv_timings_cap(struct v4l2_subdev *sd,
-   struct v4l2_dv_timings_cap *cap)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   return __adv7604_dv_timings_cap(sd, cap, state-selected_input);
-}
-
-static int adv7604_pad_dv_timings_cap(struct v4l2_subdev *sd,
-   struct v4l2_dv_timings_cap *cap)
-{
-   struct adv7604_state *state = to_state(sd);
-
-   if (cap-pad = state-source_pad)
-   return -EINVAL;
-
-   return __adv7604_dv_timings_cap(sd, cap, cap-pad);
-}
-
 /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings
if the format is listed in adv7604_timings[] */
 static void adv7604_fill_optional_dv_timings_fields(struct v4l2_subdev *sd,
@@ -2430,8 +2415,6 @@ static const struct v4l2_subdev_video_ops 
adv7604_video_ops = {
.s_dv_timings = adv7604_s_dv_timings,
.g_dv_timings = adv7604_g_dv_timings,
.query_dv_timings = adv7604_query_dv_timings,
-   .enum_dv_timings = adv7604_enum_dv_timings,
-   .dv_timings_cap = adv7604_dv_timings_cap,
 };
 
 static const struct v4l2_subdev_pad_ops adv7604_pad_ops = {
@@ -2440,7 +2423,7 @@ static const struct v4l2_subdev_pad_ops adv7604_pad_ops = 
{
.set_fmt = adv7604_set_format,
.get_edid = adv7604_get_edid,
.set_edid = adv7604_set_edid,
-   .dv_timings_cap = adv7604_pad_dv_timings_cap,
+   .dv_timings_cap = adv7604_dv_timings_cap,
.enum_dv_timings = adv7604_enum_dv_timings,
 };
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/47] s5p-tv: mixer: Switch to pad-level DV operations

2014-02-05 Thread Laurent Pinchart
The video-level enum_dv_timings and dv_timings_cap operations are
deprecated in favor of the pad-level versions. All subdev drivers
implement the pad-level versions, switch to them.

Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/s5p-tv/mixer_video.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_video.c 
b/drivers/media/platform/s5p-tv/mixer_video.c
index c5059ba..0d6b928 100644
--- a/drivers/media/platform/s5p-tv/mixer_video.c
+++ b/drivers/media/platform/s5p-tv/mixer_video.c
@@ -509,9 +509,11 @@ static int mxr_enum_dv_timings(struct file *file, void *fh,
struct mxr_device *mdev = layer-mdev;
int ret;
 
+   timings-pad = 0;
+
/* lock protects from changing sd_out */
mutex_lock(mdev-mutex);
-   ret = v4l2_subdev_call(to_outsd(mdev), video, enum_dv_timings, timings);
+   ret = v4l2_subdev_call(to_outsd(mdev), pad, enum_dv_timings, timings);
mutex_unlock(mdev-mutex);
 
return ret ? -EINVAL : 0;
@@ -567,9 +569,11 @@ static int mxr_dv_timings_cap(struct file *file, void *fh,
struct mxr_device *mdev = layer-mdev;
int ret;
 
+   cap-pad = 0;
+
/* lock protects from changing sd_out */
mutex_lock(mdev-mutex);
-   ret = v4l2_subdev_call(to_outsd(mdev), video, dv_timings_cap, cap);
+   ret = v4l2_subdev_call(to_outsd(mdev), pad, dv_timings_cap, cap);
mutex_unlock(mdev-mutex);
 
return ret ? -EINVAL : 0;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 25/47] v4l: subdev: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 2c7355a..ddea899 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -326,12 +326,8 @@ struct v4l2_subdev_video_ops {
struct v4l2_dv_timings *timings);
int (*g_dv_timings)(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings);
-   int (*enum_dv_timings)(struct v4l2_subdev *sd,
-   struct v4l2_enum_dv_timings *timings);
int (*query_dv_timings)(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings);
-   int (*dv_timings_cap)(struct v4l2_subdev *sd,
-   struct v4l2_dv_timings_cap *cap);
int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index,
 enum v4l2_mbus_pixelcode *code);
int (*enum_mbus_fsizes)(struct v4l2_subdev *sd,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 27/47] v4l: Add support for DV timings ioctls on subdev nodes

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 .../DocBook/media/v4l/vidioc-dv-timings-cap.xml| 27 ++
 .../DocBook/media/v4l/vidioc-enum-dv-timings.xml   | 27 +-
 drivers/media/v4l2-core/v4l2-subdev.c  | 15 
 include/uapi/linux/v4l2-subdev.h   |  5 
 4 files changed, 63 insertions(+), 11 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml 
b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
index cd7720d..baef771 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
@@ -1,11 +1,12 @@
 refentry id=vidioc-dv-timings-cap
   refmeta
-refentrytitleioctl VIDIOC_DV_TIMINGS_CAP/refentrytitle
+refentrytitleioctl VIDIOC_DV_TIMINGS_CAP, 
VIDIOC_SUBDEV_DV_TIMINGS_CAP/refentrytitle
 manvol;
   /refmeta
 
   refnamediv
 refnameVIDIOC_DV_TIMINGS_CAP/refname
+refnameVIDIOC_SUBDEV_DV_TIMINGS_CAP/refname
 refpurposeThe capabilities of the Digital Video 
receiver/transmitter/refpurpose
   /refnamediv
 
@@ -33,7 +34,7 @@
   varlistentry
termparameterrequest/parameter/term
listitem
- paraVIDIOC_DV_TIMINGS_CAP/para
+ paraVIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP/para
/listitem
   /varlistentry
   varlistentry
@@ -54,10 +55,19 @@
   interface and may change in the future./para
 /note
 
-paraTo query the capabilities of the DV receiver/transmitter 
applications can call
-this ioctl and the driver will fill in the structure. Note that drivers may 
return
+paraTo query the capabilities of the DV receiver/transmitter applications
+can call the constantVIDIOC_DV_TIMINGS_CAP/constant ioctl on a video node
+and the driver will fill in the structure. Note that drivers may return
 different values after switching the video input or output./para
 
+paraWhen implemented by the driver DV capabilities of subdevices can be
+queried by calling the constantVIDIOC_SUBDEV_DV_TIMINGS_CAP/constant ioctl
+directly on a subdevice node. The capabilities are specific to inputs (for DV
+receivers) or outputs (for DV transmitters), application must specify the
+desired pad number in the v4l2-dv-timings-cap; structfieldpad/structfield
+field. Attemps to query capabilities on a pad that doesn't support them will
+return an EINVAL;./para
+
 table pgwide=1 frame=none id=v4l2-bt-timings-cap
   titlestruct structnamev4l2_bt_timings_cap/structname/title
   tgroup cols=3
@@ -127,7 +137,14 @@ different values after switching the video input or 
output./para
  /row
  row
entry__u32/entry
-   entrystructfieldreserved/structfield[3]/entry
+   entrystructfieldpad/structfield/entry
+   entryPad number as reported by the media controller API. This 
field
+   is only used when operating on a subdevice node. When operating on a
+   video node applications must set this field to zero./entry
+ /row
+ row
+   entry__u32/entry
+   entrystructfieldreserved/structfield[2]/entry
entryReserved for future extensions. Drivers must set the array 
to zero./entry
  /row
  row
diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml 
b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
index b3e17c1..e55df46 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
@@ -1,11 +1,12 @@
 refentry id=vidioc-enum-dv-timings
   refmeta
-refentrytitleioctl VIDIOC_ENUM_DV_TIMINGS/refentrytitle
+refentrytitleioctl VIDIOC_ENUM_DV_TIMINGS, 
VIDIOC_SUBDEV_ENUM_DV_TIMINGS/refentrytitle
 manvol;
   /refmeta
 
   refnamediv
 refnameVIDIOC_ENUM_DV_TIMINGS/refname
+refnameVIDIOC_SUBDEV_ENUM_DV_TIMINGS/refname
 refpurposeEnumerate supported Digital Video timings/refpurpose
   /refnamediv
 
@@ -33,7 +34,7 @@
   varlistentry
termparameterrequest/parameter/term
listitem
- paraVIDIOC_ENUM_DV_TIMINGS/para
+ paraVIDIOC_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUM_DV_TIMINGS/para
/listitem
   /varlistentry
   varlistentry
@@ -61,14 +62,21 @@ standards or even custom timings that are not in this 
list./para
 
 paraTo query the available timings, applications initialize the
 structfieldindex/structfield field and zero the reserved array of 
v4l2-enum-dv-timings;
-and call the constantVIDIOC_ENUM_DV_TIMINGS/constant ioctl with a pointer 
to this
-structure. Drivers fill the rest of the structure or return an
+and call the constantVIDIOC_ENUM_DV_TIMINGS/constant ioctl on a video node 
with a
+pointer to this structure. Drivers fill the rest of the structure or return an
 EINVAL; when the index is out of bounds. To enumerate all supported DV 
timings,
 applications shall 

[PATCH 35/47] adv7604: Add sink pads

2014-02-05 Thread Laurent Pinchart
The ADV7604 has sink pads for its HDMI and analog inputs. Report them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 71 -
 include/media/adv7604.h | 14 -
 2 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 05e7e1a..da32ce9 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -97,13 +97,25 @@ struct adv7604_chip_info {
  *
  **
  */
+enum adv7604_pad {
+   ADV7604_PAD_HDMI_PORT_A = 0,
+   ADV7604_PAD_HDMI_PORT_B = 1,
+   ADV7604_PAD_HDMI_PORT_C = 2,
+   ADV7604_PAD_HDMI_PORT_D = 3,
+   ADV7604_PAD_VGA_RGB = 4,
+   ADV7604_PAD_VGA_COMP = 5,
+   /* The source pad is either 1 (ADV7611) or 6 (ADV7604) */
+   ADV7604_PAD_MAX = 7,
+};
+
 struct adv7604_state {
const struct adv7604_chip_info *info;
struct adv7604_platform_data pdata;
struct v4l2_subdev sd;
-   struct media_pad pad;
+   struct media_pad pads[ADV7604_PAD_MAX];
+   unsigned int source_pad;
struct v4l2_ctrl_handler hdl;
-   enum adv7604_input_port selected_input;
+   enum adv7604_pad selected_input;
struct v4l2_dv_timings timings;
struct {
u8 edid[256];
@@ -775,18 +787,18 @@ static inline bool is_analog_input(struct v4l2_subdev *sd)
 {
struct adv7604_state *state = to_state(sd);
 
-   return state-selected_input == ADV7604_INPUT_VGA_RGB ||
-  state-selected_input == ADV7604_INPUT_VGA_COMP;
+   return state-selected_input == ADV7604_PAD_VGA_RGB ||
+  state-selected_input == ADV7604_PAD_VGA_COMP;
 }
 
 static inline bool is_digital_input(struct v4l2_subdev *sd)
 {
struct adv7604_state *state = to_state(sd);
 
-   return state-selected_input == ADV7604_INPUT_HDMI_PORT_A ||
-  state-selected_input == ADV7604_INPUT_HDMI_PORT_B ||
-  state-selected_input == ADV7604_INPUT_HDMI_PORT_C ||
-  state-selected_input == ADV7604_INPUT_HDMI_PORT_D;
+   return state-selected_input == ADV7604_PAD_HDMI_PORT_A ||
+  state-selected_input == ADV7604_PAD_HDMI_PORT_B ||
+  state-selected_input == ADV7604_PAD_HDMI_PORT_C ||
+  state-selected_input == ADV7604_PAD_HDMI_PORT_D;
 }
 
 /* --- */
@@ -1066,14 +1078,14 @@ static void set_rgb_quantization_range(struct 
v4l2_subdev *sd)
 
switch (state-rgb_quantization_range) {
case V4L2_DV_RGB_RANGE_AUTO:
-   if (state-selected_input == ADV7604_INPUT_VGA_RGB) {
+   if (state-selected_input == ADV7604_PAD_VGA_RGB) {
/* Receiving analog RGB signal
 * Set RGB full range (0-255) */
io_write_and_or(sd, 0x02, 0x0f, 0x10);
break;
}
 
-   if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
+   if (state-selected_input == ADV7604_PAD_VGA_COMP) {
/* Receiving analog YPbPr signal
 * Set automode */
io_write_and_or(sd, 0x02, 0x0f, 0xf0);
@@ -1106,7 +1118,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
}
break;
case V4L2_DV_RGB_RANGE_LIMITED:
-   if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
+   if (state-selected_input == ADV7604_PAD_VGA_COMP) {
/* YCrCb limited range (16-235) */
io_write_and_or(sd, 0x02, 0x0f, 0x20);
break;
@@ -1117,7 +1129,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
 
break;
case V4L2_DV_RGB_RANGE_FULL:
-   if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
+   if (state-selected_input == ADV7604_PAD_VGA_COMP) {
/* YCrCb full range (0-255) */
io_write_and_or(sd, 0x02, 0x0f, 0x60);
break;
@@ -1806,7 +1818,7 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
struct adv7604_state *state = to_state(sd);
u8 *data = NULL;
 
-   if (edid-pad  ADV7604_EDID_PORT_D)
+   if (edid-pad  ADV7604_PAD_HDMI_PORT_D)
return -EINVAL;
if (edid-blocks == 0)
return -EINVAL;
@@ -1823,10 +1835,10 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
edid-blocks = state-edid.blocks;
 
switch (edid-pad) {
-   case ADV7604_EDID_PORT_A:
-   case ADV7604_EDID_PORT_B:
-   case ADV7604_EDID_PORT_C:
-   case ADV7604_EDID_PORT_D:
+   case 

[PATCH 36/47] adv7604: Make output format configurable through pad format operations

2014-02-05 Thread Laurent Pinchart
Replace the dummy video format operations by pad format operations that
configure the output format.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 243 +++-
 include/media/adv7604.h |  47 ++---
 2 files changed, 225 insertions(+), 65 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index da32ce9..181372a 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -53,6 +53,28 @@ MODULE_LICENSE(GPL);
 /* ADV7604 system clock frequency */
 #define ADV7604_fsc (28636360)
 
+#define ADV7604_RGB_OUT(1  1)
+
+#define ADV7604_OP_FORMAT_SEL_8BIT (0  0)
+#define ADV7604_OP_FORMAT_SEL_10BIT(1  0)
+#define ADV7604_OP_FORMAT_SEL_12BIT(2  0)
+
+#define ADV7604_OP_MODE_SEL_SDR_422(0  5)
+#define ADV7604_OP_MODE_SEL_DDR_422(1  5)
+#define ADV7604_OP_MODE_SEL_SDR_444(2  5)
+#define ADV7604_OP_MODE_SEL_DDR_444(3  5)
+#define ADV7604_OP_MODE_SEL_SDR_422_2X (4  5)
+#define ADV7604_OP_MODE_SEL_ADI_CM (5  5)
+
+#define ADV7604_OP_CH_SEL_GBR  (0  5)
+#define ADV7604_OP_CH_SEL_GRB  (1  5)
+#define ADV7604_OP_CH_SEL_BGR  (2  5)
+#define ADV7604_OP_CH_SEL_RGB  (3  5)
+#define ADV7604_OP_CH_SEL_BRG  (4  5)
+#define ADV7604_OP_CH_SEL_RBG  (5  5)
+
+#define ADV7604_OP_SWAP_CB_CR  (1  0)
+
 enum adv7604_type {
ADV7604,
ADV7611,
@@ -63,6 +85,14 @@ struct adv7604_reg_seq {
u8 val;
 };
 
+struct adv7604_format_info {
+   enum v4l2_mbus_pixelcode code;
+   u8 op_ch_sel;
+   bool rgb_out;
+   bool swap_cb_cr;
+   u8 op_format_sel;
+};
+
 struct adv7604_chip_info {
enum adv7604_type type;
 
@@ -78,6 +108,9 @@ struct adv7604_chip_info {
unsigned int tdms_lock_mask;
unsigned int fmt_change_digital_mask;
 
+   const struct adv7604_format_info *formats;
+   unsigned int nformats;
+
void (*set_termination)(struct v4l2_subdev *sd, bool enable);
void (*setup_irqs)(struct v4l2_subdev *sd);
unsigned int (*read_hdmi_pixelclock)(struct v4l2_subdev *sd);
@@ -111,12 +144,18 @@ enum adv7604_pad {
 struct adv7604_state {
const struct adv7604_chip_info *info;
struct adv7604_platform_data pdata;
+
struct v4l2_subdev sd;
struct media_pad pads[ADV7604_PAD_MAX];
unsigned int source_pad;
+
struct v4l2_ctrl_handler hdl;
+
enum adv7604_pad selected_input;
+
struct v4l2_dv_timings timings;
+   const struct adv7604_format_info *format;
+
struct {
u8 edid[256];
u32 present;
@@ -781,6 +820,93 @@ static void adv7604_write_reg_seq(struct v4l2_subdev *sd,
adv7604_write_reg(sd, reg_seq[i].reg, reg_seq[i].val);
 }
 
+/* 
-
+ * Format helpers
+ */
+
+static const struct adv7604_format_info adv7604_formats[] = {
+   { V4L2_MBUS_FMT_RGB888_1X24, ADV7604_OP_CH_SEL_RGB, true, false,
+ ADV7604_OP_MODE_SEL_SDR_444 | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_YUYV8_2X8, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_YVYU8_2X8, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_YUYV10_2X10, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_10BIT },
+   { V4L2_MBUS_FMT_YVYU10_2X10, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_10BIT },
+   { V4L2_MBUS_FMT_YUYV12_2X12, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_12BIT },
+   { V4L2_MBUS_FMT_YVYU12_2X12, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_12BIT },
+   { V4L2_MBUS_FMT_UYVY8_1X16, ADV7604_OP_CH_SEL_RBG, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_VYUY8_1X16, ADV7604_OP_CH_SEL_RBG, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_YUYV8_1X16, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_YVYU8_1X16, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+   { V4L2_MBUS_FMT_UYVY10_1X20, ADV7604_OP_CH_SEL_RBG, false, false,
+

[PATCH 34/47] adv7604: Remove subdev control handlers

2014-02-05 Thread Laurent Pinchart
Control operations are handled by the control framework and the subdev
control handlers are never called directly. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index fe71d686..05e7e1a 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2176,13 +2176,6 @@ static const struct v4l2_ctrl_ops adv7604_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops adv7604_core_ops = {
.log_status = adv7604_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
.interrupt_service_routine = adv7604_isr,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.g_register = adv7604_g_register,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/47] ad9389b: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/ad9389b.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index 44c037d..4cdff9e 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -670,8 +670,6 @@ static const struct v4l2_subdev_video_ops ad9389b_video_ops 
= {
.s_stream = ad9389b_s_stream,
.s_dv_timings = ad9389b_s_dv_timings,
.g_dv_timings = ad9389b_g_dv_timings,
-   .enum_dv_timings = ad9389b_enum_dv_timings,
-   .dv_timings_cap = ad9389b_dv_timings_cap,
 };
 
 /* -- PAD OPS -- */
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/47] s5p-tv: hdmiphy: Remove deprecated video-level DV timings operation

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings operation is deprecated and unused. Remove it.

Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/s5p-tv/hdmiphy_drv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c 
b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
index ff22320..c2f2e35 100644
--- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
@@ -262,7 +262,6 @@ static const struct v4l2_subdev_core_ops hdmiphy_core_ops = 
{
 
 static const struct v4l2_subdev_video_ops hdmiphy_video_ops = {
.s_dv_timings = hdmiphy_s_dv_timings,
-   .dv_timings_cap = hdmiphy_dv_timings_cap,
.s_stream =  hdmiphy_s_stream,
 };
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 37/47] adv7604: Add pad-level DV timings support

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 47 +
 1 file changed, 43 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 181372a..0925fe8 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1524,24 +1524,42 @@ static int read_stdi(struct v4l2_subdev *sd, struct 
stdi_readback *stdi)
 static int adv7604_enum_dv_timings(struct v4l2_subdev *sd,
struct v4l2_enum_dv_timings *timings)
 {
+   struct adv7604_state *state = to_state(sd);
+
if (timings-index = ARRAY_SIZE(adv7604_timings) - 1)
return -EINVAL;
+
+   if (timings-pad = state-source_pad)
+   return -EINVAL;
+
memset(timings-reserved, 0, sizeof(timings-reserved));
timings-timings = adv7604_timings[timings-index];
return 0;
 }
 
-static int adv7604_dv_timings_cap(struct v4l2_subdev *sd,
-   struct v4l2_dv_timings_cap *cap)
+static int __adv7604_dv_timings_cap(struct v4l2_subdev *sd,
+   struct v4l2_dv_timings_cap *cap,
+   unsigned int pad)
 {
cap-type = V4L2_DV_BT_656_1120;
cap-bt.max_width = 1920;
cap-bt.max_height = 1200;
cap-bt.min_pixelclock = 2500;
-   if (is_digital_input(sd))
+
+   switch (pad) {
+   case ADV7604_PAD_HDMI_PORT_A:
+   case ADV7604_PAD_HDMI_PORT_B:
+   case ADV7604_PAD_HDMI_PORT_C:
+   case ADV7604_PAD_HDMI_PORT_D:
cap-bt.max_pixelclock = 22500;
-   else
+   break;
+   case ADV7604_PAD_VGA_RGB:
+   case ADV7604_PAD_VGA_COMP:
+   default:
cap-bt.max_pixelclock = 17000;
+   break;
+   }
+
cap-bt.standards = V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
 V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT;
cap-bt.capabilities = V4L2_DV_BT_CAP_PROGRESSIVE |
@@ -1549,6 +1567,25 @@ static int adv7604_dv_timings_cap(struct v4l2_subdev *sd,
return 0;
 }
 
+static int adv7604_dv_timings_cap(struct v4l2_subdev *sd,
+   struct v4l2_dv_timings_cap *cap)
+{
+   struct adv7604_state *state = to_state(sd);
+
+   return __adv7604_dv_timings_cap(sd, cap, state-selected_input);
+}
+
+static int adv7604_pad_dv_timings_cap(struct v4l2_subdev *sd,
+   struct v4l2_dv_timings_cap *cap)
+{
+   struct adv7604_state *state = to_state(sd);
+
+   if (cap-pad = state-source_pad)
+   return -EINVAL;
+
+   return __adv7604_dv_timings_cap(sd, cap, cap-pad);
+}
+
 /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings
if the format is listed in adv7604_timings[] */
 static void adv7604_fill_optional_dv_timings_fields(struct v4l2_subdev *sd,
@@ -2403,6 +2440,8 @@ static const struct v4l2_subdev_pad_ops adv7604_pad_ops = 
{
.set_fmt = adv7604_set_format,
.get_edid = adv7604_get_edid,
.set_edid = adv7604_set_edid,
+   .dv_timings_cap = adv7604_pad_dv_timings_cap,
+   .enum_dv_timings = adv7604_enum_dv_timings,
 };
 
 static const struct v4l2_subdev_ops adv7604_ops = {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/47] s5p-tv: hdmiphy: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings operation is deprecated. Implement the
pad-level version of the operation to prepare for the removal of the
video version.

Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/s5p-tv/hdmiphy_drv.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c 
b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
index e19a0af..ff22320 100644
--- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
@@ -225,6 +225,9 @@ static int hdmiphy_s_dv_timings(struct v4l2_subdev *sd,
 static int hdmiphy_dv_timings_cap(struct v4l2_subdev *sd,
struct v4l2_dv_timings_cap *cap)
 {
+   if (cap-pad != 0)
+   return -EINVAL;
+
cap-type = V4L2_DV_BT_656_1120;
/* The phy only determines the pixelclock, leave the other values
 * at 0 to signify that we have no information for them. */
@@ -263,9 +266,14 @@ static const struct v4l2_subdev_video_ops 
hdmiphy_video_ops = {
.s_stream =  hdmiphy_s_stream,
 };
 
+static const struct v4l2_subdev_pad_ops hdmiphy_pad_ops = {
+   .dv_timings_cap = hdmiphy_dv_timings_cap,
+};
+
 static const struct v4l2_subdev_ops hdmiphy_ops = {
.core = hdmiphy_core_ops,
.video = hdmiphy_video_ops,
+   .pad = hdmiphy_pad_ops,
 };
 
 static int hdmiphy_probe(struct i2c_client *client,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/47] v4l: Add 12-bit YUV 4:2:2 media bus pixel codes

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 240 +
 include/uapi/linux/v4l2-mediabus.h |   6 +-
 2 files changed, 245 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index a0fa7e0..b2d5a03 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -3006,6 +3006,246 @@
  entryusubscript1/subscript/entry
  entryusubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-UYVY12-1X24
+ entryV4L2_MBUS_FMT_UYVY12_1X24/entry
+ entry0x2020/entry
+ entry/entry
+ dash-ent-8;
+ entryusubscript11/subscript/entry
+ entryusubscript10/subscript/entry
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ entryusubscript0/subscript/entry
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-8;
+ entryvsubscript11/subscript/entry
+ entryvsubscript10/subscript/entry
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row id=V4L2-MBUS-FMT-VYUY12-1X24
+ entryV4L2_MBUS_FMT_VYUY12_1X24/entry
+ entry0x2021/entry
+ entry/entry
+ dash-ent-8;
+ entryvsubscript11/subscript/entry
+ entryvsubscript10/subscript/entry
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+ entryysubscript11/subscript/entry
+ entryysubscript10/subscript/entry
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-8;
+ entryusubscript11/subscript/entry
+ entryusubscript10/subscript/entry
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+   

[PATCH 09/47] adv7842: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7842.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index e04fe3f..78d21fd 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1399,6 +1399,9 @@ static int read_stdi(struct v4l2_subdev *sd, struct 
stdi_readback *stdi)
 static int adv7842_enum_dv_timings(struct v4l2_subdev *sd,
   struct v4l2_enum_dv_timings *timings)
 {
+   if (timings-pad != 0)
+   return -EINVAL;
+
return v4l2_enum_dv_timings_cap(timings,
adv7842_get_dv_timings_cap(sd), adv7842_check_dv_timings, NULL);
 }
@@ -1406,6 +1409,9 @@ static int adv7842_enum_dv_timings(struct v4l2_subdev *sd,
 static int adv7842_dv_timings_cap(struct v4l2_subdev *sd,
  struct v4l2_dv_timings_cap *cap)
 {
+   if (cap-pad != 0)
+   return -EINVAL;
+
*cap = *adv7842_get_dv_timings_cap(sd);
return 0;
 }
@@ -2897,6 +2903,8 @@ static const struct v4l2_subdev_video_ops 
adv7842_video_ops = {
 static const struct v4l2_subdev_pad_ops adv7842_pad_ops = {
.get_edid = adv7842_get_edid,
.set_edid = adv7842_set_edid,
+   .enum_dv_timings = adv7842_enum_dv_timings,
+   .dv_timings_cap = adv7842_dv_timings_cap,
 };
 
 static const struct v4l2_subdev_ops adv7842_ops = {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 33/47] adv7604: Add adv7611 support

2014-02-05 Thread Laurent Pinchart
From: Lars-Peter Clausen l...@metafoo.de

This patch adds support for the Analog Devices ADV7611 HDMI receiver.
The adv7611 is quite similar to the adv7604. It has only one instead of four
HDMI inputs and no analog frontend though. Also some register bits have been
shuffled around, but large parts of their register maps are compatible.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 drivers/media/i2c/adv7604.c | 719 +++-
 include/media/adv7604.h |  10 +
 2 files changed, 528 insertions(+), 201 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 2a044d1..fe71d686 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -53,6 +53,43 @@ MODULE_LICENSE(GPL);
 /* ADV7604 system clock frequency */
 #define ADV7604_fsc (28636360)
 
+enum adv7604_type {
+   ADV7604,
+   ADV7611,
+};
+
+struct adv7604_reg_seq {
+   unsigned int reg;
+   u8 val;
+};
+
+struct adv7604_chip_info {
+   enum adv7604_type type;
+
+   bool has_afe;
+   unsigned int max_port;
+   unsigned int num_dv_ports;
+
+   unsigned int edid_enable_reg;
+   unsigned int edid_status_reg;
+   unsigned int lcf_reg;
+
+   unsigned int cable_det_mask;
+   unsigned int tdms_lock_mask;
+   unsigned int fmt_change_digital_mask;
+
+   void (*set_termination)(struct v4l2_subdev *sd, bool enable);
+   void (*setup_irqs)(struct v4l2_subdev *sd);
+   unsigned int (*read_hdmi_pixelclock)(struct v4l2_subdev *sd);
+   unsigned int (*read_cable_det)(struct v4l2_subdev *sd);
+
+   /* 0 = AFE, 1 = HDMI */
+   const struct adv7604_reg_seq *recommended_settings[2];
+   unsigned int num_recommended_settings[2];
+
+   unsigned long page_mask;
+};
+
 /*
  **
  *
@@ -61,6 +98,7 @@ MODULE_LICENSE(GPL);
  **
  */
 struct adv7604_state {
+   const struct adv7604_chip_info *info;
struct adv7604_platform_data pdata;
struct v4l2_subdev sd;
struct media_pad pad;
@@ -101,6 +139,11 @@ struct adv7604_state {
struct v4l2_ctrl *rgb_quantization_range_ctrl;
 };
 
+static bool adv7604_has_afe(struct adv7604_state *state)
+{
+   return state-info-has_afe;
+}
+
 /* Supported CEA and DMT timings */
 static const struct v4l2_dv_timings adv7604_timings[] = {
V4L2_DV_BT_CEA_720X480P59_94,
@@ -611,6 +654,121 @@ static inline int vdp_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state-i2c_vdp, reg, val);
 }
 
+enum {
+   ADV7604_PAGE_IO,
+   ADV7604_PAGE_AVLINK,
+   ADV7604_PAGE_CEC,
+   ADV7604_PAGE_INFOFRAME,
+   ADV7604_PAGE_ESDP,
+   ADV7604_PAGE_DPP,
+   ADV7604_PAGE_AFE,
+   ADV7604_PAGE_REP,
+   ADV7604_PAGE_EDID,
+   ADV7604_PAGE_HDMI,
+   ADV7604_PAGE_TEST,
+   ADV7604_PAGE_CP,
+   ADV7604_PAGE_VDP,
+   ADV7604_PAGE_TERM,
+};
+
+#define ADV7604_REG(page, offset)  (((page)  8) | (offset))
+#define ADV7604_REG_SEQ_TERM   0x
+
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+static int adv7604_read_reg(struct v4l2_subdev *sd, unsigned int reg)
+{
+   struct adv7604_state *state = to_state(sd);
+   unsigned int page = reg  8;
+
+   if (!(BIT(page)  state-info-page_mask))
+   return -EINVAL;
+
+   reg = 0xff;
+
+   switch (page) {
+   case ADV7604_PAGE_IO:
+   return io_read(sd, reg);
+   case ADV7604_PAGE_AVLINK:
+   return avlink_read(sd, reg);
+   case ADV7604_PAGE_CEC:
+   return cec_read(sd, reg);
+   case ADV7604_PAGE_INFOFRAME:
+   return infoframe_read(sd, reg);
+   case ADV7604_PAGE_ESDP:
+   return esdp_read(sd, reg);
+   case ADV7604_PAGE_DPP:
+   return dpp_read(sd, reg);
+   case ADV7604_PAGE_AFE:
+   return afe_read(sd, reg);
+   case ADV7604_PAGE_REP:
+   return rep_read(sd, reg);
+   case ADV7604_PAGE_EDID:
+   return edid_read(sd, reg);
+   case ADV7604_PAGE_HDMI:
+   return hdmi_read(sd, reg);
+   case ADV7604_PAGE_TEST:
+   return test_read(sd, reg);
+   case ADV7604_PAGE_CP:
+   return cp_read(sd, reg);
+   case ADV7604_PAGE_VDP:
+   return vdp_read(sd, reg);
+   }
+
+   return -EINVAL;
+}
+#endif
+
+static int adv7604_write_reg(struct v4l2_subdev *sd, unsigned int reg, u8 val)
+{
+   struct adv7604_state *state = to_state(sd);
+   unsigned int page = reg  8;
+
+   if (!(BIT(page)  state-info-page_mask))
+   return -EINVAL;
+
+   reg = 0xff;
+
+   switch (page) {
+   case ADV7604_PAGE_IO:
+   return io_write(sd, reg, val);
+   case ADV7604_PAGE_AVLINK:
+   return avlink_write(sd, reg, val);
+

[PATCH 06/47] v4l: Add pad-level DV timings subdev operations

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h| 4 
 include/uapi/linux/videodev2.h | 8 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index d67210a..2c7355a 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -505,6 +505,10 @@ struct v4l2_subdev_pad_ops {
 struct v4l2_subdev_selection *sel);
int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
+   int (*dv_timings_cap)(struct v4l2_subdev *sd,
+ struct v4l2_dv_timings_cap *cap);
+   int (*enum_dv_timings)(struct v4l2_subdev *sd,
+  struct v4l2_enum_dv_timings *timings);
 #ifdef CONFIG_MEDIA_CONTROLLER
int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
 struct v4l2_subdev_format *source_fmt,
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 6ae7bbe..b75970d 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1086,12 +1086,14 @@ struct v4l2_dv_timings {
 
 /** struct v4l2_enum_dv_timings - DV timings enumeration
  * @index: enumeration index
+ * @pad:   the pad number for which to query capabilities
  * @reserved:  must be zeroed
  * @timings:   the timings for the given index
  */
 struct v4l2_enum_dv_timings {
__u32 index;
-   __u32 reserved[3];
+   __u32 pad;
+   __u32 reserved[2];
struct v4l2_dv_timings timings;
 };
 
@@ -1129,11 +1131,13 @@ struct v4l2_bt_timings_cap {
 
 /** struct v4l2_dv_timings_cap - DV timings capabilities
  * @type:  the type of the timings (same as in struct v4l2_dv_timings)
+ * @pad:   the pad number for which to query capabilities
  * @bt:the BT656/1120 timings capabilities
  */
 struct v4l2_dv_timings_cap {
__u32 type;
-   __u32 reserved[3];
+   __u32 pad;
+   __u32 reserved[2];
union {
struct v4l2_bt_timings_cap bt;
__u32 raw_data[32];
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/47] v4l: Add UYVY10_2X10 and VYUY10_2X10 media bus pixel codes

2014-02-05 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 128 +
 include/uapi/linux/v4l2-mediabus.h |   4 +-
 2 files changed, 131 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 7331ce1..6fb58de 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -1898,6 +1898,134 @@
  entryysubscript1/subscript/entry
  entryysubscript0/subscript/entry
/row
+   row id=V4L2-MBUS-FMT-UYVY10-2X10
+ entryV4L2_MBUS_FMT_UYVY10_2X10/entry
+ entry0x2018/entry
+ entry/entry
+ dash-ent-22;
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ entryusubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-22;
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-22;
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-22;
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row id=V4L2-MBUS-FMT-VYUY10-2X10
+ entryV4L2_MBUS_FMT_VYUY10_2X10/entry
+ entry0x2019/entry
+ entry/entry
+ dash-ent-22;
+ entryvsubscript9/subscript/entry
+ entryvsubscript8/subscript/entry
+ entryvsubscript7/subscript/entry
+ entryvsubscript6/subscript/entry
+ entryvsubscript5/subscript/entry
+ entryvsubscript4/subscript/entry
+ entryvsubscript3/subscript/entry
+ entryvsubscript2/subscript/entry
+ entryvsubscript1/subscript/entry
+ entryvsubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-22;
+ entryysubscript9/subscript/entry
+ entryysubscript8/subscript/entry
+ entryysubscript7/subscript/entry
+ entryysubscript6/subscript/entry
+ entryysubscript5/subscript/entry
+ entryysubscript4/subscript/entry
+ entryysubscript3/subscript/entry
+ entryysubscript2/subscript/entry
+ entryysubscript1/subscript/entry
+ entryysubscript0/subscript/entry
+   /row
+   row
+ entry/entry
+ entry/entry
+ entry/entry
+ dash-ent-22;
+ entryusubscript9/subscript/entry
+ entryusubscript8/subscript/entry
+ entryusubscript7/subscript/entry
+ entryusubscript6/subscript/entry
+ entryusubscript5/subscript/entry
+ entryusubscript4/subscript/entry
+ entryusubscript3/subscript/entry
+ entryusubscript2/subscript/entry
+ entryusubscript1/subscript/entry
+ 

[PATCH 08/47] adv7511: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7511.c | 67 ++---
 1 file changed, 39 insertions(+), 28 deletions(-)

diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index ee61894..f8c75c6 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -597,34 +597,6 @@ static int adv7511_isr(struct v4l2_subdev *sd, u32 status, 
bool *handled)
return 0;
 }
 
-static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid 
*edid)
-{
-   struct adv7511_state *state = get_adv7511_state(sd);
-
-   if (edid-pad != 0)
-   return -EINVAL;
-   if ((edid-blocks == 0) || (edid-blocks  256))
-   return -EINVAL;
-   if (!edid-edid)
-   return -EINVAL;
-   if (!state-edid.segments) {
-   v4l2_dbg(1, debug, sd, EDID segment 0 not found\n);
-   return -ENODATA;
-   }
-   if (edid-start_block = state-edid.segments * 2)
-   return -E2BIG;
-   if ((edid-blocks + edid-start_block) = state-edid.segments * 2)
-   edid-blocks = state-edid.segments * 2 - edid-start_block;
-
-   memcpy(edid-edid, state-edid.data[edid-start_block * 128],
-   128 * edid-blocks);
-   return 0;
-}
-
-static const struct v4l2_subdev_pad_ops adv7511_pad_ops = {
-   .get_edid = adv7511_get_edid,
-};
-
 static const struct v4l2_subdev_core_ops adv7511_core_ops = {
.log_status = adv7511_log_status,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -700,12 +672,18 @@ static int adv7511_g_dv_timings(struct v4l2_subdev *sd,
 static int adv7511_enum_dv_timings(struct v4l2_subdev *sd,
   struct v4l2_enum_dv_timings *timings)
 {
+   if (timings-pad != 0)
+   return -EINVAL;
+
return v4l2_enum_dv_timings_cap(timings, adv7511_timings_cap, NULL, 
NULL);
 }
 
 static int adv7511_dv_timings_cap(struct v4l2_subdev *sd,
  struct v4l2_dv_timings_cap *cap)
 {
+   if (cap-pad != 0)
+   return -EINVAL;
+
*cap = adv7511_timings_cap;
return 0;
 }
@@ -797,6 +775,39 @@ static const struct v4l2_subdev_audio_ops 
adv7511_audio_ops = {
.s_routing = adv7511_s_routing,
 };
 
+/*  PAD OPS - 
*/
+
+static int adv7511_get_edid(struct v4l2_subdev *sd,
+   struct v4l2_subdev_edid *edid)
+{
+   struct adv7511_state *state = get_adv7511_state(sd);
+
+   if (edid-pad != 0)
+   return -EINVAL;
+   if ((edid-blocks == 0) || (edid-blocks  256))
+   return -EINVAL;
+   if (!edid-edid)
+   return -EINVAL;
+   if (!state-edid.segments) {
+   v4l2_dbg(1, debug, sd, EDID segment 0 not found\n);
+   return -ENODATA;
+   }
+   if (edid-start_block = state-edid.segments * 2)
+   return -E2BIG;
+   if ((edid-blocks + edid-start_block) = state-edid.segments * 2)
+   edid-blocks = state-edid.segments * 2 - edid-start_block;
+
+   memcpy(edid-edid, state-edid.data[edid-start_block * 128],
+   128 * edid-blocks);
+   return 0;
+}
+
+static const struct v4l2_subdev_pad_ops adv7511_pad_ops = {
+   .get_edid = adv7511_get_edid,
+   .enum_dv_timings = adv7511_enum_dv_timings,
+   .dv_timings_cap = adv7511_dv_timings_cap,
+};
+
 /* - SUBDEV OPS --- */
 
 static const struct v4l2_subdev_ops adv7511_ops = {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 20/47] adv7842: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7842.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 78d21fd..7fd9325 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2892,8 +2892,6 @@ static const struct v4l2_subdev_video_ops 
adv7842_video_ops = {
.s_dv_timings = adv7842_s_dv_timings,
.g_dv_timings = adv7842_g_dv_timings,
.query_dv_timings = adv7842_query_dv_timings,
-   .enum_dv_timings = adv7842_enum_dv_timings,
-   .dv_timings_cap = adv7842_dv_timings_cap,
.enum_mbus_fmt = adv7842_enum_mbus_fmt,
.g_mbus_fmt = adv7842_g_mbus_fmt,
.try_mbus_fmt = adv7842_g_mbus_fmt,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/47] media: staging: davinci: vpfe: Switch to pad-level DV operations

2014-02-05 Thread Laurent Pinchart
The video-level enum_dv_timings and dv_timings_cap operations are
deprecated in favor of the pad-level versions. All subdev drivers
implement the pad-level versions, switch to them.

Cc: Prabhakar Lad prabhakar.cse...@gmail.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/staging/media/davinci_vpfe/vpfe_video.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 1f3b0f9..a1655a8 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -987,8 +987,10 @@ vpfe_enum_dv_timings(struct file *file, void *fh,
struct vpfe_device *vpfe_dev = video-vpfe_dev;
struct v4l2_subdev *subdev = video-current_ext_subdev-subdev;
 
+   timings-pad = 0;
+
v4l2_dbg(1, debug, vpfe_dev-v4l2_dev, vpfe_enum_dv_timings\n);
-   return v4l2_subdev_call(subdev, video, enum_dv_timings, timings);
+   return v4l2_subdev_call(subdev, pad, enum_dv_timings, timings);
 }
 
 /*
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 26/47] v4l: Improve readability by not wrapping ioctl number #define's

2014-02-05 Thread Laurent Pinchart
Wrapping the #define's at a 80 columns boundary just obfuscates the
code. Don't do that.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/uapi/linux/v4l2-subdev.h | 33 +
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index a33c4da..9fe3493 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -156,25 +156,18 @@ struct v4l2_subdev_edid {
__u8 __user *edid;
 };
 
-#define VIDIOC_SUBDEV_G_FMT_IOWR('V',  4, struct v4l2_subdev_format)
-#define VIDIOC_SUBDEV_S_FMT_IOWR('V',  5, struct v4l2_subdev_format)
-#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
-   _IOWR('V', 21, struct v4l2_subdev_frame_interval)
-#define VIDIOC_SUBDEV_S_FRAME_INTERVAL \
-   _IOWR('V', 22, struct v4l2_subdev_frame_interval)
-#define VIDIOC_SUBDEV_ENUM_MBUS_CODE \
-   _IOWR('V',  2, struct v4l2_subdev_mbus_code_enum)
-#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
-   _IOWR('V', 74, struct v4l2_subdev_frame_size_enum)
-#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
-   _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum)
-#define VIDIOC_SUBDEV_G_CROP   _IOWR('V', 59, struct v4l2_subdev_crop)
-#define VIDIOC_SUBDEV_S_CROP   _IOWR('V', 60, struct v4l2_subdev_crop)
-#define VIDIOC_SUBDEV_G_SELECTION \
-   _IOWR('V', 61, struct v4l2_subdev_selection)
-#define VIDIOC_SUBDEV_S_SELECTION \
-   _IOWR('V', 62, struct v4l2_subdev_selection)
-#define VIDIOC_SUBDEV_G_EDID   _IOWR('V', 40, struct v4l2_subdev_edid)
-#define VIDIOC_SUBDEV_S_EDID   _IOWR('V', 41, struct v4l2_subdev_edid)
+#define VIDIOC_SUBDEV_G_FMT_IOWR('V',  4, struct 
v4l2_subdev_format)
+#define VIDIOC_SUBDEV_S_FMT_IOWR('V',  5, struct 
v4l2_subdev_format)
+#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct 
v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct 
v4l2_subdev_frame_interval)
+#define VIDIOC_SUBDEV_ENUM_MBUS_CODE   _IOWR('V',  2, struct 
v4l2_subdev_mbus_code_enum)
+#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE  _IOWR('V', 74, struct 
v4l2_subdev_frame_size_enum)
+#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL  _IOWR('V', 75, struct 
v4l2_subdev_frame_interval_enum)
+#define VIDIOC_SUBDEV_G_CROP   _IOWR('V', 59, struct 
v4l2_subdev_crop)
+#define VIDIOC_SUBDEV_S_CROP   _IOWR('V', 60, struct 
v4l2_subdev_crop)
+#define VIDIOC_SUBDEV_G_SELECTION  _IOWR('V', 61, struct 
v4l2_subdev_selection)
+#define VIDIOC_SUBDEV_S_SELECTION  _IOWR('V', 62, struct 
v4l2_subdev_selection)
+#define VIDIOC_SUBDEV_G_EDID   _IOWR('V', 40, struct 
v4l2_subdev_edid)
+#define VIDIOC_SUBDEV_S_EDID   _IOWR('V', 41, struct 
v4l2_subdev_edid)
 
 #endif
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/47] media: davinci: vpif: Switch to pad-level DV operations

2014-02-05 Thread Laurent Pinchart
The video-level enum_dv_timings and dv_timings_cap operations are
deprecated in favor of the pad-level versions. All subdev drivers
implement the pad-level versions, switch to them.

Cc: Prabhakar Lad prabhakar.cse...@gmail.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/davinci/vpif_capture.c | 4 +++-
 drivers/media/platform/davinci/vpif_display.c | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/davinci/vpif_capture.c 
b/drivers/media/platform/davinci/vpif_capture.c
index 735ec47..d0081eb 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -1723,7 +1723,9 @@ vpif_enum_dv_timings(struct file *file, void *priv,
struct channel_obj *ch = fh-channel;
int ret;
 
-   ret = v4l2_subdev_call(ch-sd, video, enum_dv_timings, timings);
+   timings-pad = 0;
+
+   ret = v4l2_subdev_call(ch-sd, pad, enum_dv_timings, timings);
if (ret == -ENOIOCTLCMD || ret == -ENODEV)
return -EINVAL;
return ret;
diff --git a/drivers/media/platform/davinci/vpif_display.c 
b/drivers/media/platform/davinci/vpif_display.c
index 9d115cd..20979c4 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1380,7 +1380,9 @@ vpif_enum_dv_timings(struct file *file, void *priv,
struct channel_obj *ch = fh-channel;
int ret;
 
-   ret = v4l2_subdev_call(ch-sd, video, enum_dv_timings, timings);
+   timings-pad = 0;
+
+   ret = v4l2_subdev_call(ch-sd, pad, enum_dv_timings, timings);
if (ret == -ENOIOCTLCMD || ret == -ENODEV)
return -EINVAL;
return ret;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/47] media: bfin_capture: Switch to pad-level DV operations

2014-02-05 Thread Laurent Pinchart
The video-level enum_dv_timings and dv_timings_cap operations are
deprecated in favor of the pad-level versions. All subdev drivers
implement the pad-level versions, switch to them.

Cc: Scott Jiang scott.jiang.li...@gmail.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/blackfin/bfin_capture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 2819165..5928d1d 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -648,7 +648,9 @@ static int bcap_enum_dv_timings(struct file *file, void 
*priv,
 {
struct bcap_device *bcap_dev = video_drvdata(file);
 
-   return v4l2_subdev_call(bcap_dev-sd, video,
+   timings-pad = 0;
+
+   return v4l2_subdev_call(bcap_dev-sd, pad,
enum_dv_timings, timings);
 }
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/47] ad9389b: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/ad9389b.c | 69 ++---
 1 file changed, 40 insertions(+), 29 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index 83225d6..44c037d 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -571,35 +571,6 @@ static const struct v4l2_subdev_core_ops ad9389b_core_ops 
= {
.interrupt_service_routine = ad9389b_isr,
 };
 
-/* -- PAD OPS -- */
-
-static int ad9389b_get_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid 
*edid)
-{
-   struct ad9389b_state *state = get_ad9389b_state(sd);
-
-   if (edid-pad != 0)
-   return -EINVAL;
-   if (edid-blocks == 0 || edid-blocks  256)
-   return -EINVAL;
-   if (!edid-edid)
-   return -EINVAL;
-   if (!state-edid.segments) {
-   v4l2_dbg(1, debug, sd, EDID segment 0 not found\n);
-   return -ENODATA;
-   }
-   if (edid-start_block = state-edid.segments * 2)
-   return -E2BIG;
-   if (edid-blocks + edid-start_block = state-edid.segments * 2)
-   edid-blocks = state-edid.segments * 2 - edid-start_block;
-   memcpy(edid-edid, state-edid.data[edid-start_block * 128],
-  128 * edid-blocks);
-   return 0;
-}
-
-static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = {
-   .get_edid = ad9389b_get_edid,
-};
-
 /* -- VIDEO OPS -- */
 
 /* Enable/disable ad9389b output */
@@ -678,6 +649,9 @@ static int ad9389b_g_dv_timings(struct v4l2_subdev *sd,
 static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd,
   struct v4l2_enum_dv_timings *timings)
 {
+   if (timings-pad != 0)
+   return -EINVAL;
+
return v4l2_enum_dv_timings_cap(timings, ad9389b_timings_cap,
NULL, NULL);
 }
@@ -685,6 +659,9 @@ static int ad9389b_enum_dv_timings(struct v4l2_subdev *sd,
 static int ad9389b_dv_timings_cap(struct v4l2_subdev *sd,
  struct v4l2_dv_timings_cap *cap)
 {
+   if (cap-pad != 0)
+   return -EINVAL;
+
*cap = ad9389b_timings_cap;
return 0;
 }
@@ -697,6 +674,40 @@ static const struct v4l2_subdev_video_ops 
ad9389b_video_ops = {
.dv_timings_cap = ad9389b_dv_timings_cap,
 };
 
+/* -- PAD OPS -- */
+
+static int ad9389b_get_edid(struct v4l2_subdev *sd,
+   struct v4l2_subdev_edid *edid)
+{
+   struct ad9389b_state *state = get_ad9389b_state(sd);
+
+   if (edid-pad != 0)
+   return -EINVAL;
+   if (edid-blocks == 0 || edid-blocks  256)
+   return -EINVAL;
+   if (!edid-edid)
+   return -EINVAL;
+   if (!state-edid.segments) {
+   v4l2_dbg(1, debug, sd, EDID segment 0 not found\n);
+   return -ENODATA;
+   }
+   if (edid-start_block = state-edid.segments * 2)
+   return -E2BIG;
+   if (edid-blocks + edid-start_block = state-edid.segments * 2)
+   edid-blocks = state-edid.segments * 2 - edid-start_block;
+   memcpy(edid-edid, state-edid.data[edid-start_block * 128],
+  128 * edid-blocks);
+   return 0;
+}
+
+static const struct v4l2_subdev_pad_ops ad9389b_pad_ops = {
+   .get_edid = ad9389b_get_edid,
+   .enum_dv_timings = ad9389b_enum_dv_timings,
+   .dv_timings_cap = ad9389b_dv_timings_cap,
+};
+
+/* -- AUDIO OPS -- */
+
 static int ad9389b_s_audio_stream(struct v4l2_subdev *sd, int enable)
 {
v4l2_dbg(1, debug, sd, %s: %sable\n, __func__, (enable ? en : 
dis));
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/47] tvp7002: Remove deprecated video-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated
and unused. Remove them.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/tvp7002.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 9f56fd5..fa901a9 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -926,7 +926,6 @@ static const struct v4l2_subdev_core_ops tvp7002_core_ops = 
{
 static const struct v4l2_subdev_video_ops tvp7002_video_ops = {
.g_dv_timings = tvp7002_g_dv_timings,
.s_dv_timings = tvp7002_s_dv_timings,
-   .enum_dv_timings = tvp7002_enum_dv_timings,
.query_dv_timings = tvp7002_query_dv_timings,
.s_stream = tvp7002_s_stream,
.g_mbus_fmt = tvp7002_mbus_fmt,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 29/47] adv7604: Add support for asynchronous probing

2014-02-05 Thread Laurent Pinchart
From: Lars-Peter Clausen l...@metafoo.de

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 71c8570..98ac383 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2337,6 +2337,11 @@ static int adv7604_probe(struct i2c_client *client,
goto err_entity;
v4l2_info(sd, %s found @ 0x%x (%s)\n, client-name,
client-addr  1, client-adapter-name);
+
+   err = v4l2_async_register_subdev(sd);
+   if (err)
+   goto err_entity;
+
return 0;
 
 err_entity:
@@ -2360,6 +2365,7 @@ static int adv7604_remove(struct i2c_client *client)
 
cancel_delayed_work(state-delayed_work_enable_hotplug);
destroy_workqueue(state-work_queues);
+   v4l2_async_unregister_subdev(sd);
v4l2_device_unregister_subdev(sd);
media_entity_cleanup(sd-entity);
adv7604_unregister_clients(to_state(sd));
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/47] ths8200: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/ths8200.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c
index 04139ee..e17e5155 100644
--- a/drivers/media/i2c/ths8200.c
+++ b/drivers/media/i2c/ths8200.c
@@ -410,6 +410,9 @@ static int ths8200_g_dv_timings(struct v4l2_subdev *sd,
 static int ths8200_enum_dv_timings(struct v4l2_subdev *sd,
   struct v4l2_enum_dv_timings *timings)
 {
+   if (timings-pad != 0)
+   return -EINVAL;
+
return v4l2_enum_dv_timings_cap(timings, ths8200_timings_cap,
NULL, NULL);
 }
@@ -417,6 +420,9 @@ static int ths8200_enum_dv_timings(struct v4l2_subdev *sd,
 static int ths8200_dv_timings_cap(struct v4l2_subdev *sd,
  struct v4l2_dv_timings_cap *cap)
 {
+   if (cap-pad != 0)
+   return -EINVAL;
+
*cap = ths8200_timings_cap;
return 0;
 }
@@ -430,10 +436,16 @@ static const struct v4l2_subdev_video_ops 
ths8200_video_ops = {
.dv_timings_cap = ths8200_dv_timings_cap,
 };
 
+static const struct v4l2_subdev_pad_ops ths8200_pad_ops = {
+   .enum_dv_timings = ths8200_enum_dv_timings,
+   .dv_timings_cap = ths8200_dv_timings_cap,
+};
+
 /* V4L2 top level operation handlers */
 static const struct v4l2_subdev_ops ths8200_ops = {
.core  = ths8200_core_ops,
.video = ths8200_video_ops,
+   .pad = ths8200_pad_ops,
 };
 
 static int ths8200_probe(struct i2c_client *client,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/47] s5p-tv: hdmi: Add pad-level DV timings operations

2014-02-05 Thread Laurent Pinchart
The video enum_dv_timings and dv_timings_cap operations are deprecated.
Implement the pad-level version of those operations to prepare for the
removal of the video version.

Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Tomasz Stanislawski t.stanisl...@samsung.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/s5p-tv/hdmi_drv.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/media/platform/s5p-tv/hdmi_drv.c 
b/drivers/media/platform/s5p-tv/hdmi_drv.c
index 534722c..3db496c 100644
--- a/drivers/media/platform/s5p-tv/hdmi_drv.c
+++ b/drivers/media/platform/s5p-tv/hdmi_drv.c
@@ -674,6 +674,8 @@ static int hdmi_g_mbus_fmt(struct v4l2_subdev *sd,
 static int hdmi_enum_dv_timings(struct v4l2_subdev *sd,
struct v4l2_enum_dv_timings *timings)
 {
+   if (timings-pad != 0)
+   return -EINVAL;
if (timings-index = ARRAY_SIZE(hdmi_timings))
return -EINVAL;
timings-timings = hdmi_timings[timings-index].dv_timings;
@@ -687,6 +689,9 @@ static int hdmi_dv_timings_cap(struct v4l2_subdev *sd,
 {
struct hdmi_device *hdev = sd_to_hdmi_dev(sd);
 
+   if (cap-pad != 0)
+   return -EINVAL;
+
/* Let the phy fill in the pixelclock range */
v4l2_subdev_call(hdev-phy_sd, video, dv_timings_cap, cap);
cap-type = V4L2_DV_BT_656_1120;
@@ -713,6 +718,11 @@ static const struct v4l2_subdev_video_ops 
hdmi_sd_video_ops = {
.s_stream = hdmi_s_stream,
 };
 
+static const struct v4l2_subdev_pad_ops hdmi_sd_pad_ops = {
+   .enum_dv_timings = hdmi_enum_dv_timings,
+   .dv_timings_cap = hdmi_dv_timings_cap,
+};
+
 static const struct v4l2_subdev_ops hdmi_sd_ops = {
.core = hdmi_sd_core_ops,
.video = hdmi_sd_video_ops,
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 46/47] adv7604: Add LLC polarity configuration

2014-02-05 Thread Laurent Pinchart
Add an inv_llc_pol field to platform data to control the clock polarity.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 3 ++-
 include/media/adv7604.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cd8a2dc..064e57e 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2445,7 +2445,8 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
cp_write(sd, 0x69, 0x30);   /* Enable CP CSC */
 
/* VS, HS polarities */
-   io_write(sd, 0x06, 0xa0 | pdata-inv_vs_pol  2 | pdata-inv_hs_pol  
1);
+   io_write(sd, 0x06, 0xa0 | pdata-inv_vs_pol  2 |
+pdata-inv_hs_pol  1 | pdata-inv_llc_pol);
 
/* Adjust drive strength */
io_write(sd, 0x14, 0x40 | pdata-dr_str_data  4 |
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index 0cad7a7..7c8b4e9 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -118,6 +118,7 @@ struct adv7604_platform_data {
/* IO register 0x06 */
unsigned inv_vs_pol:1;
unsigned inv_hs_pol:1;
+   unsigned inv_llc_pol:1;
 
/* IO register 0x14 */
enum adv7604_drive_strength dr_str_data;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/47] ADV7611 support

2014-02-05 Thread Hans Verkuil
Hi Laurent!

On 02/05/2014 05:41 PM, Laurent Pinchart wrote:
 Hello,
 
 This patch set implements support for the ADV7611 in the adv7604 driver. It
 also comes up with new features such as output format configuration through
 pad format operations, hot-plug detect control through GPIO and DT support.
 
 Patches 06/47 to 27/47 replace the subdev video DV timings query cap and enum
 operations with pad-level equivalents. I've split driver changes in one patch
 per driver to make review easier, but I can squash them together if desired.

For patches 2-5 and 7-26:

Reviewed-by: Hans Verkuil hans.verk...@cisco.com

I have some upcoming comments for patches 6 and 27 and I don't feel qualified
enough to judge patch 1 (unless you ask explicitly).

I will look at the remaining adv7604 patches later. I need to test those on
our hardware, so this will probably going to be next week before I get to them.

Nothing jumped out at me when I quickly read through them, but I didn't
look all that closely.

Regards,

Hans


 
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Tomasz Stanislawski t.stanisl...@samsung.com
 Cc: Scott Jiang scott.jiang.li...@gmail.com
 Cc: Prabhakar Lad prabhakar.cse...@gmail.com
 
 Lars-Peter Clausen (4):
   adv7604: Add missing include to linux/types.h
   adv7604: Add support for asynchronous probing
   adv7604: Don't put info string arrays on the stack
   adv7604: Add adv7611 support
 
 Laurent Pinchart (43):
   v4l: of: Support empty port nodes
   v4l: Add UYVY10_2X10 and VYUY10_2X10 media bus pixel codes
   v4l: Add UYVY10_1X20 and VYUY10_1X20 media bus pixel codes
   v4l: Add 12-bit YUV 4:2:0 media bus pixel codes
   v4l: Add 12-bit YUV 4:2:2 media bus pixel codes
   v4l: Add pad-level DV timings subdev operations
   ad9389b: Add pad-level DV timings operations
   adv7511: Add pad-level DV timings operations
   adv7842: Add pad-level DV timings operations
   s5p-tv: hdmi: Add pad-level DV timings operations
   s5p-tv: hdmiphy: Add pad-level DV timings operations
   ths8200: Add pad-level DV timings operations
   tvp7002: Add pad-level DV timings operations
   media: bfin_capture: Switch to pad-level DV operations
   media: davinci: vpif: Switch to pad-level DV operations
   media: staging: davinci: vpfe: Switch to pad-level DV operations
   s5p-tv: mixer: Switch to pad-level DV operations
   ad9389b: Remove deprecated video-level DV timings operations
   adv7511: Remove deprecated video-level DV timings operations
   adv7842: Remove deprecated video-level DV timings operations
   s5p-tv: hdmi: Remove deprecated video-level DV timings operations
   s5p-tv: hdmiphy: Remove deprecated video-level DV timings operation
   ths8200: Remove deprecated video-level DV timings operations
   tvp7002: Remove deprecated video-level DV timings operations
   v4l: subdev: Remove deprecated video-level DV timings operations
   v4l: Improve readability by not wrapping ioctl number #define's
   v4l: Add support for DV timings ioctls on subdev nodes
   adv7604: Add 16-bit read functions for CP and HDMI
   adv7604: Cache register contents when reading multiple bits
   adv7604: Remove subdev control handlers
   adv7604: Add sink pads
   adv7604: Make output format configurable through pad format operations
   adv7604: Add pad-level DV timings support
   adv7604: Remove deprecated video-level DV timings operations
   adv7604: Inline the to_sd function
   adv7604: Store I2C addresses and clients in arrays
   adv7604: Replace *_and_or() functions with *_clr_set()
   adv7604: Sort headers alphabetically
   adv7604: Control hot-plug detect through a GPIO
   adv7604: Specify the default input through platform data
   adv7604: Add DT support
   adv7604: Add LLC polarity configuration
   adv7604: Add endpoint properties to DT bindings
 
  Documentation/DocBook/media/v4l/subdev-formats.xml |  760 ++
  .../DocBook/media/v4l/vidioc-dv-timings-cap.xml|   27 +-
  .../DocBook/media/v4l/vidioc-enum-dv-timings.xml   |   27 +-
  .../devicetree/bindings/media/i2c/adv7604.txt  |   69 +
  drivers/media/i2c/ad9389b.c|   67 +-
  drivers/media/i2c/adv7511.c|   69 +-
  drivers/media/i2c/adv7604.c| 1465 
 ++--
  drivers/media/i2c/adv7842.c|   10 +-
  drivers/media/i2c/ths8200.c|   10 +
  drivers/media/i2c/tvp7002.c|5 +-
  drivers/media/platform/blackfin/bfin_capture.c |4 +-
  drivers/media/platform/davinci/vpif_capture.c  |4 +-
  drivers/media/platform/davinci/vpif_display.c  |4 +-
  drivers/media/platform/s5p-tv/hdmi_drv.c   |   14 +-
  drivers/media/platform/s5p-tv/hdmiphy_drv.c|9 +-
  drivers/media/platform/s5p-tv/mixer_video.c|8 +-
  drivers/media/v4l2-core/v4l2-of.c  |   52 +-
  drivers/media/v4l2-core/v4l2-subdev.c  |   15 +
  

Re: [PATCH 06/47] v4l: Add pad-level DV timings subdev operations

2014-02-05 Thread Hans Verkuil
On 02/05/2014 05:41 PM, Laurent Pinchart wrote:
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  include/media/v4l2-subdev.h| 4 
  include/uapi/linux/videodev2.h | 8 ++--
  2 files changed, 10 insertions(+), 2 deletions(-)
 
 diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
 index d67210a..2c7355a 100644
 --- a/include/media/v4l2-subdev.h
 +++ b/include/media/v4l2-subdev.h
 @@ -505,6 +505,10 @@ struct v4l2_subdev_pad_ops {
struct v4l2_subdev_selection *sel);
   int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
   int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
 + int (*dv_timings_cap)(struct v4l2_subdev *sd,
 +   struct v4l2_dv_timings_cap *cap);
 + int (*enum_dv_timings)(struct v4l2_subdev *sd,
 +struct v4l2_enum_dv_timings *timings);
  #ifdef CONFIG_MEDIA_CONTROLLER
   int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
struct v4l2_subdev_format *source_fmt,
 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
 index 6ae7bbe..b75970d 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ -1086,12 +1086,14 @@ struct v4l2_dv_timings {
  
  /** struct v4l2_enum_dv_timings - DV timings enumeration
   * @index:   enumeration index
 + * @pad: the pad number for which to query capabilities

Add something like: pad is only used with v4l-subdev nodes.

   * @reserved:must be zeroed
   * @timings: the timings for the given index
   */
  struct v4l2_enum_dv_timings {
   __u32 index;
 - __u32 reserved[3];
 + __u32 pad;
 + __u32 reserved[2];
   struct v4l2_dv_timings timings;
  };
  
 @@ -1129,11 +1131,13 @@ struct v4l2_bt_timings_cap {
  
  /** struct v4l2_dv_timings_cap - DV timings capabilities
   * @type:the type of the timings (same as in struct v4l2_dv_timings)
 + * @pad: the pad number for which to query capabilities

Ditto.

   * @bt:  the BT656/1120 timings capabilities
   */
  struct v4l2_dv_timings_cap {
   __u32 type;
 - __u32 reserved[3];
 + __u32 pad;
 + __u32 reserved[2];
   union {
   struct v4l2_bt_timings_cap bt;
   __u32 raw_data[32];
 

See also my comments for patch 27.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 27/47] v4l: Add support for DV timings ioctls on subdev nodes

2014-02-05 Thread Hans Verkuil
Hi Laurent,

Some comments:

On 02/05/2014 05:42 PM, Laurent Pinchart wrote:
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  .../DocBook/media/v4l/vidioc-dv-timings-cap.xml| 27 
 ++
  .../DocBook/media/v4l/vidioc-enum-dv-timings.xml   | 27 
 +-
  drivers/media/v4l2-core/v4l2-subdev.c  | 15 
  include/uapi/linux/v4l2-subdev.h   |  5 
  4 files changed, 63 insertions(+), 11 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml 
 b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
 index cd7720d..baef771 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-dv-timings-cap.xml
 @@ -1,11 +1,12 @@
  refentry id=vidioc-dv-timings-cap
refmeta
 -refentrytitleioctl VIDIOC_DV_TIMINGS_CAP/refentrytitle
 +refentrytitleioctl VIDIOC_DV_TIMINGS_CAP, 
 VIDIOC_SUBDEV_DV_TIMINGS_CAP/refentrytitle
  manvol;
/refmeta
  
refnamediv
  refnameVIDIOC_DV_TIMINGS_CAP/refname
 +refnameVIDIOC_SUBDEV_DV_TIMINGS_CAP/refname
  refpurposeThe capabilities of the Digital Video 
 receiver/transmitter/refpurpose
/refnamediv
  
 @@ -33,7 +34,7 @@
varlistentry
   termparameterrequest/parameter/term
   listitem
 -   paraVIDIOC_DV_TIMINGS_CAP/para
 +   paraVIDIOC_DV_TIMINGS_CAP, VIDIOC_SUBDEV_DV_TIMINGS_CAP/para
   /listitem
/varlistentry
varlistentry
 @@ -54,10 +55,19 @@
interface and may change in the future./para
  /note
  
 -paraTo query the capabilities of the DV receiver/transmitter 
 applications can call
 -this ioctl and the driver will fill in the structure. Note that drivers may 
 return
 +paraTo query the capabilities of the DV receiver/transmitter 
 applications
 +can call the constantVIDIOC_DV_TIMINGS_CAP/constant ioctl on a video node
 +and the driver will fill in the structure. Note that drivers may return
  different values after switching the video input or output./para
  
 +paraWhen implemented by the driver DV capabilities of subdevices can be
 +queried by calling the constantVIDIOC_SUBDEV_DV_TIMINGS_CAP/constant 
 ioctl
 +directly on a subdevice node. The capabilities are specific to inputs (for DV
 +receivers) or outputs (for DV transmitters), application must specify the

s/application/the application/

 +desired pad number in the v4l2-dv-timings-cap; 
 structfieldpad/structfield
 +field. Attemps to query capabilities on a pad that doesn't support them will

s/Attemps/Attempts/

 +return an EINVAL;./para
 +
  table pgwide=1 frame=none id=v4l2-bt-timings-cap
titlestruct structnamev4l2_bt_timings_cap/structname/title
tgroup cols=3
 @@ -127,7 +137,14 @@ different values after switching the video input or 
 output./para
 /row
 row
   entry__u32/entry
 - entrystructfieldreserved/structfield[3]/entry
 + entrystructfieldpad/structfield/entry
 + entryPad number as reported by the media controller API. This 
 field
 + is only used when operating on a subdevice node. When operating on a
 + video node applications must set this field to zero./entry

Currently the spec says that the driver will zero the reserved array. No mention
is made of the application having to zero it. This means that drivers cannot 
rely
on what is in the pad field since apps can leave it uninitialized.

If we keep that behavior, then the text has to change as follows:

s/applications must set this field to zero/this field is ignored/

However, should be keep that behavior? This ioctl is still marked as 
experimental,
so perhaps we should change the spec to require that reserved should be zeroed 
by
applications as well. I'm not certain, to be honest.

 +   /row
 +   row
 + entry__u32/entry
 + entrystructfieldreserved/structfield[2]/entry
   entryReserved for future extensions. Drivers must set the array 
 to zero./entry
 /row
 row
 diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml 
 b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
 index b3e17c1..e55df46 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-enum-dv-timings.xml
 @@ -1,11 +1,12 @@
  refentry id=vidioc-enum-dv-timings
refmeta
 -refentrytitleioctl VIDIOC_ENUM_DV_TIMINGS/refentrytitle
 +refentrytitleioctl VIDIOC_ENUM_DV_TIMINGS, 
 VIDIOC_SUBDEV_ENUM_DV_TIMINGS/refentrytitle
  manvol;
/refmeta
  
refnamediv
  refnameVIDIOC_ENUM_DV_TIMINGS/refname
 +refnameVIDIOC_SUBDEV_ENUM_DV_TIMINGS/refname
  refpurposeEnumerate supported Digital Video timings/refpurpose
/refnamediv
  
 @@ -33,7 +34,7 @@
varlistentry
   termparameterrequest/parameter/term
   listitem
 -   paraVIDIOC_ENUM_DV_TIMINGS/para
 +

Re: [RFC PATCH 0/4] rc: Adding support for sysfs wakeup scancodes

2014-02-05 Thread Antti Seppälä
On 5 February 2014 11:42, James Hogan james.ho...@imgtec.com wrote:
 On 05/02/14 09:39, James Hogan wrote:
 Hi Antti,

 On 05/02/14 07:03, Antti Seppälä wrote:
 To wake up with nuvoton-cir we need to program several raw ir
 pulse/space lengths to the hardware and not a scancode. James's
 approach doesn't support this.

 Do the raw pulse/space lengths your hardware requires correspond to a
 single IR packet (mapping to a single scancode)?

 If so then my API is simply at a higher level of abstraction. I think
 this has the following advantages:
 * userspace sees a consistent interface at the same level of abstraction
 as it already has access to from input subsystem (i.e. scancodes). I.e.
 it doesn't need to care which IR device is in use, whether it does
 raw/hardware decode, or the details of the timings of the current protocol.
 * it supports hardware decoders which filter on the demodulated data
 rather than the raw pulse/space lengths.

 Of course to support this we'd need some per-protocol code to convert a
 scancode back to pulse/space lengths. I'd like to think that code could
 be generic, maybe as helper functions which multiple drivers could use,
 which could also handle corner cases of the API in a consistent way
 (e.g. user providing filter mask covering multiple scancodes, which
 presumably pulse/space).

 hmm, I didn't complete that sentence :(.
 I meant:
 ..., which presumably pulse/space can't really represent very easily).

 Cheers
 James


 I see I've just crossed emails with Mauro who has just suggested
 something similar. I agree that his (2) is the more elegant option.


Yes, in nuvoton the ir pulses correspond to a scancode (or part of a scancode)

After giving it some thought I agree that using scancodes is the most
elegant way for specifying wakeup commands. Too bad that nuvoton does
not work with scancodes.
I pretty much agree with Mauro that the right solution would be to
write an IR encoder and use it to convert the given scancode back to a
format understood by nuvoton.

Writing IR encoders for all the protocols and an encoder selector
functionality is quite labourous and sadly I don't have time for that
anytime soon. If anyone wants to step up I'd be more than happy to
help though :)

-Antti
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s2255drv: remove redundant parameter

2014-02-05 Thread Dean Anderson
Removing duplicate fmt from buffer structure.

Signed-off-by: Dean Anderson linux-...@sensoray.com
---
 drivers/media/usb/s2255/s2255drv.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c 
b/drivers/media/usb/s2255/s2255drv.c
index 1b267b1..517901b 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -290,7 +290,6 @@ struct s2255_fmt {
 struct s2255_buffer {
/* common v4l buffer stuff -- must be first */
struct videobuf_buffer vb;
-   const struct s2255_fmt *fmt;
 };
 
 struct s2255_fh {
@@ -625,13 +624,13 @@ static void s2255_fillbuff(struct s2255_vc *vc,
if (last_frame != -1) {
tmpbuf =
(const char *)vc-buffer.frame[last_frame].lpvbits;
-   switch (buf-fmt-fourcc) {
+   switch (vc-fmt-fourcc) {
case V4L2_PIX_FMT_YUYV:
case V4L2_PIX_FMT_UYVY:
planar422p_to_yuv_packed((const unsigned char *)tmpbuf,
 vbuf, buf-vb.width,
 buf-vb.height,
-buf-fmt-fourcc);
+vc-fmt-fourcc);
break;
case V4L2_PIX_FMT_GREY:
memcpy(vbuf, tmpbuf, buf-vb.width * buf-vb.height);
@@ -711,7 +710,6 @@ static int buffer_prepare(struct videobuf_queue *vq, struct 
videobuf_buffer *vb,
return -EINVAL;
}
 
-   buf-fmt = vc-fmt;
buf-vb.width = w;
buf-vb.height = h;
buf-vb.field = field;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s2255drv: buffer setup fix

2014-02-05 Thread Dean Anderson
Buffer setup should check if minimum number of buffers is used.

Signed-off-by: Dean Anderson linux-...@sensoray.com
---
 drivers/media/usb/s2255/s2255drv.c |   16 
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c 
b/drivers/media/usb/s2255/s2255drv.c
index 2e24aee..1b267b1 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -69,7 +69,7 @@
 #define S2255_DSP_BOOTTIME  800
 /* maximum time to wait for firmware to load (ms) */
 #define S2255_LOAD_TIMEOUT  (5000 + S2255_DSP_BOOTTIME)
-#define S2255_DEF_BUFS  16
+#define S2255_MIN_BUFS  2
 #define S2255_SETMODE_TIMEOUT   500
 #define S2255_VIDSTATUS_TIMEOUT 350
 #define S2255_MARKER_FRAME cpu_to_le32(0x2255DA4AL)
@@ -374,9 +374,6 @@ static long s2255_vendor_req(struct s2255_dev *dev, 
unsigned char req,
 
 static struct usb_driver s2255_driver;
 
-/* Declare static vars that will be used as parameters */
-static unsigned int vid_limit = 16;/* Video memory limit, in Mb */
-
 /* start video number */
 static int video_nr = -1;  /* /dev/videoN, -1 for autodetect */
 
@@ -385,8 +382,6 @@ static int jpeg_enable = 1;
 
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, Debug level(0-100) default 0);
-module_param(vid_limit, int, 0644);
-MODULE_PARM_DESC(vid_limit, video memory limit(Mb));
 module_param(video_nr, int, 0644);
 MODULE_PARM_DESC(video_nr, start video minor(-1 default autodetect));
 module_param(jpeg_enable, int, 0644);
@@ -671,18 +666,15 @@ static void s2255_fillbuff(struct s2255_vc *vc,
Videobuf operations
--*/
 
-static int buffer_setup(struct videobuf_queue *vq, unsigned int *count,
+static int buffer_setup(struct videobuf_queue *vq, unsigned int *nbuffers,
unsigned int *size)
 {
struct s2255_fh *fh = vq-priv_data;
struct s2255_vc *vc = fh-vc;
*size = vc-width * vc-height * (vc-fmt-depth  3);
 
-   if (0 == *count)
-   *count = S2255_DEF_BUFS;
-
-   if (*size * *count  vid_limit * 1024 * 1024)
-   *count = (vid_limit * 1024 * 1024) / *size;
+   if (*nbuffers  S2255_MIN_BUFS)
+   *nbuffers = S2255_MIN_BUFS;
 
return 0;
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s2255drv: fix for return code not checked

2014-02-05 Thread Dean Anderson
Start acquisition return code was not being checked.  Return error
if start acquisition fails.

Signed-off-by: Dean Anderson linux-...@sensoray.com
---
 drivers/media/usb/s2255/s2255drv.c |   14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c 
b/drivers/media/usb/s2255/s2255drv.c
index 4c483ad..556e5e5 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -1230,12 +1230,16 @@ static int vidioc_streamon(struct file *file, void 
*priv, enum v4l2_buf_type i)
vc-buffer.frame[j].cur_size = 0;
}
res = videobuf_streamon(fh-vb_vidq);
-   if (res == 0) {
-   s2255_start_acquire(vc);
-   vc-b_acquire = 1;
-   } else
+   if (res != 0) {
res_free(fh);
-
+   return res;
+   }
+   res = s2255_start_acquire(vc);
+   if (res != 0) {
+   res_free(fh);
+   return res;
+   }
+   vc-b_acquire = 1;
return res;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s2255drv: dynamic memory allocation efficiency fix

2014-02-05 Thread Dean Anderson
Driver was allocating a kernel buffer each time it was sending a command.
It is better to allocate this buffer once at startup.

Signed-off-by: Dean Anderson linux-...@sensoray.com
---
 drivers/media/usb/s2255/s2255drv.c |   67 
 1 file changed, 37 insertions(+), 30 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c 
b/drivers/media/usb/s2255/s2255drv.c
index 517901b..4c483ad 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -260,6 +260,7 @@ struct s2255_dev {
atomic_tnum_channels;
int frames;
struct mutexlock;   /* channels[].vdev.lock */
+   struct mutexcmdlock; /* protects cmdbuf */
struct usb_device   *udev;
struct usb_interface*interface;
u8  read_endpoint;
@@ -273,6 +274,8 @@ struct s2255_dev {
/* dsp firmware version (f2255usb.bin) */
int dsp_fw_ver;
u16 pid; /* product id */
+#define S2255_CMDBUF_SIZE 512
+   __le32  *cmdbuf;
 };
 
 static inline struct s2255_dev *to_s2255_dev(struct v4l2_device *v4l2_dev)
@@ -1121,11 +1124,12 @@ static int s2255_set_mode(struct s2255_vc *vc,
  struct s2255_mode *mode)
 {
int res;
-   __le32 *buffer;
unsigned long chn_rev;
struct s2255_dev *dev = to_s2255_dev(vc-vdev.v4l2_dev);
int i;
+   __le32 *buffer = dev-cmdbuf;
 
+   mutex_lock(dev-cmdlock);
chn_rev = G_chnmap[vc-idx];
dprintk(dev, 3, %s channel: %d\n, __func__, vc-idx);
/* if JPEG, set the quality */
@@ -1139,11 +1143,6 @@ static int s2255_set_mode(struct s2255_vc *vc,
vc-mode = *mode;
vc-req_image_size = get_transfer_size(mode);
dprintk(dev, 1, %s: reqsize %ld\n, __func__, vc-req_image_size);
-   buffer = kzalloc(512, GFP_KERNEL);
-   if (buffer == NULL) {
-   dev_err(dev-udev-dev, out of mem\n);
-   return -ENOMEM;
-   }
/* set the mode */
buffer[0] = IN_DATA_TOKEN;
buffer[1] = (__le32) cpu_to_le32(chn_rev);
@@ -1154,7 +1153,6 @@ static int s2255_set_mode(struct s2255_vc *vc,
res = s2255_write_config(dev-udev, (unsigned char *)buffer, 512);
if (debug)
s2255_print_cfg(dev, mode);
-   kfree(buffer);
/* wait at least 3 frames before continuing */
if (mode-restart) {
wait_event_timeout(vc-wait_setmode,
@@ -1168,22 +1166,20 @@ static int s2255_set_mode(struct s2255_vc *vc,
/* clear the restart flag */
vc-mode.restart = 0;
dprintk(dev, 1, %s chn %d, result: %d\n, __func__, vc-idx, res);
+   mutex_unlock(dev-cmdlock);
return res;
 }
 
 static int s2255_cmd_status(struct s2255_vc *vc, u32 *pstatus)
 {
int res;
-   __le32 *buffer;
u32 chn_rev;
struct s2255_dev *dev = to_s2255_dev(vc-vdev.v4l2_dev);
+   __le32 *buffer = dev-cmdbuf;
+
+   mutex_lock(dev-cmdlock);
chn_rev = G_chnmap[vc-idx];
dprintk(dev, 4, %s chan %d\n, __func__, vc-idx);
-   buffer = kzalloc(512, GFP_KERNEL);
-   if (buffer == NULL) {
-   dev_err(dev-udev-dev, out of mem\n);
-   return -ENOMEM;
-   }
/* form the get vid status command */
buffer[0] = IN_DATA_TOKEN;
buffer[1] = (__le32) cpu_to_le32(chn_rev);
@@ -1191,7 +1187,6 @@ static int s2255_cmd_status(struct s2255_vc *vc, u32 
*pstatus)
*pstatus = 0;
vc-vidstatus_ready = 0;
res = s2255_write_config(dev-udev, (unsigned char *)buffer, 512);
-   kfree(buffer);
wait_event_timeout(vc-wait_vidstatus,
   (vc-vidstatus_ready != 0),
   msecs_to_jiffies(S2255_VIDSTATUS_TIMEOUT));
@@ -1201,6 +1196,7 @@ static int s2255_cmd_status(struct s2255_vc *vc, u32 
*pstatus)
}
*pstatus = vc-vidstatus;
dprintk(dev, 4, %s, vid status %d\n, __func__, *pstatus);
+   mutex_unlock(dev-cmdlock);
return res;
 }
 
@@ -1724,6 +1720,7 @@ static void s2255_destroy(struct s2255_dev *dev)
mutex_destroy(dev-lock);
usb_put_dev(dev-udev);
v4l2_device_unregister(dev-v4l2_dev);
+   kfree(dev-cmdbuf);
kfree(dev);
 }
 
@@ -2350,18 +2347,14 @@ static int s2255_start_readpipe(struct s2255_dev *dev)
 /* starts acquisition process */
 static int s2255_start_acquire(struct s2255_vc *vc)
 {
-   unsigned char *buffer;
int res;
unsigned long chn_rev;
int j;
struct s2255_dev *dev = to_s2255_dev(vc-vdev.v4l2_dev);
-   chn_rev = G_chnmap[vc-idx];
-   buffer = kzalloc(512, GFP_KERNEL);
-   if (buffer == NULL) {
-   dev_err(dev-udev-dev, out of mem\n);
-   return -ENOMEM;
-   }
+   __le32 *buffer = dev-cmdbuf;
 
+   

[PATCH v2] s2255drv: fix for return code not checked

2014-02-05 Thread Dean Anderson
Start acquisition return code was not being checked.  Return error
if start acquisition fails.

Signed-off-by: Dean Anderson linux-...@sensoray.com
---
 drivers/media/usb/s2255/s2255drv.c |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c 
b/drivers/media/usb/s2255/s2255drv.c
index 4c483ad..787b591 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -1230,12 +1230,16 @@ static int vidioc_streamon(struct file *file, void 
*priv, enum v4l2_buf_type i)
vc-buffer.frame[j].cur_size = 0;
}
res = videobuf_streamon(fh-vb_vidq);
-   if (res == 0) {
-   s2255_start_acquire(vc);
-   vc-b_acquire = 1;
-   } else
+   if (res != 0) {
res_free(fh);
-
+   return res;
+   }
+   res = s2255_start_acquire(vc);
+   if (res != 0) {
+   res_free(fh);
+   return res;
+   }
+   vc-b_acquire = 1;
return res;
 }
 
@@ -2373,7 +2377,7 @@ static int s2255_start_acquire(struct s2255_vc *vc)
 
dprintk(dev, 2, start acquire exit[%d] %d\n, vc-idx, res);
mutex_unlock(dev-cmdlock);
-   return 0;
+   return res;
 }
 
 static int s2255_stop_acquire(struct s2255_vc *vc)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/4] rc: Adding support for sysfs wakeup scancodes

2014-02-05 Thread Mauro Carvalho Chehab
Em Wed, 05 Feb 2014 20:16:04 +0200
Antti Seppälä a.sepp...@gmail.com escreveu:

 On 5 February 2014 11:42, James Hogan james.ho...@imgtec.com wrote:
  On 05/02/14 09:39, James Hogan wrote:
  Hi Antti,
 
  On 05/02/14 07:03, Antti Seppälä wrote:
  To wake up with nuvoton-cir we need to program several raw ir
  pulse/space lengths to the hardware and not a scancode. James's
  approach doesn't support this.
 
  Do the raw pulse/space lengths your hardware requires correspond to a
  single IR packet (mapping to a single scancode)?
 
  If so then my API is simply at a higher level of abstraction. I think
  this has the following advantages:
  * userspace sees a consistent interface at the same level of abstraction
  as it already has access to from input subsystem (i.e. scancodes). I.e.
  it doesn't need to care which IR device is in use, whether it does
  raw/hardware decode, or the details of the timings of the current protocol.
  * it supports hardware decoders which filter on the demodulated data
  rather than the raw pulse/space lengths.
 
  Of course to support this we'd need some per-protocol code to convert a
  scancode back to pulse/space lengths. I'd like to think that code could
  be generic, maybe as helper functions which multiple drivers could use,
  which could also handle corner cases of the API in a consistent way
  (e.g. user providing filter mask covering multiple scancodes, which
  presumably pulse/space).
 
  hmm, I didn't complete that sentence :(.
  I meant:
  ..., which presumably pulse/space can't really represent very easily).
 
  Cheers
  James
 
 
  I see I've just crossed emails with Mauro who has just suggested
  something similar. I agree that his (2) is the more elegant option.
 
 
 Yes, in nuvoton the ir pulses correspond to a scancode (or part of a scancode)
 
 After giving it some thought I agree that using scancodes is the most
 elegant way for specifying wakeup commands. Too bad that nuvoton does
 not work with scancodes.
 I pretty much agree with Mauro that the right solution would be to
 write an IR encoder and use it to convert the given scancode back to a
 format understood by nuvoton.

Ok, as we all agreed, I'll merge the remaining patches from James.

 Writing IR encoders for all the protocols and an encoder selector
 functionality is quite labourous and sadly I don't have time for that
 anytime soon. If anyone wants to step up I'd be more than happy to
 help though :)

I suspect that writing one IR encoder should not be hard, as there
are already some on LIRC userspace.

I would love to have some time to write at least a few IR encoders,
but, unfortunately, I would not have any time soon.

Regards,
Mauro
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] s2255drv: cleanup of s2255_fh

2014-02-05 Thread Dean Anderson
Removal of unnecessary parameters from s2255_fh.

Signed-off-by: Dean Anderson linux-...@sensoray.com
---
 drivers/media/usb/s2255/s2255drv.c |   94 +---
 1 file changed, 44 insertions(+), 50 deletions(-)

diff --git a/drivers/media/usb/s2255/s2255drv.c 
b/drivers/media/usb/s2255/s2255drv.c
index 787b591..e0663ce 100644
--- a/drivers/media/usb/s2255/s2255drv.c
+++ b/drivers/media/usb/s2255/s2255drv.c
@@ -298,9 +298,7 @@ struct s2255_buffer {
 struct s2255_fh {
/* this must be the first field in this struct */
struct v4l2_fh  fh;
-   struct s2255_dev*dev;
struct videobuf_queue   vb_vidq;
-   enum v4l2_buf_type  type;
struct s2255_vc *vc;
int resources;
 };
@@ -673,6 +671,7 @@ static int buffer_setup(struct videobuf_queue *vq, unsigned 
int *nbuffers,
 {
struct s2255_fh *fh = vq-priv_data;
struct s2255_vc *vc = fh-vc;
+
*size = vc-width * vc-height * (vc-fmt-depth  3);
 
if (*nbuffers  S2255_MIN_BUFS)
@@ -696,7 +695,7 @@ static int buffer_prepare(struct videobuf_queue *vq, struct 
videobuf_buffer *vb,
int rc;
int w = vc-width;
int h = vc-height;
-   dprintk(fh-dev, 4, %s, field=%d\n, __func__, field);
+   dprintk(vc-dev, 4, %s, field=%d\n, __func__, field);
if (vc-fmt == NULL)
return -EINVAL;
 
@@ -704,12 +703,12 @@ static int buffer_prepare(struct videobuf_queue *vq, 
struct videobuf_buffer *vb,
(w  norm_maxw(vc)) ||
(h  norm_minh(vc)) ||
(h  norm_maxh(vc))) {
-   dprintk(fh-dev, 4, invalid buffer prepare\n);
+   dprintk(vc-dev, 4, invalid buffer prepare\n);
return -EINVAL;
}
buf-vb.size = w * h * (vc-fmt-depth  3);
if (0 != buf-vb.baddr  buf-vb.bsize  buf-vb.size) {
-   dprintk(fh-dev, 4, invalid buffer prepare\n);
+   dprintk(vc-dev, 4, invalid buffer prepare\n);
return -EINVAL;
}
 
@@ -735,7 +734,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct 
videobuf_buffer *vb)
struct s2255_buffer *buf = container_of(vb, struct s2255_buffer, vb);
struct s2255_fh *fh = vq-priv_data;
struct s2255_vc *vc = fh-vc;
-   dprintk(fh-dev, 1, %s\n, __func__);
+   dprintk(vc-dev, 1, %s\n, __func__);
buf-vb.state = VIDEOBUF_QUEUED;
list_add_tail(buf-vb.queue, vc-buf_list);
 }
@@ -745,7 +744,8 @@ static void buffer_release(struct videobuf_queue *vq,
 {
struct s2255_buffer *buf = container_of(vb, struct s2255_buffer, vb);
struct s2255_fh *fh = vq-priv_data;
-   dprintk(fh-dev, 4, %s %d\n, __func__, fh-vc-idx);
+   struct s2255_vc *vc = fh-vc;
+   dprintk(vc-dev, 4, %s %d\n, __func__, vc-idx);
free_buffer(vq, buf);
 }
 
@@ -766,7 +766,7 @@ static int res_get(struct s2255_fh *fh)
/* it's free, grab it */
vc-resources = 1;
fh-resources = 1;
-   dprintk(fh-dev, 1, s2255: res: get\n);
+   dprintk(vc-dev, 1, s2255: res: get\n);
return 1;
 }
 
@@ -792,7 +792,7 @@ static int vidioc_querycap(struct file *file, void *priv,
   struct v4l2_capability *cap)
 {
struct s2255_fh *fh = file-private_data;
-   struct s2255_dev *dev = fh-dev;
+   struct s2255_dev *dev = fh-vc-dev;
 
strlcpy(cap-driver, s2255, sizeof(cap-driver));
strlcpy(cap-card, s2255, sizeof(cap-card));
@@ -855,7 +855,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
*priv,
 
field = f-fmt.pix.field;
 
-   dprintk(fh-dev, 50, %s NTSC: %d suggested width: %d, height: %d\n,
+   dprintk(vc-dev, 50, %s NTSC: %d suggested width: %d, height: %d\n,
__func__, is_ntsc, f-fmt.pix.width, f-fmt.pix.height);
if (is_ntsc) {
/* NTSC */
@@ -897,7 +897,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
*priv,
f-fmt.pix.sizeimage = f-fmt.pix.height * f-fmt.pix.bytesperline;
f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
f-fmt.pix.priv = 0;
-   dprintk(fh-dev, 50, %s: set width %d height %d field %d\n, __func__,
+   dprintk(vc-dev, 50, %s: set width %d height %d field %d\n, __func__,
f-fmt.pix.width, f-fmt.pix.height, f-fmt.pix.field);
return 0;
 }
@@ -925,13 +925,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
mutex_lock(q-vb_lock);
 
if (videobuf_queue_is_busy(fh-vb_vidq)) {
-   dprintk(fh-dev, 1, queue busy\n);
+   dprintk(vc-dev, 1, queue busy\n);
ret = -EBUSY;
goto out_s_fmt;
}
 
if (res_locked(fh)) {
-   dprintk(fh-dev, 1, %s: channel busy\n, __func__);
+   dprintk(vc-dev, 1, %s: channel busy\n, __func__);
ret = -EBUSY;
goto out_s_fmt;
}
@@ 

Re: [PATCH] s2255drv: port to videobuf2

2014-02-05 Thread Dean Anderson

On 2014-02-04 04:04, Hans Verkuil wrote:

Hi Dean,

On 02/03/14 18:06, Dean Anderson wrote:

On 2014-02-03 03:51, Hans Verkuil wrote:

Hi Dean,

Some specific comments below, but first two general comments:

It is easier to review if at least the removal of the old s2255_fh 
struct
was done as a separate patch. It's always good to try and keep the 
changes
in patches as small as possible. The actual vb2 conversion is always 
a
'big bang' patch, that's unavoidable, but it's easier if it isn't 
mixed in
with other changes that are not directly related to the vb2 
conversion.



I figured removal of s2255_fh was a natural part of the videobuf2 
conversion process, but I can break it up.


It's more like the first phase of a vb2 conversion. It really is wrong
for videobuf as well, so it makes sense to do that first.

I also did change some formatting and naming changes (s2255_channel 
to s2255_vc) that can be postponed.


Just put it in a separate patch either before or after the patch that 
does

the vb2 conversion.





And did you also run the v4l2-compliance utility for this driver? 
That's

useful to check that everything it still correct.


Thanks for the comments.  I'll do a v2 soon with v4l2-compliance 
fully tested too.


Rather than the standard v4l2-compliance from v4l-utils, can you use 
this

from my own tree:

http://git.linuxtv.org/hverkuil/v4l-utils.git/shortlog/refs/heads/streaming

I've started work to add tests for streaming to v4l2-compliance. While 
not
complete it should cover what the s2255 driver needs. I'm very 
interested

in what it finds (or, as the case might be, what it doesn't find).

In order to do the streaming tests you have to run it with option -s.



The current driver before the videobuf2 patch has 3 errors and 8 
warnings with option -s.  The warnings are msg5650 warnings that 
will break existing applications if fixed.


Here's what is causing at least two of the errors (the other is 
unsupported USERPTR, which will be fixed in VB2):


Vidioc_reqbufs calls videobuf_reqbufs, which returns a fail if 
req-count = 0.


IE:

if (req-count  1) {
dprintk(1, reqbufs: count invalid (%d)\n, req-count);
return -EINVAL;
}

Are drivers using videobuf required to check if 
v4l2_requestbuffers-count == 0 before calling videobuf_reqbufs? That 
seems unlikely and inefficient, so this could be an issue with 
videobuf-core.c..


Thanks,







Regards,

Hans

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] rc: ir-raw: Load ir-sharp-decoder module at init

2014-02-05 Thread James Hogan
Commit 1d184b0bc13d ([media] media: rc: add raw decoder for Sharp
protocol) added a new raw IR decoder for the sharp protocol, but didn't
add the code to load the module at init as is done for other raw
decoders, so add that code now.

Signed-off-by: James Hogan james.ho...@imgtec.com
Cc: Mauro Carvalho Chehab m.che...@samsung.com
---
I'm not sure if the media tree gets rebased, but if so this could
happily be squashed into the sharp decoder commit.
---
 drivers/media/rc/ir-raw.c   | 1 +
 drivers/media/rc/rc-core-priv.h | 7 +++
 2 files changed, 8 insertions(+)

diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index 5c42750..79a9cb6 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -352,6 +352,7 @@ void ir_raw_init(void)
load_jvc_decode();
load_sony_decode();
load_sanyo_decode();
+   load_sharp_decode();
load_mce_kbd_decode();
load_lirc_codec();
 
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index c40d666..dc3b0b7 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -210,6 +210,13 @@ static inline void load_sony_decode(void) { }
 static inline void load_sanyo_decode(void) { }
 #endif
 
+/* from ir-sharp-decoder.c */
+#ifdef CONFIG_IR_SHARP_DECODER_MODULE
+#define load_sharp_decode()request_module_nowait(ir-sharp-decoder)
+#else
+static inline void load_sharp_decode(void) { }
+#endif
+
 /* from ir-mce_kbd-decoder.c */
 #ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE
 #define load_mce_kbd_decode()  request_module_nowait(ir-mce_kbd-decoder)
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] s2255drv: port to videobuf2

2014-02-05 Thread Hans Verkuil
On 02/05/2014 10:44 PM, Dean Anderson wrote:
 On 2014-02-04 04:04, Hans Verkuil wrote:
 Hi Dean,

 On 02/03/14 18:06, Dean Anderson wrote:
 On 2014-02-03 03:51, Hans Verkuil wrote:
 Hi Dean,

 Some specific comments below, but first two general comments:

 It is easier to review if at least the removal of the old s2255_fh 
 struct
 was done as a separate patch. It's always good to try and keep the 
 changes
 in patches as small as possible. The actual vb2 conversion is always 
 a
 'big bang' patch, that's unavoidable, but it's easier if it isn't 
 mixed in
 with other changes that are not directly related to the vb2 
 conversion.


 I figured removal of s2255_fh was a natural part of the videobuf2 
 conversion process, but I can break it up.

 It's more like the first phase of a vb2 conversion. It really is wrong
 for videobuf as well, so it makes sense to do that first.

 I also did change some formatting and naming changes (s2255_channel 
 to s2255_vc) that can be postponed.

 Just put it in a separate patch either before or after the patch that 
 does
 the vb2 conversion.



 And did you also run the v4l2-compliance utility for this driver? 
 That's
 useful to check that everything it still correct.

 Thanks for the comments.  I'll do a v2 soon with v4l2-compliance 
 fully tested too.

 Rather than the standard v4l2-compliance from v4l-utils, can you use 
 this
 from my own tree:

 http://git.linuxtv.org/hverkuil/v4l-utils.git/shortlog/refs/heads/streaming

 I've started work to add tests for streaming to v4l2-compliance. While 
 not
 complete it should cover what the s2255 driver needs. I'm very 
 interested
 in what it finds (or, as the case might be, what it doesn't find).

 In order to do the streaming tests you have to run it with option -s.

 
 The current driver before the videobuf2 patch has 3 errors and 8 
 warnings with option -s.  The warnings are msg5650 warnings that 
 will break existing applications if fixed.
 
 Here's what is causing at least two of the errors (the other is 
 unsupported USERPTR, which will be fixed in VB2):
 
 Vidioc_reqbufs calls videobuf_reqbufs, which returns a fail if 
 req-count = 0.
 
 IE:
 
 if (req-count  1) {
   dprintk(1, reqbufs: count invalid (%d)\n, req-count);
   return -EINVAL;
 }
 
 Are drivers using videobuf required to check if 
 v4l2_requestbuffers-count == 0 before calling videobuf_reqbufs? That 
 seems unlikely and inefficient, so this could be an issue with 
 videobuf-core.c..

videobuf has always handled REQBUFS with a count of 0 wrong. One of the
many bad things about videobuf. Any driver using videobuf will fail the
v4l2-compliance test so that is not surprising.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


affiliate

2014-02-05 Thread SA

May I request for your cooperation to move funds and invest same in your 
country.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

2014-02-05 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Thu Feb  6 04:00:37 CET 2014
git branch: test
git hash:   261cb200e7227820cd0056435d7c1a3a9c476766
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-6.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12-i686: OK
linux-3.13-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-x86_64: OK
linux-3.13-x86_64: OK
apps: OK
spec-git: OK
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Thursday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Thursday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch] [media] dvb-frontends: decimal vs hex typo in ChannelConfiguration()

2014-02-05 Thread Dan Carpenter
From the context this should be hex 0x80 instead of decimal 80.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com
---
Untested.

diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c 
b/drivers/media/dvb-frontends/tda18271c2dd.c
index 2c54586ac07f..de0a1c110972 100644
--- a/drivers/media/dvb-frontends/tda18271c2dd.c
+++ b/drivers/media/dvb-frontends/tda18271c2dd.c
@@ -1030,7 +1030,7 @@ static int ChannelConfiguration(struct tda_state *state,
state-m_Regs[EP4] = state-m_EP4 | 
state-m_IFLevelDigital;
 
if ((Standard == HF_FM_Radio)  state-m_bFMInput)
-   state-m_Regs[EP4] |= 80;
+   state-m_Regs[EP4] |= 0x80;
 
state-m_Regs[MPD] = ~0x80;
if (Standard  HF_AnalogMax)
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html