Re: [git:media_tree/master] [media] Add device tree support to adp1653 flash driver

2015-04-09 Thread Pavel Machek
Hi!

 Hi Pawel,

Me?

 This driver doesn't compile:
 
 On 04/08/2015 10:46 PM, Mauro Carvalho Chehab wrote:
  This is an automatic generated email to let you know that the following 
  patch were queued at the 
  http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
  

  --- a/drivers/media/i2c/adp1653.c
  +++ b/drivers/media/i2c/adp1653.c
  @@ -306,9 +309,17 @@ adp1653_init_device(struct adp1653_flash *flash)
   static int
   __adp1653_set_power(struct adp1653_flash *flash, int on)
   {
  -   int ret;
  +   int ret = 0;
  +
  +   if (flash-platform_data-power) {
  +   ret = flash-platform_data-power(flash-subdev, on);
  +   } else {
  +   gpio_set_value(flash-platform_data-power_gpio, on);
 
 The power_gpio field is not found in struct adp1653_platform_data.

Yes, int power_gpio should be added into that struct.

 Can you fix this?
 
 I'm also getting this warning:

Well, old version of patch was merged while new versions were getting
discussed / developed in another mail thread.

I guess best course of action is to drop this from Mauro's tree, as
conflicting patch exists in Sakari's tree...?

Thanks,
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.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


kconf syntax error when doing make menuconfig

2015-04-09 Thread Amex
Hi guys,
 
i'm trying to select only specific modules with menuconfig but get this:
 
ubuntu@***:~/media_build$ sudo make menuconfig
make -C /home/ubuntu/media_build/v4l menuconfig
make[1]: Entering directory `/home/ubuntu/media_build/v4l'
make -C /lib/modules/3.13.0-44-generic/build -f 
/home/ubuntu/media_build/v4l/Makefile.kernel config-targets=1 mixed-targets=0 
dot-config=0 SRCDIR=/lib/modules/3.13.0-44-generic/build v4l-mconf
make[2]: Entering directory `/usr/src/linux-headers-3.13.0-44-generic'
make -f /lib/modules/3.13.0-44-generic/build/scripts/Makefile.build 
obj=scripts/kconfig hostprogs-y=mconf scripts/kconfig/mconf
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTCC scripts/kconfig/mconf.o
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/mconf
make[2]: Leaving directory `/usr/src/linux-headers-3.13.0-44-generic'
/lib/modules/3.13.0-44-generic/build/scripts/kconfig/mconf ./Kconfig
./Kconfig:778: syntax error
./Kconfig:777: unknown option Say
./Kconfig:778: unknown option which
./Kconfig:779: unknown option The
./Kconfig:782: syntax error
./Kconfig:781:warning: multi-line strings not supported
./Kconfig:781: unknown option If
make[1]: *** [menuconfig] Error 1
make[1]: Leaving directory `/home/ubuntu/media_build/v4l'
make: *** [menuconfig] Error 2

it happens on Amazon EC2 Ubuntu 14.04 aswell as in my own VirtualBox VM

i also get this with make xconfig. just running ./build, however, works

-TC
--
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: using TSOP receiver without lircd

2015-04-09 Thread Sergio Serrano
Thank you David

I'm following your clues

I've contacted Jarod Wilson (redhat), too. If it can be useful to the
list, bellow you can find his thoughts.

Thank you both!

Sergio

On Mon, Apr 06, 2015 at 06:08:51PM +0200, Sergio Serrano wrote:
 Thank you Jarod for promptly reply.
 Great to hear that!

 I'm using omap2 (interrupt+gpio) and
 https://github.com/hani93/lirc_bbb module (I've got already  /dev/lirc
 device).

That driver isn't going to work, its written for lirc. You need a driver
written for the in-kernel IR subsystem. See drivers/media/rc/fintek-cir.c
and friends (iguanair.c, imon.c, winbond-cir.c, nuvoton-cir.c, etc).

 Using the method you mention is it still possible? Or it is only
 possible for usb receivers ?

Physical interface doesn't matter. The driver interfaces do. You'd have to
rewrite lirc_bbb to rc-core interfaces instead of lirc interfaces.

2015-04-06 20:41 GMT+02:00 David Härdeman da...@hardeman.nu:
 On Mon, Apr 06, 2015 at 06:01:52PM +0200, Sergio Serrano wrote:
Hi members!

In the hope that someone can help me, I has come to this mailing list after
contacting David Hardeman (thank you!).
He has already given me some clues. This is my scenario.

I'm using a OMAP2 processor and capturing TSOP34836 (remote RC5 compatible)
signals through GPIO+interrupt. I have created the /dev/lirc0 device , here
comes my question: If possible I don't want to deal with LIRC and irrecord
stuff. Is it possible? What will be the first steps?

 Your next step would be a kernel driver that receives the GPIO
 interrupts and feeds them into rc-core as edge events.

 drivers/media/rc/gpio-ir-recv.c is probably what you want as a starting
 point (though you'll need to find a way to feed it the right
 parameters...)

 Regards,
 David

--
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: [git:media_tree/master] [media] Add device tree support to adp1653 flash driver

2015-04-09 Thread Hans Verkuil
Hi Pawel,

This driver doesn't compile:

On 04/08/2015 10:46 PM, Mauro Carvalho Chehab wrote:
 This is an automatic generated email to let you know that the following patch 
 were queued at the 
 http://git.linuxtv.org/cgit.cgi/media_tree.git tree:
 
 Subject: [media] Add device tree support to adp1653 flash driver
 Author:  Pavel Machek pa...@ucw.cz
 Date:Fri Mar 13 17:48:40 2015 -0300
 
 Nokia N900 is switching to device tree, make sure we can use flash
 there, too.
 
 Signed-off-by: Pavel Machek pa...@ucw.cz
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 
  .../devicetree/bindings/media/i2c/adp1653.txt  |   37 
  drivers/media/i2c/adp1653.c|   90 
 ++--
  2 files changed, 118 insertions(+), 9 deletions(-)
 
 ---
 
 http://git.linuxtv.org/cgit.cgi/media_tree.git/commit/?id=b6100f10bdc2019a65297d2597c388de2f7dd653
 
 diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
 index 873fe19..0341009 100644
 --- a/drivers/media/i2c/adp1653.c
 +++ b/drivers/media/i2c/adp1653.c
 @@ -306,9 +309,17 @@ adp1653_init_device(struct adp1653_flash *flash)
  static int
  __adp1653_set_power(struct adp1653_flash *flash, int on)
  {
 - int ret;
 + int ret = 0;
 +
 + if (flash-platform_data-power) {
 + ret = flash-platform_data-power(flash-subdev, on);
 + } else {
 + gpio_set_value(flash-platform_data-power_gpio, on);

The power_gpio field is not found in struct adp1653_platform_data.

Can you fix this?

I'm also getting this warning:

adp1653.c:433:6: warning: unused variable 'gpio' [-Wunused-variable]
  int gpio;
  ^

Please fix that as well.

Strange, this patch seems to have been merged without anyone compiling it first.

Regards,

Hans

 + if (on)
 + /* Some delay is apparently required. */
 + udelay(20);
 + }
  
 - ret = flash-platform_data-power(flash-subdev, on);
   if (ret  0)
   return ret;
  

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


RE: [PATCH] rc: img-ir: Add and enable sys clock for IR

2015-04-09 Thread Sifan Naeem
Hi Mauro,

Seems like you have applied the correct patch after all. ([v2] rc: img-ir: Add 
and enable sys clock for img-ir)

Thanks,
Sifan

 -Original Message-
 From: Mauro Carvalho Chehab [mailto:mche...@osg.samsung.com]
 Sent: 08 April 2015 15:41
 To: Sifan Naeem
 Cc: James Hogan; linux-ker...@vger.kernel.org; linux-
 me...@vger.kernel.org
 Subject: Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
 
 Em Wed, 08 Apr 2015 13:56:14 +
 Sifan Naeem sifan.na...@imgtec.com escreveu:
 
  Hi Mauro,
 
  I sent you a v2 of this patch on 4th February:
 
  From: Sifan Naeem
  Sent: 04 February 2015 16:48
  To: James Hogan; mche...@osg.samsung.com
  Cc: linux-ker...@vger.kernel.org; linux-media@vger.kernel.org; Sifan
  Naeem
  Subject: [PATCH v2] rc: img-ir: Add and enable sys clock for img-ir
 
 
  Unfortunately, while trying to improve the commit message in v2 I had
 changed the last word of the patch name from IR to img-ir.
 
  Do you want me to do a diff between the 2 patches and send you a new
 patch?
 
 Yes, please do that, changing the patch name/description to reflect what
 changed since v1.
 
 Regards,
 Mauro
 
 
  Sifan
 
   -Original Message-
   From: Mauro Carvalho Chehab [mailto:mche...@osg.samsung.com]
   Sent: 08 April 2015 12:32
   To: Sifan Naeem
   Cc: James Hogan; linux-ker...@vger.kernel.org; linux-
   me...@vger.kernel.org
   Subject: Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
  
   Em Tue, 3 Feb 2015 17:30:29 +
   Sifan Naeem sifan.na...@imgtec.com escreveu:
  
Gets a handle to the system clock, already described in the
binding document, and calls the appropriate common clock framework
functions to mark it prepared/enabled, the common clock framework
initially enables the clock and doesn't disable it at least until
the device/driver is removed.
The system clock to IR is needed for the driver to communicate
with the IR hardware via MMIO accesses on the system bus, so it
must not be disabled during use or the driver will malfunction.
  
   Hmm... patchwork has two versions of this patch, but I have only one
   on my e-mail.
  
   Could you please check if I applied the right one? If not, please
   send me an email with a fixup patch.
  
   Thanks!
   Mauro
  
   
Signed-off-by: Sifan Naeem sifan.na...@imgtec.com
---
 drivers/media/rc/img-ir/img-ir-core.c |   13 +
 drivers/media/rc/img-ir/img-ir.h  |2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)
   
diff --git a/drivers/media/rc/img-ir/img-ir-core.c
b/drivers/media/rc/img-ir/img-ir-core.c
index 77c78de..783dd21 100644
--- a/drivers/media/rc/img-ir/img-ir-core.c
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv
*priv)
   
if (!IS_ERR(priv-clk))
clk_prepare_enable(priv-clk);
+   if (!IS_ERR(priv-sys_clk))
+   clk_prepare_enable(priv-sys_clk);
 }
   
 static void img_ir_ident(struct img_ir_priv *priv) @@ -110,10
+112,11 @@ static int img_ir_probe(struct platform_device *pdev)
priv-clk = devm_clk_get(pdev-dev, core);
if (IS_ERR(priv-clk))
dev_warn(pdev-dev, cannot get core clock 
resource\n);
-   /*
-* The driver doesn't need to know about the system (sys) or
   power
-* modulation (mod) clocks yet
-*/
+
+   /* Get sys clock */
+   priv-sys_clk = devm_clk_get(pdev-dev, sys);
+   if (IS_ERR(priv-sys_clk))
+   dev_warn(pdev-dev, cannot get sys clock resource\n);
   
/* Set up raw  hw decoder */
error = img_ir_probe_raw(priv);
@@ -152,6 +155,8 @@ static int img_ir_remove(struct
platform_device
*pdev)
   
if (!IS_ERR(priv-clk))
clk_disable_unprepare(priv-clk);
+   if (!IS_ERR(priv-sys_clk))
+   clk_disable_unprepare(priv-sys_clk);
return 0;
 }
   
diff --git a/drivers/media/rc/img-ir/img-ir.h
b/drivers/media/rc/img-ir/img-ir.h
index 2ddf560..f1387c0 100644
--- a/drivers/media/rc/img-ir/img-ir.h
+++ b/drivers/media/rc/img-ir/img-ir.h
@@ -138,6 +138,7 @@ struct clk;
  * @dev:   Platform device.
  * @irq:   IRQ number.
  * @clk:   Input clock.
+ * @sys_clk:   System clock.
  * @reg_base:  Iomem base address of IR register block.
  * @lock:  Protects IR registers and variables in this 
struct.
  * @raw:   Driver data for raw decoder.
@@ -147,6 +148,7 @@ struct img_ir_priv {
struct device   *dev;
int irq;
struct clk  *clk;
+   struct clk  *sys_clk;
void __iomem*reg_base;
spinlock_t   

Re: [git:media_tree/master] [media] Add device tree support to adp1653 flash driver

2015-04-09 Thread Sakari Ailus
Hi,

On Thu, Apr 09, 2015 at 09:34:00AM +0200, Hans Verkuil wrote:
...
  --- a/drivers/media/i2c/adp1653.c
  +++ b/drivers/media/i2c/adp1653.c
  @@ -306,9 +309,17 @@ adp1653_init_device(struct adp1653_flash *flash)
   static int
   __adp1653_set_power(struct adp1653_flash *flash, int on)
   {
  - int ret;
  + int ret = 0;
  +
  + if (flash-platform_data-power) {
  + ret = flash-platform_data-power(flash-subdev, on);
  + } else {
  + gpio_set_value(flash-platform_data-power_gpio, on);
 
  The power_gpio field is not found in struct adp1653_platform_data.
  
  Yes, int power_gpio should be added into that struct.
  
  Can you fix this?
 
  I'm also getting this warning:
  
  Well, old version of patch was merged while new versions were getting
  discussed / developed in another mail thread.
  
  I guess best course of action is to drop this from Mauro's tree, as
  conflicting patch exists in Sakari's tree...?
 
 Sakari, do you agree? How did this patch manage to be merged? Was it not
 marked Superseded?

I don't know why that was merged. The patch is an old version of the adp1653
DT support patch, which was agreed to split into two: DT binding
documentation and the driver changes. As Pavel said, the DT documentation
patch is in my tree.

Mauro, could you revert it, please?

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


usbtv: no video or sound with linux kernel 3.18.0 and 3.18.11

2015-04-09 Thread Malin Bruland

I have the Fushicai USBTV

Os: Ubuntu 14.04.2 lts
kernel: 3.18.11-031811-generic

I have tested with kernel 3.16.0-30 generic: video, but no sound.





In lsusb detetced as:

Bus 003 Device 002: ID 1b71:3002  


Dmesg kernel 3.18.11:

[   72.550720] usb 4-1.2: USB disconnect, device number 3
[   74.026917] usb 4-1.2: new high-speed USB device number 5 using ehci-pci
[   74.122176] usb 4-1.2: config 1 interface 0 altsetting 1 bulk endpoint 0x83 
has invalid maxpacket 256
[   74.125288] usb 4-1.2: New USB device found, idVendor=1b71, idProduct=3002
[   74.125292] usb 4-1.2: New USB device strings: Mfr=3, Product=4, 
SerialNumber=2
[   74.125293] usb 4-1.2: Product: usbtv007
[   74.125294] usb 4-1.2: Manufacturer: fushicai
[   74.125295] usb 4-1.2: SerialNumber: 3002
[   74.126288] usbtv 4-1.2:1.0: Fushicai USBTV007 Audio-Video Grabber



With ubuntu 14.04.2 lts kernel 3.16 I get video, but no audio.


When trying to capture with vlc:
malin@kaffemocca:~$ vlc
VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
[0x1037058] main libvlc: Running vlc with the default interface. Use
'cvlc' to use vlc without interface.
[0x7f79b4006a38] filesystem access error: cannot open
file /home/malin/hw:0,0 (No such file or directory)
[0x7f79b80009b8] main input error: open of `file:///home/malin/hw%3A0%
2C0' failed
[0x7f79b4029348] filesystem access error: cannot open
file /home/malin/hw:1,0 (No such file or directory)
[0x7f79b8006578] main input error: open of `file:///home/malin/hw%3A1%
2C0' failed


When trying to capture with mplayer, I get this:

malin@kaffemocca:~$ mplayer tv:// -tv
driver=v4l2:width=720:height=576:device=/dev/video0 -vo xv -fps 65
MPlayer 1.1-4.8 (C) 2000-2012 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing tv://.
TV file format detected.
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski olschew...@zpr.uni-koeln.de
 comment: first try, more to come ;-)
Selected device: usbtv
 Capabilities:  video capture  read/write  streaming
 supported norms: 0 = NTSC; 1 = NTSC-M; 2 = NTSC-M-JP; 3 = NTSC-M-KR; 4
= NTSC-443; 5 = PAL; 6 = PAL-BG; 7 = PAL-H; 8 = PAL-I; 9 = PAL-DK; 10 =
PAL-M; 11 = PAL-60;
 inputs: 0 = Composite; 1 = S-Video;
 Current input: 0
 Current format: YUYV
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Inappropriate ioctl for device
v4l2: ioctl query control failed: Inappropriate ioctl for device
v4l2: ioctl query control failed: Inappropriate ioctl for device
v4l2: ioctl query control failed: Inappropriate ioctl for device
v4l2: ioctl query control failed: Inappropriate ioctl for device
==
Opening video decoder: [raw] RAW Uncompressed Video
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 720x576 = 720x576 Packed YUY2 
Selected video codec: [rawyuy2] vfm: raw (RAW YUY2)
==
Audio: no sound
FPS forced to be 65.000  (ftime: 0.015).
Starting playback...
V:   0.0   1/  1 ??%MPlayer interrupted by signal 2 in module:
video_read_frame
V:   0.0  22/ 22 ??% ??% ??,?% 0 0 
v4l2: select timeout
v4l2: ioctl set mute failed: Inappropriate ioctl for device
v4l2: 0 frames successfully processed, 1 frames dropped.
 ??% ??,?% 0 0 
v4l2: select timeout
V:   0.0   3/  3 ??% ??% ??,?% 0 0 
v4l2: select timeout
V:   0.0   5/  5 ??% ??% ??,?% 0 0 

Getting just green screen, with no video or audio

.





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


[PATCH 5/7] v4l2: replace try_mbus_fmt by set_fmt in bridge drivers

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace all calls to try_mbus_fmt in bridge drivers by calls to the
set_fmt pad op.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Scott Jiang scott.jiang.li...@gmail.com
Cc: Jonathan Corbet cor...@lwn.net
---
 drivers/media/pci/saa7134/saa7134-empress.c| 11 +++---
 drivers/media/platform/blackfin/bfin_capture.c | 15 
 drivers/media/platform/marvell-ccic/mcam-core.c| 11 +++---
 drivers/media/platform/soc_camera/atmel-isi.c  | 28 ---
 drivers/media/platform/soc_camera/mx2_camera.c | 38 +++-
 drivers/media/platform/soc_camera/mx3_camera.c | 28 ---
 drivers/media/platform/soc_camera/omap1_camera.c   | 26 --
 drivers/media/platform/soc_camera/pxa_camera.c | 28 ---
 drivers/media/platform/soc_camera/rcar_vin.c   | 42 --
 .../platform/soc_camera/sh_mobile_ceu_camera.c | 38 +++-
 drivers/media/platform/via-camera.c| 11 +++---
 11 files changed, 158 insertions(+), 118 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa7134-empress.c 
b/drivers/media/pci/saa7134/saa7134-empress.c
index 22632f9..dc14930 100644
--- a/drivers/media/pci/saa7134/saa7134-empress.c
+++ b/drivers/media/pci/saa7134/saa7134-empress.c
@@ -157,11 +157,14 @@ static int empress_try_fmt_vid_cap(struct file *file, 
void *priv,
struct v4l2_format *f)
 {
struct saa7134_dev *dev = video_drvdata(file);
-   struct v4l2_mbus_framefmt mbus_fmt;
+   struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_format format = {
+   .which = V4L2_SUBDEV_FORMAT_TRY,
+   };
 
-   v4l2_fill_mbus_format(mbus_fmt, f-fmt.pix, MEDIA_BUS_FMT_FIXED);
-   saa_call_all(dev, video, try_mbus_fmt, mbus_fmt);
-   v4l2_fill_pix_format(f-fmt.pix, mbus_fmt);
+   v4l2_fill_mbus_format(format.format, f-fmt.pix, MEDIA_BUS_FMT_FIXED);
+   saa_call_all(dev, pad, set_fmt, pad_cfg, format);
+   v4l2_fill_pix_format(f-fmt.pix, format.format);
 
f-fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
f-fmt.pix.sizeimage= TS_PACKET_SIZE * dev-ts.nr_packets;
diff --git a/drivers/media/platform/blackfin/bfin_capture.c 
b/drivers/media/platform/blackfin/bfin_capture.c
index 6ea11b1..aa50eba 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -602,7 +602,10 @@ static int bcap_try_format(struct bcap_device *bcap,
 {
struct bcap_format *sf = bcap-sensor_formats;
struct bcap_format *fmt = NULL;
-   struct v4l2_mbus_framefmt mbus_fmt;
+   struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_format format = {
+   .which = V4L2_SUBDEV_FORMAT_TRY,
+   };
int ret, i;
 
for (i = 0; i  bcap-num_sensor_formats; i++) {
@@ -613,16 +616,16 @@ static int bcap_try_format(struct bcap_device *bcap,
if (i == bcap-num_sensor_formats)
fmt = sf[0];
 
-   v4l2_fill_mbus_format(mbus_fmt, pixfmt, fmt-mbus_code);
-   ret = v4l2_subdev_call(bcap-sd, video,
-   try_mbus_fmt, mbus_fmt);
+   v4l2_fill_mbus_format(format.format, pixfmt, fmt-mbus_code);
+   ret = v4l2_subdev_call(bcap-sd, pad, set_fmt, pad_cfg,
+   format);
if (ret  0)
return ret;
-   v4l2_fill_pix_format(pixfmt, mbus_fmt);
+   v4l2_fill_pix_format(pixfmt, format.format);
if (bcap_fmt) {
for (i = 0; i  bcap-num_sensor_formats; i++) {
fmt = sf[i];
-   if (mbus_fmt.code == fmt-mbus_code)
+   if (format.format.code == fmt-mbus_code)
break;
}
*bcap_fmt = *fmt;
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
b/drivers/media/platform/marvell-ccic/mcam-core.c
index 9c64b5d..5f48154 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -1413,16 +1413,19 @@ static int mcam_vidioc_try_fmt_vid_cap(struct file 
*filp, void *priv,
struct mcam_camera *cam = priv;
struct mcam_format_struct *f;
struct v4l2_pix_format *pix = fmt-fmt.pix;
-   struct v4l2_mbus_framefmt mbus_fmt;
+   struct v4l2_subdev_pad_config pad_cfg;
+   struct v4l2_subdev_format format = {
+   .which = V4L2_SUBDEV_FORMAT_TRY,
+   };
int ret;
 
f = mcam_find_format(pix-pixelformat);
pix-pixelformat = f-pixelformat;
-   v4l2_fill_mbus_format(mbus_fmt, pix, f-mbus_code);
+   v4l2_fill_mbus_format(format.format, pix, f-mbus_code);
mutex_lock(cam-s_mutex);
-   ret = sensor_call(cam, video, try_mbus_fmt, mbus_fmt);
+   ret = sensor_call(cam, pad, set_fmt, 

[PATCH v2 3/3] media: atmel-isi: remove mck back compatiable code as it's not need

2015-04-09 Thread Josh Wu
The master clock should handled by sensor itself.

Signed-off-by: Josh Wu josh...@atmel.com
---

Changes in v2:
- totally remove clock_start()/clock_stop() as they are optional.

 drivers/media/platform/soc_camera/atmel-isi.c | 45 ---
 1 file changed, 45 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 2b05f89..7bba7d9 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -83,8 +83,6 @@ struct atmel_isi {
struct completion   complete;
/* ISI peripherial clock */
struct clk  *pclk;
-   /* ISI_MCK, feed to camera sensor to generate pixel clock */
-   struct clk  *mck;
unsigned intirq;
 
struct isi_platform_datapdata;
@@ -727,31 +725,6 @@ static void isi_camera_remove_device(struct 
soc_camera_device *icd)
 icd-devnum);
 }
 
-/* Called with .host_lock held */
-static int isi_camera_clock_start(struct soc_camera_host *ici)
-{
-   struct atmel_isi *isi = ici-priv;
-   int ret;
-
-   if (!IS_ERR(isi-mck)) {
-   ret = clk_prepare_enable(isi-mck);
-   if (ret) {
-   return ret;
-   }
-   }
-
-   return 0;
-}
-
-/* Called with .host_lock held */
-static void isi_camera_clock_stop(struct soc_camera_host *ici)
-{
-   struct atmel_isi *isi = ici-priv;
-
-   if (!IS_ERR(isi-mck))
-   clk_disable_unprepare(isi-mck);
-}
-
 static unsigned int isi_camera_poll(struct file *file, poll_table *pt)
 {
struct soc_camera_device *icd = file-private_data;
@@ -865,8 +838,6 @@ static struct soc_camera_host_ops isi_soc_camera_host_ops = 
{
.owner  = THIS_MODULE,
.add= isi_camera_add_device,
.remove = isi_camera_remove_device,
-   .clock_start= isi_camera_clock_start,
-   .clock_stop = isi_camera_clock_stop,
.set_fmt= isi_camera_set_fmt,
.try_fmt= isi_camera_try_fmt,
.get_formats= isi_camera_get_formats,
@@ -904,7 +875,6 @@ static int atmel_isi_probe_dt(struct atmel_isi *isi,
 
/* Default settings for ISI */
isi-pdata.full_mode = 1;
-   isi-pdata.mck_hz = ISI_DEFAULT_MCLK_FREQ;
isi-pdata.frate = ISI_CFG1_FRATE_CAPTURE_ALL;
 
np = of_graph_get_next_endpoint(np, NULL);
@@ -980,21 +950,6 @@ static int atmel_isi_probe(struct platform_device *pdev)
INIT_LIST_HEAD(isi-video_buffer_list);
INIT_LIST_HEAD(isi-dma_desc_head);
 
-   /* ISI_MCK is the sensor master clock. It should be handled by the
-* sensor driver directly, as the ISI has no use for that clock. Make
-* the clock optional here while platforms transition to the correct
-* model.
-*/
-   isi-mck = devm_clk_get(dev, isi_mck);
-   if (!IS_ERR(isi-mck)) {
-   /* Set ISI_MCK's frequency, it should be faster than pixel
-* clock.
-*/
-   ret = clk_set_rate(isi-mck, isi-pdata.mck_hz);
-   if (ret  0)
-   return ret;
-   }
-
isi-p_fb_descriptors = dma_alloc_coherent(pdev-dev,
sizeof(struct fbd) * MAX_BUFFER_NUM,
isi-fb_descriptors_phys,
-- 
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


[PATCH v2 1/3] media: atmel-isi: remove the useless code which disable isi

2015-04-09 Thread Josh Wu
To program ISI control register, the pixel clock should be enabled.
So without pixel clock (from sensor) enabled, disable ISI controller is
not make sense. So this patch remove those code.

Signed-off-by: Josh Wu josh...@atmel.com
---

Changes in v2:
- this file is new added.

 drivers/media/platform/soc_camera/atmel-isi.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index c125b1d..31254b4 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -131,8 +131,6 @@ static int configure_geometry(struct atmel_isi *isi, u32 
width,
return -EINVAL;
}
 
-   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
-
cfg2 = isi_readl(isi, ISI_CFG2);
/* Set YCC swap mode */
cfg2 = ~ISI_CFG2_YCC_SWAP_MODE_MASK;
@@ -843,7 +841,6 @@ static int isi_camera_set_bus_param(struct 
soc_camera_device *icd)
 
cfg1 |= ISI_CFG1_THMASK_BEATS_16;
 
-   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
isi_writel(isi, ISI_CFG1, cfg1);
 
return 0;
@@ -1022,8 +1019,6 @@ static int atmel_isi_probe(struct platform_device *pdev)
if (isi-pdata.data_width_flags  ISI_DATAWIDTH_10)
isi-width_flags |= 1  9;
 
-   isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
-
irq = platform_get_irq(pdev, 0);
if (IS_ERR_VALUE(irq)) {
ret = irq;
-- 
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


[PATCH 1/7] v4l2: replace enum_mbus_fmt by enum_mbus_code

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace all calls to the enum_mbus_fmt video op by the pad
enum_mbus_code op and remove the duplicate video op.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Scott Jiang scott.jiang.li...@gmail.com
Cc: Jonathan Corbet cor...@lwn.net
Cc: Kamil Debski k.deb...@samsung.com
---
 drivers/media/i2c/adv7170.c| 15 
 drivers/media/i2c/adv7175.c| 15 
 drivers/media/i2c/adv7183.c| 15 
 drivers/media/i2c/adv7842.c| 11 +
 drivers/media/i2c/ak881x.c | 15 
 drivers/media/i2c/ml86v7667.c  | 15 
 drivers/media/i2c/mt9v011.c| 15 
 drivers/media/i2c/ov7670.c | 11 +
 drivers/media/i2c/soc_camera/imx074.c  | 16 +
 drivers/media/i2c/soc_camera/mt9m001.c | 15 
 drivers/media/i2c/soc_camera/mt9m111.c | 15 
 drivers/media/i2c/soc_camera/mt9t031.c | 15 
 drivers/media/i2c/soc_camera/mt9t112.c | 15 
 drivers/media/i2c/soc_camera/mt9v022.c | 15 
 drivers/media/i2c/soc_camera/ov2640.c  | 15 
 drivers/media/i2c/soc_camera/ov5642.c  | 15 
 drivers/media/i2c/soc_camera/ov6650.c  | 15 
 drivers/media/i2c/soc_camera/ov772x.c  | 15 
 drivers/media/i2c/soc_camera/ov9640.c  | 15 
 drivers/media/i2c/soc_camera/ov9740.c  | 19 +--
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  | 15 
 drivers/media/i2c/soc_camera/tw9910.c  | 15 
 drivers/media/i2c/sr030pc30.c  | 16 +
 drivers/media/i2c/tvp514x.c| 20 
 drivers/media/i2c/tvp5150.c| 15 
 drivers/media/i2c/tvp7002.c| 20 
 drivers/media/i2c/vs6624.c | 15 
 drivers/media/platform/blackfin/bfin_capture.c | 17 +-
 drivers/media/platform/soc_camera/atmel-isi.c  | 19 ---
 drivers/media/platform/soc_camera/mx2_camera.c | 27 --
 drivers/media/platform/soc_camera/mx3_camera.c | 23 ++
 drivers/media/platform/soc_camera/omap1_camera.c   | 21 +
 drivers/media/platform/soc_camera/pxa_camera.c | 19 ---
 drivers/media/platform/soc_camera/rcar_vin.c   | 19 ---
 .../platform/soc_camera/sh_mobile_ceu_camera.c | 19 ---
 drivers/media/platform/soc_camera/soc_camera.c | 15 
 .../platform/soc_camera/soc_camera_platform.c  | 15 
 include/media/v4l2-subdev.h|  4 
 38 files changed, 361 insertions(+), 250 deletions(-)

diff --git a/drivers/media/i2c/adv7170.c b/drivers/media/i2c/adv7170.c
index 40a1a95..cfe963b 100644
--- a/drivers/media/i2c/adv7170.c
+++ b/drivers/media/i2c/adv7170.c
@@ -262,13 +262,14 @@ static int adv7170_s_routing(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7170_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-   u32 *code)
+static int adv7170_enum_mbus_code(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_mbus_code_enum *code)
 {
-   if (index = ARRAY_SIZE(adv7170_codes))
+   if (code-pad || code-index = ARRAY_SIZE(adv7170_codes))
return -EINVAL;
 
-   *code = adv7170_codes[index];
+   code-code = adv7170_codes[code-index];
return 0;
 }
 
@@ -323,11 +324,15 @@ static const struct v4l2_subdev_video_ops 
adv7170_video_ops = {
.s_routing = adv7170_s_routing,
.s_mbus_fmt = adv7170_s_fmt,
.g_mbus_fmt = adv7170_g_fmt,
-   .enum_mbus_fmt  = adv7170_enum_fmt,
+};
+
+static const struct v4l2_subdev_pad_ops adv7170_pad_ops = {
+   .enum_mbus_code = adv7170_enum_mbus_code,
 };
 
 static const struct v4l2_subdev_ops adv7170_ops = {
.video = adv7170_video_ops,
+   .pad = adv7170_pad_ops,
 };
 
 /* --- */
diff --git a/drivers/media/i2c/adv7175.c b/drivers/media/i2c/adv7175.c
index d220af5..3f40304 100644
--- a/drivers/media/i2c/adv7175.c
+++ b/drivers/media/i2c/adv7175.c
@@ -300,13 +300,14 @@ static int adv7175_s_routing(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7175_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
-   u32 *code)
+static int adv7175_enum_mbus_code(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config 

[PATCH 0/7] v4l2: convert video ops to pad ops

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This patch series converts duplicate video ops to pad ops.

Patches 1-6 convert enum/g/try/s_mbus_fmt and patch 7 converts
g/s_crop and cropcap.

Patch 7 has been posted before:

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

Patch 7 remains an RFC since I still have not been able to test this
on actual hardware.

Note that the calls to set_fmt(V4L2_SUBDEV_FORMAT_TRY) in bridge drivers
all assume that pad is 0. Which is actually true for these specific
drivers, but may not be true in the future. In that case the
struct v4l2_subdev_pad_config pad_cfg local variable should become an
array of at least (pad + 1) elements.

But we'll handle that when we need it.

My intention is to get patches 1-6 in for 4.2, preferably asap to get
as much testing time as possible. These patches touch on many drivers
so the sooner they are merged, the easier it is for developers to work
on top of them.

The moral of the story: never accept patches that add duplicate ops
without removing the old ones as well. It seems that every time I end
up being the sucker that does the work, and it is a really boring and
unpleasant job. Next time I'll Nack such patches.

Regards,

Hans

Hans Verkuil (7):
  v4l2: replace enum_mbus_fmt by enum_mbus_code
  v4l2: replace video op g_mbus_fmt by pad op get_fmt
  v4l2: replace try_mbus_fmt by set_fmt
  v4l2: replace s_mbus_fmt by set_fmt
  v4l2: replace try_mbus_fmt by set_fmt in bridge drivers
  v4l2: replace s_mbus_fmt by set_fmt in bridge drivers
  v4l2: remove g/s_crop and cropcap from video ops

 drivers/media/i2c/adv7170.c|  42 --
 drivers/media/i2c/adv7175.c|  42 --
 drivers/media/i2c/adv7183.c|  61 
 drivers/media/i2c/adv7842.c|  25 ++--
 drivers/media/i2c/ak881x.c |  67 +
 drivers/media/i2c/cx25840/cx25840-core.c   |  15 +-
 drivers/media/i2c/ml86v7667.c  |  29 ++--
 drivers/media/i2c/mt9v011.c|  53 +++
 drivers/media/i2c/ov7670.c |  38 ++---
 drivers/media/i2c/saa6752hs.c  |  42 --
 drivers/media/i2c/saa7115.c|  16 ++-
 drivers/media/i2c/saa717x.c|  16 ++-
 drivers/media/i2c/soc_camera/imx074.c  | 108 +++---
 drivers/media/i2c/soc_camera/mt9m001.c | 113 +--
 drivers/media/i2c/soc_camera/mt9m111.c | 114 ---
 drivers/media/i2c/soc_camera/mt9t031.c | 126 +---
 drivers/media/i2c/soc_camera/mt9t112.c | 101 -
 drivers/media/i2c/soc_camera/mt9v022.c | 111 --
 drivers/media/i2c/soc_camera/ov2640.c  | 103 ++---
 drivers/media/i2c/soc_camera/ov5642.c  | 113 ---
 drivers/media/i2c/soc_camera/ov6650.c  | 117 ---
 drivers/media/i2c/soc_camera/ov772x.c  |  85 ++-
 drivers/media/i2c/soc_camera/ov9640.c  |  73 +-
 drivers/media/i2c/soc_camera/ov9740.c  |  76 +-
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  | 118 +++
 drivers/media/i2c/soc_camera/tw9910.c  |  88 ++--
 drivers/media/i2c/sr030pc30.c  |  62 
 drivers/media/i2c/tvp514x.c|  55 +--
 drivers/media/i2c/tvp5150.c| 111 +++---
 drivers/media/i2c/tvp7002.c|  48 ---
 drivers/media/i2c/vs6624.c |  55 +++
 drivers/media/pci/cx18/cx18-av-core.c  |  16 ++-
 drivers/media/pci/cx18/cx18-controls.c |  13 +-
 drivers/media/pci/cx18/cx18-ioctl.c|  12 +-
 drivers/media/pci/cx23885/cx23885-video.c  |  12 +-
 drivers/media/pci/ivtv/ivtv-controls.c |  12 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c|  12 +-
 drivers/media/pci/saa7134/saa7134-empress.c|  32 +++--
 drivers/media/platform/am437x/am437x-vpfe.c|  25 +---
 drivers/media/platform/blackfin/bfin_capture.c |  40 --
 drivers/media/platform/davinci/vpfe_capture.c  |  19 +--
 drivers/media/platform/marvell-ccic/mcam-core.c|  19 ++-
 drivers/media/platform/omap3isp/ispvideo.c |  88 
 drivers/media/platform/s5p-tv/hdmi_drv.c   |  12 +-
 drivers/media/platform/s5p-tv/mixer_drv.c  |  15 +-
 drivers/media/platform/s5p-tv/sdo_drv.c|  14 +-
 drivers/media/platform/sh_vou.c|  74 +-
 drivers/media/platform/soc_camera/atmel-isi.c  |  74 +-
 drivers/media/platform/soc_camera/mx2_camera.c | 131 +
 drivers/media/platform/soc_camera/mx3_camera.c | 123 +---
 drivers/media/platform/soc_camera/omap1_camera.c   | 

[PATCH 2/7] v4l2: replace video op g_mbus_fmt by pad op get_fmt

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The g_mbus_fmt video op is a duplicate of the pad op. Replace all uses
by the get_fmt pad op and remove the video op.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Prabhakar Lad prabhakar.cse...@gmail.com
Cc: Kamil Debski k.deb...@samsung.com
---
 drivers/media/i2c/adv7170.c| 11 +++--
 drivers/media/i2c/adv7175.c| 11 +++--
 drivers/media/i2c/adv7183.c| 12 +++--
 drivers/media/i2c/adv7842.c| 14 --
 drivers/media/i2c/ak881x.c | 24 --
 drivers/media/i2c/ml86v7667.c  | 14 --
 drivers/media/i2c/saa6752hs.c  | 14 +-
 drivers/media/i2c/soc_camera/imx074.c  | 11 +++--
 drivers/media/i2c/soc_camera/mt9m001.c | 11 +++--
 drivers/media/i2c/soc_camera/mt9m111.c | 11 +++--
 drivers/media/i2c/soc_camera/mt9t031.c | 11 +++--
 drivers/media/i2c/soc_camera/mt9t112.c | 11 +++--
 drivers/media/i2c/soc_camera/mt9v022.c | 11 +++--
 drivers/media/i2c/soc_camera/ov2640.c  | 11 +++--
 drivers/media/i2c/soc_camera/ov5642.c  | 11 +++--
 drivers/media/i2c/soc_camera/ov6650.c  | 11 +++--
 drivers/media/i2c/soc_camera/ov772x.c  | 11 +++--
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  | 11 +++--
 drivers/media/i2c/soc_camera/tw9910.c  | 11 +++--
 drivers/media/i2c/sr030pc30.c  | 12 +++--
 drivers/media/i2c/tvp514x.c| 35 ++
 drivers/media/i2c/tvp5150.c| 15 +++---
 drivers/media/i2c/tvp7002.c| 28 ---
 drivers/media/i2c/vs6624.c | 12 +++--
 drivers/media/pci/saa7134/saa7134-empress.c|  9 ++--
 drivers/media/platform/am437x/am437x-vpfe.c|  6 +--
 drivers/media/platform/davinci/vpfe_capture.c  | 19 
 drivers/media/platform/s5p-tv/hdmi_drv.c   | 12 +++--
 drivers/media/platform/s5p-tv/mixer_drv.c  | 15 --
 drivers/media/platform/s5p-tv/sdo_drv.c| 14 --
 drivers/media/platform/soc_camera/mx2_camera.c | 13 --
 drivers/media/platform/soc_camera/mx3_camera.c | 25 +-
 drivers/media/platform/soc_camera/omap1_camera.c   | 17 ---
 drivers/media/platform/soc_camera/pxa_camera.c | 21 +
 drivers/media/platform/soc_camera/rcar_vin.c   | 46 ++
 .../platform/soc_camera/sh_mobile_ceu_camera.c | 54 --
 drivers/media/platform/soc_camera/soc_camera.c | 15 +++---
 .../platform/soc_camera/soc_camera_platform.c  |  9 ++--
 include/media/v4l2-subdev.h|  4 --
 39 files changed, 352 insertions(+), 261 deletions(-)

diff --git a/drivers/media/i2c/adv7170.c b/drivers/media/i2c/adv7170.c
index cfe963b..58d0a3c 100644
--- a/drivers/media/i2c/adv7170.c
+++ b/drivers/media/i2c/adv7170.c
@@ -273,11 +273,16 @@ static int adv7170_enum_mbus_code(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7170_g_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *mf)
+static int adv7170_get_fmt(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *format)
 {
+   struct v4l2_mbus_framefmt *mf = format-format;
u8 val = adv7170_read(sd, 0x7);
 
+   if (format-pad)
+   return -EINVAL;
+
if ((val  0x40) == (1  6))
mf-code = MEDIA_BUS_FMT_UYVY8_1X16;
else
@@ -323,11 +328,11 @@ static const struct v4l2_subdev_video_ops 
adv7170_video_ops = {
.s_std_output = adv7170_s_std_output,
.s_routing = adv7170_s_routing,
.s_mbus_fmt = adv7170_s_fmt,
-   .g_mbus_fmt = adv7170_g_fmt,
 };
 
 static const struct v4l2_subdev_pad_ops adv7170_pad_ops = {
.enum_mbus_code = adv7170_enum_mbus_code,
+   .get_fmt = adv7170_get_fmt,
 };
 
 static const struct v4l2_subdev_ops adv7170_ops = {
diff --git a/drivers/media/i2c/adv7175.c b/drivers/media/i2c/adv7175.c
index 3f40304..f744345 100644
--- a/drivers/media/i2c/adv7175.c
+++ b/drivers/media/i2c/adv7175.c
@@ -311,11 +311,16 @@ static int adv7175_enum_mbus_code(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7175_g_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *mf)
+static int adv7175_get_fmt(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *format)
 {
+   struct v4l2_mbus_framefmt *mf = format-format;
u8 val = adv7175_read(sd, 0x7);
 
+   if (format-pad)
+   return -EINVAL;
+
if ((val  0x40) == (1  6))
mf-code = MEDIA_BUS_FMT_UYVY8_1X16;
else
@@ -376,11 

[PATCH 3/7] v4l2: replace try_mbus_fmt by set_fmt

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The try_mbus_fmt video op is a duplicate of the pad op. Replace all uses
in sub-devices by the set_fmt() pad op.

Since try_mbus_fmt and s_mbus_fmt both map to the set_fmt pad op (but
with a different 'which' argument), this patch will replace both try_mbus_fmt
and s_mbus_fmt by set_fmt.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Jonathan Corbet cor...@lwn.net
Cc: Kamil Debski k.deb...@samsung.com
---
 drivers/media/i2c/adv7183.c| 36 
 drivers/media/i2c/mt9v011.c| 38 -
 drivers/media/i2c/ov7670.c | 27 +++-
 drivers/media/i2c/saa6752hs.c  | 28 +++--
 drivers/media/i2c/soc_camera/imx074.c  | 39 --
 drivers/media/i2c/soc_camera/mt9m001.c | 17 +---
 drivers/media/i2c/soc_camera/mt9m111.c | 31 ++
 drivers/media/i2c/soc_camera/mt9t031.c | 48 +++---
 drivers/media/i2c/soc_camera/mt9t112.c | 15 +--
 drivers/media/i2c/soc_camera/mt9v022.c | 17 +---
 drivers/media/i2c/soc_camera/ov2640.c  | 36 +---
 drivers/media/i2c/soc_camera/ov5642.c  | 34 +++
 drivers/media/i2c/soc_camera/ov6650.c  | 17 +---
 drivers/media/i2c/soc_camera/ov772x.c  | 15 +--
 drivers/media/i2c/soc_camera/ov9640.c  | 17 ++--
 drivers/media/i2c/soc_camera/ov9740.c  | 16 ++--
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  | 40 +++---
 drivers/media/i2c/soc_camera/tw9910.c  | 15 +--
 drivers/media/i2c/sr030pc30.c  | 38 -
 drivers/media/i2c/vs6624.c | 28 ++---
 drivers/media/platform/soc_camera/sh_mobile_csi2.c | 35 
 21 files changed, 304 insertions(+), 283 deletions(-)

diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index 9d58b75..e2dd161 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -431,10 +431,15 @@ static int adv7183_enum_mbus_code(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7183_try_mbus_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *fmt)
+static int adv7183_set_fmt(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *format)
 {
struct adv7183 *decoder = to_adv7183(sd);
+   struct v4l2_mbus_framefmt *fmt = format-format;
+
+   if (format-pad)
+   return -EINVAL;
 
fmt-code = MEDIA_BUS_FMT_UYVY8_2X8;
fmt-colorspace = V4L2_COLORSPACE_SMPTE170M;
@@ -447,16 +452,10 @@ static int adv7183_try_mbus_fmt(struct v4l2_subdev *sd,
fmt-width = 720;
fmt-height = 576;
}
-   return 0;
-}
-
-static int adv7183_s_mbus_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *fmt)
-{
-   struct adv7183 *decoder = to_adv7183(sd);
-
-   adv7183_try_mbus_fmt(sd, fmt);
-   decoder-fmt = *fmt;
+   if (format-which == V4L2_SUBDEV_FORMAT_ACTIVE)
+   decoder-fmt = *fmt;
+   else
+   cfg-try_fmt = *fmt;
return 0;
 }
 
@@ -519,14 +518,13 @@ static const struct v4l2_subdev_video_ops 
adv7183_video_ops = {
.s_routing = adv7183_s_routing,
.querystd = adv7183_querystd,
.g_input_status = adv7183_g_input_status,
-   .try_mbus_fmt = adv7183_try_mbus_fmt,
-   .s_mbus_fmt = adv7183_s_mbus_fmt,
.s_stream = adv7183_s_stream,
 };
 
 static const struct v4l2_subdev_pad_ops adv7183_pad_ops = {
.enum_mbus_code = adv7183_enum_mbus_code,
.get_fmt = adv7183_get_fmt,
+   .set_fmt = adv7183_set_fmt,
 };
 
 static const struct v4l2_subdev_ops adv7183_ops = {
@@ -542,7 +540,9 @@ static int adv7183_probe(struct i2c_client *client,
struct v4l2_subdev *sd;
struct v4l2_ctrl_handler *hdl;
int ret;
-   struct v4l2_mbus_framefmt fmt;
+   struct v4l2_subdev_format fmt = {
+   .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+   };
const unsigned *pin_array;
 
/* Check if the adapter supports the needed features */
@@ -612,9 +612,9 @@ static int adv7183_probe(struct i2c_client *client,
 
adv7183_writeregs(sd, adv7183_init_regs, ARRAY_SIZE(adv7183_init_regs));
adv7183_s_std(sd, decoder-std);
-   fmt.width = 720;
-   fmt.height = 576;
-   adv7183_s_mbus_fmt(sd, fmt);
+   fmt.format.width = 720;
+   fmt.format.height = 576;
+   adv7183_set_fmt(sd, NULL, fmt);
 
/* initialize the hardware to the default control values */
ret = v4l2_ctrl_handler_setup(hdl);
diff --git a/drivers/media/i2c/mt9v011.c 

[PATCH] dvb: Document FE_SCALE_DECIBEL units consistently

2015-04-09 Thread David Howells
In comments and in the documentation, the units of properties marked with the
FE_SCALE_DECIBEL scale are specified in terms of 1/1000 dB or 0.0001 dB.  This
is inconsistent, however, as 1/1000 is 0.001, not 0.0001.

Note that the v4l-utils divide the value by 1000 for the signal strength
suggesting that the 1/1000 is correct.

Settle on millidecibels, ie. 1/1000dB or 0.001dB.

Signed-off-by: David Howells dhowe...@redhat.com
---

 Documentation/DocBook/media/dvb/dvbproperty.xml |4 ++--
 include/uapi/linux/dvb/frontend.h   |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml 
b/Documentation/DocBook/media/dvb/dvbproperty.xml
index 3018564..7ddab2b 100644
--- a/Documentation/DocBook/media/dvb/dvbproperty.xml
+++ b/Documentation/DocBook/media/dvb/dvbproperty.xml
@@ -953,7 +953,7 @@ enum fe_interleaving {
paraPossible scales for this metric are:/para
itemizedlist mark='bullet'

listitemparaconstantFE_SCALE_NOT_AVAILABLE/constant - it failed to 
measure it, or the measurement was not complete yet./para/listitem
-   listitemparaconstantFE_SCALE_DECIBEL/constant - 
signal strength is in 0.0001 dBm units, power measured in miliwatts. This value 
is generally negative./para/listitem
+   listitemparaconstantFE_SCALE_DECIBEL/constant - 
signal strength is in 0.001 dBm units, power measured in miliwatts. This value 
is generally negative./para/listitem
listitemparaconstantFE_SCALE_RELATIVE/constant 
- The frontend provides a 0% to 100% measurement for power (actually, 0 to 
65535)./para/listitem
/itemizedlist
/section
@@ -963,7 +963,7 @@ enum fe_interleaving {
paraPossible scales for this metric are:/para
itemizedlist mark='bullet'

listitemparaconstantFE_SCALE_NOT_AVAILABLE/constant - it failed to 
measure it, or the measurement was not complete yet./para/listitem
-   listitemparaconstantFE_SCALE_DECIBEL/constant - 
Signal/Noise ratio is in 0.0001 dB units./para/listitem
+   listitemparaconstantFE_SCALE_DECIBEL/constant - 
Signal/Noise ratio is in 0.001 dB units./para/listitem
listitemparaconstantFE_SCALE_RELATIVE/constant 
- The frontend provides a 0% to 100% measurement for Signal/Noise (actually, 0 
to 65535)./para/listitem
/itemizedlist
/section
diff --git a/include/uapi/linux/dvb/frontend.h 
b/include/uapi/linux/dvb/frontend.h
index c56d77c..466f569 100644
--- a/include/uapi/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -467,7 +467,7 @@ struct dtv_cmds_h {
  * @FE_SCALE_NOT_AVAILABLE: That QoS measure is not available. That
  * could indicate a temporary or a permanent
  * condition.
- * @FE_SCALE_DECIBEL: The scale is measured in 0.0001 dB steps, typically
+ * @FE_SCALE_DECIBEL: The scale is measured in 0.001 dB steps, typically
  *   used on signal measures.
  * @FE_SCALE_RELATIVE: The scale is a relative percentual measure,
  * ranging from 0 (0%) to 0x (100%).
@@ -516,7 +516,7 @@ struct dtv_stats {
__u8 scale; /* enum fecap_scale_params type */
union {
__u64 uvalue;   /* for counters and relative scales */
-   __s64 svalue;   /* for 0.0001 dB measures */
+   __s64 svalue;   /* for 0.001 dB measures */
};
 } __attribute__ ((packed));
 

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


[PATCH] media: adv7604: Fix masks used for querying timings in ADV7611

2015-04-09 Thread Jean-Michel Hautbois
All masks for timings are different between ADV7604 and ADV7611.
Most of the values have 1 precision bit more in the latter.
Fix this by adding new fields to the chip_info structure.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 drivers/media/i2c/adv7604.c | 69 -
 1 file changed, 56 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 60ffcf0..c1be0f7 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -124,6 +124,20 @@ struct adv76xx_chip_info {
unsigned int num_recommended_settings[2];
 
unsigned long page_mask;
+
+   /* Masks for timings */
+   unsigned int linewidth_mask;
+   unsigned int field0_height_mask;
+   unsigned int field1_height_mask;
+   unsigned int hfrontporch_mask;
+   unsigned int hsync_mask;
+   unsigned int hbackporch_mask;
+   unsigned int field0_vfrontporch_mask;
+   unsigned int field1_vfrontporch_mask;
+   unsigned int field0_vsync_mask;
+   unsigned int field1_vsync_mask;
+   unsigned int field0_vbackporch_mask;
+   unsigned int field1_vbackporch_mask;
 };
 
 /*
@@ -1504,23 +1518,28 @@ static int adv76xx_query_dv_timings(struct v4l2_subdev 
*sd,
if (is_digital_input(sd)) {
timings-type = V4L2_DV_BT_656_1120;
 
-   /* FIXME: All masks are incorrect for ADV7611 */
-   bt-width = hdmi_read16(sd, 0x07, 0xfff);
-   bt-height = hdmi_read16(sd, 0x09, 0xfff);
+   bt-width = hdmi_read16(sd, 0x07, info-linewidth_mask);
+   bt-height = hdmi_read16(sd, 0x09, info-field0_height_mask);
bt-pixelclock = info-read_hdmi_pixelclock(sd);
-   bt-hfrontporch = hdmi_read16(sd, 0x20, 0x3ff);
-   bt-hsync = hdmi_read16(sd, 0x22, 0x3ff);
-   bt-hbackporch = hdmi_read16(sd, 0x24, 0x3ff);
-   bt-vfrontporch = hdmi_read16(sd, 0x2a, 0x1fff) / 2;
-   bt-vsync = hdmi_read16(sd, 0x2e, 0x1fff) / 2;
-   bt-vbackporch = hdmi_read16(sd, 0x32, 0x1fff) / 2;
+   bt-hfrontporch = hdmi_read16(sd, 0x20, info-hfrontporch_mask);
+   bt-hsync = hdmi_read16(sd, 0x22, info-hsync_mask);
+   bt-hbackporch = hdmi_read16(sd, 0x24, info-hbackporch_mask);
+   bt-vfrontporch = hdmi_read16(sd, 0x2a,
+   info-field0_vfrontporch_mask) / 2;
+   bt-vsync = hdmi_read16(sd, 0x2e, info-field0_vsync_mask) / 2;
+   bt-vbackporch = hdmi_read16(sd, 0x32,
+   info-field0_vbackporch_mask) / 2;
bt-polarities = ((hdmi_read(sd, 0x05)  0x10) ? 
V4L2_DV_VSYNC_POS_POL : 0) |
((hdmi_read(sd, 0x05)  0x20) ? V4L2_DV_HSYNC_POS_POL : 
0);
if (bt-interlaced == V4L2_DV_INTERLACED) {
-   bt-height += hdmi_read16(sd, 0x0b, 0xfff);
-   bt-il_vfrontporch = hdmi_read16(sd, 0x2c, 0x1fff) / 2;
-   bt-il_vsync = hdmi_read16(sd, 0x30, 0x1fff) / 2;
-   bt-il_vbackporch = hdmi_read16(sd, 0x34, 0x1fff) / 2;
+   bt-height += hdmi_read16(sd, 0x0b,
+   info-field1_height_mask);
+   bt-il_vfrontporch = hdmi_read16(sd, 0x2c,
+   info-field1_vfrontporch_mask) / 2;
+   bt-il_vsync = hdmi_read16(sd, 0x30,
+   info-field1_vsync_mask) / 2;
+   bt-il_vbackporch = hdmi_read16(sd, 0x34,
+   info-field1_vbackporch_mask) / 2;
}
adv76xx_fill_optional_dv_timings_fields(sd, timings);
} else {
@@ -2567,6 +2586,18 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
BIT(ADV76XX_PAGE_EDID) | BIT(ADV76XX_PAGE_HDMI) |
BIT(ADV76XX_PAGE_TEST) | BIT(ADV76XX_PAGE_CP) |
BIT(ADV7604_PAGE_VDP),
+   .linewidth_mask = 0xfff,
+   .field0_height_mask = 0xfff,
+   .field1_height_mask = 0xfff,
+   .hfrontporch_mask = 0x3ff,
+   .hsync_mask = 0x3ff,
+   .hbackporch_mask = 0x3ff,
+   .field0_vfrontporch_mask = 0x1fff,
+   .field0_vsync_mask = 0x1fff,
+   .field0_vbackporch_mask = 0x1fff,
+   .field1_vfrontporch_mask = 0x1fff,
+   .field1_vsync_mask = 0x1fff,
+   .field1_vbackporch_mask = 0x1fff,
},
[ADV7611] = {
.type = ADV7611,
@@ -2596,6 +2627,18 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
BIT(ADV76XX_PAGE_INFOFRAME) | BIT(ADV76XX_PAGE_AFE) |
BIT(ADV76XX_PAGE_REP) |  BIT(ADV76XX_PAGE_EDID) |

Re: kconf syntax error when doing make menuconfig

2015-04-09 Thread Devin Heitmueller
 i also get this with make xconfig. just running ./build, however, works

Yeah, I've seen that before.  It's a whitespace bug in the KConfig
file.  Just open it in a text editor, go to the line in question, and
fix the leading whitespace to match all the other entries (If I
recall, you'll actually see it occur in two or three places).

It's a trivial fix - feel free to submit a patch so people don't hit
it in the future.

Devin

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


[PATCH 6/7] v4l2: replace s_mbus_fmt by set_fmt in bridge drivers

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace all calls to s_mbus_fmt in bridge drivers by calls to the
set_fmt pad op.

Remove the old try/s_mbus_fmt video ops since they are now no longer used.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Prabhakar Lad prabhakar.cse...@gmail.com
Cc: Scott Jiang scott.jiang.li...@gmail.com
Cc: Jonathan Corbet cor...@lwn.net
---
 drivers/media/pci/cx18/cx18-controls.c | 13 +++--
 drivers/media/pci/cx18/cx18-ioctl.c| 12 +++--
 drivers/media/pci/cx23885/cx23885-video.c  | 12 +++--
 drivers/media/pci/ivtv/ivtv-controls.c | 12 +++--
 drivers/media/pci/ivtv/ivtv-ioctl.c| 12 +++--
 drivers/media/pci/saa7134/saa7134-empress.c| 10 ++--
 drivers/media/platform/am437x/am437x-vpfe.c| 19 ++-
 drivers/media/platform/blackfin/bfin_capture.c |  8 +--
 drivers/media/platform/marvell-ccic/mcam-core.c|  8 +--
 drivers/media/platform/sh_vou.c| 61 --
 drivers/media/platform/soc_camera/atmel-isi.c  | 27 +-
 drivers/media/platform/soc_camera/mx2_camera.c | 35 +++--
 drivers/media/platform/soc_camera/mx3_camera.c | 31 ++-
 drivers/media/platform/soc_camera/omap1_camera.c   | 44 +---
 drivers/media/platform/soc_camera/pxa_camera.c | 33 ++--
 drivers/media/platform/soc_camera/rcar_vin.c   |  4 +-
 .../platform/soc_camera/sh_mobile_ceu_camera.c |  8 +--
 drivers/media/platform/soc_camera/soc_scale_crop.c | 37 +++--
 drivers/media/platform/via-camera.c|  8 +--
 drivers/media/usb/cx231xx/cx231xx-417.c| 12 +++--
 drivers/media/usb/cx231xx/cx231xx-video.c  | 23 
 drivers/media/usb/em28xx/em28xx-camera.c   | 12 +++--
 drivers/media/usb/go7007/go7007-v4l2.c | 12 +++--
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c| 17 +++---
 include/media/v4l2-subdev.h|  8 ---
 25 files changed, 256 insertions(+), 222 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-controls.c 
b/drivers/media/pci/cx18/cx18-controls.c
index 4aeb7c6..71227a1 100644
--- a/drivers/media/pci/cx18/cx18-controls.c
+++ b/drivers/media/pci/cx18/cx18-controls.c
@@ -93,13 +93,16 @@ static int cx18_s_video_encoding(struct cx2341x_handler 
*cxhdl, u32 val)
 {
struct cx18 *cx = container_of(cxhdl, struct cx18, cxhdl);
int is_mpeg1 = val == V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
-   struct v4l2_mbus_framefmt fmt;
+   struct v4l2_subdev_format format = {
+   .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+   };
+   struct v4l2_mbus_framefmt *fmt = format.format;
 
/* fix videodecoder resolution */
-   fmt.width = cxhdl-width / (is_mpeg1 ? 2 : 1);
-   fmt.height = cxhdl-height;
-   fmt.code = MEDIA_BUS_FMT_FIXED;
-   v4l2_subdev_call(cx-sd_av, video, s_mbus_fmt, fmt);
+   fmt-width = cxhdl-width / (is_mpeg1 ? 2 : 1);
+   fmt-height = cxhdl-height;
+   fmt-code = MEDIA_BUS_FMT_FIXED;
+   v4l2_subdev_call(cx-sd_av, pad, set_fmt, NULL, format);
return 0;
 }
 
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c 
b/drivers/media/pci/cx18/cx18-ioctl.c
index 79aee30..55525af 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -267,7 +267,9 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
 {
struct cx18_open_id *id = fh2id(fh);
struct cx18 *cx = id-cx;
-   struct v4l2_mbus_framefmt mbus_fmt;
+   struct v4l2_subdev_format format = {
+   .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+   };
struct cx18_stream *s = cx-streams[id-type];
int ret;
int w, h;
@@ -296,10 +298,10 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
s-vb_bytes_per_line = 1440; /* Packed */
}
 
-   mbus_fmt.width = cx-cxhdl.width = w;
-   mbus_fmt.height = cx-cxhdl.height = h;
-   mbus_fmt.code = MEDIA_BUS_FMT_FIXED;
-   v4l2_subdev_call(cx-sd_av, video, s_mbus_fmt, mbus_fmt);
+   format.format.width = cx-cxhdl.width = w;
+   format.format.height = cx-cxhdl.height = h;
+   format.format.code = MEDIA_BUS_FMT_FIXED;
+   v4l2_subdev_call(cx-sd_av, pad, set_fmt, NULL, format);
return cx18_g_fmt_vid_cap(file, fh, fmt);
 }
 
diff --git a/drivers/media/pci/cx23885/cx23885-video.c 
b/drivers/media/pci/cx23885/cx23885-video.c
index 2232b38..ec76470 100644
--- a/drivers/media/pci/cx23885/cx23885-video.c
+++ b/drivers/media/pci/cx23885/cx23885-video.c
@@ -581,7 +581,9 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
struct v4l2_format *f)
 {
struct cx23885_dev *dev = video_drvdata(file);
-   struct v4l2_mbus_framefmt mbus_fmt;
+   struct v4l2_subdev_format format = {
+   .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+   };
int 

[PATCH 4/7] v4l2: replace s_mbus_fmt by set_fmt

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The s_mbus_fmt video op is a duplicate of the pad op. Replace all uses
in sub-devices by the set_fmt() pad op.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7170.c  | 16 +++-
 drivers/media/i2c/adv7175.c  | 16 +++-
 drivers/media/i2c/cx25840/cx25840-core.c | 15 ---
 drivers/media/i2c/saa7115.c  | 16 +---
 drivers/media/i2c/saa717x.c  | 16 +---
 drivers/media/pci/cx18/cx18-av-core.c| 16 +---
 drivers/media/usb/go7007/s2250-board.c   | 18 +++---
 7 files changed, 88 insertions(+), 25 deletions(-)

diff --git a/drivers/media/i2c/adv7170.c b/drivers/media/i2c/adv7170.c
index 58d0a3c..f0d3f5a 100644
--- a/drivers/media/i2c/adv7170.c
+++ b/drivers/media/i2c/adv7170.c
@@ -296,11 +296,16 @@ static int adv7170_get_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7170_s_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *mf)
+static int adv7170_set_fmt(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *format)
 {
+   struct v4l2_mbus_framefmt *mf = format-format;
u8 val = adv7170_read(sd, 0x7);
-   int ret;
+   int ret = 0;
+
+   if (format-pad)
+   return -EINVAL;
 
switch (mf-code) {
case MEDIA_BUS_FMT_UYVY8_2X8:
@@ -317,7 +322,8 @@ static int adv7170_s_fmt(struct v4l2_subdev *sd,
return -EINVAL;
}
 
-   ret = adv7170_write(sd, 0x7, val);
+   if (format-which == V4L2_SUBDEV_FORMAT_ACTIVE)
+   ret = adv7170_write(sd, 0x7, val);
 
return ret;
 }
@@ -327,12 +333,12 @@ static int adv7170_s_fmt(struct v4l2_subdev *sd,
 static const struct v4l2_subdev_video_ops adv7170_video_ops = {
.s_std_output = adv7170_s_std_output,
.s_routing = adv7170_s_routing,
-   .s_mbus_fmt = adv7170_s_fmt,
 };
 
 static const struct v4l2_subdev_pad_ops adv7170_pad_ops = {
.enum_mbus_code = adv7170_enum_mbus_code,
.get_fmt = adv7170_get_fmt,
+   .set_fmt = adv7170_set_fmt,
 };
 
 static const struct v4l2_subdev_ops adv7170_ops = {
diff --git a/drivers/media/i2c/adv7175.c b/drivers/media/i2c/adv7175.c
index f744345..321834b 100644
--- a/drivers/media/i2c/adv7175.c
+++ b/drivers/media/i2c/adv7175.c
@@ -334,11 +334,16 @@ static int adv7175_get_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int adv7175_s_fmt(struct v4l2_subdev *sd,
-   struct v4l2_mbus_framefmt *mf)
+static int adv7175_set_fmt(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *format)
 {
+   struct v4l2_mbus_framefmt *mf = format-format;
u8 val = adv7175_read(sd, 0x7);
-   int ret;
+   int ret = 0;
+
+   if (format-pad)
+   return -EINVAL;
 
switch (mf-code) {
case MEDIA_BUS_FMT_UYVY8_2X8:
@@ -355,7 +360,8 @@ static int adv7175_s_fmt(struct v4l2_subdev *sd,
return -EINVAL;
}
 
-   ret = adv7175_write(sd, 0x7, val);
+   if (format-which == V4L2_SUBDEV_FORMAT_ACTIVE)
+   ret = adv7175_write(sd, 0x7, val);
 
return ret;
 }
@@ -380,12 +386,12 @@ static const struct v4l2_subdev_core_ops adv7175_core_ops 
= {
 static const struct v4l2_subdev_video_ops adv7175_video_ops = {
.s_std_output = adv7175_s_std_output,
.s_routing = adv7175_s_routing,
-   .s_mbus_fmt = adv7175_s_fmt,
 };
 
 static const struct v4l2_subdev_pad_ops adv7175_pad_ops = {
.enum_mbus_code = adv7175_enum_mbus_code,
.get_fmt = adv7175_get_fmt,
+   .set_fmt = adv7175_set_fmt,
 };
 
 static const struct v4l2_subdev_ops adv7175_ops = {
diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
b/drivers/media/i2c/cx25840/cx25840-core.c
index bd49644..166ae31 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -1366,14 +1366,17 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
 
 /* --- */
 
-static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct 
v4l2_mbus_framefmt *fmt)
+static int cx25840_set_fmt(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_format *format)
 {
+   struct v4l2_mbus_framefmt *fmt = format-format;
struct cx25840_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
int HSC, VSC, Vsrc, Hsrc, filter, Vlines;
int is_50Hz = !(state-std  V4L2_STD_525_60);
 
-   if (fmt-code != MEDIA_BUS_FMT_FIXED)
+   if (format-pad || fmt-code != MEDIA_BUS_FMT_FIXED)
return -EINVAL;
 
fmt-field = V4L2_FIELD_INTERLACED;
@@ -1403,6 

[PATCH 7/7] v4l2: remove g/s_crop and cropcap from video ops

2015-04-09 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace all calls to g/s_crop and cropcap by calls to the
get/set_selection pad ops.

Remove the old g/s_crop and cropcap video ops since they are now no
longer used.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/ak881x.c |  28 +++--
 drivers/media/i2c/soc_camera/imx074.c  |  42 +++
 drivers/media/i2c/soc_camera/mt9m001.c |  70 ++-
 drivers/media/i2c/soc_camera/mt9m111.c |  57 -
 drivers/media/i2c/soc_camera/mt9t031.c |  52 +
 drivers/media/i2c/soc_camera/mt9t112.c |  60 +-
 drivers/media/i2c/soc_camera/mt9v022.c |  68 ++-
 drivers/media/i2c/soc_camera/ov2640.c  |  41 +++
 drivers/media/i2c/soc_camera/ov5642.c  |  53 +
 drivers/media/i2c/soc_camera/ov6650.c  |  74 ++--
 drivers/media/i2c/soc_camera/ov772x.c  |  44 ---
 drivers/media/i2c/soc_camera/ov9640.c  |  41 +++
 drivers/media/i2c/soc_camera/ov9740.c  |  41 +++
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  |  52 +
 drivers/media/i2c/soc_camera/tw9910.c  |  47 +++-
 drivers/media/i2c/tvp5150.c|  81 +++--
 drivers/media/platform/omap3isp/ispvideo.c |  88 +-
 drivers/media/platform/sh_vou.c|  13 ++-
 drivers/media/platform/soc_camera/mx2_camera.c |  18 ++-
 drivers/media/platform/soc_camera/mx3_camera.c |  18 ++-
 drivers/media/platform/soc_camera/omap1_camera.c   |  23 ++--
 drivers/media/platform/soc_camera/pxa_camera.c |  17 ++-
 drivers/media/platform/soc_camera/rcar_vin.c   |  26 ++---
 .../platform/soc_camera/sh_mobile_ceu_camera.c |  32 +++--
 drivers/media/platform/soc_camera/soc_camera.c | 130 ++---
 .../platform/soc_camera/soc_camera_platform.c  |  45 +++
 drivers/media/platform/soc_camera/soc_scale_crop.c |  85 --
 drivers/media/platform/soc_camera/soc_scale_crop.h |   6 +-
 drivers/staging/media/omap4iss/iss_video.c |  88 +-
 include/media/soc_camera.h |   7 +-
 include/media/v4l2-subdev.h|   3 -
 31 files changed, 735 insertions(+), 715 deletions(-)

diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c
index 2984624..a87b3b5 100644
--- a/drivers/media/i2c/ak881x.c
+++ b/drivers/media/i2c/ak881x.c
@@ -124,21 +124,27 @@ static int ak881x_enum_mbus_code(struct v4l2_subdev *sd,
return 0;
 }
 
-static int ak881x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
+static int ak881x_get_selection(struct v4l2_subdev *sd,
+   struct v4l2_subdev_pad_config *cfg,
+   struct v4l2_subdev_selection *sel)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ak881x *ak881x = to_ak881x(client);
 
-   a-bounds.left  = 0;
-   a-bounds.top   = 0;
-   a-bounds.width = 720;
-   a-bounds.height= ak881x-lines;
-   a-defrect  = a-bounds;
-   a-type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-   a-pixelaspect.numerator= 1;
-   a-pixelaspect.denominator  = 1;
+   if (sel-which != V4L2_SUBDEV_FORMAT_ACTIVE)
+   return -EINVAL;
 
-   return 0;
+   switch (sel-target) {
+   case V4L2_SEL_TGT_CROP_BOUNDS:
+   case V4L2_SEL_TGT_CROP_DEFAULT:
+   sel-r.left = 0;
+   sel-r.top = 0;
+   sel-r.width = 720;
+   sel-r.height = ak881x-lines;
+   return 0;
+   default:
+   return -EINVAL;
+   }
 }
 
 static int ak881x_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
@@ -207,13 +213,13 @@ static struct v4l2_subdev_core_ops ak881x_subdev_core_ops 
= {
 };
 
 static struct v4l2_subdev_video_ops ak881x_subdev_video_ops = {
-   .cropcap= ak881x_cropcap,
.s_std_output   = ak881x_s_std_output,
.s_stream   = ak881x_s_stream,
 };
 
 static const struct v4l2_subdev_pad_ops ak881x_subdev_pad_ops = {
.enum_mbus_code = ak881x_enum_mbus_code,
+   .get_selection  = ak881x_get_selection,
.set_fmt= ak881x_fill_fmt,
.get_fmt= ak881x_fill_fmt,
 };
diff --git a/drivers/media/i2c/soc_camera/imx074.c 
b/drivers/media/i2c/soc_camera/imx074.c
index f68c235..05b55cf 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -209,31 +209,26 @@ static int imx074_get_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int imx074_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+static int 

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

2015-04-09 Thread Sakari Ailus
Zero the entire struct starting from bus_type. As more fields are added, no
changes will be needed in the function to reset their value explicitly.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/v4l2-core/v4l2-of.c |5 +++--
 include/media/v4l2-of.h   |1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index 83143d3..3ac6348 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -149,8 +149,9 @@ int v4l2_of_parse_endpoint(const struct device_node *node,
int rval;
 
of_graph_parse_endpoint(node, endpoint-base);
-   endpoint-bus_type = 0;
-   memset(endpoint-bus, 0, sizeof(endpoint-bus));
+   /* Zero fields from bus_type to until the end */
+   memset(endpoint-bus_type, 0, sizeof(*endpoint) -
+  offsetof(typeof(*endpoint), bus_type));
 
rval = v4l2_of_parse_csi_bus(node, endpoint);
if (rval)
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index f66b92c..6c85c07 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -60,6 +60,7 @@ struct v4l2_of_bus_parallel {
  */
 struct v4l2_of_endpoint {
struct of_endpoint base;
+   /* Fields below this line will be zeroed by v4l2_of_parse_endpoint() */
enum v4l2_mbus_type bus_type;
union {
struct v4l2_of_bus_parallel parallel;
-- 
1.7.10.4

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


[PATCH v4 0/4] Add link-frequencies to struct v4l2_of_endpoint

2015-04-09 Thread Sakari Ailus
Hi folks,

Here's the fourth version of the link-frequencies patchset, which also
changes how the v4l2_of_endpoint is used.

Since v3:

patch 2:

- Use zero when referring to zeroing memory instead of clean.

patch 3:

- Fix interface documentation language.

v3 is available here:

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

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


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

2015-04-09 Thread Sakari Ailus
The link-frequencies property is a variable length array of link frequencies
in an endpoint. The array is needed by an increasing number of drivers, so
it makes sense to add it to struct v4l2_of_endpoint.

However, the length of the array is variable and the size of struct
v4l2_of_endpoint is fixed since it is allocated by the caller. The options
here are

1. to define a fixed maximum limit of link frequencies that has to be the
global maximum of all boards. This is seen as problematic since the maximum
could be largish, and everyone hitting the problem would need to submit a
patch to fix it, or

2. parse the property in every driver. This doesn't sound appealing as two
of the three implementations submitted to linux-media were wrong, and one of
them was even merged before this was noticed, or

3. change the interface so that allocating and releasing memory according to
the size of the array is possible. This is what the patch does.

v4l2_of_alloc_parse_endpoint() is just like v4l2_of_parse_endpoint(), but it
will allocate the memory resources needed to store struct v4l2_of_endpoint
and the additional arrays pointed to by this struct. A corresponding release
function v4l2_of_free_endpoint() is provided to release the memory allocated
by v4l2_of_alloc_parse_endpoint().

In addition to this, the link-frequencies property is parsed as well, and
the result is stored to struct v4l2_of_endpoint field link_frequencies.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/v4l2-core/v4l2-of.c |   87 +
 include/media/v4l2-of.h   |   17 
 2 files changed, 104 insertions(+)

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

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

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

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/smiapp/smiapp-core.c |   40 
 1 file changed, 20 insertions(+), 20 deletions(-)

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

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


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

2015-04-09 Thread Sakari Ailus
The field is unused. Remove it.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 include/media/v4l2-of.h |2 --
 1 file changed, 2 deletions(-)

diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h
index f831c9c..f66b92c 100644
--- a/include/media/v4l2-of.h
+++ b/include/media/v4l2-of.h
@@ -57,7 +57,6 @@ struct v4l2_of_bus_parallel {
  * @base: struct of_endpoint containing port, id, and local of_node
  * @bus_type: bus type
  * @bus: bus configuration data structure
- * @head: list head for this structure
  */
 struct v4l2_of_endpoint {
struct of_endpoint base;
@@ -66,7 +65,6 @@ struct v4l2_of_endpoint {
struct v4l2_of_bus_parallel parallel;
struct v4l2_of_bus_mipi_csi2 mipi_csi2;
} bus;
-   struct list_head head;
 };
 
 /**
-- 
1.7.10.4

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


Re: [PATCH v2 4/7] [media] uvcvideo: Enable runtime PM of descendant devices

2015-04-09 Thread Tomeu Vizoso
On 4 April 2015 at 14:33, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Tomeu,

 Thank you for the patch.

 Could you please CC me on the whole series for v3 ?

Sure.

 On Friday 03 April 2015 14:57:53 Tomeu Vizoso wrote:
 So UVC devices can remain runtime-suspended when the system goes into a
 sleep state, they and all of their descendant devices need to have
 runtime PM enable.

 Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com
 ---
  drivers/media/usb/uvc/uvc_driver.c | 11 +++
  1 file changed, 11 insertions(+)

 diff --git a/drivers/media/usb/uvc/uvc_driver.c
 b/drivers/media/usb/uvc/uvc_driver.c index cf27006..687e5fb 100644
 --- a/drivers/media/usb/uvc/uvc_driver.c
 +++ b/drivers/media/usb/uvc/uvc_driver.c
 @@ -1855,6 +1855,15 @@ static int uvc_register_chains(struct uvc_device
 *dev) return 0;
  }

 +static int uvc_pm_runtime_enable(struct device *dev, void *data)
 +{
 + pm_runtime_enable(dev);
 +
 + device_for_each_child(dev, NULL, uvc_pm_runtime_enable);

 How many recursion levels do we typically have with uvcvideo ?

it has video%d - input%d - event%d, when USB_VIDEO_CLASS_INPUT_EVDEV
is enabled.

 +
 + return 0;
 +}

 The function isn't UVC-specific, how about renaming it to
 pm_runtime_enable_recursive() (or something similar) and moving it to the
 runtime PM core ?

Yeah, that would be handy when doing the same to other drivers.

 +
  /* 
 * USB probe, disconnect, suspend and resume
   */
 @@ -1959,6 +1968,8 @@ static int uvc_probe(struct usb_interface *intf,
   supported.\n, ret);
   }

 + device_for_each_child(dev-intf-dev, NULL, uvc_pm_runtime_enable);

 You could just call uvc_pm_runtime_enable(dev-intf-dev, NULL) here.

I will go with the above for now.

Thanks,

Tomeu

 +
   uvc_trace(UVC_TRACE_PROBE, UVC device initialized.\n);
   usb_enable_autosuspend(udev);
   return 0;

 --
 Regards,

 Laurent Pinchart

 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
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] media: atmel-isi: add runtime pm support

2015-04-09 Thread Josh Wu
The runtime pm resume/suspend will enable/disable pclk (ISI peripheral
clock).
And we need to call runtime_pm_get_sync()/runtime_pm_put() when we need
access ISI registers.

In the meantime, as clock_start()/clock_stop() is used to control the
mclk not ISI peripheral clock. So move this to start[stop]_streaming()
function.

Signed-off-by: Josh Wu josh...@atmel.com
---

Changes in v2:
- merged v1 two patch into one.
- use runtime_pm_put() instead of runtime_pm_put_sync()
- enable peripheral clock before access ISI registers.

 drivers/media/platform/soc_camera/atmel-isi.c | 51 +++
 1 file changed, 45 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 31254b4..2b05f89 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -20,6 +20,7 @@
 #include linux/kernel.h
 #include linux/module.h
 #include linux/platform_device.h
+#include linux/pm_runtime.h
 #include linux/slab.h
 
 #include media/atmel-isi.h
@@ -384,6 +385,8 @@ static int start_streaming(struct vb2_queue *vq, unsigned 
int count)
struct atmel_isi *isi = ici-priv;
int ret;
 
+   pm_runtime_get_sync(ici-v4l2_dev.dev);
+
/* Reset ISI */
ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET);
if (ret  0) {
@@ -441,6 +444,8 @@ static void stop_streaming(struct vb2_queue *vq)
ret = atmel_isi_wait_status(isi, WAIT_ISI_DISABLE);
if (ret  0)
dev_err(icd-parent, Disable ISI timed out\n);
+
+   pm_runtime_put(ici-v4l2_dev.dev);
 }
 
 static struct vb2_ops isi_video_qops = {
@@ -509,7 +514,13 @@ static int isi_camera_set_fmt(struct soc_camera_device 
*icd,
if (mf.code != xlate-code)
return -EINVAL;
 
+   /* Enable PM and peripheral clock before operate isi registers */
+   pm_runtime_get_sync(ici-v4l2_dev.dev);
+
ret = configure_geometry(isi, pix-width, pix-height, xlate-code);
+
+   pm_runtime_put(ici-v4l2_dev.dev);
+
if (ret  0)
return ret;
 
@@ -722,14 +733,9 @@ static int isi_camera_clock_start(struct soc_camera_host 
*ici)
struct atmel_isi *isi = ici-priv;
int ret;
 
-   ret = clk_prepare_enable(isi-pclk);
-   if (ret)
-   return ret;
-
if (!IS_ERR(isi-mck)) {
ret = clk_prepare_enable(isi-mck);
if (ret) {
-   clk_disable_unprepare(isi-pclk);
return ret;
}
}
@@ -744,7 +750,6 @@ static void isi_camera_clock_stop(struct soc_camera_host 
*ici)
 
if (!IS_ERR(isi-mck))
clk_disable_unprepare(isi-mck);
-   clk_disable_unprepare(isi-pclk);
 }
 
 static unsigned int isi_camera_poll(struct file *file, poll_table *pt)
@@ -841,8 +846,13 @@ static int isi_camera_set_bus_param(struct 
soc_camera_device *icd)
 
cfg1 |= ISI_CFG1_THMASK_BEATS_16;
 
+   /* Enable PM and peripheral clock before operate isi registers */
+   pm_runtime_get_sync(ici-v4l2_dev.dev);
+
isi_writel(isi, ISI_CFG1, cfg1);
 
+   pm_runtime_put(ici-v4l2_dev.dev);
+
return 0;
 }
 
@@ -1039,6 +1049,9 @@ static int atmel_isi_probe(struct platform_device *pdev)
soc_host-v4l2_dev.dev  = pdev-dev;
soc_host-nr= pdev-id;
 
+   pm_suspend_ignore_children(pdev-dev, true);
+   pm_runtime_enable(pdev-dev);
+
if (isi-pdata.asd_sizes) {
soc_host-asd = isi-pdata.asd;
soc_host-asd_sizes = isi-pdata.asd_sizes;
@@ -1052,6 +1065,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
return 0;
 
 err_register_soc_camera_host:
+   pm_runtime_disable(pdev-dev);
 err_req_irq:
 err_ioremap:
vb2_dma_contig_cleanup_ctx(isi-alloc_ctx);
@@ -1064,6 +1078,30 @@ err_alloc_ctx:
return ret;
 }
 
+static int atmel_isi_runtime_suspend(struct device *dev)
+{
+   struct soc_camera_host *soc_host = to_soc_camera_host(dev);
+   struct atmel_isi *isi = container_of(soc_host,
+   struct atmel_isi, soc_host);
+
+   clk_disable_unprepare(isi-pclk);
+
+   return 0;
+}
+static int atmel_isi_runtime_resume(struct device *dev)
+{
+   struct soc_camera_host *soc_host = to_soc_camera_host(dev);
+   struct atmel_isi *isi = container_of(soc_host,
+   struct atmel_isi, soc_host);
+
+   return clk_prepare_enable(isi-pclk);
+}
+
+static const struct dev_pm_ops atmel_isi_dev_pm_ops = {
+   SET_RUNTIME_PM_OPS(atmel_isi_runtime_suspend,
+   atmel_isi_runtime_resume, NULL)
+};
+
 static const struct of_device_id atmel_isi_of_match[] = {
{ .compatible = atmel,at91sam9g45-isi },
{ }
@@ -1075,6 +1113,7 @@ static struct platform_driver atmel_isi_driver = {
.driver = {
   

[PATCH v2 0/3] media: atmel-isi: rework on the clock part and add runtime pm support

2015-04-09 Thread Josh Wu
This patch series fix the peripheral clock code and enable runtime pm
support.
Also it clean up the code which is for the compatiblity of mck.

Changes in v2:
- merged v1 two patch into one.
- use runtime_pm_put() instead of runtime_pm_put_sync()
- enable peripheral clock before access ISI registers.
- totally remove clock_start()/clock_stop() as they are optional.

Josh Wu (3):
  media: atmel-isi: remove the useless code which disable isi
  media: atmel-isi: add runtime pm support
  media: atmel-isi: remove mck back compatiable code as it's not need

 drivers/media/platform/soc_camera/atmel-isi.c | 101 --
 1 file changed, 45 insertions(+), 56 deletions(-)

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


Re: [git:media_tree/master] [media] Add device tree support to adp1653 flash driver

2015-04-09 Thread Hans Verkuil
On 04/09/2015 09:30 AM, Pavel Machek wrote:
 Hi!
 
 Hi Pawel,
 
 Me?

Oops, sorry. I meant Pavel. Apologies for misspelling your name.

 
 This driver doesn't compile:

 On 04/08/2015 10:46 PM, Mauro Carvalho Chehab wrote:
 This is an automatic generated email to let you know that the following 
 patch were queued at the 
 http://git.linuxtv.org/cgit.cgi/media_tree.git tree:

 
 --- a/drivers/media/i2c/adp1653.c
 +++ b/drivers/media/i2c/adp1653.c
 @@ -306,9 +309,17 @@ adp1653_init_device(struct adp1653_flash *flash)
  static int
  __adp1653_set_power(struct adp1653_flash *flash, int on)
  {
 -   int ret;
 +   int ret = 0;
 +
 +   if (flash-platform_data-power) {
 +   ret = flash-platform_data-power(flash-subdev, on);
 +   } else {
 +   gpio_set_value(flash-platform_data-power_gpio, on);

 The power_gpio field is not found in struct adp1653_platform_data.
 
 Yes, int power_gpio should be added into that struct.
 
 Can you fix this?

 I'm also getting this warning:
 
 Well, old version of patch was merged while new versions were getting
 discussed / developed in another mail thread.
 
 I guess best course of action is to drop this from Mauro's tree, as
 conflicting patch exists in Sakari's tree...?

Sakari, do you agree? How did this patch manage to be merged? Was it not
marked Superseded?

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] uvcvideo: Add quirk for Quanta NL3 laptop camera

2015-04-09 Thread Daniel Drake
Hi Laurent,

On Sat, Apr 4, 2015 at 3:44 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 I'm not sure that adding a device-specific quirk is the bast way to handle
 this problem, as it wouldn't really scale if other devices expose buggy
 descriptors. A more generic way to patch or override descriptors might be
 better, with a single quirk and a pointer to a patch function. This would
 require refactoring the quirks system to store a structure pointer instead of
 a bitfield in the driver_info field.

I agree, but I don't currently have time to work on a more advanced approach.

I think that's OK for everyone, as I can work with this patch for the
time being, and if nobody else has broken descriptors, there's no
particular rush.

Thanks,
Daniel
--
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