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


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

2012-08-24 Thread Sylwester Nawrocki
Hi Mauro,

On 08/15/2012 03:48 PM, Mauro Carvalho Chehab wrote:
 Move ancillary I2C drivers into drivers/media/i2c, in order to
 better organize them.
 
 Signed-off-by: Mauro Carvalho Chehabmche...@redhat.com
 ---
   drivers/media/Kconfig  |   9 +-
   drivers/media/Makefile |   2 +-
   drivers/media/i2c/Kconfig  | 566 
 
   drivers/media/i2c/Makefile |  63 +++
   drivers/media/{video =  i2c}/adp1653.c |   2 +-
...
   rename drivers/media/{video =  i2c}/wm8775.c (100%)
 
 diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
 index c9cdc61..26f3de5 100644
 --- a/drivers/media/Kconfig
 +++ b/drivers/media/Kconfig
 @@ -151,18 +151,15 @@ source drivers/media/rc/Kconfig
 
   source drivers/media/tuners/Kconfig
 
 +source drivers/media/i2c/Kconfig
 +
   #
 -# Video/Radio/Hybrid adapters
 +# V4L platform/mem2mem drivers
   #
 -
   source drivers/media/video/Kconfig
 
   source drivers/media/radio/Kconfig
 
 -#
 -# DVB adapters
 -#
 -
   source drivers/media/pci/Kconfig
   source drivers/media/usb/Kconfig
   source drivers/media/mmc/Kconfig
 diff --git a/drivers/media/Makefile b/drivers/media/Makefile
 index 360c44d..e1be196 100644
 --- a/drivers/media/Makefile
 +++ b/drivers/media/Makefile
 @@ -9,7 +9,7 @@ ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
   endif
 
   obj-y += tuners/ common/ rc/ video/
 -obj-y += pci/ usb/ mmc/ firewire/ parport/
 +obj-y += i2c/ pci/ usb/ mmc/ firewire/ parport/

That way all i2c drivers won't be linked before bridge drivers, which
causes failure of sensor subdev registration. There was a comment
about it in the original Makefile, please see further below.

This issue have already shown up for me in a real system,

[1.075000] s3c_camif_driver_init:633
[1.08] s3c-camif s3c2440-camif: sensor clock frequency: 1200
[1.09] s3c-camif: failed to acquire subdev OV9650
[1.095000] platform s3c2440-camif: Driver s3c-camif requests probe deferral
[1.10] ov965x_i2c_driver_init:820

I've attached a patch to fix this issue.

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

[snip]

 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 index a0c6692..52a04fa 100644
 --- a/drivers/media/video/Makefile
 +++ b/drivers/media/video/Makefile
 @@ -2,73 +2,9 @@
   # Makefile for the video capture/playback device drivers.
   #
 
 -msp3400-objs :=  msp3400-driver.o msp3400-kthreads.o
 -
   omap2cam-objs   :=  omap24xxcam.o omap24xxcam-dma.o
 
 -# Helper modules
 -
 -obj-$(CONFIG_VIDEO_APTINA_PLL) += aptina-pll.o
 -
 -# All i2c modules must come first:
^
|
This is currently not preserved +
   
 -obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
 -obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
 -obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o

--

Regards,
Sylwester
From ca02e4cba9f400a0066f2875c2fe4284bc8e06dc Mon Sep 17 00:00:00 2001
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