[GIT PULL FOR v4.2] Miscellaneous VSP1 changes

2015-06-12 Thread Laurent Pinchart
Hi Mauro,

If there's still time to get them in v4.2, could you please pull the following 
patches ?

The following changes since commit e42c8c6eb456f8978de417ea349eef676ef4385c:

  [media] au0828: move dev->boards atribuition to happen earlier (2015-06-10 
12:39:35 -0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git vsp1/next

for you to fetch changes up to a61f3619a7ac6d09428cabb8332464cbb45385da:

  media: uapi: vsp1: Use __u32 instead of u32 (2015-06-13 09:56:29 +0300)


Joe Perches (1):
  media: uapi: vsp1: Use __u32 instead of u32

Laurent Pinchart (1):
  MAINTAINERS: Add entry for the Renesas VSP1 driver

 MAINTAINERS   | 9 +
 include/uapi/linux/vsp1.h | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

-- 
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: [Xen-devel] RIP MTRR - status update for upcoming v4.2

2015-06-12 Thread Ingo Molnar

* Andy Lutomirski  wrote:

> On Jun 12, 2015 12:59 AM, "Jan Beulich"  wrote:
> >
> > >>> On 12.06.15 at 01:23,  wrote:
> > > There are two usages on MTRRs:
> > >  1) MTRR entries set by firmware
> > >  2) MTRR entries set by OS drivers
> > >
> > > We can obsolete 2), but we have no control over 1).  As UEFI firmwares
> > > also set this up, this usage will continue to stay.  So, we should not
> > > get rid of the MTRR code that looks up the MTRR entries, while we have
> > > no need to modify them.
> > >
> > > Such MTRR entries provide safe guard to /dev/mem, which allows privileged 
> > > user to access a range that may require UC mapping while the /dev/mem 
> > > driver 
> > > blindly maps it with WB.  MTRRs converts WB to UC in such a case.
> >
> > But it wouldn't be impossible to simply read the MTRRs upon boot, store the 
> > information, disable MTRRs, and correctly use PAT to achieve the same 
> > effect 
> > (i.e. the "blindly maps" part of course would need fixing).
> 
> This may crash and burn badly when we call a UEFI function or an SMI happens. 
>  I 
> think we should just leave the MTRRs alone.

Not to mention suspend/resume, reboot and other goodies where the firmware 
might 
pop up expecting intact MTRRs.

Btw., doesn't a lack of MTRRs imply UC? So is 'crash and burn' possible in most 
cases? Isn't it just 'executes slower than before'?

Thanks,

Ingo
--
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: AverMedia HD Duet (White Box) A188WB drivers

2015-06-12 Thread Manu Abraham
Hi David,

The saa7160 chipset is supported by the saa716x driver.
I wrote a driver for it, which is over here.
http://git.linuxtv.org/cgit.cgi/manu/saa716x_new.git

I do have the A188 card and documentation also with me,
thanks to Avermedia.

The card is not yet supported in the above tree, so cloning
that tree will not help much in your case. Though I have
some code related to that, it is only on my local testbox

I've been with an accident and my other hand is in a restrictive
state with minimal movements. It will be a few weeks, before
I can do something in this area. It's not much help to you at
this point right now, but just fyi

Manu



On Sat, Jun 13, 2015 at 8:46 AM, David Nelson  wrote:
> I have the AverMedia HD Duet (White Box) A188WB. Which has been
> working great for several years in Windows 7 Media Center. I just
> tried installing Mythbuntu but it does not appear to be recognized. I
> am a bit of a newbie but I managed to find some info about it.
>
> Does anyone know of a driver for it? lspci says it uses the Philips
> SAA7160 which does appear to be in a few other supported devices.
>
> Details follow
>
> I get the following from lspci -vvnnk
>
> 03:00.0 Multimedia controller [0480]: Philips Semiconductors SAA7160
> [1131:7160] (rev 01)
> Subsystem: Avermedia Technologies Inc Device [1461:1e55]
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
> Stepping- SERR- FastB2B- DisINTx-
> Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
> SERR-  Latency: 0, Cache Line Size: 64 bytes
> Interrupt: pin A routed to IRQ 10
> Region 0: Memory at ef80 (64-bit, non-prefetchable) [size=1M]
> Capabilities: 
>
>
> I can see that there is a driver for a few other devices with this
> chip at http://www.linuxtv.org/wiki/index.php/NXP_SAA716x  (i.e.
> heading "As of (2014-06-07)"
>
>
> --
> -David Nelson
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


AverMedia HD Duet (White Box) A188WB drivers

2015-06-12 Thread David Nelson
I have the AverMedia HD Duet (White Box) A188WB. Which has been
working great for several years in Windows 7 Media Center. I just
tried installing Mythbuntu but it does not appear to be recognized. I
am a bit of a newbie but I managed to find some info about it.

Does anyone know of a driver for it? lspci says it uses the Philips
SAA7160 which does appear to be in a few other supported devices.

Details follow

I get the following from lspci -vvnnk

03:00.0 Multimedia controller [0480]: Philips Semiconductors SAA7160
[1131:7160] (rev 01)
Subsystem: Avermedia Technologies Inc Device [1461:1e55]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
SERR- 


I can see that there is a driver for a few other devices with this
chip at http://www.linuxtv.org/wiki/index.php/NXP_SAA716x  (i.e.
heading "As of (2014-06-07)"


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


cron job: media_tree daily build: WARNINGS

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

Results of the daily build of media_tree:

date:   Sat Jun 13 04:00:17 CEST 2015
git branch: test
git hash:   e42c8c6eb456f8978de417ea349eef676ef4385c
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

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

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


drivers/media/dvb-frontends/rtl2832_sdr.c:1435:3-8: No need to set .owner here. The core will do it.

2015-06-12 Thread kbuild test robot
tree:   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b85dfd30cb37318587018ee430c2c1cfabf3dabc
commit: 63bdab5d31b987c5ccb81c3c6662016d07cbb5b7 [media] rtl2832_sdr: convert 
to platform driver
date:   4 months ago


coccinelle warnings: (new ones prefixed by >>)

>> drivers/media/dvb-frontends/rtl2832_sdr.c:1435:3-8: No need to set .owner 
>> here. The core will do it.

vim +1435 drivers/media/dvb-frontends/rtl2832_sdr.c

  1419  mutex_lock(&dev->v4l2_lock);
  1420  /* No need to keep the urbs around after disconnection */
  1421  dev->udev = NULL;
  1422  v4l2_device_disconnect(&dev->v4l2_dev);
  1423  video_unregister_device(&dev->vdev);
  1424  mutex_unlock(&dev->v4l2_lock);
  1425  mutex_unlock(&dev->vb_queue_lock);
  1426  
  1427  v4l2_device_put(&dev->v4l2_dev);
  1428  
  1429  return 0;
  1430  }
  1431  
  1432  static struct platform_driver rtl2832_sdr_driver = {
  1433  .driver = {
  1434  .name   = "rtl2832_sdr",
> 1435  .owner  = THIS_MODULE,
  1436  },
  1437  .probe  = rtl2832_sdr_probe,
  1438  .remove = rtl2832_sdr_remove,
  1439  };
  1440  module_platform_driver(rtl2832_sdr_driver);
  1441  
  1442  MODULE_AUTHOR("Antti Palosaari ");
  1443  MODULE_DESCRIPTION("Realtek RTL2832 SDR driver");

---
0-DAY kernel test infrastructureOpen Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild Intel Corporation
--
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: [Xen-devel] RIP MTRR - status update for upcoming v4.2

2015-06-12 Thread James Bottomley
On Fri, 2015-06-12 at 16:15 -0700, Andy Lutomirski wrote:
> On Jun 12, 2015 12:59 AM, "Jan Beulich"  wrote:
> >
> > >>> On 12.06.15 at 01:23,  wrote:
> > > There are two usages on MTRRs:
> > >  1) MTRR entries set by firmware
> > >  2) MTRR entries set by OS drivers
> > >
> > > We can obsolete 2), but we have no control over 1).  As UEFI firmwares
> > > also set this up, this usage will continue to stay.  So, we should not
> > > get rid of the MTRR code that looks up the MTRR entries, while we have
> > > no need to modify them.
> > >
> > > Such MTRR entries provide safe guard to /dev/mem, which allows
> > > privileged user to access a range that may require UC mapping while
> > > the /dev/mem driver blindly maps it with WB.  MTRRs converts WB to UC in
> > > such a case.
> >
> > But it wouldn't be impossible to simply read the MTRRs upon boot,
> > store the information, disable MTRRs, and correctly use PAT to
> > achieve the same effect (i.e. the "blindly maps" part of course
> > would need fixing).
> 
> This may crash and burn badly when we call a UEFI function or an SMI
> happens.  I think we should just leave the MTRRs alone.

Wholeheartedly agree: PAT only works when the given memory map is in
operation but MTRRs function everywhere.  Anything that goes into real
mode or installs its own memory map won't see the Linux page attributes.

James


--
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: [Xen-devel] RIP MTRR - status update for upcoming v4.2

2015-06-12 Thread Andy Lutomirski
On Jun 12, 2015 12:59 AM, "Jan Beulich"  wrote:
>
> >>> On 12.06.15 at 01:23,  wrote:
> > There are two usages on MTRRs:
> >  1) MTRR entries set by firmware
> >  2) MTRR entries set by OS drivers
> >
> > We can obsolete 2), but we have no control over 1).  As UEFI firmwares
> > also set this up, this usage will continue to stay.  So, we should not
> > get rid of the MTRR code that looks up the MTRR entries, while we have
> > no need to modify them.
> >
> > Such MTRR entries provide safe guard to /dev/mem, which allows
> > privileged user to access a range that may require UC mapping while
> > the /dev/mem driver blindly maps it with WB.  MTRRs converts WB to UC in
> > such a case.
>
> But it wouldn't be impossible to simply read the MTRRs upon boot,
> store the information, disable MTRRs, and correctly use PAT to
> achieve the same effect (i.e. the "blindly maps" part of course
> would need fixing).

This may crash and burn badly when we call a UEFI function or an SMI
happens.  I think we should just leave the MTRRs alone.

--Andy
--
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 v1.1 1/1] omap3isp: Fix sub-device power management code

2015-06-12 Thread Sakari Ailus
Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour")
modified the media controller link setup notification API and updated the
OMAP3 ISP driver accordingly. As a side effect it introduced a bug by
turning power on after setting the link instead of before. This results in
sub-devices not being powered down in some cases when they should be. Fix
it.

Signed-off-by: Sakari Ailus 
Fixes: 813f5c0ac5cc [media] media: Change media device link_notify behaviour
Cc: sta...@vger.kernel.org # since v3.10
---
Hi Laurent,

I amended the commit message a bit. Let me know if you're ok with it.

 drivers/media/platform/omap3isp/isp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 6bcab28..ce0556c 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -829,14 +829,14 @@ static int isp_pipeline_link_notify(struct media_link 
*link, u32 flags,
int ret;
 
if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
-   !(link->flags & MEDIA_LNK_FL_ENABLED)) {
+   !(flags & MEDIA_LNK_FL_ENABLED)) {
/* Powering off entities is assumed to never fail. */
isp_pipeline_pm_power(source, -sink_use);
isp_pipeline_pm_power(sink, -source_use);
return 0;
}
 
-   if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
+   if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH &&
(flags & MEDIA_LNK_FL_ENABLED)) {
 
ret = isp_pipeline_pm_power(source, sink_use);
-- 
2.1.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 1/1] omap3isp: Fix sub-device power management code

2015-06-12 Thread Sakari Ailus
Hi Laurent,

On Fri, Jun 12, 2015 at 10:24:28AM +0300, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Thursday 11 June 2015 00:38:11 Sakari Ailus wrote:
> > On Wed, Jun 10, 2015 at 03:52:50AM +0300, Laurent Pinchart wrote:
> > > On Friday 29 May 2015 02:17:47 Sakari Ailus wrote:
> > > > The power management code was reworked a little due to interface changes
> > > > in the MC. Due to those changes the power management broke a bit, fix it
> > > > so the functionality is reverted to old behaviour.
> > > 
> > > I found the commit message a bit vague. How about
> > > 
> > > "Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour")
> > > modified the media controller link setup notification API and updated the
> > > OMAP3 ISP driver accordingly. As a side effect it introduced a bug by
> > > turning power on after setting the link instead of before. This results
> > > in powered off entities being accessed. Fix it."
> > > 
> > > Or have I misunderstood the problem ?
> > 
> > Not entirely, but it's not just that: depending on the order in which the
> > links are changed and the video nodes opened or closed, the use counts may
> > end up being too high or too low (even negative).
> 
> OK. Could you please update the commit message accordingly ?

Hmm. I'm still not fully certain how did I manage to reproduce that, but in
a few occasions the sensor was powered down when it shouldn't have been and
the power count was decreased more than it was first increased.

What's indeed easy to see is that in post notification of enabling the links
the use counts of the partial pipelines are in fact not those of the
partial, but the complete one, and thus end up being twice as much they
should be.

I'm fine with using the commit message you suggested, the bottom line still
is that it was broken, and the patch fixes it.

-- 
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] media: i2c/adp1653: set enable gpio to output

2015-06-12 Thread Sakari Ailus
Hallo Uwe,

Thanks for the patch!

On Fri, Jun 12, 2015 at 09:47:28AM +0200, Uwe Kleine-König wrote:
> Without setting the direction of a gpio to output a call to
> gpiod_set_value doesn't have a defined outcome.
> 
> Furthermore this is one caller less that stops us making the flags
> argument to gpiod_get*() mandatory.
> 
> Signed-off-by: Uwe Kleine-König 
> ---
> Hello,
> 
> this patch applies to next and is only necessary on top of 074c57a25fa2
> ([media] media: i2c/adp1653: Devicetree support for adp1653).
> 
> Note I plan to make the flags parameter mandatory for 4.3. So unless
> this change gets into 4.2, would it be ok to let it go in via the gpio
> tree?

Fine for me.

For the patch,

Acked-by: Sakari Ailus 

-- 
Freundliche hilsen,

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: media_tree log has not been updated for about a month

2015-06-12 Thread Mauro Carvalho Chehab
Em 12 de junho de 2015 15:20:56 BRT, "Tycho Lürsen"  
escreveu:
>Hi all,
>I don't know who is responsible for a functioning web frontend of your 
>development tree in git.
>The thing is: http://git.linuxtv.org/cgit.cgi/media_tree.git/log/ has 
>not been updated for about a month.
>It still shows   356484cabe44984d2dc66a90bd5e3465ba1f64fb ([media] 
>dw2102: resync fifo when demod locks) as the last commit.
>That is very inconvenient to me.
>Can anyone fix this, please?
>
>Kind regards,
>Tycho.
>--
>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

Not sure what happened.  Just removed the cache manually. Please test again.

Cheers,
Mauro
--
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


media_tree log has not been updated for about a month

2015-06-12 Thread Tycho Lürsen

Hi all,
I don't know who is responsible for a functioning web frontend of your 
development tree in git.
The thing is: http://git.linuxtv.org/cgit.cgi/media_tree.git/log/ has 
not been updated for about a month.
It still shows   356484cabe44984d2dc66a90bd5e3465ba1f64fb ([media] 
dw2102: resync fifo when demod locks) as the last commit.

That is very inconvenient to me.
Can anyone fix this, please?

Kind regards,
Tycho.
--
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: [Xen-devel] RIP MTRR - status update for upcoming v4.2

2015-06-12 Thread Toshi Kani
On Fri, 2015-06-12 at 08:59 +0100, Jan Beulich wrote:
> >>> On 12.06.15 at 01:23,  wrote:
> > There are two usages on MTRRs:
> >  1) MTRR entries set by firmware
> >  2) MTRR entries set by OS drivers
> > 
> > We can obsolete 2), but we have no control over 1).  As UEFI firmwares
> > also set this up, this usage will continue to stay.  So, we should not
> > get rid of the MTRR code that looks up the MTRR entries, while we have
> > no need to modify them.
> > 
> > Such MTRR entries provide safe guard to /dev/mem, which allows
> > privileged user to access a range that may require UC mapping while
> > the /dev/mem driver blindly maps it with WB.  MTRRs converts WB to UC in
> > such a case.
> 
> But it wouldn't be impossible to simply read the MTRRs upon boot,
> store the information, disable MTRRs, and correctly use PAT to
> achieve the same effect (i.e. the "blindly maps" part of course
> would need fixing).

It could be done, but I do not see much benefit of doing it.  One of the
reasons platform vendors set MTRRs is so that a system won't hit a
machine check when an OS bug leads an access with a wrong cache type.  A
machine check is hard to analyze and can be seen as a hardware issue by
customers.  Emulating MTRRs with PAT won't protect from such a bug. 

> > UEFI memory table has memory attribute, which describes cache types
> > supported in physical memory ranges.  However, this information gets
> > lost when it it is converted to e820 table.
> 
> I'm afraid you rather don't want to trust that information, as
> firmware vendors frequently screw it up.

Could be, but we need to use firmware info when necessary...

Thanks,
-Toshi

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


[RFC v3 10/19] media/i2c/cs53l32a: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/cs53l32a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/cs53l32a.c b/drivers/media/i2c/cs53l32a.c
index 27400c16ef9a..9358350278cc 100644
--- a/drivers/media/i2c/cs53l32a.c
+++ b/drivers/media/i2c/cs53l32a.c
@@ -122,6 +122,7 @@ static const struct v4l2_ctrl_ops cs53l32a_ctrl_ops = {
 static const struct v4l2_subdev_core_ops cs53l32a_core_ops = {
.log_status = cs53l32a_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 11/19] media/i2c/cx25840/cx25840-core: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/cx25840/cx25840-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
b/drivers/media/i2c/cx25840/cx25840-core.c
index e15a789ad596..5d8d25e6bbf0 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -5044,6 +5044,7 @@ static const struct v4l2_subdev_core_ops cx25840_core_ops 
= {
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.queryctrl = v4l2_subdev_queryctrl,
.querymenu = v4l2_subdev_querymenu,
.reset = cx25840_reset,
-- 
2.1.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


[RFC v3 15/19] media/i2c/tlv320aic23b: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tlv320aic23b.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tlv320aic23b.c b/drivers/media/i2c/tlv320aic23b.c
index ef87f7b09ea2..4e279de8e194 100644
--- a/drivers/media/i2c/tlv320aic23b.c
+++ b/drivers/media/i2c/tlv320aic23b.c
@@ -123,6 +123,7 @@ static const struct v4l2_ctrl_ops tlv320aic23b_ctrl_ops = {
 static const struct v4l2_subdev_core_ops tlv320aic23b_core_ops = {
.log_status = tlv320aic23b_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 09/19] media/i2c/bt819: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/bt819.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/bt819.c b/drivers/media/i2c/bt819.c
index 76b334a6a56d..b3e9ac3616b5 100644
--- a/drivers/media/i2c/bt819.c
+++ b/drivers/media/i2c/bt819.c
@@ -381,6 +381,7 @@ static const struct v4l2_ctrl_ops bt819_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops bt819_core_ops = {
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 19/19] Documentation: media: Fix code sample

2015-06-12 Thread Ricardo Ribalda Delgado
Add newly created core op to the example.

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/video4linux/v4l2-controls.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 7e3dfcacdbee..1d25de0199c4 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -105,6 +105,7 @@ Basic usage for V4L2 and sub-device drivers
.g_ctrl = v4l2_subdev_g_ctrl,
.s_ctrl = v4l2_subdev_s_ctrl,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
 
-- 
2.1.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


[RFC v3 18/19] Docbook: media: new ioctl VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
Add documentation for new ioctl.

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/DocBook/media/v4l/v4l2.xml   |  8 
 Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 13 +
 Documentation/video4linux/v4l2-controls.txt|  3 ++-
 Documentation/video4linux/v4l2-framework.txt   |  1 +
 Documentation/zh_CN/video4linux/v4l2-framework.txt |  1 +
 5 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index e98caa1c39bd..027cf8408382 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -153,6 +153,14 @@ structs, ioctls) must be noted in more detail in the 
history chapter
 applications. -->
 
   
+   4.2
+   2015-06-12
+   rr
+   Extend &vidioc-g-ext-ctrls;. Add ioctl 
VIDIOC_G_DEF_EXT_CTRLS
+to get the default value of multiple controls.
+   
+  
+  
3.21
2015-02-13
mcc
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
index c5bdbfcc42b3..5f8283a7e288 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
@@ -1,12 +1,13 @@
 
   
 ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
-VIDIOC_TRY_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS, VIDIOC_G_DEF_EXT_CTRLS
 &manvol;
   
 
   
 VIDIOC_G_EXT_CTRLS
+VIDIOC_G_DEF_EXT_CTRLS
 VIDIOC_S_EXT_CTRLS
 VIDIOC_TRY_EXT_CTRLS
 Get or set the value of several controls, try control
@@ -39,7 +40,7 @@ values
request

  VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
-VIDIOC_TRY_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS, VIDIOC_G_DEF_EXT_CTRLS

   
   
@@ -74,7 +75,10 @@ of each &v4l2-ext-control; and call the
 VIDIOC_G_EXT_CTRLS ioctl. String controls controls
 must also set the string field. Controls
 of compound types (V4L2_CTRL_FLAG_HAS_PAYLOAD is set)
-must set the ptr field.
+must set the ptr field. To get the default value
+instead of the current value, call the
+VIDIOC_G_DEF_EXT_CTRLS ioctl with the same arguments.
+
 
 If the size is too small to
 receive the control result (only relevant for pointer-type controls
@@ -141,7 +145,8 @@ application.
The total size in bytes of the payload of this
 control. This is normally 0, but for pointer controls this should be
 set to the size of the memory containing the payload, or that will
-receive the payload. If VIDIOC_G_EXT_CTRLS finds
+receive the payload. If VIDIOC_G_EXT_CTRLS
+or VIDIOC_G_DEF_EXT_CTRLS finds
 that this value is less than is required to store
 the payload result, then it is set to a value large enough to store the
 payload result and ENOSPC is returned. Note that for string controls
diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 5517db602f37..7e3dfcacdbee 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -79,7 +79,8 @@ Basic usage for V4L2 and sub-device drivers
 
   Finally, remove all control functions from your v4l2_ioctl_ops (if any):
   vidioc_queryctrl, vidioc_query_ext_ctrl, vidioc_querymenu, vidioc_g_ctrl,
-  vidioc_s_ctrl, vidioc_g_ext_ctrls, vidioc_try_ext_ctrls and 
vidioc_s_ext_ctrls.
+  vidioc_s_ctrl, vidioc_g_ext_ctrls, vidioc_try_ext_ctrls,
+  vidioc_g_def_ext_ctrls, and vidioc_s_ext_ctrls.
   Those are now no longer needed.
 
 1.3.2) For sub-device drivers do this:
diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index 75d5c18d689a..4672396f48b1 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -462,6 +462,7 @@ VIDIOC_QUERYMENU
 VIDIOC_G_CTRL
 VIDIOC_S_CTRL
 VIDIOC_G_EXT_CTRLS
+VIDIOC_G_DEF_EXT_CTRLS
 VIDIOC_S_EXT_CTRLS
 VIDIOC_TRY_EXT_CTRLS
 
diff --git a/Documentation/zh_CN/video4linux/v4l2-framework.txt 
b/Documentation/zh_CN/video4linux/v4l2-framework.txt
index 2b828e631e31..b8c0d6fb6595 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -401,6 +401,7 @@ VIDIOC_QUERYMENU
 VIDIOC_G_CTRL
 VIDIOC_S_CTRL
 VIDIOC_G_EXT_CTRLS
+VIDIOC_G_DEF_EXT_CTRLS
 VIDIOC_S_EXT_CTRLS
 VIDIOC_TRY_EXT_CTRLS
 
-- 
2.1.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


[RFC v3 08/19] v4l2-subdev: Add g_def_ext_ctrls to core_ops

2015-06-12 Thread Ricardo Ribalda Delgado
This function returns the default value of an extended control. Provides
sub-devices with the same functionality as ioctl VIDIOC_G_DEF_EXT_CTRLS.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 7 +++
 include/media/v4l2-ctrls.h   | 2 ++
 include/media/v4l2-subdev.h  | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 02ff6f573fd2..2a42b826f857 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2888,6 +2888,13 @@ int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, 
struct v4l2_ext_controls *cs
 }
 EXPORT_SYMBOL(v4l2_subdev_g_ext_ctrls);
 
+int v4l2_subdev_g_def_ext_ctrls(struct v4l2_subdev *sd,
+   struct v4l2_ext_controls *cs)
+{
+   return v4l2_g_ext_ctrls(sd->ctrl_handler, cs, true);
+}
+EXPORT_SYMBOL(v4l2_subdev_g_def_ext_ctrls);
+
 /* Helper function to get a single control */
 static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)
 {
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 16f16b67181b..61e6cd67fc10 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -823,6 +823,8 @@ int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct 
v4l2_ctrl_handler *hdl,
 int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
 int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
 int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs);
+int v4l2_subdev_g_def_ext_ctrls(struct v4l2_subdev *sd,
+   struct v4l2_ext_controls *cs);
 int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs);
 int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs);
 int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index dc20102ff600..01b3354942cf 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -158,6 +158,8 @@ struct v4l2_subdev_core_ops {
int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
int (*g_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*ctrls);
+   int (*g_def_ext_ctrls)(struct v4l2_subdev *sd,
+  struct v4l2_ext_controls *ctrls);
int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*ctrls);
int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*ctrls);
int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
-- 
2.1.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


[RFC v3 16/19] media/i2c/vpx3220: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/vpx3220.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/vpx3220.c b/drivers/media/i2c/vpx3220.c
index 016e766e72ba..60d635250b19 100644
--- a/drivers/media/i2c/vpx3220.c
+++ b/drivers/media/i2c/vpx3220.c
@@ -451,6 +451,7 @@ static const struct v4l2_ctrl_ops vpx3220_ctrl_ops = {
 static const struct v4l2_subdev_core_ops vpx3220_core_ops = {
.init = vpx3220_init,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 06/19] media/pci/saa7164-vbi: Implement vivioc_g_def_ext_ctrls

2015-06-12 Thread Ricardo Ribalda Delgado
Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
use the controller framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/pci/saa7164/saa7164-vbi.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c 
b/drivers/media/pci/saa7164/saa7164-vbi.c
index 859fd03d82f9..e3f6cf8e83ee 100644
--- a/drivers/media/pci/saa7164/saa7164-vbi.c
+++ b/drivers/media/pci/saa7164/saa7164-vbi.c
@@ -810,6 +810,33 @@ static int vidioc_queryctrl(struct file *file, void *priv,
return -EINVAL;
 }
 
+static int vidioc_g_def_ext_ctrls(struct file *file, void *priv,
+   struct v4l2_ext_controls *ctrls)
+{
+   struct saa7164_vbi_fh *fh = file->private_data;
+   struct saa7164_port *port = fh->port;
+   int i, err = 0;
+   struct v4l2_queryctrl q;
+
+   if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
+   for (i = 0; i < ctrls->count; i++) {
+   struct v4l2_ext_control *ctrl = ctrls->controls + i;
+
+   q.id = ctrl->id;
+   err = fill_queryctrl(&port->vbi_params, &q);
+   if (err) {
+   ctrls->error_idx = i;
+   break;
+   }
+   ctrl->value = q.default_value;
+   }
+   return err;
+
+   }
+
+   return -EINVAL;
+}
+
 static int saa7164_vbi_stop_port(struct saa7164_port *port)
 {
struct saa7164_dev *dev = port->dev;
@@ -1263,6 +1290,7 @@ static const struct v4l2_ioctl_ops vbi_ioctl_ops = {
.vidioc_try_fmt_vid_cap  = vidioc_try_fmt_vid_cap,
.vidioc_s_fmt_vid_cap= vidioc_s_fmt_vid_cap,
.vidioc_g_ext_ctrls  = vidioc_g_ext_ctrls,
+   .vidioc_g_def_ext_ctrls  = vidioc_g_def_ext_ctrls,
.vidioc_s_ext_ctrls  = vidioc_s_ext_ctrls,
.vidioc_try_ext_ctrls= vidioc_try_ext_ctrls,
.vidioc_queryctrl= vidioc_queryctrl,
-- 
2.1.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


[RFC v3 13/19] media/i2c/saa7110: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/saa7110.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/saa7110.c b/drivers/media/i2c/saa7110.c
index 99689ee57d7e..964cc2cf1508 100644
--- a/drivers/media/i2c/saa7110.c
+++ b/drivers/media/i2c/saa7110.c
@@ -359,6 +359,7 @@ static const struct v4l2_ctrl_ops saa7110_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops saa7110_core_ops = {
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 17/19] media/i2c/wm8775: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/wm8775.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/wm8775.c b/drivers/media/i2c/wm8775.c
index bee7946faa7c..45d4873aca74 100644
--- a/drivers/media/i2c/wm8775.c
+++ b/drivers/media/i2c/wm8775.c
@@ -179,6 +179,7 @@ static const struct v4l2_ctrl_ops wm8775_ctrl_ops = {
 static const struct v4l2_subdev_core_ops wm8775_core_ops = {
.log_status = wm8775_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 05/19] media/pci/saa7164-encoder: Implement vivioc_g_def_ext_ctrls

2015-06-12 Thread Ricardo Ribalda Delgado
Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
use the controller framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/pci/saa7164/saa7164-encoder.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c 
b/drivers/media/pci/saa7164/saa7164-encoder.c
index 4434e0f28c26..63840bc0 100644
--- a/drivers/media/pci/saa7164/saa7164-encoder.c
+++ b/drivers/media/pci/saa7164/saa7164-encoder.c
@@ -884,6 +884,33 @@ static int vidioc_queryctrl(struct file *file, void *priv,
return -EINVAL;
 }
 
+static int vidioc_g_def_ext_ctrls(struct file *file, void *priv,
+   struct v4l2_ext_controls *ctrls)
+{
+   struct saa7164_encoder_fh *fh = file->private_data;
+   struct saa7164_port *port = fh->port;
+   int i, err = 0;
+   struct v4l2_queryctrl q;
+
+   if (ctrls->ctrl_class == V4L2_CTRL_CLASS_MPEG) {
+   for (i = 0; i < ctrls->count; i++) {
+   struct v4l2_ext_control *ctrl = ctrls->controls + i;
+
+   q.id = ctrl->id;
+   err = fill_queryctrl(&port->encoder_params, &q);
+   if (err) {
+   ctrls->error_idx = i;
+   break;
+   }
+   ctrl->value = q.default_value;
+   }
+   return err;
+
+   }
+
+   return -EINVAL;
+}
+
 static int saa7164_encoder_stop_port(struct saa7164_port *port)
 {
struct saa7164_dev *dev = port->dev;
@@ -1317,6 +1344,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_try_fmt_vid_cap  = vidioc_try_fmt_vid_cap,
.vidioc_s_fmt_vid_cap= vidioc_s_fmt_vid_cap,
.vidioc_g_ext_ctrls  = vidioc_g_ext_ctrls,
+   .vidioc_g_def_ext_ctrls  = vidioc_g_def_ext_ctrls,
.vidioc_s_ext_ctrls  = vidioc_s_ext_ctrls,
.vidioc_try_ext_ctrls= vidioc_try_ext_ctrls,
.vidioc_queryctrl= vidioc_queryctrl,
-- 
2.1.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


[RFC v3 14/19] media/i2c/saa7115: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/saa7115.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 0eae5f4471e2..c227dc11b136 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1582,6 +1582,7 @@ static const struct v4l2_ctrl_ops saa711x_ctrl_ops = {
 static const struct v4l2_subdev_core_ops saa711x_core_ops = {
.log_status = saa711x_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 12/19] media/i2c/msp3400-driver: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/msp3400-driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/msp3400-driver.c 
b/drivers/media/i2c/msp3400-driver.c
index dcc68ec71732..10837564af8e 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -643,6 +643,7 @@ static const struct v4l2_ctrl_ops msp_ctrl_ops = {
 static const struct v4l2_subdev_core_ops msp_core_ops = {
.log_status = msp_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v3 00/19] New ioct VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
Integer controls provide a way to get their default/initial value, but
any other control (p_u32, p_u8.) provide no other way to get the
initial value than unloading the module and loading it back.

*What is the actual problem?
I have a custom control with WIDTH integer values. Every value
represents the calibrated FPN (fixed pattern noise) correction value for that
column
-Application A changes the FPN correction value
-Application B wants to restore the calibrated value but it cant :(

*What is the proposed solution?
-Add a new ioctl VIDIOC_G_DEF_EXT_CTRLS, with the same API as
G_EXT_CTRLS, but that returns the initial value of a given control.


I have posted a copy of my working tree to

https://github.com/ribalda/linux/tree/g_def_ext-rfc3

It has been tested with a hacked version of yavta (for normal controls) and a
custom program for the array control.

Changelog v3:
-Comments by Hans Verkuil:
-Remove the control ops from the following drivers
saa7706
ivtv-gpio
wm8739
tvp7002
tvp514x
tvl320aic23b
tda7432
sr030pc30
saa717x
cs5345
adv7393
adv7343

Changelog v2:
-Add documentation
-Split in multiple patches
-Comments by Hans Verkuil:
-Rename ioctl to G_DEF_EXT_CTRL
-Much! better implementation of def_to_user


THANKS!


Ricardo Ribalda Delgado (19):
  media/v4l2-core: Add argument def_value to g_ext_ctrl
  media/v4l2-core: add new ioctl VIDIOC_G_DEF_EXT_CTRLS
  videodev2.h: Fix typo in comment
  media/usb/uvc: Implement vivioc_g_def_ext_ctrls
  media/pci/saa7164-encoder: Implement vivioc_g_def_ext_ctrls
  media/pci/saa7164-vbi: Implement vivioc_g_def_ext_ctrls
  media/usb/prusb2: Implement vivioc_g_def_ext_ctrls
  v4l2-subdev: Add g_def_ext_ctrls to core_ops
  media/i2c/bt819: Implement g_def_ext_ctrls core_op
  media/i2c/cs53l32a: Implement g_def_ext_ctrls core_op
  media/i2c/cx25840/cx25840-core: Implement g_def_ext_ctrls core_op
  media/i2c/msp3400-driver: Implement g_def_ext_ctrls core_op
  media/i2c/saa7110: Implement g_def_ext_ctrls core_op
  media/i2c/saa7115: Implement g_def_ext_ctrls core_op
  media/i2c/tlv320aic23b: Implement g_def_ext_ctrls core_op
  media/i2c/vpx3220: Implement g_def_ext_ctrls core_op
  media/i2c/wm8775: Implement g_def_ext_ctrls core_op
  Docbook: media: new ioctl VIDIOC_G_DEF_EXT_CTRLS
  Documentation: media: Fix code sample

 Documentation/DocBook/media/v4l/v4l2.xml   |  8 ++
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   | 13 ++---
 Documentation/video4linux/v4l2-controls.txt|  4 ++-
 Documentation/video4linux/v4l2-framework.txt   |  1 +
 Documentation/zh_CN/video4linux/v4l2-framework.txt |  1 +
 drivers/media/i2c/bt819.c  |  1 +
 drivers/media/i2c/cs53l32a.c   |  1 +
 drivers/media/i2c/cx25840/cx25840-core.c   |  1 +
 drivers/media/i2c/msp3400-driver.c |  1 +
 drivers/media/i2c/saa7110.c|  1 +
 drivers/media/i2c/saa7115.c|  1 +
 drivers/media/i2c/tlv320aic23b.c   |  1 +
 drivers/media/i2c/vpx3220.c|  1 +
 drivers/media/i2c/wm8775.c |  1 +
 drivers/media/pci/saa7164/saa7164-encoder.c| 28 +++
 drivers/media/pci/saa7164/saa7164-vbi.c| 28 +++
 drivers/media/platform/omap3isp/ispvideo.c |  2 +-
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c   | 28 +++
 drivers/media/usb/uvc/uvc_v4l2.c   | 30 
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c  |  4 +++
 drivers/media/v4l2-core/v4l2-ctrls.c   | 32 ++
 drivers/media/v4l2-core/v4l2-ioctl.c   | 25 +++--
 drivers/media/v4l2-core/v4l2-subdev.c  |  5 +++-
 include/media/v4l2-ctrls.h |  5 +++-
 include/media/v4l2-ioctl.h |  2 ++
 include/media/v4l2-subdev.h|  2 ++
 include/uapi/linux/videodev2.h |  3 +-
 27 files changed, 214 insertions(+), 16 deletions(-)

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


[RFC v3 04/19] media/usb/uvc: Implement vivioc_g_def_ext_ctrls

2015-06-12 Thread Ricardo Ribalda Delgado
Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
use the controller framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/usb/uvc/uvc_v4l2.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 2764f43607c1..e2698a77138a 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -1001,6 +1001,35 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void 
*fh,
return uvc_ctrl_rollback(handle);
 }
 
+static int uvc_ioctl_g_def_ext_ctrls(struct file *file, void *fh,
+struct v4l2_ext_controls *ctrls)
+{
+   struct uvc_fh *handle = fh;
+   struct uvc_video_chain *chain = handle->chain;
+   struct v4l2_ext_control *ctrl = ctrls->controls;
+   unsigned int i;
+   int ret;
+   struct v4l2_queryctrl qc;
+
+   ret = uvc_ctrl_begin(chain);
+   if (ret < 0)
+   return ret;
+
+   for (i = 0; i < ctrls->count; ++ctrl, ++i) {
+   qc.id = ctrl->id;
+   ret = uvc_query_v4l2_ctrl(chain, &qc);
+   if (ret < 0) {
+   ctrls->error_idx = i;
+   return ret;
+   }
+   ctrl->value = qc.default_value;
+   }
+
+   ctrls->error_idx = 0;
+
+   return 0;
+}
+
 static int uvc_ioctl_s_try_ext_ctrls(struct uvc_fh *handle,
 struct v4l2_ext_controls *ctrls,
 bool commit)
@@ -1500,6 +1529,7 @@ const struct v4l2_ioctl_ops uvc_ioctl_ops = {
.vidioc_g_ctrl = uvc_ioctl_g_ctrl,
.vidioc_s_ctrl = uvc_ioctl_s_ctrl,
.vidioc_g_ext_ctrls = uvc_ioctl_g_ext_ctrls,
+   .vidioc_g_def_ext_ctrls = uvc_ioctl_g_def_ext_ctrls,
.vidioc_s_ext_ctrls = uvc_ioctl_s_ext_ctrls,
.vidioc_try_ext_ctrls = uvc_ioctl_try_ext_ctrls,
.vidioc_querymenu = uvc_ioctl_querymenu,
-- 
2.1.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


[RFC v3 02/19] media/v4l2-core: add new ioctl VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
This ioctl returns the default value of one or more extended controls.
It has the same interface as VIDIOC_EXT_CTRLS.

It is needed due to the fact that QUERYCTRL was not enough to
provide the initial value of pointer type controls.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c |  4 
 drivers/media/v4l2-core/v4l2-ioctl.c  | 21 +
 drivers/media/v4l2-core/v4l2-subdev.c |  3 +++
 include/media/v4l2-ioctl.h|  2 ++
 include/uapi/linux/videodev2.h|  1 +
 5 files changed, 31 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index af635430524e..b7ab852b642f 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -817,6 +817,7 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct 
v4l2_edid32 __user *up)
 #defineVIDIOC_DQEVENT32_IOR ('V', 89, struct v4l2_event32)
 #define VIDIOC_CREATE_BUFS32   _IOWR('V', 92, struct v4l2_create_buffers32)
 #define VIDIOC_PREPARE_BUF32   _IOWR('V', 93, struct v4l2_buffer32)
+#define VIDIOC_G_DEF_EXT_CTRLS32 _IOWR('V', 104, struct v4l2_ext_controls32)
 
 #define VIDIOC_OVERLAY32   _IOW ('V', 14, s32)
 #define VIDIOC_STREAMON32  _IOW ('V', 18, s32)
@@ -858,6 +859,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break;
case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
case VIDIOC_G_EXT_CTRLS32: cmd = VIDIOC_G_EXT_CTRLS; break;
+   case VIDIOC_G_DEF_EXT_CTRLS32: cmd = VIDIOC_G_DEF_EXT_CTRLS; break;
case VIDIOC_S_EXT_CTRLS32: cmd = VIDIOC_S_EXT_CTRLS; break;
case VIDIOC_TRY_EXT_CTRLS32: cmd = VIDIOC_TRY_EXT_CTRLS; break;
case VIDIOC_DQEVENT32: cmd = VIDIOC_DQEVENT; break;
@@ -935,6 +937,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
break;
 
case VIDIOC_G_EXT_CTRLS:
+   case VIDIOC_G_DEF_EXT_CTRLS:
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
err = get_v4l2_ext_controls32(&karg.v2ecs, up);
@@ -962,6 +965,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
   contain information on which control failed. */
switch (cmd) {
case VIDIOC_G_EXT_CTRLS:
+   case VIDIOC_G_DEF_EXT_CTRLS:
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
if (put_v4l2_ext_controls32(&karg.v2ecs, up))
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index a675ccc8f27a..5ed03b8588ec 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1991,6 +1991,25 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops 
*ops,
-EINVAL;
 }
 
+static int v4l_g_def_ext_ctrls(const struct v4l2_ioctl_ops *ops,
+   struct file *file, void *fh, void *arg)
+{
+   struct video_device *vfd = video_devdata(file);
+   struct v4l2_ext_controls *p = arg;
+   struct v4l2_fh *vfh =
+   test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL;
+
+   p->error_idx = p->count;
+   if (vfh && vfh->ctrl_handler)
+   return v4l2_g_ext_ctrls(vfh->ctrl_handler, p, true);
+   if (vfd->ctrl_handler)
+   return v4l2_g_ext_ctrls(vfd->ctrl_handler, p, true);
+   if (ops->vidioc_g_def_ext_ctrls == NULL)
+   return -ENOTTY;
+   return check_ext_ctrls(p, 0) ?
+   ops->vidioc_g_def_ext_ctrls(file, fh, p) : -EINVAL;
+}
+
 static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
@@ -2435,6 +2454,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_FNC(VIDIOC_G_SLICED_VBI_CAP, v4l_g_sliced_vbi_cap, 
v4l_print_sliced_vbi_cap, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)),
IOCTL_INFO_FNC(VIDIOC_LOG_STATUS, v4l_log_status, v4l_print_newline, 0),
IOCTL_INFO_FNC(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_CTRL),
+   IOCTL_INFO_FNC(VIDIOC_G_DEF_EXT_CTRLS, v4l_g_def_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_CTRL),
IOCTL_INFO_FNC(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL),
IOCTL_INFO_FNC(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_CTRL),
IOCTL_INFO_STD(VIDIOC_ENUM_FRAMESIZES, vidioc_enum_framesizes, 
v4l_print_frmsizeenum, INFO_FL_CLEAR(v4l2_frmsizeenum, pixel_format)),
@@ -2643,6 +2663,7 @@ static int check_array_args(unsigned int cmd, void *parg, 
size_t *array_size,
 
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_G_EXT_CTRLS:
+   case VIDIOC_G_DEF_EXT_CTRLS:
ca

[RFC v3 07/19] media/usb/prusb2: Implement vivioc_g_def_ext_ctrls

2015-06-12 Thread Ricardo Ribalda Delgado
Callback needed by ioctl VIDIOC_G_DEF_EXT_CTRLS as this driver does not
use the controller framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index 1c5f85bf7ed4..16198c53ffa3 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -649,6 +649,33 @@ static int pvr2_g_ext_ctrls(struct file *file, void *priv,
return 0;
 }
 
+static int pvr2_g_def_ext_ctrls(struct file *file, void *priv,
+   struct v4l2_ext_controls *ctls)
+{
+   struct pvr2_v4l2_fh *fh = file->private_data;
+   struct pvr2_hdw *hdw = fh->channel.mc_head->hdw;
+   struct v4l2_ext_control *ctrl;
+   unsigned int idx;
+   int ret;
+   struct pvr2_ctrl *cptr;
+
+   ret = 0;
+   for (idx = 0; idx < ctls->count; idx++) {
+   ctrl = ctls->controls + idx;
+   cptr = pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id);
+   if (!ctrl){
+   ctls->error_idx = idx;
+   return -EINVAL;
+   }
+
+   /* Ensure that if read as a 64 bit value, the user
+  will still get a hopefully sane value */
+   ctrl->value64 = 0;
+   pvr2_ctrl_get_def(cptr, &ctrl->value);
+   }
+   return 0;
+}
+
 static int pvr2_s_ext_ctrls(struct file *file, void *priv,
struct v4l2_ext_controls *ctls)
 {
@@ -809,6 +836,7 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = {
.vidioc_g_ctrl  = pvr2_g_ctrl,
.vidioc_s_ctrl  = pvr2_s_ctrl,
.vidioc_g_ext_ctrls = pvr2_g_ext_ctrls,
+   .vidioc_g_def_ext_ctrls = pvr2_g_def_ext_ctrls,
.vidioc_s_ext_ctrls = pvr2_s_ext_ctrls,
.vidioc_try_ext_ctrls   = pvr2_try_ext_ctrls,
 };
-- 
2.1.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


[RFC v3 01/19] media/v4l2-core: Add argument def_value to g_ext_ctrl

2015-06-12 Thread Ricardo Ribalda Delgado
If def_value is set, the default value for the controls is returned.

Helper function def_to_user is also added with the same interface as
cur_to_user or new_to_user.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/platform/omap3isp/ispvideo.c |  2 +-
 drivers/media/v4l2-core/v4l2-ctrls.c   | 25 -
 drivers/media/v4l2-core/v4l2-ioctl.c   |  4 ++--
 drivers/media/v4l2-core/v4l2-subdev.c  |  2 +-
 include/media/v4l2-ctrls.h |  3 ++-
 5 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispvideo.c 
b/drivers/media/platform/omap3isp/ispvideo.c
index d285af18df7f..cdcc51ff6fa7 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -941,7 +941,7 @@ static int isp_video_check_external_subdevs(struct 
isp_video *video,
ctrls.count = 1;
ctrls.controls = &ctrl;
 
-   ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls);
+   ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls, false);
if (ret < 0) {
dev_warn(isp->dev, "no pixel rate control in subdev %s\n",
 pipe->external->name);
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6b7dcc1b77d..02ff6f573fd2 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1489,6 +1489,17 @@ static int new_to_user(struct v4l2_ext_control *c,
return ptr_to_user(c, ctrl, ctrl->p_new);
 }
 
+/* Helper function: copy the initial control value back to the caller */
+static int def_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl)
+{
+   int idx;
+
+   for (idx = 0; idx < ctrl->elems; idx++)
+   ctrl->type_ops->init(ctrl, idx, ctrl->p_new);
+
+   return ptr_to_user(c, ctrl, ctrl->p_new);
+}
+
 /* Helper function: copy the caller-provider value to the given control value 
*/
 static int user_to_ptr(struct v4l2_ext_control *c,
   struct v4l2_ctrl *ctrl,
@@ -2795,7 +2806,8 @@ static int class_check(struct v4l2_ctrl_handler *hdl, u32 
ctrl_class)
 
 
 /* Get extended controls. Allocates the helpers array if needed. */
-int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls 
*cs)
+int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl,
+struct v4l2_ext_controls *cs, bool def_value)
 {
struct v4l2_ctrl_helper helper[4];
struct v4l2_ctrl_helper *helpers = helper;
@@ -2827,9 +2839,11 @@ int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, 
struct v4l2_ext_controls *cs
 
for (i = 0; !ret && i < cs->count; i++) {
int (*ctrl_to_user)(struct v4l2_ext_control *c,
-   struct v4l2_ctrl *ctrl) = cur_to_user;
+   struct v4l2_ctrl *ctrl);
struct v4l2_ctrl *master;
 
+   ctrl_to_user = def_value ? def_to_user : cur_to_user;
+
if (helpers[i].mref == NULL)
continue;
 
@@ -2839,8 +2853,9 @@ int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, 
struct v4l2_ext_controls *cs
v4l2_ctrl_lock(master);
 
/* g_volatile_ctrl will update the new control values */
-   if ((master->flags & V4L2_CTRL_FLAG_VOLATILE) ||
-   (master->has_volatiles && !is_cur_manual(master))) {
+   if (!def_value &&
+   ((master->flags & V4L2_CTRL_FLAG_VOLATILE) ||
+   (master->has_volatiles && !is_cur_manual(master {
for (j = 0; j < master->ncontrols; j++)
cur_to_new(master->cluster[j]);
ret = call_op(master, g_volatile_ctrl);
@@ -2869,7 +2884,7 @@ EXPORT_SYMBOL(v4l2_g_ext_ctrls);
 
 int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs)
 {
-   return v4l2_g_ext_ctrls(sd->ctrl_handler, cs);
+   return v4l2_g_ext_ctrls(sd->ctrl_handler, cs, false);
 }
 EXPORT_SYMBOL(v4l2_subdev_g_ext_ctrls);
 
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 85de4557f696..a675ccc8f27a 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1982,9 +1982,9 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops 
*ops,
 
p->error_idx = p->count;
if (vfh && vfh->ctrl_handler)
-   return v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
+   return v4l2_g_ext_ctrls(vfh->ctrl_handler, p, false);
if (vfd->ctrl_handler)
-   return v4l2_g_ext_ctrls(vfd->ctrl_handler, p);
+   return v4l2_g_ext_ctrls(vfd->ctrl_handler, p, false);
if (ops->vidioc_g_ext_ctrls == NULL)
return -ENOTTY;
return check_ext_ctrls(p, 0) ? ops->vidioc_g_ext_ctrls(file, fh, p) :
diff --git a/drivers

[RFC v3 03/19] videodev2.h: Fix typo in comment

2015-06-12 Thread Ricardo Ribalda Delgado
Referenced file has moved

Signed-off-by: Ricardo Ribalda Delgado 
---
 include/uapi/linux/videodev2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index b9468a3b833e..b059237f0214 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -2272,7 +2272,7 @@ struct v4l2_create_buffers {
 #define VIDIOC_G_DEF_EXT_CTRLS _IOWR('V', 104, struct v4l2_ext_controls)
 
 /* Reminder: when adding new ioctls please add support for them to
-   drivers/media/video/v4l2-compat-ioctl32.c as well! */
+   drivers/media/v4l2-core/v4l2-compat-ioctl32.c as well! */
 
 #define BASE_VIDIOC_PRIVATE192 /* 192-255 are private */
 
-- 
2.1.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: RIP MTRR - status update for upcoming v4.2

2015-06-12 Thread Toshi Kani
On Fri, 2015-06-12 at 02:52 +0200, Luis R. Rodriguez wrote:
> On Thu, Jun 11, 2015 at 05:23:16PM -0600, Toshi Kani wrote:
> > On Thu, 2015-06-11 at 13:36 -0700, Luis R. Rodriguez wrote:
> >  :
> > > Pending RIP MTRR patches
> > > 
> > > 
> > > There are a few pending series so I wanted to provide a status update
> > > on those series.
> > > 
> > > mtrr: bury MTRR - unexport mtrr_add() and mtrr_del()
> > > 
> > > This is the nail on the MTRR coffin, it will prevent future direct
> > > access to MTRR code. This will not be posted until all of the below
> > > patches are in and merged. A possible next step here might be to
> > > consider separating PAT code from MTRR code and making PAT a first
> > > class citizen, enabling distributions to disable MTRR code in the
> > > future. I thought this was possible but for some reason I recently
> > > thought that there was one possible issue to make this happen. I
> > > suppose we won't know unless we try, unless of course someone already
> > > knows, Toshi?
> > 
> > There are two usages on MTRRs:
> >  1) MTRR entries set by firmware
> >  2) MTRR entries set by OS drivers
> > 
> > We can obsolete 2), but we have no control over 1).  As UEFI firmwares
> > also set this up, this usage will continue to stay.  So, we should not
> > get rid of the MTRR code that looks up the MTRR entries, while we have
> > no need to modify them.
> > 
> > Such MTRR entries provide safe guard to /dev/mem, which allows
> > privileged user to access a range that may require UC mapping while
> > the /dev/mem driver blindly maps it with WB.  MTRRs converts WB to UC in
> > such a case.
> > 
> > UEFI memory table has memory attribute, which describes cache types
> > supported in physical memory ranges.  However, this information gets
> > lost when it it is converted to e820 table.
> 
> Is there no way to modify CPU capability bits upon boot and kick UEFI
> to re-evaluate ? In such UEFI cases what happens for instance when
> Xen is used which does not support MTRR?

EFI GetMemoryMap() is a boot service, and won't be available after
ExitBootServices() is called.  But we should be able to keep the
attribute information copied into some table if necessary.

Xen provides virtual firmware on their guests, right?  If this firmware
does not set up MTRRs today, then I do not think it needs to set up for
UEFI, either.  Assuming the guest physical address is virtualized, it
does not have to carry the same platform attribute & restriction.

Thanks,
-Toshi


--
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 06/12] media/i2c/tda7432: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tda7432.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/tda7432.c b/drivers/media/i2c/tda7432.c
index cf93021a6500..d3834a4c48da 100644
--- a/drivers/media/i2c/tda7432.c
+++ b/drivers/media/i2c/tda7432.c
@@ -331,13 +331,6 @@ static const struct v4l2_ctrl_ops tda7432_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops tda7432_core_ops = {
.log_status = tda7432_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static const struct v4l2_subdev_ops tda7432_ops = {
-- 
2.1.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 01/12] media/i2c/adv7343: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/adv7343.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index 7c50833e7d17..d27283135490 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -319,13 +319,6 @@ static const struct v4l2_ctrl_ops adv7343_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops adv7343_core_ops = {
.log_status = adv7343_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static int adv7343_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
-- 
2.1.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 02/12] media/i2c/adv7393: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/adv7393.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/adv7393.c b/drivers/media/i2c/adv7393.c
index 558f19154eb9..0215f95c2245 100644
--- a/drivers/media/i2c/adv7393.c
+++ b/drivers/media/i2c/adv7393.c
@@ -306,13 +306,6 @@ static const struct v4l2_ctrl_ops adv7393_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops adv7393_core_ops = {
.log_status = adv7393_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static int adv7393_s_std_output(struct v4l2_subdev *sd, v4l2_std_id std)
-- 
2.1.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 07/12] media/i2c/tlv320aic23: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tlv320aic23b.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/tlv320aic23b.c b/drivers/media/i2c/tlv320aic23b.c
index ef87f7b09ea2..0370dd89f1fc 100644
--- a/drivers/media/i2c/tlv320aic23b.c
+++ b/drivers/media/i2c/tlv320aic23b.c
@@ -122,13 +122,6 @@ static const struct v4l2_ctrl_ops tlv320aic23b_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops tlv320aic23b_core_ops = {
.log_status = tlv320aic23b_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static const struct v4l2_subdev_audio_ops tlv320aic23b_audio_ops = {
-- 
2.1.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 08/12] media/i2c/tvp514x: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tvp514x.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 24e47279e30c..a93985a9b070 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -957,16 +957,6 @@ static int tvp514x_set_pad_format(struct v4l2_subdev *sd,
return 0;
 }
 
-static const struct v4l2_subdev_core_ops tvp514x_core_ops = {
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
-};
-
 static const struct v4l2_subdev_video_ops tvp514x_video_ops = {
.s_std = tvp514x_s_std,
.s_routing = tvp514x_s_routing,
@@ -983,7 +973,6 @@ static const struct v4l2_subdev_pad_ops tvp514x_pad_ops = {
 };
 
 static const struct v4l2_subdev_ops tvp514x_ops = {
-   .core = &tvp514x_core_ops,
.video = &tvp514x_video_ops,
.pad = &tvp514x_pad_ops,
 };
-- 
2.1.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 00/12] media/subdevices: Remove unused compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
Remove no longer used compat control ops, as they are not used in their
bridge drivers.

Working tree can be found at
https://github.com/ribalda/linux/tree/compat_control_clean

Ricardo Ribalda Delgado (12):
  media/i2c/adv7343: Remove compat control ops
  media/i2c/adv7393: Remove compat control ops
  media/i2c/cs5345: Remove compat control ops
  media/i2c/saa717x: Remove compat control ops
  media/i2c/sr030pc30: Remove compat control ops
  media/i2c/tda7432: Remove compat control ops
  media/i2c/tlv320aic23: Remove compat control ops
  media/i2c/tvp514x: Remove compat control ops
  media/i2c/tvp7002: Remove compat control ops
  i2c/wm8739: Remove compat control ops
  pci/ivtv/ivtv-gpio: Remove compat control ops
  media/radio/saa7706h: Remove compat control ops

 drivers/media/i2c/adv7343.c|  7 ---
 drivers/media/i2c/adv7393.c|  7 ---
 drivers/media/i2c/cs5345.c |  7 ---
 drivers/media/i2c/saa717x.c|  7 ---
 drivers/media/i2c/sr030pc30.c  |  7 ---
 drivers/media/i2c/tda7432.c|  7 ---
 drivers/media/i2c/tlv320aic23b.c   |  7 ---
 drivers/media/i2c/tvp514x.c| 11 ---
 drivers/media/i2c/tvp7002.c|  7 ---
 drivers/media/i2c/wm8739.c |  7 ---
 drivers/media/pci/ivtv/ivtv-gpio.c |  7 ---
 drivers/media/radio/saa7706h.c | 16 ++--
 12 files changed, 2 insertions(+), 95 deletions(-)

-- 
2.1.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 11/12] pci/ivtv/ivtv-gpio: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/pci/ivtv/ivtv-gpio.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-gpio.c 
b/drivers/media/pci/ivtv/ivtv-gpio.c
index af52def700cc..f752f3993687 100644
--- a/drivers/media/pci/ivtv/ivtv-gpio.c
+++ b/drivers/media/pci/ivtv/ivtv-gpio.c
@@ -313,13 +313,6 @@ static const struct v4l2_ctrl_ops gpio_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops subdev_core_ops = {
.log_status = subdev_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static const struct v4l2_subdev_tuner_ops subdev_tuner_ops = {
-- 
2.1.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 10/12] i2c/wm8739: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/wm8739.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/wm8739.c b/drivers/media/i2c/wm8739.c
index 3be73f6a40e9..534b0e560317 100644
--- a/drivers/media/i2c/wm8739.c
+++ b/drivers/media/i2c/wm8739.c
@@ -176,13 +176,6 @@ static const struct v4l2_ctrl_ops wm8739_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops wm8739_core_ops = {
.log_status = wm8739_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static const struct v4l2_subdev_audio_ops wm8739_audio_ops = {
-- 
2.1.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 09/12] media/i2c/tvp7002: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tvp7002.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 05077cffd235..f617d8b745ee 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -861,13 +861,6 @@ tvp7002_set_pad_format(struct v4l2_subdev *sd, struct 
v4l2_subdev_pad_config *cf
 /* V4L2 core operation handlers */
 static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
.log_status = tvp7002_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.g_register = tvp7002_g_register,
.s_register = tvp7002_s_register,
-- 
2.1.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 03/12] media/i2c/cs5345: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/cs5345.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/cs5345.c b/drivers/media/i2c/cs5345.c
index 34b76a9e7515..8cebf9cc8007 100644
--- a/drivers/media/i2c/cs5345.c
+++ b/drivers/media/i2c/cs5345.c
@@ -132,13 +132,6 @@ static const struct v4l2_ctrl_ops cs5345_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops cs5345_core_ops = {
.log_status = cs5345_log_status,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.g_register = cs5345_g_register,
.s_register = cs5345_s_register,
-- 
2.1.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 05/12] media/i2c/sr030pc30: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/sr030pc30.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/sr030pc30.c b/drivers/media/i2c/sr030pc30.c
index b62b6ddc4356..229dc76c44a5 100644
--- a/drivers/media/i2c/sr030pc30.c
+++ b/drivers/media/i2c/sr030pc30.c
@@ -636,13 +636,6 @@ static const struct v4l2_ctrl_ops sr030pc30_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops sr030pc30_core_ops = {
.s_power= sr030pc30_s_power,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
 };
 
 static const struct v4l2_subdev_pad_ops sr030pc30_pad_ops = {
-- 
2.1.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 12/12] media/radio/saa7706h: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/radio/saa7706h.c | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c
index ec805b09c608..183e92719140 100644
--- a/drivers/media/radio/saa7706h.c
+++ b/drivers/media/radio/saa7706h.c
@@ -336,19 +336,7 @@ static const struct v4l2_ctrl_ops saa7706h_ctrl_ops = {
.s_ctrl = saa7706h_s_ctrl,
 };
 
-static const struct v4l2_subdev_core_ops saa7706h_core_ops = {
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
-};
-
-static const struct v4l2_subdev_ops saa7706h_ops = {
-   .core = &saa7706h_core_ops,
-};
+static const struct v4l2_subdev_ops empty_ops = {};
 
 /*
  * Generic i2c probe
@@ -373,7 +361,7 @@ static int saa7706h_probe(struct i2c_client *client,
if (state == NULL)
return -ENOMEM;
sd = &state->sd;
-   v4l2_i2c_subdev_init(sd, client, &saa7706h_ops);
+   v4l2_i2c_subdev_init(sd, client, &empty_ops);
 
v4l2_ctrl_handler_init(&state->hdl, 4);
v4l2_ctrl_new_std(&state->hdl, &saa7706h_ctrl_ops,
-- 
2.1.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 04/12] media/i2c/saa717x: Remove compat control ops

2015-06-12 Thread Ricardo Ribalda Delgado
They are no longer used in old non-control-framework
bridge drivers.

Reported-by: Hans Verkuil 
Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/saa717x.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index 7d517361e419..c6ba19cf1aa5 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -1204,13 +1204,6 @@ static const struct v4l2_subdev_core_ops 
saa717x_core_ops = {
.g_register = saa717x_g_register,
.s_register = saa717x_s_register,
 #endif
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
.log_status = saa717x_log_status,
 };
 
-- 
2.1.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: [RFC v2 00/27] New ioct VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
Hello Hans

On Fri, Jun 12, 2015 at 3:41 PM, Hans Verkuil  wrote:

>
> I did a quick analysis and for the following i2c modules you can just remove 
> the
> compat control ops altogether since they are no longer used in old 
> non-control-framework
> bridge drivers:
>
> saa7706
> ivtv-gpio
> wm8739
> tvp7002
> tvp514x
> tvl320aic23b
> tda7432
> sr030pc30
> saa717x
> cs5345
> adv7393
> adv7343
>
> Also note that the uvc driver needs to be adapted manually since it can't use
> the control framework. The ioctls are implemented in the driver itself.

Would it make sense to split this patchset in two?

1) This patchset - all i2c modules that dont need compat control ops +
uvc driver
2) A new patchset removing compat control ops on the list that you provided

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


Re: [RFC v2 00/27] New ioct VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Hans Verkuil
On 06/12/2015 03:11 PM, Ricardo Ribalda Delgado wrote:
> Integer controls provide a way to get their default/initial value, but
> any other control (p_u32, p_u8.) provide no other way to get the
> initial value than unloading the module and loading it back.
> 
> *What is the actual problem?
> I have a custom control with WIDTH integer values. Every value
> represents the calibrated FPN (fixed pattern noise) correction value for that
> column
> -Application A changes the FPN correction value
> -Application B wants to restore the calibrated value but it cant :(
> 
> *What is the proposed solution?
> -Add a new ioctl VIDIOC_G_DEF_EXT_CTRLS, with the same API as
> G_EXT_CTRLS, but that returns the initial value of a given control.
> 
> 
> I have posted a copy of my working tree to
> 
> https://github.com/ribalda/linux/tree/g_def_ext
> 
> It has been tested with a hacked version of yavta (for normal controls) and a
> custom program for the array control.
> 
> Changelog v2:
> -Add documentation
> -Split in multiple patches
> -Comments by Hans:
>   -Rename ioctl to G_DEF_EXT_CTRL
>   -Much! better implementation of def_to_user
> 
> 
> THANKS!
> 
> Ricardo Ribalda Delgado (27):
>   media/v4l2-core: Add argument def_value to g_ext_ctrl
>   media/v4l2-core: add new ioctl VIDIOC_G_DEF_EXT_CTRLS
>   videodev2.h: Fix typo in comment
>   v4l2-subdev: Add g_def_ext_ctrls to core_ops
>   media/i2c/adv7343: Implement g_def_ext_ctrls core_op
>   media/i2c/adv7393: Implement g_def_ext_ctrls core_op
>   media/i2c/bt819: Implement g_def_ext_ctrls core_op
>   media/i2c/cs5345: Implement g_def_ext_ctrls core_op
>   media/i2c/cs53l32a: Implement g_def_ext_ctrls core_op
>   media/i2c/cx25840/cx25840-core: Implement g_def_ext_ctrls core_op
>   media/i2c/msp3400-driver: Implement g_def_ext_ctrls core_op
>   media/i2c/saa7110: Implement g_def_ext_ctrls core_op
>   media/i2c/saa7115: Implement g_def_ext_ctrls core_op
>   media/i2c/saa717x: Implement g_def_ext_ctrls core_op
>   media/i2c/sr030pc30: Implement g_def_ext_ctrls core_op
>   media/i2c/tda7432: Implement g_def_ext_ctrls core_op
>   media/i2c/tlv320aic23b: Implement g_def_ext_ctrls core_op
>   media/i2c/tvaudio: Implement g_def_ext_ctrls core_op
>   media/i2c/tvp514x: Implement g_def_ext_ctrls core_op
>   media/i2c/tvp7002: Implement g_def_ext_ctrls core_op
>   media/i2c/vpx3220: Implement g_def_ext_ctrls core_op
>   media/i2c/wm8739: Implement g_def_ext_ctrls core_op
>   media/i2c/wm8775: Implement g_def_ext_ctrls core_op
>   media/pci/ivtv/ivtv-gpio: Implement g_def_ext_ctrls core_op
>   media/radio/saa7706h: Implement g_def_ext_ctrls core_op

I did a quick analysis and for the following i2c modules you can just remove the
compat control ops altogether since they are no longer used in old 
non-control-framework
bridge drivers:

saa7706
ivtv-gpio
wm8739
tvp7002
tvp514x
tvl320aic23b
tda7432
sr030pc30
saa717x
cs5345
adv7393
adv7343

Also note that the uvc driver needs to be adapted manually since it can't use
the control framework. The ioctls are implemented in the driver itself.

Regards,

Hans

>   Docbook: media: new ioctl VIDIOC_G_DEF_EXT_CTRLS
>   Documentation: media: Fix code sample
> 
>  Documentation/DocBook/media/v4l/v4l2.xml   |  8 ++
>  .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   | 13 ++---
>  Documentation/video4linux/v4l2-controls.txt|  4 ++-
>  Documentation/video4linux/v4l2-framework.txt   |  1 +
>  Documentation/zh_CN/video4linux/v4l2-framework.txt |  1 +
>  drivers/media/i2c/adv7343.c|  1 +
>  drivers/media/i2c/adv7393.c|  1 +
>  drivers/media/i2c/bt819.c  |  1 +
>  drivers/media/i2c/cs5345.c |  1 +
>  drivers/media/i2c/cs53l32a.c   |  1 +
>  drivers/media/i2c/cx25840/cx25840-core.c   |  1 +
>  drivers/media/i2c/msp3400-driver.c |  1 +
>  drivers/media/i2c/saa7110.c|  1 +
>  drivers/media/i2c/saa7115.c|  1 +
>  drivers/media/i2c/saa717x.c|  1 +
>  drivers/media/i2c/sr030pc30.c  |  1 +
>  drivers/media/i2c/tda7432.c|  1 +
>  drivers/media/i2c/tlv320aic23b.c   |  1 +
>  drivers/media/i2c/tvaudio.c|  1 +
>  drivers/media/i2c/tvp514x.c|  1 +
>  drivers/media/i2c/tvp7002.c|  1 +
>  drivers/media/i2c/vpx3220.c|  1 +
>  drivers/media/i2c/wm8739.c |  1 +
>  drivers/media/i2c/wm8775.c |  1 +
>  drivers/media/pci/ivtv/ivtv-gpio.c |  1 +
>  drivers/media/platform/omap3isp/ispvideo.c |  2 +-
>  drivers/media/radio/saa7706h.c |  1 +
>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c  |  4 +++
>  drivers/media/v4l2-core/v4l2-ctrls.c   | 32 
> ++--

[RFC v2 12/27] media/i2c/saa7110: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/saa7110.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/saa7110.c b/drivers/media/i2c/saa7110.c
index 99689ee57d7e..964cc2cf1508 100644
--- a/drivers/media/i2c/saa7110.c
+++ b/drivers/media/i2c/saa7110.c
@@ -359,6 +359,7 @@ static const struct v4l2_ctrl_ops saa7110_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops saa7110_core_ops = {
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 17/27] media/i2c/tlv320aic23b: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tlv320aic23b.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tlv320aic23b.c b/drivers/media/i2c/tlv320aic23b.c
index ef87f7b09ea2..4e279de8e194 100644
--- a/drivers/media/i2c/tlv320aic23b.c
+++ b/drivers/media/i2c/tlv320aic23b.c
@@ -123,6 +123,7 @@ static const struct v4l2_ctrl_ops tlv320aic23b_ctrl_ops = {
 static const struct v4l2_subdev_core_ops tlv320aic23b_core_ops = {
.log_status = tlv320aic23b_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 27/27] Documentation: media: Fix code sample

2015-06-12 Thread Ricardo Ribalda Delgado
Add newly created core op to the example.

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/video4linux/v4l2-controls.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 7e3dfcacdbee..1d25de0199c4 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -105,6 +105,7 @@ Basic usage for V4L2 and sub-device drivers
.g_ctrl = v4l2_subdev_g_ctrl,
.s_ctrl = v4l2_subdev_s_ctrl,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
 
-- 
2.1.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


[RFC v2 19/27] media/i2c/tvp514x: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tvp514x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 24e47279e30c..d69708aac627 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -959,6 +959,7 @@ static int tvp514x_set_pad_format(struct v4l2_subdev *sd,
 
 static const struct v4l2_subdev_core_ops tvp514x_core_ops = {
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 18/27] media/i2c/tvaudio: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tvaudio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tvaudio.c b/drivers/media/i2c/tvaudio.c
index 0c50e5285cf6..05972a5d2c68 100644
--- a/drivers/media/i2c/tvaudio.c
+++ b/drivers/media/i2c/tvaudio.c
@@ -1856,6 +1856,7 @@ static const struct v4l2_ctrl_ops tvaudio_ctrl_ops = {
 static const struct v4l2_subdev_core_ops tvaudio_core_ops = {
.log_status = tvaudio_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 15/27] media/i2c/sr030pc30: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/sr030pc30.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/sr030pc30.c b/drivers/media/i2c/sr030pc30.c
index b62b6ddc4356..23836801218a 100644
--- a/drivers/media/i2c/sr030pc30.c
+++ b/drivers/media/i2c/sr030pc30.c
@@ -637,6 +637,7 @@ static const struct v4l2_ctrl_ops sr030pc30_ctrl_ops = {
 static const struct v4l2_subdev_core_ops sr030pc30_core_ops = {
.s_power= sr030pc30_s_power,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 23/27] media/i2c/wm8775: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/wm8775.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/wm8775.c b/drivers/media/i2c/wm8775.c
index bee7946faa7c..45d4873aca74 100644
--- a/drivers/media/i2c/wm8775.c
+++ b/drivers/media/i2c/wm8775.c
@@ -179,6 +179,7 @@ static const struct v4l2_ctrl_ops wm8775_ctrl_ops = {
 static const struct v4l2_subdev_core_ops wm8775_core_ops = {
.log_status = wm8775_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 08/27] media/i2c/cs5345: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/cs5345.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/cs5345.c b/drivers/media/i2c/cs5345.c
index 34b76a9e7515..ad3c89585909 100644
--- a/drivers/media/i2c/cs5345.c
+++ b/drivers/media/i2c/cs5345.c
@@ -133,6 +133,7 @@ static const struct v4l2_ctrl_ops cs5345_ctrl_ops = {
 static const struct v4l2_subdev_core_ops cs5345_core_ops = {
.log_status = cs5345_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 07/27] media/i2c/bt819: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/bt819.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/bt819.c b/drivers/media/i2c/bt819.c
index 76b334a6a56d..b3e9ac3616b5 100644
--- a/drivers/media/i2c/bt819.c
+++ b/drivers/media/i2c/bt819.c
@@ -381,6 +381,7 @@ static const struct v4l2_ctrl_ops bt819_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops bt819_core_ops = {
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 10/27] media/i2c/cx25840/cx25840-core: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/cx25840/cx25840-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
b/drivers/media/i2c/cx25840/cx25840-core.c
index e15a789ad596..5d8d25e6bbf0 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -5044,6 +5044,7 @@ static const struct v4l2_subdev_core_ops cx25840_core_ops 
= {
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.queryctrl = v4l2_subdev_queryctrl,
.querymenu = v4l2_subdev_querymenu,
.reset = cx25840_reset,
-- 
2.1.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


[RFC v2 21/27] media/i2c/vpx3220: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/vpx3220.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/vpx3220.c b/drivers/media/i2c/vpx3220.c
index 016e766e72ba..60d635250b19 100644
--- a/drivers/media/i2c/vpx3220.c
+++ b/drivers/media/i2c/vpx3220.c
@@ -451,6 +451,7 @@ static const struct v4l2_ctrl_ops vpx3220_ctrl_ops = {
 static const struct v4l2_subdev_core_ops vpx3220_core_ops = {
.init = vpx3220_init,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 09/27] media/i2c/cs53l32a: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/cs53l32a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/cs53l32a.c b/drivers/media/i2c/cs53l32a.c
index 27400c16ef9a..9358350278cc 100644
--- a/drivers/media/i2c/cs53l32a.c
+++ b/drivers/media/i2c/cs53l32a.c
@@ -122,6 +122,7 @@ static const struct v4l2_ctrl_ops cs53l32a_ctrl_ops = {
 static const struct v4l2_subdev_core_ops cs53l32a_core_ops = {
.log_status = cs53l32a_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 06/27] media/i2c/adv7393: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/adv7393.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/adv7393.c b/drivers/media/i2c/adv7393.c
index 558f19154eb9..e59e29335c83 100644
--- a/drivers/media/i2c/adv7393.c
+++ b/drivers/media/i2c/adv7393.c
@@ -307,6 +307,7 @@ static const struct v4l2_ctrl_ops adv7393_ctrl_ops = {
 static const struct v4l2_subdev_core_ops adv7393_core_ops = {
.log_status = adv7393_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 05/27] media/i2c/adv7343: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/adv7343.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index 7c50833e7d17..9753fb545f17 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -320,6 +320,7 @@ static const struct v4l2_ctrl_ops adv7343_ctrl_ops = {
 static const struct v4l2_subdev_core_ops adv7343_core_ops = {
.log_status = adv7343_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 04/27] v4l2-subdev: Add g_def_ext_ctrls to core_ops

2015-06-12 Thread Ricardo Ribalda Delgado
This function returns the default value of an extended control. Provides
sub-devices with the same functionality as ioctl VIDIOC_G_DEF_EXT_CTRLS.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 7 +++
 include/media/v4l2-ctrls.h   | 2 ++
 include/media/v4l2-subdev.h  | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 02ff6f573fd2..2a42b826f857 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2888,6 +2888,13 @@ int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, 
struct v4l2_ext_controls *cs
 }
 EXPORT_SYMBOL(v4l2_subdev_g_ext_ctrls);
 
+int v4l2_subdev_g_def_ext_ctrls(struct v4l2_subdev *sd,
+   struct v4l2_ext_controls *cs)
+{
+   return v4l2_g_ext_ctrls(sd->ctrl_handler, cs, true);
+}
+EXPORT_SYMBOL(v4l2_subdev_g_def_ext_ctrls);
+
 /* Helper function to get a single control */
 static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)
 {
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 16f16b67181b..61e6cd67fc10 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -823,6 +823,8 @@ int v4l2_s_ext_ctrls(struct v4l2_fh *fh, struct 
v4l2_ctrl_handler *hdl,
 int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc);
 int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
 int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs);
+int v4l2_subdev_g_def_ext_ctrls(struct v4l2_subdev *sd,
+   struct v4l2_ext_controls *cs);
 int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs);
 int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs);
 int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index dc20102ff600..01b3354942cf 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -158,6 +158,8 @@ struct v4l2_subdev_core_ops {
int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl);
int (*g_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*ctrls);
+   int (*g_def_ext_ctrls)(struct v4l2_subdev *sd,
+  struct v4l2_ext_controls *ctrls);
int (*s_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*ctrls);
int (*try_ext_ctrls)(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*ctrls);
int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm);
-- 
2.1.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


[RFC v2 22/27] media/i2c/wm8739: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/wm8739.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/wm8739.c b/drivers/media/i2c/wm8739.c
index 3be73f6a40e9..003c07bee16f 100644
--- a/drivers/media/i2c/wm8739.c
+++ b/drivers/media/i2c/wm8739.c
@@ -177,6 +177,7 @@ static const struct v4l2_ctrl_ops wm8739_ctrl_ops = {
 static const struct v4l2_subdev_core_ops wm8739_core_ops = {
.log_status = wm8739_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 14/27] media/i2c/saa717x: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/saa717x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/saa717x.c b/drivers/media/i2c/saa717x.c
index 7d517361e419..e1f94e0131e2 100644
--- a/drivers/media/i2c/saa717x.c
+++ b/drivers/media/i2c/saa717x.c
@@ -1205,6 +1205,7 @@ static const struct v4l2_subdev_core_ops saa717x_core_ops 
= {
.s_register = saa717x_s_register,
 #endif
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 24/27] media/pci/ivtv/ivtv-gpio: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/pci/ivtv/ivtv-gpio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/ivtv/ivtv-gpio.c 
b/drivers/media/pci/ivtv/ivtv-gpio.c
index af52def700cc..d16f210670e2 100644
--- a/drivers/media/pci/ivtv/ivtv-gpio.c
+++ b/drivers/media/pci/ivtv/ivtv-gpio.c
@@ -314,6 +314,7 @@ static const struct v4l2_ctrl_ops gpio_ctrl_ops = {
 static const struct v4l2_subdev_core_ops subdev_core_ops = {
.log_status = subdev_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 16/27] media/i2c/tda7432: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tda7432.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tda7432.c b/drivers/media/i2c/tda7432.c
index cf93021a6500..efff7d48ce9e 100644
--- a/drivers/media/i2c/tda7432.c
+++ b/drivers/media/i2c/tda7432.c
@@ -332,6 +332,7 @@ static const struct v4l2_ctrl_ops tda7432_ctrl_ops = {
 static const struct v4l2_subdev_core_ops tda7432_core_ops = {
.log_status = tda7432_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 26/27] Docbook: media: new ioctl VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
Add documentation for new ioctl.

Signed-off-by: Ricardo Ribalda Delgado 
---
 Documentation/DocBook/media/v4l/v4l2.xml   |  8 
 Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml | 13 +
 Documentation/video4linux/v4l2-controls.txt|  3 ++-
 Documentation/video4linux/v4l2-framework.txt   |  1 +
 Documentation/zh_CN/video4linux/v4l2-framework.txt |  1 +
 5 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index e98caa1c39bd..027cf8408382 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -153,6 +153,14 @@ structs, ioctls) must be noted in more detail in the 
history chapter
 applications. -->
 
   
+   4.2
+   2015-06-12
+   rr
+   Extend &vidioc-g-ext-ctrls;. Add ioctl 
VIDIOC_G_DEF_EXT_CTRLS
+to get the default value of multiple controls.
+   
+  
+  
3.21
2015-02-13
mcc
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
index c5bdbfcc42b3..5f8283a7e288 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
@@ -1,12 +1,13 @@
 
   
 ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
-VIDIOC_TRY_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS, VIDIOC_G_DEF_EXT_CTRLS
 &manvol;
   
 
   
 VIDIOC_G_EXT_CTRLS
+VIDIOC_G_DEF_EXT_CTRLS
 VIDIOC_S_EXT_CTRLS
 VIDIOC_TRY_EXT_CTRLS
 Get or set the value of several controls, try control
@@ -39,7 +40,7 @@ values
request

  VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS,
-VIDIOC_TRY_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS, VIDIOC_G_DEF_EXT_CTRLS

   
   
@@ -74,7 +75,10 @@ of each &v4l2-ext-control; and call the
 VIDIOC_G_EXT_CTRLS ioctl. String controls controls
 must also set the string field. Controls
 of compound types (V4L2_CTRL_FLAG_HAS_PAYLOAD is set)
-must set the ptr field.
+must set the ptr field. To get the default value
+instead of the current value, call the
+VIDIOC_G_DEF_EXT_CTRLS ioctl with the same arguments.
+
 
 If the size is too small to
 receive the control result (only relevant for pointer-type controls
@@ -141,7 +145,8 @@ application.
The total size in bytes of the payload of this
 control. This is normally 0, but for pointer controls this should be
 set to the size of the memory containing the payload, or that will
-receive the payload. If VIDIOC_G_EXT_CTRLS finds
+receive the payload. If VIDIOC_G_EXT_CTRLS
+or VIDIOC_G_DEF_EXT_CTRLS finds
 that this value is less than is required to store
 the payload result, then it is set to a value large enough to store the
 payload result and ENOSPC is returned. Note that for string controls
diff --git a/Documentation/video4linux/v4l2-controls.txt 
b/Documentation/video4linux/v4l2-controls.txt
index 5517db602f37..7e3dfcacdbee 100644
--- a/Documentation/video4linux/v4l2-controls.txt
+++ b/Documentation/video4linux/v4l2-controls.txt
@@ -79,7 +79,8 @@ Basic usage for V4L2 and sub-device drivers
 
   Finally, remove all control functions from your v4l2_ioctl_ops (if any):
   vidioc_queryctrl, vidioc_query_ext_ctrl, vidioc_querymenu, vidioc_g_ctrl,
-  vidioc_s_ctrl, vidioc_g_ext_ctrls, vidioc_try_ext_ctrls and 
vidioc_s_ext_ctrls.
+  vidioc_s_ctrl, vidioc_g_ext_ctrls, vidioc_try_ext_ctrls,
+  vidioc_g_def_ext_ctrls, and vidioc_s_ext_ctrls.
   Those are now no longer needed.
 
 1.3.2) For sub-device drivers do this:
diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index 75d5c18d689a..4672396f48b1 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -462,6 +462,7 @@ VIDIOC_QUERYMENU
 VIDIOC_G_CTRL
 VIDIOC_S_CTRL
 VIDIOC_G_EXT_CTRLS
+VIDIOC_G_DEF_EXT_CTRLS
 VIDIOC_S_EXT_CTRLS
 VIDIOC_TRY_EXT_CTRLS
 
diff --git a/Documentation/zh_CN/video4linux/v4l2-framework.txt 
b/Documentation/zh_CN/video4linux/v4l2-framework.txt
index 2b828e631e31..b8c0d6fb6595 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -401,6 +401,7 @@ VIDIOC_QUERYMENU
 VIDIOC_G_CTRL
 VIDIOC_S_CTRL
 VIDIOC_G_EXT_CTRLS
+VIDIOC_G_DEF_EXT_CTRLS
 VIDIOC_S_EXT_CTRLS
 VIDIOC_TRY_EXT_CTRLS
 
-- 
2.1.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


[RFC v2 25/27] media/radio/saa7706h: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/radio/saa7706h.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c
index ec805b09c608..cac1496da7e2 100644
--- a/drivers/media/radio/saa7706h.c
+++ b/drivers/media/radio/saa7706h.c
@@ -338,6 +338,7 @@ static const struct v4l2_ctrl_ops saa7706h_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops saa7706h_core_ops = {
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 13/27] media/i2c/saa7115: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/saa7115.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 0eae5f4471e2..c227dc11b136 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1582,6 +1582,7 @@ static const struct v4l2_ctrl_ops saa711x_ctrl_ops = {
 static const struct v4l2_subdev_core_ops saa711x_core_ops = {
.log_status = saa711x_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 20/27] media/i2c/tvp7002: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/tvp7002.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 05077cffd235..006170ebe3da 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -862,6 +862,7 @@ tvp7002_set_pad_format(struct v4l2_subdev *sd, struct 
v4l2_subdev_pad_config *cf
 static const struct v4l2_subdev_core_ops tvp7002_core_ops = {
.log_status = tvp7002_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 11/27] media/i2c/msp3400-driver: Implement g_def_ext_ctrls core_op

2015-06-12 Thread Ricardo Ribalda Delgado
Via control framework.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/i2c/msp3400-driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/msp3400-driver.c 
b/drivers/media/i2c/msp3400-driver.c
index dcc68ec71732..10837564af8e 100644
--- a/drivers/media/i2c/msp3400-driver.c
+++ b/drivers/media/i2c/msp3400-driver.c
@@ -643,6 +643,7 @@ static const struct v4l2_ctrl_ops msp_ctrl_ops = {
 static const struct v4l2_subdev_core_ops msp_core_ops = {
.log_status = msp_log_status,
.g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
+   .g_def_ext_ctrls = v4l2_subdev_g_def_ext_ctrls,
.try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
.s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
.g_ctrl = v4l2_subdev_g_ctrl,
-- 
2.1.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


[RFC v2 03/27] videodev2.h: Fix typo in comment

2015-06-12 Thread Ricardo Ribalda Delgado
Referenced file has moved

Signed-off-by: Ricardo Ribalda Delgado 
---
 include/uapi/linux/videodev2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index b9468a3b833e..b059237f0214 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -2272,7 +2272,7 @@ struct v4l2_create_buffers {
 #define VIDIOC_G_DEF_EXT_CTRLS _IOWR('V', 104, struct v4l2_ext_controls)
 
 /* Reminder: when adding new ioctls please add support for them to
-   drivers/media/video/v4l2-compat-ioctl32.c as well! */
+   drivers/media/v4l2-core/v4l2-compat-ioctl32.c as well! */
 
 #define BASE_VIDIOC_PRIVATE192 /* 192-255 are private */
 
-- 
2.1.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


[RFC v2 02/27] media/v4l2-core: add new ioctl VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
This ioctl returns the default value of one or more extended controls.
It has the same interface as VIDIOC_EXT_CTRLS.

It is needed due to the fact that QUERYCTRL was not enough to
provide the initial value of pointer type controls.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c |  4 
 drivers/media/v4l2-core/v4l2-ioctl.c  | 21 +
 drivers/media/v4l2-core/v4l2-subdev.c |  3 +++
 include/media/v4l2-ioctl.h|  2 ++
 include/uapi/linux/videodev2.h|  1 +
 5 files changed, 31 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index af635430524e..b7ab852b642f 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -817,6 +817,7 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct 
v4l2_edid32 __user *up)
 #defineVIDIOC_DQEVENT32_IOR ('V', 89, struct v4l2_event32)
 #define VIDIOC_CREATE_BUFS32   _IOWR('V', 92, struct v4l2_create_buffers32)
 #define VIDIOC_PREPARE_BUF32   _IOWR('V', 93, struct v4l2_buffer32)
+#define VIDIOC_G_DEF_EXT_CTRLS32 _IOWR('V', 104, struct v4l2_ext_controls32)
 
 #define VIDIOC_OVERLAY32   _IOW ('V', 14, s32)
 #define VIDIOC_STREAMON32  _IOW ('V', 18, s32)
@@ -858,6 +859,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_ENUMINPUT32: cmd = VIDIOC_ENUMINPUT; break;
case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
case VIDIOC_G_EXT_CTRLS32: cmd = VIDIOC_G_EXT_CTRLS; break;
+   case VIDIOC_G_DEF_EXT_CTRLS32: cmd = VIDIOC_G_DEF_EXT_CTRLS; break;
case VIDIOC_S_EXT_CTRLS32: cmd = VIDIOC_S_EXT_CTRLS; break;
case VIDIOC_TRY_EXT_CTRLS32: cmd = VIDIOC_TRY_EXT_CTRLS; break;
case VIDIOC_DQEVENT32: cmd = VIDIOC_DQEVENT; break;
@@ -935,6 +937,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
break;
 
case VIDIOC_G_EXT_CTRLS:
+   case VIDIOC_G_DEF_EXT_CTRLS:
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
err = get_v4l2_ext_controls32(&karg.v2ecs, up);
@@ -962,6 +965,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
   contain information on which control failed. */
switch (cmd) {
case VIDIOC_G_EXT_CTRLS:
+   case VIDIOC_G_DEF_EXT_CTRLS:
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
if (put_v4l2_ext_controls32(&karg.v2ecs, up))
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index a675ccc8f27a..5ed03b8588ec 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1991,6 +1991,25 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops 
*ops,
-EINVAL;
 }
 
+static int v4l_g_def_ext_ctrls(const struct v4l2_ioctl_ops *ops,
+   struct file *file, void *fh, void *arg)
+{
+   struct video_device *vfd = video_devdata(file);
+   struct v4l2_ext_controls *p = arg;
+   struct v4l2_fh *vfh =
+   test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags) ? fh : NULL;
+
+   p->error_idx = p->count;
+   if (vfh && vfh->ctrl_handler)
+   return v4l2_g_ext_ctrls(vfh->ctrl_handler, p, true);
+   if (vfd->ctrl_handler)
+   return v4l2_g_ext_ctrls(vfd->ctrl_handler, p, true);
+   if (ops->vidioc_g_def_ext_ctrls == NULL)
+   return -ENOTTY;
+   return check_ext_ctrls(p, 0) ?
+   ops->vidioc_g_def_ext_ctrls(file, fh, p) : -EINVAL;
+}
+
 static int v4l_s_ext_ctrls(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
@@ -2435,6 +2454,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_FNC(VIDIOC_G_SLICED_VBI_CAP, v4l_g_sliced_vbi_cap, 
v4l_print_sliced_vbi_cap, INFO_FL_CLEAR(v4l2_sliced_vbi_cap, type)),
IOCTL_INFO_FNC(VIDIOC_LOG_STATUS, v4l_log_status, v4l_print_newline, 0),
IOCTL_INFO_FNC(VIDIOC_G_EXT_CTRLS, v4l_g_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_CTRL),
+   IOCTL_INFO_FNC(VIDIOC_G_DEF_EXT_CTRLS, v4l_g_def_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_CTRL),
IOCTL_INFO_FNC(VIDIOC_S_EXT_CTRLS, v4l_s_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_PRIO | INFO_FL_CTRL),
IOCTL_INFO_FNC(VIDIOC_TRY_EXT_CTRLS, v4l_try_ext_ctrls, 
v4l_print_ext_controls, INFO_FL_CTRL),
IOCTL_INFO_STD(VIDIOC_ENUM_FRAMESIZES, vidioc_enum_framesizes, 
v4l_print_frmsizeenum, INFO_FL_CLEAR(v4l2_frmsizeenum, pixel_format)),
@@ -2643,6 +2663,7 @@ static int check_array_args(unsigned int cmd, void *parg, 
size_t *array_size,
 
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_G_EXT_CTRLS:
+   case VIDIOC_G_DEF_EXT_CTRLS:
ca

[RFC v2 00/27] New ioct VIDIOC_G_DEF_EXT_CTRLS

2015-06-12 Thread Ricardo Ribalda Delgado
Integer controls provide a way to get their default/initial value, but
any other control (p_u32, p_u8.) provide no other way to get the
initial value than unloading the module and loading it back.

*What is the actual problem?
I have a custom control with WIDTH integer values. Every value
represents the calibrated FPN (fixed pattern noise) correction value for that
column
-Application A changes the FPN correction value
-Application B wants to restore the calibrated value but it cant :(

*What is the proposed solution?
-Add a new ioctl VIDIOC_G_DEF_EXT_CTRLS, with the same API as
G_EXT_CTRLS, but that returns the initial value of a given control.


I have posted a copy of my working tree to

https://github.com/ribalda/linux/tree/g_def_ext

It has been tested with a hacked version of yavta (for normal controls) and a
custom program for the array control.

Changelog v2:
-Add documentation
-Split in multiple patches
-Comments by Hans:
  -Rename ioctl to G_DEF_EXT_CTRL
  -Much! better implementation of def_to_user


THANKS!

Ricardo Ribalda Delgado (27):
  media/v4l2-core: Add argument def_value to g_ext_ctrl
  media/v4l2-core: add new ioctl VIDIOC_G_DEF_EXT_CTRLS
  videodev2.h: Fix typo in comment
  v4l2-subdev: Add g_def_ext_ctrls to core_ops
  media/i2c/adv7343: Implement g_def_ext_ctrls core_op
  media/i2c/adv7393: Implement g_def_ext_ctrls core_op
  media/i2c/bt819: Implement g_def_ext_ctrls core_op
  media/i2c/cs5345: Implement g_def_ext_ctrls core_op
  media/i2c/cs53l32a: Implement g_def_ext_ctrls core_op
  media/i2c/cx25840/cx25840-core: Implement g_def_ext_ctrls core_op
  media/i2c/msp3400-driver: Implement g_def_ext_ctrls core_op
  media/i2c/saa7110: Implement g_def_ext_ctrls core_op
  media/i2c/saa7115: Implement g_def_ext_ctrls core_op
  media/i2c/saa717x: Implement g_def_ext_ctrls core_op
  media/i2c/sr030pc30: Implement g_def_ext_ctrls core_op
  media/i2c/tda7432: Implement g_def_ext_ctrls core_op
  media/i2c/tlv320aic23b: Implement g_def_ext_ctrls core_op
  media/i2c/tvaudio: Implement g_def_ext_ctrls core_op
  media/i2c/tvp514x: Implement g_def_ext_ctrls core_op
  media/i2c/tvp7002: Implement g_def_ext_ctrls core_op
  media/i2c/vpx3220: Implement g_def_ext_ctrls core_op
  media/i2c/wm8739: Implement g_def_ext_ctrls core_op
  media/i2c/wm8775: Implement g_def_ext_ctrls core_op
  media/pci/ivtv/ivtv-gpio: Implement g_def_ext_ctrls core_op
  media/radio/saa7706h: Implement g_def_ext_ctrls core_op
  Docbook: media: new ioctl VIDIOC_G_DEF_EXT_CTRLS
  Documentation: media: Fix code sample

 Documentation/DocBook/media/v4l/v4l2.xml   |  8 ++
 .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   | 13 ++---
 Documentation/video4linux/v4l2-controls.txt|  4 ++-
 Documentation/video4linux/v4l2-framework.txt   |  1 +
 Documentation/zh_CN/video4linux/v4l2-framework.txt |  1 +
 drivers/media/i2c/adv7343.c|  1 +
 drivers/media/i2c/adv7393.c|  1 +
 drivers/media/i2c/bt819.c  |  1 +
 drivers/media/i2c/cs5345.c |  1 +
 drivers/media/i2c/cs53l32a.c   |  1 +
 drivers/media/i2c/cx25840/cx25840-core.c   |  1 +
 drivers/media/i2c/msp3400-driver.c |  1 +
 drivers/media/i2c/saa7110.c|  1 +
 drivers/media/i2c/saa7115.c|  1 +
 drivers/media/i2c/saa717x.c|  1 +
 drivers/media/i2c/sr030pc30.c  |  1 +
 drivers/media/i2c/tda7432.c|  1 +
 drivers/media/i2c/tlv320aic23b.c   |  1 +
 drivers/media/i2c/tvaudio.c|  1 +
 drivers/media/i2c/tvp514x.c|  1 +
 drivers/media/i2c/tvp7002.c|  1 +
 drivers/media/i2c/vpx3220.c|  1 +
 drivers/media/i2c/wm8739.c |  1 +
 drivers/media/i2c/wm8775.c |  1 +
 drivers/media/pci/ivtv/ivtv-gpio.c |  1 +
 drivers/media/platform/omap3isp/ispvideo.c |  2 +-
 drivers/media/radio/saa7706h.c |  1 +
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c  |  4 +++
 drivers/media/v4l2-core/v4l2-ctrls.c   | 32 ++
 drivers/media/v4l2-core/v4l2-ioctl.c   | 25 +++--
 drivers/media/v4l2-core/v4l2-subdev.c  |  5 +++-
 include/media/v4l2-ctrls.h |  5 +++-
 include/media/v4l2-ioctl.h |  2 ++
 include/media/v4l2-subdev.h|  2 ++
 include/uapi/linux/videodev2.h |  3 +-
 35 files changed, 112 insertions(+), 16 deletions(-)

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


[RFC v2 01/27] media/v4l2-core: Add argument def_value to g_ext_ctrl

2015-06-12 Thread Ricardo Ribalda Delgado
If def_value is set, the default value for the controls is returned.

Helper function def_to_user is also added with the same interface as
cur_to_user or new_to_user.

Signed-off-by: Ricardo Ribalda Delgado 
---
 drivers/media/platform/omap3isp/ispvideo.c |  2 +-
 drivers/media/v4l2-core/v4l2-ctrls.c   | 25 -
 drivers/media/v4l2-core/v4l2-ioctl.c   |  4 ++--
 drivers/media/v4l2-core/v4l2-subdev.c  |  2 +-
 include/media/v4l2-ctrls.h |  3 ++-
 5 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/omap3isp/ispvideo.c 
b/drivers/media/platform/omap3isp/ispvideo.c
index d285af18df7f..cdcc51ff6fa7 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -941,7 +941,7 @@ static int isp_video_check_external_subdevs(struct 
isp_video *video,
ctrls.count = 1;
ctrls.controls = &ctrl;
 
-   ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls);
+   ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls, false);
if (ret < 0) {
dev_warn(isp->dev, "no pixel rate control in subdev %s\n",
 pipe->external->name);
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6b7dcc1b77d..02ff6f573fd2 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1489,6 +1489,17 @@ static int new_to_user(struct v4l2_ext_control *c,
return ptr_to_user(c, ctrl, ctrl->p_new);
 }
 
+/* Helper function: copy the initial control value back to the caller */
+static int def_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl)
+{
+   int idx;
+
+   for (idx = 0; idx < ctrl->elems; idx++)
+   ctrl->type_ops->init(ctrl, idx, ctrl->p_new);
+
+   return ptr_to_user(c, ctrl, ctrl->p_new);
+}
+
 /* Helper function: copy the caller-provider value to the given control value 
*/
 static int user_to_ptr(struct v4l2_ext_control *c,
   struct v4l2_ctrl *ctrl,
@@ -2795,7 +2806,8 @@ static int class_check(struct v4l2_ctrl_handler *hdl, u32 
ctrl_class)
 
 
 /* Get extended controls. Allocates the helpers array if needed. */
-int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls 
*cs)
+int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl,
+struct v4l2_ext_controls *cs, bool def_value)
 {
struct v4l2_ctrl_helper helper[4];
struct v4l2_ctrl_helper *helpers = helper;
@@ -2827,9 +2839,11 @@ int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, 
struct v4l2_ext_controls *cs
 
for (i = 0; !ret && i < cs->count; i++) {
int (*ctrl_to_user)(struct v4l2_ext_control *c,
-   struct v4l2_ctrl *ctrl) = cur_to_user;
+   struct v4l2_ctrl *ctrl);
struct v4l2_ctrl *master;
 
+   ctrl_to_user = def_value ? def_to_user : cur_to_user;
+
if (helpers[i].mref == NULL)
continue;
 
@@ -2839,8 +2853,9 @@ int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, 
struct v4l2_ext_controls *cs
v4l2_ctrl_lock(master);
 
/* g_volatile_ctrl will update the new control values */
-   if ((master->flags & V4L2_CTRL_FLAG_VOLATILE) ||
-   (master->has_volatiles && !is_cur_manual(master))) {
+   if (!def_value &&
+   ((master->flags & V4L2_CTRL_FLAG_VOLATILE) ||
+   (master->has_volatiles && !is_cur_manual(master {
for (j = 0; j < master->ncontrols; j++)
cur_to_new(master->cluster[j]);
ret = call_op(master, g_volatile_ctrl);
@@ -2869,7 +2884,7 @@ EXPORT_SYMBOL(v4l2_g_ext_ctrls);
 
 int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls 
*cs)
 {
-   return v4l2_g_ext_ctrls(sd->ctrl_handler, cs);
+   return v4l2_g_ext_ctrls(sd->ctrl_handler, cs, false);
 }
 EXPORT_SYMBOL(v4l2_subdev_g_ext_ctrls);
 
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 85de4557f696..a675ccc8f27a 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1982,9 +1982,9 @@ static int v4l_g_ext_ctrls(const struct v4l2_ioctl_ops 
*ops,
 
p->error_idx = p->count;
if (vfh && vfh->ctrl_handler)
-   return v4l2_g_ext_ctrls(vfh->ctrl_handler, p);
+   return v4l2_g_ext_ctrls(vfh->ctrl_handler, p, false);
if (vfd->ctrl_handler)
-   return v4l2_g_ext_ctrls(vfd->ctrl_handler, p);
+   return v4l2_g_ext_ctrls(vfd->ctrl_handler, p, false);
if (ops->vidioc_g_ext_ctrls == NULL)
return -ENOTTY;
return check_ext_ctrls(p, 0) ? ops->vidioc_g_ext_ctrls(file, fh, p) :
diff --git a/drivers

Re: [PATCH 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-06-12 Thread Vinod Koul
On Thu, Jun 04, 2015 at 06:58:06PM +0300, Peter Ujfalusi wrote:
> Vinod,
> 
> On 06/02/2015 03:55 PM, Vinod Koul wrote:
> > On Fri, May 29, 2015 at 05:32:50PM +0300, Peter Ujfalusi wrote:
> >> On 05/29/2015 01:18 PM, Vinod Koul wrote:
> >>> On Fri, May 29, 2015 at 11:42:27AM +0200, Geert Uytterhoeven wrote:
>  On Fri, May 29, 2015 at 11:33 AM, Vinod Koul  
>  wrote:
> > On Tue, May 26, 2015 at 04:25:57PM +0300, Peter Ujfalusi wrote:
> >> dma_request_slave_channel_compat() 'eats' up the returned error codes 
> >> which
> >> prevents drivers using the compat call to be able to do deferred 
> >> probing.
> >>
> >> The new wrapper is identical in functionality but it will return with 
> >> error
> >> code in case of failure and will pass the -EPROBE_DEFER to the caller 
> >> in
> >> case dma_request_slave_channel_reason() returned with it.
> > This is okay but am worried about one more warpper, how about fixing
> > dma_request_slave_channel_compat()
> 
>  Then all callers of dma_request_slave_channel_compat() have to be
>  modified to handle ERR_PTR first.
> 
>  The same is true for (the existing) dma_request_slave_channel_reason()
>  vs. dma_request_slave_channel().
> >>> Good point, looking again, I think we should rather fix
> >>> dma_request_slave_channel_reason() as it was expected to return err code 
> >>> and
> >>> add new users. Anyway users of this API do expect the reason...
> >>
> >> Hrm, they are for different use.dma_request_slave_channel()/_reason() is 
> >> for
> >> drivers only working via DT or ACPI while
> >> dma_request_slave_channel_compat()/_reason() is for drivers expected to 
> >> run in
> >> DT/ACPI or legacy mode as well.
> >>
> >> I added the dma_request_slave_channel_compat_reason() because OMAP/daVinci
> >> drivers are using this to request channels - they need to support DT and
> >> legacy mode.
> > I think we should hide these things behind the API and do this behind the
> > hood for ACPI/DT systems.
> > 
> > Also it makes sense to use right API and mark rest as depricated
> 
> So to convert the dma_request_slave_channel_compat() and not to create _reason
> variant?
> 
> Or to have single API to request channel? The problem with that is that we
> need different parameters for legacy and DT for example.
Sorry this slipped thru

Thinking about it again, I think we should coverge to two APIs and mark the
legacy depracuated and look to convert folks and phase that out


-- 
~Vinod
--
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] v4l2-dv-timings: print refresh rate with better precision

2015-06-12 Thread Prashant Laddha
In many cases, refresh rate is not exact integer. In such cases,
fraction was lost and it used to print, say, 59 in case of 59.94.
Now, capturing the fraction up to 2 decimal places.

Cc: Hans Verkuil 
Signed-off-by: Prashant Laddha 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 1e08eee..21f3480 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -256,6 +256,7 @@ void v4l2_print_dv_timings(const char *dev_prefix, const 
char *prefix,
 {
const struct v4l2_bt_timings *bt = &t->bt;
u32 htot, vtot;
+   u32 fps;
 
if (t->type != V4L2_DV_BT_656_1120)
return;
@@ -265,13 +266,15 @@ void v4l2_print_dv_timings(const char *dev_prefix, const 
char *prefix,
if (bt->interlaced)
vtot /= 2;
 
+   fps = (htot * vtot) > 0 ? div_u64((100 * (u64)bt->pixelclock),
+ (htot * vtot)) : 0;
+
if (prefix == NULL)
prefix = "";
 
-   pr_info("%s: %s%ux%u%s%u (%ux%u)\n", dev_prefix, prefix,
+   pr_info("%s: %s%ux%u%s%u.%u (%ux%u)\n", dev_prefix, prefix,
bt->width, bt->height, bt->interlaced ? "i" : "p",
-   (htot * vtot) > 0 ? ((u32)bt->pixelclock / (htot * vtot)) : 0,
-   htot, vtot);
+   fps / 100, fps % 100, htot, vtot);
 
if (!detailed)
return;
-- 
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: [PATCH] Kconfig: disable Media Controller for DVB

2015-06-12 Thread Mauro Carvalho Chehab
Em Fri, 12 Jun 2015 13:02:00 +0200
Hans Verkuil  escreveu:

> On 06/12/2015 12:57 PM, Mauro Carvalho Chehab wrote:
> > Since when we start discussions about the usage Media Controller
> > for complex hardware, one thing become clear: the way it is, MC
> > fails to map anything more complex than a webcam.
> > 
> > The point is that MC has entities named as devnodes, but the only
> > devnode used (before the DVB patches) is MEDIA_ENT_T_DEVNODE_V4L.
> > Due to the way MC got implemented, however, this entity actually
> > doesn't represent the devnode, but the hardware I/O engine that
> > receives data via DMA.
> > 
> > By coincidence, such DMA is associated with the V4L device node
> > on webcam hardware, but this is not true even for other V4L2
> > devices. For example, on USB hardware, the DMA is done via the
> > USB controller. The data passes though a in-kernel filter that
> > strips off the URB headers. Other V4L2 devices like radio may not
> > even have DMA. When it have, the DMA is done via ALSA, and not
> > via the V4L devnode.
> > 
> > In other words, MC is broken as a hole, but tagging it as BROKEN
> 
> hole -> whole
> 
> One of these days you'll have retrained your brain for this :-)

Heh ;)

> 
> > right now would do more harm than good.
> > 
> > So, instead, let's mark, for now, the DVB part as broken and
> > block all new changes to it while we don't fix this mess, with
> 
> "while we fix this mess, which"

Changed to:
   "block all new changes to MC while we fix this mess, which"


Sending version 2.

Regards,
Mauro
--
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] Kconfig: disable Media Controller for DVB

2015-06-12 Thread Mauro Carvalho Chehab
Since when we start discussions about the usage Media Controller
for complex hardware, one thing become clear: the way it is, MC
fails to map anything more complex than a webcam.

The point is that MC has entities named as devnodes, but the only
devnode used (before the DVB patches) is MEDIA_ENT_T_DEVNODE_V4L.
Due to the way MC got implemented, however, this entity actually
doesn't represent the devnode, but the hardware I/O engine that
receives data via DMA.

By coincidence, such DMA is associated with the V4L device node
on webcam hardware, but this is not true even for other V4L2
devices. For example, on USB hardware, the DMA is done via the
USB controller. The data passes though a in-kernel filter that
strips off the URB headers. Other V4L2 devices like radio may not
even have DMA. When it have, the DMA is done via ALSA, and not
via the V4L devnode.

In other words, MC is broken as a whole, but tagging it as BROKEN
right now would do more harm than good.

So, instead, let's mark, for now, the DVB part as broken and
block all new changes to MC while we fix this mess, whith
we hopefully will do for the next Kernel version.

Requested-by: Laurent Pinchart 
Signed-off-by: Hans Verkuil 
Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 3ef0f90b128f..157099243d61 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -97,6 +97,7 @@ config MEDIA_CONTROLLER
 config MEDIA_CONTROLLER_DVB
bool "Enable Media controller for DVB"
depends on MEDIA_CONTROLLER
+   depends on BROKEN
---help---
  Enable the media controller API support for DVB.
 
-- 
2.4.2

--
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] Kconfig: disable Media Controller for DVB

2015-06-12 Thread Hans Verkuil
On 06/12/2015 12:57 PM, Mauro Carvalho Chehab wrote:
> Since when we start discussions about the usage Media Controller
> for complex hardware, one thing become clear: the way it is, MC
> fails to map anything more complex than a webcam.
> 
> The point is that MC has entities named as devnodes, but the only
> devnode used (before the DVB patches) is MEDIA_ENT_T_DEVNODE_V4L.
> Due to the way MC got implemented, however, this entity actually
> doesn't represent the devnode, but the hardware I/O engine that
> receives data via DMA.
> 
> By coincidence, such DMA is associated with the V4L device node
> on webcam hardware, but this is not true even for other V4L2
> devices. For example, on USB hardware, the DMA is done via the
> USB controller. The data passes though a in-kernel filter that
> strips off the URB headers. Other V4L2 devices like radio may not
> even have DMA. When it have, the DMA is done via ALSA, and not
> via the V4L devnode.
> 
> In other words, MC is broken as a hole, but tagging it as BROKEN

hole -> whole

One of these days you'll have retrained your brain for this :-)

> right now would do more harm than good.
> 
> So, instead, let's mark, for now, the DVB part as broken and
> block all new changes to it while we don't fix this mess, with

"while we fix this mess, which"

After fixing the typos:

Signed-off-by: Hans Verkuil 

Regards,

Hans

> we hopefully will do for the next Kernel version.
> 
> Requested-by: Laurent Pinchart 
> Signed-off-by: Mauro Carvalho Chehab 
> 
> diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
> index 3ef0f90b128f..157099243d61 100644
> --- a/drivers/media/Kconfig
> +++ b/drivers/media/Kconfig
> @@ -97,6 +97,7 @@ config MEDIA_CONTROLLER
>  config MEDIA_CONTROLLER_DVB
>   bool "Enable Media controller for DVB"
>   depends on MEDIA_CONTROLLER
> + depends on BROKEN
>   ---help---
> Enable the media controller API support for DVB.
>  
> 

--
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] Kconfig: disable Media Controller for DVB

2015-06-12 Thread Mauro Carvalho Chehab
Since when we start discussions about the usage Media Controller
for complex hardware, one thing become clear: the way it is, MC
fails to map anything more complex than a webcam.

The point is that MC has entities named as devnodes, but the only
devnode used (before the DVB patches) is MEDIA_ENT_T_DEVNODE_V4L.
Due to the way MC got implemented, however, this entity actually
doesn't represent the devnode, but the hardware I/O engine that
receives data via DMA.

By coincidence, such DMA is associated with the V4L device node
on webcam hardware, but this is not true even for other V4L2
devices. For example, on USB hardware, the DMA is done via the
USB controller. The data passes though a in-kernel filter that
strips off the URB headers. Other V4L2 devices like radio may not
even have DMA. When it have, the DMA is done via ALSA, and not
via the V4L devnode.

In other words, MC is broken as a hole, but tagging it as BROKEN
right now would do more harm than good.

So, instead, let's mark, for now, the DVB part as broken and
block all new changes to it while we don't fix this mess, with
we hopefully will do for the next Kernel version.

Requested-by: Laurent Pinchart 
Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 3ef0f90b128f..157099243d61 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -97,6 +97,7 @@ config MEDIA_CONTROLLER
 config MEDIA_CONTROLLER_DVB
bool "Enable Media controller for DVB"
depends on MEDIA_CONTROLLER
+   depends on BROKEN
---help---
  Enable the media controller API support for DVB.
 
-- 
2.4.2

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


Re: [RFC PATCH 0/3] Refactoring Videobuf2 for common use

2015-06-12 Thread Hans Verkuil
Hi Junghak,

On 06/08/2015 03:35 PM, Junghak Sung wrote:
> Hello everybody,
> 
> This patch series refactories exsiting Videobuf2, so that not only V4L2
> but also other frameworks can use it to manage buffer and utilize
> queue.
> 
> I would separate existing Videobuf2-core framework into two parts - common
> and v4l2-specific part. This work is as follows :
> 
> 1. Separate existing vb2_buffer structure into common buffer and
>v4l2-specific parts by removing v4l2-specific members and
>embedding it into vb2_v4l2_buffer structure like this:
> 
> struct vb2_v4l2_buffer {
> struct vb2_buffervb2;
> struct v4l2_buffer   v4l2_buf;
> struct v4l2_planev4l2_planes[VIDEO_MAX_PLANES];
> };
> 
> 2. Abstract the v4l2-specific elements, and specify them when the device
>drives use them. For example, vb2_v4l2_buffer structure can be abstracted
>by vb2_buffer structure, and device drivers can get framework-specific
>object such as vb2_v4l2_buffer by using container_of().
> 
> 3. Separate VB2-core framework into real VB2-core and v4l2-specific part.
>This means that it moves V4L2-specific parts of VB2-core to v4l2-specific
>part because current VB2-core framework has some codes dependent of V4L2.
>As a result, we will have two VB2 files - videobuf2-core.c and
>videobuf2-v4l2.c.
> 
> Why do we try to make the VB2 framework to be common?
> 
> As you may know, current DVB framework uses ringbuffer mechanism to demux
> MPEG-2 TS data and pass it to userspace. However, this mechanism requires
> extra memory copy because DVB framework provides only read() system call for
> application - read() system call copies the kernel data to user-space buffer.
> 
> So if we can use VB2 framework which supports streaming I/O and buffer
> sharing mechanism, then we could enhance existing DVB framework by removing
> the extra memory copy - with VB2 framework, application can access the kernel
> data directly through mmap system call.
> 
> This patch series is the first step for it.
> 
> We have a plan for this work as follows:
> 
> 1. Separate existing VB2 framework into three parts - VB2 common, VB2-v4l2,
>and VB2-dvb. Of course, this change should not affect other v4l2-based
>device drivers. This patch series includes some parts of this step.
> 
> 2. Add new APIs for DVB streaming I/O. These APIs will be implemented
>in VB2-dvb framework. So, we can remove unnecessary memory copy between
>kernel-space and user-space by using these new APIs.
>However, we leaves legacy interfaces as-is for backward compatibility.
> 
> We are working on this project with Mauro and have a discussion with him
> on IRC channel weekly. Nowaday, we are discussing more detailed DVB user
> scenario for streaming I/O.
> 
> The final goal of this project is to enhance current DVB framework.
> The first mission is to achieve zero-copy functionality between kernel-space
> and user-space with mmap system call. More missions are under consideration:
> i.e., we could share the buffer not only between kernel-space and user-space
> but also between devices - demux, hw video codec - by exporting a buffer
> to dmabuf fd with VB2 framework.
> 
> Any suggestions and comments are welcome.

I've tried to review it, but in the current form it is too hard to do. It's not
helped by the fact that patch 2 didn't make it to the mailinglist. It might
be better to just split up such large patches and make a note that the pull
request will combine the two (or more) patches into one.

BTW, I fully agree with what you want to do, where I am having trouble is
verifying that nothing breaks and in the details of the vb2 API changes.

Can you make a new patch series that only shows the changes to the videobuf2
sources and headers, so without all the driver changes? The driver changes
are automatically checked by the compiler when you build the drivers, so I
believe that that's correct (I hope :-) ).

Also try to split it up in smaller pieces. I had the feeling that you combined
multiple but otherwise independent changes in one patch. The vb2 framework is
an important piece of code, and I want to be confident about the changes made.

Regarding the split into core and v4l2 sources/headers: I've been thinking about
this a bit more, and what would probably make reviewing easiest is if you start
off with making a simple videobuf2-v4l2.h header that just includes core.h and
slowly move the v4l2-specific parts from videobuf2-core.h to videobuf2-v4l2.h.

And do the same with videobuf2-v4l2.c: start off with an empty source and move
code from core.c to v4l2.c whenever a v4l2-specific part migrates.

Another note: I noticed that the queue_setup op was changed so the v4l2_format
argument became a void *. I do not think that that is the right approach since
we lose strong typing.

I wonder if v4l2-specific queue ops should be introduced. I'm not sure how that
would work out, but I think we can look at that for th

Re: [RFC PATCH 1/3] modify the vb2_buffer structure for common video buffer and make struct vb2_v4l2_buffer

2015-06-12 Thread Hans Verkuil
On 06/12/2015 11:58 AM, Hans Verkuil wrote:
> Hi Junghak,
> 
> On 06/08/2015 03:35 PM, Junghak Sung wrote:
>> Make the struct vb2_buffer to common buffer by removing v4l2-specific 
>> members.
>> And common video buffer is embedded into v4l2-specific video buffer like:
>> struct vb2_v4l2_buffer {
>> struct vb2_buffervb2;
>> struct v4l2_bufferv4l2_buf;
>> struct v4l2_planev4l2_planes[VIDEO_MAX_PLANES];
>> };
>> This changes require the modifications of all device drivers that use this 
>> structure.
> 
> It's next to impossible to review just large diffs, but it is unavoidable for
> changes like this I guess.
> 
> I do recommend that you do a 'git grep videobuf2-core' to make sure all usages
> of that have been replaced with videobuf2-v4l2. I think I saw videobuf2-core
> mentioned in a comment, but it is hard to be sure.
> 
> It would also be easier to review if the renaming of core.[ch] to v4l2.[ch] 
> was
> done in a separate patch. If it is relatively easy to split it up like that,
> then I would appreciate it, but if it takes a lot of time, then leave it as 
> is.
> 
> Anyway, assuming that 'git grep videobuf2-core' doesn't find anything:
> 
> Acked-by: Hans Verkuil 

Sorry, I'm retracting that Acked-by: I tried to apply it and I saw it was 
against
an old kernel version, not against the media_tree master branch.

Also, I thought videobuf2-core.[ch] was renamed to videobuf2-v4l2.[ch], but 
that's
not the case. I think that would make much more sense. Later patches can split 
up
videobuf2-v4l2.c/h into a videobuf2-core and -v4l2 part.

Regards,

Hans

> 
> Regards,
> 
>   Hans
> 
>>
>> Signed-off-by: Junghak Sung 
>> ---
>>  Documentation/video4linux/v4l2-pci-skeleton.c  |   12 +-
>>  drivers/media/dvb-frontends/rtl2832_sdr.c  |   10 +-
>>  drivers/media/pci/cx23885/cx23885-417.c|   12 +-
>>  drivers/media/pci/cx23885/cx23885-dvb.c|   12 +-
>>  drivers/media/pci/cx23885/cx23885-vbi.c|   12 +-
>>  drivers/media/pci/cx23885/cx23885-video.c  |   12 +-
>>  drivers/media/pci/cx23885/cx23885.h|2 +-
>>  drivers/media/pci/cx25821/cx25821-video.c  |   12 +-
>>  drivers/media/pci/cx25821/cx25821.h|2 +-
>>  drivers/media/pci/cx88/cx88-blackbird.c|   14 +-
>>  drivers/media/pci/cx88/cx88-dvb.c  |   14 +-
>>  drivers/media/pci/cx88/cx88-vbi.c  |   12 +-
>>  drivers/media/pci/cx88/cx88-video.c|   12 +-
>>  drivers/media/pci/cx88/cx88.h  |2 +-
>>  drivers/media/pci/saa7134/saa7134-empress.c|2 +-
>>  drivers/media/pci/saa7134/saa7134-ts.c |   10 +-
>>  drivers/media/pci/saa7134/saa7134-vbi.c|   12 +-
>>  drivers/media/pci/saa7134/saa7134-video.c  |   18 +-
>>  drivers/media/pci/saa7134/saa7134.h|8 +-
>>  drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c |   14 +-
>>  drivers/media/pci/solo6x10/solo6x10-v4l2.c |6 +-
>>  drivers/media/pci/solo6x10/solo6x10.h  |4 +-
>>  drivers/media/pci/sta2x11/sta2x11_vip.c|   20 +-
>>  drivers/media/pci/tw68/tw68-video.c|   12 +-
>>  drivers/media/pci/tw68/tw68.h  |2 +-
>>  drivers/media/platform/am437x/am437x-vpfe.c|   16 +-
>>  drivers/media/platform/am437x/am437x-vpfe.h|2 +-
>>  drivers/media/platform/blackfin/bfin_capture.c |   20 +-
>>  drivers/media/platform/coda/coda-bit.c |   20 +-
>>  drivers/media/platform/coda/coda-common.c  |   24 +-
>>  drivers/media/platform/coda/coda-jpeg.c|2 +-
>>  drivers/media/platform/coda/coda.h |6 +-
>>  drivers/media/platform/davinci/vpbe_display.c  |8 +-
>>  drivers/media/platform/davinci/vpif_capture.c  |   16 +-
>>  drivers/media/platform/davinci/vpif_capture.h  |2 +-
>>  drivers/media/platform/davinci/vpif_display.c  |   18 +-
>>  drivers/media/platform/davinci/vpif_display.h  |6 +-
>>  drivers/media/platform/exynos-gsc/gsc-core.c   |2 +-
>>  drivers/media/platform/exynos-gsc/gsc-core.h   |6 +-
>>  drivers/media/platform/exynos-gsc/gsc-m2m.c|   16 +-
>>  drivers/media/platform/exynos4-is/fimc-capture.c   |   12 +-
>>  drivers/media/platform/exynos4-is/fimc-core.c  |4 +-
>>  drivers/media/platform/exynos4-is/fimc-core.h  |6 +-
>>  drivers/media/platform/exynos4-is/fimc-is.h|2 +-
>>  drivers/media/platform/exynos4-is/fimc-isp-video.c |   14 +-
>>  drivers/media/platform/exynos4-is/fimc-isp-video.h |2 +-
>>  drivers/media/platform/exynos4-is/fimc-isp.h   |4 +-
>>  drivers/media/platform/exynos4-is/fimc-lite.c  |   10 +-
>>  drivers/media/platform/exynos4-is/fimc-lite.h  |4 +-
>>  drivers/media/platform/exynos4-is/fimc-m2m.c   |   16 +-
>>  drivers/media/platform/m2m-deinterlace.c   |   16 

Re: [RFC PATCH 1/3] modify the vb2_buffer structure for common video buffer and make struct vb2_v4l2_buffer

2015-06-12 Thread Hans Verkuil
Hi Junghak,

On 06/08/2015 03:35 PM, Junghak Sung wrote:
> Make the struct vb2_buffer to common buffer by removing v4l2-specific members.
> And common video buffer is embedded into v4l2-specific video buffer like:
> struct vb2_v4l2_buffer {
> struct vb2_buffervb2;
> struct v4l2_bufferv4l2_buf;
> struct v4l2_planev4l2_planes[VIDEO_MAX_PLANES];
> };
> This changes require the modifications of all device drivers that use this 
> structure.

It's next to impossible to review just large diffs, but it is unavoidable for
changes like this I guess.

I do recommend that you do a 'git grep videobuf2-core' to make sure all usages
of that have been replaced with videobuf2-v4l2. I think I saw videobuf2-core
mentioned in a comment, but it is hard to be sure.

It would also be easier to review if the renaming of core.[ch] to v4l2.[ch] was
done in a separate patch. If it is relatively easy to split it up like that,
then I would appreciate it, but if it takes a lot of time, then leave it as is.

Anyway, assuming that 'git grep videobuf2-core' doesn't find anything:

Acked-by: Hans Verkuil 

Regards,

Hans

> 
> Signed-off-by: Junghak Sung 
> ---
>  Documentation/video4linux/v4l2-pci-skeleton.c  |   12 +-
>  drivers/media/dvb-frontends/rtl2832_sdr.c  |   10 +-
>  drivers/media/pci/cx23885/cx23885-417.c|   12 +-
>  drivers/media/pci/cx23885/cx23885-dvb.c|   12 +-
>  drivers/media/pci/cx23885/cx23885-vbi.c|   12 +-
>  drivers/media/pci/cx23885/cx23885-video.c  |   12 +-
>  drivers/media/pci/cx23885/cx23885.h|2 +-
>  drivers/media/pci/cx25821/cx25821-video.c  |   12 +-
>  drivers/media/pci/cx25821/cx25821.h|2 +-
>  drivers/media/pci/cx88/cx88-blackbird.c|   14 +-
>  drivers/media/pci/cx88/cx88-dvb.c  |   14 +-
>  drivers/media/pci/cx88/cx88-vbi.c  |   12 +-
>  drivers/media/pci/cx88/cx88-video.c|   12 +-
>  drivers/media/pci/cx88/cx88.h  |2 +-
>  drivers/media/pci/saa7134/saa7134-empress.c|2 +-
>  drivers/media/pci/saa7134/saa7134-ts.c |   10 +-
>  drivers/media/pci/saa7134/saa7134-vbi.c|   12 +-
>  drivers/media/pci/saa7134/saa7134-video.c  |   18 +-
>  drivers/media/pci/saa7134/saa7134.h|8 +-
>  drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c |   14 +-
>  drivers/media/pci/solo6x10/solo6x10-v4l2.c |6 +-
>  drivers/media/pci/solo6x10/solo6x10.h  |4 +-
>  drivers/media/pci/sta2x11/sta2x11_vip.c|   20 +-
>  drivers/media/pci/tw68/tw68-video.c|   12 +-
>  drivers/media/pci/tw68/tw68.h  |2 +-
>  drivers/media/platform/am437x/am437x-vpfe.c|   16 +-
>  drivers/media/platform/am437x/am437x-vpfe.h|2 +-
>  drivers/media/platform/blackfin/bfin_capture.c |   20 +-
>  drivers/media/platform/coda/coda-bit.c |   20 +-
>  drivers/media/platform/coda/coda-common.c  |   24 +-
>  drivers/media/platform/coda/coda-jpeg.c|2 +-
>  drivers/media/platform/coda/coda.h |6 +-
>  drivers/media/platform/davinci/vpbe_display.c  |8 +-
>  drivers/media/platform/davinci/vpif_capture.c  |   16 +-
>  drivers/media/platform/davinci/vpif_capture.h  |2 +-
>  drivers/media/platform/davinci/vpif_display.c  |   18 +-
>  drivers/media/platform/davinci/vpif_display.h  |6 +-
>  drivers/media/platform/exynos-gsc/gsc-core.c   |2 +-
>  drivers/media/platform/exynos-gsc/gsc-core.h   |6 +-
>  drivers/media/platform/exynos-gsc/gsc-m2m.c|   16 +-
>  drivers/media/platform/exynos4-is/fimc-capture.c   |   12 +-
>  drivers/media/platform/exynos4-is/fimc-core.c  |4 +-
>  drivers/media/platform/exynos4-is/fimc-core.h  |6 +-
>  drivers/media/platform/exynos4-is/fimc-is.h|2 +-
>  drivers/media/platform/exynos4-is/fimc-isp-video.c |   14 +-
>  drivers/media/platform/exynos4-is/fimc-isp-video.h |2 +-
>  drivers/media/platform/exynos4-is/fimc-isp.h   |4 +-
>  drivers/media/platform/exynos4-is/fimc-lite.c  |   10 +-
>  drivers/media/platform/exynos4-is/fimc-lite.h  |4 +-
>  drivers/media/platform/exynos4-is/fimc-m2m.c   |   16 +-
>  drivers/media/platform/m2m-deinterlace.c   |   16 +-
>  drivers/media/platform/marvell-ccic/mcam-core.c|   24 +-
>  drivers/media/platform/marvell-ccic/mcam-core.h|2 +-
>  drivers/media/platform/mx2_emmaprp.c   |   16 +-
>  drivers/media/platform/omap3isp/ispvideo.c |8 +-
>  drivers/media/platform/omap3isp/ispvideo.h |4 +-
>  drivers/media/platform/s3c-camif/camif-capture.c   |   12 +-
>  drivers/media/platform/s3c-camif/camif-core.c  |2 +-
>  drivers/media/platform/s3c-camif/camif-core.h  |4 +-
>  drivers/media/platform/s5p-g2d/g2d.c 

Re: [PATCH 2/9] [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()

2015-06-12 Thread Tomi Valkeinen


On 12/06/15 12:26, Laurent Pinchart wrote:
> Hi Tomi,
> 
> On Friday 12 June 2015 12:21:13 Tomi Valkeinen wrote:
>> On 11/06/15 07:21, Laurent Pinchart wrote:
>>> On Wednesday 10 June 2015 06:20:45 Mauro Carvalho Chehab wrote:
 From: Jan Kara 

 Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() instead of
 hand made mapping of virtual address to physical address. Also the
 function leaked page reference from get_user_pages() so fix that by
 properly release the reference when omap_vout_buffer_release() is
 called.

 Signed-off-by: Jan Kara 
 Signed-off-by: Hans Verkuil 
 [hans.verk...@cisco.com: remove unused struct omap_vout_device *vout
 variable]

 Signed-off-by: Mauro Carvalho Chehab 

 diff --git a/drivers/media/platform/omap/omap_vout.c
 b/drivers/media/platform/omap/omap_vout.c index
 f09c5f17a42f..7feb6394f111
 100644
 --- a/drivers/media/platform/omap/omap_vout.c
 +++ b/drivers/media/platform/omap/omap_vout.c
 @@ -195,46 +195,34 @@ static int omap_vout_try_format(struct
 v4l2_pix_format *pix) }

  /*

 - * omap_vout_uservirt_to_phys: This inline function is used to convert
 user - * space virtual address to physical address.
 + * omap_vout_get_userptr: Convert user space virtual address to physical
 + * address.

   */

 -static unsigned long omap_vout_uservirt_to_phys(unsigned long virtp)
 +static int omap_vout_get_userptr(struct videobuf_buffer *vb, u32 virtp,
 +   u32 *physp)

  {

 -  unsigned long physp = 0;
 -  struct vm_area_struct *vma;
 -  struct mm_struct *mm = current->mm;
 +  struct frame_vector *vec;
 +  int ret;

/* For kernel direct-mapped memory, take the easy way */

 -  if (virtp >= PAGE_OFFSET)
 -  return virt_to_phys((void *) virtp);
 -
 -  down_read(¤t->mm->mmap_sem);
 -  vma = find_vma(mm, virtp);
 -  if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
 -  /* this will catch, kernel-allocated, mmaped-to-usermode
 - addresses */
 -  physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
 -  up_read(¤t->mm->mmap_sem);
 -  } else {
 -  /* otherwise, use get_user_pages() for general userland pages */
 -  int res, nr_pages = 1;
 -  struct page *pages;
 +  if (virtp >= PAGE_OFFSET) {
 +  *physp = virt_to_phys((void *)virtp);
>>>
>>> Lovely. virtp comes from userspace and as far as I know it arrives here
>>> completely unchecked. The problem isn't introduced by this patch, but
>>> omap_vout buffer management seems completely broken to me, and nobody
>>> seems to care about the driver. Given that omapdrm should now provide the
>>> video output capabilities that are missing from omapfb and resulted in
>>> the development of omap_vout, shouldn't we drop the omap_vout driver ?
>>>
>>> Tomi, any opinion on this ? Do you see any omap_vout capability missing
>>> from omapdrm ?
>>
>> I've never used omap_vout, so I don't even know what it offers. I do
>> know it supports VRFB rotation (omap3), which we don't have on omapdrm,
>> though. Whether anyone uses that (or omap_vout), I have no idea...
>>
>> I'd personally love to get rid of omap_vout, as it causes complications
>> on omapfb/omapdss side.
> 
> How difficult would it be to implement VRFB rotation in omapdrm ?

I don't know... drivers/video/fbdev/omap2/vrfb.c contains the code to
handle the VRFB hardware, but it does require certain amount of book
keeping and tweaking of the fb size etc from the omapdrm side. And
probably a new parameter to somehow enable vrfb for a buffer, as you
don't want it to be used by default.

 Tomi



signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/9] [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()

2015-06-12 Thread Laurent Pinchart
Hi Tomi,

On Friday 12 June 2015 12:21:13 Tomi Valkeinen wrote:
> On 11/06/15 07:21, Laurent Pinchart wrote:
> > On Wednesday 10 June 2015 06:20:45 Mauro Carvalho Chehab wrote:
> >> From: Jan Kara 
> >> 
> >> Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() instead of
> >> hand made mapping of virtual address to physical address. Also the
> >> function leaked page reference from get_user_pages() so fix that by
> >> properly release the reference when omap_vout_buffer_release() is
> >> called.
> >> 
> >> Signed-off-by: Jan Kara 
> >> Signed-off-by: Hans Verkuil 
> >> [hans.verk...@cisco.com: remove unused struct omap_vout_device *vout
> >> variable]
> >> 
> >> Signed-off-by: Mauro Carvalho Chehab 
> >> 
> >> diff --git a/drivers/media/platform/omap/omap_vout.c
> >> b/drivers/media/platform/omap/omap_vout.c index
> >> f09c5f17a42f..7feb6394f111
> >> 100644
> >> --- a/drivers/media/platform/omap/omap_vout.c
> >> +++ b/drivers/media/platform/omap/omap_vout.c
> >> @@ -195,46 +195,34 @@ static int omap_vout_try_format(struct
> >> v4l2_pix_format *pix) }
> >> 
> >>  /*
> >> 
> >> - * omap_vout_uservirt_to_phys: This inline function is used to convert
> >> user - * space virtual address to physical address.
> >> + * omap_vout_get_userptr: Convert user space virtual address to physical
> >> + * address.
> >> 
> >>   */
> >> 
> >> -static unsigned long omap_vout_uservirt_to_phys(unsigned long virtp)
> >> +static int omap_vout_get_userptr(struct videobuf_buffer *vb, u32 virtp,
> >> +   u32 *physp)
> >> 
> >>  {
> >> 
> >> -  unsigned long physp = 0;
> >> -  struct vm_area_struct *vma;
> >> -  struct mm_struct *mm = current->mm;
> >> +  struct frame_vector *vec;
> >> +  int ret;
> >> 
> >>/* For kernel direct-mapped memory, take the easy way */
> >> 
> >> -  if (virtp >= PAGE_OFFSET)
> >> -  return virt_to_phys((void *) virtp);
> >> -
> >> -  down_read(¤t->mm->mmap_sem);
> >> -  vma = find_vma(mm, virtp);
> >> -  if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
> >> -  /* this will catch, kernel-allocated, mmaped-to-usermode
> >> - addresses */
> >> -  physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
> >> -  up_read(¤t->mm->mmap_sem);
> >> -  } else {
> >> -  /* otherwise, use get_user_pages() for general userland pages */
> >> -  int res, nr_pages = 1;
> >> -  struct page *pages;
> >> +  if (virtp >= PAGE_OFFSET) {
> >> +  *physp = virt_to_phys((void *)virtp);
> > 
> > Lovely. virtp comes from userspace and as far as I know it arrives here
> > completely unchecked. The problem isn't introduced by this patch, but
> > omap_vout buffer management seems completely broken to me, and nobody
> > seems to care about the driver. Given that omapdrm should now provide the
> > video output capabilities that are missing from omapfb and resulted in
> > the development of omap_vout, shouldn't we drop the omap_vout driver ?
> > 
> > Tomi, any opinion on this ? Do you see any omap_vout capability missing
> > from omapdrm ?
> 
> I've never used omap_vout, so I don't even know what it offers. I do
> know it supports VRFB rotation (omap3), which we don't have on omapdrm,
> though. Whether anyone uses that (or omap_vout), I have no idea...
> 
> I'd personally love to get rid of omap_vout, as it causes complications
> on omapfb/omapdss side.

How difficult would it be to implement VRFB rotation in omapdrm ?

-- 
Regards,

Laurent Pinchart


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 2/2] genalloc: rename of_get_named_gen_pool() to of_gen_pool_get()

2015-06-12 Thread Vinod Koul
On Thu, Jun 11, 2015 at 04:28:32PM +0300, Vladimir Zapolskiy wrote:
> To be consistent with other kernel interface namings, rename
> of_get_named_gen_pool() to of_gen_pool_get(). In the original
> function name "_named" suffix references to a device tree property,
> which contains a phandle to a device and the corresponding
> device driver is assumed to register a gen_pool object.
> 
> Due to a weak relation and to avoid any confusion (e.g. in future
> possible scenario if gen_pool objects are named) the suffix is
> removed.
> 
> Signed-off-by: Vladimir Zapolskiy 
> ---
>  drivers/dma/mmp_tdma.c| 2 +-
For this:

Acked-by: Vinod Koul 

-- 
~Vinod

--
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 14/15] media: soc_camera: fill in bus_info field

2015-06-12 Thread Hans Verkuil
On 06/03/2015 04:00 PM, William Towle wrote:
> From: Rob Taylor 
> 
> Adapt soc_camera_querycap() so that cap->bus_info is populated in
> addition to cap->driver.
> 
> Signed-off-by: Rob Taylor 
> Reviewed-by: William Towle 
> ---
>  drivers/media/platform/soc_camera/soc_camera.c |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
> b/drivers/media/platform/soc_camera/soc_camera.c
> index 4e59833..675cfc4 100644
> --- a/drivers/media/platform/soc_camera/soc_camera.c
> +++ b/drivers/media/platform/soc_camera/soc_camera.c
> @@ -954,6 +954,7 @@ static int soc_camera_querycap(struct file *file, void  
> *priv,
>   WARN_ON(priv != file->private_data);
>  
>   strlcpy(cap->driver, ici->drv_name, sizeof(cap->driver));
> + strlcpy(cap->bus_info, "platform:soc_camera", sizeof(cap->bus_info));

Sorry, but this is the wrong place. This should be done in rcar_vin_querycap.

If you have multiple soc_camera instances, then the bus_info should be unique
for each. And that's obviously not the case if it's done here.

The rcar driver will know, however.

Regards,

Hans

>   return ici->ops->querycap(ici, cap);
>  }
>  
> 

--
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 15/15] media: rcar_vin: Reject videobufs that are too small for current format

2015-06-12 Thread Hans Verkuil
On 06/03/2015 04:00 PM, William Towle wrote:
> From: Rob Taylor 
> 
> In videobuf_setup reject buffers that are too small for the configured
> format. Fixes v4l2-complience issue.
> 
> Signed-off-by: Rob Taylor 
> Reviewed-by: William Towle 

Acked-by: Hans Verkuil 

Thanks,

Hans

> ---
>  drivers/media/platform/soc_camera/rcar_vin.c |3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
> b/drivers/media/platform/soc_camera/rcar_vin.c
> index cc993bc..1531a76 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
> @@ -541,6 +541,9 @@ static int rcar_vin_videobuf_setup(struct vb2_queue *vq,
>   unsigned int bytes_per_line;
>   int ret;
>  
> + if (fmt->fmt.pix.sizeimage < icd->sizeimage)
> + return -EINVAL;
> +
>   xlate = soc_camera_xlate_by_fourcc(icd,
>  fmt->fmt.pix.pixelformat);
>   if (!xlate)
> 

--
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/9] [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()

2015-06-12 Thread Tomi Valkeinen


On 11/06/15 07:21, Laurent Pinchart wrote:
> Hello,
> 
> (CC'ing Tomi Valkeinen)
> 
> On Wednesday 10 June 2015 06:20:45 Mauro Carvalho Chehab wrote:
>> From: Jan Kara 
>>
>> Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns() instead of
>> hand made mapping of virtual address to physical address. Also the
>> function leaked page reference from get_user_pages() so fix that by
>> properly release the reference when omap_vout_buffer_release() is
>> called.
>>
>> Signed-off-by: Jan Kara 
>> Signed-off-by: Hans Verkuil 
>> [hans.verk...@cisco.com: remove unused struct omap_vout_device *vout
>> variable]
>>
>> Signed-off-by: Mauro Carvalho Chehab 
>>
>> diff --git a/drivers/media/platform/omap/omap_vout.c
>> b/drivers/media/platform/omap/omap_vout.c index f09c5f17a42f..7feb6394f111
>> 100644
>> --- a/drivers/media/platform/omap/omap_vout.c
>> +++ b/drivers/media/platform/omap/omap_vout.c
>> @@ -195,46 +195,34 @@ static int omap_vout_try_format(struct v4l2_pix_format
>> *pix) }
>>
>>  /*
>> - * omap_vout_uservirt_to_phys: This inline function is used to convert user
>> - * space virtual address to physical address.
>> + * omap_vout_get_userptr: Convert user space virtual address to physical
>> + * address.
>>   */
>> -static unsigned long omap_vout_uservirt_to_phys(unsigned long virtp)
>> +static int omap_vout_get_userptr(struct videobuf_buffer *vb, u32 virtp,
>> + u32 *physp)
>>  {
>> -unsigned long physp = 0;
>> -struct vm_area_struct *vma;
>> -struct mm_struct *mm = current->mm;
>> +struct frame_vector *vec;
>> +int ret;
>>
>>  /* For kernel direct-mapped memory, take the easy way */
>> -if (virtp >= PAGE_OFFSET)
>> -return virt_to_phys((void *) virtp);
>> -
>> -down_read(¤t->mm->mmap_sem);
>> -vma = find_vma(mm, virtp);
>> -if (vma && (vma->vm_flags & VM_IO) && vma->vm_pgoff) {
>> -/* this will catch, kernel-allocated, mmaped-to-usermode
>> -   addresses */
>> -physp = (vma->vm_pgoff << PAGE_SHIFT) + (virtp - vma->vm_start);
>> -up_read(¤t->mm->mmap_sem);
>> -} else {
>> -/* otherwise, use get_user_pages() for general userland pages */
>> -int res, nr_pages = 1;
>> -struct page *pages;
>> +if (virtp >= PAGE_OFFSET) {
>> +*physp = virt_to_phys((void *)virtp);
> 
> Lovely. virtp comes from userspace and as far as I know it arrives here 
> completely unchecked. The problem isn't introduced by this patch, but 
> omap_vout buffer management seems completely broken to me, and nobody seems 
> to 
> care about the driver. Given that omapdrm should now provide the video output 
> capabilities that are missing from omapfb and resulted in the development of 
> omap_vout, shouldn't we drop the omap_vout driver ?
> 
> Tomi, any opinion on this ? Do you see any omap_vout capability missing from 
> omapdrm ?

I've never used omap_vout, so I don't even know what it offers. I do
know it supports VRFB rotation (omap3), which we don't have on omapdrm,
though. Whether anyone uses that (or omap_vout), I have no idea...

I'd personally love to get rid of omap_vout, as it causes complications
on omapfb/omapdss side.

 Tomi



signature.asc
Description: OpenPGP digital signature


Re: [PATCH 11/15] media: soc_camera: soc_scale_crop: Use correct pad number in try_fmt

2015-06-12 Thread Hans Verkuil
On 06/03/2015 03:59 PM, William Towle wrote:
> From: Rob Taylor 
> 
> Fix calls to subdev try_fmt to use correct pad. Fixes failures with
> subdevs that care about having the right pad number set.
> 
> Signed-off-by: William Towle 
> Reviewed-by: Rob Taylor 
> ---
>  drivers/media/platform/soc_camera/soc_scale_crop.c |   10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c 
> b/drivers/media/platform/soc_camera/soc_scale_crop.c
> index bda29bc..90e2769 100644
> --- a/drivers/media/platform/soc_camera/soc_scale_crop.c
> +++ b/drivers/media/platform/soc_camera/soc_scale_crop.c
> @@ -225,6 +225,10 @@ static int client_set_fmt(struct soc_camera_device *icd,
>   bool host_1to1;
>   int ret;
>  
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> + format->pad = icd->src_pad_idx;
> +#endif

As mentioned in the review of patch 9 it should be possible to drop the
#if defined() here.

> +
>   ret = v4l2_device_call_until_err(sd->v4l2_dev,
>soc_camera_grp_id(icd), pad,
>set_fmt, NULL, format);
> @@ -261,10 +265,16 @@ static int client_set_fmt(struct soc_camera_device *icd,
>   /* width <= max_width && height <= max_height - guaranteed by try_fmt */
>   while ((width > tmp_w || height > tmp_h) &&
>  tmp_w < max_width && tmp_h < max_height) {
> +

Spurious whitespace change.

>   tmp_w = min(2 * tmp_w, max_width);
>   tmp_h = min(2 * tmp_h, max_height);
>   mf->width = tmp_w;
>   mf->height = tmp_h;
> +
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> + format->pad = icd->src_pad_idx;
> +#endif

Same as the first comment.

> +
>   ret = v4l2_device_call_until_err(sd->v4l2_dev,
>   soc_camera_grp_id(icd), pad,
>   set_fmt, NULL, format);
> 

Regards,

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


Re: [PATCH 10/15] media: rcar_vin: Use correct pad number in try_fmt

2015-06-12 Thread Hans Verkuil
On 06/03/2015 03:59 PM, William Towle wrote:
> Fix rcar_vin_try_fmt to use the correct pad number when calling the
> subdev set_fmt. Previously pad number 0 was always used, resulting in
> EINVAL if the subdev cares about the pad number (e.g. ADV7612).
> 
> Signed-off-by: William Towle 
> Reviewed-by: Rob Taylor 
> ---
>  drivers/media/platform/soc_camera/rcar_vin.c |   20 +++-
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
> b/drivers/media/platform/soc_camera/rcar_vin.c
> index 00c1034..cc993bc 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
> @@ -1697,7 +1697,7 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
> *icd,
>   const struct soc_camera_format_xlate *xlate;
>   struct v4l2_pix_format *pix = &f->fmt.pix;
>   struct v4l2_subdev *sd = soc_camera_to_subdev(icd);
> - struct v4l2_subdev_pad_config pad_cfg;
> + struct v4l2_subdev_pad_config *pad_cfg;
>   struct v4l2_subdev_format format = {
>   .which = V4L2_SUBDEV_FORMAT_TRY,
>   };
> @@ -1706,6 +1706,8 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
> *icd,
>   int width, height;
>   int ret;
>  
> + pad_cfg = v4l2_subdev_alloc_pad_config(sd);
> +
>   xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
>   if (!xlate) {
>   xlate = icd->current_fmt;
> @@ -1734,10 +1736,15 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
> *icd,
>   mf->code = xlate->code;
>   mf->colorspace = pix->colorspace;
>  
> - ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd),
> -  pad, set_fmt, &pad_cfg, &format);
> - if (ret < 0)
> + format.pad = icd->src_pad_idx;
> + ret = v4l2_device_call_until_err(sd->v4l2_dev,
> + soc_camera_grp_id(icd), pad,
> + set_fmt, pad_cfg,
> + &format);
> + if (ret < 0) {
> + v4l2_subdev_free_pad_config(pad_cfg);
>   return ret;

I would use a goto to the end of the function here.

> + }
>  
>   /* Adjust only if VIN cannot scale */
>   if (pix->width > mf->width * 2)
> @@ -1759,13 +1766,15 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
> *icd,
>*/
>   mf->width = VIN_MAX_WIDTH;
>   mf->height = VIN_MAX_HEIGHT;
> + format.pad = icd->src_pad_idx;
>   ret = v4l2_device_call_until_err(sd->v4l2_dev,
>soc_camera_grp_id(icd),
> -  pad, set_fmt, &pad_cfg,
> +  pad, set_fmt, pad_cfg,
>&format);
>   if (ret < 0) {
>   dev_err(icd->parent,
>   "client try_fmt() = %d\n", ret);
> + v4l2_subdev_free_pad_config(pad_cfg);
>   return ret;

Ditto.

>   }
>   }
> @@ -1776,6 +1785,7 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
> *icd,
>   pix->height = height;
>   }
>  

With the error label here.

> + v4l2_subdev_free_pad_config(pad_cfg);
>   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 09/15] media: soc_camera pad-aware driver initialisation

2015-06-12 Thread Hans Verkuil
On 06/03/2015 03:59 PM, William Towle wrote:
> Add detection of source pad number for drivers aware of the media
> controller API, so that the combination of soc_camera and rcar_vin
> can create device nodes to support modern drivers such as adv7604.c
> (for HDMI on Lager) and the converted adv7180.c (for composite)
> underneath.
> 
> Building rcar_vin gains a dependency on CONFIG_MEDIA_CONTROLLER, in
> line with requirements for building the drivers associated with it.
> 
> Signed-off-by: William Towle 
> Signed-off-by: Rob Taylor 
> ---
>  drivers/media/platform/soc_camera/Kconfig  |1 +
>  drivers/media/platform/soc_camera/rcar_vin.c   |1 +
>  drivers/media/platform/soc_camera/soc_camera.c |   46 
> 
>  include/media/soc_camera.h |1 +
>  4 files changed, 49 insertions(+)
> 
> diff --git a/drivers/media/platform/soc_camera/Kconfig 
> b/drivers/media/platform/soc_camera/Kconfig
> index f2776cd..5c45c83 100644
> --- a/drivers/media/platform/soc_camera/Kconfig
> +++ b/drivers/media/platform/soc_camera/Kconfig
> @@ -38,6 +38,7 @@ config VIDEO_RCAR_VIN
>   depends on VIDEO_DEV && SOC_CAMERA
>   depends on ARCH_SHMOBILE || COMPILE_TEST
>   depends on HAS_DMA
> + depends on MEDIA_CONTROLLER
>   select VIDEOBUF2_DMA_CONTIG
>   select SOC_CAMERA_SCALE_CROP
>   ---help---
> diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
> b/drivers/media/platform/soc_camera/rcar_vin.c
> index 16352a8..00c1034 100644
> --- a/drivers/media/platform/soc_camera/rcar_vin.c
> +++ b/drivers/media/platform/soc_camera/rcar_vin.c
> @@ -1359,6 +1359,7 @@ static int rcar_vin_get_formats(struct 
> soc_camera_device *icd, unsigned int idx,
>   struct device *dev = icd->parent;
>   int shift;
>  
> + fmt.pad = icd->src_pad_idx;
>   ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt);
>   if (ret < 0)
>   return ret;
> diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
> b/drivers/media/platform/soc_camera/soc_camera.c
> index d708df4..c4952c8 100644
> --- a/drivers/media/platform/soc_camera/soc_camera.c
> +++ b/drivers/media/platform/soc_camera/soc_camera.c
> @@ -1293,6 +1293,9 @@ static int soc_camera_probe_finish(struct 
> soc_camera_device *icd)
>   .which = V4L2_SUBDEV_FORMAT_ACTIVE,
>   };
>   struct v4l2_mbus_framefmt *mf = &fmt.format;
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> + struct media_pad pad;
> +#endif
>   int ret;
>  
>   sd->grp_id = soc_camera_grp_id(icd);
> @@ -1310,8 +1313,40 @@ static int soc_camera_probe_finish(struct 
> soc_camera_device *icd)
>   return ret;
>   }
>  
> + icd->src_pad_idx = -1;

If CONFIG_MEDIA_CONTROLLER is not defined, then I would expect that src_pad_idx 
should
be 0, not -1.

> +#if defined(CONFIG_MEDIA_CONTROLLER)
>   /* At this point client .probe() should have run already */
> + ret = media_entity_init(&icd->vdev->entity, 1, &pad, 0);
> + if (ret < 0) {
> + goto eusrfmt;
> + } else {
> + int pad_idx;
> +
> + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> + if (sd->entity.pads[pad_idx].flags
> + == MEDIA_PAD_FL_SOURCE)
> + break;
> + if (pad_idx >= sd->entity.num_pads)
> + goto eusrfmt;
> +
> + ret = media_entity_create_link(&icd->vdev->entity, 0,
> + &sd->entity, pad_idx,
> + MEDIA_LNK_FL_IMMUTABLE |
> + MEDIA_LNK_FL_ENABLED);

Why would you want to create a link and set up the vdev entity?

All you need to do here is to find the sd source pad and store it in
sd->src_pad_idx.

You are not registering a media device here, so there is no need to
do anything more. I'd drop all that code.

> + if (ret < 0)
> + goto eusrfmt;
> +
> + icd->src_pad_idx = pad_idx;
> + ret = soc_camera_init_user_formats(icd);
> + if (ret < 0) {
> + icd->src_pad_idx = -1;
> + goto eusrfmt;
> + }
> + }
> +#else
>   ret = soc_camera_init_user_formats(icd);
> +#endif
> +
>   if (ret < 0)
>   goto eusrfmt;
>  
> @@ -1322,6 +1357,9 @@ static int soc_camera_probe_finish(struct 
> soc_camera_device *icd)
>   goto evidstart;
>  
>   /* Try to improve our guess of a reasonable window format */
> +#if defined(CONFIG_MEDIA_CONTROLLER)
> + fmt.pad = icd->src_pad_idx;
> +#endif

If src_pad_idx is 0 if CONFIG_MEDIA_CONTROLLER is undefined, then you don't 
need the
#if defined() here.

Regards,

Hans

>   if (!v4l2_subdev_call(sd, pad, get_fmt, NULL, &fmt)) {
>   icd->user_width = mf->width

Re: [PATCH] media/v4l2-ctrls: Code cleanout validate_new()

2015-06-12 Thread Hans Verkuil
On 06/10/2015 03:38 PM, Ricardo Ribalda Delgado wrote:
> We can simplify the code removing the if().
> 
> v4l2_ctr_new sets ctrls->elems to 1 when !ctrl->is_ptr.
> 
> Signed-off-by: Ricardo Ribalda Delgado 

Acked-by: Hans Verkuil 

Thanks!

Hans

> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c | 15 ---
>  1 file changed, 15 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
> b/drivers/media/v4l2-core/v4l2-ctrls.c
> index e3a3468002e6..b6b7dcc1b77d 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1678,21 +1678,6 @@ static int validate_new(const struct v4l2_ctrl *ctrl, 
> union v4l2_ctrl_ptr p_new)
>   unsigned idx;
>   int err = 0;
>  
> - if (!ctrl->is_ptr) {
> - switch (ctrl->type) {
> - case V4L2_CTRL_TYPE_INTEGER:
> - case V4L2_CTRL_TYPE_INTEGER_MENU:
> - case V4L2_CTRL_TYPE_MENU:
> - case V4L2_CTRL_TYPE_BITMASK:
> - case V4L2_CTRL_TYPE_BOOLEAN:
> - case V4L2_CTRL_TYPE_BUTTON:
> - case V4L2_CTRL_TYPE_CTRL_CLASS:
> - case V4L2_CTRL_TYPE_INTEGER64:
> - return ctrl->type_ops->validate(ctrl, 0, p_new);
> - default:
> - break;
> - }
> - }
>   for (idx = 0; !err && idx < ctrl->elems; idx++)
>   err = ctrl->type_ops->validate(ctrl, idx, p_new);
>   return err;
> 

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


Re: [RFC] media: New ioct VIDIOC_INITIAL_EXT_CTRLS

2015-06-12 Thread Hans Verkuil
Hi Ricardo!

On 06/10/2015 01:17 PM, Ricardo Ribalda Delgado wrote:
> Integer controls provide a way to get their default/initial value, but
> any other control (p_u32, p_u8.) provide no other way to get the
> initial value than unloading the module and loading it back.
> 
> *What is the actual problem?
> I have a custom control with WIDTH integer values. Every value
> represents the calibrated FPN (fixed pattern noise) correction value for that 
> column
> -Application A changes the FPN correction value
> -Application B wants to restore the calibrated value but it cant :(
> 
> *What is the proposed solution?
> -Add a new ioctl VIDIOC_INITIAL_EXT_CTRLS, with the same API as
> G_EXT_CTRLS, but that returns the initial value of a given control
> 
> *This code is not splited in different patches and there is no doc!
> Yes, at this point I want your feedback about the ioctl, and an initial
> piece of code could help the disscussion. Of course, once we agreed I
> will provide the documentation and a properly build patchset.
> 
> So, shoot me: What do you think?

Thanks for this RFC. I do have a few suggestions to improve this, but I agree
with the basic design.

> 
> THANKS!
> 
> Signed-off-by: Ricardo Ribalda Delgado 
> ---
>  drivers/media/v4l2-core/v4l2-compat-ioctl32.c |  4 ++
>  drivers/media/v4l2-core/v4l2-ctrls.c  | 65 
> ---
>  drivers/media/v4l2-core/v4l2-ioctl.c  | 20 +
>  drivers/media/v4l2-core/v4l2-subdev.c |  3 ++
>  include/media/v4l2-ctrls.h|  2 +
>  include/media/v4l2-ioctl.h|  2 +
>  include/uapi/linux/videodev2.h|  4 +-
>  7 files changed, 92 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
> b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
> index af635430524e..1e3272e28b2d 100644
> --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
> +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
> @@ -817,6 +817,7 @@ static int put_v4l2_edid32(struct v4l2_edid *kp, struct 
> v4l2_edid32 __user *up)
>  #define  VIDIOC_DQEVENT32_IOR ('V', 89, struct v4l2_event32)
>  #define VIDIOC_CREATE_BUFS32 _IOWR('V', 92, struct v4l2_create_buffers32)
>  #define VIDIOC_PREPARE_BUF32 _IOWR('V', 93, struct v4l2_buffer32)
> +#define VIDIOC_INITIAL_EXT_CTRLS32_IOWR('V', 104, struct 
> v4l2_ext_controls32)
>  
>  #define VIDIOC_OVERLAY32 _IOW ('V', 14, s32)
>  #define VIDIOC_STREAMON32_IOW ('V', 18, s32)
> @@ -859,6 +860,7 @@ static long do_video_ioctl(struct file *file, unsigned 
> int cmd, unsigned long ar
>   case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break;
>   case VIDIOC_G_EXT_CTRLS32: cmd = VIDIOC_G_EXT_CTRLS; break;
>   case VIDIOC_S_EXT_CTRLS32: cmd = VIDIOC_S_EXT_CTRLS; break;
> + case VIDIOC_INITIAL_EXT_CTRLS32: cmd = VIDIOC_INITIAL_EXT_CTRLS; break;
>   case VIDIOC_TRY_EXT_CTRLS32: cmd = VIDIOC_TRY_EXT_CTRLS; break;
>   case VIDIOC_DQEVENT32: cmd = VIDIOC_DQEVENT; break;
>   case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break;
> @@ -937,6 +939,7 @@ static long do_video_ioctl(struct file *file, unsigned 
> int cmd, unsigned long ar
>   case VIDIOC_G_EXT_CTRLS:
>   case VIDIOC_S_EXT_CTRLS:
>   case VIDIOC_TRY_EXT_CTRLS:
> + case VIDIOC_INITIAL_EXT_CTRLS:
>   err = get_v4l2_ext_controls32(&karg.v2ecs, up);
>   compatible_arg = 0;
>   break;
> @@ -964,6 +967,7 @@ static long do_video_ioctl(struct file *file, unsigned 
> int cmd, unsigned long ar
>   case VIDIOC_G_EXT_CTRLS:
>   case VIDIOC_S_EXT_CTRLS:
>   case VIDIOC_TRY_EXT_CTRLS:
> + case VIDIOC_INITIAL_EXT_CTRLS:

I'd call it VIDIOC_G_DEF_EXT_CTRLS. Since the default value is called 
default_value in QUERYCTRL,
I think it is more consistent to refer to the default value rather than the 
initial value.
And _G_ shows that you get this value.

>   if (put_v4l2_ext_controls32(&karg.v2ecs, up))
>   err = -EFAULT;
>   break;
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
> b/drivers/media/v4l2-core/v4l2-ctrls.c
> index b462165a7f0c..465f73acc644 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1449,6 +1449,40 @@ static const struct v4l2_ctrl_type_ops std_type_ops = {
>   .validate = std_validate,
>  };
>  
> +/* Helper function: copy the initial value back to the caller */
> +static int init_to_user(struct v4l2_ext_control *c, struct v4l2_ctrl *ctrl)
> +{
> + int idx;
> + int ret;
> + long size;
> + union v4l2_ctrl_ptr ptr;
> +
> + if (!ctrl->is_ptr){

Space before {

> + ptr.p = &c->value;
> + ctrl->type_ops->init(ctrl, 0, ptr);
> + return 0;
> + }
> +
> + size = ctrl->elem_size * ctrl->elems;
> + if (c->size < size){

Ditto

> + c->size = size;
> + return -ENOSPC;
> + }
> +
> + ptr

Re: [Xen-devel] RIP MTRR - status update for upcoming v4.2

2015-06-12 Thread Jan Beulich
>>> On 12.06.15 at 01:23,  wrote:
> There are two usages on MTRRs:
>  1) MTRR entries set by firmware
>  2) MTRR entries set by OS drivers
> 
> We can obsolete 2), but we have no control over 1).  As UEFI firmwares
> also set this up, this usage will continue to stay.  So, we should not
> get rid of the MTRR code that looks up the MTRR entries, while we have
> no need to modify them.
> 
> Such MTRR entries provide safe guard to /dev/mem, which allows
> privileged user to access a range that may require UC mapping while
> the /dev/mem driver blindly maps it with WB.  MTRRs converts WB to UC in
> such a case.

But it wouldn't be impossible to simply read the MTRRs upon boot,
store the information, disable MTRRs, and correctly use PAT to
achieve the same effect (i.e. the "blindly maps" part of course
would need fixing).

> UEFI memory table has memory attribute, which describes cache types
> supported in physical memory ranges.  However, this information gets
> lost when it it is converted to e820 table.

I'm afraid you rather don't want to trust that information, as
firmware vendors frequently screw it up.

Jan

--
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 FOR v4.2] Various fixes

2015-06-12 Thread Hans Verkuil
The following changes since commit e42c8c6eb456f8978de417ea349eef676ef4385c:

  [media] au0828: move dev->boards atribuition to happen earlier (2015-06-10 
12:39:35 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.2n

for you to fetch changes up to 5361c68bdc76a5cf8beaaa19d7b18000bd4bbc34:

  v4l2-dv-timings: log if the timing is reduced blanking V2 (2015-06-12 
09:39:40 +0200)


Fabian Frederick (5):
  v4l2-dv-timings: use swap() in v4l2_calc_aspect_ratio()
  wl128x: use swap() in fm_rdsparse_swapbytes()
  saa7146: use swap() in sort_and_eliminate()
  saa6588: use swap() in saa6588_i2c_poll()
  btcx-risc: use swap() in btcx_sort_clips()

Hans Verkuil (4):
  stk1160: fix sequence handling
  rc/Kconfig: fix indentation problem
  mantis: fix unused variable compiler warning
  v4l2-dv-timings: log if the timing is reduced blanking V2

Jan Roemisch (1):
  radio-bcm2048: Fix region selection

Krzysztof Hałasa (4):
  SOLO6x10: Fix G.723 minimum audio period count.
  SOLO6x10: unmap registers only after free_irq().
  SOLO6x10: remove unneeded register locking and barriers.
  SOLO6x10: Remove dead code.

Prashant Laddha (1):
  v4l2-dv-timings: add support for reduced blanking v2

 drivers/media/common/saa7146/saa7146_hlp.c|  9 +++-
 drivers/media/i2c/adv7604.c   |  2 +-
 drivers/media/i2c/adv7842.c   |  2 +-
 drivers/media/i2c/saa6588.c   |  4 +---
 drivers/media/pci/bt8xx/btcx-risc.c   |  5 +
 drivers/media/pci/mantis/mantis_i2c.c |  3 +--
 drivers/media/pci/solo6x10/solo6x10-core.c| 18 ++--
 drivers/media/pci/solo6x10/solo6x10-g723.c| 13 ++--
 drivers/media/pci/solo6x10/solo6x10.h | 26 +--
 drivers/media/platform/vivid/vivid-vid-cap.c  |  2 +-
 drivers/media/radio/wl128x/fmdrv_common.c |  5 +
 drivers/media/rc/Kconfig  | 26 +++
 drivers/media/usb/stk1160/stk1160-v4l.c   |  2 ++
 drivers/media/usb/stk1160/stk1160-video.c |  4 +---
 drivers/media/usb/stk1160/stk1160.h   |  3 +--
 drivers/media/v4l2-core/v4l2-dv-timings.c | 89 
---
 drivers/staging/media/bcm2048/radio-bcm2048.c | 20 ++
 include/media/v4l2-dv-timings.h   |  6 +-
 18 files changed, 116 insertions(+), 123 deletions(-)
--
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


  1   2   >