cron job: media_tree daily build: OK

2014-12-03 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 Dec  4 04:00:16 CET 2014
git branch: test
git hash:   e8bd888a148cb55a5ba27070fdfeb62386c89577
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-35-gc1c3f96
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.17-3.slh.2-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: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
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: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17-i686: OK
linux-3.18-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
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: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: 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 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


[GIT PULL 3.19] rtl2832_sdr fix

2014-12-03 Thread Antti Palosaari

The following changes since commit 504febc3f98c87a8bebd8f2f274f32c0724131e4:

  Revert "[media] lmed04: add missing breaks" (2014-11-25 22:16:25 -0200)

are available in the git repository at:

  git://linuxtv.org/anttip/media_tree.git rtl2832_sdr

for you to fetch changes up to df12dc299d72779a1595b713909a706fe0785ece:

  rtl2832_sdr: control ADC (2014-12-04 01:16:24 +0200)


Antti Palosaari (1):
  rtl2832_sdr: control ADC

 drivers/media/dvb-frontends/rtl2832_sdr.c | 8 
 1 file changed, 8 insertions(+)

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


[PATCH] rtl2832_sdr: control ADC

2014-12-03 Thread Antti Palosaari
Recent rtl28xxu patch I made moved demod ADC enable from power control
to frontend control (due to slave demod support). Because of that we
need call USB interface frontend control too in order to enable ADC.

Signed-off-by: Antti Palosaari 
---
 drivers/media/dvb-frontends/rtl2832_sdr.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c 
b/drivers/media/dvb-frontends/rtl2832_sdr.c
index 7bf98cf..2896b47 100644
--- a/drivers/media/dvb-frontends/rtl2832_sdr.c
+++ b/drivers/media/dvb-frontends/rtl2832_sdr.c
@@ -1013,6 +1013,10 @@ static int rtl2832_sdr_start_streaming(struct vb2_queue 
*vq, unsigned int count)
if (s->d->props->power_ctrl)
s->d->props->power_ctrl(s->d, 1);
 
+   /* enable ADC */
+   if (s->d->props->frontend_ctrl)
+   s->d->props->frontend_ctrl(s->fe, 1);
+
set_bit(POWER_ON, &s->flags);
 
ret = rtl2832_sdr_set_tuner(s);
@@ -1064,6 +1068,10 @@ static void rtl2832_sdr_stop_streaming(struct vb2_queue 
*vq)
 
clear_bit(POWER_ON, &s->flags);
 
+   /* disable ADC */
+   if (s->d->props->frontend_ctrl)
+   s->d->props->frontend_ctrl(s->fe, 0);
+
if (s->d->props->power_ctrl)
s->d->props->power_ctrl(s->d, 0);
 
-- 
http://palosaari.fi/

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


[PATCH v3] media: platform: add VPFE capture driver support for AM437X

2014-12-03 Thread Lad, Prabhakar
From: Benoit Parrot 

This patch adds Video Processing Front End (VPFE) driver for
AM437X family of devices
Driver supports the following:
- V4L2 API using MMAP buffer access based on videobuf2 api
- Asynchronous sensor/decoder sub device registration
- DT support

Signed-off-by: Benoit Parrot 
Signed-off-by: Darren Etheridge 
Signed-off-by: Lad, Prabhakar 
---
 Changes for v3:
 a> Fixed review comments pointed by Hans.
 
 Following is the v4l2-compliance output:-
 
 
 root@am437x-evm:~# ./v4l2-compliance -s -i 0 -vv
Driver Info:
Driver name   : vpfe
[   99.723462] vpfe 48328000.vpfe: =  START STATUS  
=

Bus info  : platform:vpfe 48328000.vpfe
[   99.735701] vpfe 48328000.vpfe: ==  END STATUS  
==
Driver version: 3.18.0
Capabilities  : 0x85200[   99.748824] vpfe 48328000.vpfe: invalid input 
index: 1
001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x0521
Video Capture
Read/Write
Streaming
Extended Pix Format

Compliance test for device /dev/video0 (not using libv4l2):

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Test input 0:

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 0 Private Controls: 0

Format ioctls:
info: found 7 framesizes for pixel format 56595559
info: found 7 framesizes for pixel format 59565955
info: found 7 framesizes for pixel format 52424752
info: found 7 framesizes for pixel format 31384142
info: found 4 formats for buftype 1
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
info: Could not perform global format test
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
info: test buftype Video Capture
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK

Streaming ioctls:
test read/write: OK
Video Capture:
Buffer: 0 Sequence: 0 Field: None Timestamp: 104.346919s
Buffer: 1 Sequence: 1 Field: None Timestamp: 104.369798s
Buffer: 2 Sequence: 2 Field: None Timestamp: 104.392679s
Buffer: 3 Sequence: 3 Field: None Timestamp: 104.598605s
Buffer: 0 Sequence: 4 Field: None Timestamp: 104.621486s
Buffer: 1 Sequence: 5 Field: None Timestamp: 104.644364s
Buffer: 2 Sequence: 6 Field: None Timestamp: 104.667245s
Buffer: 3 Sequence: 7 Field: None Timestamp: 104.690126s
Buffer: 0 Sequence: 8 Field: None Timestamp: 104.713005s
Buffer: 1 Sequence: 9 Field: None Timestamp: 104.735885s
   

[PATCH] media: i2c/adp1653: devicetree support for adp1653

2014-12-03 Thread Pavel Machek

We are moving to device tree support on OMAP3, but that currently
breaks ADP1653 driver. This adds device tree support, plus required
documentation.

Signed-off-by: Pavel Machek 

--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adp1653.txt
@@ -0,0 +1,38 @@
+* Analog Devices ADP1653 flash LED driver
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- "adi,adp1653"
+
+  - reg: I2C slave address
+
+  - gpios: References to the GPIO that controls the power for the chip.
+
+There are two led outputs available - flash and indicator. One led is
+represented by one child node, nodes need to be named "flash" and "indicator".
+
+Required properties of the LED child node:
+- max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+
+Required properties of the flash LED child node:
+
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+- flash-timeout-microsec : see 
Documentation/devicetree/bindings/leds/common.txt
+
+Example:
+
+adp1653: led-controller@30 {
+compatible = "adi,adp1653";
+   reg = <0x30>;
+gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* 88 */
+
+   flash {
+flash-timeout-microsec = <50>;
+flash-max-microamp = <32>;
+max-microamp = <5>;
+   };
+indicator {
+max-microamp = <17500>;
+   };
+};
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index cfddc3d..11d8afd 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -560,6 +567,22 @@
 
ti,usb-charger-detection = <&isp1704>;
};
+
+   adp1653: led-controller@30 {
+   compatible = "adi,adp1653";
+   reg = <0x30>;
+   gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* 88 */
+
+   flash {
+   flash-timeout-microsec = <50>;
+   flash-max-microamp = <32>;
+   max-microamp = <5>;
+   };
+
+   indicator {
+   max-microamp = <17500>;
+   };
+   };
 };
 
 &i2c3 {
diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
index 873fe19..62601b2 100644
--- a/drivers/media/i2c/adp1653.c
+++ b/drivers/media/i2c/adp1653.c
@@ -8,6 +8,7 @@
  * Contributors:
  * Sakari Ailus 
  * Tuukka Toivonen 
+ *  Pavel Machek 
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -34,9 +35,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 
 #define TIMEOUT_MAX82
 #define TIMEOUT_STEP   54600
 #define TIMEOUT_MIN(TIMEOUT_MAX - ADP1653_REG_CONFIG_TMR_SET_MAX \
@@ -306,9 +318,18 @@ adp1653_init_device(struct adp1653_flash *flash)
 static int
 __adp1653_set_power(struct adp1653_flash *flash, int on)
 {
-   int ret;
+   int ret = 0;
 
-   ret = flash->platform_data->power(&flash->subdev, on);
+   if (flash->platform_data->power)
+   ret = flash->platform_data->power(&flash->subdev, on);
+   else {
+   gpio_set_value(flash->platform_data->power_gpio, on);
+   if (on) {
+   /* Some delay is apparently required. */
+   udelay(20);
+   }
+   }
+   
if (ret < 0)
return ret;
 
@@ -316,8 +337,13 @@ __adp1653_set_power(struct adp1653_flash *flash, int on)
return 0;
 
ret = adp1653_init_device(flash);
-   if (ret < 0)
+   if (ret >= 0)
+   return ret;
+
+   if (flash->platform_data->power)
flash->platform_data->power(&flash->subdev, 0);
+   else
+   gpio_set_value(flash->platform_data->power_gpio, 0);
 
return ret;
 }
@@ -407,21 +433,69 @@ static int adp1653_resume(struct device *dev)
 
 #endif /* CONFIG_PM */
 
+static int adp1653_of_init(struct i2c_client *client, struct adp1653_flash 
*flash, 
+  struct device_node *node)
+{
+   u32 val;
+   struct adp1653_platform_data *pd;
+   enum of_gpio_flags flags;
+   int gpio;
+   struct device_node *child;
+
+   if (!node)
+   return -EINVAL;
+
+   pd = devm_kzalloc(&client->dev, sizeof(*pd), GFP_KERNEL);
+   if (!pd)
+   return -ENOMEM;
+   flash->platform_data = pd;
+
+   child = of_get_child_by_name(node, "flash");
+   if (!child) return -EINVAL;
+   if (of_property_read_u32(child, "flash-timeout-microsec", &val)) return 
-EINVAL;
+   pd->max_flash_timeout = val;
+   if (of_property_read_u32(child, "flash-max-microamp", &val)) return 
-EINVAL;
+   pd->max_flash_intensity = val

Re: [PATCH/RFC v9 02/19] Documentation: leds: Add description of LED Flash class extension

2014-12-03 Thread Sakari Ailus
Hi Jacek,

On Wed, Dec 03, 2014 at 05:06:37PM +0100, Jacek Anaszewski wrote:
> The documentation being added contains overall description of the
> LED Flash Class and the related sysfs attributes.
> 
> Signed-off-by: Jacek Anaszewski 
> Acked-by: Kyungmin Park 
> Cc: Bryan Wu 
> Cc: Richard Purdie 
> ---
>  Documentation/leds/leds-class-flash.txt |   50 
> +++
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/leds/leds-class-flash.txt
> 
> diff --git a/Documentation/leds/leds-class-flash.txt 
> b/Documentation/leds/leds-class-flash.txt
> new file mode 100644
> index 000..82e58b1
> --- /dev/null
> +++ b/Documentation/leds/leds-class-flash.txt
> @@ -0,0 +1,50 @@
> +
> +Flash LED handling under Linux
> +==
> +
> +Some LED devices support two modes - torch and flash. The modes are
> +supported by the LED class (see Documentation/leds/leds-class.txt)
> +and LED Flash class respectively.
> +
> +In order to enable support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol
> +must be defined in the kernel config. A flash LED driver must register
> +in the LED subsystem with led_classdev_flash_register to gain flash
> +capabilities.
> +
> +Following sysfs attributes are exposed for controlling flash led devices:
> +
> + - flash_brightness - flash LED brightness in microamperes (RW)
> + - max_flash_brightness - maximum available flash LED brightness (RO)
> + - flash_timeout - flash strobe duration in microseconds (RW)
> + - max_flash_timeout - maximum available flash strobe duration (RO)
> + - flash_strobe - flash strobe state (RW)
> + - flash_sync_strobe - one flash device can control more than one
> +   sub-led; when this atrribute is set to 1

s/atrribute/attribute/

> +   the flash led will be strobed synchronously
> +   with the other one controlled by the same
> +   device; flash timeout setting is inherited
> +   from the led being strobed explicitly and
> +   flash brightness setting of a sub-led's
> +   being synchronized is used (RW)

The flash brightness shouldn't be determined by the strobed LED. If this is
a property of the hardware, then be it, but in general no, it it shouldn't
be an interface requirement. I think this should just say that the strobe is
synchronised.

How does the user btw. figure out which flash LEDs may be strobed
synchronously using the LED flash interface?

> + - flash_fault - bitmask of flash faults that may have occurred
> + possible flags are:
> + * 0x01 - flash controller voltage to the flash LED has exceeded
> +  the limit specific to the flash controller
> + * 0x02 - the flash strobe was still on when the timeout set by
> +  the user has expired; not all flash controllers may
> +  set this in all such conditions
> + * 0x04 - the flash controller has overheated
> + * 0x08 - the short circuit protection of the flash controller
> +  has been triggered
> + * 0x10 - current in the LED power supply has exceeded the limit
> +  specific to the flash controller
> + * 0x40 - flash controller voltage to the flash LED has been
> +  below the minimum limit specific to the flash
> + * 0x80 - the input voltage of the flash controller is below
> +  the limit under which strobing the flash at full
> +  current will not be possible. The condition persists
> +  until this flag is no longer set
> + * 0x100 - the temperature of the LED has exceeded its allowed
> +   upper limit
> +
> + Flash faults are cleared by reading the attribute.

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


Re: [PATCH/RFC v9 01/19] leds: Add LED Flash class extension to the LED subsystem

2014-12-03 Thread Sakari Ailus
Hi Jacek,

Thanks for the update. A few comments below.

On Wed, Dec 03, 2014 at 05:06:36PM +0100, Jacek Anaszewski wrote:
> Some LED devices support two operation modes - torch and flash.
> This patch provides support for flash LED devices in the LED subsystem
> by introducing new sysfs attributes and kernel internal interface.
> The attributes being introduced are: flash_brightness, flash_strobe,
> flash_timeout, max_flash_timeout, max_flash_brightness, flash_fault
> and flash_sync_strobe. All the flash related features are placed
> in a separate module. Torch mode is supported by the LED class
> interface.
> 
> The modifications aim to be compatible with V4L2 framework requirements
> related to the flash devices management. The design assumes that V4L2
> sub-device can take of the LED class device control and communicate
> with it through the kernel internal interface. When V4L2 Flash sub-device
> file is opened, the LED class device sysfs interface is made
> unavailable.
> 
> Signed-off-by: Jacek Anaszewski 
> Acked-by: Kyungmin Park 
> Cc: Bryan Wu 
> Cc: Richard Purdie 
> ---
>  drivers/leds/Kconfig|   10 +
>  drivers/leds/Makefile   |1 +
>  drivers/leds/led-class-flash.c  |  446 
> +++
>  drivers/leds/led-class.c|4 +
>  include/linux/led-class-flash.h |  186 
>  include/linux/leds.h|3 +
>  6 files changed, 650 insertions(+)
>  create mode 100644 drivers/leds/led-class-flash.c
>  create mode 100644 include/linux/led-class-flash.h
> 
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index b3c0d8a..fa8021e 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -19,6 +19,16 @@ config LEDS_CLASS
> This option enables the led sysfs class in /sys/class/leds.  You'll
> need this to do anything useful with LEDs.  If unsure, say N.
>  
> +config LEDS_CLASS_FLASH
> + tristate "LED Flash Class Support"
> + depends on LEDS_CLASS
> + help
> +   This option enables the flash led sysfs class in /sys/class/leds.
> +   It wrapps LED Class and adds flash LEDs specific sysfs attributes
> +   and kernel internal API to it. You'll need this to provide support
> +   for the flash related features of a LED device. It can be built
> +   as a module.
> +
>  comment "LED drivers"
>  
>  config LEDS_88PM860X
> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
> index 1c65a19..cbba921 100644
> --- a/drivers/leds/Makefile
> +++ b/drivers/leds/Makefile
> @@ -2,6 +2,7 @@
>  # LED Core
>  obj-$(CONFIG_NEW_LEDS)   += led-core.o
>  obj-$(CONFIG_LEDS_CLASS) += led-class.o
> +obj-$(CONFIG_LEDS_CLASS_FLASH)   += led-class-flash.o
>  obj-$(CONFIG_LEDS_TRIGGERS)  += led-triggers.o
>  
>  # LED Platform Drivers
> diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
> new file mode 100644
> index 000..219b414
> --- /dev/null
> +++ b/drivers/leds/led-class-flash.c
> @@ -0,0 +1,446 @@
> +/*
> + * LED Flash class interface
> + *
> + * Copyright (C) 2014 Samsung Electronics Co., Ltd.
> + * Author: Jacek Anaszewski 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "leds.h"
> +
> +#define has_flash_op(flash, op)  \
> + (flash && flash->ops->op)
> +
> +#define call_flash_op(flash, op, args...)\
> + ((has_flash_op(flash, op)) ?\
> + (flash->ops->op(flash, args)) : \
> + -EINVAL)
> +
> +static ssize_t flash_brightness_store(struct device *dev,
> + struct device_attribute *attr, const char *buf, size_t size)
> +{
> + struct led_classdev *led_cdev = dev_get_drvdata(dev);
> + struct led_classdev_flash *flash = lcdev_to_flash(led_cdev);
> + unsigned long state;
> + ssize_t ret;
> +
> + mutex_lock(&led_cdev->led_access);
> +
> + if (led_sysfs_is_disabled(led_cdev)) {
> + ret = -EBUSY;
> + goto unlock;
> + }
> +
> + ret = kstrtoul(buf, 10, &state);
> + if (ret)
> + goto unlock;
> +
> + ret = led_set_flash_brightness(flash, state);
> + if (ret < 0)
> + goto unlock;
> +
> + ret = size;
> +unlock:
> + mutex_unlock(&led_cdev->led_access);
> + return ret;
> +}
> +
> +static ssize_t flash_brightness_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct led_classdev *led_cdev = dev_get_drvdata(dev);
> + struct led_classdev_flash *flash = lcdev_to_flash(led_cdev);
> +
> + /* no lock needed for this */
> + led_update_flash_brightness(flash);
> +
> + return sprintf(buf, 

[PATCH/RFC v9 01/19] leds: Add LED Flash class extension to the LED subsystem

2014-12-03 Thread Jacek Anaszewski
Some LED devices support two operation modes - torch and flash.
This patch provides support for flash LED devices in the LED subsystem
by introducing new sysfs attributes and kernel internal interface.
The attributes being introduced are: flash_brightness, flash_strobe,
flash_timeout, max_flash_timeout, max_flash_brightness, flash_fault
and flash_sync_strobe. All the flash related features are placed
in a separate module. Torch mode is supported by the LED class
interface.

The modifications aim to be compatible with V4L2 framework requirements
related to the flash devices management. The design assumes that V4L2
sub-device can take of the LED class device control and communicate
with it through the kernel internal interface. When V4L2 Flash sub-device
file is opened, the LED class device sysfs interface is made
unavailable.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/leds/Kconfig|   10 +
 drivers/leds/Makefile   |1 +
 drivers/leds/led-class-flash.c  |  446 +++
 drivers/leds/led-class.c|4 +
 include/linux/led-class-flash.h |  186 
 include/linux/leds.h|3 +
 6 files changed, 650 insertions(+)
 create mode 100644 drivers/leds/led-class-flash.c
 create mode 100644 include/linux/led-class-flash.h

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index b3c0d8a..fa8021e 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -19,6 +19,16 @@ config LEDS_CLASS
  This option enables the led sysfs class in /sys/class/leds.  You'll
  need this to do anything useful with LEDs.  If unsure, say N.
 
+config LEDS_CLASS_FLASH
+   tristate "LED Flash Class Support"
+   depends on LEDS_CLASS
+   help
+ This option enables the flash led sysfs class in /sys/class/leds.
+ It wrapps LED Class and adds flash LEDs specific sysfs attributes
+ and kernel internal API to it. You'll need this to provide support
+ for the flash related features of a LED device. It can be built
+ as a module.
+
 comment "LED drivers"
 
 config LEDS_88PM860X
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 1c65a19..cbba921 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -2,6 +2,7 @@
 # LED Core
 obj-$(CONFIG_NEW_LEDS) += led-core.o
 obj-$(CONFIG_LEDS_CLASS)   += led-class.o
+obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o
 obj-$(CONFIG_LEDS_TRIGGERS)+= led-triggers.o
 
 # LED Platform Drivers
diff --git a/drivers/leds/led-class-flash.c b/drivers/leds/led-class-flash.c
new file mode 100644
index 000..219b414
--- /dev/null
+++ b/drivers/leds/led-class-flash.c
@@ -0,0 +1,446 @@
+/*
+ * LED Flash class interface
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "leds.h"
+
+#define has_flash_op(flash, op)\
+   (flash && flash->ops->op)
+
+#define call_flash_op(flash, op, args...)  \
+   ((has_flash_op(flash, op)) ?\
+   (flash->ops->op(flash, args)) : \
+   -EINVAL)
+
+static ssize_t flash_brightness_store(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t size)
+{
+   struct led_classdev *led_cdev = dev_get_drvdata(dev);
+   struct led_classdev_flash *flash = lcdev_to_flash(led_cdev);
+   unsigned long state;
+   ssize_t ret;
+
+   mutex_lock(&led_cdev->led_access);
+
+   if (led_sysfs_is_disabled(led_cdev)) {
+   ret = -EBUSY;
+   goto unlock;
+   }
+
+   ret = kstrtoul(buf, 10, &state);
+   if (ret)
+   goto unlock;
+
+   ret = led_set_flash_brightness(flash, state);
+   if (ret < 0)
+   goto unlock;
+
+   ret = size;
+unlock:
+   mutex_unlock(&led_cdev->led_access);
+   return ret;
+}
+
+static ssize_t flash_brightness_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct led_classdev *led_cdev = dev_get_drvdata(dev);
+   struct led_classdev_flash *flash = lcdev_to_flash(led_cdev);
+
+   /* no lock needed for this */
+   led_update_flash_brightness(flash);
+
+   return sprintf(buf, "%u\n", flash->brightness.val);
+}
+static DEVICE_ATTR_RW(flash_brightness);
+
+static ssize_t max_flash_brightness_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   struct led_classdev *led_cdev = dev_get_drvdata(dev);
+   struct led_classdev_flash *flash = lcdev_to_flash(le

[PATCH/RFC v9 02/19] Documentation: leds: Add description of LED Flash class extension

2014-12-03 Thread Jacek Anaszewski
The documentation being added contains overall description of the
LED Flash Class and the related sysfs attributes.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 Documentation/leds/leds-class-flash.txt |   50 +++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/leds/leds-class-flash.txt

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
new file mode 100644
index 000..82e58b1
--- /dev/null
+++ b/Documentation/leds/leds-class-flash.txt
@@ -0,0 +1,50 @@
+
+Flash LED handling under Linux
+==
+
+Some LED devices support two modes - torch and flash. The modes are
+supported by the LED class (see Documentation/leds/leds-class.txt)
+and LED Flash class respectively.
+
+In order to enable support for flash LEDs CONFIG_LEDS_CLASS_FLASH symbol
+must be defined in the kernel config. A flash LED driver must register
+in the LED subsystem with led_classdev_flash_register to gain flash
+capabilities.
+
+Following sysfs attributes are exposed for controlling flash led devices:
+
+   - flash_brightness - flash LED brightness in microamperes (RW)
+   - max_flash_brightness - maximum available flash LED brightness (RO)
+   - flash_timeout - flash strobe duration in microseconds (RW)
+   - max_flash_timeout - maximum available flash strobe duration (RO)
+   - flash_strobe - flash strobe state (RW)
+   - flash_sync_strobe - one flash device can control more than one
+ sub-led; when this atrribute is set to 1
+ the flash led will be strobed synchronously
+ with the other one controlled by the same
+ device; flash timeout setting is inherited
+ from the led being strobed explicitly and
+ flash brightness setting of a sub-led's
+ being synchronized is used (RW)
+   - flash_fault - bitmask of flash faults that may have occurred
+   possible flags are:
+   * 0x01 - flash controller voltage to the flash LED has exceeded
+the limit specific to the flash controller
+   * 0x02 - the flash strobe was still on when the timeout set by
+the user has expired; not all flash controllers may
+set this in all such conditions
+   * 0x04 - the flash controller has overheated
+   * 0x08 - the short circuit protection of the flash controller
+has been triggered
+   * 0x10 - current in the LED power supply has exceeded the limit
+specific to the flash controller
+   * 0x40 - flash controller voltage to the flash LED has been
+below the minimum limit specific to the flash
+   * 0x80 - the input voltage of the flash controller is below
+the limit under which strobing the flash at full
+current will not be possible. The condition persists
+until this flag is no longer set
+   * 0x100 - the temperature of the LED has exceeded its allowed
+ upper limit
+
+   Flash faults are cleared by reading the attribute.
-- 
1.7.9.5

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


[PATCH/RFC v9 00/19] LED / flash API integration

2014-12-03 Thread Jacek Anaszewski
This patch set is a follow-up of the LED / flash API integration
series [1].


Changes since version 8:


- added a new way of registering async sub-device
- switched to matching flash leds by DT phandles
- improved Device Tree bindings documentation
- split the drivers patches to LED Flash class
  and V4L2 Flash part
- fixed indicator leds handling in v4l2-flash
- applied various fixes an cleanups


Changes since version 7:


- removed explicit support for indicator leds from
  LED Flash class - indicator leds will be registered
  as a separate LED Flash class devices
- added flash_sync_strobe sysfs attribute and related
  V4L2_CID_FLASH_SYNC_STROBE control
- changed the way of matching V4L2 Flash sub-devices
  in a media device, which entailed modification in
  v4l2-async driver
- modified max77693 DT bindings documentation
- applied various fixes an cleanups


Changes since version 6:


- removed addition of public LED subsystem API for setting
  torch brightness in favour of internal API for
  synchronous and asynchronous led brightness level setting
- fixed possible race condition upon creating LED Flash class
  related sysfs attributes


Changes since version 5:


- removed flash manager framework - its implementation needs
  further thorough discussion.
- removed external strobe facilities from the LED Flash Class
  and provided external_strobe_set op in v4l2-flash. LED subsystem
  should be strobe provider agnostic.

Thanks,
Jacek Anaszewski

Jacek Anaszewski (19):
  leds: Add LED Flash class extension to the LED subsystem
  Documentation: leds: Add description of LED Flash class extension
  mfd: max77693: Modify flash cell name identifiers
  mfd: max77693: adjust max77693_led_platform_data
  leds: Add support for max77693 mfd flash cell
  DT: Add documentation for the mfd Maxim max77693
  dt-binding: mfd: max77693: Add DT binding related macros
  leds: Add driver for AAT1290 current regulator
  of: Add Skyworks Solutions, Inc. vendor prefix
  DT: Add documentation for the Skyworks AAT1290
  v4l2-async: change custom.match callback argument type
  v4l2-async: add V4L2_ASYNC_MATCH_CUSTOM_OF matching type
  v4l2-ctrls: Add V4L2_CID_FLASH_SYNC_STROBE control
  media: Add registration helpers for V4L2 flash sub-devices
  Documentation: leds: Add description of v4l2-flash sub-device
  exynos4-is: Add support for v4l2-flash subdevs
  DT: Add documentation for exynos4-is 'flashes' property
  leds: max77693: add support for V4L2 Flash sub-device
  leds: aat1290: add support for V4L2 Flash sub-device

 Documentation/DocBook/media/v4l/controls.xml   |   11 +
 .../devicetree/bindings/leds/leds-aat1290.txt  |   17 +
 .../devicetree/bindings/media/samsung-fimc.txt |7 +
 Documentation/devicetree/bindings/mfd/max77693.txt |   89 ++
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 Documentation/leds/leds-class-flash.txt|   63 ++
 drivers/leds/Kconfig   |   27 +
 drivers/leds/Makefile  |3 +
 drivers/leds/led-class-flash.c |  446 
 drivers/leds/led-class.c   |4 +
 drivers/leds/leds-aat1290.c|  474 
 drivers/leds/leds-max77693.c   | 1154 
 drivers/media/platform/exynos4-is/media-dev.c  |   42 +-
 drivers/media/platform/exynos4-is/media-dev.h  |   13 +-
 drivers/media/v4l2-core/Kconfig|   11 +
 drivers/media/v4l2-core/Makefile   |2 +
 drivers/media/v4l2-core/v4l2-async.c   |  122 ++-
 drivers/media/v4l2-core/v4l2-ctrls.c   |2 +
 drivers/media/v4l2-core/v4l2-flash.c   |  546 +
 drivers/mfd/max77693.c |4 +-
 include/dt-bindings/mfd/max77693.h |   38 +
 include/linux/led-class-flash.h|  186 
 include/linux/leds.h   |3 +
 include/linux/mfd/max77693.h   |4 +-
 include/media/v4l2-async.h |6 +-
 include/media/v4l2-flash.h |  139 +++
 include/uapi/linux/v4l2-controls.h |1 +
 27 files changed, 3388 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt
 create mode 100644 Documentation/leds/leds-class-flash.txt
 create mode 100644 drivers/leds/led-class-flash.c
 create mode 100644 drivers/leds/leds-aat1290.c
 create mode 100644 drivers/leds/leds-max77693.c
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/dt-bindings/mfd/max77693.h
 create mode 100644 include/linux/led-class-flash.h
 create mode 100644 include/media/v4l2-flash.h

-- 
1.7.

[PATCH/RFC v9 10/19] DT: Add documentation for the Skyworks AAT1290

2014-12-03 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
1.5A Step-Up Current Regulator for Flash LEDs.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: 
---
 .../devicetree/bindings/leds/leds-aat1290.txt  |   17 +
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/leds-aat1290.txt

diff --git a/Documentation/devicetree/bindings/leds/leds-aat1290.txt 
b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
new file mode 100644
index 000..17b8f05
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/leds-aat1290.txt
@@ -0,0 +1,17 @@
+* Skyworks Solutions, Inc. AAT1290 Current Regulator for Flash LEDs
+
+Required properties:
+
+- compatible : Must be "skyworks,aat1290".
+- gpios : Two gpio pins in order FLEN, EN/SET.
+- flash-timeout-microsec : Maximum flash timeout in microseconds -
+  it can be calculated using following formula:
+  T = 8.82 * 10^9 * Ct.
+
+Example:
+
+flash_led: led {
+   compatible = "skyworks,aat1290";
+   gpios = <&gpj1 1 0>, <&gpj1 2 0>;
+   flash-timeout-microsec = <194>;
+}
-- 
1.7.9.5

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


[PATCH/RFC v9 05/19] leds: Add support for max77693 mfd flash cell

2014-12-03 Thread Jacek Anaszewski
This patch adds led-flash support to Maxim max77693 chipset.
A device can be exposed to user space through LED subsystem
sysfs interface. Device supports up to two leds which can
work in flash and torch mode. The leds can be triggered
externally or by software.

Signed-off-by: Jacek Anaszewski 
Signed-off-by: Andrzej Hajda 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: Lee Jones 
Cc: Chanwoo Choi 
---
 drivers/leds/Kconfig |   10 +
 drivers/leds/Makefile|1 +
 drivers/leds/leds-max77693.c | 1023 ++
 3 files changed, 1034 insertions(+)
 create mode 100644 drivers/leds/leds-max77693.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index fa8021e..2e66d55 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -463,6 +463,16 @@ config LEDS_TCA6507
  LED driver chips accessed via the I2C bus.
  Driver support brightness control and hardware-assisted blinking.
 
+config LEDS_MAX77693
+   tristate "LED support for MAX77693 Flash"
+   depends on LEDS_CLASS_FLASH
+   depends on MFD_MAX77693
+   depends on OF
+   help
+ This option enables support for the flash part of the MAX77693
+ multifunction device. It has build in control for two leds in flash
+ and torch mode.
+
 config LEDS_MAX8997
tristate "LED support for MAX8997 PMIC"
depends on LEDS_CLASS && MFD_MAX8997
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index cbba921..57ca62b 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_LEDS_MC13783)+= leds-mc13783.o
 obj-$(CONFIG_LEDS_NS2) += leds-ns2.o
 obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o
 obj-$(CONFIG_LEDS_ASIC3)   += leds-asic3.o
+obj-$(CONFIG_LEDS_MAX77693)+= leds-max77693.o
 obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o
 obj-$(CONFIG_LEDS_LM355x)  += leds-lm355x.o
 obj-$(CONFIG_LEDS_BLINKM)  += leds-blinkm.o
diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
new file mode 100644
index 000..67a2f8f
--- /dev/null
+++ b/drivers/leds/leds-max77693.c
@@ -0,0 +1,1023 @@
+/*
+ * LED Flash class driver for the flash cell of max77693 mfd.
+ *
+ * Copyright (C) 2014, Samsung Electronics Co., Ltd.
+ *
+ * Authors: Jacek Anaszewski 
+ *  Andrzej Hajda 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MODE_OFF   0
+#define MODE_FLASH1(1 << 0)
+#define MODE_FLASH2(1 << 1)
+#define MODE_TORCH1(1 << 2)
+#define MODE_TORCH2(1 << 3)
+#define MODE_FLASH_EXTERNAL1   (1 << 4)
+#define MODE_FLASH_EXTERNAL2   (1 << 5)
+
+#define MODE_FLASH (MODE_FLASH1 | MODE_FLASH2 | \
+MODE_FLASH_EXTERNAL1 | MODE_FLASH_EXTERNAL2)
+
+#define FLED1_IOUT (1 << 0)
+#define FLED2_IOUT (1 << 1)
+
+enum {
+   FLED1,
+   FLED2
+};
+
+enum {
+   FLASH,
+   TORCH
+};
+
+struct max77693_sub_led {
+   struct led_classdev_flash ldev;
+   struct work_struct work_brightness_set;
+
+   unsigned int torch_brightness;
+   unsigned int flash_timeout;
+};
+
+struct max77693_led {
+   struct regmap *regmap;
+   struct platform_device *pdev;
+   struct max77693_led_platform_data *pdata;
+   struct mutex lock;
+
+   struct max77693_sub_led sub_leds[2];
+
+   unsigned int current_flash_timeout;
+   unsigned int mode_flags;
+   u8 torch_iout_reg;
+   bool iout_joint;
+   int strobing_sub_led_id;
+};
+
+struct max77693_led_settings {
+   struct led_flash_setting torch_brightness;
+   struct led_flash_setting flash_brightness;
+   struct led_flash_setting flash_timeout;
+};
+
+static u8 max77693_led_iout_to_reg(u32 ua)
+{
+   if (ua < FLASH_IOUT_MIN)
+   ua = FLASH_IOUT_MIN;
+   return (ua - FLASH_IOUT_MIN) / FLASH_IOUT_STEP;
+}
+
+static u8 max77693_flash_timeout_to_reg(u32 us)
+{
+   return (us - FLASH_TIMEOUT_MIN) / FLASH_TIMEOUT_STEP;
+}
+
+static inline struct max77693_led *ldev1_to_led(
+   struct led_classdev_flash *ldev)
+{
+   struct max77693_sub_led *sub_led = container_of(ldev,
+   struct max77693_sub_led,
+   ldev);
+   return container_of(sub_led, struct max77693_led, sub_leds[0]);
+}
+
+static inline struct max77693_led *ldev2_to_led(
+   struct led_classdev_flash *ldev)
+{
+   struct max77693_sub_led *sub_led = container

[PATCH/RFC v9 08/19] leds: Add driver for AAT1290 current regulator

2014-12-03 Thread Jacek Anaszewski
This patch adds a driver for the 1.5A Step-Up Current Regulator
for Flash LEDs. The device is programmed through a Skyworks proprietary
AS2Cwire serial digital interface.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 drivers/leds/Kconfig|7 +
 drivers/leds/Makefile   |1 +
 drivers/leds/leds-aat1290.c |  413 +++
 3 files changed, 421 insertions(+)
 create mode 100644 drivers/leds/leds-aat1290.c

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 2e66d55..ec4b78c 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -39,6 +39,13 @@ config LEDS_88PM860X
  This option enables support for on-chip LED drivers found on Marvell
  Semiconductor 88PM8606 PMIC.
 
+config LEDS_AAT1290
+   tristate "LED support for the AAT1290"
+   depends on LEDS_CLASS_FLASH
+   depends on OF
+   help
+This option enables support for the LEDs on the AAT1290.
+
 config LEDS_LM3530
tristate "LCD Backlight driver for LM3530"
depends on LEDS_CLASS
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index 57ca62b..b802251 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o
 
 # LED Platform Drivers
 obj-$(CONFIG_LEDS_88PM860X)+= leds-88pm860x.o
+obj-$(CONFIG_LEDS_AAT1290) += leds-aat1290.o
 obj-$(CONFIG_LEDS_BD2802)  += leds-bd2802.o
 obj-$(CONFIG_LEDS_LOCOMO)  += leds-locomo.o
 obj-$(CONFIG_LEDS_LM3530)  += leds-lm3530.o
diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
new file mode 100644
index 000..15d969b
--- /dev/null
+++ b/drivers/leds/leds-aat1290.c
@@ -0,0 +1,413 @@
+/*
+ * LED Flash class driver for the AAT1290
+ * 1.5A Step-Up Current Regulator for Flash LEDs
+ *
+ * Copyright (C) 2014, Samsung Electronics Co., Ltd.
+ * Author: Jacek Anaszewski 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define AAT1290_MOVIE_MODE_CURRENT_ADDR17
+#define AAT1290_FLASH_SAFETY_TIMER_ADDR18
+#define AAT1290_MOVIE_MODE_CONFIG_ADDR 19
+#define AAT1290_MM_CURRENT_RATIO_ADDR  20
+#define AAT1290_LATCH_TIME_US  500
+#define AAT1290_EN_SET_TICK_TIME_US1
+#define AAT1290_MOVIE_MODE_OFF 1
+#define AAT1290_MOVIE_MODE_ON  3
+#define AAT1290_MAX_MM_CURR_PERCENT_0  16
+#define AAT1290_MAX_MM_CURR_PERCENT_100 1
+#define AAT1290_FLASH_TM_NUM_LEVELS16
+
+#define AAT1290_MM_TO_FL_1_92  1
+#define AAT1290_MM_TO_FL_3_7   2
+#define AAT1290_MM_TO_FL_5_5   3
+#define AAT1290_MM_TO_FL_7_3   4
+#define AAT1290_MM_TO_FL_9 5
+#define AAT1290_MM_TO_FL_10_7  6
+#define AAT1290_MM_TO_FL_12_4  7
+#define AAT1290_MM_TO_FL_148
+#define AAT1290_MM_TO_FL_15_9  9
+#define AAT1290_MM_TO_FL_17_5  10
+#define AAT1290_MM_TO_FL_19_1  11
+#define AAT1290_MM_TO_FL_20_8  12
+#define AAT1290_MM_TO_FL_22_4  13
+#define AAT1290_MM_TO_FL_2414
+#define AAT1290_MM_TO_FL_25_6  15
+#define AAT1290_MM_TO_FL_OFF   16
+
+struct aat1290_led_settings {
+   struct led_flash_setting torch_brightness;
+   struct led_flash_setting flash_brightness;
+   struct led_flash_setting flash_timeout;
+};
+
+struct aat1290_led {
+   struct platform_device *pdev;
+   struct mutex lock;
+
+   struct led_classdev_flash ldev;
+
+   int flen_gpio;
+   int en_set_gpio;
+
+   u32 max_flash_tm;
+   bool movie_mode;
+
+   char *label;
+   unsigned int torch_brightness;
+   unsigned int flash_timeout;
+   struct work_struct work_brightness_set;
+};
+
+static struct aat1290_led *ldev_to_led(struct led_classdev_flash *ldev)
+{
+   return container_of(ldev, struct aat1290_led, ldev);
+}
+
+static void aat1290_as2cwire_write(struct aat1290_led *led, int addr, int 
value)
+{
+   int i;
+
+   gpio_set_value(led->flen_gpio, 0);
+   gpio_set_value(led->en_set_gpio, 0);
+
+   udelay(10);
+
+   /* write address */
+   for (i = 0; i < addr; ++i) {
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 0);
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 1);
+   }
+
+   udelay(AAT1290_LATCH_TIME_US);
+
+   /* write data */
+   for (i = 0; i < value; ++i) {
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 0);
+   udelay(AAT1290_EN_SET_TICK_TIME_US);
+   gpio_set_value(led->en_set_gpio, 1);
+   }
+
+   udelay(AAT1290_LATCH_TIME_US);
+}
+

[PATCH/RFC v9 12/19] v4l2-async: add V4L2_ASYNC_MATCH_CUSTOM_OF matching type

2014-12-03 Thread Jacek Anaszewski
There are cases where a v4l2 sub-device is not related to the
main Device Tree node of a device, but to its child node.
Add v4l2_async_get_of_node_by_subdev function to facilitate
associating a sub-device with different Device Tree node
than the one from the related struct device. Added is also
V4L2_ASYNC_MATCH_CUSTOM_OF matching type to declare this
type of matching.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Guennadi Liakhovetski 
Cc: Laurent Pinchart 
Cc: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-async.c |  106 ++
 include/media/v4l2-async.h   |4 ++
 2 files changed, 98 insertions(+), 12 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index 8140992..faa16484 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -22,6 +22,17 @@
 #include 
 #include 
 
+static LIST_HEAD(subdev_list);
+static LIST_HEAD(notifier_list);
+static LIST_HEAD(custom_of_list);
+static DEFINE_MUTEX(list_lock);
+
+struct v4l2_subdev_to_of_node {
+   struct v4l2_subdev *sd;
+   struct device_node *node;
+   struct list_head list;
+};
+
 static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 #if IS_ENABLED(CONFIG_I2C)
@@ -44,9 +55,17 @@ static bool match_of(struct v4l2_subdev *sd, struct 
v4l2_async_subdev *asd)
return sd->dev->of_node == asd->match.of.node;
 }
 
-static LIST_HEAD(subdev_list);
-static LIST_HEAD(notifier_list);
-static DEFINE_MUTEX(list_lock);
+static bool match_custom_of(struct v4l2_subdev *sd, struct v4l2_async_subdev 
*asd)
+{
+   struct v4l2_subdev_to_of_node *sd_to_of;
+
+   list_for_each_entry(sd_to_of, &custom_of_list, list)
+   if ((sd_to_of->sd == sd) &&
+   (sd_to_of->node == asd->match.of.node))
+   return true;
+
+   return false;
+}
 
 static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier 
*notifier,
struct v4l2_subdev *sd)
@@ -72,6 +91,9 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct 
v4l2_async_notifier *
case V4L2_ASYNC_MATCH_OF:
match = match_of;
break;
+   case V4L2_ASYNC_MATCH_CUSTOM_OF:
+   match = match_custom_of;
+   break;
default:
/* Cannot happen, unless someone breaks us */
WARN_ON(true);
@@ -120,9 +142,19 @@ static int v4l2_async_test_notify(struct 
v4l2_async_notifier *notifier,
 
 static void v4l2_async_cleanup(struct v4l2_subdev *sd)
 {
+   struct v4l2_subdev_to_of_node *sd_to_of, *tmp;
+
v4l2_device_unregister_subdev(sd);
/* Subdevice driver will reprobe and put the subdev back onto the list 
*/
list_del_init(&sd->async_list);
+
+   list_for_each_entry_safe(sd_to_of, tmp, &custom_of_list, list) {
+   if (sd_to_of->sd == sd) {
+   list_del(&sd_to_of->list);
+   kfree (sd_to_of);
+   }
+   }
+
sd->asd = NULL;
sd->dev = NULL;
 }
@@ -149,6 +181,7 @@ int v4l2_async_notifier_register(struct v4l2_device 
*v4l2_dev,
case V4L2_ASYNC_MATCH_DEVNAME:
case V4L2_ASYNC_MATCH_I2C:
case V4L2_ASYNC_MATCH_OF:
+   case V4L2_ASYNC_MATCH_CUSTOM_OF:
break;
default:
dev_err(notifier->v4l2_dev ? notifier->v4l2_dev->dev : 
NULL,
@@ -262,32 +295,65 @@ void v4l2_async_notifier_unregister(struct 
v4l2_async_notifier *notifier)
 }
 EXPORT_SYMBOL(v4l2_async_notifier_unregister);
 
-int v4l2_async_register_subdev(struct v4l2_subdev *sd)
+static int __v4l2_async_register_subdev(struct v4l2_subdev *sd)
 {
struct v4l2_async_notifier *notifier;
 
-   mutex_lock(&list_lock);
-
INIT_LIST_HEAD(&sd->async_list);
 
list_for_each_entry(notifier, ¬ifier_list, list) {
struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, 
sd);
-   if (asd) {
-   int ret = v4l2_async_test_notify(notifier, sd, asd);
-   mutex_unlock(&list_lock);
-   return ret;
-   }
+   if (asd)
+   return v4l2_async_test_notify(notifier, sd, asd);
}
 
/* None matched, wait for hot-plugging */
list_add(&sd->async_list, &subdev_list);
 
+   return 0;
+}
+
+int v4l2_async_register_subdev(struct v4l2_subdev *sd)
+{
+   int ret;
+
+   mutex_lock(&list_lock);
+
+   ret = __v4l2_async_register_subdev(sd);
+
mutex_unlock(&list_lock);
 
-   return 0;
+   return ret;
 }
 EXPORT_SYMBOL(v4l2_async_register_subdev);
 
+int v4l2_async_register_subdev_with_of(struct v4l2_subdev *sd,
+ 

[PATCH/RFC v9 15/19] Documentation: leds: Add description of v4l2-flash sub-device

2014-12-03 Thread Jacek Anaszewski
This patch extends LED Flash class documention by
the description of interactions with v4l2-flash sub-device.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Acked-by: Sakari Ailus 
Cc: Bryan Wu 
Cc: Richard Purdie 
---
 Documentation/leds/leds-class-flash.txt |   13 +
 1 file changed, 13 insertions(+)

diff --git a/Documentation/leds/leds-class-flash.txt 
b/Documentation/leds/leds-class-flash.txt
index 82e58b1..bc3855b 100644
--- a/Documentation/leds/leds-class-flash.txt
+++ b/Documentation/leds/leds-class-flash.txt
@@ -48,3 +48,16 @@ Following sysfs attributes are exposed for controlling flash 
led devices:
  upper limit
 
Flash faults are cleared by reading the attribute.
+
+A LED subsystem driver can be controlled also from the level of VideoForLinux2
+subsystem. In order to enable this CONFIG_V4L2_FLASH_LED_CLASS symbol has to
+be defined in the kernel config. The driver must call the v4l2_flash_init
+function to get registered in the V4L2 subsystem. On remove the
+v4l2_flash_release function has to be called (see ).
+
+After proper initialization a V4L2 Flash sub-device is created. The sub-device
+exposes a number of V4L2 controls, which allow for controlling a LED Flash 
class
+device with use of its internal kernel API.
+Opening the V4L2 Flash sub-device makes the LED subsystem sysfs interface
+unavailable. The interface is re-enabled after the V4L2 Flash sub-device
+is closed.
-- 
1.7.9.5

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


[PATCH/RFC v9 16/19] exynos4-is: Add support for v4l2-flash subdevs

2014-12-03 Thread Jacek Anaszewski
This patch adds suppport for external v4l2-flash devices.
The support includes parsing camera-flash DT property
and asynchronous subdevice registration.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sylwester Nawrocki 
---
 drivers/media/platform/exynos4-is/media-dev.c |   42 +++--
 drivers/media/platform/exynos4-is/media-dev.h |   13 +++-
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c 
b/drivers/media/platform/exynos4-is/media-dev.c
index f315ef9..b422d2e 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -451,6 +451,25 @@ rpm_put:
return ret;
 }
 
+static void fimc_md_register_flash_entities(struct fimc_md *fmd)
+{
+   struct device_node *parent = fmd->pdev->dev.of_node;
+   struct device_node *np;
+   int i = 0;
+
+   do {
+   np = of_parse_phandle(parent, "flashes", i);
+   if (np) {
+   fmd->flash[fmd->num_flashes].asd.match_type =
+   
V4L2_ASYNC_MATCH_CUSTOM_OF;
+   fmd->flash[fmd->num_flashes].asd.match.of.node = np;
+   fmd->num_flashes++;
+   fmd->async_subdevs[fmd->num_sensors + i] =
+   &fmd->flash[i].asd;
+   }
+   } while (np && (++i < FIMC_MAX_FLASHES));
+}
+
 static int __of_get_csis_id(struct device_node *np)
 {
u32 reg = 0;
@@ -1272,9 +1291,24 @@ static int subdev_notifier_bound(struct 
v4l2_async_notifier *notifier,
 struct v4l2_async_subdev *asd)
 {
struct fimc_md *fmd = notifier_to_fimc_md(notifier);
+   struct device_node *node;
struct fimc_sensor_info *si = NULL;
int i;
 
+   node = v4l2_async_get_of_node_by_subdev(subdev);
+   if (node) {
+   /* Register flash subdev if detected any */
+   for (i = 0; i < ARRAY_SIZE(fmd->flash); i++) {
+   if (fmd->flash[i].asd.match.of.node == node) {
+   fmd->flash[i].subdev = subdev;
+   fmd->num_flashes++;
+   return 0;
+   }
+   }
+
+   return -EINVAL;
+   }
+
/* Find platform data for this sensor subdev */
for (i = 0; i < ARRAY_SIZE(fmd->sensor); i++)
if (fmd->sensor[i].asd.match.of.node == subdev->dev->of_node)
@@ -1385,6 +1419,8 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_m_ent;
}
 
+   fimc_md_register_flash_entities(fmd);
+
mutex_unlock(&fmd->media_dev.graph_mutex);
 
ret = device_create_file(&pdev->dev, &dev_attr_subdev_conf_mode);
@@ -1401,12 +1437,14 @@ static int fimc_md_probe(struct platform_device *pdev)
goto err_attr;
}
 
-   if (fmd->num_sensors > 0) {
+   if (fmd->num_sensors > 0 || fmd->num_flashes > 0) {
fmd->subdev_notifier.subdevs = fmd->async_subdevs;
-   fmd->subdev_notifier.num_subdevs = fmd->num_sensors;
+   fmd->subdev_notifier.num_subdevs = fmd->num_sensors +
+   fmd->num_flashes;
fmd->subdev_notifier.bound = subdev_notifier_bound;
fmd->subdev_notifier.complete = subdev_notifier_complete;
fmd->num_sensors = 0;
+   fmd->num_flashes = 0;
 
ret = v4l2_async_notifier_register(&fmd->v4l2_dev,
&fmd->subdev_notifier);
diff --git a/drivers/media/platform/exynos4-is/media-dev.h 
b/drivers/media/platform/exynos4-is/media-dev.h
index 0321454..feff9c8 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -34,6 +34,8 @@
 
 #define FIMC_MAX_SENSORS   4
 #define FIMC_MAX_CAMCLKS   2
+#define FIMC_MAX_FLASHES   2
+#define FIMC_MAX_ASYNC_SUBDEVS (FIMC_MAX_SENSORS + FIMC_MAX_FLASHES)
 #define DEFAULT_SENSOR_CLK_FREQ2400U
 
 /* LCD/ISP Writeback clocks (PIXELASYNCMx) */
@@ -93,6 +95,11 @@ struct fimc_sensor_info {
struct fimc_dev *host;
 };
 
+struct fimc_flash_info {
+   struct v4l2_subdev *subdev;
+   struct v4l2_async_subdev asd;
+};
+
 struct cam_clk {
struct clk_hw hw;
struct fimc_md *fmd;
@@ -104,6 +111,8 @@ struct cam_clk {
  * @csis: MIPI CSIS subdevs data
  * @sensor: array of registered sensor subdevs
  * @num_sensors: actual number of registered sensors
+ * @flash: array of registered flash subdevs
+ * @num_flashes: actual number of registered flashes
  * @camclk: external sensor clock information
  * @fimc: array of registered fimc devices
  * @fimc_is: fimc-is data structure
@@ -123,6 +132,8 @@ struct fimc_md {
struct

[PATCH/RFC v9 14/19] media: Add registration helpers for V4L2 flash sub-devices

2014-12-03 Thread Jacek Anaszewski
This patch adds helper functions for registering/unregistering
LED Flash class devices as V4L2 sub-devices. The functions should
be called from the LED subsystem device driver. In case the
support for V4L2 Flash sub-devices is disabled in the kernel
config the functions' empty versions will be used.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sakari Ailus 
Cc: Hans Verkuil 
---
 drivers/media/v4l2-core/Kconfig  |   11 +
 drivers/media/v4l2-core/Makefile |2 +
 drivers/media/v4l2-core/v4l2-flash.c |  546 ++
 include/media/v4l2-flash.h   |  139 +
 4 files changed, 698 insertions(+)
 create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
 create mode 100644 include/media/v4l2-flash.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a..f034f1a 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
 tristate
 depends on VIDEOBUF2_CORE
 
+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+   tristate "Enable support for Flash sub-devices"
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable support for Flash sub-devices, which allow
+ to control LED class devices with use of V4L2 Flash controls.
+
+ When in doubt, say N.
+
 # Used by drivers that need Videobuf modules
 config VIDEOBUF_GEN
tristate
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile
index 63d29f2..44e858c 100644
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
 
 obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
 
+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
+
 obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
 obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
 obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
new file mode 100644
index 000..beff400
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -0,0 +1,546 @@
+/*
+ * V4L2 Flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation."
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define has_flash_op(v4l2_flash, op)   \
+   (v4l2_flash && v4l2_flash->ops->op)
+
+#define call_flash_op(v4l2_flash, op, args...) \
+   (has_flash_op(v4l2_flash, op) ? \
+   v4l2_flash->ops->op(args) : \
+   -EINVAL)
+
+static inline enum led_brightness v4l2_flash_intensity_to_led_brightness(
+   struct v4l2_ctrl **ctrls,
+   enum ctrl_init_data_id cdata_id,
+   s32 intensity)
+{
+   struct v4l2_ctrl *ctrl = ctrls[cdata_id];
+   s64 __intensity = intensity - ctrl->minimum;
+
+   do_div(__intensity, ctrl->step);
+
+   /*
+* Indicator leds, unlike torch leds, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Therefore it must be possible to set it to 0 level which in
+* the LED subsystem reflects LED_OFF state.
+*/
+   if (cdata_id != INDICATOR_INTENSITY)
+   ++__intensity;
+
+   return __intensity;
+}
+
+static inline s32 v4l2_flash_led_brightness_to_intensity(
+   struct v4l2_ctrl **ctrls,
+   enum ctrl_init_data_id cdata_id,
+   enum led_brightness brightness)
+{
+   struct v4l2_ctrl *ctrl = ctrls[cdata_id];
+
+   /*
+* Indicator leds, unlike torch leds, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Do not decrement brightness read from the LED subsystem for
+* indicator led as it may equal 0. For torch leds this function
+* is called only when V4L2_FLASH_LED_MODE_TORCH is set and the
+* brightness read is guaranteed to be greater than 0. In other
+* cases the cached torch intensity value is used.
+*/
+   if (cdata_id != INDICATOR_INTENSITY)
+   --brightness;
+
+   return (brightness * ctrl->step) + ctrl->minimum;
+}
+
+static int v4l2_flash_g_volatile_ctrl(struct v4l2_ctrl *c)
+{
+   struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c);
+   struct led_classdev_flash *flash = v4l2_flash->flash;
+  

[PATCH/RFC v9 09/19] of: Add Skyworks Solutions, Inc. vendor prefix

2014-12-03 Thread Jacek Anaszewski
Use "skyworks" as the vendor prefix for the Skyworks Solutions, Inc.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: 
---
 .../devicetree/bindings/vendor-prefixes.txt|1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index c177cd7..3006825 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -137,6 +137,7 @@ ricoh   Ricoh Co. Ltd.
 rockchip   Fuzhou Rockchip Electronics Co., Ltd
 samsungSamsung Semiconductor
 sandiskSandisk Corporation
+skyworks   Skyworks Solutions, Inc.
 sbsSmart Battery System
 schindler  Schindler
 seagateSeagate Technology PLC
-- 
1.7.9.5

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


[PATCH/RFC v9 06/19] DT: Add documentation for the mfd Maxim max77693

2014-12-03 Thread Jacek Anaszewski
This patch adds device tree binding documentation for
the flash cell of the Maxim max77693 multifunctional device.

Signed-off-by: Jacek Anaszewski 
Signed-off-by: Andrzej Hajda 
Acked-by: Kyungmin Park 
Cc: Lee Jones 
Cc: Chanwoo Choi 
Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: 
---
 Documentation/devicetree/bindings/mfd/max77693.txt |   89 
 1 file changed, 89 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/max77693.txt 
b/Documentation/devicetree/bindings/mfd/max77693.txt
index 01e9f30..25a6e78 100644
--- a/Documentation/devicetree/bindings/mfd/max77693.txt
+++ b/Documentation/devicetree/bindings/mfd/max77693.txt
@@ -41,7 +41,66 @@ Optional properties:
 To get more informations, please refer to documentaion.
[*] refer Documentation/devicetree/bindings/pwm/pwm.txt
 
+- led : the LED submodule device node
+
+There are two led outputs available - fled1 and fled2. Each of them can
+control a separate led or they can be connected together to double
+the maximum current for a single connected led. One led is represented
+by one child node.
+
+Required properties:
+- compatible : Must be "maxim,max77693-led".
+
+Optional properties:
+- maxim,fleds : Array of current outputs in order: fled1, fled2.
+   Note: both current outputs can be connected to a single led
+   Possible values:
+   MAX77693_LED_FLED_UNUSED - the output is left disconnected,
+   MAX77693_LED_FLED_USED - a diode is connected to the output.
+- maxim,trigger-type : Array of trigger types in order: flash, torch.
+   Possible trigger types:
+   MAX77693_LED_TRIG_TYPE_EDGE - Rising edge of the signal triggers
+   the flash/torch,
+   MAX77693_LED_TRIG_TYPE_LEVEL - Signal level controls duration of
+   the flash/torch.
+- maxim,trigger : Array of flags indicating which trigger can activate given 
led
+   in order: fled1, fled2.
+   Possible flag values (can be combined):
+   MAX77693_LED_TRIG_FLASHEN - FLASHEN pin of the chip,
+   MAX77693_LED_TRIG_TORCHEN - TORCHEN pin of the chip,
+   MAX77693_LED_TRIG_SOFTWARE - software via I2C command.
+- maxim,boost-mode :
+   In boost mode the device can produce up to 1.2A of total current
+   on both outputs. The maximum current on each output is reduced
+   to 625mA then. If there are two child led nodes defined then boost
+   is enabled by default.
+   Possible values:
+   MAX77693_LED_BOOST_OFF - no boost,
+   MAX77693_LED_BOOST_ADAPTIVE - adaptive mode,
+   MAX77693_LED_BOOST_FIXED - fixed mode.
+- maxim,boost-vout : Output voltage of the boost module in millivolts.
+- maxim,vsys-min : Low input voltage level in millivolts. Flash is not fired
+   if chip estimates that system voltage could drop below this level due
+   to flash power consumption.
+
+Required properties of the LED child node:
+- label : see Documentation/devicetree/bindings/leds/common.txt
+- maxim,fled_id : Identifier of the fled output the led is connected to;
+   MAX77693_LED_FLED1 - FLED1 output of the device - it has to be
+   used also if a single LED is connected to both outputs,
+   MAX77693_LED_FLED2 - FLED2 output of the device.
+
+Optional properties of the LED child node:
+- max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 25
+- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
+   Range: 15625 - 100
+- flash-timeout-microsec : see 
Documentation/devicetree/bindings/leds/common.txt
+   Range: 62500 - 100
+
 Example:
+#include 
+
max77693@66 {
compatible = "maxim,max77693";
reg = <0x66>;
@@ -73,4 +132,34 @@ Example:
pwms = <&pwm 0 4 0>;
pwm-names = "haptic";
};
+
+   led {
+   compatible = "maxim,max77693-led";
+   maxim,fleds = ;
+   maxim,trigger = ;
+   maxim,trigger-type = ;
+   maxim,boost-mode = ;
+   maxim,boost-vout = <5000>;
+   maxim,vsys-min = <2400>;
+
+   camera1_flash: led1 {
+   maxim,fled_id = ;
+   label = "max77693-flash1";
+   max-microamp = <25>;
+   flash-max-microamp = <625000>;
+   flash-timeout-microsec = <100>;
+   };
+
+   camera2_flash: led2 {
+   maxim,fled_id = ;
+   label = "max77693-flash2";
+ 

[PATCH/RFC v9 03/19] mfd: max77693: Modify flash cell name identifiers

2014-12-03 Thread Jacek Anaszewski
Change flash cell identifiers from max77693-flash to max77693-led
to avoid confusion with NOR/NAND Flash.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Chanwoo Choi 
Cc: Lee Jones 
---
 drivers/mfd/max77693.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index a159593..cb14afa 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -53,8 +53,8 @@ static const struct mfd_cell max77693_devs[] = {
.of_compatible = "maxim,max77693-haptic",
},
{
-   .name = "max77693-flash",
-   .of_compatible = "maxim,max77693-flash",
+   .name = "max77693-led",
+   .of_compatible = "maxim,max77693-led",
},
 };
 
-- 
1.7.9.5

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


[PATCH/RFC v9 07/19] dt-binding: mfd: max77693: Add DT binding related macros

2014-12-03 Thread Jacek Anaszewski
Add macros for max77693 led part related binding.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Lee Jones 
Cc: Chanwoo Choi 
---
 include/dt-bindings/mfd/max77693.h |   38 
 1 file changed, 38 insertions(+)
 create mode 100644 include/dt-bindings/mfd/max77693.h

diff --git a/include/dt-bindings/mfd/max77693.h 
b/include/dt-bindings/mfd/max77693.h
new file mode 100644
index 000..4011cb47
--- /dev/null
+++ b/include/dt-bindings/mfd/max77693.h
@@ -0,0 +1,38 @@
+/*
+ * This header provides macros for MAX77693 device binding
+ *
+ * Copyright (C) 2014, Samsung Electronics Co., Ltd.
+ *
+ * Author: Jacek Anaszewski 
+ */
+
+#ifndef __DT_BINDINGS_MAX77693_H__
+#define __DT_BINDINGS_MAX77693_H
+
+/* External control pins */
+#define MAX77693_LED_FLED_UNUSED   0
+#define MAX77693_LED_FLED_USED 1
+
+/* FLED pins */
+#define MAX77693_LED_FLED1 1
+#define MAX77693_LED_FLED2 2
+
+/* External trigger type */
+#define MAX77693_LED_TRIG_TYPE_EDGE0
+#define MAX77693_LED_TRIG_TYPE_LEVEL   1
+
+/* Trigger flags */
+#define MAX77693_LED_TRIG_FLASHEN  (1 << 0)
+#define MAX77693_LED_TRIG_TORCHEN  (1 << 1)
+#define MAX77693_LED_TRIG_SOFTWARE (1 << 2)
+
+#define MAX77693_LED_TRIG_ALL  (MAX77693_LED_TRIG_FLASHEN | \
+MAX77693_LED_TRIG_TORCHEN | \
+MAX77693_LED_TRIG_SOFTWARE)
+
+/* Boost modes */
+#define MAX77693_LED_BOOST_OFF 0
+#define MAX77693_LED_BOOST_ADAPTIVE1
+#define MAX77693_LED_BOOST_FIXED   2
+
+#endif /* __DT_BINDINGS_MAX77693_H */
-- 
1.7.9.5

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


[PATCH/RFC v9 04/19] mfd: max77693: adjust max77693_led_platform_data

2014-12-03 Thread Jacek Anaszewski
Add "label" array for Device Tree strings with the name of a LED device
and make flash_timeout a two element array, for caching the sub-led
related flash timeout. Added is also an array for caching pointers to the
sub-nodes representing sub-leds.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Chanwoo Choi 
Cc: Lee Jones 
---
 include/linux/mfd/max77693.h |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index f0b6585..c80ee99 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -88,16 +88,18 @@ enum max77693_led_boost_mode {
 };
 
 struct max77693_led_platform_data {
+   const char *label[2];
u32 fleds[2];
u32 iout_torch[2];
u32 iout_flash[2];
u32 trigger[2];
u32 trigger_type[2];
+   u32 flash_timeout[2];
u32 num_leds;
u32 boost_mode;
-   u32 flash_timeout;
u32 boost_vout;
u32 low_vsys;
+   struct device_node *sub_nodes[2];
 };
 
 /* MAX77693 */
-- 
1.7.9.5

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


[PATCH/RFC v9 11/19] v4l2-async: change custom.match callback argument type

2014-12-03 Thread Jacek Anaszewski
It is useful to have an access to the async sub-device
being matched, not only to the related struct device.
Change match callback argument from struct device
to struct v4l2_subdev.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Guennadi Liakhovetski 
Cc: Laurent Pinchart 
Cc: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-async.c |   16 
 include/media/v4l2-async.h   |2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index 85a6a34..8140992 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -22,10 +22,10 @@
 #include 
 #include 
 
-static bool match_i2c(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 #if IS_ENABLED(CONFIG_I2C)
-   struct i2c_client *client = i2c_verify_client(dev);
+   struct i2c_client *client = i2c_verify_client(sd->dev);
return client &&
asd->match.i2c.adapter_id == client->adapter->nr &&
asd->match.i2c.address == client->addr;
@@ -34,14 +34,14 @@ static bool match_i2c(struct device *dev, struct 
v4l2_async_subdev *asd)
 #endif
 }
 
-static bool match_devname(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_devname(struct v4l2_subdev *sd, struct v4l2_async_subdev 
*asd)
 {
-   return !strcmp(asd->match.device_name.name, dev_name(dev));
+   return !strcmp(asd->match.device_name.name, dev_name(sd->dev));
 }
 
-static bool match_of(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
-   return dev->of_node == asd->match.of.node;
+   return sd->dev->of_node == asd->match.of.node;
 }
 
 static LIST_HEAD(subdev_list);
@@ -52,7 +52,7 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct 
v4l2_async_notifier *
struct v4l2_subdev *sd)
 {
struct v4l2_async_subdev *asd;
-   bool (*match)(struct device *, struct v4l2_async_subdev *);
+   bool (*match)(struct v4l2_subdev *, struct v4l2_async_subdev *);
 
list_for_each_entry(asd, ¬ifier->waiting, list) {
/* bus_type has been verified valid before */
@@ -79,7 +79,7 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct 
v4l2_async_notifier *
}
 
/* match cannot be NULL here */
-   if (match(sd->dev, asd))
+   if (match(sd, asd))
return asd;
}
 
diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
index 7683569..1c0b586 100644
--- a/include/media/v4l2-async.h
+++ b/include/media/v4l2-async.h
@@ -51,7 +51,7 @@ struct v4l2_async_subdev {
unsigned short address;
} i2c;
struct {
-   bool (*match)(struct device *,
+   bool (*match)(struct v4l2_subdev *,
  struct v4l2_async_subdev *);
void *priv;
} custom;
-- 
1.7.9.5

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


[PATCH/RFC v9 13/19] v4l2-ctrls: Add V4L2_CID_FLASH_SYNC_STROBE control

2014-12-03 Thread Jacek Anaszewski
Add V4L2_CID_FLASH_SYNC_STROBE control for determining
whether a flash device strobe has to be synchronized
with other flash leds controller by the same device.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sakari Ailus 
Cc: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/controls.xml |   11 +++
 drivers/media/v4l2-core/v4l2-ctrls.c |2 ++
 include/uapi/linux/v4l2-controls.h   |1 +
 3 files changed, 14 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index e013e4b..20179ab 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4563,6 +4563,17 @@ interface and may change in the future.
after strobe during which another strobe will not be
possible. This is a read-only control.
  
+ 
+   V4L2_CID_FLASH_SYNC_STROBE
+   boolean
+ 
+ 
+   Synchronized strobe: whether the flash
+   should be strobed synchronously with the other one controlled
+   by the same device. Flash timeout setting is inherited from the
+   LED being strobed explicitly and flash intensity setting of a LED
+   being synchronized is used.
+ 
  

   
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 45c5b47..a7cca8c 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -846,6 +846,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_FLASH_FAULT:  return "Faults";
case V4L2_CID_FLASH_CHARGE: return "Charge";
case V4L2_CID_FLASH_READY:  return "Ready to Strobe";
+   case V4L2_CID_FLASH_SYNC_STROBE:return "Synchronize Strobe";
 
/* JPEG encoder controls */
/* Keep the order of the 'case's the same as in v4l2-controls.h! */
@@ -949,6 +950,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_FLASH_STROBE_STATUS:
case V4L2_CID_FLASH_CHARGE:
case V4L2_CID_FLASH_READY:
+   case V4L2_CID_FLASH_SYNC_STROBE:
case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE:
case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:
diff --git a/include/uapi/linux/v4l2-controls.h 
b/include/uapi/linux/v4l2-controls.h
index 661f119..5bce13d 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -833,6 +833,7 @@ enum v4l2_flash_strobe_source {
 
 #define V4L2_CID_FLASH_CHARGE  (V4L2_CID_FLASH_CLASS_BASE + 11)
 #define V4L2_CID_FLASH_READY   (V4L2_CID_FLASH_CLASS_BASE + 12)
+#define V4L2_CID_FLASH_SYNC_STROBE (V4L2_CID_FLASH_CLASS_BASE + 13)
 
 
 /* JPEG-class control IDs */
-- 
1.7.9.5

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


[PATCH/RFC v9 19/19] leds: aat1290: add support for V4L2 Flash sub-device

2014-12-03 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the aat1290 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: Sakari Ailus 
---
 drivers/leds/leds-aat1290.c |   61 +++
 1 file changed, 61 insertions(+)

diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index 15d969b..81a8f48 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define AAT1290_MOVIE_MODE_CURRENT_ADDR17
@@ -63,6 +64,7 @@ struct aat1290_led {
struct mutex lock;
 
struct led_classdev_flash ldev;
+   struct v4l2_flash *v4l2_flash;
 
int flen_gpio;
int en_set_gpio;
@@ -280,11 +282,51 @@ static void aat1290_init_flash_settings(struct 
aat1290_led *led,
setting->val = setting->max;
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+static void aat1290_init_v4l2_ctrl_config(struct aat1290_led_settings *s,
+   struct v4l2_flash_ctrl_config *config)
+{
+   struct led_flash_setting *setting;
+   struct v4l2_ctrl_config *c;
+
+   c = &config->intensity;
+   setting = &s->torch_brightness;
+   c->min = setting->min;
+   c->max = setting->max;
+   c->step = setting->step;
+   c->def = setting->val;
+
+   c = &config->flash_timeout;
+   setting = &s->flash_timeout;
+   c->min = setting->min;
+   c->max = setting->max;
+   c->step = setting->step;
+   c->def = setting->val;
+
+   config->has_external_strobe = false;
+}
+#else
+#define aat1290_init_v4l2_ctrl_config(s, config)
+#endif
+
 static const struct led_flash_ops flash_ops = {
.strobe_set = aat1290_led_flash_strobe_set,
.timeout_set = aat1290_led_flash_timeout_set,
 };
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+static const struct v4l2_flash_ops v4l2_flash_ops = {
+   .external_strobe_set = NULL,
+};
+
+static const struct v4l2_flash_ops *get_v4l2_flash_ops(void)
+{
+   return &v4l2_flash_ops;
+}
+#else
+#define get_v4l2_flash_ops() (NULL)
+#endif
+
 static int aat1290_led_probe(struct platform_device *pdev)
 {
struct device *dev = &pdev->dev;
@@ -292,6 +334,9 @@ static int aat1290_led_probe(struct platform_device *pdev)
struct aat1290_led *led;
struct led_classdev *led_cdev;
struct led_classdev_flash *flash;
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+   struct v4l2_flash_ctrl_config v4l2_flash_config;
+#endif
struct aat1290_led_settings settings;
int flen_gpio, enset_gpio, ret;
 
@@ -344,6 +389,9 @@ static int aat1290_led_probe(struct platform_device *pdev)
 
flash->timeout = settings.flash_timeout;
 
+   /* Init V4L2 Flash controls basing on initialized settings */
+   aat1290_init_v4l2_ctrl_config(&settings, &v4l2_flash_config);
+
/* Init led class */
led_cdev = &flash->led_cdev;
led_cdev->name = led->label;
@@ -361,8 +409,20 @@ static int aat1290_led_probe(struct platform_device *pdev)
if (ret < 0)
goto error_gpio_en_set;
 
+   /* Create V4L2 Flash subdev. */
+   led->v4l2_flash = v4l2_flash_init(flash,
+ get_v4l2_flash_ops(),
+ dev_node,
+ &v4l2_flash_config);
+   if (IS_ERR(led->v4l2_flash)) {
+   ret = PTR_ERR(led->v4l2_flash);
+   goto error_v4l2_flash_init;
+   }
+
return 0;
 
+error_v4l2_flash_init:
+   led_classdev_flash_unregister(flash);
 error_gpio_en_set:
if (gpio_is_valid(enset_gpio))
gpio_free(enset_gpio);
@@ -378,6 +438,7 @@ static int aat1290_led_remove(struct platform_device *pdev)
 {
struct aat1290_led *led = platform_get_drvdata(pdev);
 
+   v4l2_flash_release(led->v4l2_flash);
led_classdev_flash_unregister(&led->ldev);
cancel_work_sync(&led->work_brightness_set);
 
-- 
1.7.9.5

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


[PATCH/RFC v9 17/19] DT: Add documentation for exynos4-is 'flashes' property

2014-12-03 Thread Jacek Anaszewski
This patch adds a description of 'flashes' property
to the samsung-fimc.txt.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Sylwester Nawrocki 
Cc: Rob Herring 
Cc: Pawel Moll 
Cc: Mark Rutland 
Cc: Ian Campbell 
Cc: Kumar Gala 
Cc: 
---
 .../devicetree/bindings/media/samsung-fimc.txt |7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/samsung-fimc.txt 
b/Documentation/devicetree/bindings/media/samsung-fimc.txt
index 922d6f8..22a6b2f 100644
--- a/Documentation/devicetree/bindings/media/samsung-fimc.txt
+++ b/Documentation/devicetree/bindings/media/samsung-fimc.txt
@@ -40,6 +40,12 @@ should be inactive. For the "active-a" state the camera port 
A must be activated
 and the port B deactivated and for the state "active-b" it should be the other
 way around.
 
+Optional properties:
+
+- flashes - Array of phandles to flash LED devices, or their sub-nodes
+   representing sub-leds.
+   (see Documentation/devicetree/bindings/leds/common.txt)
+
 The 'camera' node must include at least one 'fimc' child node.
 
 
@@ -166,6 +172,7 @@ Example:
clock-output-names = "cam_a_clkout", "cam_b_clkout";
pinctrl-names = "default";
pinctrl-0 = <&cam_port_a_clk_active>;
+   flashes = <&camera_flash>, <&system_torch>;
status = "okay";
#address-cells = <1>;
#size-cells = <1>;
-- 
1.7.9.5

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


[PATCH/RFC v9 18/19] leds: max77693: add support for V4L2 Flash sub-device

2014-12-03 Thread Jacek Anaszewski
Add support for V4L2 Flash sub-device to the max77693 LED Flash class
driver. The support allows for V4L2 Flash sub-device to take the control
of the LED Flash class device.

Signed-off-by: Jacek Anaszewski 
Acked-by: Kyungmin Park 
Cc: Bryan Wu 
Cc: Richard Purdie 
Cc: Sakari Ailus 
---
 drivers/leds/leds-max77693.c |  133 +-
 1 file changed, 132 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
index 67a2f8f..e93edbd 100644
--- a/drivers/leds/leds-max77693.c
+++ b/drivers/leds/leds-max77693.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define MODE_OFF   0
 #define MODE_FLASH1(1 << 0)
@@ -49,6 +50,7 @@ enum {
 struct max77693_sub_led {
struct led_classdev_flash ldev;
struct work_struct work_brightness_set;
+   struct v4l2_flash *v4l2_flash;
 
unsigned int torch_brightness;
unsigned int flash_timeout;
@@ -602,6 +604,32 @@ unlock:
\
return ret; \
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+#define MAX77693_LED_FLASH_EXTERNAL_STROBE_SET(ID) \
+static int max77693_led##ID##_external_strobe_set( \
+   struct v4l2_flash *v4l2_flash,  \
+   bool enable)\
+{  \
+   struct max77693_led *led =  \
+   ldev##ID##_to_led(v4l2_flash->flash);   \
+   int ret;\
+   \
+   mutex_lock(&led->lock); \
+   \
+   if (enable) \
+   ret = max77693_add_mode(led, MODE_FLASH_EXTERNAL##ID);  \
+   else\
+   ret = max77693_clear_mode(led,  \
+   MODE_FLASH_EXTERNAL##ID);   \
+   \
+   mutex_unlock(&led->lock);   \
+   \
+   return ret; \
+}
+#else
+#define MAX77693_LED_FLASH_EXTERNAL_STROBE_SET(ID)
+#endif
+
 #define MAX77693_LED_FLASH_FAULT_GET(ID)   \
 static int max77693_led##ID##_flash_fault_get( \
struct led_classdev_flash *flash,   \
@@ -670,6 +698,7 @@ MAX77693_LED_TORCH_BRIGHTNESS_SET(1)
 MAX77693_LED_FLASH_BRIGHTNESS_SET(1)
 MAX77693_LED_FLASH_STROBE_SET(1)
 MAX77693_LED_FLASH_STROBE_GET(1)
+MAX77693_LED_FLASH_EXTERNAL_STROBE_SET(1)
 MAX77693_LED_FLASH_TIMEOUT_SET(1)
 MAX77693_LED_FLASH_FAULT_GET(1)
 
@@ -679,6 +708,7 @@ MAX77693_LED_TORCH_BRIGHTNESS_SET(2)
 MAX77693_LED_FLASH_BRIGHTNESS_SET(2)
 MAX77693_LED_FLASH_STROBE_SET(2)
 MAX77693_LED_FLASH_STROBE_GET(2)
+MAX77693_LED_FLASH_EXTERNAL_STROBE_SET(2)
 MAX77693_LED_FLASH_TIMEOUT_SET(2)
 MAX77693_LED_FLASH_FAULT_GET(2)
 
@@ -838,9 +868,35 @@ static const struct led_flash_ops flash_ops##ID = {
\
.fault_get  = max77693_led##ID##_flash_fault_get,   
\
 }
 
+#if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
+#define MAX77693_LED_V4L2_FLASH_OPS(ID)
\
+static const struct v4l2_flash_ops v4l2_flash##ID##_ops = {
\
+   .external_strobe_set = max77693_led##ID##_external_strobe_set,  
\
+}
+
+#define MAX77693_LED_GET_V4L2_FLASH_OPS(ID)
\
+static inline const struct v4l2_flash_ops *get_v4l2_flash##ID##_ops(void)  
\
+{  
\
+   return &v4l2_flash##ID##_ops;   
\
+}
+#else
+#define MAX77693_LED_V4L2_FLASH_OPS(ID)
+
+#define MAX77693_LED_GET_V4L2_FLASH_OPS(ID)
\
+static inline const struct v4l2_flash_ops *get_v4l2_flash##ID##_ops(void)  
\
+{  
\
+   return NULL;
\
+}
+#endif
+
 MAX77693_LED_INIT_FLASH_OPS(1);
 MAX77693_LED_INIT_FLASH_OPS(2);
 
+MAX77693_LED_V4L2_FLASH_OPS(1);
+MAX77693_LED_V4L2_FLASH_OPS(2);
+MAX77693_LED_GET_V4L2_FLASH_OPS(1);
+MAX77693_LED_GET_V4L2_FLASH_OPS(2);
+
 static void max7769

Re: [PATCH] Add LVDS RGB media bus formats

2014-12-03 Thread Sakari Ailus
Hi Philipp,

On Tue, Dec 02, 2014 at 08:41:24PM +0100, Philipp Zabel wrote:
> This patch adds three new RGB media bus formats that describe
> 18-bit or 24-bit samples transferred over an LVDS bus with three
> or four differential data pairs, serialized into 7 time slots,
> using standard SPWG/PSWG/VESA or JEIDA data ordering.
> 
> Signed-off-by: Philipp Zabel 
> ---
>  Documentation/DocBook/media/v4l/subdev-formats.xml | 189 
> +
>  include/uapi/linux/media-bus-format.h  |   5 +-
>  2 files changed, 193 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
> b/Documentation/DocBook/media/v4l/subdev-formats.xml
> index 0d6f731..52d7f04 100644
> --- a/Documentation/DocBook/media/v4l/subdev-formats.xml
> +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
> @@ -89,6 +89,11 @@
>MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE.
>
>  
> +  On LVDS buses, usually each sample is transferred in seven time 
> slots
> +  on three (18-bit) or four (24-bit) differential data pairs at the same 
> time.
> +  The remaining bits are used for control signals as defined by 
> SPWG/PSWG/VESA
> +  or JEIDA standards.
> +
>The following tables list existing packed RGB formats.
>  
>
> @@ -606,6 +611,190 @@
> 
>   
>
> +  
> + LVDS RGB formats
> + 
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> +   
> + 
> +   Identifier
> +   Code
> +   
> +   
> +   Data organization
> + 
> + 
> +   
> +   
> +   Pair
> +   Slot
> +   0
> +   1
> +   2
> +   3
> +   4
> +   5
> +   6
> + 
> +   
> +   
> + 
> +   MEDIA_BUS_FMT_RGB666_LVDS_SPWG
> +   0x1010
> +   data0
> +   
> +   g0
> +   r5
> +   r4
> +   r3
> +   r2
> +   r1
> +   r0
> + 
> + 
> +   
> +   
> +   data1
> +   
> +   b1
> +   b0
> +   g5
> +   g4
> +   g3
> +   g2
> +   g1
> + 
> + 
> +   
> +   
> +   data2
> +   
> +   de
> +   vs
> +   hs
> +   b5
> +   b4
> +   b3
> +   b2
> + 
> + 
> +   MEDIA_BUS_FMT_RGB888_LVDS_SPWG
> +   0x1011
> +   data0
> +   
> +   g0
> +   r5
> +   r4
> +   r3
> +   r2
> +   r1
> +   r0
> + 
> + 
> +   
> +   
> +   data1
> +   
> +   b1
> +   b0
> +   g5
> +   g4
> +   g3
> +   g2
> +   g1
> + 
> + 
> +   
> +   
> +   data2
> +   
> +   de
> +   vs
> +   hs
> +   b5
> +   b4
> +   b3
> +   b2
> + 
> + 
> +   
> +   
> +   data3
> +   
> +   ctl
> +   b7
> +   b6
> +   g7
> +   g6
> +   r7
> +   r6
> + 
> + 
> +   MEDIA_BUS_FMT_RGB888_LVDS_JEIDA
> +   0x1012
> +   data0
> +   
> +   g2
> +   r7
> +   r6
> +   r5
> +   r4
> +   r3
> +   r2
> + 
> + 
> +   
> +   
> +   data1
> +   
> +   b3
> +   b2
> +   g7
> +   g6
> +   g5
> +   g4
> +   g3
> + 
> + 
> +   
> +   
> +   data2
> +   
> +   de
> +   vs
> +   hs
> +   b7
> +   b6
> +   b5
> +   b4
> + 
> + 
> +   
> +   
> +   data3
> +   
> +   ctl
> +   b1
> +   b0
> +   g1
> +   g0
> +   r1
> +   r0
> + 
> +   
> + 
> +  

In general, I'd be more concerned with the pixel data itself than on low
level bus signalling related matters. For that reason I'd just say the
non-data bits are simply undefined.

We already support the CSI-2 bus, but the formats we use make no mention of
the standard itself. (A note to myself, they still should have been
separated from parallel format definitions.)

Could you instead create more generic format definitions that are not
specific to SPWG/PSWG/VESA or JEIDA?

I think this falls to the domain of the parallel-like interfaces since it
defines per bus pin which data is transferred over which pin. Is the wire
order defined by the abo

[GIT PULL FOR v3.19] videobuf2 race condition fixes

2014-12-03 Thread Laurent Pinchart
Hi Mauro,

Would it still be possible to get those two race condition fixes in v3.19 ?

The following changes since commit e8bd888a148cb55a5ba27070fdfeb62386c89577:

  [media] omap_vout: fix compile warnings (2014-12-02 11:35:05 -0200)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git v4l2/core

for you to fetch changes up to b8e73cc952d29020370c8f005d242c178463f4ec:

  v4l: vb2: Fix race condition in _vb2_fop_release (2014-12-03 17:15:55 +0200)


Laurent Pinchart (2):
  v4l: vb2: Fix race condition in vb2_fop_poll
  v4l: vb2: Fix race condition in _vb2_fop_release

 drivers/media/v4l2-core/videobuf2-core.c | 35 +++
 1 file changed, 12 insertions(+), 23 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v4 05/10] v4l: of: Add v4l2_of_parse_link() function

2014-12-03 Thread Laurent Pinchart
Hi Sylwester,

Thank you for the review.

On Wednesday 03 December 2014 16:02:12 Sylwester Nawrocki wrote:
> Hi Laurent,
> 
> On 01/12/14 21:13, Laurent Pinchart wrote:
> > The function fills a link data structure with the device node and port
> > number at both the local and remote ends of a link defined by one of its
> > endpoint nodes.
> > 
> > Signed-off-by: Laurent Pinchart 
> > Acked-by: Hans Verkuil 
> > ---
> > 
> >  drivers/media/v4l2-core/v4l2-of.c | 61 ++
> >  include/media/v4l2-of.h   | 27 +
> >  2 files changed, 88 insertions(+)
> > 
> > Cc: Sylwester Nawrocki 
> > 
> > diff --git a/drivers/media/v4l2-core/v4l2-of.c
> > b/drivers/media/v4l2-core/v4l2-of.c index b4ed9a9..c473479 100644
> > --- a/drivers/media/v4l2-core/v4l2-of.c
> > +++ b/drivers/media/v4l2-core/v4l2-of.c
> > @@ -142,3 +142,64 @@ int v4l2_of_parse_endpoint(const struct device_node
> > *node,> 
> > return 0;
> >  
> >  }
> >  EXPORT_SYMBOL(v4l2_of_parse_endpoint);
> > 
> > +
> > +/**
> > + * v4l2_of_parse_link() - parse a link between two endpoints
> > + * @node: pointer to the endpoint at the local end of the link
> > + * @link: pointer to the V4L2 OF link data structure
> > + *
> > + * Fill the link structure with the local and remote nodes and port
> > numbers.
> > + * The local_node and remote_node fields are set to point to the local
> > and
> > + * remote port parent nodes respectively (the port parent node being the
> > parent
>
> Not sure it that improves anything, but how about changing "remote port
> parent" to "remote port's parent" ? I took me a while to understand this
> whole sentence.

I'll fix that.
 
> Anyway the patch looks good to me.
> 
> Acked-by: Sylwester Nawrocki 
> 
> > + * node of the port node if that node isn't a 'ports' node, or the
> > grand-parent + * node of the port node otherwise).
> > + *
> > + * A reference is taken to both the local and remote nodes, the caller
> > must use + * v4l2_of_put_link() to drop the references when done with the
> > link. + *
> > + * Return: 0 on success, or -ENOLINK if the remote endpoint can't be
> > found. + */

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v4 07/10] v4l: vb2: Fix race condition in _vb2_fop_release

2014-12-03 Thread Sylwester Nawrocki
On 01/12/14 21:13, Laurent Pinchart wrote:
> The function releases the queue if the file being released is the queue
> owner. The check reads the queue->owner field without taking the queue
> lock, creating a race condition with functions that set the queue owner,
> such as vb2_ioctl_reqbufs() for instance.
> 
> Fix this by moving the queue->owner check within the mutex protected
> section.
> 
> Signed-off-by: Laurent Pinchart 
> Acked-by: Hans Verkuil 

Acked-by: Sylwester Nawrocki 

--
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 05/10] v4l: of: Add v4l2_of_parse_link() function

2014-12-03 Thread Sylwester Nawrocki
Hi Laurent,

On 01/12/14 21:13, Laurent Pinchart wrote:
> The function fills a link data structure with the device node and port
> number at both the local and remote ends of a link defined by one of its
> endpoint nodes.
> 
> Signed-off-by: Laurent Pinchart 
> Acked-by: Hans Verkuil 
> ---
>  drivers/media/v4l2-core/v4l2-of.c | 61 
> +++
>  include/media/v4l2-of.h   | 27 +
>  2 files changed, 88 insertions(+)
> 
> Cc: Sylwester Nawrocki 
> 
> diff --git a/drivers/media/v4l2-core/v4l2-of.c 
> b/drivers/media/v4l2-core/v4l2-of.c
> index b4ed9a9..c473479 100644
> --- a/drivers/media/v4l2-core/v4l2-of.c
> +++ b/drivers/media/v4l2-core/v4l2-of.c
> @@ -142,3 +142,64 @@ int v4l2_of_parse_endpoint(const struct device_node 
> *node,
>   return 0;
>  }
>  EXPORT_SYMBOL(v4l2_of_parse_endpoint);
> +
> +/**
> + * v4l2_of_parse_link() - parse a link between two endpoints
> + * @node: pointer to the endpoint at the local end of the link
> + * @link: pointer to the V4L2 OF link data structure
> + *
> + * Fill the link structure with the local and remote nodes and port numbers.
> + * The local_node and remote_node fields are set to point to the local and
> + * remote port parent nodes respectively (the port parent node being the 
> parent

Not sure it that improves anything, but how about changing "remote port parent"
to "remote port's parent" ? I took me a while to understand this whole sentence.

Anyway the patch looks good to me.

Acked-by: Sylwester Nawrocki 

> + * node of the port node if that node isn't a 'ports' node, or the 
> grand-parent
> + * node of the port node otherwise).
> + *
> + * A reference is taken to both the local and remote nodes, the caller must 
> use
> + * v4l2_of_put_link() to drop the references when done with the link.
> + *
> + * Return: 0 on success, or -ENOLINK if the remote endpoint can't be found.
> + */

--
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 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Hans Verkuil
On 12/03/14 12:06, Sakari Ailus wrote:
> Hi Hans,
> 
> On Tue, Dec 02, 2014 at 01:21:40PM +0100, Hans Verkuil wrote:
>> From: Hans Verkuil 
>>
>> The crop and selection pad ops are duplicates. Replace all uses of 
>> get/set_crop
>> by get/set_selection. This will make it possible to drop get/set_crop
>> altogether.
>>
>> Signed-off-by: Hans Verkuil 
>> Cc: Sylwester Nawrocki 
>> Cc: Laurent Pinchart 
>> Cc: Prabhakar Lad 
>> Cc: Philipp Zabel 
> 
> For both: 
> 
> Acked-by: Sakari Ailus 
> 
> Another point I'd like to draw attention to are the reserved fields --- some
> drivers appear to zero them whereas some pay no attention. Shouldn't we
> check in the sub-device IOCTL handler that the user has zeroed them, or zero
> them for the user? I think this has probably been discussed before on V4L2.
> Both have their advantages, probably zeroing them in the framework would be
> the best option. What do you think?

If the framework can zero, then that's always better. Also note that valgrind
understands the subdev ioctls, so that will be able to checks apps as well.

I haven't really looked into this yet, but I'm happy to review patches :-)

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 3/3] Add RGB666_1X24_CPADHI media bus format

2014-12-03 Thread Philipp Zabel
Commit 9e74d2926a28 ("staging: imx-drm: add LVDS666 support for parallel
display") describes a 24-bit bus format where three 6-bit components each
take the lower part of 8 bits with the two high bits zero padded. Add a
component-wise padded media bus format RGB666_1X24_CPADHI to support this
connection.

Cc: Emil Renner Berthing 
Signed-off-by: Philipp Zabel 
---
Changes since v1:
 - Added missing /* RGB - next is ... */ comment update
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 30 ++
 include/uapi/linux/media-bus-format.h  |  3 ++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 3d88a25..e60a01f 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -469,6 +469,36 @@
  b1
  b0

+   
+ MEDIA_BUS_FMT_RGB666_1X24_CPADHI
+ 0x1015
+ 
+ &dash-ent-8;
+ 0
+ 0
+ r5
+ r4
+ r3
+ r2
+ r1
+ r0
+ 0
+ 0
+ g5
+ g4
+ g3
+ g2
+ g1
+ g0
+ 0
+ 0
+ b5
+ b4
+ b3
+ b2
+ b1
+ b0
+   

  MEDIA_BUS_FMT_BGR888_1X24
  0x1013
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 35e0579..95826e5 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -33,7 +33,7 @@
 
 #define MEDIA_BUS_FMT_FIXED0x0001
 
-/* RGB - next is   0x1015 */
+/* RGB - next is   0x1016 */
 #define MEDIA_BUS_FMT_RGB444_1X12  0x100e
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE  0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE  0x1002
@@ -45,6 +45,7 @@
 #define MEDIA_BUS_FMT_RGB565_2X8_BE0x1007
 #define MEDIA_BUS_FMT_RGB565_2X8_LE0x1008
 #define MEDIA_BUS_FMT_RGB666_1X18  0x1009
+#define MEDIA_BUS_FMT_RGB666_1X24_CPADHI   0x1015
 #define MEDIA_BUS_FMT_RGB666_LVDS_SPWG 0x1010
 #define MEDIA_BUS_FMT_BGR888_1X24  0x1013
 #define MEDIA_BUS_FMT_GBR888_1X24  0x1014
-- 
2.1.3

--
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 1/3] Add BGR888_1X24 and GBR888_1X24 media bus formats

2014-12-03 Thread Philipp Zabel
This patch adds two more 24-bit RGB formats. BGR888 is more or less common,
GBR888 is used on the internal connection between the IPU display interface
and the TVE (VGA DAC) on i.MX53 SoCs.

Signed-off-by: Philipp Zabel 
Acked-by: Laurent Pinchart 
---
Changes since v1:
 - Reordered 24-bit RGB formats alphabetically
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 60 ++
 include/uapi/linux/media-bus-format.h  |  4 +-
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 52d7f04..a8da9d3 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -469,6 +469,66 @@
  b1
  b0

+   
+ MEDIA_BUS_FMT_BGR888_1X24
+ 0x1013
+ 
+ &dash-ent-8;
+ b7
+ b6
+ b5
+ b4
+ b3
+ b2
+ b1
+ b0
+ g7
+ g6
+ g5
+ g4
+ g3
+ g2
+ g1
+ g0
+ r7
+ r6
+ r5
+ r4
+ r3
+ r2
+ r1
+ r0
+   
+   
+ MEDIA_BUS_FMT_GBR888_1X24
+ 0x1014
+ 
+ &dash-ent-8;
+ g7
+ g6
+ g5
+ g4
+ g3
+ g2
+ g1
+ g0
+ b7
+ b6
+ b5
+ b4
+ b3
+ b2
+ b1
+ b0
+ r7
+ r6
+ r5
+ r4
+ r3
+ r2
+ r1
+ r0
+   

  MEDIA_BUS_FMT_RGB888_1X24
  0x100a
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 7f8b1e2..10b40dd 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -33,7 +33,7 @@
 
 #define MEDIA_BUS_FMT_FIXED0x0001
 
-/* RGB - next is   0x1013 */
+/* RGB - next is   0x1015 */
 #define MEDIA_BUS_FMT_RGB444_1X12  0x100e
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE  0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE  0x1002
@@ -46,6 +46,8 @@
 #define MEDIA_BUS_FMT_RGB565_2X8_LE0x1008
 #define MEDIA_BUS_FMT_RGB666_1X18  0x1009
 #define MEDIA_BUS_FMT_RGB666_LVDS_SPWG 0x1010
+#define MEDIA_BUS_FMT_BGR888_1X24  0x1013
+#define MEDIA_BUS_FMT_GBR888_1X24  0x1014
 #define MEDIA_BUS_FMT_RGB888_1X24  0x100a
 #define MEDIA_BUS_FMT_RGB888_2X12_BE   0x100b
 #define MEDIA_BUS_FMT_RGB888_2X12_LE   0x100c
-- 
2.1.3

--
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 2/3] Add YUV8_1X24 media bus format

2014-12-03 Thread Philipp Zabel
Signed-off-by: Philipp Zabel 
Acked-by: Laurent Pinchart 
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 37 ++
 include/uapi/linux/media-bus-format.h  |  3 +-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index a8da9d3..3d88a25 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -2933,6 +2933,43 @@
  u1
  u0

+   
+ MEDIA_BUS_FMT_YUV8_1X24
+ 0x2024
+ 
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ y7
+ y6
+ y5
+ y4
+ y3
+ y2
+ y1
+ y0
+ u7
+ u6
+ u5
+ u4
+ u3
+ u2
+ u1
+ u0
+ v7
+ v6
+ v5
+ v4
+ v3
+ v2
+ v1
+ v0
+   

  MEDIA_BUS_FMT_YUV10_1X30
  0x2016
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 10b40dd..35e0579 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -55,7 +55,7 @@
 #define MEDIA_BUS_FMT_RGB888_LVDS_JEIDA0x1012
 #define MEDIA_BUS_FMT_ARGB_1X320x100d
 
-/* YUV (including grey) - next is  0x2024 */
+/* YUV (including grey) - next is  0x2025 */
 #define MEDIA_BUS_FMT_Y8_1X8   0x2001
 #define MEDIA_BUS_FMT_UV8_1X8  0x2015
 #define MEDIA_BUS_FMT_UYVY8_1_5X8  0x2002
@@ -81,6 +81,7 @@
 #define MEDIA_BUS_FMT_VYUY10_1X20  0x201b
 #define MEDIA_BUS_FMT_YUYV10_1X20  0x200d
 #define MEDIA_BUS_FMT_YVYU10_1X20  0x200e
+#define MEDIA_BUS_FMT_YUV8_1X240x2024
 #define MEDIA_BUS_FMT_YUV10_1X30   0x2016
 #define MEDIA_BUS_FMT_AYUV8_1X32   0x2017
 #define MEDIA_BUS_FMT_UYVY12_2X12  0x201c
-- 
2.1.3

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


Re: [PATCH 1/3] Add BGR888_1X24 and GBR888_1X24 media bus formats

2014-12-03 Thread Philipp Zabel
Am Mittwoch, den 03.12.2014, 14:48 +0200 schrieb Laurent Pinchart:
> Hi Philipp,
> 
> Thank you for the patch.

Thank you for the comments. I'll fix the issues you pointed out and
resend.

> On Wednesday 03 December 2014 11:28:18 Philipp Zabel wrote:
> > This patch adds two more 24-bit RGB formats. BGR888 is more or less common,
> > GBR888 is used on the internal connection between the IPU display interface
> > and the TVE (VGA DAC) on i.MX53 SoCs.
> 
> Were RGB and BGR patented that they had to use a new format ? :-)

I wish I knew.
[...]

regards
Philipp

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


Re: [PATCH 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Laurent Pinchart
Hi Hans,

On Wednesday 03 December 2014 12:17:57 Hans Verkuil wrote:
> On 12/03/14 12:14, Sylwester Nawrocki wrote:
> > On 02/12/14 13:21, Hans Verkuil wrote:
> >> -static int s5k6aa_set_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh
> >> *fh,
> >> - struct v4l2_subdev_crop *crop)
> >> +static int s5k6aa_set_selection(struct v4l2_subdev *sd,
> >> +  struct v4l2_subdev_fh *fh,
> >> +  struct v4l2_subdev_selection *sel)
> >>  {
> >>struct s5k6aa *s5k6aa = to_s5k6aa(sd);
> >>struct v4l2_mbus_framefmt *mf;
> >>unsigned int max_x, max_y;
> >>struct v4l2_rect *crop_r;
> >> 
> >> +  if (sel->pad || sel->target != V4L2_SEL_TGT_CROP)
> >> +  return -EINVAL;
> >> +
> > 
> > Isn't checking sel->pad redundant here ? There is already the pad index
> > validation in check_selection() in v4l2-subdev.c and this driver has only
> > one pad.
> 
> If it is called from a bridge driver, then it hasn't gone through
> check_selection().
> 
> That said, if it is called from a bridge driver, then one might expect
> correct usage of pad.
> 
> Laurent, do you have an opinion on this?

I would expect the pad to be valid when called from a bridge driver. We could 
double-check that in subdev drivers as a debugging help, but I'm not sure if 
it's worth it.

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 3/3] Add RGB666_1X24_CPADHI media bus format

2014-12-03 Thread Laurent Pinchart
Hi Philipp,

Thank you for the patch.

On Wednesday 03 December 2014 11:28:20 Philipp Zabel wrote:
> Commit 9e74d2926a28 ("staging: imx-drm: add LVDS666 support for parallel
> display") describes a 24-bit bus format where three 6-bit components each
> take the lower part of 8 bits with the two high bits zero padded. Add a
> component-wise padded media bus format RGB666_1X24_CPADHI to support this
> connection.
> 
> Cc: Emil Renner Berthing 
> Signed-off-by: Philipp Zabel 
> ---
>  Documentation/DocBook/media/v4l/subdev-formats.xml | 30 +++
>  include/uapi/linux/media-bus-format.h  |  1 +
>  2 files changed, 31 insertions(+)
> 
> diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml
> b/Documentation/DocBook/media/v4l/subdev-formats.xml index 9afb846..c259b9e
> 100644
> --- a/Documentation/DocBook/media/v4l/subdev-formats.xml
> +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
> @@ -469,6 +469,36 @@
> b1
> b0
>   
> + 
> +   MEDIA_BUS_FMT_RGB666_1X24_CPADHI
> +   0x1015
> +   
> +   &dash-ent-8;
> +   0
> +   0
> +   r5
> +   r4
> +   r3
> +   r2
> +   r1
> +   r0
> +   0
> +   0
> +   g5
> +   g4
> +   g3
> +   g2
> +   g1
> +   g0
> +   0
> +   0
> +   b5
> +   b4
> +   b3
> +   b2
> +   b1
> +   b0
> + 
>   
> MEDIA_BUS_FMT_RGB888_1X24
> 0x100a
> diff --git a/include/uapi/linux/media-bus-format.h
> b/include/uapi/linux/media-bus-format.h index 977316e..ec80fb8 100644
> --- a/include/uapi/linux/media-bus-format.h
> +++ b/include/uapi/linux/media-bus-format.h
> @@ -45,6 +45,7 @@

Could you please update the next value comment ?

>  #define MEDIA_BUS_FMT_RGB565_2X8_BE  0x1007
>  #define MEDIA_BUS_FMT_RGB565_2X8_LE  0x1008
>  #define MEDIA_BUS_FMT_RGB666_1X180x1009
> +#define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015
>  #define MEDIA_BUS_FMT_RGB666_LVDS_SPWG   0x1010
>  #define MEDIA_BUS_FMT_RGB888_1X240x100a
>  #define MEDIA_BUS_FMT_BGR888_1X240x1013

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 2/3] Add YUV8_1X24 media bus format

2014-12-03 Thread Laurent Pinchart
Hi Philipp,

Thank you for the patch.

On Wednesday 03 December 2014 11:28:19 Philipp Zabel wrote:
> Signed-off-by: Philipp Zabel 

Acked-by: Laurent Pinchart 

> ---
>  Documentation/DocBook/media/v4l/subdev-formats.xml | 37 +++
>  include/uapi/linux/media-bus-format.h  |  3 +-
>  2 files changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml
> b/Documentation/DocBook/media/v4l/subdev-formats.xml index f163767..9afb846
> 100644
> --- a/Documentation/DocBook/media/v4l/subdev-formats.xml
> +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
> @@ -2933,6 +2933,43 @@
> u1
> u0
>   
> + 
> +   MEDIA_BUS_FMT_YUV8_1X24
> +   0x2024
> +   
> +   -
> +   -
> +   -
> +   -
> +   -
> +   -
> +   -
> +   -
> +   y7
> +   y6
> +   y5
> +   y4
> +   y3
> +   y2
> +   y1
> +   y0
> +   u7
> +   u6
> +   u5
> +   u4
> +   u3
> +   u2
> +   u1
> +   u0
> +   v7
> +   v6
> +   v5
> +   v4
> +   v3
> +   v2
> +   v1
> +   v0
> + 
>   
> MEDIA_BUS_FMT_YUV10_1X30
> 0x2016
> diff --git a/include/uapi/linux/media-bus-format.h
> b/include/uapi/linux/media-bus-format.h index 6d7f0c7..977316e 100644
> --- a/include/uapi/linux/media-bus-format.h
> +++ b/include/uapi/linux/media-bus-format.h
> @@ -55,7 +55,7 @@
>  #define MEDIA_BUS_FMT_RGB888_LVDS_JEIDA  0x1012
>  #define MEDIA_BUS_FMT_ARGB_1X32  0x100d
> 
> -/* YUV (including grey) - next is0x2024 */
> +/* YUV (including grey) - next is0x2025 */
>  #define MEDIA_BUS_FMT_Y8_1X8 0x2001
>  #define MEDIA_BUS_FMT_UV8_1X80x2015
>  #define MEDIA_BUS_FMT_UYVY8_1_5X80x2002
> @@ -81,6 +81,7 @@
>  #define MEDIA_BUS_FMT_VYUY10_1X200x201b
>  #define MEDIA_BUS_FMT_YUYV10_1X200x200d
>  #define MEDIA_BUS_FMT_YVYU10_1X200x200e
> +#define MEDIA_BUS_FMT_YUV8_1X24  0x2024
>  #define MEDIA_BUS_FMT_YUV10_1X30 0x2016
>  #define MEDIA_BUS_FMT_AYUV8_1X32 0x2017
>  #define MEDIA_BUS_FMT_UYVY12_2X120x201c

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/3] Add BGR888_1X24 and GBR888_1X24 media bus formats

2014-12-03 Thread Laurent Pinchart
Hi Philipp,

Thank you for the patch.

On Wednesday 03 December 2014 11:28:18 Philipp Zabel wrote:
> This patch adds two more 24-bit RGB formats. BGR888 is more or less common,
> GBR888 is used on the internal connection between the IPU display interface
> and the TVE (VGA DAC) on i.MX53 SoCs.

Were RGB and BGR patented that they had to use a new format ? :-)

> Signed-off-by: Philipp Zabel 
> ---
>  Documentation/DocBook/media/v4l/subdev-formats.xml | 60 +++
>  include/uapi/linux/media-bus-format.h  |  4 +-
>  2 files changed, 63 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml
> b/Documentation/DocBook/media/v4l/subdev-formats.xml index 52d7f04..f163767
> 100644
> --- a/Documentation/DocBook/media/v4l/subdev-formats.xml
> +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
> @@ -499,6 +499,66 @@
> b1
> b0
>   
> + 
> +   MEDIA_BUS_FMT_BGR888_1X24
> +   0x1013
> +   
> +   &dash-ent-8;
> +   b7
> +   b6
> +   b5
> +   b4
> +   b3
> +   b2
> +   b1
> +   b0
> +   g7
> +   g6
> +   g5
> +   g4
> +   g3
> +   g2
> +   g1
> +   g0
> +   r7
> +   r6
> +   r5
> +   r4
> +   r3
> +   r2
> +   r1
> +   r0
> + 
> + 
> +   MEDIA_BUS_FMT_GBR888_1X24
> +   0x1014
> +   
> +   &dash-ent-8;
> +   g7
> +   g6
> +   g5
> +   g4
> +   g3
> +   g2
> +   g1
> +   g0
> +   b7
> +   b6
> +   b5
> +   b4
> +   b3
> +   b2
> +   b1
> +   b0
> +   r7
> +   r6
> +   r5
> +   r4
> +   r3
> +   r2
> +   r1
> +   r0
> + 
>   
> MEDIA_BUS_FMT_RGB888_2X12_BE
> 0x100b
> diff --git a/include/uapi/linux/media-bus-format.h
> b/include/uapi/linux/media-bus-format.h index 7f8b1e2..6d7f0c7 100644
> --- a/include/uapi/linux/media-bus-format.h
> +++ b/include/uapi/linux/media-bus-format.h
> @@ -33,7 +33,7 @@
> 
>  #define MEDIA_BUS_FMT_FIXED  0x0001
> 
> -/* RGB - next is 0x1013 */
> +/* RGB - next is 0x1015 */
>  #define MEDIA_BUS_FMT_RGB444_1X120x100e
>  #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE0x1001
>  #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE0x1002
> @@ -47,6 +47,8 @@
>  #define MEDIA_BUS_FMT_RGB666_1X180x1009
>  #define MEDIA_BUS_FMT_RGB666_LVDS_SPWG   0x1010
>  #define MEDIA_BUS_FMT_RGB888_1X240x100a
> +#define MEDIA_BUS_FMT_BGR888_1X240x1013
> +#define MEDIA_BUS_FMT_GBR888_1X240x1014

Could you move these right before RGB888_1X24 to keep them sorted 
alphabetically ? Same for the documentation part.

With this changed,

Acked-by: Laurent Pinchart 

>  #define MEDIA_BUS_FMT_RGB888_2X12_BE 0x100b
>  #define MEDIA_BUS_FMT_RGB888_2X12_LE 0x100c
>  #define MEDIA_BUS_FMT_RGB888_LVDS_SPWG   0x1011

-- 
Regards,

Laurent Pinchart

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


RE: [PATCH] media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM

2014-12-03 Thread Kamil Debski
Hi,

> From: Rafael J. Wysocki [mailto:r...@rjwysocki.net]
> Sent: Wednesday, December 03, 2014 3:14 AM
> To: linux-media@vger.kernel.org
> Cc: Kyungmin Park; Sylwester Nawrocki; Mauro Carvalho Chehab; Kukjin
> Kim; linux-samsung-...@vger.kernel.org; Kamil Debski; Philipp Zabel;
> Linux PM list; Linux Kernel Mailing List
> Subject: [PATCH] media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
> 
> From: Rafael J. Wysocki 
> 
> After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
> selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
> depending on CONFIG_PM_RUNTIME may now be changed to depend on
> CONFIG_PM.
> 
> The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be
> replaced with CONFIG_PM too.
> 
> Make these changes everywhere under drivers/media/.
> 
> Signed-off-by: Rafael J. Wysocki 
> ---
> 
> Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME
> if
> PM_SLEEP is selected) which is only in linux-next at the moment (via
> the
> linux-pm tree).
> 
> Please let me know if it is OK to take this one into linux-pm.

Looks good, for the s5p_mfc part,
Acked-by: Kamil Debski 

Best wishes,
-- 
Kamil Debski
Samsung R&D Institute Poland


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


Re: [PATCH 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Hans Verkuil
On 12/03/14 12:49, Sylwester Nawrocki wrote:
> On 03/12/14 12:17, Hans Verkuil wrote:
>> Hi Sylwester,
>>
>> On 12/03/14 12:14, Sylwester Nawrocki wrote:
 Hi Hans,

 On 02/12/14 13:21, Hans Verkuil wrote:
>> -static int s5k6aa_set_crop(struct v4l2_subdev *sd, struct 
>> v4l2_subdev_fh *fh,
>> -   struct v4l2_subdev_crop *crop)
>> +static int s5k6aa_set_selection(struct v4l2_subdev *sd,
>> +struct v4l2_subdev_fh *fh,
>> +struct v4l2_subdev_selection *sel)
>>  {
>>  struct s5k6aa *s5k6aa = to_s5k6aa(sd);
>>  struct v4l2_mbus_framefmt *mf;
>>  unsigned int max_x, max_y;
>>  struct v4l2_rect *crop_r;
>>  
>> +if (sel->pad || sel->target != V4L2_SEL_TGT_CROP)
>> +return -EINVAL;
>> +

 Isn't checking sel->pad redundant here ? There is already the pad index
 validation in check_selection() in v4l2-subdev.c and this driver has only
 one pad.
>>
>> If it is called from a bridge driver, then it hasn't gone through
>> check_selection().
>>
>> That said, if it is called from a bridge driver, then one might expect
>> correct usage of pad.
> 
> Indeed, there is still a possibility to have wrong pad index passed
> to those functions.  I won't object to this patch being merged as is,
> even though functional changes could be minimized by not adding a
> check which wasn't originally there. :)
> 
> Acked-by: Sylwester Nawrocki 
> 

I've dropped the sel->pad check.

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 0/4] Media cleanups

2014-12-03 Thread Sakari Ailus
On Mon, Dec 01, 2014 at 02:10:41PM +0100, Hans Verkuil wrote:
> This patch series:
> 
> - Removes all the emacs editor variables in sources.
> - Stops drivers from using the debug field in struct video_device.
>   This field is internal to the v4l2 core and drivers shouldn't
>   set it.
> - Improve debug flag handling.
> - Document the debug attribute.

Nice set!

Acked-by: Sakari Ailus 

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


Re: [PATCH v4 05/10] v4l: of: Add v4l2_of_parse_link() function

2014-12-03 Thread Sakari Ailus
On Mon, Dec 01, 2014 at 10:13:35PM +0200, Laurent Pinchart wrote:
> The function fills a link data structure with the device node and port
> number at both the local and remote ends of a link defined by one of its
> endpoint nodes.
> 
> Signed-off-by: Laurent Pinchart 
> Acked-by: Hans Verkuil 
> ---
>  drivers/media/v4l2-core/v4l2-of.c | 61 
> +++
>  include/media/v4l2-of.h   | 27 +
>  2 files changed, 88 insertions(+)

Acked-by: Sakari Ailus 

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


Re: [PATCH] media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM

2014-12-03 Thread Philipp Zabel
Am Mittwoch, den 03.12.2014, 03:13 +0100 schrieb Rafael J. Wysocki:
> From: Rafael J. Wysocki 
> 
> After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
> selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
> depending on CONFIG_PM_RUNTIME may now be changed to depend on
> CONFIG_PM.
> 
> The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be
> replaced with CONFIG_PM too.
> 
> Make these changes everywhere under drivers/media/.
> 
> Signed-off-by: Rafael J. Wysocki 
> ---
> 
> Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if
> PM_SLEEP is selected) which is only in linux-next at the moment (via the
> linux-pm tree).
> 
> Please let me know if it is OK to take this one into linux-pm.

For the coda part,
Acked-by: Philipp Zabel 

regards
Philipp

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


Re: [PATCH 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Sylwester Nawrocki
On 03/12/14 12:17, Hans Verkuil wrote:
> Hi Sylwester,
> 
> On 12/03/14 12:14, Sylwester Nawrocki wrote:
>> > Hi Hans,
>> > 
>> > On 02/12/14 13:21, Hans Verkuil wrote:
>>> >> -static int s5k6aa_set_crop(struct v4l2_subdev *sd, struct 
>>> >> v4l2_subdev_fh *fh,
>>> >> -   struct v4l2_subdev_crop *crop)
>>> >> +static int s5k6aa_set_selection(struct v4l2_subdev *sd,
>>> >> +struct v4l2_subdev_fh *fh,
>>> >> +struct v4l2_subdev_selection *sel)
>>> >>  {
>>> >>  struct s5k6aa *s5k6aa = to_s5k6aa(sd);
>>> >>  struct v4l2_mbus_framefmt *mf;
>>> >>  unsigned int max_x, max_y;
>>> >>  struct v4l2_rect *crop_r;
>>> >>  
>>> >> +if (sel->pad || sel->target != V4L2_SEL_TGT_CROP)
>>> >> +return -EINVAL;
>>> >> +
>> > 
>> > Isn't checking sel->pad redundant here ? There is already the pad index
>> > validation in check_selection() in v4l2-subdev.c and this driver has only
>> > one pad.
>
> If it is called from a bridge driver, then it hasn't gone through
> check_selection().
> 
> That said, if it is called from a bridge driver, then one might expect
> correct usage of pad.

Indeed, there is still a possibility to have wrong pad index passed
to those functions.  I won't object to this patch being merged as is,
even though functional changes could be minimized by not adding a
check which wasn't originally there. :)

Acked-by: Sylwester Nawrocki 

-- 
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] media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM

2014-12-03 Thread Sylwester Nawrocki
On 03/12/14 03:13, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki 
> 
> After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
> selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
> depending on CONFIG_PM_RUNTIME may now be changed to depend on
> CONFIG_PM.
> 
> The alternative of CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME may be
> replaced with CONFIG_PM too.
> 
> Make these changes everywhere under drivers/media/.
> 
> Signed-off-by: Rafael J. Wysocki 

Acked-by: Sylwester Nawrocki 

> ---
> 
> Note: This depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if
> PM_SLEEP is selected) which is only in linux-next at the moment (via the
> linux-pm tree).
> 
> Please let me know if it is OK to take this one into linux-pm.

I'm fine with this being merged through linux-pm as far as the exynos/s5p
drivers are concerned.

> ---
>  drivers/media/platform/coda/coda-common.c   |4 ++--
>  drivers/media/platform/exynos4-is/fimc-core.c   |6 +++---
>  drivers/media/platform/exynos4-is/fimc-is-i2c.c |2 +-
>  drivers/media/platform/exynos4-is/fimc-lite.c   |2 +-
>  drivers/media/platform/exynos4-is/mipi-csis.c   |2 +-
>  drivers/media/platform/s5p-jpeg/jpeg-core.c |4 ++--
>  drivers/media/platform/s5p-mfc/s5p_mfc.c|2 +-
>  drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |   10 --
>  8 files changed, 15 insertions(+), 17 deletions(-)

--
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 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Hans Verkuil
Hi Sylwester,

On 12/03/14 12:14, Sylwester Nawrocki wrote:
> Hi Hans,
> 
> On 02/12/14 13:21, Hans Verkuil wrote:
>> -static int s5k6aa_set_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh 
>> *fh,
>> -   struct v4l2_subdev_crop *crop)
>> +static int s5k6aa_set_selection(struct v4l2_subdev *sd,
>> +struct v4l2_subdev_fh *fh,
>> +struct v4l2_subdev_selection *sel)
>>  {
>>  struct s5k6aa *s5k6aa = to_s5k6aa(sd);
>>  struct v4l2_mbus_framefmt *mf;
>>  unsigned int max_x, max_y;
>>  struct v4l2_rect *crop_r;
>>  
>> +if (sel->pad || sel->target != V4L2_SEL_TGT_CROP)
>> +return -EINVAL;
>> +
> 
> Isn't checking sel->pad redundant here ? There is already the pad index
> validation in check_selection() in v4l2-subdev.c and this driver has only
> one pad.

If it is called from a bridge driver, then it hasn't gone through
check_selection().

That said, if it is called from a bridge driver, then one might expect
correct usage of pad.

Laurent, do you have an opinion 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 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Sakari Ailus
On Wed, Dec 03, 2014 at 12:14:49PM +0100, Sylwester Nawrocki wrote:
> Hi Hans,
> 
> On 02/12/14 13:21, Hans Verkuil wrote:
> > -static int s5k6aa_set_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh 
> > *fh,
> > -  struct v4l2_subdev_crop *crop)
> > +static int s5k6aa_set_selection(struct v4l2_subdev *sd,
> > +   struct v4l2_subdev_fh *fh,
> > +   struct v4l2_subdev_selection *sel)
> >  {
> > struct s5k6aa *s5k6aa = to_s5k6aa(sd);
> > struct v4l2_mbus_framefmt *mf;
> > unsigned int max_x, max_y;
> > struct v4l2_rect *crop_r;
> >  
> > +   if (sel->pad || sel->target != V4L2_SEL_TGT_CROP)
> > +   return -EINVAL;
> > +
> 
> Isn't checking sel->pad redundant here ? There is already the pad index
> validation in check_selection() in v4l2-subdev.c and this driver has only
> one pad.

Good point. check_crop() does that for the [sg]_crop as well.

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


[REVIEW PATCH 1/2] v4l: Add data_offset to struct v4l2_buffer

2014-12-03 Thread Sakari Ailus
From: Sakari Ailus 

The data_offset field tells the start of the image data from the beginning
of the buffer. The bsize field in struct v4l2_buffer includes this, but the
sizeimage field in struct v4l2_pix_format does not.

Signed-off-by: Sakari Ailus 
---
 Documentation/DocBook/media/v4l/compat.xml  | 11 +++
 Documentation/DocBook/media/v4l/io.xml  | 18 +++---
 Documentation/DocBook/media/v4l/vidioc-qbuf.xml |  3 +--
 drivers/media/usb/cpia2/cpia2_v4l.c |  2 +-
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c   |  4 ++--
 drivers/media/v4l2-core/videobuf2-core.c| 17 -
 include/uapi/linux/videodev2.h  |  4 +++-
 7 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 0a2debf..ad54e72 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2579,6 +2579,17 @@ fields changed from _s32 to _u32.
   
 
 
+
+  V4L2 in Linux 3.20
+  
+   
+ Replaced reserved2 by
+ data_offset in struct
+ v4l2_buffer.
+   
+  
+
+
 
   Relation of V4L2 to other Linux multimedia APIs
 
diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 1c17f80..13baeac 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -839,10 +839,22 @@ is the file descriptor associated with a DMABUF 
buffer.
  
  
__u32
-   reserved2
+   data_offset

-   A place holder for future extensions. Applications
-should set this to 0.
+   
+ Start of the image data from the beginning of the buffer in
+ bytes. Applications must set this for both
+ V4L2_BUF_TYPE_VIDEO_OUTPUT buffers
+ whereas driver must set this for
+ V4L2_BUF_TYPE_VIDEO_CAPTURE buffers
+ before &VIDIOC-PREPARE-BUF; and &VIDIOC-QBUF; IOCTLs. Note
+ that data_offset is included in
+ bytesused. So the size of the image
+ in the plane is bytesused-
+ data_offset at offset
+ data_offset from the start of the
+ plane.
+   
  
  
__u32
diff --git a/Documentation/DocBook/media/v4l/vidioc-qbuf.xml 
b/Documentation/DocBook/media/v4l/vidioc-qbuf.xml
index 3504a7f..f529e4d 100644
--- a/Documentation/DocBook/media/v4l/vidioc-qbuf.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-qbuf.xml
@@ -72,8 +72,7 @@ initialize the bytesused,
 timestamp fields, see  for details.
 Applications must also set flags to 0.
-The reserved2 and
-reserved fields must be set to 0. When using
+The reserved field must be set to 0. When using
 the multi-planar API, the
 m.planes field must contain a userspace pointer
 to a filled-in array of &v4l2-plane; and the length
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c 
b/drivers/media/usb/cpia2/cpia2_v4l.c
index 9caea83..a94e83a 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -952,7 +952,7 @@ static int cpia2_dqbuf(struct file *file, void *fh, struct 
v4l2_buffer *buf)
buf->sequence = cam->buffers[buf->index].seq;
buf->m.offset = cam->buffers[buf->index].data - cam->frame_buffer;
buf->length = cam->frame_size;
-   buf->reserved2 = 0;
+   buf->data_offset = 0;
buf->reserved = 0;
memset(&buf->timecode, 0, sizeof(buf->timecode));
 
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index af63543..e238066 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -326,7 +326,7 @@ struct v4l2_buffer32 {
__s32   fd;
} m;
__u32   length;
-   __u32   reserved2;
+   __u32   data_offset;
__u32   reserved;
 };
 
@@ -491,7 +491,7 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct 
v4l2_buffer32 __user
put_user(kp->timestamp.tv_usec, &up->timestamp.tv_usec) ||
copy_to_user(&up->timecode, &kp->timecode, sizeof(struct 
v4l2_timecode)) ||
put_user(kp->sequence, &up->sequence) ||
-   put_user(kp->reserved2, &up->reserved2) ||
+   put_user(kp->data_offset, &up->data_offset) ||
put_user(kp->reserved, &up->reserved))
return -EFAULT;
 
diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 7aed8f2..3162de8 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -607,6 +607,9 @@ static int __verify_length(struct vb2_buffer *vb, const 

Re: [PATCH 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Sylwester Nawrocki
Hi Hans,

On 02/12/14 13:21, Hans Verkuil wrote:
> -static int s5k6aa_set_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
> -struct v4l2_subdev_crop *crop)
> +static int s5k6aa_set_selection(struct v4l2_subdev *sd,
> + struct v4l2_subdev_fh *fh,
> + struct v4l2_subdev_selection *sel)
>  {
>   struct s5k6aa *s5k6aa = to_s5k6aa(sd);
>   struct v4l2_mbus_framefmt *mf;
>   unsigned int max_x, max_y;
>   struct v4l2_rect *crop_r;
>  
> + if (sel->pad || sel->target != V4L2_SEL_TGT_CROP)
> + return -EINVAL;
> +

Isn't checking sel->pad redundant here ? There is already the pad index
validation in check_selection() in v4l2-subdev.c and this driver has only
one pad.

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


[REVIEW PATCH 2/2] v4l: Add packed Bayer raw10 pixel formats

2014-12-03 Thread Sakari Ailus
From: Aviv Greenberg 

These formats are just like 10-bit raw bayer formats that exist already, but
the pixels are not padded to byte boundaries. Instead, the eight high order
bits of four consecutive pixels are stored in four bytes, followed by a byte
of two low order bits of each of the four pixels.

Signed-off-by: Aviv Greenberg 
Signed-off-by: Sakari Ailus 
---
 .../DocBook/media/v4l/pixfmt-srggb10p.xml  | 83 ++
 Documentation/DocBook/media/v4l/pixfmt.xml |  1 +
 include/uapi/linux/videodev2.h |  5 ++
 3 files changed, 89 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml

diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml 
b/Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml
new file mode 100644
index 000..3e88d8d
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml
@@ -0,0 +1,83 @@
+
+  
+   V4L2_PIX_FMT_SRGGB10P ('pRAA'),
+V4L2_PIX_FMT_SGRBG10P ('pgAA'),
+V4L2_PIX_FMT_SGBRG10P ('pGAA'),
+V4L2_PIX_FMT_SBGGR10P ('pBAA'),
+
+   &manvol;
+  
+  
+   V4L2_PIX_FMT_SRGGB10P
+   V4L2_PIX_FMT_SGRBG10P
+   V4L2_PIX_FMT_SGBRG10P
+   V4L2_PIX_FMT_SBGGR10P
+   10-bit packed Bayer formats
+  
+  
+   Description
+
+   The following four pixel formats are packed raw sRGB /
+   Bayer formats with 10 bits per colour. Every four consequtive
+   colour components are packed into 5 bytes such that each of
+   the first 4 bytes contain their 8 high bits, and the fifth
+   byte contains 4 groups of 2 their low bits. Bytes are stored
+   in memory in little endian order.
+
+   Each n-pixel row contains n/2 green samples and n/2 blue
+   or red samples, with alternating green-red and green-blue
+   rows. They are conventionally described as GRGR... BGBG...,
+   RGRG... GBGB..., etc. Below is an example of one of these
+   formats
+
+
+  V4L2_PIX_FMT_SBGGR10P 4 × 4
+  pixel image
+
+  
+   Byte Order.
+   Each cell is one byte.
+ 
+   
+ 
+ 
+   
+ start + 0:
+ B00high
+ G01high
+ B02high
+ G03high
+ B+G0-3low
+   
+   
+ start + 5:
+ G04high
+ R05high
+ G06high
+ R07high
+ G+R4-7low
+   
+   
+ start + 10:
+ B08high
+ G09high
+ B10high
+ G11high
+ B+G8-11low
+   
+   
+  start + 15:
+ G12high
+ R13high
+ G14high
+ R15high
+ G+R12-15low
+   
+ 
+   
+ 
+   
+  
+
+  
+
diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml 
b/Documentation/DocBook/media/v4l/pixfmt.xml
index df5b23d..5a83d9c 100644
--- a/Documentation/DocBook/media/v4l/pixfmt.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt.xml
@@ -716,6 +716,7 @@ access the palette, this must be done with ioctls of the 
Linux framebuffer API.<
 &sub-srggb10alaw8;
 &sub-srggb10dpcm8;
 &sub-srggb12;
+&sub-srggb10p;
   
 
   
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index e9806c6..faba23a 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -402,6 +402,11 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
 #define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
 #define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
+   /* 10bit raw bayer packed, 5 bytes for every 4 pixels */
+#define V4L2_PIX_FMT_SBGGR10P v4l2_fourcc('p', 'B', 'A', 'A')
+#define V4L2_PIX_FMT_SGBRG10P v4l2_fourcc('p', 'G', 'A', 'A')
+#define V4L2_PIX_FMT_SGRBG10P v4l2_fourcc('p', 'g', 'A', 'A')
+#define V4L2_PIX_FMT_SRGGB10P v4l2_fourcc('p', 'R', 'A', 'A')
/*
 * 10bit raw bayer, expanded to 16 bits
 * rrgg ggbb...
-- 
1.9.1

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


[REVIEW PATCH 0/2] data_offset for single plane buffers, packed raw10

2014-12-03 Thread Sakari Ailus
Hi folks,

These two patches add data_offset support for single-plane buffers and
definitions and documentation for 10-bit packed raw bayer formats.

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


Re: [PATCH 1/2] v4l2 subdevs: replace get/set_crop by get/set_selection

2014-12-03 Thread Sakari Ailus
Hi Hans,

On Tue, Dec 02, 2014 at 01:21:40PM +0100, Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> The crop and selection pad ops are duplicates. Replace all uses of 
> get/set_crop
> by get/set_selection. This will make it possible to drop get/set_crop
> altogether.
> 
> Signed-off-by: Hans Verkuil 
> Cc: Sylwester Nawrocki 
> Cc: Laurent Pinchart 
> Cc: Prabhakar Lad 
> Cc: Philipp Zabel 

For both: 

Acked-by: Sakari Ailus 

Another point I'd like to draw attention to are the reserved fields --- some
drivers appear to zero them whereas some pay no attention. Shouldn't we
check in the sub-device IOCTL handler that the user has zeroed them, or zero
them for the user? I think this has probably been discussed before on V4L2.
Both have their advantages, probably zeroing them in the framework would be
the best option. What do you think?

Definitely out of scope of this set.

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


Re: [PATCH v2] media: platform: add VPFE capture driver support for AM437X

2014-12-03 Thread Hans Verkuil
On 12/03/14 01:29, Lad, Prabhakar wrote:
> From: Benoit Parrot 
> 
> This patch adds Video Processing Front End (VPFE) driver for
> AM437X family of devices
> Driver supports the following:
> - V4L2 API using MMAP buffer access based on videobuf2 api
> - Asynchronous sensor/decoder sub device registration
> - DT support
> 
> Signed-off-by: Benoit Parrot 
> Signed-off-by: Darren Etheridge 
> Signed-off-by: Lad, Prabhakar 
> ---
>  Changes for v2:
>  a> Fixed review comments pointed by Hans.
>  
>  .../devicetree/bindings/media/ti-am437x-vpfe.txt   |   61 +
>  MAINTAINERS|9 +
>  drivers/media/platform/Kconfig |1 +
>  drivers/media/platform/Makefile|2 +
>  drivers/media/platform/am437x/Kconfig  |   11 +
>  drivers/media/platform/am437x/Makefile |2 +
>  drivers/media/platform/am437x/am437x-vpfe.c| 2785 
> 
>  drivers/media/platform/am437x/am437x-vpfe.h|  287 ++
>  drivers/media/platform/am437x/am437x-vpfe_regs.h   |  140 +
>  include/uapi/linux/Kbuild  |1 +
>  include/uapi/linux/am437x-vpfe.h   |  122 +
>  11 files changed, 3421 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
>  create mode 100644 drivers/media/platform/am437x/Kconfig
>  create mode 100644 drivers/media/platform/am437x/Makefile
>  create mode 100644 drivers/media/platform/am437x/am437x-vpfe.c
>  create mode 100644 drivers/media/platform/am437x/am437x-vpfe.h
>  create mode 100644 drivers/media/platform/am437x/am437x-vpfe_regs.h
>  create mode 100644 include/uapi/linux/am437x-vpfe.h
> 
> diff --git a/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt 
> b/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
> new file mode 100644
> index 000..3932e76
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/ti-am437x-vpfe.txt
> @@ -0,0 +1,61 @@
> +Texas Instruments AM437x CAMERA (VPFE)
> +--
> +
> +The Video Processing Front End (VPFE) is a key component for image capture
> +applications. The capture module provides the system interface and the
> +processing capability to connect RAW image-sensor modules and video decoders
> +to the AM437x device.
> +
> +Required properties:
> +- compatible: must be "ti,am437x-vpfe"
> +- reg: physical base address and length of the registers set for the device;
> +- interrupts: should contain IRQ line for the VPFE;
> +- ti,am437x-vpfe-interface: can be one of the following,
> + 0 - Raw Bayer Interface.
> + 1 - 8 Bit BT656 Interface.
> + 2 - 10 Bit BT656 Interface.
> + 3 - YCbCr 8 Bit Interface.
> + 4 - YCbCr 16 Bit Interface.
> +
> +VPFE supports a single port node with parallel bus. It should contain one
> +'port' child node with child 'endpoint' node. Please refer to the bindings
> +defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +Example:
> + vpfe: vpfe@f0034000 {
> + compatible = "ti,am437x-vpfe";
> + reg = <0x48328000 0x2000>;
> + interrupts = ;
> +
> + pinctrl-names = "default", "sleep";
> + pinctrl-0 = <&vpfe_pins_default>;
> + pinctrl-1 = <&vpfe_pins_sleep>;
> +
> + port {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + vpfe0_ep: endpoint {
> + remote-endpoint = <&ov2659_1>;
> + ti,am437x-vpfe-interface = <0>;
> + bus-width = <8>;
> + hsync-active = <0>;
> + vsync-active = <0>;
> + };
> + };
> + };
> +
> + i2c1: i2c@4802a000 {
> +
> + ov2659@30 {
> + compatible = "ti,ov2659";
> + reg = <0x30>;
> +
> + port {
> + ov2659_1: endpoint {
> + remote-endpoint = <&vpfe0_ep>;
> + bus-width = <8>;
> + mclk-frequency = <1200>;
> + };
> + };
> + };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a6288ca..a42d367 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8537,6 +8537,15 @@ S: Maintained
>  F:   drivers/media/platform/davinci/
>  F:   include/media/davinci/
>  
> +TI AM437X VPFE DRIVER
> +M:   Lad, Prabhakar 
> +L:   linux-media@vger.kernel.org
> +W:   http://linuxtv.org/
> +Q:   http://patchwork.linuxtv.org/project/linux-media/list/
> +T:   git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git
> +S:   Maintained
> +F:   drivers/media/platform/am437x/
> +
>  SIS 190 ETHERNET DRIVER
>  M:   Francois Romieu 
>  L:   net...@vger.kernel.org
> diff --git a/drivers

[PATCH 1/3] Add BGR888_1X24 and GBR888_1X24 media bus formats

2014-12-03 Thread Philipp Zabel
This patch adds two more 24-bit RGB formats. BGR888 is more or less common,
GBR888 is used on the internal connection between the IPU display interface
and the TVE (VGA DAC) on i.MX53 SoCs.

Signed-off-by: Philipp Zabel 
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 60 ++
 include/uapi/linux/media-bus-format.h  |  4 +-
 2 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 52d7f04..f163767 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -499,6 +499,66 @@
  b1
  b0

+   
+ MEDIA_BUS_FMT_BGR888_1X24
+ 0x1013
+ 
+ &dash-ent-8;
+ b7
+ b6
+ b5
+ b4
+ b3
+ b2
+ b1
+ b0
+ g7
+ g6
+ g5
+ g4
+ g3
+ g2
+ g1
+ g0
+ r7
+ r6
+ r5
+ r4
+ r3
+ r2
+ r1
+ r0
+   
+   
+ MEDIA_BUS_FMT_GBR888_1X24
+ 0x1014
+ 
+ &dash-ent-8;
+ g7
+ g6
+ g5
+ g4
+ g3
+ g2
+ g1
+ g0
+ b7
+ b6
+ b5
+ b4
+ b3
+ b2
+ b1
+ b0
+ r7
+ r6
+ r5
+ r4
+ r3
+ r2
+ r1
+ r0
+   

  MEDIA_BUS_FMT_RGB888_2X12_BE
  0x100b
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 7f8b1e2..6d7f0c7 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -33,7 +33,7 @@
 
 #define MEDIA_BUS_FMT_FIXED0x0001
 
-/* RGB - next is   0x1013 */
+/* RGB - next is   0x1015 */
 #define MEDIA_BUS_FMT_RGB444_1X12  0x100e
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE  0x1001
 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE  0x1002
@@ -47,6 +47,8 @@
 #define MEDIA_BUS_FMT_RGB666_1X18  0x1009
 #define MEDIA_BUS_FMT_RGB666_LVDS_SPWG 0x1010
 #define MEDIA_BUS_FMT_RGB888_1X24  0x100a
+#define MEDIA_BUS_FMT_BGR888_1X24  0x1013
+#define MEDIA_BUS_FMT_GBR888_1X24  0x1014
 #define MEDIA_BUS_FMT_RGB888_2X12_BE   0x100b
 #define MEDIA_BUS_FMT_RGB888_2X12_LE   0x100c
 #define MEDIA_BUS_FMT_RGB888_LVDS_SPWG 0x1011
-- 
2.1.3

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


[PATCH 3/3] Add RGB666_1X24_CPADHI media bus format

2014-12-03 Thread Philipp Zabel
Commit 9e74d2926a28 ("staging: imx-drm: add LVDS666 support for parallel
display") describes a 24-bit bus format where three 6-bit components each
take the lower part of 8 bits with the two high bits zero padded. Add a
component-wise padded media bus format RGB666_1X24_CPADHI to support this
connection.

Cc: Emil Renner Berthing 
Signed-off-by: Philipp Zabel 
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 30 ++
 include/uapi/linux/media-bus-format.h  |  1 +
 2 files changed, 31 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index 9afb846..c259b9e 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -469,6 +469,36 @@
  b1
  b0

+   
+ MEDIA_BUS_FMT_RGB666_1X24_CPADHI
+ 0x1015
+ 
+ &dash-ent-8;
+ 0
+ 0
+ r5
+ r4
+ r3
+ r2
+ r1
+ r0
+ 0
+ 0
+ g5
+ g4
+ g3
+ g2
+ g1
+ g0
+ 0
+ 0
+ b5
+ b4
+ b3
+ b2
+ b1
+ b0
+   

  MEDIA_BUS_FMT_RGB888_1X24
  0x100a
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 977316e..ec80fb8 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -45,6 +45,7 @@
 #define MEDIA_BUS_FMT_RGB565_2X8_BE0x1007
 #define MEDIA_BUS_FMT_RGB565_2X8_LE0x1008
 #define MEDIA_BUS_FMT_RGB666_1X18  0x1009
+#define MEDIA_BUS_FMT_RGB666_1X24_CPADHI   0x1015
 #define MEDIA_BUS_FMT_RGB666_LVDS_SPWG 0x1010
 #define MEDIA_BUS_FMT_RGB888_1X24  0x100a
 #define MEDIA_BUS_FMT_BGR888_1X24  0x1013
-- 
2.1.3

--
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/3] Add YUV8_1X24 media bus format

2014-12-03 Thread Philipp Zabel
Signed-off-by: Philipp Zabel 
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 37 ++
 include/uapi/linux/media-bus-format.h  |  3 +-
 2 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml 
b/Documentation/DocBook/media/v4l/subdev-formats.xml
index f163767..9afb846 100644
--- a/Documentation/DocBook/media/v4l/subdev-formats.xml
+++ b/Documentation/DocBook/media/v4l/subdev-formats.xml
@@ -2933,6 +2933,43 @@
  u1
  u0

+   
+ MEDIA_BUS_FMT_YUV8_1X24
+ 0x2024
+ 
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ y7
+ y6
+ y5
+ y4
+ y3
+ y2
+ y1
+ y0
+ u7
+ u6
+ u5
+ u4
+ u3
+ u2
+ u1
+ u0
+ v7
+ v6
+ v5
+ v4
+ v3
+ v2
+ v1
+ v0
+   

  MEDIA_BUS_FMT_YUV10_1X30
  0x2016
diff --git a/include/uapi/linux/media-bus-format.h 
b/include/uapi/linux/media-bus-format.h
index 6d7f0c7..977316e 100644
--- a/include/uapi/linux/media-bus-format.h
+++ b/include/uapi/linux/media-bus-format.h
@@ -55,7 +55,7 @@
 #define MEDIA_BUS_FMT_RGB888_LVDS_JEIDA0x1012
 #define MEDIA_BUS_FMT_ARGB_1X320x100d
 
-/* YUV (including grey) - next is  0x2024 */
+/* YUV (including grey) - next is  0x2025 */
 #define MEDIA_BUS_FMT_Y8_1X8   0x2001
 #define MEDIA_BUS_FMT_UV8_1X8  0x2015
 #define MEDIA_BUS_FMT_UYVY8_1_5X8  0x2002
@@ -81,6 +81,7 @@
 #define MEDIA_BUS_FMT_VYUY10_1X20  0x201b
 #define MEDIA_BUS_FMT_YUYV10_1X20  0x200d
 #define MEDIA_BUS_FMT_YVYU10_1X20  0x200e
+#define MEDIA_BUS_FMT_YUV8_1X240x2024
 #define MEDIA_BUS_FMT_YUV10_1X30   0x2016
 #define MEDIA_BUS_FMT_AYUV8_1X32   0x2017
 #define MEDIA_BUS_FMT_UYVY12_2X12  0x201c
-- 
2.1.3

--
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: [PATCHv3 2/9] v4l2-mediabus: improve colorspace support

2014-12-03 Thread Sakari Ailus
Hi Hans,

On Wed, Dec 03, 2014 at 08:28:14AM +0100, Hans Verkuil wrote:
> On 12/03/2014 01:16 AM, Sakari Ailus wrote:
> > Hi Hans,
> > 
> > On Mon, Dec 01, 2014 at 10:03:46AM +0100, Hans Verkuil wrote:
> >> From: Hans Verkuil 
> >>
> >> Add and copy the new ycbcr_enc and quantization fields.
> >>
> >> Signed-off-by: Hans Verkuil 
> >> ---
> >>  include/media/v4l2-mediabus.h  | 4 
> >>  include/uapi/linux/v4l2-mediabus.h | 6 +-
> >>  2 files changed, 9 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
> >> index 59d7397..38d960d 100644
> >> --- a/include/media/v4l2-mediabus.h
> >> +++ b/include/media/v4l2-mediabus.h
> >> @@ -94,6 +94,8 @@ static inline void v4l2_fill_pix_format(struct 
> >> v4l2_pix_format *pix_fmt,
> >>pix_fmt->height = mbus_fmt->height;
> >>pix_fmt->field = mbus_fmt->field;
> >>pix_fmt->colorspace = mbus_fmt->colorspace;
> >> +  pix_fmt->ycbcr_enc = mbus_fmt->ycbcr_enc;
> >> +  pix_fmt->quantization = mbus_fmt->quantization;
> >>  }
> >>  
> >>  static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt 
> >> *mbus_fmt,
> >> @@ -104,6 +106,8 @@ static inline void v4l2_fill_mbus_format(struct 
> >> v4l2_mbus_framefmt *mbus_fmt,
> >>mbus_fmt->height = pix_fmt->height;
> >>mbus_fmt->field = pix_fmt->field;
> >>mbus_fmt->colorspace = pix_fmt->colorspace;
> >> +  mbus_fmt->ycbcr_enc = pix_fmt->ycbcr_enc;
> >> +  mbus_fmt->quantization = pix_fmt->quantization;
> >>mbus_fmt->code = code;
> >>  }
> >>  
> >> diff --git a/include/uapi/linux/v4l2-mediabus.h 
> >> b/include/uapi/linux/v4l2-mediabus.h
> >> index b1934a3..5a86d8e 100644
> >> --- a/include/uapi/linux/v4l2-mediabus.h
> >> +++ b/include/uapi/linux/v4l2-mediabus.h
> >> @@ -22,6 +22,8 @@
> >>   * @code: data format code (from enum v4l2_mbus_pixelcode)
> >>   * @field:used interlacing type (from enum v4l2_field)
> >>   * @colorspace:   colorspace of the data (from enum v4l2_colorspace)
> >> + * @ycbcr_enc:YCbCr encoding of the data (from enum 
> >> v4l2_ycbcr_encoding)
> >> + * @quantization: quantization of the data (from enum v4l2_quantization)
> >>   */
> >>  struct v4l2_mbus_framefmt {
> >>__u32   width;
> >> @@ -29,7 +31,9 @@ struct v4l2_mbus_framefmt {
> >>__u32   code;
> >>__u32   field;
> >>__u32   colorspace;
> >> -  __u32   reserved[7];
> >> +  __u32   ycbcr_enc;
> >> +  __u32   quantization;
> >> +  __u32   reserved[5];
> > 
> > If you feel these can fit to 8 bits in planes, I would consider to use 8
> > bits here as well. Adding frame descriptor support later on might eat some
> > fields from here as well.
> 
> You can do this in a number of ways:
> 
>   __u8 ycbcr_enc;
>   __u8 quantization;
>   __u32 reserved[6];
> 
> This would leave a hole before the reserved field. That's hard to zero.
> 
>   __u8 ycbcr_enc;
>   __u8 quantization;
>   __u8 reserved[2 + 6 * 4];
> 
> This will work for now, but if a __u32 needs to be added later, then I get
> a hole again.

One option would be to add the u8's to the end.

I think the best one would be to add another reserved field.

>   __u16 ycbcr_enc;
>   __u16 quantization;
>   __u32 reserved[6];
> 
> This is the only alternative that doesn't leave a hole. Would this be OK?
> I have no problem changing the API to this.

This is workable as well. Up to you.

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


Re: [PATCH 3/4] media: ov2640: add a master clock for sensor

2014-12-03 Thread Josh Wu

Hi, Laurent

On 12/2/2014 6:26 AM, Laurent Pinchart wrote:

Hi Josh,

(CC'ing the devicet...@vger.kernel.org mailing list)

Thank you for the patch.

On Friday 28 November 2014 18:28:26 Josh Wu wrote:

The master clock can be optional. It's a common clock framework clock.
It can make sensor output a pixel clock to the camera interface.

If you just use a external oscillator clock as the master clock, then,
just don't need set 'mck' in dt node.

Signed-off-by: Josh Wu 
---
  drivers/media/i2c/soc_camera/ov2640.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/media/i2c/soc_camera/ov2640.c
b/drivers/media/i2c/soc_camera/ov2640.c index 6506126..06c2aa9 100644
--- a/drivers/media/i2c/soc_camera/ov2640.c
+++ b/drivers/media/i2c/soc_camera/ov2640.c
@@ -13,6 +13,7 @@
   * published by the Free Software Foundation.
   */

+#include 
  #include 
  #include 
  #include 
@@ -31,6 +32,8 @@

  #define VAL_SET(x, mask, rshift, lshift)  \
x) >> rshift) & mask) << lshift)
+#define DEFAULT_MASTER_CLK_FREQ2500
+
  /*
   * DSP registers
   * register offset for BANK_SEL == BANK_SEL_DSP
@@ -284,6 +287,7 @@ struct ov2640_priv {
struct v4l2_ctrl_handlerhdl;
u32 cfmt_code;
struct v4l2_clk *clk;
+   struct clk  *master_clk;
const struct ov2640_win_size*win;

struct soc_camera_subdev_desc   ssdd_dt;
@@ -746,6 +750,7 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int
on) struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
struct ov2640_priv *priv = to_ov2640(client);
struct v4l2_clk *clk;
+   int ret = 0;

if (!priv->clk) {
clk = v4l2_clk_get(&client->dev, "mclk");
@@ -755,6 +760,16 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int
on) priv->clk = clk;
}

+   if (!IS_ERR(priv->master_clk)) {

The clock should be mandatory, you can thus drop this check.

OK. sure.




+   if (on)
+   ret = clk_prepare_enable(priv->master_clk);
+   else
+   clk_disable_unprepare(priv->master_clk);
+
+   if (ret)
+   return ret;

You can move the error check inside the first branch of the if and remove the
ret = 0 initialization above.


+   }
+
return soc_camera_set_power(&client->dev, ssdd, priv->clk, on);

If this call fails you should disable or enable the clock to undo the
enable/disable above.


ah, I totally forget this. will fix in next version. Thanks.




  }

@@ -1153,6 +1168,16 @@ static int ov2640_probe(struct i2c_client *client,
}
}

+   priv->master_clk = devm_clk_get(&client->dev, "mck");
+   if (!IS_ERR(priv->master_clk)) {
+   /* Set ISI_MCK's frequency, it should be faster than pixel
+* clock.
+*/
+   ret = clk_set_rate(priv->master_clk, DEFAULT_MASTER_CLK_FREQ);

The clock frequency should be system-dependent. For the DT case an easy
implementation would be to use the assigned-clock-rates to set the desired
clock frequency is case of a variable clock, as adding a sensor-specific
property to specify the desired clock frequency only to read that property in
the driver and call clk_set_rate() seems a bit pointless to me.


I tried assigned-clock-rates and it works fine.
The only issue is the it cannot used by multiple nodes. But I think I 
can put a comments in the dt node for this.

Thanks.

Best Regards,
Josh Wu




+   if (ret < 0)
+   return ret;
+   }
+
v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
v4l2_ctrl_handler_init(&priv->hdl, 2);
v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,


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


Re: [PATCH 4/4] media: ov2640: dt: add the device tree binding document

2014-12-03 Thread Josh Wu

Hi, Laurent

On 12/2/2014 6:14 AM, Laurent Pinchart wrote:

Hi Josh,

Thank you for the patch.

On Friday 28 November 2014 18:28:27 Josh Wu wrote:

Add the document for ov2640 dt.

Cc: devicet...@vger.kernel.org
Signed-off-by: Josh Wu 
---
  .../devicetree/bindings/media/i2c/ov2640.txt   | 43 +++
  1 file changed, 43 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/ov2640.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/ov2640.txt
b/Documentation/devicetree/bindings/media/i2c/ov2640.txt new file mode
100644
index 000..adec147
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ov2640.txt
@@ -0,0 +1,43 @@
+* Omnivision ov2640 CMOS sensor
+
+The Omnivision OV2640 sensor support multiple resolutions output, such as
+CIF, SVGA, UXGA. It also can support YUV422/420, RGB565/555 or raw RGB
+output format.
+
+Required Properties :
+- compatible  : Must be "omnivision,ov2640"

The usual practice is to use the company's stock ticker as a prefix. In this
case the compatible string would be "ovti,ov2640". You need to add the prefix
to Documentation/devicetree/bindings/vendor-prefixes.txt.


+- reset-gpio  : reset pin
+- power-down-gpio : power down pin

That should be reset-gpios and power-down-gpios, even if there's a single
GPIO. Furthermore, given that the power down pin is named PWDN you might want
to name the property pwdn-gpios.

The reset and pwdn signals won't be connected on all boards, so the two
properties should be optional.


+Optional Properties:
+- clocks  : reference master clock, if using external fixed clock,
you
+no need to have such property.

The clock is required by the chip, so even when using an external fixed clock
the property should be present, and reference a fixed clock node. The clocks
and clock-names properties should thus be mandatory.


+- clock-names : Must be "mck", it means the master clock for ov2640.

The clock input is named xvclk in the datasheet, you should use the same name
here.


+
+For further reading of port node refer
Documentation/devicetree/bindings/media/
+video-interfaces.txt.

Even if you reference that document you should still mention what port node(s)
these bindings require. Something like the following text should be enough.

"The device node must contain one 'port' child node for its digital output
video port, in accordance with the video interface bindings defined in
Documentation/devicetree/bindings/media/video-interfaces.txt."


+
+Example:
+
+   i2c1: i2c@f0018000 {
+   ov2640: camera@0x30 {
+   compatible = "omnivision,ov2640";
+   reg = <0x30>;
+
+   ... ...

No need for an ellipsis, what are you trying to hide ? :-)


I just emit the pinctrl property here. Will add it back.



+
+   reset-gpio = <&pioE 24 GPIO_ACTIVE_HIGH>;
+   power-down-gpio = <&pioE 29 GPIO_ACTIVE_HIGH>;
+
+   /* use pck1 for the master clock of ov2640 */

I think you can drop the comment.


I will send a new version which will fix all above.
Thanks for your time to review the patch. That help me a lot.

Best Regards,
Josh Wu




+   clocks = <&pck1>;
+   clock-names = "mck";
+
+   port {
+   ov2640_0: endpoint {
+   remote-endpoint = <&isi_0>;
+   bus-width = <8>;
+   };
+   };
+   };
+   };


--
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 3/9] clk: sunxi: Add prcm mod0 clock driver

2014-12-03 Thread Hans de Goede

Hi,

On 12/02/2014 04:45 PM, Maxime Ripard wrote:

>> Ok, so thinking more about this, I'm still convinced that the MFD

framework is only getting in the way here.


You still haven't said of what exactly it's getting in the way of.


Of using of_clk_define to bind to the mod0 clk in the prcm, because the
ir_clk node does not have its own reg property when the mfd framework is
used and of_clk_define requires the node to have its own reg property.


But I can see having things represented in devicetree properly, with
the clocks, etc. as child nodes of the prcm being something which we
want.


Clocks and reset are the only thing set so far, because we need
reference to them from the DT itself, nothing more.

We could very much have more devices instatiated from the MFD itself.


So since all we are using the MFD for is to instantiate platform
devices under the prcm nodes, and assign an io resource for the regs
to them, why not simply make the prcm node itself a simple-bus.


No, this is really not a bus. It shouldn't be described at all as
such. It is a device, that has multiple functionnalities in the system
=> MFD. It really is that simple.


Ok, I can live with that, but likewise the clocks node is not a bus either!

So it should not have a simple-bus compatible either, and as such we cannot
simply change the mod0 driver from of_clk_define to a platform driver because
then we need to instantiate platform devs for the mod0 clock nodes, which
means making the clock node a simple-bus.

I can see your logic in wanting the ir_clk prcm sub-node to use the
mod0 compatible string, so how about we make the mod0 driver both
register through of_declare and as a platform driver. Note this means
that it will try to bind twice to the ir_clk node, since of_clk_declare
will cause it to try and bind there too AFAIK.

The of_clk_declare bind will fail though because there is no regs
property, so this double bind is not an issue as long as we do not
log errors on the first bind failure.

Note that the ir_clk node will still need an "ir-clk" compatible as
well for the MFD to find it and assign the proper resources to it.

But this way we will have the clk driver binding to the mod0 clk compatible,
which is what you want, while having the MFD assign resources on the
fact that it is the ir-clk node, so that things will still work if
there are multiple mod0 clks in the prcm.


This does everything the MFD prcm driver currently does, without
actually needing a specific kernel driver, and as added bonus this
will move the definition of the mfd function reg offsets out of the
kernel and into the devicetree where they belong in the first place.


Which was nacked in the first place because such offsets are not
supposed to be in the DT.

Really, we have something that work here, there's no need to refactor
it.


Ok, but that does bring us back to the original problem wrt the ir-clk,
see above for how I think we should solve this then. If you agree I
can implement the proposed fix.

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