Re: [Workshop-2011] Media summit/KS-2012 proposals

2012-09-06 Thread Hans Verkuil
On Thu September 6 2012 06:09:44 Jun Nie wrote:
 2012/9/5 Hans Verkuil hverk...@xs4all.nl:
  On Wed 5 September 2012 10:04:41 Jun Nie wrote:
  Is there any summary for this summit or presentation material? I am
  looking forward for some idea on CEC. It is really complex in
  functionality.
  Maybe other guys is expecting simiar fruite from summit too.
 
  Yes, there will be a summit report. It's not quite finished yet, I think.
 
  With respect to CEC we had some useful discussions. It will have to be a
  new class of device (/dev/cecX), so the userspace API will be separate from
  drm or v4l.
 
  And the kernel will have to take care of the core CEC protocol w.r.t. 
  control
  and discovery due to the HDMI 1.4a requirements.
 
  I plan on starting work on this within 1-2 weeks.
 
  My CEC presentation can be found here:
 
  http://hverkuil.home.xs4all.nl/presentations/v4l2-workshop-cec.odp
 
  Regards,
 
  Hans
 
 Thanks for quick response! It's good to know that CEC is independent
 with DRM/V4L for my HDMI implementation is FB/lcd-device based. CEC is
 also deserved to have independent management in both hardware signal
 and functionality. Someone also expressed similar thoughts before.
 Will remote control protocal parsing are done in userspace reference
 library? Or not decided yet?

Are you referring to the remote control pass-through functionality?
I don't know yet whether that will go through a userspace library or
through the RC kernel subsystem, or possibly both.

Most of the other non-system messages will go to a userspace library.

But I haven't started coding yet, so it is very early days :-)

The main thing is that at least I now have a high-level design that
I can start to work with.

Regards,

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


[PATCH v2] drivers/media/platform/s5p-tv/sdo_drv.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/platform/s5p-tv/sdo_drv.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/s5p-tv/sdo_drv.c 
b/drivers/media/platform/s5p-tv/sdo_drv.c
index ad68bbe..58cf56d 100644
--- a/drivers/media/platform/s5p-tv/sdo_drv.c
+++ b/drivers/media/platform/s5p-tv/sdo_drv.c
@@ -369,6 +369,7 @@ static int __devinit sdo_probe(struct platform_device *pdev)
sdev-fout_vpll = clk_get(dev, fout_vpll);
if (IS_ERR_OR_NULL(sdev-fout_vpll)) {
dev_err(dev, failed to get clock 'fout_vpll'\n);
+   ret = -ENXIO;
goto fail_dacphy;
}
dev_info(dev, fout_vpll.rate = %lu\n, clk_get_rate(sclk_vpll));
@@ -377,11 +378,13 @@ static int __devinit sdo_probe(struct platform_device 
*pdev)
sdev-vdac = devm_regulator_get(dev, vdd33a_dac);
if (IS_ERR_OR_NULL(sdev-vdac)) {
dev_err(dev, failed to get regulator 'vdac'\n);
+   ret = -ENXIO;
goto fail_fout_vpll;
}
sdev-vdet = devm_regulator_get(dev, vdet);
if (IS_ERR_OR_NULL(sdev-vdet)) {
dev_err(dev, failed to get regulator 'vdet'\n);
+   ret = -ENXIO;
goto fail_fout_vpll;
}
 

--
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: Camera not detected on linux-next

2012-09-06 Thread Prabhakar Lad
Hi Sylwester,

On Wed, Sep 5, 2012 at 9:47 PM, Sylwester Nawrocki
s.nawro...@samsung.com wrote:
 Hi,

 On 09/05/2012 06:06 PM, Fabio Estevam wrote:
 I am running linux-next 20120905 on a mx31pdk board with a ov2640 CMOS
 and I am not able to get the ov2640 to be probed:

 soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0
 mx3-camera mx3-camera.0: MX3 Camera driver attached to camera 0
 mx3-camera mx3-camera.0: MX3 Camera driver detached from camera 0
  (no messages showing ov2640 being probed)

 I noticed that Kconfig changed the way to select the Sensors used on
 soc_camera driver and I selected ov2640 in the .config.

 camera worked fine on this board running 3.5.3. So before start
 bisecting, I would like to know if there is anything obvious I am
 missing.

 Also tested on a mx27pdk and ov2640 could not be probed there as well.

 Maybe this is about the sensor/host driver linking order.
 If so, then this patch should help

 http://git.linuxtv.org/snawrocki/media.git/commitdiff/458b9b5ab8cb970887c9d1f1fddf88399b2d9ef2

Thanks for the patch.  I too had created one but didnt submit. I guess you will
post the patch soon to the list.

Thanks and Regards,
--Prabhakar Lad

 --

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


Re: [RFC PATCH] [media] rc: filter out not allowed protocols when decoding

2012-09-06 Thread Changbin Du
Sean , many thanks for your help. I know much more about IR framwork
now. I'll try to
work out a patch to remove allowed_protocols.

Thanks again!
[Du, Changbin]

2012/9/4 Sean Young s...@mess.org:
 On Tue, Sep 04, 2012 at 11:06:07AM +0800, Changbin Du wrote:
 mutex_lock(ir_raw_handler_lock);
   - list_for_each_entry(handler, ir_raw_handler_list, list)
   - handler-decode(raw-dev, ev);
   + list_for_each_entry(handler, ir_raw_handler_list, list) {
   + /* use all protocol by default */
   + if (raw-dev-allowed_protos == RC_TYPE_UNKNOWN ||
   + raw-dev-allowed_protos  handler-protocols)
   + handler-decode(raw-dev, ev);
   + }
 
  Each IR protocol decoder already checks whether it is enabled or not;
  should it not be so that only allowed protocols can be enabled rather
  than checking both enabled_protocols and allowed_protocols?
 
  Just from reading store_protocols it looks like decoders which aren't
  in allowed_protocols can be enabled, which makes no sense. Also
  ir_raw_event_register all protocols are enabled rather than the
  allowed ones.
 
 
  Lastely I don't know why raw ir drivers should dictate which protocols
  can be enabled. Would it not be better to remove it entirely?


 I agree with you. I just thought that the only thing a decoder should care
 is its decoding logic, but not including decoder management. My idaea is:
  1) use enabled_protocols to select decoders in ir_raw.c, but not
 placed in decoders to do the judgement.
  2) remove  allowed_protocols or just use it to set the default
 decoder (also should rename allowed_protocols  to default_protocol).

 The default decoder should be the one set by the rc keymap.

 I also have a question:
  Is there a requirement that one more decoders are enabled for a
 IR device at the same time?

 Yes, you want to be able to multiple remotes on the IR device (which
 you can do as long as the scancodes don't overlap, I think), and the
 lirc device is implemented as a decoder, so you might want to see the
 raw IR as well as have it decoded.

 And if that will lead to a issue that each decoder may decode a
 same pulse sequence to different evnets since their protocol is
 different?

 At the moment, no. David Hardeman has sent a patch for this:

 http://patchwork.linuxtv.org/patch/11388/


 Sean
--
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: [Workshop-2011] Media summit/KS-2012 proposals

2012-09-06 Thread Jun Nie
2012/9/6 Hans Verkuil hverk...@xs4all.nl:
 On Thu September 6 2012 06:09:44 Jun Nie wrote:
 2012/9/5 Hans Verkuil hverk...@xs4all.nl:
  On Wed 5 September 2012 10:04:41 Jun Nie wrote:
  Is there any summary for this summit or presentation material? I am
  looking forward for some idea on CEC. It is really complex in
  functionality.
  Maybe other guys is expecting simiar fruite from summit too.
 
  Yes, there will be a summit report. It's not quite finished yet, I think.
 
  With respect to CEC we had some useful discussions. It will have to be a
  new class of device (/dev/cecX), so the userspace API will be separate from
  drm or v4l.
 
  And the kernel will have to take care of the core CEC protocol w.r.t. 
  control
  and discovery due to the HDMI 1.4a requirements.
 
  I plan on starting work on this within 1-2 weeks.
 
  My CEC presentation can be found here:
 
  http://hverkuil.home.xs4all.nl/presentations/v4l2-workshop-cec.odp
 
  Regards,
 
  Hans

 Thanks for quick response! It's good to know that CEC is independent
 with DRM/V4L for my HDMI implementation is FB/lcd-device based. CEC is
 also deserved to have independent management in both hardware signal
 and functionality. Someone also expressed similar thoughts before.
 Will remote control protocal parsing are done in userspace reference
 library? Or not decided yet?

 Are you referring to the remote control pass-through functionality?
 I don't know yet whether that will go through a userspace library or
 through the RC kernel subsystem, or possibly both.
I mean all the feature that can involved in handhold remote control,
one touch play, standby, on screen display, etc, such as
play/pause/poweroff. I want to mention all non CDC features that can
be implemented in user space. They are hard to be covered by any
sub-system and user space library is more proper. Just like your
metaphor, kitchen sink for CEC. I like your words.

 Most of the other non-system messages will go to a userspace library.
Does routing/address is included in system message here?

 But I haven't started coding yet, so it is very early days :-)

 The main thing is that at least I now have a high-level design that
 I can start to work with.

 Regards,

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


Re: Camera not detected on linux-next

2012-09-06 Thread Sylwester Nawrocki
Hi Prabhakar,

On 09/06/2012 11:16 AM, Prabhakar Lad wrote:
 Thanks for the patch.  I too had created one but didnt submit. I guess you 
 will
 post the patch soon to the list.

I've posted it a few days ago, it's already queued in the patchwork:
http://patchwork.linuxtv.org/patch/14046/


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


Re: Camera not detected on linux-next

2012-09-06 Thread Prabhakar Lad
Hi Sylwester,

On Thu, Sep 6, 2012 at 4:19 PM, Sylwester Nawrocki
s.nawro...@samsung.com wrote:
 Hi Prabhakar,

 On 09/06/2012 11:16 AM, Prabhakar Lad wrote:
 Thanks for the patch.  I too had created one but didnt submit. I guess you 
 will
 post the patch soon to the list.

 I've posted it a few days ago, it's already queued in the patchwork:
 http://patchwork.linuxtv.org/patch/14046/

Thanks for pointing.

Regards,
--Prabhakar Lad


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


Re: [Workshop-2011] Media summit/KS-2012 proposals

2012-09-06 Thread Hans Verkuil
On Thu 6 September 2012 12:29:17 Jun Nie wrote:
 2012/9/6 Hans Verkuil hverk...@xs4all.nl:
  On Thu September 6 2012 06:09:44 Jun Nie wrote:
  2012/9/5 Hans Verkuil hverk...@xs4all.nl:
   On Wed 5 September 2012 10:04:41 Jun Nie wrote:
   Is there any summary for this summit or presentation material? I am
   looking forward for some idea on CEC. It is really complex in
   functionality.
   Maybe other guys is expecting simiar fruite from summit too.
  
   Yes, there will be a summit report. It's not quite finished yet, I think.
  
   With respect to CEC we had some useful discussions. It will have to be a
   new class of device (/dev/cecX), so the userspace API will be separate 
   from
   drm or v4l.
  
   And the kernel will have to take care of the core CEC protocol w.r.t. 
   control
   and discovery due to the HDMI 1.4a requirements.
  
   I plan on starting work on this within 1-2 weeks.
  
   My CEC presentation can be found here:
  
   http://hverkuil.home.xs4all.nl/presentations/v4l2-workshop-cec.odp
  
   Regards,
  
   Hans
 
  Thanks for quick response! It's good to know that CEC is independent
  with DRM/V4L for my HDMI implementation is FB/lcd-device based. CEC is
  also deserved to have independent management in both hardware signal
  and functionality. Someone also expressed similar thoughts before.
  Will remote control protocal parsing are done in userspace reference
  library? Or not decided yet?
 
  Are you referring to the remote control pass-through functionality?
  I don't know yet whether that will go through a userspace library or
  through the RC kernel subsystem, or possibly both.

 I mean all the feature that can involved in handhold remote control,
 one touch play, standby, on screen display, etc, such as
 play/pause/poweroff. I want to mention all non CDC features that can
 be implemented in user space. They are hard to be covered by any
 sub-system and user space library is more proper. Just like your
 metaphor, kitchen sink for CEC. I like your words.

Yes, that will all be userspace.

My plan is to have the CEC adapter driver handle the core CEC protocol,
allow other drivers to intercept messages that are relevant for them and
send messages themselves, and anything that remains will be available to
userspace for which a new library will be created.

Now, don't ask me about any of the details, since I don't have them yet :-)
My plan is to start working on this next week or the week after.

Are you willing to test early versions of this work? Can you test HDMI 1.4a
features as well? Testing this might well be one of the harder things to do.

Regards,

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


Question: em28xx and audio inputs?

2012-09-06 Thread Hans Verkuil
Hi all,

I've started work on fixing v4l2-compliance failures in em28xx and I came
across a broken ENUM/G/S_AUDIO implementation.

This is the current implementation:

static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
{
struct em28xx_fh   *fh= priv;
struct em28xx  *dev   = fh-dev;

if (!dev-audio_mode.has_audio)
return -EINVAL;

switch (a-index) {
case EM28XX_AMUX_VIDEO:
strcpy(a-name, Television);
break;
case EM28XX_AMUX_LINE_IN:
strcpy(a-name, Line In);
break;
case EM28XX_AMUX_VIDEO2:
strcpy(a-name, Television alt);
break;
case EM28XX_AMUX_PHONE:
strcpy(a-name, Phone);
break;
case EM28XX_AMUX_MIC:
strcpy(a-name, Mic);
break;
case EM28XX_AMUX_CD:
strcpy(a-name, CD);
break;
case EM28XX_AMUX_AUX:
strcpy(a-name, Aux);
break;
case EM28XX_AMUX_PCM_OUT:
strcpy(a-name, PCM);
break;
default:
return -EINVAL;
}

a-index = dev-ctl_ainput;
a-capability = V4L2_AUDCAP_STEREO;

return 0;
}

static int vidioc_s_audio(struct file *file, void *priv, const struct 
v4l2_audio *a)
{
struct em28xx_fh   *fh  = priv;
struct em28xx  *dev = fh-dev;


if (!dev-audio_mode.has_audio)
return -EINVAL;

if (a-index = MAX_EM28XX_INPUT)
return -EINVAL;
if (0 == INPUT(a-index)-type)
return -EINVAL;

dev-ctl_ainput = INPUT(a-index)-amux;
dev-ctl_aoutput = INPUT(a-index)-aout;

if (!dev-ctl_aoutput)
dev-ctl_aoutput = EM28XX_AOUT_MASTER;

return 0;
}

The g_audio implementation is wrong because it has a switch on a-index instead
of on dev-ctl_ainput. That's easy enough to fix, but s_audio is a real problem:
it interprets a-index as an input index instead of as an audio input index.

In addition, ctl_ainput does not have to be an EM28XX_AMUX_* index, as some
boards use an msp34xx instead.

I see a number of possible solutions:

1) Just delete the audio input support. Clearly nobody has used this code.
2) Don't implement audio input support if the msp3400 is used, otherwise
allow the user to set the em28xx AMUX to any of the possible values.
3) Don't implement audio input support if the msp3400 is used, otherwise
allow the user to set the em28xx AMUX to any of the values supported by
the list of inputs for that board.

The difference between 2 and 3 is that with 2 you can select e.g. a CD
input, even though it is unlikely that it is hooked up to something.

I have no idea whether that would make sense or not. I'm inclined to do
either 1 or 3.

Any em28xx that can shed some light on this?

Regards,

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


Re: [PATCH 10/12] [media] move i2c files into drivers/media/i2c

2012-09-06 Thread Mauro Carvalho Chehab
Em 24-08-2012 20:44, Sylwester Nawrocki escreveu:
 From: Sylwester Nawrocki sylvester.nawro...@gmail.com
 Date: Sat, 25 Aug 2012 01:23:14 +0200
 Subject: [PATCH] [media] Fix link order of the V4L2 bridge and I2C modules
 
 All I2C modules must be linked first to ensure proper module
 initialization order. With platform devices linked before I2C
 modules I2C subdev registration fails as the subdev drivers
 are not yet initialized during bridge driver's probing.
 
 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.
 
 Signed-off-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
 ---
  drivers/media/Makefile |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..92a8bcf 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -8,8 +8,9 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
obj-$(CONFIG_MEDIA_SUPPORT) += media.o
  endif
  
 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-y += common/ rc/ i2c/
 +obj-y += tuners/ platform/ pci/ usb/ mmc/ firewire/ parport/
  
 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 +obj-$(CONFIG_VIDEO_DEV) += radio/
  obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/
 -- 1.7.4.1

Hmm... This change seems incomplete on my eyes: tuners and dvb-frontends
are also I2C drivers. So, while this fixes the issue for platform drivers,
other drivers will still suffer this issue, at least on drivers that doesn't
depend on drivers located outside the media subsystem[1]

[1] thankfully, staging compiles after media, so the drivers there
shouldn't be affected. Also, drivers that use alsa won't be affected, as
alsa core (with is compiled after media) uses subsys_initcall().

IMO, the correct fix is the one below. Could you please test it?

Regards,
Mauro

-

[media] Fix init order for I2C drivers

Based on a patch from Sylvester Nawrocki

This fixes regression introduced with commmit cb7a01ac324bf2ee2,
[media] move i2c files into drivers/media/i2c.

The linked order affect what drivers will be initialized first, when
they're built-in at Kernel. While there are macros that allow changing
the init order, like subsys_initcall(), late_initcall()  friends,
when all drivers  linked belong to the same subsystem, it is easier
to change the order at the Makefile.

All I2C modules must be linked before any drivers that actually use it,
in order to ensure proper module initialization order.

Also, the core drivers should be initialized before the drivers that use
them.

This patch reorders the drivers init, in order to fulfill the above
requirements.

Reported-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index b0b0193..620f275 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -4,12 +4,30 @@
 
 media-objs := media-device.o media-devnode.o media-entity.o
 
+#
+# I2C drivers should come before other drivers, otherwise they'll fail
+# when compiled as builtin drivers
+#
+obj-y += i2c/ tuners/
+obj-$(CONFIG_DVB_CORE)  += dvb-frontends/
+
+#
+# Now, let's link-in the media core
+#
 ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
   obj-$(CONFIG_MEDIA_SUPPORT) += media.o
 endif
 
-obj-y += tuners/ common/ rc/ platform/
-obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
+obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
+obj-$(CONFIG_DVB_CORE)  += dvb-core/
+
+# There are both core and drivers at RC subtree - merge before drivers
+obj-y += rc/
+
+#
+# Finally, merge the drivers that require the core
+#
+
+obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ parport/
+obj-$(CONFIG_VIDEO_DEV) += radio/
 
-obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
-obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/


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


Re: [RFC PATCH v5] media: add v4l2 subdev driver for S5K4ECGX sensor

2012-09-06 Thread Sangwook Lee
Hi Sylwester

Thank you for the review again.

On 5 September 2012 22:56, Sylwester Nawrocki
sylvester.nawro...@gmail.com wrote:
 Hi Sangwook,

 On 09/05/2012 02:28 PM, Sangwook Lee wrote:
[snip]
 +#includelinux/vmalloc.h

 What do we need this header for ?

Ok, let me delete this.


 +
 +#includemedia/media-entity.h
 +#includemedia/s5k4ecgx.h
 +#includemedia/v4l2-ctrls.h
 +#includemedia/v4l2-device.h
 +#includemedia/v4l2-mediabus.h
 +#includemedia/v4l2-subdev.h
 ...
 +
 +static int s5k4ecgx_set_ahb_address(struct v4l2_subdev *sd)
 +{
 + int ret;
 + struct i2c_client *client = v4l2_get_subdevdata(sd);
 +
 + /* Set APB peripherals start address */
 + ret = s5k4ecgx_i2c_write(client, AHB_MSB_ADDR_PTR, GEN_REG_OFFSH);
 + if (ret)
 + return ret;
 + /*
 +  * FIXME: This is copied from s5k6aa, because of no information
 +  * in s5k4ecgx's datasheet.
 +  * sw_reset is activated to put device into idle status
 +  */
 + ret = s5k4ecgx_i2c_write(client, 0x0010, 0x0001);
 + if (ret)
 + return ret;
 +
 + /* FIXME: no information available about this register */

 Let's drop that comment, we will fix all magic numbers once proper
 documentation is available.

Ok.


 + ret = s5k4ecgx_i2c_write(client, 0x1030, 0x);
 + if (ret)
 + return ret;
 + /* Halt ARM CPU */
 + ret = s5k4ecgx_i2c_write(client, 0x0014, 0x0001);
 +
 + return ret;

 Just do

 return s5k4ecgx_i2c_write(client, 0x0014, 0x0001);

OK, I will fix this.

 +}
 +
 +#define FW_HEAD 6
 +/* Register address, value are 4, 2 bytes */
 +#define FW_REG_SIZE 6

 FW_REG_SIZE is a bit confusing, maybe we could name this FW_RECORD_SIZE
 or something similar ?

Fair enough


 +/*
 + * Firmware has the following format:
 + *total number of records (4-bytes + 2-bytes padding) N,  record 0,
 + *  record N - 1,  CRC32-CCITT (4-bytes)
 + * where record is a 4-byte register address followed by 2-byte
 + * register value (little endian)
 + */
 +static int s5k4ecgx_load_firmware(struct v4l2_subdev *sd)
 +{
 + const struct firmware *fw;
 + int err, i, regs_num;
 + struct i2c_client *client = v4l2_get_subdevdata(sd);
 + u16 val;
 + u32 addr, crc, crc_file, addr_inc = 0;
 + u8 *fwbuf;
 +
 + err = request_firmware(fw, S5K4ECGX_FIRMWARE, sd-v4l2_dev-dev);
 + if (err) {
 + v4l2_err(sd, Failed to read firmware %s\n, 
 S5K4ECGX_FIRMWARE);
 + goto fw_out1;

 return err;

OK, I will fix this.


 ?
 + }
 + fwbuf = kmemdup(fw-data, fw-size, GFP_KERNEL);

 Why do we need this kmemdup ? Couldn't we just use fw-data ?

OK,  Iet me reconsider this.


 + if (!fwbuf) {
 + err = -ENOMEM;
 + goto fw_out2;
 + }
 + crc_file = *(u32 *)(fwbuf + regs_num * FW_REG_SIZE);

 regs_num is uninitialized ?

 + crc = crc32_le(~0, fwbuf, regs_num * FW_REG_SIZE);
 + if (crc != crc_file) {
 + v4l2_err(sd, FW: invalid crc (%#x:%#x)\n, crc, crc_file);
 + err = -EINVAL;
 + goto fw_out3;
 + }
 + regs_num = *(u32 *)(fwbuf);

 I guess this needs to be moved up. I would make it

 regs_num = le32_to_cpu(*(u32 *)fw-data);

 And perhaps we need a check like:

 if (fw-size  regs_num * FW_REG_SIZE)
 return -EINVAL;
 ?
 + v4l2_dbg(3, debug, sd, FW: %s size %d register sets %d\n,
 +  S5K4ECGX_FIRMWARE, fw-size, regs_num);
 + regs_num++; /* Add header */
 + for (i = 1; i  regs_num; i++) {
 + addr = *(u32 *)(fwbuf + i * FW_REG_SIZE);
 + val = *(u16 *)(fwbuf + i * FW_REG_SIZE + 4);

 I think you need to access addr and val through le32_to_cpu() as well,
 even though your ARM system might be little-endian by default, this
 driver could possibly be used on machines with different endianness.

 Something like this could be more optimal:

 const u8 *ptr = fw-data + FW_REG_SIZE;

 for (i = 1; i  regs_num; i++) {
 addr = le32_to_cpu(*(u32 *)ptr);
 ptr += 4;
 val = le16_to_cpu(*(u16 *)ptr);
 ptr += FW_REG_SIZE;


Thanks for your advice. I will take le32(16)_to_cpu.


 + if (addr - addr_inc != 2)
 + err = s5k4ecgx_write(client, addr, val);
 + else
 + err = s5k4ecgx_i2c_write(client, REG_CMDBUF0_ADDR, 
 val);
 + if (err)
 + goto fw_out3;

 nit: break instead of goto ?
Ok, I will fix this.


 + addr_inc = addr;
 + }
 +fw_out3:
 + kfree(fwbuf);
 +fw_out2:
 + release_firmware(fw);
 +fw_out1:
 +
 + return err;
 +}
 ...
 +static int s5k4ecgx_init_sensor(struct v4l2_subdev *sd)
 +{
 + int ret;
 +
 + ret = s5k4ecgx_set_ahb_address(sd);
 + /* The delay is from manufacturer's settings */
 + msleep(100);
 +
 + ret |= s5k4ecgx_load_firmware(sd);

 if (!ret)
 ret 

[RFC PATCH v6] media: add v4l2 subdev driver for S5K4ECGX sensor

2012-09-06 Thread Sangwook Lee
This patch adds driver for S5K4ECGX sensor with embedded ISP SoC,
S5K4ECGX, which is a 5M CMOS Image sensor from Samsung
The driver implements preview mode of the S5K4ECGX sensor.
capture (snapshot) operation, face detection are missing now.
Following controls are supported:
contrast/saturation/brightness/sharpness

Signed-off-by: Sangwook Lee sangwook@linaro.org
Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
---
Changes since v5:
- deleted dummy lines
- fixed pointer errors in handling firmware
- updated comments
- added le32_to_cpu,le16_to_cpu

Changes since v4:
- replaced register tables with the function from Sylwester
- updated firmware parsing function with CRC32 check
  firmware generator from user space:
  git://git.linaro.org/people/sangwook/fimc-v4l2-app.git

Changes since v3:
- used request_firmware to configure initial settings
- added parsing functions to read initial settings
- updated regulator API
- reduced preview setting tables by experiment

Changes since v2:
- added GPIO (reset/stby) and regulators
- updated I2C read/write, based on s5k6aa datasheet
- fixed set_fmt errors
- reduced register tables a bit
- removed vmalloc

Changes since v1:
- fixed s_stream(0) when it called twice
- changed mutex_X position to be used when strictly necessary
- add additional s_power(0) in case that error happens
- update more accurate debugging statements
- remove dummy else

 drivers/media/i2c/Kconfig|7 +
 drivers/media/i2c/Makefile   |1 +
 drivers/media/i2c/s5k4ecgx.c | 1011 ++
 include/media/s5k4ecgx.h |   37 ++
 4 files changed, 1056 insertions(+)
 create mode 100644 drivers/media/i2c/s5k4ecgx.c
 create mode 100644 include/media/s5k4ecgx.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 9a5a059..55b3bbb 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -484,6 +484,13 @@ config VIDEO_S5K6AA
  This is a V4L2 sensor-level driver for Samsung S5K6AA(FX) 1.3M
  camera sensor with an embedded SoC image signal processor.
 
+config VIDEO_S5K4ECGX
+tristate Samsung S5K4ECGX sensor support
+depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
+---help---
+  This is a V4L2 sensor-level driver for Samsung S5K4ECGX 5M
+  camera sensor with an embedded SoC image signal processor.
+
 source drivers/media/i2c/smiapp/Kconfig
 
 comment Flash devices
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 088a460..a720812 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
 obj-$(CONFIG_VIDEO_SR030PC30)  += sr030pc30.o
 obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
 obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
+obj-$(CONFIG_VIDEO_S5K4ECGX)   += s5k4ecgx.o
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
new file mode 100644
index 000..66107c8
--- /dev/null
+++ b/drivers/media/i2c/s5k4ecgx.c
@@ -0,0 +1,1011 @@
+/*
+ * Driver for s5k4ecgx (5MP Camera) from Samsung
+ * a quarter-inch optical format 1.4 micron 5 megapixel (Mp)
+ * CMOS image sensor.
+ *
+ * Copyright (C) 2012, Linaro, Sangwook Lee sangwook@linaro.org
+ * Copyright (C) 2012, Insignal Co,. Ltd,  Homin Lee suap...@insignal.co.kr
+ *
+ * Based on s5k6aa, noon010pc30 driver
+ * Copyright (C) 2011, Samsung Electronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include linux/clk.h
+#include linux/crc32.h
+#include linux/ctype.h
+#include linux/delay.h
+#include linux/firmware.h
+#include linux/gpio.h
+#include linux/i2c.h
+#include linux/module.h
+#include linux/regulator/consumer.h
+#include linux/slab.h
+
+#include media/media-entity.h
+#include media/s5k4ecgx.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+#include media/v4l2-mediabus.h
+#include media/v4l2-subdev.h
+
+static int debug;
+module_param(debug, int, 0644);
+
+#define S5K4ECGX_DRIVER_NAME   s5k4ecgx
+#define S5K4ECGX_FIRMWARE  s5k4ecgx.bin
+
+/* Firmware revision information */
+#define REG_FW_REVISION0x71a6
+#define REG_FW_VERSION 0x71a4
+#define S5K4ECGX_REVISION_1_1  0x11
+#define S5K4ECGX_FW_VERSION0x4ec0
+
+/* General purpose parameters */
+#define REG_USER_BRIGHTNESS0x722c
+#define REG_USER_CONTRAST  0x722e
+#define REG_USER_SATURATION0x7230
+
+#define REG_G_NEW_CFG_SYNC 0x724a
+#define REG_G_PREV_IN_WIDTH0x7250
+#define REG_G_PREV_IN_HEIGHT  

pac7302-webcams and libv4lconvert interaction

2012-09-06 Thread Frank Schäfer

Hi,

I'm currently looking into the gspca_pac7302-driver and how it interacts
with libv4lconvert.
This is how it currently works
- driver announces v4l2_pix_format 640x480 (width x height)
- the frames (jpeg) passed to userspace are encoded as 480x640 and this
complies with the jpeg-header we generate
- libv4lconvert checks width/height in the jpeg-header and compares them
with the image format announced by the kernel:
   a) values are the same:
  1) V4LCONTROL_ROTATED_90_JPEG is NOT set for the device (standard
case):
  = everything is fine, image is decoded
  2) V4LCONTROL_ROTATED_90_JPEG is set for the device:
  = libv4lconvert bails out with -EIO displaying the error
message unexpected width / height in JPEG header: expected: 640x480,
header: 480x640
   b) values are different:
  1) V4LCONTROL_ROTATED_90_JPEG is NOT set:
  = libv4lconvert bails out with -EIO displaying the error
message unexpected width / height in JPEG header: expected: 640x480,
header: 480x640
  2) V4LCONTROL_ROTATED_90_JPEG is set:
  = image is decoded and rotated correctly


Thinking about this for some minutes:

1) shouldn't the kernel always announce the real image format (size) of
the data it passes to userspace ?
Current behavior seems inconsistent to me...
Announcing the actual image size allows applications which trust the API
value more than the value in the frame header to decode the image
correctly without using libv4lconvert (although the image would still be
rotated).

2) shouldn't libv4lconvert always rotate the image if
V4LCONTROL_ROTATED_90_JPEG is set for a device ?
It seems like a2) is a bug, because the expected size should be 640x480,
too.

3) because all pac7302 devices are sending rotated image data, we should
add them ALL to libv4lconvert. Currently only 4 of the 14 devices are on
the list.
Do you want me to send a patch ?


What do you think ?

Regards,
Frank

--
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] drivers/media/pci/ttpci/budget-av.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/pci/ttpci/budget-av.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/ttpci/budget-av.c 
b/drivers/media/pci/ttpci/budget-av.c
index 12ddb53..1f8b1bb 100644
--- a/drivers/media/pci/ttpci/budget-av.c
+++ b/drivers/media/pci/ttpci/budget-av.c
@@ -1477,8 +1477,8 @@ static int budget_av_attach(struct saa7146_dev *dev, 
struct saa7146_pci_extensio
 
if (saa7113_init(budget_av) == 0) {
budget_av-has_saa7113 = 1;
-
-   if (0 != saa7146_vv_init(dev, vv_data)) {
+   err = saa7146_vv_init(dev, vv_data);
+   if (err != 0) {
/* fixme: proper cleanup here */
ERR(cannot init vv subsystem\n);
return err;

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


[PATCH 4/14] drivers/media/v4l2-core/videobuf2-core.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/v4l2-core/videobuf2-core.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 4da3df6..f6bc240 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -1876,8 +1876,10 @@ static int __vb2_init_fileio(struct vb2_queue *q, int 
read)
 */
for (i = 0; i  q-num_buffers; i++) {
fileio-bufs[i].vaddr = vb2_plane_vaddr(q-bufs[i], 0);
-   if (fileio-bufs[i].vaddr == NULL)
+   if (fileio-bufs[i].vaddr == NULL) {
+   ret = -EFAULT;
goto err_reqbufs;
+   }
fileio-bufs[i].size = vb2_plane_size(q-bufs[i], 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 14/14] drivers/media/usb/gspca/cpia1.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/usb/gspca/cpia1.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c
index 2499a88..b3ba47d 100644
--- a/drivers/media/usb/gspca/cpia1.c
+++ b/drivers/media/usb/gspca/cpia1.c
@@ -751,7 +751,7 @@ static int goto_high_power(struct gspca_dev *gspca_dev)
if (signal_pending(current))
return -EINTR;
 
-   do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);
+   ret = do_command(gspca_dev, CPIA_COMMAND_GetCameraStatus, 0, 0, 0, 0);
if (ret)
return ret;
 

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


[PATCH 2/14] drivers/media/platform/soc_camera/mx2_camera.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/platform/soc_camera/mx2_camera.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/mx2_camera.c 
b/drivers/media/platform/soc_camera/mx2_camera.c
index 256187f..f8884a7 100644
--- a/drivers/media/platform/soc_camera/mx2_camera.c
+++ b/drivers/media/platform/soc_camera/mx2_camera.c
@@ -1800,13 +1800,16 @@ static int __devinit mx2_camera_probe(struct 
platform_device *pdev)
 
if (!res_emma || !irq_emma) {
dev_err(pdev-dev, no EMMA resources\n);
+   err = -ENODEV;
goto exit_free_irq;
}
 
pcdev-res_emma = res_emma;
pcdev-irq_emma = irq_emma;
-   if (mx27_camera_emma_init(pcdev))
+   if (mx27_camera_emma_init(pcdev)) {
+   err = -ENODEV;
goto exit_free_irq;
+   }
}
 
pcdev-soc_host.drv_name= MX2_CAM_DRV_NAME,

--
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/14] drivers/media/platform/soc_camera/soc_camera.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/platform/soc_camera/soc_camera.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index 10b57f8..a4beb6c 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1184,7 +1184,8 @@ static int soc_camera_probe(struct soc_camera_device *icd)
sd-grp_id = soc_camera_grp_id(icd);
v4l2_set_subdev_hostdata(sd, icd);
 
-   if (v4l2_ctrl_add_handler(icd-ctrl_handler, sd-ctrl_handler))
+   ret = v4l2_ctrl_add_handler(icd-ctrl_handler, sd-ctrl_handler);
+   if (ret)
goto ectrl;
 
/* At this point client .probe() should have run already */

--
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/14] drivers/media/platform/blackfin/bfin_capture.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/platform/blackfin/bfin_capture.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 1677623..cb2eb26 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -968,6 +968,7 @@ static int __devinit bcap_probe(struct platform_device 
*pdev)
if (!i2c_adap) {
v4l2_err(bcap_dev-v4l2_dev,
Unable to find i2c adapter\n);
+   ret = -ENODEV;
goto err_unreg_vdev;
 
}

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


[PATCH 5/14] drivers/media/pci/cx25821/cx25821-video-upstream.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/pci/cx25821/cx25821-video-upstream.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/media/pci/cx25821/cx25821-video-upstream.c 
b/drivers/media/pci/cx25821/cx25821-video-upstream.c
index 52c13e0..b41e57b 100644
--- a/drivers/media/pci/cx25821/cx25821-video-upstream.c
+++ b/drivers/media/pci/cx25821/cx25821-video-upstream.c
@@ -753,7 +753,6 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, 
int channel_select,
 {
struct sram_channel *sram_ch;
u32 tmp;
-   int retval = 0;
int err = 0;
int data_frame_size = 0;
int risc_buffer_size = 0;
@@ -796,15 +795,19 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, 
int channel_select,
dev-_filename = kmemdup(dev-input_filename, str_length + 1,
 GFP_KERNEL);
 
-   if (!dev-_filename)
+   if (!dev-_filename) {
+   err = -ENOENT;
goto error;
+   }
} else {
str_length = strlen(dev-_defaultname);
dev-_filename = kmemdup(dev-_defaultname, str_length + 1,
 GFP_KERNEL);
 
-   if (!dev-_filename)
+   if (!dev-_filename) {
+   err = -ENOENT;
goto error;
+   }
}
 
/* Default if filename is empty string */
@@ -828,7 +831,7 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, 
int channel_select,
dev-_line_size = (dev-_pixel_format == PIXEL_FRMT_422) ?
(WIDTH_D1 * 2) : (WIDTH_D1 * 3) / 2;
 
-   retval = cx25821_sram_channel_setup_upstream(dev, sram_ch,
+   err = cx25821_sram_channel_setup_upstream(dev, sram_ch,
dev-_line_size, 0);
 
/* setup fifo + format */
@@ -838,8 +841,8 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, 
int channel_select,
dev-upstream_databuf_size = data_frame_size * 2;
 
/* Allocating buffers and prepare RISC program */
-   retval = cx25821_upstream_buffer_prepare(dev, sram_ch, dev-_line_size);
-   if (retval  0) {
+   err = cx25821_upstream_buffer_prepare(dev, sram_ch, dev-_line_size);
+   if (err  0) {
pr_err(%s: Failed to set up Video upstream buffers!\n,
   dev-name);
goto error;

--
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] drivers/media/usb/hdpvr/hdpvr-core.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/usb/hdpvr/hdpvr-core.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c 
b/drivers/media/usb/hdpvr/hdpvr-core.c
index 304f43e..84dc26f 100644
--- a/drivers/media/usb/hdpvr/hdpvr-core.c
+++ b/drivers/media/usb/hdpvr/hdpvr-core.c
@@ -401,12 +401,14 @@ static int hdpvr_probe(struct usb_interface *interface,
client = hdpvr_register_ir_rx_i2c(dev);
if (!client) {
v4l2_err(dev-v4l2_dev, i2c IR RX device register failed\n);
+   retval = -ENODEV;
goto reg_fail;
}
 
client = hdpvr_register_ir_tx_i2c(dev);
if (!client) {
v4l2_err(dev-v4l2_dev, i2c IR TX device register failed\n);
+   retval = -ENODEV;
goto reg_fail;
}
 #endif

--
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] drivers/media/usb/tm6000/tm6000-video.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/usb/tm6000/tm6000-video.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/tm6000/tm6000-video.c 
b/drivers/media/usb/tm6000/tm6000-video.c
index 45ed59c..12cc59c 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -1802,6 +1802,7 @@ int tm6000_v4l2_register(struct tm6000_core *dev)
if (!dev-radio_dev) {
printk(KERN_INFO %s: can't register radio device\n,
   dev-name);
+   ret = -ENXIO;
return ret; /* FIXME release resource */
}
 

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


[PATCH 6/14] drivers/media/pci/dm1105/dm1105.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/pci/dm1105/dm1105.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/dm1105/dm1105.c 
b/drivers/media/pci/dm1105/dm1105.c
index a609b3a..f147031 100644
--- a/drivers/media/pci/dm1105/dm1105.c
+++ b/drivers/media/pci/dm1105/dm1105.c
@@ -1128,8 +1128,10 @@ static int __devinit dm1105_probe(struct pci_dev *pdev,
INIT_WORK(dev-work, dm1105_dmx_buffer);
sprintf(dev-wqn, %s/%d, dvb_adapter-name, dvb_adapter-num);
dev-wq = create_singlethread_workqueue(dev-wqn);
-   if (!dev-wq)
+   if (!dev-wq) {
+   ret = -ENOMEM;
goto err_dvb_net;
+   }
 
ret = request_irq(pdev-irq, dm1105_irq, IRQF_SHARED,
DRIVER_NAME, dev);

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


[PATCH 7/14] drivers/media/pci/ngene/ngene-core.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/pci/ngene/ngene-core.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/ngene/ngene-core.c 
b/drivers/media/pci/ngene/ngene-core.c
index c8e0d5b..6bb44f1 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1691,7 +1691,8 @@ int __devinit ngene_probe(struct pci_dev *pci_dev,
dev-i2c_current_bus = -1;
 
/* Register DVB adapters and devices for both channels */
-   if (init_channels(dev)  0)
+   stat = init_channels(dev);
+   if (stat  0)
goto fail2;
 
return 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 9/14] drivers/media/radio/radio-cadet.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/radio/radio-cadet.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/radio/radio-cadet.c 
b/drivers/media/radio/radio-cadet.c
index 697a421..643d80a 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -645,7 +645,8 @@ static int __init cadet_init(void)
set_bit(V4L2_FL_USE_FH_PRIO, dev-vdev.flags);
video_set_drvdata(dev-vdev, dev);
 
-   if (video_register_device(dev-vdev, VFL_TYPE_RADIO, radio_nr)  0)
+   res = video_register_device(dev-vdev, VFL_TYPE_RADIO, radio_nr);
+   if (res  0)
goto err_hdl;
v4l2_info(v4l2_dev, ADS Cadet Radio Card at 0x%x\n, dev-io);
return 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] drivers/media/i2c/mt9m032.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/i2c/mt9m032.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c
index 445359c..f80c1d7 100644
--- a/drivers/media/i2c/mt9m032.c
+++ b/drivers/media/i2c/mt9m032.c
@@ -781,7 +781,7 @@ static int mt9m032_probe(struct i2c_client *client,
ret = mt9m032_write(client, MT9M032_RESET, 1);  /* reset on */
if (ret  0)
goto error_entity;
-   mt9m032_write(client, MT9M032_RESET, 0);/* reset off */
+   ret = mt9m032_write(client, MT9M032_RESET, 0);  /* reset off */
if (ret  0)
goto error_entity;
 

--
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] drivers/media/usb/stk1160/stk1160-i2c.c: fix error return code

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// smpl
(
if@p1 (\(ret  0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// /smpl

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/usb/stk1160/stk1160-i2c.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
b/drivers/media/usb/stk1160/stk1160-i2c.c
index 176ac93..850cf28 100644
--- a/drivers/media/usb/stk1160/stk1160-i2c.c
+++ b/drivers/media/usb/stk1160/stk1160-i2c.c
@@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
addr,
if (rc  0)
return rc;
 
-   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
+   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
if (rc  0)
return rc;
 

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


[PATCH 6/10] drivers/media/pci/cx88/cx88-blackbird.c: removes unnecessary semicolon

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/pci/cx88/cx88-blackbird.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -u -p a/drivers/media/pci/cx88/cx88-blackbird.c 
b/drivers/media/pci/cx88/cx88-blackbird.c
--- a/drivers/media/pci/cx88/cx88-blackbird.c
+++ b/drivers/media/pci/cx88/cx88-blackbird.c
@@ -721,7 +721,7 @@ static int vidioc_g_fmt_vid_cap (struct
 
f-fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
f-fmt.pix.bytesperline = 0;
-   f-fmt.pix.sizeimage= 188 * 4 * mpegbufs; /* 188 * 4 * 1024; */;
+   f-fmt.pix.sizeimage= 188 * 4 * mpegbufs; /* 188 * 4 * 1024; */
f-fmt.pix.colorspace   = V4L2_COLORSPACE_SMPTE170M;
f-fmt.pix.width= dev-width;
f-fmt.pix.height   = dev-height;
@@ -739,7 +739,7 @@ static int vidioc_try_fmt_vid_cap (struc
 
f-fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
f-fmt.pix.bytesperline = 0;
-   f-fmt.pix.sizeimage= 188 * 4 * mpegbufs; /* 188 * 4 * 1024; */;
+   f-fmt.pix.sizeimage= 188 * 4 * mpegbufs; /* 188 * 4 * 1024; */
f-fmt.pix.colorspace   = V4L2_COLORSPACE_SMPTE170M;
dprintk(1, VIDIOC_TRY_FMT: w: %d, h: %d, f: %d\n,
dev-width, dev-height, fh-mpegq.field );
@@ -755,7 +755,7 @@ static int vidioc_s_fmt_vid_cap (struct
 
f-fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
f-fmt.pix.bytesperline = 0;
-   f-fmt.pix.sizeimage= 188 * 4 * mpegbufs; /* 188 * 4 * 1024; */;
+   f-fmt.pix.sizeimage= 188 * 4 * mpegbufs; /* 188 * 4 * 1024; */
f-fmt.pix.colorspace   = V4L2_COLORSPACE_SMPTE170M;
dev-width  = f-fmt.pix.width;
dev-height = f-fmt.pix.height;

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


[PATCH 5/10] drivers/media/dvb-frontends/itd1000.c: removes unnecessary semicolon

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/dvb-frontends/itd1000.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -u -p a/drivers/media/dvb-frontends/itd1000.c 
b/drivers/media/dvb-frontends/itd1000.c
--- a/drivers/media/dvb-frontends/itd1000.c
+++ b/drivers/media/dvb-frontends/itd1000.c
@@ -231,7 +231,7 @@ static void itd1000_set_lo(struct itd100
state-frequency = ((plln * 1000) + (pllf * 1000)/1048576) * 2*FREF;
itd_dbg(frequency: %dkHz (wanted) %dkHz (set), PLLF = %d, PLLN = 
%d\n, freq_khz, state-frequency, pllf, plln);
 
-   itd1000_write_reg(state, PLLNH, 0x80); /* PLLNH */;
+   itd1000_write_reg(state, PLLNH, 0x80); /* PLLNH */
itd1000_write_reg(state, PLLNL, plln  0xff);
itd1000_write_reg(state, PLLFH, (itd1000_read_reg(state, PLLFH)  0xf0) 
| ((pllf  16)  0x0f));
itd1000_write_reg(state, PLLFM, (pllf  8)  0xff);

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


[PATCH 4/10] drivers/media/dvb-frontends/sp8870.c: removes unnecessary semicolon

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/dvb-frontends/sp8870.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff -u -p a/drivers/media/dvb-frontends/sp8870.c 
b/drivers/media/dvb-frontends/sp8870.c
--- a/drivers/media/dvb-frontends/sp8870.c
+++ b/drivers/media/dvb-frontends/sp8870.c
@@ -188,7 +188,7 @@ static int configure_reg0xc05 (struct dt
break;
default:
return -EINVAL;
-   };
+   }
 
switch (p-hierarchy) {
case HIERARCHY_NONE:
@@ -207,7 +207,7 @@ static int configure_reg0xc05 (struct dt
break;
default:
return -EINVAL;
-   };
+   }
 
switch (p-code_rate_HP) {
case FEC_1_2:
@@ -229,7 +229,7 @@ static int configure_reg0xc05 (struct dt
break;
default:
return -EINVAL;
-   };
+   }
 
if (known_parameters)
*reg0xc05 |= (2  1);  /* use specified parameters */

--
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/10] drivers/media/radio/si4713-i2c.c: removes unnecessary semicolon

2012-09-06 Thread Peter Senna Tschudin
From: Peter Senna Tschudin peter.se...@gmail.com

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com

---
 drivers/media/radio/si4713-i2c.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff -u -p a/drivers/media/radio/si4713-i2c.c b/drivers/media/radio/si4713-i2c.c
--- a/drivers/media/radio/si4713-i2c.c
+++ b/drivers/media/radio/si4713-i2c.c
@@ -1009,7 +1009,7 @@ static int si4713_choose_econtrol_action
 
default:
rval = -EINVAL;
-   };
+   }
 
return rval;
 }
@@ -1081,7 +1081,7 @@ static int si4713_write_econtrol_string(
default:
rval = -EINVAL;
break;
-   };
+   }
 
 exit:
return rval;
@@ -1130,7 +1130,7 @@ static int si4713_write_econtrol_tune(st
default:
rval = -EINVAL;
goto unlock;
-   };
+   }
 
if (sdev-power_state)
rval = si4713_tx_tune_power(sdev, power, antcap);
@@ -1420,7 +1420,7 @@ static int si4713_read_econtrol_string(s
default:
rval = -EINVAL;
break;
-   };
+   }
 
 exit:
return rval;
@@ -1473,7 +1473,7 @@ static int si4713_read_econtrol_tune(str
break;
default:
rval = -EINVAL;
-   };
+   }
 
 unlock:
mutex_unlock(sdev-mutex);
@@ -1698,7 +1698,7 @@ static int si4713_queryctrl(struct v4l2_
default:
rval = -EINVAL;
break;
-   };
+   }
 
return rval;
 }

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


Using omap3-isp-live example application on beagleboard with DVI

2012-09-06 Thread John Weber
Hello,

My goal is to better understand how to write an application that makes use
of the omap3isp and media controller frameworks and v4l2.  I'm attempting to
make use of Laurent's omap3-isp-live example application as a starting point
and play with the AEC/WB capability.

My problem is that when I start the live application, the display turns blue
(it seems when the chromakey fill is done), but no video appears on the
display.  I do think that I'm getting good (or at least statistics) from the
ISP because I can change the view in front of the camera (by putting my hand
in front of the lens) and the gain settings change.

root@beagleboard:~# live

Device /dev/video6 opened: OMAP3 ISP resizer output (media).

viewfinder configured for 2011 1024x768

AEWB: #win 10x7 start 16x74 size 256x256 inc 30x30

Device /dev/video7 opened: omap_vout ().

3 buffers requested.

Buffer 0 mapped at address 0x40279000.

Buffer 1 mapped at address 0x40402000.

Buffer 2 mapped at address 0x4059e000.

3 buffers requested.

Buffer 0 valid.

Buffer 1 valid.

Buffer 2 valid.

AE: factor 3.1250 exposure 2000 sensor gain 12

AE: factor 1.6018 exposure 2000 sensor gain 19

AE: factor 1.1346 exposure 2000 sensor gain 21

AE: factor 1.0446 exposure 2000 sensor gain 21

AE: factor 1.0448 exposure 2000 sensor gain 21

AE: factor 1.0444 exposure 2000 sensor gain 21

AE: factor 1.0443 exposure 2000 sensor gain 21

AE: factor 1.0445 exposure 2000 sensor gain 21

AE: factor 1.0438 exposure 2000 sensor gain 21

AE: factor 1.0448 exposure 2000 sensor gain 21

AE: factor 1.0461 exposure 2000 sensor gain 21

AE: factor 1.0897 exposure 2000 sensor gain 22

AE: factor 2.6543 exposure 2000 sensor gain 58  Me obstructing the
camera FOV using my hand causes the factor and gain to rise

AE: factor 1.2345 exposure 2000 sensor gain 71   

AE: factor 1.1631 exposure 2000 sensor gain 82   

AE: factor 0.9797 exposure 2000 sensor gain 80   

AE: factor 0.9709 exposure 2000 sensor gain 77   

frame rate: 6.597745 fps

AE: factor 0.9633 exposure 2000 sensor gain 74   

AE: factor 0.6130 exposure 2000 sensor gain 45   

AE: factor 0.9271 exposure 2000 sensor gain 41   

AE: factor 1.0130 exposure 2000 sensor gain 41   

AE: factor 1.0504 exposure 2000 sensor gain 43   

AE: factor 1.0411 exposure 2000 sensor gain 44   

AE: factor 1.0271 exposure 2000 sensor gain 45   

AE: factor 1.0602 exposure 2000 sensor gain 47   

AE: factor 1.1278 exposure 2000 sensor gain 53   

AE: factor 1.1870 exposure 2000 sensor gain 62   

AE: factor 1.1074 exposure 2000 sensor gain 68   

AE: factor 1.0716 exposure 2000 sensor gain 72   

AE: factor 0.4074 exposure 2000 sensor gain 29   

AE: factor 0.8033 exposure 2000 sensor gain 23

AE: factor 0.9741 exposure 2000 sensor gain 22

AE: factor 1.0115 exposure 2000 sensor gain 22


I did have to change the omap_vout driver slightly to increase the buffer
size.  I was getting errors in the application attempted to allocate USERPTR
buffers for 1024x768 frames:

root@beagleboard:~# live

Device /dev/video6 opened: OMAP3 ISP resizer output (media).

viewfinder configured for 2011 1024x768

AEWB: #win 10x7 start 16x74 size 256x256 inc 30x30

Device /dev/video7 opened: omap_vout ().

3 buffers requested.

Buffer 0 mapped at address 0x40302000.

Buffer 1 mapped at address 0x404df000.

Buffer 2 mapped at address 0x4066e000.

3 buffers requested.

Buffer 0 too small (1572864 bytes required, 1474560 bytes available.)  

So, I changed drivers/media/video/omap/omap_voutdef.h to increase the buffer
size slightly.

/* Max Resolution supported by the driver */
#define VID_MAX_WIDTH   1280/* Largest width */
#define VID_MAX_HEIGHT  768 /* Largest height */ -- Was 720

I'm pretty sure that wasn't the only way to solve the problem, but it did
allow the live application to run without errors.

I am using a patched variant of the current Angstrom mainline (3.2.16) with
the MT9P031 sensor and a DVI display on Beagleboard-xM and am able to run
the following commands and see a live video stream on the display.  I
suspect that this indicates that hardware setup works:

media-ctl -v -r -l 'mt9p031 2-0048:0-OMAP3 ISP CCDC:0[1], OMAP3 ISP
CCDC:2-OMAP3 ISP preview:0[1], OMAP3 ISP preview:1-OMAP3 ISP
resizer:0[1], OMAP3 ISP resizer:1-OMAP3 ISP resizer output:0[1]'

media-ctl -v -f 'mt9p031 2-0048:0 [SGRBG12 1024x768], OMAP3 ISP CCDC:2
[SGRBG10 1024x768], OMAP3 ISP preview:1 [UYVY 10006x760], OMAP3 ISP
resizer:1 [UYVY 1024x768]'

yavta -f UYVY -s 1024x768 -n 8 --skip 3 --capture=1000 --stdout /dev/video6
| mplayer - -demuxer rawvideo -rawvideo w=1024:h=768:format=uyvy -vo fbdev

Thanks for any tips or assistance!

John

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


Integrate camera interface of OMAP3530 in Angstrom Linux

2012-09-06 Thread Andreas Nagel

Hello,

I am using an embedded module called TAO-3530 from Technexion, which has 
an OMAP3530 processor.
This processor has a camera interface, which is part of the ISP 
submodule. For an ongoing project I want to capture a video signal from 
this interface. After several days of excessive research I still don't 
know, how to access it.
I configured the Angstrom kernel (2.6.32), so that the driver for OMAP 3 
camera controller (and all other OMAP 3 related things) is integrated, 
but I don't see any new device nodes in the filesystem.


I also found some rumors, that the Media Controller Framework or driver 
provides the device node /dev/media0, but I was not able to install it.
I use OpenEmbedded, but I don't have a recipe for Media Controller. On 
the Angstrom website ( http://www.angstrom-distribution.org/repo/ ) 
there's actually a package called media-ctl, but due to the missing 
recipe, i can't install it. Can't say, I am an expert in OE.


Can you help me point out, what's necessary to make the camera interface 
accessible?


Best regards,
Andreas

--
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: go7007 question

2012-09-06 Thread Volokh Konstantin
On Mon, Sep 03, 2012 at 02:37:16PM -0400, Adam Rosi-Kessel wrote:
 Hi:
 
 I've been searching around for help with go7007 on a Plextor device
 (PX-TV402U) and can't find any forum for questions/help. You seem to
 be active in development--wondering if you might have any tips.
 
 I'm running 3.2.23, using the go7007 drivers from your
 wis-go7007-3.2.11.patch.
I found that it very old patch and it don`t recover existing problems on new 
linux brunch
 
 When I try to run gorecord, it can't find the audio device (Unable
 to find associated ALSA device node).
 
 If I manually specify an audio device, I get this:
 
 gorecord -vdevice /dev/video0 -adevice /dev/dsp -format mpeg4 test.avi
 
 Unable to open /dev/video0: Device or resource busy
 
 
 There seems to be a kernel oops of sort when I connect the USB device:
 
 [469.653440] go7007-usb: probing new GO7007 USB board
 
 [469.909932] go7007: registering new Plextor PX-TV402U-NA
 
 [469.909987] go7007: registered device video0 [v4l2]
 
 [469.928881] wis-saa7115: initializing SAA7115 at address 32 on WIS
 GO7007SB EZ-USB
 
 [469.989083] go7007: probing for module i2c:wis_saa7115 failed
 
 [470.004785] wis-uda1342: initializing UDA1342 at address 26 on WIS
 GO7007SB EZ-USB
 
 [470.005454] go7007: probing for module i2c:wis_uda1342 failed
 
 [470.011659] wis-sony-tuner: initializing tuner at address 96 on WIS
 GO7007SB EZ-USB
 
 [470.011676] Modules linked in: wis_sony_tuner(O) wis_uda1342(O)
 wis_saa7115(O) go7007_usb(O+) go7007(O) v4l2_common videodev media
 cpufreq_conservative cpufreq_powersave cpufreq_stats
 cpufreq_userspace parport_pc ppdev lp parport ipt_MASQUERADE
 xt_tcpudp ipt_REDIRECT xt_conntrack iptable_mangle nf_conntrack_ftp
 ipt_REJECT ipt_LOG xt_limit xt_multiport xt_state iptable_nat nf_nat
 nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 iptable_filter
 ip_tables x_tables bridge stp bnep rfcomm bluetooth rfkill radeon
 ttm drm_kms_helper drm i2c_algo_bit power_supply binfmt_misc
 dm_snapshot dm_mirror dm_region_hash dm_log dm_mod fuse nfsd nfs
 lockd fscache auth_rpcgss nfs_acl sunrpc hwmon_vid
 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec
 snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm tpm_tis tpm snd_seq_midi
 snd_rawmidi snd_seq_midi_event snd_seq acpi_cpufreq mperf snd_timer
 snd_seq_device i2c_i801 serio_raw evdev i2c_core coretemp dcdbas
 pcspkr tpm_bios snd soundcore processor snd_page_alloc button ext4
 mbcache jbd2 crc16 sg sr_mod cdrom sd_mod crc_t10dif usb_storage uas
 ata_generic uhci_hcd ata_piix libata ehci_hcd r8169 mii floppy
 scsi_mod usbcore usb_common e1000e thermal fan thermal_sys [last
 unloaded: scsi_wait_scan]
 
 [470.011810][f988fdf7] ? go7007_register_encoder+0xbf/0x11a [go7007]
 
 [470.011816][f9872c5c] ? go7007_usb_probe+0x47c/0x60c [go7007_usb]
When driver probes I found bug that i2c_subdev not init properly
 
 [470.011932] Modules linked in: wis_sony_tuner(O) wis_uda1342(O)
 wis_saa7115(O) go7007_usb(O+) go7007(O) v4l2_common videodev media
 cpufreq_conservative cpufreq_powersave cpufreq_stats
 cpufreq_userspace parport_pc ppdev lp parport ipt_MASQUERADE
 xt_tcpudp ipt_REDIRECT xt_conntrack iptable_mangle nf_conntrack_ftp
 ipt_REJECT ipt_LOG xt_limit xt_multiport xt_state iptable_nat nf_nat
 nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 iptable_filter
 ip_tables x_tables bridge stp bnep rfcomm bluetooth rfkill radeon
 ttm drm_kms_helper drm i2c_algo_bit power_supply binfmt_misc
 dm_snapshot dm_mirror dm_region_hash dm_log dm_mod fuse nfsd nfs
 lockd fscache auth_rpcgss nfs_acl sunrpc hwmon_vid
 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel snd_hda_codec
 snd_hwdep snd_pcm_oss snd_mixer_oss snd_pcm tpm_tis tpm snd_seq_midi
 snd_rawmidi snd_seq_midi_event snd_seq acpi_cpufreq mperf snd_timer
 snd_seq_device i2c_i801 serio_raw evdev i2c_core coretemp dcdbas
 pcspkr tpm_bios snd soundcore processor snd_page_alloc button ext4
 mbcache jbd2 crc16 sg sr_mod cdrom sd_mod crc_t10dif usb_storage uas
 ata_generic uhci_hcd ata_piix libata ehci_hcd r8169 mii floppy
 scsi_mod usbcore usb_common e1000e thermal fan thermal_sys [last
 unloaded: scsi_wait_scan]
 
 [470.012070][f988fdf7] ? go7007_register_encoder+0xbf/0x11a [go7007]
 
 [470.012075][f9872c5c] ? go7007_usb_probe+0x47c/0x60c [go7007_usb]
 
 Thanks in advance for any pointers!
 
I recommend to try to use latest patches:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50930.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50931.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50923.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50922.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50924.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50929.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50926.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50925.html
http://www.mail-archive.com/linux-media@vger.kernel.org/msg50928.html

cron job: media_tree daily build: WARNINGS

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

Results of the daily build of media_tree:

date:Thu Sep  6 19:00:20 CEST 2012
git hash:79e8c7bebb467bbc3f2514d75bba669a3f354324
gcc version:  i686-linux-gcc (GCC) 4.7.1
host hardware:x86_64
host os:  3.4.07-marune

linux-git-arm-eabi-davinci: WARNINGS
linux-git-arm-eabi-exynos: OK
linux-git-arm-eabi-omap: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: WARNINGS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: 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-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
linux-3.4-x86_64: WARNINGS
linux-3.5-x86_64: WARNINGS
linux-3.6-rc2-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-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-3.4-i686: WARNINGS
linux-3.5-i686: WARNINGS
linux-3.6-rc2-i686: WARNINGS
apps: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

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

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


Re: [PATCH 10/12] [media] move i2c files into drivers/media/i2c

2012-09-06 Thread Sylwester Nawrocki
On 09/06/2012 04:07 PM, Mauro Carvalho Chehab wrote:
 Em 24-08-2012 20:44, Sylwester Nawrocki escreveu:
 From: Sylwester Nawrockisylvester.nawro...@gmail.com
 Date: Sat, 25 Aug 2012 01:23:14 +0200
 Subject: [PATCH] [media] Fix link order of the V4L2 bridge and I2C modules

 All I2C modules must be linked first to ensure proper module
 initialization order. With platform devices linked before I2C
 modules I2C subdev registration fails as the subdev drivers
 are not yet initialized during bridge driver's probing.

 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.

 Signed-off-by: Sylwester Nawrockisylvester.nawro...@gmail.com
 ---
   drivers/media/Makefile |7 ---
   1 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..92a8bcf 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -8,8 +8,9 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
 obj-$(CONFIG_MEDIA_SUPPORT) += media.o
   endif

 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-y += common/ rc/ i2c/
 +obj-y += tuners/ platform/ pci/ usb/ mmc/ firewire/ parport/

 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 +obj-$(CONFIG_VIDEO_DEV) += radio/
   obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/
 -- 1.7.4.1
 
 Hmm... This change seems incomplete on my eyes: tuners and dvb-frontends
 are also I2C drivers. So, while this fixes the issue for platform drivers,
 other drivers will still suffer this issue, at least on drivers that doesn't
 depend on drivers located outside the media subsystem[1]

Yeah, that's possible. I wasn't very confident about anything but platform 
and i2c drivers. Thanks for improving it. I tested the patch with a camera 
host and I2C sensor driver and it also fixed the problem.

 [1] thankfully, staging compiles after media, so the drivers there
 shouldn't be affected. Also, drivers that use alsa won't be affected, as
 alsa core (with is compiled after media) uses subsys_initcall().
 
 IMO, the correct fix is the one below. Could you please test it?
 
 Regards,
 Mauro
 
 -
 
 [media] Fix init order for I2C drivers
 
 Based on a patch from Sylvester Nawrocki
 
 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.
 
 The linked order affect what drivers will be initialized first, when
 they're built-in at Kernel. While there are macros that allow changing
 the init order, like subsys_initcall(), late_initcall()  friends,
 when all drivers  linked belong to the same subsystem, it is easier
 to change the order at the Makefile.
 
 All I2C modules must be linked before any drivers that actually use it,
 in order to ensure proper module initialization order.
 
 Also, the core drivers should be initialized before the drivers that use
 them.
 
 This patch reorders the drivers init, in order to fulfill the above
 requirements.
 
 Reported-by: Sylwester Nawrockisylvester.nawro...@gmail.com
 Signed-off-by: Mauro Carvalho Chehabmche...@redhat.com
 
Acked-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
 
 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..620f275 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -4,12 +4,30 @@
 
   media-objs  := media-device.o media-devnode.o media-entity.o
 
 +#
 +# I2C drivers should come before other drivers, otherwise they'll fail
 +# when compiled as builtin drivers
 +#
 +obj-y += i2c/ tuners/
 +obj-$(CONFIG_DVB_CORE)  += dvb-frontends/
 +
 +#
 +# Now, let's link-in the media core
 +#
   ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
 obj-$(CONFIG_MEDIA_SUPPORT) += media.o
   endif
 
 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-$(CONFIG_DVB_CORE)  += dvb-core/
 +
 +# There are both core and drivers at RC subtree - merge before drivers
 +obj-y += rc/
 +
 +#
 +# Finally, merge the drivers that require the core
 +#
 +
 +obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += radio/
 
 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 -obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/

--

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


Re: [Workshop-2011] Media summit/KS-2012 proposals

2012-09-06 Thread Jun Nie
2012/9/6 Hans Verkuil hverk...@xs4all.nl:
 On Thu 6 September 2012 12:29:17 Jun Nie wrote:
 2012/9/6 Hans Verkuil hverk...@xs4all.nl:
  On Thu September 6 2012 06:09:44 Jun Nie wrote:
  2012/9/5 Hans Verkuil hverk...@xs4all.nl:
   On Wed 5 September 2012 10:04:41 Jun Nie wrote:
   Is there any summary for this summit or presentation material? I am
   looking forward for some idea on CEC. It is really complex in
   functionality.
   Maybe other guys is expecting simiar fruite from summit too.
  
   Yes, there will be a summit report. It's not quite finished yet, I 
   think.
  
   With respect to CEC we had some useful discussions. It will have to be a
   new class of device (/dev/cecX), so the userspace API will be separate 
   from
   drm or v4l.
  
   And the kernel will have to take care of the core CEC protocol w.r.t. 
   control
   and discovery due to the HDMI 1.4a requirements.
  
   I plan on starting work on this within 1-2 weeks.
  
   My CEC presentation can be found here:
  
   http://hverkuil.home.xs4all.nl/presentations/v4l2-workshop-cec.odp
  
   Regards,
  
   Hans
 
  Thanks for quick response! It's good to know that CEC is independent
  with DRM/V4L for my HDMI implementation is FB/lcd-device based. CEC is
  also deserved to have independent management in both hardware signal
  and functionality. Someone also expressed similar thoughts before.
  Will remote control protocal parsing are done in userspace reference
  library? Or not decided yet?
 
  Are you referring to the remote control pass-through functionality?
  I don't know yet whether that will go through a userspace library or
  through the RC kernel subsystem, or possibly both.

 I mean all the feature that can involved in handhold remote control,
 one touch play, standby, on screen display, etc, such as
 play/pause/poweroff. I want to mention all non CDC features that can
 be implemented in user space. They are hard to be covered by any
 sub-system and user space library is more proper. Just like your
 metaphor, kitchen sink for CEC. I like your words.

 Yes, that will all be userspace.

 My plan is to have the CEC adapter driver handle the core CEC protocol,
 allow other drivers to intercept messages that are relevant for them and
 send messages themselves, and anything that remains will be available to
 userspace for which a new library will be created.

 Now, don't ask me about any of the details, since I don't have them yet :-)
 My plan is to start working on this next week or the week after.

 Are you willing to test early versions of this work? Can you test HDMI 1.4a
 features as well? Testing this might well be one of the harder things to do.

I am willing to test or contribute to the library. But my hardware
does not include HEAC. So my test scope limites to the features that
can be implemented in user space.

 Regards,

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


Re: [PATCH 10/12] [media] move i2c files into drivers/media/i2c

2012-09-06 Thread Prabhakar Lad
Hi Mauro,

Thanks for the patch.

On Thu, Sep 6, 2012 at 7:37 PM, Mauro Carvalho Chehab
mche...@redhat.com wrote:
 Em 24-08-2012 20:44, Sylwester Nawrocki escreveu:
 From: Sylwester Nawrocki sylvester.nawro...@gmail.com
 Date: Sat, 25 Aug 2012 01:23:14 +0200
 Subject: [PATCH] [media] Fix link order of the V4L2 bridge and I2C modules

 All I2C modules must be linked first to ensure proper module
 initialization order. With platform devices linked before I2C
 modules I2C subdev registration fails as the subdev drivers
 are not yet initialized during bridge driver's probing.

 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.

 Signed-off-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
 ---
  drivers/media/Makefile |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..92a8bcf 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -8,8 +8,9 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
obj-$(CONFIG_MEDIA_SUPPORT) += media.o
  endif

 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-y += common/ rc/ i2c/
 +obj-y += tuners/ platform/ pci/ usb/ mmc/ firewire/ parport/

 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 +obj-$(CONFIG_VIDEO_DEV) += radio/
  obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/
 -- 1.7.4.1

 Hmm... This change seems incomplete on my eyes: tuners and dvb-frontends
 are also I2C drivers. So, while this fixes the issue for platform drivers,
 other drivers will still suffer this issue, at least on drivers that doesn't
 depend on drivers located outside the media subsystem[1]

 [1] thankfully, staging compiles after media, so the drivers there
 shouldn't be affected. Also, drivers that use alsa won't be affected, as
 alsa core (with is compiled after media) uses subsys_initcall().

 IMO, the correct fix is the one below. Could you please test it?

 Regards,
 Mauro

 -

 [media] Fix init order for I2C drivers

 Based on a patch from Sylvester Nawrocki

 This fixes regression introduced with commmit cb7a01ac324bf2ee2,
 [media] move i2c files into drivers/media/i2c.

 The linked order affect what drivers will be initialized first, when
 they're built-in at Kernel. While there are macros that allow changing
 the init order, like subsys_initcall(), late_initcall()  friends,
 when all drivers  linked belong to the same subsystem, it is easier
 to change the order at the Makefile.

 All I2C modules must be linked before any drivers that actually use it,
 in order to ensure proper module initialization order.

 Also, the core drivers should be initialized before the drivers that use
 them.

 This patch reorders the drivers init, in order to fulfill the above
 requirements.

 Reported-by: Sylwester Nawrocki sylvester.nawro...@gmail.com
 Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

Acked-by: Prabhakar Lad prabhakar@ti.com


Thanks and Regards,
--Prabhakar Lad

 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index b0b0193..620f275 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -4,12 +4,30 @@

  media-objs := media-device.o media-devnode.o media-entity.o

 +#
 +# I2C drivers should come before other drivers, otherwise they'll fail
 +# when compiled as builtin drivers
 +#
 +obj-y += i2c/ tuners/
 +obj-$(CONFIG_DVB_CORE)  += dvb-frontends/
 +
 +#
 +# Now, let's link-in the media core
 +#
  ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
obj-$(CONFIG_MEDIA_SUPPORT) += media.o
  endif

 -obj-y += tuners/ common/ rc/ platform/
 -obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += v4l2-core/
 +obj-$(CONFIG_DVB_CORE)  += dvb-core/
 +
 +# There are both core and drivers at RC subtree - merge before drivers
 +obj-y += rc/
 +
 +#
 +# Finally, merge the drivers that require the core
 +#
 +
 +obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ parport/
 +obj-$(CONFIG_VIDEO_DEV) += radio/

 -obj-$(CONFIG_VIDEO_DEV) += radio/ v4l2-core/
 -obj-$(CONFIG_DVB_CORE)  += dvb-core/ dvb-frontends/


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