bug report: null dereference in error handling in mantis_dvb_init()

2012-05-17 Thread Dan Carpenter
Hi,

I'm working on some new Smatch stuff and so I'm finding old bugs and
emailing bug reports.


This is a semi-automatic email about new static checker warnings.

The patch 68fe255cd15c: "V4L/DVB (13799): [Mantis] Unregister 
frontend" from Dec 4, 2009, leads to the following Smatch complaint:

drivers/media/dvb/mantis/mantis_dvb.c:251 mantis_dvb_init()
 error: we previously assumed 'mantis->fe' could be null (see line 228)

drivers/media/dvb/mantis/mantis_dvb.c
   227  } else {
   228  if (mantis->fe == NULL) {
   229  dprintk(MANTIS_ERROR, 1, "FE ");
   230  goto err5;

"mantis->fe" is NULL on this path.

   231  }
   232  
   233  if (dvb_register_frontend(&mantis->dvb_adapter, 
mantis->fe)) {
   234  dprintk(MANTIS_ERROR, 1, "ERROR: 
Frontend registration failed");
   235  
   236  if (mantis->fe->ops.release)
   237  
mantis->fe->ops.release(mantis->fe);
   238  
   239  mantis->fe = NULL;

And here.

   240  goto err5;
   241  }
   242  }
   243  }
   244  
   245  return 0;
   246  
   247  /* Error conditions ..  */
   248  err5:
   249  tasklet_kill(&mantis->tasklet);
   250  dvb_net_release(&mantis->dvbnet);
   251  dvb_unregister_frontend(mantis->fe);
^^^
This new call to dvb_unregister_frontend() was added but it can't handle
NULL pointers.

   252  dvb_frontend_detach(mantis->fe);
   253  err4:

regards,
dan carpenter

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


Re: Kernel Display and Video API Consolidation mini-summit at ELC 2012 - Notes

2012-05-17 Thread Hans Verkuil
On Thu May 17 2012 04:46:37 Jun Nie wrote:
> Is there any discussion on HDCP on the summit? It is tightly
> coupled with HDMI and DVI and should be managed together with the
> transmitter. But there is not code to handle HDCP in DRM/FB/V4L in
> latest kernel. Any thoughts on HDCP? Or you guys think there is risk
> to support it in kernel? Thanks for your comments!

There is no risk to support it in the kernel, the risk is all for the
implementer (usually by having to lock down the system preventing access
to the box). You'd better read the HDCP license very carefully before deciding
to use HDCP under linux!

I'm working on V4L HDMI receivers and transmitters myself, but not on HDCP.
But I'd be happy to review/comment on proposals for adding HDCP support.

Note that there is very little work to be done to add this for simple
receivers and transmitters. The hard part will be supporting repeaters.

For simple receivers all you need in V4L2 is a flag telling you that the
received video was encrypted and for a transmitter I think you just need a
control to turn encryption on or off (AFAIK, I'd have to verify that statement
regarding the transmitter to be 100% certain). All the actual encryption and
decryption is handled by the receiver/transmitter hardware, at least on the
hardware that I have seen.

Repeaters are a lot harder as you have to handle key exchanges. I don't know
off-hand what that would involve API-wise in V4L2.

Regards,

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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread Thomas Mair
On 17.05.2012 05:40, poma wrote:
> […]
> v4-1-5-rtl2832-ver.-0.4-v2.diff
> 

Oh thanks. That Makefile is haunting me badly ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/2] Proposal to deprecate four drivers

2012-05-17 Thread Hans Verkuil
On Mon May 14 2012 21:11:57 Hans Verkuil wrote:
> Hi all,
> 
> These two patches deprecate the ISA video capture pms driver and the three
> parallel port webcam drivers bw-qcam, c-qcam and w9966.
> 
> Nobody has hardware for the three parallel port webcams anymore (and we really
> tried to get hold of some), and my ISA pms board also no longer works (I 
> suspect
> the Pentium motherboard I use for testing ISA cards is too fast :-) ).
> 
> I've given up on these drivers. I've posted a pull request to get these 
> drivers
> up to speed with regards to the latest frameworks (the pms update has already
> been merged), and I think that should be the last change before removing them
> altogether. If someone ever gets working hardware for these drivers, then they
> are easy to resurrect from the git history should there be a desire to do so.
> 
> ISA and parallel port are both unsuitable for streaming video, so this 
> hardware
> is really obsolete.

I'm shelving this RFC for the time being. I suddenly have leads on all three
parallel port webcams so with a bit of luck I might have actual hardware to
test these drivers in a few weeks time.

It's still not useful to anyone of course, but as long as I can test ancient
hardware I'm happy :-)

Regards,

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


[PATCH] [resend] radio-sf16fmr2: add PnP support for SF16-FMD2

2012-05-17 Thread Ondrej Zary
Add PnP support to radio-sf16fmr2 driver to support SF16-FMD2 card (SB16 +
TEA5757). The driver can now handle two cards (FMR2 is hardwired to 0x384,
FMD2 can be put at 0x384 or 0x284 by PnP).
Tested with both SF16-FMR2 and SF16-FMD2 (the can work at the same time by
using kernel parameter "pnp_reserve_io=0x384,2" so the FMD2 is put at 0x284).

Signed-off-by: Ondrej Zary 

--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -329,7 +329,7 @@ config RADIO_SF16FMI
  module will be called radio-sf16fmi.
 
 config RADIO_SF16FMR2
-   tristate "SF16FMR2 Radio"
+   tristate "SF16-FMR2/SF16-FMD2 Radio"
depends on ISA && VIDEO_V4L2 && SND
---help---
  Choose Y here if you have one of these FM radio cards.
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -1,4 +1,4 @@
-/* SF16-FMR2 radio driver for Linux
+/* SF16-FMR2 and SF16-FMD2 radio driver for Linux
  * Copyright (c) 2011 Ondrej Zary
  *
  * Original driver was (c) 2000-2002 Ziglio Frediano, fredd...@angelfire.com
@@ -13,15 +13,19 @@
 #include   /* request_region   */
 #include   /* outb, outb_p */
 #include 
+#include 
 #include 
 
 MODULE_AUTHOR("Ondrej Zary");
-MODULE_DESCRIPTION("MediaForte SF16-FMR2 FM radio card driver");
+MODULE_DESCRIPTION("MediaForte SF16-FMR2 and SF16-FMD2 FM radio card driver");
 MODULE_LICENSE("GPL");
 
-static int radio_nr = -1;
-module_param(radio_nr, int, 0444);
-MODULE_PARM_DESC(radio_nr, "Radio device number");
+/* these cards can only use two different ports (0x384 and 0x284) */
+#define FMR2_MAX 2
+
+static int radio_nr[FMR2_MAX] = { [0 ... (FMR2_MAX - 1)] = -1 };
+module_param_array(radio_nr, int, NULL, 0444);
+MODULE_PARM_DESC(radio_nr, "Radio device numbers");
 
 struct fmr2 {
int io;
@@ -29,9 +33,15 @@ struct fmr2 {
struct snd_tea575x tea;
struct v4l2_ctrl *volume;
struct v4l2_ctrl *balance;
+   bool is_fmd2;
 };
 
-/* the port is hardwired so no need to support multiple cards */
+static int num_fmr2_cards;
+static struct fmr2 *fmr2_cards[FMR2_MAX];
+static bool isa_registered;
+static bool pnp_registered;
+
+/* the port is hardwired on SF16-FMR2 */
 #define FMR2_PORT  0x384
 
 /* TEA575x tuner pins */
@@ -174,7 +184,8 @@ static int fmr2_tea_ext_init(struct snd_tea575x *tea)
 {
struct fmr2 *fmr2 = tea->private_data;
 
-   if (inb(fmr2->io) & FMR2_HASVOL) {
+   /* FMR2 can have volume control, FMD2 can't (uses SB16 mixer) */
+   if (!fmr2->is_fmd2 && inb(fmr2->io) & FMR2_HASVOL) {
fmr2->volume = v4l2_ctrl_new_std(&tea->ctrl_handler, 
&fmr2_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 0, 68, 2, 56);
fmr2->balance = v4l2_ctrl_new_std(&tea->ctrl_handler, 
&fmr2_ctrl_ops, V4L2_CID_AUDIO_BALANCE, -68, 68, 2, 0);
if (tea->ctrl_handler.error) {
@@ -186,22 +197,28 @@ static int fmr2_tea_ext_init(struct snd_tea575x *tea)
return 0;
 }
 
-static int __devinit fmr2_probe(struct device *pdev, unsigned int dev)
+static struct pnp_device_id fmr2_pnp_ids[] __devinitdata = {
+   { .id = "MFRad13" }, /* tuner subdevice of SF16-FMD2 */
+   { .id = "" }
+};
+MODULE_DEVICE_TABLE(pnp, fmr2_pnp_ids);
+
+static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io)
 {
-   struct fmr2 *fmr2;
-   int err;
+   int err, i;
+   char *card_name = fmr2->is_fmd2 ? "SF16-FMD2" : "SF16-FMR2";
 
-   fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
-   if (fmr2 == NULL)
-   return -ENOMEM;
+   /* avoid errors if a card was already registered at given port */
+   for (i = 0; i < num_fmr2_cards; i++)
+   if (io == fmr2_cards[i]->io)
+   return -EBUSY;
 
-   strlcpy(fmr2->v4l2_dev.name, dev_name(pdev),
-   sizeof(fmr2->v4l2_dev.name));
-   fmr2->io = FMR2_PORT;
+   strlcpy(fmr2->v4l2_dev.name, "radio-sf16fmr2",
+   sizeof(fmr2->v4l2_dev.name)),
+   fmr2->io = io;
 
if (!request_region(fmr2->io, 2, fmr2->v4l2_dev.name)) {
printk(KERN_ERR "radio-sf16fmr2: I/O port 0x%x already in 
use\n", fmr2->io);
-   kfree(fmr2);
return -EBUSY;
}
 
@@ -210,56 +227,121 @@ static int __devinit fmr2_probe(struct device *pdev, 
unsigned int dev)
if (err < 0) {
v4l2_err(&fmr2->v4l2_dev, "Could not register v4l2_device\n");
release_region(fmr2->io, 2);
-   kfree(fmr2);
return err;
}
fmr2->tea.v4l2_dev = &fmr2->v4l2_dev;
fmr2->tea.private_data = fmr2;
-   fmr2->tea.radio_nr = radio_nr;
+   fmr2->tea.radio_nr = radio_nr[num_fmr2_cards];
fmr2->tea.ops = &fmr2_tea_ops;
fmr2->tea.ext_init = fmr2_tea_ext_init;
-   strlcpy(fmr2->tea.card, "SF16-FMR2", sizeof(fmr2->tea.card));
-   snprintf(fmr2->tea.bus_info, sizeof(fmr2->te

Re: [PATCH] [resend] radio-sf16fmr2: add PnP support for SF16-FMD2

2012-05-17 Thread Hans Verkuil
On Thu May 17 2012 10:55:01 Ondrej Zary wrote:
> Add PnP support to radio-sf16fmr2 driver to support SF16-FMD2 card (SB16 +
> TEA5757). The driver can now handle two cards (FMR2 is hardwired to 0x384,
> FMD2 can be put at 0x384 or 0x284 by PnP).
> Tested with both SF16-FMR2 and SF16-FMD2 (the can work at the same time by
> using kernel parameter "pnp_reserve_io=0x384,2" so the FMD2 is put at 0x284).
> 
> Signed-off-by: Ondrej Zary 

Acked-by: Hans Verkuil 

> 
> --- a/drivers/media/radio/Kconfig
> +++ b/drivers/media/radio/Kconfig
> @@ -329,7 +329,7 @@ config RADIO_SF16FMI
> module will be called radio-sf16fmi.
>  
>  config RADIO_SF16FMR2
> - tristate "SF16FMR2 Radio"
> + tristate "SF16-FMR2/SF16-FMD2 Radio"
>   depends on ISA && VIDEO_V4L2 && SND
>   ---help---
> Choose Y here if you have one of these FM radio cards.
> --- a/drivers/media/radio/radio-sf16fmr2.c
> +++ b/drivers/media/radio/radio-sf16fmr2.c
> @@ -1,4 +1,4 @@
> -/* SF16-FMR2 radio driver for Linux
> +/* SF16-FMR2 and SF16-FMD2 radio driver for Linux
>   * Copyright (c) 2011 Ondrej Zary
>   *
>   * Original driver was (c) 2000-2002 Ziglio Frediano, fredd...@angelfire.com
> @@ -13,15 +13,19 @@
>  #include /* request_region   */
>  #include /* outb, outb_p */
>  #include 
> +#include 
>  #include 
>  
>  MODULE_AUTHOR("Ondrej Zary");
> -MODULE_DESCRIPTION("MediaForte SF16-FMR2 FM radio card driver");
> +MODULE_DESCRIPTION("MediaForte SF16-FMR2 and SF16-FMD2 FM radio card 
> driver");
>  MODULE_LICENSE("GPL");
>  
> -static int radio_nr = -1;
> -module_param(radio_nr, int, 0444);
> -MODULE_PARM_DESC(radio_nr, "Radio device number");
> +/* these cards can only use two different ports (0x384 and 0x284) */
> +#define FMR2_MAX 2
> +
> +static int radio_nr[FMR2_MAX] = { [0 ... (FMR2_MAX - 1)] = -1 };
> +module_param_array(radio_nr, int, NULL, 0444);
> +MODULE_PARM_DESC(radio_nr, "Radio device numbers");
>  
>  struct fmr2 {
>   int io;
> @@ -29,9 +33,15 @@ struct fmr2 {
>   struct snd_tea575x tea;
>   struct v4l2_ctrl *volume;
>   struct v4l2_ctrl *balance;
> + bool is_fmd2;
>  };
>  
> -/* the port is hardwired so no need to support multiple cards */
> +static int num_fmr2_cards;
> +static struct fmr2 *fmr2_cards[FMR2_MAX];
> +static bool isa_registered;
> +static bool pnp_registered;
> +
> +/* the port is hardwired on SF16-FMR2 */
>  #define FMR2_PORT0x384
>  
>  /* TEA575x tuner pins */
> @@ -174,7 +184,8 @@ static int fmr2_tea_ext_init(struct snd_tea575x *tea)
>  {
>   struct fmr2 *fmr2 = tea->private_data;
>  
> - if (inb(fmr2->io) & FMR2_HASVOL) {
> + /* FMR2 can have volume control, FMD2 can't (uses SB16 mixer) */
> + if (!fmr2->is_fmd2 && inb(fmr2->io) & FMR2_HASVOL) {
>   fmr2->volume = v4l2_ctrl_new_std(&tea->ctrl_handler, 
> &fmr2_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 0, 68, 2, 56);
>   fmr2->balance = v4l2_ctrl_new_std(&tea->ctrl_handler, 
> &fmr2_ctrl_ops, V4L2_CID_AUDIO_BALANCE, -68, 68, 2, 0);
>   if (tea->ctrl_handler.error) {
> @@ -186,22 +197,28 @@ static int fmr2_tea_ext_init(struct snd_tea575x *tea)
>   return 0;
>  }
>  
> -static int __devinit fmr2_probe(struct device *pdev, unsigned int dev)
> +static struct pnp_device_id fmr2_pnp_ids[] __devinitdata = {
> + { .id = "MFRad13" }, /* tuner subdevice of SF16-FMD2 */
> + { .id = "" }
> +};
> +MODULE_DEVICE_TABLE(pnp, fmr2_pnp_ids);
> +
> +static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int 
> io)
>  {
> - struct fmr2 *fmr2;
> - int err;
> + int err, i;
> + char *card_name = fmr2->is_fmd2 ? "SF16-FMD2" : "SF16-FMR2";
>  
> - fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
> - if (fmr2 == NULL)
> - return -ENOMEM;
> + /* avoid errors if a card was already registered at given port */
> + for (i = 0; i < num_fmr2_cards; i++)
> + if (io == fmr2_cards[i]->io)
> + return -EBUSY;
>  
> - strlcpy(fmr2->v4l2_dev.name, dev_name(pdev),
> - sizeof(fmr2->v4l2_dev.name));
> - fmr2->io = FMR2_PORT;
> + strlcpy(fmr2->v4l2_dev.name, "radio-sf16fmr2",
> + sizeof(fmr2->v4l2_dev.name)),
> + fmr2->io = io;
>  
>   if (!request_region(fmr2->io, 2, fmr2->v4l2_dev.name)) {
>   printk(KERN_ERR "radio-sf16fmr2: I/O port 0x%x already in 
> use\n", fmr2->io);
> - kfree(fmr2);
>   return -EBUSY;
>   }
>  
> @@ -210,56 +227,121 @@ static int __devinit fmr2_probe(struct device *pdev, 
> unsigned int dev)
>   if (err < 0) {
>   v4l2_err(&fmr2->v4l2_dev, "Could not register v4l2_device\n");
>   release_region(fmr2->io, 2);
> - kfree(fmr2);
>   return err;
>   }
>   fmr2->tea.v4l2_dev = &fmr2->v4l2_dev;
>   fmr2->tea.private_data = fmr2;
> - fmr2->tea.radio_nr = radio_nr;
> + fmr2->tea.radio_n

Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread Antti Palosaari

Moikka Thomas,

Here is the review. See comments below.

And conclusion is that it is ready for the Kernel merge. I did not see 
any big functiuonality problems - only some small issues that are likely 
considered as a coding style etc. Feel free to fix those and sent new 
patc serie or just new patch top of that.


Reviewed-by: Antti Palosaari 


On 17.05.2012 01:13, Thomas Mair wrote:

Changelog for ver. 0.3:
- removed statistics as their calculation was wrong
- fixed bug in Makefile
- indentation and code style improvements

Signed-off-by: Thomas Mair
---
  drivers/media/dvb/frontends/Kconfig|7 +
  drivers/media/dvb/frontends/Makefile   |1 +
  drivers/media/dvb/frontends/rtl2832.c  |  825 
  drivers/media/dvb/frontends/rtl2832.h  |   74 +++
  drivers/media/dvb/frontends/rtl2832_priv.h |  258 +
  5 files changed, 1165 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/dvb/frontends/rtl2832.c
  create mode 100644 drivers/media/dvb/frontends/rtl2832.h
  create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h

diff --git a/drivers/media/dvb/frontends/Kconfig 
b/drivers/media/dvb/frontends/Kconfig
index f479834..f7d67d7 100644
--- a/drivers/media/dvb/frontends/Kconfig
+++ b/drivers/media/dvb/frontends/Kconfig
@@ -432,6 +432,13 @@ config DVB_RTL2830
help
  Say Y when you want to support this frontend.

+config DVB_RTL2832
+   tristate "Realtek RTL2832 DVB-T"
+   depends on DVB_CORE&&  I2C
+   default m if DVB_FE_CUSTOMISE
+   help
+ Say Y when you want to support this frontend.
+


It is correct.

Just for the comment as you said in cover letter that you are unsure 
about that.



  comment "DVB-C (cable) frontends"
depends on DVB_CORE

diff --git a/drivers/media/dvb/frontends/Makefile 
b/drivers/media/dvb/frontends/Makefile
index b0381dc..bbf2955 100644
--- a/drivers/media/dvb/frontends/Makefile
+++ b/drivers/media/dvb/frontends/Makefile
@@ -98,6 +98,7 @@ obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o
  obj-$(CONFIG_DVB_A8293) += a8293.o
  obj-$(CONFIG_DVB_TDA10071) += tda10071.o
  obj-$(CONFIG_DVB_RTL2830) += rtl2830.o
+obj-$(CONFIG_DVB_RTL2830) += rtl2832.o
  obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
  obj-$(CONFIG_DVB_AF9033) += af9033.o

diff --git a/drivers/media/dvb/frontends/rtl2832.c 
b/drivers/media/dvb/frontends/rtl2832.c
new file mode 100644
index 000..51c7927
--- /dev/null
+++ b/drivers/media/dvb/frontends/rtl2832.c
@@ -0,0 +1,825 @@
+/*
+ * Realtek RTL2832 DVB-T demodulator driver
+ *
+ * Copyright (C) 2012 Thomas Mair
+ *
+ * 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.
+ */
+
+#include "rtl2832_priv.h"
+
+
+int rtl2832_debug;
+module_param_named(debug, rtl2832_debug, int, 0644);
+MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
+
+
+static int reg_mask[32] = {


This should be static const.


+   0x0001,
+   0x0003,
+   0x0007,
+   0x000f,
+   0x001f,
+   0x003f,
+   0x007f,
+   0x00ff,
+   0x01ff,
+   0x03ff,
+   0x07ff,
+   0x0fff,
+   0x1fff,
+   0x3fff,
+   0x7fff,
+   0x,
+   0x0001,
+   0x0003,
+   0x0007,
+   0x000f,
+   0x001f,
+   0x003f,
+   0x007f,
+   0x00ff,
+   0x01ff,
+   0x03ff,
+   0x07ff,
+   0x0fff,
+   0x1fff,
+   0x3fff,
+   0x7fff,
+   0x
+};
+
+struct rtl2832_reg_entry registers[] = {


static const struct


+   [DVBT_SOFT_RST] = {0x1, 0x1,   2, 2},
+   [DVBT_IIC_REPEAT]   = {0x1, 0x1,   3, 3},
+   [DVBT_TR_WAIT_MIN_8K]   = {0x1, 0x88, 11, 2},
+   [DVBT_RSD_BER_FAIL_VAL] = {0x1, 0x8f, 15, 0},
+   [DVBT_EN_BK_TRK]= {0x1, 0xa6,  7, 7},
+   [DVBT_AD_EN_REG]= {0x0, 0x8,   7, 7},
+   [DVBT_AD_EN_REG1]   = {0x0, 0x8,   6, 6},
+   [DVBT_EN_BBIN]  = {0x1, 0xb1,  0, 0},
+   [DVBT_MGD_THD0] = {0x1, 0x95,  7, 0},
+   [DVBT_MGD_THD1] = {0x1, 0x96,  7, 0},
+   [DVBT_MGD_THD2] = {0x1, 0x97,  7, 0},
+   [DVBT_MGD_THD3] = {0x1, 0x98,  7, 0},
+

Re: [PATCH v4 2/5] rtl28xxu: support for the rtl2832 demod driver

2012-05-17 Thread Antti Palosaari

Moikka

Comments below.

Reviewed-by: Antti Palosaari 


On 17.05.2012 01:13, Thomas Mair wrote:

This only adds support for the Terratec Cinergy T Stick Black device.

Signed-off-by: Thomas Mair
---
  drivers/media/dvb/dvb-usb/Kconfig   |3 +
  drivers/media/dvb/dvb-usb/dvb-usb-ids.h |1 +
  drivers/media/dvb/dvb-usb/rtl28xxu.c|  431 +--
  3 files changed, 411 insertions(+), 24 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/Kconfig 
b/drivers/media/dvb/dvb-usb/Kconfig
index be1db75..98dd0d8 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -417,9 +417,12 @@ config DVB_USB_RTL28XXU
tristate "Realtek RTL28xxU DVB USB support"
depends on DVB_USB&&  EXPERIMENTAL
select DVB_RTL2830
+   select DVB_RTL2832
select MEDIA_TUNER_QT1010 if !MEDIA_TUNER_CUSTOMISE
select MEDIA_TUNER_MT2060 if !MEDIA_TUNER_CUSTOMISE
select MEDIA_TUNER_MXL5005S if !MEDIA_TUNER_CUSTOMISE
+   select MEDIA_TUNER_FC0012 if !MEDIA_TUNER_CUSTOMISE
+   select MEDIA_TUNER_FC0013 if !MEDIA_TUNER_CUSTOMISE
help
  Say Y here to support the Realtek RTL28xxU DVB USB receiver.

diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h 
b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 2418e41..fd37be0 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -157,6 +157,7 @@
  #define USB_PID_TERRATEC_CINERGY_T_STICK  0x0093
  #define USB_PID_TERRATEC_CINERGY_T_STICK_RC   0x0097
  #define USB_PID_TERRATEC_CINERGY_T_STICK_DUAL_RC  0x0099
+#define USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV10x00a9
  #define USB_PID_TWINHAN_VP7041_COLD   0x3201
  #define USB_PID_TWINHAN_VP7041_WARM   0x3202
  #define USB_PID_TWINHAN_VP7020_COLD   0x3203
diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c 
b/drivers/media/dvb/dvb-usb/rtl28xxu.c
index 8f4736a..bb66771 100644
--- a/drivers/media/dvb/dvb-usb/rtl28xxu.c
+++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c
@@ -3,6 +3,7 @@
   *
   * Copyright (C) 2009 Antti Palosaari
   * Copyright (C) 2011 Antti Palosaari
+ * Copyright (C) 2012 Thomas Mair
   *
   *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
@@ -22,10 +23,12 @@
  #include "rtl28xxu.h"

  #include "rtl2830.h"
+#include "rtl2832.h"

  #include "qt1010.h"
  #include "mt2060.h"
  #include "mxl5005s.h"
+#include "fc0012.h"


You have added both FC0012 and FC0013 as a Kconfig but only fc0012.h is 
used here. It is wrong. Unless you are not using FC0013 tuner you should 
not make Kconfig dependency for the driver.




  /* debug */
  static int dvb_usb_rtl28xxu_debug;
@@ -378,34 +381,153 @@ err:
return ret;
  }

+static struct rtl2832_config rtl28xxu_rtl2832_fc0012_config = {
+   .i2c_addr = 0x10, /* 0x20 */
+   .xtal = 2880,
+   .if_dvbt = 0,
+   .tuner = TUNER_RTL2832_FC0012
+};
+
+
+static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
+   int cmd, int arg)
+{
+   int ret;
+   u8 val;
+
+   deb_info("%s cmd=%d arg=%d\n", __func__, cmd, arg);
+   switch (cmd) {
+   case FC_FE_CALLBACK_VHF_ENABLE:
+   /* set output values */
+   ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL,&val);
+   if (ret)
+   goto err;
+
+   if (arg)
+   val&= 0xbf; /* set GPIO6 low */
+   else
+   val |= 0x40; /* set GPIO6 high */
+
+
+   ret = rtl2831_wr_reg(d, SYS_GPIO_OUT_VAL, val);
+   if (ret)
+   goto err;
+   break;
+   default:
+   ret = -EINVAL;
+   goto err;
+   }
+   return 0;
+
+err:
+   err("%s: failed=%d\n", __func__, ret);
+
+   return ret;
+}
+
+
+static int rtl2832u_fc0013_tuner_callback(struct dvb_usb_device *d,
+   int cmd, int arg)
+{
+   /* TODO implement*/
+   return 0;
+}
+
+static int rtl2832u_tuner_callback(struct dvb_usb_device *d, int cmd, int arg)
+{
+   struct rtl28xxu_priv *priv = d->priv;
+
+   switch (priv->tuner) {
+   case TUNER_RTL2832_FC0012:
+   return rtl2832u_fc0012_tuner_callback(d, cmd, arg);
+
+   case TUNER_RTL2832_FC0013:
+   return rtl2832u_fc0013_tuner_callback(d, cmd, arg);
+   default:
+   break;
+   }
+
+   return -ENODEV;
+}
+
+static int rtl2832u_frontend_callback(void *adapter_priv, int component,
+   int cmd, int arg)
+{
+   struct i2c_adapter *adap = adapter_priv;
+   struct dvb_usb_device *d = i2c_get_adapdata(adap);
+
+   switch (component) {
+   case DVB_FRONTEND_COMPONENT_TUNER:
+   return rtl2832u_tuner_callback(d, cmd, arg);
+   default:
+   

Re: [PATCH v4 3/5] rtl28xxu: renamed rtl2831_rd/rtl2831_wr to rtl28xx_rd/rtl28xx_wr

2012-05-17 Thread Antti Palosaari

On 17.05.2012 01:13, Thomas Mair wrote:

Signed-off-by: Thomas Mair


Acked-by: Antti Palosaari 



---
  drivers/media/dvb/dvb-usb/rtl28xxu.c |  102 +-
  1 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c 
b/drivers/media/dvb/dvb-usb/rtl28xxu.c
index bb66771..6817ef7 100644
--- a/drivers/media/dvb/dvb-usb/rtl28xxu.c
+++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c
@@ -83,7 +83,7 @@ err:
return ret;
  }

-static int rtl2831_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
+static int rtl28xx_wr_regs(struct dvb_usb_device *d, u16 reg, u8 *val, int len)
  {
struct rtl28xxu_req req;

@@ -119,12 +119,12 @@ static int rtl2831_rd_regs(struct dvb_usb_device *d, u16 
reg, u8 *val, int len)
return rtl28xxu_ctrl_msg(d,&req);
  }

-static int rtl2831_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
+static int rtl28xx_wr_reg(struct dvb_usb_device *d, u16 reg, u8 val)
  {
-   return rtl2831_wr_regs(d, reg,&val, 1);
+   return rtl28xx_wr_regs(d, reg,&val, 1);
  }

-static int rtl2831_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
+static int rtl28xx_rd_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
  {
return rtl2831_rd_regs(d, reg, val, 1);
  }
@@ -311,12 +311,12 @@ static int rtl2831u_frontend_attach(struct 
dvb_usb_adapter *adap)
 */

/* GPIO direction */
-   ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a);
+   ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, 0x0a);
if (ret)
goto err;

/* enable as output GPIO0, GPIO2, GPIO4 */
-   ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15);
+   ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, 0x15);
if (ret)
goto err;

@@ -399,7 +399,7 @@ static int rtl2832u_fc0012_tuner_callback(struct 
dvb_usb_device *d,
switch (cmd) {
case FC_FE_CALLBACK_VHF_ENABLE:
/* set output values */
-   ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL,&val);
+   ret = rtl28xx_rd_reg(d, SYS_GPIO_OUT_VAL,&val);
if (ret)
goto err;

@@ -409,7 +409,7 @@ static int rtl2832u_fc0012_tuner_callback(struct 
dvb_usb_device *d,
val |= 0x40; /* set GPIO6 high */


-   ret = rtl2831_wr_reg(d, SYS_GPIO_OUT_VAL, val);
+   ret = rtl28xx_wr_reg(d, SYS_GPIO_OUT_VAL, val);
if (ret)
goto err;
break;
@@ -504,25 +504,25 @@ static int rtl2832u_frontend_attach(struct 
dvb_usb_adapter *adap)
deb_info("%s:\n", __func__);


-   ret = rtl2831_rd_reg(adap->dev, SYS_GPIO_DIR,&val);
+   ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_DIR,&val);
if (ret)
goto err;

val&= 0xbf;

-   ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_DIR, val);
+   ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_DIR, val);
if (ret)
goto err;


/* enable as output GPIO3 and GPIO6*/
-   ret = rtl2831_rd_reg(adap->dev, SYS_GPIO_OUT_EN,&val);
+   ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_EN,&val);
if (ret)
goto err;

val |= 0x48;

-   ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_EN, val);
+   ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_EN, val);
if (ret)
goto err;

@@ -773,7 +773,7 @@ static int rtl2831u_streaming_ctrl(struct dvb_usb_adapter 
*adap , int onoff)

deb_info("%s: onoff=%d\n", __func__, onoff);

-   ret = rtl2831_rd_reg(adap->dev, SYS_GPIO_OUT_VAL,&gpio);
+   ret = rtl28xx_rd_reg(adap->dev, SYS_GPIO_OUT_VAL,&gpio);
if (ret)
goto err;

@@ -787,11 +787,11 @@ static int rtl2831u_streaming_ctrl(struct dvb_usb_adapter 
*adap , int onoff)
gpio&= (~0x04); /* LED off */
}

-   ret = rtl2831_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, gpio);
+   ret = rtl28xx_wr_reg(adap->dev, SYS_GPIO_OUT_VAL, gpio);
if (ret)
goto err;

-   ret = rtl2831_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
+   ret = rtl28xx_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
if (ret)
goto err;

@@ -817,7 +817,7 @@ static int rtl2832u_streaming_ctrl(struct dvb_usb_adapter 
*adap , int onoff)
buf[1] = 0x02; /* reset EPA */
}

-   ret = rtl2831_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
+   ret = rtl28xx_wr_regs(adap->dev, USB_EPA_CTL, buf, 2);
if (ret)
goto err;

@@ -835,12 +835,12 @@ static int rtl2831u_power_ctrl(struct dvb_usb_device *d, 
int onoff)
deb_info("%s: onoff=%d\n", __func__, onoff);

/* demod adc */
-   ret = rtl2831_rd_reg(d, SYS_SYS0,&sys0);
+   ret = rtl28xx_rd_reg(d, SYS_SYS0,&sys0);
if (ret)
goto err;

/* tuner power, read GPIOs */
-   ret = rtl2831_rd_reg(d, SYS_GPIO_OUT_VAL,&gpio);
+  

Re: [PATCH v4 4/5] rtl28xxu: support G-Tek Electronics Group Lifeview LV5TDLX DVB-T

2012-05-17 Thread Antti Palosaari

On 17.05.2012 01:13, Thomas Mair wrote:

Signed-off-by: Thomas Mair


Nacked.
Better PID definition is required.


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

diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h 
b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index fd37be0..b0a86e9 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -135,6 +135,7 @@
  #define USB_PID_GENIUS_TVGO_DVB_T03   0x4012
  #define USB_PID_GRANDTEC_DVBT_USB_COLD0x0fa0
  #define USB_PID_GRANDTEC_DVBT_USB_WARM0x0fa1
+#define USB_PID_GTEK   0xb803


You must give better name for the device. Vendor name is not enough as 
many vendors has surely more than one device model.


Correct PID is something like USB_PID_GTEK_LIFEVIEW_LV5TDLX


  #define USB_PID_INTEL_CE9500  0x9500
  #define USB_PID_ITETECH_IT91350x9135
  #define USB_PID_ITETECH_IT9135_9005   0x9005
diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c 
b/drivers/media/dvb/dvb-usb/rtl28xxu.c
index 6817ef7..9056d28 100644
--- a/drivers/media/dvb/dvb-usb/rtl28xxu.c
+++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c
@@ -1135,6 +1135,7 @@ enum rtl28xxu_usb_table_entry {
RTL2831U_14AA_0160,
RTL2831U_14AA_0161,
RTL2832U_0CCD_00A9,
+   RTL2832U_1F4D_B803,
  };

  static struct usb_device_id rtl28xxu_table[] = {
@@ -1149,6 +1150,8 @@ static struct usb_device_id rtl28xxu_table[] = {
/* RTL2832U */
[RTL2832U_0CCD_00A9] = {
USB_DEVICE(USB_VID_TERRATEC, 
USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1)},
+   [RTL2832U_1F4D_B803] = {
+   USB_DEVICE(USB_VID_GTEK, USB_PID_GTEK)},
{} /* terminating entry */
  };

@@ -1262,7 +1265,7 @@ static struct dvb_usb_device_properties 
rtl28xxu_properties[] = {

.i2c_algo =&rtl28xxu_i2c_algo,

-   .num_device_descs = 1,
+   .num_device_descs = 2,
.devices = {
{
.name = "Terratec Cinergy T Stick Black",
@@ -1270,6 +1273,12 @@ static struct dvb_usb_device_properties 
rtl28xxu_properties[] = {
&rtl28xxu_table[RTL2832U_0CCD_00A9],
},
},
+   {
+   .name = "G-Tek Electronics Group Lifeview LV5TDLX 
DVB-T [RTL2832U]",
+   .warm_ids = {
+   &rtl28xxu_table[RTL2832U_1F4D_B803],
+   },
+   },
}
},




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


Re: [PATCH v4 5/5] rtl28xxu: support Terratec Noxon DAB/DAB+ stick

2012-05-17 Thread Antti Palosaari

On 17.05.2012 01:13, Thomas Mair wrote:

Signed-off-by: Hans-Frieder Vogt
Signed-off-by: Thomas Mair


Acked-by: Antti Palosaari 



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

diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h 
b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index b0a86e9..95c9c14 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -244,6 +244,7 @@
  #define USB_PID_TERRATEC_H7_2 0x10a3
  #define USB_PID_TERRATEC_T3   0x10a0
  #define USB_PID_TERRATEC_T5   0x10a1
+#define USB_PID_NOXON_DAB_STICK0x00b3
  #define USB_PID_PINNACLE_EXPRESSCARD_320CX0x022e
  #define USB_PID_PINNACLE_PCTV2000E0x022c
  #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228
diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c 
b/drivers/media/dvb/dvb-usb/rtl28xxu.c
index 9056d28..f10cac2 100644
--- a/drivers/media/dvb/dvb-usb/rtl28xxu.c
+++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c
@@ -29,6 +29,7 @@
  #include "mt2060.h"
  #include "mxl5005s.h"
  #include "fc0012.h"
+#include "fc0013.h"


Aaah, it is coming here. You were introducing some FC0013 earlier which 
I mentioned (that Kconfig dependency). Correct place for FC0013 stuff is 
that patch.




  /* debug */
  static int dvb_usb_rtl28xxu_debug;
@@ -388,6 +389,12 @@ static struct rtl2832_config 
rtl28xxu_rtl2832_fc0012_config = {
.tuner = TUNER_RTL2832_FC0012
  };

+static struct rtl2832_config rtl28xxu_rtl2832_fc0013_config = {
+   .i2c_addr = 0x10, /* 0x20 */
+   .xtal = 2880,
+   .if_dvbt = 0,
+   .tuner = TUNER_RTL2832_FC0013
+};

  static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
int cmd, int arg)
@@ -553,6 +560,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter 
*adap)
ret = rtl28xxu_ctrl_msg(adap->dev,&req_fc0013);
if (ret == 0&&  buf[0] == 0xa3) {
priv->tuner = TUNER_RTL2832_FC0013;
+   rtl2832_config =&rtl28xxu_rtl2832_fc0013_config;
info("%s: FC0013 tuner found", __func__);
goto found;
}
@@ -750,6 +758,14 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
fe->ops.tuner_ops.get_rf_strength;
return 0;
break;
+   case TUNER_RTL2832_FC0013:
+   fe = dvb_attach(fc0013_attach, adap->fe_adap[0].fe,
+   &adap->dev->i2c_adap, 0xc6>>1, 0, FC_XTAL_28_8_MHZ);
+
+   /* fc0013 also supports signal strength reading */
+   adap->fe_adap[0].fe->ops.read_signal_strength = adap->fe_adap[0]
+   .fe->ops.tuner_ops.get_rf_strength;
+   return 0;
default:
fe = NULL;
err("unknown tuner=%d", priv->tuner);
@@ -1136,6 +1152,7 @@ enum rtl28xxu_usb_table_entry {
RTL2831U_14AA_0161,
RTL2832U_0CCD_00A9,
RTL2832U_1F4D_B803,
+   RTL2832U_0CCD_00B3,
  };

  static struct usb_device_id rtl28xxu_table[] = {
@@ -1152,6 +1169,8 @@ static struct usb_device_id rtl28xxu_table[] = {
USB_DEVICE(USB_VID_TERRATEC, 
USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1)},
[RTL2832U_1F4D_B803] = {
USB_DEVICE(USB_VID_GTEK, USB_PID_GTEK)},
+   [RTL2832U_0CCD_00B3] = {
+   USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK)},
{} /* terminating entry */
  };

@@ -1265,7 +1284,7 @@ static struct dvb_usb_device_properties 
rtl28xxu_properties[] = {

.i2c_algo =&rtl28xxu_i2c_algo,

-   .num_device_descs = 2,
+   .num_device_descs = 3,
.devices = {
{
.name = "Terratec Cinergy T Stick Black",
@@ -1279,6 +1298,12 @@ static struct dvb_usb_device_properties 
rtl28xxu_properties[] = {
&rtl28xxu_table[RTL2832U_1F4D_B803],
},
},
+   {
+   .name = "NOXON DAB/DAB+ USB dongle",
+   .warm_ids = {
+   &rtl28xxu_table[RTL2832U_0CCD_00B3],
+   },
+   },
}
},




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


Re: [PATCH v4 0/5] support for rtl2832

2012-05-17 Thread Antti Palosaari

On 17.05.2012 01:13, Thomas Mair wrote:

This is the new version of the patch series to add support for the
rtl2832 demodulator driver. Before applying the patches you need to
add the fc0012/fc0013 driver from Hans-Frider Vogt.


Who wants to review those tuner drivers?


The changes from the privious version of the patches are manly in the
rtl2832 demod driver to fix code style issues, a nasty bug in the
frontends Makefile and the removal of the signal statistics functionality
which was badly broken in version 0.3 of the driver.

The one thing that I am not really confident with is the Kconfig file for
the dvb frontend driver. Are the changes I made right? And if not what
kind of changes need to be made?

Thanks Antti and poma for your comments!



I have reviewed all patches and commented some issues. Those are after 
all relative small issues you can sent just new patch top of that to fix 
or rebase whole patch series and sent new. It is up to you.



regards
Antti



Regards
Thomas

Thomas Mair (5):
   rtl2832 ver. 0.4: removed signal statistics
   rtl28xxu: support for the rtl2832 demod driver
   rtl28xxu: renamed rtl2831_rd/rtl2831_wr to rtl28xx_rd/rtl28xx_wr
   rtl28xxu: support G-Tek Electronics Group Lifeview LV5TDLX DVB-T
   rtl28xxu: support Terratec Noxon DAB/DAB+ stick

  drivers/media/dvb/dvb-usb/Kconfig  |3 +
  drivers/media/dvb/dvb-usb/dvb-usb-ids.h|3 +
  drivers/media/dvb/dvb-usb/rtl28xxu.c   |  513 --
  drivers/media/dvb/frontends/Kconfig|7 +
  drivers/media/dvb/frontends/Makefile   |1 +
  drivers/media/dvb/frontends/rtl2832.c  |  825 
  drivers/media/dvb/frontends/rtl2832.h  |   74 +++
  drivers/media/dvb/frontends/rtl2832_priv.h |  258 +
  8 files changed, 1636 insertions(+), 48 deletions(-)
  create mode 100644 drivers/media/dvb/frontends/rtl2832.c
  create mode 100644 drivers/media/dvb/frontends/rtl2832.h
  create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h




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


[PATCH 00/10] SMIA(++) driver improvements, fixes

2012-05-17 Thread Sakari Ailus
Hi,

This patchset contains a few improvements and fixes to the SMIA++
driver. Perhaps most importantly, it's no longer necessary to use board
code to use the driver: alternatively a clock name can be provided
instead of a function to configure the external clock. The platform data
function to configure the clock will be removed later on when platforms
such as the OMAP 3 allow controlling the clock through the clock framework.

Support for 8-bit raw bayer formats is added, too. There are changes in
quirk handling and 8-bit only reads (based on a quirk flag) for badly
behaving sensors.

Cheers,

-- 
Sakari Ailus
sakari.ai...@maxwell.research.nokia.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10] smiapp: Allow using external clock from the clock framework

2012-05-17 Thread Sakari Ailus
Instead of providing a function in platform data, allow also providing the
name of the external clock and use it through the clock framework.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c |   55 ++
 drivers/media/video/smiapp/smiapp.h  |1 +
 include/media/smiapp.h   |1 +
 3 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index a8a1db9..999f3fc 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -26,6 +26,7 @@
  *
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -,8 +1112,11 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
}
usleep_range(1000, 1000);
 
-   rval = sensor->platform_data->set_xclk(&sensor->src->sd,
-   sensor->platform_data->ext_clk);
+   if (sensor->platform_data->set_xclk)
+   rval = sensor->platform_data->set_xclk(
+   &sensor->src->sd, sensor->platform_data->ext_clk);
+   else
+   rval = clk_enable(sensor->ext_clk);
if (rval < 0) {
dev_dbg(&client->dev, "failed to set xclk\n");
goto out_xclk_fail;
@@ -1231,7 +1235,10 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
 out_cci_addr_fail:
if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN)
gpio_set_value(sensor->platform_data->xshutdown, 0);
-   sensor->platform_data->set_xclk(&sensor->src->sd, 0);
+   if (sensor->platform_data->set_xclk)
+   sensor->platform_data->set_xclk(&sensor->src->sd, 0);
+   else
+   clk_disable(sensor->ext_clk);
 
 out_xclk_fail:
regulator_disable(sensor->vana);
@@ -1256,7 +1263,10 @@ static void smiapp_power_off(struct smiapp_sensor 
*sensor)
 
if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN)
gpio_set_value(sensor->platform_data->xshutdown, 0);
-   sensor->platform_data->set_xclk(&sensor->src->sd, 0);
+   if (sensor->platform_data->set_xclk)
+   sensor->platform_data->set_xclk(&sensor->src->sd, 0);
+   else
+   clk_disable(sensor->ext_clk);
usleep_range(5000, 5000);
regulator_disable(sensor->vana);
sensor->streaming = 0;
@@ -2327,6 +2337,28 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
return -ENODEV;
}
 
+   if (!sensor->platform_data->set_xclk) {
+   sensor->ext_clk = clk_get(&client->dev,
+ sensor->platform_data->ext_clk_name);
+   if (IS_ERR(sensor->ext_clk)) {
+   dev_err(&client->dev, "could not get clock %s\n",
+   sensor->platform_data->ext_clk_name);
+   rval = -ENODEV;
+   goto out_clk_get;
+   }
+
+   rval = clk_set_rate(sensor->ext_clk,
+   sensor->platform_data->ext_clk);
+   if (rval < 0) {
+   dev_err(&client->dev,
+   "unable to set clock %s freq to %u\n",
+   sensor->platform_data->ext_clk_name,
+   sensor->platform_data->ext_clk);
+   rval = -ENODEV;
+   goto out_clk_set_rate;
+   }
+   }
+
if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN) {
if (gpio_request_one(sensor->platform_data->xshutdown, 0,
 "SMIA++ xshutdown") != 0) {
@@ -2334,7 +2366,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev)
"unable to acquire reset gpio %d\n",
sensor->platform_data->xshutdown);
rval = -ENODEV;
-   goto out_gpio_request;
+   goto out_clk_set_rate;
}
}
 
@@ -2589,7 +2621,11 @@ out_smiapp_power_on:
if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN)
gpio_free(sensor->platform_data->xshutdown);
 
-out_gpio_request:
+out_clk_set_rate:
+   clk_put(sensor->ext_clk);
+   sensor->ext_clk = NULL;
+
+out_clk_get:
regulator_put(sensor->vana);
sensor->vana = NULL;
return rval;
@@ -2778,7 +2814,10 @@ static int __exit smiapp_remove(struct i2c_client 
*client)
if (sensor->power_count) {
if (sensor->platform_data->xshutdown != SMIAPP_NO_XSHUTDOWN)
gpio_set_value(sensor->platform_data->xshutdown, 0);
-   sensor->platform_data->set_xclk(&sensor->src->sd, 0);
+   if (sensor->platform_data->set_xclk)
+   sensor->platform_data->set_xclk(&sensor->src->sd, 0);

[PATCH 02/10] smiapp: Pass struct sensor to register writing commands instead of i2c_client

2012-05-17 Thread Sakari Ailus
Pass struct sensor to register access commands. This allows taking quirks
into account in register access.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c  |  154 ++---
 drivers/media/video/smiapp/smiapp-quirk.c |4 +-
 drivers/media/video/smiapp/smiapp-regs.c  |7 +-
 drivers/media/video/smiapp/smiapp-regs.h  |6 +-
 4 files changed, 84 insertions(+), 87 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index 999f3fc..de5c947 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -75,12 +75,12 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
int embedded_start = -1, embedded_end = -1;
int image_start = 0;
 
-   rval = smiapp_read(client, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_TYPE,
+   rval = smiapp_read(sensor, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_TYPE,
   &fmt_model_type);
if (rval)
return rval;
 
-   rval = smiapp_read(client, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_SUBTYPE,
+   rval = smiapp_read(sensor, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_SUBTYPE,
   &fmt_model_subtype);
if (rval)
return rval;
@@ -106,7 +106,7 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
 
if (fmt_model_type == SMIAPP_FRAME_FORMAT_MODEL_TYPE_2BYTE) {
rval = smiapp_read(
-   client,
+   sensor,
SMIAPP_REG_U16_FRAME_FORMAT_DESCRIPTOR_2(i),
&desc);
if (rval)
@@ -120,7 +120,7 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
} else if (fmt_model_type
   == SMIAPP_FRAME_FORMAT_MODEL_TYPE_4BYTE) {
rval = smiapp_read(
-   client,
+   sensor,
SMIAPP_REG_U32_FRAME_FORMAT_DESCRIPTOR_4(i),
&desc);
if (rval)
@@ -199,44 +199,43 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
 
 static int smiapp_pll_configure(struct smiapp_sensor *sensor)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
struct smiapp_pll *pll = &sensor->pll;
int rval;
 
rval = smiapp_write(
-   client, SMIAPP_REG_U16_VT_PIX_CLK_DIV, pll->vt_pix_clk_div);
+   sensor, SMIAPP_REG_U16_VT_PIX_CLK_DIV, pll->vt_pix_clk_div);
if (rval < 0)
return rval;
 
rval = smiapp_write(
-   client, SMIAPP_REG_U16_VT_SYS_CLK_DIV, pll->vt_sys_clk_div);
+   sensor, SMIAPP_REG_U16_VT_SYS_CLK_DIV, pll->vt_sys_clk_div);
if (rval < 0)
return rval;
 
rval = smiapp_write(
-   client, SMIAPP_REG_U16_PRE_PLL_CLK_DIV, pll->pre_pll_clk_div);
+   sensor, SMIAPP_REG_U16_PRE_PLL_CLK_DIV, pll->pre_pll_clk_div);
if (rval < 0)
return rval;
 
rval = smiapp_write(
-   client, SMIAPP_REG_U16_PLL_MULTIPLIER, pll->pll_multiplier);
+   sensor, SMIAPP_REG_U16_PLL_MULTIPLIER, pll->pll_multiplier);
if (rval < 0)
return rval;
 
/* Lane op clock ratio does not apply here. */
rval = smiapp_write(
-   client, SMIAPP_REG_U32_REQUESTED_LINK_BIT_RATE_MBPS,
+   sensor, SMIAPP_REG_U32_REQUESTED_LINK_BIT_RATE_MBPS,
DIV_ROUND_UP(pll->op_sys_clk_freq_hz, 100 / 256 / 256));
if (rval < 0 || sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
return rval;
 
rval = smiapp_write(
-   client, SMIAPP_REG_U16_OP_PIX_CLK_DIV, pll->op_pix_clk_div);
+   sensor, SMIAPP_REG_U16_OP_PIX_CLK_DIV, pll->op_pix_clk_div);
if (rval < 0)
return rval;
 
return smiapp_write(
-   client, SMIAPP_REG_U16_OP_SYS_CLK_DIV, pll->op_sys_clk_div);
+   sensor, SMIAPP_REG_U16_OP_SYS_CLK_DIV, pll->op_sys_clk_div);
 }
 
 static int smiapp_pll_update(struct smiapp_sensor *sensor)
@@ -425,7 +424,6 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
struct smiapp_sensor *sensor =
container_of(ctrl->handler, struct smiapp_subdev, ctrl_handler)
->sensor;
-   struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
u32 orient = 0;
int exposure;
int rval;
@@ -433,12 +431,12 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
switch (ctrl->id) {
case V4L2_CID_ANALOGUE_GAIN:
return smiapp_write(
-   client,
+   sensor,
SMIAPP_REG_U16_ANA

[PATCH 03/10] smiapp: Quirk for sensors that only do 8-bit reads

2012-05-17 Thread Sakari Ailus
Some sensors implement only 8-bit read functionality and fail on wider
reads. Add a quirk flag for such sensors.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-quirk.h |1 +
 drivers/media/video/smiapp/smiapp-regs.c  |   73 +
 drivers/media/video/smiapp/smiapp-regs.h  |1 +
 3 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-quirk.h 
b/drivers/media/video/smiapp/smiapp-quirk.h
index 7a1b3a0..de82cdf 100644
--- a/drivers/media/video/smiapp/smiapp-quirk.h
+++ b/drivers/media/video/smiapp/smiapp-quirk.h
@@ -46,6 +46,7 @@ struct smiapp_quirk {
 
 /* op pix clock is for all lanes in total normally */
 #define SMIAPP_QUIRK_FLAG_OP_PIX_CLOCK_PER_LANE(1 << 0)
+#define SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY   (1 << 1)
 
 struct smiapp_reg_8 {
u16 reg;
diff --git a/drivers/media/video/smiapp/smiapp-regs.c 
b/drivers/media/video/smiapp/smiapp-regs.c
index e5e5f43..9c43064 100644
--- a/drivers/media/video/smiapp/smiapp-regs.c
+++ b/drivers/media/video/smiapp/smiapp-regs.c
@@ -78,19 +78,15 @@ static uint32_t float_to_u32_mul_100(struct i2c_client 
*client,
  * Read a 8/16/32-bit i2c register.  The value is returned in 'val'.
  * Returns zero if successful, or non-zero otherwise.
  */
-int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
+static int smiapp_read(struct smiapp_sensor *sensor, u16 reg,
+  u16 len, u32 *val)
 {
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
struct i2c_msg msg;
unsigned char data[4];
-   unsigned int len = (u8)(reg >> 16);
u16 offset = reg;
int r;
 
-   if (len != SMIA_REG_8BIT && len != SMIA_REG_16BIT
-   && len != SMIA_REG_32BIT)
-   return -EINVAL;
-
msg.addr = client->addr;
msg.flags = 0;
msg.len = 2;
@@ -132,9 +128,6 @@ int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 
*val)
BUG();
}
 
-   if (reg & SMIA_REG_FLAG_FLOAT)
-   *val = float_to_u32_mul_100(client, *val);
-
return 0;
 
 err:
@@ -143,6 +136,68 @@ err:
return r;
 }
 
+/* Read a register using 8-bit access only. */
+static int smiapp_read_8only(struct smiapp_sensor *sensor, u16 reg,
+u16 len, u32 *val)
+{
+   unsigned int i;
+   int rval;
+
+   *val = 0;
+
+   for (i = 0; i < len; i++) {
+   u32 val8;
+
+   rval = smiapp_read(sensor, reg + i, 1, &val8);
+   if (rval < 0)
+   return rval;
+   *val |= val8 << ((len - i - 1) << 3);
+   }
+
+   return 0;
+}
+
+/*
+ * Read a 8/16/32-bit i2c register.  The value is returned in 'val'.
+ * Returns zero if successful, or non-zero otherwise.
+ */
+static int __smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val,
+bool only8)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
+   unsigned int len = (u8)(reg >> 16);
+   int rval;
+
+   if (len != SMIA_REG_8BIT && len != SMIA_REG_16BIT
+   && len != SMIA_REG_32BIT)
+   return -EINVAL;
+
+   if (len == SMIA_REG_8BIT && !only8)
+   rval = smiapp_read(sensor, (u16)reg, len, val);
+   else
+   rval = smiapp_read_8only(sensor, (u16)reg, len, val);
+   if (rval < 0)
+   return rval;
+
+   if (reg & SMIA_REG_FLAG_FLOAT)
+   *val = float_to_u32_mul_100(client, *val);
+
+   return 0;
+}
+
+int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val)
+{
+   return __smiapp_read(
+   sensor, reg, val,
+   smiapp_needs_quirk(sensor,
+  SMIAPP_QUIRK_FLAG_8BIT_READ_ONLY));
+}
+
+int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val)
+{
+   return __smiapp_read(sensor, reg, val, true);
+}
+
 /*
  * Write to a 8/16-bit register.
  * Returns zero if successful, or non-zero otherwise.
diff --git a/drivers/media/video/smiapp/smiapp-regs.h 
b/drivers/media/video/smiapp/smiapp-regs.h
index 1edfd20..7f9013b 100644
--- a/drivers/media/video/smiapp/smiapp-regs.h
+++ b/drivers/media/video/smiapp/smiapp-regs.h
@@ -43,6 +43,7 @@ struct smia_reg {
 struct smiapp_sensor;
 
 int smiapp_read(struct smiapp_sensor *sensor, u32 reg, u32 *val);
+int smiapp_read_8only(struct smiapp_sensor *sensor, u32 reg, u32 *val);
 int smiapp_write(struct smiapp_sensor *sensor, u32 reg, u32 val);
 
 #endif
-- 
1.7.2.5

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


[PATCH 05/10] smiapp: Round minimum pre_pll up rather than down in ip_clk_freq check

2012-05-17 Thread Sakari Ailus
The pre_pll divisor must be such that ext_clk / pre_pll divisor does not
result in a frequency that is greater than pll_ip_clk_freq. Fix this.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp-pll.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/smiapp-pll.c b/drivers/media/video/smiapp-pll.c
index a416e27..a2e41a2 100644
--- a/drivers/media/video/smiapp-pll.c
+++ b/drivers/media/video/smiapp-pll.c
@@ -124,8 +124,9 @@ int smiapp_pll_calculate(struct device *dev, struct 
smiapp_pll_limits *limits,
   limits->min_pll_ip_freq_hz));
limits->min_pre_pll_clk_div =
max_t(uint16_t, limits->min_pre_pll_clk_div,
- clk_div_even(pll->ext_clk_freq_hz /
-  limits->max_pll_ip_freq_hz));
+ clk_div_even_up(
+ DIV_ROUND_UP(pll->ext_clk_freq_hz,
+  limits->max_pll_ip_freq_hz)));
dev_dbg(dev, "pre-pll check: min / max pre_pll_clk_div: %d / %d\n",
limits->min_pre_pll_clk_div, limits->max_pre_pll_clk_div);
 
-- 
1.7.2.5

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


[PATCH 04/10] smiapp: Use 8-bit reads only before identifying the sensor

2012-05-17 Thread Sakari Ailus
Some sensors only allow 8-bit access, so use safe 8-bit access before the
sensor has been identified.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c |   63 --
 1 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index de5c947..3bf086f 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -2197,51 +2197,56 @@ static int smiapp_identify_module(struct v4l2_subdev 
*subdev)
minfo->name = SMIAPP_NAME;
 
/* Module info */
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_MANUFACTURER_ID,
-  &minfo->manufacturer_id);
+   rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_MANUFACTURER_ID,
+&minfo->manufacturer_id);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U16_MODEL_ID,
-  &minfo->model_id);
+   rval = smiapp_read_8only(sensor, SMIAPP_REG_U16_MODEL_ID,
+&minfo->model_id);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MAJOR,
-  &minfo->revision_number_major);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_REVISION_NUMBER_MAJOR,
+&minfo->revision_number_major);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_REVISION_NUMBER_MINOR,
-  &minfo->revision_number_minor);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_REVISION_NUMBER_MINOR,
+&minfo->revision_number_minor);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_YEAR,
-  &minfo->module_year);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_MODULE_DATE_YEAR,
+&minfo->module_year);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_MONTH,
-  &minfo->module_month);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_MODULE_DATE_MONTH,
+&minfo->module_month);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY,
-  &minfo->module_day);
+   rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_MODULE_DATE_DAY,
+&minfo->module_day);
 
/* Sensor info */
if (!rval)
-   rval = smiapp_read(sensor,
-  SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID,
-  &minfo->sensor_manufacturer_id);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_SENSOR_MANUFACTURER_ID,
+&minfo->sensor_manufacturer_id);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U16_SENSOR_MODEL_ID,
-  &minfo->sensor_model_id);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U16_SENSOR_MODEL_ID,
+&minfo->sensor_model_id);
if (!rval)
-   rval = smiapp_read(sensor,
-  SMIAPP_REG_U8_SENSOR_REVISION_NUMBER,
-  &minfo->sensor_revision_number);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_SENSOR_REVISION_NUMBER,
+&minfo->sensor_revision_number);
if (!rval)
-   rval = smiapp_read(sensor,
-  SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION,
-  &minfo->sensor_firmware_version);
+   rval = smiapp_read_8only(sensor,
+SMIAPP_REG_U8_SENSOR_FIRMWARE_VERSION,
+&minfo->sensor_firmware_version);
 
/* SMIA */
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIA_VERSION,
-  &minfo->smia_version);
+   rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_SMIA_VERSION,
+&minfo->smia_version);
if (!rval)
-   rval = smiapp_read(sensor, SMIAPP_REG_U8_SMIAPP_VERSION,
-  &minfo->smiapp_version);
+   rval = smiapp_read_8only(sensor, SMIAPP_REG_U8_SMIAPP_VERSION,
+ 

[PATCH 06/10] smiapp: Initialise rval in smiapp_read_nvm()

2012-05-17 Thread Sakari Ailus
rval was not properly initialised in smiapp_read_nvm(). Do that.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index 3bf086f..6524091 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -873,7 +873,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor,
   unsigned char *nvm)
 {
u32 i, s, p, np, v;
-   int rval, rval2;
+   int rval = 0, rval2;
 
np = sensor->nvm_size / SMIAPP_NVM_PAGE_SIZE;
for (p = 0; p < np; p++) {
-- 
1.7.2.5

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


[PATCH 07/10] smiapp: Use non-binning limits if the binning limit is zero

2012-05-17 Thread Sakari Ailus
Some sensors do use binning but do not have valid limits in binning
registers. Use non-binning limits in that case.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c |   31 +++--
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index 6524091..47d6901 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -653,6 +653,7 @@ static int smiapp_get_all_limits(struct smiapp_sensor 
*sensor)
 
 static int smiapp_get_limits_binning(struct smiapp_sensor *sensor)
 {
+   struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
static u32 const limits[] = {
SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN,
SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN,
@@ -671,11 +672,11 @@ static int smiapp_get_limits_binning(struct smiapp_sensor 
*sensor)
SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MIN,
SMIAPP_LIMIT_FINE_INTEGRATION_TIME_MAX_MARGIN,
};
+   unsigned int i;
+   int rval;
 
if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY] ==
SMIAPP_BINNING_CAPABILITY_NO) {
-   unsigned int i;
-
for (i = 0; i < ARRAY_SIZE(limits); i++)
sensor->limits[limits[i]] =
sensor->limits[limits_replace[i]];
@@ -683,7 +684,31 @@ static int smiapp_get_limits_binning(struct smiapp_sensor 
*sensor)
return 0;
}
 
-   return smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits));
+   rval = smiapp_get_limits(sensor, limits, ARRAY_SIZE(limits));
+   if (rval < 0)
+   return rval;
+
+   /*
+* Sanity check whether the binning limits are valid. If not,
+* use the non-binning ones.
+*/
+   if (sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN]
+   && sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN]
+   && sensor->limits[SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN])
+   return 0;
+
+   for (i = 0; i < ARRAY_SIZE(limits); i++) {
+   dev_dbg(&client->dev,
+   "replace limit 0x%8.8x \"%s\" = %d, 0x%x\n",
+   smiapp_reg_limits[limits[i]].addr,
+   smiapp_reg_limits[limits[i]].what,
+   sensor->limits[limits_replace[i]],
+   sensor->limits[limits_replace[i]]);
+   sensor->limits[limits[i]] =
+   sensor->limits[limits_replace[i]];
+   }
+
+   return 0;
 }
 
 static int smiapp_get_mbus_formats(struct smiapp_sensor *sensor)
-- 
1.7.2.5

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


[PATCH 09/10] smiapp: Add support for 8-bit uncompressed formats

2012-05-17 Thread Sakari Ailus
Add support for uncompressed 8-bit raw bayer formats.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index 47d6901..ffc6eb7 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -367,6 +367,10 @@ static const struct smiapp_csi_data_format 
smiapp_csi_data_formats[] = {
{ V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_RGGB, },
{ V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_BGGR, },
{ V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8, 10, 8, SMIAPP_PIXEL_ORDER_GBRG, },
+   { V4L2_MBUS_FMT_SGRBG8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_GRBG, },
+   { V4L2_MBUS_FMT_SRGGB8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_RGGB, },
+   { V4L2_MBUS_FMT_SBGGR8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_BGGR, },
+   { V4L2_MBUS_FMT_SGBRG8_1X8, 8, 8, SMIAPP_PIXEL_ORDER_GBRG, },
 };
 
 const char *pixel_order_str[] = { "GRBG", "RGGB", "BGGR", "GBRG" };
-- 
1.7.2.5

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


[PATCH 08/10] smiapp: Allow generic quirk registers

2012-05-17 Thread Sakari Ailus
Implement more generic quirk registers than just limit and capability
registers. This comes with the expense of a little bit more access time so
these should be only used when really needed.

Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-quirk.c |   46 +
 drivers/media/video/smiapp/smiapp-quirk.h |   10 ++
 drivers/media/video/smiapp/smiapp-regs.c  |4 ++
 3 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-quirk.c 
b/drivers/media/video/smiapp/smiapp-quirk.c
index 81c2be3..55e8795 100644
--- a/drivers/media/video/smiapp/smiapp-quirk.c
+++ b/drivers/media/video/smiapp/smiapp-quirk.c
@@ -81,6 +81,52 @@ int smiapp_replace_limit_at(struct smiapp_sensor *sensor,
return -EINVAL;
 }
 
+bool smiapp_quirk_reg(struct smiapp_sensor *sensor,
+ u32 reg, u32 *val)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
+   const struct smia_reg *sreg;
+
+   if (!sensor->minfo.quirk)
+   return false;
+
+   sreg = sensor->minfo.quirk->regs;
+
+   if (!sreg)
+   return false;
+
+   while (sreg->type) {
+   u16 type = reg >> 16;
+   u16 reg16 = reg;
+
+   if (sreg->type != type || sreg->reg != reg16) {
+   sreg++;
+   continue;
+   }
+
+   switch ((u8)type) {
+   case SMIA_REG_8BIT:
+   dev_dbg(&client->dev, "quirk: 0x%8.8x: 0x%2.2x\n",
+   reg, sreg->val);
+   break;
+   case SMIA_REG_16BIT:
+   dev_dbg(&client->dev, "quirk: 0x%8.8x: 0x%4.4x\n",
+   reg, sreg->val);
+   break;
+   case SMIA_REG_32BIT:
+   dev_dbg(&client->dev, "quirk: 0x%8.8x: 0x%8.8x\n",
+   reg, sreg->val);
+   break;
+   }
+
+   *val = sreg->val;
+
+   return true;
+   }
+
+   return false;
+}
+
 static int jt8ew9_limits(struct smiapp_sensor *sensor)
 {
if (sensor->minfo.revision_number_major < 0x03)
diff --git a/drivers/media/video/smiapp/smiapp-quirk.h 
b/drivers/media/video/smiapp/smiapp-quirk.h
index de82cdf..f4dcaab 100644
--- a/drivers/media/video/smiapp/smiapp-quirk.h
+++ b/drivers/media/video/smiapp/smiapp-quirk.h
@@ -41,6 +41,7 @@ struct smiapp_quirk {
int (*post_poweron)(struct smiapp_sensor *sensor);
int (*pre_streamon)(struct smiapp_sensor *sensor);
int (*post_streamoff)(struct smiapp_sensor *sensor);
+   const struct smia_reg *regs;
unsigned long flags;
 };
 
@@ -55,6 +56,15 @@ struct smiapp_reg_8 {
 
 void smiapp_replace_limit(struct smiapp_sensor *sensor,
  u32 limit, u32 val);
+bool smiapp_quirk_reg(struct smiapp_sensor *sensor,
+ u32 reg, u32 *val);
+
+#define SMIAPP_MK_QUIRK_REG(_reg, _val) \
+   {   \
+   .type = (_reg >> 16),   \
+   .reg = (u16)_reg,   \
+   .val = _val,\
+   }
 
 #define smiapp_call_quirk(_sensor, _quirk, ...)
\
(_sensor->minfo.quirk &&\
diff --git a/drivers/media/video/smiapp/smiapp-regs.c 
b/drivers/media/video/smiapp/smiapp-regs.c
index 9c43064..b1812b1 100644
--- a/drivers/media/video/smiapp/smiapp-regs.c
+++ b/drivers/media/video/smiapp/smiapp-regs.c
@@ -172,6 +172,9 @@ static int __smiapp_read(struct smiapp_sensor *sensor, u32 
reg, u32 *val,
&& len != SMIA_REG_32BIT)
return -EINVAL;
 
+   if (smiapp_quirk_reg(sensor, reg, val))
+   goto found_quirk;
+
if (len == SMIA_REG_8BIT && !only8)
rval = smiapp_read(sensor, (u16)reg, len, val);
else
@@ -179,6 +182,7 @@ static int __smiapp_read(struct smiapp_sensor *sensor, u32 
reg, u32 *val,
if (rval < 0)
return rval;
 
+found_quirk:
if (reg & SMIA_REG_FLAG_FLOAT)
*val = float_to_u32_mul_100(client, *val);
 
-- 
1.7.2.5

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


[PATCH 10/10] smiapp: Use v4l2_ctrl_new_int_menu() instead of v4l2_ctrl_new_custom()

2012-05-17 Thread Sakari Ailus
Signed-off-by: Sakari Ailus 
---
 drivers/media/video/smiapp/smiapp-core.c |   17 ++---
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/media/video/smiapp/smiapp-core.c 
b/drivers/media/video/smiapp/smiapp-core.c
index ffc6eb7..f518026 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -508,7 +508,7 @@ static const struct v4l2_ctrl_ops smiapp_ctrl_ops = {
 static int smiapp_init_controls(struct smiapp_sensor *sensor)
 {
struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
-   struct v4l2_ctrl_config cfg;
+   unsigned int max;
int rval;
 
rval = v4l2_ctrl_handler_init(&sensor->pixel_array->ctrl_handler, 7);
@@ -572,17 +572,12 @@ static int smiapp_init_controls(struct smiapp_sensor 
*sensor)
goto error;
sensor->src->ctrl_handler.lock = &sensor->mutex;
 
-   memset(&cfg, 0, sizeof(cfg));
+   for (max = 0; sensor->platform_data->op_sys_clock[max + 1]; max++);
 
-   cfg.ops = &smiapp_ctrl_ops;
-   cfg.id = V4L2_CID_LINK_FREQ;
-   cfg.type = V4L2_CTRL_TYPE_INTEGER_MENU;
-   while (sensor->platform_data->op_sys_clock[cfg.max + 1])
-   cfg.max++;
-   cfg.qmenu_int = sensor->platform_data->op_sys_clock;
-
-   sensor->link_freq = v4l2_ctrl_new_custom(
-   &sensor->src->ctrl_handler, &cfg, NULL);
+   sensor->link_freq = v4l2_ctrl_new_int_menu(
+   &sensor->src->ctrl_handler, &smiapp_ctrl_ops,
+   V4L2_CID_LINK_FREQ, max, 0,
+   sensor->platform_data->op_sys_clock);
 
sensor->pixel_rate_csi = v4l2_ctrl_new_std(
&sensor->src->ctrl_handler, &smiapp_ctrl_ops,
-- 
1.7.2.5

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


cron job: media_tree daily build: ERRORS

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

Results of the daily build of media_tree:

date:Thu May 17 19:00:18 CEST 2012
git hash:61282daf505f3c8def09332ca337ac257b792029
gcc version:  i686-linux-gcc (GCC) 4.6.3
host hardware:x86_64
host os:  3.3-5.slh.3-amd64

linux-git-arm-eabi-exynos: WARNINGS
linux-git-arm-eabi-omap: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: ERRORS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: WARNINGS
linux-2.6.31.12-i686: ERRORS
linux-2.6.32.6-i686: ERRORS
linux-2.6.33-i686: ERRORS
linux-2.6.34-i686: WARNINGS
linux-2.6.35.3-i686: WARNINGS
linux-2.6.36-i686: WARNINGS
linux-2.6.37-i686: WARNINGS
linux-2.6.38.2-i686: WARNINGS
linux-2.6.39.1-i686: WARNINGS
linux-3.0-i686: WARNINGS
linux-3.1-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-2.6.31.12-x86_64: ERRORS
linux-2.6.32.6-x86_64: ERRORS
linux-2.6.33-x86_64: ERRORS
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35.3-x86_64: WARNINGS
linux-2.6.36-x86_64: WARNINGS
linux-2.6.37-x86_64: WARNINGS
linux-2.6.38.2-x86_64: WARNINGS
linux-2.6.39.1-x86_64: WARNINGS
linux-3.0-x86_64: WARNINGS
linux-3.1-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The V4L-DVB specification from this daily build is here:

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


[PATCH 1/2] dvb_cmd_name function

2012-05-17 Thread André Roth
---
 lib/include/dvb-fe.h  |1 +
 lib/libdvbv5/dvb-fe.c |   21 +++--
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h
index 872a558..b4c5279 100644
--- a/lib/include/dvb-fe.h
+++ b/lib/include/dvb-fe.h
@@ -108,6 +108,7 @@ int dvb_set_sys(struct dvb_v5_fe_parms *parms,
   fe_delivery_system_t sys);
 int dvb_set_compat_delivery_system(struct dvb_v5_fe_parms *parms,
   uint32_t desired_system);
+const char *dvb_cmd_name(int cmd);
 void dvb_fe_prt_parms(FILE *fp, const struct dvb_v5_fe_parms *parms);
 int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms);
 int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms);
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 1fa4ef5..4f7a217 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -380,6 +380,15 @@ int dvb_set_compat_delivery_system(struct dvb_v5_fe_parms 
*parms,
return 0;
 }
 
+const char *dvb_cmd_name(int cmd)
+{
+  if (cmd < DTV_USER_COMMAND_START)
+return dvb_v5_name[cmd];
+  else if (cmd <= DTV_MAX_USER_COMMAND)
+return dvb_user_name[cmd - DTV_USER_COMMAND_START];
+  return NULL;
+}
+
 void dvb_fe_prt_parms(FILE *fp, const struct dvb_v5_fe_parms *parms)
 {
int i;
@@ -398,11 +407,11 @@ void dvb_fe_prt_parms(FILE *fp, const struct 
dvb_v5_fe_parms *parms)
 
if (!attr_name || !*attr_name)
fprintf(fp, "%s = %u\n",
-   dvb_v5_name[parms->dvb_prop[i].cmd],
+   dvb_cmd_name(parms->dvb_prop[i].cmd),
parms->dvb_prop[i].u.data);
else
fprintf(fp, "%s = %s\n",
-   dvb_v5_name[parms->dvb_prop[i].cmd],
+   dvb_cmd_name(parms->dvb_prop[i].cmd),
*attr_name);
}
 };
@@ -417,8 +426,8 @@ int dvb_fe_retrieve_parm(struct dvb_v5_fe_parms *parms,
*value = parms->dvb_prop[i].u.data;
return 0;
}
-   fprintf(stderr, "%s (%d) command not found during retrieve\n",
-   dvb_v5_name[cmd], cmd);
+   fprintf(stderr, "command %s (%d) not found during retrieve\n",
+   dvb_cmd_name(cmd), cmd);
 
return EINVAL;
 }
@@ -433,8 +442,8 @@ int dvb_fe_store_parm(struct dvb_v5_fe_parms *parms,
parms->dvb_prop[i].u.data = value;
return 0;
}
-   fprintf(stderr, "%s (%d) command not found during store\n",
-   dvb_v5_name[cmd], cmd);
+   fprintf(stderr, "command %s (%d) not found during store\n",
+   dvb_cmd_name(cmd), cmd);
 
return EINVAL;
 }
-- 
1.7.2.5

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


[PATCH 2/2] ignore user commands on fe

2012-05-17 Thread André Roth
---
 lib/libdvbv5/dvb-fe.c |   32 
 lib/libdvbv5/dvb-v5-std.c |2 ++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 4f7a217..a91dd65 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -389,12 +389,21 @@ const char *dvb_cmd_name(int cmd)
   return NULL;
 }
 
+const char * const *dvb_attr_names(int cmd)
+{
+  if (cmd < DTV_USER_COMMAND_START)
+return dvb_v5_attr_names[cmd];
+  else if (cmd <= DTV_MAX_USER_COMMAND)
+return dvb_user_attr_names[cmd - DTV_USER_COMMAND_START];
+  return NULL;
+}
+
 void dvb_fe_prt_parms(FILE *fp, const struct dvb_v5_fe_parms *parms)
 {
int i;
 
for (i = 0; i < parms->n_props; i++) {
-   const char * const *attr_name = 
dvb_v5_attr_names[parms->dvb_prop[i].cmd];
+   const char * const *attr_name = 
dvb_attr_names(parms->dvb_prop[i].cmd);
if (attr_name) {
int j;
 
@@ -448,6 +457,15 @@ int dvb_fe_store_parm(struct dvb_v5_fe_parms *parms,
return EINVAL;
 }
 
+int dvb_copy_fe_props(struct dtv_property *from, int n, struct dtv_property 
*to)
+{
+  int i, j;
+  for (i = 0, j = 0; i < n; i++)
+if (from[i].cmd < DTV_USER_COMMAND_START)
+  to[j++] = from[i];
+  return j;
+}
+
 int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
 {
int n = 0;
@@ -471,7 +489,10 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *parms)
parms->dvb_prop[n].cmd = DTV_TUNE;
parms->n_props = n;
 
-   prop.props = parms->dvb_prop;
+   struct dtv_property fe_prop[DTV_MAX_COMMAND];
+n = dvb_copy_fe_props(parms->dvb_prop, n, fe_prop);
+
+   prop.props = fe_prop;
prop.num = n;
if (!parms->legacy_fe) {
if (ioctl(parms->fd, FE_GET_PROPERTY, &prop) == -1) {
@@ -538,8 +559,11 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *parms)
uint32_t freq;
uint32_t bw;
 
-   prop.props = parms->dvb_prop;
-   prop.num = parms->n_props + 1;
+   struct dtv_property fe_prop[DTV_MAX_COMMAND];
+int n = dvb_copy_fe_props(parms->dvb_prop, parms->n_props, fe_prop);
+
+   prop.props = fe_prop;
+   prop.num = n + 1;
parms->dvb_prop[parms->n_props].cmd = DTV_TUNE;
 
if (is_satellite(parms->current_sys)) {
diff --git a/lib/libdvbv5/dvb-v5-std.c b/lib/libdvbv5/dvb-v5-std.c
index ec588b1..fe66041 100644
--- a/lib/libdvbv5/dvb-v5-std.c
+++ b/lib/libdvbv5/dvb-v5-std.c
@@ -105,6 +105,7 @@ const unsigned int sys_dvbs_props[] = {
DTV_INNER_FEC,
DTV_VOLTAGE,
DTV_TONE,
+DTV_POLARIZATION,
0
 };
 
@@ -118,6 +119,7 @@ const unsigned int sys_dvbs2_props[] = {
DTV_MODULATION,
DTV_PILOT,
DTV_ROLLOFF,
+DTV_POLARIZATION,
0
 };
 
-- 
1.7.2.5

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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread poma
On 05/17/2012 04:19 PM, Antti Palosaari wrote:
> Moikka Thomas,
> 
> Here is the review. See comments below.
> 
> And conclusion is that it is ready for the Kernel merge. I did not see
> any big functiuonality problems - only some small issues that are likely
> considered as a coding style etc. Feel free to fix those and sent new
> patc serie or just new patch top of that.
> 
> Reviewed-by: Antti Palosaari 
> 
> 
> On 17.05.2012 01:13, Thomas Mair wrote:
>> Changelog for ver. 0.3:
>> - removed statistics as their calculation was wrong
>> - fixed bug in Makefile
>> - indentation and code style improvements
>>
>> Signed-off-by: Thomas Mair
>> ---
>>   drivers/media/dvb/frontends/Kconfig|7 +
>>   drivers/media/dvb/frontends/Makefile   |1 +
>>   drivers/media/dvb/frontends/rtl2832.c  |  825
>> 
>>   drivers/media/dvb/frontends/rtl2832.h  |   74 +++
>>   drivers/media/dvb/frontends/rtl2832_priv.h |  258 +
>>   5 files changed, 1165 insertions(+), 0 deletions(-)
>>   create mode 100644 drivers/media/dvb/frontends/rtl2832.c
>>   create mode 100644 drivers/media/dvb/frontends/rtl2832.h
>>   create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h
>>
>> diff --git a/drivers/media/dvb/frontends/Kconfig
>> b/drivers/media/dvb/frontends/Kconfig
>> index f479834..f7d67d7 100644
>> --- a/drivers/media/dvb/frontends/Kconfig
>> +++ b/drivers/media/dvb/frontends/Kconfig
>> @@ -432,6 +432,13 @@ config DVB_RTL2830
>>   help
>> Say Y when you want to support this frontend.
>>
>> +config DVB_RTL2832
>> +tristate "Realtek RTL2832 DVB-T"
>> +depends on DVB_CORE&&  I2C
>> +default m if DVB_FE_CUSTOMISE
>> +help
>> +  Say Y when you want to support this frontend.
>> +
> 
> It is correct.
> 
> Just for the comment as you said in cover letter that you are unsure
> about that.
> 
>>   comment "DVB-C (cable) frontends"
>>   depends on DVB_CORE
>>
>> diff --git a/drivers/media/dvb/frontends/Makefile
>> b/drivers/media/dvb/frontends/Makefile
>> index b0381dc..bbf2955 100644
>> --- a/drivers/media/dvb/frontends/Makefile
>> +++ b/drivers/media/dvb/frontends/Makefile
>> @@ -98,6 +98,7 @@ obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o
>>   obj-$(CONFIG_DVB_A8293) += a8293.o
>>   obj-$(CONFIG_DVB_TDA10071) += tda10071.o
>>   obj-$(CONFIG_DVB_RTL2830) += rtl2830.o
>> +obj-$(CONFIG_DVB_RTL2830) += rtl2832.o
>>   obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
>>   obj-$(CONFIG_DVB_AF9033) += af9033.o
>>
>> diff --git a/drivers/media/dvb/frontends/rtl2832.c
>> b/drivers/media/dvb/frontends/rtl2832.c
>> new file mode 100644
>> index 000..51c7927
>> --- /dev/null
>> +++ b/drivers/media/dvb/frontends/rtl2832.c
>> @@ -0,0 +1,825 @@
>> +/*
>> + * Realtek RTL2832 DVB-T demodulator driver
>> + *
>> + * Copyright (C) 2012 Thomas Mair
>> + *
>> + *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.
>> + */
>> +
>> +#include "rtl2832_priv.h"
>> +
>> +
>> +int rtl2832_debug;
>> +module_param_named(debug, rtl2832_debug, int, 0644);
>> +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging
>> (default:off).");
>> +
>> +
>> +static int reg_mask[32] = {
> 
> This should be static const.
> 
>> +0x0001,
>> +0x0003,
>> +0x0007,
>> +0x000f,
>> +0x001f,
>> +0x003f,
>> +0x007f,
>> +0x00ff,
>> +0x01ff,
>> +0x03ff,
>> +0x07ff,
>> +0x0fff,
>> +0x1fff,
>> +0x3fff,
>> +0x7fff,
>> +0x,
>> +0x0001,
>> +0x0003,
>> +0x0007,
>> +0x000f,
>> +0x001f,
>> +0x003f,
>> +0x007f,
>> +0x00ff,
>> +0x01ff,
>> +0x03ff,
>> +0x07ff,
>> +0x0fff,
>> +0x1fff,
>> +0x3fff,
>> +0x7fff,
>> +0x
>> +};
>> +
>> +struct rtl2832_reg_entry registers[] = {
> 
> static const struct
> 
>> +[DVBT_SOFT_RST]= {0x1, 0x1,   2, 2},
>> +[DVBT_IIC_REPEAT]= {0x1, 0x1,   3, 3},
>> +[DVBT_TR_WAIT_MIN_8K]= {0x1, 0x88, 11, 2},
>> +[DVBT_RSD_BER_FAIL_VAL]= {0x1, 0x8f, 15, 0},
>> +[DVBT_EN_BK_TRK]= {0x1, 0xa6,  7, 7},
>> +[DVBT_AD_EN_REG]= {0x0, 0x8,   7, 7},
>> +

Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread Antti Palosaari

On 17.05.2012 23:27, poma wrote:

On 05/17/2012 04:19 PM, Antti Palosaari wrote:

Moikka Thomas,

Here is the review. See comments below.

And conclusion is that it is ready for the Kernel merge. I did not see
any big functiuonality problems - only some small issues that are likely
considered as a coding style etc. Feel free to fix those and sent new
patc serie or just new patch top of that.

Reviewed-by: Antti Palosaari


[...]


rtl2832.c.diff:
- static int ->  static const
- struct ->  static const struct
- newline between function call and error check ->  […]
- 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
(/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
[…]
Use one space around (on each side of) most binary and ternary operators,
such as any of these:

 =  +  -<   >   *  /  %  |&   ^<=>=  ==  !=  ?  :

[…]

grep '>>\|<<' v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
+   len = (msb>>  3) + 1;
+   reading_tmp |= reading[i]<<  ((len-1-i)*8);
+   *val = (reading_tmp>>  lsb)&  mask;
+   len = (msb>>  3) + 1;
+   reading_tmp |= reading[i]<<  ((len-1-i)*8);
+   writing_tmp = reading_tmp&  ~(mask<<  lsb);
+   writing_tmp |= ((val&  mask)<<  lsb);
+   writing[i] = (writing_tmp>>  ((len-1-i)*8))&  0xff;
+   num = bw_mode<<  20;

Bitshift operators seems to be OK.
Something else?


(len-1-i)*8


- 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
Compared to 'rtl2830_priv.h' seems to be OK.

./checkpatch.pl --no-tree
v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 1177 lines checked

v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

How do you produce this error:
"ERROR: Macros with complex values should be enclosed in parenthesis…"?


Just running checkpatch.pl --file foo

And it is ERROR which means it *must* be corrected.

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


Re: [PATCH v4 4/5] rtl28xxu: support G-Tek Electronics Group Lifeview LV5TDLX DVB-T

2012-05-17 Thread poma
On 05/17/2012 04:47 PM, Antti Palosaari wrote:
> On 17.05.2012 01:13, Thomas Mair wrote:
>> Signed-off-by: Thomas Mair
> 
> Nacked.
> Better PID definition is required.
> 
>> ---
>>   drivers/media/dvb/dvb-usb/dvb-usb-ids.h |1 +
>>   drivers/media/dvb/dvb-usb/rtl28xxu.c|   11 ++-
>>   2 files changed, 11 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
>> b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
>> index fd37be0..b0a86e9 100644
>> --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
>> +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
>> @@ -135,6 +135,7 @@
>>   #define USB_PID_GENIUS_TVGO_DVB_T030x4012
>>   #define USB_PID_GRANDTEC_DVBT_USB_COLD0x0fa0
>>   #define USB_PID_GRANDTEC_DVBT_USB_WARM0x0fa1
>> +#define USB_PID_GTEK0xb803
> 
> You must give better name for the device. Vendor name is not enough as
> many vendors has surely more than one device model.
> 
> Correct PID is something like USB_PID_GTEK_LIFEVIEW_LV5TDLX
>

Precisely - USB_PID_DELOCK_USB2_DVBT according to the device:
http://www.delock.de/produkte/G_61744/merkmale.html
regardless of what's in '/usr/share/hwdata/usb.ids'
;)

>>   #define USB_PID_INTEL_CE95000x9500
>>   #define USB_PID_ITETECH_IT91350x9135
>>   #define USB_PID_ITETECH_IT9135_90050x9005
>> diff --git a/drivers/media/dvb/dvb-usb/rtl28xxu.c
>> b/drivers/media/dvb/dvb-usb/rtl28xxu.c
>> index 6817ef7..9056d28 100644
>> --- a/drivers/media/dvb/dvb-usb/rtl28xxu.c
>> +++ b/drivers/media/dvb/dvb-usb/rtl28xxu.c
>> @@ -1135,6 +1135,7 @@ enum rtl28xxu_usb_table_entry {
>>   RTL2831U_14AA_0160,
>>   RTL2831U_14AA_0161,
>>   RTL2832U_0CCD_00A9,
>> +RTL2832U_1F4D_B803,
>>   };
>>
>>   static struct usb_device_id rtl28xxu_table[] = {
>> @@ -1149,6 +1150,8 @@ static struct usb_device_id rtl28xxu_table[] = {
>>   /* RTL2832U */
>>   [RTL2832U_0CCD_00A9] = {
>>   USB_DEVICE(USB_VID_TERRATEC,
>> USB_PID_TERRATEC_CINERGY_T_STICK_BLACK_REV1)},
>> +[RTL2832U_1F4D_B803] = {
>> +USB_DEVICE(USB_VID_GTEK, USB_PID_GTEK)},
>>   {} /* terminating entry */
>>   };
>>
>> @@ -1262,7 +1265,7 @@ static struct dvb_usb_device_properties
>> rtl28xxu_properties[] = {
>>
>>   .i2c_algo =&rtl28xxu_i2c_algo,
>>
>> -.num_device_descs = 1,
>> +.num_device_descs = 2,
>>   .devices = {
>>   {
>>   .name = "Terratec Cinergy T Stick Black",
>> @@ -1270,6 +1273,12 @@ static struct dvb_usb_device_properties
>> rtl28xxu_properties[] = {
>>   &rtl28xxu_table[RTL2832U_0CCD_00A9],
>>   },
>>   },
>> +{
>> +.name = "G-Tek Electronics Group Lifeview LV5TDLX
>> DVB-T [RTL2832U]",
>> +.warm_ids = {
>> +&rtl28xxu_table[RTL2832U_1F4D_B803],
>> +},
>> +},
>>   }
>>   },
>>
> 
> 

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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread Thomas Mair
On 17.05.2012 22:41, Antti Palosaari wrote:
> On 17.05.2012 23:27, poma wrote:
>> On 05/17/2012 04:19 PM, Antti Palosaari wrote:
>>> Moikka Thomas,
>>>
>>> Here is the review. See comments below.
>>>
>>> And conclusion is that it is ready for the Kernel merge. I did not see
>>> any big functiuonality problems - only some small issues that are likely
>>> considered as a coding style etc. Feel free to fix those and sent new
>>> patc serie or just new patch top of that.
>>>
>>> Reviewed-by: Antti Palosaari
> 
> [...]
> 
>> rtl2832.c.diff:
>> - static int ->  static const
>> - struct ->  static const struct
>> - newline between function call and error check ->  […]
>> - 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
>> (/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
>> […]
>> Use one space around (on each side of) most binary and ternary operators,
>> such as any of these:
>>
>>  =  +  -<   >   *  /  %  |&   ^<=>=  ==  !=  ?  :
>>
>> […]
>>
>> grep '>>\|<<' v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
>> +len = (msb>>  3) + 1;
>> +reading_tmp |= reading[i]<<  ((len-1-i)*8);
>> +*val = (reading_tmp>>  lsb)&  mask;
>> +len = (msb>>  3) + 1;
>> +reading_tmp |= reading[i]<<  ((len-1-i)*8);
>> +writing_tmp = reading_tmp&  ~(mask<<  lsb);
>> +writing_tmp |= ((val&  mask)<<  lsb);
>> +writing[i] = (writing_tmp>>  ((len-1-i)*8))&  0xff;
>> +num = bw_mode<<  20;
>>
>> Bitshift operators seems to be OK.
>> Something else?
> 
> (len-1-i)*8
I almost have a new corrected version of the patch series ready, fixing this 
issues and the 
other ones you mentioned. 
> 
>> - 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
>> Compared to 'rtl2830_priv.h' seems to be OK.
>>
>> ./checkpatch.pl --no-tree
>> v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
>> ERROR: Missing Signed-off-by: line(s)
>>
>> total: 1 errors, 0 warnings, 1177 lines checked
>>
>> v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
>> problems, please review.  If any of these errors
>> are false positives report them to the maintainer, see
>> CHECKPATCH in MAINTAINERS.
>>
>> How do you produce this error:
>> "ERROR: Macros with complex values should be enclosed in parenthesis…"?
> 
> Just running checkpatch.pl --file foo
> 

For me checkpath.pl also does not report the error you reported. It does seem
strange to me, as the makros are the same as in rtl2830_priv.h

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


Re: Fwd: Bug#669715: dvb-apps: Channel/frequency/etc. data needs updating for London transmitters

2012-05-17 Thread Thomas Kernen

On 5/14/12 1:54 PM, Andrew Benham wrote:


I don't know if it's just Crystal Palace, but one of the multiplexes
thinks it's using QPSK even though it's using QAM64 - this messes up
'scan' unless one reorders the frequency list.
Having done the scan, one then needs to replace 'QPSK' by 'QAM_64' in
the output.


I reported the issue through my channels and the issue was fixed earlier 
this evening. The DVB-SI tables have been updated so that now the 
constellation type has been changed from 0 (QPSK) to 2 (64-QAM).


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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread Antti Palosaari

On 17.05.2012 23:45, Thomas Mair wrote:

On 17.05.2012 22:41, Antti Palosaari wrote:

On 17.05.2012 23:27, poma wrote:

On 05/17/2012 04:19 PM, Antti Palosaari wrote:

Moikka Thomas,

Here is the review. See comments below.

And conclusion is that it is ready for the Kernel merge. I did not see
any big functiuonality problems - only some small issues that are likely
considered as a coding style etc. Feel free to fix those and sent new
patc serie or just new patch top of that.

Reviewed-by: Antti Palosaari


[...]


rtl2832.c.diff:
- static int ->   static const
- struct ->   static const struct
- newline between function call and error check ->   […]
- 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
(/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
[…]
Use one space around (on each side of) most binary and ternary operators,
such as any of these:

  =  +  -<>*  /  %  |&^<=>=  ==  !=  ?  :

[…]

grep '>>\|<<' v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
+len = (msb>>   3) + 1;
+reading_tmp |= reading[i]<<   ((len-1-i)*8);
+*val = (reading_tmp>>   lsb)&   mask;
+len = (msb>>   3) + 1;
+reading_tmp |= reading[i]<<   ((len-1-i)*8);
+writing_tmp = reading_tmp&   ~(mask<<   lsb);
+writing_tmp |= ((val&   mask)<<   lsb);
+writing[i] = (writing_tmp>>   ((len-1-i)*8))&   0xff;
+num = bw_mode<<   20;

Bitshift operators seems to be OK.
Something else?


(len-1-i)*8

I almost have a new corrected version of the patch series ready, fixing this 
issues and the
other ones you mentioned.



- 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
Compared to 'rtl2830_priv.h' seems to be OK.

./checkpatch.pl --no-tree
v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 1177 lines checked

v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

How do you produce this error:
"ERROR: Macros with complex values should be enclosed in parenthesis…"?


Just running checkpatch.pl --file foo



For me checkpath.pl also does not report the error you reported. It does seem
strange to me, as the makros are the same as in rtl2830_priv.h


Are you using some old version of checkpatch.pl ?
Mine is:
commit c06a9ebdb7a4f4823d4225fe789d8c20a1d534eb
Author: Joe Perches 
Date:   Mon Apr 16 13:35:11 2012 -0600

If you are using older version then upgrade. checkpatch.pl is developed 
very rapidly and there is all the time new checks.


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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread poma
On 05/17/2012 10:49 PM, Antti Palosaari wrote:
> On 17.05.2012 23:45, Thomas Mair wrote:
>> On 17.05.2012 22:41, Antti Palosaari wrote:
>>> On 17.05.2012 23:27, poma wrote:
 On 05/17/2012 04:19 PM, Antti Palosaari wrote:
> Moikka Thomas,
>
> Here is the review. See comments below.
>
> And conclusion is that it is ready for the Kernel merge. I did not see
> any big functiuonality problems - only some small issues that are
> likely
> considered as a coding style etc. Feel free to fix those and sent new
> patc serie or just new patch top of that.
>
> Reviewed-by: Antti Palosaari
>>>
>>> [...]
>>>
 rtl2832.c.diff:
 - static int ->   static const
 - struct ->   static const struct
 - newline between function call and error check ->   […]
 - 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
 (/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
 […]
 Use one space around (on each side of) most binary and ternary
 operators,
 such as any of these:

   =  +  -<>*  /  %  |&^<=>=  ==  !=  ?  :

 […]

 grep '>>\|<<'
 v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
 +len = (msb>>   3) + 1;
 +reading_tmp |= reading[i]<<   ((len-1-i)*8);
 +*val = (reading_tmp>>   lsb)&   mask;
 +len = (msb>>   3) + 1;
 +reading_tmp |= reading[i]<<   ((len-1-i)*8);
 +writing_tmp = reading_tmp&   ~(mask<<   lsb);
 +writing_tmp |= ((val&   mask)<<   lsb);
 +writing[i] = (writing_tmp>>   ((len-1-i)*8))&   0xff;
 +num = bw_mode<<   20;

 Bitshift operators seems to be OK.
 Something else?
>>>
>>> (len-1-i)*8
>> I almost have a new corrected version of the patch series ready,
>> fixing this issues and the
>> other ones you mentioned.
>>>
 - 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
 Compared to 'rtl2830_priv.h' seems to be OK.

 ./checkpatch.pl --no-tree
 v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
 ERROR: Missing Signed-off-by: line(s)

 total: 1 errors, 0 warnings, 1177 lines checked

 v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
 problems, please review.  If any of these errors
 are false positives report them to the maintainer, see
 CHECKPATCH in MAINTAINERS.

 How do you produce this error:
 "ERROR: Macros with complex values should be enclosed in parenthesis…"?
>>>
>>> Just running checkpatch.pl --file foo
>>>
>>
>> For me checkpath.pl also does not report the error you reported. It
>> does seem
>> strange to me, as the makros are the same as in rtl2830_priv.h
> 
> Are you using some old version of checkpatch.pl ?
> Mine is:
> commit c06a9ebdb7a4f4823d4225fe789d8c20a1d534eb
> Author: Joe Perches 
> Date:   Mon Apr 16 13:35:11 2012 -0600
> 
> If you are using older version then upgrade. checkpatch.pl is developed
> very rapidly and there is all the time new checks.
> 
> regards
> Antti

https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl

./checkpatch.pl --version
Usage: checkpatch.pl [OPTION]... [FILE]...
Version: 0.32

Options:
  -q, --quietquiet
  --no-tree  run without a kernel tree
  --no-signoff   do not check for 'Signed-off-by' line
  --patchtreat FILE as patchfile (default)
  --emacsemacs compile window format
  --terseone line per report
  -f, --file treat FILE as regular source file
  --subjective, --strict enable more subjective tests
  --ignore TYPE(,TYPE2...)   ignore various comma separated message types
  --show-types   show the message "types" in the output
  --root=PATHPATH to the kernel tree root
  --no-summary   suppress the per-file summary
  --mailback only produce a report in case of
warnings/errors
  --summary-file include the filename in summary
  --debug KEY=[0|1]  turn on/off debugging of KEY, where KEY is
one of
 'values', 'possible', 'type', and 'attr'
(default
 is all off)
  --test-only=WORD   report only warnings/errors containing WORD
 literally
  -h, --help, --version  display this help and exit

When FILE is - read standard input.

./checkpatch.pl --no-tree
v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
ERROR: Macros with complex values should be enclosed in parenthesis
#977: FILE: drivers/media/dvb/frontends/rtl2832_priv.h:30:
+#define dbg(f, arg...) \
+   if (rtl2832_debug) \
+   printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)

ERROR: Missing Signed-off-by: line(s)

total: 2 errors, 0 warnings, 1177 lines checked

v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has sty

Re: [PATCH] V4L: Rename V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to V4L2_SEL_TGT_[CROP/COMPOSE]

2012-05-17 Thread Sakari Ailus
On Mon, May 14, 2012 at 07:17:03PM +0200, Sylwester Nawrocki wrote:
> This patch drops the _ACTIVE part from the selection target names as
> a prerequisite to unify the selection target names on subdevs and regular
> video nodes.
> 
> Although not exactly the same, the meaning of V4L2_SEL_TGT_*_ACTIVE and
> V4L2_SUBDEV_SEL_TGT_*_ACTUAL selection targets is logically the same.
> Different names add to confusion where both APIs are used in a single
> driver or an application.
> The selections API is experimental, so no compatibility layer is added.
> The ABI remains unchanged.
> 
> Signed-off-by: Sylwester Nawrocki 
> Signed-off-by: Kyungmin Park 

Thanks!

Acked-by: Sakari Ailus 

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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread poma
On 05/17/2012 10:45 PM, Thomas Mair wrote:
> On 17.05.2012 22:41, Antti Palosaari wrote:
>> On 17.05.2012 23:27, poma wrote:
>>> On 05/17/2012 04:19 PM, Antti Palosaari wrote:
 Moikka Thomas,

 Here is the review. See comments below.

 And conclusion is that it is ready for the Kernel merge. I did not see
 any big functiuonality problems - only some small issues that are likely
 considered as a coding style etc. Feel free to fix those and sent new
 patc serie or just new patch top of that.

 Reviewed-by: Antti Palosaari
>>
>> [...]
>>
>>> rtl2832.c.diff:
>>> - static int ->  static const
>>> - struct ->  static const struct
>>> - newline between function call and error check ->  […]
>>> - 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
>>> (/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
>>> […]
>>> Use one space around (on each side of) most binary and ternary operators,
>>> such as any of these:
>>>
>>>  =  +  -<   >   *  /  %  |&   ^<=>=  ==  !=  ?  :
>>>
>>> […]
>>>
>>> grep '>>\|<<' v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
>>> +len = (msb>>  3) + 1;
>>> +reading_tmp |= reading[i]<<  ((len-1-i)*8);
>>> +*val = (reading_tmp>>  lsb)&  mask;
>>> +len = (msb>>  3) + 1;
>>> +reading_tmp |= reading[i]<<  ((len-1-i)*8);
>>> +writing_tmp = reading_tmp&  ~(mask<<  lsb);
>>> +writing_tmp |= ((val&  mask)<<  lsb);
>>> +writing[i] = (writing_tmp>>  ((len-1-i)*8))&  0xff;
>>> +num = bw_mode<<  20;
>>>
>>> Bitshift operators seems to be OK.
>>> Something else?
>>
>> (len-1-i)*8
> I almost have a new corrected version of the patch series ready, fixing this 
> issues and the 
> other ones you mentioned. 
>>
>>> - 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
>>> Compared to 'rtl2830_priv.h' seems to be OK.
>>>
>>> ./checkpatch.pl --no-tree
>>> v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
>>> ERROR: Missing Signed-off-by: line(s)
>>>
>>> total: 1 errors, 0 warnings, 1177 lines checked
>>>
>>> v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
>>> problems, please review.  If any of these errors
>>> are false positives report them to the maintainer, see
>>> CHECKPATCH in MAINTAINERS.
>>>
>>> How do you produce this error:
>>> "ERROR: Macros with complex values should be enclosed in parenthesis…"?
>>
>> Just running checkpatch.pl --file foo
>>
> 
> For me checkpath.pl also does not report the error you reported. It does seem
> strange to me, as the makros are the same as in rtl2830_priv.h
> 
> Regards 
> Thomas

Yeah, 'rtl2830_priv.h' is the same.
Fu… me, now I don't know too!
:)

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


[PATCH 1/1] v4l: Remove "_ACTUAL" from subdev selection API target definition names

2012-05-17 Thread Sakari Ailus
The string "_ACTUAL" does not say anything more about the target names. Drop
it. V4L2 selection API was changed by "V4L: Rename 
V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to
V4L2_SEL_TGT_[CROP/COMPOSE]" by Sylwester Nawrocki. This patch does the same
for the V4L2 subdev API.

Signed-off-by: Sakari Ailus 
---
 Documentation/DocBook/media/v4l/dev-subdev.xml |   25 +--
 .../media/v4l/vidioc-subdev-g-selection.xml|   12 
 drivers/media/video/omap3isp/ispccdc.c |4 +-
 drivers/media/video/omap3isp/isppreview.c  |4 +-
 drivers/media/video/omap3isp/ispresizer.c  |4 +-
 drivers/media/video/smiapp/smiapp-core.c   |   22 
 drivers/media/video/v4l2-subdev.c  |4 +-
 include/linux/v4l2-subdev.h|4 +-
 8 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/dev-subdev.xml 
b/Documentation/DocBook/media/v4l/dev-subdev.xml
index 4afcbbe..ac715dd 100644
--- a/Documentation/DocBook/media/v4l/dev-subdev.xml
+++ b/Documentation/DocBook/media/v4l/dev-subdev.xml
@@ -289,8 +289,8 @@
   &v4l2-rect; by the coordinates of the top left corner and the rectangle
   size. Both the coordinates and sizes are expressed in pixels.
 
-  As for pad formats, drivers store try and active
-  rectangles for the selection targets of ACTUAL type As for pad formats, drivers store try and active rectangles for
+  the selection targets .
 
   On sink pads, cropping is applied relative to the
@@ -308,7 +308,7 @@
   Scaling support is optional. When supported by a subdev,
   the crop rectangle on the subdev's sink pad is scaled to the
   size configured using the &VIDIOC-SUBDEV-S-SELECTION; IOCTL
-  using V4L2_SUBDEV_SEL_COMPOSE_ACTUAL
+  using V4L2_SUBDEV_SEL_TGT_COMPOSE
   selection target on the same pad. If the subdev supports scaling
   but not composing, the top and left values are not used and must
   always be set to zero.
@@ -333,22 +333,21 @@
   Types of selection targets
 
   
-   ACTUAL targets
+   Actual targets
 
-   ACTUAL targets reflect the actual hardware configuration
-   at any point of time. There is a BOUNDS target
-   corresponding to every ACTUAL.
+   Actual targets (without a postfix) reflect the actual hardware
+   configuration at any point of time.
   
 
   
BOUNDS targets
 
-   BOUNDS targets is the smallest rectangle that contains
-   all valid ACTUAL rectangles. It may not be possible to set the
-   ACTUAL rectangle as large as the BOUNDS rectangle, however.
-   This may be because e.g. a sensor's pixel array is not
-   rectangular but cross-shaped or round. The maximum size may
-   also be smaller than the BOUNDS rectangle.
+   BOUNDS targets is the smallest rectangle that contains all
+   valid actual rectangles. It may not be possible to set the actual
+   rectangle as large as the BOUNDS rectangle, however. This may be
+   because e.g. a sensor's pixel array is not rectangular but
+   cross-shaped or round. The maximum size may also be smaller than the
+   BOUNDS rectangle.
   
 
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml 
b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml
index 208e9f0..96ab51e 100644
--- a/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-subdev-g-selection.xml
@@ -72,10 +72,10 @@
 
   Types of selection targets
 
-  There are two types of selection targets: actual and bounds.
-  The ACTUAL targets are the targets which configure the hardware.
-  The BOUNDS target will return a rectangle that contain all
-  possible ACTUAL rectangles.
+  There are two types of selection targets: plain and bounds. The
+  actual targets are the targets which configure the hardware. The BOUNDS
+  target will return a rectangle that contain all possible actual
+  rectangles.
 
 
 
@@ -93,7 +93,7 @@
 &cs-def;

  
-   V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL
+   V4L2_SUBDEV_SEL_TGT_CROP
0x
Actual crop. Defines the cropping
performed by the processing step.
@@ -104,7 +104,7 @@
Bounds of the crop rectangle.
  
  
-   
V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL
+   V4L2_SUBDEV_SEL_TGT_COMPOSE
0x0100
Actual compose rectangle. Used to configure scaling
on sink pads and composition on source pads.
diff --git a/drivers/media/video/omap3isp/ispccdc.c 
b/drivers/media/video/omap3isp/ispccdc.c
index 7e32331..f19774f 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -2024,7 +2024,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, 
struct v4l2_subdev

Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread Thomas Mair
On 17.05.2012 23:08, poma wrote:
> On 05/17/2012 10:45 PM, Thomas Mair wrote:
>> On 17.05.2012 22:41, Antti Palosaari wrote:
>>> On 17.05.2012 23:27, poma wrote:
 On 05/17/2012 04:19 PM, Antti Palosaari wrote:
> Moikka Thomas,
>
> Here is the review. See comments below.
>
> And conclusion is that it is ready for the Kernel merge. I did not see
> any big functiuonality problems - only some small issues that are likely
> considered as a coding style etc. Feel free to fix those and sent new
> patc serie or just new patch top of that.
>
> Reviewed-by: Antti Palosaari
>>>
>>> [...]
>>>
 rtl2832.c.diff:
 - static int ->  static const
 - struct ->  static const struct
 - newline between function call and error check ->  […]
 - 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
 (/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
 […]
 Use one space around (on each side of) most binary and ternary operators,
 such as any of these:

  =  +  -<   >   *  /  %  |&   ^<=>=  ==  !=  ?  :

 […]

 grep '>>\|<<' v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
 +len = (msb>>  3) + 1;
 +reading_tmp |= reading[i]<<  ((len-1-i)*8);
 +*val = (reading_tmp>>  lsb)&  mask;
 +len = (msb>>  3) + 1;
 +reading_tmp |= reading[i]<<  ((len-1-i)*8);
 +writing_tmp = reading_tmp&  ~(mask<<  lsb);
 +writing_tmp |= ((val&  mask)<<  lsb);
 +writing[i] = (writing_tmp>>  ((len-1-i)*8))&  0xff;
 +num = bw_mode<<  20;

 Bitshift operators seems to be OK.
 Something else?
>>>
>>> (len-1-i)*8
>> I almost have a new corrected version of the patch series ready, fixing this 
>> issues and the 
>> other ones you mentioned. 
>>>
 - 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
 Compared to 'rtl2830_priv.h' seems to be OK.

 ./checkpatch.pl --no-tree
 v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
 ERROR: Missing Signed-off-by: line(s)

 total: 1 errors, 0 warnings, 1177 lines checked

 v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
 problems, please review.  If any of these errors
 are false positives report them to the maintainer, see
 CHECKPATCH in MAINTAINERS.

 How do you produce this error:
 "ERROR: Macros with complex values should be enclosed in parenthesis…"?
>>>
>>> Just running checkpatch.pl --file foo
>>>
>>
>> For me checkpath.pl also does not report the error you reported. It does seem
>> strange to me, as the makros are the same as in rtl2830_priv.h
>>
>> Regards 
>> Thomas
> 
> Yeah, 'rtl2830_priv.h' is the same.
> Fu… me, now I don't know too!
> :)
> 
> cheers,
> poma

Ok. I will then check the patches with the new checkpatch version tomorrow as I 
need some 
rest now ;) It should not be too difficult to remove the errors.

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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread poma
On 05/17/2012 11:19 PM, Thomas Mair wrote:
> On 17.05.2012 23:08, poma wrote:
>> On 05/17/2012 10:45 PM, Thomas Mair wrote:
>>> On 17.05.2012 22:41, Antti Palosaari wrote:
 On 17.05.2012 23:27, poma wrote:
> On 05/17/2012 04:19 PM, Antti Palosaari wrote:
>> Moikka Thomas,
>>
>> Here is the review. See comments below.
>>
>> And conclusion is that it is ready for the Kernel merge. I did not see
>> any big functiuonality problems - only some small issues that are likely
>> considered as a coding style etc. Feel free to fix those and sent new
>> patc serie or just new patch top of that.
>>
>> Reviewed-by: Antti Palosaari

 [...]

> rtl2832.c.diff:
> - static int ->  static const
> - struct ->  static const struct
> - newline between function call and error check ->  […]
> - 5 indications apropos 'spaces' regarding 'CodingStyle'- line 206
> (/usr/share/doc/kernel-doc-3.3.5/Documentation/CodingStyle)
> […]
> Use one space around (on each side of) most binary and ternary operators,
> such as any of these:
>
>  =  +  -<   >   *  /  %  |&   ^<=>=  ==  !=  ?  :
>
> […]
>
> grep '>>\|<<' v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
> +len = (msb>>  3) + 1;
> +reading_tmp |= reading[i]<<  ((len-1-i)*8);
> +*val = (reading_tmp>>  lsb)&  mask;
> +len = (msb>>  3) + 1;
> +reading_tmp |= reading[i]<<  ((len-1-i)*8);
> +writing_tmp = reading_tmp&  ~(mask<<  lsb);
> +writing_tmp |= ((val&  mask)<<  lsb);
> +writing[i] = (writing_tmp>>  ((len-1-i)*8))&  0xff;
> +num = bw_mode<<  20;
>
> Bitshift operators seems to be OK.
> Something else?

 (len-1-i)*8
>>> I almost have a new corrected version of the patch series ready, fixing 
>>> this issues and the 
>>> other ones you mentioned. 

> - 1 indication apropos 'media/dvb/frontends/rtl2832_priv.h:30'
> Compared to 'rtl2830_priv.h' seems to be OK.
>
> ./checkpatch.pl --no-tree
> v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig
> ERROR: Missing Signed-off-by: line(s)
>
> total: 1 errors, 0 warnings, 1177 lines checked
>
> v4-1-5-rtl2832-ver.-0.4-removed-signal-statistics.patch.orig has style
> problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
>
> How do you produce this error:
> "ERROR: Macros with complex values should be enclosed in parenthesis…"?

 Just running checkpatch.pl --file foo

>>>
>>> For me checkpath.pl also does not report the error you reported. It does 
>>> seem
>>> strange to me, as the makros are the same as in rtl2830_priv.h
>>>
>>> Regards 
>>> Thomas
>>
>> Yeah, 'rtl2830_priv.h' is the same.
>> Fu… me, now I don't know too!
>> :)
>>
>> cheers,
>> poma
> 
> Ok. I will then check the patches with the new checkpatch version tomorrow as 
> I need some 
> rest now ;) It should not be too difficult to remove the errors.
> 
> Regards 
> Thomas

Have a pleasant beauty sleep ;)

cheers,
poma

ps.
/usr/src/kernels/`uname -r`/scripts
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] v4l: Remove "_ACTUAL" from subdev selection API target definition names

2012-05-17 Thread Sylwester Nawrocki
Hi Sakari,

thanks for the patch.

On 05/17/2012 11:15 PM, Sakari Ailus wrote:
> The string "_ACTUAL" does not say anything more about the target names. Drop
> it. V4L2 selection API was changed by "V4L: Rename 
> V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to
> V4L2_SEL_TGT_[CROP/COMPOSE]" by Sylwester Nawrocki. This patch does the same
> for the V4L2 subdev API.
> 
> Signed-off-by: Sakari Ailus

Are these all changes, or do you think we could try to drop the _SUBDEV
part as well from the below selection target names, so they are same
across V4L2 and subdev API ? :-)

I realize it might me quite a bit of documentation work and it's pretty 
late for getting these patches in for v3.5.

I still have a dependency on my previous pull request which is pending
for the patch you mentioned. Do you think we should leave "_SUBDEV"
in subdev selection target names for now (/ever) ? 

Regards,
Sylwester

> ---
...
> diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
> index 812019e..01eee06 100644
> --- a/include/linux/v4l2-subdev.h
> +++ b/include/linux/v4l2-subdev.h
> @@ -128,11 +128,11 @@ struct v4l2_subdev_frame_interval_enum {
>   #define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG(1<<  2)
> 
>   /* active cropping area */
> -#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL  0x
> +#define V4L2_SUBDEV_SEL_TGT_CROP 0x
>   /* cropping bounds */
>   #define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002
>   /* current composing area */
> -#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL   0x0100
> +#define V4L2_SUBDEV_SEL_TGT_COMPOSE  0x0100
>   /* composing bounds */
>   #define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS  0x0102
> 

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


[PATCH] em28xx: simple comment fix

2012-05-17 Thread Antti Palosaari
Signed-off-by: Antti Palosaari 
---
 drivers/media/video/em28xx/em28xx-dvb.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-dvb.c 
b/drivers/media/video/em28xx/em28xx-dvb.c
index 3a5b89d..16410ac 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -476,8 +476,8 @@ static void terratec_h5_init(struct em28xx *dev)
 static void pctv_520e_init(struct em28xx *dev)
 {
/*
-* Init TDA8295(?) analog demodulator. Looks like I2C traffic to
-* digital demodulator and tuner are routed via TDA8295.
+* Init AVF4910B analog decoder. Looks like I2C traffic to
+* digital demodulator and tuner are routed via AVF4910B.
 */
int i;
struct {
-- 
1.7.7.6

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


[PATCH 1/2] drxk: fix GPIOs

2012-05-17 Thread Antti Palosaari
UIO-2 and UIO-3 were broken.

Signed-off-by: Antti Palosaari 
---
 drivers/media/dvb/frontends/drxk_hard.c |4 ++--
 drivers/media/dvb/frontends/drxk_map.h  |2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb/frontends/drxk_hard.c 
b/drivers/media/dvb/frontends/drxk_hard.c
index 8d99ac1..60b868f 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -5835,7 +5835,7 @@ static int WriteGPIO(struct drxk_state *state)
}
if (state->UIO_mask & 0x0002) { /* UIO-2 */
/* write to io pad configuration register - output mode 
*/
-   status = write16(state, SIO_PDR_SMA_TX_CFG__A, 
state->m_GPIOCfg);
+   status = write16(state, SIO_PDR_SMA_RX_CFG__A, 
state->m_GPIOCfg);
if (status < 0)
goto error;
 
@@ -5854,7 +5854,7 @@ static int WriteGPIO(struct drxk_state *state)
}
if (state->UIO_mask & 0x0004) { /* UIO-3 */
/* write to io pad configuration register - output mode 
*/
-   status = write16(state, SIO_PDR_SMA_TX_CFG__A, 
state->m_GPIOCfg);
+   status = write16(state, SIO_PDR_GPIO_CFG__A, 
state->m_GPIOCfg);
if (status < 0)
goto error;
 
diff --git a/drivers/media/dvb/frontends/drxk_map.h 
b/drivers/media/dvb/frontends/drxk_map.h
index 9b11a83..23e16c1 100644
--- a/drivers/media/dvb/frontends/drxk_map.h
+++ b/drivers/media/dvb/frontends/drxk_map.h
@@ -432,6 +432,7 @@
 #define  SIO_PDR_UIO_OUT_LO__A 
0x7F0016
 #define  SIO_PDR_OHW_CFG__A
0x7F001F
 #defineSIO_PDR_OHW_CFG_FREF_SEL__M 0x3
+#define  SIO_PDR_GPIO_CFG__A   
0x7F0021
 #define  SIO_PDR_MSTRT_CFG__A  
0x7F0025
 #define  SIO_PDR_MERR_CFG__A   
0x7F0026
 #define  SIO_PDR_MCLK_CFG__A   
0x7F0028
@@ -446,4 +447,5 @@
 #define  SIO_PDR_MD5_CFG__A
0x7F0030
 #define  SIO_PDR_MD6_CFG__A
0x7F0031
 #define  SIO_PDR_MD7_CFG__A
0x7F0032
+#define  SIO_PDR_SMA_RX_CFG__A 
0x7F0037
 #define  SIO_PDR_SMA_TX_CFG__A 
0x7F0038
-- 
1.7.7.6

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


[PATCH 2/2] em28xx: disable LNA - PCTV QuatroStick nano (520e)

2012-05-17 Thread Antti Palosaari
Signed-off-by: Antti Palosaari 
---
 drivers/media/video/em28xx/em28xx-dvb.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/em28xx/em28xx-dvb.c 
b/drivers/media/video/em28xx/em28xx-dvb.c
index ea3810f..3a5b89d 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -336,6 +336,8 @@ struct drxk_config pctv_520e_drxk = {
.single_master = 1,
.microcode_name = "dvb-demod-drxk-pctv.fw",
.chunk_size = 58,
+   .antenna_dvbt = true, /* disable LNA */
+   .antenna_gpio = (1 << 2), /* disable LNA */
 };
 
 static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
-- 
1.7.7.6

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


Re: [PATCH 1/1] v4l: Remove "_ACTUAL" from subdev selection API target definition names

2012-05-17 Thread Sakari Ailus
Hi Sylwester,

On Thu, May 17, 2012 at 11:37:47PM +0200, Sylwester Nawrocki wrote:
> Hi Sakari,
> 
> thanks for the patch.
> 
> On 05/17/2012 11:15 PM, Sakari Ailus wrote:
> > The string "_ACTUAL" does not say anything more about the target names. Drop
> > it. V4L2 selection API was changed by "V4L: Rename 
> > V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to
> > V4L2_SEL_TGT_[CROP/COMPOSE]" by Sylwester Nawrocki. This patch does the same
> > for the V4L2 subdev API.
> > 
> > Signed-off-by: Sakari Ailus
> 
> Are these all changes, or do you think we could try to drop the _SUBDEV
> part as well from the below selection target names, so they are same
> across V4L2 and subdev API ? :-)
> 
> I realize it might me quite a bit of documentation work and it's pretty 
> late for getting these patches in for v3.5.
> 
> I still have a dependency on my previous pull request which is pending
> for the patch you mentioned. Do you think we should leave "_SUBDEV"
> in subdev selection target names for now (/ever) ? 

I started working on removing the SUBDEV_ in between but I agree with you,
there seems to be more than just a tiny bit of documentation work. It may be
we'll go past 3.5 in doing that.

I think the most important change was to get rid or ACTUAL/ACTIVE anyway.
What we could do is that we postpone this change after 3.5 (to 3.6) and
perhaps keep the old subdev targets around awhile.

In my opinion the user space may (or perhaps even should) begin using the
V4L2 targets already, but in kernel we'll use the existing subdev targets
before the removal patch is eventually ready.

This is primarily a documentation change after all.

Could you rebase your exposure metering target definition patch on top of
the _ACTUAL/_ACTIVE removal patches?

Kind regars,

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


Re: [PATCH 03/23] V4L: Add an extended camera white balance control

2012-05-17 Thread Sakari Ailus
Hi Sylwester,

Sylwester Nawrocki wrote:
> Hi Sakari,
> 
> On 05/16/2012 08:57 AM, Sakari Ailus wrote:
> ...
> +
> + 
> +  spanname="id">V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE 
> + enum v4l2_auto_n_preset_white_balance
> + Sets white balance to automatic,
> +manual or a preset. The presets determine color temperature of the light 
> as
> +a hint to the camera for white balance adjustments resulting in most 
> accurate
> +color representation. The following white balance presets are listed in 
> order
> +of increasing color temperature.
> + 
> + 
> + 
> + 
> + 
> + 
> V4L2_WHITE_BALANCE_MANUAL 
> + Manual white balance.
> + 
> + 
> + 
> V4L2_WHITE_BALANCE_AUTO 
> + Automatic white balance adjustments.
> + 
> + 
> + 
> V4L2_WHITE_BALANCE_INCANDESCENT 
> + White balance setting for incandescent (tungsten) 
> lighting.
> +It generally cools down the colors and corresponds approximately to 
> 2500...3500 K
> +color temperature range.
> + 
> + 
> + 
> V4L2_WHITE_BALANCE_FLUORESCENT 
> + White balance preset for fluorescent lighting.
> +It corresponds approximately to 4000...5000 K color temperature.
> + 
> + 
> + 
> V4L2_WHITE_BALANCE_FLUORESCENT_H 
> + With this setting the camera will compensate for
> +fluorescent H lighting.
> + 

 I don't remember for quite sure if I replied to this already... what's the
 diff between the above two?
>>>
>>> No, you didn't, otherwise I would certainly remember that ;)
>>>
>>> V4L2_WHITE_BALANCE_FLUORESCENT_H is for newer, daylight calibrated 
>>> fluorescent
>>> lamps. So this preset will generally cool down the colours less than
> ^   
> Sorry, I put it wrong. It should have been "warm up", since "cooling down"
> the colours happens only for V4L2_WHITE_BALANCE_INCANDESCENT, other presets
> just generally warm up colours, with various degree.
> 
>>> V4L2_WHITE_BALANCE_FLUORESCENT. I was even thinking about a separate 
>>> control 
>>> for V4L2_WHITE_BALANCE_FLUORESCENT, since some ISPs have several presets for
>>> fluorescent lighting. I dropped that idea finally though.
>>
>> I don't know about the daylight calibrated ones, but the older ones often
>> tend to give colder light. Nevertheless, I think it'd be good to mention
>> this in the documentation. I couldn't have guessed it. :)
> 
> Do you think something like this would be OK:
> 
> + 
> V4L2_WHITE_BALANCE_FLUORESCENT_H 
> + Variant of 
> V4L2_WHITE_BALANCE_FLUORESCENT 
> + for fluorescent lamp lighting with spectral power distribution more similar
> + to daylight.
> + 
> 
> ?

Looks good to me!

Cheers,

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


Re: [PATCH v2] V4L: DocBook: Improve V4L2_CID_AUTO_N_WHITE_BALANCE control description

2012-05-17 Thread Sakari Ailus
On Wed, May 16, 2012 at 12:05:24AM +0200, Sylwester Nawrocki wrote:
> This patch removes the estimate color temperature range specification
> for the white balance presets for which exact values heavily depend
> on a particular camera specification.
> 
> Signed-off-by: Sylwester Nawrocki 

Acked-by: Sakari Ailus 

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


[PATCH 3/3] libscan renamings

2012-05-17 Thread André Roth
---
 lib/include/libscan.h  |   12 ++--
 lib/libdvbv5/libscan.c |6 +++---
 utils/dvb/dvbv5-scan.c |4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/lib/include/libscan.h b/lib/include/libscan.h
index bc11ce1..a2b061c 100644
--- a/lib/include/libscan.h
+++ b/lib/include/libscan.h
@@ -136,11 +136,19 @@ struct dvb_descriptors {
unsigned cur_ts;
 };
 
-struct dvb_descriptors *get_dvb_ts_tables(int dmx_fd,
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dvb_descriptors *dvb_get_ts_tables(int dmx_fd,
  uint32_t delivery_system,
  unsigned other_nit,
  unsigned timeout_multiply,
  int verbose);
-void free_dvb_ts_tables(struct dvb_descriptors *dvb_desc);
+void dvb_free_ts_tables(struct dvb_descriptors *dvb_desc);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif
diff --git a/lib/libdvbv5/libscan.c b/lib/libdvbv5/libscan.c
index dd010e1..7916d36 100644
--- a/lib/libdvbv5/libscan.c
+++ b/lib/libdvbv5/libscan.c
@@ -400,7 +400,7 @@ static int read_section(int dmx_fd, struct dvb_descriptors 
*dvb_desc,
return 0;
 }
 
-struct dvb_descriptors *get_dvb_ts_tables(int dmx_fd,
+struct dvb_descriptors *dvb_get_ts_tables(int dmx_fd,
  uint32_t delivery_system,
  unsigned other_nit,
  unsigned timeout_multiply,
@@ -460,7 +460,7 @@ struct dvb_descriptors *get_dvb_ts_tables(int dmx_fd,
  pat_pmt_time * timeout_multiply);
if (rc < 0) {
fprintf(stderr, "error while waiting for PAT table\n");
-   free_dvb_ts_tables(dvb_desc);
+   dvb_free_ts_tables(dvb_desc);
return NULL;
}
 
@@ -504,7 +504,7 @@ struct dvb_descriptors *get_dvb_ts_tables(int dmx_fd,
 }
 
 
-void free_dvb_ts_tables(struct dvb_descriptors *dvb_desc)
+void dvb_free_ts_tables(struct dvb_descriptors *dvb_desc)
 {
struct pat_table *pat_table = &dvb_desc->pat_table;
struct pid_table *pid_table = dvb_desc->pat_table.pid_table;
diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
index c7b18eb..64945cc 100644
--- a/utils/dvb/dvbv5-scan.c
+++ b/utils/dvb/dvbv5-scan.c
@@ -406,7 +406,7 @@ static int run_scan(struct arguments *args,
if (rc < 0)
continue;
 
-   dvb_desc = get_dvb_ts_tables(dmx_fd,
+   dvb_desc = dvb_get_ts_tables(dmx_fd,
 parms->current_sys,
 args->other_nit,
 args->timeout_multiply,
@@ -433,7 +433,7 @@ static int run_scan(struct arguments *args,
if (!args->dont_add_new_freqs)
add_other_freq_entries(dvb_file, parms, dvb_desc);
 
-   free_dvb_ts_tables(dvb_desc);
+   dvb_free_ts_tables(dvb_desc);
}
 
if (dvb_file_new)
-- 
1.7.2.5

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


Re: [PATCH 1/1] v4l: Remove "_ACTUAL" from subdev selection API target definition names

2012-05-17 Thread Sylwester Nawrocki
Hi Sakari,

On 05/18/2012 12:35 AM, Sakari Ailus wrote:
...
>> On 05/17/2012 11:15 PM, Sakari Ailus wrote:
>>> The string "_ACTUAL" does not say anything more about the target names. Drop
>>> it. V4L2 selection API was changed by "V4L: Rename 
>>> V4L2_SEL_TGT_[CROP/COMPOSE]_ACTIVE to
>>> V4L2_SEL_TGT_[CROP/COMPOSE]" by Sylwester Nawrocki. This patch does the same
>>> for the V4L2 subdev API.
>>>
>>> Signed-off-by: Sakari Ailus
>>
>> Are these all changes, or do you think we could try to drop the _SUBDEV
>> part as well from the below selection target names, so they are same
>> across V4L2 and subdev API ? :-)
>>
>> I realize it might me quite a bit of documentation work and it's pretty
>> late for getting these patches in for v3.5.
>>
>> I still have a dependency on my previous pull request which is pending
>> for the patch you mentioned. Do you think we should leave "_SUBDEV"
>> in subdev selection target names for now (/ever) ?
> 
> I started working on removing the SUBDEV_ in between but I agree with you,
> there seems to be more than just a tiny bit of documentation work. It may be
> we'll go past 3.5 in doing that.
> 
> I think the most important change was to get rid or ACTUAL/ACTIVE anyway.
> What we could do is that we postpone this change after 3.5 (to 3.6) and
> perhaps keep the old subdev targets around awhile.
> 
> In my opinion the user space may (or perhaps even should) begin using the
> V4L2 targets already, but in kernel we'll use the existing subdev targets
> before the removal patch is eventually ready.

That sounds good to me. 

> This is primarily a documentation change after all.
> 
> Could you rebase your exposure metering target definition patch on top of
> the _ACTUAL/_ACTIVE removal patches?

It's not the focus targets patches that would cause conflicts, I have 
postponed them to 3.6. It's just the last patch from this series:

http://git.infradead.org/users/kmpark/linux-samsung/shortlog/refs/heads/v4l-fimc-exynos4x12

What I could do is just to apply the selection rename patch before it
and to resend whole pull request again. I'll try to do it tomorrow.

--

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


[PATCH] au0828: Add USB ID used by many dongles

2012-05-17 Thread Ismael Luceno
Tested with Yfeng 680 ATV dongle.

Signed-off-by: Ismael Luceno 
---
 drivers/media/video/au0828/au0828-cards.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/video/au0828/au0828-cards.c 
b/drivers/media/video/au0828/au0828-cards.c
index 1c6015a..e3fe9a6 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -325,6 +325,8 @@ struct usb_device_id au0828_usb_id_table[] = {
.driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
{ USB_DEVICE(0x2040, 0x7281),
.driver_info = AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL },
+   { USB_DEVICE(0x05e1, 0x0480),
+   .driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
{ USB_DEVICE(0x2040, 0x8200),
.driver_info = AU0828_BOARD_HAUPPAUGE_WOODBURY },
{ USB_DEVICE(0x2040, 0x7260),
-- 
1.7.10.1

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


[PATCH] au0828: Move the Kconfig knob under V4L_USB_DRIVERS

2012-05-17 Thread Ismael Luceno
This driver is for USB devices, but was incorrectly listed under
V4L_PCI_DRIVERS.

Signed-off-by: Ismael Luceno 
---
 drivers/media/video/Kconfig |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index ce1e7ba..5d9e584 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -644,6 +644,8 @@ menuconfig V4L_USB_DRIVERS
 
 if V4L_USB_DRIVERS
 
+source "drivers/media/video/au0828/Kconfig"
+
 source "drivers/media/video/uvc/Kconfig"
 
 source "drivers/media/video/gspca/Kconfig"
@@ -721,8 +723,6 @@ menuconfig V4L_PCI_DRIVERS
 
 if V4L_PCI_DRIVERS
 
-source "drivers/media/video/au0828/Kconfig"
-
 source "drivers/media/video/bt8xx/Kconfig"
 
 source "drivers/media/video/cx18/Kconfig"
-- 
1.7.10.1

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


Re: [PATCH v4 1/5] rtl2832 ver. 0.4: removed signal statistics

2012-05-17 Thread poma
On 05/17/2012 04:19 PM, Antti Palosaari wrote:
> Moikka Thomas,
> 
> Here is the review. See comments below.
> 
> And conclusion is that it is ready for the Kernel merge. I did not see
> any big functiuonality problems - only some small issues that are likely
> considered as a coding style etc. Feel free to fix those and sent new
> patc serie or just new patch top of that.
> 
> Reviewed-by: Antti Palosaari 
> 
> 
> On 17.05.2012 01:13, Thomas Mair wrote:
>> Changelog for ver. 0.3:
>> - removed statistics as their calculation was wrong
>> - fixed bug in Makefile
>> - indentation and code style improvements
>>
>> Signed-off-by: Thomas Mair
>> ---
>>   drivers/media/dvb/frontends/Kconfig|7 +
>>   drivers/media/dvb/frontends/Makefile   |1 +
>>   drivers/media/dvb/frontends/rtl2832.c  |  825
>> 
>>   drivers/media/dvb/frontends/rtl2832.h  |   74 +++
>>   drivers/media/dvb/frontends/rtl2832_priv.h |  258 +
>>   5 files changed, 1165 insertions(+), 0 deletions(-)
>>   create mode 100644 drivers/media/dvb/frontends/rtl2832.c
>>   create mode 100644 drivers/media/dvb/frontends/rtl2832.h
>>   create mode 100644 drivers/media/dvb/frontends/rtl2832_priv.h
>>
>> diff --git a/drivers/media/dvb/frontends/Kconfig
>> b/drivers/media/dvb/frontends/Kconfig
>> index f479834..f7d67d7 100644
>> --- a/drivers/media/dvb/frontends/Kconfig
>> +++ b/drivers/media/dvb/frontends/Kconfig
>> @@ -432,6 +432,13 @@ config DVB_RTL2830
>>   help
>> Say Y when you want to support this frontend.
>>
>> +config DVB_RTL2832
>> +tristate "Realtek RTL2832 DVB-T"
>> +depends on DVB_CORE&&  I2C
>> +default m if DVB_FE_CUSTOMISE
>> +help
>> +  Say Y when you want to support this frontend.
>> +
> 
> It is correct.
> 
> Just for the comment as you said in cover letter that you are unsure
> about that.
> 
>>   comment "DVB-C (cable) frontends"
>>   depends on DVB_CORE
>>
>> diff --git a/drivers/media/dvb/frontends/Makefile
>> b/drivers/media/dvb/frontends/Makefile
>> index b0381dc..bbf2955 100644
>> --- a/drivers/media/dvb/frontends/Makefile
>> +++ b/drivers/media/dvb/frontends/Makefile
>> @@ -98,6 +98,7 @@ obj-$(CONFIG_DVB_IT913X_FE) += it913x-fe.o
>>   obj-$(CONFIG_DVB_A8293) += a8293.o
>>   obj-$(CONFIG_DVB_TDA10071) += tda10071.o
>>   obj-$(CONFIG_DVB_RTL2830) += rtl2830.o
>> +obj-$(CONFIG_DVB_RTL2830) += rtl2832.o
>>   obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
>>   obj-$(CONFIG_DVB_AF9033) += af9033.o
>>
>> diff --git a/drivers/media/dvb/frontends/rtl2832.c
>> b/drivers/media/dvb/frontends/rtl2832.c
>> new file mode 100644
>> index 000..51c7927
>> --- /dev/null
>> +++ b/drivers/media/dvb/frontends/rtl2832.c
>> @@ -0,0 +1,825 @@
>> +/*
>> + * Realtek RTL2832 DVB-T demodulator driver
>> + *
>> + * Copyright (C) 2012 Thomas Mair
>> + *
>> + *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.
>> + */
>> +
>> +#include "rtl2832_priv.h"
>> +
>> +
>> +int rtl2832_debug;
>> +module_param_named(debug, rtl2832_debug, int, 0644);
>> +MODULE_PARM_DESC(debug, "Turn on/off frontend debugging
>> (default:off).");
>> +
>> +
>> +static int reg_mask[32] = {
> 
> This should be static const.
> 
>> +0x0001,
>> +0x0003,
>> +0x0007,
>> +0x000f,
>> +0x001f,
>> +0x003f,
>> +0x007f,
>> +0x00ff,
>> +0x01ff,
>> +0x03ff,
>> +0x07ff,
>> +0x0fff,
>> +0x1fff,
>> +0x3fff,
>> +0x7fff,
>> +0x,
>> +0x0001,
>> +0x0003,
>> +0x0007,
>> +0x000f,
>> +0x001f,
>> +0x003f,
>> +0x007f,
>> +0x00ff,
>> +0x01ff,
>> +0x03ff,
>> +0x07ff,
>> +0x0fff,
>> +0x1fff,
>> +0x3fff,
>> +0x7fff,
>> +0x
>> +};
>> +
>> +struct rtl2832_reg_entry registers[] = {
> 
> static const struct
> 
>> +[DVBT_SOFT_RST]= {0x1, 0x1,   2, 2},
>> +[DVBT_IIC_REPEAT]= {0x1, 0x1,   3, 3},
>> +[DVBT_TR_WAIT_MIN_8K]= {0x1, 0x88, 11, 2},
>> +[DVBT_RSD_BER_FAIL_VAL]= {0x1, 0x8f, 15, 0},
>> +[DVBT_EN_BK_TRK]= {0x1, 0xa6,  7, 7},
>> +[DVBT_AD_EN_REG]= {0x0, 0x8,   7, 7},
>> +

Re: [PATCH] dma-buf: mmap support

2012-05-17 Thread Sumit Semwal
Hi Daniel, Rob,

On 11 May 2012 21:00, Rob Clark  wrote:
> On Tue, Apr 24, 2012 at 4:08 AM, Daniel Vetter  wrote:
>> Compared to Rob Clark's RFC I've ditched the prepare/finish hooks

>>
>> Cc: Rob Clark 
>> Cc: Rebecca Schultz Zavin 
>> Signed-Off-by: Daniel Vetter 
>
> Acked-by: Rob Clark 
Thanks, applied to my for-next.
Sorry, I was away due to some medical reasons for some time, hence the delay.
>

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