Re: [PATCH v2 2/2] x86/mm/pat, drivers/media/ivtv: move pat warn and replace WARN() with pr_warn()

2015-06-25 Thread Ingo Molnar

* Luis R. Rodriguez mcg...@do-not-panic.com wrote:

 From: Luis R. Rodriguez mcg...@suse.com
 
 On built-in kernels this warning will always splat as this is part
 of the module init. Fix that by shifting the PAT requirement check
 out under the code that does the quasi-probe for the device. This
 device driver relies on an existing driver to find its own devices,
 it looks for that device driver and its own found devices, then
 uses driver_for_each_device() to try to see if it can probe each of
 those devices as a frambuffer device with ivtvfb_init_card(). We
 tuck the PAT requiremenet check then on the ivtvfb_init_card()
 call making the check at least require an ivtv device present
 before complaining.
 
 Reported-by: Fengguang Wu fengguang...@intel.com [0-day test robot]
 Signed-off-by: Luis R. Rodriguez mcg...@suse.com
 ---
  drivers/media/pci/ivtv/ivtvfb.c | 15 +--
  1 file changed, 9 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c
 index 4cb365d..8b95eef 100644
 --- a/drivers/media/pci/ivtv/ivtvfb.c
 +++ b/drivers/media/pci/ivtv/ivtvfb.c
 @@ -38,6 +38,8 @@
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
 +#define pr_fmt(fmt) KBUILD_MODNAME :  fmt
 +
  #include linux/module.h
  #include linux/kernel.h
  #include linux/fb.h
 @@ -1171,6 +1173,13 @@ static int ivtvfb_init_card(struct ivtv *itv)
  {
   int rc;
  
 +#ifdef CONFIG_X86_64
 + if (pat_enabled()) {
 + pr_warn(ivtvfb needs PAT disabled, boot with nopat kernel 
 parameter\n);
 + return -ENODEV;
 + }
 +#endif
 +
   if (itv-osd_info) {
   IVTVFB_ERR(Card %d already initialised\n, ivtvfb_card_id);
   return -EBUSY;

Same argument as for ipath: why not make arch_phys_wc_add() fail on PAT and 
return 
-1, and check it in arch_phys_wc_del()?

That way we don't do anything drastic, the remaining few drivers still keep 
working (albeit suboptimally - can be worked around with the 'nopat' boot 
option) 
- yet we've reduced the use of MTRRs drastically.

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: [PATCH v2 1/2] x86/mm/pat, drivers/infiniband/ipath: replace WARN() with pr_warn()

2015-06-25 Thread Ingo Molnar

* Luis R. Rodriguez mcg...@do-not-panic.com wrote:

 From: Luis R. Rodriguez mcg...@suse.com
 
 WARN() may confuse users, fix that. ipath_init_one() is part the
 device's probe so this would only be triggered if a corresponding
 device was found.
 
 Signed-off-by: Luis R. Rodriguez mcg...@suse.com
 ---
  drivers/infiniband/hw/ipath/ipath_driver.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c 
 b/drivers/infiniband/hw/ipath/ipath_driver.c
 index 2d7e503..871dbe5 100644
 --- a/drivers/infiniband/hw/ipath/ipath_driver.c
 +++ b/drivers/infiniband/hw/ipath/ipath_driver.c
 @@ -31,6 +31,8 @@
   * SOFTWARE.
   */
  
 +#define pr_fmt(fmt) KBUILD_MODNAME :  fmt
 +
  #include linux/sched.h
  #include linux/spinlock.h
  #include linux/idr.h
 @@ -399,8 +401,8 @@ static int ipath_init_one(struct pci_dev *pdev, const 
 struct pci_device_id *ent)
   u32 bar0 = 0, bar1 = 0;
  
  #ifdef CONFIG_X86_64
 - if (WARN(pat_enabled(),
 -  ipath needs PAT disabled, boot with nopat kernel 
 parameter\n)) {
 + if (pat_enabled()) {
 + pr_warn(ipath needs PAT disabled, boot with nopat kernel 
 parameter\n);
   ret = -ENODEV;
   goto bail;
   }

So driver init will always fail with this on modern kernels.

Btw., on a second thought, ipath uses MTRRs to enable WC:

ret = ipath_enable_wc(dd);
if (ret)
ret = 0;

Note how it ignores any failures - the driver still works even if WC was not 
enabled.

So why don't you simply extend ipath_enable_wc() to generate the warning 
message 
and return -EINVAL - which still keeps the driver working on modern kernels?

Just inform the user about 'nopat' if he wants WC for this driver.

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


[PATCH] [media] pctv452e: Replace memset with eth_zero_addr

2015-06-25 Thread Vaishali Thakkar
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// smpl
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// /smpl

Signed-off-by: Vaishali Thakkar vthakkar1...@gmail.com
---
 drivers/media/usb/dvb-usb/pctv452e.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/pctv452e.c 
b/drivers/media/usb/dvb-usb/pctv452e.c
index d17618f..ec397c4 100644
--- a/drivers/media/usb/dvb-usb/pctv452e.c
+++ b/drivers/media/usb/dvb-usb/pctv452e.c
@@ -611,7 +611,7 @@ static int pctv452e_read_mac_address(struct dvb_usb_device 
*d, u8 mac[6])
return 0;
 
 failed:
-   memset(mac, 0, 6);
+   eth_zero_addr(mac);
 
return ret;
 }
-- 
1.9.1

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


[PATCH] [media] ttpci: Replace memset with eth_zero_addr

2015-06-25 Thread Vaishali Thakkar
Use eth_zero_addr to assign the zero address to the given address
array instead of memset when second argument is address of zero.
Note that the 6 in the third argument of memset appears to represent
an ethernet address size (ETH_ALEN).

The Coccinelle semantic patch that makes this change is as follows:

// smpl
@eth_zero_addr@
expression e;
@@

-memset(e,0x00,6);
+eth_zero_addr(e);
// /smpl

Signed-off-by: Vaishali Thakkar vthakkar1...@gmail.com
---
 drivers/media/pci/ttpci/budget-av.c| 2 +-
 drivers/media/pci/ttpci/ttpci-eeprom.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/pci/ttpci/budget-av.c 
b/drivers/media/pci/ttpci/budget-av.c
index 54c9910..3e469d4 100644
--- a/drivers/media/pci/ttpci/budget-av.c
+++ b/drivers/media/pci/ttpci/budget-av.c
@@ -1508,7 +1508,7 @@ static int budget_av_attach(struct saa7146_dev *dev, 
struct saa7146_pci_extensio
if (i2c_readregs(budget_av-budget.i2c_adap, 0xa0, 0x30, mac, 6)) {
pr_err(KNC1-%d: Could not read MAC from KNC1 card\n,
   budget_av-budget.dvb_adapter.num);
-   memset(mac, 0, 6);
+   eth_zero_addr(mac);
} else {
pr_info(KNC1-%d: MAC addr = %pM\n,
budget_av-budget.dvb_adapter.num, mac);
diff --git a/drivers/media/pci/ttpci/ttpci-eeprom.c 
b/drivers/media/pci/ttpci/ttpci-eeprom.c
index 32d4315..01e13c4 100644
--- a/drivers/media/pci/ttpci/ttpci-eeprom.c
+++ b/drivers/media/pci/ttpci/ttpci-eeprom.c
@@ -36,6 +36,7 @@
 #include linux/module.h
 #include linux/string.h
 #include linux/i2c.h
+#include linux/etherdevice.h
 
 #include ttpci-eeprom.h
 
@@ -145,7 +146,7 @@ int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 
*proposed_mac)
 
if (ret != 0) { /* Will only be -ENODEV */
dprintk(Couldn't read from EEPROM: not there?\n);
-   memset(proposed_mac, 0, 6);
+   eth_zero_addr(proposed_mac);
return ret;
}
 
@@ -157,7 +158,7 @@ int ttpci_eeprom_parse_mac(struct i2c_adapter *adapter, u8 
*proposed_mac)
dprintk( %.2x:, encodedMAC[i]);
}
dprintk(%.2x\n, encodedMAC[19]);
-   memset(proposed_mac, 0, 6);
+   eth_zero_addr(proposed_mac);
return ret;
}
 
-- 
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 4/5] [media] adv7604: Deliver resolution change events to userspace

2015-06-25 Thread Lars-Peter Clausen

On 06/25/2015 12:21 PM, Sakari Ailus wrote:

Hi Lars-Peter,

On Wed, Jun 24, 2015 at 06:50:30PM +0200, Lars-Peter Clausen wrote:

Use the new v4l2_subdev_notify_event() helper function to deliver the
resolution change event to userspace via the v4l2 subdev event queue as
well as to the bridge driver using the callback notify mechanism.

This allows userspace applications to react to changes in resolution. This
is useful and often necessary for video pipelines where there is no direct
1-to-1 relationship between the subdevice converter and the video capture
device and hence it does not make sense to directly forward the event to
the video capture device node.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
  drivers/media/i2c/adv7604.c | 23 ++-
  1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cf1cb5a..b66f63e3 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1761,8 +1761,8 @@ static int adv76xx_s_routing(struct v4l2_subdev *sd,
select_input(sd);
enable_input(sd);

-   v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
-  (void *)adv76xx_ev_fmt);
+   v4l2_subdev_notify_event(sd, adv76xx_ev_fmt);
+
return 0;
  }

@@ -1929,8 +1929,7 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
%s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n,
__func__, fmt_change, fmt_change_digital);

-   v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
-  (void *)adv76xx_ev_fmt);
+   v4l2_subdev_notify_event(sd, adv76xx_ev_fmt);

if (handled)
*handled = true;
@@ -2348,6 +2347,20 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)
return 0;
  }

+static int adv76xx_subscribe_event(struct v4l2_subdev *sd,
+  struct v4l2_fh *fh,
+  struct v4l2_event_subscription *sub)
+{
+   switch (sub-type) {
+   case V4L2_EVENT_SOURCE_CHANGE:
+   return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
+   case V4L2_EVENT_CTRL:
+   return v4l2_event_subdev_unsubscribe(sd, fh, sub);


This should be ..._subscribe(), shouldn't it?


Right, not sure how that happened.



You could simply use v4l2_event_subscribe(fh, sub),
v4l2_event_subdev_unsubscribe() is there so you can use it directly as the
subscribe_event() op.


It's just to be on the safe side in case v4l2_event_subdev_subscribe() 
starts to do something in addition to just being a wrapper around 
v4l2_event_subscribe().


Thanks,
- Lars
--
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/2] [media] videobuf2: add trace events

2015-06-25 Thread Steven Rostedt
On Thu, 25 Jun 2015 12:01:27 +0200
Philipp Zabel p.za...@pengutronix.de wrote:

 diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
 index 89d0497..3d15cf1 100644
 --- a/include/trace/events/v4l2.h
 +++ b/include/trace/events/v4l2.h
 @@ -175,9 +175,108 @@ SHOW_FIELD
   )   \
   )
  
 +#define VB2_TRACE_EVENT(event_name)  \

This is what we have DECLARE_EVENT_CLASS for. Please use that,
otherwise you are adding about 5k of text per event (where as
DEFINE_EVENT adds only about 250 bytes).

DECLARE_EVENT_CLASS(vb2_event_class,
[..]


 + TRACE_EVENT(event_name, \
 + TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),   \
 + \
 + TP_ARGS(q, vb), \
 + \
 + TP_STRUCT__entry(   \
 + __field(int, minor) \
 + __field(u32, queued_count)  \
 + __field(int, owned_by_drv_count)\
 + __field(u32, index) \
 + __field(u32, type)  \
 + __field(u32, bytesused) \
 + __field(u32, flags) \
 + __field(u32, field) \
 + __field(s64, timestamp) \
 + __field(u32, timecode_type) \
 + __field(u32, timecode_flags)\
 + __field(u8, timecode_frames)\
 + __field(u8, timecode_seconds)   \
 + __field(u8, timecode_minutes)   \
 + __field(u8, timecode_hours) \
 + __field(u8, timecode_userbits0) \
 + __field(u8, timecode_userbits1) \
 + __field(u8, timecode_userbits2) \
 + __field(u8, timecode_userbits3) \
 + __field(u32, sequence)  \
 + ),  \
 + \
 + TP_fast_assign( \
 + __entry-minor = q-owner ? \
 + q-owner-vdev-minor : -1; \
 + __entry-queued_count = q-queued_count;\
 + __entry-owned_by_drv_count =   \
 + atomic_read(q-owned_by_drv_count);\
 + __entry-index = vb-v4l2_buf.index;\
 + __entry-type = vb-v4l2_buf.type;  \
 + __entry-bytesused = vb-v4l2_buf.bytesused;\
 + __entry-flags = vb-v4l2_buf.flags;\
 + __entry-field = vb-v4l2_buf.field;\
 + __entry-timestamp =\
 + timeval_to_ns(vb-v4l2_buf.timestamp); \
 + __entry-timecode_type =\
 + vb-v4l2_buf.timecode.type; \
 + __entry-timecode_flags =   \
 + vb-v4l2_buf.timecode.flags;\
 + __entry-timecode_frames =  \
 + vb-v4l2_buf.timecode.frames;   \
 + __entry-timecode_seconds = \
 + vb-v4l2_buf.timecode.seconds;  \
 + __entry-timecode_minutes = \
 + vb-v4l2_buf.timecode.minutes;  \
 + __entry-timecode_hours =   \
 + vb-v4l2_buf.timecode.hours;\
 + __entry-timecode_userbits0 =   \
 + vb-v4l2_buf.timecode.userbits[0];  \
 + __entry-timecode_userbits1 =   \
 + vb-v4l2_buf.timecode.userbits[1];  \
 + __entry-timecode_userbits2 =   \
 + vb-v4l2_buf.timecode.userbits[2];  \
 + __entry-timecode_userbits3 =   \
 +  

Re: [PATCH 5/5] [media] adv7842: Deliver resolution change events to userspace

2015-06-25 Thread Sakari Ailus
Hi Lars-peter,

On Wed, Jun 24, 2015 at 06:50:31PM +0200, Lars-Peter Clausen wrote:
 Use the new v4l2_subdev_notify_event() helper function to deliver the
 resolution change event to userspace via the v4l2 subdev event queue as
 well as to the bridge driver using the callback notify mechanism.
 
 This allows userspace applications to react to changes in resolution. This
 is useful and often necessary for video pipelines where there is no direct
 1-to-1 relationship between the subdevice converter and the video capture
 device and hence it does not make sense to directly forward the event to
 the video capture device node.
 
 Signed-off-by: Lars-Peter Clausen l...@metafoo.de
 ---
  drivers/media/i2c/adv7842.c | 22 +-
  1 file changed, 17 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
 index ffc0655..ed51aa7 100644
 --- a/drivers/media/i2c/adv7842.c
 +++ b/drivers/media/i2c/adv7842.c
 @@ -1981,8 +1981,7 @@ static int adv7842_s_routing(struct v4l2_subdev *sd,
   select_input(sd, state-vid_std_select);
   enable_input(sd);
  
 - v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
 -(void *)adv7842_ev_fmt);
 + v4l2_subdev_notify_event(sd, adv7842_ev_fmt);
  
   return 0;
  }
 @@ -2215,8 +2214,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
 status, bool *handled)
%s: fmt_change_cp = 0x%x, fmt_change_digital = 0x%x, 
 fmt_change_sdp = 0x%x\n,
__func__, fmt_change_cp, fmt_change_digital,
fmt_change_sdp);
 - v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
 -(void *)adv7842_ev_fmt);
 + v4l2_subdev_notify_event(sd, adv7842_ev_fmt);
   if (handled)
   *handled = true;
   }
 @@ -3006,6 +3004,20 @@ static long adv7842_ioctl(struct v4l2_subdev *sd, 
 unsigned int cmd, void *arg)
   return -ENOTTY;
  }
  
 +static int adv7842_subscribe_event(struct v4l2_subdev *sd,
 +struct v4l2_fh *fh,
 +struct v4l2_event_subscription *sub)
 +{
 + switch (sub-type) {
 + case V4L2_EVENT_SOURCE_CHANGE:
 + return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
 + case V4L2_EVENT_CTRL:
 + return v4l2_event_subdev_unsubscribe(sd, fh, sub);

Correcting my comment to the previous patch --- shouldn't this be
v4l2_event_subscribe(fh, sub, ..., NULL)?

 + default:
 + return -EINVAL;
 + }
 +}
 +
  /* --- */
  
  static const struct v4l2_ctrl_ops adv7842_ctrl_ops = {
 @@ -3016,7 +3028,7 @@ static const struct v4l2_subdev_core_ops 
 adv7842_core_ops = {
   .log_status = adv7842_log_status,
   .ioctl = adv7842_ioctl,
   .interrupt_service_routine = adv7842_isr,
 - .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
 + .subscribe_event = adv7842_subscribe_event,
   .unsubscribe_event = v4l2_event_subdev_unsubscribe,
  #ifdef CONFIG_VIDEO_ADV_DEBUG
   .g_register = adv7842_g_register,

-- 
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 02/13] dmaengine: Introduce dma_request_slave_channel_compat_reason()

2015-06-25 Thread Arnd Bergmann
On Wednesday 24 June 2015 21:54:01 Vinod Koul wrote:
  It would be nice to find another name for the
  dma_request_slave_channel_compat() so with the new name we could have chance
  to rearrange the parameters: (dev, name, mask, fn, fn_param)
  
  We would end up with the following APIs, all returning with error code on 
  failure:
  dma_request_slave_channel(dev, name);
  dma_request_channel_legacy(mask, fn, fn_param);
  dma_request_slave_channel_compat(mask, fn, fn_param, dev, name);
  dma_request_any_channel(mask);
 This is good idea but still we end up with 4 APIs. Why not just converge to
 two API, one legacy + memcpy + filer fn and one untimate API for slave?
 
 Internally we may have 4 APIs for cleaner handling...
 

Not sure if it's realistic, but I think it would be nice to have
a way for converting the current slave drivers that use the
mask/filter/param API to the dev/name based API. We should
be able to do this by registering a lookup table from platform
code that translates one to the other, like we do with the
clkdev lookup to find a device clock based on a local identifier.

The main downside of this is that it's a lot of work if we want
to completely remove dma_request_channel() for slave drivers,
but it could be done more gradually.

Another upside is that we could come up with a mechanism to
avoid the link-time dependency on the filter-function that
causes problems when that filter is defined in a loadable
module for the dmaengine driver.

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


Re: [PATCH 1/2] [media] v4l2-mem2mem: set the queue owner field just as vb2_ioctl_reqbufs does

2015-06-25 Thread Sylwester Nawrocki
Hello Philipp,

On 25/06/15 12:01, Philipp Zabel wrote:
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 ---
  drivers/media/v4l2-core/v4l2-mem2mem.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
 b/drivers/media/v4l2-core/v4l2-mem2mem.c
 index dc853e5..511caaa 100644
 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
 +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
 @@ -357,9 +357,16 @@ int v4l2_m2m_reqbufs(struct file *file, struct 
 v4l2_m2m_ctx *m2m_ctx,
struct v4l2_requestbuffers *reqbufs)
  {
   struct vb2_queue *vq;
 + int ret;
  
   vq = v4l2_m2m_get_vq(m2m_ctx, reqbufs-type);
 - return vb2_reqbufs(vq, reqbufs);
 + ret = vb2_reqbufs(vq, reqbufs);
 + /* If count == 0, then the owner has released all buffers and he
 +is no longer owner of the queue. Otherwise we have a new owner. */
 + if (ret == 0)
 + vq-owner = reqbufs-count ? file-private_data : NULL;
 +
 + return ret;
  }

How about modifying v4l2_m2m_ioctl_reqbufs() instead ?

Moreover, does it really makes sense when a new m2m device context
is being created during each video device open()?

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


Re: [PATCH 4/5] [media] adv7604: Deliver resolution change events to userspace

2015-06-25 Thread Sakari Ailus
Hi Lars-Peter,

On Wed, Jun 24, 2015 at 06:50:30PM +0200, Lars-Peter Clausen wrote:
 Use the new v4l2_subdev_notify_event() helper function to deliver the
 resolution change event to userspace via the v4l2 subdev event queue as
 well as to the bridge driver using the callback notify mechanism.
 
 This allows userspace applications to react to changes in resolution. This
 is useful and often necessary for video pipelines where there is no direct
 1-to-1 relationship between the subdevice converter and the video capture
 device and hence it does not make sense to directly forward the event to
 the video capture device node.
 
 Signed-off-by: Lars-Peter Clausen l...@metafoo.de
 ---
  drivers/media/i2c/adv7604.c | 23 ++-
  1 file changed, 18 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index cf1cb5a..b66f63e3 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -1761,8 +1761,8 @@ static int adv76xx_s_routing(struct v4l2_subdev *sd,
   select_input(sd);
   enable_input(sd);
  
 - v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
 -(void *)adv76xx_ev_fmt);
 + v4l2_subdev_notify_event(sd, adv76xx_ev_fmt);
 +
   return 0;
  }
  
 @@ -1929,8 +1929,7 @@ static int adv76xx_isr(struct v4l2_subdev *sd, u32 
 status, bool *handled)
   %s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n,
   __func__, fmt_change, fmt_change_digital);
  
 - v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT,
 -(void *)adv76xx_ev_fmt);
 + v4l2_subdev_notify_event(sd, adv76xx_ev_fmt);
  
   if (handled)
   *handled = true;
 @@ -2348,6 +2347,20 @@ static int adv76xx_log_status(struct v4l2_subdev *sd)
   return 0;
  }
  
 +static int adv76xx_subscribe_event(struct v4l2_subdev *sd,
 +struct v4l2_fh *fh,
 +struct v4l2_event_subscription *sub)
 +{
 + switch (sub-type) {
 + case V4L2_EVENT_SOURCE_CHANGE:
 + return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
 + case V4L2_EVENT_CTRL:
 + return v4l2_event_subdev_unsubscribe(sd, fh, sub);

This should be ..._subscribe(), shouldn't it?

You could simply use v4l2_event_subscribe(fh, sub),
v4l2_event_subdev_unsubscribe() is there so you can use it directly as the
subscribe_event() op.

 + default:
 + return -EINVAL;
 + }
 +}
 +
  /* --- */
  
  static const struct v4l2_ctrl_ops adv76xx_ctrl_ops = {
 @@ -2357,7 +2370,7 @@ static const struct v4l2_ctrl_ops adv76xx_ctrl_ops = {
  static const struct v4l2_subdev_core_ops adv76xx_core_ops = {
   .log_status = adv76xx_log_status,
   .interrupt_service_routine = adv76xx_isr,
 - .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
 + .subscribe_event = adv76xx_subscribe_event,
   .unsubscribe_event = v4l2_event_subdev_unsubscribe,
  #ifdef CONFIG_VIDEO_ADV_DEBUG
   .g_register = adv76xx_g_register,

-- 
Regards,

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


Re: [PATCH 3/5] [media] Add helper function for subdev event notifications

2015-06-25 Thread Lars-Peter Clausen

On 06/25/2015 11:47 AM, Sakari Ailus wrote:

Hi Lars-Peter,

On Wed, Jun 24, 2015 at 06:50:29PM +0200, Lars-Peter Clausen wrote:

Add a new helper function called v4l2_subdev_notify_event() which will
deliver the specified event to both the v4l2 subdev event queue as well as
to the notify callback. The former is typically used by userspace
applications to listen to notification events while the later is used by
bridge drivers. Combining both into the same function avoids boilerplate
code in subdev drivers.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
  drivers/media/v4l2-core/v4l2-subdev.c | 18 ++
  include/media/v4l2-subdev.h   |  4 
  2 files changed, 22 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index 6359606..83615b8 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -588,3 +588,21 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct 
v4l2_subdev_ops *ops)
  #endif
  }
  EXPORT_SYMBOL(v4l2_subdev_init);
+
+/**
+ * v4l2_subdev_notify_event() - Delivers event notification for subdevice
+ * @sd: The subdev for which to deliver the event
+ * @ev: The event to deliver
+ *
+ * Will deliver the specified event to all userspace event listeners which are
+ * subscribed to the v42l subdev event queue as well as to the bridge driver
+ * using the notify callback. The notification type for the notify callback
+ * will be V4L2_DEVICE_NOTIFY_EVENT.
+ */
+void v4l2_subdev_notify_event(struct v4l2_subdev *sd,
+ const struct v4l2_event *ev)
+{
+   v4l2_event_queue(sd-devnode, ev);
+   v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, (void *)ev);


This is ugly. The casting avoids a warning for passing a const variable as
non-const.


v4l2_subdev_notify() is a ioctl() style interface, which means you don't get 
type safety for the arg parameter, this includes any modifiers like const. 
Any subscriber to the notify callback needs to be aware that the type for 
the arg parameter for events of type V4L2_DEVICE_NOTIFY_EVENT is const 
struct v4l2_event *.


Having the cast here confined to a single place hides the ugliness from the 
users and you don't have to put the case, like it is right now, into each 
individual driver.




Could v4l2_subdev_notify() be changed to take the third argument as const?


You could, I guess, but you don't really gain anything. The subscriber still 
needs to be aware what the correct type of the arg parameter is for a 
specific event type.



Alternatively I'd just leave it out from v4l2_subdev_notify_event().


The whole point of the helper function is to have something that does both, 
add the event to the asynchronous event queue as well as call the 
synchronous event callback.


--
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-rc1] media updates

2015-06-25 Thread Mauro Carvalho Chehab
Hi Linus,

Please pull from:
  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
tags/media/v4.2-1

For the following media updates:
- Lots of improvements at the DVB API DocBook documentation. Now, the frontend
  and the network APIs are fully in sync with the Kernel and looks more like
  the rest of the media documentation;
- New frontend driver: cx24120
- New driver for a PCI device: cobalt. This driver is actually not sold in
  the market, but it is a good example of a multi-HDMI input device;
- The dt3155 driver were promoted from staging;
- The mantis driver got remote controller support;
- New V4L2 driver for ST bdisp SoC chipsets;
- Make sparse and smatch happier: several bugs were solved by fixing
  the issues reported by those static code analyzers.
- Lots of new device additions, new features, improvements and cleanups at
  the existing drivers.

The following changes since commit 030bbdbf4c833bc69f502eae58498bc5572db736:

  Linux 4.1-rc3 (2015-05-10 15:12:29 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
tags/media/v4.2-1

for you to fetch changes up to faebbd8f134f0c054f372982c8ddd1bbcc41b440:

  [media] lmedm04: fix the range for relative measurements (2015-06-24 08:38:30 
-0300)


media updates for v4.2-rc1


Alexey Khoroshilov (1):
  [media] marvell-ccic: fix memory leak on failure path in 
cafe_smbus_setup()

Antonio Ospite (1):
  [media] cx25821: cx25821-medusa-reg.h: fix 0x0x prefix

Antti Palosaari (56):
  [media] msi001: revise synthesizer calculation
  [media] msi001: cleanups / renames
  [media] msi2500: revise synthesizer calculation
  [media] msi2500: cleanups
  [media] fc2580: implement I2C client bindings
  [media] rtl28xxu: bind fc2580 using I2C binding
  [media] af9035: bind fc2580 using I2C binding
  [media] fc2580: remove obsolete media attach
  [media] fc2580: improve set params logic
  [media] fc2580: cleanups and variable renames
  [media] fc2580: use regmap for register I2C access
  [media] af9035: fix device order in ID list
  [media] tua9001: add I2C bindings
  [media] af9035: bind tua9001 using I2C binding
  [media] rtl28xxu: bind tua9001 using I2C binding
  [media] tua9001: remove media attach
  [media] tua9001: various minor changes
  [media] tua9001: use regmap for I2C register access
  [media] tua9001: use div_u64() for frequency calculation
  [media] rtl2832: add inittab for FC2580 tuner
  [media] rtl28xxu: set correct FC2580 tuner for RTL2832 demod
  [media] fc2580: calculate filter control word dynamically
  [media] fc2580: implement V4L2 subdevice for SDR control
  [media] rtl2832_sdr: add support for fc2580 tuner
  [media] rtl28xxu: load SDR module for fc2580 based devices
  [media] e4000: revise synthesizer calculation
  [media] e4000: various small changes
  [media] e4000: implement V4L2 subdevice tuner and core ops
  [media] dvb-core: fix 32-bit overflow during bandwidth calculation
  [media] vivid: SDR cap add 'CU08' Complex U8 format
  [media] v4l2: correct two SDR format names
  [media] m88ds3103: do not return error from get_frontend() when not ready
  [media] m88ds3103: implement DVBv5 CNR statistics
  [media] m88ds3103: implement DVBv5 BER
  [media] m88ds3103: use jiffies when polling DiSEqC TX ready
  [media] m88ds3103: add I2C client binding
  [media] af9035: add USB ID 07ca:0337 AVerMedia HD Volar (A867)
  [media] si2168: Implement own I2C adapter locking
  [media] si2157: implement signal strength stats
  [media] tda10071: implement I2C client bindings
  [media] a8293: implement I2C client bindings
  [media] em28xx: add support for DVB SEC I2C client
  [media] em28xx: bind PCTV 460e using I2C client
  [media] cx23885: add support for DVB I2C SEC client
  [media] cx23885: Hauppauge WinTV Starburst bind I2C demod and SEC
  [media] cx23885: Hauppauge WinTV-HVR4400/HVR5500 bind I2C demod and SEC
  [media] cx23885: Hauppauge WinTV-HVR5525 bind I2C SEC
  [media] tda10071: add missing error status when probe() fails
  [media] fc2580: add missing error status when probe() fails
  [media] ts2020: re-implement PLL calculations
  [media] ts2020: improve filter limit calc
  [media] ts2020: register I2C driver from legacy media attach
  [media] ts2020: convert to regmap I2C API
  [media] m88ds3103: rename variables and correct logging
  [media] m88ds3103: use regmap for I2C register access
  [media] em28xx: PCTV 461e use I2C client for demod and SEC

Antti Seppälä (3):
  [media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper
  [media] rc: ir-rc6-decoder: Add encode capability
  [media] rc: 

Re: i.MX6 video capture support in mainline

2015-06-25 Thread Philipp Zabel
Hi Javier,

Am Dienstag, den 23.06.2015, 12:20 +0200 schrieb Javier Martin:
[...]
 media-ctl -l 'IPU0 SMFC0:1-imx-ipuv3-camera.2:0[1]'
 
 The last command will fail like this:
 
 imx-ipuv3 240.ipu: invalid link 'IPU0 SMFC0'(5):1 - 
 'imx-ipuv3-camera.2'(2):0
 Unable to parse link: Invalid argument (22)
 
 The reason it fails, apparently, is that the links that have been 
 created when opening /dev/video0 are not included in the ipu_links[] 
 static table defined in drivers/gpio/ipu-v3/ipu-media.c which is where 
 the ipu_smfc_link_setup() function tries to find a valid link.

Those are the IPU internal links, not handling the video device node
entities is a bug in ipu-media. Try something like this:

-8-
diff --git a/drivers/gpu/ipu-v3/ipu-media.c b/drivers/gpu/ipu-v3/ipu-media.c
index fda80c7..920806c 100644
--- a/drivers/gpu/ipu-v3/ipu-media.c
+++ b/drivers/gpu/ipu-v3/ipu-media.c
@@ -341,14 +341,16 @@ static int ipu_smfc_link_setup(struct media_entity 
*entity,
   const struct media_pad *remote, u32 flags)
 {
struct ipu_soc *ipu = to_ipu(entity);
-   const struct ipu_link *link;
+   const struct ipu_link *link = NULL;
const struct ipu_pad *pad;
u32 mask, sel = FS_SEL_ARM;
int csi, smfc;
 
-   link = ipu_find_link(ipu, local, remote);
-   if (!link)
-   return ipu_invalid_link(ipu, local, remote);
+   if (remote-entity-type != MEDIA_ENT_T_DEVNODE_V4L) {
+   link = ipu_find_link(ipu, local, remote);
+   if (!link)
+   return ipu_invalid_link(ipu, local, remote);
+   }
 
if (local-flags  MEDIA_PAD_FL_SINK) {
/* SMFC_MAP_CHx */
@@ -371,7 +373,7 @@ static int ipu_smfc_link_setup(struct media_entity *entity,
/* SMFCx_DEST_SEL */
pad = ipu_entities[ipu_entity(ipu, entity)].pads[local-index];
mask = pad-mask  pad-offset;
-   if (flags  MEDIA_LNK_FL_ENABLED)
+   if (link  (flags  MEDIA_LNK_FL_ENABLED))
sel = link-dest_sel  pad-offset;
 
ipu_cm_update_bits(ipu, IPU_FS_PROC_FLOW3, mask, sel);
-8-

 I've got some questions regarding this driver and iMX6 video capture 
 support in general that someone here may gladly answer:
 
 a) Is anyone currently working on mainlining iMX6 video capture support? 
 I know about Steve's and Philipp's work but I haven't seen any progress 
 since September 2014.

I am working on this on and off, but haven't found the time to fit in
the media entity rework.

 b) Does anyone know whether it's possible to capture YUV420P video using 
 the driver in Philipp's repository? If so could you please provide the 
 pipeline setup that you used with media-ctl?

What do you mean by YUV420P? The capture driver supports
V4L2_PIX_FMT_YUV420, but not the V4L2_PIX_FMT_YUV420M multiplanar
format, because the hardware U/V planes are just fixed offsets from a
base address. Memory bandwidth consumption wise, the most efficient
formats are NV12 and YUYV/UYVY.

 c) If we were willing to help with mainline submission of this driver 
 what issues should we focus on?

In my opinion, the media entities should be reworked and reduced to just
two CSI entities, a single IC(PRP) entity, and four video device nodes
(that correspond to the SMFC[0-3] FIFOs / CSI[0-3] IDMAC channels) with
their entities for each IPU.
Describing details like the SMFC FIFOs or different IC stages as media
entities and describing the IDMAC channel linking via buffers in system
RAM as links between media entities turned out to be the wrong
abstraction.
One thing I'm not yet clear about is how to handle MIPI CSI-2 streams
with multiple virtual channels properly, but I haven't seen hardware
that produces such streams yet.

regards
Philipp

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


[PATCH 1/2] [media] v4l2-mem2mem: set the queue owner field just as vb2_ioctl_reqbufs does

2015-06-25 Thread Philipp Zabel
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/v4l2-core/v4l2-mem2mem.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
b/drivers/media/v4l2-core/v4l2-mem2mem.c
index dc853e5..511caaa 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -357,9 +357,16 @@ int v4l2_m2m_reqbufs(struct file *file, struct 
v4l2_m2m_ctx *m2m_ctx,
 struct v4l2_requestbuffers *reqbufs)
 {
struct vb2_queue *vq;
+   int ret;
 
vq = v4l2_m2m_get_vq(m2m_ctx, reqbufs-type);
-   return vb2_reqbufs(vq, reqbufs);
+   ret = vb2_reqbufs(vq, reqbufs);
+   /* If count == 0, then the owner has released all buffers and he
+  is no longer owner of the queue. Otherwise we have a new owner. */
+   if (ret == 0)
+   vq-owner = reqbufs-count ? file-private_data : NULL;
+
+   return ret;
 }
 EXPORT_SYMBOL_GPL(v4l2_m2m_reqbufs);
 
-- 
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 2/2] [media] videobuf2: add trace events

2015-06-25 Thread Philipp Zabel
Add videobuf2 specific vb2_qbuf and vb2_dqbuf trace events that mirror the
v4l2_qbuf and v4l2_dqbuf trace events, only they include additional
information about queue fill state and are emitted right before the buffer
is enqueued in the driver or userspace is woken up. This allows to make
sense of the timeline of trace events in combination with others that might
be triggered by __enqueue_in_driver.

Also two new trace events vb2_buf_queue and vb2_buf_done are added,
allowing to trace the handover between videobuf2 framework and driver.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/v4l2-core/videobuf2-core.c | 11 
 include/trace/events/v4l2.h  | 99 
 2 files changed, 110 insertions(+)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 93b3154..b866a6b 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -30,6 +30,8 @@
 #include media/v4l2-common.h
 #include media/videobuf2-core.h
 
+#include trace/events/v4l2.h
+
 static int debug;
 module_param(debug, int, 0644);
 
@@ -1207,6 +1209,8 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum 
vb2_buffer_state state)
atomic_dec(q-owned_by_drv_count);
spin_unlock_irqrestore(q-done_lock, flags);
 
+   trace_vb2_buf_done(q, vb);
+
if (state == VB2_BUF_STATE_QUEUED) {
if (q-start_streaming_called)
__enqueue_in_driver(vb);
@@ -1629,6 +1633,8 @@ static void __enqueue_in_driver(struct vb2_buffer *vb)
vb-state = VB2_BUF_STATE_ACTIVE;
atomic_inc(q-owned_by_drv_count);
 
+   trace_vb2_buf_queue(q, vb);
+
/* sync buffers */
for (plane = 0; plane  vb-num_planes; ++plane)
call_void_memop(vb, prepare, vb-planes[plane].mem_priv);
@@ -1878,6 +1884,8 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct 
v4l2_buffer *b)
vb-v4l2_buf.timecode = b-timecode;
}
 
+   trace_vb2_qbuf(q, vb);
+
/*
 * If already streaming, give the buffer to driver for processing.
 * If not, the buffer will be given to driver on next streamon.
@@ -2123,6 +2131,9 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct 
v4l2_buffer *b, bool n
/* Remove from videobuf queue */
list_del(vb-queued_entry);
q-queued_count--;
+
+   trace_vb2_dqbuf(q, vb);
+
if (!V4L2_TYPE_IS_OUTPUT(q-type) 
vb-v4l2_buf.flags  V4L2_BUF_FLAG_LAST)
q-last_buffer_dequeued = true;
diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
index 89d0497..3d15cf1 100644
--- a/include/trace/events/v4l2.h
+++ b/include/trace/events/v4l2.h
@@ -175,9 +175,108 @@ SHOW_FIELD
)   \
)
 
+#define VB2_TRACE_EVENT(event_name)\
+   TRACE_EVENT(event_name, \
+   TP_PROTO(struct vb2_queue *q, struct vb2_buffer *vb),   \
+   \
+   TP_ARGS(q, vb), \
+   \
+   TP_STRUCT__entry(   \
+   __field(int, minor) \
+   __field(u32, queued_count)  \
+   __field(int, owned_by_drv_count)\
+   __field(u32, index) \
+   __field(u32, type)  \
+   __field(u32, bytesused) \
+   __field(u32, flags) \
+   __field(u32, field) \
+   __field(s64, timestamp) \
+   __field(u32, timecode_type) \
+   __field(u32, timecode_flags)\
+   __field(u8, timecode_frames)\
+   __field(u8, timecode_seconds)   \
+   __field(u8, timecode_minutes)   \
+   __field(u8, timecode_hours) \
+   __field(u8, timecode_userbits0) \
+   __field(u8, timecode_userbits1) \
+   __field(u8, timecode_userbits2) \
+   __field(u8, timecode_userbits3) \
+   __field(u32, sequence)  \
+   ),  \
+  

[PATCH 1/1] usb/airspy: removing unneeded goto

2015-06-25 Thread Maninder Singh
This patch removes unneded goto,
reported by coccinelle.

Signed-off-by: Maninder Singh maninder...@samsung.com
Reviewed-by: Akhilesh Kumar akhiles...@samsung.com
---
 drivers/media/usb/airspy/airspy.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/usb/airspy/airspy.c 
b/drivers/media/usb/airspy/airspy.c
index 4069234..8f2e1c2 100644
--- a/drivers/media/usb/airspy/airspy.c
+++ b/drivers/media/usb/airspy/airspy.c
@@ -937,9 +937,6 @@ static int airspy_set_if_gain(struct airspy *s)
ret = airspy_ctrl_msg(s, CMD_SET_VGA_GAIN, 0, s-if_gain-val,
u8tmp, 1);
if (ret)
-   goto err;
-err:
-   if (ret)
dev_dbg(s-dev, failed=%d\n, ret);
 
return ret;
-- 
1.7.9.5

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


XC5000C 0x14b4 status

2015-06-25 Thread Unembossed Name

Hi,

I was working on a Linux driver for a hybrid TV-tuner with SAA7134 PCI bridge, 
XC5000C RF tuner and Si2168 DVB demodulator by a
combining all existent at that time drivers together.
During that work, I had an issue with XC5000C.
Episodically, after attaching to DVB and reading XREG_PRODUCT_ID register, it
was possible to receive 0x14b4 instead of usual 0x1388 status. And as a result get a xc5000: Device not found at addr 0x%02x 
(0x%x)\n in dmesg.

To workaround these, I added a few strings to a source of a driver to make it's 
behaviour the same for 0x14b4, as for 0x1388.
After that RF tuner identification became always successful.
I had a conversation with a hardware vendor.
Now I can say, that such behaviour, most likely, because of  early firmware 
for XC5000C.
This hardware vendor is using for his Windows driver a latest firmware, and 
reading Product ID register always gives 0x14b4 status.
As he says, 0x1388 status is only for previous XC5000 IC. (Without C at end of 
a P/N)
Is this possible to patch xc5000.c with something like this:

#define XC_PRODUCT_ID_FW_LOADED 0x1388
+#define XC_PRODUCT_ID_FW_LOADED_XC5000C 0x14b4

 case XC_PRODUCT_ID_FW_LOADED:
+ case XC_PRODUCT_ID_FW_LOADED_XC5000C:
  printk(KERN_INFO
   xc5000: Successfully identified at address 0x%02x\n,

Or to try to get a chip vendor's permission for using a latest firmware for 
XC5000C in Linux, and then anyway, patch the driver?

Best regards. 


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


Re: [PATCH 1/2] [media] v4l2-mem2mem: set the queue owner field just as vb2_ioctl_reqbufs does

2015-06-25 Thread Kamil Debski
Hi Philipp,

On 25 June 2015 at 11:01, Philipp Zabel p.za...@pengutronix.de wrote:
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de

Please add the patch description no matter how simple it is and how
well the subject covers the content of the patch.

Best wishes,
Kamil

 ---
  drivers/media/v4l2-core/v4l2-mem2mem.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)

 diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
 b/drivers/media/v4l2-core/v4l2-mem2mem.c
 index dc853e5..511caaa 100644
 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
 +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
 @@ -357,9 +357,16 @@ int v4l2_m2m_reqbufs(struct file *file, struct 
 v4l2_m2m_ctx *m2m_ctx,
  struct v4l2_requestbuffers *reqbufs)
  {
 struct vb2_queue *vq;
 +   int ret;

 vq = v4l2_m2m_get_vq(m2m_ctx, reqbufs-type);
 -   return vb2_reqbufs(vq, reqbufs);
 +   ret = vb2_reqbufs(vq, reqbufs);
 +   /* If count == 0, then the owner has released all buffers and he
 +  is no longer owner of the queue. Otherwise we have a new owner. */
 +   if (ret == 0)
 +   vq-owner = reqbufs-count ? file-private_data : NULL;
 +
 +   return ret;
  }
  EXPORT_SYMBOL_GPL(v4l2_m2m_reqbufs);

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


Re: [PATCH 1/2] [media] v4l2-mem2mem: set the queue owner field just as vb2_ioctl_reqbufs does

2015-06-25 Thread Philipp Zabel
Hi Sylwester,

Am Donnerstag, den 25.06.2015, 15:11 +0200 schrieb Sylwester Nawrocki:
 Hello Philipp,
 
 On 25/06/15 12:01, Philipp Zabel wrote:
  Signed-off-by: Philipp Zabel p.za...@pengutronix.de
  ---
   drivers/media/v4l2-core/v4l2-mem2mem.c | 9 -
   1 file changed, 8 insertions(+), 1 deletion(-)
  
  diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
  b/drivers/media/v4l2-core/v4l2-mem2mem.c
  index dc853e5..511caaa 100644
  --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
  +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
  @@ -357,9 +357,16 @@ int v4l2_m2m_reqbufs(struct file *file, struct 
  v4l2_m2m_ctx *m2m_ctx,
   struct v4l2_requestbuffers *reqbufs)
   {
  struct vb2_queue *vq;
  +   int ret;
   
  vq = v4l2_m2m_get_vq(m2m_ctx, reqbufs-type);
  -   return vb2_reqbufs(vq, reqbufs);
  +   ret = vb2_reqbufs(vq, reqbufs);
  +   /* If count == 0, then the owner has released all buffers and he
  +  is no longer owner of the queue. Otherwise we have a new owner. */
  +   if (ret == 0)
  +   vq-owner = reqbufs-count ? file-private_data : NULL;
  +
  +   return ret;
   }
 
 How about modifying v4l2_m2m_ioctl_reqbufs() instead ?

The coda, gsc-m2m, m2m-deinterlace, mx2_emmaprp, and sh_veu drivers all
have their own implementation of vidioc_reqbufs that call
v4l2_m2m_reqbufs directly.
Maybe this should be moved into v4l2_m2m_ioctl_reqbufs after all drivers
are updated to use it instead of v4l2_m2m_reqbufs.

 Moreover, does it really makes sense when a new m2m device context
 is being created during each video device open()?

Having the queue owner's device minor in the trace output is very useful
when tracing a single stream across multiple devices. To discern events
from multiple simultaneous contexts I have added the context id to the
coda driver specific trace events.

regards
Philipp


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


Re: [PATCH 1/2] [media] v4l2-mem2mem: set the queue owner field just as vb2_ioctl_reqbufs does

2015-06-25 Thread Philipp Zabel
Hi Kamil,

Am Donnerstag, den 25.06.2015, 15:10 +0100 schrieb Kamil Debski:
 Hi Philipp,
 
 On 25 June 2015 at 11:01, Philipp Zabel p.za...@pengutronix.de wrote:
  Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 
 Please add the patch description no matter how simple it is and how
 well the subject covers the content of the patch.

Will do in the next round.

thanks
Philipp

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


Re: [PATCH 2/2] [media] videobuf2: add trace events

2015-06-25 Thread Philipp Zabel
Am Donnerstag, den 25.06.2015, 09:07 -0400 schrieb Steven Rostedt:
 On Thu, 25 Jun 2015 12:01:27 +0200
 Philipp Zabel p.za...@pengutronix.de wrote:
 
  diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
  index 89d0497..3d15cf1 100644
  --- a/include/trace/events/v4l2.h
  +++ b/include/trace/events/v4l2.h
  @@ -175,9 +175,108 @@ SHOW_FIELD
  )   \
  )
   
  +#define VB2_TRACE_EVENT(event_name)
  \
 
 This is what we have DECLARE_EVENT_CLASS for. Please use that,
 otherwise you are adding about 5k of text per event (where as
 DEFINE_EVENT adds only about 250 bytes).
[...]
 While you are at it, nuke the above macro and convert that too.

Thanks, I'll do that.

regards
Philipp

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


Re: [PATCH v2 2/2] x86/mm/pat, drivers/media/ivtv: move pat warn and replace WARN() with pr_warn()

2015-06-25 Thread Luis R. Rodriguez
On Thu, Jun 25, 2015 at 08:51:47AM +0200, Ingo Molnar wrote:
 
 * Luis R. Rodriguez mcg...@do-not-panic.com wrote:
 
  From: Luis R. Rodriguez mcg...@suse.com
  
  On built-in kernels this warning will always splat as this is part
  of the module init. Fix that by shifting the PAT requirement check
  out under the code that does the quasi-probe for the device. This
  device driver relies on an existing driver to find its own devices,
  it looks for that device driver and its own found devices, then
  uses driver_for_each_device() to try to see if it can probe each of
  those devices as a frambuffer device with ivtvfb_init_card(). We
  tuck the PAT requiremenet check then on the ivtvfb_init_card()
  call making the check at least require an ivtv device present
  before complaining.
  
  Reported-by: Fengguang Wu fengguang...@intel.com [0-day test robot]
  Signed-off-by: Luis R. Rodriguez mcg...@suse.com
  ---
   drivers/media/pci/ivtv/ivtvfb.c | 15 +--
   1 file changed, 9 insertions(+), 6 deletions(-)
  
  diff --git a/drivers/media/pci/ivtv/ivtvfb.c 
  b/drivers/media/pci/ivtv/ivtvfb.c
  index 4cb365d..8b95eef 100644
  --- a/drivers/media/pci/ivtv/ivtvfb.c
  +++ b/drivers/media/pci/ivtv/ivtvfb.c
  @@ -38,6 +38,8 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
  USA
*/
   
  +#define pr_fmt(fmt) KBUILD_MODNAME :  fmt
  +
   #include linux/module.h
   #include linux/kernel.h
   #include linux/fb.h
  @@ -1171,6 +1173,13 @@ static int ivtvfb_init_card(struct ivtv *itv)
   {
  int rc;
   
  +#ifdef CONFIG_X86_64
  +   if (pat_enabled()) {
  +   pr_warn(ivtvfb needs PAT disabled, boot with nopat kernel 
  parameter\n);
  +   return -ENODEV;
  +   }
  +#endif
  +
  if (itv-osd_info) {
  IVTVFB_ERR(Card %d already initialised\n, ivtvfb_card_id);
  return -EBUSY;
 
 Same argument as for ipath: why not make arch_phys_wc_add() fail on PAT and 
 return 
 -1, and check it in arch_phys_wc_del()?

The arch_phys_wc_add() is a no-op for PAT systems but for PAT to work we need
not only need to add this in where we replace the MTRR call but we also need
to convert ioremap_nocache() calls to ioremap_wc() but only if things were
split up already.

We racked our heads [0] [1] trying to figure out how to do the split for ivtv. 
The
issues with ivtv were that the firmware decides where the WC area is and does
not provide APIs to expose it. Then alternatives are to for example just use WC
on the entire full range and use work arounds write(); wmb(); read(); for MMIO
registers. That idea came from the use case of the Myricom Ethernet device
driver which uses WC as a compromise to address a performance regression if
it didn't use WC on an entire range, it uses the work around for the MMIO
registers. I considered very *briefly* adding a generic API that would let
device driver use this but dropped the idea as it seems this was not a common
issue and this was rather a work around.

I should note that Benjamin recenlty noted that power pc (and he says possibly
more) writel() and co contains an implicit mb(). That addresses some of it may
maybe not all requirements.

[0] http://lkml.kernel.org/r/1429146457.1899.99.ca...@palomino.walls.org
[1] https://marc.info/?t=14289474115r=1w=2

 That way we don't do anything drastic, the remaining few drivers still keep 
 working (albeit suboptimally - can be worked around with the 'nopat' boot 
 option) 
 - yet we've reduced the use of MTRRs drastically.

It seems the 3 drivers that needed hackery are ancient, not common and likely
adding a general fix more work than the gains provided through it. We'd need
to address not only the use of the arch_phys calls but also to split their MMIO
registers / WC desire area. This later part was the harder part of all this.
Fortunately the norm is that modern devices have a full PCI bar designated
for each now. Furthermore in the future we should hope for buses that do the
negotiation of this for us and we can just map things out for them in the
kernel. benh seems to note ppc does some hackery for this but I wouldn't bet
on it being viable without issues on x86 just unless a thorough review / big
wagers are made.

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


Re: [PATCH v2 1/2] x86/mm/pat, drivers/infiniband/ipath: replace WARN() with pr_warn()

2015-06-25 Thread Luis R. Rodriguez
On Thu, Jun 25, 2015 at 08:49:22AM +0200, Ingo Molnar wrote:
 
 * Luis R. Rodriguez mcg...@do-not-panic.com wrote:
 
  From: Luis R. Rodriguez mcg...@suse.com
  
  WARN() may confuse users, fix that. ipath_init_one() is part the
  device's probe so this would only be triggered if a corresponding
  device was found.
  
  Signed-off-by: Luis R. Rodriguez mcg...@suse.com
  ---
   drivers/infiniband/hw/ipath/ipath_driver.c | 6 --
   1 file changed, 4 insertions(+), 2 deletions(-)
  
  diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c 
  b/drivers/infiniband/hw/ipath/ipath_driver.c
  index 2d7e503..871dbe5 100644
  --- a/drivers/infiniband/hw/ipath/ipath_driver.c
  +++ b/drivers/infiniband/hw/ipath/ipath_driver.c
  @@ -31,6 +31,8 @@
* SOFTWARE.
*/
   
  +#define pr_fmt(fmt) KBUILD_MODNAME :  fmt
  +
   #include linux/sched.h
   #include linux/spinlock.h
   #include linux/idr.h
  @@ -399,8 +401,8 @@ static int ipath_init_one(struct pci_dev *pdev, const 
  struct pci_device_id *ent)
  u32 bar0 = 0, bar1 = 0;
   
   #ifdef CONFIG_X86_64
  -   if (WARN(pat_enabled(),
  -ipath needs PAT disabled, boot with nopat kernel 
  parameter\n)) {
  +   if (pat_enabled()) {
  +   pr_warn(ipath needs PAT disabled, boot with nopat kernel 
  parameter\n);
  ret = -ENODEV;
  goto bail;
  }
 
 So driver init will always fail with this on modern kernels.

Nope, I double checked this, ipath_init_one() is the PCI probe routine,
not the module init call. It should probably be renamed.

 Btw., on a second thought, ipath uses MTRRs to enable WC:
 
 ret = ipath_enable_wc(dd);
 if (ret)
 ret = 0;
 
 Note how it ignores any failures - the driver still works even if WC was not 
 enabled.

Ah, well WC strategy requires a split of the MMIO registers and the desired
WC area, right now they are combined for some type of ipath devices. There
are two things to consider when thinking about whether or not we want to
do the work required to do the split:

1) The state of affairs of the ipath driver
2) The effort required to do the ipath MMIO register / WC split

As for 1): the ipath driver is deprecated, the folks who maintain it
haven't used the driver in testing for 3-4 years now. The ipath driver
powers the old HTX bus card that only work in AMD systems, the replacement
driver is the qib infiniband driver , it powers all PCI-E cards. Doug
was even talking about removing the driver from the kernel [0] [1].

As for 2): I looked into doing the split and what makes it really
hard is that the ipath driver has a character device that is used
for diagnostics which lets userspace poke at the PCI device's
ioremap'd space, for the split case some magic needs to be done to
ensure the driver uses the right offset. So apart from addressing the
split and driver's use the character device mapping calls also would
need to be fixed.

I did the work on the atyfb driver to demo work effort required to
address the split, I did look to doing it for both the ipath and
ivtv driver but for both 1) and 2) indicated it was not worth it.

[0] http://lkml.kernel.org/r/1429728791.121496.10.ca...@redhat.com
[1] http://lkml.kernel.org/r/1430159932.44548.20.ca...@redhat.com

 So why don't you simply extend ipath_enable_wc() to generate the warning 
 message 
 and return -EINVAL - which still keeps the driver working on modern kernels?

We would need to do the split.

 Just inform the user about 'nopat' if he wants WC for this driver.

If we had the split we could do this.

  Luis
--
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 5/7] [media] omap3isp: remove unused var

2015-06-25 Thread Laurent Pinchart
Hi Mauro,

On Wednesday 24 June 2015 07:49:09 Mauro Carvalho Chehab wrote:
 drivers/media/platform/omap3isp/isppreview.c:932:6: warning: variable
 ‘features’ set but not used [-Wunused-but-set-variable]
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

On a side note, I'd appreciate if you could wait a couple of days for review 
before committing patches to the media_tree master branch.

Or maybe process pending pull requests for the same driver before fast-
tracking your own patches ;-)

 diff --git a/drivers/media/platform/omap3isp/isppreview.c
 b/drivers/media/platform/omap3isp/isppreview.c index
 15cb254ccc39..13803270d104 100644
 --- a/drivers/media/platform/omap3isp/isppreview.c
 +++ b/drivers/media/platform/omap3isp/isppreview.c
 @@ -929,14 +929,10 @@ static void preview_setup_hw(struct isp_prev_device
 *prev, u32 update, u32 active)
  {
   unsigned int i;
 - u32 features;
 
   if (update == 0)
   return;
 
 - features = (prev-params.params[0].features  active)
 -  | (prev-params.params[1].features  ~active);
 -
   for (i = 0; i  ARRAY_SIZE(update_attrs); i++) {
   const struct preview_update *attr = update_attrs[i];
   struct prev_params *params;

-- 
Regards,

Laurent Pinchart

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


Re: [patch] [media] v4l: xilinx: missing error code

2015-06-25 Thread Laurent Pinchart
Hi Dan,

Thank you for the patch.

On Wednesday 24 June 2015 17:28:31 Dan Carpenter wrote:
 We should set ret on this error path instead of returning success.
 
 Fixes: df3305156f98 ('[media] v4l: xilinx: Add Xilinx Video IP core')
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

and applied to my tree.

 diff --git a/drivers/media/platform/xilinx/xilinx-dma.c
 b/drivers/media/platform/xilinx/xilinx-dma.c index 98e50e4..e779c93 100644
 --- a/drivers/media/platform/xilinx/xilinx-dma.c
 +++ b/drivers/media/platform/xilinx/xilinx-dma.c
 @@ -699,8 +699,10 @@ int xvip_dma_init(struct xvip_composite_device *xdev,
 struct xvip_dma *dma,
 
   /* ... and the buffers queue... */
   dma-alloc_ctx = vb2_dma_contig_init_ctx(dma-xdev-dev);
 - if (IS_ERR(dma-alloc_ctx))
 + if (IS_ERR(dma-alloc_ctx)) {
 + ret = PTR_ERR(dma-alloc_ctx);
   goto error;
 + }
 
   /* Don't enable VB2_READ and VB2_WRITE, as using the read() and write()
* V4L2 APIs would be inefficient. Testing on the command line with a

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


cron job: media_tree daily build: OK

2015-06-25 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:   Fri Jun 26 04:00:24 CEST 2015
git branch: test
git hash:   faebbd8f134f0c054f372982c8ddd1bbcc41b440
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: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.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: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.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/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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


Re: [PATCH 11/12] [media] tsin: c8sectpfe: Add Kconfig and Makefile for the driver.

2015-06-25 Thread Paul Bolle
On Wed, 2015-06-24 at 16:11 +0100, Peter Griffin wrote:
 --- /dev/null
 +++ b/drivers/media/tsin/c8sectpfe/Makefile

 +c8sectpfe-y += c8sectpfe-core.o c8sectpfe-common.o c8sectpfe-dvb.o
 +
 +obj-$(CONFIG_DVB_C8SECTPFE) += c8sectpfe.o
 +
 +ifneq ($(CONFIG_DVB_C8SECTPFE),)
 + c8sectpfe-y += c8sectpfe-debugfs.o
 +endif

Isn't the above equivalent to
c8sectpfe-y += c8sectpfe-core.o c8sectpfe-common.o c8sectpfe-dvb.o 
c8sectpfe-debugfs.o

obj-$(CONFIG_DVB_C8SECTPFE) += c8sectpfe.o

Or am I missing something subtle here?


Paul Bolle
--
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] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL

2015-06-25 Thread Sakari Ailus
Hi Hans,

On Tue, Jun 23, 2015 at 11:20:23AM +0200, Hans Verkuil wrote:
 If the vdev pointer == NULL, then just return.
 
 This makes it easier for subdev drivers to use this function without having to
 check if the sd-devnode pointer is NULL or not.

Do you have an example of when this would be useful? Isn't it a rather
fundamental question to a driver whether or not it exposes a device node,
i.e. why would a driver use v4l2_event_queue() in the first place if it does
not expose a device node, and so the event interface?

 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 
 diff --git a/drivers/media/v4l2-core/v4l2-event.c 
 b/drivers/media/v4l2-core/v4l2-event.c
 index 8761aab..8d3171c 100644
 --- a/drivers/media/v4l2-core/v4l2-event.c
 +++ b/drivers/media/v4l2-core/v4l2-event.c
 @@ -172,6 +172,9 @@ void v4l2_event_queue(struct video_device *vdev, const 
 struct v4l2_event *ev)
   unsigned long flags;
   struct timespec timestamp;
 
 + if (vdev == NULL)
 + return;
 +
   ktime_get_ts(timestamp);
 
   spin_lock_irqsave(vdev-fh_lock, flags);

-- 
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: Build regressions/improvements in v4.1

2015-06-25 Thread Russell King - ARM Linux
On Tue, Jun 23, 2015 at 09:50:00AM +0200, Geert Uytterhoeven wrote:
 Hi Russell,
 
 On Mon, Jun 22, 2015 at 11:18 PM, Russell King - ARM Linux
 li...@arm.linux.org.uk wrote:
  On Mon, Jun 22, 2015 at 10:52:13PM +0200, Geert Uytterhoeven wrote:
  On Mon, Jun 22, 2015 at 10:48 PM, Geert Uytterhoeven
  ge...@linux-m68k.org wrote:
   JFYI, when comparing v4.1[1] to v4.1-rc8[3], the summaries are:
 - build errors: +44/-7
 
+ /home/kisskb/slave/src/arch/arm/mm/dump.c: error:
  'L_PTE_MT_BUFFERABLE' undeclared here (not in a function):  = 81:10
+ /home/kisskb/slave/src/arch/arm/mm/dump.c: error:
  'L_PTE_MT_DEV_CACHED' undeclared here (not in a function):  = 117:10
+ /home/kisskb/slave/src/arch/arm/mm/dump.c: error:
  'L_PTE_MT_DEV_NONSHARED' undeclared here (not in a function):  =
  108:10
 
  I'm rather ignoring this because I don't see these errors here.  This
  is one of the problems of just throwing out build reports.  With zero
  information such as a configuration or a method on how to cause the
  errors, it's pretty much worthless to post errors.
 
  Folk who do build testing need to be smarter, and consider what it's
  like to be on the receiving end of their report emails...
 
 Fortunately the kisskb service has good bookkeeping of build logs and configs.

As any good build system should do... :)

 Re-adding the lost URL:
  [1] http://kisskb.ellerman.id.au/kisskb/head/9038/ (all 254 configs)
 
   1. Open URL in web browser,
   2. Click on Failed, next to arm-randconfig,
   3. Click on Download, next to arm-randconfig,
   4. Reproduce,
   5. Fix,
   6. Profit! ;-)

Looking at the last 7 build results...

That shows that many of the linus failing build results are down to:

cc1: error: unrecognized command line option '-fstack-protector-strong'

which is a compiler/kbuild problem.  The kernel build system checks
for the flag and warns over it:

ifdef CONFIG_CC_STACKPROTECTOR_STRONG
  stackp-flag := -fstack-protector-strong
  ifeq ($(call cc-option, $(stackp-flag)),)
$(warning Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: \
  -fstack-protector-strong not supported by compiler)
  endif
else
  # Force off for distro compilers that enable stack protector by 
default.
  stackp-flag := $(call cc-option, -fno-stack-protector)
endif

but this doesn't stop the build progressing - and in any case, it
shows that randconfig with an outdated compiler is a problem with
modern Kbuild.  That accounts for 3 of the 7 Linus build failures.

.config:19:warning: symbol value '' invalid for PHYS_OFFSET

which can't be fixed: it has to be given a value.  That's a
randconfig problem.

/opt/cross/gcc-4.6.3-nolibc/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-geabi-ld:
 no machine record defined

Probably another toolchain problem.

arch/arm/mm/built-in.o:(.proc.info.init+0x198): undefined reference to 
`fa_user_fns'

This looks like it's been there for years (since 2009...) but
needs fixing (and we should probably fix it in a generic way.)

/tmp/ccA1GNig.s:671: Error: selected processor does not support Thumb mode `mrs 
r6,cpsr'

Maybe Uwe can investigate this one - it's EFM32 related.

Looking at the linux-next builds:

.config:21:warning: symbol value '' invalid for PHYS_OFFSET
cc1: error: unrecognized command line option '-fstack-protector-strong'

See above.

drivers/dma/pxa_dma.c:192:2: error: void value not ignored as it ought to be

Relatively new driver...

eeprom.c:(.text+0x26ad0): undefined reference to `pci_ioremap_io'
pci.c:(.init.text+0x518): undefined reference to `pci_ioremap_io'
last.c:(.text+0xb9fb0): undefined reference to `clk_set_parent'

Probably drivers not correctly checking their dependencies.

include/linux/virtio_ring.h:45:3: error: implicit declaration of function 
'dma_wmb' [-Werror=implicit-function-declaration]

virtio_ring.h not including a required header file?

As for the build errors you're reporting, that doesn't seem to be
anything new.  It seems to be down to a missing dependency between
ARM_PTDUMP and MMU, which means that ARM_PTDUMP is selectable on !MMU
systems.  I'll add that dependency, but that's just a small drop in
the ocean - it looks like it's the least of the problems with ARM
randconfig...

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
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: Build regressions/improvements in v4.1

2015-06-25 Thread Russell King - ARM Linux
On Thu, Jun 25, 2015 at 10:30:07AM +0100, Russell King - ARM Linux wrote:
 On Thu, Jun 25, 2015 at 10:18:15AM +0100, Russell King - ARM Linux wrote:
  On Tue, Jun 23, 2015 at 09:50:00AM +0200, Geert Uytterhoeven wrote:
  As for the build errors you're reporting, that doesn't seem to be
  anything new.  It seems to be down to a missing dependency between
  ARM_PTDUMP and MMU, which means that ARM_PTDUMP is selectable on !MMU
  systems.  I'll add that dependency, but that's just a small drop in
  the ocean - it looks like it's the least of the problems with ARM
  randconfig...
 
 Now that the build has finished... even with that fixed...
 
 arch/arm/mach-versatile/built-in.o: In function `pci_versatile_setup':
 arch/arm/mach-versatile/pci.c:249: undefined reference to `pci_ioremap_io'
 kernel/built-in.o: In function `set_section_ro_nx':
 kernel/module.c:1738: undefined reference to `set_memory_nx'
 kernel/built-in.o: In function `set_page_attributes':
 kernel/module.c:1709: undefined reference to `set_memory_ro'
 ...
 
 which means that DEBUG_SET_MODULE_RONX also needs to depend on MMU.
 As for the pci_ioremap_io, I'm not sure what to do about that.
 
 In any case, I'll queue up both of these dependency fixes as low
 priority.  Thanks.

No I won't.  Arnd has already caught the one you originally reported,
and there's a fix already queued for it to be merged during this window...

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
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] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL

2015-06-25 Thread Lars-Peter Clausen

On 06/25/2015 11:12 AM, Sakari Ailus wrote:

Hi Hans,

On Tue, Jun 23, 2015 at 11:20:23AM +0200, Hans Verkuil wrote:

If the vdev pointer == NULL, then just return.

This makes it easier for subdev drivers to use this function without having to
check if the sd-devnode pointer is NULL or not.


Do you have an example of when this would be useful? Isn't it a rather
fundamental question to a driver whether or not it exposes a device node,
i.e. why would a driver use v4l2_event_queue() in the first place if it does
not expose a device node, and so the event interface?


The device node will only be created if the subdev driver supports it and if 
the bridge driver requests it. So if the subdev driver supports it, but the 
bridge driver does not request it there will be no devnode. The patch is to 
handle that case.


This patch is a requirement for this series which adds support for direct 
event notification to some subdev drivers. Why this is necessary and useful 
can be found in the series patch description. 
http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/92808


- Lars
--
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/15] media: soc_camera pad-aware driver initialisation

2015-06-25 Thread William Towle
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 william.to...@codethink.co.uk
Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
---
 drivers/media/platform/soc_camera/Kconfig  |1 +
 drivers/media/platform/soc_camera/rcar_vin.c   |1 +
 drivers/media/platform/soc_camera/soc_camera.c |   36 
 include/media/soc_camera.h |1 +
 4 files changed, 39 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..8d4d20c 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,33 @@ static int soc_camera_probe_finish(struct 
soc_camera_device *icd)
return ret;
}
 
+   icd-src_pad_idx = 0;
+#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;
+
+   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;
 
@@ -1335,6 +1363,9 @@ static int soc_camera_probe_finish(struct 
soc_camera_device *icd)
 evidstart:
soc_camera_free_user_formats(icd);
 eusrfmt:
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   media_entity_cleanup(icd-vdev-entity);
+#endif
soc_camera_remove_device(icd);
 
return ret;
@@ -1856,6 +1887,11 @@ static int soc_camera_remove(struct soc_camera_device 
*icd)
if (icd-num_user_formats)
soc_camera_free_user_formats(icd);
 
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   if (icd-vdev-entity.num_pads)
+   media_entity_cleanup(icd-vdev-entity);
+#endif
+
if (icd-clk) {
/* For the synchronous case */
v4l2_clk_unregister(icd-clk);
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 2f6261f..30193cf 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -42,6 +42,7 @@ struct soc_camera_device {
unsigned char devnum;   /* Device number per host */
struct soc_camera_sense *sense; /* See comment in struct definition */
struct video_device *vdev;
+   int src_pad_idx;/* For media-controller drivers */
struct v4l2_ctrl_handler ctrl_handler;
const struct soc_camera_format_xlate *current_fmt;
struct soc_camera_format_xlate *user_formats;
-- 

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

2015-06-25 Thread William Towle
Fix rcar_vin_try_fmt's use of an inappropriate pad number when calling
the subdev set_fmt function - for the ADV7612, IDs should be non-zero.

Signed-off-by: William Towle william.to...@codethink.co.uk
Reviewed-by: Rob Taylor rob.tay...@codethink.co.uk
---
 drivers/media/platform/soc_camera/rcar_vin.c |   20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 00c1034..1023c5b 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1697,14 +1697,18 @@ 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,
};
struct v4l2_mbus_framefmt *mf = format.format;
__u32 pixfmt = pix-pixelformat;
int width, height;
-   int ret;
+   int ret= -ENOMEM;
+
+   pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+   if (pad_cfg == NULL)
+   goto out;
 
xlate = soc_camera_xlate_by_fourcc(icd, pixfmt);
if (!xlate) {
@@ -1734,10 +1738,11 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
*icd,
mf-code = xlate-code;
mf-colorspace = pix-colorspace;
 
+   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);
+pad, set_fmt, pad_cfg, format);
if (ret  0)
-   return ret;
+   goto cleanup;
 
/* Adjust only if VIN cannot scale */
if (pix-width  mf-width * 2)
@@ -1761,12 +1766,12 @@ static int rcar_vin_try_fmt(struct soc_camera_device 
*icd,
mf-height = VIN_MAX_HEIGHT;
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);
-   return ret;
+   goto cleanup;
}
}
/* We will scale exactly */
@@ -1776,6 +1781,9 @@ static int rcar_vin_try_fmt(struct soc_camera_device *icd,
pix-height = height;
}
 
+cleanup:
+   v4l2_subdev_free_pad_config(pad_cfg);
+out:
return ret;
 }
 
-- 
1.7.10.4

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


[PATCH 02/15] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888 input support

2015-06-25 Thread William Towle
This adds V4L2_MBUS_FMT_RGB888_1X24 input format support
which is used by the ADV7612 chip.

Signed-off-by: Koji Matsuoka koji.matsuoka...@renesas.com
Signed-off-by: Simon Horman horms+rene...@verge.net.au
Signed-off-by: Yoshihiro Kaneko ykaneko0...@gmail.com

Modified to use MEDIA_BUS_FMT_* constants

Signed-off-by: William Towle william.to...@codethink.co.uk
Reviewed-by: Rob Taylor rob.tay...@codethink.co.uk
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/platform/soc_camera/rcar_vin.c |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index db7700b..16352a8 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -98,6 +98,7 @@
 #define VNMC_INF_YUV10_BT656   (2  16)
 #define VNMC_INF_YUV10_BT601   (3  16)
 #define VNMC_INF_YUV16 (5  16)
+#define VNMC_INF_RGB888(6  16)
 #define VNMC_VUP   (1  10)
 #define VNMC_IM_ODD(0  3)
 #define VNMC_IM_ODD_EVEN   (1  3)
@@ -589,7 +590,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
struct soc_camera_device *icd = priv-ici.icd;
struct rcar_vin_cam *cam = icd-host_priv;
u32 vnmc, dmr, interrupts;
-   bool progressive = false, output_is_yuv = false;
+   bool progressive = false, output_is_yuv = false, input_is_yuv = false;
 
switch (priv-field) {
case V4L2_FIELD_TOP:
@@ -623,16 +624,22 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
case MEDIA_BUS_FMT_YUYV8_1X16:
/* BT.601/BT.1358 16bit YCbCr422 */
vnmc |= VNMC_INF_YUV16;
+   input_is_yuv = true;
break;
case MEDIA_BUS_FMT_YUYV8_2X8:
/* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
vnmc |= priv-pdata_flags  RCAR_VIN_BT656 ?
VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
+   input_is_yuv = true;
+   break;
+   case MEDIA_BUS_FMT_RGB888_1X24:
+   vnmc |= VNMC_INF_RGB888;
break;
case MEDIA_BUS_FMT_YUYV10_2X10:
/* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
vnmc |= priv-pdata_flags  RCAR_VIN_BT656 ?
VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;
+   input_is_yuv = true;
break;
default:
break;
@@ -676,7 +683,7 @@ static int rcar_vin_setup(struct rcar_vin_priv *priv)
vnmc |= VNMC_VUP;
 
/* If input and output use the same colorspace, use bypass mode */
-   if (output_is_yuv)
+   if (input_is_yuv == output_is_yuv)
vnmc |= VNMC_BPS;
 
/* progressive or interlaced mode */
@@ -1423,6 +1430,7 @@ static int rcar_vin_get_formats(struct soc_camera_device 
*icd, unsigned int idx,
case MEDIA_BUS_FMT_YUYV8_1X16:
case MEDIA_BUS_FMT_YUYV8_2X8:
case MEDIA_BUS_FMT_YUYV10_2X10:
+   case MEDIA_BUS_FMT_RGB888_1X24:
if (cam-extra_fmt)
break;
 
-- 
1.7.10.4

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


Re: Build regressions/improvements in v4.1

2015-06-25 Thread Russell King - ARM Linux
On Thu, Jun 25, 2015 at 10:18:15AM +0100, Russell King - ARM Linux wrote:
 On Tue, Jun 23, 2015 at 09:50:00AM +0200, Geert Uytterhoeven wrote:
 As for the build errors you're reporting, that doesn't seem to be
 anything new.  It seems to be down to a missing dependency between
 ARM_PTDUMP and MMU, which means that ARM_PTDUMP is selectable on !MMU
 systems.  I'll add that dependency, but that's just a small drop in
 the ocean - it looks like it's the least of the problems with ARM
 randconfig...

Now that the build has finished... even with that fixed...

arch/arm/mach-versatile/built-in.o: In function `pci_versatile_setup':
arch/arm/mach-versatile/pci.c:249: undefined reference to `pci_ioremap_io'
kernel/built-in.o: In function `set_section_ro_nx':
kernel/module.c:1738: undefined reference to `set_memory_nx'
kernel/built-in.o: In function `set_page_attributes':
kernel/module.c:1709: undefined reference to `set_memory_ro'
...

which means that DEBUG_SET_MODULE_RONX also needs to depend on MMU.
As for the pci_ioremap_io, I'm not sure what to do about that.

In any case, I'll queue up both of these dependency fixes as low
priority.  Thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
--
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/15] ARM: shmobile: lager dts: specify default-input for ADV7612

2015-06-25 Thread William Towle
Set 'default-input' property for ADV7612. Enables image/video capture
without the need to have userspace specifying routing.

Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Tested-by: William Towle william.to...@codethink.co.uk
---
 arch/arm/boot/dts/r8a7790-lager.dts |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index d381e99..be3b3c6 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -552,6 +552,7 @@
port {
hdmi_in_ep: endpoint {
remote-endpoint = vin0ep0;
+   default-input = 0;
};
};
};
-- 
1.7.10.4

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


[PATCH 04/15] media: adv7604: chip info and formats for ADV7612

2015-06-25 Thread William Towle
Add support for the ADV7612 chip as implemented on Renesas' Lager
board to adv7604.c, including lists for formats/colourspace/timing
selection and an IRQ handler.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |  102 +--
 1 file changed, 98 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 808360f..ebeddd5 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -81,6 +81,7 @@ MODULE_LICENSE(GPL);
 enum adv76xx_type {
ADV7604,
ADV7611,
+   ADV7612,
 };
 
 struct adv76xx_reg_seq {
@@ -766,6 +767,23 @@ static const struct adv76xx_format_info adv7611_formats[] 
= {
  ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_12BIT },
 };
 
+static const struct adv76xx_format_info adv7612_formats[] = {
+   { MEDIA_BUS_FMT_RGB888_1X24, ADV76XX_OP_CH_SEL_RGB, true, false,
+ ADV76XX_OP_MODE_SEL_SDR_444 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_2X8, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_2X8, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_UYVY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_VYUY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_1X16, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_1X16, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+};
+
 static const struct adv76xx_format_info *
 adv76xx_format_info(struct adv76xx_state *state, u32 code)
 {
@@ -870,6 +888,16 @@ static unsigned int adv7611_read_cable_det(struct 
v4l2_subdev *sd)
return value  1;
 }
 
+static unsigned int adv7612_read_cable_det(struct v4l2_subdev *sd)
+{
+   /*  Reads CABLE_DET_A_RAW. For input B support, need to
+*  account for bit 7 [MSB] of 0x6a (ie. CABLE_DET_B_RAW)
+*/
+   u8 value = io_read(sd, 0x6f);
+
+   return value  1;
+}
+
 static int adv76xx_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd)
 {
struct adv76xx_state *state = to_state(sd);
@@ -2510,6 +2538,11 @@ static void adv7611_setup_irqs(struct v4l2_subdev *sd)
io_write(sd, 0x41, 0xd0); /* STDI irq for any change, disable INT2 */
 }
 
+static void adv7612_setup_irqs(struct v4l2_subdev *sd)
+{
+   io_write(sd, 0x41, 0xd0); /* disable INT2 */
+}
+
 static void adv76xx_unregister_clients(struct adv76xx_state *state)
 {
unsigned int i;
@@ -2597,6 +2630,19 @@ static const struct adv76xx_reg_seq 
adv7611_recommended_settings_hdmi[] = {
{ ADV76XX_REG_SEQ_TERM, 0 },
 };
 
+static const struct adv76xx_reg_seq adv7612_recommended_settings_hdmi[] = {
+   { ADV76XX_REG(ADV76XX_PAGE_CP, 0x6c), 0x00 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x9b), 0x03 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x6f), 0x08 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x85), 0x1f },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x87), 0x70 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x57), 0xda },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x58), 0x01 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x03), 0x98 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x4c), 0x44 },
+   { ADV76XX_REG_SEQ_TERM, 0 },
+};
+
 static const struct adv76xx_chip_info adv76xx_chip_info[] = {
[ADV7604] = {
.type = ADV7604,
@@ -2685,17 +2731,60 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
.field1_vsync_mask = 0x3fff,
.field1_vbackporch_mask = 0x3fff,
},
+   [ADV7612] = {
+   .type = ADV7612,
+   .has_afe = false,
+   .max_port = ADV76XX_PAD_HDMI_PORT_A,/* B not supported */
+   .num_dv_ports = 1,  /* normally 2 */
+   .edid_enable_reg = 0x74,
+   .edid_status_reg = 0x76,
+   .lcf_reg = 0xa3,
+   .tdms_lock_mask = 0x43,
+   .cable_det_mask = 0x01,
+   .fmt_change_digital_mask = 0x03,
+   .cp_csc = 0xf4,
+   .formats = adv7612_formats,
+   .nformats = ARRAY_SIZE(adv7612_formats),
+   .set_termination = adv7611_set_termination,
+   .setup_irqs = adv7612_setup_irqs,
+   .read_hdmi_pixelclock = adv7611_read_hdmi_pixelclock,
+   .read_cable_det = adv7612_read_cable_det,
+   .recommended_settings = {
+   [1] = adv7612_recommended_settings_hdmi,
+   },
+   

[PATCH 01/15] ARM: shmobile: lager dts: Add entries for VIN HDMI input support

2015-06-25 Thread William Towle
Add DT entries for vin0, vin0_pins, and adv7612

Signed-off-by: William Towle william.to...@codethink.co.uk
Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
---
 arch/arm/boot/dts/r8a7790-lager.dts |   41 ++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/r8a7790-lager.dts 
b/arch/arm/boot/dts/r8a7790-lager.dts
index 10b3426..d381e99 100644
--- a/arch/arm/boot/dts/r8a7790-lager.dts
+++ b/arch/arm/boot/dts/r8a7790-lager.dts
@@ -378,7 +378,12 @@
renesas,function = usb2;
};
 
-   vin1_pins: vin {
+   vin0_pins: vin0 {
+   renesas,groups = vin0_data24, vin0_sync, vin0_field, 
vin0_clkenb, vin0_clk;
+   renesas,function = vin0;
+   };
+
+   vin1_pins: vin1 {
renesas,groups = vin1_data8, vin1_clk;
renesas,function = vin1;
};
@@ -539,6 +544,18 @@
reg = 0x12;
};
 
+   hdmi-in@4c {
+   compatible = adi,adv7612;
+   reg = 0x4c;
+   remote = vin0;
+
+   port {
+   hdmi_in_ep: endpoint {
+   remote-endpoint = vin0ep0;
+   };
+   };
+   };
+
composite-in@20 {
compatible = adi,adv7180;
reg = 0x20;
@@ -654,6 +671,28 @@
status = okay;
 };
 
+/* HDMI video input */
+vin0 {
+   pinctrl-0 = vin0_pins;
+   pinctrl-names = default;
+
+   status = ok;
+
+   port {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   vin0ep0: endpoint {
+   remote-endpoint = hdmi_in_ep;
+   bus-width = 24;
+   hsync-active = 0;
+   vsync-active = 0;
+   pclk-sample = 1;
+   data-active = 1;
+   };
+   };
+};
+
 /* composite video input */
 vin1 {
pinctrl-0 = vin1_pins;
-- 
1.7.10.4

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


[PATCH 03/15] media: adv7180: add of match table

2015-06-25 Thread William Towle
From: Ben Dooks ben.do...@codethink.co.uk

Add a proper of match id for use when the device is being bound via
device tree, to avoid having to use the i2c old-style binding of the
device.

Signed-off-by: Ben Dooks ben.do...@codethink.co.uk
Signed-off-by: William.Towle william.to...@codethink.co.uk
Reviewed-by: Rob Taylor rob.tay...@codethink.co.uk
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7180.c |   11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index a493c0b..09a96df 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -25,6 +25,7 @@
 #include linux/interrupt.h
 #include linux/i2c.h
 #include linux/slab.h
+#include linux/of.h
 #include media/v4l2-ioctl.h
 #include linux/videodev2.h
 #include media/v4l2-device.h
@@ -1324,11 +1325,21 @@ static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, 
adv7180_suspend, adv7180_resume);
 #define ADV7180_PM_OPS NULL
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id adv7180_of_id[] = {
+   { .compatible = adi,adv7180, },
+   { },
+};
+
+MODULE_DEVICE_TABLE(of, adv7180_of_id);
+#endif
+
 static struct i2c_driver adv7180_driver = {
.driver = {
   .owner = THIS_MODULE,
   .name = KBUILD_MODNAME,
   .pm = ADV7180_PM_OPS,
+  .of_match_table = of_match_ptr(adv7180_of_id),
   },
.probe = adv7180_probe,
.remove = adv7180_remove,
-- 
1.7.10.4

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


HDMI and Composite capture on Lager, for kernel 4.1, version 4

2015-06-25 Thread William Towle

  Version 4. Obsoletes version 3, as seen at:

http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/91931

  This version has the bus_info field set in rcar_vin.c, where the
value used can be constructed uniquely. Elsewhere a number of small
optimisations have been made, and some redundant initialisation code
has been removed.

To follow:
[PATCH 01/15] ARM: shmobile: lager dts: Add entries for VIN HDMI
[PATCH 02/15] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888
[PATCH 03/15] media: adv7180: add of match table
[PATCH 04/15] media: adv7604: chip info and formats for ADV7612
[PATCH 05/15] media: adv7604: document support for ADV7612 dual HDMI
[PATCH 06/15] media: adv7604: ability to read default input port
[PATCH 07/15] ARM: shmobile: lager dts: specify default-input for
[PATCH 08/15] v4l: subdev: Add pad config allocator and init
[PATCH 09/15] media: soc_camera pad-aware driver initialisation
[PATCH 10/15] media: rcar_vin: Use correct pad number in try_fmt
[PATCH 11/15] media: soc_camera: soc_scale_crop: Use correct pad
[PATCH 12/15] media: soc_camera: Fill std field in enum_input
[PATCH 13/15] media: soc_camera: Fix error reporting in expbuf
[PATCH 14/15] media: rcar_vin: fill in bus_info field
[PATCH 15/15] media: rcar_vin: Reject videobufs that are too small

Cheers,
  Wills.
--
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/15] v4l: subdev: Add pad config allocator and init

2015-06-25 Thread William Towle
From: Laurent Pinchart laurent.pinch...@linaro.org

Add a new subdev operation to initialize a subdev pad config array, and
a helper function to allocate and initialize the array. This can be used
by bridge drivers to implement try format based on subdev pad
operations.

Signed-off-by: Laurent Pinchart laurent.pinch...@linaro.org
Acked-by: Vaibhav Hiremath vaibhav.hirem...@linaro.org
---
 drivers/media/v4l2-core/v4l2-subdev.c | 19 ++-
 include/media/v4l2-subdev.h   | 10 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

Changes since v1:

- Added v4l2_subdev_free_pad_config
---
 drivers/media/v4l2-core/v4l2-subdev.c |   19 ++-
 include/media/v4l2-subdev.h   |   10 ++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index 6359606..d594fe5 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -35,7 +35,7 @@
 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
 {
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
-   fh-pad = kzalloc(sizeof(*fh-pad) * sd-entity.num_pads, GFP_KERNEL);
+   fh-pad = v4l2_subdev_alloc_pad_config(sd);
if (fh-pad == NULL)
return -ENOMEM;
 #endif
@@ -569,6 +569,23 @@ int v4l2_subdev_link_validate(struct media_link *link)
sink, link, source_fmt, sink_fmt);
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd)
+{
+   struct v4l2_subdev_pad_config *cfg;
+
+   if (!sd-entity.num_pads)
+   return NULL;
+
+   cfg = kcalloc(sd-entity.num_pads, sizeof(*cfg), GFP_KERNEL);
+   if (!cfg)
+   return NULL;
+
+   v4l2_subdev_call(sd, pad, init_cfg, cfg);
+
+   return cfg;
+}
+EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config);
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops 
*ops)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index dc20102..4a609f6 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -485,6 +485,8 @@ struct v4l2_subdev_pad_config {
  *  may be adjusted by the subdev driver to device 
capabilities.
  */
 struct v4l2_subdev_pad_ops {
+   void (*init_cfg)(struct v4l2_subdev *sd,
+struct v4l2_subdev_pad_config *cfg);
int (*enum_mbus_code)(struct v4l2_subdev *sd,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_mbus_code_enum *code);
@@ -677,7 +679,15 @@ int v4l2_subdev_link_validate_default(struct v4l2_subdev 
*sd,
  struct v4l2_subdev_format *source_fmt,
  struct v4l2_subdev_format *sink_fmt);
 int v4l2_subdev_link_validate(struct media_link *link);
+
+struct v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev 
*sd);
+
+static inline void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config 
*cfg)
+{
+   kfree(cfg);
+}
 #endif /* CONFIG_MEDIA_CONTROLLER */
+
 void v4l2_subdev_init(struct v4l2_subdev *sd,
  const struct v4l2_subdev_ops *ops);
 
-- 
1.7.10.4

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


[PATCH 05/15] media: adv7604: document support for ADV7612 dual HDMI input decoder

2015-06-25 Thread William Towle
From: Ian Molton ian.mol...@codethink.co.uk

This documentation accompanies the patch adding support for the ADV7612
dual HDMI decoder / repeater chip.

Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Reviewed-by: William Towle william.to...@codethink.co.uk
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt|   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..7eafdbc 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,15 +1,17 @@
-* Analog Devices ADV7604/11 video decoder with HDMI receiver
+* Analog Devices ADV7604/11/12 video decoder with HDMI receiver
 
-The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI
-receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input,
-and the ADV7611 has one HDMI input and no analog input.
+The ADV7604 and ADV7611/12 are multiformat video decoders with an integrated
+HDMI receiver. The ADV7604 has four multiplexed HDMI inputs and one analog
+input, and the ADV7611 has one HDMI input and no analog input. The 7612 is
+similar to the 7611 but has 2 HDMI inputs.
 
-These device tree bindings support the ADV7611 only at the moment.
+These device tree bindings support the ADV7611/12 only at the moment.
 
 Required Properties:
 
   - compatible: Must contain one of the following
 - adi,adv7611 for the ADV7611
+- adi,adv7612 for the ADV7612
 
   - reg: I2C slave address
 
@@ -22,10 +24,10 @@ port, in accordance with the video interface bindings 
defined in
 Documentation/devicetree/bindings/media/video-interfaces.txt. The port nodes
 are numbered as follows.
 
-  Port ADV7611
+  Port ADV7611ADV7612
 
-  HDMI 0
-  Digital output   1
+  HDMI 0 0, 1
+  Digital output   12
 
 The digital output port node must contain at least one endpoint.
 
-- 
1.7.10.4

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


[PATCH 12/15] media: soc_camera: Fill std field in enum_input

2015-06-25 Thread William Towle
From: Hans Verkuil hans.verk...@cisco.com

Fill in the std field from the video_device tvnorms field in
enum_input.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
---
 drivers/media/platform/soc_camera/soc_camera.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index 8d4d20c..7971388 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -309,11 +309,14 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, 
void *priv,
 static int soc_camera_enum_input(struct file *file, void *priv,
 struct v4l2_input *inp)
 {
+   struct soc_camera_device *icd = file-private_data;
+
if (inp-index != 0)
return -EINVAL;
 
/* default is camera */
inp-type = V4L2_INPUT_TYPE_CAMERA;
+   inp-std = icd-vdev-tvnorms;
strcpy(inp-name, Camera);
 
return 0;
-- 
1.7.10.4

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


[PATCH 13/15] media: soc_camera: Fix error reporting in expbuf

2015-06-25 Thread William Towle
From: Hans Verkuil hans.verk...@cisco.com

Remove unnecessary check and fix the error code for vb1 drivers.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
---
 drivers/media/platform/soc_camera/soc_camera.c |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index 7971388..bb181c1 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -470,14 +470,10 @@ static int soc_camera_expbuf(struct file *file, void 
*priv,
struct soc_camera_device *icd = file-private_data;
struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
 
-   if (icd-streamer != file)
-   return -EBUSY;
-
/* videobuf2 only */
if (ici-ops-init_videobuf)
-   return -EINVAL;
-   else
-   return vb2_expbuf(icd-vb2_vidq, p);
+   return -ENOTTY;
+   return vb2_expbuf(icd-vb2_vidq, p);
 }
 
 /* Always entered with .host_lock held */
-- 
1.7.10.4

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


[PATCH 15/15] media: rcar_vin: Reject videobufs that are too small for current format

2015-06-25 Thread William Towle
From: Rob Taylor rob.tay...@codethink.co.uk

In videobuf_setup reject buffers that are too small for the configured
format. Fixes v4l2-compliance issue.

Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
Reviewed-by: William Towle william.to...@codethink.co.uk
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 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 20f690d..75f5ad0 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)
-- 
1.7.10.4

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


[PATCH 14/15] media: rcar_vin: fill in bus_info field

2015-06-25 Thread William Towle
From: Rob Taylor rob.tay...@codethink.co.uk

Adapt rcar_vin_querycap() so that cap-bus_info is populated with
something meaningful/unique.

Signed-off-by: Rob Taylor rob.tay...@codethink.co.uk
Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/platform/soc_camera/rcar_vin.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/soc_camera/rcar_vin.c 
b/drivers/media/platform/soc_camera/rcar_vin.c
index 1023c5b..20f690d 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1800,6 +1800,7 @@ static int rcar_vin_querycap(struct soc_camera_host *ici,
strlcpy(cap-card, R_Car_VIN, sizeof(cap-card));
cap-device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
+   snprintf(cap-bus_info, sizeof(cap-bus_info), platform:%s%d, 
DRV_NAME, ici-nr);
 
return 0;
 }
-- 
1.7.10.4

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


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

2015-06-25 Thread William Towle
From: Rob Taylor rob.tay...@codethink.co.uk

Fix calls to subdev try_fmt function to use valid pad numbers, fixing
the case where subdevs (eg. ADV7612) have valid pad numbers that are
non-zero.

Signed-off-by: William Towle william.to...@codethink.co.uk
Reviewed-by: Rob Taylor rob.tay...@codethink.co.uk
---
 drivers/media/platform/soc_camera/soc_scale_crop.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/soc_camera/soc_scale_crop.c 
b/drivers/media/platform/soc_camera/soc_scale_crop.c
index bda29bc..2772215 100644
--- a/drivers/media/platform/soc_camera/soc_scale_crop.c
+++ b/drivers/media/platform/soc_camera/soc_scale_crop.c
@@ -225,6 +225,7 @@ static int client_set_fmt(struct soc_camera_device *icd,
bool host_1to1;
int ret;
 
+   format-pad = icd-src_pad_idx;
ret = v4l2_device_call_until_err(sd-v4l2_dev,
 soc_camera_grp_id(icd), pad,
 set_fmt, NULL, format);
-- 
1.7.10.4

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


[PATCH 06/15] media: adv7604: ability to read default input port from DT

2015-06-25 Thread William Towle
From: Ian Molton ian.mol...@codethink.co.uk

Adds support to the adv7604 driver for specifying the default input
port in the Device tree. If no value is provided, the driver will be
unable to select an input without help from userspace.

Tested-by: William Towle william.to...@codethink.co.uk
Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt |3 +++
 drivers/media/i2c/adv7604.c |8 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 7eafdbc..8337f75 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -47,6 +47,7 @@ Optional Endpoint Properties:
   If none of hsync-active, vsync-active and pclk-sample is specified the
   endpoint will use embedded BT.656 synchronization.
 
+  - default-input: Select which input is selected after reset.
 
 Example:
 
@@ -60,6 +61,8 @@ Example:
#address-cells = 1;
#size-cells = 0;
 
+   default-input = 0;
+
port@0 {
reg = 0;
};
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index ebeddd5..2a89b91 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2795,6 +2795,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *endpoint;
struct device_node *np;
unsigned int flags;
+   u32 v;
 
np = state-i2c_clients[ADV76XX_PAGE_IO]-dev.of_node;
 
@@ -2804,6 +2805,12 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
return -EINVAL;
 
v4l2_of_parse_endpoint(endpoint, bus_cfg);
+
+   if (!of_property_read_u32(endpoint, default-input, v))
+   state-pdata.default_input = v;
+   else
+   state-pdata.default_input = -1;
+
of_node_put(endpoint);
 
flags = bus_cfg.bus.parallel.flags;
@@ -2842,7 +2849,6 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
/* Hardcode the remaining platform data fields. */
state-pdata.disable_pwrdnb = 0;
state-pdata.disable_cable_det_rst = 0;
-   state-pdata.default_input = -1;
state-pdata.blank_data = 1;
state-pdata.alt_data_sat = 1;
state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
-- 
1.7.10.4

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


Re: [PATCH] v4l2-event: v4l2_event_queue: do nothing if vdev == NULL

2015-06-25 Thread Sakari Ailus
Hi Lars-Peter,

On Thu, Jun 25, 2015 at 11:22:02AM +0200, Lars-Peter Clausen wrote:
 On 06/25/2015 11:12 AM, Sakari Ailus wrote:
 Hi Hans,
 
 On Tue, Jun 23, 2015 at 11:20:23AM +0200, Hans Verkuil wrote:
 If the vdev pointer == NULL, then just return.
 
 This makes it easier for subdev drivers to use this function without having 
 to
 check if the sd-devnode pointer is NULL or not.
 
 Do you have an example of when this would be useful? Isn't it a rather
 fundamental question to a driver whether or not it exposes a device node,
 i.e. why would a driver use v4l2_event_queue() in the first place if it does
 not expose a device node, and so the event interface?
 
 The device node will only be created if the subdev driver supports it and if
 the bridge driver requests it. So if the subdev driver supports it, but the
 bridge driver does not request it there will be no devnode. The patch is to
 handle that case.
 
 This patch is a requirement for this series which adds support for direct
 event notification to some subdev drivers. Why this is necessary and useful
 can be found in the series patch description.
 http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/92808

Ok, fair enough.

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

-- 
Regards,

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


Re: [PATCH 3/5] [media] Add helper function for subdev event notifications

2015-06-25 Thread Sakari Ailus
Hi Lars-Peter,

On Wed, Jun 24, 2015 at 06:50:29PM +0200, Lars-Peter Clausen wrote:
 Add a new helper function called v4l2_subdev_notify_event() which will
 deliver the specified event to both the v4l2 subdev event queue as well as
 to the notify callback. The former is typically used by userspace
 applications to listen to notification events while the later is used by
 bridge drivers. Combining both into the same function avoids boilerplate
 code in subdev drivers.
 
 Signed-off-by: Lars-Peter Clausen l...@metafoo.de
 ---
  drivers/media/v4l2-core/v4l2-subdev.c | 18 ++
  include/media/v4l2-subdev.h   |  4 
  2 files changed, 22 insertions(+)
 
 diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
 b/drivers/media/v4l2-core/v4l2-subdev.c
 index 6359606..83615b8 100644
 --- a/drivers/media/v4l2-core/v4l2-subdev.c
 +++ b/drivers/media/v4l2-core/v4l2-subdev.c
 @@ -588,3 +588,21 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const 
 struct v4l2_subdev_ops *ops)
  #endif
  }
  EXPORT_SYMBOL(v4l2_subdev_init);
 +
 +/**
 + * v4l2_subdev_notify_event() - Delivers event notification for subdevice
 + * @sd: The subdev for which to deliver the event
 + * @ev: The event to deliver
 + *
 + * Will deliver the specified event to all userspace event listeners which 
 are
 + * subscribed to the v42l subdev event queue as well as to the bridge driver
 + * using the notify callback. The notification type for the notify callback
 + * will be V4L2_DEVICE_NOTIFY_EVENT.
 + */
 +void v4l2_subdev_notify_event(struct v4l2_subdev *sd,
 +   const struct v4l2_event *ev)
 +{
 + v4l2_event_queue(sd-devnode, ev);
 + v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, (void *)ev);

This is ugly. The casting avoids a warning for passing a const variable as
non-const.

Could v4l2_subdev_notify() be changed to take the third argument as const?
Alternatively I'd just leave it out from v4l2_subdev_notify_event().

 +}
 +EXPORT_SYMBOL_GPL(v4l2_subdev_notify_event);
 diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
 index dc20102..65d4a5f 100644
 --- a/include/media/v4l2-subdev.h
 +++ b/include/media/v4l2-subdev.h
 @@ -44,6 +44,7 @@
  
  struct v4l2_device;
  struct v4l2_ctrl_handler;
 +struct v4l2_event;
  struct v4l2_event_subscription;
  struct v4l2_fh;
  struct v4l2_subdev;
 @@ -693,4 +694,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
  #define v4l2_subdev_has_op(sd, o, f) \
   ((sd)-ops-o  (sd)-ops-o-f)
  
 +void v4l2_subdev_notify_event(struct v4l2_subdev *sd,
 +   const struct v4l2_event *ev);
 +
  #endif

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