Re: [PATCH] Add LVDS RGB media bus formats

2014-12-15 Thread Philipp Zabel
Hi Sakari,

Am Samstag, den 13.12.2014, 01:07 +0200 schrieb Sakari Ailus:
[...]
  diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
  b/Documentation/DocBook/media/v4l/subdev-formats.xml
  index 0d6f731..6d59a0e 100644
  --- a/Documentation/DocBook/media/v4l/subdev-formats.xml
  +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
  @@ -89,6 +89,14 @@
 constantMEDIA_BUS_FMT_RGB555_2X8_PADHI_BE/constant.
 /para
   
  +  paraOn LVDS buses, usually each sample is transferred serialized 
  in seven
 
 80 characters per line, please.
 
 Could you move this paragraph just before the LVDS table?

Will do.

[...]
  diff --git a/include/uapi/linux/media-bus-format.h 
  b/include/uapi/linux/media-bus-format.h
  index 37091c6..3fb9cbb 100644
  --- a/include/uapi/linux/media-bus-format.h
  +++ b/include/uapi/linux/media-bus-format.h
  @@ -33,7 +33,7 @@
   
   #define MEDIA_BUS_FMT_FIXED0x0001
   
  -/* RGB - next is   0x1010 */
 
 Does your patch depend on another patch which is not merged yet?

Yes, it depends on Boris Brezillon's patch to
Add RGB444_1X12 and RGB565_1X16 media bus formats:
https://lkml.org/lkml/2014/11/16/12

thanks
Philipp

--
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/6] Vivid sine gen: Optimization for sine LUT size

2014-12-15 Thread Prashant Laddha
Exploiting the symmetry and repetitive nature of sine waveform
to reduce size of sine LUT. Values up to phase = pi/4, can be
used to calculate sine for remaining phases.

Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Signed-off-by: Prashant Laddha prlad...@cisco.com
---
 drivers/media/platform/vivid/vivid-sin.c | 74 ++--
 1 file changed, 32 insertions(+), 42 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-sin.c 
b/drivers/media/platform/vivid/vivid-sin.c
index e3d6149..2ed9f7f 100644
--- a/drivers/media/platform/vivid/vivid-sin.c
+++ b/drivers/media/platform/vivid/vivid-sin.c
@@ -25,46 +25,38 @@
 
 #define SIN_TAB_SIZE 256
 
-   /*TODO- Reduce the size of the table */
-/* Since sinewave is symmetric, it can be represented using only quarter
-   of the samples compared to the number of samples used below  */
-
-static s32 sin[257] = {
-0,31,63,94,   125,   156,   187,   218,
-  249,   279,   310,   340,   370,   400,   430,   459,
-  488,   517,   545,   573,   601,   628,   655,   682,
-  708,   734,   760,   784,   809,   833,   856,   879,
-  902,   923,   945,   965,   986,  1005,  1024,  1042,
- 1060,  1077,  1094,  1109,  1124,  1139,  1153,  1166,
- 1178,  1190,  1200,  1211,  1220,  1229,  1237,  1244,
- 1251,  1256,  1261,  1265,  1269,  1272,  1273,  1275,
- 1275,  1275,  1273,  1272,  1269,  1265,  1261,  1256,
- 1251,  1244,  1237,  1229,  1220,  1211,  1200,  1190,
- 1178,  1166,  1153,  1139,  1124,  1109,  1094,  1077,
- 1060,  1042,  1024,  1005,   986,   965,   945,   923,
-  902,   879,   856,   833,   809,   784,   760,   734,
-  708,   682,   655,   628,   601,   573,   545,   517,
-  488,   459,   430,   400,   370,   340,   310,   279,
-  249,   218,   187,   156,   125,94,63,31,
-0,   -31,   -63,   -94,  -125,   156,  -187,  -218,
- -249,  -279,  -310,  -340,  -370,  -400,  -430,  -459,
- -488,  -517,  -545,  -573,  -601,  -628,  -655,  -682,
- -708,  -734,  -760,  -784,  -809,  -833,  -856,  -879,
- -902,  -923,  -945,  -965,  -986, -1005, -1024, -1042,
--1060, -1077, -1094, -1109, -1124, -1139, -1153, -1166,
--1178, -1190, -1200, -1211, -1220, -1229, -1237, -1244,
--1251, -1256, -1261, -1265, -1269, -1272, -1273, -1275,
--1275, -1275, -1273, -1272, -1269, -1265, -1261, -1256,
--1251, -1244, -1237, -1229, -1220, -1211, -1200, -1190,
--1178, -1166, -1153, -1139, -1124, -1109, -1094, -1077,
--1060, -1042, -1024, -1005,  -986,  -965,  -945,  -923,
- -902,  -879,  -856,  -833,  -809,  -784,  -760,  -734,
- -708,  -682,  -655,  -628,  -601,  -573,  -545,  -517,
- -488,  -459,  -430,  -400,  -370,  -340,  -310,  -279,
- -249,  -218,  -187,  -156,  -125,   -94,   -63,   -31,
-0
+static s32 sin[65] = {
+  0,   31,   63,   94,  125,  156,  187,  218,  249,  279,  310,  340,
+370,  400,  430,  459,  488,  517,  545,  573,  601,  628,  655,  682,
+708,  734,  760,  784,  809,  833,  856,  879,  902,  923,  945,  965,
+986, 1005, 1024, 1042, 1060, 1077, 1094, 1109, 1124, 1139, 1153, 1166,
+   1178, 1190, 1200, 1211, 1220, 1229, 1237, 1244, 1251, 1256, 1261, 1265,
+   1269, 1272, 1273, 1275, 1275
};
 
+static s32 get_sin_val(u32 index)
+{
+   u32 tab_index;
+   u32 new_index;
+
+   if (index = 64)
+   return sin[index];
+   else if (index  64  index = 128) {
+   tab_index = 64 - (index - 64);
+   return sin[tab_index];
+   } else if (index  128  index = 192) {
+   tab_index = index - 128;
+   return (-1) * sin[tab_index];
+   } else if (index  192  index = 255) {
+   tab_index = 64 - (index - 192);
+   return (-1) * sin[tab_index];
+   }
+
+   new_index = index % 256;
+   return get_sin_val(new_index);
+
+}
+
 /*
  * Calculation of sine is implemented using a look up table for range of
  * phase values from 0 to 2*pi. Look table contains finite entries, say N.
@@ -142,8 +134,7 @@ s32 calc_sin(u32 phase)
d1 =  temp0 - temp1;
d0 = (1  FIX_PT_PREC) - d1;
 
-   result = (d0 * sin[index % 256] + d1 * sin[(index+1)%256]);
-
+   result = d0 * get_sin_val(index) + d1 * get_sin_val(index+1);
return result  FIX_PT_PREC;
 }
 
@@ -166,8 +157,7 @@ s32 calc_cos(u32 phase)
d0 = (1  FIX_PT_PREC) - d1;
 
index += 64;
-   result = (d0 * sin[index % 256] + d1 * sin[(index+1)%256]);
-
+   result = d0 * get_sin_val(index) + d1 * get_sin_val(index+1);
return result  FIX_PT_PREC;
 }
 
-- 
1.9.1

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

[PATCH 4/6] Vivid sine gen: Renamed SIN_TAB_SIZE to SIN_LUT_SIZE

2014-12-15 Thread Prashant Laddha
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Signed-off-by: Prashant Laddha prlad...@cisco.com
---
 drivers/media/platform/vivid/vivid-sin.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-sin.c 
b/drivers/media/platform/vivid/vivid-sin.c
index c9face9..1ba6df9 100644
--- a/drivers/media/platform/vivid/vivid-sin.c
+++ b/drivers/media/platform/vivid/vivid-sin.c
@@ -23,7 +23,7 @@
 
 #include vivid-sin.h
 
-#define SIN_TAB_SIZE 256
+#define SIN_LUT_SIZE 256
 
 static s32 sin[65] = {
   0,   31,   63,   94,  125,  156,  187,  218,  249,  279,  310,  340,
@@ -123,7 +123,7 @@ s32 calc_sin(u32 phase)
u64 temp0;
u64 temp1;
 
-   temp0 = phase * SIN_TAB_SIZE;
+   temp0 = phase * SIN_LUT_SIZE;
index = (temp0 * 7) / (44  FIX_PT_PREC);
 
temp0 = (temp0 * 7) / 44;
@@ -145,7 +145,7 @@ s32 calc_cos(u32 phase)
u64 temp0;
u64 temp1;
 
-   temp0 = phase * SIN_TAB_SIZE;
+   temp0 = phase * SIN_LUT_SIZE;
index = (temp0 * 7) / (44  FIX_PT_PREC);
 
temp0 = (temp0 * 7) / 44;
-- 
1.9.1

--
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/6] Vivid sine gen: Refactor get_sin_val ()

2014-12-15 Thread Prashant Laddha
Removed recursion. Also reduced few if() checks.

Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Signed-off-by: Prashant Laddha prlad...@cisco.com
---
 drivers/media/platform/vivid/vivid-sin.c | 28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-sin.c 
b/drivers/media/platform/vivid/vivid-sin.c
index 2ed9f7f..c9face9 100644
--- a/drivers/media/platform/vivid/vivid-sin.c
+++ b/drivers/media/platform/vivid/vivid-sin.c
@@ -36,25 +36,23 @@ static s32 sin[65] = {
 
 static s32 get_sin_val(u32 index)
 {
+   s32 sign = 1;
u32 tab_index;
u32 new_index;
 
-   if (index = 64)
-   return sin[index];
-   else if (index  64  index = 128) {
-   tab_index = 64 - (index - 64);
-   return sin[tab_index];
-   } else if (index  128  index = 192) {
-   tab_index = index - 128;
-   return (-1) * sin[tab_index];
-   } else if (index  192  index = 255) {
-   tab_index = 64 - (index - 192);
-   return (-1) * sin[tab_index];
-   }
-
-   new_index = index % 256;
-   return get_sin_val(new_index);
+   new_index = index  0xFF; /* new_index = index % 256*/
 
+   if (new_index  128)
+   sign = -1;
+
+   new_index = index  0x7F; /* new_index = index % 256*/
+
+   if (new_index = 64)
+   tab_index = new_index;
+   else
+   tab_index = 64 - (new_index - 64);
+
+   return sign * sin[tab_index];
 }
 
 /*
-- 
1.9.1

--
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/6] Vivid SDR: Modified equation used for generating FM

2014-12-15 Thread Prashant Laddha
FM (frequency modulated) signal for SDR is generated by varying the
phase. The phase variation is proportional to input signal. It was
observed that, the larger phase increments leads to discontinuties
in the signal recovered after demodulation. This was one of the
reason for broken (cracky) sine tone after SDR receiver.

This patch modifies the phase calculation on two counts -
1. Phase of modulated signal, is varied around a center value.
2. The extent of phase variation with respect to input
signal is reduced. This is equivalent to reducing modulation index.

FM signal generated using modifed equation, do not lead to broken
sine tone.

Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Signed-off-by: Prashant Laddha prlad...@cisco.com
---
 drivers/media/platform/vivid/vivid-sdr-cap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/vivid/vivid-sdr-cap.c 
b/drivers/media/platform/vivid/vivid-sdr-cap.c
index 1e5abd7..1e1 100644
--- a/drivers/media/platform/vivid/vivid-sdr-cap.c
+++ b/drivers/media/platform/vivid/vivid-sdr-cap.c
@@ -455,7 +455,9 @@ void vivid_sdr_cap_process(struct vivid_dev *dev, struct 
vivid_buffer *buf)
 
for (i = 0; i  plane_size; i += 2) {
 
-   mod_phase_inc = calc_cos(dev-sdr_fixp_src_phase);
+   mod_phase_inc = calc_cos(dev-sdr_fixp_src_phase) / 4 +
+   src_phase_inc;
+
dev-sdr_fixp_src_phase += src_phase_inc;
 
while (dev-sdr_fixp_src_phase = FIX_PT_2PI)
-- 
1.9.1

--
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/6] Vivid: Increased precision for (co)sine computation

2014-12-15 Thread Prashant Laddha
1.sin LUT is recomputed with precision of 16 bits to represent
fractional part. (lowest fraction that can be represented now
is 1/2^16, that is 0.15).

2.Instead of using PI = 22/7 in intermediate calculation, use
precomputed value for 2PI

3 To avoid overflows, use 64 bit variables for intermediate
calculations

Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Signed-off-by: Prashant Laddha prlad...@cisco.com
---
 drivers/media/platform/vivid/vivid-core.h|  4 +-
 drivers/media/platform/vivid/vivid-sdr-cap.c | 33 +-
 drivers/media/platform/vivid/vivid-sin.c | 94 
 drivers/media/platform/vivid/vivid-sin.h |  9 +--
 4 files changed, 78 insertions(+), 62 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-core.h 
b/drivers/media/platform/vivid/vivid-core.h
index 6f4445a..ea5c5c8 100644
--- a/drivers/media/platform/vivid/vivid-core.h
+++ b/drivers/media/platform/vivid/vivid-core.h
@@ -434,8 +434,8 @@ struct vivid_dev {
struct list_headsdr_cap_active;
unsignedsdr_adc_freq;
unsignedsdr_fm_freq;
-   int sdr_fixp_src_phase;
-   int sdr_fixp_mod_phase;
+   s64 sdr_fixp_src_phase;
+   s64 sdr_fixp_mod_phase;
 
booltstamp_src_is_soe;
boolhas_crop_cap;
diff --git a/drivers/media/platform/vivid/vivid-sdr-cap.c 
b/drivers/media/platform/vivid/vivid-sdr-cap.c
index 1f8b328..1e5abd7 100644
--- a/drivers/media/platform/vivid/vivid-sdr-cap.c
+++ b/drivers/media/platform/vivid/vivid-sdr-cap.c
@@ -429,12 +429,16 @@ void vivid_sdr_cap_process(struct vivid_dev *dev, struct 
vivid_buffer *buf)
u8 *vbuf = vb2_plane_vaddr(buf-vb, 0);
unsigned long i;
unsigned long plane_size = vb2_plane_size(buf-vb, 0);
-   int fixp_i, fixp_q;
+   s64 fixp_i;
+   s64 fixp_q;
 
u32 adc_freq;
u32 sig_freq;
-   s32 src_phase_inc;
-   s32 mod_phase_inc;
+   s64 src_phase_inc;
+   s64 mod_phase_inc;
+   s64 signal_offset = 1275; /* 127.5 would be added modulated signal*/
+
+   signal_offset = FIX_PT_PREC;
 
/*
 * TODO: Generated beep tone goes very crackly when sample rate is
@@ -454,30 +458,27 @@ void vivid_sdr_cap_process(struct vivid_dev *dev, struct 
vivid_buffer *buf)
mod_phase_inc = calc_cos(dev-sdr_fixp_src_phase);
dev-sdr_fixp_src_phase += src_phase_inc;
 
-   while (dev-sdr_fixp_src_phase = ((44  FIX_PT_PREC)/7))
-   dev-sdr_fixp_src_phase -= ((44  FIX_PT_PREC)/7);
-
-   mod_phase_inc = FIX_PT_PREC;
-   mod_phase_inc /= 1275;
+   while (dev-sdr_fixp_src_phase = FIX_PT_2PI)
+   dev-sdr_fixp_src_phase -= FIX_PT_2PI;
 
dev-sdr_fixp_mod_phase += mod_phase_inc;
 
while (dev-sdr_fixp_mod_phase  0)
-   dev-sdr_fixp_mod_phase += ((44  FIX_PT_PREC) / 7);
+   dev-sdr_fixp_mod_phase += FIX_PT_2PI;
 
-   while (dev-sdr_fixp_mod_phase = ((44  FIX_PT_PREC) / 7))
-   dev-sdr_fixp_mod_phase -= ((44  FIX_PT_PREC) / 7);
+   while (dev-sdr_fixp_mod_phase = FIX_PT_2PI)
+   dev-sdr_fixp_mod_phase -= FIX_PT_2PI;
 
fixp_i = calc_sin(dev-sdr_fixp_mod_phase);
fixp_q = calc_cos(dev-sdr_fixp_mod_phase);
 
/* convert 'fixp float' to u8 */
-   /* u8 = X * 127.5f + 127.5f; where X is float [-1.0 / +1.0]
-   The values stored in sin look table are pre-multipied with 1275.
-   So, only do addition */
+   /* u8 = X * 127.5f + 127.5f; where X is float [-1.0 / +1.0] */
 
-   fixp_i += 1275;
-   fixp_q += 1275;
+   fixp_i = fixp_i * 1275 + signal_offset;
+   fixp_q = fixp_q * 1275 + signal_offset;
+   fixp_i = FIX_PT_PREC;
+   fixp_q = FIX_PT_PREC;
*vbuf++ = DIV_ROUND_CLOSEST(fixp_i, 10);
*vbuf++ = DIV_ROUND_CLOSEST(fixp_q, 10);
}
diff --git a/drivers/media/platform/vivid/vivid-sin.c 
b/drivers/media/platform/vivid/vivid-sin.c
index 1ba6df9..24680ea 100644
--- a/drivers/media/platform/vivid/vivid-sin.c
+++ b/drivers/media/platform/vivid/vivid-sin.c
@@ -26,19 +26,23 @@
 #define SIN_LUT_SIZE 256
 
 static s32 sin[65] = {
-  0,   31,   63,   94,  125,  156,  187,  218,  249,  279,  310,  340,
-370,  400,  430,  459,  488,  517,  545,  573,  601,  628,  655,  682,
-708,  734,  760,  784,  809,  833,  856,  879,  902,  923,  945,  965,
-986, 1005, 1024, 1042, 1060, 1077, 1094, 1109, 1124, 1139, 1153, 1166,
-   1178, 1190, 1200, 1211, 

[PATCH 1/6] Use LUT based implementation for (co)sine functions

2014-12-15 Thread Prashant Laddha
Replaced Taylor series calculation for (co)sine with a
look up table (LUT) for sine values.

Also reworked fixed point implementation to reduce rounding errors.

Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Cc: Mauro Carvalho Chehab mche...@osg.samsung.com

Signed-off-by: Prashant Laddha prlad...@cisco.com
---
 drivers/media/platform/vivid/Makefile|   2 +-
 drivers/media/platform/vivid/vivid-sdr-cap.c |  87 ++---
 drivers/media/platform/vivid/vivid-sin.c | 184 +++
 drivers/media/platform/vivid/vivid-sin.h |  31 +
 4 files changed, 252 insertions(+), 52 deletions(-)
 create mode 100644 drivers/media/platform/vivid/vivid-sin.c
 create mode 100644 drivers/media/platform/vivid/vivid-sin.h

diff --git a/drivers/media/platform/vivid/Makefile 
b/drivers/media/platform/vivid/Makefile
index 756fc12..9d5fe1c 100644
--- a/drivers/media/platform/vivid/Makefile
+++ b/drivers/media/platform/vivid/Makefile
@@ -2,5 +2,5 @@ vivid-objs := vivid-core.o vivid-ctrls.o vivid-vid-common.o 
vivid-vbi-gen.o \
vivid-vid-cap.o vivid-vid-out.o vivid-kthread-cap.o 
vivid-kthread-out.o \
vivid-radio-rx.o vivid-radio-tx.o vivid-radio-common.o \
vivid-rds-gen.o vivid-sdr-cap.o vivid-vbi-cap.o vivid-vbi-out.o 
\
-   vivid-osd.o vivid-tpg.o vivid-tpg-colors.o
+   vivid-osd.o vivid-tpg.o vivid-tpg-colors.o vivid-sin.o
 obj-$(CONFIG_VIDEO_VIVID) += vivid.o
diff --git a/drivers/media/platform/vivid/vivid-sdr-cap.c 
b/drivers/media/platform/vivid/vivid-sdr-cap.c
index 4af55f1..1f8b328 100644
--- a/drivers/media/platform/vivid/vivid-sdr-cap.c
+++ b/drivers/media/platform/vivid/vivid-sdr-cap.c
@@ -31,6 +31,7 @@
 #include vivid-core.h
 #include vivid-ctrls.h
 #include vivid-sdr-cap.h
+#include vivid-sin.h
 
 static const struct v4l2_frequency_band bands_adc[] = {
{
@@ -423,40 +424,17 @@ int vidioc_g_fmt_sdr_cap(struct file *file, void *fh, 
struct v4l2_format *f)
return 0;
 }
 
-#define FIXP_FRAC(1  15)
-#define FIXP_PI  ((int)(FIXP_FRAC * 3.141592653589))
-
-/* cos() from cx88 driver: cx88-dsp.c */
-static s32 fixp_cos(unsigned int x)
-{
-   u32 t2, t4, t6, t8;
-   u16 period = x / FIXP_PI;
-
-   if (period % 2)
-   return -fixp_cos(x - FIXP_PI);
-   x = x % FIXP_PI;
-   if (x  FIXP_PI/2)
-   return -fixp_cos(FIXP_PI/2 - (x % (FIXP_PI/2)));
-   /* Now x is between 0 and FIXP_PI/2.
-* To calculate cos(x) we use it's Taylor polinom. */
-   t2 = x*x/FIXP_FRAC/2;
-   t4 = t2*x/FIXP_FRAC*x/FIXP_FRAC/3/4;
-   t6 = t4*x/FIXP_FRAC*x/FIXP_FRAC/5/6;
-   t8 = t6*x/FIXP_FRAC*x/FIXP_FRAC/7/8;
-   return FIXP_FRAC-t2+t4-t6+t8;
-}
-
-static inline s32 fixp_sin(unsigned int x)
-{
-   return -fixp_cos(x + (FIXP_PI / 2));
-}
-
 void vivid_sdr_cap_process(struct vivid_dev *dev, struct vivid_buffer *buf)
 {
u8 *vbuf = vb2_plane_vaddr(buf-vb, 0);
unsigned long i;
unsigned long plane_size = vb2_plane_size(buf-vb, 0);
-   int fixp_src_phase_step, fixp_i, fixp_q;
+   int fixp_i, fixp_q;
+
+   u32 adc_freq;
+   u32 sig_freq;
+   s32 src_phase_inc;
+   s32 mod_phase_inc;
 
/*
 * TODO: Generated beep tone goes very crackly when sample rate is
@@ -466,34 +444,41 @@ void vivid_sdr_cap_process(struct vivid_dev *dev, struct 
vivid_buffer *buf)
 
/* calculate phase step */
#define BEEP_FREQ 1000 /* 1kHz beep */
-   fixp_src_phase_step = DIV_ROUND_CLOSEST(2 * FIXP_PI * BEEP_FREQ,
-   dev-sdr_adc_freq);
+
+   adc_freq = dev-sdr_adc_freq;   /* samples per sec*/
+   sig_freq = BEEP_FREQ;   /* cycles per sec */
+   src_phase_inc = phase_per_sample(sig_freq, adc_freq);
 
for (i = 0; i  plane_size; i += 2) {
-   dev-sdr_fixp_mod_phase += fixp_cos(dev-sdr_fixp_src_phase);
-   dev-sdr_fixp_src_phase += fixp_src_phase_step;
 
-   /*
-* Transfer phases to [0 / 2xPI] in order to avoid variable
-* overflow and make it suitable for cosine implementation
-* used, which does not support negative angles.
-*/
-   while (dev-sdr_fixp_mod_phase  (0 * FIXP_PI))
-   dev-sdr_fixp_mod_phase += (2 * FIXP_PI);
-   while (dev-sdr_fixp_mod_phase  (2 * FIXP_PI))
-   dev-sdr_fixp_mod_phase -= (2 * FIXP_PI);
+   mod_phase_inc = calc_cos(dev-sdr_fixp_src_phase);
+   dev-sdr_fixp_src_phase += src_phase_inc;
+
+   while (dev-sdr_fixp_src_phase = ((44  FIX_PT_PREC)/7))
+   dev-sdr_fixp_src_phase -= ((44  FIX_PT_PREC)/7);
+
+   mod_phase_inc = FIX_PT_PREC;
+   mod_phase_inc /= 1275;
+
+   dev-sdr_fixp_mod_phase += mod_phase_inc;
+
+   while (dev-sdr_fixp_mod_phase  0)

Re: [v3][PATCH 3/5] media: ov2640: add primary dt support

2014-12-15 Thread Josh Wu

Hi, Laurent

On 12/11/2014 4:10 PM, Laurent Pinchart wrote:

Hi Josh,

Thank you for the patch.

I only have three minor comments. After fixing them,

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com


Thanks for the review.


On Thursday 11 December 2014 15:35:37 Josh Wu wrote:

Add device tree support for ov2640.

Cc: devicet...@vger.kernel.org
Signed-off-by: Josh Wu josh...@atmel.com
---
v2 - v3:
   1. fix gpiod usage.
   2. refine the ov2640_probe() function.

v1 - v2:
   1. use gpiod APIs.
   2. change the gpio pin's name according to datasheet.
   3. reduce the delay for .reset() function.

  drivers/media/i2c/soc_camera/ov2640.c | 87 +---
  1 file changed, 81 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov2640.c
b/drivers/media/i2c/soc_camera/ov2640.c index 9ee910d..e0bcf5b 100644
--- a/drivers/media/i2c/soc_camera/ov2640.c
+++ b/drivers/media/i2c/soc_camera/ov2640.c
@@ -18,6 +18,8 @@
  #include linux/i2c.h
  #include linux/slab.h
  #include linux/delay.h
+#include linux/gpio.h
+#include linux/of_gpio.h
  #include linux/v4l2-mediabus.h
  #include linux/videodev2.h

@@ -283,6 +285,10 @@ struct ov2640_priv {
u32 cfmt_code;
struct v4l2_clk *clk;
const struct ov2640_win_size*win;
+
+   struct soc_camera_subdev_desc   ssdd_dt;
+   struct gpio_desc *resetb_gpio;
+   struct gpio_desc *pwdn_gpio;
  };

  /*
@@ -1047,6 +1053,63 @@ static struct v4l2_subdev_ops ov2640_subdev_ops = {
.video  = ov2640_subdev_video_ops,
  };

+/* OF probe functions */
+static int ov2640_hw_power(struct device *dev, int on)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+   struct ov2640_priv *priv = to_ov2640(client);
+
+   dev_dbg(client-dev, %s: %s the camera\n,
+   __func__, on ? ENABLE : DISABLE);
+
+   if (priv-pwdn_gpio)
+   gpiod_direction_output(priv-pwdn_gpio, !on);
+
+   return 0;
+}
+
+static int ov2640_hw_reset(struct device *dev)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+   struct ov2640_priv *priv = to_ov2640(client);
+
+   if (priv-resetb_gpio) {
+   /* Active the resetb pin to perform a reset pulse */
+   gpiod_direction_output(priv-resetb_gpio, 1);
+   usleep_range(3000, 5000);
+   gpiod_direction_output(priv-resetb_gpio, 0);
+   }
+
+   return 0;
+}
+
+static int ov2640_probe_dt(struct i2c_client *client,
+   struct ov2640_priv *priv)
+{
+   /* reset is not actived */

Do you mean that you configure the reset signal as inactive ? I would state
that as Request the reset GPIO deasserted.


yes, exactly. I'll take your sentence. thanks.



+   priv-resetb_gpio = devm_gpiod_get_optional(client-dev, resetb,
+   GPIOD_OUT_LOW);
+   if (!priv-resetb_gpio)
+   dev_dbg(client-dev, resetb gpio is not assigned!\n);
+   else if (IS_ERR(priv-resetb_gpio))
+   return PTR_ERR(priv-resetb_gpio);
+
+   /* Power down actived */

And Request the power down GPIO asserted.

ditto.




+   priv-pwdn_gpio = devm_gpiod_get_optional(client-dev, pwdn,
+   GPIOD_OUT_HIGH);
+   if (!priv-pwdn_gpio)
+   dev_dbg(client-dev, pwdn gpio is not assigned!\n);
+   else if (IS_ERR(priv-pwdn_gpio))
+   return PTR_ERR(priv-pwdn_gpio);
+
+   /* Initialize the soc_camera_subdev_desc */
+   priv-ssdd_dt.power = ov2640_hw_power;
+   priv-ssdd_dt.reset = ov2640_hw_reset;
+   client-dev.platform_data = priv-ssdd_dt;
+
+   return 0;
+}
+
  /*
   * i2c_driver functions
   */
@@ -1058,12 +1121,6 @@ static int ov2640_probe(struct i2c_client *client,
struct i2c_adapter  *adapter = to_i2c_adapter(client-dev.parent);
int ret;

-   if (!ssdd) {
-   dev_err(adapter-dev,
-   OV2640: Missing platform_data for driver\n);
-   return -EINVAL;
-   }
-
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_err(adapter-dev,
OV2640: I2C-Adapter doesn't support SMBUS\n);
@@ -1077,6 +1134,17 @@ static int ov2640_probe(struct i2c_client *client,
return -ENOMEM;
}

+   if (!ssdd  !client-dev.of_node) {
+   dev_err(client-dev, Missing platform_data for driver\n);
+   return  -EINVAL;
+   }
+
+   if (!ssdd  client-dev.of_node) {

You can just test for !ssdd as you've tested client-dev.of_node above
already.


Right, thanks.

Best Regards,
Josh Wu



+   ret = ov2640_probe_dt(client, priv);
+   if (ret)
+   return ret;
+   }
+
v4l2_i2c_subdev_init(priv-subdev, client, ov2640_subdev_ops);
v4l2_ctrl_handler_init(priv-hdl, 2);
v4l2_ctrl_new_std(priv-hdl, ov2640_ctrl_ops,
@@ 

Re: [v3][PATCH 5/5] media: ov2640: dt: add the device tree binding document

2014-12-15 Thread Josh Wu

Hi, Laurent

On 12/12/2014 10:17 AM, Laurent Pinchart wrote:

Hi Josh,

Thank you for the patch.

On Thursday 11 December 2014 15:35:39 Josh Wu wrote:

Add the document for ov2640 dt.

Cc: devicet...@vger.kernel.org
Signed-off-by: Josh Wu josh...@atmel.com
---
v2 - v3:
   1. fix incorrect description.
   2. Add assigned-clocks  assigned-clock-rates.
   3. resetb pin should be ACTIVE_LOW.

v1 - v2:
   1. change the compatible string to be consistent with verdor file.
   2. change the clock and pins' name.
   3. add missed pinctrl in example.

  .../devicetree/bindings/media/i2c/ov2640.txt   | 53 +++
  1 file changed, 53 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/ov2640.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/ov2640.txt
b/Documentation/devicetree/bindings/media/i2c/ov2640.txt new file mode
100644
index 000..958e120
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ov2640.txt
@@ -0,0 +1,53 @@
+* Omnivision ov2640 CMOS sensor
+
+The Omnivision OV2640 sensor support multiple resolutions output, such as
+CIF, SVGA, UXGA. It also can support YUV422/420, RGB565/555 or raw RGB
+output format.
+
+Required Properties:
+- compatible: Must be ovti,ov2640
+- clocks: reference to the xvclk input clock. It can be an external fixed
+  clock or a programmable clock from SoC.

It could also be a variable clock provided by something else. I would just
drop the second sentence.


I mention this since these are the cases in at91 platform.
Sure. I'll drop it.



+- clock-names: Must be xvclk.
+- assigned-clocks: reference to the above 'clocks' property.
+- assigned-clock-rates: reference to the clock frequency of xvclk. Typical
+value is 25Mhz (2500).
+This clock should only have single user. Specifying
+Conflicting rate configuration in multiple
consumer
+nodes for a shared clock is forbidden.

Those two properties are optional. I'm not sure they should even be mentioned
in the ov2640 bindings. For one thing they're not needed if the clock doesn't
need to be forced to a specific frequency, and the clock rate could also be
configured through other means depending on the platform.


hmm, if the clock is fixed then this 'assigned-clock-rates' is not needed.
And I only find one binding document mentioned the assigned-clocks. It 
looks like a general property for all clocks. We don't need mention it 
repeatedly.

So I'd like to drop this two properties in next version.

Thanks and Best Regards,
Josh Wu



+
+Optional Properties:
+- resetb-gpios: reference to the GPIO connected to the resetb pin, if any.
+- pwdn-gpios: reference to the GPIO connected to the pwdn pin, if any.
+
+The device node must contain one 'port' child node for its digital output
+video port, in accordance with the video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+
+   i2c1: i2c@f0018000 {
+   ov2640: camera@0x30 {
+   compatible = ovti,ov2640;
+   reg = 0x30;
+
+   pinctrl-names = default;
+   pinctrl-0 = pinctrl_pck1 pinctrl_ov2640_pwdn

pinctrl_ov2640_resetb;

+
+   resetb-gpios = pioE 24 GPIO_ACTIVE_LOW;
+   pwdn-gpios = pioE 29 GPIO_ACTIVE_HIGH;
+
+   clocks = pck1;
+   clock-names = xvclk;
+
+   assigned-clocks = pck1;
+   assigned-clock-rates = 2500;
+
+   port {
+   ov2640_0: endpoint {
+   remote-endpoint = isi_0;
+   bus-width = 8;
+   };
+   };
+   };
+   };


--
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 08/10] s5k4ecgx: fix sparse warnings

2014-12-15 Thread Sylwester Nawrocki
On 13/12/14 12:52, Hans Verkuil wrote:
 The get_unaligned_le*() functions return the value using cpu endianness,
 so calling le*_to_cpu is wrong.
 
 It hasn't been not noticed because this code has only been run on little
 endian systems, so le*_to_cpu doesn't do anything.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Cc: Sylwester Nawrocki s.nawro...@samsung.com

Acked-by: Sylwester Nawrocki s.nawro...@samsung.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


Re: [PATCH 09/10] s5k6aa: fix sparse warnings

2014-12-15 Thread Sylwester Nawrocki
On 13/12/14 12:52, Hans Verkuil wrote:
 drivers/media/i2c/s5k6aa.c:351:16: warning: cast to restricted __be16
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Acked-by: Sylwester Nawrocki s.nawro...@samsung.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


Re: [PATCH 10/10] s5k5baf: fix sparse warnings

2014-12-15 Thread Sylwester Nawrocki
On 13/12/14 12:53, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 drivers/media/i2c/s5k5baf.c:1796:33: warning: duplicate const
 drivers/media/i2c/s5k5baf.c:379:24: warning: cast to restricted __le16
 drivers/media/i2c/s5k5baf.c:437:11: warning: incorrect type in assignment 
 (different base types)
 drivers/media/i2c/s5k5baf.c:445:16: warning: incorrect type in return 
 expression (different base types)
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Acked-by: Sylwester Nawrocki s.nawro...@samsung.com

 ---
  drivers/media/i2c/s5k5baf.c | 13 +++--
  1 file changed, 7 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
 index 60a74d8..a3d7d03 100644
 --- a/drivers/media/i2c/s5k5baf.c
 +++ b/drivers/media/i2c/s5k5baf.c
 @@ -353,7 +353,7 @@ static struct v4l2_rect s5k5baf_cis_rect = {
   *
   */
  static int s5k5baf_fw_parse(struct device *dev, struct s5k5baf_fw **fw,
 - size_t count, const u16 *data)
 + size_t count, const __le16 *data)
  {
   struct s5k5baf_fw *f;
   u16 *d, i, *end;
 @@ -421,6 +421,7 @@ static u16 s5k5baf_i2c_read(struct s5k5baf *state, u16 
 addr)
  {
   struct i2c_client *c = v4l2_get_subdevdata(state-sd);
   __be16 w, r;
 + u16 res;
   struct i2c_msg msg[] = {
   { .addr = c-addr, .flags = 0,
 .len = 2, .buf = (u8 *)w },
 @@ -434,15 +435,15 @@ static u16 s5k5baf_i2c_read(struct s5k5baf *state, u16 
 addr)
  
   w = cpu_to_be16(addr);
   ret = i2c_transfer(c-adapter, msg, 2);
 - r = be16_to_cpu(r);
 + res = be16_to_cpu(r);
  
 - v4l2_dbg(3, debug, c, i2c_read: 0x%04x : 0x%04x\n, addr, r);
 + v4l2_dbg(3, debug, c, i2c_read: 0x%04x : 0x%04x\n, addr, res);
  
   if (ret != 2) {
   v4l2_err(c, i2c_read: error during transfer (%d)\n, ret);
   state-error = ret;
   }
 - return r;
 + return res;
  }
  
  static void s5k5baf_i2c_write(struct s5k5baf *state, u16 addr, u16 val)
 @@ -1037,7 +1038,7 @@ static int s5k5baf_load_setfile(struct s5k5baf *state)
   }
  
   ret = s5k5baf_fw_parse(c-dev, state-fw, fw-size / 2,
 -(u16 *)fw-data);
 +(__le16 *)fw-data);
  
   release_firmware(fw);
  
 @@ -1793,7 +1794,7 @@ static const struct v4l2_subdev_ops s5k5baf_subdev_ops 
 = {
  
  static int s5k5baf_configure_gpios(struct s5k5baf *state)
  {
 - static const char const *name[] = { S5K5BAF_STBY, S5K5BAF_RST };
 + static const char * const name[] = { S5K5BAF_STBY, S5K5BAF_RST };
   struct i2c_client *c = v4l2_get_subdevdata(state-sd);
   struct s5k5baf_gpio *g = state-gpios;
   int ret, i;

--
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 v3] Add LVDS RGB media bus formats

2014-12-15 Thread Sakari Ailus
Hi Philipp,

On Mon, Dec 15, 2014 at 10:26:04AM +0100, Philipp Zabel wrote:
 This patch adds three new RGB media bus formats that describe
 18-bit or 24-bit samples transferred over an LVDS bus with three
 or four differential data pairs, serialized into 7 time slots,
 using standard SPWG/PSWG/VESA or JEIDA data ordering.
 
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

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


Re: [PATCH 1/6] Use LUT based implementation for (co)sine functions

2014-12-15 Thread Antti Palosaari

On 12/15/2014 03:13 PM, Mauro Carvalho Chehab wrote:

Em Mon, 15 Dec 2014 14:49:17 +0530
Prashant Laddha prlad...@cisco.com escreveu:


Replaced Taylor series calculation for (co)sine with a
look up table (LUT) for sine values.


Kernel has already a LUT for sin/cos at:
include/linux/fixp-arith.h

The best would be to either use it or improve its precision, if the one there
is not good enough.


I looked that one when made generator. It has poor precision and it uses 
degrees not radians. But surely it is correct practice improve existing 
than introduce new.


regards
Antti


--
http://palosaari.fi/
--
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] vb2-vmalloc: Protect DMA-specific code by #ifdef CONFIG_HAS_DMA

2014-12-15 Thread Geert Uytterhoeven
If NO_DMA=y:

drivers/built-in.o: In function `vb2_vmalloc_dmabuf_ops_detach':
videobuf2-vmalloc.c:(.text+0x6f11b0): undefined reference to `dma_unmap_sg'
drivers/built-in.o: In function `vb2_vmalloc_dmabuf_ops_map':
videobuf2-vmalloc.c:(.text+0x6f1266): undefined reference to `dma_unmap_sg'
videobuf2-vmalloc.c:(.text+0x6f1282): undefined reference to `dma_map_sg'

As we don't want to make the core VIDEOBUF2_VMALLOC depend on HAS_DMA
(it's v4l2 core code, and selected by a lot of drivers), stub out the
DMA support if HAS_DMA is not set.

Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
 drivers/media/v4l2-core/videobuf2-vmalloc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c 
b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index fba944e502271069..d4fe55c85e0c5e71 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -211,6 +211,7 @@ static int vb2_vmalloc_mmap(void *buf_priv, struct 
vm_area_struct *vma)
return 0;
 }
 
+#ifdef CONFIG_HAS_DMA
 /*/
 /* DMABUF ops for exporters  */
 /*/
@@ -380,6 +381,8 @@ static struct dma_buf *vb2_vmalloc_get_dmabuf(void 
*buf_priv, unsigned long flag
 
return dbuf;
 }
+#endif /* CONFIG_HAS_DMA */
+
 
 /*/
 /*   callbacks for DMABUF buffers*/
@@ -437,7 +440,9 @@ const struct vb2_mem_ops vb2_vmalloc_memops = {
.put= vb2_vmalloc_put,
.get_userptr= vb2_vmalloc_get_userptr,
.put_userptr= vb2_vmalloc_put_userptr,
+#ifdef CONFIG_HAS_DMA
.get_dmabuf = vb2_vmalloc_get_dmabuf,
+#endif
.map_dmabuf = vb2_vmalloc_map_dmabuf,
.unmap_dmabuf   = vb2_vmalloc_unmap_dmabuf,
.attach_dmabuf  = vb2_vmalloc_attach_dmabuf,
-- 
1.9.1

--
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/RESEND] [media] VIDEO_CAFE_CCIC should select VIDEOBUF2_DMA_SG

2014-12-15 Thread Geert Uytterhoeven
If VIDEO_CAFE_CCIC=y, but VIDEOBUF2_DMA_SG=m:

drivers/built-in.o: In function `mcam_v4l_open':
mcam-core.c:(.text+0x1c2e81): undefined reference to `vb2_dma_sg_memops'
mcam-core.c:(.text+0x1c2eb0): undefined reference to `vb2_dma_sg_init_ctx'
drivers/built-in.o: In function `mcam_v4l_release':
mcam-core.c:(.text+0x1c34bf): undefined reference to `vb2_dma_sg_cleanup_ctx'

Reported-by: Fengguang Wu fengguang...@intel.com
Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org
---
This is a resend of a patch from 2013-09-30. It's still valid.

 drivers/media/platform/marvell-ccic/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/marvell-ccic/Kconfig 
b/drivers/media/platform/marvell-ccic/Kconfig
index 6265d36adcebcb89..3d166568bd6955bd 100644
--- a/drivers/media/platform/marvell-ccic/Kconfig
+++ b/drivers/media/platform/marvell-ccic/Kconfig
@@ -5,6 +5,7 @@ config VIDEO_CAFE_CCIC
select VIDEO_OV7670
select VIDEOBUF2_VMALLOC
select VIDEOBUF2_DMA_CONTIG
+   select VIDEOBUF2_DMA_SG
---help---
  This is a video4linux2 driver for the Marvell 88ALP01 integrated
  CMOS camera controller.  This is the controller found on first-
-- 
1.9.1

--
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/RESEND] [media] VIDEO_CAFE_CCIC should select VIDEOBUF2_DMA_SG

2014-12-15 Thread Jonathan Corbet
On Mon, 15 Dec 2014 14:55:37 +0100
Geert Uytterhoeven ge...@linux-m68k.org wrote:

 If VIDEO_CAFE_CCIC=y, but VIDEOBUF2_DMA_SG=m:
 
 drivers/built-in.o: In function `mcam_v4l_open':
 mcam-core.c:(.text+0x1c2e81): undefined reference to `vb2_dma_sg_memops'
 mcam-core.c:(.text+0x1c2eb0): undefined reference to `vb2_dma_sg_init_ctx'
 drivers/built-in.o: In function `mcam_v4l_release':
 mcam-core.c:(.text+0x1c34bf): undefined reference to `vb2_dma_sg_cleanup_ctx'

I've been mildly resistant to this because I've never figured out how
such a configuration can come about.  The Cafe chip only appeared in the
OLPC XO-1 and cannot even come close to doing S/G I/O.  So this patch
robs a bit of memory for no use on a platform that can ill afford it.

OTOH, the number of people building contemporary kernels for the XO-1 has
got to be pretty small.  So, in the interest of mollifying randconfig
users out there, you can add my:

Acked-by: Jonathan Corbet cor...@lwn.net

jon
--
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/RESEND] [media] VIDEO_CAFE_CCIC should select VIDEOBUF2_DMA_SG

2014-12-15 Thread Geert Uytterhoeven
Hi Jon,

On Mon, Dec 15, 2014 at 3:04 PM, Jonathan Corbet cor...@lwn.net wrote:
 On Mon, 15 Dec 2014 14:55:37 +0100
 Geert Uytterhoeven ge...@linux-m68k.org wrote:

 If VIDEO_CAFE_CCIC=y, but VIDEOBUF2_DMA_SG=m:

 drivers/built-in.o: In function `mcam_v4l_open':
 mcam-core.c:(.text+0x1c2e81): undefined reference to `vb2_dma_sg_memops'
 mcam-core.c:(.text+0x1c2eb0): undefined reference to `vb2_dma_sg_init_ctx'
 drivers/built-in.o: In function `mcam_v4l_release':
 mcam-core.c:(.text+0x1c34bf): undefined reference to `vb2_dma_sg_cleanup_ctx'

 I've been mildly resistant to this because I've never figured out how
 such a configuration can come about.  The Cafe chip only appeared in the
 OLPC XO-1 and cannot even come close to doing S/G I/O.  So this patch
 robs a bit of memory for no use on a platform that can ill afford it.

If the driver cannot do SG, perhaps this block should be removed from
drivers/media/platform/marvell-ccic/mcam-core.h?

#if IS_ENABLED(CONFIG_VIDEOBUF2_DMA_SG)
#define MCAM_MODE_DMA_SG 1
#endif

Oh, this seems to be a reason for the breakage, too: IS_ENABLED()
evaluates to true for modular options...

 OTOH, the number of people building contemporary kernels for the XO-1 has
 got to be pretty small.  So, in the interest of mollifying randconfig
 users out there, you can add my:

 Acked-by: Jonathan Corbet cor...@lwn.net

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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/RESEND] [media] VIDEO_CAFE_CCIC should select VIDEOBUF2_DMA_SG

2014-12-15 Thread Jonathan Corbet
On Mon, 15 Dec 2014 15:10:38 +0100
Geert Uytterhoeven ge...@linux-m68k.org wrote:

 If the driver cannot do SG, perhaps this block should be removed from
 drivers/media/platform/marvell-ccic/mcam-core.h?
 
 #if IS_ENABLED(CONFIG_VIDEOBUF2_DMA_SG)
 #define MCAM_MODE_DMA_SG 1
 #endif

Other drivers using the Marvell core can do S/G, though, so that option
needs to remain.  Applying your patch is almost certainly the most
straightforward solution at this point.

Thanks,

jon
--
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/1] yavta: Set plane size for mplane buffers in qbuf

2014-12-15 Thread Sakari Ailus
The plane size was left zero for mplane buffers when queueing a buffer. Fix
this.

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/yavta.c b/yavta.c
index 7f9e814..77e5a41 100644
--- a/yavta.c
+++ b/yavta.c
@@ -979,8 +979,12 @@ static int video_queue_buffer(struct device *dev, int 
index, enum buffer_fill_mo
 
if (dev-memtype == V4L2_MEMORY_USERPTR) {
if (video_is_mplane(dev)) {
-   for (i = 0; i  dev-num_planes; i++)
-   buf.m.planes[i].m.userptr = (unsigned 
long)dev-buffers[index].mem[i];
+   for (i = 0; i  dev-num_planes; i++) {
+   buf.m.planes[i].m.userptr = (unsigned long)
+   dev-buffers[index].mem[i];
+   buf.m.planes[i].length =
+   dev-buffers[index].size[i];
+   }
} else {
buf.m.userptr = (unsigned 
long)dev-buffers[index].mem[0];
}
-- 
2.1.0.231.g7484e3b

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


[GIT PULL FOR v3.20] 10-bit packed raw bayer format support

2014-12-15 Thread Sakari Ailus
Hi Mauro,

These patches make minor cleanups in raw bayer format documentation and
finally add a definition for 10-bit packed raw bayer formats.

Please pull.

The following changes since commit e272d95f8c0544cff55c485a10828b063c8e417c:

  [media] rcar_vin: Fix interrupt enable in progressive (2014-12-12 10:29:40 
-0200)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git srggb10p

for you to fetch changes up to 84e49381d980c2188e660b684d9e1770d9154ff6:

  v4l: Add packed Bayer raw10 pixel formats (2014-12-15 17:36:19 +0200)


Aviv Greenberg (1):
  v4l: Add packed Bayer raw10 pixel formats

Sakari Ailus (2):
  DocBook: v4l: Fix raw bayer pixel format documentation wording
  DocBook: v4l: Rearrange raw bayer format definitions, remove bad comment

 Documentation/DocBook/media/v4l/pixfmt-srggb10.xml |2 +-
 .../DocBook/media/v4l/pixfmt-srggb10alaw8.xml  |2 +-
 .../DocBook/media/v4l/pixfmt-srggb10dpcm8.xml  |2 +-
 .../DocBook/media/v4l/pixfmt-srggb10p.xml  |   99 
 Documentation/DocBook/media/v4l/pixfmt-srggb12.xml |2 +-
 Documentation/DocBook/media/v4l/pixfmt.xml |1 +
 include/uapi/linux/videodev2.h |   17 ++--
 7 files changed, 113 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml

-- 
Kind regards,

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


[RFC] video support for Samsung SUR40

2014-12-15 Thread Florian Echtler
Hi everyone,

I'm currently working on adding raw sensor video support for the Samsung
SUR40 touchscreen. I've finally found some useful documentation about
videobuf2, and added the required functions to the driver (without
actually delivering data so far, I just wanted to try and stream empty
frames for starters).

However, I'm running into an issue I have a hard time understanding. In
particular, as soon as I load the kernel module, I'm getting a kernel
oops (NULL pointer dereference) in line 354 or 355 of the attached
source code. The reason is probably that the previous check (in line
350) doesn't abort - even though I didn't actually provide a buffer, so
the list_head should be empty. As no user space program has actually
opened the video device yet, there shouldn't be any buffers queued,
right? (AFAICT the list is initialized properly in line 490).

I'd be quite grateful if somebody with more experience can look over the
code and tell me what mistakes I made :-)

Thanks  best regards, Florian

P.S. The SUR40 is a quite peculiar touchscreen device which does
on-board image processing to provide touch data, but also allows to
retrieve the raw video image. Unfortunately, it's a single USB device
with two endpoints for the different data types, so everything (input 
video) needs to be squeezed into one driver.
-- 
SENT FROM MY DEC VT50 TERMINAL
/*
 * Surface2.0/SUR40/PixelSense input driver
 *
 * Copyright (c) 2013 by Florian 'floe' Echtler f...@butterbrot.org
 *
 * Derived from the USB Skeleton driver 1.1,
 * Copyright (c) 2003 Greg Kroah-Hartman (g...@kroah.com)
 *
 * and from the Apple USB BCM5974 multitouch driver,
 * Copyright (c) 2008 Henrik Rydberg (rydb...@euromail.se)
 *
 * and from the generic hid-multitouch driver,
 * Copyright (c) 2010-2012 Stephane Chatty cha...@enac.fr
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */

#include linux/kernel.h
#include linux/errno.h
#include linux/delay.h
#include linux/init.h
#include linux/slab.h
#include linux/module.h
#include linux/completion.h
#include linux/uaccess.h
#include linux/usb.h
#include linux/printk.h
#include linux/input-polldev.h
#include linux/input/mt.h
#include linux/usb/input.h
#include linux/videodev2.h
#include media/v4l2-device.h
#include media/v4l2-dev.h
#include media/v4l2-ioctl.h
#include media/videobuf2-dma-contig.h

/* read 512 bytes from endpoint 0x86 - get header + blobs */
struct sur40_header {

	__le16 type;   /* always 0x0001 */
	__le16 count;  /* count of blobs (if 0: continue prev. packet) */

	__le32 packet_id;  /* unique ID for all packets in one frame */

	__le32 timestamp;  /* milliseconds (inc. by 16 or 17 each frame) */
	__le32 unknown;/* epoch? always 02/03 00 00 00 */

} __packed;

struct sur40_blob {

	__le16 blob_id;

	u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */
	u8 unknown;/* always 0x01 or 0x02 (no idea what this is?) */

	__le16 bb_pos_x;   /* upper left corner of bounding box */
	__le16 bb_pos_y;

	__le16 bb_size_x;  /* size of bounding box */
	__le16 bb_size_y;

	__le16 pos_x;  /* finger tip position */
	__le16 pos_y;

	__le16 ctr_x;  /* centroid position */
	__le16 ctr_y;

	__le16 axis_x; /* somehow related to major/minor axis, mostly: */
	__le16 axis_y; /* axis_x == bb_size_y  axis_y == bb_size_x */

	__le32 angle;  /* orientation in radians relative to x axis -
	  actually an IEEE754 float, don't use in kernel */

	__le32 area;   /* size in pixels/pressure (?) */

	u8 padding[32];

} __packed;

/* combined header/blob data */
struct sur40_data {
	struct sur40_header header;
	struct sur40_blob   blobs[];
} __packed;


/* version information */
#define DRIVER_SHORT   sur40
#define DRIVER_LONGSamsung SUR40
#define DRIVER_AUTHOR  Florian 'floe' Echtler f...@butterbrot.org
#define DRIVER_DESCSurface2.0/SUR40/PixelSense input driver

/* vendor and device IDs */
#define ID_MICROSOFT 0x045e
#define ID_SUR40 0x0775

/* sensor resolution */
#define SENSOR_RES_X 1920
#define SENSOR_RES_Y 1080

/* touch data endpoint */
#define TOUCH_ENDPOINT 0x86

/* video data endpoint */
#define VIDEO_ENDPOINT 0x82

/* polling interval (ms) */
#define POLL_INTERVAL 10

/* maximum number of contacts FIXME: this is a guess? */
#define MAX_CONTACTS 64

/* control commands */
#define SUR40_GET_VERSION 0xb0 /* 12 bytes string*/
#define SUR40_UNKNOWN10xb3 /*  5 bytes   */
#define SUR40_UNKNOWN20xc1 /* 24 bytes   */

#define SUR40_GET_STATE   0xc5 /*  4 bytes state (?) */
#define SUR40_GET_SENSORS 0xb1 /*  8 bytes sensors   */

/*
 * Note: an earlier, non-public version of this driver used USB_RECIP_ENDPOINT
 * here by mistake which is very likely to have corrupted the firmware EEPROM
 * on two separate SUR40 

Re: LibV4L2 and CREATE_BUFS issues

2014-12-15 Thread Hans de Goede

Hi,

On 14-12-14 15:24, Nicolas Dufresne wrote:


Le 2014-12-14 04:49, Hans de Goede a écrit :

Ah yes I see, so I assume that if libv4l where to return a failure for
CREATE_BUFS when conversion is used, that gstreamer will then fallback to
a regular REQUEST_BUFS call ?

Then that indeed seems the best solution, can you submit patch for this ?


Exactly, that should work. My concern with application side workaround would 
that the day someone implements CREATE_BUF support in v4l2 this application 
won't benefit without patching. I'll see if I can find time, disabling it seems 
faster then implementing support for it, specially that current experiment show 
that the jpeg code is really fragile. Current state is that libv4l2 is causing 
a buffer overflow, so it is harmful library in that sense.


Hmm, is that jpeg overflow still there with my recent (aprok 2-3 weeks ago) fix
for this?


This raise a concern, it would mean that USERPTR, DMABUF, CREATE_BUFS will now 
be lost (in most cases) when enabling libv4l2.


Yes, which is not good.


This is getting a bit annoying. Specially that we are pushing forward having 
m2m decoders to only be usable through libv4l2 (HW specific parsers). Is there 
a long term plan or are we simply pushing the dust toward libv4l2 ?


I think that trying to bold support for all of this into libv4l2 is not 
necessarily
a good idea. Then again if we're going to use libv4l2 plugins to do things like
media-controller pipeline setups for apps which are not media-controller aware,
maybe it is ...

libv4l2 was mostly created to get the then current generation of v4l2 apps to 
work
with webcams which have funky formats without pushing fmt conversion into the 
kernel
as several out of tree drivers were doing.

It may be better to come up with a better API for libv4lconvert, and let apps 
which
want to do advanced stuff deal with conversion themselves, while keeping all the
conversion code in a central place, but that does leave the media-controller 
issue.

Note that I've aprox. 0 time to work on libv4l now a days ...

What we really need is an active libv4l maintainer. Do not get me wrong, Gregor
has been doing a great job at maintaining it, but if we want to do some 
architectural
rework (or just a complete rewrite) I think we need someone who knows the v4l2 
API,
media-controller, etc. a lot better.

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: [RFC] video support for Samsung SUR40

2014-12-15 Thread Hans Verkuil
Hi Florian,

On 12/15/2014 04:47 PM, Florian Echtler wrote:
 Hi everyone,
 
 I'm currently working on adding raw sensor video support for the Samsung
 SUR40 touchscreen. I've finally found some useful documentation about
 videobuf2, and added the required functions to the driver (without
 actually delivering data so far, I just wanted to try and stream empty
 frames for starters).
 
 However, I'm running into an issue I have a hard time understanding. In
 particular, as soon as I load the kernel module, I'm getting a kernel
 oops (NULL pointer dereference) in line 354 or 355 of the attached
 source code. The reason is probably that the previous check (in line
 350) doesn't abort - even though I didn't actually provide a buffer, so
 the list_head should be empty. As no user space program has actually
 opened the video device yet, there shouldn't be any buffers queued,
 right? (AFAICT the list is initialized properly in line 490).
 
 I'd be quite grateful if somebody with more experience can look over the
 code and tell me what mistakes I made :-)

Why on earth is sur40_poll doing anything with video buffers? That's
all handled by vb2. As far as I can tell you can just delete everything
from '// deal with video data here' until the end of the poll function.

The probably cause of the crash here is that the input device node is
created before the 'INIT_LIST_HEAD(sur40-buf_list);' call, and since
udevd (I think) opens new devices immediately after they are created
it is likely that sur40_poll is called before buf_list is initialized.

But, as I said, that code doesn't belong there at all, so just remove it.

Regards,

Hans

 
 Thanks  best regards, Florian
 
 P.S. The SUR40 is a quite peculiar touchscreen device which does
 on-board image processing to provide touch data, but also allows to
 retrieve the raw video image. Unfortunately, it's a single USB device
 with two endpoints for the different data types, so everything (input 
 video) needs to be squeezed into one driver.
 

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


[yavta PATCH 1/2] yavta: Implement data_offset support for single and multi plane buffers

2014-12-15 Thread Sakari Ailus
Support data_offset for single and multi plane buffers. Also add an option
to write the data in the buffer before data offset (--buffer-prefix).

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/yavta.c b/yavta.c
index 77e5a41..47b817c 100644
--- a/yavta.c
+++ b/yavta.c
@@ -80,6 +80,8 @@ struct device
 
void *pattern[VIDEO_MAX_PLANES];
unsigned int patternsize[VIDEO_MAX_PLANES];
+
+   bool write_buffer_prefix;
 };
 
 static bool video_is_mplane(struct device *dev)
@@ -1546,13 +1548,22 @@ static void video_save_image(struct device *dev, struct 
v4l2_buffer *buf,
 
for (i = 0; i  dev-num_planes; i++) {
unsigned int length;
+   unsigned int data_offset = 0;
 
-   if (video_is_mplane(dev))
+   if (video_is_mplane(dev)) {
length = buf-m.planes[i].bytesused;
-   else
+   data_offset = buf-m.planes[i].data_offset;
+   } else {
length = buf-bytesused;
+   }
+
+   if (!dev-write_buffer_prefix)
+   length -= data_offset;
+   else
+   data_offset = 0;
 
-   ret = write(fd, dev-buffers[buf-index].mem[i], length);
+   ret = write(fd, dev-buffers[buf-index].mem[i] + data_offset,
+   length);
if (ret  0) {
printf(write error: %s (%d)\n, strerror(errno), 
errno);
break;
@@ -1618,7 +1629,7 @@ static int video_do_capture(struct device *dev, unsigned 
int nframes,
if (video_is_capture(dev))
video_verify_buffer(dev, buf);
 
-   size += buf.bytesused;
+   size += buf.bytesused - buf.data_offset;
 
fps = (buf.timestamp.tv_sec - last.tv_sec) * 100
+ buf.timestamp.tv_usec - last.tv_usec;
@@ -1717,6 +1728,7 @@ static void usage(const char *argv0)
printf(-t, --time-per-frame num/denom  Set the time per frame (eg. 
1/25 = 25 fps)\n);
printf(-u, --userptr   Use the user pointers streaming 
method\n);
printf(-w, --set-control 'ctrl value'  Set control 'ctrl' to 
'value'\n);
+   printf(--buffer-prefix Write portions of buffer before 
data_offset\n);
printf(--buffer-size   Buffer size in bytes\n);
printf(--enum-formats  Enumerate formats\n);
printf(--enum-inputs   Enumerate inputs\n);
@@ -1749,10 +1761,12 @@ static void usage(const char *argv0)
 #define OPT_BUFFER_SIZE268
 #define OPT_PREMULTIPLIED  269
 #define OPT_QUEUE_LATE 270
+#define OPT_BUFFER_PREFIX  271
 
 static struct option opts[] = {
{buffer-size, 1, 0, OPT_BUFFER_SIZE},
{buffer-type, 1, 0, 'B'},
+   {buffer-prefix, 1, 0, OPT_BUFFER_PREFIX},
{capture, 2, 0, 'c'},
{check-overrun, 0, 0, 'C'},
{delay, 1, 0, 'd'},
@@ -2016,6 +2030,8 @@ int main(int argc, char *argv[])
case OPT_USERPTR_OFFSET:
userptr_offset = atoi(optarg);
break;
+   case OPT_BUFFER_PREFIX:
+   dev.write_buffer_prefix = true;
default:
printf(Invalid option -%c\n, c);
printf(Run %s -h for help.\n, argv[0]);
-- 
2.1.0.231.g7484e3b

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


[yavta PATCH 2/2] yavta: Add support for 10-bit packed raw bayer formats

2014-12-15 Thread Sakari Ailus
Add support for these pixel formats:

V4L2_PIX_FMT_SBGGR10P
V4L2_PIX_FMT_SGBRG10P
V4L2_PIX_FMT_SGRBG10P
V4L2_PIX_FMT_SRGGB10P

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/yavta.c b/yavta.c
index 47b817c..7a6888f 100644
--- a/yavta.c
+++ b/yavta.c
@@ -202,6 +202,10 @@ static struct v4l2_format_info {
{ SGBRG10, V4L2_PIX_FMT_SGBRG10, 1 },
{ SGRBG10, V4L2_PIX_FMT_SGRBG10, 1 },
{ SRGGB10, V4L2_PIX_FMT_SRGGB10, 1 },
+   { SBGGR10P, V4L2_PIX_FMT_SBGGR10P, 1 },
+   { SGBRG10P, V4L2_PIX_FMT_SGBRG10P, 1 },
+   { SGRBG10P, V4L2_PIX_FMT_SGRBG10P, 1 },
+   { SRGGB10P, V4L2_PIX_FMT_SRGGB10P, 1 },
{ SBGGR12, V4L2_PIX_FMT_SBGGR12, 1 },
{ SGBRG12, V4L2_PIX_FMT_SGBRG12, 1 },
{ SGRBG12, V4L2_PIX_FMT_SGRBG12, 1 },
-- 
2.1.0.231.g7484e3b

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


[yavta PATCH v2 2/3] yavta: Update headers from upstream kernel

2014-12-15 Thread Sakari Ailus
Include packed raw 10-bit definitions as well.

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 include/linux/v4l2-common.h   |   2 +
 include/linux/v4l2-controls.h |   6 +++
 include/linux/videodev2.h | 121 +++---
 3 files changed, 111 insertions(+), 18 deletions(-)

diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
index 2f6f8ca..1527398 100644
--- a/include/linux/v4l2-common.h
+++ b/include/linux/v4l2-common.h
@@ -43,6 +43,8 @@
 #define V4L2_SEL_TGT_CROP_DEFAULT  0x0001
 /* Cropping bounds */
 #define V4L2_SEL_TGT_CROP_BOUNDS   0x0002
+/* Native frame size */
+#define V4L2_SEL_TGT_NATIVE_SIZE   0x0003
 /* Current composing area */
 #define V4L2_SEL_TGT_COMPOSE   0x0100
 /* Default composing area */
diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
index e946e43..661f119 100644
--- a/include/linux/v4l2-controls.h
+++ b/include/linux/v4l2-controls.h
@@ -746,6 +746,8 @@ enum v4l2_auto_focus_range {
V4L2_AUTO_FOCUS_RANGE_INFINITY  = 3,
 };
 
+#define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32)
+#define V4L2_CID_TILT_SPEED(V4L2_CID_CAMERA_CLASS_BASE+33)
 
 /* FM Modulator class control IDs */
 
@@ -865,6 +867,10 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_VBLANK
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
 #define V4L2_CID_HBLANK
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
 #define V4L2_CID_ANALOGUE_GAIN 
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
+#define V4L2_CID_TEST_PATTERN_RED  
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 4)
+#define V4L2_CID_TEST_PATTERN_GREENR   
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5)
+#define V4L2_CID_TEST_PATTERN_BLUE 
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
+#define V4L2_CID_TEST_PATTERN_GREENB   
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
 
 
 /* Image processing controls */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 87b83c3..14e2129 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -77,6 +77,7 @@
 /*  Four-character-code (FOURCC) */
 #define v4l2_fourcc(a, b, c, d)\
((__u32)(a) | ((__u32)(b)  8) | ((__u32)(c)  16) | ((__u32)(d)  
24))
+#define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1  31))
 
 /*
  * E N U M S
@@ -175,30 +176,103 @@ enum v4l2_memory {
 
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
 enum v4l2_colorspace {
-   /* ITU-R 601 -- broadcast NTSC/PAL */
+   /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
V4L2_COLORSPACE_SMPTE170M = 1,
 
-   /* 1125-Line (US) HDTV */
+   /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
V4L2_COLORSPACE_SMPTE240M = 2,
 
-   /* HD and modern captures. */
+   /* Rec.709: used for HDTV */
V4L2_COLORSPACE_REC709= 3,
 
-   /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
+   /*
+* Deprecated, do not use. No driver will ever return this. This was
+* based on a misunderstanding of the bt878 datasheet.
+*/
V4L2_COLORSPACE_BT878 = 4,
 
-   /* These should be useful.  Assume 601 extents. */
+   /*
+* NTSC 1953 colorspace. This only makes sense when dealing with
+* really, really old NTSC recordings. Superseded by SMPTE 170M.
+*/
V4L2_COLORSPACE_470_SYSTEM_M  = 5,
+
+   /*
+* EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
+* dealing with really old PAL/SECAM recordings. Superseded by
+* SMPTE 170M.
+*/
V4L2_COLORSPACE_470_SYSTEM_BG = 6,
 
-   /* I know there will be cameras that send this.  So, this is
-* unspecified chromaticities and full 0-255 on each of the
-* Y'CbCr components
+   /*
+* Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
+* and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
 */
V4L2_COLORSPACE_JPEG  = 7,
 
-   /* For RGB colourspaces, this is probably a good start. */
+   /* For RGB colorspaces such as produces by most webcams. */
V4L2_COLORSPACE_SRGB  = 8,
+
+   /* AdobeRGB colorspace */
+   V4L2_COLORSPACE_ADOBERGB  = 9,
+
+   /* BT.2020 colorspace, used for UHDTV. */
+   V4L2_COLORSPACE_BT2020= 10,
+};
+
+enum v4l2_ycbcr_encoding {
+   /*
+* Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
+* various colorspaces:
+*
+* V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
+* V4L2_COLORSPACE_470_SYSTEM_BG, V4L2_COLORSPACE_ADOBERGB and
+* V4L2_COLORSPACE_JPEG: V4L2_YCBCR_ENC_601
+*
+* V4L2_COLORSPACE_REC709: V4L2_YCBCR_ENC_709
+*
+* V4L2_COLORSPACE_SRGB: 

[yavta PATCH v2 1/3] yavta: Implement data_offset support for multi plane buffers

2014-12-15 Thread Sakari Ailus
Support data_offset for multi plane buffers. Also add an option to write the
data in the buffer before data offset (--buffer-prefix).

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/yavta.c b/yavta.c
index 77e5a41..003d6ba 100644
--- a/yavta.c
+++ b/yavta.c
@@ -80,6 +80,8 @@ struct device
 
void *pattern[VIDEO_MAX_PLANES];
unsigned int patternsize[VIDEO_MAX_PLANES];
+
+   bool write_buffer_prefix;
 };
 
 static bool video_is_mplane(struct device *dev)
@@ -1546,13 +1548,22 @@ static void video_save_image(struct device *dev, struct 
v4l2_buffer *buf,
 
for (i = 0; i  dev-num_planes; i++) {
unsigned int length;
+   unsigned int data_offset = 0;
 
-   if (video_is_mplane(dev))
+   if (video_is_mplane(dev)) {
length = buf-m.planes[i].bytesused;
-   else
+   data_offset = buf-m.planes[i].data_offset;
+   } else {
length = buf-bytesused;
+   }
+
+   if (!dev-write_buffer_prefix)
+   length -= data_offset;
+   else
+   data_offset = 0;
 
-   ret = write(fd, dev-buffers[buf-index].mem[i], length);
+   ret = write(fd, dev-buffers[buf-index].mem[i] + data_offset,
+   length);
if (ret  0) {
printf(write error: %s (%d)\n, strerror(errno), 
errno);
break;
@@ -1717,6 +1728,7 @@ static void usage(const char *argv0)
printf(-t, --time-per-frame num/denom  Set the time per frame (eg. 
1/25 = 25 fps)\n);
printf(-u, --userptr   Use the user pointers streaming 
method\n);
printf(-w, --set-control 'ctrl value'  Set control 'ctrl' to 
'value'\n);
+   printf(--buffer-prefix Write portions of buffer before 
data_offset\n);
printf(--buffer-size   Buffer size in bytes\n);
printf(--enum-formats  Enumerate formats\n);
printf(--enum-inputs   Enumerate inputs\n);
@@ -1749,10 +1761,12 @@ static void usage(const char *argv0)
 #define OPT_BUFFER_SIZE268
 #define OPT_PREMULTIPLIED  269
 #define OPT_QUEUE_LATE 270
+#define OPT_BUFFER_PREFIX  271
 
 static struct option opts[] = {
{buffer-size, 1, 0, OPT_BUFFER_SIZE},
{buffer-type, 1, 0, 'B'},
+   {buffer-prefix, 1, 0, OPT_BUFFER_PREFIX},
{capture, 2, 0, 'c'},
{check-overrun, 0, 0, 'C'},
{delay, 1, 0, 'd'},
@@ -2016,6 +2030,8 @@ int main(int argc, char *argv[])
case OPT_USERPTR_OFFSET:
userptr_offset = atoi(optarg);
break;
+   case OPT_BUFFER_PREFIX:
+   dev.write_buffer_prefix = true;
default:
printf(Invalid option -%c\n, c);
printf(Run %s -h for help.\n, argv[0]);
-- 
2.1.0.231.g7484e3b

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


[yavta PATCH v2 0/3] Support data_offset and 10-bit packed raw bayer formats

2014-12-15 Thread Sakari Ailus
Hi Laurent,

Compared to v1, a field remaining from the single plane data_offset support
patch has been removed. Also the kernel headers have been updated with the
10-bit packed raw bayer pixel format definitions.

-- 
Kind regards,
Sakari

--
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 1/1] yavta: Set plane size for mplane buffers in qbuf

2014-12-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Monday 15 December 2014 17:27:44 Sakari Ailus wrote:
 The plane size was left zero for mplane buffers when queueing a buffer. Fix
 this.
 
 Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
 ---
  yavta.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)
 
 diff --git a/yavta.c b/yavta.c
 index 7f9e814..77e5a41 100644
 --- a/yavta.c
 +++ b/yavta.c
 @@ -979,8 +979,12 @@ static int video_queue_buffer(struct device *dev, int
 index, enum buffer_fill_mo
 
   if (dev-memtype == V4L2_MEMORY_USERPTR) {
   if (video_is_mplane(dev)) {
 - for (i = 0; i  dev-num_planes; i++)
 - buf.m.planes[i].m.userptr = (unsigned long)dev-
 buffers[index].mem[i];
 + for (i = 0; i  dev-num_planes; i++) {
 + buf.m.planes[i].m.userptr = (unsigned long)
 + dev-buffers[index].mem[i];
 + buf.m.planes[i].length =
 + dev-buffers[index].size[i];

According to the V4L2 API, this field is set by the driver. That's not in line 
with the videobuf2 implementation, which requires the length field to be set 
for USERPTR and DMABUF. Would you like to submit a documentation patch ?

 + }
   } else {
   buf.m.userptr = (unsigned 
 long)dev-buffers[index].mem[0];

For consistency, what would you think about moving the buf.length assignment 
from the else statement right before this hunk to here ? If you're fine with 
that there's no need to resubmit, I'll apply the modification locally.

   }

-- 
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 majordomo info at  http://vger.kernel.org/majordomo-info.html


[yavta PATCH v2 3/3] yavta: Add support for 10-bit packed raw bayer formats

2014-12-15 Thread Sakari Ailus
Add support for these pixel formats:

V4L2_PIX_FMT_SBGGR10P
V4L2_PIX_FMT_SGBRG10P
V4L2_PIX_FMT_SGRBG10P
V4L2_PIX_FMT_SRGGB10P

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/yavta.c b/yavta.c
index 003d6ba..f40562a 100644
--- a/yavta.c
+++ b/yavta.c
@@ -202,6 +202,10 @@ static struct v4l2_format_info {
{ SGBRG10, V4L2_PIX_FMT_SGBRG10, 1 },
{ SGRBG10, V4L2_PIX_FMT_SGRBG10, 1 },
{ SRGGB10, V4L2_PIX_FMT_SRGGB10, 1 },
+   { SBGGR10P, V4L2_PIX_FMT_SBGGR10P, 1 },
+   { SGBRG10P, V4L2_PIX_FMT_SGBRG10P, 1 },
+   { SGRBG10P, V4L2_PIX_FMT_SGRBG10P, 1 },
+   { SRGGB10P, V4L2_PIX_FMT_SRGGB10P, 1 },
{ SBGGR12, V4L2_PIX_FMT_SBGGR12, 1 },
{ SGBRG12, V4L2_PIX_FMT_SGBRG12, 1 },
{ SGRBG12, V4L2_PIX_FMT_SGRBG12, 1 },
-- 
2.1.0.231.g7484e3b

--
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: [yavta PATCH v2 2/3] yavta: Update headers from upstream kernel

2014-12-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Monday 15 December 2014 18:26:48 Sakari Ailus wrote:
 Include packed raw 10-bit definitions as well.

Could you please mention in the commit message which upstream tag or commit ID 
has been used to generate the headers ?

 Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
 ---
  include/linux/v4l2-common.h   |   2 +
  include/linux/v4l2-controls.h |   6 +++
  include/linux/videodev2.h | 121 ---
  3 files changed, 111 insertions(+), 18 deletions(-)
 
 diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
 index 2f6f8ca..1527398 100644
 --- a/include/linux/v4l2-common.h
 +++ b/include/linux/v4l2-common.h
 @@ -43,6 +43,8 @@
  #define V4L2_SEL_TGT_CROP_DEFAULT0x0001
  /* Cropping bounds */
  #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
 +/* Native frame size */
 +#define V4L2_SEL_TGT_NATIVE_SIZE 0x0003
  /* Current composing area */
  #define V4L2_SEL_TGT_COMPOSE 0x0100
  /* Default composing area */
 diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
 index e946e43..661f119 100644
 --- a/include/linux/v4l2-controls.h
 +++ b/include/linux/v4l2-controls.h
 @@ -746,6 +746,8 @@ enum v4l2_auto_focus_range {
   V4L2_AUTO_FOCUS_RANGE_INFINITY  = 3,
  };
 
 +#define V4L2_CID_PAN_SPEED   (V4L2_CID_CAMERA_CLASS_BASE+32)
 +#define V4L2_CID_TILT_SPEED  (V4L2_CID_CAMERA_CLASS_BASE+33)
 
  /* FM Modulator class control IDs */
 
 @@ -865,6 +867,10 @@ enum v4l2_jpeg_chroma_subsampling {
  #define V4L2_CID_VBLANK  
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
  #define V4L2_CID_HBLANK  
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
  #define V4L2_CID_ANALOGUE_GAIN   
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE 
+ 3)
 +#define V4L2_CID_TEST_PATTERN_RED
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 
4)
 +#define V4L2_CID_TEST_PATTERN_GREENR 
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE 
+
 5) +#define V4L2_CID_TEST_PATTERN_BLUE
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE 
+
 6) +#define V4L2_CID_TEST_PATTERN_GREENB  
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE
 + 7)
 
 
  /* Image processing controls */
 diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
 index 87b83c3..14e2129 100644
 --- a/include/linux/videodev2.h
 +++ b/include/linux/videodev2.h
 @@ -77,6 +77,7 @@
  /*  Four-character-code (FOURCC) */
  #define v4l2_fourcc(a, b, c, d)\
   ((__u32)(a) | ((__u32)(b)  8) | ((__u32)(c)  16) | ((__u32)(d)  
24))
 +#define v4l2_fourcc_be(a, b, c, d)   (v4l2_fourcc(a, b, c, d) | (1  31))
 
  /*
   *   E N U M S
 @@ -175,30 +176,103 @@ enum v4l2_memory {
 
  /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
  enum v4l2_colorspace {
 - /* ITU-R 601 -- broadcast NTSC/PAL */
 + /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
   V4L2_COLORSPACE_SMPTE170M = 1,
 
 - /* 1125-Line (US) HDTV */
 + /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
   V4L2_COLORSPACE_SMPTE240M = 2,
 
 - /* HD and modern captures. */
 + /* Rec.709: used for HDTV */
   V4L2_COLORSPACE_REC709= 3,
 
 - /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
 + /*
 +  * Deprecated, do not use. No driver will ever return this. This was
 +  * based on a misunderstanding of the bt878 datasheet.
 +  */
   V4L2_COLORSPACE_BT878 = 4,
 
 - /* These should be useful.  Assume 601 extents. */
 + /*
 +  * NTSC 1953 colorspace. This only makes sense when dealing with
 +  * really, really old NTSC recordings. Superseded by SMPTE 170M.
 +  */
   V4L2_COLORSPACE_470_SYSTEM_M  = 5,
 +
 + /*
 +  * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
 +  * dealing with really old PAL/SECAM recordings. Superseded by
 +  * SMPTE 170M.
 +  */
   V4L2_COLORSPACE_470_SYSTEM_BG = 6,
 
 - /* I know there will be cameras that send this.  So, this is
 -  * unspecified chromaticities and full 0-255 on each of the
 -  * Y'CbCr components
 + /*
 +  * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
 +  * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
*/
   V4L2_COLORSPACE_JPEG  = 7,
 
 - /* For RGB colourspaces, this is probably a good start. */
 + /* For RGB colorspaces such as produces by most webcams. */
   V4L2_COLORSPACE_SRGB  = 8,
 +
 + /* AdobeRGB colorspace */
 + V4L2_COLORSPACE_ADOBERGB  = 9,
 +
 + /* BT.2020 colorspace, used for UHDTV. */
 + V4L2_COLORSPACE_BT2020= 10,
 +};
 +
 +enum v4l2_ycbcr_encoding {
 + /*
 +  * Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings for the
 +  * various colorspaces:
 +  *
 +  * V4L2_COLORSPACE_SMPTE170M, V4L2_COLORSPACE_470_SYSTEM_M,
 +  * 

Re: [yavta PATCH v2 3/3] yavta: Add support for 10-bit packed raw bayer formats

2014-12-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Monday 15 December 2014 18:26:49 Sakari Ailus wrote:
 Add support for these pixel formats:
 
 V4L2_PIX_FMT_SBGGR10P
 V4L2_PIX_FMT_SGBRG10P
 V4L2_PIX_FMT_SGRBG10P
 V4L2_PIX_FMT_SRGGB10P
 
 Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  yavta.c | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/yavta.c b/yavta.c
 index 003d6ba..f40562a 100644
 --- a/yavta.c
 +++ b/yavta.c
 @@ -202,6 +202,10 @@ static struct v4l2_format_info {
   { SGBRG10, V4L2_PIX_FMT_SGBRG10, 1 },
   { SGRBG10, V4L2_PIX_FMT_SGRBG10, 1 },
   { SRGGB10, V4L2_PIX_FMT_SRGGB10, 1 },
 + { SBGGR10P, V4L2_PIX_FMT_SBGGR10P, 1 },
 + { SGBRG10P, V4L2_PIX_FMT_SGBRG10P, 1 },
 + { SGRBG10P, V4L2_PIX_FMT_SGRBG10P, 1 },
 + { SRGGB10P, V4L2_PIX_FMT_SRGGB10P, 1 },
   { SBGGR12, V4L2_PIX_FMT_SBGGR12, 1 },
   { SGBRG12, V4L2_PIX_FMT_SGBRG12, 1 },
   { SGRBG12, V4L2_PIX_FMT_SGRBG12, 1 },

-- 
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 majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC v01] Driver for Toshiba TC358743 CSI-2 to HDMI bridge

2014-12-15 Thread matrandg
From: Mats Randgaard matra...@cisco.com

The driver is tested on our hardware and all the implemented features
works as expected.

Missing features:
- CEC support
- HDCP repeater support
- IR support

Signed-off-by: Mats Randgaard matra...@cisco.com
---
 MAINTAINERS|6 +
 drivers/media/i2c/Kconfig  |   12 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/tc358743.c   | 1768 
 drivers/media/i2c/tc358743_regs.h  |  670 ++
 include/media/tc358743.h   |   89 ++
 include/uapi/linux/v4l2-controls.h |4 +
 7 files changed, 2550 insertions(+)
 create mode 100644 drivers/media/i2c/tc358743.c
 create mode 100644 drivers/media/i2c/tc358743_regs.h
 create mode 100644 include/media/tc358743.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 9c49eb6..7608a83 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9448,6 +9448,12 @@ L:   platform-driver-...@vger.kernel.org
 S: Orphan
 F: drivers/platform/x86/toshiba_acpi.c
 
+TOSHIBA TC358743 DRIVER
+M: Mats Randgaard matra...@cisco.com
+L: linux-media@vger.kernel.org
+S: Maintained
+F: drivers/media/i2c/tc358743*
+
 TOSHIBA SMM DRIVER
 M: Jonathan Buzzard jonat...@buzzard.org.uk
 L: tlinux-us...@tce.toshiba-dme.co.jp
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index f40b4cf..0103cdf 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -293,6 +293,18 @@ config VIDEO_SAA7191
  To compile this driver as a module, choose M here: the
  module will be called saa7191.
 
+config VIDEO_TC358743
+   tristate Toshiba TC358743 decoder
+   depends on VIDEO_V4L2  I2C
+   ---help---
+ Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge
+
+ This is a Analog Devices Component/Graphics Digitizer
+ with 4:1 Multiplexed HDMI Receiver.
+
+ To compile this driver as a module, choose M here: the
+ module will be called tc358743.
+
 config VIDEO_TVP514X
tristate Texas Instruments TVP514x video decoder
depends on VIDEO_V4L2  I2C
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 01ae932..b4dea43 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -78,3 +78,4 @@ obj-$(CONFIG_VIDEO_SMIAPP_PLL)+= smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
 obj-$(CONFIG_VIDEO_ML86V7667)  += ml86v7667.o
+obj-$(CONFIG_VIDEO_TC358743)   += tc358743.o
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
new file mode 100644
index 000..a86cbe0
--- /dev/null
+++ b/drivers/media/i2c/tc358743.c
@@ -0,0 +1,1768 @@
+/*
+ * tc358743 - Toshiba HDMI to CSI-2 bridge
+ *
+ * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights
+ * reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * References (c = chapter, p = page):
+ * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60
+ * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/i2c.h
+#include linux/delay.h
+#include linux/videodev2.h
+#include linux/workqueue.h
+#include linux/v4l2-dv-timings.h
+#include media/v4l2-dv-timings.h
+#include media/v4l2-device.h
+#include media/v4l2-ctrls.h
+#include media/tc358743.h
+
+#include tc358743_regs.h
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, debug level (0-3));
+
+MODULE_DESCRIPTION(Toshiba TC358743 HDMI to CSI-2 bridge driver);
+MODULE_AUTHOR(Ramakrishnan Muthukrishnan r...@rkrishnan.org);
+MODULE_AUTHOR(Mikhail Khelik mkhe...@cisco.com);
+MODULE_AUTHOR(Mats Randgaard matra...@cisco.com);
+MODULE_LICENSE(GPL);
+
+static const struct v4l2_dv_timings_cap tc358743_timings_cap = {
+   .type = V4L2_DV_BT_656_1120,
+   /* keep this initialization for compatibility with GCC  4.4.6 */
+   .reserved = { 0 },
+   /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */
+   V4L2_INIT_BT_TIMINGS(1, 1, 1, 1, 0, 16500,
+   V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
+   V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
+   

Re: [yavta PATCH v2 1/3] yavta: Implement data_offset support for multi plane buffers

2014-12-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Monday 15 December 2014 18:26:47 Sakari Ailus wrote:
 Support data_offset for multi plane buffers. Also add an option to write the
 data in the buffer before data offset (--buffer-prefix).
 
 Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
 ---
  yavta.c | 22 +++---
  1 file changed, 19 insertions(+), 3 deletions(-)
 
 diff --git a/yavta.c b/yavta.c
 index 77e5a41..003d6ba 100644
 --- a/yavta.c
 +++ b/yavta.c
 @@ -80,6 +80,8 @@ struct device
 
   void *pattern[VIDEO_MAX_PLANES];
   unsigned int patternsize[VIDEO_MAX_PLANES];
 +
 + bool write_buffer_prefix;
  };
 
  static bool video_is_mplane(struct device *dev)
 @@ -1546,13 +1548,22 @@ static void video_save_image(struct device *dev,
 struct v4l2_buffer *buf,
 
   for (i = 0; i  dev-num_planes; i++) {
   unsigned int length;
 + unsigned int data_offset = 0;
 
 - if (video_is_mplane(dev))
 + if (video_is_mplane(dev)) {
   length = buf-m.planes[i].bytesused;
 - else
 + data_offset = buf-m.planes[i].data_offset;
 + } else {
   length = buf-bytesused;
 + }
 +
 + if (!dev-write_buffer_prefix)
 + length -= data_offset;
 + else
 + data_offset = 0;

Nitpicking here, I find it a bit hard to read that you're adjusting the length 
here but still keep the offset to add it to the buffer address below. How 
about something like

void *data = dev-buffers[buf-index].mem[i];
unsigned int length;

if (video_is_mplane(dev)) {
length = buf-m.planes[i].bytesused;

if (!dev-write_buffer_prefix) {
data += buf-m.planes[i].data_offset;
length -= buf-m.planes[i].data_offset;
}

} else {
length = buf-bytesused;
}

ret = write(fd, data, length);

 - ret = write(fd, dev-buffers[buf-index].mem[i], length);
 + ret = write(fd, dev-buffers[buf-index].mem[i] + data_offset,
 + length);
   if (ret  0) {
   printf(write error: %s (%d)\n, strerror(errno), 
 errno);
   break;
 @@ -1717,6 +1728,7 @@ static void usage(const char *argv0)
   printf(-t, --time-per-frame num/denom  Set the time per frame (eg. 
 1/25 
=
 25 fps)\n); printf(-u, --userptrUse the user pointers 
 streaming
 method\n); printf(-w, --set-control 'ctrl value'Set control 'ctrl' to
 'value'\n); +printf(--buffer-prefix Write portions 
 of buffer 
before
 data_offset\n); printf(--buffer-sizeBuffer size in 
 bytes\n);
   printf(--enum-formats  Enumerate formats\n);
   printf(--enum-inputs   Enumerate inputs\n);
 @@ -1749,10 +1761,12 @@ static void usage(const char *argv0)
  #define OPT_BUFFER_SIZE  268
  #define OPT_PREMULTIPLIED269
  #define OPT_QUEUE_LATE   270
 +#define OPT_BUFFER_PREFIX271
 
  static struct option opts[] = {
   {buffer-size, 1, 0, OPT_BUFFER_SIZE},
   {buffer-type, 1, 0, 'B'},
 + {buffer-prefix, 1, 0, OPT_BUFFER_PREFIX},
   {capture, 2, 0, 'c'},
   {check-overrun, 0, 0, 'C'},
   {delay, 1, 0, 'd'},
 @@ -2016,6 +2030,8 @@ int main(int argc, char *argv[])
   case OPT_USERPTR_OFFSET:
   userptr_offset = atoi(optarg);
   break;
 + case OPT_BUFFER_PREFIX:
 + dev.write_buffer_prefix = true;
   default:
   printf(Invalid option -%c\n, c);
   printf(Run %s -h for help.\n, argv[0]);

-- 
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 majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [tvtime] Broke support for cards with multiple numbers of the input

2014-12-15 Thread Mauro Carvalho Chehab
Em Mon, 15 Dec 2014 11:56:16 +
grigore calugar zradu1...@gmail.com escreveu:

 After 
 commit:http://git.linuxtv.org/cgit.cgi/tvtime.git/commit/?id=c49ebc47c51e0bcf9e8c4403efdf0f31bf1b4479
 support for support for cards with multiple numbers of the input is
 broken. My tuner has 4 inputs and after this commit I can not select
 any from OSD menu.

Sorry, I inverted a test there. The enclosed patch should fix it.
I'm merging upstream.

Regards,
Mauro

[PATCH] Fix input select condition

Changeset c49ebc47c51e added an inverted condition with caused a
regression.

Reported-by: Grigore Calugar zradu1...@gmail.com
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/src/videoinput.c b/src/videoinput.c
index 084cc3f4c7ed..50c2b84b70de 100644
--- a/src/videoinput.c
+++ b/src/videoinput.c
@@ -849,8 +849,8 @@ void videoinput_set_input_num( videoinput_t *vidin, int 
inputnum )
 
 videoinput_stop_capture_v4l2( vidin );
 
-if( !vidin-numinputs ) {
-if( ioctl( vidin-grab_fd, VIDIOC_S_INPUT, index )  0 ) {
+if( vidin-numinputs ) {
+   if( ioctl( vidin-grab_fd, VIDIOC_S_INPUT, index )  0 ) {
fprintf( stderr, videoinput: Card refuses to set its input.\n
 Please post a bug report to  PACKAGE_BUGREPORT \n
 indicating your card, driver, and this error message: 
%s.\n,


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


[yavta PATCH v3 3/3] yavta: Add support for 10-bit packed raw bayer formats

2014-12-15 Thread Sakari Ailus
Add support for these pixel formats:

V4L2_PIX_FMT_SBGGR10P
V4L2_PIX_FMT_SGBRG10P
V4L2_PIX_FMT_SGRBG10P
V4L2_PIX_FMT_SRGGB10P

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/yavta.c b/yavta.c
index cf8239b..e79abd6 100644
--- a/yavta.c
+++ b/yavta.c
@@ -202,6 +202,10 @@ static struct v4l2_format_info {
{ SGBRG10, V4L2_PIX_FMT_SGBRG10, 1 },
{ SGRBG10, V4L2_PIX_FMT_SGRBG10, 1 },
{ SRGGB10, V4L2_PIX_FMT_SRGGB10, 1 },
+   { SBGGR10P, V4L2_PIX_FMT_SBGGR10P, 1 },
+   { SGBRG10P, V4L2_PIX_FMT_SGBRG10P, 1 },
+   { SGRBG10P, V4L2_PIX_FMT_SGRBG10P, 1 },
+   { SRGGB10P, V4L2_PIX_FMT_SRGGB10P, 1 },
{ SBGGR12, V4L2_PIX_FMT_SBGGR12, 1 },
{ SGBRG12, V4L2_PIX_FMT_SGBRG12, 1 },
{ SGRBG12, V4L2_PIX_FMT_SGRBG12, 1 },
-- 
2.1.0.231.g7484e3b

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


[yavta PATCH v3 0/3] Support data_offset and 10-bit packed raw bayer

2014-12-15 Thread Sakari Ailus
Hi Laurent,

since v2:

- Reworked patch 1,
- List media-tree and on-list patches included in the headers.

-- 
Kind regards,
Sakari

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


[yavta PATCH v3 2/3] yavta: Update headers from upstream kernel

2014-12-15 Thread Sakari Ailus
Include packed raw 10-bit definitions as well.

This includes patches up to and including
[media] mn88473: One function call less in mn88473_init() after error
and the following patches (v2 sent to linux-media):

DocBook: v4l: Fix raw bayer pixel format documentation wording,
DocBook: v4l: Rearrange raw bayer format definitions, remove bad comment and
v4l: Add packed Bayer raw10 pixel formats.

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 include/linux/v4l2-common.h   |   2 +
 include/linux/v4l2-controls.h |   6 +++
 include/linux/videodev2.h | 121 +++---
 3 files changed, 111 insertions(+), 18 deletions(-)

diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
index 2f6f8ca..1527398 100644
--- a/include/linux/v4l2-common.h
+++ b/include/linux/v4l2-common.h
@@ -43,6 +43,8 @@
 #define V4L2_SEL_TGT_CROP_DEFAULT  0x0001
 /* Cropping bounds */
 #define V4L2_SEL_TGT_CROP_BOUNDS   0x0002
+/* Native frame size */
+#define V4L2_SEL_TGT_NATIVE_SIZE   0x0003
 /* Current composing area */
 #define V4L2_SEL_TGT_COMPOSE   0x0100
 /* Default composing area */
diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
index e946e43..661f119 100644
--- a/include/linux/v4l2-controls.h
+++ b/include/linux/v4l2-controls.h
@@ -746,6 +746,8 @@ enum v4l2_auto_focus_range {
V4L2_AUTO_FOCUS_RANGE_INFINITY  = 3,
 };
 
+#define V4L2_CID_PAN_SPEED (V4L2_CID_CAMERA_CLASS_BASE+32)
+#define V4L2_CID_TILT_SPEED(V4L2_CID_CAMERA_CLASS_BASE+33)
 
 /* FM Modulator class control IDs */
 
@@ -865,6 +867,10 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_VBLANK
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
 #define V4L2_CID_HBLANK
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
 #define V4L2_CID_ANALOGUE_GAIN 
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
+#define V4L2_CID_TEST_PATTERN_RED  
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 4)
+#define V4L2_CID_TEST_PATTERN_GREENR   
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5)
+#define V4L2_CID_TEST_PATTERN_BLUE 
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
+#define V4L2_CID_TEST_PATTERN_GREENB   
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
 
 
 /* Image processing controls */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 87b83c3..14e2129 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -77,6 +77,7 @@
 /*  Four-character-code (FOURCC) */
 #define v4l2_fourcc(a, b, c, d)\
((__u32)(a) | ((__u32)(b)  8) | ((__u32)(c)  16) | ((__u32)(d)  
24))
+#define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1  31))
 
 /*
  * E N U M S
@@ -175,30 +176,103 @@ enum v4l2_memory {
 
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
 enum v4l2_colorspace {
-   /* ITU-R 601 -- broadcast NTSC/PAL */
+   /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
V4L2_COLORSPACE_SMPTE170M = 1,
 
-   /* 1125-Line (US) HDTV */
+   /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
V4L2_COLORSPACE_SMPTE240M = 2,
 
-   /* HD and modern captures. */
+   /* Rec.709: used for HDTV */
V4L2_COLORSPACE_REC709= 3,
 
-   /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
+   /*
+* Deprecated, do not use. No driver will ever return this. This was
+* based on a misunderstanding of the bt878 datasheet.
+*/
V4L2_COLORSPACE_BT878 = 4,
 
-   /* These should be useful.  Assume 601 extents. */
+   /*
+* NTSC 1953 colorspace. This only makes sense when dealing with
+* really, really old NTSC recordings. Superseded by SMPTE 170M.
+*/
V4L2_COLORSPACE_470_SYSTEM_M  = 5,
+
+   /*
+* EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
+* dealing with really old PAL/SECAM recordings. Superseded by
+* SMPTE 170M.
+*/
V4L2_COLORSPACE_470_SYSTEM_BG = 6,
 
-   /* I know there will be cameras that send this.  So, this is
-* unspecified chromaticities and full 0-255 on each of the
-* Y'CbCr components
+   /*
+* Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
+* and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
 */
V4L2_COLORSPACE_JPEG  = 7,
 
-   /* For RGB colourspaces, this is probably a good start. */
+   /* For RGB colorspaces such as produces by most webcams. */
V4L2_COLORSPACE_SRGB  = 8,
+
+   /* AdobeRGB colorspace */
+   V4L2_COLORSPACE_ADOBERGB  = 9,
+
+   /* BT.2020 colorspace, used for UHDTV. */
+   V4L2_COLORSPACE_BT2020= 10,
+};
+
+enum v4l2_ycbcr_encoding {
+   /*
+* Mapping of V4L2_YCBCR_ENC_DEFAULT to actual encodings 

[yavta PATCH v3 1/3] yavta: Implement data_offset support for multi plane buffers

2014-12-15 Thread Sakari Ailus
Support data_offset for multi plane buffers. Also add an option to write the
data in the buffer before data offset (--buffer-prefix).

Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
---
 yavta.c | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/yavta.c b/yavta.c
index 77e5a41..cf8239b 100644
--- a/yavta.c
+++ b/yavta.c
@@ -80,6 +80,8 @@ struct device
 
void *pattern[VIDEO_MAX_PLANES];
unsigned int patternsize[VIDEO_MAX_PLANES];
+
+   bool write_buffer_prefix;
 };
 
 static bool video_is_mplane(struct device *dev)
@@ -1545,14 +1547,21 @@ static void video_save_image(struct device *dev, struct 
v4l2_buffer *buf,
return;
 
for (i = 0; i  dev-num_planes; i++) {
+   void *data = dev-buffers[buf-index].mem[i];
unsigned int length;
 
-   if (video_is_mplane(dev))
+   if (video_is_mplane(dev)) {
length = buf-m.planes[i].bytesused;
-   else
+
+   if (!dev-write_buffer_prefix) {
+   data += buf-m.planes[i].data_offset;
+   length -= buf-m.planes[i].data_offset;
+   }
+   } else {
length = buf-bytesused;
+   }
 
-   ret = write(fd, dev-buffers[buf-index].mem[i], length);
+   ret = write(fd, data, length);
if (ret  0) {
printf(write error: %s (%d)\n, strerror(errno), 
errno);
break;
@@ -1717,6 +1726,7 @@ static void usage(const char *argv0)
printf(-t, --time-per-frame num/denom  Set the time per frame (eg. 
1/25 = 25 fps)\n);
printf(-u, --userptr   Use the user pointers streaming 
method\n);
printf(-w, --set-control 'ctrl value'  Set control 'ctrl' to 
'value'\n);
+   printf(--buffer-prefix Write portions of buffer before 
data_offset\n);
printf(--buffer-size   Buffer size in bytes\n);
printf(--enum-formats  Enumerate formats\n);
printf(--enum-inputs   Enumerate inputs\n);
@@ -1749,10 +1759,12 @@ static void usage(const char *argv0)
 #define OPT_BUFFER_SIZE268
 #define OPT_PREMULTIPLIED  269
 #define OPT_QUEUE_LATE 270
+#define OPT_BUFFER_PREFIX  271
 
 static struct option opts[] = {
{buffer-size, 1, 0, OPT_BUFFER_SIZE},
{buffer-type, 1, 0, 'B'},
+   {buffer-prefix, 1, 0, OPT_BUFFER_PREFIX},
{capture, 2, 0, 'c'},
{check-overrun, 0, 0, 'C'},
{delay, 1, 0, 'd'},
@@ -2016,6 +2028,8 @@ int main(int argc, char *argv[])
case OPT_USERPTR_OFFSET:
userptr_offset = atoi(optarg);
break;
+   case OPT_BUFFER_PREFIX:
+   dev.write_buffer_prefix = true;
default:
printf(Invalid option -%c\n, c);
printf(Run %s -h for help.\n, argv[0]);
-- 
2.1.0.231.g7484e3b

--
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 1/1] yavta: Set plane size for mplane buffers in qbuf

2014-12-15 Thread Sakari Ailus
Hi Laurent,

On Mon, Dec 15, 2014 at 06:31:01PM +0200, Laurent Pinchart wrote:
 Hi Sakari,
 
 Thank you for the patch.
 
 On Monday 15 December 2014 17:27:44 Sakari Ailus wrote:
  The plane size was left zero for mplane buffers when queueing a buffer. Fix
  this.
  
  Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
  ---
   yavta.c | 8 ++--
   1 file changed, 6 insertions(+), 2 deletions(-)
  
  diff --git a/yavta.c b/yavta.c
  index 7f9e814..77e5a41 100644
  --- a/yavta.c
  +++ b/yavta.c
  @@ -979,8 +979,12 @@ static int video_queue_buffer(struct device *dev, int
  index, enum buffer_fill_mo
  
  if (dev-memtype == V4L2_MEMORY_USERPTR) {
  if (video_is_mplane(dev)) {
  -   for (i = 0; i  dev-num_planes; i++)
  -   buf.m.planes[i].m.userptr = (unsigned long)dev-
  buffers[index].mem[i];
  +   for (i = 0; i  dev-num_planes; i++) {
  +   buf.m.planes[i].m.userptr = (unsigned long)
  +   dev-buffers[index].mem[i];
  +   buf.m.planes[i].length =
  +   dev-buffers[index].size[i];
 
 According to the V4L2 API, this field is set by the driver. That's not in 
 line 
 with the videobuf2 implementation, which requires the length field to be set 
 for USERPTR and DMABUF. Would you like to submit a documentation patch ?

Certainly. I actually missed that this is what the documentation states.

  +   }
  } else {
  buf.m.userptr = (unsigned 
  long)dev-buffers[index].mem[0];
 
 For consistency, what would you think about moving the buf.length assignment 
 from the else statement right before this hunk to here ? If you're fine with 
 that there's no need to resubmit, I'll apply the modification locally.

Feel free to add that.

-- 
Cheers,

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


Re: [yavta PATCH v3 2/3] yavta: Update headers from upstream kernel

2014-12-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Monday 15 December 2014 21:58:39 Sakari Ailus wrote:
 Include packed raw 10-bit definitions as well.
 
 This includes patches up to and including
 [media] mn88473: One function call less in mn88473_init() after error
 and the following patches (v2 sent to linux-media):
 
 DocBook: v4l: Fix raw bayer pixel format documentation wording,
 DocBook: v4l: Rearrange raw bayer format definitions, remove bad comment
 and v4l: Add packed Bayer raw10 pixel formats.

Could you please resubmit this with the upstream commit ID when Mauro will 
have pulled those two patches ?

 Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com
 ---
  include/linux/v4l2-common.h   |   2 +
  include/linux/v4l2-controls.h |   6 +++
  include/linux/videodev2.h | 121 ---
  3 files changed, 111 insertions(+), 18 deletions(-)
 
 diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
 index 2f6f8ca..1527398 100644
 --- a/include/linux/v4l2-common.h
 +++ b/include/linux/v4l2-common.h
 @@ -43,6 +43,8 @@
  #define V4L2_SEL_TGT_CROP_DEFAULT0x0001
  /* Cropping bounds */
  #define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
 +/* Native frame size */
 +#define V4L2_SEL_TGT_NATIVE_SIZE 0x0003
  /* Current composing area */
  #define V4L2_SEL_TGT_COMPOSE 0x0100
  /* Default composing area */
 diff --git a/include/linux/v4l2-controls.h b/include/linux/v4l2-controls.h
 index e946e43..661f119 100644
 --- a/include/linux/v4l2-controls.h
 +++ b/include/linux/v4l2-controls.h
 @@ -746,6 +746,8 @@ enum v4l2_auto_focus_range {
   V4L2_AUTO_FOCUS_RANGE_INFINITY  = 3,
  };
 
 +#define V4L2_CID_PAN_SPEED   (V4L2_CID_CAMERA_CLASS_BASE+32)
 +#define V4L2_CID_TILT_SPEED  (V4L2_CID_CAMERA_CLASS_BASE+33)
 
  /* FM Modulator class control IDs */
 
 @@ -865,6 +867,10 @@ enum v4l2_jpeg_chroma_subsampling {
  #define V4L2_CID_VBLANK  
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
  #define V4L2_CID_HBLANK  
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
  #define V4L2_CID_ANALOGUE_GAIN   
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE 
+ 3)
 +#define V4L2_CID_TEST_PATTERN_RED
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 
4)
 +#define V4L2_CID_TEST_PATTERN_GREENR 
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE 
+
 5) +#define V4L2_CID_TEST_PATTERN_BLUE
 (V4L2_CID_IMAGE_SOURCE_CLASS_BASE 
+
 6) +#define V4L2_CID_TEST_PATTERN_GREENB  
(V4L2_CID_IMAGE_SOURCE_CLASS_BASE
 + 7)
 
 
  /* Image processing controls */
 diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
 index 87b83c3..14e2129 100644
 --- a/include/linux/videodev2.h
 +++ b/include/linux/videodev2.h
 @@ -77,6 +77,7 @@
  /*  Four-character-code (FOURCC) */
  #define v4l2_fourcc(a, b, c, d)\
   ((__u32)(a) | ((__u32)(b)  8) | ((__u32)(c)  16) | ((__u32)(d)  
24))
 +#define v4l2_fourcc_be(a, b, c, d)   (v4l2_fourcc(a, b, c, d) | (1  31))
 
  /*
   *   E N U M S
 @@ -175,30 +176,103 @@ enum v4l2_memory {
 
  /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
  enum v4l2_colorspace {
 - /* ITU-R 601 -- broadcast NTSC/PAL */
 + /* SMPTE 170M: used for broadcast NTSC/PAL SDTV */
   V4L2_COLORSPACE_SMPTE170M = 1,
 
 - /* 1125-Line (US) HDTV */
 + /* Obsolete pre-1998 SMPTE 240M HDTV standard, superseded by Rec 709 */
   V4L2_COLORSPACE_SMPTE240M = 2,
 
 - /* HD and modern captures. */
 + /* Rec.709: used for HDTV */
   V4L2_COLORSPACE_REC709= 3,
 
 - /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
 + /*
 +  * Deprecated, do not use. No driver will ever return this. This was
 +  * based on a misunderstanding of the bt878 datasheet.
 +  */
   V4L2_COLORSPACE_BT878 = 4,
 
 - /* These should be useful.  Assume 601 extents. */
 + /*
 +  * NTSC 1953 colorspace. This only makes sense when dealing with
 +  * really, really old NTSC recordings. Superseded by SMPTE 170M.
 +  */
   V4L2_COLORSPACE_470_SYSTEM_M  = 5,
 +
 + /*
 +  * EBU Tech 3213 PAL/SECAM colorspace. This only makes sense when
 +  * dealing with really old PAL/SECAM recordings. Superseded by
 +  * SMPTE 170M.
 +  */
   V4L2_COLORSPACE_470_SYSTEM_BG = 6,
 
 - /* I know there will be cameras that send this.  So, this is
 -  * unspecified chromaticities and full 0-255 on each of the
 -  * Y'CbCr components
 + /*
 +  * Effectively shorthand for V4L2_COLORSPACE_SRGB, V4L2_YCBCR_ENC_601
 +  * and V4L2_QUANTIZATION_FULL_RANGE. To be used for (Motion-)JPEG.
*/
   V4L2_COLORSPACE_JPEG  = 7,
 
 - /* For RGB colourspaces, this is probably a good start. */
 + /* For RGB colorspaces such as produces by most webcams. */
   V4L2_COLORSPACE_SRGB  = 8,
 +
 + /* AdobeRGB colorspace */
 + V4L2_COLORSPACE_ADOBERGB 

Re: [yavta PATCH v3 1/3] yavta: Implement data_offset support for multi plane buffers

2014-12-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Monday 15 December 2014 21:58:38 Sakari Ailus wrote:
 Support data_offset for multi plane buffers. Also add an option to write the
 data in the buffer before data offset (--buffer-prefix).
 
 Signed-off-by: Sakari Ailus sakari.ai...@linux.intel.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  yavta.c | 20 +---
  1 file changed, 17 insertions(+), 3 deletions(-)
 
 diff --git a/yavta.c b/yavta.c
 index 77e5a41..cf8239b 100644
 --- a/yavta.c
 +++ b/yavta.c
 @@ -80,6 +80,8 @@ struct device
 
   void *pattern[VIDEO_MAX_PLANES];
   unsigned int patternsize[VIDEO_MAX_PLANES];
 +
 + bool write_buffer_prefix;
  };
 
  static bool video_is_mplane(struct device *dev)
 @@ -1545,14 +1547,21 @@ static void video_save_image(struct device *dev,
 struct v4l2_buffer *buf, return;
 
   for (i = 0; i  dev-num_planes; i++) {
 + void *data = dev-buffers[buf-index].mem[i];
   unsigned int length;
 
 - if (video_is_mplane(dev))
 + if (video_is_mplane(dev)) {
   length = buf-m.planes[i].bytesused;
 - else
 +
 + if (!dev-write_buffer_prefix) {
 + data += buf-m.planes[i].data_offset;
 + length -= buf-m.planes[i].data_offset;
 + }
 + } else {
   length = buf-bytesused;
 + }
 
 - ret = write(fd, dev-buffers[buf-index].mem[i], length);
 + ret = write(fd, data, length);
   if (ret  0) {
   printf(write error: %s (%d)\n, strerror(errno), 
 errno);
   break;
 @@ -1717,6 +1726,7 @@ static void usage(const char *argv0)
   printf(-t, --time-per-frame num/denom  Set the time per frame (eg. 
 1/25 
=
 25 fps)\n); printf(-u, --userptrUse the user pointers 
 streaming
 method\n); printf(-w, --set-control 'ctrl value'Set control 'ctrl' to
 'value'\n); +printf(--buffer-prefix Write portions 
 of buffer 
before
 data_offset\n); printf(--buffer-sizeBuffer size in 
 bytes\n);
   printf(--enum-formats  Enumerate formats\n);
   printf(--enum-inputs   Enumerate inputs\n);
 @@ -1749,10 +1759,12 @@ static void usage(const char *argv0)
  #define OPT_BUFFER_SIZE  268
  #define OPT_PREMULTIPLIED269
  #define OPT_QUEUE_LATE   270
 +#define OPT_BUFFER_PREFIX271
 
  static struct option opts[] = {
   {buffer-size, 1, 0, OPT_BUFFER_SIZE},
   {buffer-type, 1, 0, 'B'},
 + {buffer-prefix, 1, 0, OPT_BUFFER_PREFIX},
   {capture, 2, 0, 'c'},
   {check-overrun, 0, 0, 'C'},
   {delay, 1, 0, 'd'},
 @@ -2016,6 +2028,8 @@ int main(int argc, char *argv[])
   case OPT_USERPTR_OFFSET:
   userptr_offset = atoi(optarg);
   break;
 + case OPT_BUFFER_PREFIX:
 + dev.write_buffer_prefix = true;
   default:
   printf(Invalid option -%c\n, c);
   printf(Run %s -h for help.\n, argv[0]);

-- 
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 majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/3] yavta: Compound control support

2014-12-15 Thread Laurent Pinchart
Hello,

This patch set implements compound control get and set support for yavta. Only
the integer types are currently supported.

I'm not sure to be happy with the way compound control values are printed. I'm
open to suggestions (or better, patches ;-)) on how to improve this.

Laurent Pinchart (3):
  Implement VIDIOC_QUERY_EXT_CTRL support
  Implement compound control get support
  Implement compound control set support

 yavta.c | 414 +---
 1 file changed, 316 insertions(+), 98 deletions(-)

-- 
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 majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] Implement compound control set support

2014-12-15 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 yavta.c | 217 
 1 file changed, 165 insertions(+), 52 deletions(-)

diff --git a/yavta.c b/yavta.c
index 006bab6..843c561 100644
--- a/yavta.c
+++ b/yavta.c
@@ -19,6 +19,7 @@
 
 #define __STDC_FORMAT_MACROS
 
+#include ctype.h
 #include stdio.h
 #include string.h
 #include fcntl.h
@@ -494,59 +495,38 @@ static int get_control(struct device *dev,
return ret;
 }
 
-static void set_control(struct device *dev, unsigned int id,
-   int64_t val)
+static int set_control(struct device *dev,
+  const struct v4l2_query_ext_ctrl *query,
+  struct v4l2_ext_control *ctrl)
 {
struct v4l2_ext_controls ctrls;
-   struct v4l2_ext_control ctrl;
-   struct v4l2_query_ext_ctrl query;
-   int64_t old_val = val;
-   int is_64;
+   struct v4l2_control old;
int ret;
 
-   ret = query_control(dev, id, query);
-   if (ret  0)
-   return;
-
-   is_64 = query.type == V4L2_CTRL_TYPE_INTEGER64;
-
memset(ctrls, 0, sizeof(ctrls));
-   memset(ctrl, 0, sizeof(ctrl));
 
-   ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(id);
+   ctrls.ctrl_class = V4L2_CTRL_ID2CLASS(ctrl-id);
ctrls.count = 1;
-   ctrls.controls = ctrl;
+   ctrls.controls = ctrl;
 
-   ctrl.id = id;
-   if (is_64)
-   ctrl.value64 = val;
-   else
-   ctrl.value = val;
+   ctrl-id = query-id;
 
ret = ioctl(dev-fd, VIDIOC_S_EXT_CTRLS, ctrls);
-   if (ret != -1) {
-   if (is_64)
-   val = ctrl.value64;
-   else
-   val = ctrl.value;
-   } else if (!is_64  query.type != V4L2_CTRL_TYPE_STRING 
-  (errno == EINVAL || errno == ENOTTY)) {
-   struct v4l2_control old;
-
-   old.id = id;
-   old.value = val;
-   ret = ioctl(dev-fd, VIDIOC_S_CTRL, old);
-   if (ret != -1)
-   val = old.value;
-   }
-   if (ret == -1) {
-   printf(unable to set control 0x%8.8x: %s (%d).\n,
-   id, strerror(errno), errno);
-   return;
-   }
+   if (ret != -1)
+   return 0;
 
-   printf(Control 0x%08x set to % PRId64 , is % PRId64 \n,
-  id, old_val, val);
+   if (query-flags  V4L2_CTRL_FLAG_HAS_PAYLOAD ||
+   query-type == V4L2_CTRL_TYPE_INTEGER64 ||
+   (errno != EINVAL  errno != ENOTTY))
+   return -1;
+
+   old.id = ctrl-id;
+   old.value = ctrl-value;
+   ret = ioctl(dev-fd, VIDIOC_S_CTRL, old);
+   if (ret != -1)
+   ctrl-value = old.value;
+
+   return ret;
 }
 
 static int video_get_format(struct device *dev)
@@ -1148,7 +1128,7 @@ static void video_print_control_value(const struct 
v4l2_query_ext_ctrl *query,
}
 }
 
-static int video_print_control(struct device *dev, unsigned int id, bool full)
+static int video_get_control(struct device *dev, unsigned int id, bool full)
 {
struct v4l2_ext_control ctrl;
struct v4l2_query_ext_ctrl query;
@@ -1211,6 +1191,143 @@ static int video_print_control(struct device *dev, 
unsigned int id, bool full)
return query.id;
 }
 
+static int video_parse_control_array(const struct v4l2_query_ext_ctrl *query,
+struct v4l2_ext_control *ctrl,
+const char *val)
+{
+   unsigned int i;
+   char *endptr;
+   __u32 value;
+
+   for ( ; isspace(*val); ++val) { };
+
+   if (*val++ != '{')
+   return -EINVAL;
+
+   for (i = 0; i  query-elems; ++i) {
+   for ( ; isspace(*val); ++val) { };
+
+   switch (query-type) {
+   case V4L2_CTRL_TYPE_U8:
+   case V4L2_CTRL_TYPE_U16:
+   case V4L2_CTRL_TYPE_U32:
+   default:
+   value = strtoul(val, endptr, 0);
+   break;
+   }
+
+   if (endptr == NULL)
+   return -EINVAL;
+
+   switch (query-type) {
+   case V4L2_CTRL_TYPE_U8:
+   ctrl-p_u8[i] = value;
+   break;
+   case V4L2_CTRL_TYPE_U16:
+   ctrl-p_u16[i] = value;
+   break;
+   case V4L2_CTRL_TYPE_U32:
+   ctrl-p_u32[i] = value;
+   break;
+   }
+
+   val = endptr;
+   for ( ; isspace(*val); ++val) { };
+
+   if (i != query-elems - 1) {
+   if (*val++ != ',')
+   return -EINVAL;
+   for ( ; isspace(*val); ++val) { };
+   }
+   }
+
+   if (*val++ != 

[PATCH 2/3] Implement compound control get support

2014-12-15 Thread Laurent Pinchart
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 yavta.c | 158 +++-
 1 file changed, 116 insertions(+), 42 deletions(-)

diff --git a/yavta.c b/yavta.c
index b9b8bb8..006bab6 100644
--- a/yavta.c
+++ b/yavta.c
@@ -416,12 +416,14 @@ static int query_control(struct device *dev, unsigned int 
id,
query-id = id;
 
ret = ioctl(dev-fd, VIDIOC_QUERY_EXT_CTRL, query);
-   if (ret  0  errno != EINVAL)
+   if (!ret || errno == EINVAL)
+   return ret;
+
+   if (errno != ENOTTY) {
printf(unable to query control 0x%8.8x: %s (%d).\n,
   id, strerror(errno), errno);
-
-   if (!ret || errno != ENOTTY)
return ret;
+   }
 
/*
 * If VIDIOC_QUERY_EXT_CTRL isn't available emulate it using
@@ -456,6 +458,7 @@ static int get_control(struct device *dev,
   struct v4l2_ext_control *ctrl)
 {
struct v4l2_ext_controls ctrls;
+   struct v4l2_control old;
int ret;
 
memset(ctrls, 0, sizeof(ctrls));
@@ -467,34 +470,28 @@ static int get_control(struct device *dev,
 
ctrl-id = query-id;
 
-   if (query-type == V4L2_CTRL_TYPE_STRING) {
-   ctrl-string = malloc(query-maximum + 1);
-   if (ctrl-string == NULL)
+   if (query-flags  V4L2_CTRL_FLAG_HAS_PAYLOAD) {
+   ctrl-size = query-elems * query-elem_size;
+   ctrl-ptr = malloc(ctrl-size);
+   if (ctrl-ptr == NULL)
return -ENOMEM;
-
-   ctrl-size = query-maximum + 1;
}
 
ret = ioctl(dev-fd, VIDIOC_G_EXT_CTRLS, ctrls);
if (ret != -1)
return 0;
 
-   if (query-type != V4L2_CTRL_TYPE_INTEGER64 
-   query-type != V4L2_CTRL_TYPE_STRING 
-   (errno == EINVAL || errno == ENOTTY)) {
-   struct v4l2_control old;
+   if (query-flags  V4L2_CTRL_FLAG_HAS_PAYLOAD ||
+   query-type == V4L2_CTRL_TYPE_INTEGER64 ||
+   (errno != EINVAL  errno != ENOTTY))
+   return -1;
 
-   old.id = query-id;
-   ret = ioctl(dev-fd, VIDIOC_G_CTRL, old);
-   if (ret != -1) {
-   ctrl-value = old.value;
-   return 0;
-   }
-   }
+   old.id = query-id;
+   ret = ioctl(dev-fd, VIDIOC_G_CTRL, old);
+   if (ret != -1)
+   ctrl-value = old.value;
 
-   printf(unable to get control 0x%8.8x: %s (%d).\n,
-   query-id, strerror(errno), errno);
-   return -1;
+   return ret;
 }
 
 static void set_control(struct device *dev, unsigned int id,
@@ -1087,12 +1084,75 @@ static void video_query_menu(struct device *dev,
};
 }
 
+static void video_print_control_array(const struct v4l2_query_ext_ctrl *query,
+ struct v4l2_ext_control *ctrl)
+{
+   unsigned int i;
+
+   printf({);
+
+   for (i = 0; i  query-elems; ++i) {
+   switch (query-type) {
+   case V4L2_CTRL_TYPE_U8:
+   printf(%u, ctrl-p_u8[i]);
+   break;
+   case V4L2_CTRL_TYPE_U16:
+   printf(%u, ctrl-p_u16[i]);
+   break;
+   case V4L2_CTRL_TYPE_U32:
+   printf(%u, ctrl-p_u32[i]);
+   break;
+   }
+
+   if (i != query-elems - 1)
+   printf(, );
+   }
+
+   printf(});
+}
+
+static void video_print_control_value(const struct v4l2_query_ext_ctrl *query,
+ struct v4l2_ext_control *ctrl)
+{
+   if (query-nr_of_dims == 0) {
+   switch (query-type) {
+   case V4L2_CTRL_TYPE_INTEGER:
+   case V4L2_CTRL_TYPE_BOOLEAN:
+   case V4L2_CTRL_TYPE_MENU:
+   case V4L2_CTRL_TYPE_INTEGER_MENU:
+   printf(%d, ctrl-value);
+   break;
+   case V4L2_CTRL_TYPE_BITMASK:
+   printf(0x%08x, ctrl-value);
+   break;
+   case V4L2_CTRL_TYPE_INTEGER64:
+   printf(%lld, ctrl-value64);
+   break;
+   case V4L2_CTRL_TYPE_STRING:
+   printf(%s, ctrl-string);
+   break;
+   }
+
+   return;
+   }
+
+   switch (query-type) {
+   case V4L2_CTRL_TYPE_U8:
+   case V4L2_CTRL_TYPE_U16:
+   case V4L2_CTRL_TYPE_U32:
+   video_print_control_array(query, ctrl);
+   break;
+   default:
+   printf(unsupported);
+   break;
+   }
+}
+
 static int video_print_control(struct device *dev, unsigned int id, bool full)
 {
struct v4l2_ext_control ctrl;
struct 

[PATCH 1/3] Implement VIDIOC_QUERY_EXT_CTRL support

2014-12-15 Thread Laurent Pinchart
Use the new extended control query ioctl when available with an
automatic fall back to VIDIOC_QUERYCTRL.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 yavta.c | 47 +++
 1 file changed, 39 insertions(+), 8 deletions(-)

diff --git a/yavta.c b/yavta.c
index 8e8ec19..b9b8bb8 100644
--- a/yavta.c
+++ b/yavta.c
@@ -407,22 +407,52 @@ static void video_log_status(struct device *dev)
 }
 
 static int query_control(struct device *dev, unsigned int id,
-struct v4l2_queryctrl *query)
+struct v4l2_query_ext_ctrl *query)
 {
+   struct v4l2_queryctrl q;
int ret;
 
memset(query, 0, sizeof(*query));
query-id = id;
 
-   ret = ioctl(dev-fd, VIDIOC_QUERYCTRL, query);
+   ret = ioctl(dev-fd, VIDIOC_QUERY_EXT_CTRL, query);
if (ret  0  errno != EINVAL)
printf(unable to query control 0x%8.8x: %s (%d).\n,
   id, strerror(errno), errno);
 
-   return ret;
+   if (!ret || errno != ENOTTY)
+   return ret;
+
+   /*
+* If VIDIOC_QUERY_EXT_CTRL isn't available emulate it using
+* VIDIOC_QUERYCTRL.
+*/
+   memset(q, 0, sizeof(q));
+   q.id = id;
+
+   ret = ioctl(dev-fd, VIDIOC_QUERYCTRL, q);
+   if (ret  0) {
+   if (errno != EINVAL)
+   printf(unable to query control 0x%8.8x: %s (%d).\n,
+  id, strerror(errno), errno);
+   return ret;
+   }
+
+   memset(query, 0, sizeof(*query));
+   query-id = q.id;
+   query-type = q.type;
+   memcpy(query-name, q.name, sizeof(query-name));
+   query-minimum = q.minimum;
+   query-maximum = q.maximum;
+   query-step = q.step;
+   query-default_value = q.default_value;
+   query-flags = q.flags;
+
+   return 0;
 }
 
-static int get_control(struct device *dev, const struct v4l2_queryctrl *query,
+static int get_control(struct device *dev,
+  const struct v4l2_query_ext_ctrl *query,
   struct v4l2_ext_control *ctrl)
 {
struct v4l2_ext_controls ctrls;
@@ -472,7 +502,7 @@ static void set_control(struct device *dev, unsigned int id,
 {
struct v4l2_ext_controls ctrls;
struct v4l2_ext_control ctrl;
-   struct v4l2_queryctrl query;
+   struct v4l2_query_ext_ctrl query;
int64_t old_val = val;
int is_64;
int ret;
@@ -1034,7 +1064,8 @@ static int video_enable(struct device *dev, int enable)
return 0;
 }
 
-static void video_query_menu(struct device *dev, struct v4l2_queryctrl *query,
+static void video_query_menu(struct device *dev,
+struct v4l2_query_ext_ctrl *query,
 unsigned int value)
 {
struct v4l2_querymenu menu;
@@ -1059,7 +1090,7 @@ static void video_query_menu(struct device *dev, struct 
v4l2_queryctrl *query,
 static int video_print_control(struct device *dev, unsigned int id, bool full)
 {
struct v4l2_ext_control ctrl;
-   struct v4l2_queryctrl query;
+   struct v4l2_query_ext_ctrl query;
char sval[24];
char *current = sval;
int ret;
@@ -1087,7 +1118,7 @@ static int video_print_control(struct device *dev, 
unsigned int id, bool full)
sprintf(sval, %d, ctrl.value);
 
if (full)
-   printf(control 0x%08x `%s' min %d max %d step %d default %d 
current %s.\n,
+   printf(control 0x%08x `%s' min %lld max %lld step %lld default 
%lld current %s.\n,
query.id, query.name, query.minimum, query.maximum,
query.step, query.default_value, current);
else
-- 
2.0.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 1/2] qv4l2: enable qt5 opengl build

2014-12-15 Thread Peter Seiderer
Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 configure.ac  | 12 ++--
 utils/qv4l2/qv4l2.pro |  7 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 588dd9e..dce2848 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,8 +143,16 @@ if test x$qt_pkgconfig = xtrue; then
AC_SUBST(MOC)
AC_SUBST(UIC)
AC_SUBST(RCC)
-# disable QTGL for qt5 because qv4l2 crash
-   qt_pkgconfig_gl=false
+   PKG_CHECK_MODULES(QT5GL, [Qt5OpenGL = 5.0 gl], [qt_pkgconfig_gl=true], 
[qt_pkgconfig_gl=false])
+   if test x$qt_pkgconfig_gl = xtrue; then
+  QTGL_CFLAGS=$QT5GL_CFLAGS -fPIC
+  QTGL_LIBS=$QT5GL_LIBS
+  AC_SUBST(QT_CFLAGS)
+  AC_SUBST(QT_LIBS)
+  AC_DEFINE([HAVE_QTGL], [1], [qt has opengl support])
+   else
+  AC_MSG_WARN(Qt5 OpenGL is not available)
+fi
 else
PKG_CHECK_MODULES(QT, [QtCore = 4.0 QtGui = 4.0], [qt_pkgconfig=true], 
[qt_pkgconfig=false])
if test x$qt_pkgconfig = xtrue; then
diff --git a/utils/qv4l2/qv4l2.pro b/utils/qv4l2/qv4l2.pro
index 82500af..a2106d0 100644
--- a/utils/qv4l2/qv4l2.pro
+++ b/utils/qv4l2/qv4l2.pro
@@ -8,12 +8,9 @@ CONFIG += debug
 
 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
 
-#
-# qt5: opengl support for disabled (will crash on startup)
-#
-# qt4: to disable opengl suppport comment out the following
+# opengl: to disable opengl suppport comment out the following
 # line and the line '#define HAVE_QTGL 1' from ../../config.h
-lessThan(QT_MAJOR_VERSION, 5): QT += opengl
+QT += opengl
 
 INCLUDEPATH += $$PWD/../..
 INCLUDEPATH += $$PWD/../v4l2-ctl/
-- 
2.1.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 2/2] qv4l2: fix qt5 opengl runtime errors

2014-12-15 Thread Peter Seiderer
Fix the following two runtime errors with qt-5.3.2:

- QOpenGLFunctions created with non-current context
  Program received signal SIGSEGV, Segmentation fault.
 #0  0x762819f0 in QOpenGLContext::shareGroup() const () at 
/usr/lib64/libQt5Gui.so.5
 #1  0x764ff470 in  () at /usr/lib64/libQt5Gui.so.5
 #2  0x764ff64b in QOpenGLFunctions::initializeOpenGLFunctions() ()
 at /usr/lib64/libQt5Gui.so.5
 #3  0x770c2e29 in  () at /usr/lib64/libQt5OpenGL.so.5
 #4  0x770c2f7c in QGLFunctions::initializeGLFunctions(QGLContext 
const*) ()
 at /usr/lib64/libQt5OpenGL.so.5
 #5  0x0040fab7 in CaptureWinGLEngine::CaptureWinGLEngine() 
(this=0x7494f0)
 at ../qv4l2/capture-win-gl.cpp:149
 #6  0x0040f562 in CaptureWinGL::CaptureWinGL(ApplicationWindow*) 
(this=0x749420, aw=
 0x8bbda0) at ../qv4l2/capture-win-gl.cpp:28
 #7  0x0043c005 in ApplicationWindow::newCaptureWin() (this=0x8bbda0)
 at ../qv4l2/qv4l2.cpp:443
 #8  0x0043ab8e in ApplicationWindow::setDevice(QString const, bool) 
(this=0x8bbda0, device=..., rawOpen=false) at ../qv4l2/qv4l2.cpp:257
 #9  0x00444724 in main(int, char**) (argc=1, argv=0x7fffdcd8)
 at ../qv4l2/qv4l2.cpp:1774

   Solution: call QGLFunctions::initializeGLFunctions() later (in
   CaptureWinGLEngine::initializeGL()).

- Program received signal SIGSEGV, Segmentation fault.
 #0  0x770c8cc0 in QGLShaderProgram::release() () at 
/usr/lib64/libQt5OpenGL.so.5
 #1  0x0040fe0f in CaptureWinGLEngine::clearShader() (this=0x6f0ae0)
 at ../qv4l2/capture-win-gl.cpp:241
 #2  0x0041016b in CaptureWinGLEngine::changeShader() (this=0x6f0ae0)
 at ../qv4l2/capture-win-gl.cpp:353
 #3  0x004105db in CaptureWinGLEngine::paintGL() (this=0x6f0ae0)
 at ../qv4l2/capture-win-gl.cpp:438
 #4  0x770bc2f4 in QGLWidget::glDraw() () at 
/usr/lib64/libQt5OpenGL.so.5
 #5  0x770b9229 in QGLWidget::paintEvent(QPaintEvent*) ()
 at /usr/lib64/libQt5OpenGL.so.5
 #6  0x769ec112 in QWidget::event(QEvent*) () at 
/usr/lib64/libQt5Widgets.so.5
 #7  0x769b0cfc in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #8  0x769b5c36 in QApplication::notify(QObject*, QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #9  0x75d0fb35 in QCoreApplication::notifyInternal(QObject*, QEvent*) 
()
 at /usr/lib64/libQt5Core.so.5
 #10 0x769e6b25 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion 
const, QPoint const, int, QPainter*, QWidgetBackingStore*) () at 
/usr/lib64/libQt5Widgets.so.5
 #11 0x769bd3a1 in QWidgetPrivate::repaint_sys(QRegion const) ()
 at /usr/lib64/libQt5Widgets.so.5
 #12 0x76a0b873 in  () at /usr/lib64/libQt5Widgets.so.5
 #13 0x769b0cfc in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #14 0x769b5c36 in QApplication::notify(QObject*, QEvent*) ()
 at /usr/lib64/libQt5Widgets.so.5
 #15 0x75d0fb35 in QCoreApplication::notifyInternal(QObject*, QEvent*) 
()
 at /usr/lib64/libQt5Core.so.5
 #16 0x76244fe6 in 
QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*)
 () at /usr/lib64/libQt5Gui.so.5
 #17 0x76245b45 in 
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
 () at /usr/lib64/libQt5Gui.so.5
 #18 0x7622c5a8 in 
QWindowSystemInterface::sendWindowSystemEvents(QFlagsQEventLoop::ProcessEventsFlag)
 () at /usr/lib64/libQt5Gui.so.5
 #19 0x7fffeeb75f30 in  () at /usr/lib64/qt5/plugins/platforms/libqxcb.so
 #20 0x742b1a04 in g_main_context_dispatch () at 
/usr/lib64/libglib-2.0.so.0
 #21 0x742b1c48 in  () at /usr/lib64/libglib-2.0.so.0
 #22 0x742b1cec in g_main_context_iteration () at 
/usr/lib64/libglib-2.0.so.0
 #23 0x75d6689c in 
QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) () 
at /usr/lib64/libQt5Core.so.5
 #24 0x75d0da4b in 
QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) ()
 at /usr/lib64/libQt5Core.so.5
 #25 0x75d150a6 in QCoreApplication::exec() () at 
/usr/lib64/libQt5Core.so.5
 #26 0x0044476d in main(int, char**) (argc=1, argv=0x7fffdcd8)
 at ../qv4l2/qv4l2.cpp:1777

  Solution: call QGLShaderProgram::release() only in case shader program
   is previously linked.

Signed-off-by: Peter Seiderer ps.rep...@gmx.net
---
 utils/qv4l2/capture-win-gl.cpp | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp
index f229866..5122d09 100644
--- a/utils/qv4l2/capture-win-gl.cpp
+++ b/utils/qv4l2/capture-win-gl.cpp
@@ -146,7 +146,7 @@ CaptureWinGLEngine::CaptureWinGLEngine() :
m_mag_filter(GL_NEAREST),
m_min_filter(GL_NEAREST)
 {
-   

[PATCH 0/3] Various fixes for s5p-mfc driver

2014-12-15 Thread Nicolas Dufresne
This patchset fixes ability to drain the decoder due to use of wrong
enumeration name and fixes implementation of display delay controls
for MFC firmware v6 and higher.

Note that there is no need in the display delay fix for trying to be
backward compatible with what the comment was saying since the control
properties was preventing it. There was basically no way other then
setting a large delay value to get the frames in display order.

Nicolas Dufresne (3):
  s5p-mfc-v6+: Use display_delay_enable CID
  s5p-mfc-dec: Don't use encoder stop command
  media-doc: Fix MFC display delay control doc

 Documentation/DocBook/media/v4l/controls.xml| 11 +--
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|  2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |  6 +-
 3 files changed, 7 insertions(+), 12 deletions(-)

-- 
2.1.0

--
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/3] s5p-mfc-dec: Don't use encoder stop command

2014-12-15 Thread Nicolas Dufresne
The decoder should handle V4L2_DEC_CMD_STOP to trigger drain,
but it currently expecting V4L2_ENC_CMD_STOP.

Signed-off-by: Nicolas Dufresne nicolas.dufre...@collabora.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 99e2e84..98304fc 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -816,7 +816,7 @@ static int vidioc_decoder_cmd(struct file *file, void *priv,
unsigned long flags;
 
switch (cmd-cmd) {
-   case V4L2_ENC_CMD_STOP:
+   case V4L2_DEC_CMD_STOP:
if (cmd-flags != 0)
return -EINVAL;
 
-- 
2.1.0

--
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/3] s5p-mfc-v6+: Use display_delay_enable CID

2014-12-15 Thread Nicolas Dufresne
The MFC driver has two controls, DISPLAY_DELAY and DISPLAY_DELAY_ENABLE
that allow forcing the decoder to return a decoded frame sooner
regardless of the order. The added support for firmware version 6 and
higher was not taking into account the DISPLAY_DELAY_ENABLE boolean.
Instead it had a comment stating that DISPLAY_DELAY should be set to a
negative value to disable it. This is not possible since the control
range is from 0 to 65535. This feature was also supposed to be disabled
by default in order to produce frames in display order.

Signed-off-by: Nicolas Dufresne nicolas.dufre...@collabora.com
---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 92032a0..0675515 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -1340,11 +1340,7 @@ static int s5p_mfc_init_decode_v6(struct s5p_mfc_ctx 
*ctx)
/* FMO_ASO_CTRL - 0: Enable, 1: Disable */
reg |= (fmo_aso_ctrl  S5P_FIMV_D_OPT_FMO_ASO_CTRL_MASK_V6);
 
-   /* When user sets desplay_delay to 0,
-* It works as display_delay enable and delay set to 0.
-* If user wants display_delay disable, It should be
-* set to negative value. */
-   if (ctx-display_delay = 0) {
+   if (ctx-display_delay_enable) {
reg |= (0x1  S5P_FIMV_D_OPT_DDELAY_EN_SHIFT_V6);
writel(ctx-display_delay, mfc_regs-d_display_delay);
}
-- 
2.1.0

--
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/3] media-doc: Fix MFC display delay control doc

2014-12-15 Thread Nicolas Dufresne
The V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE control
is a boolean but was documented as a integer. The documentation was
also slightly miss-leading.

Signed-off-by: Nicolas Dufresne nicolas.dufre...@collabora.com
---
 Documentation/DocBook/media/v4l/controls.xml | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index e013e4b..4e9462f 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -2692,12 +2692,11 @@ in the S5P family of SoCs by Samsung.
  rowentry/entry/row
  row
entry 
spanname=idconstantV4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE/constantnbsp;/entry
-   entryinteger/entry
- /rowrowentry spanname=descrIf the display delay is 
enabled then the decoder has to return a
-CAPTURE buffer after processing a certain number of OUTPUT buffers. If this 
number is low, then it may result in
-buffers not being dequeued in display order. In addition hardware may still 
use those buffers as reference, thus
-application should not write to those buffers. This feature can be used for 
example for generating thumbnails of videos.
-Applicable to the H264 decoder.
+   entryboolean/entry
+ /rowrowentry spanname=descrIf the display delay is 
enabled then the decoder is forced to return a
+CAPTURE buffer (decoded frame) after processing a certain number of OUTPUT 
buffers. The delay can be set through
+constantV4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY/constant. 
This feature can be used for example
+for generating thumbnails of videos. Applicable to the H264 decoder.
  /entry
  /row
  rowentry/entry/row
-- 
2.1.0

--
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] video support for Samsung SUR40

2014-12-15 Thread Florian Echtler
Hello Hans,

On 15.12.2014 17:01, Hans Verkuil wrote:
 On 12/15/2014 04:47 PM, Florian Echtler wrote:
 However, I'm running into an issue I have a hard time understanding. In
 particular, as soon as I load the kernel module, I'm getting a kernel
 oops (NULL pointer dereference) in line 354 or 355 of the attached
 source code. The reason is probably that the previous check (in line
 350) doesn't abort - even though I didn't actually provide a buffer, so
 the list_head should be empty. As no user space program has actually
 opened the video device yet, there shouldn't be any buffers queued,
 right? (AFAICT the list is initialized properly in line 490).
 I'd be quite grateful if somebody with more experience can look over the
 code and tell me what mistakes I made :-)
First of all, thanks for the quick feedback.

 Why on earth is sur40_poll doing anything with video buffers? That's
 all handled by vb2. As far as I can tell you can just delete everything
 from '// deal with video data here' until the end of the poll function.
Right now, the code doesn't do anything, but I'm planning to add the
actual data retrieval at this point later. I'd like to use the
input_polldev thread for this, as a) the video data should be fetched
synchronously with the input device data and b) the thread will be
running continuously anyway.

 The probably cause of the crash here is that the input device node is
 created before the 'INIT_LIST_HEAD(sur40-buf_list);' call, and since
 udevd (I think) opens new devices immediately after they are created
 it is likely that sur40_poll is called before buf_list is initialized.
OK, that sounds plausible, will test that tomorrow.

 But, as I said, that code doesn't belong there at all, so just remove it.
See above - that was actually intentional. It's kind of a hackish
solution, but for the moment, I'd just like to get a video stream with
minimal overhead, so I'm reusing the polldev thread.

Best regards, Florian
-- 
SENT FROM MY DEC VT50 TERMINAL



signature.asc
Description: OpenPGP digital signature


Re: [RFC] video support for Samsung SUR40

2014-12-15 Thread Hans Verkuil
On 12/15/2014 11:15 PM, Florian Echtler wrote:
 Hello Hans,
 
 On 15.12.2014 17:01, Hans Verkuil wrote:
 On 12/15/2014 04:47 PM, Florian Echtler wrote:
 However, I'm running into an issue I have a hard time understanding. In
 particular, as soon as I load the kernel module, I'm getting a kernel
 oops (NULL pointer dereference) in line 354 or 355 of the attached
 source code. The reason is probably that the previous check (in line
 350) doesn't abort - even though I didn't actually provide a buffer, so
 the list_head should be empty. As no user space program has actually
 opened the video device yet, there shouldn't be any buffers queued,
 right? (AFAICT the list is initialized properly in line 490).
 I'd be quite grateful if somebody with more experience can look over the
 code and tell me what mistakes I made :-)
 First of all, thanks for the quick feedback.
 
 Why on earth is sur40_poll doing anything with video buffers? That's
 all handled by vb2. As far as I can tell you can just delete everything
 from '// deal with video data here' until the end of the poll function.
 Right now, the code doesn't do anything, but I'm planning to add the
 actual data retrieval at this point later. I'd like to use the
 input_polldev thread for this, as a) the video data should be fetched
 synchronously with the input device data and b) the thread will be
 running continuously anyway.

Ah, now I see it.

 
 The probably cause of the crash here is that the input device node is
 created before the 'INIT_LIST_HEAD(sur40-buf_list);' call, and since
 udevd (I think) opens new devices immediately after they are created
 it is likely that sur40_poll is called before buf_list is initialized.
 OK, that sounds plausible, will test that tomorrow.
 
 But, as I said, that code doesn't belong there at all, so just remove it.
 See above - that was actually intentional. It's kind of a hackish
 solution, but for the moment, I'd just like to get a video stream with
 minimal overhead, so I'm reusing the polldev thread.

OK. If you are planning to upstream this driver, then this probably needs
another look.

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


Fwd: Instalation issue on S960

2014-12-15 Thread Carlos Diogo
Dear support team ,
i have spent 4 days trying to get my S960 setup in my raspberrry Pi

I have tried multiple options and using the linuxtv.org drivers the
power light switches on but then i get the below message



[8.561909] usb 1-1.5: dvb_usb_v2: found a 'DVBSky S960/S860' in warm state
[8.576865] usb 1-1.5: dvb_usb_v2: will pass the complete MPEG2
transport stream to the software demuxer
[8.591803] DVB: registering new adapter (DVBSky S960/S860)
[8.603974] usb 1-1.5: dvb_usb_v2: MAC address: 00:18:42:54:96:0c
[8.650257] DVB: Unable to find symbol m88ds3103_attach()
[8.661452] usb 1-1.5: dvbsky_s960_attach fail.
[8.683560] usbcore: registered new interface driver dvb_usb_dvbsky

I have tried googling it but i have found nothing about this

i'm using raspbian , with kernel 3.12.34

Any help here?

Thanks in advance
Carlos


-- 
Os meus cumprimentos / Best regards /  Mit freundlichen Grüße
Carlos Diogo
--
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] mn88472: implement lock for all delivery systems

2014-12-15 Thread Benjamin Larsson
Signed-off-by: Benjamin Larsson benja...@southpole.se
---
 drivers/staging/media/mn88472/mn88472.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/mn88472/mn88472.c 
b/drivers/staging/media/mn88472/mn88472.c
index 68f5036..426f0ed 100644
--- a/drivers/staging/media/mn88472/mn88472.c
+++ b/drivers/staging/media/mn88472/mn88472.c
@@ -238,6 +238,7 @@ static int mn88472_read_status(struct dvb_frontend *fe, 
fe_status_t *status)
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret;
unsigned int utmp;
+   int lock = 0;
 
*status = 0;
 
@@ -248,21 +249,37 @@ static int mn88472_read_status(struct dvb_frontend *fe, 
fe_status_t *status)
 
switch (c-delivery_system) {
case SYS_DVBT:
+   ret = regmap_read(dev-regmap[0], 0x7F, utmp);
+   if (ret)
+   goto err;
+   if ((utmp0xF)  8)
+   lock = 1;
+   break;
case SYS_DVBT2:
-   /* FIXME: implement me */
-   utmp = 0x08; /* DVB-C lock value */
+   msleep(150);
+   ret = regmap_read(dev-regmap[2], 0x92, utmp);
+   if (ret)
+   goto err;
+   if ((utmp0xF) = 0x07)
+   *status |= FE_HAS_SIGNAL;
+   if ((utmp0xF) = 0x0a)
+   *status |= FE_HAS_CARRIER;
+   if ((utmp0xF) = 0x0d)
+   *status |= FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
break;
case SYS_DVBC_ANNEX_A:
ret = regmap_read(dev-regmap[1], 0x84, utmp);
if (ret)
goto err;
+   if ((utmp0xF)  7)
+   lock = 1;
break;
default:
ret = -EINVAL;
goto err;
}
 
-   if (utmp == 0x08)
+   if (lock)
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI |
FE_HAS_SYNC | FE_HAS_LOCK;
 
-- 
1.9.1

--
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: Instalation issue on S960

2014-12-15 Thread Mark Clarkstone
Hi,

I was recently trying to build drivers for another tuner on a Pi and
also came across a similar problem [unable to find symbols], it turns
out that the Raspberry Pi kernel doesn't have I2C_MUX enabled which is
needed by some modules.

You could try rebuilding the kernel with the above option enabled and
see if that helps.

Although I could be totally wrong and hopefully someone with more
knowledge will know (I'm still pretty much a Linux noob :p).

Hope this helps.

On 15 December 2014 at 23:13, Carlos Diogo cdi...@gmail.com wrote:
 Dear support team ,
 i have spent 4 days trying to get my S960 setup in my raspberrry Pi

 I have tried multiple options and using the linuxtv.org drivers the
 power light switches on but then i get the below message



 [8.561909] usb 1-1.5: dvb_usb_v2: found a 'DVBSky S960/S860' in warm state
 [8.576865] usb 1-1.5: dvb_usb_v2: will pass the complete MPEG2
 transport stream to the software demuxer
 [8.591803] DVB: registering new adapter (DVBSky S960/S860)
 [8.603974] usb 1-1.5: dvb_usb_v2: MAC address: 00:18:42:54:96:0c
 [8.650257] DVB: Unable to find symbol m88ds3103_attach()
 [8.661452] usb 1-1.5: dvbsky_s960_attach fail.
 [8.683560] usbcore: registered new interface driver dvb_usb_dvbsky

 I have tried googling it but i have found nothing about this

 i'm using raspbian , with kernel 3.12.34

 Any help here?

 Thanks in advance
 Carlos


 --
 Os meus cumprimentos / Best regards /  Mit freundlichen Grüße
 Carlos Diogo
 --
 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
--
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: Kedves: Webmail Elofizeto

2014-12-15 Thread Maria Kovalska
 



From: Maria Kovalska
Sent: Tue 12/16/2014 2:01
Subject: Kedves: Webmail Elofizeto


Kedves: Webmail Elofizeto

Felhívjuk figyelmét, hogy az e-mail fiók meghaladta
tárolókapacitás. Ön nem tud küldeni és fogadni e-maileket és a
e-mail fiókja törlésre kerül a szerverünkrol. A probléma elkerülése
érdekében,
   Kattintson ide
https://dean7.jfmed.uniba.sk/exchweb/bin/redir.asp?URL=https://formcraf
ts.com/a/7589   frissítse a számla.


Köszönöm.

Management Team. 
--
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] mn88472: implement lock for all delivery systems

2014-12-15 Thread Antti Palosaari

Moikka!

On 12/16/2014 01:40 AM, Benjamin Larsson wrote:

Signed-off-by: Benjamin Larsson benja...@southpole.se
---
  drivers/staging/media/mn88472/mn88472.c | 23 ---
  1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/mn88472/mn88472.c 
b/drivers/staging/media/mn88472/mn88472.c
index 68f5036..426f0ed 100644
--- a/drivers/staging/media/mn88472/mn88472.c
+++ b/drivers/staging/media/mn88472/mn88472.c
@@ -238,6 +238,7 @@ static int mn88472_read_status(struct dvb_frontend *fe, 
fe_status_t *status)
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret;
unsigned int utmp;
+   int lock = 0;

*status = 0;

@@ -248,21 +249,37 @@ static int mn88472_read_status(struct dvb_frontend *fe, 
fe_status_t *status)

switch (c-delivery_system) {
case SYS_DVBT:
+   ret = regmap_read(dev-regmap[0], 0x7F, utmp);
+   if (ret)
+   goto err;
+   if ((utmp0xF)  8)


You didn't read Kernel coding style doc?

around line 206 Documentation/CodingStyle
---
Use one space around (on each side of) most binary and ternary operators,
such as any of these:

=  +  -  *  /  %  |^  =  =  ==  !=  ?  :
---


+   lock = 1;
+   break;
case SYS_DVBT2:
-   /* FIXME: implement me */
-   utmp = 0x08; /* DVB-C lock value */
+   msleep(150);


This sleep does not look correct. Why it is here? In order to provide 
more time for lock waiting? In that case you must increase 
.get_tune_settings() timeout. On some other case you will need to add 
comment why such strange thing is needed.



+   ret = regmap_read(dev-regmap[2], 0x92, utmp);
+   if (ret)
+   goto err;
+   if ((utmp0xF) = 0x07)
+   *status |= FE_HAS_SIGNAL;
+   if ((utmp0xF) = 0x0a)
+   *status |= FE_HAS_CARRIER;
+   if ((utmp0xF) = 0x0d)
+   *status |= FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
break;
case SYS_DVBC_ANNEX_A:
ret = regmap_read(dev-regmap[1], 0x84, utmp);
if (ret)
goto err;
+   if ((utmp0xF)  7)
+   lock = 1;
break;
default:
ret = -EINVAL;
goto err;
}

-   if (utmp == 0x08)
+   if (lock)
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI |
FE_HAS_SYNC | FE_HAS_LOCK;


Antti

--
http://palosaari.fi/
--
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: Instalation issue on S960

2014-12-15 Thread Antti Palosaari

On 12/16/2014 02:09 AM, Mark Clarkstone wrote:

Hi,

I was recently trying to build drivers for another tuner on a Pi and
also came across a similar problem [unable to find symbols], it turns
out that the Raspberry Pi kernel doesn't have I2C_MUX enabled which is
needed by some modules.


That's likely the reason as I2C mux is needed by m88ds3103 driver.

Antti


You could try rebuilding the kernel with the above option enabled and
see if that helps.

Although I could be totally wrong and hopefully someone with more
knowledge will know (I'm still pretty much a Linux noob :p).

Hope this helps.

On 15 December 2014 at 23:13, Carlos Diogo cdi...@gmail.com wrote:

Dear support team ,
i have spent 4 days trying to get my S960 setup in my raspberrry Pi

I have tried multiple options and using the linuxtv.org drivers the
power light switches on but then i get the below message



[8.561909] usb 1-1.5: dvb_usb_v2: found a 'DVBSky S960/S860' in warm state
[8.576865] usb 1-1.5: dvb_usb_v2: will pass the complete MPEG2
transport stream to the software demuxer
[8.591803] DVB: registering new adapter (DVBSky S960/S860)
[8.603974] usb 1-1.5: dvb_usb_v2: MAC address: 00:18:42:54:96:0c
[8.650257] DVB: Unable to find symbol m88ds3103_attach()
[8.661452] usb 1-1.5: dvbsky_s960_attach fail.
[8.683560] usbcore: registered new interface driver dvb_usb_dvbsky

I have tried googling it but i have found nothing about this

i'm using raspbian , with kernel 3.12.34

Any help here?

Thanks in advance
Carlos


--
Os meus cumprimentos / Best regards /  Mit freundlichen Grüße
Carlos Diogo
--
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

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



--
http://palosaari.fi/
--
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: ERRORS

2014-12-15 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:   Tue Dec 16 04:00:25 CET 2014
git branch: test
git hash:   e272d95f8c0544cff55c485a10828b063c8e417c
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-41-g6c2d743
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.17-3.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
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.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.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17-i686: OK
linux-3.18-i686: OK
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.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-x86_64: OK
apps: ERRORS
spec-git: OK
sparse: ERRORS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.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


Re: [PATCH 1/6] Use LUT based implementation for (co)sine functions

2014-12-15 Thread Prashant Laddha (prladdha)
Antti, Mauro,

Thanks for your comments.

On 15/12/14 7:00 pm, Antti Palosaari cr...@iki.fi wrote:


On 12/15/2014 03:13 PM, Mauro Carvalho Chehab wrote:
 Em Mon, 15 Dec 2014 14:49:17 +0530
 Prashant Laddha prlad...@cisco.com escreveu:

 Replaced Taylor series calculation for (co)sine with a
 look up table (LUT) for sine values.

 Kernel has already a LUT for sin/cos at:
  include/linux/fixp-arith.h

 The best would be to either use it or improve its precision, if the one
there
 is not good enough.

Thanks. I had not looked at this file earlier. But now when I looked at
this file I agree with Antti¹s comments below.



I looked that one when made generator. It has poor precision and it uses
degrees not radians.

 
Also, it does not support calculation for phase values falling in middle
of two entries of LUT.


But surely it is correct practice improve existing
than introduce new.

I agree. Probably we can start looking into how to improve existing. I
looked at dependancies. As of now functions in fixp-arith is used by two
other files. Replacing current implementation in fixp-arith.h with high
precision will not work as it is, because caller functions are using
lesser precision. We probably need to discuss more on how to improve
existing implementation.

Some thoughts -
1. Going by the name fixp-arith.h, I feel, it should have larger scope
than just (co)sine implementation. It can include divide as well. One
could also consider option to keep all trignometric functions in another
file
2. One could support APIs to provide output with different precisions, say
16, 32, 64 bits etc. Not sure how final implementation would be but one
option would be to do internal computation with highest
precision possible and then truncate the result to have desired precision
based on the API called.


Regards,
Prashant