Re: linux-next: Tree for Apr 10 (media/i2c/adp1653)

2015-04-10 Thread Sakari Ailus
Hi Randy and others,

On Fri, Apr 10, 2015 at 10:25:23AM -0700, Randy Dunlap wrote:
...
> > ../drivers/media/i2c/adp1653.c:433:6: warning: unused variable 'gpio' 
> > [-Wunused-variable]
> >   int gpio;

A preliminary patch for adp1653 DT support was accidentally merged to
media-tree. It's now reverted in media-tree:

---
commit be8e58d93fba531b12ef2fce4fb33c9c5fb5b69f
Author: Mauro Carvalho Chehab 
Date:   Thu Apr 9 07:33:45 2015 -0300

Revert "[media] Add device tree support to adp1653 flash driver"

As requested by Sakari:

"The driver changes are still being reviewed.
 It's been proposed that the max-microamp property be renamed."

So, as the DT bindings are not agreed upstream yet, let's revert
it.

Requested-by: Sakari Ailus 
This reverts commit b6100f10bdc2019a65297d2597c388de2f7dd653.
---

I thus believe the problem in linux-next should disappear by itself. In the
meantime, the revert from media-tree could be used if needed.

Thanks.

-- 
Kind regards,

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


[PATCH] [media] omap4iss: avoid broken OMAP4 dependency

2015-04-10 Thread Arnd Bergmann
The omap4iss driver uses an interface that used to be provided
by OMAP4 but has now been removed and replaced with a WARN_ON(1)
statement, which likely broke the iss_csiphy code at runtime.

It also broke compiling the driver when CONFIG_ARCH_OMAP2PLUS
is set, which is implied by OMAP4:

drivers/staging/media/omap4iss/iss_csiphy.c: In function 
'omap4iss_csiphy_config':
drivers/staging/media/omap4iss/iss_csiphy.c:167:2: error: implicit declaration 
of function 'omap4_ctrl_pad_writel' [-Werror=implicit-function-declaration]
  omap4_ctrl_pad_writel(cam_rx_ctrl,

In turn, this broke ARM allyesconfig builds. Replacing the
omap4_ctrl_pad_writel call with WARN_ON(1) won't make the
situation any worse than it already is, but fixes the build
problem.

Signed-off-by: Arnd Bergmann 
Fixes: efde234674d9 ("ARM: OMAP4+: control: remove support for legacy pad 
read/write")
---
diff --git a/drivers/staging/media/omap4iss/iss_csiphy.c 
b/drivers/staging/media/omap4iss/iss_csiphy.c
index 7c3d55d811ef..24f56ed90ac3 100644
--- a/drivers/staging/media/omap4iss/iss_csiphy.c
+++ b/drivers/staging/media/omap4iss/iss_csiphy.c

@@ -140,9 +140,7 @@ int omap4iss_csiphy_config(struct iss_device *iss,
 * - bit [18] : CSIPHY1 CTRLCLK enable
 * - bit [17:16] : CSIPHY1 config: 00 d-phy, 01/10 ccp2
 */
-   cam_rx_ctrl = omap4_ctrl_pad_readl(
-   OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX);
-
+   cam_rx_ctrl = WARN_ON(1);
 
if (subdevs->interface == ISS_INTERFACE_CSI2A_PHY1) {
cam_rx_ctrl &= ~(OMAP4_CAMERARX_CSI21_LANEENABLE_MASK |
@@ -166,8 +164,7 @@ int omap4iss_csiphy_config(struct iss_device *iss,
cam_rx_ctrl |= OMAP4_CAMERARX_CSI22_CTRLCLKEN_MASK;
}
 
-   omap4_ctrl_pad_writel(cam_rx_ctrl,
-OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX);
+   WARN_ON(1);
 
/* Reset used lane count */
csi2->phy->used_data_lanes = 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] [media] R820T tuner needs CONFIG_BITREVERSE

2015-04-10 Thread Arnd Bergmann
In a rarely hit randconfig case, the r820t tuner driver can
get built when CONFIG_BITREVERSE is not selected by any
other driver, resulting in this error:

drivers/built-in.o: In function `r820t_read.constprop.3':
:(.text+0xa0594): undefined reference to `byte_rev_table'

For consistency, this adds the 'select BITREVERSE' that
all other similar drivers have.

Signed-off-by: Arnd Bergmann 

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 983510d282f6..db4caf2b4669 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -258,6 +258,7 @@ config MEDIA_TUNER_R820T
tristate "Rafael Micro R820T silicon tuner"
depends on MEDIA_SUPPORT && I2C
default m if !MEDIA_SUBDRV_AUTOSELECT
+   select BITREVERSE
help
  Rafael Micro R820T silicon tuner driver.
 

--
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] [media] vb2: remove unused variable

2015-04-10 Thread Arnd Bergmann
A recent bug fix removed all uses of the 'fileio' variable in
vb2_thread_stop(), which now causes warnings in a lot of
ARM defconfig builds:

drivers/media/v4l2-core/videobuf2-core.c:3228:26: warning: unused variable 
'fileio' [-Wunused-variable]

This removes the variable as well. The commit that introduced
the warning was marked for 3.18+ backports, so this should
probably be backported too.

Signed-off-by: Arnd Bergmann 
Fixes: 0e661006370b7 ("[media] vb2: fix 'UNBALANCED' warnings when calling 
vb2_thread_stop()")
Cc:   # for v3.18 and up

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index c11aee7db884..d3f7bf0db61e 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -3225,7 +3225,6 @@ EXPORT_SYMBOL_GPL(vb2_thread_start);
 int vb2_thread_stop(struct vb2_queue *q)
 {
struct vb2_threadio_data *threadio = q->threadio;
-   struct vb2_fileio_data *fileio = q->fileio;
int err;
 
if (threadio == NULL)

--
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] [media] dvb-usb/dvb-usb-v2: use IS_REACHABLE

2015-04-10 Thread Arnd Bergmann
Tha ARM randconfig builds came up with another rare build
failure for the dib3000mc driver, when dibusb is built-in
and dib3000mc is a loadable module:

ERROR: "dibusb_dib3000mc_frontend_attach" 
[drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!
ERROR: "dibusb_dib3000mc_tuner_attach" 
[drivers/media/usb/dvb-usb/dvb-usb-nova-t-usb2.ko] undefined!

Apparently this used to be a valid configuration (build-time,
not run-time), but broke as part of a cleanup.
I tried reverting the cleanup, but saw that the code was still
wrong then. This tries to fix the code properly, by moving the
problematic functions into a new file that now is built as a
loadable module or built-in, whichever is correct for a particular
configuration. It fixes the regression as well as the run-time
problem that already existed before.

I have also checked the two other files that were changed in
the original cleanup, and found them to be correct in either
version, so I do not touch that part.

As this is a rather obscure bug, there is no need for backports.

Signed-off-by: Arnd Bergmann 
Fixes: 028c70ff42783 ("[media] dvb-usb/dvb-usb-v2: use IS_ENABLED")
---
 drivers/media/usb/dvb-usb/Kconfig|  20 +++-
 drivers/media/usb/dvb-usb/Makefile   |   3 +
 drivers/media/usb/dvb-usb/dibusb-common.c| 158 -
 drivers/media/usb/dvb-usb/dibusb-mc-common.c | 168 +++
 4 files changed, 186 insertions(+), 163 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 128eee61570d..8b662b3f8ac1 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -20,10 +20,20 @@ config DVB_USB_DEBUG
  Say Y if you want to enable debugging. See modinfo dvb-usb (and the
  appropriate drivers) for debug levels.
 
+config DVB_USB_DIB3000MC
+   tristate
+   depends on DVB_USB
+   select DVB_DIB3000MC
+   help
+ This is a module with helper functions for accessing the
+ DIB3000MC from USB DVB devices. It must be a separate module
+ in case DVB_USB is built-in and DVB_DIB3000MC is a module,
+ and gets selected automatically when needed.
+
 config DVB_USB_A800
tristate "AVerMedia AverTV DVB-T USB 2.0 (A800)"
depends on DVB_USB
-   select DVB_DIB3000MC
+   select DVB_USB_DIB3000MC
select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
help
@@ -54,7 +64,7 @@ config DVB_USB_DIBUSB_MB_FAULTY
 config DVB_USB_DIBUSB_MC
tristate "DiBcom USB DVB-T devices (based on the DiB3000M-C/P) (see 
help for device list)"
depends on DVB_USB
-   select DVB_DIB3000MC
+   select DVB_USB_DIB3000MC
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
help
  Support for USB2.0 DVB-T receivers based on reference designs made by
@@ -72,7 +82,7 @@ config DVB_USB_DIB0700
select DVB_DIB7000P if MEDIA_SUBDRV_AUTOSELECT
select DVB_DIB7000M if MEDIA_SUBDRV_AUTOSELECT
select DVB_DIB8000 if MEDIA_SUBDRV_AUTOSELECT
-   select DVB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
@@ -99,7 +109,7 @@ config DVB_USB_UMT_010
tristate "HanfTek UMT-010 DVB-T USB2.0 support"
depends on DVB_USB
select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
-   select DVB_DIB3000MC
+   select DVB_USB_DIB3000MC
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MT352 if MEDIA_SUBDRV_AUTOSELECT
help
@@ -192,7 +202,7 @@ config DVB_USB_GP8PSK
 config DVB_USB_NOVA_T_USB2
tristate "Hauppauge WinTV-NOVA-T usb2 DVB-T USB2.0 support"
depends on DVB_USB
-   select DVB_DIB3000MC
+   select DVB_USB_DIB3000MC
select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
help
diff --git a/drivers/media/usb/dvb-usb/Makefile 
b/drivers/media/usb/dvb-usb/Makefile
index acdd1efd4e74..8da26352f73b 100644
--- a/drivers/media/usb/dvb-usb/Makefile
+++ b/drivers/media/usb/dvb-usb/Makefile
@@ -16,6 +16,9 @@ obj-$(CONFIG_DVB_USB_DTT200U) += dvb-usb-dtt200u.o
 
 dvb-usb-dibusb-common-objs := dibusb-common.o
 
+dvb-usb-dibusb-mc-common-objs := dibusb-mc-common.o
+obj-$(CONFIG_DVB_USB_DIB3000MC)+= dvb-usb-dibusb-mc-common.o
+
 dvb-usb-a800-objs := a800.o
 obj-$(CONFIG_DVB_USB_A800) += dvb-usb-dibusb-common.o dvb-usb-a800.o
 
diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c 
b/drivers/media/usb/dvb-usb/dibusb-common.c
index ef3a8f75f82e..7617ba8ac698 100644
--- a/drivers/media/usb/dvb-usb/dibusb-common.c
+++ b/drivers/media/usb/dvb-usb/dibusb-common.c
@@ -184,164 +184,6 @@ int dibusb_read_eeprom_byte(struct dvb_usb_de

[PATCH] [media] exynos4_is: exynos4-fimc requires i2c

2015-04-10 Thread Arnd Bergmann
Without i2c, we can get a build error:

drivers/media/platform/exynos4-is/fimc-is-i2c.c: In function 
'fimc_is_i2c_probe':
drivers/media/platform/exynos4-is/fimc-is-i2c.c:58:8: error: implicit 
declaration of function 'i2c_add_adapter' 
[-Werror=implicit-function-declaration]

The dependency already exists for exynos-fimc-lite and s5p-fimc,
but is missing for exynos4-fimc.

Signed-off-by: Arnd Bergmann 

diff --git a/drivers/media/platform/exynos4-is/Kconfig 
b/drivers/media/platform/exynos4-is/Kconfig
index b7b2e472240a..40423c6c5324 100644
--- a/drivers/media/platform/exynos4-is/Kconfig
+++ b/drivers/media/platform/exynos4-is/Kconfig
@@ -57,6 +57,7 @@ endif
 
 config VIDEO_EXYNOS4_FIMC_IS
tristate "EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver"
+   depends on I2C
depends on HAS_DMA
select VIDEOBUF2_DMA_CONTIG
depends on OF

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


dual-duty capture driver bridge and sub-device

2015-04-10 Thread Benoit Parrot
Hi,

I am wondering if there already example of V4L2 capture drivers which
can be used as either stand-alone bridge driver or as a sub-device to
another bridge driver based on configuration.

I am looking for some example I could use as a starting point.

Given the following entities:

- S  :: CSI2 sensor
- Cs :: CSI2 capture engine
- Cp :: Parallel capture engine

Here is the scenarios I have:

Case #1:
S => Cs
Here Cs connect to S. Cs advertises video node.

Driver Connectivity is established through DT using the
v4l2-asynchronous registration method.

Case #2:
S => Cs => Cp
Here Cs connect to S and Cp connects to Cs.
Cp advertises a video node.
In this case Cs appears as a "sensor" to Cp.

Driver Connectivity is established through DT using the
v4l2-asynchronous registration method.

I would guess that the difficulty here would be within the Cs driver
to setup the appropriate V4L2 device registration based on how DT
is setup.

If anyone as any example of this type, I would appreciate a few
pointers/ideas or examples.

Regards,
Benoit
--
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] media: i2c: ov2659: add VIDEO_V4L2_SUBDEV_API dependency

2015-04-10 Thread Lad Prabhakar
From: "Lad, Prabhakar" 

this patch adds dependency of VIDEO_V4L2_SUBDEV_API
for VIDEO_OV2659 so that it doesn't complain for random
config builds.

Reported-by: Randy Dunlap 
Signed-off-by: Lad, Prabhakar 
---
 drivers/media/i2c/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 6f30ea7..8b05681 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -468,7 +468,7 @@ config VIDEO_SMIAPP_PLL
 
 config VIDEO_OV2659
tristate "OmniVision OV2659 sensor support"
-   depends on VIDEO_V4L2 && I2C
+   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
depends on MEDIA_CAMERA_SUPPORT
---help---
  This is a Video4Linux2 sensor-level driver for the OmniVision
-- 
2.1.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


Re: [PATCH v4 4/4] smiapp: Use v4l2_of_alloc_parse_endpoint()

2015-04-10 Thread Lad, Prabhakar
Hi Sakari,

Thanks for the patch.

On Thu, Apr 9, 2015 at 10:25 PM, Sakari Ailus  wrote:
> Instead of parsing the link-frequencies property in the driver, let
> v4l2_of_alloc_parse_endpoint() do it.
>
> Signed-off-by: Sakari Ailus 
> Acked-by: Laurent Pinchart 
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c |   40 
> 
>  1 file changed, 20 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
> b/drivers/media/i2c/smiapp/smiapp-core.c
> index 557f25d..4a2e8d3 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -2975,9 +2975,9 @@ static int smiapp_resume(struct device *dev)
>  static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev)
>  {
> struct smiapp_platform_data *pdata;
> -   struct v4l2_of_endpoint bus_cfg;
> +   struct v4l2_of_endpoint *bus_cfg;
> struct device_node *ep;
> -   uint32_t asize;
> +   int i;
> int rval;
>
> if (!dev->of_node)
> @@ -2987,13 +2987,17 @@ static struct smiapp_platform_data 
> *smiapp_get_pdata(struct device *dev)
> if (!ep)
> return NULL;
>
> +   bus_cfg = v4l2_of_alloc_parse_endpoint(ep);
> +   if (IS_ERR(bus_cfg)) {
> +   rval = PTR_ERR(bus_cfg);

this assignment  is not required.

Apart from that the patch looks good.

Reviewed-by: Lad, Prabhakar 

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


Re: [PATCH v4 4/4] smiapp: Use v4l2_of_alloc_parse_endpoint()

2015-04-10 Thread Sakari Ailus
Hi Prabhakar,

Thank you for the review.

On Fri, Apr 10, 2015 at 10:54:08PM +0100, Lad, Prabhakar wrote:
> Hi Sakari,
> 
> Thanks for the patch.
> 
> On Thu, Apr 9, 2015 at 10:25 PM, Sakari Ailus  wrote:
> > Instead of parsing the link-frequencies property in the driver, let
> > v4l2_of_alloc_parse_endpoint() do it.
> >
> > Signed-off-by: Sakari Ailus 
> > Acked-by: Laurent Pinchart 
> > ---
> >  drivers/media/i2c/smiapp/smiapp-core.c |   40 
> > 
> >  1 file changed, 20 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
> > b/drivers/media/i2c/smiapp/smiapp-core.c
> > index 557f25d..4a2e8d3 100644
> > --- a/drivers/media/i2c/smiapp/smiapp-core.c
> > +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> > @@ -2975,9 +2975,9 @@ static int smiapp_resume(struct device *dev)
> >  static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev)
> >  {
> > struct smiapp_platform_data *pdata;
> > -   struct v4l2_of_endpoint bus_cfg;
> > +   struct v4l2_of_endpoint *bus_cfg;
> > struct device_node *ep;
> > -   uint32_t asize;
> > +   int i;
> > int rval;
> >
> > if (!dev->of_node)
> > @@ -2987,13 +2987,17 @@ static struct smiapp_platform_data 
> > *smiapp_get_pdata(struct device *dev)
> > if (!ep)
> > return NULL;
> >
> > +   bus_cfg = v4l2_of_alloc_parse_endpoint(ep);
> > +   if (IS_ERR(bus_cfg)) {
> > +   rval = PTR_ERR(bus_cfg);
> 
> this assignment  is not required.
> 
> Apart from that the patch looks good.
> 
> Reviewed-by: Lad, Prabhakar 

Good point. I'll remove it.

There's another case of the same in the function, I'll send a separate patch
on that. I'll send a pull request on these soonish.

-- 
Kind regards,

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


[PATCH] media: i2c: ov2659: Use v4l2_of_alloc_parse_endpoint()

2015-04-10 Thread Lad Prabhakar
From: "Lad, Prabhakar" 

Instead of parsing the link-frequencies property in the driver, let
v4l2_of_alloc_parse_endpoint() do it.

Signed-off-by: Lad, Prabhakar 
---
 This patch depends on https://patchwork.kernel.org/patch/6190901/
 
 drivers/media/i2c/ov2659.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c
index edebd11..c1e310b 100644
--- a/drivers/media/i2c/ov2659.c
+++ b/drivers/media/i2c/ov2659.c
@@ -1340,8 +1340,8 @@ static struct ov2659_platform_data *
 ov2659_get_pdata(struct i2c_client *client)
 {
struct ov2659_platform_data *pdata;
+   struct v4l2_of_endpoint *bus_cfg;
struct device_node *endpoint;
-   int ret;
 
if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
return client->dev.platform_data;
@@ -1350,18 +1350,27 @@ ov2659_get_pdata(struct i2c_client *client)
if (!endpoint)
return NULL;
 
+   bus_cfg = v4l2_of_alloc_parse_endpoint(endpoint);
+   if (IS_ERR(bus_cfg)) {
+   pdata = NULL;
+   goto done;
+   }
+
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
goto done;
 
-   ret = of_property_read_u64(endpoint, "link-frequencies",
-  &pdata->link_frequency);
-   if (ret) {
-   dev_err(&client->dev, "link-frequencies property not found\n");
+   if (bus_cfg->nr_of_link_frequencies != 1) {
+   dev_err(&client->dev,
+   "link-frequencies property not found or too many\n");
pdata = NULL;
+   goto done;
}
 
+   pdata->link_frequency = bus_cfg->link_frequencies[0];
+
 done:
+   v4l2_of_free_endpoint(bus_cfg);
of_node_put(endpoint);
return pdata;
 }
-- 
2.1.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


Re: [PATCH v4 3/4] v4l: of: Parse variable length properties --- link-frequencies

2015-04-10 Thread Lad, Prabhakar
Hi Sakari,

Thanks for the patch.

On Thu, Apr 9, 2015 at 10:25 PM, Sakari Ailus  wrote:
> The link-frequencies property is a variable length array of link frequencies
> in an endpoint. The array is needed by an increasing number of drivers, so
> it makes sense to add it to struct v4l2_of_endpoint.
>
> However, the length of the array is variable and the size of struct
> v4l2_of_endpoint is fixed since it is allocated by the caller. The options
> here are
>
> 1. to define a fixed maximum limit of link frequencies that has to be the
> global maximum of all boards. This is seen as problematic since the maximum
> could be largish, and everyone hitting the problem would need to submit a
> patch to fix it, or
>
> 2. parse the property in every driver. This doesn't sound appealing as two
> of the three implementations submitted to linux-media were wrong, and one of
> them was even merged before this was noticed, or
>
> 3. change the interface so that allocating and releasing memory according to
> the size of the array is possible. This is what the patch does.
>
> v4l2_of_alloc_parse_endpoint() is just like v4l2_of_parse_endpoint(), but it
> will allocate the memory resources needed to store struct v4l2_of_endpoint
> and the additional arrays pointed to by this struct. A corresponding release
> function v4l2_of_free_endpoint() is provided to release the memory allocated
> by v4l2_of_alloc_parse_endpoint().
>
> In addition to this, the link-frequencies property is parsed as well, and
> the result is stored to struct v4l2_of_endpoint field link_frequencies.
>
> Signed-off-by: Sakari Ailus 
> Acked-by: Laurent Pinchart 

Tested-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad

> ---
>  drivers/media/v4l2-core/v4l2-of.c |   87 
> +
>  include/media/v4l2-of.h   |   17 
>  2 files changed, 104 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-of.c 
> b/drivers/media/v4l2-core/v4l2-of.c
> index 3ac6348..c52fb96 100644
> --- a/drivers/media/v4l2-core/v4l2-of.c
> +++ b/drivers/media/v4l2-core/v4l2-of.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -141,6 +142,10 @@ static void v4l2_of_parse_parallel_bus(const struct 
> device_node *node,
>   * V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag.
>   * The caller should hold a reference to @node.
>   *
> + * NOTE: This function does not parse properties the size of which is
> + * variable without a low fixed limit. Please use
> + * v4l2_of_alloc_parse_endpoint() in new drivers instead.
> + *
>   * Return: 0.
>   */
>  int v4l2_of_parse_endpoint(const struct device_node *node,
> @@ -167,6 +172,88 @@ int v4l2_of_parse_endpoint(const struct device_node 
> *node,
>  }
>  EXPORT_SYMBOL(v4l2_of_parse_endpoint);
>
> +/*
> + * v4l2_of_free_endpoint() - free the endpoint acquired by
> + * v4l2_of_alloc_parse_endpoint()
> + * @endpoint - the endpoint the resources of which are to be released
> + *
> + * It is safe to call this function with NULL argument or on an
> + * endpoint the parsing of which failed.
> + */
> +void v4l2_of_free_endpoint(struct v4l2_of_endpoint *endpoint)
> +{
> +   if (IS_ERR_OR_NULL(endpoint))
> +   return;
> +
> +   kfree(endpoint->link_frequencies);
> +   kfree(endpoint);
> +}
> +EXPORT_SYMBOL(v4l2_of_free_endpoint);
> +
> +/**
> + * v4l2_of_alloc_parse_endpoint() - parse all endpoint node properties
> + * @node: pointer to endpoint device_node
> + *
> + * All properties are optional. If none are found, we don't set any flags.
> + * This means the port has a static configuration and no properties have
> + * to be specified explicitly.
> + * If any properties that identify the bus as parallel are found and
> + * slave-mode isn't set, we set V4L2_MBUS_MASTER. Similarly, if we recognise
> + * the bus as serial CSI-2 and clock-noncontinuous isn't set, we set the
> + * V4L2_MBUS_CSI2_CONTINUOUS_CLOCK flag.
> + * The caller should hold a reference to @node.
> + *
> + * v4l2_of_alloc_parse_endpoint() has two important differences to
> + * v4l2_of_parse_endpoint():
> + *
> + * 1. It also parses variable size data and
> + *
> + * 2. The memory it has allocated to store the variable size data must
> + *be freed using v4l2_of_free_endpoint() when no longer needed.
> + *
> + * Return: Pointer to v4l2_of_endpoint if successful, on error a
> + * negative error code.
> + */
> +struct v4l2_of_endpoint *v4l2_of_alloc_parse_endpoint(
> +   const struct device_node *node)
> +{
> +   struct v4l2_of_endpoint *endpoint;
> +   int len;
> +   int rval;
> +
> +   endpoint = kzalloc(sizeof(*endpoint), GFP_KERNEL);
> +   if (!endpoint)
> +   return ERR_PTR(-ENOMEM);
> +
> +   rval = v4l2_of_parse_endpoint(node, endpoint);
> +   if (rval < 0)
> +   goto out_err;
> +
> +   if (of_get_property(node, "link-frequencies", &len)) {
> +   endpoint->link_frequencies = kmalloc(len, GFP_KERNEL);

Re: [PATCH v4 2/4] v4l: of: Instead of zeroing bus_type and bus field separately, unify this

2015-04-10 Thread Lad, Prabhakar
Hi Sakari,

Thanks for the patch.

On Thu, Apr 9, 2015 at 10:25 PM, Sakari Ailus  wrote:
> Zero the entire struct starting from bus_type. As more fields are added, no
> changes will be needed in the function to reset their value explicitly.
>
> Signed-off-by: Sakari Ailus 
> Acked-by: Laurent Pinchart 

Acked-by: Lad, Prabhakar 

Cheers,
--Prabhakar Lad

> ---
>  drivers/media/v4l2-core/v4l2-of.c |5 +++--
>  include/media/v4l2-of.h   |1 +
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-of.c 
> b/drivers/media/v4l2-core/v4l2-of.c
> index 83143d3..3ac6348 100644
> --- a/drivers/media/v4l2-core/v4l2-of.c
> +++ b/drivers/media/v4l2-core/v4l2-of.c
> @@ -149,8 +149,9 @@ int v4l2_of_parse_endpoint(const struct device_node *node,
> int rval;
>
> of_graph_parse_endpoint(node, &endpoint->base);
> -   endpoint->bus_type = 0;
> -   memset(&endpoint->bus, 0, sizeof(endpoint->bus));
> +   /* Zero fields from bus_type to until the end */
> +   memset(&endpoint->bus_type, 0, sizeof(*endpoint) -
> +  offsetof(typeof(*endpoint), bus_type));
>
> rval = v4l2_of_parse_csi_bus(node, endpoint);
> if (rval)
> diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
> index f66b92c..6c85c07 100644
> --- a/include/media/v4l2-of.h
> +++ b/include/media/v4l2-of.h
> @@ -60,6 +60,7 @@ struct v4l2_of_bus_parallel {
>   */
>  struct v4l2_of_endpoint {
> struct of_endpoint base;
> +   /* Fields below this line will be zeroed by v4l2_of_parse_endpoint() 
> */
> enum v4l2_mbus_type bus_type;
> union {
> struct v4l2_of_bus_parallel parallel;
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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 v4.1 4/4] smiapp: Use v4l2_of_alloc_parse_endpoint()

2015-04-10 Thread Sakari Ailus
Instead of parsing the link-frequencies property in the driver, let
v4l2_of_alloc_parse_endpoint() do it.

Signed-off-by: Sakari Ailus 
Acked-by: Laurent Pinchart 
Reviewed-by: Sylwester Nawrocki 
Reviewed-by: Lad, Prabhakar 
---
since v4:

- Remove useless assignment to rval.

 drivers/media/i2c/smiapp/smiapp-core.c |   38 +++-
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 557f25d..636ebd6 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2975,9 +2975,9 @@ static int smiapp_resume(struct device *dev)
 static struct smiapp_platform_data *smiapp_get_pdata(struct device *dev)
 {
struct smiapp_platform_data *pdata;
-   struct v4l2_of_endpoint bus_cfg;
+   struct v4l2_of_endpoint *bus_cfg;
struct device_node *ep;
-   uint32_t asize;
+   int i;
int rval;
 
if (!dev->of_node)
@@ -2987,13 +2987,15 @@ static struct smiapp_platform_data 
*smiapp_get_pdata(struct device *dev)
if (!ep)
return NULL;
 
+   bus_cfg = v4l2_of_alloc_parse_endpoint(ep);
+   if (IS_ERR(bus_cfg))
+   goto out_err;
+
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
goto out_err;
 
-   v4l2_of_parse_endpoint(ep, &bus_cfg);
-
-   switch (bus_cfg.bus_type) {
+   switch (bus_cfg->bus_type) {
case V4L2_MBUS_CSI2:
pdata->csi_signalling_mode = SMIAPP_CSI_SIGNALLING_MODE_CSI2;
break;
@@ -3002,7 +3004,7 @@ static struct smiapp_platform_data 
*smiapp_get_pdata(struct device *dev)
goto out_err;
}
 
-   pdata->lanes = bus_cfg.bus.mipi_csi2.num_data_lanes;
+   pdata->lanes = bus_cfg->bus.mipi_csi2.num_data_lanes;
dev_dbg(dev, "lanes %u\n", pdata->lanes);
 
/* xshutdown GPIO is optional */
@@ -3022,34 +3024,30 @@ static struct smiapp_platform_data 
*smiapp_get_pdata(struct device *dev)
dev_dbg(dev, "reset %d, nvm %d, clk %d, csi %d\n", pdata->xshutdown,
pdata->nvm_size, pdata->ext_clk, pdata->csi_signalling_mode);
 
-   rval = of_get_property(ep, "link-frequencies", &asize) ? 0 : -ENOENT;
-   if (rval) {
-   dev_warn(dev, "can't get link-frequencies array size\n");
+   if (!bus_cfg->nr_of_link_frequencies) {
+   dev_warn(dev, "no link frequencies defined\n");
goto out_err;
}
 
-   pdata->op_sys_clock = devm_kzalloc(dev, asize, GFP_KERNEL);
+   pdata->op_sys_clock = devm_kcalloc(
+   dev, bus_cfg->nr_of_link_frequencies + 1 /* guardian */,
+   sizeof(*pdata->op_sys_clock), GFP_KERNEL);
if (!pdata->op_sys_clock) {
rval = -ENOMEM;
goto out_err;
}
 
-   asize /= sizeof(*pdata->op_sys_clock);
-   rval = of_property_read_u64_array(
-   ep, "link-frequencies", pdata->op_sys_clock, asize);
-   if (rval) {
-   dev_warn(dev, "can't get link-frequencies\n");
-   goto out_err;
+   for (i = 0; i < bus_cfg->nr_of_link_frequencies; i++) {
+   pdata->op_sys_clock[i] = bus_cfg->link_frequencies[i];
+   dev_dbg(dev, "freq %d: %lld\n", i, pdata->op_sys_clock[i]);
}
 
-   for (; asize > 0; asize--)
-   dev_dbg(dev, "freq %d: %lld\n", asize - 1,
-   pdata->op_sys_clock[asize - 1]);
-
+   v4l2_of_free_endpoint(bus_cfg);
of_node_put(ep);
return pdata;
 
 out_err:
+   v4l2_of_free_endpoint(bus_cfg);
of_node_put(ep);
return NULL;
 }
-- 
1.7.10.4

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


Re: [PATCH v4 1/4] v4l: of: Remove the head field in struct v4l2_of_endpoint

2015-04-10 Thread Sakari Ailus
Hi Sylwester,

On Fri, Apr 10, 2015 at 11:47:20AM +0200, Sylwester Nawrocki wrote:
> Hi Sakari,
> 
> On 09/04/15 23:25, Sakari Ailus wrote:
> > The field is unused. Remove it.
> > 
> > Signed-off-by: Sakari Ailus 
> > ---
> >  include/media/v4l2-of.h |2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
> > index f831c9c..f66b92c 100644
> > --- a/include/media/v4l2-of.h
> > +++ b/include/media/v4l2-of.h
> > @@ -57,7 +57,6 @@ struct v4l2_of_bus_parallel {
> >   * @base: struct of_endpoint containing port, id, and local of_node
> >   * @bus_type: bus type
> >   * @bus: bus configuration data structure
> > - * @head: list head for this structure
> >   */
> >  struct v4l2_of_endpoint {
> > struct of_endpoint base;
> > @@ -66,7 +65,6 @@ struct v4l2_of_endpoint {
> > struct v4l2_of_bus_parallel parallel;
> > struct v4l2_of_bus_mipi_csi2 mipi_csi2;
> > } bus;
> > -   struct list_head head;
> >  };
> 
> I don't remember what this list_head was originally intended for,
> probably for some code in soc_camera on which didn't the works were
> postponed or abandoned. Presumably now such code would likely live
> in drivers/of/base.c anyway.

I thought something like that might have happened. I wasn't involved with
this at the time so I didn't remember... should have been a separate patch
though.

> Acked-by: Sylwester Nawrocki 

Many thanks for the review!

-- 
Kind regards,

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


[PATCH 1/1] smiapp: Remove useless rval assignment in smiapp_get_pdata()

2015-04-10 Thread Sakari Ailus
The value is not used after the assignment.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 636ebd6..4b1e112 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -3032,10 +3032,8 @@ static struct smiapp_platform_data 
*smiapp_get_pdata(struct device *dev)
pdata->op_sys_clock = devm_kcalloc(
dev, bus_cfg->nr_of_link_frequencies + 1 /* guardian */,
sizeof(*pdata->op_sys_clock), GFP_KERNEL);
-   if (!pdata->op_sys_clock) {
-   rval = -ENOMEM;
+   if (!pdata->op_sys_clock)
goto out_err;
-   }
 
for (i = 0; i < bus_cfg->nr_of_link_frequencies; i++) {
pdata->op_sys_clock[i] = bus_cfg->link_frequencies[i];
-- 
1.7.10.4

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


cron job: media_tree daily build: ERRORS

2015-04-10 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:   Sat Apr 11 04:00:21 CEST 2015
git branch: test
git hash:   e183201b9e917daf2530b637b2f34f1d5afb934d
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.19.0-1.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-rc1-i686: WARNINGS
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API 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