[git:v4l-utils/master] v4l-utils: sync to latest kernel headers

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l-utils: sync to latest kernel headers
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 10:05:23 2014 +0100

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

 contrib/freebsd/include/linux/v4l2-common.h   |8 +
 contrib/freebsd/include/linux/v4l2-controls.h |   18 ++-
 contrib/freebsd/include/linux/videodev2.h |   12 ++-
 contrib/test/gen_ioctl_list.pl|1 +
 contrib/test/ioctl-test.h |9 +-
 contrib/test/ioctl_32.h   |2 +
 contrib/test/ioctl_64.h   |2 +
 include/linux/v4l2-common.h   |8 +
 include/linux/v4l2-controls.h |   18 ++-
 include/linux/v4l2-subdev.h   |   14 +--
 include/linux/videodev2.h |   12 ++-
 utils/keytable/rc_maps.cfg|  170 
 utils/v4l2-compliance/v4l2-test-formats.cpp   |6 +-
 13 files changed, 162 insertions(+), 118 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=f7c41cf52e7590e5945de9b74ccf8e77575950e1

diff --git a/contrib/freebsd/include/linux/v4l2-common.h 
b/contrib/freebsd/include/linux/v4l2-common.h
index 4f0667e..270db89 100644
--- a/contrib/freebsd/include/linux/v4l2-common.h
+++ b/contrib/freebsd/include/linux/v4l2-common.h
@@ -68,4 +68,12 @@
 #define V4L2_SUBDEV_SEL_FLAG_SIZE_LE   V4L2_SEL_FLAG_LE
 #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG
 
+struct v4l2_edid {
+   __u32 pad;
+   __u32 start_block;
+   __u32 blocks;
+   __u32 reserved[5];
+   __u8 __user *edid;
+};
+
 #endif /* __V4L2_COMMON__ */
diff --git a/contrib/freebsd/include/linux/v4l2-controls.h 
b/contrib/freebsd/include/linux/v4l2-controls.h
index e97101c..2ac5597 100644
--- a/contrib/freebsd/include/linux/v4l2-controls.h
+++ b/contrib/freebsd/include/linux/v4l2-controls.h
@@ -815,6 +815,9 @@ enum v4l2_flash_strobe_source {
 #define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1  3)
 #define V4L2_FLASH_FAULT_OVER_CURRENT  (1  4)
 #define V4L2_FLASH_FAULT_INDICATOR (1  5)
+#define V4L2_FLASH_FAULT_UNDER_VOLTAGE (1  6)
+#define V4L2_FLASH_FAULT_INPUT_VOLTAGE (1  7)
+#define V4L2_FLASH_FAULT_LED_OVER_TEMPERATURE  (1  8)
 
 #define V4L2_CID_FLASH_CHARGE  (V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY   (V4L2_CID_FLASH_CLASS_BASE + 12)
@@ -901,11 +904,14 @@ enum v4l2_deemphasis {
 #define V4L2_CID_RF_TUNER_CLASS_BASE   (V4L2_CTRL_CLASS_RF_TUNER | 
0x900)
 #define V4L2_CID_RF_TUNER_CLASS
(V4L2_CTRL_CLASS_RF_TUNER | 1)
 
-#define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO
(V4L2_CID_RF_TUNER_CLASS_BASE + 1)
-#define V4L2_CID_RF_TUNER_LNA_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 
2)
-#define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO  (V4L2_CID_RF_TUNER_CLASS_BASE + 
3)
-#define V4L2_CID_RF_TUNER_MIXER_GAIN   (V4L2_CID_RF_TUNER_CLASS_BASE + 
4)
-#define V4L2_CID_RF_TUNER_IF_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 
5)
-#define V4L2_CID_RF_TUNER_IF_GAIN  (V4L2_CID_RF_TUNER_CLASS_BASE + 
6)
+#define V4L2_CID_RF_TUNER_BANDWIDTH_AUTO   (V4L2_CID_RF_TUNER_CLASS_BASE + 
11)
+#define V4L2_CID_RF_TUNER_BANDWIDTH(V4L2_CID_RF_TUNER_CLASS_BASE + 
12)
+#define V4L2_CID_RF_TUNER_LNA_GAIN_AUTO
(V4L2_CID_RF_TUNER_CLASS_BASE + 41)
+#define V4L2_CID_RF_TUNER_LNA_GAIN (V4L2_CID_RF_TUNER_CLASS_BASE + 
42)
+#define V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO  (V4L2_CID_RF_TUNER_CLASS_BASE + 
51)
+#define V4L2_CID_RF_TUNER_MIXER_GAIN   (V4L2_CID_RF_TUNER_CLASS_BASE + 
52)
+#define V4L2_CID_RF_TUNER_IF_GAIN_AUTO (V4L2_CID_RF_TUNER_CLASS_BASE + 
61)
+#define V4L2_CID_RF_TUNER_IF_GAIN  (V4L2_CID_RF_TUNER_CLASS_BASE + 
62)
+#define V4L2_CID_RF_TUNER_PLL_LOCK 
(V4L2_CID_RF_TUNER_CLASS_BASE + 91)
 
 #endif
diff --git a/contrib/freebsd/include/linux/videodev2.h 
b/contrib/freebsd/include/linux/videodev2.h
index 5eb1c58..7f1d242 100644
--- a/contrib/freebsd/include/linux/videodev2.h
+++ b/contrib/freebsd/include/linux/videodev2.h
@@ -470,6 +470,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SE401  v4l2_fourcc('S', '4', '0', '1') /* se401 
janggu compressed rgb */
 #define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 
interleaved UYVY/JPEG */
 
+/* SDR formats - used only for Software Defined Radio devices */
+#define V4L2_SDR_FMT_CU8  v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
+#define V4L2_SDR_FMT_CU16LE   v4l2_fourcc('C', 'U', '1', '6') /* IQ u16le 
*/
+
 /*
  * F O R M A T   E N U M E R A T I O N
  */
@@ -1744,10 +1748,10 @@ struct v4l2_pix_format_mplane {
 } __attribute__ ((packed));
 
 /**
- * struct v4l2_format_sdr - 

[git:v4l-utils/master] v4l2-ctl: add EDID get and set options

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-ctl: add EDID get and set options
Author:  Martin Bugge marbu...@cisco.com
Date:Fri Mar 14 11:17:17 2014 +0100

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com

 utils/v4l2-ctl/Makefile.am |3 +-
 utils/v4l2-ctl/v4l2-ctl-common.cpp |1 +
 utils/v4l2-ctl/v4l2-ctl-edid.cpp   |  405 
 utils/v4l2-ctl/v4l2-ctl.cpp|   10 +
 utils/v4l2-ctl/v4l2-ctl.h  |9 +
 5 files changed, 427 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=2ef2ac4d1704bc7920de80147aafe6fb74c20e91

diff --git a/utils/v4l2-ctl/Makefile.am b/utils/v4l2-ctl/Makefile.am
index becaa15..489f92f 100644
--- a/utils/v4l2-ctl/Makefile.am
+++ b/utils/v4l2-ctl/Makefile.am
@@ -8,5 +8,6 @@ ivtv_ctl_LDFLAGS = -lm
 v4l2_ctl_SOURCES = v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp 
v4l2-ctl-tuner.cpp \
v4l2-ctl-io.cpp v4l2-ctl-stds.cpp v4l2-ctl-vidcap.cpp 
v4l2-ctl-vidout.cpp \
v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp 
v4l2-ctl-misc.cpp \
-   v4l2-ctl-streaming.cpp v4l2-ctl-test-patterns.cpp v4l2-ctl-sdr.cpp
+   v4l2-ctl-streaming.cpp v4l2-ctl-test-patterns.cpp v4l2-ctl-sdr.cpp \
+   v4l2-ctl-edid.cpp
 v4l2_ctl_LDADD = ../../lib/libv4l2/libv4l2.la 
../../lib/libv4lconvert/libv4lconvert.la
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp 
b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index a68f1c6..8d7c7a2 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -75,6 +75,7 @@ void common_usage(void)
 --help-vbi VBI format options\n
 --help-vidcap  video capture format options\n
 --help-vidout  vidout output format options\n
+--help-edidedid handling options\n
 -k, --concise  be more concise if possible.\n
 -l, --list-ctrls   display all controls and their values 
[VIDIOC_QUERYCTRL]\n
 -L, --list-ctrls-menus\n
diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
new file mode 100644
index 000..39a02ca
--- /dev/null
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -0,0 +1,405 @@
+#include unistd.h
+#include stdlib.h
+#include stdio.h
+#include string.h
+#include inttypes.h
+#include fcntl.h
+#include ctype.h
+#include errno.h
+#include sys/ioctl.h
+#include linux/videodev2.h
+#include linux/v4l2-subdev.h
+#include libv4l2.h
+#include string
+
+#include v4l2-ctl.h
+
+enum format {
+   HEX,
+   RAW,
+   CARRAY
+};
+
+void edid_usage(void)
+{
+   printf(\nEDID options:\n
+--set-edid=pad=pad,[edid=type|file=file]\n
+   pad is the input or output index for 
which to set the EDID.\n
+   type can be 'hdmi', 'dvid' or 'vga'. A 
predefined EDID suitable\n
+   for that connector type will be set. It 
has a 1920x1080p60 native resolution.\n
+   If file is '-', then the data is read 
from stdin, otherwise it is\n
+   read from the given file. The file format 
must be in hex as in get-edid.\n
+   The 'edid' or 'file' arguments are 
mutually exclusive. One of the two\n
+   must be specified.\n
+
--get-edid=pad=pad,startblock=startblock,blocks=blocks,format=fmt,file=file\n
+   pad is the input or output index for 
which to get the EDID.\n
+   startblock is the first block number you 
want to read. Default 0.\n
+   blocks is the number of blocks you want 
to read. Default is\n
+   all blocks.\n
+   fmt is one of:\n
+   hex:hex numbers in ascii text\n
+   raw:can be piped directly into the 
edid-decode tool\n
+   carray: c-program struct\n
+   If file is '-' or not the 'file' 
argument is not supplied, then the data\n
+   is written to stdout.\n
+  );
+}
+
+static void read_edid_file(FILE *f, struct v4l2_subdev_edid *e)
+{
+   char value[4] = { 0 };
+   int blocks = 1;
+   int i = 0;
+   int c;
+
+   fseek(f, SEEK_SET, 0);
+   e-edid = (unsigned char *)malloc(blocks * 128);
+
+   while ((c = fgetc(f)) != EOF) {
+   if (isxdigit(c)) {
+   if (i  0x01) {
+   value[1] = c;
+   e-edid[i/2] = strtoul(value, 0, 16);
+  

[git:v4l-utils/master] v4l2-ctl: add --clear-edid option.

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-ctl: add --clear-edid option.
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 11:36:19 2014 +0100

Also make sure the --set-edid doesn't accidentally clear the EDID if the
file contains no data.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

 utils/v4l2-ctl/v4l2-ctl-edid.cpp |   62 +
 utils/v4l2-ctl/v4l2-ctl.cpp  |3 +-
 utils/v4l2-ctl/v4l2-ctl.h|5 ++-
 3 files changed, 47 insertions(+), 23 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=9591ffce227bde4e27ab666be8325281f290f99d

diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
index 39a02ca..681d2f7 100644
--- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -31,6 +31,8 @@ void edid_usage(void)
read from the given file. The file format 
must be in hex as in get-edid.\n
The 'edid' or 'file' arguments are 
mutually exclusive. One of the two\n
must be specified.\n
+--clear-edid=pad\n
+   pad is the input or output index for 
which to clear the EDID.\n
 
--get-edid=pad=pad,startblock=startblock,blocks=blocks,format=fmt,file=file\n
pad is the input or output index for 
which to get the EDID.\n
startblock is the first block number you 
want to read. Default 0.\n
@@ -47,36 +49,36 @@ void edid_usage(void)
 
 static void read_edid_file(FILE *f, struct v4l2_subdev_edid *e)
 {
-   char value[4] = { 0 };
-   int blocks = 1;
-   int i = 0;
+   char value[3] = { 0 };
+   unsigned blocks = 1;
+   unsigned i = 0;
int c;
 
fseek(f, SEEK_SET, 0);
e-edid = (unsigned char *)malloc(blocks * 128);
 
while ((c = fgetc(f)) != EOF) {
-   if (isxdigit(c)) {
-   if (i  0x01) {
-   value[1] = c;
-   e-edid[i/2] = strtoul(value, 0, 16);
-   } else {
-   value[0] = c;
-   }
-   i++;
+   if (!isxdigit(c))
+   continue;
+   if (i  0x01) {
+   value[1] = c;
if (i / 2  blocks * 128) {
blocks++;
-   e-edid = (unsigned char*)realloc(e-edid, 
blocks * 128);
-   }
-   if (blocks  256) {
-   fprintf(stderr, edid file error: too long\n);
-   free(e-edid);
-   e-edid = NULL;
-   exit(1);
+   if (blocks  256) {
+   fprintf(stderr, edid file error: too 
long\n);
+   free(e-edid);
+   e-edid = NULL;
+   exit(1);
+   }
+   e-edid = (unsigned char *)realloc(e-edid, 
blocks * 128);
}
+   e-edid[i / 2] = strtoul(value, 0, 16);
+   } else {
+   value[0] = c;
}
+   i++;
}
-   e-blocks = blocks;
+   e-blocks = i / 256;
 }
 
 static bool crc_ok(unsigned char *b)
@@ -234,6 +236,7 @@ static char *file_in;
 static struct v4l2_subdev_edid gedid;
 static char *file_out;
 static enum format gformat;
+static unsigned clear_pad;
 
 void edid_cmd(int ch, char *optarg)
 {
@@ -292,6 +295,11 @@ void edid_cmd(int ch, char *optarg)
}
break;
 
+   case OptClearEdid:
+   if (optarg)
+   clear_pad = strtoul(optarg, 0, 0);
+   break;
+
case OptGetEdid:
memset(gedid, 0, sizeof(gedid));
gedid.blocks = 256; /* default all blocks */
@@ -351,6 +359,14 @@ void edid_cmd(int ch, char *optarg)
 
 void edid_set(int fd)
 {
+   if (options[OptClearEdid]) {
+   struct v4l2_edid edid;
+
+   memset(edid, 0, sizeof(edid));
+   edid.pad = clear_pad;
+   doioctl(fd, VIDIOC_SUBDEV_S_EDID, sedid);
+   }
+
if (options[OptSetEdid]) {
FILE *fin = NULL;
 
@@ -365,8 +381,14 @@ void edid_set(int fd)
exit(1);
}
}
-   if (fin)
+   if (fin) {
read_edid_file(fin, sedid);
+   if (sedid.blocks == 0) {
+  

[git:v4l-utils/master] v4l2-ctl: rename old v4l2_subdev_edid and VIDIOC_SUBDEV_G/S_EDID

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-ctl: rename old v4l2_subdev_edid and VIDIOC_SUBDEV_G/S_EDID
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 12:45:28 2014 +0100

I forgot to rename those old names to the new ones.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Reported-by: Martin Bugge marbu...@cisco.com

 utils/v4l2-ctl/v4l2-ctl-edid.cpp |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=8ddc9476017043cea3af8f7af47698abe72b2ac6

diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
index 681d2f7..2cacd49 100644
--- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -47,7 +47,7 @@ void edid_usage(void)
   );
 }
 
-static void read_edid_file(FILE *f, struct v4l2_subdev_edid *e)
+static void read_edid_file(FILE *f, struct v4l2_edid *e)
 {
char value[3] = { 0 };
unsigned blocks = 1;
@@ -91,7 +91,7 @@ static bool crc_ok(unsigned char *b)
return sum == 0;
 }
 
-static void hexdumpedid(FILE *f, struct v4l2_subdev_edid *e)
+static void hexdumpedid(FILE *f, struct v4l2_edid *e)
 {
for (unsigned b = 0; b  e-blocks; b++) {
unsigned char *buf = e-edid + 128 * b;
@@ -108,7 +108,7 @@ static void hexdumpedid(FILE *f, struct v4l2_subdev_edid *e)
}
 }
 
-static void rawdumpedid(FILE *f, struct v4l2_subdev_edid *e)
+static void rawdumpedid(FILE *f, struct v4l2_edid *e)
 {
for (unsigned b = 0; b  e-blocks; b++) {
unsigned char *buf = e-edid + 128 * b;
@@ -118,7 +118,7 @@ static void rawdumpedid(FILE *f, struct v4l2_subdev_edid *e)
}
 }
 
-static void carraydumpedid(FILE *f, struct v4l2_subdev_edid *e)
+static void carraydumpedid(FILE *f, struct v4l2_edid *e)
 {
fprintf(f, unsigned char edid[] = {\n);
for (unsigned b = 0; b  e-blocks; b++) {
@@ -139,7 +139,7 @@ static void carraydumpedid(FILE *f, struct v4l2_subdev_edid 
*e)
fprintf(f, };\n);
 }
 
-static void printedid(FILE *f, struct v4l2_subdev_edid *e, enum format gf)
+static void printedid(FILE *f, struct v4l2_edid *e, enum format gf)
 {
switch (gf) {
default:
@@ -230,10 +230,10 @@ static uint8_t hdmi_edid[256] = {
 /**/
 
 
-static struct v4l2_subdev_edid sedid;
+static struct v4l2_edid sedid;
 static char *file_in;
 
-static struct v4l2_subdev_edid gedid;
+static struct v4l2_edid gedid;
 static char *file_out;
 static enum format gformat;
 static unsigned clear_pad;
@@ -364,7 +364,7 @@ void edid_set(int fd)
 
memset(edid, 0, sizeof(edid));
edid.pad = clear_pad;
-   doioctl(fd, VIDIOC_SUBDEV_S_EDID, sedid);
+   doioctl(fd, VIDIOC_S_EDID, sedid);
}
 
if (options[OptSetEdid]) {
@@ -389,7 +389,7 @@ void edid_set(int fd)
exit(1);
}
}
-   doioctl(fd, VIDIOC_SUBDEV_S_EDID, sedid);
+   doioctl(fd, VIDIOC_S_EDID, sedid);
if (fin) {
if (sedid.edid) {
free(sedid.edid);
@@ -418,7 +418,7 @@ void edid_get(int fd)
}
}
gedid.edid = (unsigned char *)malloc(gedid.blocks * 128);
-   if (doioctl(fd, VIDIOC_SUBDEV_G_EDID, gedid) == 0)
+   if (doioctl(fd, VIDIOC_G_EDID, gedid) == 0)
printedid(fout, gedid, gformat);
if (file_out  fout != stdout)
fclose(fout);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] DocBook media: clarify v4l2_pix_format and v4l2_pix_format_mplane fields

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] DocBook media: clarify v4l2_pix_format and 
v4l2_pix_format_mplane fields
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 08:57:07 2014 -0300

Be more specific with regards to how some of these fields are interpreted.
In particular the height value and which fields can be set by the application.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 Documentation/DocBook/media/v4l/pixfmt.xml |   23 ---
 1 files changed, 16 insertions(+), 7 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=46609297e373c74a87acbb7e9f052a3ed8a8212c

diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index f535d9b..ea514d6 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -25,7 +25,12 @@ capturing and output, for overlay frame buffer formats see 
also
row
  entry__u32/entry
  entrystructfieldheight/structfield/entry
- entryImage height in pixels./entry
+ entryImage height in pixels. If structfieldfield/structfield is
+ one of constantV4L2_FIELD_TOP/constant, 
constantV4L2_FIELD_BOTTOM/constant
+ or constantV4L2_FIELD_ALTERNATE/constant then height refers to the
+ number of lines in the field, otherwise it refers to the number of
+ lines in the frame (which is twice the field height for interlaced
+ formats)./entry
/row
row
  entry spanname=hspanApplications set these fields to
@@ -54,7 +59,7 @@ linkend=reserved-formats //entry
 can request to capture or output only the top or bottom field, or both
 fields interlaced or sequentially stored in one buffer or alternating
 in separate buffers. Drivers return the actual field order selected.
-For details see xref linkend=field-order /./entry
+For more details on fields see xref linkend=field-order /./entry
/row
row
  entry__u32/entry
@@ -81,7 +86,10 @@ plane and is divided by the same factor as the
 example the Cb and Cr planes of a YUV 4:2:0 image have half as many
 padding bytes following each line as the Y plane. To avoid ambiguities
 drivers must return a structfieldbytesperline/structfield value
-rounded up to a multiple of the scale factor./para/entry
+rounded up to a multiple of the scale factor./para
+paraFor compressed formats the structfieldbytesperline/structfield
+value makes no sense. Applications and drivers must set this to 0 in
+that case./para/entry
/row
row
  entry__u32/entry
@@ -97,7 +105,8 @@ hold an image./entry
  entryv4l2-colorspace;/entry
  entrystructfieldcolorspace/structfield/entry
  entryThis information supplements the
-structfieldpixelformat/structfield and must be set by the driver,
+structfieldpixelformat/structfield and must be set by the driver for
+capture streams and by the application for output streams,
 see xref linkend=colorspaces /./entry
/row
row
@@ -135,7 +144,7 @@ set this field to zero./entry
   entry__u16/entry
   entrystructfieldbytesperline/structfield/entry
   entryDistance in bytes between the leftmost pixels in two adjacent
-lines./entry
+lines. See v4l2-pix-format;./entry
 /row
 row
   entry__u16/entry
@@ -154,12 +163,12 @@ set this field to zero./entry
 row
   entry__u32/entry
   entrystructfieldwidth/structfield/entry
-  entryImage width in pixels./entry
+  entryImage width in pixels. See v4l2-pix-format;./entry
 /row
 row
   entry__u32/entry
   entrystructfieldheight/structfield/entry
-  entryImage height in pixels./entry
+  entryImage height in pixels. See v4l2-pix-format;./entry
 /row
 row
   entry__u32/entry

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] e4000: rename some variables

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: rename some variables
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Feb 10 22:52:51 2014 -0300

Rename some variables.
Change error status checks from (ret  0) to (ret).
No actual functionality changes.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/e4000.c  |  332 ++--
 drivers/media/tuners/e4000_priv.h |2 +-
 2 files changed, 167 insertions(+), 167 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=c5f51b15829d5e5dc65a9628cf4fbdcfd97636bf

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index f382b90..3b52550 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -23,110 +23,110 @@
 
 static int e4000_init(struct dvb_frontend *fe)
 {
-   struct e4000_priv *priv = fe-tuner_priv;
+   struct e4000 *s = fe-tuner_priv;
int ret;
 
-   dev_dbg(priv-client-dev, %s:\n, __func__);
+   dev_dbg(s-client-dev, %s:\n, __func__);
 
/* dummy I2C to ensure I2C wakes up */
-   ret = regmap_write(priv-regmap, 0x02, 0x40);
+   ret = regmap_write(s-regmap, 0x02, 0x40);
 
/* reset */
-   ret = regmap_write(priv-regmap, 0x00, 0x01);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x00, 0x01);
+   if (ret)
goto err;
 
/* disable output clock */
-   ret = regmap_write(priv-regmap, 0x06, 0x00);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x06, 0x00);
+   if (ret)
goto err;
 
-   ret = regmap_write(priv-regmap, 0x7a, 0x96);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x7a, 0x96);
+   if (ret)
goto err;
 
/* configure gains */
-   ret = regmap_bulk_write(priv-regmap, 0x7e, \x01\xfe, 2);
-   if (ret  0)
+   ret = regmap_bulk_write(s-regmap, 0x7e, \x01\xfe, 2);
+   if (ret)
goto err;
 
-   ret = regmap_write(priv-regmap, 0x82, 0x00);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x82, 0x00);
+   if (ret)
goto err;
 
-   ret = regmap_write(priv-regmap, 0x24, 0x05);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x24, 0x05);
+   if (ret)
goto err;
 
-   ret = regmap_bulk_write(priv-regmap, 0x87, \x20\x01, 2);
-   if (ret  0)
+   ret = regmap_bulk_write(s-regmap, 0x87, \x20\x01, 2);
+   if (ret)
goto err;
 
-   ret = regmap_bulk_write(priv-regmap, 0x9f, \x7f\x07, 2);
-   if (ret  0)
+   ret = regmap_bulk_write(s-regmap, 0x9f, \x7f\x07, 2);
+   if (ret)
goto err;
 
/* DC offset control */
-   ret = regmap_write(priv-regmap, 0x2d, 0x1f);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x2d, 0x1f);
+   if (ret)
goto err;
 
-   ret = regmap_bulk_write(priv-regmap, 0x70, \x01\x01, 2);
-   if (ret  0)
+   ret = regmap_bulk_write(s-regmap, 0x70, \x01\x01, 2);
+   if (ret)
goto err;
 
/* gain control */
-   ret = regmap_write(priv-regmap, 0x1a, 0x17);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x1a, 0x17);
+   if (ret)
goto err;
 
-   ret = regmap_write(priv-regmap, 0x1f, 0x1a);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x1f, 0x1a);
+   if (ret)
goto err;
 
-   priv-active = true;
+   s-active = true;
 err:
if (ret)
-   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(s-client-dev, %s: failed=%d\n, __func__, ret);
 
return ret;
 }
 
 static int e4000_sleep(struct dvb_frontend *fe)
 {
-   struct e4000_priv *priv = fe-tuner_priv;
+   struct e4000 *s = fe-tuner_priv;
int ret;
 
-   dev_dbg(priv-client-dev, %s:\n, __func__);
+   dev_dbg(s-client-dev, %s:\n, __func__);
 
-   priv-active = false;
+   s-active = false;
 
-   ret = regmap_write(priv-regmap, 0x00, 0x00);
-   if (ret  0)
+   ret = regmap_write(s-regmap, 0x00, 0x00);
+   if (ret)
goto err;
 err:
if (ret)
-   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(s-client-dev, %s: failed=%d\n, __func__, ret);
 
return ret;
 }
 
 static int e4000_set_params(struct dvb_frontend *fe)
 {
-   struct e4000_priv *priv = fe-tuner_priv;
+   struct e4000 *s = fe-tuner_priv;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret, i, sigma_delta;
u64 f_vco;
u8 buf[5], i_data[4], q_data[4];
 
-   dev_dbg(priv-client-dev,
+   dev_dbg(s-client-dev,
%s: delivery_system=%d frequency=%u 

[git:media_tree/master] [media] v4l2-pci-skeleton: add a V4L2 PCI skeleton driver

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] v4l2-pci-skeleton: add a V4L2 PCI skeleton driver
Author:  Hans Verkuil hverk...@xs4all.nl
Date:Fri Mar 14 08:38:21 2014 -0300

This example driver uses all the latest frameworks and can serve as a
starting point for a new V4L2 PCI driver.

Originally written for a presentation on how to use V4L2 frameworks
during FOSDEM 2014.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 Documentation/video4linux/v4l2-framework.txt  |4 +
 Documentation/video4linux/v4l2-pci-skeleton.c |  913 +
 2 files changed, 917 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=926977e0ae75567a87d95b245eea589a8bbb8682

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index ae3a2cc..667a433 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -34,6 +34,10 @@ So this framework sets up the basic building blocks that all 
drivers
 need and this same framework should make it much easier to refactor
 common code into utility functions shared by all drivers.
 
+A good example to look at as a reference is the v4l2-pci-skeleton.c
+source that is available in this directory. It is a skeleton driver for
+a PCI capture card, and demonstrates how to use the V4L2 driver
+framework. It can be used as a template for real PCI video capture driver.
 
 Structure of a driver
 -
diff --git a/Documentation/video4linux/v4l2-pci-skeleton.c 
b/Documentation/video4linux/v4l2-pci-skeleton.c
new file mode 100644
index 000..3a1c0d2
--- /dev/null
+++ b/Documentation/video4linux/v4l2-pci-skeleton.c
@@ -0,0 +1,913 @@
+/*
+ * This is a V4L2 PCI Skeleton Driver. It gives an initial skeleton source
+ * for use with other PCI drivers.
+ *
+ * This skeleton PCI driver assumes that the card has an S-Video connector as
+ * input 0 and an HDMI connector as input 1.
+ *
+ * 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.
+ */
+
+#include linux/types.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/init.h
+#include linux/kmod.h
+#include linux/mutex.h
+#include linux/pci.h
+#include linux/interrupt.h
+#include linux/videodev2.h
+#include linux/v4l2-dv-timings.h
+#include media/v4l2-device.h
+#include media/v4l2-dev.h
+#include media/v4l2-ioctl.h
+#include media/v4l2-dv-timings.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-event.h
+#include media/videobuf2-dma-contig.h
+
+MODULE_DESCRIPTION(V4L2 PCI Skeleton Driver);
+MODULE_AUTHOR(Hans Verkuil);
+MODULE_LICENSE(GPL v2);
+MODULE_DEVICE_TABLE(pci, skeleton_pci_tbl);
+
+/**
+ * struct skeleton - All internal data for one instance of device
+ * @pdev: PCI device
+ * @v4l2_dev: top-level v4l2 device struct
+ * @vdev: video node structure
+ * @ctrl_handler: control handler structure
+ * @lock: ioctl serialization mutex
+ * @std: current SDTV standard
+ * @timings: current HDTV timings
+ * @format: current pix format
+ * @input: current video input (0 = SDTV, 1 = HDTV)
+ * @queue: vb2 video capture queue
+ * @alloc_ctx: vb2 contiguous DMA context
+ * @qlock: spinlock controlling access to buf_list and sequence
+ * @buf_list: list of buffers queued for DMA
+ * @sequence: frame sequence counter
+ */
+struct skeleton {
+   struct pci_dev *pdev;
+   struct v4l2_device v4l2_dev;
+   struct video_device vdev;
+   struct v4l2_ctrl_handler ctrl_handler;
+   struct mutex lock;
+   v4l2_std_id std;
+   struct v4l2_dv_timings timings;
+   struct v4l2_pix_format format;
+   unsigned input;
+
+   struct vb2_queue queue;
+   struct vb2_alloc_ctx *alloc_ctx;
+
+   spinlock_t qlock;
+   struct list_head buf_list;
+   unsigned int sequence;
+};
+
+struct skel_buffer {
+   struct vb2_buffer vb;
+   struct list_head list;
+};
+
+static inline struct skel_buffer *to_skel_buffer(struct vb2_buffer *vb2)
+{
+   return container_of(vb2, struct skel_buffer, vb);
+}
+
+static const struct pci_device_id 

[git:media_tree/master] [media] rc: img-ir: hw: Fix min/max bits setup

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rc: img-ir: hw: Fix min/max bits setup
Author:  James Hogan james.ho...@imgtec.com
Date:Thu Mar 13 07:29:22 2014 -0300

The calculated values for the minlen and maxlen fields, which were
rounded to multiples of 2 and clamped to a valid range, were left
unused. Use them in the calculation of the register value rather than
using the raw input minlen and maxlen.

This fixes the following warning with a W=1 build:
drivers/media/rc/img-ir/img-ir-hw.c In function ‘img_ir_free_timing’:
drivers/media/rc/img-ir/img-ir-hw.c +228 :23: warning: variable ‘maxlen’ set 
but not used [-Wunused-but-set-variable]
drivers/media/rc/img-ir/img-ir-hw.c +228 :15: warning: variable ‘minlen’ set 
but not used [-Wunused-but-set-variable]

Reported-by: Mauro Carvalho Chehab m.che...@samsung.com
Signed-off-by: James Hogan james.ho...@imgtec.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/rc/img-ir/img-ir-hw.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=b9e28d1f8301d6e393b8937282f325f13fb9cf6a

diff --git a/drivers/media/rc/img-ir/img-ir-hw.c 
b/drivers/media/rc/img-ir/img-ir-hw.c
index 2abf78a..579a52b 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -240,9 +240,9 @@ static u32 img_ir_free_timing(const struct 
img_ir_free_timing *timing,
ft_min = (timing-ft_min*clock_hz + 99) / 100;
ft_min = (ft_min + 7)  3;
/* construct register value */
-   return  (timing-maxlen  IMG_IR_MAXLEN_SHIFT) |
-   (timing-minlen  IMG_IR_MINLEN_SHIFT) |
-   (ft_min  IMG_IR_FT_MIN_SHIFT);
+   return  (maxlen  IMG_IR_MAXLEN_SHIFT) |
+   (minlen  IMG_IR_MINLEN_SHIFT) |
+   (ft_min  IMG_IR_FT_MIN_SHIFT);
 }
 
 /**

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

[git:media_tree/master] [media] DocBook media: v4l2_format_sdr was renamed to v4l2_sdr_format

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] DocBook media: v4l2_format_sdr was renamed to v4l2_sdr_format
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 08:57:06 2014 -0300

Update the DocBook files accordingly.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 Documentation/DocBook/media/v4l/dev-sdr.xml  |6 +++---
 Documentation/DocBook/media/v4l/vidioc-g-fmt.xml |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=22a5ea91df52392f98ff7ff66a1dce2c07e68568

diff --git a/Documentation/DocBook/media/v4l/dev-sdr.xml 
b/Documentation/DocBook/media/v4l/dev-sdr.xml
index 524b9c4..dc14804 100644
--- a/Documentation/DocBook/media/v4l/dev-sdr.xml
+++ b/Documentation/DocBook/media/v4l/dev-sdr.xml
@@ -69,15 +69,15 @@ must be supported as well.
 para
 To use the link linkend=formatformat/link ioctls applications set the
 structfieldtype/structfield field of a v4l2-format; to
-constantV4L2_BUF_TYPE_SDR_CAPTURE/constant and use the v4l2-format-sdr;
+constantV4L2_BUF_TYPE_SDR_CAPTURE/constant and use the v4l2-sdr-format;
 structfieldsdr/structfield member of the structfieldfmt/structfield
 union as needed per the desired operation.
 Currently only the structfieldpixelformat/structfield field of
-v4l2-format-sdr; is used. The content of that field is the V4L2 fourcc code
+v4l2-sdr-format; is used. The content of that field is the V4L2 fourcc code
 of the data format.
 /para
 
-table pgwide=1 frame=none id=v4l2-format-sdr
+table pgwide=1 frame=none id=v4l2-sdr-format
   titlestruct structnamev4l2_sdr_format/structname/title
   tgroup cols=3
 cs-str;
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
index f43f1a9..4fe19a7a 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
@@ -172,7 +172,7 @@ capture and output devices./entry
  /row
  row
entry/entry
-   entryv4l2-format-sdr;/entry
+   entryv4l2-sdr-format;/entry
entrystructfieldsdr/structfield/entry
entryDefinition of a data format, see
 xref linkend=pixfmt /, used by SDR capture devices./entry

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl2832_sdr: clamp bandwidth to nearest legal value in automode

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl2832_sdr: clamp bandwidth to nearest legal value in automode
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Mar 10 14:28:45 2014 -0300

Clamp bandwidth to nearest legal value in automode in order to pass
v4l2-compliance test.

Reported-by: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ea4d04f92c97c7986dfc363655f9c4143d35c2b9

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index 141fc8b..b09f7d8 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -1322,8 +1322,16 @@ static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl)
switch (ctrl-id) {
case V4L2_CID_RF_TUNER_BANDWIDTH_AUTO:
case V4L2_CID_RF_TUNER_BANDWIDTH:
-   if (s-bandwidth_auto-val)
-   s-bandwidth-val = s-f_adc;
+   /* TODO: these controls should be moved to tuner drivers */
+   if (s-bandwidth_auto-val) {
+   /* Round towards the closest legal value */
+   s32 val = s-f_adc + s-bandwidth-step / 2;
+   u32 offset;
+   val = clamp(val, s-bandwidth-minimum, 
s-bandwidth-maximum);
+   offset = val - s-bandwidth-minimum;
+   offset = s-bandwidth-step * (offset / 
s-bandwidth-step);
+   s-bandwidth-val = s-bandwidth-minimum + offset;
+   }
 
c-bandwidth_hz = s-bandwidth-val;
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl2832_sdr: fixing v4l2-compliance issues

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl2832_sdr: fixing v4l2-compliance issues
Author:  Hans Verkuil hverk...@xs4all.nl
Date:Wed Mar 5 20:21:38 2014 -0300

Fix rtl2832_sdr driver v4l2-compliance issues.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c |   29 +
 1 files changed, 23 insertions(+), 6 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=bc9087549ea9f57c400013d08d311c7cd4892132

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index 7e20576..141fc8b 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -118,6 +118,7 @@ struct rtl2832_sdr_state {
struct vb2_queue vb_queue;
struct list_head queued_bufs;
spinlock_t queued_bufs_lock; /* Protects queued_bufs */
+   unsigned sequence;   /* buffer sequence counter */
 
/* Note if taking both locks v4l2_lock must always be locked first! */
struct mutex v4l2_lock;  /* Protects everything else */
@@ -413,6 +414,8 @@ static void rtl2832_sdr_urb_complete(struct urb *urb)
len = rtl2832_sdr_convert_stream(s, ptr, urb-transfer_buffer,
urb-actual_length);
vb2_set_plane_payload(fbuf-vb, 0, len);
+   v4l2_get_timestamp(fbuf-vb.v4l2_buf.timestamp);
+   fbuf-vb.v4l2_buf.sequence = s-sequence++;
vb2_buffer_done(fbuf-vb, VB2_BUF_STATE_DONE);
}
 skip:
@@ -609,8 +612,9 @@ static int rtl2832_sdr_queue_setup(struct vb2_queue *vq,
struct rtl2832_sdr_state *s = vb2_get_drv_priv(vq);
dev_dbg(s-udev-dev, %s: *nbuffers=%d\n, __func__, *nbuffers);
 
-   /* Absolute min and max number of buffers available for mmap() */
-   *nbuffers = clamp_t(unsigned int, *nbuffers, 8, 32);
+   /* Need at least 8 buffers */
+   if (vq-num_buffers + *nbuffers  8)
+   *nbuffers = 8 - vq-num_buffers;
*nplanes = 1;
/* 2 = max 16-bit sample returned */
sizes[0] = PAGE_ALIGN(BULK_BUFFER_SIZE * 2);
@@ -1011,6 +1015,8 @@ static int rtl2832_sdr_start_streaming(struct vb2_queue 
*vq, unsigned int count)
if (ret)
goto err;
 
+   s-sequence = 0;
+
ret = rtl2832_sdr_submit_urbs(s);
if (ret)
goto err;
@@ -1088,6 +1094,8 @@ static int rtl2832_sdr_s_tuner(struct file *file, void 
*priv,
struct rtl2832_sdr_state *s = video_drvdata(file);
dev_dbg(s-udev-dev, %s:\n, __func__);
 
+   if (v-index  1)
+   return -EINVAL;
return 0;
 }
 
@@ -1123,12 +1131,15 @@ static int rtl2832_sdr_g_frequency(struct file *file, 
void *priv,
dev_dbg(s-udev-dev, %s: tuner=%d type=%d\n,
__func__, f-tuner, f-type);
 
-   if (f-tuner == 0)
+   if (f-tuner == 0) {
f-frequency = s-f_adc;
-   else if (f-tuner == 1)
+   f-type = V4L2_TUNER_ADC;
+   } else if (f-tuner == 1) {
f-frequency = s-f_tuner;
-   else
+   f-type = V4L2_TUNER_RF;
+   } else {
return -EINVAL;
+   }
 
return ret;
 }
@@ -1162,7 +1173,9 @@ static int rtl2832_sdr_s_frequency(struct file *file, 
void *priv,
__func__, s-f_adc);
ret = rtl2832_sdr_set_adc(s);
} else if (f-tuner == 1) {
-   s-f_tuner = f-frequency;
+   s-f_tuner = clamp_t(unsigned int, f-frequency,
+   bands_fm[0].rangelow,
+   bands_fm[0].rangehigh);
dev_dbg(s-udev-dev, %s: RF frequency=%u Hz\n,
__func__, f-frequency);
 
@@ -1196,6 +1209,7 @@ static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file, 
void *priv,
dev_dbg(s-udev-dev, %s:\n, __func__);
 
f-fmt.sdr.pixelformat = s-pixelformat;
+   memset(f-fmt.sdr.reserved, 0, sizeof(f-fmt.sdr.reserved));
 
return 0;
 }
@@ -1212,6 +1226,7 @@ static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file, 
void *priv,
if (vb2_is_busy(q))
return -EBUSY;
 
+   memset(f-fmt.sdr.reserved, 0, sizeof(f-fmt.sdr.reserved));
for (i = 0; i  NUM_FORMATS; i++) {
if (formats[i].pixelformat == f-fmt.sdr.pixelformat) {
s-pixelformat = f-fmt.sdr.pixelformat;
@@ -1233,6 +1248,7 @@ static int rtl2832_sdr_try_fmt_sdr_cap(struct file *file, 
void *priv,
dev_dbg(s-udev-dev, %s: pixelformat fourcc %4.4s\n, __func__,
(char *)f-fmt.sdr.pixelformat);
 
+   

[git:media_tree/master] [media] rc: img-ir: jvc: Remove unused no-leader timings

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rc: img-ir: jvc: Remove unused no-leader timings
Author:  James Hogan james.ho...@imgtec.com
Date:Thu Mar 13 07:29:23 2014 -0300

The JVC timings included timings intended for the secondary decoder
(which matches messages with no leader), however they were in the wrong
part of the timings structure, repeating s00 and s01 rather than being
in s10 and s11.

Distinct repeat timings can't be properly supported yet for JVC anyway
since the scancode callback cannot determine which decoder matched the
message, so for now remove these timings and don't bother to enable the
secondary decoder.

This fixes the following warnings with W=1:
drivers/media/rc/img-ir/img-ir-jvc.c +76 :3: warning: initialized field 
overwritten [-Woverride-init]
drivers/media/rc/img-ir/img-ir-jvc.c +76 :3: warning: (near initialization for 
‘img_ir_jvc.timings.s00’) [-Woverride-init]
drivers/media/rc/img-ir/img-ir-jvc.c +81 :3: warning: initialized field 
overwritten [-Woverride-init]
drivers/media/rc/img-ir/img-ir-jvc.c +81 :3: warning: (near initialization for 
‘img_ir_jvc.timings.s01’) [-Woverride-init]

Reported-by: Mauro Carvalho Chehab m.che...@samsung.com
Signed-off-by: James Hogan james.ho...@imgtec.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/rc/img-ir/img-ir-jvc.c |   11 ---
 1 files changed, 0 insertions(+), 11 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=32df34d875bbfeda023485f7693c6fe1cd7946c3

diff --git a/drivers/media/rc/img-ir/img-ir-jvc.c 
b/drivers/media/rc/img-ir/img-ir-jvc.c
index ae55867..10209d2 100644
--- a/drivers/media/rc/img-ir/img-ir-jvc.c
+++ b/drivers/media/rc/img-ir/img-ir-jvc.c
@@ -49,7 +49,6 @@ struct img_ir_decoder img_ir_jvc = {
.control = {
.decoden = 1,
.code_type = IMG_IR_CODETYPE_PULSEDIST,
-   .decodend2 = 1,
},
/* main timings */
.unit = 527500, /* 527.5 us */
@@ -69,16 +68,6 @@ struct img_ir_decoder img_ir_jvc = {
.pulse = { 1/* 527.5 us +-60 us */ },
.space = { 3/* 1.5825 ms +-40 us */ },
},
-   /* 0 symbol (no leader) */
-   .s00 = {
-   .pulse = { 1/* 527.5 us +-60 us */ },
-   .space = { 1/* 527.5 us */ },
-   },
-   /* 1 symbol (no leader) */
-   .s01 = {
-   .pulse = { 1/* 527.5 us +-60 us */ },
-   .space = { 3/* 1.5825 ms +-40 us */ },
-   },
/* free time */
.ft = {
.minlen = 16,

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

[git:media_tree/master] [media] rc: img-ir: hw: Remove unnecessary semi-colon

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rc: img-ir: hw: Remove unnecessary semi-colon
Author:  James Hogan james.ho...@imgtec.com
Date:Thu Mar 13 07:29:21 2014 -0300

Fix a coccicheck warning in img-ir driver:
drivers/media/rc/img-ir/img-ir-hw.c:500:2-3: Unneeded semicolon

Signed-off-by: James Hogan james.ho...@imgtec.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/rc/img-ir/img-ir-hw.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=54ece68d89110f598546d3a2d10cbbbc70cb5055

diff --git a/drivers/media/rc/img-ir/img-ir-hw.c 
b/drivers/media/rc/img-ir/img-ir-hw.c
index cbbfd7d..2abf78a 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -497,7 +497,7 @@ set_unlock:
break;
default:
ret = -EINVAL;
-   };
+   }
 
 unlock:
spin_unlock_irq(priv-lock);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl28xxu: use muxed RTL2832 I2C adapters for E4000 and RTL2832_SDR

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl28xxu: use muxed RTL2832 I2C adapters for E4000 and 
RTL2832_SDR
Author:  Antti Palosaari cr...@iki.fi
Date:Sat Feb 8 04:03:57 2014 -0300

RTL2832 driver provides muxed I2C adapters for tuner bus I2C gate
control. Pass those adapters to rtl2832_sdr and e4000 modules in order
to get rid of proprietary DVB .i2c_gate_ctrl() callback use.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/dvb-usb-v2/rtl28xxu.c |   10 --
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ae1f8453e828c18cf5291aeab53081dca6906f6e

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index f51949e..c83c16c 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -774,6 +774,9 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter 
*adap)
goto err;
}
 
+   /* RTL2832 I2C repeater */
+   priv-demod_i2c_adapter = rtl2832_get_i2c_adapter(adap-fe[0]);
+
/* set fe callback */
adap-fe[0]-callback = rtl2832u_frontend_callback;
 
@@ -922,6 +925,8 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
break;
case TUNER_RTL2832_E4000: {
struct v4l2_subdev *sd;
+   struct i2c_adapter *i2c_adap_internal =
+   
rtl2832_get_private_i2c_adapter(adap-fe[0]);
struct e4000_config e4000_config = {
.fe = adap-fe[0],
.clock = 2880,
@@ -932,7 +937,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
info.platform_data = e4000_config;
 
request_module(info.type);
-   client = i2c_new_device(d-i2c_adap, info);
+   client = i2c_new_device(priv-demod_i2c_adapter, info);
if (client == NULL || client-dev.driver == NULL)
break;
 
@@ -943,10 +948,11 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
 
priv-client = client;
sd = i2c_get_clientdata(client);
+   i2c_set_adapdata(i2c_adap_internal, d);
 
/* attach SDR */
dvb_attach(rtl2832_sdr_attach, adap-fe[0],
-   d-i2c_adap,
+   i2c_adap_internal,
rtl28xxu_rtl2832_e4000_config, sd);
}
break;
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
index 367aca1..a26cab1 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -55,6 +55,7 @@ struct rtl28xxu_priv {
u8 tuner;
char *tuner_name;
u8 page; /* integrated demod active register page */
+   struct i2c_adapter *demod_i2c_adapter;
bool rc_active;
struct i2c_client *client;
 };

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] media: davinci: vpbe: fix build warning

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] media: davinci: vpbe: fix build warning
Author:  Lad, Prabhakar prabhakar.cse...@gmail.com
Date:Fri Mar 14 02:25:35 2014 -0300

this patch fixes following build warning
drivers/media/platform/davinci/vpbe_display.c: In function 
'vpbe_start_streaming':
drivers/media/platform/davinci/vpbe_display.c:344: warning: unused variable 
'vpbe_dev'

Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/platform/davinci/vpbe_display.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=17fd60fd503d3e7ae095ed75f5a1f1ed1a5d31c1

diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 7a0e40e..b4f12d0 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -341,7 +341,6 @@ static int vpbe_start_streaming(struct vb2_queue *vq, 
unsigned int count)
 {
struct vpbe_fh *fh = vb2_get_drv_priv(vq);
struct vpbe_layer *layer = fh-layer;
-   struct vpbe_device *vpbe_dev = fh-disp_dev-vpbe_dev;
int ret;
 
/* Get the next frame from the buffer queue */

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] MAINTAINERS: add rtl2832_sdr driver

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] MAINTAINERS: add rtl2832_sdr driver
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Feb 3 00:00:32 2014 -0300

Realtek RTL2832 SDR driver. Currently in staging as SDR API is not
ready.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 MAINTAINERS |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ba6e6f6e5032679b08158eda86cf3fce456dc1ec

diff --git a/MAINTAINERS b/MAINTAINERS
index 3718c32..94c9cff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7351,6 +7351,16 @@ T:   git git://linuxtv.org/anttip/media_tree.git
 S: Maintained
 F: drivers/media/dvb-frontends/rtl2832*
 
+RTL2832_SDR MEDIA DRIVER
+M: Antti Palosaari cr...@iki.fi
+L: linux-me...@vger.kernel.org
+W: http://linuxtv.org/
+W: http://palosaari.fi/linux/
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+T: git git://linuxtv.org/anttip/media_tree.git
+S: Maintained
+F: drivers/staging/media/rtl2832u_sdr/rtl2832_sdr*
+
 RTL8180 WIRELESS DRIVER
 M: John W. Linville linvi...@tuxdriver.com
 L: linux-wirel...@vger.kernel.org

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl2832_sdr: expose e4000 controls to user

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl2832_sdr: expose e4000 controls to user
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Feb 10 22:15:01 2014 -0300

E4000 tuner driver provides now some controls. Expose those to
userland.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=09143009d44e615068ac108bf23b69b5fcf85cbe

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index 86fffcf..7e20576 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -1387,10 +1387,9 @@ struct dvb_frontend *rtl2832_sdr_attach(struct 
dvb_frontend *fe,
/* Register controls */
switch (s-cfg-tuner) {
case RTL2832_TUNER_E4000:
-   v4l2_ctrl_handler_init(s-hdl, 2);
-   s-bandwidth_auto = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
-   s-bandwidth = v4l2_ctrl_new_std(s-hdl, ops, 
V4L2_CID_RF_TUNER_BANDWIDTH, 430, 1100, 10, 430);
-   v4l2_ctrl_auto_cluster(2, s-bandwidth_auto, 0, false);
+   v4l2_ctrl_handler_init(s-hdl, 9);
+   if (sd)
+   v4l2_ctrl_add_handler(s-hdl, sd-ctrl_handler, NULL);
break;
case RTL2832_TUNER_R820T:
v4l2_ctrl_handler_init(s-hdl, 2);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] e4000: fix PLL calc to allow higher frequencies

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: fix PLL calc to allow higher frequencies
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Jan 27 03:13:19 2014 -0300

There was 32-bit overflow on VCO frequency calculation which blocks
tuning to 1073 - 1104 MHz. Use 64 bit number in order to avoid VCO
frequency overflow.

After that fix device in question tunes to following range:
60 - 1104 MHz
1250 - 2207 MHz

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/e4000.c |   14 +-
 1 files changed, 5 insertions(+), 9 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=0ed0b22dc594a533a959ed8995e69e2275af40d9

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 3a03b02..ae52a1f 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -221,11 +221,11 @@ static int e4000_set_params(struct dvb_frontend *fe)
struct e4000_priv *priv = fe-tuner_priv;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret, i, sigma_delta;
-   unsigned int f_vco;
+   u64 f_vco;
u8 buf[5], i_data[4], q_data[4];
 
dev_dbg(priv-client-dev,
-   %s: delivery_system=%d frequency=%d bandwidth_hz=%d\n,
+   %s: delivery_system=%d frequency=%u bandwidth_hz=%u\n,
__func__, c-delivery_system, c-frequency,
c-bandwidth_hz);
 
@@ -248,20 +248,16 @@ static int e4000_set_params(struct dvb_frontend *fe)
goto err;
}
 
-   /*
-* Note: Currently f_vco overflows when c-frequency is 1 073 741 824 Hz
-* or more.
-*/
-   f_vco = c-frequency * e4000_pll_lut[i].mul;
+   f_vco = 1ull * c-frequency * e4000_pll_lut[i].mul;
sigma_delta = div_u64(0x1ULL * (f_vco % priv-clock), priv-clock);
-   buf[0] = f_vco / priv-clock;
+   buf[0] = div_u64(f_vco, priv-clock);
buf[1] = (sigma_delta  0)  0xff;
buf[2] = (sigma_delta  8)  0xff;
buf[3] = 0x00;
buf[4] = e4000_pll_lut[i].div;
 
dev_dbg(priv-client-dev,
-   %s: f_vco=%u pll div=%d sigma_delta=%04x\n,
+   %s: f_vco=%llu pll div=%d sigma_delta=%04x\n,
__func__, f_vco, buf[0], sigma_delta);
 
ret = e4000_wr_regs(priv, 0x09, buf, 5);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl28xxu: depends on I2C_MUX

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl28xxu: depends on I2C_MUX
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Mar 10 15:18:55 2014 -0300

We need depend on I2C_MUX as rtl2832 demod used requires it.

All error/warnings:
warning: (DVB_USB_RTL28XXU) selects DVB_RTL2832 which has unmet direct 
dependencies (MEDIA_SUPPORT  DVB_CORE  I2C  I2C_MUX)
ERROR: i2c_add_mux_adapter [drivers/media/dvb-frontends/rtl2832.ko] undefined!
ERROR: i2c_del_mux_adapter [drivers/media/dvb-frontends/rtl2832.ko] undefined!

Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/dvb-usb-v2/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=3d0a73aaa95e0bdbf1462779811acbe0af7bb39e

diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
b/drivers/media/usb/dvb-usb-v2/Kconfig
index bfb7378..037e519 100644
--- a/drivers/media/usb/dvb-usb-v2/Kconfig
+++ b/drivers/media/usb/dvb-usb-v2/Kconfig
@@ -126,7 +126,7 @@ config DVB_USB_MXL111SF
 
 config DVB_USB_RTL28XXU
tristate Realtek RTL28xxU DVB USB support
-   depends on DVB_USB_V2
+   depends on DVB_USB_V2  I2C_MUX
select DVB_RTL2830
select DVB_RTL2832
select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl28xxu: attach SDR extension module

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl28xxu: attach SDR extension module
Author:  Antti Palosaari cr...@iki.fi
Date:Tue Sep 10 00:13:57 2013 -0300

With that extension module it supports SDR.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/dvb-usb-v2/Makefile   |1 +
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c |   20 
 2 files changed, 21 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=bcf43393579e3d4069e75a9200a87703185bcf11

diff --git a/drivers/media/usb/dvb-usb-v2/Makefile 
b/drivers/media/usb/dvb-usb-v2/Makefile
index bc38f03..7407b83 100644
--- a/drivers/media/usb/dvb-usb-v2/Makefile
+++ b/drivers/media/usb/dvb-usb-v2/Makefile
@@ -41,3 +41,4 @@ ccflags-y += -I$(srctree)/drivers/media/dvb-core
 ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
 ccflags-y += -I$(srctree)/drivers/media/tuners
 ccflags-y += -I$(srctree)/drivers/media/common
+ccflags-y += -I$(srctree)/drivers/staging/media/rtl2832u_sdr
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index db98f1c..61b420c 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -24,6 +24,7 @@
 
 #include rtl2830.h
 #include rtl2832.h
+#include rtl2832_sdr.h
 
 #include qt1010.h
 #include mt2060.h
@@ -902,6 +903,10 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
 * that to the tuner driver */
adap-fe[0]-ops.read_signal_strength =
adap-fe[0]-ops.tuner_ops.get_rf_strength;
+
+   /* attach SDR */
+   dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
+   rtl28xxu_rtl2832_fc0012_config, NULL);
return 0;
break;
case TUNER_RTL2832_FC0013:
@@ -911,8 +916,13 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
/* fc0013 also supports signal strength reading */
adap-fe[0]-ops.read_signal_strength =
adap-fe[0]-ops.tuner_ops.get_rf_strength;
+
+   /* attach SDR */
+   dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
+   rtl28xxu_rtl2832_fc0013_config, NULL);
return 0;
case TUNER_RTL2832_E4000: {
+   struct v4l2_subdev *sd;
struct e4000_config e4000_config = {
.fe = adap-fe[0],
.clock = 2880,
@@ -933,6 +943,12 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
}
 
priv-client = client;
+   sd = i2c_get_clientdata(client);
+
+   /* attach SDR */
+   dvb_attach(rtl2832_sdr_attach, adap-fe[0],
+   d-i2c_adap,
+   rtl28xxu_rtl2832_e4000_config, sd);
}
break;
case TUNER_RTL2832_FC2580:
@@ -959,6 +975,10 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
/* Use tuner to get the signal strength */
adap-fe[0]-ops.read_signal_strength =
adap-fe[0]-ops.tuner_ops.get_rf_strength;
+
+   /* attach SDR */
+   dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
+   rtl28xxu_rtl2832_r820t_config, NULL);
break;
case TUNER_RTL2832_R828D:
/* power off mn88472 demod on GPIO0 */

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] e4000: implement PLL lock v4l control

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: implement PLL lock v4l control
Author:  Antti Palosaari cr...@iki.fi
Date:Fri Feb 7 02:55:57 2014 -0300

Implement PLL lock control to get PLL lock flag status from tuner
synthesizer.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/e4000.c  |   53 -
 drivers/media/tuners/e4000_priv.h |2 +
 2 files changed, 54 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ecfb7ca3c8c48e90f2918a72e8ed7a2f989f2635

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index ae52a1f..ed2f635 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -181,6 +181,8 @@ static int e4000_init(struct dvb_frontend *fe)
if (fe-ops.i2c_gate_ctrl)
fe-ops.i2c_gate_ctrl(fe, 0);
 
+   priv-active = true;
+
return 0;
 err:
if (fe-ops.i2c_gate_ctrl)
@@ -197,6 +199,8 @@ static int e4000_sleep(struct dvb_frontend *fe)
 
dev_dbg(priv-client-dev, %s:\n, __func__);
 
+   priv-active = false;
+
if (fe-ops.i2c_gate_ctrl)
fe-ops.i2c_gate_ctrl(fe, 1);
 
@@ -512,6 +516,50 @@ err:
return ret;
 }
 
+static int e4000_pll_lock(struct dvb_frontend *fe)
+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int ret;
+   u8 u8tmp;
+
+   if (priv-active == false)
+   return 0;
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 1);
+
+   ret = e4000_rd_reg(priv, 0x07, u8tmp);
+   if (ret)
+   goto err;
+
+   priv-pll_lock-val = (u8tmp  0x01);
+err:
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   if (ret)
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+
+   return ret;
+}
+
+static int e4000_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
+{
+   struct e4000_priv *priv =
+   container_of(ctrl-handler, struct e4000_priv, hdl);
+   int ret;
+
+   switch (ctrl-id) {
+   case  V4L2_CID_RF_TUNER_PLL_LOCK:
+   ret = e4000_pll_lock(priv-fe);
+   break;
+   default:
+   ret = -EINVAL;
+   }
+
+   return ret;
+}
+
 static int e4000_s_ctrl(struct v4l2_ctrl *ctrl)
 {
struct e4000_priv *priv =
@@ -550,6 +598,7 @@ static int e4000_s_ctrl(struct v4l2_ctrl *ctrl)
 }
 
 static const struct v4l2_ctrl_ops e4000_ctrl_ops = {
+   .g_volatile_ctrl = e4000_g_volatile_ctrl,
.s_ctrl = e4000_s_ctrl,
 };
 
@@ -613,7 +662,7 @@ static int e4000_probe(struct i2c_client *client,
goto err;
 
/* Register controls */
-   v4l2_ctrl_handler_init(priv-hdl, 8);
+   v4l2_ctrl_handler_init(priv-hdl, 9);
priv-bandwidth_auto = v4l2_ctrl_new_std(priv-hdl, e4000_ctrl_ops,
V4L2_CID_RF_TUNER_BANDWIDTH_AUTO, 0, 1, 1, 1);
priv-bandwidth = v4l2_ctrl_new_std(priv-hdl, e4000_ctrl_ops,
@@ -634,6 +683,8 @@ static int e4000_probe(struct i2c_client *client,
priv-if_gain = v4l2_ctrl_new_std(priv-hdl, e4000_ctrl_ops,
V4L2_CID_RF_TUNER_IF_GAIN, 0, 54, 1, 0);
v4l2_ctrl_auto_cluster(2, priv-if_gain_auto, 0, false);
+   priv-pll_lock = v4l2_ctrl_new_std(priv-hdl, e4000_ctrl_ops,
+   V4L2_CID_RF_TUNER_PLL_LOCK,  0, 1, 1, 0);
if (priv-hdl.error) {
ret = priv-hdl.error;
dev_err(priv-client-dev, Could not initialize controls\n);
diff --git a/drivers/media/tuners/e4000_priv.h 
b/drivers/media/tuners/e4000_priv.h
index e2ad54f..3ddd980 100644
--- a/drivers/media/tuners/e4000_priv.h
+++ b/drivers/media/tuners/e4000_priv.h
@@ -30,6 +30,7 @@ struct e4000_priv {
u32 clock;
struct dvb_frontend *fe;
struct v4l2_subdev sd;
+   bool active;
 
/* Controls */
struct v4l2_ctrl_handler hdl;
@@ -41,6 +42,7 @@ struct e4000_priv {
struct v4l2_ctrl *mixer_gain;
struct v4l2_ctrl *if_gain_auto;
struct v4l2_ctrl *if_gain;
+   struct v4l2_ctrl *pll_lock;
 };
 
 struct e4000_pll {

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl28xxu: fix switch-case style issue

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl28xxu: fix switch-case style issue
Author:  Antti Palosaari cr...@iki.fi
Date:Mon Feb 3 23:07:21 2014 -0300

Use break, not return, for every case.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/dvb-usb-v2/rtl28xxu.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=55cdb7ddf1a6aeae198c0903ff74008c2d2ea937

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 61b420c..f51949e 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -907,7 +907,6 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
/* attach SDR */
dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
rtl28xxu_rtl2832_fc0012_config, NULL);
-   return 0;
break;
case TUNER_RTL2832_FC0013:
fe = dvb_attach(fc0013_attach, adap-fe[0],
@@ -920,7 +919,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
/* attach SDR */
dvb_attach(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
rtl28xxu_rtl2832_fc0013_config, NULL);
-   return 0;
+   break;
case TUNER_RTL2832_E4000: {
struct v4l2_subdev *sd;
struct e4000_config e4000_config = {

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] e4000: implement controls via v4l2 control framework

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: implement controls via v4l2 control framework
Author:  Antti Palosaari cr...@iki.fi
Date:Sun Jan 26 21:02:53 2014 -0300

Implement gain and bandwidth controls using v4l2 control framework.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/Kconfig  |2 +-
 drivers/media/tuners/e4000.c  |  217 -
 drivers/media/tuners/e4000_priv.h |   77 +
 3 files changed, 291 insertions(+), 5 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=adaa616ffb697f00db9b4ccb638c5e9e719dbb7f

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index ba2e365..3b95392 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -203,7 +203,7 @@ config MEDIA_TUNER_TDA18212
 
 config MEDIA_TUNER_E4000
tristate Elonics E4000 silicon tuner
-   depends on MEDIA_SUPPORT  I2C
+   depends on MEDIA_SUPPORT  I2C  VIDEO_V4L2
default m if !MEDIA_SUBDRV_AUTOSELECT
help
  Elonics E4000 silicon tuner driver.
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 0153169..3a03b02 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -385,6 +385,178 @@ static int e4000_get_if_frequency(struct dvb_frontend 
*fe, u32 *frequency)
return 0;
 }
 
+static int e4000_set_lna_gain(struct dvb_frontend *fe)
+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int ret;
+   u8 u8tmp;
+   dev_dbg(priv-client-dev, %s: lna auto=%d-%d val=%d-%d\n,
+   __func__, priv-lna_gain_auto-cur.val,
+   priv-lna_gain_auto-val, priv-lna_gain-cur.val,
+   priv-lna_gain-val);
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 1);
+
+   if (priv-lna_gain_auto-val  priv-if_gain_auto-cur.val)
+   u8tmp = 0x17;
+   else if (priv-lna_gain_auto-val)
+   u8tmp = 0x19;
+   else if (priv-if_gain_auto-cur.val)
+   u8tmp = 0x16;
+   else
+   u8tmp = 0x10;
+
+   ret = e4000_wr_reg(priv, 0x1a, u8tmp);
+   if (ret)
+   goto err;
+
+   if (priv-lna_gain_auto-val == false) {
+   ret = e4000_wr_reg(priv, 0x14, priv-lna_gain-val);
+   if (ret)
+   goto err;
+   }
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   return 0;
+err:
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+   return ret;
+}
+
+static int e4000_set_mixer_gain(struct dvb_frontend *fe)
+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int ret;
+   u8 u8tmp;
+   dev_dbg(priv-client-dev, %s: mixer auto=%d-%d val=%d-%d\n,
+   __func__, priv-mixer_gain_auto-cur.val,
+   priv-mixer_gain_auto-val, priv-mixer_gain-cur.val,
+   priv-mixer_gain-val);
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 1);
+
+   if (priv-mixer_gain_auto-val)
+   u8tmp = 0x15;
+   else
+   u8tmp = 0x14;
+
+   ret = e4000_wr_reg(priv, 0x20, u8tmp);
+   if (ret)
+   goto err;
+
+   if (priv-mixer_gain_auto-val == false) {
+   ret = e4000_wr_reg(priv, 0x15, priv-mixer_gain-val);
+   if (ret)
+   goto err;
+   }
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   return 0;
+err:
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 0);
+
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
+   return ret;
+}
+
+static int e4000_set_if_gain(struct dvb_frontend *fe)
+{
+   struct e4000_priv *priv = fe-tuner_priv;
+   int ret;
+   u8 buf[2];
+   u8 u8tmp;
+   dev_dbg(priv-client-dev, %s: if auto=%d-%d val=%d-%d\n,
+   __func__, priv-if_gain_auto-cur.val,
+   priv-if_gain_auto-val, priv-if_gain-cur.val,
+   priv-if_gain-val);
+
+   if (fe-ops.i2c_gate_ctrl)
+   fe-ops.i2c_gate_ctrl(fe, 1);
+
+   if (priv-if_gain_auto-val  priv-lna_gain_auto-cur.val)
+   u8tmp = 0x17;
+   else if (priv-lna_gain_auto-cur.val)
+   u8tmp = 0x19;
+   else if (priv-if_gain_auto-val)
+   u8tmp = 0x16;
+   else
+   u8tmp = 0x10;
+
+   ret = e4000_wr_reg(priv, 0x1a, u8tmp);
+   if (ret)
+   goto err;
+
+   if (priv-if_gain_auto-val == false) {
+   buf[0] = 

[git:media_tree/master] [media] rtl2832_sdr: Realtek RTL2832 SDR driver module

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl2832_sdr: Realtek RTL2832 SDR driver module
Author:  Antti Palosaari cr...@iki.fi
Date:Tue Sep 10 00:07:56 2013 -0300

Implement SDR driver for Realtek RTL2832U chip as a DVB extension
module. SDR module is attached by DVB USB RTL28XXU driver as a DVB
SEC (satellite equipment controller) module. Abusing unused SEC here
has no harm as that is DVB-T only frontend.

SDR functionality is provided by RTL2832 DVB-T demodulator. I suspect
it is originally planned for DAB and FM, but it could be abused general
SDR, due to modern silicon tuners that has wide frequency range and a
lot of configurable parameters (filters, gains, ...).

http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/44461

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/staging/media/Kconfig|2 +
 drivers/staging/media/Makefile   |2 +
 drivers/staging/media/rtl2832u_sdr/Kconfig   |7 +
 drivers/staging/media/rtl2832u_sdr/Makefile  |6 +
 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c | 1471 ++
 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.h |   54 +
 6 files changed, 1542 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=771138920eafa399f68d3492c8a75dfeea23474b

diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
index 22b0c9d..a9f2e63 100644
--- a/drivers/staging/media/Kconfig
+++ b/drivers/staging/media/Kconfig
@@ -41,6 +41,8 @@ source drivers/staging/media/solo6x10/Kconfig
 
 source drivers/staging/media/omap4iss/Kconfig
 
+source drivers/staging/media/rtl2832u_sdr/Kconfig
+
 # Keep LIRC at the end, as it has sub-menus
 source drivers/staging/media/lirc/Kconfig
 
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
index bedc62a..8e2c5d2 100644
--- a/drivers/staging/media/Makefile
+++ b/drivers/staging/media/Makefile
@@ -11,3 +11,5 @@ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/
 obj-$(CONFIG_USB_SN9C102)   += sn9c102/
 obj-$(CONFIG_VIDEO_OMAP2)   += omap24xx/
 obj-$(CONFIG_VIDEO_TCM825X) += omap24xx/
+obj-$(CONFIG_DVB_RTL2832_SDR)  += rtl2832u_sdr/
+
diff --git a/drivers/staging/media/rtl2832u_sdr/Kconfig 
b/drivers/staging/media/rtl2832u_sdr/Kconfig
new file mode 100644
index 000..3ede5fe
--- /dev/null
+++ b/drivers/staging/media/rtl2832u_sdr/Kconfig
@@ -0,0 +1,7 @@
+config DVB_RTL2832_SDR
+   tristate Realtek RTL2832 SDR
+   depends on USB  DVB_CORE  I2C  VIDEO_V4L2  DVB_USB_RTL28XXU
+   select DVB_RTL2832
+   select VIDEOBUF2_VMALLOC
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+
diff --git a/drivers/staging/media/rtl2832u_sdr/Makefile 
b/drivers/staging/media/rtl2832u_sdr/Makefile
new file mode 100644
index 000..7e00a0d
--- /dev/null
+++ b/drivers/staging/media/rtl2832u_sdr/Makefile
@@ -0,0 +1,6 @@
+obj-$(CONFIG_DVB_RTL2832_SDR) += rtl2832_sdr.o
+
+ccflags-y += -Idrivers/media/dvb-core
+ccflags-y += -Idrivers/media/dvb-frontends
+ccflags-y += -Idrivers/media/tuners
+ccflags-y += -Idrivers/media/usb/dvb-usb-v2
diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
new file mode 100644
index 000..86fffcf
--- /dev/null
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -0,0 +1,1471 @@
+/*
+ * Realtek RTL2832U SDR driver
+ *
+ * Copyright (C) 2013 Antti Palosaari cr...@iki.fi
+ *
+ *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.
+ *
+ *This program is distributed in the hope that it will be useful,
+ *but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *GNU General Public License for more details.
+ *
+ *You should have received a copy of the GNU General Public License along
+ *with this program; if not, write to the Free Software Foundation, Inc.,
+ *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * GNU Radio plugin gr-kernel for device usage will be on:
+ * http://git.linuxtv.org/anttip/gr-kernel.git
+ *
+ */
+
+#include dvb_frontend.h
+#include rtl2832_sdr.h
+#include dvb_usb.h
+
+#include media/v4l2-device.h
+#include media/v4l2-ioctl.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-event.h
+#include media/videobuf2-vmalloc.h
+
+#include linux/jiffies.h
+#include linux/math64.h
+
+#define MAX_BULK_BUFS(10)
+#define BULK_BUFFER_SIZE (128 * 512)
+
+static const struct v4l2_frequency_band bands_adc[] = {
+   {
+   .tuner = 0,
+   .type = 

[git:media_tree/master] [media] e4000: convert to Regmap API

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: convert to Regmap API
Author:  Antti Palosaari cr...@iki.fi
Date:Sat Feb 8 06:20:35 2014 -0300

That comes possible after driver was converted to kernel I2C model
(I2C binding  proper I2C client with no gate control hack). All
nasty low level I2C routines are now covered by regmap.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/Kconfig  |1 +
 drivers/media/tuners/e4000.c  |  212 +++-
 drivers/media/tuners/e4000_priv.h |2 +
 3 files changed, 68 insertions(+), 147 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=bd428bbc7527d4ea195712598c1c252ebb4554ae

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 3b95392..85c0d96 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -204,6 +204,7 @@ config MEDIA_TUNER_TDA18212
 config MEDIA_TUNER_E4000
tristate Elonics E4000 silicon tuner
depends on MEDIA_SUPPORT  I2C  VIDEO_V4L2
+   select REGMAP_I2C
default m if !MEDIA_SUBDRV_AUTOSELECT
help
  Elonics E4000 silicon tuner driver.
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 29f73f6..f382b90 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -21,97 +21,6 @@
 #include e4000_priv.h
 #include linux/math64.h
 
-/* Max transfer size done by I2C transfer functions */
-#define MAX_XFER_SIZE  64
-
-/* write multiple registers */
-static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len)
-{
-   int ret;
-   u8 buf[MAX_XFER_SIZE];
-   struct i2c_msg msg[1] = {
-   {
-   .addr = priv-client-addr,
-   .flags = 0,
-   .len = 1 + len,
-   .buf = buf,
-   }
-   };
-
-   if (1 + len  sizeof(buf)) {
-   dev_warn(priv-client-dev,
-%s: i2c wr reg=%04x: len=%d is too big!\n,
-KBUILD_MODNAME, reg, len);
-   return -EINVAL;
-   }
-
-   buf[0] = reg;
-   memcpy(buf[1], val, len);
-
-   ret = i2c_transfer(priv-client-adapter, msg, 1);
-   if (ret == 1) {
-   ret = 0;
-   } else {
-   dev_warn(priv-client-dev,
-   %s: i2c wr failed=%d reg=%02x len=%d\n,
-   KBUILD_MODNAME, ret, reg, len);
-   ret = -EREMOTEIO;
-   }
-   return ret;
-}
-
-/* read multiple registers */
-static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len)
-{
-   int ret;
-   u8 buf[MAX_XFER_SIZE];
-   struct i2c_msg msg[2] = {
-   {
-   .addr = priv-client-addr,
-   .flags = 0,
-   .len = 1,
-   .buf = reg,
-   }, {
-   .addr = priv-client-addr,
-   .flags = I2C_M_RD,
-   .len = len,
-   .buf = buf,
-   }
-   };
-
-   if (len  sizeof(buf)) {
-   dev_warn(priv-client-dev,
-%s: i2c rd reg=%04x: len=%d is too big!\n,
-KBUILD_MODNAME, reg, len);
-   return -EINVAL;
-   }
-
-   ret = i2c_transfer(priv-client-adapter, msg, 2);
-   if (ret == 2) {
-   memcpy(val, buf, len);
-   ret = 0;
-   } else {
-   dev_warn(priv-client-dev,
-   %s: i2c rd failed=%d reg=%02x len=%d\n,
-   KBUILD_MODNAME, ret, reg, len);
-   ret = -EREMOTEIO;
-   }
-
-   return ret;
-}
-
-/* write single register */
-static int e4000_wr_reg(struct e4000_priv *priv, u8 reg, u8 val)
-{
-   return e4000_wr_regs(priv, reg, val, 1);
-}
-
-/* read single register */
-static int e4000_rd_reg(struct e4000_priv *priv, u8 reg, u8 *val)
-{
-   return e4000_rd_regs(priv, reg, val, 1);
-}
-
 static int e4000_init(struct dvb_frontend *fe)
 {
struct e4000_priv *priv = fe-tuner_priv;
@@ -120,58 +29,58 @@ static int e4000_init(struct dvb_frontend *fe)
dev_dbg(priv-client-dev, %s:\n, __func__);
 
/* dummy I2C to ensure I2C wakes up */
-   ret = e4000_wr_reg(priv, 0x02, 0x40);
+   ret = regmap_write(priv-regmap, 0x02, 0x40);
 
/* reset */
-   ret = e4000_wr_reg(priv, 0x00, 0x01);
+   ret = regmap_write(priv-regmap, 0x00, 0x01);
if (ret  0)
goto err;
 
/* disable output clock */
-   ret = e4000_wr_reg(priv, 0x06, 0x00);
+   ret = regmap_write(priv-regmap, 0x06, 0x00);
 

[git:media_tree/master] [media] e4000: get rid of DVB i2c_gate_ctrl()

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: get rid of DVB i2c_gate_ctrl()
Author:  Antti Palosaari cr...@iki.fi
Date:Sat Feb 8 04:21:10 2014 -0300

Gate control is now implemented by rtl2832 I2C adapter so we do not
need proprietary DVB i2c_gate_ctrl() anymore.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/e4000.c |  103 +-
 1 files changed, 21 insertions(+), 82 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=1c73fc6bb542859a7f37bfc2d34f21da8a51bd30

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index ed2f635..29f73f6 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -119,9 +119,6 @@ static int e4000_init(struct dvb_frontend *fe)
 
dev_dbg(priv-client-dev, %s:\n, __func__);
 
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 1);
-
/* dummy I2C to ensure I2C wakes up */
ret = e4000_wr_reg(priv, 0x02, 0x40);
 
@@ -178,17 +175,11 @@ static int e4000_init(struct dvb_frontend *fe)
if (ret  0)
goto err;
 
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
-
priv-active = true;
-
-   return 0;
 err:
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
+   if (ret)
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
 
-   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
return ret;
 }
 
@@ -201,22 +192,13 @@ static int e4000_sleep(struct dvb_frontend *fe)
 
priv-active = false;
 
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 1);
-
ret = e4000_wr_reg(priv, 0x00, 0x00);
if (ret  0)
goto err;
-
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
-
-   return 0;
 err:
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
+   if (ret)
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
 
-   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
return ret;
 }
 
@@ -233,9 +215,6 @@ static int e4000_set_params(struct dvb_frontend *fe)
__func__, c-delivery_system, c-frequency,
c-bandwidth_hz);
 
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 1);
-
/* gain control manual */
ret = e4000_wr_reg(priv, 0x1a, 0x00);
if (ret  0)
@@ -361,16 +340,10 @@ static int e4000_set_params(struct dvb_frontend *fe)
ret = e4000_wr_reg(priv, 0x1a, 0x17);
if (ret  0)
goto err;
-
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
-
-   return 0;
 err:
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
+   if (ret)
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
 
-   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
return ret;
 }
 
@@ -390,14 +363,12 @@ static int e4000_set_lna_gain(struct dvb_frontend *fe)
struct e4000_priv *priv = fe-tuner_priv;
int ret;
u8 u8tmp;
+
dev_dbg(priv-client-dev, %s: lna auto=%d-%d val=%d-%d\n,
__func__, priv-lna_gain_auto-cur.val,
priv-lna_gain_auto-val, priv-lna_gain-cur.val,
priv-lna_gain-val);
 
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 1);
-
if (priv-lna_gain_auto-val  priv-if_gain_auto-cur.val)
u8tmp = 0x17;
else if (priv-lna_gain_auto-val)
@@ -416,16 +387,10 @@ static int e4000_set_lna_gain(struct dvb_frontend *fe)
if (ret)
goto err;
}
-
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
-
-   return 0;
 err:
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 0);
+   if (ret)
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
 
-   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
return ret;
 }
 
@@ -434,14 +399,12 @@ static int e4000_set_mixer_gain(struct dvb_frontend *fe)
struct e4000_priv *priv = fe-tuner_priv;
int ret;
u8 u8tmp;
+
dev_dbg(priv-client-dev, %s: mixer auto=%d-%d val=%d-%d\n,
__func__, priv-mixer_gain_auto-cur.val,
priv-mixer_gain_auto-val, priv-mixer_gain-cur.val,
priv-mixer_gain-val);
 
-   if (fe-ops.i2c_gate_ctrl)
-   fe-ops.i2c_gate_ctrl(fe, 1);
-
if (priv-mixer_gain_auto-val)
u8tmp = 0x15;
else
@@ -456,16 +419,10 

[git:media_tree/master] [media] rtl28xxu: constify demod config structs

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl28xxu: constify demod config structs
Author:  Antti Palosaari cr...@iki.fi
Date:Sat Oct 12 23:35:35 2013 -0300

Optimize a little bit from data to text.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/dvb-usb-v2/rtl28xxu.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=e8b4668937c4892685b970a94de851c5fdd27571

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index ae07740..db98f1c 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -516,7 +516,7 @@ err:
return ret;
 }
 
-static struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = {
+static const struct rtl2830_config rtl28xxu_rtl2830_mt2060_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.ts_mode = 0,
@@ -527,7 +527,7 @@ static struct rtl2830_config rtl28xxu_rtl2830_mt2060_config 
= {
 
 };
 
-static struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = {
+static const struct rtl2830_config rtl28xxu_rtl2830_qt1010_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.ts_mode = 0,
@@ -537,7 +537,7 @@ static struct rtl2830_config rtl28xxu_rtl2830_qt1010_config 
= {
.agc_targ_val = 0x2d,
 };
 
-static struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = {
+static const struct rtl2830_config rtl28xxu_rtl2830_mxl5005s_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.ts_mode = 0,
@@ -551,7 +551,7 @@ static int rtl2831u_frontend_attach(struct dvb_usb_adapter 
*adap)
 {
struct dvb_usb_device *d = adap_to_d(adap);
struct rtl28xxu_priv *priv = d_to_priv(d);
-   struct rtl2830_config *rtl2830_config;
+   const struct rtl2830_config *rtl2830_config;
int ret;
 
dev_dbg(d-udev-dev, %s:\n, __func__);
@@ -586,31 +586,31 @@ err:
return ret;
 }
 
-static struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
+static const struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.tuner = TUNER_RTL2832_FC0012
 };
 
-static struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
+static const struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.tuner = TUNER_RTL2832_FC0013
 };
 
-static struct rtl2832_config rtl28xxu_rtl2832_tua9001_config = {
+static const struct rtl2832_config rtl28xxu_rtl2832_tua9001_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.tuner = TUNER_RTL2832_TUA9001,
 };
 
-static struct rtl2832_config rtl28xxu_rtl2832_e4000_config = {
+static const struct rtl2832_config rtl28xxu_rtl2832_e4000_config = {
.i2c_addr = 0x10, /* 0x20 */
.xtal = 2880,
.tuner = TUNER_RTL2832_E4000,
 };
 
-static struct rtl2832_config rtl28xxu_rtl2832_r820t_config = {
+static const struct rtl2832_config rtl28xxu_rtl2832_r820t_config = {
.i2c_addr = 0x10,
.xtal = 2880,
.tuner = TUNER_RTL2832_R820T,
@@ -734,7 +734,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter 
*adap)
int ret;
struct dvb_usb_device *d = adap_to_d(adap);
struct rtl28xxu_priv *priv = d_to_priv(d);
-   struct rtl2832_config *rtl2832_config;
+   const struct rtl2832_config *rtl2832_config;
 
dev_dbg(d-udev-dev, %s:\n, __func__);
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] e4000: convert DVB tuner to I2C driver model

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: convert DVB tuner to I2C driver model
Author:  Antti Palosaari cr...@iki.fi
Date:Tue Oct 15 19:22:45 2013 -0300

Driver conversion from proprietary DVB tuner model to more
general I2C driver model.

Cc: Jean Delvare kh...@linux-fr.org
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/e4000.c|  115 +++
 drivers/media/tuners/e4000.h|   21 ++
 drivers/media/tuners/e4000_priv.h   |5 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c |   56 ---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |1 +
 5 files changed, 126 insertions(+), 72 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=28fd31f82dccfcfcb4c80fd916d4caf875c04d90

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 40c1da7..0153169 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -31,7 +31,7 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 
*val, int len)
u8 buf[MAX_XFER_SIZE];
struct i2c_msg msg[1] = {
{
-   .addr = priv-cfg-i2c_addr,
+   .addr = priv-client-addr,
.flags = 0,
.len = 1 + len,
.buf = buf,
@@ -39,7 +39,7 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 
*val, int len)
};
 
if (1 + len  sizeof(buf)) {
-   dev_warn(priv-i2c-dev,
+   dev_warn(priv-client-dev,
 %s: i2c wr reg=%04x: len=%d is too big!\n,
 KBUILD_MODNAME, reg, len);
return -EINVAL;
@@ -48,11 +48,11 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, 
u8 *val, int len)
buf[0] = reg;
memcpy(buf[1], val, len);
 
-   ret = i2c_transfer(priv-i2c, msg, 1);
+   ret = i2c_transfer(priv-client-adapter, msg, 1);
if (ret == 1) {
ret = 0;
} else {
-   dev_warn(priv-i2c-dev,
+   dev_warn(priv-client-dev,
%s: i2c wr failed=%d reg=%02x len=%d\n,
KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
@@ -67,12 +67,12 @@ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, 
u8 *val, int len)
u8 buf[MAX_XFER_SIZE];
struct i2c_msg msg[2] = {
{
-   .addr = priv-cfg-i2c_addr,
+   .addr = priv-client-addr,
.flags = 0,
.len = 1,
.buf = reg,
}, {
-   .addr = priv-cfg-i2c_addr,
+   .addr = priv-client-addr,
.flags = I2C_M_RD,
.len = len,
.buf = buf,
@@ -80,18 +80,18 @@ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, 
u8 *val, int len)
};
 
if (len  sizeof(buf)) {
-   dev_warn(priv-i2c-dev,
+   dev_warn(priv-client-dev,
 %s: i2c rd reg=%04x: len=%d is too big!\n,
 KBUILD_MODNAME, reg, len);
return -EINVAL;
}
 
-   ret = i2c_transfer(priv-i2c, msg, 2);
+   ret = i2c_transfer(priv-client-adapter, msg, 2);
if (ret == 2) {
memcpy(val, buf, len);
ret = 0;
} else {
-   dev_warn(priv-i2c-dev,
+   dev_warn(priv-client-dev,
%s: i2c rd failed=%d reg=%02x len=%d\n,
KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
@@ -117,7 +117,7 @@ static int e4000_init(struct dvb_frontend *fe)
struct e4000_priv *priv = fe-tuner_priv;
int ret;
 
-   dev_dbg(priv-i2c-dev, %s:\n, __func__);
+   dev_dbg(priv-client-dev, %s:\n, __func__);
 
if (fe-ops.i2c_gate_ctrl)
fe-ops.i2c_gate_ctrl(fe, 1);
@@ -186,7 +186,7 @@ err:
if (fe-ops.i2c_gate_ctrl)
fe-ops.i2c_gate_ctrl(fe, 0);
 
-   dev_dbg(priv-i2c-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(priv-client-dev, %s: failed=%d\n, __func__, ret);
return ret;
 }
 
@@ -195,7 +195,7 @@ static int e4000_sleep(struct dvb_frontend *fe)
struct e4000_priv *priv = fe-tuner_priv;
int ret;
 
-   dev_dbg(priv-i2c-dev, %s:\n, __func__);
+   dev_dbg(priv-client-dev, %s:\n, __func__);
 
if (fe-ops.i2c_gate_ctrl)
fe-ops.i2c_gate_ctrl(fe, 1);
@@ -212,7 +212,7 @@ err:
if (fe-ops.i2c_gate_ctrl)
fe-ops.i2c_gate_ctrl(fe, 0);
 
-   dev_dbg(priv-i2c-dev, %s: failed=%d\n, 

[git:media_tree/master] [media] em28xx-audio: make sure audio is unmuted on open()

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] em28xx-audio: make sure audio is unmuted on open()
Author:  Frank Schaefer fschaefer@googlemail.com
Date:Fri Jan 17 14:18:43 2014 -0300

In all cases, when the first capture is called, we need to
call the code that unmutes the volume.

Signed-off-by: Frank Schäfer fschaefer@googlemail.com
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/em28xx/em28xx-audio.c |   42 --
 1 files changed, 22 insertions(+), 20 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ba35ca07080268af1badeb47de0f9eff28126339

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index f75c0a5..c1937ea 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -273,26 +273,28 @@ static int snd_em28xx_capture_open(struct 
snd_pcm_substream *substream)
mutex_lock(dev-lock);
 
runtime-hw = snd_em28xx_hw_capture;
-   if ((dev-alt == 0 || dev-is_audio_only)  dev-adev.users == 0) {
-   if (dev-is_audio_only)
-   /* vendor audio is on a separate interface */
-   dev-alt = 1;
-   else
-   /* vendor audio is on the same interface as video */
-   dev-alt = 7;
-   /*
-* FIXME: The intention seems to be to select the alt
-* setting with the largest wMaxPacketSize for the video
-* endpoint.
-* At least dev-alt should be used instead, but we
-* should probably not touch it at all if it is
-* already 0, because wMaxPacketSize of the audio
-* endpoints seems to be the same for all.
-*/
-
-   dprintk(changing alternate number on interface %d to %d\n,
-   dev-ifnum, dev-alt);
-   usb_set_interface(dev-udev, dev-ifnum, dev-alt);
+
+   if (dev-adev.users == 0) {
+   if (dev-alt == 0 || dev-is_audio_only) {
+   if (dev-is_audio_only)
+   /* audio is on a separate interface */
+   dev-alt = 1;
+   else
+   /* audio is on the same interface as video */
+   dev-alt = 7;
+   /*
+* FIXME: The intention seems to be to select
+* the alt setting with the largest
+* wMaxPacketSize for the video endpoint.
+* At least dev-alt should be used instead, but
+* we should probably not touch it at all if it
+* is already 0, because wMaxPacketSize of the
+* audio endpoints seems to be the same for all.
+*/
+   dprintk(changing alternate number on interface %d to 
%d\n,
+   dev-ifnum, dev-alt);
+   usb_set_interface(dev-udev, dev-ifnum, dev-alt);
+   }
 
/* Sets volume, mute, etc */
dev-mute = 0;

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

[git:v4l-utils/master] v4l2-compliance: add test setting all enumerated timings.

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-compliance: add test setting all enumerated timings.
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 15:12:42 2014 +0100

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

 utils/v4l2-compliance/v4l2-test-io-config.cpp |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=cb239e955a2ee8f8fcd9ef7853c8de13aaf9b695

diff --git a/utils/v4l2-compliance/v4l2-test-io-config.cpp 
b/utils/v4l2-compliance/v4l2-test-io-config.cpp
index df2714d..da29a03 100644
--- a/utils/v4l2-compliance/v4l2-test-io-config.cpp
+++ b/utils/v4l2-compliance/v4l2-test-io-config.cpp
@@ -154,10 +154,19 @@ static int checkTimings(struct node *node, bool 
has_timings, bool is_input)
 {
struct v4l2_enum_dv_timings enumtimings;
struct v4l2_dv_timings timings;
-   int ret;
+   struct v4l2_format fmt;
+   bool is_mplane = node-caps  (V4L2_CAP_VIDEO_CAPTURE_MPLANE |
+  V4L2_CAP_VIDEO_OUTPUT_MPLANE |
+  V4L2_CAP_VIDEO_M2M_MPLANE);
+   unsigned type;
unsigned i;
+   int ret;
 
memset(timings, 0xff, sizeof(timings));
+   if (node-can_capture)
+   type = is_mplane ? V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE : 
V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   else
+   type = is_mplane ? V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : 
V4L2_BUF_TYPE_VIDEO_OUTPUT;
ret = doioctl(node, VIDIOC_G_DV_TIMINGS, timings);
if (ret  has_timings)
return fail(TIMINGS cap set, but could not get current 
timings\n);
@@ -177,6 +186,16 @@ static int checkTimings(struct node *node, bool 
has_timings, bool is_input)
return fail(reserved not zeroed\n);
if (enumtimings.index != i)
return fail(index changed!\n);
+   fail_on_test(doioctl(node, VIDIOC_S_DV_TIMINGS, 
enumtimings.timings));
+   fmt.type = type;
+   fail_on_test(doioctl(node, VIDIOC_G_FMT, fmt));
+
+   unsigned field = is_mplane ? fmt.fmt.pix_mp.field : 
fmt.fmt.pix.field;
+
+   if (enumtimings.timings.bt.interlaced)
+   fail_on_test(field == V4L2_FIELD_NONE);
+   else
+   fail_on_test(field != V4L2_FIELD_NONE);
}
if (i == 0  has_timings)
return fail(TIMINGS cap set, but no timings can be 
enumerated\n);
@@ -184,6 +203,8 @@ static int checkTimings(struct node *node, bool 
has_timings, bool is_input)
return fail(TIMINGS cap was not set, but timings can be 
enumerated\n);
if (ret != ENOTTY  ret != ENODATA  !has_timings)
return fail(TIMINGS cap not set, but got wrong error code for 
enumeration (%d)\n, ret);
+   if (has_timings)
+   fail_on_test(doioctl(node, VIDIOC_S_DV_TIMINGS, timings));
ret = doioctl(node, VIDIOC_QUERY_DV_TIMINGS, timings);
if (!ret  !has_timings)
return fail(TIMINGS cap was not set, but could still query 
timings\n);

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:v4l-utils/master] v4l2-compliance: add G/S_EDID tests.

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-compliance: add G/S_EDID tests.
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Fri Mar 14 15:56:05 2014 +0100

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

 utils/v4l2-compliance/v4l2-compliance.cpp |1 +
 utils/v4l2-compliance/v4l2-compliance.h   |1 +
 utils/v4l2-compliance/v4l2-test-io-config.cpp |   98 -
 3 files changed, 99 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=0a8144612c3fb180d984dd1d05e1618f10c62cc1

diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp 
b/utils/v4l2-compliance/v4l2-compliance.cpp
index 285ddbd..34ef0d3 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -824,6 +824,7 @@ int main(int argc, char **argv)
printf(\ttest VIDIOC_ENUM/G/S/QUERY_STD: %s\n, ok(testStd(node)));
printf(\ttest VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: %s\n, 
ok(testTimings(node)));
printf(\ttest VIDIOC_DV_TIMINGS_CAP: %s\n, ok(testTimingsCap(node)));
+   printf(\ttest VIDIOC_G/S_EDID: %s\n, ok(testEdid(node)));
printf(\n);
 
/* Format ioctls */
diff --git a/utils/v4l2-compliance/v4l2-compliance.h 
b/utils/v4l2-compliance/v4l2-compliance.h
index 2906f49..0802298 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -186,6 +186,7 @@ int testJpegComp(struct node *node);
 int testStd(struct node *node);
 int testTimings(struct node *node);
 int testTimingsCap(struct node *node);
+int testEdid(struct node *node);
 
 // Format ioctl tests
 int testEnumFormats(struct node *node);
diff --git a/utils/v4l2-compliance/v4l2-test-io-config.cpp 
b/utils/v4l2-compliance/v4l2-test-io-config.cpp
index da29a03..eeb2877 100644
--- a/utils/v4l2-compliance/v4l2-test-io-config.cpp
+++ b/utils/v4l2-compliance/v4l2-test-io-config.cpp
@@ -234,7 +234,7 @@ int testTimings(struct node *node)
if (input.capabilities  V4L2_IN_CAP_DV_TIMINGS)
has_timings = true;
if (checkTimings(node, input.capabilities  
V4L2_IN_CAP_DV_TIMINGS, true))
-   return fail(Timings failed for input %d.\n, i);
+   return fail(Timings check failed for input %d.\n, i);
}
 
for (o = 0; o  node-outputs; o++) {
@@ -318,3 +318,99 @@ int testTimingsCap(struct node *node)
}
return has_timings ? 0 : ENOTTY;
 }
+
+static int checkEdid(struct node *node, unsigned pad, bool is_input)
+{
+   struct v4l2_edid edid;
+   __u8 data[256 * 128];
+   unsigned blocks;
+   int ret;
+
+   memset(edid.reserved, 0xff, sizeof(edid.reserved));
+   edid.pad = pad;
+   edid.start_block = 0;
+   edid.blocks = 0;
+   edid.edid = (__u8 *)0xdeadbeef;
+   ret = doioctl(node, VIDIOC_G_EDID, edid);
+   if (ret == ENOTTY) {
+   memset(edid, 0, sizeof(edid));
+   edid.pad = pad;
+   fail_on_test(doioctl(node, VIDIOC_S_EDID, edid) != ENOTTY);
+   return 0;
+   }
+   fail_on_test(ret);
+   fail_on_test(check_0(edid.reserved, sizeof(edid.reserved)));
+   fail_on_test(edid.start_block);
+   fail_on_test(edid.blocks  256);
+   blocks = edid.blocks;
+   edid.edid = data;
+   fail_on_test(doioctl(node, VIDIOC_G_EDID, edid));
+   fail_on_test(edid.blocks != blocks);
+   edid.start_block = edid.blocks ? edid.blocks : 1;
+   ret = doioctl(node, VIDIOC_G_EDID, edid);
+   fail_on_test(ret != EINVAL  ret != ENODATA);
+   if (blocks  1) {
+   edid.start_block = 1;
+   edid.blocks = blocks;
+   fail_on_test(doioctl(node, VIDIOC_G_EDID, edid));
+   fail_on_test(edid.blocks != blocks - 1);
+   }
+   edid.start_block = 0;
+   edid.blocks = 256;
+   ret = doioctl(node, VIDIOC_G_EDID, edid);
+   fail_on_test(ret  ret != ENODATA);
+   if (!ret)
+   fail_on_test(edid.blocks != blocks);
+
+   memset(edid.reserved, 0xff, sizeof(edid.reserved));
+   edid.blocks = blocks;
+   ret = doioctl(node, VIDIOC_S_EDID, edid);
+   if (ret == ENOTTY)
+   return 0;
+   fail_on_test(!is_input);
+   fail_on_test(ret);
+   fail_on_test(check_0(edid.reserved, sizeof(edid.reserved)));
+   return 0;
+}
+
+int testEdid(struct node *node)
+{
+   bool has_edid = false;
+   unsigned i, o;
+   int ret;
+
+   for (i = 0; i  node-inputs; i++) {
+   struct v4l2_input input;
+
+   input.index = i;
+   ret = doioctl(node, VIDIOC_ENUMINPUT, input);
+   if (ret)
+   return fail(could not enumerate input %d?!\n, i);
+   ret = doioctl(node, VIDIOC_S_INPUT, input.index);
+

[git:v4l-utils/master] libv4lconvert: remove broken ALTERNATE handling

2014-03-14 Thread Hans Verkuil
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: libv4lconvert: remove broken ALTERNATE handling
Author:  Hans Verkuil hans.verk...@cisco.com
Date:Tue Mar 4 00:05:23 2014 +0100

The V4L2 specification used to say that if field == V4L2_FIELD_ALTERNATE, the
height would have to be divided by two. This is incorrect, the height is that of
a single field. This has been corrected in the spec, now this code in 
libv4lconvert
needs to be removed as well.

Tested with both bttv and saa7146, the only two drivers supporting 
FIELD_ALTERNATE
today.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com

 lib/libv4lconvert/libv4lconvert.c |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=91a70169c4c6b2f45fb7fc7893becb96f5f7b894

diff --git a/lib/libv4lconvert/libv4lconvert.c 
b/lib/libv4lconvert/libv4lconvert.c
index e2afc27..df06b75 100644
--- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c
@@ -1328,13 +1328,6 @@ int v4lconvert_convert(struct v4lconvert_data *data,
return to_copy;
}
 
-   /* When field is V4L2_FIELD_ALTERNATE, each buffer only contains half 
the
-  lines */
-   if (my_src_fmt.fmt.pix.field == V4L2_FIELD_ALTERNATE) {
-   my_src_fmt.fmt.pix.height /= 2;
-   my_dest_fmt.fmt.pix.height /= 2;
-   }
-
/* sanity check, is the dest buffer large enough? */
switch (my_dest_fmt.fmt.pix.pixelformat) {
case V4L2_PIX_FMT_RGB24:

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] af9033: implement PID filter

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] af9033: implement PID filter
Author:  Antti Palosaari cr...@iki.fi
Date:Thu Feb 13 15:40:59 2014 -0300

Implement PID filter and export it via symbol.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/dvb-frontends/af9033.c |   53 ++
 drivers/media/dvb-frontends/af9033.h |   19 
 2 files changed, 72 insertions(+), 0 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=040cf86c8a121905bf201f334a4848f35de29729

diff --git a/drivers/media/dvb-frontends/af9033.c 
b/drivers/media/dvb-frontends/af9033.c
index 65728c2..5a1c508 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -989,6 +989,59 @@ err:
return ret;
 }
 
+int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff)
+{
+   struct af9033_state *state = fe-demodulator_priv;
+   int ret;
+
+   dev_dbg(state-i2c-dev, %s: onoff=%d\n, __func__, onoff);
+
+   ret = af9033_wr_reg_mask(state, 0x80f993, onoff, 0x01);
+   if (ret  0)
+   goto err;
+
+   return 0;
+
+err:
+   dev_dbg(state-i2c-dev, %s: failed=%d\n, __func__, ret);
+
+   return ret;
+}
+EXPORT_SYMBOL(af9033_pid_filter_ctrl);
+
+int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, int onoff)
+{
+   struct af9033_state *state = fe-demodulator_priv;
+   int ret;
+   u8 wbuf[2] = {(pid  0)  0xff, (pid  8)  0xff};
+
+   dev_dbg(state-i2c-dev, %s: index=%d pid=%04x onoff=%d\n,
+   __func__, index, pid, onoff);
+
+   if (pid  0x1fff)
+   return 0;
+
+   ret = af9033_wr_regs(state, 0x80f996, wbuf, 2);
+   if (ret  0)
+   goto err;
+
+   ret = af9033_wr_reg(state, 0x80f994, onoff);
+   if (ret  0)
+   goto err;
+
+   ret = af9033_wr_reg(state, 0x80f995, index);
+   if (ret  0)
+   goto err;
+
+   return 0;
+
+err:
+   dev_dbg(state-i2c-dev, %s: failed=%d\n, __func__, ret);
+
+   return ret;
+}
+EXPORT_SYMBOL(af9033_pid_filter);
+
 static struct dvb_frontend_ops af9033_ops;
 
 struct dvb_frontend *af9033_attach(const struct af9033_config *config,
diff --git a/drivers/media/dvb-frontends/af9033.h 
b/drivers/media/dvb-frontends/af9033.h
index c286e8f..de245f9 100644
--- a/drivers/media/dvb-frontends/af9033.h
+++ b/drivers/media/dvb-frontends/af9033.h
@@ -81,6 +81,11 @@ struct af9033_config {
 #if IS_ENABLED(CONFIG_DVB_AF9033)
 extern struct dvb_frontend *af9033_attach(const struct af9033_config *config,
struct i2c_adapter *i2c);
+
+extern int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff);
+
+extern int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid,
+   int onoff);
 #else
 static inline struct dvb_frontend *af9033_attach(
const struct af9033_config *config, struct i2c_adapter *i2c)
@@ -88,6 +93,20 @@ static inline struct dvb_frontend *af9033_attach(
pr_warn(%s: driver disabled by Kconfig\n, __func__);
return NULL;
 }
+
+static inline int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff)
+{
+   pr_warn(%s: driver disabled by Kconfig\n, __func__);
+   return -ENODEV;
+}
+
+static inline int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 
pid,
+   int onoff)
+{
+   pr_warn(%s: driver disabled by Kconfig\n, __func__);
+   return -ENODEV;
+}
+
 #endif
 
 #endif /* AF9033_H */

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] af9035: use af9033 PID filters

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] af9035: use af9033 PID filters
Author:  Antti Palosaari cr...@iki.fi
Date:Thu Feb 13 15:53:05 2014 -0300

PID filters are property of af9033 demod. Use PID filters from af9033
driver as it provides those now.

Allow possible dual mode on USB 1.1 mode too as bandwidth could be
just enough when filters are used on both frontends.

Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/usb/dvb-usb-v2/af9035.c |   61 +---
 1 files changed, 10 insertions(+), 51 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=b24c2b4fb126007e36c5a67461527a5bfed33d17

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c 
b/drivers/media/usb/dvb-usb-v2/af9035.c
index 1434d37..31d09a2 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -945,12 +945,7 @@ static int af9035_frontend_callback(void *adapter_priv, 
int component,
 static int af9035_get_adapter_count(struct dvb_usb_device *d)
 {
struct state *state = d_to_priv(d);
-
-   /* disable 2nd adapter as we don't have PID filters implemented */
-   if (d-udev-speed == USB_SPEED_FULL)
-   return 1;
-   else
-   return state-dual_mode + 1;
+   return state-dual_mode + 1;
 }
 
 static int af9035_frontend_attach(struct dvb_usb_adapter *adap)
@@ -1376,58 +1371,15 @@ static int af9035_get_stream_config(struct dvb_frontend 
*fe, u8 *ts_type,
return 0;
 }
 
-/*
- * FIXME: PID filter is property of demodulator and should be moved to the
- * correct driver. Also we support only adapter #0 PID filter and will
- * disable adapter #1 if USB1.1 is used.
- */
 static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
 {
-   struct dvb_usb_device *d = adap_to_d(adap);
-   int ret;
-
-   dev_dbg(d-udev-dev, %s: onoff=%d\n, __func__, onoff);
-
-   ret = af9035_wr_reg_mask(d, 0x80f993, onoff, 0x01);
-   if (ret  0)
-   goto err;
-
-   return 0;
-
-err:
-   dev_dbg(d-udev-dev, %s: failed=%d\n, __func__, ret);
-
-   return ret;
+   return af9033_pid_filter_ctrl(adap-fe[0], onoff);
 }
 
 static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid,
int onoff)
 {
-   struct dvb_usb_device *d = adap_to_d(adap);
-   int ret;
-   u8 wbuf[2] = {(pid  0)  0xff, (pid  8)  0xff};
-
-   dev_dbg(d-udev-dev, %s: index=%d pid=%04x onoff=%d\n,
-   __func__, index, pid, onoff);
-
-   ret = af9035_wr_regs(d, 0x80f996, wbuf, 2);
-   if (ret  0)
-   goto err;
-
-   ret = af9035_wr_reg(d, 0x80f994, onoff);
-   if (ret  0)
-   goto err;
-
-   ret = af9035_wr_reg(d, 0x80f995, index);
-   if (ret  0)
-   goto err;
-
-   return 0;
-
-err:
-   dev_dbg(d-udev-dev, %s: failed=%d\n, __func__, ret);
-
-   return ret;
+   return af9033_pid_filter(adap-fe[0], index, pid, onoff);
 }
 
 static int af9035_probe(struct usb_interface *intf,
@@ -1501,6 +1453,13 @@ static const struct dvb_usb_device_properties 
af9035_props = {
 
.stream = DVB_USB_STREAM_BULK(0x84, 6, 87 * 188),
}, {
+   .caps = DVB_USB_ADAP_HAS_PID_FILTER |
+   DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
+
+   .pid_filter_count = 32,
+   .pid_filter_ctrl = af9035_pid_filter_ctrl,
+   .pid_filter = af9035_pid_filter,
+
.stream = DVB_USB_STREAM_BULK(0x85, 6, 87 * 188),
},
},

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] af9033: Don't export functions for the hardware filter

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] af9033: Don't export functions for the hardware filter
Author:  Mauro Carvalho Chehab m.che...@samsung.com
Date:Fri Mar 14 14:29:06 2014 -0300

Exporting functions for hardware filter is a bad idea, as it
breaks compilation if:
CONFIG_DVB_USB_AF9035=y
CONFIG_DVB_AF9033=m

Because the PID filter function calls would be hardcoded at
af9035.

The same doesn't happen with af9033_attach() because the
dvb_attach() doesn't hardcode it. Instead, it dynamically
links it at runtime.

However, calling dvb_attach() multiple times is problematic,
as it increments module kref.

So, the better is to pass one parameter for the af9033 module
to fill the hardware filters, and then use it inside af9035.

Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/dvb-frontends/af9033.c  |   14 +-
 drivers/media/dvb-frontends/af9033.h  |   23 +++
 drivers/media/usb/dvb-usb-v2/af9035.c |   10 +++---
 drivers/media/usb/dvb-usb-v2/af9035.h |2 ++
 4 files changed, 33 insertions(+), 16 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ed97a6fe5308e5982d118a25f0697b791af5ec50

diff --git a/drivers/media/dvb-frontends/af9033.c 
b/drivers/media/dvb-frontends/af9033.c
index 5a1c508..be4bec2 100644
--- a/drivers/media/dvb-frontends/af9033.c
+++ b/drivers/media/dvb-frontends/af9033.c
@@ -989,7 +989,7 @@ err:
return ret;
 }
 
-int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff)
+static int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff)
 {
struct af9033_state *state = fe-demodulator_priv;
int ret;
@@ -1007,9 +1007,8 @@ err:
 
return ret;
 }
-EXPORT_SYMBOL(af9033_pid_filter_ctrl);
 
-int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, int onoff)
+static int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid, int 
onoff)
 {
struct af9033_state *state = fe-demodulator_priv;
int ret;
@@ -1040,12 +1039,12 @@ err:
 
return ret;
 }
-EXPORT_SYMBOL(af9033_pid_filter);
 
 static struct dvb_frontend_ops af9033_ops;
 
 struct dvb_frontend *af9033_attach(const struct af9033_config *config,
-   struct i2c_adapter *i2c)
+  struct i2c_adapter *i2c,
+  struct af9033_ops *ops)
 {
int ret;
struct af9033_state *state;
@@ -1120,6 +1119,11 @@ struct dvb_frontend *af9033_attach(const struct 
af9033_config *config,
memcpy(state-fe.ops, af9033_ops, sizeof(struct dvb_frontend_ops));
state-fe.demodulator_priv = state;
 
+   if (ops) {
+   ops-pid_filter = af9033_pid_filter;
+   ops-pid_filter_ctrl = af9033_pid_filter_ctrl;
+   }
+
return state-fe;
 
 err:
diff --git a/drivers/media/dvb-frontends/af9033.h 
b/drivers/media/dvb-frontends/af9033.h
index de245f9..539f4db 100644
--- a/drivers/media/dvb-frontends/af9033.h
+++ b/drivers/media/dvb-frontends/af9033.h
@@ -78,17 +78,24 @@ struct af9033_config {
 };
 
 
-#if IS_ENABLED(CONFIG_DVB_AF9033)
-extern struct dvb_frontend *af9033_attach(const struct af9033_config *config,
-   struct i2c_adapter *i2c);
+struct af9033_ops {
+   int (*pid_filter_ctrl)(struct dvb_frontend *fe, int onoff);
+   int (*pid_filter)(struct dvb_frontend *fe, int index, u16 pid,
+ int onoff);
+};
 
-extern int af9033_pid_filter_ctrl(struct dvb_frontend *fe, int onoff);
 
-extern int af9033_pid_filter(struct dvb_frontend *fe, int index, u16 pid,
-   int onoff);
+#if IS_ENABLED(CONFIG_DVB_AF9033)
+extern
+struct dvb_frontend *af9033_attach(const struct af9033_config *config,
+  struct i2c_adapter *i2c,
+  struct af9033_ops *ops);
+
 #else
-static inline struct dvb_frontend *af9033_attach(
-   const struct af9033_config *config, struct i2c_adapter *i2c)
+static inline
+struct dvb_frontend *af9033_attach(const struct af9033_config *config,
+  struct i2c_adapter *i2c,
+  struct af9033_ops *ops)
 {
pr_warn(%s: driver disabled by Kconfig\n, __func__);
return NULL;
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c 
b/drivers/media/usb/dvb-usb-v2/af9035.c
index 31d09a2..021e4d3 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -963,7 +963,7 @@ static int af9035_frontend_attach(struct dvb_usb_adapter 
*adap)
 
/* attach demodulator */
adap-fe[0] = dvb_attach(af9033_attach, state-af9033_config[adap-id],
-   d-i2c_adap);
+   d-i2c_adap, state-ops);
if 

[git:media_tree/master] [media] e4000: fix 32-bit build error

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] e4000: fix 32-bit build error
Author:  Antti Palosaari cr...@iki.fi
Date:Fri Mar 14 15:22:24 2014 -0300

All error/warnings:
   drivers/built-in.o: In function `e4000_set_params':
 e4000.c:(.text+0x1219a1b): undefined reference to `__umoddi3'

Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/media/tuners/e4000.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=ac8f392678da1d9839fdd10e3d5a0c9400b544fa

diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 3b52550..67ecf1b 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -116,6 +116,7 @@ static int e4000_set_params(struct dvb_frontend *fe)
struct e4000 *s = fe-tuner_priv;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret, i, sigma_delta;
+   unsigned int pll_n, pll_f;
u64 f_vco;
u8 buf[5], i_data[4], q_data[4];
 
@@ -141,8 +142,9 @@ static int e4000_set_params(struct dvb_frontend *fe)
}
 
f_vco = 1ull * c-frequency * e4000_pll_lut[i].mul;
-   sigma_delta = div_u64(0x1ULL * (f_vco % s-clock), s-clock);
-   buf[0] = div_u64(f_vco, s-clock);
+   pll_n = div_u64_rem(f_vco, s-clock, pll_f);
+   sigma_delta = div_u64(0x1ULL * pll_f, s-clock);
+   buf[0] = pll_n;
buf[1] = (sigma_delta  0)  0xff;
buf[2] = (sigma_delta  8)  0xff;
buf[3] = 0x00;

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits


[git:media_tree/master] [media] rtl2832_sdr: do not use dynamic stack allocation

2014-03-14 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] rtl2832_sdr: do not use dynamic stack allocation
Author:  Antti Palosaari cr...@iki.fi
Date:Fri Mar 14 16:20:40 2014 -0300

Do not use dynamic stack allocation.

 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c:181:1:
warning: 'rtl2832_sdr_wr' uses dynamic stack allocation [enabled by default]

Reported-by: Mauro Carvalho Chehab m.che...@samsung.com
Reported-by: kbuild test robot fengguang...@intel.com
Signed-off-by: Antti Palosaari cr...@iki.fi
Signed-off-by: Mauro Carvalho Chehab m.che...@samsung.com

 drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=02b7220017cf29507aa789720a3576e7dd59fbe2

diff --git a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c 
b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
index b09f7d8..104ee8a 100644
--- a/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
+++ b/drivers/staging/media/rtl2832u_sdr/rtl2832_sdr.c
@@ -156,7 +156,9 @@ static int rtl2832_sdr_wr(struct rtl2832_sdr_state *s, u8 
reg, const u8 *val,
int len)
 {
int ret;
-   u8 buf[1 + len];
+#define MAX_WR_LEN 24
+#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
+   u8 buf[MAX_WR_XFER_LEN];
struct i2c_msg msg[1] = {
{
.addr = s-cfg-i2c_addr,
@@ -166,6 +168,9 @@ static int rtl2832_sdr_wr(struct rtl2832_sdr_state *s, u8 
reg, const u8 *val,
}
};
 
+   if (WARN_ON(len  MAX_WR_LEN))
+   return -EINVAL;
+
buf[0] = reg;
memcpy(buf[1], val, len);
 

___
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits