RE: [PATCH] media: vb2: add a check for uninitialized buffer

2011-10-18 Thread Marek Szyprowski
Hello,

On Wednesday, October 19, 2011 8:03 AM Pawel Osciak wrote:

> Hi Marek,
> I think there is a typo in this patch:
> 
> On Wed, Oct 12, 2011 at 09:12, Marek Szyprowski
>  wrote:
> > __buffer_in_use() might be called for empty/uninitialized buffer in the
> > following scenario: REQBUF(n, USER_PTR), QUERYBUF(). This patch fixes
> > kernel ops in such case.
> >
> > Signed-off-by: Marek Szyprowski 
> > Signed-off-by: Kyungmin Park 
> > CC: Pawel Osciak 
> >
> > ---
> >  drivers/media/video/videobuf2-core.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/media/video/videobuf2-core.c 
> > b/drivers/media/video/videobuf2-core.c
> > index d8affb8..cdbbab7 100644
> > --- a/drivers/media/video/videobuf2-core.c
> > +++ b/drivers/media/video/videobuf2-core.c
> > @@ -284,14 +284,14 @@ static bool __buffer_in_use(struct vb2_queue *q, 
> > struct vb2_buffer
> *vb)
> >  {
> >        unsigned int plane;
> >        for (plane = 0; plane < vb->num_planes; ++plane) {
> > +               void mem_priv = vb->planes[plane].mem_priv;
> 
> Shouldn't this be void * instead of just void?

Yes, it should be. It looks that I've posted an older version. In the pull 
request there is a correct version.

> >                /*
> >                 * If num_users() has not been provided, call_memop
> >                 * will return 0, apparently nobody cares about this
> >                 * case anyway. If num_users() returns more than 1,
> >                 * we are not the only user of the plane's memory.
> >                 */
> > -               if (call_memop(q, plane, num_users,
> > -                               vb->planes[plane].mem_priv) > 1)
> > +               if (mem_priv && call_memop(q, plane, num_users, mem_priv) > 
> > 1)
> >                        return true;
> >        }
> >        return false;
> > --
> > 1.7.1.569.g6f426

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

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


Re: [PATCH] media: vb2: fix incorrect return value

2011-10-18 Thread Pawel Osciak
On Mon, Oct 3, 2011 at 00:21, Marek Szyprowski  wrote:
> This patch fixes incorrect return value. Errors should be returned
> as negative numbers.
>
> Reported-by: Tomasz Stanislawski 
> Signed-off-by: Marek Szyprowski 
> ---
>  drivers/media/video/videobuf2-core.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/media/video/videobuf2-core.c 
> b/drivers/media/video/videobuf2-core.c
> index 6687ac3..3f5c7a3 100644
> --- a/drivers/media/video/videobuf2-core.c
> +++ b/drivers/media/video/videobuf2-core.c
> @@ -751,7 +751,7 @@ static int __qbuf_userptr(struct vb2_buffer *vb, struct 
> v4l2_buffer *b)
>
>                /* Check if the provided plane buffer is large enough */
>                if (planes[plane].length < q->plane_sizes[plane]) {
> -                       ret = EINVAL;
> +                       ret = -EINVAL;
>                        goto err;
>                }
>
> --
> 1.7.1.569.g6f426
>
>


Acked-by: Pawel Osciak 

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


Re: [PATCH] media: vb2: add a check for uninitialized buffer

2011-10-18 Thread Pawel Osciak
Hi Marek,
I think there is a typo in this patch:

On Wed, Oct 12, 2011 at 09:12, Marek Szyprowski
 wrote:
> __buffer_in_use() might be called for empty/uninitialized buffer in the
> following scenario: REQBUF(n, USER_PTR), QUERYBUF(). This patch fixes
> kernel ops in such case.
>
> Signed-off-by: Marek Szyprowski 
> Signed-off-by: Kyungmin Park 
> CC: Pawel Osciak 
>
> ---
>  drivers/media/video/videobuf2-core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/video/videobuf2-core.c 
> b/drivers/media/video/videobuf2-core.c
> index d8affb8..cdbbab7 100644
> --- a/drivers/media/video/videobuf2-core.c
> +++ b/drivers/media/video/videobuf2-core.c
> @@ -284,14 +284,14 @@ static bool __buffer_in_use(struct vb2_queue *q, struct 
> vb2_buffer *vb)
>  {
>        unsigned int plane;
>        for (plane = 0; plane < vb->num_planes; ++plane) {
> +               void mem_priv = vb->planes[plane].mem_priv;

Shouldn't this be void * instead of just void?

>                /*
>                 * If num_users() has not been provided, call_memop
>                 * will return 0, apparently nobody cares about this
>                 * case anyway. If num_users() returns more than 1,
>                 * we are not the only user of the plane's memory.
>                 */
> -               if (call_memop(q, plane, num_users,
> -                               vb->planes[plane].mem_priv) > 1)
> +               if (mem_priv && call_memop(q, plane, num_users, mem_priv) > 1)
>                        return true;
>        }
>        return false;
> --
> 1.7.1.569.g6f426
>
>


-- 
Best regards,
Pawel Osciak
--
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 2/3] soc-camera: mt9t112: modify delay time after initialize

2011-10-18 Thread Kuninori Morimoto

Hi Guennadi, and Phil

Thank you for your check/test

> > Both are needed.
> > These are bug fix patches
> 
> I tried to capture several frames beginning with the very first one (as 
> much as performance allowed), and I do see several black or wrongly 
> coloured framed in the beginning, but none of those patches, including the 
> proposed 300ms at the end of .s_stream() fixes the problem reliably. So, 
> either this problems, that these patches fix, are specific to the Solution 
> Engine board (is it the one, where the problems have been observed?), or 
> one needs a different testing method. If they are SE-specific - I don't 
> think, getting those fixes in the driver is very important, because 
> mt9t112 data for SE is not in the mainline. If I was testing wrongly, 
> please, tell me how exactly to reproduce those problems and see, how one 
> or another patch fixes them.

I guess mt9t112 camera is used in SE (with local circuit ?)
and Ecovec.
But I forgot detail of this issue (I have no mt9t112 for now).

I think Phil is the person who wanted this patch.

But if this issue happen only SE, I can agree to Guennadi

Best regards
---
Kuninori Morimoto
--
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/14] staging/media/as102: initial import from Abilis

2011-10-18 Thread Dan Carpenter
On Tue, Oct 18, 2011 at 02:38:59PM -0200, Mauro Carvalho Chehab wrote:
> > It would be better to separate these two chunks out and put them at
> > the end after you've fixed the compile errors in [PATCH 13/14].
> 
> This doesn't really matter, as the driver won't be added to the Kernel 
> building system
> before patch 13/14, as drivers/staging/Makefile wasn't touch on patch 1/14.

Ah sorry.  My bad.

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: PVR-2200 error with what I think is tuning

2011-10-18 Thread Greg Bowyer

On 18/10/11 15:03, Devin Heitmueller wrote:

On Tue, Oct 18, 2011 at 6:00 PM, Greg Bowyer  wrote:

Hi there

You probably get this a lot, with the latest and greatest drivers from your
git repository at Steve Tosh's website I get the following after a few days

[198934.085303] tda18271_write_regs: [4-0060|S] ERROR: idx = 0x5, len = 1,
i2c_transfer returned: -5
[198934.085310] tda18271_init: [4-0060|S] error -5 on line 831
[198934.085317] tda18271_tune: [4-0060|S] error -5 on line 909
[198934.085324] tda18271_set_params: [4-0060|S] error -5 on line 994
[198934.085331] saa7164_cmd_send() No free sequences
[198934.085336] saa7164_api_i2c_read() error, ret(1) = 0xc
[198934.085341] tda10048_readreg: readreg error (ret == -5)


[198934.087195] tda10048_readreg: readreg error (ret == -5)
[198934.087209] saa7164_cmd_send() No free sequences
[198934.087214] saa7164_api_i2c_read() error, ret(1) = 0xc
[198934.087220] tda10048_readreg: readreg error (ret == -5)

My tuning software is tvheadend (which I would prefer to keep)

I started to look at the sourcecode, but I know too little about I2C to make
any sense of what might be bugging out

Is there anything I can do to avoid this ?

Just an FYI:  that doesn't actually look like an i2c problem or some
other problem with the tuner or demodulator.  It looks like the
saa7164 itself is wedged.
... The driver or the chip itself ?, would it help if I posted the lspci 
-vv for the card ?

Devin



--
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: PVR-2200 error with what I think is tuning

2011-10-18 Thread Devin Heitmueller
On Tue, Oct 18, 2011 at 6:00 PM, Greg Bowyer  wrote:
> Hi there
>
> You probably get this a lot, with the latest and greatest drivers from your
> git repository at Steve Tosh's website I get the following after a few days
>
> [198934.085303] tda18271_write_regs: [4-0060|S] ERROR: idx = 0x5, len = 1,
> i2c_transfer returned: -5
> [198934.085310] tda18271_init: [4-0060|S] error -5 on line 831
> [198934.085317] tda18271_tune: [4-0060|S] error -5 on line 909
> [198934.085324] tda18271_set_params: [4-0060|S] error -5 on line 994
> [198934.085331] saa7164_cmd_send() No free sequences
> [198934.085336] saa7164_api_i2c_read() error, ret(1) = 0xc
> [198934.085341] tda10048_readreg: readreg error (ret == -5)
>
>
> [198934.087195] tda10048_readreg: readreg error (ret == -5)
> [198934.087209] saa7164_cmd_send() No free sequences
> [198934.087214] saa7164_api_i2c_read() error, ret(1) = 0xc
> [198934.087220] tda10048_readreg: readreg error (ret == -5)
>
> My tuning software is tvheadend (which I would prefer to keep)
>
> I started to look at the sourcecode, but I know too little about I2C to make
> any sense of what might be bugging out
>
> Is there anything I can do to avoid this ?

Just an FYI:  that doesn't actually look like an i2c problem or some
other problem with the tuner or demodulator.  It looks like the
saa7164 itself is wedged.

Devin

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


PVR-2200 error with what I think is tuning

2011-10-18 Thread Greg Bowyer

Hi there

You probably get this a lot, with the latest and greatest drivers from 
your git repository at Steve Tosh's website I get the following after a 
few days


[198934.085303] tda18271_write_regs: [4-0060|S] ERROR: idx = 0x5, len = 
1, i2c_transfer returned: -5

[198934.085310] tda18271_init: [4-0060|S] error -5 on line 831
[198934.085317] tda18271_tune: [4-0060|S] error -5 on line 909
[198934.085324] tda18271_set_params: [4-0060|S] error -5 on line 994
[198934.085331] saa7164_cmd_send() No free sequences
[198934.085336] saa7164_api_i2c_read() error, ret(1) = 0xc
[198934.085341] tda10048_readreg: readreg error (ret == -5)


[198934.087195] tda10048_readreg: readreg error (ret == -5)
[198934.087209] saa7164_cmd_send() No free sequences
[198934.087214] saa7164_api_i2c_read() error, ret(1) = 0xc
[198934.087220] tda10048_readreg: readreg error (ret == -5)

My tuning software is tvheadend (which I would prefer to keep)

I started to look at the sourcecode, but I know too little about I2C to 
make any sense of what might be bugging out


Is there anything I can do to avoid this ?

-- Greg
--
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] subdevice PM: .s_power() deprecation?

2011-10-18 Thread Guennadi Liakhovetski
On Tue, 18 Oct 2011, Sylwester Nawrocki wrote:

> Hi Laurent,
> 
> On 10/18/2011 01:07 AM, Laurent Pinchart wrote:
> > On Monday 17 October 2011 23:26:28 Sylwester Nawrocki wrote:
> >> On 10/17/2011 05:23 PM, Guennadi Liakhovetski wrote:
> >>> On Mon, 17 Oct 2011, Sylwester Nawrocki wrote:

[snip]

>  The bridge driver could also choose to keep the sensor powered on,
>  whenever it sees appropriate, to avoid re-enabling the sensor to often.
> >>>
> >>> On what basis would the bridge driver make these decisions? How would it
> >>> know in advance, when it'll have to re-enable the subdev next time?
> >>
> >> Re-enabling by allowing a subdev driver to entirely control the power
> >> state. The sensor might implement "lowest power consumption" policy, while
> >> the user might want "highest performance".
> > 
> > Exactly, that's a policy decision. Would PM QoS help here ?
> 
> Thanks for reminding about PM QoS. I didn't pay much attention to it but it
> indeed appears to be a good fit for this sort of tasks.

But you anyway have to decide - who will implement those PM QoS callbacks? 
The bridge and then decide whether or not to call subdev's .s_power(), or 
the subdev driver itself? I think, the latter, in which case .s_power() 
remain unused.

> We would possibly just need to think of parameters which could be associated 
> with
> video, e.g. video_latency, etc. ?...
> 
> I'm curious whether the whole power handling could be contained within a 
> subdev 
> driver, most likely it could be done for subdevs exposing a devnode.
> 
> > 
> >> I'm referring only to camera sensor subdevs, as I don't have much 
> >> experience
> >> with other ones.
> >>
> >> Also there are some devices where you want to model power control
> >> explicitly, and it is critical to overall system operation. The s5p-tv
> >> driver is one example of these. The host driver knows exactly how the
> >> power state of its subdevs should be handled.
> > 
> > The host probably knows about how to handle the power state of its internal
> > subdevs, but what about external ones ?
> 
> In this particular example there is no external subdevs associated with the 
> host. 
> 
> But we don't seem to have separate callbacks for internal and external 
> subdevs..
> So removing s_power() puts the above described sort of drivers in trouble.

I understand what you're saying, but can you give us a specific example, 
when a subdev driver (your SoC internal subdev, that is) doesn't have a 
way to react to an event itself and only the bridge driver gets called 
into at that time? Something like an interrupt or an internal timer or 
some other internal event?

> I guess we all agree the power requirements of external subdevs are generally 
> unknown to the hosts.
> 
> For these it might make lot of sense to let the subdev driver handle the 
> device
> power supplies on basis of requests like, s_ctrl, s_stream, etc.  

Yes, right, so, most "external" (sensor, decoder,...) subdev drivers 
should never need to implement .s_power(), regardless of whether we decide 
to keep it or not. Well, ok, no, put it differently - in those drivers 
.s_power() should only really be called during system-wide suspend / 
resume.

> With PM QoS it could be easier to decide in the driver when a device should be
> put in a low power state. 

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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] omap3isp: preview: Add crop support on the sink pad

2011-10-18 Thread Laurent Pinchart
The crop rectangle takes the preview engine internal cropping
requirements into account. The smallest allowable margins are 14 columns
and 8 rows when reading from memory, and 18 columns and 8 rows when
processing data on the fly from the CCDC.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/video/omap3isp/isppreview.c |  262 +---
 drivers/media/video/omap3isp/isppreview.h |2 +
 2 files changed, 198 insertions(+), 66 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index d5cce42..ccb876f 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -76,6 +76,42 @@ static struct omap3isp_prev_csc flr_prev_csc = {
 
 #define DEF_DETECT_CORRECT_VAL 0xe
 
+/*
+ * Margins and image size limits.
+ *
+ * The preview engine crops several rows and columns internally depending on
+ * which filters are enabled. To avoid format changes when the filters are
+ * enabled or disabled (which would prevent them from being turned on or off
+ * during streaming), the driver assumes all the filters are enabled when
+ * computing sink crop and source format limits.
+ *
+ * If a filter is disabled, additional cropping is automatically added at the
+ * preview engine input by the driver to avoid overflow at line and frame end.
+ * This is completely transparent for applications.
+ *
+ * Median filter   4 pixels
+ * Noise filter,
+ * Faulty pixels correction4 pixels, 4 lines
+ * CFA filter  4 pixels, 4 lines in Bayer mode
+ *   2 lines in other modes
+ * Color suppression   2 pixels
+ * or luma enhancement
+ * -
+ * Maximum total   14 pixels, 8 lines
+ *
+ * The color suppression and luma enhancement filters are applied after bayer 
to
+ * YUV conversion. They thus can crop one pixel on the left and one pixel on 
the
+ * right side of the image without changing the color pattern. When both those
+ * filters are disabled, the driver must crop the two pixels on the same side 
of
+ * the image to avoid changing the bayer pattern. The left margin is thus set 
to
+ * 8 pixels and the right margin to 6 pixels.
+ */
+
+#define PREV_MARGIN_LEFT   8
+#define PREV_MARGIN_RIGHT  6
+#define PREV_MARGIN_TOP4
+#define PREV_MARGIN_BOTTOM 4
+
 #define PREV_MIN_IN_WIDTH  64
 #define PREV_MIN_IN_HEIGHT 8
 #define PREV_MAX_IN_HEIGHT 16384
@@ -985,52 +1021,36 @@ static void preview_config_averager(struct 
isp_prev_device *prev, u8 average)
  * enabled when reporting source pad formats to userspace. If this assumption 
is
  * not true, rows and columns must be manually cropped at the preview engine
  * input to avoid overflows at the end of lines and frames.
+ *
+ * See the explanation at the PREV_MARGIN_* definitions for more details.
  */
 static void preview_config_input_size(struct isp_prev_device *prev)
 {
struct isp_device *isp = to_isp_device(prev);
struct prev_params *params = &prev->params;
-   struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK];
-   unsigned int sph = 0;
-   unsigned int eph = format->width - 1;
-   unsigned int slv = 0;
-   unsigned int elv = format->height - 1;
-
-   if (prev->input == PREVIEW_INPUT_CCDC) {
-   sph += 2;
-   eph -= 2;
-   }
-
-   /*
-* Median filter4 pixels
-* Noise filter 4 pixels, 4 lines
-* or faulty pixels correction
-* CFA filter   4 pixels, 4 lines in Bayer mode
-*2 lines in other modes
-* Color suppression2 pixels
-* or luma enhancement
-* -
-* Maximum total14 pixels, 8 lines
-*/
-
-   if (!(params->features & PREV_CFA)) {
-   sph += 2;
-   eph -= 2;
-   slv += 2;
-   elv -= 2;
+   unsigned int sph = prev->crop.left;
+   unsigned int eph = prev->crop.left + prev->crop.width - 1;
+   unsigned int slv = prev->crop.top;
+   unsigned int elv = prev->crop.top + prev->crop.height - 1;
+
+   if (params->features & PREV_CFA) {
+   sph -= 2;
+   eph += 2;
+   slv -= 2;
+   elv += 2;
}
-   if (!(params->features & (PREV_DEFECT_COR | PREV_NOISE_FILTER))) {
-   sph += 2;
-   eph -= 2;
-   slv += 2;
-   elv -= 2;
+   if (params->features & (PREV_DEFECT_COR | PREV_NOISE_FILTER)) {
+   sph -= 2;
+   eph += 2;
+   slv -= 2;
+   elv += 2;
}
-   if (!(params->features & PREV_HORZ_MEDIAN_FILTER)) {
-   sph += 2;
-   eph -= 2;
+   if (param

[PATCH 2/3] omap3isp: preview: Rename min/max input/output sizes defines

2011-10-18 Thread Laurent Pinchart
The macros that define the minimum/maximum input and output sizes are
defined in seperate files and have no consistent naming. In preparation
for preview engine cropping support, move them all to isppreview.c and
rename them to PREV_{MIN|MAX}_{IN|OUT}_{WIDTH|HEIGHT}*.

Remove unused and/or unneeded local variables that store the maximum
output width.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/video/omap3isp/isppreview.c |   33 +++--
 drivers/media/video/omap3isp/ispreg.h |3 --
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index c920c1e..d5cce42 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -76,9 +76,15 @@ static struct omap3isp_prev_csc flr_prev_csc = {
 
 #define DEF_DETECT_CORRECT_VAL 0xe
 
-#define PREV_MIN_WIDTH 64
-#define PREV_MIN_HEIGHT8
-#define PREV_MAX_HEIGHT16384
+#define PREV_MIN_IN_WIDTH  64
+#define PREV_MIN_IN_HEIGHT 8
+#define PREV_MAX_IN_HEIGHT 16384
+
+#define PREV_MIN_OUT_WIDTH 0
+#define PREV_MIN_OUT_HEIGHT0
+#define PREV_MAX_OUT_WIDTH 1280
+#define PREV_MAX_OUT_WIDTH_ES2 3300
+#define PREV_MAX_OUT_WIDTH_36304096
 
 /*
  * Coeficient Tables for the submodules in Preview.
@@ -1280,14 +1286,14 @@ static unsigned int preview_max_out_width(struct 
isp_prev_device *prev)
 
switch (isp->revision) {
case ISP_REVISION_1_0:
-   return ISPPRV_MAXOUTPUT_WIDTH;
+   return PREV_MAX_OUT_WIDTH;
 
case ISP_REVISION_2_0:
default:
-   return ISPPRV_MAXOUTPUT_WIDTH_ES2;
+   return PREV_MAX_OUT_WIDTH_ES2;
 
case ISP_REVISION_15_0:
-   return ISPPRV_MAXOUTPUT_WIDTH_3630;
+   return PREV_MAX_OUT_WIDTH_3630;
}
 }
 
@@ -1295,7 +1301,6 @@ static void preview_configure(struct isp_prev_device 
*prev)
 {
struct isp_device *isp = to_isp_device(prev);
struct v4l2_mbus_framefmt *format;
-   unsigned int max_out_width;
 
preview_setup_hw(prev);
 
@@ -1333,8 +1338,6 @@ static void preview_configure(struct isp_prev_device 
*prev)
preview_config_outlineoffset(prev,
ALIGN(format->width, 0x10) * 2);
 
-   max_out_width = preview_max_out_width(prev);
-
preview_config_averager(prev, 0);
preview_config_ycpos(prev, format->code);
 }
@@ -1620,12 +1623,9 @@ static void preview_try_format(struct isp_prev_device 
*prev,
   enum v4l2_subdev_format_whence which)
 {
struct v4l2_mbus_framefmt *format;
-   unsigned int max_out_width;
enum v4l2_mbus_pixelcode pixelcode;
unsigned int i;
 
-   max_out_width = preview_max_out_width(prev);
-
switch (pad) {
case PREV_PAD_SINK:
/* When reading data from the CCDC, the input size has already
@@ -1638,10 +1638,11 @@ static void preview_try_format(struct isp_prev_device 
*prev,
 * filter array interpolation.
 */
if (prev->input == PREVIEW_INPUT_MEMORY) {
-   fmt->width = clamp_t(u32, fmt->width, PREV_MIN_WIDTH,
-max_out_width);
-   fmt->height = clamp_t(u32, fmt->height, PREV_MIN_HEIGHT,
- PREV_MAX_HEIGHT);
+   fmt->width = clamp_t(u32, fmt->width, PREV_MIN_IN_WIDTH,
+preview_max_out_width(prev));
+   fmt->height = clamp_t(u32, fmt->height,
+ PREV_MIN_IN_HEIGHT,
+ PREV_MAX_IN_HEIGHT);
}
 
fmt->colorspace = V4L2_COLORSPACE_SRGB;
diff --git a/drivers/media/video/omap3isp/ispreg.h 
b/drivers/media/video/omap3isp/ispreg.h
index 69f6af6..084ea77 100644
--- a/drivers/media/video/omap3isp/ispreg.h
+++ b/drivers/media/video/omap3isp/ispreg.h
@@ -402,9 +402,6 @@
 #define ISPPRV_YENH_TABLE_ADDR 0x1000
 #define ISPPRV_CFA_TABLE_ADDR  0x1400
 
-#define ISPPRV_MAXOUTPUT_WIDTH 1280
-#define ISPPRV_MAXOUTPUT_WIDTH_ES2 3300
-#define ISPPRV_MAXOUTPUT_WIDTH_36304096
 #define ISPRSZ_MIN_OUTPUT  64
 #define ISPRSZ_MAX_OUTPUT  3312
 
-- 
1.7.3.4

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


[PATCH 1/3] omap3isp: preview: Remove horizontal averager support

2011-10-18 Thread Laurent Pinchart
The horizontal averager isn't used and will get in the way when
implementing cropping support on the input pad. Remove it, it can be
added back later if needed.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/video/omap3isp/isppreview.c |   18 ++
 drivers/media/video/omap3isp/isppreview.h |7 ---
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/media/video/omap3isp/isppreview.c 
b/drivers/media/video/omap3isp/isppreview.c
index b381835..c920c1e 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -1228,7 +1228,6 @@ static void preview_init_params(struct isp_prev_device 
*prev)
/* Init values */
params->contrast = ISPPRV_CONTRAST_DEF * ISPPRV_CONTRAST_UNITS;
params->brightness = ISPPRV_BRIGHT_DEF * ISPPRV_BRIGHT_UNITS;
-   params->average = NO_AVE;
params->cfa.format = OMAP3ISP_CFAFMT_BAYER;
memcpy(params->cfa.table, cfa_coef_table,
   sizeof(params->cfa.table));
@@ -1297,7 +1296,6 @@ static void preview_configure(struct isp_prev_device 
*prev)
struct isp_device *isp = to_isp_device(prev);
struct v4l2_mbus_framefmt *format;
unsigned int max_out_width;
-   unsigned int format_avg;
 
preview_setup_hw(prev);
 
@@ -1337,8 +1335,7 @@ static void preview_configure(struct isp_prev_device 
*prev)
 
max_out_width = preview_max_out_width(prev);
 
-   format_avg = fls(DIV_ROUND_UP(format->width, max_out_width) - 1);
-   preview_config_averager(prev, format_avg);
+   preview_config_averager(prev, 0);
preview_config_ycpos(prev, format->code);
 }
 
@@ -1642,7 +1639,7 @@ static void preview_try_format(struct isp_prev_device 
*prev,
 */
if (prev->input == PREVIEW_INPUT_MEMORY) {
fmt->width = clamp_t(u32, fmt->width, PREV_MIN_WIDTH,
-max_out_width * 8);
+max_out_width);
fmt->height = clamp_t(u32, fmt->height, PREV_MIN_HEIGHT,
  PREV_MAX_HEIGHT);
}
@@ -1689,17 +1686,6 @@ static void preview_try_format(struct isp_prev_device 
*prev,
if (prev->input == PREVIEW_INPUT_CCDC)
fmt->width -= 4;
 
-   /* The preview module can output a maximum of 3312 pixels
-* horizontally due to fixed memory-line sizes. Compute the
-* horizontal averaging factor accordingly. Note that the limit
-* applies to the noise filter and CFA interpolation blocks, so
-* it doesn't take cropping by further blocks into account.
-*
-* ES 1.0 hardware revision is limited to 1280 pixels
-* horizontally.
-*/
-   fmt->width >>= fls(DIV_ROUND_UP(fmt->width, max_out_width) - 1);
-
/* Assume that all blocks are enabled and crop pixels and lines
 * accordingly. See preview_config_input_size() for more
 * information.
diff --git a/drivers/media/video/omap3isp/isppreview.h 
b/drivers/media/video/omap3isp/isppreview.h
index fa943bd..272a44a 100644
--- a/drivers/media/video/omap3isp/isppreview.h
+++ b/drivers/media/video/omap3isp/isppreview.h
@@ -45,11 +45,6 @@
 #define ISPPRV_CONTRAST_HIGH   0xFF
 #define ISPPRV_CONTRAST_UNITS  0x1
 
-#define NO_AVE 0x0
-#define AVE_2_PIX  0x1
-#define AVE_4_PIX  0x2
-#define AVE_8_PIX  0x3
-
 /* Features list */
 #define PREV_LUMA_ENHANCE  OMAP3ISP_PREV_LUMAENH
 #define PREV_INVERSE_ALAW  OMAP3ISP_PREV_INVALAW
@@ -106,7 +101,6 @@ enum preview_ycpos_mode {
  * @rgb2ycbcr: RGB to ycbcr parameters.
  * @hmed: Horizontal median filter.
  * @yclimit: YC limits parameters.
- * @average: Downsampling rate for averager.
  * @contrast: Contrast.
  * @brightness: Brightness.
  */
@@ -124,7 +118,6 @@ struct prev_params {
struct omap3isp_prev_csc rgb2ycbcr;
struct omap3isp_prev_hmed hmed;
struct omap3isp_prev_yclimit yclimit;
-   u8 average;
u8 contrast;
u8 brightness;
 };
-- 
1.7.3.4

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


[PATCH 0/3] OMAP3 ISP preview engine crop support

2011-10-18 Thread Laurent Pinchart
Hi everybody,

Those two patches add cropping support at the preview engine input. The first
patch removes horizontal averager support (unused) to ease crop implementation.
Horizontal averager support will be added back later if needed.

Laurent Pinchart (3):
  omap3isp: preview: Remove horizontal averager support
  omap3isp: preview: Rename min/max input/output sizes defines
  omap3isp: preview: Add crop support on the sink pad

 drivers/media/video/omap3isp/isppreview.c |  311 -
 drivers/media/video/omap3isp/isppreview.h |9 +-
 drivers/media/video/omap3isp/ispreg.h |3 -
 3 files changed, 216 insertions(+), 107 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [RFC] subdevice PM: .s_power() deprecation?

2011-10-18 Thread Sylwester Nawrocki
Hi Laurent,

On 10/18/2011 01:07 AM, Laurent Pinchart wrote:
> On Monday 17 October 2011 23:26:28 Sylwester Nawrocki wrote:
>> On 10/17/2011 05:23 PM, Guennadi Liakhovetski wrote:
>>> On Mon, 17 Oct 2011, Sylwester Nawrocki wrote:
 On 10/17/2011 03:49 PM, Guennadi Liakhovetski wrote:
> On Mon, 17 Oct 2011, Sylwester Nawrocki wrote:
>> On 10/17/2011 10:06 AM, Guennadi Liakhovetski wrote:
>>> On Sun, 9 Oct 2011, Sakari Ailus wrote:
 On Mon, Oct 03, 2011 at 12:57:10PM +0200, Guennadi Liakhovetski
> wrote:
 ...

 The bridge driver can't (nor should) know about the power management
 requirements of random subdevs. The name of the s_power op is rather
 poitless in its current state.

 The power state of the subdev probably even never matters to the
 bridge ---
>>>
>>> Exactly, that's the conclusion I come to in this RFC too.
>>>
 or do we really have an example of that?

 In my opinion the bridge driver should instead tell the bridge
 drivers what they can expect to hear from the bridge --- for
 example that the bridge can issue set / get controls or fmt ops to
 the subdev. The subdev may or may not need to be powered for those:
 only the subdev driver knows.
>>>
>>> Hm, why should the bridge driver tell the subdev driver (I presume,
>>> that's a typo in your above sentence) what to _expect_? Isn't just
>>> calling those operations enough?
>>>
 This is analogous to opening the subdev node from user space.
 Anything else except streaming is allowed. And streaming, which for
 sure requires powering on the subdev, is already nicely handled by
 the s_stream op.

 What do you think?

 In practice the name of s_power should change, as well as possible
 implementatio on subdev drivers.
>>>
>>> But why do we need it at all?
>>
>> AFAICS in some TV card drivers it is used to put the analog tuner into
>> low power state.
>> So core.s_power op provides the mans to suspend/resume a sub-device.
>>
>> If the bridge driver only implements a user space interface for the
>> subdev, it may want to bring a subdev up in some specific moment,
>> before video.s_stream, e.g. in some ioctl or at device open(), etc.
>>
>> Let's imagine bringing the sensor up takes appr. 700 ms, often we
>> don't want the sensor driver to be doing this before every
>> s_stream().
>
> Sorry, I still don't understand, how the bridge driver knows better,
> than the subdev driver, whether the user will resume streaming in
> 500ms or in 20s? Maybe there's some such information available with
> tuners, which I'm just unaware about?

 What I meant was that if the bridge driver assumes in advance that
 enabling sensor's power and getting it fully operational takes long
 time, it can enable sensor's power earlier than it's really necessary,
 to avoid excessive latencies during further actions.
>>>
>>> Where would a bridge driver get this information from? And how would it
>>> know in advance, when power would be "really needed" to enable it
>>> "earlier?"...
>>
>> I don't think this information could now be retrieved from a subdev in
>> standard way.
>>
>> If a bridge driver wants low latencies it can simply be coded to issue
>> s_power(1) before any other op call, and s_power(0) when it's done with a
>> subdev.
>>
 The bridge driver could also choose to keep the sensor powered on,
 whenever it sees appropriate, to avoid re-enabling the sensor to often.
>>>
>>> On what basis would the bridge driver make these decisions? How would it
>>> know in advance, when it'll have to re-enable the subdev next time?
>>
>> Re-enabling by allowing a subdev driver to entirely control the power
>> state. The sensor might implement "lowest power consumption" policy, while
>> the user might want "highest performance".
> 
> Exactly, that's a policy decision. Would PM QoS help here ?

Thanks for reminding about PM QoS. I didn't pay much attention to it but it
indeed appears to be a good fit for this sort of tasks.

We would possibly just need to think of parameters which could be associated 
with
video, e.g. video_latency, etc. ?...

I'm curious whether the whole power handling could be contained within a subdev 
driver, most likely it could be done for subdevs exposing a devnode.

> 
>> I'm referring only to camera sensor subdevs, as I don't have much experience
>> with other ones.
>>
>> Also there are some devices where you want to model power control
>> explicitly, and it is critical to overall system operation. The s5p-tv
>> driver is one example of these. The host driver knows exactly how the
>> power state of its subdevs should be handled.
> 
> The host probably knows about how to handle the power state of its internal
> subdevs, but what a

Re: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names

2011-10-18 Thread Joe Perches
On Tue, 2011-10-18 at 22:54 +0200, Piotr Chmura wrote:
> On Tue, 18 Oct 2011 13:28:39 -0700
> Joe Perches  wrote:
> > On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote:
> > > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/
> > []
> > > diff --git linux/drivers/staging/media/as102/as102_fe.c 
> > > linuxb/drivers/staging/media/as102/as102_fe.c
> > []
> > > @@ -408,6 +408,8 @@
> > >  
> > >   /* init frontend callback ops */
> > >   memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
> > > + strncpy(dvb_fe->ops.info.name, as102_dev->name,
> > > + sizeof(dvb_fe->ops.info.name));
> > strlcpy?
> Can be, but not during moving from another repo.

I don't know nor care much really which of these
patches are direct moves from another repo and which
are "cleanups".  It does appear that only patch
1 is a move from some repository to the kernel tree
and all the rest are cleanups though.

> There will be time for such fixes in kernel tree.
> Am I right ?

Oh sure, just pointing out what looks odd.

cheers, Joe

--
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: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names

2011-10-18 Thread Greg KH
On Tue, Oct 18, 2011 at 10:54:08PM +0200, Piotr Chmura wrote:
> On Tue, 18 Oct 2011 13:28:39 -0700
> Joe Perches  wrote:
> 
> > On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote:
> > > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/
> > []
> > > diff --git linux/drivers/staging/media/as102/as102_fe.c 
> > > linuxb/drivers/staging/media/as102/as102_fe.c
> > []
> > > @@ -408,6 +408,8 @@
> > >  
> > >   /* init frontend callback ops */
> > >   memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
> > > + strncpy(dvb_fe->ops.info.name, as102_dev->name,
> > > + sizeof(dvb_fe->ops.info.name));
> > 
> > strlcpy?
> > 
> > 
> 
> Can be, but not during moving from another repo.
> There will be time for such fixes in kernel tree.
> Am I right ?

Yes, you are correct, focus on getting the code into the tree first,
then work on fixing up the issues.

greg k-h
--
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: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names

2011-10-18 Thread Piotr Chmura
On Tue, 18 Oct 2011 13:28:39 -0700
Joe Perches  wrote:

> On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote:
> > Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/
> []
> > diff --git linux/drivers/staging/media/as102/as102_fe.c 
> > linuxb/drivers/staging/media/as102/as102_fe.c
> []
> > @@ -408,6 +408,8 @@
> >  
> > /* init frontend callback ops */
> > memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
> > +   strncpy(dvb_fe->ops.info.name, as102_dev->name,
> > +   sizeof(dvb_fe->ops.info.name));
> 
> strlcpy?
> 
> 

Can be, but not during moving from another repo.
There will be time for such fixes in kernel tree.
Am I right ?
--
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: pac7311

2011-10-18 Thread Németh Márton
Hi Lars,

Lars Noschinski wrote:
> I'm using a webcam (Philipps SPC500NC) which identifies itself as
> 
> 093a:2603 Pixart Imaging, Inc. PAC7312 Camera
> 
> and is sort-of supported by the gspca_pac7311 module. "sort-of" because
> the image alternates quickly between having a red tint or a green tint
> (using the gspac driver from kernel 3.0.0, but this problem is present
> since at least 2.6.31).

The most important source code for your webcam is 
drivers/media/video/gspca/pac7311.c .
You can see it online at 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/media/video/gspca/pac7311.c
 .

> If I remove and re-plugin the camera a few times (on average around 3
> times), the colors are stable.

When you plug and remove the webcam and the colors are wrong, do you get any
message in the "dmesg"?

Once the colors are stable and you unplug and replug the webcam, what happens 
then?
Is there again around 3 times when the webcam is not working properly?

> Then a second issue becomes apparent:
> There is almost no saturation in the image. Toying around with Contrast,
> Gamma, Exposure or Gain does not help. What _does_ help is the Vflip
> switch: If I enable it, the image is flipped vertically (as expected),
> but also the color become a lot better.

Is there any difference when you use the "Mirror" control? What about the
combination of the "Vflip" and "Mirror" controls?

What about the "Auto Gain" setting? Is it enabled or disabled in your case?

> Is there something I can do to debug/fix this problem?

You can try testing the webcam with different resolutions. The webcam
supports 160x120, 320x240 and 640x480 resolutions based on the source code.
You can try the different resolutions for example with "cheese"
( http://projects.gnome.org/cheese/ ) or any of your favorite V4L2 program.

You can load the usbmon kernel module and use Wireshark to log the USB 
communication
between your computer and the webcam starting with plug-in. You can compare
the communication when the webcam starts to work correctly with the one when
the webcam doesn't work as expected.

Regards,

Márton Németh
--
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 OOPS when releasing usb webcam (random)

2011-10-18 Thread David Rientjes
On Tue, 18 Oct 2011, Antonio Ospite wrote:

> > > im getting the following null pointer dereference from time to time when
> > > releasing a usb camera.
> > > 
> > > maybe this trace is of assistance...please reply to my mail since im not
> > > subscribed.
> > > 
> > 
> > I suspect this is happening in v4l2_device_unregister_subdev().  Adding 
> > Guennadi, Mauro, and linux-media.
> > 
> > > BUG: unable to handle kernel NULL pointer dereference at 006c
> > > IP: [] v4l2_device_release+0xa2/0xf0 [videodev]
> 
> Hi,
> 
> I sent a fix for a similar trace last week:
> http://patchwork.linuxtv.org/patch/8124/
> 
> Tomas, can you test it fixes the problem for you too?
> 

Tomas reported that the same change from Frederik Deweerdt fixed the 
issue, so you can add his tested-by from 
https://lkml.org/lkml/2011/10/18/298.

Guennadi or Mauro, how is this going to Linus?  It sounds like 3.1 
material since we've received at least a couple of reports of this in the 
past week.
--
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: [RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names

2011-10-18 Thread Joe Perches
On Tue, 2011-10-18 at 22:02 +0200, Piotr Chmura wrote:
> Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/
[]
> diff --git linux/drivers/staging/media/as102/as102_fe.c 
> linuxb/drivers/staging/media/as102/as102_fe.c
[]
> @@ -408,6 +408,8 @@
>  
>   /* init frontend callback ops */
>   memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
> + strncpy(dvb_fe->ops.info.name, as102_dev->name,
> + sizeof(dvb_fe->ops.info.name));

strlcpy?


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


[RESEND PATCH 12/14] staging/media/as102: fix licensing oversight

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:# HG changeset patch
# User Devin Heitmueller 
# Date 1267577404 18000
# Node ID 8557cb6da3e71a350a538e3a0eb41126884289b9
# Parent  84b93826c0a19efa114a6808165f91390cb86daa
as102: fix licensing oversight

From: Pierrick Hascoet 

Fix a couple of files which were supposed by be relicensed as GPL but were
overlooked.

Priority: normal

Signed-off-by: Pierrick Hascoet 
Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c 
linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c
--- linux/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -1,20 +1,21 @@
-/**
-
- \file   as10x_cmd_cfg.c
-
- \author: S. Martinelli
-
- \n
-   (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n
-   www.abilis.com  \n
- \n
-
- \brief AS10x API, configuration services
-
-   AS10x cmd management: build command buffer, send command through
-   selected port and wait for the response when required.
-
-*/
+/*
+ * Abilis Systems Single DVB-T Receiver
+ * Copyright (C) 2008 Pierrick Hascoet 
+ *
+ * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
 
 #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
 #include 
diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c 
linuxb/drivers/staging/media/as102/as10x_cmd_stream.c
--- linux/drivers/staging/media/as102/as10x_cmd_stream.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -1,22 +1,21 @@
-/**
-
- \file   as10x_cmd_stream.c
-
- \author: S. Martinelli
-
- \n
-   (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n
-   www.abilis.com  \n
- \n
-
- \brief AS10x CMD, stream services
-
-   AS10x CMD management: build command buffer, send command through
-   selected port and wait for the response when required.
-
-*/
-
-
+/*
+ * Abilis Systems Single DVB-T Receiver
+ * Copyright (C) 2008 Pierrick Hascoet 
+ *
+ * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
 #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
 #include 
 #include "as102_drv.h"
--
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


[RESEND PATCH 11/14] staging/media/as102: fix compile warning about unused function

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267319685 18000
# Node ID 84b93826c0a19efa114a6808165f91390cb86daa
# Parent  22ef1bdca69a2781abf397c53a0f7f6125f5359a
as102: fix compile warning about unused function

From: Devin Heitmueller 

The function in question is only used on old kernels, so we had the call to
the function #ifdef'd, but the definition of the function was stil being
included.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_fe.c 
linuxb/drivers/staging/media/as102/as102_fe.c
--- linux/drivers/staging/media/as102/as102_fe.c
+++ linuxb/drivers/staging/media/as102/as102_fe.c
@@ -32,6 +32,7 @@
 static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
  struct dvb_frontend_parameters *src);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 static void as102_fe_release(struct dvb_frontend *fe)
 {
struct as102_dev_t *dev;
@@ -42,7 +43,6 @@
if (dev == NULL)
return;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
if (mutex_lock_interruptible(&dev->bus_adap.lock))
return;
 
@@ -50,7 +50,6 @@
as10x_cmd_turn_off(&dev->bus_adap);
 
mutex_unlock(&dev->bus_adap.lock);
-#endif
 
/* release frontend callback ops */
memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops));
@@ -66,7 +65,6 @@
LEAVE();
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 static int as102_fe_init(struct dvb_frontend *fe)
 {
int ret = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND PATCH 10/14] staging/media/as102: properly handle multiple product names

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:# HG changeset patch
# User Devin Heitmueller 
# Date 1267319051 18000
# Node ID 22ef1bdca69a2781abf397c53a0f7f6125f5359a
# Parent  4a82558f6df8b957bc623d854a118a5da32dead2
as102: properly handle multiple product names

From: Devin Heitmueller 

Properly handle the case where the driver can be associated with multiple
different products (as opposed to always saying the device is named after the
value in a #define

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_drv.c 
linuxb/drivers/staging/media/as102/as102_drv.c
--- linux/drivers/staging/media/as102/as102_drv.c
+++ linuxb/drivers/staging/media/as102/as102_drv.c
@@ -209,7 +209,7 @@
 
 #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
ret = dvb_register_adapter(&as102_dev->dvb_adap,
-  DEVICE_FULL_NAME,
+  as102_dev->name,
   THIS_MODULE,
 #if defined(CONFIG_AS102_USB)
   &as102_dev->bus_adap.usb_dev->dev
diff --git linux/drivers/staging/media/as102/as102_drv.h 
linuxb/drivers/staging/media/as102/as102_drv.h
--- linux/drivers/staging/media/as102/as102_drv.h
+++ linuxb/drivers/staging/media/as102/as102_drv.h
@@ -106,6 +106,7 @@
 };
 
 struct as102_dev_t {
+   const char *name;
struct as102_bus_adapter_t bus_adap;
struct list_head device_entry;
struct kref kref;
diff --git linux/drivers/staging/media/as102/as102_fe.c 
linuxb/drivers/staging/media/as102/as102_fe.c
--- linux/drivers/staging/media/as102/as102_fe.c
+++ linuxb/drivers/staging/media/as102/as102_fe.c
@@ -346,7 +346,7 @@
 
 static struct dvb_frontend_ops as102_fe_ops = {
.info = {
-   .name   = DEVICE_FULL_NAME,
+   .name   = "Unknown AS102 device",
.type   = FE_OFDM,
.frequency_min  = 17400,
.frequency_max  = 86200,
@@ -408,6 +408,8 @@
 
/* init frontend callback ops */
memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
+   strncpy(dvb_fe->ops.info.name, as102_dev->name,
+   sizeof(dvb_fe->ops.info.name));
 
/* register dbvb frontend */
errno = dvb_register_frontend(dvb_adap, dvb_fe);
diff --git linux/drivers/staging/media/as102/as102_usb_drv.c 
linuxb/drivers/staging/media/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -44,6 +44,15 @@
{ } /* Terminating entry */
 };
 
+/* Note that this table must always have the same number of entries as the
+   as102_usb_id_table struct */
+static const char *as102_device_names[] = {
+   AS102_REFERENCE_DESIGN,
+   AS102_PCTV_74E,
+   AS102_ELGATO_EYETV_DTT_NAME,
+   NULL /* Terminating entry */
+};
+
 struct usb_driver as102_usb_driver = {
.name   =  DRIVER_FULL_NAME,
.probe  =  as102_usb_probe,
@@ -344,6 +353,7 @@
 {
int ret;
struct as102_dev_t *as102_dev;
+   int i;
 
ENTER();
 
@@ -353,6 +363,23 @@
return -ENOMEM;
}
 
+   /* This should never actually happen */
+   if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) !=
+   (sizeof(as102_device_names) / sizeof(const char *))) {
+   printk(KERN_ERR "Device names table invalid size");
+   return -EINVAL;
+   }
+
+   /* Assign the user-friendly device name */
+   for (i = 0; i < (sizeof(as102_usb_id_table) /
+sizeof(struct usb_device_id)); i++) {
+   if (id == &as102_usb_id_table[i])
+   as102_dev->name = as102_device_names[i];
+   }
+
+   if (as102_dev->name == NULL)
+   as102_dev->name = "Unknown AS102 device";
+
/* set private callback functions */
as102_dev->bus_adap.ops = &as102_priv_ops;
 
diff --git linux/drivers/staging/media/as102/as102_usb_drv.h 
linuxb/drivers/staging/media/as102/as102_usb_drv.h
--- linux/drivers/staging/media/as102/as102_usb_drv.h
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.h
@@ -28,16 +28,17 @@
 /* define these values to match the supported devices */
 
 /* Abilis system: "TITAN" */
+#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan"
 #define AS102_USB_DEVICE_VENDOR_ID 0x1BA6
 #define AS102_USB_DEVICE_PID_0001  0x0001
 
 /* PCTV Systems: PCTV picoStick (74e) */
-#define DEVICE_FULL_NAME   "PCTV Systems : PCTV picoStick (74e)"
+#define AS102_PCTV_74E "PCTV Systems picoStick (74e)"
 #define PCTV_74E_USB_VID   0x2013
 #define PCTV_74E_USB_PID   0x0246
 
 /* Elgato: EyeTV DTT Deluxe */
-#define 

[RESEND PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318991 18000
# Node ID 4a82558f6df8b957bc623d854a118a5da32dead2
# Parent  89de57601df871f6d951ca13bf52b136f9eadddf
as102: Add Elgato EyeTV DTT Deluxe

From: Devin Heitmueller 

Add support for the Elgato EyeTV DTT Deluxe.  Note that the product
name field has not yet been abstracted out, so it will still identify
itself as a PCTV 74e.  The driver was originally built by the chipset
manufacturer so that the product vendor can specify the deivce name via
a #define, but wasn't setup to support multiple products from the same build of
the driver.

Thanks to Joerg Unglaub for suggesting this change.

Priority: normal

Signed-off-by: Joerg Unglaub 
Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_usb_drv.c 
linuxb/drivers/staging/media/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -40,6 +40,7 @@
 static struct usb_device_id as102_usb_id_table[] = {
{ USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
{ USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
+   { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
{ } /* Terminating entry */
 };
 
diff --git linux/drivers/staging/media/as102/as102_usb_drv.h 
linuxb/drivers/staging/media/as102/as102_usb_drv.h
--- linux/drivers/staging/media/as102/as102_usb_drv.h
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.h
@@ -36,6 +36,11 @@
 #define PCTV_74E_USB_VID   0x2013
 #define PCTV_74E_USB_PID   0x0246
 
+/* Elgato: EyeTV DTT Deluxe */
+#define ELGATO_EYETV_DTT_NAME  "Elgato EyeTV DTT Deluxe"
+#define ELGATO_EYETV_DTT_USB_VID   0x0fd9
+#define ELGATO_EYETV_DTT_USB_PID   0x002c
+
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
 void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
 #else
--
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


[RESEND PATCH 8/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318909 18000
# Node ID 89de57601df871f6d951ca13bf52b136f9eadddf
# Parent  152825226bec049f947a844bea2c530fc9269ae5
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as10x_cmd_cfg.c.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c 
linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c
--- linux/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -2,8 +2,6 @@
 
  \file   as10x_cmd_cfg.c
 
- \version $Id$
-
  \author: S. Martinelli
 
  \n
@@ -22,7 +20,8 @@
 #include 
 #include "as102_drv.h"
 #elif defined(WIN32)
-   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)  /* win32 ddk 
implementation */
+   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
+  /* win32 ddk implementation */
   #include "wdm.h"
   #include "Device.h"
   #include "endian_mgmt.h" /* FIXME */
@@ -59,52 +58,52 @@
 int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
  uint32_t *pvalue)
 {
-   int  error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int  error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
-   sizeof(pcmd->body.context.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.context.req));
 
-   /* fill command */
-   pcmd->body.context.req.proc_id  = cpu_to_le16(CONTROL_PROC_CONTEXT);
-   pcmd->body.context.req.tag  = cpu_to_le16(tag);
-   pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
+   /* fill command */
+   pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT);
+   pcmd->body.context.req.tag = cpu_to_le16(tag);
+   pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error  = phandle->ops->xfer_cmd(phandle,
-  (uint8_t *) pcmd,
-  sizeof(pcmd->body.context.req) + HEADER_SIZE,
-  (uint8_t *) prsp,
-  sizeof(prsp->body.context.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error  = phandle->ops->xfer_cmd(phandle,
+   (uint8_t *) pcmd,
+   sizeof(pcmd->body.context.req)
+   + HEADER_SIZE,
+   (uint8_t *) prsp,
+   sizeof(prsp->body.context.rsp)
+   + HEADER_SIZE);
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response: context command do not follow the common response */
-   /* structure -> specific handling response parse required*/
-   error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
+   /* parse response: context command do not follow the common response */
+   /* structure -> specific handling response parse required*/
+   error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
 
-   if(error == 0) {
- /* Response OK -> get response data */
-  *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32);
- /* value returned is always a 32-bit value */
-   }
+   if (error == 0) {
+   /* Response OK -> get response data */
+   *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32);
+   /* value returned is always a 32-bit value */
+   }
 
 out:
-   LEAVE();
-   return(error);
+   LEAVE();
+   return error;
 }
 
 /**
@@ -118,47 +117,48 @@
 int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
  uint32_t value)
 {
-   int error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->c

[RESEND PATCH 7/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318867 18000
# Node ID 152825226bec049f947a844bea2c530fc9269ae5
# Parent  5916edd6739e9b8e02ff8a1e93161c4d23b50b3e
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_usb_drv.c.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_usb_drv.c 
linuxb/drivers/media/dvb/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -49,7 +50,7 @@
.id_table   =  as102_usb_id_table
 };
 
-struct file_operations as102_dev_fops = {
+static const struct file_operations as102_dev_fops = {
.owner   = THIS_MODULE,
.open= as102_open,
.release = as102_release,
@@ -63,46 +64,48 @@
 
 static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,
  unsigned char *send_buf, int send_buf_len,
- unsigned char *recv_buf, int recv_buf_len) {
-
+ unsigned char *recv_buf, int recv_buf_len)
+{
int ret = 0;
ENTER();
 
-   if(send_buf != NULL) {
+   if (send_buf != NULL) {
ret = usb_control_msg(bus_adap->usb_dev,
  usb_sndctrlpipe(bus_adap->usb_dev, 0),
  AS102_USB_DEVICE_TX_CTRL_CMD,
- USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR |
+ USB_RECIP_DEVICE,
  bus_adap->cmd_xid, /* value */
  0, /* index */
  send_buf, send_buf_len,
  USB_CTRL_SET_TIMEOUT /* 200 */);
-   if(ret < 0) {
+   if (ret < 0) {
dprintk(debug, "usb_control_msg(send) failed, err %i\n",
ret);
return ret;
}
 
-   if(ret != send_buf_len) {
+   if (ret != send_buf_len) {
dprintk(debug, "only wrote %d of %d bytes\n",
ret, send_buf_len);
return -1;
}
}
 
-   if(recv_buf != NULL) {
+   if (recv_buf != NULL) {
 #ifdef TRACE
dprintk(debug, "want to read: %d bytes\n", recv_buf_len);
 #endif
ret = usb_control_msg(bus_adap->usb_dev,
  usb_rcvctrlpipe(bus_adap->usb_dev, 0),
  AS102_USB_DEVICE_RX_CTRL_CMD,
- USB_DIR_IN | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ USB_DIR_IN | USB_TYPE_VENDOR |
+ USB_RECIP_DEVICE,
  bus_adap->cmd_xid, /* value */
  0, /* index */
  recv_buf, recv_buf_len,
  USB_CTRL_GET_TIMEOUT /* 200 */);
-   if(ret < 0) {
+   if (ret < 0) {
dprintk(debug, "usb_control_msg(recv) failed, err %i\n",
ret);
return ret;
@@ -119,18 +122,19 @@
 static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,
  unsigned char *send_buf,
  int send_buf_len,
- int swap32) {
-
+ int swap32)
+{
int ret = 0, actual_len;
 
-   ret = usb_bulk_msg(bus_adap->usb_dev, 
usb_sndbulkpipe(bus_adap->usb_dev, 1),
+   ret = usb_bulk_msg(bus_adap->usb_dev,
+  usb_sndbulkpipe(bus_adap->usb_dev, 1),
   send_buf, send_buf_len, &actual_len, 200);
-   if(ret) {
+   if (ret) {
dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret);
return ret;
}
 
-   if(actual_len != send_buf_len) {
+   if (actual_len != send_buf_len) {
dprintk(debug, "only wrote %d of %d bytes\n",
actual_len, send_buf_len);
return -1;
@@ -139,21 +143,22 @@
 }
 
 static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap,
-  unsigned char *recv_bu

[RESEND PATCH 6/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318799 18000
# Node ID 5916edd6739e9b8e02ff8a1e93161c4d23b50b3e
# Parent  1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_fe.c.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_fe.c 
linuxb/drivers/staging/media/as102/as102_fe.c
--- linux/drivers/staging/media/as102/as102_fe.c
+++ linuxb/drivers/staging/media/as102/as102_fe.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -31,12 +32,14 @@
 static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
  struct dvb_frontend_parameters *src);
 
-static void as102_fe_release(struct dvb_frontend *fe) {
+static void as102_fe_release(struct dvb_frontend *fe)
+{
struct as102_dev_t *dev;
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
@@ -64,13 +67,15 @@
 }
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
-static int as102_fe_init(struct dvb_frontend *fe) {
+static int as102_fe_init(struct dvb_frontend *fe)
+{
int ret = 0;
struct as102_dev_t *dev;
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -ENODEV;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -90,14 +95,16 @@
 #endif
 
 static int as102_fe_set_frontend(struct dvb_frontend *fe,
-struct dvb_frontend_parameters *params) {
+struct dvb_frontend_parameters *params)
+{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_args tune_args = { 0 };
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -ENODEV;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -107,9 +114,8 @@
 
/* send abilis command: SET_TUNE */
ret =  as10x_cmd_set_tune(&dev->bus_adap, &tune_args);
-   if(ret != 0) {
+   if (ret != 0)
dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret);
-   }
 
mutex_unlock(&dev->bus_adap.lock);
 
@@ -117,7 +123,7 @@
return (ret < 0) ? -EINVAL : 0;
 }
 
-static int as102_fe_get_frontend(struct dvb_frontend* fe,
+static int as102_fe_get_frontend(struct dvb_frontend *fe,
 struct dvb_frontend_parameters *p) {
int ret = 0;
struct as102_dev_t *dev;
@@ -125,7 +131,8 @@
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -EINVAL;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -150,7 +157,8 @@
 #if 0
dprintk(debug, "step_size= %d\n", settings->step_size);
dprintk(debug, "max_drift= %d\n", settings->max_drift);
-   dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 
1000);
+   dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms,
+   1000);
 #endif
 
settings->min_delay_ms = 1000;
@@ -160,14 +168,16 @@
 }
 
 
-static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
+static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status)
+{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_status tstate = { 0 };
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -ENODEV;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -176,48 +186,47 @@
/* send abilis command: GET_TUNE_STATUS */
ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate);
if (ret < 0) {
-   dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", 
ret);
+   dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n",
+   ret);
goto out;
}
 
dev->signal_strength  = tstate.signal_strength;
dev->ber  = tstate.BER;
 
-   switch(tstate.tune_state) {

[RESEND PATCH 5/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318751 18000
# Node ID 1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2
# Parent  69c8f5172790784738bcc18f8301919ef3d5373f
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as10x_cmd_stream.c.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c 
linuxb/drivers/staging/media/as102/as10x_cmd_stream.c
--- linux/drivers/staging/media/as102/as10x_cmd_stream.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -2,8 +2,6 @@
 
  \file   as10x_cmd_stream.c
 
- \version $Id$
-
  \author: S. Martinelli
 
  \n
@@ -53,57 +51,57 @@
\return 0 when no error, < 0 in case of error.
\callgraph
 */
-int as10x_cmd_add_PID_filter(as10x_handle_t* phandle,
-struct as10x_ts_filter *filter) {
-   interror;
-   struct as10x_cmd_t *pcmd, *prsp;
+int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
+struct as10x_ts_filter *filter)
+{
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
-   sizeof(pcmd->body.add_pid_filter.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.add_pid_filter.req));
 
-   /* fill command */
-   pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER);
-   pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
-   pcmd->body.add_pid_filter.req.stream_type = filter->type;
+   /* fill command */
+   pcmd->body.add_pid_filter.req.proc_id =
+   cpu_to_le16(CONTROL_PROC_SETFILTER);
+   pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
+   pcmd->body.add_pid_filter.req.stream_type = filter->type;
 
-   if(filter->idx < 16)
-   pcmd->body.add_pid_filter.req.idx = filter->idx;
-   else
-   pcmd->body.add_pid_filter.req.idx = 0xFF;
+   if (filter->idx < 16)
+   pcmd->body.add_pid_filter.req.idx = filter->idx;
+   else
+   pcmd->body.add_pid_filter.req.idx = 0xFF;
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error = phandle->ops->xfer_cmd(phandle,
-  (uint8_t *) pcmd,
-  sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE,
-  (uint8_t *) prsp,
-  sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+   sizeof(pcmd->body.add_pid_filter.req)
+   + HEADER_SIZE, (uint8_t *) prsp,
+   sizeof(prsp->body.add_pid_filter.rsp)
+   + HEADER_SIZE);
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response */
-   error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
+   /* parse response */
+   error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
 
-   if(error == 0) {
- /* Response OK -> get response data */
- filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
-   }
+   if (error == 0) {
+   /* Response OK -> get response data */
+   filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
+   }
 
 out:
-   LEAVE();
-   return(error);
+   LEAVE();
+   return error;
 }
 
 /**
@@ -113,144 +111,138 @@
\return 0 when no error, < 0 in case of error.
\callgraph
 */
-int as10x_cmd_del_PID_filter(as10x_handle_t* phandle,
+int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
 uint16_t pid_value)
 {
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   interror;
-   struct as10x_cmd_t *pcmd, *prsp;
+   ENTER();
 
-   ENTER();
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.del_pid_filter.req));
 
-   /* prepare command */
-   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
-   sizeof(pcmd->body.del_pid_filter.req));
+   /* fill command */
+   pcmd->body.del_pid_filter.req.proc_id =
+   cpu_to_le16(CONTROL_PROC_REMOVEFILT

[RESEND PATCH 4/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318701 18000
# Node ID 69c8f5172790784738bcc18f8301919ef3d5373f
# Parent  b91e96a07bee27c1d421b4c3702e33ee8075de83
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as10x_cmd.c.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as10x_cmd.c 
linuxb/drivers/media/dvb/as102/as10x_cmd.c
--- linux/drivers/staging/media/as102/as10x_cmd.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -21,7 +22,8 @@
 #include 
 #include "as102_drv.h"
 #elif defined(WIN32)
-   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)  /* win32 ddk 
implementation */
+   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
+  /* win32 ddk implementation */
   #include "wdm.h"
   #include "Device.h"
   #include "endian_mgmt.h" /* FIXME */
@@ -51,43 +53,42 @@
 */
 int as10x_cmd_turn_on(as10x_handle_t *phandle)
 {
-   int error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.turn_on.req));
 
-   /* fill command */
-   pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
+   /* fill command */
+   pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error = phandle->ops->xfer_cmd(
-   phandle,
-   (uint8_t *) pcmd,
-   sizeof(pcmd->body.turn_on.req) + HEADER_SIZE,
-   (uint8_t *) prsp,
-   sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+  sizeof(pcmd->body.turn_on.req) +
+  HEADER_SIZE,
+  (uint8_t *) prsp,
+  sizeof(prsp->body.turn_on.rsp) +
+  HEADER_SIZE);
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response */
-   error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
+   /* parse response */
+   error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
 
 out:
-   LEAVE();
-   return(error);
+   LEAVE();
+   return error;
 }
 
 /**
@@ -98,42 +99,41 @@
 */
 int as10x_cmd_turn_off(as10x_handle_t *phandle)
 {
-   int error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.turn_off.req));
 
-   /* fill command */
-   pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
+   /* fill command */
+   pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error = phandle->ops->xfer_cmd(
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error = phandle->ops->xfer_cmd(
phandle, (uint8_t *) pcmd,
sizeof(pcmd->body.turn_off.req) + HEADER_SIZE,
-(uint8_t *) prsp,
+   (uint8_t *) prsp,
sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response */
-   error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNO

[RESEND PATCH 3/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318626 18000
# Node ID b91e96a07bee27c1d421b4c3702e33ee8075de83
# Parent  e2ba344c99936bddc46722f1f1efec5600c58659
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_fw.c.

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_fw.c 
linuxb/drivers/media/dvb/as102/as102_fw.c
--- linux/drivers/staging/media/as102/as102_fw.c
+++ linuxb/drivers/staging/media/as102/as102_fw.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -31,15 +32,16 @@
 char as102_dt_fw1[] = "as102_data1_dt.hex";
 char as102_dt_fw2[] = "as102_data2_dt.hex";
 
-static unsigned char atohx(unsigned char *dst, char *src) {
+static unsigned char atohx(unsigned char *dst, char *src)
+{
unsigned char value = 0;
 
char msb = tolower(*src) - '0';
-   char lsb = tolower(*(src +1)) - '0';
+   char lsb = tolower(*(src + 1)) - '0';
 
-   if (msb > 9 )
+   if (msb > 9)
msb -= 7;
-   if (lsb > 9 )
+   if (lsb > 9)
lsb -= 7;
 
*dst = value = ((msb & 0xF) << 4) | (lsb & 0xF);
@@ -62,43 +64,42 @@
}
 
/* locate end of line */
-   for (src=fw_data; *src != '\n'; src += 2) {
+   for (src = fw_data; *src != '\n'; src += 2) {
atohx(&dst, src);
/* parse line to split addr / data */
switch (count) {
-   case 0:
-   *dataLength = dst;
-   break;
-   case 1:
-   addr[2] = dst;
-   break;
-   case 2:
-   addr[3] = dst;
-   break;
-   case 3:
-   /* check if data is an address */
-   if (dst == 0x04)
-   *addr_has_changed = 1;
-   else
-   *addr_has_changed = 0;
-   break;
-   case  4:
-   case  5:
-   if (*addr_has_changed) {
-   addr[(count - 4)] = dst;
-   } else {
-   data[(count - 4)] = dst;
-   }
-   break;
-   default:
+   case 0:
+   *dataLength = dst;
+   break;
+   case 1:
+   addr[2] = dst;
+   break;
+   case 2:
+   addr[3] = dst;
+   break;
+   case 3:
+   /* check if data is an address */
+   if (dst == 0x04)
+   *addr_has_changed = 1;
+   else
+   *addr_has_changed = 0;
+   break;
+   case  4:
+   case  5:
+   if (*addr_has_changed)
+   addr[(count - 4)] = dst;
+   else
data[(count - 4)] = dst;
-   break;
+   break;
+   default:
+   data[(count - 4)] = dst;
+   break;
}
count++;
}
 
/* return read value + ':' + '\n' */
-   return ((count * 2) + 2);
+   return (count * 2) + 2;
 }
 
 static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap,
@@ -122,17 +123,20 @@
&data_len,
&addr_has_changed);
 
-   if (read_bytes <= 0) {
+   if (read_bytes <= 0)
goto error;
-   }
 
/* detect the end of file */
-   if ((total_read_bytes += read_bytes) == firmware->size) {
+   total_read_bytes += read_bytes;
+   if (total_read_bytes == firmware->size) {
fw_pkt.u.request[0] = 0x00;
fw_pkt.u.request[1] = 0x03;
 
/* send EOF command */
-   if ((errno = 
bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0)
+   errno = bus_adap->ops->upload_fw_pkt(bus_ad

[RESEND PATCH 2/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318502 18000
# Node ID e2ba344c99936bddc46722f1f1efec5600c58659
# Parent  a78bda1e1a0badc4a1296be958f1f8a49014ae18
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_drv.c

Priority: normal

Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

diff --git linux/drivers/staging/media/as102/as102_drv.c 
linuxb/drivers/media/dvb/as102/as102_drv.c
--- linux/drivers/staging/media/as102/as102_drv.c
+++ linuxb/drivers/staging/media/as102/as102_drv.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -36,23 +37,23 @@
 #warning >>> DVB_CORE not defined !!! <<<
 #endif
 
-int debug = 0;
+int debug;
 module_param_named(debug, debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)");
 
-int dual_tuner = 0;
+int dual_tuner;
 module_param_named(dual_tuner, dual_tuner, int, 0644);
-MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: 
off)");
+MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner config (default: off)");
 
 static int fw_upload = 1;
 module_param_named(fw_upload, fw_upload, int, 0644);
 MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)");
 
-static int pid_filtering = 0;
+static int pid_filtering;
 module_param_named(pid_filtering, pid_filtering, int, 0644);
 MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)");
 
-static int ts_auto_disable = 0;
+static int ts_auto_disable;
 module_param_named(ts_auto_disable, ts_auto_disable, int, 0644);
 MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)");
 
@@ -65,7 +66,8 @@
 #endif
 
 #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
-static void as102_stop_stream(struct as102_dev_t *dev) {
+static void as102_stop_stream(struct as102_dev_t *dev)
+{
struct as102_bus_adapter_t *bus_adap;
 
if (dev != NULL)
@@ -80,16 +82,15 @@
if (mutex_lock_interruptible(&dev->bus_adap.lock))
return;
 
-   if (as10x_cmd_stop_streaming(bus_adap) < 0) {
+   if (as10x_cmd_stop_streaming(bus_adap) < 0)
dprintk(debug, "as10x_cmd_stop_streaming failed\n");
-   }
 
mutex_unlock(&dev->bus_adap.lock);
}
 }
 
-static int as102_start_stream(struct as102_dev_t *dev) {
-
+static int as102_start_stream(struct as102_dev_t *dev)
+{
struct as102_bus_adapter_t *bus_adap;
int ret = -EFAULT;
 
@@ -98,9 +99,8 @@
else
return ret;
 
-   if (bus_adap->ops->start_stream != NULL) {
+   if (bus_adap->ops->start_stream != NULL)
ret = bus_adap->ops->start_stream(dev);
-   }
 
if (ts_auto_disable) {
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -127,25 +127,25 @@
return -EBUSY;
}
 
-   switch(onoff) {
-   case 0:
-   ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) 
pid);
-   dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = 
%d\n",
-   index, pid, ret);
-   break;
-   case 1:
-   {
-   struct as10x_ts_filter filter;
+   switch (onoff) {
+   case 0:
+   ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid);
+   dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n",
+   index, pid, ret);
+   break;
+   case 1:
+   {
+   struct as10x_ts_filter filter;
 
-   filter.type = TS_PID_TYPE_TS;
-   filter.idx = 0xFF;
-   filter.pid = pid;
+   filter.type = TS_PID_TYPE_TS;
+   filter.idx = 0xFF;
+   filter.pid = pid;
 
-   ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
-   dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) 
ret = %d\n",
-   index, filter.idx, filter.pid, ret);
-   break;
-   }
+   ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
+   dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",
+   index, filter.idx, filter.pid, ret);
+   break;
+   }
}
 
mutex_unlock(&dev->bus_adap.lock);
@@ -154,7 +154,8 @@
return ret;
 }
 
-static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) {
+static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed

[PATCH] saa7134.h: Suppress compiler warnings when CONFIG_VIDEO_SAA7134_RC is not set

2011-10-18 Thread Timo Kokkonen
If the said config optio is not set, the compiler will spill out many
warnings about statements with no effect, such as:

drivers/media/video/saa7134/saa7134-core.c: In function ‘saa7134_irq’:
drivers/media/video/saa7134/saa7134-core.c:569:7: warning: statement with no 
effect
drivers/media/video/saa7134/saa7134-core.c:588:7: warning: statement with no 
effect

Casting the zero to void will cure the warning.

Signed-off-by: Timo Kokkonen 
---
 drivers/media/video/saa7134/saa7134.h |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/video/saa7134/saa7134.h 
b/drivers/media/video/saa7134/saa7134.h
index bc8d6bb..9b55068 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -843,10 +843,10 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev);
 int saa7134_ir_start(struct saa7134_dev *dev);
 void saa7134_ir_stop(struct saa7134_dev *dev);
 #else
-#define saa7134_input_init1(dev)   (0)
-#define saa7134_input_fini(dev)(0)
-#define saa7134_input_irq(dev) (0)
-#define saa7134_probe_i2c_ir(dev)  (0)
-#define saa7134_ir_start(dev)  (0)
-#define saa7134_ir_stop(dev)   (0)
+#define saa7134_input_init1(dev)   ((void)0)
+#define saa7134_input_fini(dev)((void)0)
+#define saa7134_input_irq(dev) ((void)0)
+#define saa7134_probe_i2c_ir(dev)  ((void)0)
+#define saa7134_ir_start(dev)  ((void)0)
+#define saa7134_ir_stop(dev)   ((void)0)
 #endif
-- 
1.7.7

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


[PULL] git://linuxtv.org/mkrufky/mxl111sf aero-m-dvbt

2011-10-18 Thread Michael Krufky
Mauro,

Please pull from the aero-m-dvbt branch of my mxl111sf git tree.  This
adds DVB-T support to the WinTV Aero-M, which already supports ATSC.
Once this is merged, the WinTV Aero-M will be the first USB device
known to be supported under Linux that supports both ATSC and DVB-T.
(I will have mine with me in Prague next week) ... Please pull asap so
that we can play with the device next week using the merged
repository.

The following changes since commit a461e0ad3d27b6342140566909a80db30d151a91:
  Steven Toth (1):
[media] cx23885: Stop the risc video fifo before reconfiguring it

are available in the git repository at:

  git://linuxtv.org/mkrufky/mxl111sf aero-m-dvbt

Michael Krufky (2):
  DVB: add MaxLinear MxL111SF DVB-T demodulator driver
  mxl111sf: add DVB-T support

 drivers/media/dvb/dvb-usb/Makefile |1 +
 drivers/media/dvb/dvb-usb/mxl111sf-demod.c |  604 
 drivers/media/dvb/dvb-usb/mxl111sf-demod.h |   55 +++
 drivers/media/dvb/dvb-usb/mxl111sf.c   |  228 +++-
 drivers/media/dvb/dvb-usb/mxl111sf.h   |2 +-
 5 files changed, 886 insertions(+), 4 deletions(-)
 create mode 100644 drivers/media/dvb/dvb-usb/mxl111sf-demod.c
 create mode 100644 drivers/media/dvb/dvb-usb/mxl111sf-demod.h

Best Regards,

Michael Krufky
--
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 2/9] mm: alloc_contig_freed_pages() added

2011-10-18 Thread Michal Nazarewicz

On Tue, 18 Oct 2011 10:48:46 -0700, Dave Hansen  wrote:


On Tue, 2011-10-18 at 10:26 -0700, Michal Nazarewicz wrote:

> You can do this in a more general fashion by checking the
> zone boundaries and resolving the pfn->page every MAX_ORDER_NR_PAGES.
> That will not be SPARSEMEM specific.

I've tried doing stuff that way but it ended up with much more code.


I guess instead of:


+static inline bool zone_pfn_same_memmap(unsigned long pfn1, unsigned long pfn2)
+{
+return pfn_to_section_nr(pfn1) == pfn_to_section_nr(pfn2);
+}


You could do:

static inline bool zone_pfn_same_maxorder(unsigned long pfn1, unsigned long 
pfn2)
{
unsigned long mask = MAX_ORDER_NR_PAGES-1;
return (pfn1 & mask) == (pfn2 & mask);
}

I think that works.  Should be the same code you have now, basically.


Makes sense.  It'd require calling pfn_to_page() every MAX_ORDER_NR_PAGES even
in memory models that have linear mapping of struct page, but I guess that's
not that bad.

--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of  o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz(o o)
ooo +--ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] videodev: fix a NULL pointer dereference in v4l2_device_release()

2011-10-18 Thread David Rientjes
On Tue, 18 Oct 2011, Antonio Ospite wrote:

> > can anyone reproduce this?
> >
> 
> Ping.
> 
> David, does the change below fix it for you, I sent the patch
> last week.
> 

I never had the problem.
--
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: support for tv tuner tda18211 in Iconbit U100 analog stick

2011-10-18 Thread Ariel Jolo
Bump, could anybody give me a hand on this ?

Thanks !


On Sun, Oct 16, 2011 at 5:02 PM, Ariel Jolo  wrote:
>
> Hey guys, I'm having the same issue here. I bought a MSI Digi VOX Mini
> II Analog (which was documented as having RTL2832 or AF9016 chips) but
> mine is:
> 1f4d:0237 G-Tek Electronics Group
>
> Here's the syslog output when I plug it in:
> http://pastebin.com/fWc7hM18
>
> As Ling, I can't get a tuner to work nor does /dev/dvb get created.
> I really need some help on this.
> Thank you very much !
>
>
> On 13 Oct 2011, Antti Palosaari wrote:
> > From: Antti Palosaari  iki.fi>
> > Subject: Re: support for tv tuner tda18211 in Iconbit U100 analog stick
> > Date: 2011-10-13 13:21:41 GMT (3 days, 6 hours and 26 minutes ago)
> > CX23102 + TDA18211 (== DVB-T only version of TDA18271)>
> >
> >Maybe someone have better knowledge about that as I am not any familiar
> >with CX23102 nor analog TV side.
> >
> >Antti
> >
> >On 10/09/2011 03:56 AM, Ling Sequera wrote:
> >> I try to post this at linux-media  vger.kernel.org
> >> , but the system rejects the
> >> sending, Excuse me for send this to you, I have understood that you are
> >> one of the developers of the tda18271 module.
> >>
> >> I have a "Mygica u719c usb analog tv stick", lsusb output identify this
> >> device as: "ID 1f4d:0237 G-Tek Electronics Group". Googling, I found
> >> that this device is the same "Iconbit Analog Stick U100 FM
> >> ",
> >> which has support in the kernel since version 3.0 as shown here
> >> . I opened the
> >> device to corfirm this information, and effectively, it has to chips,
> >> the demod Conexan "CX23102" and the DVB-T tuner NPX "TDA-18211". I
> >> installed the precompiled version of kernel 3.0.4, and the device was
> >> reconized, but only works in the modes: composite and s-video. I check
> >> the source code and I found that it don't support tv tuner mode
> >> (.tuner_type=TUNER_ABSENT in 513 line of the cx231xx-cards.c
> >> 
> >> source file), I want to add support for this. The TDA-18211 tuner has
> >> support in the kernel in the module tda18271 according to the thread of
> >> this mailing list
> >> 

Re: [PATCH 2/9] mm: alloc_contig_freed_pages() added

2011-10-18 Thread Dave Hansen
On Tue, 2011-10-18 at 10:26 -0700, Michal Nazarewicz wrote:
> > You can do this in a more general fashion by checking the
> > zone boundaries and resolving the pfn->page every MAX_ORDER_NR_PAGES.
> > That will not be SPARSEMEM specific.
> 
> I've tried doing stuff that way but it ended up with much more code.

I guess instead of:

>> +static inline bool zone_pfn_same_memmap(unsigned long pfn1, unsigned long 
>> pfn2)
>> +{
>> +return pfn_to_section_nr(pfn1) == pfn_to_section_nr(pfn2);
>> +}

You could do:

static inline bool zone_pfn_same_maxorder(unsigned long pfn1, unsigned long 
pfn2)
{
unsigned long mask = MAX_ORDER_NR_PAGES-1;
return (pfn1 & mask) == (pfn2 & mask);
}

I think that works.  Should be the same code you have now, basically.

-- Dave

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


cron job: media_tree daily build: WARNINGS

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

Results of the daily build of media_tree:

date:Tue Oct 18 19:00:15 CEST 2011
git hash:a461e0ad3d27b6342140566909a80db30d151a91
gcc version:  i686-linux-gcc (GCC) 4.6.1
host hardware:x86_64
host os:  3.0-4.slh.7-amd64

linux-git-armv5: WARNINGS
linux-git-armv5-davinci: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-armv5-omap2: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: WARNINGS
linux-2.6.31.12-i686: WARNINGS
linux-2.6.32.6-i686: WARNINGS
linux-2.6.33-i686: WARNINGS
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-rc1-i686: WARNINGS
linux-2.6.31.12-x86_64: WARNINGS
linux-2.6.32.6-x86_64: WARNINGS
linux-2.6.33-x86_64: WARNINGS
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-rc1-x86_64: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The 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


Re: [PATCH 2/9] mm: alloc_contig_freed_pages() added

2011-10-18 Thread Michal Nazarewicz

On Tue, 18 Oct 2011 05:21:09 -0700, Mel Gorman  wrote:


At this point, I'm going to apologise for not reviewing this a long long
time ago.

On Thu, Oct 06, 2011 at 03:54:42PM +0200, Marek Szyprowski wrote:

From: KAMEZAWA Hiroyuki 

This commit introduces alloc_contig_freed_pages() function
which allocates (ie. removes from buddy system) free pages
in range. Caller has to guarantee that all pages in range
are in buddy system.



Straight away, I'm wondering why you didn't use

mm/compaction.c#isolate_freepages()

It knows how to isolate pages within ranges. All its control information
is passed via struct compact_control() which I recognise may be awkward
for CMA but compaction.c know how to manage all the isolated pages and
pass them to migrate.c appropriately.


It is something to consider.  At first glance, I see that isolate_freepages
seem to operate on pageblocks which is not desired for CMA.


I haven't read all the patches yet but isolate_freepages() does break
everything up into order-0 pages. This may not be to your liking but it
would not be possible to change.


Splitting everything into order-0 pages is desired behaviour.


Along with this function, a free_contig_pages() function is
provided which frees all (or a subset of) pages allocated
with alloc_contig_free_pages().



mm/compaction.c#release_freepages()


It sort of does the same thing but release_freepages() assumes that pages
that are being freed are not-continuous and they need to be on the lru list.
With free_contig_pages(), we can assume all pages are continuous.


+#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
+/*
+ * Both PFNs must be from the same zone!  If this function returns
+ * true, pfn_to_page(pfn1) + (pfn2 - pfn1) == pfn_to_page(pfn2).
+ */
+static inline bool zone_pfn_same_memmap(unsigned long pfn1, unsigned long pfn2)
+{
+   return pfn_to_section_nr(pfn1) == pfn_to_section_nr(pfn2);
+}
+


Why do you care what section the page is in? The zone is important all
right, but not the section. Also, offhand I'm unsure if being in the
same section guarantees the same zone. sections are ordinarily fully
populated (except on ARM but hey) but I can't remember anything
enforcing that zones be section-aligned.

Later I think I see that the intention was to reduce the use of
pfn_to_page().


That is correct.


You can do this in a more general fashion by checking the
zone boundaries and resolving the pfn->page every MAX_ORDER_NR_PAGES.
That will not be SPARSEMEM specific.


I've tried doing stuff that way but it ended up with much more code.

Dave suggested the above function to check if pointer arithmetic is valid.

Please see also .




+#else
+
+#define zone_pfn_same_memmap(pfn1, pfn2) (true)
+
+#endif
+
 #endif /* !__GENERATING_BOUNDS.H */
 #endif /* !__ASSEMBLY__ */
 #endif /* _LINUX_MMZONE_H */




@@ -5706,6 +5706,73 @@ out:
spin_unlock_irqrestore(&zone->lock, flags);
 }

+unsigned long alloc_contig_freed_pages(unsigned long start, unsigned long end,
+  gfp_t flag)
+{
+   unsigned long pfn = start, count;
+   struct page *page;
+   struct zone *zone;
+   int order;
+
+   VM_BUG_ON(!pfn_valid(start));


VM_BUG_ON seems very harsh here. WARN_ON_ONCE and returning 0 to the
caller sees reasonable.


+   page = pfn_to_page(start);
+   zone = page_zone(page);
+
+   spin_lock_irq(&zone->lock);
+
+   for (;;) {
+   VM_BUG_ON(page_count(page) || !PageBuddy(page) ||
+ page_zone(page) != zone);
+


Here you will VM_BUG_ON with the zone lock held leading to system
halting very shortly.


+   list_del(&page->lru);
+   order = page_order(page);
+   count = 1UL << order;
+   zone->free_area[order].nr_free--;
+   rmv_page_order(page);
+   __mod_zone_page_state(zone, NR_FREE_PAGES, -(long)count);
+


The callers need to check in advance if watermarks are sufficient for
this. In compaction, it happens in compaction_suitable() because it only
needed to be checked once. Your requirements might be different.


+   pfn += count;
+   if (pfn >= end)
+   break;
+   VM_BUG_ON(!pfn_valid(pfn));
+


On ARM, it's possible to encounter invalid pages. VM_BUG_ON is serious
overkill.


+   if (zone_pfn_same_memmap(pfn - count, pfn))
+   page += count;
+   else
+   page = pfn_to_page(pfn);
+   }
+
+   spin_unlock_irq(&zone->lock);
+
+   /* After this, pages in the range can be freed one be one */
+   count = pfn - start;
+   pfn = start;
+   for (page = pfn_to_page(pfn); count; --count) {
+   prep_new_page(page, 0, flag);
+   ++pfn;
+   if (likely(zone_pfn_same_memmap(pfn - 1, pfn)))
+   ++page;
+   else

Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102)

2011-10-18 Thread Piotr Chmura
On Tue, 18 Oct 2011 11:52:17 -0400
Devin Heitmueller  wrote:

> On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura  
> wrote:
> > Thanks for comments for all of you.
> >
> > [PATCH 1-12/14] Following your guidelines i exported all changes from hg 
> > one by one. This way we will have all history in kernel tree.
> > I moved driver to staging/media and removed Kconfig/Makefile changes in 
> > parent directory in first patch.
> 
> Hello Piotr,
> 
> Not that I want to create more work for you, but it would appear that
> your patches stripped off all the Signed-off-by lines for both myself
> and Pierrick Hascoet (the developer from the hardware vendor).  You
> have replaced them with "cc:" lines, which breaks the chain of
> "Developer's Certificate of Origin".
> 
> When you take somebody else's patches, you need to preserve any
> existing Signed-off-by lines, adding your own at the bottom of the
> list.
> 
> In other words, the first patch should be:
> 
> Signed-off-by: Pierrick Hascoet 
> Signed-off-by: Devin Heitmueller 
> Signed-off-by: Piotr Chmura 
> 
> instead of:
> 
> Signed-off-by: Piotr Chmura 
> Cc: Pierrick Hascoet 
> Cc: Devin Heitmueller 
> 
> Devin
> 
> -- 
> Devin J. Heitmueller - Kernel Labs
> http://www.kernellabs.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Ok, i'll resend them again. 

Should I replay to every patch with something like [RESEND PATCH nn/mm]..., 
right ?

Peter
--
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: Raw data on beagleboard via isp bypass and ccdc.

2011-10-18 Thread Andrew Tubbiolo
Hi All:
    I'm trying to obtain the raw data stream off an aptina mt9p031 via
bypassing the isp in order to get my data directly from the ccdc on a
beagle xm. I've seen what seem to be 3 different forks stabbing at the
problem. None of the threads seem to indicate what patch train, cross
compile environment, and base kernel source source to draw from.

     So I'm asking if someone can point me to a mt9p031.c file, or
patches to apply to which base version of mt9p031 and what kernel
source distro and what patches I need to apply in order to get a
system that will allow something like media-ctl to obtain a raw data
stream from my detector. FYI, I want the raw data for astronomical
purposes.

Thanks!
Andrew
--
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 2/3] soc-camera: mt9t112: modify delay time after initialize

2011-10-18 Thread Guennadi Liakhovetski
Hi all

On Wed, 12 Oct 2011, Kuninori Morimoto wrote:

> Hi Guennadi
> 
> > There was a question at the bottom of this email, which you might have 
> > overseen:-) Could you give me an idea, which patche(es) exactly you meant?
> 
> sorry for my super late response.
> I losted this email.
> 
> 
> > > > > > Subject: [PATCH 2/3] soc-camera: mt9t112: modify delay time after 
> > > > > > initialize
> (snip)
> > > > > > Subject: [PATCH 3/3] soc-camera: mt9t112: The flag which control 
> > > > > > camera-init is removed
> 
> > > > This patch is needed for mt9t112 camera initialize.
> > > > I thought that it was already applied.
> > > 
> > > Which patch do you mean? Patch 2/3, or 3/3, or both are needed?
> 
> Both are needed.
> These are bug fix patches

I tried to capture several frames beginning with the very first one (as 
much as performance allowed), and I do see several black or wrongly 
coloured framed in the beginning, but none of those patches, including the 
proposed 300ms at the end of .s_stream() fixes the problem reliably. So, 
either this problems, that these patches fix, are specific to the Solution 
Engine board (is it the one, where the problems have been observed?), or 
one needs a different testing method. If they are SE-specific - I don't 
think, getting those fixes in the driver is very important, because 
mt9t112 data for SE is not in the mainline. If I was testing wrongly, 
please, tell me how exactly to reproduce those problems and see, how one 
or another patch fixes them.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
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/14] staging/media/as102: initial import from Abilis

2011-10-18 Thread Mauro Carvalho Chehab
Em 18-10-2011 14:24, Dan Carpenter escreveu:
> On Tue, Oct 18, 2011 at 11:11:34AM +0200, Piotr Chmura wrote:
>> diff --git linux/drivers/staging/media/as102/Kconfig 
>> linuxb/drivers/media/dvb/as102/Kconfig
>> new file mode 100644
>> --- /dev/null
>> +++ linuxb/drivers/staging/media/as102/Kconfig
>> @@ -0,0 +1,7 @@
>> +config DVB_AS102
>> +tristate "Abilis AS102 DVB receiver"
>> +depends on DVB_CORE && USB && I2C && INPUT
>> +help
>> +  Choose Y or M here if you have a device containing an AS102
>> +
>> +  To compile this driver as a module, choose M here
>> diff --git linux/drivers/staging/media/as102/Makefile 
>> linuxb/drivers/media/dvb/as102/Makefile
>> new file mode 100644
>> --- /dev/null
>> +++ linuxb/drivers/staging/media/as102/Makefile
>> @@ -0,0 +1,5 @@
>> +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o 
>> as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o
>> +
>> +obj-$(CONFIG_DVB_AS102) += dvb-as102.o
>> +
>> +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core
> 
> It sounds like you're going to do a resend to add in the
> Signed-off-by lines?
> 
> It would be better to separate these two chunks out and put them at
> the end after you've fixed the compile errors in [PATCH 13/14].

This doesn't really matter, as the driver won't be added to the Kernel building 
system
before patch 13/14, as drivers/staging/Makefile wasn't touch on patch 1/14.
> 
> 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: omap3isp: BT.656 support

2011-10-18 Thread Enrico
On Tue, Oct 18, 2011 at 3:33 PM, Boris Todorov
 wrote:
> Hi
>
> I'm trying to run OMAP + TVP5151 in BT656 mode.
>
> I'm using omap3isp-omap3isp-yuv (git.linuxtv.org/pinchartl/media.git).
> Plus the following patches:
>
> TVP5151:
> https://github.com/ebutera/meta-igep/tree/testing-v2/recipes-kernel/linux/linux-3.0+3.1rc/tvp5150
>
> The latest RFC patches for BT656 support:
>
> Enrico Butera (2):
>  omap3isp: ispvideo: export isp_video_mbus_to_pix
>  omap3isp: ispccdc: configure CCDC registers and add BT656 support
>
> Javier Martinez Canillas (1):
>  omap3isp: ccdc: Add interlaced field mode to platform data
>
>
> I'm able to configure with media-ctl:
>
> media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3
> ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
> media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
> media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
> media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'
>
> But
> ./yavta -f UYVY -s 720x525 -n 4 --capture=4 -F /dev/video4
>
> sleeps after
> ...
> Buffer 1 mapped at address 0x4021d000.
> length: 756000 offset: 1515520
> Buffer 2 mapped at address 0x402d6000.
> length: 756000 offset: 2273280
> Buffer 3 mapped at address 0x4038f000.
>
> Anyone with the same issue??? This happens with every other v4l test app I 
> used.
> I can see data from TVP5151 but there are no interrupts in ISP.

You can try if this:

http://www.spinics.net/lists/linux-media/msg37795.html

makes it work.

Enrico
--
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] Improved handling of presets

2011-10-18 Thread Mauro Carvalho Chehab
Em 18-10-2011 12:24, Hans Verkuil escreveu:
> On Tuesday 18 October 2011 14:19:40 Mauro Carvalho Chehab wrote:
>> Em 17-10-2011 15:03, Hans Verkuil escreveu:
>>> On Monday, October 17, 2011 17:36:10 Mauro Carvalho Chehab wrote:
 Em 17-10-2011 06:32, Hans Verkuil escreveu:
>Currently I have four standards:
>   #define V4L2_DV_BT_STD_CEA861   (1 << 0)
>   #define V4L2_DV_BT_STD_DMT  (1 << 1)  /* VESA Discrete Monitor 
> Timings
>   */ #define V4L2_DV_BT_STD_CVT   (1 << 2)  /* VESA Coordinated Video
>   Timings */ #define V4L2_DV_BT_STD_GTF   (1 << 3)  /* VESA Generalized
>   Timings Formula */
>   
>A particular timing can be part of 0 or more standards.
>Both CVT and GTF timings have a so-called 'reduced blanking' mode.
>It would be nice to represent this with a flag somewhere. I guess
>we need a flags field for that. The 'polarities' field really
>should have been called a 'flags' field. Oh well...

 instead of flags, we may consider using something like:
_u32 polarity:1

 We need to double check if this is portable enough, however.
>>>
>>> Bitfields aren't portable, unfortunately. But I wonder if we could do
>>>
>>> something like this:
>>> union {
>>> 
>>> __u32   polarities; /* Positive or negative polarity */
>>> __u32   flags;
>>> 
>>> };
>>>
>>> and deprecate 'polarities' and remove it in a year.
>>
>> If the idea is to replace the existing ioctl's, just name it as flags for
>> the structs used by the new ones. The old "polarities" will be removed
>> together with the removal of the old ioctl's.
> 
> Do we want to replace the current DV_TIMINGS ioctls? I don't see a need for
> that, to be honest. It's just the name of this field that's awkward.

It is not just that is awkward. 

struct v4l2_bt_timings is also a bad name, as "bt" doesn't really mean anything
(well, bt856 or bt1120 would be a better naming, but, even so, the timing
data there is not specific to the BT standards).

I agree with you that we can just keep the S/G DV_TIMINGS ioctl as-is, just
providing a way to use it also to get/set presets. A simple new field addition
is enough for that.

> 
>>> I suspect that Cisco might be the only user of this API anyway with the
>>> davinci drivers.
>>
>> Likely.
>>
> 2) Create a VIDIOC_ENUM_DV_TIMINGS ioctl:
>   struct v4l2_enum_dv_timings {
>   
>   __u32 index;
>   char name[32];

 Not sure about the "name" field. An u32 working as an enum could work
 better.
>>>
>>> Huh? You need a name field for the human-readable description of the
>>> timings, just like all other enum ioctls.
>>
>> The naming here could be something completely arbitrary, especially for
>> custom timings. I'm ok if you insist on keeping it, but I don't think that
>> this would bring any value. If userspace needs naming, it can give
>> whatever name it wants, as all data for the timings are there: standards,
>> resolutions, fps, etc.
>>
>> So, userspace could for example do something like:
>>
>> sprintf ("%s%dx%d_%.02ffps",
>>  dv_standard_name(dv),
>>  dv->width,
>>  dv->height,
>>  dv->pixelclock/(dv->width * dv->height));
> 
> It is common to refer to certain standard resolutions by an alias such as
> 720p60 or "XGA @ 60". A name would be useful for that.

Ok, but libv4l or the userspace tool can easily implement it. It gives userspace
more flexibility to have the names there, as namespace conflicts can be solved
purely on userspace, without causing regressions.

Ok, but sometimes, you can have two different timings for the same 
resolution/fps,
and we may discover it too late (for example, a new standard may arise with a 
different
set of timings for the same resolution/fps). As the name is part of the API, 
changing
it is not allowed, as the name is also part of the API.

> 
> For consistency in general I also think it is better if the kernel generates
> the name rather than having userspace do that. Whether the kernel should use
> the alias as (part of) the name is something we need to debate. I'm not sure
> either way.

The names at the other enum ioctl's is something that I don't like on our API,
as userspace may rely on the names. This can work fine for something that is 
very
well defined (like the standards name) or is board-specific (like the name of 
the
board inputs), but I don't think it would work here.

>   struct v4l2_dv_timings timings;
>   __u32 reserved[];

 Adding a reserved here is probably an overkill, as there are already
 reserved fields at timings struct.
>>>
>>> Probably true.
>>>
>   };
>   
>   #define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', XX, struct
>   v4l2_enum_dv_timings)
>   
>This ioctl enumerates over all discrete supported timings and
>returns their name and timings.
>
>The timings field can be us

Re: [PATCH 1/14] staging/media/as102: initial import from Abilis

2011-10-18 Thread Dan Carpenter
On Tue, Oct 18, 2011 at 11:11:34AM +0200, Piotr Chmura wrote:
> diff --git linux/drivers/staging/media/as102/Kconfig 
> linuxb/drivers/media/dvb/as102/Kconfig
> new file mode 100644
> --- /dev/null
> +++ linuxb/drivers/staging/media/as102/Kconfig
> @@ -0,0 +1,7 @@
> +config DVB_AS102
> + tristate "Abilis AS102 DVB receiver"
> + depends on DVB_CORE && USB && I2C && INPUT
> + help
> +   Choose Y or M here if you have a device containing an AS102
> +
> +   To compile this driver as a module, choose M here
> diff --git linux/drivers/staging/media/as102/Makefile 
> linuxb/drivers/media/dvb/as102/Makefile
> new file mode 100644
> --- /dev/null
> +++ linuxb/drivers/staging/media/as102/Makefile
> @@ -0,0 +1,5 @@
> +dvb-as102-objs := as102_drv.o as102_fw.o as10x_cmd.o as10x_cmd_stream.o 
> as102_fe.o as102_usb_drv.o as10x_cmd_cfg.o
> +
> +obj-$(CONFIG_DVB_AS102) += dvb-as102.o
> +
> +EXTRA_CFLAGS += -DLINUX -DCONFIG_AS102_USB -Idrivers/media/dvb/dvb-core

It sounds like you're going to do a resend to add in the
Signed-off-by lines?

It would be better to separate these two chunks out and put them at
the end after you've fixed the compile errors in [PATCH 13/14].

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: omap3isp: BT.656 support

2011-10-18 Thread Gary Thomas

On 2011-10-18 10:14, Boris Todorov wrote:

On Tue, Oct 18, 2011 at 7:04 PM, Gary Thomas  wrote:

On 2011-10-18 09:53, Boris Todorov wrote:


On Tue, Oct 18, 2011 at 6:24 PM, Gary Thomaswrote:


On 2011-10-18 09:10, Boris Todorov wrote:


On Tue, Oct 18, 2011 at 5:49 PM, Gary Thomas
  wrote:


On 2011-10-18 08:28, Boris Todorov wrote:


I'm using different board.


What board?  I would think the architecture of the OMAP3 ISP would
not change, based on the board?


It's a custom board with omap3630. ISP is not changed.
When I disable OMAP2_VOUT from defconfig "CCD output" is /dev/video2.


I see, I have that option turned off.


But result is the same - yavta sleeps at VIDIOC_DQBUF ioctl


How are you configuring the TVP5150?  In particular these settings at
boot
time:

static struct isp_v4l2_subdevs_group my_camera_subdevs[] = {
{
.subdevs = tvp5150_camera_subdevs,
.interface = ISP_INTERFACE_PARALLEL,
.bus = {
.parallel = {
.data_lane_shift = 0,
.clk_pol = 1,
.bt656 = 1,
.fldmode = 1,
}
},
},
{ },
};


My settings are:
.data_lane_shift= 0,
.clk_pol= 0,
.hs_pol = 0,
.vs_pol = 0,
.fldmode= 1,
.bt656   = 1,

I tried yours but same result.
Why did you chose clk_pol=1?


I just copied the settings from the BeagleBoard

btw what board are you using?


An internal project for the company I work with, OMAP 3530, much like the 
BeagleBoard




Have you had this working before (earlier kernel, etc)?

Never in BT.656 mode...







This is how you tell the ISP to run in BT656 mode.  Without it, it will
run
using the HS/VS/FID signals (and also in my experience does not work
properly)




According "media-ctl -p":

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
 pad0: Input [UYVY2X8 720x525]
 <- 'OMAP3 ISP CCP2':pad1 []
 <- 'OMAP3 ISP CSI2a':pad1 []
 <- 'tvp5150 3-005c':pad0 [ACTIVE]
 pad1: Output [UYVY2X8 720x525]
 ->'OMAP3 ISP CCDC output':pad0 [ACTIVE]
 ->'OMAP3 ISP resizer':pad0 []
 pad2: Output [UYVY2X8 720x524]
 ->'OMAP3 ISP preview':pad0 []
 ->'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
 ->'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
 ->'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video4
 pad0: Input
 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]


Should be /dev/video4...


Could you send your pipeline setup and full output of 'media-ctl -p'?


Pipeline setup is:

$ media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1],
"OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
$ media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

media-ctl output (with /dev/video4):

$ media-ctl -p
Opening media device /dev/media0
Enumerating entities
Found 16 entities
Enumerating pads and links
Device topology
- entity 1: OMAP3 ISP CCP2 (2 pads, 2 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev0
 pad0: Input [SGRBG10 4096x4096]
 <- 'OMAP3 ISP CCP2 input':pad0 []
 pad1: Output [SGRBG10 4096x4096]
 ->  'OMAP3 ISP CCDC':pad0 []

- entity 2: OMAP3 ISP CCP2 input (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video0
 pad0: Output
 ->  'OMAP3 ISP CCP2':pad0 []

- entity 3: OMAP3 ISP CSI2a (2 pads, 2 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev1
 pad0: Input [SGRBG10 4096x4096]
 pad1: Output [SGRBG10 4096x4096]
 ->  'OMAP3 ISP CSI2a output':pad0 []
 ->  'OMAP3 ISP CCDC':pad0 []

- entity 4: OMAP3 ISP CSI2a output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video3
 pad0: Input
 <- 'OMAP3 ISP CSI2a':pad1 []

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
  

Re: omap3isp: BT.656 support

2011-10-18 Thread Boris Todorov
On Tue, Oct 18, 2011 at 7:04 PM, Gary Thomas  wrote:
> On 2011-10-18 09:53, Boris Todorov wrote:
>>
>> On Tue, Oct 18, 2011 at 6:24 PM, Gary Thomas  wrote:
>>>
>>> On 2011-10-18 09:10, Boris Todorov wrote:

 On Tue, Oct 18, 2011 at 5:49 PM, Gary Thomas
  wrote:
>
> On 2011-10-18 08:28, Boris Todorov wrote:
>>
>> I'm using different board.
>
> What board?  I would think the architecture of the OMAP3 ISP would
> not change, based on the board?

 It's a custom board with omap3630. ISP is not changed.
 When I disable OMAP2_VOUT from defconfig "CCD output" is /dev/video2.
>>>
>>> I see, I have that option turned off.
>>>
 But result is the same - yavta sleeps at VIDIOC_DQBUF ioctl
>>>
>>> How are you configuring the TVP5150?  In particular these settings at
>>> boot
>>> time:
>>>
>>> static struct isp_v4l2_subdevs_group my_camera_subdevs[] = {
>>>        {
>>>                .subdevs = tvp5150_camera_subdevs,
>>>                .interface = ISP_INTERFACE_PARALLEL,
>>>                .bus = {
>>>                                .parallel = {
>>>                                        .data_lane_shift = 0,
>>>                                        .clk_pol = 1,
>>>                                        .bt656 = 1,
>>>                                        .fldmode = 1,
>>>                                }
>>>                },
>>>        },
>>>        { },
>>> };
>>
>> My settings are:
>>                                .data_lane_shift        = 0,
>>                                .clk_pol                = 0,
>>                                .hs_pol                 = 0,
>>                                .vs_pol                 = 0,
>>                                .fldmode                = 1,
>>                                .bt656               = 1,
>>
>> I tried yours but same result.
>> Why did you chose clk_pol=1?
>
> I just copied the settings from the BeagleBoard
btw what board are you using?

> Have you had this working before (earlier kernel, etc)?
Never in BT.656 mode...

>
>>
>>>
>>> This is how you tell the ISP to run in BT656 mode.  Without it, it will
>>> run
>>> using the HS/VS/FID signals (and also in my experience does not work
>>> properly)
>>>
>
>> According "media-ctl -p":
>>
>> - entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
>>             type V4L2 subdev subtype Unknown
>>             device node name /dev/v4l-subdev2
>>         pad0: Input [UYVY2X8 720x525]
>>                 <- 'OMAP3 ISP CCP2':pad1 []
>>                 <- 'OMAP3 ISP CSI2a':pad1 []
>>                 <- 'tvp5150 3-005c':pad0 [ACTIVE]
>>         pad1: Output [UYVY2X8 720x525]
>>                 ->      'OMAP3 ISP CCDC output':pad0 [ACTIVE]
>>                 ->      'OMAP3 ISP resizer':pad0 []
>>         pad2: Output [UYVY2X8 720x524]
>>                 ->      'OMAP3 ISP preview':pad0 []
>>                 ->      'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
>>                 ->      'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
>>                 ->      'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]
>>
>> - entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
>>             type Node subtype V4L
>>             device node name /dev/video4
>>         pad0: Input
>>                 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]
>>
>>
>> Should be /dev/video4...
>
> Could you send your pipeline setup and full output of 'media-ctl -p'?

 Pipeline setup is:

 $ media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1],
 "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
 $ media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
 $ media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
 $ media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

 media-ctl output (with /dev/video4):

 $ media-ctl -p
 Opening media device /dev/media0
 Enumerating entities
 Found 16 entities
 Enumerating pads and links
 Device topology
 - entity 1: OMAP3 ISP CCP2 (2 pads, 2 links)
             type V4L2 subdev subtype Unknown
             device node name /dev/v4l-subdev0
         pad0: Input [SGRBG10 4096x4096]
                 <- 'OMAP3 ISP CCP2 input':pad0 []
         pad1: Output [SGRBG10 4096x4096]
                 ->    'OMAP3 ISP CCDC':pad0 []

 - entity 2: OMAP3 ISP CCP2 input (1 pad, 1 link)
             type Node subtype V4L
             device node name /dev/video0
         pad0: Output
                 ->    'OMAP3 ISP CCP2':pad0 []

 - entity 3: OMAP3 ISP CSI2a (2 pads, 2 links)
             type V4L2 subdev subtype Unknown
             device node name /dev/v4l-subdev1
         pad0: Input [SGRBG10 4096x4096]
         pad1: Output [SGRBG10 4096x4096]
                 ->    'OMAP3 ISP CSI2a output':pad0 []
    

Re: omap3isp: BT.656 support

2011-10-18 Thread Gary Thomas

On 2011-10-18 09:53, Boris Todorov wrote:

On Tue, Oct 18, 2011 at 6:24 PM, Gary Thomas  wrote:

On 2011-10-18 09:10, Boris Todorov wrote:


On Tue, Oct 18, 2011 at 5:49 PM, Gary Thomaswrote:


On 2011-10-18 08:28, Boris Todorov wrote:


I'm using different board.


What board?  I would think the architecture of the OMAP3 ISP would
not change, based on the board?


It's a custom board with omap3630. ISP is not changed.
When I disable OMAP2_VOUT from defconfig "CCD output" is /dev/video2.


I see, I have that option turned off.


But result is the same - yavta sleeps at VIDIOC_DQBUF ioctl


How are you configuring the TVP5150?  In particular these settings at boot
time:

static struct isp_v4l2_subdevs_group my_camera_subdevs[] = {
{
.subdevs = tvp5150_camera_subdevs,
.interface = ISP_INTERFACE_PARALLEL,
.bus = {
.parallel = {
.data_lane_shift = 0,
.clk_pol = 1,
.bt656 = 1,
.fldmode = 1,
}
},
},
{ },
};


My settings are:
.data_lane_shift= 0,
.clk_pol= 0,
.hs_pol = 0,
.vs_pol = 0,
.fldmode= 1,
.bt656   = 1,

I tried yours but same result.
Why did you chose clk_pol=1?


I just copied the settings from the BeagleBoard

Have you had this working before (earlier kernel, etc)?





This is how you tell the ISP to run in BT656 mode.  Without it, it will run
using the HS/VS/FID signals (and also in my experience does not work
properly)




According "media-ctl -p":

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
 pad0: Input [UYVY2X8 720x525]
 <- 'OMAP3 ISP CCP2':pad1 []
 <- 'OMAP3 ISP CSI2a':pad1 []
 <- 'tvp5150 3-005c':pad0 [ACTIVE]
 pad1: Output [UYVY2X8 720x525]
 ->  'OMAP3 ISP CCDC output':pad0 [ACTIVE]
 ->  'OMAP3 ISP resizer':pad0 []
 pad2: Output [UYVY2X8 720x524]
 ->  'OMAP3 ISP preview':pad0 []
 ->  'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
 ->  'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
 ->  'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video4
 pad0: Input
 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]


Should be /dev/video4...


Could you send your pipeline setup and full output of 'media-ctl -p'?


Pipeline setup is:

$ media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1],
"OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
$ media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

media-ctl output (with /dev/video4):

$ media-ctl -p
Opening media device /dev/media0
Enumerating entities
Found 16 entities
Enumerating pads and links
Device topology
- entity 1: OMAP3 ISP CCP2 (2 pads, 2 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev0
 pad0: Input [SGRBG10 4096x4096]
 <- 'OMAP3 ISP CCP2 input':pad0 []
 pad1: Output [SGRBG10 4096x4096]
 ->'OMAP3 ISP CCDC':pad0 []

- entity 2: OMAP3 ISP CCP2 input (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video0
 pad0: Output
 ->'OMAP3 ISP CCP2':pad0 []

- entity 3: OMAP3 ISP CSI2a (2 pads, 2 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev1
 pad0: Input [SGRBG10 4096x4096]
 pad1: Output [SGRBG10 4096x4096]
 ->'OMAP3 ISP CSI2a output':pad0 []
 ->'OMAP3 ISP CCDC':pad0 []

- entity 4: OMAP3 ISP CSI2a output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video3
 pad0: Input
 <- 'OMAP3 ISP CSI2a':pad1 []

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
 pad0: Input [UYVY2X8 720x525]
 <- 'OMAP3 ISP CCP2':pad1 []
 <- 'OMAP3 ISP CSI2a':pad1 []
 <- 'tvp5150 3-005c':pad0 [ACTIVE]
 pad1: Output [UYVY2X8 720x525]
 ->'OMAP3 ISP CCDC output':pad0

Re: omap3isp: BT.656 support

2011-10-18 Thread Boris Todorov
On Tue, Oct 18, 2011 at 6:24 PM, Gary Thomas  wrote:
> On 2011-10-18 09:10, Boris Todorov wrote:
>>
>> On Tue, Oct 18, 2011 at 5:49 PM, Gary Thomas  wrote:
>>>
>>> On 2011-10-18 08:28, Boris Todorov wrote:

 I'm using different board.
>>>
>>> What board?  I would think the architecture of the OMAP3 ISP would
>>> not change, based on the board?
>>
>> It's a custom board with omap3630. ISP is not changed.
>> When I disable OMAP2_VOUT from defconfig "CCD output" is /dev/video2.
>
> I see, I have that option turned off.
>
>> But result is the same - yavta sleeps at VIDIOC_DQBUF ioctl
>
> How are you configuring the TVP5150?  In particular these settings at boot
> time:
>
> static struct isp_v4l2_subdevs_group my_camera_subdevs[] = {
>        {
>                .subdevs = tvp5150_camera_subdevs,
>                .interface = ISP_INTERFACE_PARALLEL,
>                .bus = {
>                                .parallel = {
>                                        .data_lane_shift = 0,
>                                        .clk_pol = 1,
>                                        .bt656 = 1,
>                                        .fldmode = 1,
>                                }
>                },
>        },
>        { },
> };

My settings are:
.data_lane_shift= 0,
.clk_pol= 0,
.hs_pol = 0,
.vs_pol = 0,
.fldmode= 1,
.bt656   = 1,

I tried yours but same result.
Why did you chose clk_pol=1?

>
> This is how you tell the ISP to run in BT656 mode.  Without it, it will run
> using the HS/VS/FID signals (and also in my experience does not work
> properly)
>
>>>
 According "media-ctl -p":

 - entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
             type V4L2 subdev subtype Unknown
             device node name /dev/v4l-subdev2
         pad0: Input [UYVY2X8 720x525]
                 <- 'OMAP3 ISP CCP2':pad1 []
                 <- 'OMAP3 ISP CSI2a':pad1 []
                 <- 'tvp5150 3-005c':pad0 [ACTIVE]
         pad1: Output [UYVY2X8 720x525]
                 ->    'OMAP3 ISP CCDC output':pad0 [ACTIVE]
                 ->    'OMAP3 ISP resizer':pad0 []
         pad2: Output [UYVY2X8 720x524]
                 ->    'OMAP3 ISP preview':pad0 []
                 ->    'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
                 ->    'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
                 ->    'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

 - entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
             type Node subtype V4L
             device node name /dev/video4
         pad0: Input
                 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]


 Should be /dev/video4...
>>>
>>> Could you send your pipeline setup and full output of 'media-ctl -p'?
>>
>> Pipeline setup is:
>>
>> $ media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1],
>> "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
>> $ media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
>> $ media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
>> $ media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'
>>
>> media-ctl output (with /dev/video4):
>>
>> $ media-ctl -p
>> Opening media device /dev/media0
>> Enumerating entities
>> Found 16 entities
>> Enumerating pads and links
>> Device topology
>> - entity 1: OMAP3 ISP CCP2 (2 pads, 2 links)
>>             type V4L2 subdev subtype Unknown
>>             device node name /dev/v4l-subdev0
>>         pad0: Input [SGRBG10 4096x4096]
>>                 <- 'OMAP3 ISP CCP2 input':pad0 []
>>         pad1: Output [SGRBG10 4096x4096]
>>                 ->  'OMAP3 ISP CCDC':pad0 []
>>
>> - entity 2: OMAP3 ISP CCP2 input (1 pad, 1 link)
>>             type Node subtype V4L
>>             device node name /dev/video0
>>         pad0: Output
>>                 ->  'OMAP3 ISP CCP2':pad0 []
>>
>> - entity 3: OMAP3 ISP CSI2a (2 pads, 2 links)
>>             type V4L2 subdev subtype Unknown
>>             device node name /dev/v4l-subdev1
>>         pad0: Input [SGRBG10 4096x4096]
>>         pad1: Output [SGRBG10 4096x4096]
>>                 ->  'OMAP3 ISP CSI2a output':pad0 []
>>                 ->  'OMAP3 ISP CCDC':pad0 []
>>
>> - entity 4: OMAP3 ISP CSI2a output (1 pad, 1 link)
>>             type Node subtype V4L
>>             device node name /dev/video3
>>         pad0: Input
>>                 <- 'OMAP3 ISP CSI2a':pad1 []
>>
>> - entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
>>             type V4L2 subdev subtype Unknown
>>             device node name /dev/v4l-subdev2
>>         pad0: Input [UYVY2X8 720x525]
>>                 <- 'OMAP3 ISP CCP2':pad1 []
>>                 <- 'OMAP3 ISP CSI2a':pad1 []
>>            

Re: [PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102)

2011-10-18 Thread Devin Heitmueller
On Tue, Oct 18, 2011 at 5:10 AM, Piotr Chmura  wrote:
> Thanks for comments for all of you.
>
> [PATCH 1-12/14] Following your guidelines i exported all changes from hg one 
> by one. This way we will have all history in kernel tree.
> I moved driver to staging/media and removed Kconfig/Makefile changes in 
> parent directory in first patch.

Hello Piotr,

Not that I want to create more work for you, but it would appear that
your patches stripped off all the Signed-off-by lines for both myself
and Pierrick Hascoet (the developer from the hardware vendor).  You
have replaced them with "cc:" lines, which breaks the chain of
"Developer's Certificate of Origin".

When you take somebody else's patches, you need to preserve any
existing Signed-off-by lines, adding your own at the bottom of the
list.

In other words, the first patch should be:

Signed-off-by: Pierrick Hascoet 
Signed-off-by: Devin Heitmueller 
Signed-off-by: Piotr Chmura 

instead of:

Signed-off-by: Piotr Chmura 
Cc: Pierrick Hascoet 
Cc: Devin Heitmueller 

Devin

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


Re: omap3isp: BT.656 support

2011-10-18 Thread Gary Thomas

On 2011-10-18 09:10, Boris Todorov wrote:

On Tue, Oct 18, 2011 at 5:49 PM, Gary Thomas  wrote:

On 2011-10-18 08:28, Boris Todorov wrote:


I'm using different board.


What board?  I would think the architecture of the OMAP3 ISP would
not change, based on the board?


It's a custom board with omap3630. ISP is not changed.
When I disable OMAP2_VOUT from defconfig "CCD output" is /dev/video2.


I see, I have that option turned off.


But result is the same - yavta sleeps at VIDIOC_DQBUF ioctl


How are you configuring the TVP5150?  In particular these settings at boot time:

static struct isp_v4l2_subdevs_group my_camera_subdevs[] = {
{
.subdevs = tvp5150_camera_subdevs,
.interface = ISP_INTERFACE_PARALLEL,
.bus = {
.parallel = {
.data_lane_shift = 0,
.clk_pol = 1,
.bt656 = 1,
.fldmode = 1,
}
},
},
{ },
};

This is how you tell the ISP to run in BT656 mode.  Without it, it will run
using the HS/VS/FID signals (and also in my experience does not work properly)




According "media-ctl -p":

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
 pad0: Input [UYVY2X8 720x525]
 <- 'OMAP3 ISP CCP2':pad1 []
 <- 'OMAP3 ISP CSI2a':pad1 []
 <- 'tvp5150 3-005c':pad0 [ACTIVE]
 pad1: Output [UYVY2X8 720x525]
 ->'OMAP3 ISP CCDC output':pad0 [ACTIVE]
 ->'OMAP3 ISP resizer':pad0 []
 pad2: Output [UYVY2X8 720x524]
 ->'OMAP3 ISP preview':pad0 []
 ->'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
 ->'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
 ->'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video4
 pad0: Input
 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]


Should be /dev/video4...


Could you send your pipeline setup and full output of 'media-ctl -p'?


Pipeline setup is:

$ media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1],
"OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
$ media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

media-ctl output (with /dev/video4):

$ media-ctl -p
Opening media device /dev/media0
Enumerating entities
Found 16 entities
Enumerating pads and links
Device topology
- entity 1: OMAP3 ISP CCP2 (2 pads, 2 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev0
 pad0: Input [SGRBG10 4096x4096]
 <- 'OMAP3 ISP CCP2 input':pad0 []
 pad1: Output [SGRBG10 4096x4096]
 ->  'OMAP3 ISP CCDC':pad0 []

- entity 2: OMAP3 ISP CCP2 input (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video0
 pad0: Output
 ->  'OMAP3 ISP CCP2':pad0 []

- entity 3: OMAP3 ISP CSI2a (2 pads, 2 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev1
 pad0: Input [SGRBG10 4096x4096]
 pad1: Output [SGRBG10 4096x4096]
 ->  'OMAP3 ISP CSI2a output':pad0 []
 ->  'OMAP3 ISP CCDC':pad0 []

- entity 4: OMAP3 ISP CSI2a output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video3
 pad0: Input
 <- 'OMAP3 ISP CSI2a':pad1 []

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
 pad0: Input [UYVY2X8 720x525]
 <- 'OMAP3 ISP CCP2':pad1 []
 <- 'OMAP3 ISP CSI2a':pad1 []
 <- 'tvp5150 3-005c':pad0 [ACTIVE]
 pad1: Output [UYVY2X8 720x525]
 ->  'OMAP3 ISP CCDC output':pad0 [ACTIVE]
 ->  'OMAP3 ISP resizer':pad0 []
 pad2: Output [UYVY2X8 720x524]
 ->  'OMAP3 ISP preview':pad0 []
 ->  'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
 ->  'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
 ->  'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video4
 pad0: Input
 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]

- entity 7: OMAP3 ISP preview (2 pads, 4 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev

Re: omap3isp: BT.656 support

2011-10-18 Thread Boris Todorov
On Tue, Oct 18, 2011 at 5:49 PM, Gary Thomas  wrote:
> On 2011-10-18 08:28, Boris Todorov wrote:
>>
>> I'm using different board.
>
> What board?  I would think the architecture of the OMAP3 ISP would
> not change, based on the board?

It's a custom board with omap3630. ISP is not changed.
When I disable OMAP2_VOUT from defconfig "CCD output" is /dev/video2.
But result is the same - yavta sleeps at VIDIOC_DQBUF ioctl

>
>> According "media-ctl -p":
>>
>> - entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
>>             type V4L2 subdev subtype Unknown
>>             device node name /dev/v4l-subdev2
>>         pad0: Input [UYVY2X8 720x525]
>>                 <- 'OMAP3 ISP CCP2':pad1 []
>>                 <- 'OMAP3 ISP CSI2a':pad1 []
>>                 <- 'tvp5150 3-005c':pad0 [ACTIVE]
>>         pad1: Output [UYVY2X8 720x525]
>>                 ->  'OMAP3 ISP CCDC output':pad0 [ACTIVE]
>>                 ->  'OMAP3 ISP resizer':pad0 []
>>         pad2: Output [UYVY2X8 720x524]
>>                 ->  'OMAP3 ISP preview':pad0 []
>>                 ->  'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
>>                 ->  'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
>>                 ->  'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]
>>
>> - entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
>>             type Node subtype V4L
>>             device node name /dev/video4
>>         pad0: Input
>>                 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]
>>
>>
>> Should be /dev/video4...
>
> Could you send your pipeline setup and full output of 'media-ctl -p'?

Pipeline setup is:

$ media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1],
"OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
$ media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
$ media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

media-ctl output (with /dev/video4):

$ media-ctl -p
Opening media device /dev/media0
Enumerating entities
Found 16 entities
Enumerating pads and links
Device topology
- entity 1: OMAP3 ISP CCP2 (2 pads, 2 links)
type V4L2 subdev subtype Unknown
device node name /dev/v4l-subdev0
pad0: Input [SGRBG10 4096x4096]
<- 'OMAP3 ISP CCP2 input':pad0 []
pad1: Output [SGRBG10 4096x4096]
-> 'OMAP3 ISP CCDC':pad0 []

- entity 2: OMAP3 ISP CCP2 input (1 pad, 1 link)
type Node subtype V4L
device node name /dev/video0
pad0: Output
-> 'OMAP3 ISP CCP2':pad0 []

- entity 3: OMAP3 ISP CSI2a (2 pads, 2 links)
type V4L2 subdev subtype Unknown
device node name /dev/v4l-subdev1
pad0: Input [SGRBG10 4096x4096]
pad1: Output [SGRBG10 4096x4096]
-> 'OMAP3 ISP CSI2a output':pad0 []
-> 'OMAP3 ISP CCDC':pad0 []

- entity 4: OMAP3 ISP CSI2a output (1 pad, 1 link)
type Node subtype V4L
device node name /dev/video3
pad0: Input
<- 'OMAP3 ISP CSI2a':pad1 []

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
type V4L2 subdev subtype Unknown
device node name /dev/v4l-subdev2
pad0: Input [UYVY2X8 720x525]
<- 'OMAP3 ISP CCP2':pad1 []
<- 'OMAP3 ISP CSI2a':pad1 []
<- 'tvp5150 3-005c':pad0 [ACTIVE]
pad1: Output [UYVY2X8 720x525]
-> 'OMAP3 ISP CCDC output':pad0 [ACTIVE]
-> 'OMAP3 ISP resizer':pad0 []
pad2: Output [UYVY2X8 720x524]
-> 'OMAP3 ISP preview':pad0 []
-> 'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
-> 'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
-> 'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
type Node subtype V4L
device node name /dev/video4
pad0: Input
<- 'OMAP3 ISP CCDC':pad1 [ACTIVE]

- entity 7: OMAP3 ISP preview (2 pads, 4 links)
type V4L2 subdev subtype Unknown
device node name /dev/v4l-subdev3
pad0: Input [SGRBG10 4096x4096]
<- 'OMAP3 ISP CCDC':pad2 []
<- 'OMAP3 ISP preview input':pad0 []
pad1: Output [YUYV 4082x4088]
-> 'OMAP3 ISP preview output':pad0 []
-> 'OMAP3 ISP resizer':pad0 []

- entity 8: OMAP3 ISP preview input (1 pad, 1 link)
type Node subtype V4L
device node name /dev/video5
pad0: Output
-> 'OMAP3 ISP preview':pad0 []

- entity 9: OMAP3 ISP preview output (1 pad, 1 link)
type Node subtype V4L
device node name /dev/video6
pad0: Input
<- 'OMAP3 ISP preview':pad1 []

- entity 10: OMAP3 ISP resizer (2 pads, 4 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev4
pad0: Input [YUYV 4095x4095 (4,6)/4086x4082]
  

Re: omap3isp: BT.656 support

2011-10-18 Thread Gary Thomas

On 2011-10-18 08:28, Boris Todorov wrote:

I'm using different board.


What board?  I would think the architecture of the OMAP3 ISP would
not change, based on the board?


According "media-ctl -p":

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
 type V4L2 subdev subtype Unknown
 device node name /dev/v4l-subdev2
 pad0: Input [UYVY2X8 720x525]
 <- 'OMAP3 ISP CCP2':pad1 []
 <- 'OMAP3 ISP CSI2a':pad1 []
 <- 'tvp5150 3-005c':pad0 [ACTIVE]
 pad1: Output [UYVY2X8 720x525]
 ->  'OMAP3 ISP CCDC output':pad0 [ACTIVE]
 ->  'OMAP3 ISP resizer':pad0 []
 pad2: Output [UYVY2X8 720x524]
 ->  'OMAP3 ISP preview':pad0 []
 ->  'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
 ->  'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
 ->  'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
 type Node subtype V4L
 device node name /dev/video4
 pad0: Input
 <- 'OMAP3 ISP CCDC':pad1 [ACTIVE]


Should be /dev/video4...


Could you send your pipeline setup and full output of 'media-ctl -p'?




On Tue, Oct 18, 2011 at 5:07 PM, Gary Thomas  wrote:

On 2011-10-18 07:33, Boris Todorov wrote:


Hi

I'm trying to run OMAP + TVP5151 in BT656 mode.

I'm using omap3isp-omap3isp-yuv (git.linuxtv.org/pinchartl/media.git).
Plus the following patches:

TVP5151:

https://github.com/ebutera/meta-igep/tree/testing-v2/recipes-kernel/linux/linux-3.0+3.1rc/tvp5150

The latest RFC patches for BT656 support:

Enrico Butera (2):
   omap3isp: ispvideo: export isp_video_mbus_to_pix
   omap3isp: ispccdc: configure CCDC registers and add BT656 support

Javier Martinez Canillas (1):
   omap3isp: ccdc: Add interlaced field mode to platform data


I'm able to configure with media-ctl:

media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3
ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

But
./yavta -f UYVY -s 720x525 -n 4 --capture=4 -F /dev/video4

sleeps after
...
Buffer 1 mapped at address 0x4021d000.
length: 756000 offset: 1515520
Buffer 2 mapped at address 0x402d6000.
length: 756000 offset: 2273280
Buffer 3 mapped at address 0x4038f000.

Anyone with the same issue??? This happens with every other v4l test app I
used.
I can see data from TVP5151 but there are no interrupts in ISP.


Why are you using /dev/video4?  The CCDC output is on /dev/video2

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world




--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

--
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: omap3isp: BT.656 support

2011-10-18 Thread Boris Todorov
I'm using different board.

According "media-ctl -p":

- entity 5: OMAP3 ISP CCDC (3 pads, 9 links)
type V4L2 subdev subtype Unknown
device node name /dev/v4l-subdev2
pad0: Input [UYVY2X8 720x525]
<- 'OMAP3 ISP CCP2':pad1 []
<- 'OMAP3 ISP CSI2a':pad1 []
<- 'tvp5150 3-005c':pad0 [ACTIVE]
pad1: Output [UYVY2X8 720x525]
-> 'OMAP3 ISP CCDC output':pad0 [ACTIVE]
-> 'OMAP3 ISP resizer':pad0 []
pad2: Output [UYVY2X8 720x524]
-> 'OMAP3 ISP preview':pad0 []
-> 'OMAP3 ISP AEWB':pad0 [IMMUTABLE,ACTIVE]
-> 'OMAP3 ISP AF':pad0 [IMMUTABLE,ACTIVE]
-> 'OMAP3 ISP histogram':pad0 [IMMUTABLE,ACTIVE]

- entity 6: OMAP3 ISP CCDC output (1 pad, 1 link)
type Node subtype V4L
device node name /dev/video4
pad0: Input
<- 'OMAP3 ISP CCDC':pad1 [ACTIVE]


Should be /dev/video4...


On Tue, Oct 18, 2011 at 5:07 PM, Gary Thomas  wrote:
> On 2011-10-18 07:33, Boris Todorov wrote:
>>
>> Hi
>>
>> I'm trying to run OMAP + TVP5151 in BT656 mode.
>>
>> I'm using omap3isp-omap3isp-yuv (git.linuxtv.org/pinchartl/media.git).
>> Plus the following patches:
>>
>> TVP5151:
>>
>> https://github.com/ebutera/meta-igep/tree/testing-v2/recipes-kernel/linux/linux-3.0+3.1rc/tvp5150
>>
>> The latest RFC patches for BT656 support:
>>
>> Enrico Butera (2):
>>   omap3isp: ispvideo: export isp_video_mbus_to_pix
>>   omap3isp: ispccdc: configure CCDC registers and add BT656 support
>>
>> Javier Martinez Canillas (1):
>>   omap3isp: ccdc: Add interlaced field mode to platform data
>>
>>
>> I'm able to configure with media-ctl:
>>
>> media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3
>> ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
>> media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
>> media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
>> media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'
>>
>> But
>> ./yavta -f UYVY -s 720x525 -n 4 --capture=4 -F /dev/video4
>>
>> sleeps after
>> ...
>> Buffer 1 mapped at address 0x4021d000.
>> length: 756000 offset: 1515520
>> Buffer 2 mapped at address 0x402d6000.
>> length: 756000 offset: 2273280
>> Buffer 3 mapped at address 0x4038f000.
>>
>> Anyone with the same issue??? This happens with every other v4l test app I
>> used.
>> I can see data from TVP5151 but there are no interrupts in ISP.
>
> Why are you using /dev/video4?  The CCDC output is on /dev/video2
>
> --
> 
> Gary Thomas                 |  Consulting for the
> MLB Associates              |    Embedded world
> 
>
--
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] Improved handling of presets

2011-10-18 Thread Hans Verkuil
On Tuesday 18 October 2011 14:19:40 Mauro Carvalho Chehab wrote:
> Em 17-10-2011 15:03, Hans Verkuil escreveu:
> > On Monday, October 17, 2011 17:36:10 Mauro Carvalho Chehab wrote:
> >> Em 17-10-2011 06:32, Hans Verkuil escreveu:
> >>>Currently I have four standards:
> >>>   #define V4L2_DV_BT_STD_CEA861   (1 << 0)
> >>>   #define V4L2_DV_BT_STD_DMT  (1 << 1)  /* VESA Discrete Monitor 
Timings
> >>>   */ #define V4L2_DV_BT_STD_CVT   (1 << 2)  /* VESA Coordinated Video
> >>>   Timings */ #define V4L2_DV_BT_STD_GTF   (1 << 3)  /* VESA Generalized
> >>>   Timings Formula */
> >>>   
> >>>A particular timing can be part of 0 or more standards.
> >>>Both CVT and GTF timings have a so-called 'reduced blanking' mode.
> >>>It would be nice to represent this with a flag somewhere. I guess
> >>>we need a flags field for that. The 'polarities' field really
> >>>should have been called a 'flags' field. Oh well...
> >> 
> >> instead of flags, we may consider using something like:
> >>_u32 polarity:1
> >> 
> >> We need to double check if this is portable enough, however.
> > 
> > Bitfields aren't portable, unfortunately. But I wonder if we could do
> > 
> > something like this:
> > union {
> > 
> > __u32   polarities; /* Positive or negative polarity */
> > __u32   flags;
> > 
> > };
> > 
> > and deprecate 'polarities' and remove it in a year.
> 
> If the idea is to replace the existing ioctl's, just name it as flags for
> the structs used by the new ones. The old "polarities" will be removed
> together with the removal of the old ioctl's.

Do we want to replace the current DV_TIMINGS ioctls? I don't see a need for
that, to be honest. It's just the name of this field that's awkward.

> > I suspect that Cisco might be the only user of this API anyway with the
> > davinci drivers.
> 
> Likely.
> 
> >>> 2) Create a VIDIOC_ENUM_DV_TIMINGS ioctl:
> >>>   struct v4l2_enum_dv_timings {
> >>>   
> >>>   __u32 index;
> >>>   char name[32];
> >> 
> >> Not sure about the "name" field. An u32 working as an enum could work
> >> better.
> > 
> > Huh? You need a name field for the human-readable description of the
> > timings, just like all other enum ioctls.
> 
> The naming here could be something completely arbitrary, especially for
> custom timings. I'm ok if you insist on keeping it, but I don't think that
> this would bring any value. If userspace needs naming, it can give
> whatever name it wants, as all data for the timings are there: standards,
> resolutions, fps, etc.
> 
> So, userspace could for example do something like:
> 
> sprintf ("%s%dx%d_%.02ffps",
>   dv_standard_name(dv),
>   dv->width,
>   dv->height,
>   dv->pixelclock/(dv->width * dv->height));

It is common to refer to certain standard resolutions by an alias such as
720p60 or "XGA @ 60". A name would be useful for that.

For consistency in general I also think it is better if the kernel generates
the name rather than having userspace do that. Whether the kernel should use
the alias as (part of) the name is something we need to debate. I'm not sure
either way.

> >>>   struct v4l2_dv_timings timings;
> >>>   __u32 reserved[];
> >> 
> >> Adding a reserved here is probably an overkill, as there are already
> >> reserved fields at timings struct.
> > 
> > Probably true.
> > 
> >>>   };
> >>>   
> >>>   #define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', XX, struct
> >>>   v4l2_enum_dv_timings)
> >>>   
> >>>This ioctl enumerates over all discrete supported timings and
> >>>returns their name and timings.
> >>>
> >>>The timings field can be used as an input to S_DV_TIMINGS. The
> >>>timings in this enumeration are guaranteed to be supported by the
> >>>hardware. However, other custom timings may be supported as well
> >>>(see my proposal for VIDIOC_DV_TIMINGS_CAP).
> >> 
> >> If I understood well, enum will show all timings officially supported by
> >> the hardware, right? The ones that are custom (e. g. doesn't belong to
> >> any standard, but, for some reason, the chipset vendor decided to add
> >> there) will have the standards field equal to 0, right?
> > 
> > Correct.
> > 
> > I have seen roughly two types of receivers/transmitters: those that only
> > have a limited list of timings, and those that can handle an almost
> > unlimited range of timings, typically only restricted by the maximum
> > pixel clock and sometimes blanking requirements.
> > 
> > The enum ioctl will return either the fixed list, or a representative
> > list of formats. In the latter case I am thinking of the various
> > VGA-derived resolutions and the 720p/1080p variants. That's typically
> > what a user wants to see.
> 
> As proposed, this ioctl will only fine for those with a limited list of
> timings, but it doesn't cover well the "unlimited range" case.
> 
> For nowadays needs, the discrete list is probably OK, but adding a "type"
> field lik

Re: omap3isp: BT.656 support

2011-10-18 Thread Gary Thomas

On 2011-10-18 07:33, Boris Todorov wrote:

Hi

I'm trying to run OMAP + TVP5151 in BT656 mode.

I'm using omap3isp-omap3isp-yuv (git.linuxtv.org/pinchartl/media.git).
Plus the following patches:

TVP5151:
https://github.com/ebutera/meta-igep/tree/testing-v2/recipes-kernel/linux/linux-3.0+3.1rc/tvp5150

The latest RFC patches for BT656 support:

Enrico Butera (2):
   omap3isp: ispvideo: export isp_video_mbus_to_pix
   omap3isp: ispccdc: configure CCDC registers and add BT656 support

Javier Martinez Canillas (1):
   omap3isp: ccdc: Add interlaced field mode to platform data


I'm able to configure with media-ctl:

media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3
ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

But
./yavta -f UYVY -s 720x525 -n 4 --capture=4 -F /dev/video4

sleeps after
...
Buffer 1 mapped at address 0x4021d000.
length: 756000 offset: 1515520
Buffer 2 mapped at address 0x402d6000.
length: 756000 offset: 2273280
Buffer 3 mapped at address 0x4038f000.

Anyone with the same issue??? This happens with every other v4l test app I used.
I can see data from TVP5151 but there are no interrupts in ISP.


Why are you using /dev/video4?  The CCDC output is on /dev/video2

--

Gary Thomas |  Consulting for the
MLB Associates  |Embedded world

--
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 6/9] drivers: add Contiguous Memory Allocator

2011-10-18 Thread Mel Gorman
On Thu, Oct 06, 2011 at 03:54:46PM +0200, Marek Szyprowski wrote:
> The Contiguous Memory Allocator is a set of helper functions for DMA
> mapping framework that improves allocations of contiguous memory chunks.
> 
> CMA grabs memory on system boot, marks it with CMA_MIGRATE_TYPE and
> gives back to the system. Kernel is allowed to allocate movable pages
> within CMA's managed memory so that it can be used for example for page
> cache when DMA mapping do not use it. On dma_alloc_from_contiguous()
> request such pages are migrated out of CMA area to free required
> contiguous block and fulfill the request. This allows to allocate large
> contiguous chunks of memory at any time assuming that there is enough
> free memory available in the system.
> 
> This code is heavily based on earlier works by Michal Nazarewicz.
> 
> Signed-off-by: Marek Szyprowski 
> Signed-off-by: Kyungmin Park 
> CC: Michal Nazarewicz 
> ---
>  arch/Kconfig |3 +
>  drivers/base/Kconfig |   79 +++
>  drivers/base/Makefile|1 +
>  drivers/base/dma-contiguous.c|  386 
> ++
>  include/asm-generic/dma-contiguous.h |   27 +++
>  include/linux/device.h   |4 +
>  include/linux/dma-contiguous.h   |  106 ++
>  7 files changed, 606 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/base/dma-contiguous.c
>  create mode 100644 include/asm-generic/dma-contiguous.h
>  create mode 100644 include/linux/dma-contiguous.h
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 4b0669c..a3b39a2 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -124,6 +124,9 @@ config HAVE_ARCH_TRACEHOOK
>  config HAVE_DMA_ATTRS
>   bool
>  
> +config HAVE_DMA_CONTIGUOUS
> + bool
> +
>  config USE_GENERIC_SMP_HELPERS
>   bool
>  
> diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
> index 21cf46f..a5e6d75 100644
> --- a/drivers/base/Kconfig
> +++ b/drivers/base/Kconfig
> @@ -174,4 +174,83 @@ config SYS_HYPERVISOR
>  
>  source "drivers/base/regmap/Kconfig"
>  
> +config CMA
> + bool "Contiguous Memory Allocator (EXPERIMENTAL)"
> + depends on HAVE_DMA_CONTIGUOUS && HAVE_MEMBLOCK && EXPERIMENTAL
> + select MIGRATION
> + select CMA_MIGRATE_TYPE
> + help
> +   This enables the Contiguous Memory Allocator which allows drivers
> +   to allocate big physically-contiguous blocks of memory for use with
> +   hardware components that do not support I/O map nor scatter-gather.
> +
> +   For more information see .
> +   If unsure, say "n".
> +
> +if CMA
> +
> +config CMA_DEBUG
> + bool "CMA debug messages (DEVELOPEMENT)"

s/DEVELOPEMENT/DEVELOPMENT/

Should it be under DEBUG_KERNEL?

> + help
> +   Turns on debug messages in CMA.  This produces KERN_DEBUG
> +   messages for every CMA call as well as various messages while
> +   processing calls such as dma_alloc_from_contiguous().
> +   This option does not affect warning and error messages.
> +
> +comment "Default contiguous memory area size:"
> +
> +config CMA_SIZE_ABSOLUTE
> + int "Absolute size (in MiB)"
> + depends on !CMA_SIZE_SEL_PERCENTAGE
> + default 16
> + help
> +   Defines the size (in MiB) of the default memory area for Contiguous
> +   Memory Allocator.
> +
> +config CMA_SIZE_PERCENTAGE
> + int "Percentage of total memory"
> + depends on !CMA_SIZE_SEL_ABSOLUTE
> + default 10
> + help
> +   Defines the size of the default memory area for Contiguous Memory
> +   Allocator as a percentage of the total memory in the system.
> +

Why is this not a kernel parameter rather than a config option?

Better yet, why do drivers not register how much CMA memory they are
interested in and then the drive core figure out if it can allocate that
much or not?

> +choice
> + prompt "Selected region size"
> + default CMA_SIZE_SEL_ABSOLUTE
> +
> +config CMA_SIZE_SEL_ABSOLUTE
> + bool "Use absolute value only"
> +
> +config CMA_SIZE_SEL_PERCENTAGE
> + bool "Use percentage value only"
> +
> +config CMA_SIZE_SEL_MIN
> + bool "Use lower value (minimum)"
> +
> +config CMA_SIZE_SEL_MAX
> + bool "Use higher value (maximum)"
> +
> +endchoice
> +
> +config CMA_ALIGNMENT
> + int "Maximum PAGE_SIZE order of alignment for contiguous buffers"
> + range 4 9
> + default 8
> + help
> +   DMA mapping framework by default aligns all buffers to the smallest
> +   PAGE_SIZE order which is greater than or equal to the requested buffer
> +   size. This works well for buffers up to a few hundreds kilobytes, but
> +   for larger buffers it just a memory waste. With this parameter you can
> +   specify the maximum PAGE_SIZE order for contiguous buffers. Larger
> +   buffers will be aligned only to this specified order. The order is
> +   expressed as a power of two multiplied by the PAGE_SIZE.
> +
> +   For example, if your s

omap3isp: BT.656 support

2011-10-18 Thread Boris Todorov
Hi

I'm trying to run OMAP + TVP5151 in BT656 mode.

I'm using omap3isp-omap3isp-yuv (git.linuxtv.org/pinchartl/media.git).
Plus the following patches:

TVP5151:
https://github.com/ebutera/meta-igep/tree/testing-v2/recipes-kernel/linux/linux-3.0+3.1rc/tvp5150

The latest RFC patches for BT656 support:

Enrico Butera (2):
  omap3isp: ispvideo: export isp_video_mbus_to_pix
  omap3isp: ispccdc: configure CCDC registers and add BT656 support

Javier Martinez Canillas (1):
  omap3isp: ccdc: Add interlaced field mode to platform data


I'm able to configure with media-ctl:

media-ctl -v -r -l '"tvp5150 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3
ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'
media-ctl -v --set-format '"tvp5150 3-005c":0 [UYVY2X8 720x525]'
media-ctl -v --set-format '"OMAP3 ISP CCDC":0 [UYVY2X8 720x525]'
media-ctl -v --set-format '"OMAP3 ISP CCDC":1 [UYVY2X8 720x525]'

But
./yavta -f UYVY -s 720x525 -n 4 --capture=4 -F /dev/video4

sleeps after
...
Buffer 1 mapped at address 0x4021d000.
length: 756000 offset: 1515520
Buffer 2 mapped at address 0x402d6000.
length: 756000 offset: 2273280
Buffer 3 mapped at address 0x4038f000.

Anyone with the same issue??? This happens with every other v4l test app I used.
I can see data from TVP5151 but there are no interrupts in ISP.
--
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 4/9] mm: MIGRATE_CMA migration type added

2011-10-18 Thread Mel Gorman
On Thu, Oct 06, 2011 at 03:54:44PM +0200, Marek Szyprowski wrote:
> From: Michal Nazarewicz 
> 
> The MIGRATE_CMA migration type has two main characteristics:
> (i) only movable pages can be allocated from MIGRATE_CMA
> pageblocks and (ii) page allocator will never change migration
> type of MIGRATE_CMA pageblocks.
> 
> This guarantees that page in a MIGRATE_CMA page block can
> always be migrated somewhere else (unless there's no memory left
> in the system).
> 

Or the count is premanently elevated by a device driver for some reason or if
the page is backed by a filesystem with a broken or unusable migrate_page()
function. This is unavoidable, I'm just pointing out that you can stil have
migration failures, particularly if GFP_MOVABLE has been improperly
used.

> It is designed to be used with Contiguous Memory Allocator
> (CMA) for allocating big chunks (eg. 10MiB) of physically
> contiguous memory.  Once driver requests contiguous memory,
> CMA will migrate pages from MIGRATE_CMA pageblocks.
> 
> To minimise number of migrations, MIGRATE_CMA migration type
> is the last type tried when page allocator falls back to other
> migration types then requested.
> 

It would be preferable if you could figure out how to reuse the
MIGRATE_RESERVE type for just the bitmap. Like MIGRATE_CMA, it does not
change type except when min_free_kbytes changes. However, it is
something that could be done in the future to keep the size of the
pageblock bitmap where it is now.

> Signed-off-by: Michal Nazarewicz 
> Signed-off-by: Kyungmin Park 
> [m.szyprowski: cleaned up Kconfig, renamed some functions, removed ifdefs]
> Signed-off-by: Marek Szyprowski 
> [m.nazarewicz: fixed incorrect handling of pages from ISOLATE page blocks]
> Signed-off-by: Michal Nazarewicz 
> Acked-by: Arnd Bergmann 
> ---
>  include/linux/mmzone.h |   41 +
>  include/linux/page-isolation.h |1 +
>  mm/Kconfig |8 -
>  mm/compaction.c|   10 +
>  mm/page_alloc.c|   79 
> ++--
>  5 files changed, 112 insertions(+), 27 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 862a834..cc34965 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -35,13 +35,35 @@
>   */
>  #define PAGE_ALLOC_COSTLY_ORDER 3
>  
> -#define MIGRATE_UNMOVABLE 0
> -#define MIGRATE_RECLAIMABLE   1
> -#define MIGRATE_MOVABLE   2
> -#define MIGRATE_PCPTYPES  3 /* the number of types on the pcp lists */
> -#define MIGRATE_RESERVE   3
> -#define MIGRATE_ISOLATE   4 /* can't allocate from here */
> -#define MIGRATE_TYPES 5
> +enum {
> + MIGRATE_UNMOVABLE,
> + MIGRATE_RECLAIMABLE,
> + MIGRATE_MOVABLE,
> + MIGRATE_PCPTYPES,   /* the number of types on the pcp lists */
> + MIGRATE_RESERVE = MIGRATE_PCPTYPES,
> + /*
> +  * MIGRATE_CMA migration type is designed to mimic the way
> +  * ZONE_MOVABLE works.  Only movable pages can be allocated
> +  * from MIGRATE_CMA pageblocks and page allocator never
> +  * implicitly change migration type of MIGRATE_CMA pageblock.
> +  *
> +  * The way to use it is to change migratetype of a range of
> +  * pageblocks to MIGRATE_CMA which can be done by
> +  * __free_pageblock_cma() function.  What is important though
> +  * is that a range of pageblocks must be aligned to
> +  * MAX_ORDER_NR_PAGES should biggest page be bigger then
> +  * a single pageblock.
> +  */
> + MIGRATE_CMA,

This does mean that MIGRATE_CMA also does not have a per-cpu list. I
don't know if that matters to you but all allocations using MIGRATE_CMA
will take the zone lock. I'm not sure this can be easily avoided because
if there is a per-CPU list for MIGRATE_CMA, it might use a new cache
line for it and incur a different set of performance problems.

> + MIGRATE_ISOLATE,/* can't allocate from here */
> + MIGRATE_TYPES
> +};
> +
> +#ifdef CONFIG_CMA_MIGRATE_TYPE
> +#  define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
> +#else
> +#  define is_migrate_cma(migratetype) false
> +#endif
>  
>  #define for_each_migratetype_order(order, type) \
>   for (order = 0; order < MAX_ORDER; order++) \
> @@ -54,6 +76,11 @@ static inline int get_pageblock_migratetype(struct page 
> *page)
>   return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
>  }
>  
> +static inline bool is_pageblock_cma(struct page *page)
> +{
> + return is_migrate_cma(get_pageblock_migratetype(page));
> +}
> +
>  struct free_area {
>   struct list_headfree_list[MIGRATE_TYPES];
>   unsigned long   nr_free;
> diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> index 774ecec..9b6aa8a 100644
> --- a/include/linux/page-isolation.h
> +++ b/include/linux/page-isolation.h
> @@ -48,4 +48,5 @@ int test_pages_in_a_zone(unsigned long start

Re: [PATCH 3/9] mm: alloc_contig_range() added

2011-10-18 Thread Mel Gorman
On Thu, Oct 06, 2011 at 03:54:43PM +0200, Marek Szyprowski wrote:
> From: Michal Nazarewicz 
> 
> This commit adds the alloc_contig_range() function which tries
> to allocate given range of pages.  It tries to migrate all
> already allocated pages that fall in the range thus freeing them.
> Once all pages in the range are freed they are removed from the
> buddy system thus allocated for the caller to use.
> 
> Signed-off-by: Michal Nazarewicz 
> Signed-off-by: Kyungmin Park 
> [m.szyprowski: renamed some variables for easier code reading]
> Signed-off-by: Marek Szyprowski 
> CC: Michal Nazarewicz 
> Acked-by: Arnd Bergmann 
> ---
>  include/linux/page-isolation.h |2 +
>  mm/page_alloc.c|  148 
> 
>  2 files changed, 150 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> index b9fc428..774ecec 100644
> --- a/include/linux/page-isolation.h
> +++ b/include/linux/page-isolation.h
> @@ -36,6 +36,8 @@ extern void unset_migratetype_isolate(struct page *page);
>  /* The below functions must be run on a range from a single zone. */
>  extern unsigned long alloc_contig_freed_pages(unsigned long start,
> unsigned long end, gfp_t flag);
> +extern int alloc_contig_range(unsigned long start, unsigned long end,
> +   gfp_t flags);
>  extern void free_contig_pages(unsigned long pfn, unsigned nr_pages);
>  
>  /*
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index fbfb920..8010854 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5773,6 +5773,154 @@ void free_contig_pages(unsigned long pfn, unsigned 
> nr_pages)
>   }
>  }
>  
> +static unsigned long pfn_to_maxpage(unsigned long pfn)
> +{
> + return pfn & ~(MAX_ORDER_NR_PAGES - 1);
> +}
> +

pfn_to_maxpage is a very confusing name here. It would be preferable to
create a MAX_ORDER_MASK that you apply directly.

Maybe something like SECTION_ALIGN_UP and SECTION_ALIGN_DOWN.

> +static unsigned long pfn_to_maxpage_up(unsigned long pfn)
> +{
> + return ALIGN(pfn, MAX_ORDER_NR_PAGES);
> +}
> +
> +#define MIGRATION_RETRY  5
> +static int __alloc_contig_migrate_range(unsigned long start, unsigned long 
> end)
> +{
> + int migration_failed = 0, ret;
> + unsigned long pfn = start;
> +
> + /*
> +  * Some code "borrowed" from KAMEZAWA Hiroyuki's
> +  * __alloc_contig_pages().
> +  */
> +

There is no need to put a comment like this here. Credit him in the
changelog.

> + /* drop all pages in pagevec and pcp list */
> + lru_add_drain_all();
> + drain_all_pages();
> +

Very similar to migrate_prep(). drain_all_pages should not be required
at this point.

> + for (;;) {
> + pfn = scan_lru_pages(pfn, end);

scan_lru_pages() is inefficient, this is going to be costly.

> + if (!pfn || pfn >= end)
> + break;
> +
> + ret = do_migrate_range(pfn, end);
> + if (!ret) {
> + migration_failed = 0;
> + } else if (ret != -EBUSY
> + || ++migration_failed >= MIGRATION_RETRY) {
> + return ret;
> + } else {
> + /* There are unstable pages.on pagevec. */
> + lru_add_drain_all();
> + /*
> +  * there may be pages on pcplist before
> +  * we mark the range as ISOLATED.
> +  */
> + drain_all_pages();
> + }
> + cond_resched();
> + }
> +
> + if (!migration_failed) {
> + /* drop all pages in pagevec and pcp list */
> + lru_add_drain_all();
> + drain_all_pages();
> + }
> +
> + /* Make sure all pages are isolated */
> + if (WARN_ON(test_pages_isolated(start, end)))
> + return -EBUSY;
> +

In some respects, this is very similar to mm/compaction#compact_zone().
They could have shared significant code if you reworked compact_zone
to work on ranges of memory and express compact_zone to operate on
zone->zone_start_pfn zone->zone_start_pfn+zone->spanned_pages . The
compaction code is 

> + return 0;
> +}
> +
> +/**
> + * alloc_contig_range() -- tries to allocate given range of pages
> + * @start:   start PFN to allocate
> + * @end: one-past-the-last PFN to allocate
> + * @flags:   flags passed to alloc_contig_freed_pages().
> + *
> + * The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES
> + * aligned, hovewer it's callers responsibility to guarantee that we
> + * are the only thread that changes migrate type of pageblocks the
> + * pages fall in.
> + *
> + * Returns zero on success or negative error code.  On success all
> + * pages which PFN is in (start, end) are allocated for the caller and
> + * need to be freed with free_contig_pages().
> + */
> +int alloc_

Re: [PATCH 2/9] mm: alloc_contig_freed_pages() added

2011-10-18 Thread Mel Gorman
At this point, I'm going to apologise for not reviewing this a long long
time ago.

On Thu, Oct 06, 2011 at 03:54:42PM +0200, Marek Szyprowski wrote:
> From: KAMEZAWA Hiroyuki 
> 
> This commit introduces alloc_contig_freed_pages() function
> which allocates (ie. removes from buddy system) free pages
> in range. Caller has to guarantee that all pages in range
> are in buddy system.
> 

Straight away, I'm wondering why you didn't use

mm/compaction.c#isolate_freepages()

It knows how to isolate pages within ranges. All its control information
is passed via struct compact_control() which I recognise may be awkward
for CMA but compaction.c know how to manage all the isolated pages and
pass them to migrate.c appropriately.

I haven't read all the patches yet but isolate_freepages() does break
everything up into order-0 pages. This may not be to your liking but it
would not be possible to change.

> Along with this function, a free_contig_pages() function is
> provided which frees all (or a subset of) pages allocated
> with alloc_contig_free_pages().
> 

mm/compaction.c#release_freepages()

> Michal Nazarewicz has modified the function to make it easier
> to allocate not MAX_ORDER_NR_PAGES aligned pages by making it
> return pfn of one-past-the-last allocated page.
> 
> Signed-off-by: KAMEZAWA Hiroyuki 
> Signed-off-by: Michal Nazarewicz 
> [m.nazarewicz: added checks if all allocated pages comes from the
> same memory zone]
> Signed-off-by: Michal Nazarewicz 
> Signed-off-by: Kyungmin Park 
> [m.szyprowski: fixed wrong condition in VM_BUG_ON assert]
> Signed-off-by: Marek Szyprowski 
> Acked-by: Arnd Bergmann 
> ---
>  include/linux/mmzone.h |   16 +
>  include/linux/page-isolation.h |5 +++
>  mm/page_alloc.c|   67 
> 
>  3 files changed, 88 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index a2760bb..862a834 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -1168,6 +1168,22 @@ static inline int memmap_valid_within(unsigned long 
> pfn,
>  }
>  #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
>  
> +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
> +/*
> + * Both PFNs must be from the same zone!  If this function returns
> + * true, pfn_to_page(pfn1) + (pfn2 - pfn1) == pfn_to_page(pfn2).
> + */
> +static inline bool zone_pfn_same_memmap(unsigned long pfn1, unsigned long 
> pfn2)
> +{
> + return pfn_to_section_nr(pfn1) == pfn_to_section_nr(pfn2);
> +}
> +

Why do you care what section the page is in? The zone is important all
right, but not the section. Also, offhand I'm unsure if being in the
same section guarantees the same zone. sections are ordinarily fully
populated (except on ARM but hey) but I can't remember anything
enforcing that zones be section-aligned.

Later I think I see that the intention was to reduce the use of
pfn_to_page(). You can do this in a more general fashion by checking the
zone boundaries and resolving the pfn->page every MAX_ORDER_NR_PAGES.
That will not be SPARSEMEM specific.

> +#else
> +
> +#define zone_pfn_same_memmap(pfn1, pfn2) (true)
> +
> +#endif
> +
>  #endif /* !__GENERATING_BOUNDS.H */
>  #endif /* !__ASSEMBLY__ */
>  #endif /* _LINUX_MMZONE_H */
> diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> index 58cdbac..b9fc428 100644
> --- a/include/linux/page-isolation.h
> +++ b/include/linux/page-isolation.h
> @@ -33,6 +33,11 @@ test_pages_isolated(unsigned long start_pfn, unsigned long 
> end_pfn);
>  extern int set_migratetype_isolate(struct page *page);
>  extern void unset_migratetype_isolate(struct page *page);
>  
> +/* The below functions must be run on a range from a single zone. */
> +extern unsigned long alloc_contig_freed_pages(unsigned long start,
> +   unsigned long end, gfp_t flag);
> +extern void free_contig_pages(unsigned long pfn, unsigned nr_pages);
> +
>  /*
>   * For migration.
>   */
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index bf4399a..fbfb920 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5706,6 +5706,73 @@ out:
>   spin_unlock_irqrestore(&zone->lock, flags);
>  }
>  
> +unsigned long alloc_contig_freed_pages(unsigned long start, unsigned long 
> end,
> +gfp_t flag)
> +{
> + unsigned long pfn = start, count;
> + struct page *page;
> + struct zone *zone;
> + int order;
> +
> + VM_BUG_ON(!pfn_valid(start));

VM_BUG_ON seems very harsh here. WARN_ON_ONCE and returning 0 to the
caller sees reasonable.

> + page = pfn_to_page(start);
> + zone = page_zone(page);
> +
> + spin_lock_irq(&zone->lock);
> +
> + for (;;) {
> + VM_BUG_ON(page_count(page) || !PageBuddy(page) ||
> +   page_zone(page) != zone);
> +

Here you will VM_BUG_ON with the zone lock held leading to system
halting very shortly.

Re: [RFC] Improved handling of presets

2011-10-18 Thread Mauro Carvalho Chehab
Em 17-10-2011 15:03, Hans Verkuil escreveu:
> On Monday, October 17, 2011 17:36:10 Mauro Carvalho Chehab wrote:
>> Em 17-10-2011 06:32, Hans Verkuil escreveu:
>>> RFC: Improved handling of presets
>>> =
>>>
>>> This RFC attempts to resolve the issues raised by this thread a few months 
>>> ago:
>>>
>>> http://www.mail-archive.com/linux-media@vger.kernel.org/msg33981.html
>>>
>>> The last post in this thread did a good job of summarizing the discussion:
>>>
>>> http://www.mail-archive.com/linux-media@vger.kernel.org/msg34190.html
>>>
>>> I think it is time to revisit this problem. It basically boils down to the 
>>> fact
>>> that the current preset API is too limited and somewhat awkward and I agree
>>> with that.
>>>
>>> Now, I really do not like the idea of creating a preset2 API. Instead I 
>>> think
>>> it is better to extend the current dv_timings API with new ioctls:
>>>
>>> VIDIOC_QUERY_DV_TIMINGS
>>> VIDIOC_ENUM_DV_TIMINGS
>>> VIDIOC_DV_TIMINGS_CAP
>>>
>>> These form a superset of the preset API and once this is in place we can
>>> deprecate some or all of the preset ioctls and eventually remove them (say
>>> in one or two years).
>>
>> Those 3 new ioctl's are, in practice, a preset2 API. I hate needing to 
>> deprecate
>> an API, but, if this is needed, better to do earlier than later. Let's not 
>> spend
>> our time investing on a dead horse.
>>
>>> Here is the current definition of the v4l2_dv_timings struct from 
>>> videodev2.h:
>>>
>>> /* BT.656/BT.1120 timing data */
>>> struct v4l2_bt_timings {
>>> __u32   width;  /* width in pixels */
>>> __u32   height; /* height in lines */
>>> __u32   interlaced; /* Interlaced or progressive */
>>> __u32   polarities; /* Positive or negative polarity */
>>> __u64   pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->7425 */
>>> __u32   hfrontporch;/* Horizpontal front porch in pixels */
>>> __u32   hsync;  /* Horizontal Sync length in pixels */
>>> __u32   hbackporch; /* Horizontal back porch in pixels */
>>> __u32   vfrontporch;/* Vertical front porch in pixels */
>>> __u32   vsync;  /* Vertical Sync length in lines */
>>> __u32   vbackporch; /* Vertical back porch in lines */
>>> __u32   il_vfrontporch; /* Vertical front porch for bottom field of
>>>  * interlaced field formats
>>>  */
>>> __u32   il_vsync;   /* Vertical sync length for bottom field of
>>>  * interlaced field formats
>>>  */
>>> __u32   il_vbackporch;  /* Vertical back porch for bottom field of
>>>  * interlaced field formats
>>>  */
>>> __u32   reserved[16];
>>> } __attribute__ ((packed));
>>>
>>> /* Interlaced or progressive format */
>>> #define V4L2_DV_PROGRESSIVE 0
>>> #define V4L2_DV_INTERLACED  1
>>>
>>> /* Polarities. If bit is not set, it is assumed to be negative polarity */
>>> #define V4L2_DV_VSYNC_POS_POL   0x0001
>>> #define V4L2_DV_HSYNC_POS_POL   0x0002
>>>
>>> /* DV timings */
>>> struct v4l2_dv_timings {
>>> __u32 type;
>>> union {
>>> struct v4l2_bt_timings  bt;
>>> __u32   reserved[32];
>>> };
>>> } __attribute__ ((packed));
>>>
>>> /* Values for the type field */
>>> #define V4L2_DV_BT_656_1120 0   /* BT.656/1120 timing type */
>>>
>>> This API allows you to set and get all the timings details. Its current
>>> use is to allow userspace to set non-standard timings and it is used only in
>>> the dm646x davinci drivers at the moment.
>>>
>>> I propose the following additions:
>>>
>>> 1) Add a standards field to v4l2_bt_timings:
>>>
>>> __u32 standards;
>>
>> Seems fine for get/query/enum operations. It probably doesn't make sense for 
>> set.
> 
> No, it doesn't. For set it will just be ignored by the driver.
> 
>>>
>>>Currently I have four standards:
>>>
>>> #define V4L2_DV_BT_STD_CEA861   (1 << 0)
>>> #define V4L2_DV_BT_STD_DMT  (1 << 1)  /* VESA Discrete Monitor 
>>> Timings */
>>> #define V4L2_DV_BT_STD_CVT  (1 << 2)  /* VESA Coordinated Video 
>>> Timings */
>>> #define V4L2_DV_BT_STD_GTF  (1 << 3)  /* VESA Generalized Timings 
>>> Formula */
>>>
>>>A particular timing can be part of 0 or more standards.
>>>Both CVT and GTF timings have a so-called 'reduced blanking' mode. It 
>>> would be
>>>nice to represent this with a flag somewhere. I guess we need a flags 
>>> field
>>>for that. The 'polarities' field really should have been called a 
>>> 'flags' field.
>>>Oh well...
>>
>> instead of flags, we may consider using something like:
>>  _u32 polarity:1
>>
>> We need to double check if this is portable enough, however.
> 
> Bitfields aren't portable, unfortunately. But I wonder if we could do
> something like this:

Re: [PATCH 1/9] mm: move some functions from memory_hotplug.c to page_isolation.c

2011-10-18 Thread Mel Gorman
On Thu, Oct 06, 2011 at 03:54:41PM +0200, Marek Szyprowski wrote:
> From: KAMEZAWA Hiroyuki 
> 
> Memory hotplug is a logic for making pages unused in the specified
> range of pfn. So, some of core logics can be used for other purpose
> as allocating a very large contigous memory block.
> 
> This patch moves some functions from mm/memory_hotplug.c to
> mm/page_isolation.c. This helps adding a function for large-alloc in
> page_isolation.c with memory-unplug technique.
> 
> Signed-off-by: KAMEZAWA Hiroyuki 
> [m.nazarewicz: reworded commit message]
> Signed-off-by: Michal Nazarewicz 
> Signed-off-by: Kyungmin Park 
> [m.szyprowski: rebased and updated to Linux v3.0-rc1]
> Signed-off-by: Marek Szyprowski 
> CC: Michal Nazarewicz 
> Acked-by: Arnd Bergmann 
> ---
>  include/linux/page-isolation.h |7 +++
>  mm/memory_hotplug.c|  111 --
>  mm/page_isolation.c|  114 
> 
>  3 files changed, 121 insertions(+), 111 deletions(-)
> 
> diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
> index 051c1b1..58cdbac 100644
> --- a/include/linux/page-isolation.h
> +++ b/include/linux/page-isolation.h
> @@ -33,5 +33,12 @@ test_pages_isolated(unsigned long start_pfn, unsigned long 
> end_pfn);
>  extern int set_migratetype_isolate(struct page *page);
>  extern void unset_migratetype_isolate(struct page *page);
>  
> +/*
> + * For migration.
> + */
> +
> +int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn);

bool

> +unsigned long scan_lru_pages(unsigned long start, unsigned long end);

Both function names are misleading.

> +int do_migrate_range(unsigned long start_pfn, unsigned long end_pfn);
>  

scan_lru_pages as it is used by memory hotplug is also extremely
expensive. Unplugging memory is rare so the performance is not a concern
but it make be for CMA.

I think it would have made more sense to either express this as an iterator
like for_each_lru_page_in_range() and use cursors or reuse the compaction
code. As it is, these functions are a bit rough. I'm biased but this code
seems to have very similar responsibilities to the compaction.c code for
isolate_migratepages and how it handles migration. It also knows how to avoid
isolating so much memory as to put the system in the risk of being livelocked,
isolate pages from the LRU in batch etc.

This is not a show-stopper as such but personally I would prefer that
the memory hotplug code be sharing code with compaction than CMA adding
a new dependency on memory hotplug.

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


[PATCH 13/14] staging/media/as102: fix compile

2011-10-18 Thread Piotr Chmura
Replace usb_buffer_free() and usb_buffer_alloc() by usb_free_coherent() and 
usb_alloc_coherent() making it compile in current tree.
Add driver to parent Makefile and Kconfig

Signed-off-by: Piotr Chmura 

diff -Nur linux.as102.pulled/drivers/staging/Kconfig 
linux.as102.compiling/drivers/staging/Kconfig
--- linux.as102.pulled/drivers/staging/Kconfig  2011-10-14 15:26:42.0 
+0200
+++ linux.as102.compiling/drivers/staging/Kconfig   2011-10-17 
22:26:48.0 +0200
@@ -150,4 +150,6 @@
 
 source "drivers/staging/nvec/Kconfig"
 
+source "drivers/staging/media/as102/Kconfig"
+
 endif # STAGING
diff -Nur linux.as102.pulled/drivers/staging/Makefile 
linux.as102.compiling/drivers/staging/Makefile
--- linux.as102.pulled/drivers/staging/Makefile 2011-10-14 15:26:42.0 
+0200
+++ linux.as102.compiling/drivers/staging/Makefile  2011-10-17 
22:17:39.439874425 +0200
@@ -66,3 +66,4 @@
 obj-$(CONFIG_DRM_PSB)  += gma500/
 obj-$(CONFIG_INTEL_MEI)+= mei/
 obj-$(CONFIG_MFD_NVEC) += nvec/
+obj-$(CONFIG_DVB_AS102)+= media/as102/
diff -Nur linux.as102.pulled/drivers/staging/media/as102/as102_usb_drv.c 
linux.as102.compiling/drivers/staging/media/as102/as102_usb_drv.c
--- linux.as102.pulled/drivers/staging/media/as102/as102_usb_drv.c  
2011-10-17 22:05:15.996841251 +0200
+++ linux.as102.compiling/drivers/staging/media/as102/as102_usb_drv.c   
2011-10-17 22:22:33.317887538 +0200
@@ -238,7 +238,7 @@
for (i = 0; i < MAX_STREAM_URB; i++)
usb_free_urb(dev->stream_urb[i]);
 
-   usb_buffer_free(dev->bus_adap.usb_dev,
+   usb_free_coherent(dev->bus_adap.usb_dev,
MAX_STREAM_URB * AS102_USB_BUF_SIZE,
dev->stream,
dev->dma_addr);
@@ -251,7 +251,7 @@
 
ENTER();
 
-   dev->stream = usb_buffer_alloc(dev->bus_adap.usb_dev,
+   dev->stream = usb_alloc_coherent(dev->bus_adap.usb_dev,
   MAX_STREAM_URB * AS102_USB_BUF_SIZE,
   GFP_KERNEL,
   &dev->dma_addr);
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/14] staging/media/as102: add nBox Tuner Dongle support

2011-10-18 Thread Piotr Chmura
Add support for nBox Tuner Dongle based on the same chip.

Signed-off-by: Piotr Chmura 


diff -Nur linux.as102.01-initial/drivers/staging/media/as102/as102_usb_drv.c 
linux.as102.02-nbox/drivers/staging/media/as102/as102_usb_drv.c
--- linux.as102.01-initial/drivers/staging/media/as102/as102_usb_drv.c  
2011-10-14 18:00:19.0 +0200
+++ linux.as102.02-nbox/drivers/staging/media/as102/as102_usb_drv.c 
2011-10-14 18:21:36.0 +0200
@@ -41,6 +41,7 @@
{ USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
{ USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
{ USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
+   { USB_DEVICE(NBOX_DVBT_DONGLE_USB_VID, NBOX_DVBT_DONGLE_USB_PID) },
{ } /* Terminating entry */
 };
 
@@ -50,6 +51,7 @@
AS102_REFERENCE_DESIGN,
AS102_PCTV_74E,
AS102_ELGATO_EYETV_DTT_NAME,
+   AS102_NBOX_DVBT_DONGLE_NAME,
NULL /* Terminating entry */
 };
 
diff -Nur linux.as102.01-initial/drivers/staging/as102/as102_usb_drv.h 
linux.as102.02-nbox/drivers/staging/as102/as102_usb_drv.h
--- linux.as102.01-initial/drivers/staging/media/as102/as102_usb_drv.h  
2011-10-14 17:55:02.0 +0200
+++ linux.as102.02-nbox/drivers/staging/media/as102/as102_usb_drv.h 
2011-10-14 18:20:32.0 +0200
@@ -42,6 +42,11 @@
 #define ELGATO_EYETV_DTT_USB_VID   0x0fd9
 #define ELGATO_EYETV_DTT_USB_PID   0x002c
 
+/* nBox: nBox DVB-T Dongle */
+#define AS102_NBOX_DVBT_DONGLE_NAME"nBox DVB-T Dongle"
+#define NBOX_DVBT_DONGLE_USB_VID   0x0b89
+#define NBOX_DVBT_DONGLE_USB_PID   0x0007
+
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
 void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
 #else
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/14] staging/media/as102: fix licensing oversight

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:# HG changeset patch
# User Devin Heitmueller 
# Date 1267577404 18000
# Node ID 8557cb6da3e71a350a538e3a0eb41126884289b9
# Parent  84b93826c0a19efa114a6808165f91390cb86daa
as102: fix licensing oversight

From: Pierrick Hascoet 

Fix a couple of files which were supposed by be relicensed as GPL but were
overlooked.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 
Cc: Pierrick Hascoet 

diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c 
linuxb/drivers/media/dvb/as102/as10x_cmd_cfg.c
--- linux/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -1,20 +1,21 @@
-/**
-
- \file   as10x_cmd_cfg.c
-
- \author: S. Martinelli
-
- \n
-   (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n
-   www.abilis.com  \n
- \n
-
- \brief AS10x API, configuration services
-
-   AS10x cmd management: build command buffer, send command through
-   selected port and wait for the response when required.
-
-*/
+/*
+ * Abilis Systems Single DVB-T Receiver
+ * Copyright (C) 2008 Pierrick Hascoet 
+ *
+ * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
 
 #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
 #include 
diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c 
linuxb/drivers/media/dvb/as102/as10x_cmd_stream.c
--- linux/drivers/staging/media/as102/as10x_cmd_stream.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -1,22 +1,21 @@
-/**
-
- \file   as10x_cmd_stream.c
-
- \author: S. Martinelli
-
- \n
-   (c) Copyright Abilis Systems SARL 2005-2009 All rigths reserved \n
-   www.abilis.com  \n
- \n
-
- \brief AS10x CMD, stream services
-
-   AS10x CMD management: build command buffer, send command through
-   selected port and wait for the response when required.
-
-*/
-
-
+/*
+ * Abilis Systems Single DVB-T Receiver
+ * Copyright (C) 2008 Pierrick Hascoet 
+ *
+ * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
 #if defined(LINUX) && defined(__KERNEL__) /* linux kernel implementation */
 #include 
 #include "as102_drv.h"
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/14] staging/media/as102: fix compile warning about unused function

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267319685 18000
# Node ID 84b93826c0a19efa114a6808165f91390cb86daa
# Parent  22ef1bdca69a2781abf397c53a0f7f6125f5359a
as102: fix compile warning about unused function

From: Devin Heitmueller 

The function in question is only used on old kernels, so we had the call to
the function #ifdef'd, but the definition of the function was stil being
included.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as102_fe.c 
linuxb/drivers/media/dvb/as102/as102_fe.c
--- linux/drivers/staging/media/as102/as102_fe.c
+++ linuxb/drivers/staging/media/as102/as102_fe.c
@@ -32,6 +32,7 @@
 static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
  struct dvb_frontend_parameters *src);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 static void as102_fe_release(struct dvb_frontend *fe)
 {
struct as102_dev_t *dev;
@@ -42,7 +43,6 @@
if (dev == NULL)
return;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
if (mutex_lock_interruptible(&dev->bus_adap.lock))
return;
 
@@ -50,7 +50,6 @@
as10x_cmd_turn_off(&dev->bus_adap);
 
mutex_unlock(&dev->bus_adap.lock);
-#endif
 
/* release frontend callback ops */
memset(&fe->ops, 0, sizeof(struct dvb_frontend_ops));
@@ -66,7 +65,6 @@
LEAVE();
 }
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
 static int as102_fe_init(struct dvb_frontend *fe)
 {
int ret = 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/14] staging/media/as102: properly handle multiple product names

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:# HG changeset patch
# User Devin Heitmueller 
# Date 1267319051 18000
# Node ID 22ef1bdca69a2781abf397c53a0f7f6125f5359a
# Parent  4a82558f6df8b957bc623d854a118a5da32dead2
as102: properly handle multiple product names

From: Devin Heitmueller 

Properly handle the case where the driver can be associated with multiple
different products (as opposed to always saying the device is named after the
value in a #define

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as102_drv.c 
linuxb/drivers/media/dvb/as102/as102_drv.c
--- linux/drivers/staging/media/as102/as102_drv.c
+++ linuxb/drivers/staging/media/as102/as102_drv.c
@@ -209,7 +209,7 @@
 
 #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
ret = dvb_register_adapter(&as102_dev->dvb_adap,
-  DEVICE_FULL_NAME,
+  as102_dev->name,
   THIS_MODULE,
 #if defined(CONFIG_AS102_USB)
   &as102_dev->bus_adap.usb_dev->dev
diff --git linux/drivers/staging/media/as102/as102_drv.h 
linuxb/drivers/media/dvb/as102/as102_drv.h
--- linux/drivers/staging/media/as102/as102_drv.h
+++ linuxb/drivers/staging/media/as102/as102_drv.h
@@ -106,6 +106,7 @@
 };
 
 struct as102_dev_t {
+   const char *name;
struct as102_bus_adapter_t bus_adap;
struct list_head device_entry;
struct kref kref;
diff --git linux/drivers/staging/media/as102/as102_fe.c 
linuxb/drivers/media/dvb/as102/as102_fe.c
--- linux/drivers/staging/media/as102/as102_fe.c
+++ linuxb/drivers/staging/media/as102/as102_fe.c
@@ -346,7 +346,7 @@
 
 static struct dvb_frontend_ops as102_fe_ops = {
.info = {
-   .name   = DEVICE_FULL_NAME,
+   .name   = "Unknown AS102 device",
.type   = FE_OFDM,
.frequency_min  = 17400,
.frequency_max  = 86200,
@@ -408,6 +408,8 @@
 
/* init frontend callback ops */
memcpy(&dvb_fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
+   strncpy(dvb_fe->ops.info.name, as102_dev->name,
+   sizeof(dvb_fe->ops.info.name));
 
/* register dbvb frontend */
errno = dvb_register_frontend(dvb_adap, dvb_fe);
diff --git linux/drivers/staging/media/as102/as102_usb_drv.c 
linuxb/drivers/media/dvb/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -44,6 +44,15 @@
{ } /* Terminating entry */
 };
 
+/* Note that this table must always have the same number of entries as the
+   as102_usb_id_table struct */
+static const char *as102_device_names[] = {
+   AS102_REFERENCE_DESIGN,
+   AS102_PCTV_74E,
+   AS102_ELGATO_EYETV_DTT_NAME,
+   NULL /* Terminating entry */
+};
+
 struct usb_driver as102_usb_driver = {
.name   =  DRIVER_FULL_NAME,
.probe  =  as102_usb_probe,
@@ -344,6 +353,7 @@
 {
int ret;
struct as102_dev_t *as102_dev;
+   int i;
 
ENTER();
 
@@ -353,6 +363,23 @@
return -ENOMEM;
}
 
+   /* This should never actually happen */
+   if ((sizeof(as102_usb_id_table) / sizeof(struct usb_device_id)) !=
+   (sizeof(as102_device_names) / sizeof(const char *))) {
+   printk(KERN_ERR "Device names table invalid size");
+   return -EINVAL;
+   }
+
+   /* Assign the user-friendly device name */
+   for (i = 0; i < (sizeof(as102_usb_id_table) /
+sizeof(struct usb_device_id)); i++) {
+   if (id == &as102_usb_id_table[i])
+   as102_dev->name = as102_device_names[i];
+   }
+
+   if (as102_dev->name == NULL)
+   as102_dev->name = "Unknown AS102 device";
+
/* set private callback functions */
as102_dev->bus_adap.ops = &as102_priv_ops;
 
diff --git linux/drivers/staging/media/as102/as102_usb_drv.h 
linuxb/drivers/media/dvb/as102/as102_usb_drv.h
--- linux/drivers/staging/media/as102/as102_usb_drv.h
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.h
@@ -28,16 +28,17 @@
 /* define these values to match the supported devices */
 
 /* Abilis system: "TITAN" */
+#define AS102_REFERENCE_DESIGN "Abilis Systems DVB-Titan"
 #define AS102_USB_DEVICE_VENDOR_ID 0x1BA6
 #define AS102_USB_DEVICE_PID_0001  0x0001
 
 /* PCTV Systems: PCTV picoStick (74e) */
-#define DEVICE_FULL_NAME   "PCTV Systems : PCTV picoStick (74e)"
+#define AS102_PCTV_74E "PCTV Systems picoStick (74e)"
 #define PCTV_74E_USB_VID   0x2013
 #define PCTV_74E_USB_PID   0x0246
 
 /* Elgato: EyeTV DTT Deluxe */
-#define ELGATO_EYETV_DTT_NAME  

[PATCH 9/14] staging/media/as102: Add Elgato EyeTV DTT Deluxe

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318991 18000
# Node ID 4a82558f6df8b957bc623d854a118a5da32dead2
# Parent  89de57601df871f6d951ca13bf52b136f9eadddf
as102: Add Elgato EyeTV DTT Deluxe

From: Devin Heitmueller 

Add support for the Elgato EyeTV DTT Deluxe.  Note that the product
name field has not yet been abstracted out, so it will still identify
itself as a PCTV 74e.  The driver was originally built by the chipset
manufacturer so that the product vendor can specify the deivce name via
a #define, but wasn't setup to support multiple products from the same build of
the driver.

Thanks to Joerg Unglaub for suggesting this change.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 
Cc: Joerg Unglaub 

diff --git linux/drivers/staging/media/as102/as102_usb_drv.c 
linuxb/drivers/staging/media/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -40,6 +40,7 @@
 static struct usb_device_id as102_usb_id_table[] = {
{ USB_DEVICE(AS102_USB_DEVICE_VENDOR_ID, AS102_USB_DEVICE_PID_0001) },
{ USB_DEVICE(PCTV_74E_USB_VID, PCTV_74E_USB_PID) },
+   { USB_DEVICE(ELGATO_EYETV_DTT_USB_VID, ELGATO_EYETV_DTT_USB_PID) },
{ } /* Terminating entry */
 };
 
diff --git linux/drivers/staging/media/as102/as102_usb_drv.h 
linuxb/drivers/staging/media/as102/as102_usb_drv.h
--- linux/drivers/staging/media/as102/as102_usb_drv.h
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.h
@@ -36,6 +36,11 @@
 #define PCTV_74E_USB_VID   0x2013
 #define PCTV_74E_USB_PID   0x0246
 
+/* Elgato: EyeTV DTT Deluxe */
+#define ELGATO_EYETV_DTT_NAME  "Elgato EyeTV DTT Deluxe"
+#define ELGATO_EYETV_DTT_USB_VID   0x0fd9
+#define ELGATO_EYETV_DTT_USB_PID   0x002c
+
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
 void as102_urb_stream_irq(struct urb *urb, struct pt_regs *regs);
 #else
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318909 18000
# Node ID 89de57601df871f6d951ca13bf52b136f9eadddf
# Parent  152825226bec049f947a844bea2c530fc9269ae5
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as10x_cmd_cfg.c.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as10x_cmd_cfg.c 
linuxb/drivers/media/dvb/as102/as10x_cmd_cfg.c
--- linux/drivers/staging/media/as102/as10x_cmd_cfg.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_cfg.c
@@ -2,8 +2,6 @@
 
  \file   as10x_cmd_cfg.c
 
- \version $Id$
-
  \author: S. Martinelli
 
  \n
@@ -22,7 +20,8 @@
 #include 
 #include "as102_drv.h"
 #elif defined(WIN32)
-   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)  /* win32 ddk 
implementation */
+   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
+  /* win32 ddk implementation */
   #include "wdm.h"
   #include "Device.h"
   #include "endian_mgmt.h" /* FIXME */
@@ -59,52 +58,52 @@
 int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
  uint32_t *pvalue)
 {
-   int  error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int  error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
-   sizeof(pcmd->body.context.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.context.req));
 
-   /* fill command */
-   pcmd->body.context.req.proc_id  = cpu_to_le16(CONTROL_PROC_CONTEXT);
-   pcmd->body.context.req.tag  = cpu_to_le16(tag);
-   pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
+   /* fill command */
+   pcmd->body.context.req.proc_id = cpu_to_le16(CONTROL_PROC_CONTEXT);
+   pcmd->body.context.req.tag = cpu_to_le16(tag);
+   pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error  = phandle->ops->xfer_cmd(phandle,
-  (uint8_t *) pcmd,
-  sizeof(pcmd->body.context.req) + HEADER_SIZE,
-  (uint8_t *) prsp,
-  sizeof(prsp->body.context.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error  = phandle->ops->xfer_cmd(phandle,
+   (uint8_t *) pcmd,
+   sizeof(pcmd->body.context.req)
+   + HEADER_SIZE,
+   (uint8_t *) prsp,
+   sizeof(prsp->body.context.rsp)
+   + HEADER_SIZE);
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response: context command do not follow the common response */
-   /* structure -> specific handling response parse required*/
-   error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
+   /* parse response: context command do not follow the common response */
+   /* structure -> specific handling response parse required*/
+   error = as10x_context_rsp_parse(prsp, CONTROL_PROC_CONTEXT_RSP);
 
-   if(error == 0) {
- /* Response OK -> get response data */
-  *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32);
- /* value returned is always a 32-bit value */
-   }
+   if (error == 0) {
+   /* Response OK -> get response data */
+   *pvalue = le32_to_cpu(prsp->body.context.rsp.reg_val.u.value32);
+   /* value returned is always a 32-bit value */
+   }
 
 out:
-   LEAVE();
-   return(error);
+   LEAVE();
+   return error;
 }
 
 /**
@@ -118,47 +117,48 @@
 int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
  uint32_t value)
 {
-   int error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.context.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+ 

[PATCH 7/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318867 18000
# Node ID 152825226bec049f947a844bea2c530fc9269ae5
# Parent  5916edd6739e9b8e02ff8a1e93161c4d23b50b3e
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_usb_drv.c.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as102_usb_drv.c 
linuxb/drivers/media/dvb/as102/as102_usb_drv.c
--- linux/drivers/staging/media/as102/as102_usb_drv.c
+++ linuxb/drivers/staging/media/as102/as102_usb_drv.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -49,7 +50,7 @@
.id_table   =  as102_usb_id_table
 };
 
-struct file_operations as102_dev_fops = {
+static const struct file_operations as102_dev_fops = {
.owner   = THIS_MODULE,
.open= as102_open,
.release = as102_release,
@@ -63,46 +64,48 @@
 
 static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,
  unsigned char *send_buf, int send_buf_len,
- unsigned char *recv_buf, int recv_buf_len) {
-
+ unsigned char *recv_buf, int recv_buf_len)
+{
int ret = 0;
ENTER();
 
-   if(send_buf != NULL) {
+   if (send_buf != NULL) {
ret = usb_control_msg(bus_adap->usb_dev,
  usb_sndctrlpipe(bus_adap->usb_dev, 0),
  AS102_USB_DEVICE_TX_CTRL_CMD,
- USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ USB_DIR_OUT | USB_TYPE_VENDOR |
+ USB_RECIP_DEVICE,
  bus_adap->cmd_xid, /* value */
  0, /* index */
  send_buf, send_buf_len,
  USB_CTRL_SET_TIMEOUT /* 200 */);
-   if(ret < 0) {
+   if (ret < 0) {
dprintk(debug, "usb_control_msg(send) failed, err %i\n",
ret);
return ret;
}
 
-   if(ret != send_buf_len) {
+   if (ret != send_buf_len) {
dprintk(debug, "only wrote %d of %d bytes\n",
ret, send_buf_len);
return -1;
}
}
 
-   if(recv_buf != NULL) {
+   if (recv_buf != NULL) {
 #ifdef TRACE
dprintk(debug, "want to read: %d bytes\n", recv_buf_len);
 #endif
ret = usb_control_msg(bus_adap->usb_dev,
  usb_rcvctrlpipe(bus_adap->usb_dev, 0),
  AS102_USB_DEVICE_RX_CTRL_CMD,
- USB_DIR_IN | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ USB_DIR_IN | USB_TYPE_VENDOR |
+ USB_RECIP_DEVICE,
  bus_adap->cmd_xid, /* value */
  0, /* index */
  recv_buf, recv_buf_len,
  USB_CTRL_GET_TIMEOUT /* 200 */);
-   if(ret < 0) {
+   if (ret < 0) {
dprintk(debug, "usb_control_msg(recv) failed, err %i\n",
ret);
return ret;
@@ -119,18 +122,19 @@
 static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,
  unsigned char *send_buf,
  int send_buf_len,
- int swap32) {
-
+ int swap32)
+{
int ret = 0, actual_len;
 
-   ret = usb_bulk_msg(bus_adap->usb_dev, 
usb_sndbulkpipe(bus_adap->usb_dev, 1),
+   ret = usb_bulk_msg(bus_adap->usb_dev,
+  usb_sndbulkpipe(bus_adap->usb_dev, 1),
   send_buf, send_buf_len, &actual_len, 200);
-   if(ret) {
+   if (ret) {
dprintk(debug, "usb_bulk_msg(send) failed, err %i\n", ret);
return ret;
}
 
-   if(actual_len != send_buf_len) {
+   if (actual_len != send_buf_len) {
dprintk(debug, "only wrote %d of %d bytes\n",
actual_len, send_buf_len);
return -1;
@@ -139,21 +143,22 @@
 }
 
 static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap,
-  unsigned char *recv_buf, int recv

[PATCH 6/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318799 18000
# Node ID 5916edd6739e9b8e02ff8a1e93161c4d23b50b3e
# Parent  1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_fe.c.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as102_fe.c 
linuxb/drivers/media/dvb/as102/as102_fe.c
--- linux/drivers/staging/media/as102/as102_fe.c
+++ linuxb/drivers/staging/media/as102/as102_fe.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -31,12 +32,14 @@
 static void as102_fe_copy_tune_parameters(struct as10x_tune_args *dst,
  struct dvb_frontend_parameters *src);
 
-static void as102_fe_release(struct dvb_frontend *fe) {
+static void as102_fe_release(struct dvb_frontend *fe)
+{
struct as102_dev_t *dev;
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
@@ -64,13 +67,15 @@
 }
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19))
-static int as102_fe_init(struct dvb_frontend *fe) {
+static int as102_fe_init(struct dvb_frontend *fe)
+{
int ret = 0;
struct as102_dev_t *dev;
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -ENODEV;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -90,14 +95,16 @@
 #endif
 
 static int as102_fe_set_frontend(struct dvb_frontend *fe,
-struct dvb_frontend_parameters *params) {
+struct dvb_frontend_parameters *params)
+{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_args tune_args = { 0 };
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -ENODEV;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -107,9 +114,8 @@
 
/* send abilis command: SET_TUNE */
ret =  as10x_cmd_set_tune(&dev->bus_adap, &tune_args);
-   if(ret != 0) {
+   if (ret != 0)
dprintk(debug, "as10x_cmd_set_tune failed. (err = %d)\n", ret);
-   }
 
mutex_unlock(&dev->bus_adap.lock);
 
@@ -117,7 +123,7 @@
return (ret < 0) ? -EINVAL : 0;
 }
 
-static int as102_fe_get_frontend(struct dvb_frontend* fe,
+static int as102_fe_get_frontend(struct dvb_frontend *fe,
 struct dvb_frontend_parameters *p) {
int ret = 0;
struct as102_dev_t *dev;
@@ -125,7 +131,8 @@
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -EINVAL;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -150,7 +157,8 @@
 #if 0
dprintk(debug, "step_size= %d\n", settings->step_size);
dprintk(debug, "max_drift= %d\n", settings->max_drift);
-   dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms, 
1000);
+   dprintk(debug, "min_delay_ms = %d -> %d\n", settings->min_delay_ms,
+   1000);
 #endif
 
settings->min_delay_ms = 1000;
@@ -160,14 +168,16 @@
 }
 
 
-static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status) {
+static int as102_fe_read_status(struct dvb_frontend *fe, fe_status_t *status)
+{
int ret = 0;
struct as102_dev_t *dev;
struct as10x_tune_status tstate = { 0 };
 
ENTER();
 
-   if ((dev = (struct as102_dev_t *) fe->tuner_priv) == NULL)
+   dev = (struct as102_dev_t *) fe->tuner_priv;
+   if (dev == NULL)
return -ENODEV;
 
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -176,48 +186,47 @@
/* send abilis command: GET_TUNE_STATUS */
ret = as10x_cmd_get_tune_status(&dev->bus_adap, &tstate);
if (ret < 0) {
-   dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n", 
ret);
+   dprintk(debug, "as10x_cmd_get_tune_status failed (err = %d)\n",
+   ret);
goto out;
}
 
dev->signal_strength  = tstate.signal_strength;
dev->ber  = tstate.BER;
 
-   switch(tstate.tune_state) {
-  

[PATCH 5/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318751 18000
# Node ID 1ccb2e0adbf02a111decf8a4c78e93f4354e2bd2
# Parent  69c8f5172790784738bcc18f8301919ef3d5373f
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as10x_cmd_stream.c.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as10x_cmd_stream.c 
linuxb/drivers/media/dvb/as102/as10x_cmd_stream.c
--- linux/drivers/staging/media/as102/as10x_cmd_stream.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd_stream.c
@@ -2,8 +2,6 @@
 
  \file   as10x_cmd_stream.c
 
- \version $Id$
-
  \author: S. Martinelli
 
  \n
@@ -53,57 +51,57 @@
\return 0 when no error, < 0 in case of error.
\callgraph
 */
-int as10x_cmd_add_PID_filter(as10x_handle_t* phandle,
-struct as10x_ts_filter *filter) {
-   interror;
-   struct as10x_cmd_t *pcmd, *prsp;
+int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
+struct as10x_ts_filter *filter)
+{
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
-   sizeof(pcmd->body.add_pid_filter.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.add_pid_filter.req));
 
-   /* fill command */
-   pcmd->body.add_pid_filter.req.proc_id = cpu_to_le16(CONTROL_PROC_SETFILTER);
-   pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
-   pcmd->body.add_pid_filter.req.stream_type = filter->type;
+   /* fill command */
+   pcmd->body.add_pid_filter.req.proc_id =
+   cpu_to_le16(CONTROL_PROC_SETFILTER);
+   pcmd->body.add_pid_filter.req.pid = cpu_to_le16(filter->pid);
+   pcmd->body.add_pid_filter.req.stream_type = filter->type;
 
-   if(filter->idx < 16)
-   pcmd->body.add_pid_filter.req.idx = filter->idx;
-   else
-   pcmd->body.add_pid_filter.req.idx = 0xFF;
+   if (filter->idx < 16)
+   pcmd->body.add_pid_filter.req.idx = filter->idx;
+   else
+   pcmd->body.add_pid_filter.req.idx = 0xFF;
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error = phandle->ops->xfer_cmd(phandle,
-  (uint8_t *) pcmd,
-  sizeof(pcmd->body.add_pid_filter.req) + HEADER_SIZE,
-  (uint8_t *) prsp,
-  sizeof(prsp->body.add_pid_filter.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+   sizeof(pcmd->body.add_pid_filter.req)
+   + HEADER_SIZE, (uint8_t *) prsp,
+   sizeof(prsp->body.add_pid_filter.rsp)
+   + HEADER_SIZE);
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response */
-   error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
+   /* parse response */
+   error = as10x_rsp_parse(prsp, CONTROL_PROC_SETFILTER_RSP);
 
-   if(error == 0) {
- /* Response OK -> get response data */
- filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
-   }
+   if (error == 0) {
+   /* Response OK -> get response data */
+   filter->idx = prsp->body.add_pid_filter.rsp.filter_id;
+   }
 
 out:
-   LEAVE();
-   return(error);
+   LEAVE();
+   return error;
 }
 
 /**
@@ -113,144 +111,138 @@
\return 0 when no error, < 0 in case of error.
\callgraph
 */
-int as10x_cmd_del_PID_filter(as10x_handle_t* phandle,
+int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
 uint16_t pid_value)
 {
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   interror;
-   struct as10x_cmd_t *pcmd, *prsp;
+   ENTER();
 
-   ENTER();
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.del_pid_filter.req));
 
-   /* prepare command */
-   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
-   sizeof(pcmd->body.del_pid_filter.req));
+   /* fill command */
+   pcmd->body.del_pid_filter.req.proc_id =
+   cpu_to_le16(CONTROL_PROC_REMOVEFILTER);
+   pc

[PATCH 4/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318701 18000
# Node ID 69c8f5172790784738bcc18f8301919ef3d5373f
# Parent  b91e96a07bee27c1d421b4c3702e33ee8075de83
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as10x_cmd.c.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as10x_cmd.c 
linuxb/drivers/media/dvb/as102/as10x_cmd.c
--- linux/drivers/staging/media/as102/as10x_cmd.c
+++ linuxb/drivers/staging/media/as102/as10x_cmd.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -21,7 +22,8 @@
 #include 
 #include "as102_drv.h"
 #elif defined(WIN32)
-   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)  /* win32 ddk 
implementation */
+   #if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK)
+  /* win32 ddk implementation */
   #include "wdm.h"
   #include "Device.h"
   #include "endian_mgmt.h" /* FIXME */
@@ -51,43 +53,42 @@
 */
 int as10x_cmd_turn_on(as10x_handle_t *phandle)
 {
-   int error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd,(++phandle->cmd_xid), sizeof(pcmd->body.turn_on.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.turn_on.req));
 
-   /* fill command */
-   pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
+   /* fill command */
+   pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error = phandle->ops->xfer_cmd(
-   phandle,
-   (uint8_t *) pcmd,
-   sizeof(pcmd->body.turn_on.req) + HEADER_SIZE,
-   (uint8_t *) prsp,
-   sizeof(prsp->body.turn_on.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd,
+  sizeof(pcmd->body.turn_on.req) +
+  HEADER_SIZE,
+  (uint8_t *) prsp,
+  sizeof(prsp->body.turn_on.rsp) +
+  HEADER_SIZE);
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response */
-   error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
+   /* parse response */
+   error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNON_RSP);
 
 out:
-   LEAVE();
-   return(error);
+   LEAVE();
+   return error;
 }
 
 /**
@@ -98,42 +99,41 @@
 */
 int as10x_cmd_turn_off(as10x_handle_t *phandle)
 {
-   int error;
-   struct as10x_cmd_t *pcmd, *prsp;
+   int error;
+   struct as10x_cmd_t *pcmd, *prsp;
 
-   ENTER();
+   ENTER();
 
-   pcmd = phandle->cmd;
-   prsp = phandle->rsp;
+   pcmd = phandle->cmd;
+   prsp = phandle->rsp;
 
-   /* prepare command */
-   as10x_cmd_build(pcmd,(++phandle->cmd_xid),sizeof(pcmd->body.turn_off.req));
+   /* prepare command */
+   as10x_cmd_build(pcmd, (++phandle->cmd_xid),
+   sizeof(pcmd->body.turn_off.req));
 
-   /* fill command */
-   pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
+   /* fill command */
+   pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
 
-   /* send command */
-   if(phandle->ops->xfer_cmd) {
-  error = phandle->ops->xfer_cmd(
+   /* send command */
+   if (phandle->ops->xfer_cmd) {
+   error = phandle->ops->xfer_cmd(
phandle, (uint8_t *) pcmd,
sizeof(pcmd->body.turn_off.req) + HEADER_SIZE,
-(uint8_t *) prsp,
+   (uint8_t *) prsp,
sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE);
-   }
-   else{
-  error = AS10X_CMD_ERROR;
-   }
+   } else {
+   error = AS10X_CMD_ERROR;
+   }
 
-   if(error < 0) {
-  goto out;
-   }
+   if (error < 0)
+   goto out;
 
-   /* parse response */
-   error = as10x_rsp_parse(prsp, CONTROL_PROC_TURNOFF_RSP);
+ 

[PATCH 3/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318626 18000
# Node ID b91e96a07bee27c1d421b4c3702e33ee8075de83
# Parent  e2ba344c99936bddc46722f1f1efec5600c58659
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_fw.c.

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as102_fw.c 
linuxb/drivers/media/dvb/as102/as102_fw.c
--- linux/drivers/staging/media/as102/as102_fw.c
+++ linuxb/drivers/staging/media/as102/as102_fw.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -31,15 +32,16 @@
 char as102_dt_fw1[] = "as102_data1_dt.hex";
 char as102_dt_fw2[] = "as102_data2_dt.hex";
 
-static unsigned char atohx(unsigned char *dst, char *src) {
+static unsigned char atohx(unsigned char *dst, char *src)
+{
unsigned char value = 0;
 
char msb = tolower(*src) - '0';
-   char lsb = tolower(*(src +1)) - '0';
+   char lsb = tolower(*(src + 1)) - '0';
 
-   if (msb > 9 )
+   if (msb > 9)
msb -= 7;
-   if (lsb > 9 )
+   if (lsb > 9)
lsb -= 7;
 
*dst = value = ((msb & 0xF) << 4) | (lsb & 0xF);
@@ -62,43 +64,42 @@
}
 
/* locate end of line */
-   for (src=fw_data; *src != '\n'; src += 2) {
+   for (src = fw_data; *src != '\n'; src += 2) {
atohx(&dst, src);
/* parse line to split addr / data */
switch (count) {
-   case 0:
-   *dataLength = dst;
-   break;
-   case 1:
-   addr[2] = dst;
-   break;
-   case 2:
-   addr[3] = dst;
-   break;
-   case 3:
-   /* check if data is an address */
-   if (dst == 0x04)
-   *addr_has_changed = 1;
-   else
-   *addr_has_changed = 0;
-   break;
-   case  4:
-   case  5:
-   if (*addr_has_changed) {
-   addr[(count - 4)] = dst;
-   } else {
-   data[(count - 4)] = dst;
-   }
-   break;
-   default:
+   case 0:
+   *dataLength = dst;
+   break;
+   case 1:
+   addr[2] = dst;
+   break;
+   case 2:
+   addr[3] = dst;
+   break;
+   case 3:
+   /* check if data is an address */
+   if (dst == 0x04)
+   *addr_has_changed = 1;
+   else
+   *addr_has_changed = 0;
+   break;
+   case  4:
+   case  5:
+   if (*addr_has_changed)
+   addr[(count - 4)] = dst;
+   else
data[(count - 4)] = dst;
-   break;
+   break;
+   default:
+   data[(count - 4)] = dst;
+   break;
}
count++;
}
 
/* return read value + ':' + '\n' */
-   return ((count * 2) + 2);
+   return (count * 2) + 2;
 }
 
 static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap,
@@ -122,17 +123,20 @@
&data_len,
&addr_has_changed);
 
-   if (read_bytes <= 0) {
+   if (read_bytes <= 0)
goto error;
-   }
 
/* detect the end of file */
-   if ((total_read_bytes += read_bytes) == firmware->size) {
+   total_read_bytes += read_bytes;
+   if (total_read_bytes == firmware->size) {
fw_pkt.u.request[0] = 0x00;
fw_pkt.u.request[1] = 0x03;
 
/* send EOF command */
-   if ((errno = 
bus_adap->ops->upload_fw_pkt(bus_adap,(uint8_t *) &fw_pkt, 2, 0)) < 0)
+   errno = bus_adap->ops->upload_fw_pkt(bus_adap,
+  

[PATCH 2/14] staging/media/as102: checkpatch fixes

2011-10-18 Thread Piotr Chmura
Patch taken from http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/

Original source and comment:
# HG changeset patch
# User Devin Heitmueller 
# Date 1267318502 18000
# Node ID e2ba344c99936bddc46722f1f1efec5600c58659
# Parent  a78bda1e1a0badc4a1296be958f1f8a49014ae18
as102: checkpatch fixes

From: Devin Heitmueller 

Fix make checkpatch issues reported against as102_drv.c

Priority: normal

Signed-off-by: Piotr Chmura 
Cc: Devin Heitmueller 

diff --git linux/drivers/staging/media/as102/as102_drv.c 
linuxb/drivers/media/dvb/as102/as102_drv.c
--- linux/drivers/staging/media/as102/as102_drv.c
+++ linuxb/drivers/staging/media/as102/as102_drv.c
@@ -1,6 +1,7 @@
 /*
  * Abilis Systems Single DVB-T Receiver
  * Copyright (C) 2008 Pierrick Hascoet 
+ * Copyright (C) 2010 Devin Heitmueller 
  *
  * 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
@@ -36,23 +37,23 @@
 #warning >>> DVB_CORE not defined !!! <<<
 #endif
 
-int debug = 0;
+int debug;
 module_param_named(debug, debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default: off)");
 
-int dual_tuner = 0;
+int dual_tuner;
 module_param_named(dual_tuner, dual_tuner, int, 0644);
-MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner configuration (default: 
off)");
+MODULE_PARM_DESC(dual_tuner, "Activate Dual-Tuner config (default: off)");
 
 static int fw_upload = 1;
 module_param_named(fw_upload, fw_upload, int, 0644);
 MODULE_PARM_DESC(fw_upload, "Turn on/off default FW upload (default: on)");
 
-static int pid_filtering = 0;
+static int pid_filtering;
 module_param_named(pid_filtering, pid_filtering, int, 0644);
 MODULE_PARM_DESC(pid_filtering, "Activate HW PID filtering (default: off)");
 
-static int ts_auto_disable = 0;
+static int ts_auto_disable;
 module_param_named(ts_auto_disable, ts_auto_disable, int, 0644);
 MODULE_PARM_DESC(ts_auto_disable, "Stream Auto Enable on FW (default: off)");
 
@@ -65,7 +66,8 @@
 #endif
 
 #if defined(CONFIG_DVB_CORE) || defined(CONFIG_DVB_CORE_MODULE)
-static void as102_stop_stream(struct as102_dev_t *dev) {
+static void as102_stop_stream(struct as102_dev_t *dev)
+{
struct as102_bus_adapter_t *bus_adap;
 
if (dev != NULL)
@@ -80,16 +82,15 @@
if (mutex_lock_interruptible(&dev->bus_adap.lock))
return;
 
-   if (as10x_cmd_stop_streaming(bus_adap) < 0) {
+   if (as10x_cmd_stop_streaming(bus_adap) < 0)
dprintk(debug, "as10x_cmd_stop_streaming failed\n");
-   }
 
mutex_unlock(&dev->bus_adap.lock);
}
 }
 
-static int as102_start_stream(struct as102_dev_t *dev) {
-
+static int as102_start_stream(struct as102_dev_t *dev)
+{
struct as102_bus_adapter_t *bus_adap;
int ret = -EFAULT;
 
@@ -98,9 +99,8 @@
else
return ret;
 
-   if (bus_adap->ops->start_stream != NULL) {
+   if (bus_adap->ops->start_stream != NULL)
ret = bus_adap->ops->start_stream(dev);
-   }
 
if (ts_auto_disable) {
if (mutex_lock_interruptible(&dev->bus_adap.lock))
@@ -127,25 +127,25 @@
return -EBUSY;
}
 
-   switch(onoff) {
-   case 0:
-   ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) 
pid);
-   dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = 
%d\n",
-   index, pid, ret);
-   break;
-   case 1:
-   {
-   struct as10x_ts_filter filter;
+   switch (onoff) {
+   case 0:
+   ret = as10x_cmd_del_PID_filter(bus_adap, (uint16_t) pid);
+   dprintk(debug, "DEL_PID_FILTER([%02d] 0x%04x) ret = %d\n",
+   index, pid, ret);
+   break;
+   case 1:
+   {
+   struct as10x_ts_filter filter;
 
-   filter.type = TS_PID_TYPE_TS;
-   filter.idx = 0xFF;
-   filter.pid = pid;
+   filter.type = TS_PID_TYPE_TS;
+   filter.idx = 0xFF;
+   filter.pid = pid;
 
-   ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
-   dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) 
ret = %d\n",
-   index, filter.idx, filter.pid, ret);
-   break;
-   }
+   ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
+   dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",
+   index, filter.idx, filter.pid, ret);
+   break;
+   }
}
 
mutex_unlock(&dev->bus_adap.lock);
@@ -154,7 +154,8 @@
return ret;
 }
 
-static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed) {
+static int as102_dvb_dmx_start_feed(struct dvb_demux_feed *dvbdmxfeed)
+{
  

[PATCH 0/14] staging/media/as102: new driver submission (was Re: [PATCH 1/7] Staging submission: PCTV 74e driver (as102)

2011-10-18 Thread Piotr Chmura
On Sun, 16 Oct 2011 11:44:14 -0200
Mauro Carvalho Chehab  wrote:

> Em 16-10-2011 09:45, Devin Heitmueller escreveu:
> > On Sun, Oct 16, 2011 at 4:57 AM, Stefan Richter
> >  wrote:
> >> Hi Piotr,
> >>
> >> thanks for getting this going again.  - I have not yet looked through the
> >> source but have some small remarks on the patch format.
> >>
> >>  - In your changelogs and in the diffs, somehow the space between real
> >>name and e-mail address got lost.
> >>
> >>  - The repetition of the Subject: line as first line in the changelog is
> >>unnecessary (and would cause an undesired duplication e.g. when git-am
> >>is used, last time I checked).
> >>
> >>  - AFAICT, author of patch 1/7 is not Devin but you.  Hence the From: line
> >>right above the changelog is wrong.
> >>
> >>  - The reference to the source hg tree is very helpful.  However, since
> >>the as102 related history in there is very well laid out, it may be
> >>beneficial to quote some of this prior history.  I suggest, include
> >>the changelog of "as102: import initial as102 driver",
> >>http://kernellabs.com/hg/~dheitmueller/v4l-dvb-as102-2/rev/a78bda1e1a0b
> >>(but mark it clearly as a quote from the out-of-tree repo), and include
> >>a shortlog from this commit inclusive until the head commit inclusive.
> >>(Note, the hg author field appears to be wrong; some of the changes
> >>apparently need to be attributed to Pierrick Hascoet as author.)
> >>This would IMO improve the picture of who contributed what when this
> >>goes into mainline git history, even though the hg history needed to
> >>be discarded.
> >>
> >>  - A diffstat is always very nice to have in a patch posting.  Most tools
> >>for patch generation make it easy to add, and it helps the recipients
> >>of the patch posting.
> >>(Also, a diffstat of all patches combined would be good to have in the
> >>introductory PATCH 0/n posting, but not many developers take the time
> >>to do so.)
> >>
> >> Again, thanks for the effort and also thanks to Devin for making it
> >> possible.
> > 
> > I think collapsing my entire patch series in to a single patch would
> > not be acceptable, as it loses the entire history of what code was
> > originally delivered by Abilis as well as what changes I made.  The
> > fact that it's from multiple authors (including a commercial entity
> > contributing the code) makes this worse.
> > 
> > I think the tree does need to be rebased, but I don't think the entire
> > patch series would need to be reworked to be on staging from the
> > beginning.  You could probably import the first patch (as102: import
> > initial as102 driver), fix the usb_alloc_coherent() so that it
> > compiles (and put a note in it saying you did), apply the rest of the
> > patch series, and then add a final patch that says something like
> > "moving to staging as code is not production ready".  This would allow
> > the history to be preserved without having to rebase every patch to
> > deal with the files being moved to the staging tree.
> 
> Rebasing a changeset to move it to staging is not as complex as it seems. 
> I did it with tm6000 at the time I merged it. A simple bash script could
> do that. Something like (untested):
> 
> $ git export some_base_reference
> $ for i in 00*.patch; do sed s,/drivers/media/video,/drivers/staging,g <$i >a 
> && mv a $i; done
> $ mkdir patches/
> $ mv 00*.patches patches/
> $ (cd patches; ls *.patch > series)
> $ git quiltimport
> 
> Of course, the Makefike/Kconfig patch will need changes, but this is as easy
> as just dropping the hunks that are touching at /drivers/media/video/Makefile
> and /drivers/media/video/Kconfig, and then adding a final patch adding it to
> the /drivers/staging/*.
> 
> > 
> > An alternative would be make a minor tweak to my first patch which
> > removes the driver from the makefile.  Then every patch in the patch
> > series wouldn't actually have to compile successfully until the very
> > end when you add it back into the Makefile.  This is a luxury you can
> > do when it's a brand new driver.
> > 
> > When it's a brand new driver there is a bit more flexibility as long
> > as you don't break "git bisect".  Both of the approaches described
> > above accomplish that.
> > 
> > Mauro, what do you think?
> 
> Didn't actually reviewed the changeset, but let me comment about the
> submission procedure.
> 
> Folding patches from different authors generally is not a good idea.
> As Devin said, things like replacing "foo" by "bar" because "foo" core
> function were replaced by "bar" upstream is the kind of thing that you
> could fold, if you properly document it with:
>  
> [john@john_email.com: replaced "foo" by "bar" to fix compilation] 
> 
> So, you should rebase the patchsets, instead of just folding everything.
> It is up to you to change the patches on each patch, or to do it only at
> a final patch. Both ways work for me.
> 
> I suggest you to remo

Re: kernel OOPS when releasing usb webcam (random)

2011-10-18 Thread Antonio Ospite
On Mon, 17 Oct 2011 17:05:19 -0700 (PDT)
David Rientjes  wrote:

> On Mon, 17 Oct 2011, Tomas M. wrote:
> 
> > im getting the following null pointer dereference from time to time when
> > releasing a usb camera.
> > 
> > maybe this trace is of assistance...please reply to my mail since im not
> > subscribed.
> > 
> 
> I suspect this is happening in v4l2_device_unregister_subdev().  Adding 
> Guennadi, Mauro, and linux-media.
> 
> > BUG: unable to handle kernel NULL pointer dereference at 006c
> > IP: [] v4l2_device_release+0xa2/0xf0 [videodev]

Hi,

I sent a fix for a similar trace last week:
http://patchwork.linuxtv.org/patch/8124/

Tomas, can you test it fixes the problem for you too?

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


pgpawvlXPV7ki.pgp
Description: PGP signature


Re: [PATCH] [media] videodev: fix a NULL pointer dereference in v4l2_device_release()

2011-10-18 Thread Antonio Ospite
On Wed, 12 Oct 2011 23:59:26 +0200
Antonio Ospite  wrote:

> The change in 8280b66 does not cover the case when v4l2_dev is already
> NULL, fix that.
> 
> With a Kinect sensor, seen as an USB camera using GSPCA in this context,
> a NULL pointer dereference BUG can be triggered by just unplugging the
> device after the camera driver has been loaded.
> 
> Signed-off-by: Antonio Ospite 
> ---
> Hi,
> 
> can anyone reproduce this?
>

Ping.

David, does the change below fix it for you, I sent the patch
last week.

Regards,
   Antonio

> This is the complete trace, I left it out of the commit message, but feel 
> free 
> to include it if you think it is worth it.
> 
> BUG: unable to handle kernel NULL pointer dereference at 0090
> IP: [] v4l2_device_release+0xb8/0xe8 [videodev]
> PGD 0 
> Oops:  [#1] SMP 
> CPU 0 
> Modules linked in: snd_usb_audio snd_usbmidi_lib gspca_kinect gspca_main 
> videodev media v4l2_compat_ioctl32 hidp snd_hrtimer ebtable_nat ebtables 
> powernow_k8 mperf cpufreq_powersave cpufreq_conservative cpufreq_stats 
> cpufreq_userspace ipt_MASQUERADE xt_CHECKSUM bridge stp ppdev lp bnep rfcomm 
> tun sit tunnel4 ip6table_raw ip6table_mangle ip6t_REJECT ip6t_LOG 
> nf_conntrack_ipv6 nf_defrag_ipv6 ip6t_rt ip6table_filter ip6_tables decnet 
> binfmt_misc uinput fuse xt_tcpudp ipt_REJECT ipt_ULOG xt_limit xt_state 
> xt_multiport iptable_filter iptable_nat nf_nat nf_conntrack_ipv4 nf_conntrack 
> nf_defrag_ipv4 iptable_mangle iptable_raw ip_tables x_tables nfsd nfs lockd 
> fscache auth_rpcgss nfs_acl sunrpc it87 hwmon_vid loop kvm_amd kvm 
> snd_hda_codec_hdmi snd_hda_codec_via nvidia(P) snd_hda_intel snd_hda_codec 
> snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm snd_seq_midi snd_rawmidi cryptd 
> aes_x86_64 snd_seq_midi_event aes_generic ecb snd_seq btusb bluetooth evdev 
> snd_timer snd_seq_device edac_core parport_pc pcspkr parport rfkill snd 
> edac_mce_amd k8temp crc16 soundcore mxm_wmi snd_page_alloc asus_atk0110 
> shpchp 
> video pci_hotplug i2c_nforce2 wmi i2c_core processor thermal_sys button ext3 
> jbd mbcache dm_mod sg sd_mod sr_mod crc_t10dif cdrom ata_generic usb_storage 
> usbhid hid uas ahci libahci pata_amd libata scsi_mod forcedeth floppy 
> ohci_hcd 
> ehci_hcd usbcore [last unloaded: scsi_wait_scan]
> 
> Pid: 125, comm: khubd Tainted: P3.1.0-rc9-ao2 #3 System 
> manufacturer System Product Name/M3N78-VM
> RIP: 0010:[]  [] 
> v4l2_device_release+0xb8/0xe8 [videodev]
> RSP: 0018:88011639fc10  EFLAGS: 00010246
> RAX:  RBX: 8800ca61a088 RCX: 0001
> RDX: 0001 RSI:  RDI: a10db000
> RBP:  R08: 8119b320 R09: 8119b320
> R10: 0001 R11: 0001 R12: 8800ca61a000
> R13: 8164ffb0 R14:  R15: 001f
> FS:  7f61275f37a0() GS:88011fc0() knlGS:
> CS:  0010 DS:  ES:  CR0: 8005003b
> CR2: 0090 CR3: 0001150de000 CR4: 06f0
> DR0:  DR1:  DR2: 
> DR3:  DR6: 0ff0 DR7: 0400
> Process khubd (pid: 125, threadinfo 88011639e000, task 88011639d590)
> Stack:
>  8800ca5d8380 8800ca61a098 8800ca66c200 81232e94
>  8800ca61a0d0 8119a7fa 8119b320 8800ca61a0d0
>  8119a7ab 8800ca56dc00 a10e1068 8119b93a
> Call Trace:
>  [] ? device_release+0x41/0x72
>  [] ? kobject_release+0x4f/0x6c
>  [] ? add_uevent_var+0xdc/0xdc
>  [] ? kobject_del+0x2d/0x2d
>  [] ? kref_put+0x3e/0x47
>  [] ? usb_unbind_interface+0x4d/0x111 [usbcore]
>  [] ? __device_release_driver+0x7d/0xc9
>  [] ? device_release_driver+0x1b/0x27
>  [] ? bus_remove_device+0x7c/0x8b
>  [] ? device_del+0x129/0x177
>  [] ? usb_disable_device+0x6a/0x159 [usbcore]
>  [] ? usb_disconnect+0x8c/0x108 [usbcore]
>  [] ? usb_disconnect+0x6d/0x108 [usbcore]
>  [] ? hub_thread+0x58e/0xec6 [usbcore]
>  [] ? set_next_entity+0x32/0x52
>  [] ? add_wait_queue+0x3c/0x3c
>  [] ? usb_remote_wakeup+0x2f/0x2f [usbcore]
>  [] ? kthread+0x76/0x7e
>  [] ? kernel_thread_helper+0x4/0x10
>  [] ? kthread_worker_fn+0x139/0x139
>  [] ? gs_change+0x13/0x13
> Code: 0d a1 e8 7a ec 25 e0 48 8b 83 78 02 00 00 48 85 c0 74 18 48 83 78 08 00 
> 74 11 83 bb b0 02 00 00 03 74 08 4c 89 e7 e8 03 5a ff ff 
>  83 bd 90 00 00 00 00 b8 00 00 00 00 4c 89 e7 48 0f 44 e8 ff 
> RIP  [] v4l2_device_release+0xb8/0xe8 [videodev]
>  RSP 
> CR2: 0090
> ---[ end trace 99f7feddc91f30d6 ]---
> 
> Thanks,
>Antonio Ospite
>http://ao2.it
> 
>  drivers/media/video/v4l2-dev.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> index d721565..a5c9ed1 100644
> --- a/drivers/media/video/v4l2-dev.c
> +++ b/drivers/media/video/v4l2-dev.c
> @@ -181,7 +181,7 @@ static void v4l2_device_rel