Re: [PATCH 11/13] v4l: vsp1: Determine partition requirements for scaled images

2016-09-15 Thread Niklas Söderlund
On 2016-09-14 23:00:33 +0300, Laurent Pinchart wrote:
> Hi Niklas,
> 
> On Wednesday 14 Sep 2016 21:27:33 Niklas Söderlund wrote:
> > On 2016-09-14 02:17:04 +0300, Laurent Pinchart wrote:
> > > From: Kieran Bingham 
> > > 
> > > The partition algorithm needs to determine the capabilities of each
> > > entity in the pipeline to identify the correct maximum partition width.
> > > 
> > > Extend the vsp1 entity operations to provide a max_width operation and
> > > use this call to calculate the number of partitions that will be
> > > processed by the algorithm.
> > > 
> > > Gen 2 hardware does not require multiple partitioning, and as such
> > > will always return a single partition.
> > > 
> > > Signed-off-by: Kieran Bingham 
> > > Signed-off-by: Laurent Pinchart
> > > 
> > 
> > I can't find the information about the partition limitations for SRU or
> > UDS in any of the documents I have.
> 
> That's because it's not documented in the datasheet :-(

Sometimes a kind soul provides you with the proper documentation :-)

Acked-by: Niklas Söderlund 

> 
> > But for the parts not relating to the logic of figuring out the hscale from
> > the input/output formats width:
> > 
> > Reviewed-by: Niklas Söderlund 
> 
> Thanks.
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 

-- 
Regards,
Niklas Söderlund
--
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 v8 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Hi!

This is a spinoff of "Lager/Koelsch board HDMI input support" that excludes
the DT portions, and that works without the unmerged subdevice abstraction
layer.

This revision improves over v7 from earlier today in that it does not break
analog input devices...

CU
Uli


Changes since v7:
- do not fail if there is no sink pad

Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 3 files changed, 47 insertions(+), 1 deletion(-)

-- 
2.9.3

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


Re: [PATCH v8 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
On Thu, Sep 15, 2016 at 3:25 PM, Hans Verkuil  wrote:
> On 09/15/2016 03:24 PM, Ulrich Hecht wrote:
>>
>> Hi!
>>
>> This is a spinoff of "Lager/Koelsch board HDMI input support" that
>> excludes
>> the DT portions, and that works without the unmerged subdevice abstraction
>> layer.
>
>
> Are you going to post another patch series for the DT portions?

Yes, but not today.

CU
Uli
--
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 v6 0/2] Add GS1662 driver

2016-09-15 Thread Charles-Antoine Couret
These patches add a driver for GS1662 component, a video serializer which
supports CEA and SDI timings.
To perform that, we need to determine SDI definition and some flags.

The associated documentation will be into another patchset to be
Sphinx comaptible.

This patchset add:
* redefine SMPTE-125M timings to be compliant to standard

Charles-Antoine Couret (2):
  SDI: add flag for SDI formats and SMPTE 125M definition
  Add GS1662 driver, a video serializer

 drivers/media/Kconfig |   1 +
 drivers/media/Makefile|   2 +-
 drivers/media/spi/Kconfig |   9 +
 drivers/media/spi/Makefile|   1 +
 drivers/media/spi/gs1662.c| 472 ++
 drivers/media/v4l2-core/v4l2-dv-timings.c |  11 +-
 include/uapi/linux/v4l2-dv-timings.h  |  12 +
 include/uapi/linux/videodev2.h|   8 +
 8 files changed, 511 insertions(+), 5 deletions(-)
 create mode 100644 drivers/media/spi/Kconfig
 create mode 100644 drivers/media/spi/Makefile
 create mode 100644 drivers/media/spi/gs1662.c

-- 
2.7.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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht 
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 2 files changed, 43 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 62ca7e3..f679182 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, get_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, set_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_s_dv_timings= rvin_s_dv_timings,
.vidioc_query_dv_timings= rvin_query_dv_timings,
 
+   .vidioc_g_edid  = rvin_g_edid,
+   .vidioc_s_edid  = rvin_s_edid,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
@@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
vin->src_pad_idx = pad_idx;
fmt.pad = vin->src_pad_idx;
 
+   vin->sink_pad_idx = 0;
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
+   vin->sink_pad_idx = pad_idx;
+   break;
+   }
+
/* Try to improve our guess of a reasonable window format */
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
if (ret) {
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 793184d..af815cc 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -121,6 +121,7 @@ struct rvin_dev {
struct video_device vdev;
struct v4l2_device v4l2_dev;
int src_pad_idx;
+   int sink_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity digital;
-- 
2.9.3

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


[PATCH v8 1/2] media: adv7604: automatic "default-input" selection

2016-09-15 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Additionally, documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Based on patch by William Towle .

Signed-off-by: Ulrich Hecht 
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..055c9df 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.9.3

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


Re: solo6010 modprobe lockup since e1ceb25a (v4.3 regression)

2016-09-15 Thread Hans Verkuil
On 09/15/2016 03:19 PM, Andrey Utkin wrote:
> On Thu, Sep 15, 2016 at 03:15:53PM +0200, Hans Verkuil wrote:
>> It could be related to the fact that a PCI write may be delayed unless
>> it is followed by a read (see also the comments in 
>> drivers/media/pci/ivtv/ivtv-driver.h).
> 
> Thanks for explanation!
> 
>> That was probably the reason for the pci_read_config_word in the reg_write
>> code. Try putting that back (and just that).
> 
> In this case reg_write becomes not atomic, thus spinlock would be
> required again here, right?

That depends on whether you can have calls to this function in parallel.

But I get the feeling that it might be easier to just revert the patch.

Regards,

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


Re: solo6010 modprobe lockup since e1ceb25a (v4.3 regression)

2016-09-15 Thread Hans Verkuil
It could be related to the fact that a PCI write may be delayed unless
it is followed by a read (see also the comments in 
drivers/media/pci/ivtv/ivtv-driver.h).

That was probably the reason for the pci_read_config_word in the reg_write
code. Try putting that back (and just that).

Regards,

Hans

On 09/15/2016 03:04 PM, Andrey Utkin wrote:
> Hi Krzysztof,
> 
> Me and one more solo6010 board user experience machine lockup when
> solo6x10 module is loaded on kernel series starting with 4.3 (despite
> solo6110 board probes just fine on all kernels). That is, 3.16, 3.18,
> 4.1 and 4.2 are tested and fine, and 4.3, 4.4, and others up to current
> linux-next are bad.
> So regression slipped in between 4.2 and 4.3. The diff between
> stable/linux-4.2.y and ...-4.3.y (which were tested) is not large, and
> my suspect fell on ripoff of register writing procedures complexity,
> which was introduced in e1ceb25a (see below). Reversion of that fixes
> lockup.  However, if, on top of reversion of e1ceb25a, i drop barrier
> stuff and pci_read_config... (see
> https://github.com/bluecherrydvr/linux/commit/d59aaf3), leaving the
> spinlock stuff, it locks up again.  This is a matter in which I'm not
> quite qualified, so I have no idea what that code copes with and why
> this workaround works for solo6010.  For now I think I'll tell the
> customer to use kernel with e1ceb25a reverted, but for upstream fix, I'm
> interested in more in-depth investigation. I'll be able to provide dmesg
> logs a bit later.
> 
> The breaking commit is quoted below.
> 
> commit e1ceb25a1569ce5b61b9c496dd32d038ba8cb936
> Author: Krzysztof Hałasa 
> Date:   Mon Jun 8 10:42:24 2015 -0300
> 
> [media] SOLO6x10: remove unneeded register locking and barriers
> 
> readl() and writel() are atomic, we don't need the spin lock.
> Also, flushing posted write buffer isn't required. Especially on read :-)
> 
> Signed-off-by: Krzysztof Ha?asa 
> Signed-off-by: Hans Verkuil 
> Signed-off-by: Mauro Carvalho Chehab 
> 
> diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c 
> b/drivers/media/pci/solo6x10/solo6x10-core.c
> index 84627e6..9c948b1 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-core.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-core.c
> @@ -483,7 +483,6 @@ static int solo_pci_probe(struct pci_dev *pdev, const 
> struct pci_device_id *id)
>  
>   solo_dev->type = id->driver_data;
>   solo_dev->pdev = pdev;
> - spin_lock_init(_dev->reg_io_lock);
>   ret = v4l2_device_register(>dev, _dev->v4l2_dev);
>   if (ret)
>   goto fail_probe;
> diff --git a/drivers/media/pci/solo6x10/solo6x10.h 
> b/drivers/media/pci/solo6x10/solo6x10.h
> index 1ca54b0..27423d7 100644
> --- a/drivers/media/pci/solo6x10/solo6x10.h
> +++ b/drivers/media/pci/solo6x10/solo6x10.h
> @@ -199,7 +199,6 @@ struct solo_dev {
>   int nr_ext;
>   u32 irq_mask;
>   u32 motion_mask;
> - spinlock_t  reg_io_lock;
>   struct v4l2_device  v4l2_dev;
>  
>   /* tw28xx accounting */
> @@ -281,36 +280,13 @@ struct solo_dev {
>  
>  static inline u32 solo_reg_read(struct solo_dev *solo_dev, int reg)
>  {
> - unsigned long flags;
> - u32 ret;
> - u16 val;
> -
> - spin_lock_irqsave(_dev->reg_io_lock, flags);
> -
> - ret = readl(solo_dev->reg_base + reg);
> - rmb();
> - pci_read_config_word(solo_dev->pdev, PCI_STATUS, );
> - rmb();
> -
> - spin_unlock_irqrestore(_dev->reg_io_lock, flags);
> -
> - return ret;
> + return readl(solo_dev->reg_base + reg);
>  }
>  
>  static inline void solo_reg_write(struct solo_dev *solo_dev, int reg,
> u32 data)
>  {
> - unsigned long flags;
> - u16 val;
> -
> - spin_lock_irqsave(_dev->reg_io_lock, flags);
> -
>   writel(data, solo_dev->reg_base + reg);
> - wmb();
> - pci_read_config_word(solo_dev->pdev, PCI_STATUS, );
> - rmb();
> -
> - spin_unlock_irqrestore(_dev->reg_io_lock, flags);
>  }
>  
>  static inline void solo_irq_on(struct solo_dev *dev, u32 mask)
> --
> 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: solo6010 modprobe lockup since e1ceb25a (v4.3 regression)

2016-09-15 Thread Andrey Utkin
On Thu, Sep 15, 2016 at 03:15:53PM +0200, Hans Verkuil wrote:
> It could be related to the fact that a PCI write may be delayed unless
> it is followed by a read (see also the comments in 
> drivers/media/pci/ivtv/ivtv-driver.h).

Thanks for explanation!

> That was probably the reason for the pci_read_config_word in the reg_write
> code. Try putting that back (and just that).

In this case reg_write becomes not atomic, thus spinlock would be
required again here, right?
--
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 v8 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Hans Verkuil

On 09/15/2016 03:24 PM, Ulrich Hecht wrote:

Hi!

This is a spinoff of "Lager/Koelsch board HDMI input support" that excludes
the DT portions, and that works without the unmerged subdevice abstraction
layer.


Are you going to post another patch series for the DT portions?

Regards,

Hans



This revision improves over v7 from earlier today in that it does not break
analog input devices...

CU
Uli


Changes since v7:
- do not fail if there is no sink pad

Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 3 files changed, 47 insertions(+), 1 deletion(-)



--
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 v6 1/2] SDI: add flag for SDI formats and SMPTE 125M definition

2016-09-15 Thread Charles-Antoine Couret
Adding others generic flags, which could be used by many
components like GS1662.

Signed-off-by: Charles-Antoine Couret 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 11 +++
 include/uapi/linux/v4l2-dv-timings.h  | 12 
 include/uapi/linux/videodev2.h|  8 
 3 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 889de0a..730a7c3 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -306,7 +306,7 @@ void v4l2_print_dv_timings(const char *dev_prefix, const 
char *prefix,
(bt->polarities & V4L2_DV_VSYNC_POS_POL) ? "+" : "-",
bt->il_vsync, bt->il_vbackporch);
pr_info("%s: pixelclock: %llu\n", dev_prefix, bt->pixelclock);
-   pr_info("%s: flags (0x%x):%s%s%s%s%s%s\n", dev_prefix, bt->flags,
+   pr_info("%s: flags (0x%x):%s%s%s%s%s%s%s\n", dev_prefix, bt->flags,
(bt->flags & V4L2_DV_FL_REDUCED_BLANKING) ?
" REDUCED_BLANKING" : "",
((bt->flags & V4L2_DV_FL_REDUCED_BLANKING) &&
@@ -318,12 +318,15 @@ void v4l2_print_dv_timings(const char *dev_prefix, const 
char *prefix,
(bt->flags & V4L2_DV_FL_HALF_LINE) ?
" HALF_LINE" : "",
(bt->flags & V4L2_DV_FL_IS_CE_VIDEO) ?
-   " CE_VIDEO" : "");
-   pr_info("%s: standards (0x%x):%s%s%s%s\n", dev_prefix, bt->standards,
+   " CE_VIDEO" : "",
+   (bt->flags & V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) ?
+   " FIRST_FIELD_EXTRA_LINE" : "");
+   pr_info("%s: standards (0x%x):%s%s%s%s%s\n", dev_prefix, bt->standards,
(bt->standards & V4L2_DV_BT_STD_CEA861) ?  " CEA" : "",
(bt->standards & V4L2_DV_BT_STD_DMT) ?  " DMT" : "",
(bt->standards & V4L2_DV_BT_STD_CVT) ?  " CVT" : "",
-   (bt->standards & V4L2_DV_BT_STD_GTF) ?  " GTF" : "");
+   (bt->standards & V4L2_DV_BT_STD_GTF) ?  " GTF" : "",
+   (bt->standards & V4L2_DV_BT_STD_SDI) ?  " SDI" : "");
 }
 EXPORT_SYMBOL_GPL(v4l2_print_dv_timings);
 
diff --git a/include/uapi/linux/v4l2-dv-timings.h 
b/include/uapi/linux/v4l2-dv-timings.h
index 086168e..f319571 100644
--- a/include/uapi/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
@@ -934,4 +934,16 @@
V4L2_DV_FL_REDUCED_BLANKING) \
 }
 
+/* SDI timings definitions */
+
+/* SMPTE-125M */
+#define V4L2_DV_BT_SDI_720X487I60 { \
+   .type = V4L2_DV_BT_656_1120, \
+   V4L2_INIT_BT_TIMINGS(720, 487, 1, \
+   V4L2_DV_HSYNC_POS_POL, \
+   1350, 16, 121, 0, 0, 19, 0, 0, 19, 0, \
+   V4L2_DV_BT_STD_SDI, \
+   V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) \
+}
+
 #endif
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 8f95191..37126a4 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1259,6 +1259,7 @@ struct v4l2_bt_timings {
 #define V4L2_DV_BT_STD_DMT (1 << 1)  /* VESA Discrete Monitor Timings */
 #define V4L2_DV_BT_STD_CVT (1 << 2)  /* VESA Coordinated Video Timings */
 #define V4L2_DV_BT_STD_GTF (1 << 3)  /* VESA Generalized Timings Formula */
+#define V4L2_DV_BT_STD_SDI (1 << 4)  /* SDI Timings */
 
 /* Flags */
 
@@ -1290,6 +1291,11 @@ struct v4l2_bt_timings {
  * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861
  * except for the 640x480 format are CE formats. */
 #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4)
+/* Some formats like SMPTE-125M have an interlaced signal with a odd
+ * total height. For these formats, if this flag is set, the first
+ * field has the extra line. If not, it is the second field.
+ */
+#define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE  (1 << 5)
 
 /* A few useful defines to calculate the total blanking and frame sizes */
 #define V4L2_DV_BT_BLANKING_WIDTH(bt) \
@@ -1413,6 +1419,8 @@ struct v4l2_input {
 /* field 'status' - analog */
 #define V4L2_IN_ST_NO_H_LOCK   0x0100  /* No horizontal sync lock */
 #define V4L2_IN_ST_COLOR_KILL  0x0200  /* Color killer is active */
+#define V4L2_IN_ST_NO_V_LOCK   0x0400  /* No vertical sync lock */
+#define V4L2_IN_ST_NO_STD_LOCK 0x0800  /* No standard format lock */
 
 /* field 'status' - digital */
 #define V4L2_IN_ST_NO_SYNC 0x0001  /* No synchronization lock */
-- 
2.7.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 v6 2/2] Add GS1662 driver, a video serializer

2016-09-15 Thread Charles-Antoine Couret
You can read datasheet here:
http://www.c-dis.net/media/871/GS1662_Datasheet.pdf

It's a component which supports HD and SD CEA or SDI formats
to SDI output. It's configured through SPI bus.

GS1662 driver is implemented as v4l2 subdev.

Signed-off-by: Charles-Antoine Couret 
---
 drivers/media/Kconfig  |   1 +
 drivers/media/Makefile |   2 +-
 drivers/media/spi/Kconfig  |   9 +
 drivers/media/spi/Makefile |   1 +
 drivers/media/spi/gs1662.c | 472 +
 5 files changed, 484 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/spi/Kconfig
 create mode 100644 drivers/media/spi/Makefile
 create mode 100644 drivers/media/spi/gs1662.c

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index a8518fb..d2fa6e7 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -215,5 +215,6 @@ config MEDIA_ATTACH
 source "drivers/media/i2c/Kconfig"
 source "drivers/media/tuners/Kconfig"
 source "drivers/media/dvb-frontends/Kconfig"
+source "drivers/media/spi/Kconfig"
 
 endif # MEDIA_SUPPORT
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index e608bbc..75bc82e 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -28,6 +28,6 @@ obj-y += rc/
 # Finally, merge the drivers that require the core
 #
 
-obj-y += common/ platform/ pci/ usb/ mmc/ firewire/
+obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ spi/
 obj-$(CONFIG_VIDEO_DEV) += radio/
 
diff --git a/drivers/media/spi/Kconfig b/drivers/media/spi/Kconfig
new file mode 100644
index 000..fa47c90
--- /dev/null
+++ b/drivers/media/spi/Kconfig
@@ -0,0 +1,9 @@
+if VIDEO_V4L2
+
+config VIDEO_GS1662
+   tristate "Gennum Serializers video"
+   depends on SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ Enable the GS1662 driver which serializes video streams.
+
+endif
diff --git a/drivers/media/spi/Makefile b/drivers/media/spi/Makefile
new file mode 100644
index 000..ea64013
--- /dev/null
+++ b/drivers/media/spi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_VIDEO_GS1662) += gs1662.o
diff --git a/drivers/media/spi/gs1662.c b/drivers/media/spi/gs1662.c
new file mode 100644
index 000..f743423
--- /dev/null
+++ b/drivers/media/spi/gs1662.c
@@ -0,0 +1,472 @@
+/*
+ * GS1662 device registration.
+ *
+ * Copyright (C) 2015-2016 Nexvision
+ * Author: Charles-Antoine Couret 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REG_STATUS 0x04
+#define REG_FORCE_FMT  0x06
+#define REG_LINES_PER_FRAME0x12
+#define REG_WORDS_PER_LINE 0x13
+#define REG_WORDS_PER_ACT_LINE 0x14
+#define REG_ACT_LINES_PER_FRAME0x15
+
+#define MASK_H_LOCK0x001
+#define MASK_V_LOCK0x002
+#define MASK_STD_LOCK  0x004
+#define MASK_FORCE_STD 0x020
+#define MASK_STD_STATUS0x3E0
+
+#define GS_WIDTH_MIN   720
+#define GS_WIDTH_MAX   2048
+#define GS_HEIGHT_MIN  487
+#define GS_HEIGHT_MAX  1080
+#define GS_PIXELCLOCK_MIN  10519200
+#define GS_PIXELCLOCK_MAX  7425
+
+struct gs {
+   struct spi_device *pdev;
+   struct v4l2_subdev sd;
+   struct v4l2_dv_timings current_timings;
+   int enabled;
+};
+
+struct gs_reg_fmt {
+   u16 reg_value;
+   struct v4l2_dv_timings format;
+};
+
+struct gs_reg_fmt_custom {
+   u16 reg_value;
+   __u32 width;
+   __u32 height;
+   __u64 pixelclock;
+   __u32 interlaced;
+};
+
+static const struct spi_device_id gs_id[] = {
+   { "gs1662", 0 },
+   { }
+};
+MODULE_DEVICE_TABLE(spi, gs_id);
+
+static const struct v4l2_dv_timings fmt_cap[] = {
+   V4L2_DV_BT_SDI_720X487I60,
+   V4L2_DV_BT_CEA_720X576P50,
+   V4L2_DV_BT_CEA_1280X720P24,
+   V4L2_DV_BT_CEA_1280X720P25,
+   V4L2_DV_BT_CEA_1280X720P30,
+   V4L2_DV_BT_CEA_1280X720P50,
+   V4L2_DV_BT_CEA_1280X720P60,
+   V4L2_DV_BT_CEA_1920X1080P24,
+   V4L2_DV_BT_CEA_1920X1080P25,
+   V4L2_DV_BT_CEA_1920X1080P30,
+   V4L2_DV_BT_CEA_1920X1080I50,
+   V4L2_DV_BT_CEA_1920X1080I60,
+};
+
+static const struct gs_reg_fmt reg_fmt[] = {
+   { 0x00, V4L2_DV_BT_CEA_1280X720P60 },
+   { 0x01, V4L2_DV_BT_CEA_1280X720P60 },
+   { 0x02, V4L2_DV_BT_CEA_1280X720P30 },
+   { 0x03, V4L2_DV_BT_CEA_1280X720P30 },
+   { 0x04, V4L2_DV_BT_CEA_1280X720P50 },
+   { 0x05, V4L2_DV_BT_CEA_1280X720P50 },
+   

Re: [PATCH v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Hans Verkuil
Hi Ulrich,

A patch series on top of my tree with Niklas' patches already merged:

https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=rcar

would be ideal. Since otherwise I have to resolve a conflict.

Regards,

Hans

On 09/15/2016 03:59 PM, Niklas Söderlund wrote:
> Hi Ulrich,
> 
> Thanks for your patch.
> 
> Can you append another patch ontop of this one whit the following 
> change:
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index ac26738..7ba728d 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -494,7 +494,7 @@ static int rvin_enum_dv_timings(struct file *file, void 
> *priv_fh,
> int pad, ret;
>  
> pad = timings->pad;
> -   timings->pad = vin->src_pad_idx;
> +   timings->pad = vin->sink_pad_idx;
>  
> ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
>  
> @@ -548,7 +548,7 @@ static int rvin_dv_timings_cap(struct file *file, void 
> *priv_fh,
> int pad, ret;
>  
> pad = cap->pad;
> -   cap->pad = vin->src_pad_idx;
> +   cap->pad = vin->sink_pad_idx;
>  
> ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
> 
> 
> Whit that change the driver pass v4l2-compliance check for the HDMI 
> input on Koelsch for me.
> 
> On 2016-09-15 15:24:08 +0200, Ulrich Hecht wrote:
>> Adds G_EDID and S_EDID.
>>
>> Signed-off-by: Ulrich Hecht 
>> ---
>>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 
>> +
>>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
>>  2 files changed, 43 insertions(+)
>>
>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
>> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> index 62ca7e3..f679182 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void 
>> *priv_fh,
>>  return ret;
>>  }
>>  
>> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>> +{
>> +struct rvin_dev *vin = video_drvdata(file);
>> +struct v4l2_subdev *sd = vin_to_source(vin);
>> +int input, ret;
>> +
>> +input = edid->pad;
>> +edid->pad = vin->sink_pad_idx;
>> +
>> +ret = v4l2_subdev_call(sd, pad, get_edid, edid);
>> +
>> +edid->pad = input;
>> +
>> +return ret;
>> +}
>> +
>> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>> +{
>> +struct rvin_dev *vin = video_drvdata(file);
>> +struct v4l2_subdev *sd = vin_to_source(vin);
>> +int input, ret;
>> +
>> +input = edid->pad;
>> +edid->pad = vin->sink_pad_idx;
>> +
>> +ret = v4l2_subdev_call(sd, pad, set_edid, edid);
>> +
>> +edid->pad = input;
>> +
>> +return ret;
>> +}
>> +
>>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>  .vidioc_querycap= rvin_querycap,
>>  .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
>> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>  .vidioc_s_dv_timings= rvin_s_dv_timings,
>>  .vidioc_query_dv_timings= rvin_query_dv_timings,
>>  
>> +.vidioc_g_edid  = rvin_g_edid,
>> +.vidioc_s_edid  = rvin_s_edid,
>> +
>>  .vidioc_querystd= rvin_querystd,
>>  .vidioc_g_std   = rvin_g_std,
>>  .vidioc_s_std   = rvin_s_std,
>> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
>>  vin->src_pad_idx = pad_idx;
>>  fmt.pad = vin->src_pad_idx;
>>  
>> +vin->sink_pad_idx = 0;
>> +for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
>> +if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
>> +vin->sink_pad_idx = pad_idx;
>> +break;
>> +}
>> +
>>  /* Try to improve our guess of a reasonable window format */
>>  ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
>>  if (ret) {
>> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
>> b/drivers/media/platform/rcar-vin/rcar-vin.h
>> index 793184d..af815cc 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
>> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
>> @@ -121,6 +121,7 @@ struct rvin_dev {
>>  struct video_device vdev;
>>  struct v4l2_device v4l2_dev;
>>  int src_pad_idx;
>> +int sink_pad_idx;
> 
> sink_pad_idx should be documented in the comment above the struct. If 
> you fix that feel free to add my:
> 
> Acked-by: Niklas Söderlund 
> 
>>  struct v4l2_ctrl_handler ctrl_handler;
>>  struct v4l2_async_notifier notifier;
>>  struct rvin_graph_entity digital;
>> -- 
>> 2.9.3
>>
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to 

Re: [PATCH] [media] MAINTAINERS: Add entry for the Renesas VIN driver

2016-09-15 Thread Laurent Pinchart
Hi Niklas,

Thank you for the patch.

On Thursday 15 Sep 2016 14:18:36 Niklas Söderlund wrote:
> The driver is maintained and supported, document it as such.
> 
> Signed-off-by: Niklas Söderlund 

Acked-by: Laurent Pinchart 

> ---
>  MAINTAINERS | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a12cd60..a4b5283 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7523,6 +7523,15 @@
> F:Documentation/devicetree/bindings/media/renesas,fcp.txt
> F:drivers/media/platform/rcar-fcp.c
>  F:   include/media/rcar-fcp.h
> 
> +MEDIA DRIVERS FOR RENESAS - VIN
> +M:   Niklas Söderlund 
> +L:   linux-media@vger.kernel.org
> +L:   linux-renesas-...@vger.kernel.org
> +T:   git git://linuxtv.org/media_tree.git
> +S:   Supported
> +F:   Documentation/devicetree/bindings/media/rcar_vin.txt
> +F:   drivers/media/platform/rcar-vin/
> +
>  MEDIA DRIVERS FOR RENESAS - VSP1
>  M:   Laurent Pinchart 
>  L:   linux-media@vger.kernel.org

-- 
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] MAINTAINERS: Add entry for the Renesas VIN driver

2016-09-15 Thread Simon Horman
On Thu, Sep 15, 2016 at 03:22:38PM +0300, Laurent Pinchart wrote:
> Hi Niklas,
> 
> Thank you for the patch.
> 
> On Thursday 15 Sep 2016 14:18:36 Niklas Söderlund wrote:
> > The driver is maintained and supported, document it as such.
> > 
> > Signed-off-by: Niklas Söderlund 
> 
> Acked-by: Laurent Pinchart 

I like this a lot:

Acked-by: Simon Horman 
--
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


solo6010 modprobe lockup since e1ceb25a (v4.3 regression)

2016-09-15 Thread Andrey Utkin
Hi Krzysztof,

Me and one more solo6010 board user experience machine lockup when
solo6x10 module is loaded on kernel series starting with 4.3 (despite
solo6110 board probes just fine on all kernels). That is, 3.16, 3.18,
4.1 and 4.2 are tested and fine, and 4.3, 4.4, and others up to current
linux-next are bad.
So regression slipped in between 4.2 and 4.3. The diff between
stable/linux-4.2.y and ...-4.3.y (which were tested) is not large, and
my suspect fell on ripoff of register writing procedures complexity,
which was introduced in e1ceb25a (see below). Reversion of that fixes
lockup.  However, if, on top of reversion of e1ceb25a, i drop barrier
stuff and pci_read_config... (see
https://github.com/bluecherrydvr/linux/commit/d59aaf3), leaving the
spinlock stuff, it locks up again.  This is a matter in which I'm not
quite qualified, so I have no idea what that code copes with and why
this workaround works for solo6010.  For now I think I'll tell the
customer to use kernel with e1ceb25a reverted, but for upstream fix, I'm
interested in more in-depth investigation. I'll be able to provide dmesg
logs a bit later.

The breaking commit is quoted below.

commit e1ceb25a1569ce5b61b9c496dd32d038ba8cb936
Author: Krzysztof Hałasa 
Date:   Mon Jun 8 10:42:24 2015 -0300

[media] SOLO6x10: remove unneeded register locking and barriers

readl() and writel() are atomic, we don't need the spin lock.
Also, flushing posted write buffer isn't required. Especially on read :-)

Signed-off-by: Krzysztof Ha?asa 
Signed-off-by: Hans Verkuil 
Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c 
b/drivers/media/pci/solo6x10/solo6x10-core.c
index 84627e6..9c948b1 100644
--- a/drivers/media/pci/solo6x10/solo6x10-core.c
+++ b/drivers/media/pci/solo6x10/solo6x10-core.c
@@ -483,7 +483,6 @@ static int solo_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
 
solo_dev->type = id->driver_data;
solo_dev->pdev = pdev;
-   spin_lock_init(_dev->reg_io_lock);
ret = v4l2_device_register(>dev, _dev->v4l2_dev);
if (ret)
goto fail_probe;
diff --git a/drivers/media/pci/solo6x10/solo6x10.h 
b/drivers/media/pci/solo6x10/solo6x10.h
index 1ca54b0..27423d7 100644
--- a/drivers/media/pci/solo6x10/solo6x10.h
+++ b/drivers/media/pci/solo6x10/solo6x10.h
@@ -199,7 +199,6 @@ struct solo_dev {
int nr_ext;
u32 irq_mask;
u32 motion_mask;
-   spinlock_t  reg_io_lock;
struct v4l2_device  v4l2_dev;
 
/* tw28xx accounting */
@@ -281,36 +280,13 @@ struct solo_dev {
 
 static inline u32 solo_reg_read(struct solo_dev *solo_dev, int reg)
 {
-   unsigned long flags;
-   u32 ret;
-   u16 val;
-
-   spin_lock_irqsave(_dev->reg_io_lock, flags);
-
-   ret = readl(solo_dev->reg_base + reg);
-   rmb();
-   pci_read_config_word(solo_dev->pdev, PCI_STATUS, );
-   rmb();
-
-   spin_unlock_irqrestore(_dev->reg_io_lock, flags);
-
-   return ret;
+   return readl(solo_dev->reg_base + reg);
 }
 
 static inline void solo_reg_write(struct solo_dev *solo_dev, int reg,
  u32 data)
 {
-   unsigned long flags;
-   u16 val;
-
-   spin_lock_irqsave(_dev->reg_io_lock, flags);
-
writel(data, solo_dev->reg_base + reg);
-   wmb();
-   pci_read_config_word(solo_dev->pdev, PCI_STATUS, );
-   rmb();
-
-   spin_unlock_irqrestore(_dev->reg_io_lock, flags);
 }
 
 static inline void solo_irq_on(struct solo_dev *dev, u32 mask)
--
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: solo6010 modprobe lockup since e1ceb25a (v4.3 regression)

2016-09-15 Thread One Thousand Gnomes
On Thu, 15 Sep 2016 16:19:52 +0300
Andrey Utkin  wrote:

> On Thu, Sep 15, 2016 at 03:15:53PM +0200, Hans Verkuil wrote:
> > It could be related to the fact that a PCI write may be delayed unless
> > it is followed by a read (see also the comments in 
> > drivers/media/pci/ivtv/ivtv-driver.h).  
> 
> Thanks for explanation!
> 
> > That was probably the reason for the pci_read_config_word in the reg_write
> > code. Try putting that back (and just that).  
> 
> In this case reg_write becomes not atomic, thus spinlock would be
> required again here, right?

No - PCI writes are ordered but may not complete until the next read or
config access. That ordering isn't affected by things like spin locking
as it is a property of the bus.

Usually this only matters in obscure cases - timing is one of them, and
the other is when freeing memory because writes are posted both ways so
you need to write to stop the transfer, read to ensure the transfer has
completed and then free the target memory.

Alan
--
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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Niklas Söderlund
Hi Ulrich,

Thanks for your patch.

Can you append another patch ontop of this one whit the following 
change:

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index ac26738..7ba728d 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -494,7 +494,7 @@ static int rvin_enum_dv_timings(struct file *file, void 
*priv_fh,
int pad, ret;
 
pad = timings->pad;
-   timings->pad = vin->src_pad_idx;
+   timings->pad = vin->sink_pad_idx;
 
ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
 
@@ -548,7 +548,7 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
int pad, ret;
 
pad = cap->pad;
-   cap->pad = vin->src_pad_idx;
+   cap->pad = vin->sink_pad_idx;
 
ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);


Whit that change the driver pass v4l2-compliance check for the HDMI 
input on Koelsch for me.

On 2016-09-15 15:24:08 +0200, Ulrich Hecht wrote:
> Adds G_EDID and S_EDID.
> 
> Signed-off-by: Ulrich Hecht 
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 
> +
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
>  2 files changed, 43 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> index 62ca7e3..f679182 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void 
> *priv_fh,
>   return ret;
>  }
>  
> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int input, ret;
> +
> + input = edid->pad;
> + edid->pad = vin->sink_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, get_edid, edid);
> +
> + edid->pad = input;
> +
> + return ret;
> +}
> +
> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int input, ret;
> +
> + input = edid->pad;
> + edid->pad = vin->sink_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, set_edid, edid);
> +
> + edid->pad = input;
> +
> + return ret;
> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_querycap= rvin_querycap,
>   .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_s_dv_timings= rvin_s_dv_timings,
>   .vidioc_query_dv_timings= rvin_query_dv_timings,
>  
> + .vidioc_g_edid  = rvin_g_edid,
> + .vidioc_s_edid  = rvin_s_edid,
> +
>   .vidioc_querystd= rvin_querystd,
>   .vidioc_g_std   = rvin_g_std,
>   .vidioc_s_std   = rvin_s_std,
> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
>   vin->src_pad_idx = pad_idx;
>   fmt.pad = vin->src_pad_idx;
>  
> + vin->sink_pad_idx = 0;
> + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> + if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
> + vin->sink_pad_idx = pad_idx;
> + break;
> + }
> +
>   /* Try to improve our guess of a reasonable window format */
>   ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
>   if (ret) {
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
> b/drivers/media/platform/rcar-vin/rcar-vin.h
> index 793184d..af815cc 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -121,6 +121,7 @@ struct rvin_dev {
>   struct video_device vdev;
>   struct v4l2_device v4l2_dev;
>   int src_pad_idx;
> + int sink_pad_idx;

sink_pad_idx should be documented in the comment above the struct. If 
you fix that feel free to add my:

Acked-by: Niklas Söderlund 

>   struct v4l2_ctrl_handler ctrl_handler;
>   struct v4l2_async_notifier notifier;
>   struct rvin_graph_entity digital;
> -- 
> 2.9.3
> 

-- 
Regards,
Niklas Söderlund
--
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.9] Add SPI GS1662 driver

2016-09-15 Thread Hans Verkuil
The following changes since commit c3b809834db8b1a8891c7ff873a216eac119628d:

  [media] pulse8-cec: fix compiler warning (2016-09-12 06:42:44 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git gs1662

for you to fetch changes up to ec2890fd887f9ec68b6e1b87ead84ea659cee0c7:

  media Kconfig: improve the spi integration (2016-09-15 17:34:33 +0200)


Charles-Antoine Couret (3):
  SDI: add flag for SDI formats and SMPTE 125M definition
  Add GS1662 driver, a video serializer
  V4L2: Add documentation for SDI timings and related flags

Hans Verkuil (1):
  media Kconfig: improve the spi integration

 Documentation/media/uapi/v4l/vidioc-enuminput.rst|  31 +++--
 Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst |  15 +++
 MAINTAINERS  |   7 ++
 drivers/media/Kconfig|   7 +-
 drivers/media/Makefile   |   2 +-
 drivers/media/i2c/Kconfig|   2 +-
 drivers/media/spi/Kconfig|  14 +++
 drivers/media/spi/Makefile   |   1 +
 drivers/media/spi/gs1662.c   | 472 
+
 drivers/media/v4l2-core/v4l2-dv-timings.c|  11 +-
 include/uapi/linux/v4l2-dv-timings.h |  12 ++
 include/uapi/linux/videodev2.h   |   8 ++
 12 files changed, 566 insertions(+), 16 deletions(-)
 create mode 100644 drivers/media/spi/Kconfig
 create mode 100644 drivers/media/spi/Makefile
 create mode 100644 drivers/media/spi/gs1662.c
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] Add Mediatek JPEG Decoder

2016-09-15 Thread Rick Chang
Hi Hans,

I have perceived the problem. I'm afraid there may be some firewalls in
my environment.To prevent too much repost mails, I will check my
environment with our expert first.Sorry for the inconvenient.

Best Regards,
Rick

On Thu, 2016-09-15 at 09:43 +0200, Hans Verkuil wrote:
> Hi Rick,
> 
> I'm not sure why, but for some reason this patch series never made it to 
> the linux-media mailinglist.
> 
> Can you repost?
> 
> Regards,
> 
>   Hans
> 
> On 09/14/2016 08:36 AM, Rick Chang wrote:
> > This series of patches provide a v4l2 driver to control Mediatek JPEG hw
> > for decoding JPEG image and Motion JPEG bitstream.
> >
> > * Dependency
> > The patch "arm: dts: mt2701: Add node for JPEG decoder" depends on:
> >   CCF "arm: dts: mt2701: Add clock controller device nodes"[1]
> >   power domain patch "Mediatek MT2701 SCPSYS power domain support v7"[2]
> >   iommu and smi "Add the dtsi node of iommu and smi for mt2701"[3]
> >
> > [1] https://patchwork.kernel.org/patch/9109081
> > [2] http://lists.infradead.org/pipermail/linux-mediatek/2016-May/005429.html
> > [3] https://patchwork.kernel.org/patch/9164013/
> >
> > * Compliance test
> > v4l2-compliance SHA   : abc1453dfe89f244dccd3460d8e1a2e3091cbadb
> >
> > Driver Info:
> > Driver name   : mtk-jpeg decode
> > Card type : mtk-jpeg decoder
> > Bus info  : platform:15004000.jpegdec
> > Driver version: 4.8.0
> > Capabilities  : 0x84204000
> > Video Memory-to-Memory Multiplanar
> > Streaming
> > Extended Pix Format
> > Device Capabilities
> > Device Caps   : 0x04204000
> > Video Memory-to-Memory Multiplanar
> > Streaming
> > Extended Pix Format
> >
> > Compliance test for device /dev/video3 (not using libv4l2):
> >
> > Required ioctls:
> > test VIDIOC_QUERYCAP: OK
> >
> > Allow for multiple opens:
> > test second video open: OK
> > test VIDIOC_QUERYCAP: OK
> > test VIDIOC_G/S_PRIORITY: OK
> > test for unlimited opens: OK
> >
> > Debug ioctls:
> > test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
> > test VIDIOC_LOG_STATUS: OK (Not Supported)
> >
> > Input ioctls:
> > test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
> > test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> > test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
> > test VIDIOC_ENUMAUDIO: OK (Not Supported)
> > test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
> > test VIDIOC_G/S_AUDIO: OK (Not Supported)
> > Inputs: 0 Audio Inputs: 0 Tuners: 0
> >
> > Output ioctls:
> > test VIDIOC_G/S_MODULATOR: OK (Not Supported)
> > test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> > test VIDIOC_ENUMAUDOUT: OK (Not Supported)
> > test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
> > test VIDIOC_G/S_AUDOUT: OK (Not Supported)
> > Outputs: 0 Audio Outputs: 0 Modulators: 0
> >
> > Input/Output configuration ioctls:
> > test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
> > test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
> > test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> > test VIDIOC_G/S_EDID: OK (Not Supported)
> >
> > Control ioctls:
> > test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported)
> > test VIDIOC_QUERYCTRL: OK (Not Supported)
> > test VIDIOC_G/S_CTRL: OK (Not Supported)
> > test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported)
> > test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported)
> > test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> > Standard Controls: 0 Private Controls: 0
> >
> > Format ioctls:
> > test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
> > test VIDIOC_G/S_PARM: OK (Not Supported)
> > test VIDIOC_G_FBUF: OK (Not Supported)
> > test VIDIOC_G_FMT: OK
> > test VIDIOC_TRY_FMT: OK
> > test VIDIOC_S_FMT: OK
> > test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> > test Cropping: OK (Not Supported)
> > test Composing: OK
> > test Scaling: OK
> >
> > Codec ioctls:
> > test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
> > test VIDIOC_G_ENC_INDEX: OK (Not Supported)
> > test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
> >
> > Buffer ioctls:
> > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
> > test VIDIOC_EXPBUF: OK
> >
> > Test input 0:
> >
> >
> > Total: 43, Succeeded: 43, Failed: 0, Warnings: 0
> >
> > Rick Chang (3):
> >   dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
> >   vcodec: mediatek: Add Mediatek JPEG Decoder Driver
> >   

Re: [PATCH v6 2/2] Add GS1662 driver, a video serializer

2016-09-15 Thread Hans Verkuil
Can you make a follow-up patch adding an entry to the MAINTAINERS file?

Thanks!

Hans

On 09/15/2016 03:51 PM, Charles-Antoine Couret wrote:
> You can read datasheet here:
> http://www.c-dis.net/media/871/GS1662_Datasheet.pdf
> 
> It's a component which supports HD and SD CEA or SDI formats
> to SDI output. It's configured through SPI bus.
> 
> GS1662 driver is implemented as v4l2 subdev.
> 
> Signed-off-by: Charles-Antoine Couret 
> ---
>  drivers/media/Kconfig  |   1 +
>  drivers/media/Makefile |   2 +-
>  drivers/media/spi/Kconfig  |   9 +
>  drivers/media/spi/Makefile |   1 +
>  drivers/media/spi/gs1662.c | 472 
> +
>  5 files changed, 484 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/media/spi/Kconfig
>  create mode 100644 drivers/media/spi/Makefile
>  create mode 100644 drivers/media/spi/gs1662.c
> 
> diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
> index a8518fb..d2fa6e7 100644
> --- a/drivers/media/Kconfig
> +++ b/drivers/media/Kconfig
> @@ -215,5 +215,6 @@ config MEDIA_ATTACH
>  source "drivers/media/i2c/Kconfig"
>  source "drivers/media/tuners/Kconfig"
>  source "drivers/media/dvb-frontends/Kconfig"
> +source "drivers/media/spi/Kconfig"
>  
>  endif # MEDIA_SUPPORT
> diff --git a/drivers/media/Makefile b/drivers/media/Makefile
> index e608bbc..75bc82e 100644
> --- a/drivers/media/Makefile
> +++ b/drivers/media/Makefile
> @@ -28,6 +28,6 @@ obj-y += rc/
>  # Finally, merge the drivers that require the core
>  #
>  
> -obj-y += common/ platform/ pci/ usb/ mmc/ firewire/
> +obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ spi/
>  obj-$(CONFIG_VIDEO_DEV) += radio/
>  
> diff --git a/drivers/media/spi/Kconfig b/drivers/media/spi/Kconfig
> new file mode 100644
> index 000..fa47c90
> --- /dev/null
> +++ b/drivers/media/spi/Kconfig
> @@ -0,0 +1,9 @@
> +if VIDEO_V4L2
> +
> +config VIDEO_GS1662
> + tristate "Gennum Serializers video"
> + depends on SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
> + ---help---
> +   Enable the GS1662 driver which serializes video streams.
> +
> +endif
> diff --git a/drivers/media/spi/Makefile b/drivers/media/spi/Makefile
> new file mode 100644
> index 000..ea64013
> --- /dev/null
> +++ b/drivers/media/spi/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_VIDEO_GS1662) += gs1662.o
> diff --git a/drivers/media/spi/gs1662.c b/drivers/media/spi/gs1662.c
> new file mode 100644
> index 000..f743423
> --- /dev/null
> +++ b/drivers/media/spi/gs1662.c
> @@ -0,0 +1,472 @@
> +/*
> + * GS1662 device registration.
> + *
> + * Copyright (C) 2015-2016 Nexvision
> + * Author: Charles-Antoine Couret 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define REG_STATUS   0x04
> +#define REG_FORCE_FMT0x06
> +#define REG_LINES_PER_FRAME  0x12
> +#define REG_WORDS_PER_LINE   0x13
> +#define REG_WORDS_PER_ACT_LINE   0x14
> +#define REG_ACT_LINES_PER_FRAME  0x15
> +
> +#define MASK_H_LOCK  0x001
> +#define MASK_V_LOCK  0x002
> +#define MASK_STD_LOCK0x004
> +#define MASK_FORCE_STD   0x020
> +#define MASK_STD_STATUS  0x3E0
> +
> +#define GS_WIDTH_MIN 720
> +#define GS_WIDTH_MAX 2048
> +#define GS_HEIGHT_MIN487
> +#define GS_HEIGHT_MAX1080
> +#define GS_PIXELCLOCK_MIN10519200
> +#define GS_PIXELCLOCK_MAX7425
> +
> +struct gs {
> + struct spi_device *pdev;
> + struct v4l2_subdev sd;
> + struct v4l2_dv_timings current_timings;
> + int enabled;
> +};
> +
> +struct gs_reg_fmt {
> + u16 reg_value;
> + struct v4l2_dv_timings format;
> +};
> +
> +struct gs_reg_fmt_custom {
> + u16 reg_value;
> + __u32 width;
> + __u32 height;
> + __u64 pixelclock;
> + __u32 interlaced;
> +};
> +
> +static const struct spi_device_id gs_id[] = {
> + { "gs1662", 0 },
> + { }
> +};
> +MODULE_DEVICE_TABLE(spi, gs_id);
> +
> +static const struct v4l2_dv_timings fmt_cap[] = {
> + V4L2_DV_BT_SDI_720X487I60,
> + V4L2_DV_BT_CEA_720X576P50,
> + V4L2_DV_BT_CEA_1280X720P24,
> + V4L2_DV_BT_CEA_1280X720P25,
> + V4L2_DV_BT_CEA_1280X720P30,
> + V4L2_DV_BT_CEA_1280X720P50,
> + V4L2_DV_BT_CEA_1280X720P60,
> + V4L2_DV_BT_CEA_1920X1080P24,
> + V4L2_DV_BT_CEA_1920X1080P25,
> + 

[PATCH v7 0/2] Add GS1662 driver

2016-09-15 Thread Charles-Antoine Couret
These patches add a driver for GS1662 component, a video serializer which
supports CEA and SDI timings.
To perform that, we need to determine SDI definition and some flags.

The associated documentation will be into another patchset to be
Sphinx comaptible.

This patchset add:
* driver in the MAINTAINERS file

Charles-Antoine Couret (2):
  SDI: add flag for SDI formats and SMPTE 125M definition
  Add GS1662 driver, a video serializer

 MAINTAINERS   |   7 +
 drivers/media/Kconfig |   1 +
 drivers/media/Makefile|   2 +-
 drivers/media/spi/Kconfig |   9 +
 drivers/media/spi/Makefile|   1 +
 drivers/media/spi/gs1662.c| 472 ++
 drivers/media/v4l2-core/v4l2-dv-timings.c |  11 +-
 include/uapi/linux/v4l2-dv-timings.h  |  12 +
 include/uapi/linux/videodev2.h|   8 +
 9 files changed, 518 insertions(+), 5 deletions(-)
 create mode 100644 drivers/media/spi/Kconfig
 create mode 100644 drivers/media/spi/Makefile
 create mode 100644 drivers/media/spi/gs1662.c

-- 
2.7.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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Laurent Pinchart
Hi Ulrich,

Thank you for the patch.

On Thursday 15 Sep 2016 15:24:08 Ulrich Hecht wrote:
> Adds G_EDID and S_EDID.
> 
> Signed-off-by: Ulrich Hecht 
> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 ++
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
>  2 files changed, 43 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 62ca7e3..f679182 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void
> *priv_fh, return ret;
>  }
> 
> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int input, ret;
> +
> + input = edid->pad;
> + edid->pad = vin->sink_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, get_edid, edid);
> +
> + edid->pad = input;
> +
> + return ret;
> +}
> +
> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int input, ret;
> +
> + input = edid->pad;
> + edid->pad = vin->sink_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, set_edid, edid);
> +
> + edid->pad = input;
> +
> + return ret;
> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_querycap= rvin_querycap,
>   .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_s_dv_timings= rvin_s_dv_timings,
>   .vidioc_query_dv_timings= rvin_query_dv_timings,
> 
> + .vidioc_g_edid  = rvin_g_edid,
> + .vidioc_s_edid  = rvin_s_edid,
> +
>   .vidioc_querystd= rvin_querystd,
>   .vidioc_g_std   = rvin_g_std,
>   .vidioc_s_std   = rvin_s_std,
> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
>   vin->src_pad_idx = pad_idx;
>   fmt.pad = vin->src_pad_idx;
> 
> + vin->sink_pad_idx = 0;
> + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> + if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
> + vin->sink_pad_idx = pad_idx;
> + break;
> + }
> +

What if the subdev has multiple sink pads ? Shouldn't the pad number be 
instead computed in the get and set EDID handlers based on the input number 
passed in the struct v4l2_edid::pad field ?

>   /* Try to improve our guess of a reasonable window format */
>   ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
>   if (ret) {
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..af815cc 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -121,6 +121,7 @@ struct rvin_dev {
>   struct video_device vdev;
>   struct v4l2_device v4l2_dev;
>   int src_pad_idx;
> + int sink_pad_idx;
>   struct v4l2_ctrl_handler ctrl_handler;
>   struct v4l2_async_notifier notifier;
>   struct rvin_graph_entity digital;

-- 
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 v8 1/2] media: adv7604: automatic "default-input" selection

2016-09-15 Thread Laurent Pinchart
Hi Ulrich,

Thank you for the patch.

On Thursday 15 Sep 2016 15:24:07 Ulrich Hecht wrote:
> Fall back to input 0 if "default-input" property is not present.
> 
> Additionally, documentation in commit bf9c82278c34 ("[media]
> media: adv7604: ability to read default input port from DT") states
> that the "default-input" property should reside directly in the node
> for adv7612.

Actually it doesn't. The DT bindings specifies "default-input" as an endpoint 
property, even though the example sets it in the device node. That's 
inconsistent so the DT bindings document should be fixed. I believe the 
property should be set in the device node, it doesn't make much sense to have 
different default inputs per port.

> Hence, also adjust the parsing to make the implementation
> consistent with this.
> 
> Based on patch by William Towle .
> 
> Signed-off-by: Ulrich Hecht 
> ---
>  drivers/media/i2c/adv7604.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 4003831..055c9df 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state
> *state) if (!of_property_read_u32(endpoint, "default-input", ))
>   state->pdata.default_input = v;
>   else
> - state->pdata.default_input = -1;
> + state->pdata.default_input = 0;
> 
>   of_node_put(endpoint);
> 
> + if (!of_property_read_u32(np, "default-input", ))
> + state->pdata.default_input = v;
> +
>   flags = bus_cfg.bus.parallel.flags;
> 
>   if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)

-- 
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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Hans Verkuil


On 09/15/2016 06:47 PM, Laurent Pinchart wrote:
> Hi Ulrich,
> 
> Thank you for the patch.
> 
> On Thursday 15 Sep 2016 15:24:08 Ulrich Hecht wrote:
>> Adds G_EDID and S_EDID.
>>
>> Signed-off-by: Ulrich Hecht 
>> ---
>>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 ++
>>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
>>  2 files changed, 43 insertions(+)
>>
>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 62ca7e3..f679182 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void
>> *priv_fh, return ret;
>>  }
>>
>> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>> +{
>> +struct rvin_dev *vin = video_drvdata(file);
>> +struct v4l2_subdev *sd = vin_to_source(vin);
>> +int input, ret;
>> +
>> +input = edid->pad;
>> +edid->pad = vin->sink_pad_idx;
>> +
>> +ret = v4l2_subdev_call(sd, pad, get_edid, edid);
>> +
>> +edid->pad = input;
>> +
>> +return ret;
>> +}
>> +
>> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>> +{
>> +struct rvin_dev *vin = video_drvdata(file);
>> +struct v4l2_subdev *sd = vin_to_source(vin);
>> +int input, ret;
>> +
>> +input = edid->pad;
>> +edid->pad = vin->sink_pad_idx;
>> +
>> +ret = v4l2_subdev_call(sd, pad, set_edid, edid);
>> +
>> +edid->pad = input;
>> +
>> +return ret;
>> +}
>> +
>>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>  .vidioc_querycap= rvin_querycap,
>>  .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
>> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>  .vidioc_s_dv_timings= rvin_s_dv_timings,
>>  .vidioc_query_dv_timings= rvin_query_dv_timings,
>>
>> +.vidioc_g_edid  = rvin_g_edid,
>> +.vidioc_s_edid  = rvin_s_edid,
>> +
>>  .vidioc_querystd= rvin_querystd,
>>  .vidioc_g_std   = rvin_g_std,
>>  .vidioc_s_std   = rvin_s_std,
>> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
>>  vin->src_pad_idx = pad_idx;
>>  fmt.pad = vin->src_pad_idx;
>>
>> +vin->sink_pad_idx = 0;
>> +for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
>> +if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
>> +vin->sink_pad_idx = pad_idx;
>> +break;
>> +}
>> +
> 
> What if the subdev has multiple sink pads ? Shouldn't the pad number be 
> instead computed in the get and set EDID handlers based on the input number 
> passed in the struct v4l2_edid::pad field ?

But there is only one input (VIDIOC_ENUM_INPUT), so this would not make sense.

What is wrong is that g/s_edid should check the pad and return -EINVAL if it
is non-zero. Odd that I missed that in the earlier reviews...

Regards,

Hans

> 
>>  /* Try to improve our guess of a reasonable window format */
>>  ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
>>  if (ret) {
>> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
>> b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..af815cc 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
>> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
>> @@ -121,6 +121,7 @@ struct rvin_dev {
>>  struct video_device vdev;
>>  struct v4l2_device v4l2_dev;
>>  int src_pad_idx;
>> +int sink_pad_idx;
>>  struct v4l2_ctrl_handler ctrl_handler;
>>  struct v4l2_async_notifier notifier;
>>  struct rvin_graph_entity digital;
> 
--
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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Hans Verkuil
I've added patch v8 1/2 here as well. All I need is a correct patch 2/2 on top 
of
this. If you can do this tomorrow morning, then it will get into 4.9.

Hans

On 09/15/2016 04:02 PM, Hans Verkuil wrote:
> Hi Ulrich,
> 
> A patch series on top of my tree with Niklas' patches already merged:
> 
> https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=rcar
> 
> would be ideal. Since otherwise I have to resolve a conflict.
> 
> Regards,
> 
>   Hans
> 
> On 09/15/2016 03:59 PM, Niklas Söderlund wrote:
>> Hi Ulrich,
>>
>> Thanks for your patch.
>>
>> Can you append another patch ontop of this one whit the following 
>> change:
>>
>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
>> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> index ac26738..7ba728d 100644
>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>> @@ -494,7 +494,7 @@ static int rvin_enum_dv_timings(struct file *file, void 
>> *priv_fh,
>> int pad, ret;
>>  
>> pad = timings->pad;
>> -   timings->pad = vin->src_pad_idx;
>> +   timings->pad = vin->sink_pad_idx;
>>  
>> ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
>>  
>> @@ -548,7 +548,7 @@ static int rvin_dv_timings_cap(struct file *file, void 
>> *priv_fh,
>> int pad, ret;
>>  
>> pad = cap->pad;
>> -   cap->pad = vin->src_pad_idx;
>> +   cap->pad = vin->sink_pad_idx;
>>  
>> ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
>>
>>
>> Whit that change the driver pass v4l2-compliance check for the HDMI 
>> input on Koelsch for me.
>>
>> On 2016-09-15 15:24:08 +0200, Ulrich Hecht wrote:
>>> Adds G_EDID and S_EDID.
>>>
>>> Signed-off-by: Ulrich Hecht 
>>> ---
>>>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 
>>> +
>>>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
>>>  2 files changed, 43 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
>>> b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>>> index 62ca7e3..f679182 100644
>>> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
>>> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
>>> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void 
>>> *priv_fh,
>>> return ret;
>>>  }
>>>  
>>> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>>> +{
>>> +   struct rvin_dev *vin = video_drvdata(file);
>>> +   struct v4l2_subdev *sd = vin_to_source(vin);
>>> +   int input, ret;
>>> +
>>> +   input = edid->pad;
>>> +   edid->pad = vin->sink_pad_idx;
>>> +
>>> +   ret = v4l2_subdev_call(sd, pad, get_edid, edid);
>>> +
>>> +   edid->pad = input;
>>> +
>>> +   return ret;
>>> +}
>>> +
>>> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
>>> +{
>>> +   struct rvin_dev *vin = video_drvdata(file);
>>> +   struct v4l2_subdev *sd = vin_to_source(vin);
>>> +   int input, ret;
>>> +
>>> +   input = edid->pad;
>>> +   edid->pad = vin->sink_pad_idx;
>>> +
>>> +   ret = v4l2_subdev_call(sd, pad, set_edid, edid);
>>> +
>>> +   edid->pad = input;
>>> +
>>> +   return ret;
>>> +}
>>> +
>>>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>> .vidioc_querycap= rvin_querycap,
>>> .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
>>> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>>> .vidioc_s_dv_timings= rvin_s_dv_timings,
>>> .vidioc_query_dv_timings= rvin_query_dv_timings,
>>>  
>>> +   .vidioc_g_edid  = rvin_g_edid,
>>> +   .vidioc_s_edid  = rvin_s_edid,
>>> +
>>> .vidioc_querystd= rvin_querystd,
>>> .vidioc_g_std   = rvin_g_std,
>>> .vidioc_s_std   = rvin_s_std,
>>> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
>>> vin->src_pad_idx = pad_idx;
>>> fmt.pad = vin->src_pad_idx;
>>>  
>>> +   vin->sink_pad_idx = 0;
>>> +   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
>>> +   if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
>>> +   vin->sink_pad_idx = pad_idx;
>>> +   break;
>>> +   }
>>> +
>>> /* Try to improve our guess of a reasonable window format */
>>> ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
>>> if (ret) {
>>> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
>>> b/drivers/media/platform/rcar-vin/rcar-vin.h
>>> index 793184d..af815cc 100644
>>> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
>>> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
>>> @@ -121,6 +121,7 @@ struct rvin_dev {
>>> struct video_device vdev;
>>> struct v4l2_device v4l2_dev;
>>> int src_pad_idx;
>>> +   int sink_pad_idx;
>>
>> sink_pad_idx should be documented in the comment above the struct. If 
>> you fix that feel free to add my:
>>
>> Acked-by: Niklas 

[PATCH] media Kconfig: improve the spi integration

2016-09-15 Thread Hans Verkuil
The SPI driver looked a bit lonely in the config menu, and it didn't
support the autoselect. Shift things around a bit so it looks more logical.

Signed-off-by: Hans Verkuil 
---
Note: this patch sits on top of the gs1662 patch series.
---
 drivers/media/Kconfig | 8 
 drivers/media/i2c/Kconfig | 2 +-
 drivers/media/spi/Kconfig | 5 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 6600e59..7b85402 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -180,14 +180,14 @@ source "drivers/media/firewire/Kconfig"
 # Common driver options
 source "drivers/media/common/Kconfig"

-comment "Media ancillary drivers (tuners, sensors, i2c, frontends)"
+comment "Media ancillary drivers (tuners, sensors, i2c, spi, frontends)"

 #
-# Ancillary drivers (tuners, i2c, frontends)
+# Ancillary drivers (tuners, i2c, spi, frontends)
 #

 config MEDIA_SUBDRV_AUTOSELECT
-   bool "Autoselect ancillary drivers (tuners, sensors, i2c, frontends)"
+   bool "Autoselect ancillary drivers (tuners, sensors, i2c, spi, 
frontends)"
depends on MEDIA_ANALOG_TV_SUPPORT || MEDIA_DIGITAL_TV_SUPPORT || 
MEDIA_CAMERA_SUPPORT || MEDIA_SDR_SUPPORT
depends on HAS_IOMEM
select I2C
@@ -216,8 +216,8 @@ config MEDIA_ATTACH
default MODULES

 source "drivers/media/i2c/Kconfig"
+source "drivers/media/spi/Kconfig"
 source "drivers/media/tuners/Kconfig"
 source "drivers/media/dvb-frontends/Kconfig"
-source "drivers/media/spi/Kconfig"

 endif # MEDIA_SUPPORT
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 7f92933..2669b4b 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -21,7 +21,7 @@ config VIDEO_IR_I2C
 # Encoder / Decoder module configuration
 #

-menu "Encoders, decoders, sensors and other helper chips"
+menu "I2C Encoders, decoders, sensors and other helper chips"
visible if !MEDIA_SUBDRV_AUTOSELECT || COMPILE_TEST

 comment "Audio decoders, processors and mixers"
diff --git a/drivers/media/spi/Kconfig b/drivers/media/spi/Kconfig
index fa47c90..a21f5a3 100644
--- a/drivers/media/spi/Kconfig
+++ b/drivers/media/spi/Kconfig
@@ -1,9 +1,14 @@
 if VIDEO_V4L2

+menu "SPI helper chips"
+   visible if !MEDIA_SUBDRV_AUTOSELECT || COMPILE_TEST
+
 config VIDEO_GS1662
tristate "Gennum Serializers video"
depends on SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
---help---
  Enable the GS1662 driver which serializes video streams.

+endmenu
+
 endif
-- 
2.8.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 v3] V4L2: Add documentation for SDI timings and related flags

2016-09-15 Thread Charles-Antoine Couret
Describe new needed constants defined by SDI format.

Signed-off-by: Charles-Antoine Couret 
---
 Documentation/media/uapi/v4l/vidioc-enuminput.rst  | 31 +-
 .../media/uapi/v4l/vidioc-g-dv-timings.rst | 15 +++
 2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/Documentation/media/uapi/v4l/vidioc-enuminput.rst 
b/Documentation/media/uapi/v4l/vidioc-enuminput.rst
index 5060f54..18331b9 100644
--- a/Documentation/media/uapi/v4l/vidioc-enuminput.rst
+++ b/Documentation/media/uapi/v4l/vidioc-enuminput.rst
@@ -260,17 +260,34 @@ at index zero, incrementing by one until the driver 
returns ``EINVAL``.
 
 -  .. row 11
 
-   -  :cspan:`2` Digital Video
+   -  ``V4L2_IN_ST_NO_V_LOCK``
+
+   -  0x0400
+
+   -  No vertical sync lock.
 
 -  .. row 12
 
+   -  ``V4L2_IN_ST_NO_STD_LOCK``
+
+   -  0x0800
+
+   -  No standard format lock in case of auto-detection format
+ by the component.
+
+-  .. row 13
+
+   -  :cspan:`2` Digital Video
+
+-  .. row 14
+
-  ``V4L2_IN_ST_NO_SYNC``
 
-  0x0001
 
-  No synchronization lock.
 
--  .. row 13
+-  .. row 15
 
-  ``V4L2_IN_ST_NO_EQU``
 
@@ -278,7 +295,7 @@ at index zero, incrementing by one until the driver returns 
``EINVAL``.
 
-  No equalizer lock.
 
--  .. row 14
+-  .. row 16
 
-  ``V4L2_IN_ST_NO_CARRIER``
 
@@ -286,11 +303,11 @@ at index zero, incrementing by one until the driver 
returns ``EINVAL``.
 
-  Carrier recovery failed.
 
--  .. row 15
+-  .. row 17
 
-  :cspan:`2` VCR and Set-Top Box
 
--  .. row 16
+-  .. row 18
 
-  ``V4L2_IN_ST_MACROVISION``
 
@@ -300,7 +317,7 @@ at index zero, incrementing by one until the driver returns 
``EINVAL``.
  signal to confuse video recorders. When this flag is set
  Macrovision has been detected.
 
--  .. row 17
+-  .. row 19
 
-  ``V4L2_IN_ST_NO_ACCESS``
 
@@ -308,7 +325,7 @@ at index zero, incrementing by one until the driver returns 
``EINVAL``.
 
-  Conditional access denied.
 
--  .. row 18
+-  .. row 20
 
-  ``V4L2_IN_ST_VTR``
 
diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst 
b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
index f7bf21f..9acfa19 100644
--- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
+++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
@@ -339,6 +339,13 @@ EBUSY
 
-  The timings follow the VESA Generalized Timings Formula standard
 
+-  .. row 7
+
+   -  ``V4L2_DV_BT_STD_SDI``
+
+   -  The timings follow the SDI Timings standard.
+ There are no horizontal syncs/porches at all in this format.
+ Total blanking timings must be set in hsync or vsync fields only.
 
 
 .. _dv-bt-flags:
@@ -415,3 +422,11 @@ EBUSY
  R'G'B' values use limited range (i.e. 16-235) as opposed to full
  range (i.e. 0-255). All formats defined in CEA-861 except for the
  640x480p59.94 format are CE formats.
+
+-  .. row 8
+
+   -  ``V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE``
+
+   -  Some formats like SMPTE-125M have an interlaced signal with a odd
+ total height. For these formats, if this flag is set, the first
+ field has the extra line. Else, it is the second field.
-- 
2.7.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 v7 2/2] Add GS1662 driver, a video serializer

2016-09-15 Thread Charles-Antoine Couret
You can read datasheet here:
http://www.c-dis.net/media/871/GS1662_Datasheet.pdf

It's a component which supports HD and SD CEA or SDI formats
to SDI output. It's configured through SPI bus.

GS1662 driver is implemented as v4l2 subdev.

Signed-off-by: Charles-Antoine Couret 
---
 MAINTAINERS|   7 +
 drivers/media/Kconfig  |   1 +
 drivers/media/Makefile |   2 +-
 drivers/media/spi/Kconfig  |   9 +
 drivers/media/spi/Makefile |   1 +
 drivers/media/spi/gs1662.c | 472 +
 6 files changed, 491 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/spi/Kconfig
 create mode 100644 drivers/media/spi/Makefile
 create mode 100644 drivers/media/spi/gs1662.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 8c20323..2bfbf9d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5147,6 +5147,13 @@ L:   net...@vger.kernel.org
 S: Maintained
 F: drivers/net/ethernet/aeroflex/
 
+GS1662 VIDEO SERIALIZER
+M: Charles-Antoine Couret 
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/spi/gs1662.c
+
 GSPCA FINEPIX SUBDRIVER
 M: Frank Zago 
 L: linux-media@vger.kernel.org
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index a8518fb..d2fa6e7 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -215,5 +215,6 @@ config MEDIA_ATTACH
 source "drivers/media/i2c/Kconfig"
 source "drivers/media/tuners/Kconfig"
 source "drivers/media/dvb-frontends/Kconfig"
+source "drivers/media/spi/Kconfig"
 
 endif # MEDIA_SUPPORT
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index e608bbc..75bc82e 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -28,6 +28,6 @@ obj-y += rc/
 # Finally, merge the drivers that require the core
 #
 
-obj-y += common/ platform/ pci/ usb/ mmc/ firewire/
+obj-y += common/ platform/ pci/ usb/ mmc/ firewire/ spi/
 obj-$(CONFIG_VIDEO_DEV) += radio/
 
diff --git a/drivers/media/spi/Kconfig b/drivers/media/spi/Kconfig
new file mode 100644
index 000..fa47c90
--- /dev/null
+++ b/drivers/media/spi/Kconfig
@@ -0,0 +1,9 @@
+if VIDEO_V4L2
+
+config VIDEO_GS1662
+   tristate "Gennum Serializers video"
+   depends on SPI && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ Enable the GS1662 driver which serializes video streams.
+
+endif
diff --git a/drivers/media/spi/Makefile b/drivers/media/spi/Makefile
new file mode 100644
index 000..ea64013
--- /dev/null
+++ b/drivers/media/spi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_VIDEO_GS1662) += gs1662.o
diff --git a/drivers/media/spi/gs1662.c b/drivers/media/spi/gs1662.c
new file mode 100644
index 000..f743423
--- /dev/null
+++ b/drivers/media/spi/gs1662.c
@@ -0,0 +1,472 @@
+/*
+ * GS1662 device registration.
+ *
+ * Copyright (C) 2015-2016 Nexvision
+ * Author: Charles-Antoine Couret 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define REG_STATUS 0x04
+#define REG_FORCE_FMT  0x06
+#define REG_LINES_PER_FRAME0x12
+#define REG_WORDS_PER_LINE 0x13
+#define REG_WORDS_PER_ACT_LINE 0x14
+#define REG_ACT_LINES_PER_FRAME0x15
+
+#define MASK_H_LOCK0x001
+#define MASK_V_LOCK0x002
+#define MASK_STD_LOCK  0x004
+#define MASK_FORCE_STD 0x020
+#define MASK_STD_STATUS0x3E0
+
+#define GS_WIDTH_MIN   720
+#define GS_WIDTH_MAX   2048
+#define GS_HEIGHT_MIN  487
+#define GS_HEIGHT_MAX  1080
+#define GS_PIXELCLOCK_MIN  10519200
+#define GS_PIXELCLOCK_MAX  7425
+
+struct gs {
+   struct spi_device *pdev;
+   struct v4l2_subdev sd;
+   struct v4l2_dv_timings current_timings;
+   int enabled;
+};
+
+struct gs_reg_fmt {
+   u16 reg_value;
+   struct v4l2_dv_timings format;
+};
+
+struct gs_reg_fmt_custom {
+   u16 reg_value;
+   __u32 width;
+   __u32 height;
+   __u64 pixelclock;
+   __u32 interlaced;
+};
+
+static const struct spi_device_id gs_id[] = {
+   { "gs1662", 0 },
+   { }
+};
+MODULE_DEVICE_TABLE(spi, gs_id);
+
+static const struct v4l2_dv_timings fmt_cap[] = {
+   V4L2_DV_BT_SDI_720X487I60,
+   V4L2_DV_BT_CEA_720X576P50,
+   V4L2_DV_BT_CEA_1280X720P24,
+   V4L2_DV_BT_CEA_1280X720P25,
+   V4L2_DV_BT_CEA_1280X720P30,
+   

[PATCH v7 1/2] SDI: add flag for SDI formats and SMPTE 125M definition

2016-09-15 Thread Charles-Antoine Couret
Adding others generic flags, which could be used by many
components like GS1662.

Signed-off-by: Charles-Antoine Couret 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 11 +++
 include/uapi/linux/v4l2-dv-timings.h  | 12 
 include/uapi/linux/videodev2.h|  8 
 3 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 889de0a..730a7c3 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -306,7 +306,7 @@ void v4l2_print_dv_timings(const char *dev_prefix, const 
char *prefix,
(bt->polarities & V4L2_DV_VSYNC_POS_POL) ? "+" : "-",
bt->il_vsync, bt->il_vbackporch);
pr_info("%s: pixelclock: %llu\n", dev_prefix, bt->pixelclock);
-   pr_info("%s: flags (0x%x):%s%s%s%s%s%s\n", dev_prefix, bt->flags,
+   pr_info("%s: flags (0x%x):%s%s%s%s%s%s%s\n", dev_prefix, bt->flags,
(bt->flags & V4L2_DV_FL_REDUCED_BLANKING) ?
" REDUCED_BLANKING" : "",
((bt->flags & V4L2_DV_FL_REDUCED_BLANKING) &&
@@ -318,12 +318,15 @@ void v4l2_print_dv_timings(const char *dev_prefix, const 
char *prefix,
(bt->flags & V4L2_DV_FL_HALF_LINE) ?
" HALF_LINE" : "",
(bt->flags & V4L2_DV_FL_IS_CE_VIDEO) ?
-   " CE_VIDEO" : "");
-   pr_info("%s: standards (0x%x):%s%s%s%s\n", dev_prefix, bt->standards,
+   " CE_VIDEO" : "",
+   (bt->flags & V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) ?
+   " FIRST_FIELD_EXTRA_LINE" : "");
+   pr_info("%s: standards (0x%x):%s%s%s%s%s\n", dev_prefix, bt->standards,
(bt->standards & V4L2_DV_BT_STD_CEA861) ?  " CEA" : "",
(bt->standards & V4L2_DV_BT_STD_DMT) ?  " DMT" : "",
(bt->standards & V4L2_DV_BT_STD_CVT) ?  " CVT" : "",
-   (bt->standards & V4L2_DV_BT_STD_GTF) ?  " GTF" : "");
+   (bt->standards & V4L2_DV_BT_STD_GTF) ?  " GTF" : "",
+   (bt->standards & V4L2_DV_BT_STD_SDI) ?  " SDI" : "");
 }
 EXPORT_SYMBOL_GPL(v4l2_print_dv_timings);
 
diff --git a/include/uapi/linux/v4l2-dv-timings.h 
b/include/uapi/linux/v4l2-dv-timings.h
index 086168e..f319571 100644
--- a/include/uapi/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
@@ -934,4 +934,16 @@
V4L2_DV_FL_REDUCED_BLANKING) \
 }
 
+/* SDI timings definitions */
+
+/* SMPTE-125M */
+#define V4L2_DV_BT_SDI_720X487I60 { \
+   .type = V4L2_DV_BT_656_1120, \
+   V4L2_INIT_BT_TIMINGS(720, 487, 1, \
+   V4L2_DV_HSYNC_POS_POL, \
+   1350, 16, 121, 0, 0, 19, 0, 0, 19, 0, \
+   V4L2_DV_BT_STD_SDI, \
+   V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE) \
+}
+
 #endif
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 8f95191..37126a4 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1259,6 +1259,7 @@ struct v4l2_bt_timings {
 #define V4L2_DV_BT_STD_DMT (1 << 1)  /* VESA Discrete Monitor Timings */
 #define V4L2_DV_BT_STD_CVT (1 << 2)  /* VESA Coordinated Video Timings */
 #define V4L2_DV_BT_STD_GTF (1 << 3)  /* VESA Generalized Timings Formula */
+#define V4L2_DV_BT_STD_SDI (1 << 4)  /* SDI Timings */
 
 /* Flags */
 
@@ -1290,6 +1291,11 @@ struct v4l2_bt_timings {
  * use the range 16-235) as opposed to 0-255. All formats defined in CEA-861
  * except for the 640x480 format are CE formats. */
 #define V4L2_DV_FL_IS_CE_VIDEO (1 << 4)
+/* Some formats like SMPTE-125M have an interlaced signal with a odd
+ * total height. For these formats, if this flag is set, the first
+ * field has the extra line. If not, it is the second field.
+ */
+#define V4L2_DV_FL_FIRST_FIELD_EXTRA_LINE  (1 << 5)
 
 /* A few useful defines to calculate the total blanking and frame sizes */
 #define V4L2_DV_BT_BLANKING_WIDTH(bt) \
@@ -1413,6 +1419,8 @@ struct v4l2_input {
 /* field 'status' - analog */
 #define V4L2_IN_ST_NO_H_LOCK   0x0100  /* No horizontal sync lock */
 #define V4L2_IN_ST_COLOR_KILL  0x0200  /* Color killer is active */
+#define V4L2_IN_ST_NO_V_LOCK   0x0400  /* No vertical sync lock */
+#define V4L2_IN_ST_NO_STD_LOCK 0x0800  /* No standard format lock */
 
 /* field 'status' - digital */
 #define V4L2_IN_ST_NO_SYNC 0x0001  /* No synchronization lock */
-- 
2.7.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 v9 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Hans Verkuil


On 09/15/2016 07:33 PM, Ulrich Hecht wrote:
> Hi!
> 
> This revision sits on top of Hans's rcar branch and adds pad sanity checks
> for g_edid and s_edid, the sink pad fix for the DV timings suggested by
> Niklas, and documents sink_pad_idx. Good night!
> 
> CU
> Uli
> 
> 
> Changes since v8:
> - dumped merged default-input patch

I've 'unmerged' this due to a comment from Laurent.

Can you look at Laurent's reply?

Hans

> - added pad sanity check
> - added DV timings sink pad fix
> - documented sink_pad_idx
> - added Acked-By
> 
> Changes since v7:
> - do not fail if there is no sink pad
> 
> Changes since v6:
> - work without subdev abstraction layer
> - split off DT parts, to be handled separately
> 
> Changes since v5:
> - implement vin/subdev pad translation
> - move i2c devices
> 
> Changes since v4:
> - drop merged patches
> - adv7604: always fall back to input 0 if nothing else is specified
> - rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob
> 
> Changes since v3:
> - rvin_enum_dv_timings(): use vin->src_pad_idx
> - rvin_dv_timings_cap(): likewise
> - rvin_s_dv_timings(): update vin->format
> - add Koelsch support
> 
> Changes since v2:
> - rebased on top of rcar-vin driver v4
> - removed "adv7604: fix SPA register location for ADV7612" (picked up)
> - changed prefix of dts patch to "ARM: dts: lager: "
> 
> 
> Ulrich Hecht (2):
>   rcar-vin: implement EDID control ioctls
>   media: rcar-vin: use sink pad index for DV timings
> 
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 52 
> +++--
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
>  2 files changed, 52 insertions(+), 2 deletions(-)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v9 1/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Adds G_EDID and S_EDID.

Signed-off-by: Ulrich Hecht 
Acked-by: Niklas Söderlund 
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 50 insertions(+)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 61e9b59..f35005c 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
return ret;
 }
 
+static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   if (edid->pad)
+   return -EINVAL;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, get_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
+static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
+{
+   struct rvin_dev *vin = video_drvdata(file);
+   struct v4l2_subdev *sd = vin_to_source(vin);
+   int input, ret;
+
+   if (edid->pad)
+   return -EINVAL;
+
+   input = edid->pad;
+   edid->pad = vin->sink_pad_idx;
+
+   ret = v4l2_subdev_call(sd, pad, set_edid, edid);
+
+   edid->pad = input;
+
+   return ret;
+}
+
 static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_querycap= rvin_querycap,
.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
@@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
.vidioc_s_dv_timings= rvin_s_dv_timings,
.vidioc_query_dv_timings= rvin_query_dv_timings,
 
+   .vidioc_g_edid  = rvin_g_edid,
+   .vidioc_s_edid  = rvin_s_edid,
+
.vidioc_querystd= rvin_querystd,
.vidioc_g_std   = rvin_g_std,
.vidioc_s_std   = rvin_s_std,
@@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
 
vin->src_pad_idx = pad_idx;
 
+   vin->sink_pad_idx = 0;
+   for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
+   if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
+   vin->sink_pad_idx = pad_idx;
+   break;
+   }
+
vin->format.pixelformat = RVIN_DEFAULT_FORMAT;
rvin_reset_format(vin);
 
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h 
b/drivers/media/platform/rcar-vin/rcar-vin.h
index 793184d..727e215 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -92,6 +92,7 @@ struct rvin_graph_entity {
  * @vdev:  V4L2 video device associated with VIN
  * @v4l2_dev:  V4L2 device
  * @src_pad_idx:   source pad index for media controller drivers
+ * @sink_pad_idx:  sink pad index for media controller drivers
  * @ctrl_handler:  V4L2 control handler
  * @notifier:  V4L2 asynchronous subdevs notifier
  * @digital:   entity in the DT for local digital subdevice
@@ -121,6 +122,7 @@ struct rvin_dev {
struct video_device vdev;
struct v4l2_device v4l2_dev;
int src_pad_idx;
+   int sink_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity digital;
-- 
2.9.3

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


[PATCH v9 2/2] media: rcar-vin: use sink pad index for DV timings

2016-09-15 Thread Ulrich Hecht
Signed-off-by: Ulrich Hecht 
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index f35005c..2bbe6d4 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -550,7 +550,7 @@ static int rvin_enum_dv_timings(struct file *file, void 
*priv_fh,
int pad, ret;
 
pad = timings->pad;
-   timings->pad = vin->src_pad_idx;
+   timings->pad = vin->sink_pad_idx;
 
ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
 
@@ -604,7 +604,7 @@ static int rvin_dv_timings_cap(struct file *file, void 
*priv_fh,
int pad, ret;
 
pad = cap->pad;
-   cap->pad = vin->src_pad_idx;
+   cap->pad = vin->sink_pad_idx;
 
ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
 
-- 
2.9.3

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


Re: [PATCH v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Laurent Pinchart
Hi Hans,

On Thursday 15 Sep 2016 19:01:06 Hans Verkuil wrote:
> On 09/15/2016 06:47 PM, Laurent Pinchart wrote:
> > On Thursday 15 Sep 2016 15:24:08 Ulrich Hecht wrote:
> >> Adds G_EDID and S_EDID.
> >> 
> >> Signed-off-by: Ulrich Hecht 
> >> ---
> >> 
> >>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 +++
> >>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
> >>  2 files changed, 43 insertions(+)
> >> 
> >> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> >> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 62ca7e3..f679182
> >> 100644
> >> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> >> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> >> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file,
> >> void *priv_fh, return ret;
> >>  }
> >> 
> >> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid
> >> *edid) +{
> >> +  struct rvin_dev *vin = video_drvdata(file);
> >> +  struct v4l2_subdev *sd = vin_to_source(vin);
> >> +  int input, ret;
> >> +
> >> +  input = edid->pad;
> >> +  edid->pad = vin->sink_pad_idx;
> >> +
> >> +  ret = v4l2_subdev_call(sd, pad, get_edid, edid);
> >> +
> >> +  edid->pad = input;
> >> +
> >> +  return ret;
> >> +}
> >> +
> >> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid
> >> *edid) +{
> >> +  struct rvin_dev *vin = video_drvdata(file);
> >> +  struct v4l2_subdev *sd = vin_to_source(vin);
> >> +  int input, ret;
> >> +
> >> +  input = edid->pad;
> >> +  edid->pad = vin->sink_pad_idx;
> >> +
> >> +  ret = v4l2_subdev_call(sd, pad, set_edid, edid);
> >> +
> >> +  edid->pad = input;
> >> +
> >> +  return ret;
> >> +}
> >> +
> >>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> >>.vidioc_querycap= rvin_querycap,
> >>.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> >> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> >>.vidioc_s_dv_timings= rvin_s_dv_timings,
> >>.vidioc_query_dv_timings= rvin_query_dv_timings,
> >> 
> >> +  .vidioc_g_edid  = rvin_g_edid,
> >> +  .vidioc_s_edid  = rvin_s_edid,
> >> +
> >>.vidioc_querystd= rvin_querystd,
> >>.vidioc_g_std   = rvin_g_std,
> >>.vidioc_s_std   = rvin_s_std,
> >> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
> >>vin->src_pad_idx = pad_idx;
> >>fmt.pad = vin->src_pad_idx;
> >> 
> >> +  vin->sink_pad_idx = 0;
> >> +  for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> >> +  if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
> >> +  vin->sink_pad_idx = pad_idx;
> >> +  break;
> >> +  }
> >> +
> > 
> > What if the subdev has multiple sink pads ? Shouldn't the pad number be
> > instead computed in the get and set EDID handlers based on the input
> > number passed in the struct v4l2_edid::pad field ?
> 
> But there is only one input (VIDIOC_ENUM_INPUT), so this would not make
> sense.

Indeed, my bad. We'll address that when implementing input selection support 
then.

> What is wrong is that g/s_edid should check the pad and return -EINVAL if it
> is non-zero. Odd that I missed that in the earlier reviews...

-- 
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 v8 2/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Niklas Söderlund
On 2016-09-15 19:01:06 +0200, Hans Verkuil wrote:
> 
> 
> On 09/15/2016 06:47 PM, Laurent Pinchart wrote:
> > Hi Ulrich,
> > 
> > Thank you for the patch.
> > 
> > On Thursday 15 Sep 2016 15:24:08 Ulrich Hecht wrote:
> >> Adds G_EDID and S_EDID.
> >>
> >> Signed-off-by: Ulrich Hecht 
> >> ---
> >>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 42 
> >> ++
> >>  drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
> >>  2 files changed, 43 insertions(+)
> >>
> >> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> >> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 62ca7e3..f679182 100644
> >> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> >> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> >> @@ -557,6 +557,38 @@ static int rvin_dv_timings_cap(struct file *file, void
> >> *priv_fh, return ret;
> >>  }
> >>
> >> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid 
> >> *edid)
> >> +{
> >> +  struct rvin_dev *vin = video_drvdata(file);
> >> +  struct v4l2_subdev *sd = vin_to_source(vin);
> >> +  int input, ret;
> >> +
> >> +  input = edid->pad;
> >> +  edid->pad = vin->sink_pad_idx;
> >> +
> >> +  ret = v4l2_subdev_call(sd, pad, get_edid, edid);
> >> +
> >> +  edid->pad = input;
> >> +
> >> +  return ret;
> >> +}
> >> +
> >> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid 
> >> *edid)
> >> +{
> >> +  struct rvin_dev *vin = video_drvdata(file);
> >> +  struct v4l2_subdev *sd = vin_to_source(vin);
> >> +  int input, ret;
> >> +
> >> +  input = edid->pad;
> >> +  edid->pad = vin->sink_pad_idx;
> >> +
> >> +  ret = v4l2_subdev_call(sd, pad, set_edid, edid);
> >> +
> >> +  edid->pad = input;
> >> +
> >> +  return ret;
> >> +}
> >> +
> >>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> >>.vidioc_querycap= rvin_querycap,
> >>.vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> >> @@ -579,6 +611,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
> >>.vidioc_s_dv_timings= rvin_s_dv_timings,
> >>.vidioc_query_dv_timings= rvin_query_dv_timings,
> >>
> >> +  .vidioc_g_edid  = rvin_g_edid,
> >> +  .vidioc_s_edid  = rvin_s_edid,
> >> +
> >>.vidioc_querystd= rvin_querystd,
> >>.vidioc_g_std   = rvin_g_std,
> >>.vidioc_s_std   = rvin_s_std,
> >> @@ -832,6 +867,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
> >>vin->src_pad_idx = pad_idx;
> >>fmt.pad = vin->src_pad_idx;
> >>
> >> +  vin->sink_pad_idx = 0;
> >> +  for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> >> +  if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
> >> +  vin->sink_pad_idx = pad_idx;
> >> +  break;
> >> +  }
> >> +
> > 
> > What if the subdev has multiple sink pads ? Shouldn't the pad number be 
> > instead computed in the get and set EDID handlers based on the input number 
> > passed in the struct v4l2_edid::pad field ?
> 
> But there is only one input (VIDIOC_ENUM_INPUT), so this would not make sense.
> 
> What is wrong is that g/s_edid should check the pad and return -EINVAL if it
> is non-zero. Odd that I missed that in the earlier reviews...

Both Hans and Laurents comments are correct in this case I think.

The original patches was based on top of the Gen3 work where just as 
Laurent states the input number passed in the v4l2_edid::pad needs to be 
translated to a sink pad number of the subdevice. But since this is for 
Gen2 only there are only one input so no mapping is needed. All that is 
required is as Hans state to check that v4l2_edid::pad is a valid input 
number (equal to zero) from the rcar-vin perspective.

I do however still think there are value to find the subdevice sink pad 
id in rvin_v4l2_probe() and then use it in EDID handlers. The driver 
still need to use a sink pad number which is correct from the subdevice 
point of view.

> 
> Regards,
> 
>   Hans
> 
> > 
> >>/* Try to improve our guess of a reasonable window format */
> >>ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, );
> >>if (ret) {
> >> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> >> b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..af815cc 100644
> >> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> >> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> >> @@ -121,6 +121,7 @@ struct rvin_dev {
> >>struct video_device vdev;
> >>struct v4l2_device v4l2_dev;
> >>int src_pad_idx;
> >> +  int sink_pad_idx;
> >>struct v4l2_ctrl_handler ctrl_handler;
> >>struct v4l2_async_notifier notifier;
> >>struct rvin_graph_entity digital;
> > 

-- 
Regards,
Niklas Söderlund
--
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 v9 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Hi!

This revision sits on top of Hans's rcar branch and adds pad sanity checks
for g_edid and s_edid, the sink pad fix for the DV timings suggested by
Niklas, and documents sink_pad_idx. Good night!

CU
Uli


Changes since v8:
- dumped merged default-input patch
- added pad sanity check
- added DV timings sink pad fix
- documented sink_pad_idx
- added Acked-By

Changes since v7:
- do not fail if there is no sink pad

Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  rcar-vin: implement EDID control ioctls
  media: rcar-vin: use sink pad index for DV timings

 drivers/media/platform/rcar-vin/rcar-v4l2.c | 52 +++--
 drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
 2 files changed, 52 insertions(+), 2 deletions(-)

-- 
2.9.3

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


Re: [PATCH v9 1/2] rcar-vin: implement EDID control ioctls

2016-09-15 Thread Laurent Pinchart
Hi Ulrich,

Thank you for the patch.

On Thursday 15 Sep 2016 19:33:23 Ulrich Hecht wrote:
> Adds G_EDID and S_EDID.
> 
> Signed-off-by: Ulrich Hecht 
> Acked-by: Niklas Söderlund 

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 ++
>  drivers/media/platform/rcar-vin/rcar-vin.h  |  2 ++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 61e9b59..f35005c 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void
> *priv_fh, return ret;
>  }
> 
> +static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int input, ret;
> +
> + if (edid->pad)
> + return -EINVAL;
> +
> + input = edid->pad;
> + edid->pad = vin->sink_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, get_edid, edid);
> +
> + edid->pad = input;
> +
> + return ret;
> +}
> +
> +static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
> +{
> + struct rvin_dev *vin = video_drvdata(file);
> + struct v4l2_subdev *sd = vin_to_source(vin);
> + int input, ret;
> +
> + if (edid->pad)
> + return -EINVAL;
> +
> + input = edid->pad;
> + edid->pad = vin->sink_pad_idx;
> +
> + ret = v4l2_subdev_call(sd, pad, set_edid, edid);
> +
> + edid->pad = input;
> +
> + return ret;
> +}
> +
>  static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_querycap= rvin_querycap,
>   .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap,
> @@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = {
>   .vidioc_s_dv_timings= rvin_s_dv_timings,
>   .vidioc_query_dv_timings= rvin_query_dv_timings,
> 
> + .vidioc_g_edid  = rvin_g_edid,
> + .vidioc_s_edid  = rvin_s_edid,
> +
>   .vidioc_querystd= rvin_querystd,
>   .vidioc_g_std   = rvin_g_std,
>   .vidioc_s_std   = rvin_s_std,
> @@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
> 
>   vin->src_pad_idx = pad_idx;
> 
> + vin->sink_pad_idx = 0;
> + for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
> + if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
> + vin->sink_pad_idx = pad_idx;
> + break;
> + }
> +
>   vin->format.pixelformat = RVIN_DEFAULT_FORMAT;
>   rvin_reset_format(vin);
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h
> b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..727e215 100644
> --- a/drivers/media/platform/rcar-vin/rcar-vin.h
> +++ b/drivers/media/platform/rcar-vin/rcar-vin.h
> @@ -92,6 +92,7 @@ struct rvin_graph_entity {
>   * @vdev:V4L2 video device associated with VIN
>   * @v4l2_dev:V4L2 device
>   * @src_pad_idx: source pad index for media controller drivers
> + * @sink_pad_idx:sink pad index for media controller drivers
>   * @ctrl_handler:V4L2 control handler
>   * @notifier:V4L2 asynchronous subdevs notifier
>   * @digital: entity in the DT for local digital subdevice
> @@ -121,6 +122,7 @@ struct rvin_dev {
>   struct video_device vdev;
>   struct v4l2_device v4l2_dev;
>   int src_pad_idx;
> + int sink_pad_idx;
>   struct v4l2_ctrl_handler ctrl_handler;
>   struct v4l2_async_notifier notifier;
>   struct rvin_graph_entity digital;

-- 
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 v9 2/2] media: rcar-vin: use sink pad index for DV timings

2016-09-15 Thread Laurent Pinchart
Hi Ulrich,

Thank you for the patch.

On Thursday 15 Sep 2016 19:33:24 Ulrich Hecht wrote:
> Signed-off-by: Ulrich Hecht 

With a commit message explaining why this is needed,

Acked-by: Laurent Pinchart 

> ---
>  drivers/media/platform/rcar-vin/rcar-v4l2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> b/drivers/media/platform/rcar-vin/rcar-v4l2.c index f35005c..2bbe6d4 100644
> --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
> +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
> @@ -550,7 +550,7 @@ static int rvin_enum_dv_timings(struct file *file, void
> *priv_fh, int pad, ret;
> 
>   pad = timings->pad;
> - timings->pad = vin->src_pad_idx;
> + timings->pad = vin->sink_pad_idx;
> 
>   ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
> 
> @@ -604,7 +604,7 @@ static int rvin_dv_timings_cap(struct file *file, void
> *priv_fh, int pad, ret;
> 
>   pad = cap->pad;
> - cap->pad = vin->src_pad_idx;
> + cap->pad = vin->sink_pad_idx;
> 
>   ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);

-- 
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: mceusb xhci issue?

2016-09-15 Thread Alan Stern
On Sat, 10 Sep 2016, Wade Berrier wrote:

> On Thu Aug 11 16:18, Alan Stern wrote:
> > I never received any replies to this message.  Should the patch I 
> > suggested be merged?
> >
> 
> Hello,
> 
> I applied this updated patch to the fedora23 4.7.2 kernel and the mceusb
> transceiver works as expected.

Thank you for testing.  Can you provide the "lsusb -v" output for the
troublesome IR transceiver?

Alan Stern

--
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: mceusb xhci issue?

2016-09-15 Thread Alan Stern
Mauro:

I just took a look at the mceusb.c source file under drivers/media/rc/.  
The probe routine checks that ep_in != NULL, but it doesn't check
ep_out.  This can lead to a NULL-pointer dereference later on, crashing
the driver.  Such a crash was reported here:

http://marc.info/?l=mythtv-users=144131333703197=2

You should a check for ep_out to the probe routine.

Alan Stern

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


[PATCH v1.1 4/5] smiapp: Use runtime PM

2016-09-15 Thread Sakari Ailus
Use runtime PM to manage power. The s_power() core sub-device callback is
removed as it is no longer needed.

The power management of the sensor is changed so that it is no longer
dependent on open file descriptors on sub-device or use_count in the media
entity but solely will be powered on as needed for probing and streaming.

Signed-off-by: Sakari Ailus 
---
since v1:

- Both smiapp_set_ctrl() and smiapp_update_mode() perform work which is
  unrelated to the power state of the device. Instead, check the power
  state in smiapp_write() which is more appropriate.

- Don't explicitly disable streaming in smiapp_remove(). It'd be an
  unrelated change.

 drivers/media/i2c/smiapp/smiapp-core.c | 130 -
 drivers/media/i2c/smiapp/smiapp-regs.c |   5 ++
 drivers/media/i2c/smiapp/smiapp.h  |  11 +--
 3 files changed, 67 insertions(+), 79 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index e1d1459..d7f3738 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1198,9 +1199,17 @@ out:
  * Power management
  */
 
-static int smiapp_power_on(struct smiapp_sensor *sensor)
+static int smiapp_power_on(struct device *dev)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
+   struct i2c_client *client = to_i2c_client(dev);
+   struct v4l2_subdev *subdev = i2c_get_clientdata(client);
+   struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
+   /*
+* The sub-device related to the I2C device is always the
+* source one, i.e. ssds[0].
+*/
+   struct smiapp_sensor *sensor =
+   container_of(ssd, struct smiapp_sensor, ssds[0]);
unsigned int sleep;
int rval;
 
@@ -1326,6 +1335,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
return 0;
 
 out_cci_addr_fail:
+
gpiod_set_value(sensor->xshutdown, 0);
clk_disable_unprepare(sensor->ext_clk);
 
@@ -1334,8 +1344,14 @@ out_xclk_fail:
return rval;
 }
 
-static void smiapp_power_off(struct smiapp_sensor *sensor)
+static int smiapp_power_off(struct device *dev)
 {
+   struct i2c_client *client = to_i2c_client(dev);
+   struct v4l2_subdev *subdev = i2c_get_clientdata(client);
+   struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
+   struct smiapp_sensor *sensor =
+   container_of(ssd, struct smiapp_sensor, ssds[0]);
+
/*
 * Currently power/clock to lens are enable/disabled separately
 * but they are essentially the same signals. So if the sensor is
@@ -1353,31 +1369,8 @@ static void smiapp_power_off(struct smiapp_sensor 
*sensor)
usleep_range(5000, 5000);
regulator_disable(sensor->vana);
sensor->streaming = false;
-}
-
-static int smiapp_set_power(struct v4l2_subdev *subdev, int on)
-{
-   struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
-   int ret = 0;
-
-   mutex_lock(>power_mutex);
-
-   if (on && !sensor->power_count) {
-   /* Power on and perform initialisation. */
-   ret = smiapp_power_on(sensor);
-   if (ret < 0)
-   goto out;
-   } else if (!on && sensor->power_count == 1) {
-   smiapp_power_off(sensor);
-   }
-
-   /* Update the power count. */
-   sensor->power_count += on ? 1 : -1;
-   WARN_ON(sensor->power_count < 0);
 
-out:
-   mutex_unlock(>power_mutex);
-   return ret;
+   return 0;
 }
 
 /* 
-
@@ -1535,6 +1528,7 @@ out:
 
 static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable)
 {
+   struct i2c_client *client = v4l2_get_subdevdata(subdev);
struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
int rval;
 
@@ -1542,13 +1536,23 @@ static int smiapp_set_stream(struct v4l2_subdev 
*subdev, int enable)
return 0;
 
if (enable) {
+   rval = pm_runtime_get_sync(>dev);
+   if (rval < 0) {
+   pm_runtime_put(>dev);
+   return rval;
+   }
+
sensor->streaming = true;
rval = smiapp_start_streaming(sensor);
-   if (rval < 0)
+   if (rval < 0) {
+   pm_runtime_put(>dev);
sensor->streaming = false;
+   }
} else {
rval = smiapp_stop_streaming(sensor);
sensor->streaming = false;
+
+   pm_runtime_put(>dev);
}
 
return rval;
@@ -2308,13 +2312,15 @@ smiapp_sysfs_nvm_read(struct device *dev, struct 
device_attribute *attr,
if (!sensor->nvm_size) {
/* NVM not read yet - read it now */

Re: mceusb xhci issue?

2016-09-15 Thread Wade Berrier
On Thu Sep 15 15:13, Alan Stern wrote:
> On Sat, 10 Sep 2016, Wade Berrier wrote:
> 
> > On Thu Aug 11 16:18, Alan Stern wrote:
> > > I never received any replies to this message.  Should the patch I 
> > > suggested be merged?
> > >
> > 
> > Hello,
> > 
> > I applied this updated patch to the fedora23 4.7.2 kernel and the mceusb
> > transceiver works as expected.
> 
> Thank you for testing.  Can you provide the "lsusb -v" output for the
> troublesome IR transceiver?
> 

Here's the output:

Bus 001 Device 006: ID 1784:0006 TopSeed Technology Corp. eHome Infrared 
Transceiver
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 
  bDeviceSubClass 0 
  bDeviceProtocol 0 
  bMaxPacketSize0 8
  idVendor   0x1784 TopSeed Technology Corp.
  idProduct  0x0006 eHome Infrared Transceiver
  bcdDevice1.02
  iManufacturer   1 TopSeed Technology Corp.
  iProduct2 eHome Infrared Transceiver
  iSerial 3 TS004RrP
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   32
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0 
bmAttributes 0xa0
  (Bus Powered)
  Remote Wakeup
MaxPower  100mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass255 Vendor Specific Subclass
  bInterfaceProtocol255 Vendor Specific Protocol
  iInterface  0 
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0020  1x 32 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0020  1x 32 bytes
bInterval   0
Device Status: 0x0001
  Self Powered

Wade
--
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.9] R-Car VSP1 fixes and features

2016-09-15 Thread Laurent Pinchart
Hi Mauro,

Here's my (if all goes well last) pull request for the VSP1 driver for v4.9. 
As discussed over IRC I've dropped the rotation patch as it's still requires 
discussions. The rest should not be controversial, it's a bunch of fixes 
(mostly for race conditions), a bit of refactoring, dropping support for 
features that the hardware doesn't actually support, and implementation of 
image partitioning to enable scaling on Gen3 SoCs (without any change to the 
userspace API).

The following changes since commit c3b809834db8b1a8891c7ff873a216eac119628d:

  [media] pulse8-cec: fix compiler warning (2016-09-12 06:42:44 -0300)

are available in the git repository at:

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

for you to fetch changes up to 7fccbd66953e10deaa4725cff560e149deee66f5:

  v4l: vsp1: Disable VYUY on Gen3 (2016-09-15 22:14:02 +0300)


Kieran Bingham (6):
  v4l: vsp1: Ensure pipeline locking in resume path
  v4l: vsp1: Repair race between frame end and qbuf handler
  v4l: vsp1: Use DFE instead of FRE for frame end
  v4l: vsp1: Support chained display lists
  v4l: vsp1: Determine partition requirements for scaled images
  v4l: vsp1: Support multiple partitions per frame

Laurent Pinchart (8):
  v4l: vsp1: Prevent pipelines from running when not streaming
  v4l: vsp1: Protect against race conditions between get and set format
  v4l: vsp1: Disable cropping on WPF sink pad
  v4l: vsp1: Fix RPF cropping
  v4l: vsp1: Pass parameter type to entity configuration operation
  v4l: vsp1: Replace .set_memory() with VSP1_ENTITY_PARAMS_PARTITION
  v4l: vsp1: Fix spinlock in mixed IRQ context function
  v4l: vsp1: Disable VYUY on Gen3

 drivers/media/platform/vsp1/vsp1_bru.c|  33 +--
 drivers/media/platform/vsp1/vsp1_clu.c|  61 -
 drivers/media/platform/vsp1/vsp1_dl.c | 119 
 drivers/media/platform/vsp1/vsp1_dl.h |   1 +
 drivers/media/platform/vsp1/vsp1_drm.c|  17 ++--
 drivers/media/platform/vsp1/vsp1_drv.c|   2 +-
 drivers/media/platform/vsp1/vsp1_entity.c |  22 -
 drivers/media/platform/vsp1/vsp1_entity.h |  25 +++--
 drivers/media/platform/vsp1/vsp1_hsit.c   |  20 ++--
 drivers/media/platform/vsp1/vsp1_lif.c|  20 ++--
 drivers/media/platform/vsp1/vsp1_lut.c|  42 ++---
 drivers/media/platform/vsp1/vsp1_pipe.c   |  11 ++-
 drivers/media/platform/vsp1/vsp1_pipe.h   |  11 ++-
 drivers/media/platform/vsp1/vsp1_rpf.c| 106 ++
 drivers/media/platform/vsp1/vsp1_rwpf.c   |  81 +++--
 drivers/media/platform/vsp1/vsp1_rwpf.h   |  13 ---
 drivers/media/platform/vsp1/vsp1_sru.c|  50 --
 drivers/media/platform/vsp1/vsp1_uds.c|  71 ---
 drivers/media/platform/vsp1/vsp1_video.c  | 186 ++---
 drivers/media/platform/vsp1/vsp1_wpf.c| 129 --
 20 files changed, 754 insertions(+), 266 deletions(-)

-- 
Regards,

Laurent Pinchart

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


cron job: media_tree daily build: ERRORS

2016-09-15 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 Sep 16 04:00:16 CEST 2016
git branch: test
git hash:   c3b809834db8b1a8891c7ff873a216eac119628d
gcc version:i686-linux-gcc (GCC) 5.4.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3428-gdfe27cf
host hardware:  x86_64
host os:4.6.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: 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.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.1-i686: OK
linux-4.2-i686: OK
linux-4.3-i686: OK
linux-4.4-i686: OK
linux-4.5-i686: OK
linux-4.6-i686: OK
linux-4.7-i686: OK
linux-4.8-rc1-i686: 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.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-x86_64: OK
linux-4.4-x86_64: OK
linux-4.5-x86_64: OK
linux-4.6-x86_64: OK
linux-4.7-x86_64: OK
linux-4.8-rc1-x86_64: OK
apps: ERRORS
spec-git: OK
sparse: WARNINGS
smatch: WARNINGS

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/index.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: [v4l-utils PATCH v1.3 2/2] media-ctl: Print information related to a single entity

2016-09-15 Thread Sakari Ailus
On 09/15/16 11:10, Laurent Pinchart wrote:
> Reviewed-by: Laurent Pinchart 

Thanks!

pushed to master.

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


Re: [PATCH 0/3] Add Mediatek JPEG Decoder

2016-09-15 Thread Hans Verkuil

Hi Rick,

I'm not sure why, but for some reason this patch series never made it to 
the linux-media mailinglist.


Can you repost?

Regards,

Hans

On 09/14/2016 08:36 AM, Rick Chang wrote:

This series of patches provide a v4l2 driver to control Mediatek JPEG hw
for decoding JPEG image and Motion JPEG bitstream.

* Dependency
The patch "arm: dts: mt2701: Add node for JPEG decoder" depends on:
  CCF "arm: dts: mt2701: Add clock controller device nodes"[1]
  power domain patch "Mediatek MT2701 SCPSYS power domain support v7"[2]
  iommu and smi "Add the dtsi node of iommu and smi for mt2701"[3]

[1] https://patchwork.kernel.org/patch/9109081
[2] http://lists.infradead.org/pipermail/linux-mediatek/2016-May/005429.html
[3] https://patchwork.kernel.org/patch/9164013/

* Compliance test
v4l2-compliance SHA   : abc1453dfe89f244dccd3460d8e1a2e3091cbadb

Driver Info:
Driver name   : mtk-jpeg decode
Card type : mtk-jpeg decoder
Bus info  : platform:15004000.jpegdec
Driver version: 4.8.0
Capabilities  : 0x84204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x04204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format

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

Required ioctls:
test VIDIOC_QUERYCAP: OK

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

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

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

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

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

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

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK
test Scaling: OK

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

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK

Test input 0:


Total: 43, Succeeded: 43, Failed: 0, Warnings: 0

Rick Chang (3):
  dt-bindings: mediatek: Add a binding for Mediatek JPEG Decoder
  vcodec: mediatek: Add Mediatek JPEG Decoder Driver
  arm: dts: mt2701: Add node for Mediatek JPEG Decoder

 .../bindings/media/mediatek-jpeg-codec.txt |   35 +
 arch/arm/boot/dts/mt2701.dtsi  |   14 +
 drivers/media/platform/Kconfig |   15 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/mtk-jpeg/Makefile   |4 +
 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c| 1271 
 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.h|  141 +++
 drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.c  |  417 +++
 drivers/media/platform/mtk-jpeg/mtk_jpeg_hw.h  |   91 ++
 drivers/media/platform/mtk-jpeg/mtk_jpeg_parse.c   |  160 +++
 

Re: [STLinux Kernel] [PATCH v3 0/4] STIH CEC driver

2016-09-15 Thread Peter Griffin
Hi Benjamin,

On Thu, 15 Sep 2016, Benjamin Gaignard wrote:

> version 3:
>  - remove rx_msg and use local variable instead
>  - change configuration flag from VIDEO_STIH_CEC to VIDEO_STI_HDMI_CEC
> 

For the series: -
 Acked-by: Peter Griffin 

regards,

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


[PATCH v3 4/4] add maintainer for stih-cec driver

2016-09-15 Thread Benjamin Gaignard
Signed-off-by: Benjamin Gaignard 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0bbe4b1..f541117 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10281,6 +10281,13 @@ S: Maintained
 F: Documentation/devicetree/bindings/serial/
 F: drivers/tty/serial/
 
+STI CEC DRIVER
+M: Benjamin Gaignard 
+L: ker...@stlinux.com
+S: Maintained
+F: drivers/staging/media/st-cec/
+F: Documentation/devicetree/bindings/media/stih-cec.txt
+
 SYNOPSYS DESIGNWARE DMAC DRIVER
 M: Viresh Kumar 
 M: Andy Shevchenko 
-- 
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 v3 1/4] bindings for stih-cec driver

2016-09-15 Thread Benjamin Gaignard
Add bindings documentation for stih-cec driver.

Signed-off-by: Benjamin Gaignard 
---
 .../devicetree/bindings/media/stih-cec.txt | 25 ++
 1 file changed, 25 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/stih-cec.txt

diff --git a/Documentation/devicetree/bindings/media/stih-cec.txt 
b/Documentation/devicetree/bindings/media/stih-cec.txt
new file mode 100644
index 000..71c4b2f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/stih-cec.txt
@@ -0,0 +1,25 @@
+STMicroelectronics STIH4xx HDMI CEC driver
+
+Required properties:
+ - compatible : value should be "st,stih-cec"
+ - reg : Physical base address of the IP registers and length of memory
+mapped region.
+ - clocks : from common clock binding: handle to HDMI CEC clock
+ - interrupts : HDMI CEC interrupt number to the CPU.
+ - pinctrl-names: Contains only one value - "default"
+ - pinctrl-0: Specifies the pin control groups used for CEC hardware.
+ - resets: Reference to a reset controller
+
+Example for STIH407:
+
+sti-cec@094a087c {
+   compatible = "st,stih-cec";
+   reg = <0x94a087c 0x64>;
+   clocks = <_sysin>;
+   clock-names = "cec-clk";
+   interrupts = ;
+   interrupt-names = "cec-irq";
+   pinctrl-names = "default";
+   pinctrl-0 = <_cec0_default>;
+   resets = < STIH407_LPM_SOFTRESET>;
+};
-- 
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 v3 2/4] add stih-cec driver

2016-09-15 Thread Benjamin Gaignard
This patch implement CEC driver for stih4xx platform.
Driver compliance has been test with cec-ctl and
cec-compliance tools.

Signed-off-by: Benjamin Gaignard 
---
 drivers/staging/media/Kconfig   |   2 +
 drivers/staging/media/Makefile  |   1 +
 drivers/staging/media/st-cec/Kconfig|   8 +
 drivers/staging/media/st-cec/Makefile   |   1 +
 drivers/staging/media/st-cec/stih-cec.c | 380 
 5 files changed, 392 insertions(+)
 create mode 100644 drivers/staging/media/st-cec/Kconfig
 create mode 100644 drivers/staging/media/st-cec/Makefile
 create mode 100644 drivers/staging/media/st-cec/stih-cec.c

diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
index 7292f23..699719b 100644
--- a/drivers/staging/media/Kconfig
+++ b/drivers/staging/media/Kconfig
@@ -38,4 +38,6 @@ source "drivers/staging/media/s5p-cec/Kconfig"
 # Keep LIRC at the end, as it has sub-menus
 source "drivers/staging/media/lirc/Kconfig"
 
+source "drivers/staging/media/st-cec/Kconfig"
+
 endif
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
index 87ce8ad..7207f0a 100644
--- a/drivers/staging/media/Makefile
+++ b/drivers/staging/media/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_VIDEO_DM365_VPFE)  += davinci_vpfe/
 obj-$(CONFIG_VIDEO_OMAP4)  += omap4iss/
 obj-$(CONFIG_USB_PULSE8_CEC)+= pulse8-cec/
 obj-$(CONFIG_VIDEO_TW686X_KH)  += tw686x-kh/
+obj-$(CONFIG_VIDEO_STI_HDMI_CEC) += st-cec/
diff --git a/drivers/staging/media/st-cec/Kconfig 
b/drivers/staging/media/st-cec/Kconfig
new file mode 100644
index 000..784d2c6
--- /dev/null
+++ b/drivers/staging/media/st-cec/Kconfig
@@ -0,0 +1,8 @@
+config VIDEO_STI_HDMI_CEC
+   tristate "STMicroelectronics STiH4xx HDMI CEC driver"
+   depends on VIDEO_DEV && MEDIA_CEC && (ARCH_STI || COMPILE_TEST)
+   ---help---
+ This is a driver for STIH4xx HDMI CEC interface. It uses the
+ generic CEC framework interface.
+ CEC bus is present in the HDMI connector and enables communication
+ between compatible devices.
diff --git a/drivers/staging/media/st-cec/Makefile 
b/drivers/staging/media/st-cec/Makefile
new file mode 100644
index 000..f07905e
--- /dev/null
+++ b/drivers/staging/media/st-cec/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_VIDEO_STI_HDMI_CEC) += stih-cec.o
diff --git a/drivers/staging/media/st-cec/stih-cec.c 
b/drivers/staging/media/st-cec/stih-cec.c
new file mode 100644
index 000..2143448
--- /dev/null
+++ b/drivers/staging/media/st-cec/stih-cec.c
@@ -0,0 +1,380 @@
+/*
+ * drivers/staging/media/st-cec/stih-cec.c
+ *
+ * STIH4xx CEC driver
+ * Copyright (C) STMicroelectronic SA 2016
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define CEC_NAME   "stih-cec"
+
+/* CEC registers  */
+#define CEC_CLK_DIV   0x0
+#define CEC_CTRL  0x4
+#define CEC_IRQ_CTRL  0x8
+#define CEC_STATUS0xC
+#define CEC_EXT_STATUS0x10
+#define CEC_TX_CTRL   0x14
+#define CEC_FREE_TIME_THRESH  0x18
+#define CEC_BIT_TOUT_THRESH   0x1C
+#define CEC_BIT_PULSE_THRESH  0x20
+#define CEC_DATA  0x24
+#define CEC_TX_ARRAY_CTRL 0x28
+#define CEC_CTRL2 0x2C
+#define CEC_TX_ERROR_STS  0x30
+#define CEC_ADDR_TABLE0x34
+#define CEC_DATA_ARRAY_CTRL   0x38
+#define CEC_DATA_ARRAY_STATUS 0x3C
+#define CEC_TX_DATA_BASE  0x40
+#define CEC_TX_DATA_TOP   0x50
+#define CEC_TX_DATA_SIZE  0x1
+#define CEC_RX_DATA_BASE  0x54
+#define CEC_RX_DATA_TOP   0x64
+#define CEC_RX_DATA_SIZE  0x1
+
+/* CEC_CTRL2 */
+#define CEC_LINE_INACTIVE_EN   BIT(0)
+#define CEC_AUTO_BUS_ERR_ENBIT(1)
+#define CEC_STOP_ON_ARB_ERR_EN BIT(2)
+#define CEC_TX_REQ_WAIT_EN BIT(3)
+
+/* CEC_DATA_ARRAY_CTRL */
+#define CEC_TX_ARRAY_EN  BIT(0)
+#define CEC_RX_ARRAY_EN  BIT(1)
+#define CEC_TX_ARRAY_RESET   BIT(2)
+#define CEC_RX_ARRAY_RESET   BIT(3)
+#define CEC_TX_N_OF_BYTES_IRQ_EN BIT(4)
+#define CEC_TX_STOP_ON_NACK  BIT(7)
+
+/* CEC_TX_ARRAY_CTRL */
+#define CEC_TX_N_OF_BYTES  0x1F
+#define CEC_TX_START   BIT(5)
+#define CEC_TX_AUTO_SOM_EN BIT(6)
+#define CEC_TX_AUTO_EOM_EN BIT(7)
+
+/* CEC_IRQ_CTRL */
+#define CEC_TX_DONE_IRQ_EN   BIT(0)
+#define CEC_ERROR_IRQ_EN BIT(2)
+#define CEC_RX_DONE_IRQ_EN   BIT(3)
+#define CEC_RX_SOM_IRQ_ENBIT(4)
+#define CEC_RX_EOM_IRQ_ENBIT(5)
+#define CEC_FREE_TIME_IRQ_EN BIT(6)
+#define CEC_PIN_STS_IRQ_EN   BIT(7)
+
+/* CEC_CTRL */
+#define CEC_IN_FILTER_ENBIT(0)
+#define CEC_PWR_SAVE_EN BIT(1)
+#define CEC_EN  BIT(4)
+#define CEC_ACK_CTRLBIT(5)
+#define 

[PATCH v3 3/4] add stih-cec driver into DT

2016-09-15 Thread Benjamin Gaignard
Signed-off-by: Benjamin Gaignard 
---
 arch/arm/boot/dts/stih407-family.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index d294e82..9f88086 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -734,6 +734,18 @@
 <_s_c0_flexgen CLK_ETH_PHY>;
};
 
+   cec: sti-cec@094a087c {
+   compatible = "st,stih-cec";
+   reg = <0x94a087c 0x64>;
+   clocks = <_sysin>;
+   clock-names = "cec-clk";
+   interrupts = ;
+   interrupt-names = "cec-irq";
+   pinctrl-names = "default";
+   pinctrl-0 = <_cec0_default>;
+   resets = < STIH407_LPM_SOFTRESET>;
+   };
+
rng10: rng@08a89000 {
compatible  = "st,rng";
reg = <0x08a89000 0x1000>;
-- 
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 v3 0/4] STIH CEC driver

2016-09-15 Thread Benjamin Gaignard
version 3:
 - remove rx_msg and use local variable instead
 - change configuration flag from VIDEO_STIH_CEC to VIDEO_STI_HDMI_CEC

version 2:
 - fix typo in comments
 - in DT move stih-cec driver from stih410.dtsi to stih407-family.dtsi

Those patches implement HDMI CEC driver for stih4xx SoCs.
I have used media_tree/fixes and the lastest v4l-utils branch.

The compliance tools have been run with the following sequence:
cec-ctl --tuner -p 1.0.0.0
cec-compliance -A
and cec-follower running in a separate shell

Compliance logs:
cec-ctl --tuner -p 1.0.0.0 
Driver Info:
Driver Name: stih-cec
Adapter Name   : stih-cec
Capabilities   : 0x000f
Physical Address
Logical Addresses
Transmit
Passthrough
Driver version : 4.8.0
Available Logical Addresses: 1
Physical Address   : 1.0.0.0
Logical Address Mask   : 0x0008
CEC Version: 2.0
Vendor ID  : 0x000c03
OSD Name   : 'Tuner'
Logical Addresses  : 1

  Logical Address  : 3 (Tuner 1)
Primary Device Type: Tuner
Logical Address Type   : Tuner
All Device Types   : Tuner
RC TV Profile  : None
Device Features:
None

cec-compliance -A 
cec-compliance SHA : 56075a41f9294b21aa6bd80dc5e94cbd2b44087a

Driver Info:
Driver Name: stih-cec
Adapter Name   : stih-cec
Capabilities   : 0x000f
Physical Address
Logical Addresses
Transmit
Passthrough
Driver version : 4.8.0
Available Logical Addresses: 1
Physical Address   : 1.0.0.0
Logical Address Mask   : 0x0008
CEC Version: 2.0
Vendor ID  : 0x000c03
Logical Addresses  : 1

  Logical Address  : 3
Primary Device Type: Tuner
Logical Address Type   : Tuner
All Device Types   : Tuner
RC TV Profile  : None
Device Features:
None

Compliance test for device /dev/cec0:

The test results mean the following:
OK  Supported correctly by the device.
OK (Not Supported)  Not supported and not mandatory for the device.
OK (Presumed)   Presumably supported.  Manually check to confirm.
OK (Unexpected) Supported correctly but is not expected to be 
supported for this device.
OK (Refused)Supported by the device, but was refused.
FAILFailed and was expected to be supported by this 
device.

Find remote devices:
Polling: OK

CEC API:
CEC_ADAP_G_CAPS: OK
CEC_DQEVENT: OK
CEC_ADAP_G/S_PHYS_ADDR: OK
CEC_ADAP_G/S_LOG_ADDRS: OK
CEC_TRANSMIT: OK
CEC_RECEIVE: OK
CEC_TRANSMIT/RECEIVE (non-blocking): OK (Presumed)
CEC_G/S_MODE: OK
CEC_EVENT_LOST_MSGS: OK

Network topology:
System Information for device 0 (TV) from device 3 (Tuner 1):
CEC Version: 1.4
Physical Address   : Tx, OK, Not Acknowledged (1), Rx, 
Timeout
Vendor ID  : 0x00903e
OSD Name   : 'TV'
Menu Language  : fre
Power Status   : On

Total: 10, Succeeded: 10, Failed: 0, Warnings: 0

cec-follower 
cec-follower SHA   : 56075a41f9294b21aa6bd80dc5e94cbd2b44087a

Driver Info:
Driver Name: stih-cec
Adapter Name   : stih-cec
Capabilities   : 0x000f
Physical Address
Logical Addresses
Transmit
Passthrough
Driver version : 4.8.0
Available Logical Addresses: 1
Physical Address   : 1.0.0.0
Logical Address Mask   : 0x0008
CEC Version: 2.0
Vendor ID  : 0x000c03
Logical Addresses  : 1

  Logical Address  : 3
Primary Device Type: Tuner
Logical Address Type   : Tuner
All Device Types   : Tuner
RC TV Profile  : None
Device Features:
None

Initial Event: State Change: PA: 1.0.0.0, LA mask: 0x0008
Event: State Change: PA: 1.0.0.0, LA mask: 0x
Event: State Change: PA: 1.0.0.0, LA mask: 0x4000
Event: State Change: PA: 1.0.0.0, LA mask: 0x
Event: State Change: PA: 1.0.0.0, LA mask: 0x4000
Event: State Change: PA: 1.0.0.0, LA mask: 

[v4l-utils PATCH v1.3 2/2] media-ctl: Print information related to a single entity

2016-09-15 Thread Sakari Ailus
Add a possibility to printing all information related to a given entity by
using both -p and -e options. This may be handy sometimes if only a single
entity is of interest and there are many entities.

Signed-off-by: Sakari Ailus 
---
 utils/media-ctl/media-ctl.c | 32 ++--
 utils/media-ctl/options.c   |  4 +++-
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
index 0499008..b60d297 100644
--- a/utils/media-ctl/media-ctl.c
+++ b/utils/media-ctl/media-ctl.c
@@ -504,19 +504,11 @@ static void media_print_topology_text(struct media_device 
*media)
media, media_get_entity(media, i));
 }
 
-void media_print_topology(struct media_device *media, int dot)
-{
-   if (dot)
-   media_print_topology_dot(media);
-   else
-   media_print_topology_text(media);
-}
-
 int main(int argc, char **argv)
 {
struct media_device *media;
+   struct media_entity *entity = NULL;
int ret = -1;
-   const char *devname;
 
if (parse_cmdline(argc, argv))
return EXIT_FAILURE;
@@ -562,17 +554,11 @@ int main(int argc, char **argv)
}
 
if (media_opts.entity) {
-   struct media_entity *entity;
-
entity = media_get_entity_by_name(media, media_opts.entity);
if (entity == NULL) {
printf("Entity '%s' not found\n", media_opts.entity);
goto out;
}
-
-   devname = media_entity_get_devname(entity);
-   if (devname)
-   printf("%s\n", devname);
}
 
if (media_opts.fmt_pad) {
@@ -611,9 +597,19 @@ int main(int argc, char **argv)
}
}
 
-   if (media_opts.print || media_opts.print_dot) {
-   media_print_topology(media, media_opts.print_dot);
-   printf("\n");
+   if (media_opts.print_dot) {
+   media_print_topology_dot(media);
+   } else if (media_opts.print) {
+   if (entity)
+   media_print_topology_text_entity(media, entity);
+   else
+   media_print_topology_text(media);
+   } else if (entity) {
+   const char *devname;
+
+   devname = media_entity_get_devname(entity);
+   if (devname)
+   printf("%s\n", devname);
}
 
if (media_opts.reset) {
diff --git a/utils/media-ctl/options.c b/utils/media-ctl/options.c
index a288a1b..77d1a51 100644
--- a/utils/media-ctl/options.c
+++ b/utils/media-ctl/options.c
@@ -51,7 +51,9 @@ static void usage(const char *argv0)
printf("-i, --interactive   Modify links interactively\n");
printf("-l, --links links   Comma-separated list of link 
descriptors to setup\n");
printf("--known-mbus-fmts   List known media bus formats and their 
numeric values\n");
-   printf("-p, --print-topologyPrint the device topology\n");
+   printf("-p, --print-topologyPrint the device topology. If an 
entity\n");
+   printf("is specified through the -e option, 
print\n");
+   printf("information for that entity only.\n);
printf("--print-dot Print the device topology as a dot 
graph\n");
printf("-r, --reset Reset all links to inactive\n");
printf("-v, --verbose   Be verbose\n");
-- 
2.7.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: [v4l-utils PATCH v1.2 2/2] media-ctl: Print information related to a single entity

2016-09-15 Thread Sakari Ailus
On 09/15/16 01:05, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> On Wednesday 14 Sep 2016 17:29:39 Sakari Ailus wrote:
>> Add a possibility to printing all information related to a given entity by
>> using both -p and -e options. This may be handy sometimes if only a single
>> entity is of interest and there are many entities.
>>
>> Signed-off-by: Sakari Ailus 
>> ---
>> Fixed the commit message as well.
>>
>>  utils/media-ctl/media-ctl.c | 33 +++--
>>  utils/media-ctl/options.c   |  2 ++
>>  2 files changed, 17 insertions(+), 18 deletions(-)
>>
>> diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
>> index 0499008..109cc11 100644
>> --- a/utils/media-ctl/media-ctl.c
>> +++ b/utils/media-ctl/media-ctl.c
>> @@ -504,19 +504,11 @@ static void media_print_topology_text(struct
>> media_device *media) media, media_get_entity(media, i));
>>  }
>>
>> -void media_print_topology(struct media_device *media, int dot)
>> -{
>> -if (dot)
>> -media_print_topology_dot(media);
>> -else
>> -media_print_topology_text(media);
>> -}
>> -
>>  int main(int argc, char **argv)
>>  {
>>  struct media_device *media;
>> +struct media_entity *entity = NULL;
>>  int ret = -1;
>> -const char *devname;
>>
>>  if (parse_cmdline(argc, argv))
>>  return EXIT_FAILURE;
>> @@ -562,17 +554,11 @@ int main(int argc, char **argv)
>>  }
>>
>>  if (media_opts.entity) {
>> -struct media_entity *entity;
>> -
>>  entity = media_get_entity_by_name(media, media_opts.entity);
>>  if (entity == NULL) {
>>  printf("Entity '%s' not found\n", media_opts.entity);
>>  goto out;
>>  }
>> -
>> -devname = media_entity_get_devname(entity);
>> -if (devname)
>> -printf("%s\n", devname);
>>  }
>>
>>  if (media_opts.fmt_pad) {
>> @@ -611,9 +597,20 @@ int main(int argc, char **argv)
>>  }
>>  }
>>
>> -if (media_opts.print || media_opts.print_dot) {
>> -media_print_topology(media, media_opts.print_dot);
>> -printf("\n");
>> +if (media_opts.print_dot) {
>> +media_print_topology_dot(media);
>> +} else if (media_opts.print) {
>> +if (entity) {
>> +media_print_topology_text_entity(media, entity);
>> +} else {
>> +media_print_topology_text(media);
>> +}
> 
> You could remove the curly braces here.

Will fix.

> 
>> +} else if (entity) {
>> +const char *devname;
>> +
>> +devname = media_entity_get_devname(entity);
>> +if (devname)
>> +printf("%s\n", devname);
>>  }
>>
>>  if (media_opts.reset) {
>> diff --git a/utils/media-ctl/options.c b/utils/media-ctl/options.c
>> index a288a1b..304a86c 100644
>> --- a/utils/media-ctl/options.c
>> +++ b/utils/media-ctl/options.c
>> @@ -52,6 +52,8 @@ static void usage(const char *argv0)
>>  printf("-l, --links links   Comma-separated list of link 
> descriptors to
>> setup\n"); printf("--known-mbus-fmts List known media bus formats 
> and
>> their numeric values\n"); printf("-p, --print-topology   Print the 
> device
>> topology\n");
>> +printf("If entity name is specified using -e 
> option, information\n");
>> +printf("related to that entity only is 
> printed.\n");
> 
> Nitpicking, was anything wrong with
> 
> printf("-p, --print-topologyPrint the device topology. If an entity\n");
> printf("is specified through the -e option, print\n");
> printf("information for that entity only.\n);

Not necessarily, but I missed that part of your reply. I'll replace it.

> 
> ? I think the help text looks more natural when using articles :-)

The message was still clear, wasn't it? :-D

> 
>>  printf("--print-dot Print the device topology as a dot 
> graph\n");
>>  printf("-r, --reset Reset all links to inactive\n");
>>  printf("-v, --verbose   Be verbose\n");
> 


-- 
Cheers,

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


Re: [v4l-utils PATCH v1.3 2/2] media-ctl: Print information related to a single entity

2016-09-15 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch.

On Thursday 15 Sep 2016 09:40:39 Sakari Ailus wrote:
> Add a possibility to printing all information related to a given entity by
> using both -p and -e options. This may be handy sometimes if only a single
> entity is of interest and there are many entities.
> 
> Signed-off-by: Sakari Ailus 

Reviewed-by: Laurent Pinchart 

> ---
>  utils/media-ctl/media-ctl.c | 32 ++--
>  utils/media-ctl/options.c   |  4 +++-
>  2 files changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
> index 0499008..b60d297 100644
> --- a/utils/media-ctl/media-ctl.c
> +++ b/utils/media-ctl/media-ctl.c
> @@ -504,19 +504,11 @@ static void media_print_topology_text(struct
> media_device *media) media, media_get_entity(media, i));
>  }
> 
> -void media_print_topology(struct media_device *media, int dot)
> -{
> - if (dot)
> - media_print_topology_dot(media);
> - else
> - media_print_topology_text(media);
> -}
> -
>  int main(int argc, char **argv)
>  {
>   struct media_device *media;
> + struct media_entity *entity = NULL;
>   int ret = -1;
> - const char *devname;
> 
>   if (parse_cmdline(argc, argv))
>   return EXIT_FAILURE;
> @@ -562,17 +554,11 @@ int main(int argc, char **argv)
>   }
> 
>   if (media_opts.entity) {
> - struct media_entity *entity;
> -
>   entity = media_get_entity_by_name(media, media_opts.entity);
>   if (entity == NULL) {
>   printf("Entity '%s' not found\n", media_opts.entity);
>   goto out;
>   }
> -
> - devname = media_entity_get_devname(entity);
> - if (devname)
> - printf("%s\n", devname);
>   }
> 
>   if (media_opts.fmt_pad) {
> @@ -611,9 +597,19 @@ int main(int argc, char **argv)
>   }
>   }
> 
> - if (media_opts.print || media_opts.print_dot) {
> - media_print_topology(media, media_opts.print_dot);
> - printf("\n");
> + if (media_opts.print_dot) {
> + media_print_topology_dot(media);
> + } else if (media_opts.print) {
> + if (entity)
> + media_print_topology_text_entity(media, entity);
> + else
> + media_print_topology_text(media);
> + } else if (entity) {
> + const char *devname;
> +
> + devname = media_entity_get_devname(entity);
> + if (devname)
> + printf("%s\n", devname);
>   }
> 
>   if (media_opts.reset) {
> diff --git a/utils/media-ctl/options.c b/utils/media-ctl/options.c
> index a288a1b..77d1a51 100644
> --- a/utils/media-ctl/options.c
> +++ b/utils/media-ctl/options.c
> @@ -51,7 +51,9 @@ static void usage(const char *argv0)
>   printf("-i, --interactive   Modify links interactively\n");
>   printf("-l, --links links   Comma-separated list of link 
descriptors to
> setup\n"); printf("--known-mbus-fmts  List known media bus formats 
and
> their numeric values\n"); -   printf("-p, --print-topologyPrint the 
device
> topology\n");
> + printf("-p, --print-topologyPrint the device topology. If an 
entity\n");
> + printf("is specified through the -e option, 
print\n");
> + printf("information for that entity only.\n);
>   printf("--print-dot Print the device topology as a dot 
graph\n");
>   printf("-r, --reset Reset all links to inactive\n");
>   printf("-v, --verbose   Be verbose\n");

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 2/2] [media] Input: synaptics-rmi4: disallow impossible configuration

2016-09-15 Thread Nick Dyer
On Mon, Sep 12, 2016 at 05:30:33PM +0200, Arnd Bergmann wrote:
> The newly added debug mode for the synaptics-rmi4 driver relies on
> the v4l2 interface and vb2_vmalloc, but those might be configured
> as loadable modules when the driver itself is built-in, resulting
> in a link failure:
> 
> drivers/input/rmi4/rmi_core.o: In function `rmi_f54_remove':
> rmi_f54.c:(.text.rmi_f54_remove+0x14): undefined reference to 
> `video_unregister_device'
> rmi_f54.c:(.text.rmi_f54_remove+0x20): undefined reference to 
> `v4l2_device_unregister'
> drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_s_input':
> rmi_f54.c:(.text.rmi_f54_vidioc_s_input+0x10): undefined reference to 
> `video_devdata'
> drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_g_input':
> rmi_f54.c:(.text.rmi_f54_vidioc_g_input+0x10): undefined reference to 
> `video_devdata'
> drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_fmt':
> rmi_f54.c:(.text.rmi_f54_vidioc_fmt+0x10): undefined reference to 
> `video_devdata'
> drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_enum_input':
> rmi_f54.c:(.text.rmi_f54_vidioc_enum_input+0x10): undefined reference to 
> `video_devdata'
> drivers/input/rmi4/rmi_core.o: In function `rmi_f54_vidioc_querycap':
> ...
> 
> The best workaround I could come up with is to disallow the debug
> mode unless it's actually possible to call it.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: 3a762dbd5347 ("[media] Input: synaptics-rmi4 - add support for F54 
> diagnostics")

Acked-by: Nick Dyer 

> ---
>  drivers/input/rmi4/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig
> index f3418b65eb41..4c8a55857e00 100644
> --- a/drivers/input/rmi4/Kconfig
> +++ b/drivers/input/rmi4/Kconfig
> @@ -65,7 +65,7 @@ config RMI4_F30
>  config RMI4_F54
>   bool "RMI4 Function 54 (Analog diagnostics)"
>   depends on RMI4_CORE
> - depends on VIDEO_V4L2
> + depends on VIDEO_V4L2=y || (RMI4_CORE=m && VIDEO_V4L2=m)
>   select VIDEOBUF2_VMALLOC
>   help
> Say Y here if you want to add support for RMI4 function 54
> -- 
> 2.9.0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] v4l: vsp1: Disable VYUY on Gen3

2016-09-15 Thread Laurent Pinchart
The VYUY format isn't supported on Gen3 hardware, disable it.

Gen2 hardware supports VYUY in practice even though the documentation
doesn't advertise it, so keep it for Gen2 devices.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c   | 2 +-
 drivers/media/platform/vsp1/vsp1_pipe.c  | 8 +++-
 drivers/media/platform/vsp1/vsp1_pipe.h  | 3 ++-
 drivers/media/platform/vsp1/vsp1_video.c | 4 ++--
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 832286975e71..54795b5e5a8a 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -286,7 +286,7 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int 
rpf_index,
/* Store the format, stride, memory buffer address, crop and compose
 * rectangles and Z-order position and for the input.
 */
-   fmtinfo = vsp1_get_format_info(cfg->pixelformat);
+   fmtinfo = vsp1_get_format_info(vsp1, cfg->pixelformat);
if (!fmtinfo) {
dev_dbg(vsp1->dev, "Unsupport pixel format %08x for RPF\n",
cfg->pixelformat);
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.c 
b/drivers/media/platform/vsp1/vsp1_pipe.c
index 474de82165d8..78b6184f91ce 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.c
+++ b/drivers/media/platform/vsp1/vsp1_pipe.c
@@ -138,15 +138,21 @@ static const struct vsp1_format_info vsp1_video_formats[] 
= {
 
 /*
  * vsp1_get_format_info - Retrieve format information for a 4CC
+ * @vsp1: the VSP1 device
  * @fourcc: the format 4CC
  *
  * Return a pointer to the format information structure corresponding to the
  * given V4L2 format 4CC, or NULL if no corresponding format can be found.
  */
-const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc)
+const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
+   u32 fourcc)
 {
unsigned int i;
 
+   /* Special case, the VYUY format is supported on Gen2 only. */
+   if (vsp1->info->gen != 2 && fourcc == V4L2_PIX_FMT_VYUY)
+   return NULL;
+
for (i = 0; i < ARRAY_SIZE(vsp1_video_formats); ++i) {
const struct vsp1_format_info *info = _video_formats[i];
 
diff --git a/drivers/media/platform/vsp1/vsp1_pipe.h 
b/drivers/media/platform/vsp1/vsp1_pipe.h
index f15b697ad999..ac4ad261 100644
--- a/drivers/media/platform/vsp1/vsp1_pipe.h
+++ b/drivers/media/platform/vsp1/vsp1_pipe.h
@@ -130,6 +130,7 @@ void vsp1_pipeline_propagate_alpha(struct vsp1_pipeline 
*pipe,
 void vsp1_pipelines_suspend(struct vsp1_device *vsp1);
 void vsp1_pipelines_resume(struct vsp1_device *vsp1);
 
-const struct vsp1_format_info *vsp1_get_format_info(u32 fourcc);
+const struct vsp1_format_info *vsp1_get_format_info(struct vsp1_device *vsp1,
+   u32 fourcc);
 
 #endif /* __VSP1_PIPE_H__ */
diff --git a/drivers/media/platform/vsp1/vsp1_video.c 
b/drivers/media/platform/vsp1/vsp1_video.c
index 15d08cb50bd1..e773d3d30df2 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -117,9 +117,9 @@ static int __vsp1_video_try_format(struct vsp1_video *video,
/* Retrieve format information and select the default format if the
 * requested format isn't supported.
 */
-   info = vsp1_get_format_info(pix->pixelformat);
+   info = vsp1_get_format_info(video->vsp1, pix->pixelformat);
if (info == NULL)
-   info = vsp1_get_format_info(VSP1_VIDEO_DEF_FORMAT);
+   info = vsp1_get_format_info(video->vsp1, VSP1_VIDEO_DEF_FORMAT);
 
pix->pixelformat = info->fourcc;
pix->colorspace = V4L2_COLORSPACE_SRGB;
-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/2] [media] Input: atmel_mxt: disallow impossible configuration

2016-09-15 Thread Nick Dyer
On Mon, Sep 12, 2016 at 05:30:32PM +0200, Arnd Bergmann wrote:
> The newnly added debug mode for the atmel_mxt_ts driver relies on
> the v4l2 interface and vb2_vmalloc, but those might be configured
> as loadable modules when the driver itself is built-in, resulting
> in a link failure:
> 
> drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_vidioc_querycap':
> atmel_mxt_ts.c:(.text.mxt_vidioc_querycap+0x10): undefined reference to 
> `video_devdata'
> drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_buffer_queue':
> atmel_mxt_ts.c:(.text.mxt_buffer_queue+0x20): undefined reference to 
> `vb2_plane_vaddr'
> atmel_mxt_ts.c:(.text.mxt_buffer_queue+0x164): undefined reference to 
> `vb2_buffer_done'
> drivers/input/touchscreen/atmel_mxt_ts.o: In function `mxt_free_object_table':
> atmel_mxt_ts.c:(.text.mxt_free_object_table+0x18): undefined reference to 
> `video_unregister_device'
> atmel_mxt_ts.c:(.text.mxt_free_object_table+0x20): undefined reference to 
> `v4l2_device_unregister'
> 
> The best workaround I could come up with is to disallow the debug
> mode unless it's actually possible to call it.
> 
> Signed-off-by: Arnd Bergmann 
> Fixes: ecfdd7e2660e ("[media] Input: atmel_mxt_ts - output diagnostic debug 
> via V4L2 device")

Acked-by: Nick Dyer 

> ---
>  drivers/input/touchscreen/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/Kconfig 
> b/drivers/input/touchscreen/Kconfig
> index fce1e41ffe8b..ccf933969587 100644
> --- a/drivers/input/touchscreen/Kconfig
> +++ b/drivers/input/touchscreen/Kconfig
> @@ -117,7 +117,8 @@ config TOUCHSCREEN_ATMEL_MXT
>  
>  config TOUCHSCREEN_ATMEL_MXT_T37
>   bool "Support T37 Diagnostic Data"
> - depends on TOUCHSCREEN_ATMEL_MXT && VIDEO_V4L2
> + depends on TOUCHSCREEN_ATMEL_MXT
> + depends on VIDEO_V4L2=y || (TOUCHSCREEN_ATMEL_MXT=m && VIDEO_V4L2=m)
>   select VIDEOBUF2_VMALLOC
>   help
> Say Y here if you want support to output data from the T37
> -- 
> 2.9.0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Input: v4l-touch - add copyright lines

2016-09-15 Thread Nick Dyer
Hi Hans-

Please could you apply this patch to your media_tree/touch branch before it
goes to v4.9 if possible.

Thanks



Add copyright lines for Zodiac who paid for the V4L touch work.

Signed-off-by: Nick Dyer 
---
 drivers/input/rmi4/rmi_f54.c | 1 +
 drivers/input/touchscreen/atmel_mxt_ts.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index 99a8836..185b753 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2012-2015 Synaptics Incorporated
+ * Copyright (C) 2016 Zodiac Inflight Innovations
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published by
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c 
b/drivers/input/touchscreen/atmel_mxt_ts.c
index beede8f..e5d185f 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2010 Samsung Electronics Co.Ltd
  * Copyright (C) 2011-2014 Atmel Corporation
  * Copyright (C) 2012 Google, Inc.
+ * Copyright (C) 2016 Zodiac Inflight Innovations
  *
  * Author: Joonyoung Shim 
  *
-- 
2.7.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] [v4l-utils] libv4l2subdev: Propagate format deep in the topology

2016-09-15 Thread Sakari Ailus
Hi Helen,

Thanks for the patch!

On Tue, Sep 13, 2016 at 05:09:58PM -0300, Helen Koike wrote:
> The format was only being propagated to the subdevices directly
> connected to the node being changed.
> Continue propagating the format to all the subdevices in the video pipe.
> 
> Signed-off-by: Helen Koike 
> ---
> 
> Only one level of propagation was not that useful for me so I made it to 
> completely
> propagate the format through the topology, I hope this patch to be useful to 
> others.

I'd say most of the time a single sub-device is configured at a time --- the
current implementation does set the format set by the user on a source pad
on the sink pad at the other end of an enabled link as well, but that's just
for the convenience.

Your patch changes this to do a lot more than that. I'm not saying that the
functionality isn't needed, but it would have to be behind a specific flag
as it only caters for the needs of a somewhat special case: you wish to
propagate the same format all the way to the end of the pipeline.
Additionally, just changing the behaviour does break the existing users of
media-ctl.

Sub-devices propagate the cropping and composing (i.e. scaling)
configuration downstream inside a single sub-device. This (very likely)
consequently changes the format on the source pads as well, and should be
similarly propagated downstream.

I think how this could be added to media-ctl is by adding a new command line
option, and amending the functionality with propagating the selections as
well.

The propagation should only be performed after full configuration of a
sub-device is done: a single command line may well first change the format
on a sub-device sink pad, then cropping and finally composition
configuration, all of which are internally propagated in the sub-device
before the following configuration step is taken. I don't think we wish to
propagate each step over the full pipeline downstream.

As per where would I put this --- I'm not fully certain libv4l2subdev is the
right place for the functionality, at least it'd widen the scope for the
library somewhat. I started writing (but unfortunately not being able to
finish it) a pipeline configuration library with the intent of providing
functionality of a regular V4L2 device node on a device the full
configuration (links, sub-device formats etc.) is up to the user. The
library was called libautopipe, I think this could be a beginning of such a
library.

I wonder what Laurent thinks.

> 
>  utils/media-ctl/libv4l2subdev.c | 43 
> +++--
>  1 file changed, 24 insertions(+), 19 deletions(-)
> 
> diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
> index 3dcf943..8333557 100644
> --- a/utils/media-ctl/libv4l2subdev.c
> +++ b/utils/media-ctl/libv4l2subdev.c
> @@ -644,6 +644,28 @@ static int set_frame_interval(struct media_entity 
> *entity,
>   return 0;
>  }
>  
> +static void propagate_set_fmt(struct media_entity *entity)
> +{
> + unsigned int i;
> +
> + for (i = 0; i < entity->num_links; ++i) {
> + struct media_link *link = >links[i];
> + struct v4l2_mbus_framefmt format;
> +
> + if (!(link->flags & MEDIA_LNK_FL_ENABLED))
> + continue;
> +
> + /* If we found a source pad, propagate it's format to the 
> remote sink */
> + if (link->source->entity == entity &&
> + link->sink->entity->info.type == MEDIA_ENT_T_V4L2_SUBDEV) {
> +
> + v4l2_subdev_get_format(entity, , 
> link->source->index,
> + V4L2_SUBDEV_FORMAT_ACTIVE);
> + set_format(link->sink, );
> + propagate_set_fmt(link->sink->entity);
> + }
> + }
> +}
>  
>  static int v4l2_subdev_parse_setup_format(struct media_device *media,
> const char *p, char **endp)
> @@ -653,7 +675,6 @@ static int v4l2_subdev_parse_setup_format(struct 
> media_device *media,
>   struct v4l2_rect crop = { -1, -1, -1, -1 };
>   struct v4l2_rect compose = crop;
>   struct v4l2_fract interval = { 0, 0 };
> - unsigned int i;
>   char *end;
>   int ret;
>  
> @@ -690,24 +711,8 @@ static int v4l2_subdev_parse_setup_format(struct 
> media_device *media,
>   return ret;
>  
>  
> - /* If the pad is an output pad, automatically set the same format on
> -  * the remote subdev input pads, if any.
> -  */
> - if (pad->flags & MEDIA_PAD_FL_SOURCE) {
> - for (i = 0; i < pad->entity->num_links; ++i) {
> - struct media_link *link = >entity->links[i];
> - struct v4l2_mbus_framefmt remote_format;
> -
> - if (!(link->flags & MEDIA_LNK_FL_ENABLED))
> - continue;
> -
> - if (link->source == pad &&
> -  

Re: [PATCH v2] V4L2: Add documentation for SDI timings and related flags

2016-09-15 Thread Hans Verkuil


On 09/07/2016 11:26 AM, Charles-Antoine Couret wrote:
> Le 12/08/2016 à 15:17, Hans Verkuil a écrit :
>> On 08/04/2016 05:39 PM, Charles-Antoine Couret wrote:
>>
>> A commit log is missing here.
> 
> Yeah I will fix that.
> 
>>> diff --git a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst 
>>> b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
>>> index f7bf21f..0205bf6 100644
>>> --- a/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
>>> +++ b/Documentation/media/uapi/v4l/vidioc-g-dv-timings.rst
>>> @@ -339,6 +339,14 @@ EBUSY
>>>  
>>> -  The timings follow the VESA Generalized Timings Formula standard
>>>  
>>> +-  .. row 7
>>> +
>>> +   -  ``V4L2_DV_BT_STD_SDI``
>>> +
>>> +   -  The timings follow the SDI Timings standard.
>>> + There are not always horizontal syncs/porches or similar in this 
>>> format.
>>> + If it is not precised by standard, blanking timings must be set in
>>> + hsync or vsync fields by default.
>>
>> OK. This is confusing. The text was changed after my question about 
>> something porch-like
>> in the SMPTE-125M standard. But I see nothing like that after re-reading it.
>>
>> So what sort of 'porch' timing were you thinking of?
> 
> In SMPTE-125M for example, the time between the real horizontal blanking is 
> precised (16 pixelclock).
> For me it looks like front porch timing.

Well, for some variants it is actually half-timings (21.5). In addition, it 
doesn't
seem to be used at all, it is just to relate the analog hsync to the digital 
sample.

>> I wonder if I shouldn't just use the text from your first patch:
>>
>>-  ``V4L2_DV_BT_STD_SDI``
>>
>>-  The timings follow the SDI Timings standard.
>>There are no horizontal syncs/porches at all in this format.
>>Total blanking timings must be set in hsync or vsync fields only.
> 
> I agree with that if you prefer, after all the front/backporch are probably 
> irrelevant in this case.
> So, if you confirm this way, I would send you another patchset to fix that.

I think we should stick to this text.

Regards,

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


[GIT PULL FOR v4.9] Various fixes, enhancements

2016-09-15 Thread Hans Verkuil
The following changes since commit c3b809834db8b1a8891c7ff873a216eac119628d:

  [media] pulse8-cec: fix compiler warning (2016-09-12 06:42:44 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git for-v4.9e

for you to fetch changes up to 1f2f86f0e97a2afcbaf5400de40ef225e8e47a42:

  vivid: fix error return code in vivid_create_instance() (2016-09-15 11:36:30 
+0200)


Andrey Utkin (2):
  tw5864: constify vb2_ops structure
  tw5864: constify struct video_device template

Arnd Bergmann (1):
  pulse8-cec: avoid uninitialized data use

Colin Ian King (1):
  pxa_camera: fix spelling mistake: "dequeud" -> "dequeued"

Hans Verkuil (1):
  v4l-drivers/fourcc.rst: fix typo

Jean Delvare (1):
  cec: fix Kconfig help text

Johan Fjeldtvedt (1):
  pulse8-cec: store logical address mask

Songjun Wu (1):
  atmel-isc: set the format on the first open

Tiffany Lin (1):
  vcodec: mediatek: Add V4L2_CAP_TIMEPERFRAME capability setting

Wei Yongjun (3):
  pxa_camera: fix error return code in pxa_camera_probe()
  pxa_camera: remove duplicated include from pxa_camera.c
  vivid: fix error return code in vivid_create_instance()

 Documentation/media/v4l-drivers/fourcc.rst |  2 +-
 drivers/media/pci/tw5864/tw5864-video.c|  4 ++--
 drivers/media/platform/atmel/atmel-isc.c   | 30 
++
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c |  3 +++
 drivers/media/platform/pxa_camera.c| 11 +++
 drivers/media/platform/vivid/vivid-core.c  |  5 -
 drivers/staging/media/cec/Kconfig  |  3 ---
 drivers/staging/media/pulse8-cec/pulse8-cec.c  | 38 
+-
 8 files changed, 72 insertions(+), 24 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 1/2] st-hva: encoding summary at instance release

2016-09-15 Thread Hans Verkuil
Hi Jean-Christophe,

I think it would be better to add a Kconfig option to explicitly enable this 
encoding/performance
summary.

Wouldn't debugfs be more appropriate for this? Especially given the next patch.

Regards,

Hans

On 09/12/2016 06:01 PM, Jean-Christophe Trotin wrote:
> This patch prints unconditionnaly a short summary about the encoding
> operation at each instance closing, for debug purpose:
> - information about the stream (format, profile, level, resolution)
> - performance information (number of encoded frames, maximum framerate)
> - potential (system, encoding...) errors
> 
> Signed-off-by: Yannick Fertre 
> Signed-off-by: Jean-Christophe Trotin 
> ---
>  drivers/media/platform/sti/hva/Makefile|   2 +-
>  drivers/media/platform/sti/hva/hva-debug.c | 125 
> +
>  drivers/media/platform/sti/hva/hva-h264.c  |   6 ++
>  drivers/media/platform/sti/hva/hva-hw.c|   5 ++
>  drivers/media/platform/sti/hva/hva-mem.c   |   5 +-
>  drivers/media/platform/sti/hva/hva-v4l2.c  |  30 ---
>  drivers/media/platform/sti/hva/hva.h   |  27 +++
>  7 files changed, 188 insertions(+), 12 deletions(-)
>  create mode 100644 drivers/media/platform/sti/hva/hva-debug.c
> 
> diff --git a/drivers/media/platform/sti/hva/Makefile 
> b/drivers/media/platform/sti/hva/Makefile
> index ffb69ce..0895d2d 100644
> --- a/drivers/media/platform/sti/hva/Makefile
> +++ b/drivers/media/platform/sti/hva/Makefile
> @@ -1,2 +1,2 @@
>  obj-$(CONFIG_VIDEO_STI_HVA) := st-hva.o
> -st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o hva-h264.o
> +st-hva-y := hva-v4l2.o hva-hw.o hva-mem.o hva-h264.o hva-debug.o
> diff --git a/drivers/media/platform/sti/hva/hva-debug.c 
> b/drivers/media/platform/sti/hva/hva-debug.c
> new file mode 100644
> index 000..71bbf32
> --- /dev/null
> +++ b/drivers/media/platform/sti/hva/hva-debug.c
> @@ -0,0 +1,125 @@
> +/*
> + * Copyright (C) STMicroelectronics SA 2015
> + * Authors: Yannick Fertre 
> + *  Hugues Fruchet 
> + * License terms:  GNU General Public License (GPL), version 2
> + */
> +
> +#include "hva.h"
> +
> +/*
> + * encoding summary
> + */
> +
> +char *hva_dbg_summary(struct hva_ctx *ctx)
> +{
> + struct hva_streaminfo *stream = >streaminfo;
> + struct hva_frameinfo *frame = >frameinfo;
> + struct hva_ctx_dbg *dbg = >dbg;
> + static char str[200] = "";
> + char *cur = str;
> + size_t left = sizeof(str);
> + int cnt = 0;
> + int ret = 0;
> + u32 errors;
> +
> + /* frame info */
> + cur += cnt;
> + left -= cnt;
> + ret = snprintf(cur, left, "%4.4s %dx%d > ",
> +(char *)>pixelformat,
> +frame->aligned_width, frame->aligned_height);
> + cnt = (left > ret ? ret : left);
> +
> + /* stream info */
> + cur += cnt;
> + left -= cnt;
> + ret = snprintf(cur, left, "%4.4s %dx%d %s %s: ",
> +(char *)>streamformat,
> +stream->width, stream->height,
> +stream->profile, stream->level);
> + cnt = (left > ret ? ret : left);
> +
> + /* performance info */
> + cur += cnt;
> + left -= cnt;
> + ret = snprintf(cur, left, "%d frames encoded", dbg->cnt_duration);
> + cnt = (left > ret ? ret : left);
> +
> + if (dbg->cnt_duration && dbg->total_duration) {
> + u64 div;
> + u32 fps;
> +
> + div = (u64)dbg->cnt_duration * 10;
> + do_div(div, dbg->total_duration);
> + fps = (u32)div;
> + cur += cnt;
> + left -= cnt;
> + ret = snprintf(cur, left, ", max fps (0.1Hz)=%d", fps);
> + cnt = (left > ret ? ret : left);
> + }
> +
> + /* error info */
> + errors = dbg->sys_errors + dbg->encode_errors + dbg->frame_errors;
> + if (errors) {
> + cur += cnt;
> + left -= cnt;
> + ret = snprintf(cur, left, ", %d errors", errors);
> + cnt = (left > ret ? ret : left);
> + }
> +
> + return str;
> +}
> +
> +/*
> + * performance debug info
> + */
> +
> +void hva_dbg_perf_begin(struct hva_ctx *ctx)
> +{
> + struct hva_ctx_dbg *dbg = >dbg;
> +
> + dbg->begin = ktime_get();
> +
> + /*
> +  * filter sequences valid for performance:
> +  * - begin/begin (no stream available) is an invalid sequence
> +  * - begin/end is a valid sequence
> +  */
> + dbg->is_valid_period = false;
> +}
> +
> +void hva_dbg_perf_end(struct hva_ctx *ctx, struct hva_stream *stream)
> +{
> + struct device *dev = ctx_to_dev(ctx);
> + u64 div;
> + u32 duration;
> + u32 bytesused;
> + u32 timestamp;
> + struct hva_ctx_dbg *dbg = >dbg;
> + ktime_t end = ktime_get();
> +
> + /* stream bytesused and timestamp in us */
> + bytesused = vb2_get_plane_payload(>vbuf.vb2_buf, 0);
> + div = 

[PATCH 0/5] smiapp: Runtime PM support

2016-09-15 Thread Sakari Ailus
Hi,

This set adds runtime PM support for the smiapp driver. The old s_power()
callback is made redundant and removed as a result.

These patches go on top of my other patches in the "[PATCH v2 00/17] More
smiapp cleanups, fixes" which I just sent to linux-media.

The patches can also be found here:



-- 
Kind regards,
Sakari

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


[PATCH 5/5] smiapp: Implement support for autosuspend

2016-09-15 Thread Sakari Ailus
Delay suspending the device by 1000 ms by default.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index ba5ad36..313f037 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -1559,7 +1559,8 @@ static int smiapp_set_stream(struct v4l2_subdev *subdev, 
int enable)
rval = smiapp_stop_streaming(sensor);
sensor->streaming = false;
 
-   pm_runtime_put(>dev);
+   pm_runtime_mark_last_busy(>dev);
+   pm_runtime_put_autosuspend(>dev);
}
 
return rval;
@@ -2327,7 +2328,8 @@ smiapp_sysfs_nvm_read(struct device *dev, struct 
device_attribute *attr,
dev_err(>dev, "nvm read failed\n");
return -ENODEV;
}
-   pm_runtime_put(>dev);
+   pm_runtime_mark_last_busy(>dev);
+   pm_runtime_put_autosuspend(>dev);
}
/*
 * NVM is still way below a PAGE_SIZE, so we can safely
@@ -3038,7 +3040,9 @@ static int smiapp_probe(struct i2c_client *client,
if (rval < 0)
goto out_media_entity_cleanup;
 
-   pm_runtime_put(>dev);
+   pm_runtime_set_autosuspend_delay(>dev, 1000);
+   pm_runtime_use_autosuspend(>dev);
+   pm_runtime_put_autosuspend(>dev);
 
return 0;
 
-- 
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 1/5] smiapp: Drop BUG_ON() in suspend path

2016-09-15 Thread Sakari Ailus
Checking that the mutex is not acquired is unnecessary for user processes
are stopped by this point. Drop the check.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 61827fd..bdc5d1b 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2687,8 +2687,6 @@ static int smiapp_suspend(struct device *dev)
struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
bool streaming;
 
-   BUG_ON(mutex_is_locked(>mutex));
-
if (sensor->power_count == 0)
return 0;
 
-- 
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 4/5] smiapp: Use runtime PM

2016-09-15 Thread Sakari Ailus
Use runtime PM to manage power. The s_power() core sub-device callback is
removed as it is no longer needed.

The power management of the sensor is changed so that it is no longer
dependent on open file descriptors on sub-device or use_count in the media
entity but solely will be powered on as needed for probing and streaming.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 139 +
 drivers/media/i2c/smiapp/smiapp.h  |  11 +--
 2 files changed, 71 insertions(+), 79 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index e1d1459..ba5ad36 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -415,10 +416,14 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
struct smiapp_sensor *sensor =
container_of(ctrl->handler, struct smiapp_subdev, ctrl_handler)
->sensor;
+   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
u32 orient = 0;
int exposure;
int rval;
 
+   if (pm_runtime_suspended(>dev))
+   return 0;
+
switch (ctrl->id) {
case V4L2_CID_ANALOGUE_GAIN:
return smiapp_write(
@@ -922,6 +927,9 @@ static int smiapp_update_mode(struct smiapp_sensor *sensor)
unsigned int binning_mode;
int rval;
 
+   if (pm_runtime_suspended(>dev))
+   return 0;
+
/* Binning has to be set up here; it affects limits */
if (sensor->binning_horizontal == 1 &&
sensor->binning_vertical == 1) {
@@ -1198,9 +1206,17 @@ out:
  * Power management
  */
 
-static int smiapp_power_on(struct smiapp_sensor *sensor)
+static int smiapp_power_on(struct device *dev)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
+   struct i2c_client *client = to_i2c_client(dev);
+   struct v4l2_subdev *subdev = i2c_get_clientdata(client);
+   struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
+   /*
+* The sub-device related to the I2C device is always the
+* source one, i.e. ssds[0].
+*/
+   struct smiapp_sensor *sensor =
+   container_of(ssd, struct smiapp_sensor, ssds[0]);
unsigned int sleep;
int rval;
 
@@ -1326,6 +1342,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
return 0;
 
 out_cci_addr_fail:
+
gpiod_set_value(sensor->xshutdown, 0);
clk_disable_unprepare(sensor->ext_clk);
 
@@ -1334,8 +1351,14 @@ out_xclk_fail:
return rval;
 }
 
-static void smiapp_power_off(struct smiapp_sensor *sensor)
+static int smiapp_power_off(struct device *dev)
 {
+   struct i2c_client *client = to_i2c_client(dev);
+   struct v4l2_subdev *subdev = i2c_get_clientdata(client);
+   struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
+   struct smiapp_sensor *sensor =
+   container_of(ssd, struct smiapp_sensor, ssds[0]);
+
/*
 * Currently power/clock to lens are enable/disabled separately
 * but they are essentially the same signals. So if the sensor is
@@ -1353,31 +1376,8 @@ static void smiapp_power_off(struct smiapp_sensor 
*sensor)
usleep_range(5000, 5000);
regulator_disable(sensor->vana);
sensor->streaming = false;
-}
-
-static int smiapp_set_power(struct v4l2_subdev *subdev, int on)
-{
-   struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
-   int ret = 0;
-
-   mutex_lock(>power_mutex);
-
-   if (on && !sensor->power_count) {
-   /* Power on and perform initialisation. */
-   ret = smiapp_power_on(sensor);
-   if (ret < 0)
-   goto out;
-   } else if (!on && sensor->power_count == 1) {
-   smiapp_power_off(sensor);
-   }
-
-   /* Update the power count. */
-   sensor->power_count += on ? 1 : -1;
-   WARN_ON(sensor->power_count < 0);
 
-out:
-   mutex_unlock(>power_mutex);
-   return ret;
+   return 0;
 }
 
 /* 
-
@@ -1535,6 +1535,7 @@ out:
 
 static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable)
 {
+   struct i2c_client *client = v4l2_get_subdevdata(subdev);
struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
int rval;
 
@@ -1542,13 +1543,23 @@ static int smiapp_set_stream(struct v4l2_subdev 
*subdev, int enable)
return 0;
 
if (enable) {
+   rval = pm_runtime_get_sync(>dev);
+   if (rval < 0) {
+   pm_runtime_put(>dev);
+   return rval;
+   }
+
sensor->streaming = true;
rval = smiapp_start_streaming(sensor);
-  

[PATCH 3/5] smiapp: Set use suspend and resume ops for other functions

2016-09-15 Thread Sakari Ailus
Use the suspend and resume ops for freeze, thaw, poweroff and restore
callbacks as well.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index fe1f738..e1d1459 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -3090,8 +3090,7 @@ static const struct i2c_device_id smiapp_id_table[] = {
 MODULE_DEVICE_TABLE(i2c, smiapp_id_table);
 
 static const struct dev_pm_ops smiapp_pm_ops = {
-   .suspend= smiapp_suspend,
-   .resume = smiapp_resume,
+   SET_SYSTEM_SLEEP_PM_OPS(smiapp_suspend, smiapp_resume)
 };
 
 static struct i2c_driver smiapp_i2c_driver = {
-- 
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/5] smiapp: Set device for pixel array and binner

2016-09-15 Thread Sakari Ailus
The dev field of the v4l2_subdev was left NULL for the pixel array and
binner sub-devices. Fix this.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index bdc5d1b..fe1f738 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2589,6 +2589,7 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
 
ssd->sd.internal_ops = _internal_ops;
ssd->sd.owner = THIS_MODULE;
+   ssd->sd.dev = >dev;
v4l2_set_subdevdata(>sd, client);
 }
 
-- 
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


[GIT PULL FOR v4.9] MediaTek video decoder and MDP drivers

2016-09-15 Thread Hans Verkuil
Hi Mauro,

This adds the mediatek video decoder and MDP driver.

This patch series depends on a bunch of fixes that are currently pending for 
4.8:

a21cb70 vcodec:mediatek: Refine VP8 encoder driver
84b313f vcodec:mediatek: Refine H264 encoder driver
55673f3 vcodec:mediatek: change H264 profile default to profile high
b321ac9 vcodec:mediatek: Add timestamp and timecode copy for V4L2 Encoder
b44d7f7 vcodec:mediatek: Fix visible_height larger than coded_height issue in 
s_fmt_out
d7500e9 vcodec:mediatek: Fix fops_vcodec_release flow for V4L2 Encoder
c9487c9 vcodec:mediatek:code refine for v4l2 Encoder driver

After these fixes the video decoder is added, then support for the opaque MT21C 
format
is added and finally the MDP driver is added that can handle the MT21C format.

There are two small items pending:

A suggestion to improve the MT21C documentation:

https://patchwork.linuxtv.org/patch/37003/

And some COMPILE_TEST build warnings for the MDP driver:

https://lkml.org/lkml/2016/9/14/355

However, these aren't show stoppers and I'm sure these will be resolved in 
follow-up patches.

Regards,

Hans

The following changes since commit c3b809834db8b1a8891c7ff873a216eac119628d:

  [media] pulse8-cec: fix compiler warning (2016-09-12 06:42:44 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git mtkdec

for you to fetch changes up to 6f73b74462aa52704c1ffe8ae765743c9af60f12:

  media: mtk-mdp: add Maintainers entry for Mediatek MDP driver (2016-09-14 
14:12:29 +0200)


Andrew-CT Chen (1):
  VPU: mediatek: Add decode support

Colin Ian King (1):
  VPU: mediatek: fix null pointer dereference on pdev

Julia Lawall (1):
  vcodec: mediatek: fix odd_ptr_err.cocci warnings

Minghsiu Tsai (6):
  VPU: mediatek: Add mdp support
  dt-bindings: Add a binding for Mediatek MDP
  media: Add Mediatek MDP Driver
  arm64: dts: mediatek: Add MDP for MT8173
  media: mtk-mdp: support pixelformat V4L2_PIX_FMT_MT21C
  media: mtk-mdp: add Maintainers entry for Mediatek MDP driver

Tiffany Lin (19):
  vcodec:mediatek:code refine for v4l2 Encoder driver
  vcodec:mediatek: Fix fops_vcodec_release flow for V4L2 Encoder
  vcodec:mediatek: Fix visible_height larger than coded_height issue in 
s_fmt_out
  vcodec:mediatek: Add timestamp and timecode copy for V4L2 Encoder
  vcodec:mediatek: change H264 profile default to profile high
  vcodec:mediatek: Refine H264 encoder driver
  vcodec:mediatek: Refine VP8 encoder driver
  vcodec: mediatek: Add V4L2_CAP_TIMEPERFRAME capability setting
  dt-bindings: Add a binding for Mediatek Video Decoder
  vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver
  vcodec: mediatek: Add Mediatek H264 Video Decoder Drive
  vcodec: mediatek: Add Mediatek VP8 Video Decoder Driver
  Add documentation for V4L2_PIX_FMT_VP9.
  vcodec: mediatek: Add Mediatek VP9 Video Decoder Driver
  vcodec: mediatek: add Maintainers entry for Mediatek MT8173 vcodec drivers
  v4l: add Mediatek compressed video block format
  docs-rst: Add compressed video formats used on MT8173 codec driver
  vcodec: mediatek: Add V4L2_PIX_FMT_MT21C support for v4l2 decoder
  arm64: dts: mediatek: Add Video Decoder for MT8173

Wu-Cheng Li (2):
  videodev2.h: add V4L2_PIX_FMT_VP9 format.
  v4l2-ioctl: add VP9 format description.

 Documentation/devicetree/bindings/media/mediatek-mdp.txt|  109 +
 Documentation/devicetree/bindings/media/mediatek-vcodec.txt |   57 ++-
 Documentation/media/uapi/v4l/pixfmt-013.rst |8 +
 Documentation/media/uapi/v4l/pixfmt-reserved.rst|   10 +
 MAINTAINERS |   18 +
 arch/arm64/boot/dts/mediatek/mt8173.dtsi|  128 ++
 drivers/media/platform/Kconfig  |   17 +
 drivers/media/platform/Makefile |2 +
 drivers/media/platform/mtk-mdp/Makefile |9 +
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.c   |  159 +++
 drivers/media/platform/mtk-mdp/mtk_mdp_comp.h   |   72 +++
 drivers/media/platform/mtk-mdp/mtk_mdp_core.c   |  294 
+
 drivers/media/platform/mtk-mdp/mtk_mdp_core.h   |  260 +++
 drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h|  126 ++
 drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c| 1278 
+
 drivers/media/platform/mtk-mdp/mtk_mdp_m2m.h|   22 +
 drivers/media/platform/mtk-mdp/mtk_mdp_regs.c   |  156 +++
 drivers/media/platform/mtk-mdp/mtk_mdp_regs.h   |   31 ++
 drivers/media/platform/mtk-mdp/mtk_mdp_vpu.c|  145 +++
 drivers/media/platform/mtk-mdp/mtk_mdp_vpu.h|   41 ++
 

Re: [PATCH v1 2/2] st-hva: add debug file system

2016-09-15 Thread Hans Verkuil
Same thing here: this should be enabled in a Kconfig option. That new Kconfig
option should depend on DEBUG_FS as well.

BTW (independent of these two patches): I think it would be easier to maintain
if you make a Kconfig file in the sti directory, rather than adding them to the
Kconfig in platform.

Regards,

Hans

On 09/12/2016 06:01 PM, Jean-Christophe Trotin wrote:
> This patch creates 4 static debugfs entries to dump:
> - the device-related information ("st-hva/device")
> - the list of registered encoders ("st-hva/encoders")
> - the current values of the hva registers ("st-hva/regs")
> - the information about the last closed instance ("st-hva/last")
> 
> It also creates dynamically a debugfs entry for each opened instance,
> ("st-hva/") to dump:
> - the information about the stream (profile, level, resolution,
>   alignment...)
> - the control parameters (bitrate mode, framerate, GOP size...)
> - the potential (system, encoding...) errors
> - the performance information about the encoding (HW processing
>   duration, average bitrate, average framerate...)
> Each time a running instance is closed, its context (including the
> debug information) is saved to feed, on demand, the last closed
> instance debugfs entry.
> 
> Signed-off-by: Yannick Fertre 
> Signed-off-by: Jean-Christophe Trotin 
> ---
>  drivers/media/platform/sti/hva/hva-debug.c | 362 
> +
>  drivers/media/platform/sti/hva/hva-hw.c|  39 
>  drivers/media/platform/sti/hva/hva-hw.h|   1 +
>  drivers/media/platform/sti/hva/hva-v4l2.c  |  11 +-
>  drivers/media/platform/sti/hva/hva.h   |  86 +--
>  5 files changed, 482 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/hva/hva-debug.c 
> b/drivers/media/platform/sti/hva/hva-debug.c
> index 71bbf32..433b1d4 100644
> --- a/drivers/media/platform/sti/hva/hva-debug.c
> +++ b/drivers/media/platform/sti/hva/hva-debug.c
> @@ -5,7 +5,113 @@
>   * License terms:  GNU General Public License (GPL), version 2
>   */
>  
> +#include 
> +
>  #include "hva.h"
> +#include "hva-hw.h"
> +
> +static void format_ctx(struct seq_file *s, struct hva_ctx *ctx)
> +{
> + struct hva_streaminfo *stream = >streaminfo;
> + struct hva_frameinfo *frame = >frameinfo;
> + struct hva_controls *ctrls = >ctrls;
> + struct hva_ctx_dbg *dbg = >dbg;
> + u32 bitrate_mode, aspect, entropy, vui_sar, sei_fp;
> +
> + seq_printf(s, "|-%s\n  |\n", ctx->name);
> +
> + seq_printf(s, "  |-[%sframe info]\n",
> +ctx->flags & HVA_FLAG_FRAMEINFO ? "" : "default ");
> + seq_printf(s, "  | |- pixel format=%4.4s\n"
> +   "  | |- wxh=%dx%d\n"
> +   "  | |- wxh (w/ encoder alignment constraint)=%dx%d\n"
> +   "  |\n",
> +   (char *)>pixelformat,
> +   frame->width, frame->height,
> +   frame->aligned_width, frame->aligned_height);
> +
> + seq_printf(s, "  |-[%sstream info]\n",
> +ctx->flags & HVA_FLAG_STREAMINFO ? "" : "default ");
> + seq_printf(s, "  | |- stream format=%4.4s\n"
> +   "  | |- wxh=%dx%d\n"
> +   "  | |- %s\n"
> +   "  | |- %s\n"
> +   "  |\n",
> +   (char *)>streamformat,
> +   stream->width, stream->height,
> +   stream->profile, stream->level);
> +
> + bitrate_mode = V4L2_CID_MPEG_VIDEO_BITRATE_MODE;
> + aspect = V4L2_CID_MPEG_VIDEO_ASPECT;
> + seq_puts(s, "  |-[parameters]\n");
> + seq_printf(s, "  | |- %s\n"
> +   "  | |- bitrate=%d bps\n"
> +   "  | |- GOP size=%d\n"
> +   "  | |- video aspect=%s\n"
> +   "  | |- framerate=%d/%d\n",
> +   v4l2_ctrl_get_menu(bitrate_mode)[ctrls->bitrate_mode],
> +   ctrls->bitrate,
> +   ctrls->gop_size,
> +   v4l2_ctrl_get_menu(aspect)[ctrls->aspect],
> +   ctrls->time_per_frame.denominator,
> +   ctrls->time_per_frame.numerator);
> +
> + entropy = V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE;
> + vui_sar = V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC;
> + sei_fp =  V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE;
> + if (stream->streamformat == V4L2_PIX_FMT_H264) {
> + seq_printf(s, "  | |- %s entropy mode\n"
> +   "  | |- CPB size=%d kB\n"
> +   "  | |- DCT8x8 enable=%s\n"
> +   "  | |- qpmin=%d\n"
> +   "  | |- qpmax=%d\n"
> +   "  | |- PAR enable=%s\n"
> +   "  | |- PAR id=%s\n"
> +   "  | |- SEI frame packing enable=%s\n"
> +   "  | |- SEI frame packing type=%s\n",
> +   

[PATCH v2 14/17] smiapp: Remove useless newlines and other small cleanups

2016-09-15 Thread Sakari Ailus
The code probably has been unindented at some point but rewrapping has not
been done. Do it now.

Also remove a useless memory allocation failure message.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 33 +
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 8b042e2..3548225 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -442,8 +442,7 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
orient |= SMIAPP_IMAGE_ORIENTATION_VFLIP;
 
orient ^= sensor->hvflip_inv_mask;
-   rval = smiapp_write(sensor,
-   SMIAPP_REG_U8_IMAGE_ORIENTATION,
+   rval = smiapp_write(sensor, SMIAPP_REG_U8_IMAGE_ORIENTATION,
orient);
if (rval < 0)
return rval;
@@ -458,10 +457,8 @@ static int smiapp_set_ctrl(struct v4l2_ctrl *ctrl)
__smiapp_update_exposure_limits(sensor);
 
if (exposure > sensor->exposure->maximum) {
-   sensor->exposure->val =
-   sensor->exposure->maximum;
-   rval = smiapp_set_ctrl(
-   sensor->exposure);
+   sensor->exposure->val = sensor->exposure->maximum;
+   rval = smiapp_set_ctrl(sensor->exposure);
if (rval < 0)
return rval;
}
@@ -1318,8 +1315,7 @@ static int smiapp_power_on(struct smiapp_sensor *sensor)
if (!sensor->pixel_array)
return 0;
 
-   rval = v4l2_ctrl_handler_setup(
-   >pixel_array->ctrl_handler);
+   rval = v4l2_ctrl_handler_setup(>pixel_array->ctrl_handler);
if (rval)
goto out_cci_addr_fail;
 
@@ -1625,7 +1621,8 @@ static int __smiapp_get_format(struct v4l2_subdev *subdev,
struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
 
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
-   fmt->format = *v4l2_subdev_get_try_format(subdev, cfg, 
fmt->pad);
+   fmt->format = *v4l2_subdev_get_try_format(subdev, cfg,
+ fmt->pad);
} else {
struct v4l2_rect *r;
 
@@ -1725,7 +1722,6 @@ static void smiapp_propagate(struct v4l2_subdev *subdev,
 static const struct smiapp_csi_data_format
 *smiapp_validate_csi_data_format(struct smiapp_sensor *sensor, u32 code)
 {
-   const struct smiapp_csi_data_format *csi_format = sensor->csi_format;
unsigned int i;
 
for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) {
@@ -1734,7 +1730,7 @@ static const struct smiapp_csi_data_format
return _csi_data_formats[i];
}
 
-   return csi_format;
+   return sensor->csi_format;
 }
 
 static int smiapp_set_format_source(struct v4l2_subdev *subdev,
@@ -2068,8 +2064,7 @@ static int smiapp_set_compose(struct v4l2_subdev *subdev,
smiapp_set_compose_scaler(subdev, cfg, sel, crops, comp);
 
*comp = sel->r;
-   smiapp_propagate(subdev, cfg, sel->which,
-V4L2_SEL_TGT_COMPOSE);
+   smiapp_propagate(subdev, cfg, sel->which, V4L2_SEL_TGT_COMPOSE);
 
if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return smiapp_update_mode(sensor);
@@ -2146,9 +2141,8 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
->height;
src_size = &_r;
} else {
-   src_size =
-   v4l2_subdev_get_try_compose(
-   subdev, cfg, ssd->sink_pad);
+   src_size = v4l2_subdev_get_try_compose(
+   subdev, cfg, ssd->sink_pad);
}
}
 
@@ -2617,7 +2611,8 @@ static int smiapp_open(struct v4l2_subdev *sd, struct 
v4l2_subdev_fh *fh)
for (i = 0; i < ssd->npads; i++) {
struct v4l2_mbus_framefmt *try_fmt =
v4l2_subdev_get_try_format(sd, fh->pad, i);
-   struct v4l2_rect *try_crop = v4l2_subdev_get_try_crop(sd, 
fh->pad, i);
+   struct v4l2_rect *try_crop =
+   v4l2_subdev_get_try_crop(sd, fh->pad, i);
struct v4l2_rect *try_comp;
 
smiapp_get_native_size(ssd, try_crop);
@@ -2856,8 +2851,7 @@ static int smiapp_probe(struct i2c_client *client,
return -EPROBE_DEFER;
}
 
-   rval = clk_set_rate(sensor->ext_clk,
-   sensor->hwcfg->ext_clk);
+   rval = clk_set_rate(sensor->ext_clk, sensor->hwcfg->ext_clk);
if (rval < 0) {
   

[PATCH v2 09/17] smiapp: Read frame format earlier

2016-09-15 Thread Sakari Ailus
The information gathered during frame format reading will be required
earlier in the initialisation when it was available. Also return an error
if frame format cannot be obtained.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 0b5671c..c9aee83 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2890,6 +2890,12 @@ static int smiapp_probe(struct i2c_client *client,
goto out_power_off;
}
 
+   rval = smiapp_read_frame_fmt(sensor);
+   if (rval) {
+   rval = -ENODEV;
+   goto out_power_off;
+   }
+
/*
 * Handle Sensor Module orientation on the board.
 *
@@ -3013,8 +3019,6 @@ static int smiapp_probe(struct i2c_client *client,
 
sensor->pixel_array->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
-   /* final steps */
-   smiapp_read_frame_fmt(sensor);
rval = smiapp_init_controls(sensor);
if (rval < 0)
goto out_cleanup;
-- 
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 v2 01/17] smiapp: Move sub-device initialisation into a separate function

2016-09-15 Thread Sakari Ailus
Simplify smiapp_init() by moving the initialisation of individual
sub-devices to a separate function.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 108 +++--
 1 file changed, 49 insertions(+), 59 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 44f8c7e..862017e 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2535,11 +2535,55 @@ static void smiapp_cleanup(struct smiapp_sensor *sensor)
smiapp_free_controls(sensor);
 }
 
+static void smiapp_create_subdev(struct smiapp_sensor *sensor,
+struct smiapp_subdev *ssd, const char *name)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
+
+   if (ssd != sensor->src)
+   v4l2_subdev_init(>sd, _ops);
+
+   ssd->sensor = sensor;
+
+   if (ssd == sensor->pixel_array) {
+   ssd->npads = 1;
+   } else {
+   ssd->npads = 2;
+   ssd->source_pad = 1;
+   }
+
+   snprintf(ssd->sd.name,
+sizeof(ssd->sd.name), "%s %s %d-%4.4x", sensor->minfo.name,
+name, i2c_adapter_id(client->adapter), client->addr);
+
+   ssd->sink_fmt.width =
+   sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
+   ssd->sink_fmt.height =
+   sensor->limits[SMIAPP_LIMIT_Y_ADDR_MAX] + 1;
+   ssd->compose.width = ssd->sink_fmt.width;
+   ssd->compose.height = ssd->sink_fmt.height;
+   ssd->crop[ssd->source_pad] = ssd->compose;
+   ssd->pads[ssd->source_pad].flags = MEDIA_PAD_FL_SOURCE;
+   if (ssd != sensor->pixel_array) {
+   ssd->crop[ssd->sink_pad] = ssd->compose;
+   ssd->pads[ssd->sink_pad].flags = MEDIA_PAD_FL_SINK;
+   }
+
+   ssd->sd.entity.ops = _entity_ops;
+
+   if (ssd == sensor->src)
+   return;
+
+   ssd->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+   ssd->sd.internal_ops = _internal_ops;
+   ssd->sd.owner = THIS_MODULE;
+   v4l2_set_subdevdata(>sd, client);
+}
+
 static int smiapp_init(struct smiapp_sensor *sensor)
 {
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
struct smiapp_pll *pll = >pll;
-   struct smiapp_subdev *last = NULL;
unsigned int i;
int rval;
 
@@ -2700,64 +2744,10 @@ static int smiapp_init(struct smiapp_sensor *sensor)
if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS;
 
-   for (i = 0; i < SMIAPP_SUBDEVS; i++) {
-   struct {
-   struct smiapp_subdev *ssd;
-   char *name;
-   } const __this[] = {
-   { sensor->scaler, "scaler", },
-   { sensor->binner, "binner", },
-   { sensor->pixel_array, "pixel array", },
-   }, *_this = &__this[i];
-   struct smiapp_subdev *this = _this->ssd;
-
-   if (!this)
-   continue;
-
-   if (this != sensor->src)
-   v4l2_subdev_init(>sd, _ops);
-
-   this->sensor = sensor;
-
-   if (this == sensor->pixel_array) {
-   this->npads = 1;
-   } else {
-   this->npads = 2;
-   this->source_pad = 1;
-   }
-
-   snprintf(this->sd.name,
-sizeof(this->sd.name), "%s %s %d-%4.4x",
-sensor->minfo.name, _this->name,
-i2c_adapter_id(client->adapter), client->addr);
-
-   this->sink_fmt.width =
-   sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
-   this->sink_fmt.height =
-   sensor->limits[SMIAPP_LIMIT_Y_ADDR_MAX] + 1;
-   this->compose.width = this->sink_fmt.width;
-   this->compose.height = this->sink_fmt.height;
-   this->crop[this->source_pad] = this->compose;
-   this->pads[this->source_pad].flags = MEDIA_PAD_FL_SOURCE;
-   if (this != sensor->pixel_array) {
-   this->crop[this->sink_pad] = this->compose;
-   this->pads[this->sink_pad].flags = MEDIA_PAD_FL_SINK;
-   }
-
-   this->sd.entity.ops = _entity_ops;
-
-   if (last == NULL) {
-   last = this;
-   continue;
-   }
-
-   this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-   this->sd.internal_ops = _internal_ops;
-   this->sd.owner = THIS_MODULE;
-   v4l2_set_subdevdata(>sd, client);
-
-   last = this;
-   }
+   if (sensor->scaler)
+   smiapp_create_subdev(sensor, sensor->scaler, "scaler");
+   

[PATCH v2 08/17] smiapp: Merge smiapp_init() with smiapp_probe()

2016-09-15 Thread Sakari Ailus
The smiapp_probe() is the sole caller of smiapp_init(). Unify the two.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 425 -
 1 file changed, 205 insertions(+), 220 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 13322f3..0b5671c 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2605,224 +2605,6 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
v4l2_set_subdevdata(>sd, client);
 }
 
-static int smiapp_init(struct smiapp_sensor *sensor)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
-   struct smiapp_pll *pll = >pll;
-   unsigned int i;
-   int rval;
-
-   sensor->vana = devm_regulator_get(>dev, "vana");
-   if (IS_ERR(sensor->vana)) {
-   dev_err(>dev, "could not get regulator for vana\n");
-   return PTR_ERR(sensor->vana);
-   }
-
-   sensor->ext_clk = devm_clk_get(>dev, NULL);
-   if (IS_ERR(sensor->ext_clk)) {
-   dev_err(>dev, "could not get clock (%ld)\n",
-   PTR_ERR(sensor->ext_clk));
-   return -EPROBE_DEFER;
-   }
-
-   rval = clk_set_rate(sensor->ext_clk,
-   sensor->hwcfg->ext_clk);
-   if (rval < 0) {
-   dev_err(>dev,
-   "unable to set clock freq to %u\n",
-   sensor->hwcfg->ext_clk);
-   return rval;
-   }
-
-   sensor->xshutdown = devm_gpiod_get_optional(>dev, "xshutdown",
-   GPIOD_OUT_LOW);
-   if (IS_ERR(sensor->xshutdown))
-   return PTR_ERR(sensor->xshutdown);
-
-   rval = smiapp_power_on(sensor);
-   if (rval)
-   return -ENODEV;
-
-   rval = smiapp_identify_module(sensor);
-   if (rval) {
-   rval = -ENODEV;
-   goto out_power_off;
-   }
-
-   rval = smiapp_get_all_limits(sensor);
-   if (rval) {
-   rval = -ENODEV;
-   goto out_power_off;
-   }
-
-   /*
-* Handle Sensor Module orientation on the board.
-*
-* The application of H-FLIP and V-FLIP on the sensor is modified by
-* the sensor orientation on the board.
-*
-* For SMIAPP_BOARD_SENSOR_ORIENT_180 the default behaviour is to set
-* both H-FLIP and V-FLIP for normal operation which also implies
-* that a set/unset operation for user space HFLIP and VFLIP v4l2
-* controls will need to be internally inverted.
-*
-* Rotation also changes the bayer pattern.
-*/
-   if (sensor->hwcfg->module_board_orient ==
-   SMIAPP_MODULE_BOARD_ORIENT_180)
-   sensor->hvflip_inv_mask = SMIAPP_IMAGE_ORIENTATION_HFLIP |
- SMIAPP_IMAGE_ORIENTATION_VFLIP;
-
-   rval = smiapp_call_quirk(sensor, limits);
-   if (rval) {
-   dev_err(>dev, "limits quirks failed\n");
-   goto out_power_off;
-   }
-
-   if (sensor->limits[SMIAPP_LIMIT_BINNING_CAPABILITY]) {
-   u32 val;
-
-   rval = smiapp_read(sensor,
-  SMIAPP_REG_U8_BINNING_SUBTYPES, );
-   if (rval < 0) {
-   rval = -ENODEV;
-   goto out_power_off;
-   }
-   sensor->nbinning_subtypes = min_t(u8, val,
- SMIAPP_BINNING_SUBTYPES);
-
-   for (i = 0; i < sensor->nbinning_subtypes; i++) {
-   rval = smiapp_read(
-   sensor, SMIAPP_REG_U8_BINNING_TYPE_n(i), );
-   if (rval < 0) {
-   rval = -ENODEV;
-   goto out_power_off;
-   }
-   sensor->binning_subtypes[i] =
-   *(struct smiapp_binning_subtype *)
-
-   dev_dbg(>dev, "binning %xx%x\n",
-   sensor->binning_subtypes[i].horizontal,
-   sensor->binning_subtypes[i].vertical);
-   }
-   }
-   sensor->binning_horizontal = 1;
-   sensor->binning_vertical = 1;
-
-   if (device_create_file(>dev, _attr_ident) != 0) {
-   dev_err(>dev, "sysfs ident entry creation failed\n");
-   rval = -ENOENT;
-   goto out_power_off;
-   }
-   /* SMIA++ NVM initialization - it will be read from the sensor
-* when it is first requested by userspace.
-*/
-   if (sensor->minfo.smiapp_version && sensor->hwcfg->nvm_size) {
-   sensor->nvm = devm_kzalloc(>dev,
-   sensor->hwcfg->nvm_size, GFP_KERNEL);

[PATCH v2 04/17] smiapp: Split off sub-device registration into two

2016-09-15 Thread Sakari Ailus
Remove the loop in sub-device registration and create each sub-device
explicitly instead.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 82 +++---
 1 file changed, 45 insertions(+), 37 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 0a03f30..9022ffc 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2475,54 +2475,62 @@ static const struct v4l2_subdev_ops smiapp_ops;
 static const struct v4l2_subdev_internal_ops smiapp_internal_ops;
 static const struct media_entity_operations smiapp_entity_ops;
 
-static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
+static int smiapp_register_subdev(struct smiapp_sensor *sensor,
+ struct smiapp_subdev *ssd,
+ struct smiapp_subdev *sink_ssd,
+ u16 source_pad, u16 sink_pad, u32 link_flags)
 {
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
-   struct smiapp_subdev *ssds[] = {
-   sensor->scaler,
-   sensor->binner,
-   sensor->pixel_array,
-   };
-   unsigned int i;
int rval;
 
-   for (i = 0; i < SMIAPP_SUBDEVS - 1; i++) {
-   struct smiapp_subdev *this = ssds[i + 1];
-   struct smiapp_subdev *last = ssds[i];
+   if (!sink_ssd)
+   return 0;
 
-   if (!last)
-   continue;
+   rval = media_entity_pads_init(>sd.entity,
+ ssd->npads, ssd->pads);
+   if (rval) {
+   dev_err(>dev,
+   "media_entity_pads_init failed\n");
+   return rval;
+   }
 
-   rval = media_entity_pads_init(>sd.entity,
-this->npads, this->pads);
-   if (rval) {
-   dev_err(>dev,
-   "media_entity_pads_init failed\n");
-   return rval;
-   }
+   rval = v4l2_device_register_subdev(sensor->src->sd.v4l2_dev,
+  >sd);
+   if (rval) {
+   dev_err(>dev,
+   "v4l2_device_register_subdev failed\n");
+   return rval;
+   }
 
-   rval = v4l2_device_register_subdev(sensor->src->sd.v4l2_dev,
-  >sd);
-   if (rval) {
-   dev_err(>dev,
-   "v4l2_device_register_subdev failed\n");
-   return rval;
-   }
+   rval = media_create_pad_link(>sd.entity, source_pad,
+_ssd->sd.entity, sink_pad,
+link_flags);
+   if (rval) {
+   dev_err(>dev,
+   "media_create_pad_link failed\n");
+   return rval;
+   }
 
-   rval = media_create_pad_link(>sd.entity,
-this->source_pad,
->sd.entity,
-last->sink_pad,
-MEDIA_LNK_FL_ENABLED |
-MEDIA_LNK_FL_IMMUTABLE);
-   if (rval) {
-   dev_err(>dev,
-   "media_create_pad_link failed\n");
+   return 0;
+}
+
+static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
+{
+   int rval;
+
+   if (sensor->scaler) {
+   rval = smiapp_register_subdev(
+   sensor, sensor->binner, sensor->scaler,
+   SMIAPP_PAD_SRC, SMIAPP_PAD_SINK,
+   MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
+   if (rval < 0)
return rval;
-   }
}
 
-   return 0;
+   return smiapp_register_subdev(
+   sensor, sensor->pixel_array, sensor->binner,
+   SMIAPP_PA_PAD_SRC, SMIAPP_PAD_SINK,
+   MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
 }
 
 static void smiapp_cleanup(struct smiapp_sensor *sensor)
-- 
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 v2 11/17] smiapp: Use SMIAPP_PADS when referring to number of pads

2016-09-15 Thread Sakari Ailus
Replace plain value 2 with SMIAPP_PADS when referring to the number of
pads.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp.h 
b/drivers/media/i2c/smiapp/smiapp.h
index e71271e..f9febe0 100644
--- a/drivers/media/i2c/smiapp/smiapp.h
+++ b/drivers/media/i2c/smiapp/smiapp.h
@@ -157,9 +157,9 @@ struct smiapp_binning_subtype {
 
 struct smiapp_subdev {
struct v4l2_subdev sd;
-   struct media_pad pads[2];
+   struct media_pad pads[SMIAPP_PADS];
struct v4l2_rect sink_fmt;
-   struct v4l2_rect crop[2];
+   struct v4l2_rect crop[SMIAPP_PADS];
struct v4l2_rect compose; /* compose on sink */
unsigned short sink_pad;
unsigned short source_pad;
-- 
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 v2 17/17] smiapp-pll: Don't complain aloud about failing PLL calculation

2016-09-15 Thread Sakari Ailus
Don't complain about a failure to compute the pre_pll divisor. The
function is used to determine whether a particular combination of bits per
sample value and a link frequency can be used, in which case there are
lots of unnecessary driver messages. During normal operation the failure
generally does not happen. Use dev_dbg() instead.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp-pll.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c
index e3348db..771db56 100644
--- a/drivers/media/i2c/smiapp-pll.c
+++ b/drivers/media/i2c/smiapp-pll.c
@@ -479,7 +479,8 @@ int smiapp_pll_calculate(struct device *dev,
return 0;
}
 
-   dev_info(dev, "unable to compute pre_pll divisor\n");
+   dev_dbg(dev, "unable to compute pre_pll divisor\n");
+
return rval;
 }
 EXPORT_SYMBOL_GPL(smiapp_pll_calculate);
-- 
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 v2 03/17] smiapp: Initialise media entity after sensor init

2016-09-15 Thread Sakari Ailus
This allows determining the number of pads in the entity based on the
sensor.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index be74ba3..0a03f30 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -3056,12 +3056,7 @@ static int smiapp_probe(struct i2c_client *client,
sensor->src->sd.internal_ops = _internal_src_ops;
sensor->src->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
sensor->src->sensor = sensor;
-
sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
-   rval = media_entity_pads_init(>src->sd.entity, 2,
-sensor->src->pads);
-   if (rval < 0)
-   return rval;
 
if (client->dev.of_node) {
rval = smiapp_init(sensor);
@@ -3069,6 +3064,11 @@ static int smiapp_probe(struct i2c_client *client,
goto out_media_entity_cleanup;
}
 
+   rval = media_entity_pads_init(>src->sd.entity, 2,
+sensor->src->pads);
+   if (rval < 0)
+   goto out_media_entity_cleanup;
+
rval = v4l2_async_register_subdev(>src->sd);
if (rval < 0)
goto out_media_entity_cleanup;
-- 
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 v2 00/17] More smiapp cleanups, fixes

2016-09-15 Thread Sakari Ailus
Hi all,

This set further cleans up the smiapp driver and prepares for later
changes.

More fixes and cleanups since v1.

-- 
Kind regards,
Sakari


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


[PATCH v2 07/17] smiapp: Always initialise the sensor in probe

2016-09-15 Thread Sakari Ailus
Initialise the sensor in probe. The reason why it wasn't previously done
in case of platform data was that the probe() of the driver that provided
the clock through the set_xclk() callback would need to finish before the
probe() function of the smiapp driver. The set_xclk() callback no longer
exists.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 53 --
 1 file changed, 19 insertions(+), 34 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 5d251b4..13322f3 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2530,8 +2530,19 @@ static int smiapp_register_subdev(struct smiapp_sensor 
*sensor,
return 0;
 }
 
-static int smiapp_register_subdevs(struct smiapp_sensor *sensor)
+static void smiapp_cleanup(struct smiapp_sensor *sensor)
+{
+   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
+
+   device_remove_file(>dev, _attr_nvm);
+   device_remove_file(>dev, _attr_ident);
+
+   smiapp_free_controls(sensor);
+}
+
+static int smiapp_registered(struct v4l2_subdev *subdev)
 {
+   struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
int rval;
 
if (sensor->scaler) {
@@ -2540,23 +2551,18 @@ static int smiapp_register_subdevs(struct smiapp_sensor 
*sensor)
SMIAPP_PAD_SRC, SMIAPP_PAD_SINK,
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
if (rval < 0)
-   return rval;
+   goto out_err;
}
 
return smiapp_register_subdev(
sensor, sensor->pixel_array, sensor->binner,
SMIAPP_PA_PAD_SRC, SMIAPP_PAD_SINK,
MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE);
-}
 
-static void smiapp_cleanup(struct smiapp_sensor *sensor)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
-
-   device_remove_file(>dev, _attr_nvm);
-   device_remove_file(>dev, _attr_ident);
+out_err:
+   smiapp_cleanup(sensor);
 
-   smiapp_free_controls(sensor);
+   return rval;
 }
 
 static void smiapp_create_subdev(struct smiapp_sensor *sensor,
@@ -2817,25 +2823,6 @@ out_power_off:
return rval;
 }
 
-static int smiapp_registered(struct v4l2_subdev *subdev)
-{
-   struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
-   struct i2c_client *client = v4l2_get_subdevdata(subdev);
-   int rval;
-
-   if (!client->dev.of_node) {
-   rval = smiapp_init(sensor);
-   if (rval)
-   return rval;
-   }
-
-   rval = smiapp_register_subdevs(sensor);
-   if (rval)
-   smiapp_cleanup(sensor);
-
-   return rval;
-}
-
 static int smiapp_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 {
struct smiapp_subdev *ssd = to_smiapp_subdev(sd);
@@ -3077,11 +3064,9 @@ static int smiapp_probe(struct i2c_client *client,
sensor->src->sensor = sensor;
sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
 
-   if (client->dev.of_node) {
-   rval = smiapp_init(sensor);
-   if (rval)
-   goto out_media_entity_cleanup;
-   }
+   rval = smiapp_init(sensor);
+   if (rval)
+   goto out_media_entity_cleanup;
 
rval = media_entity_pads_init(>src->sd.entity, 2,
 sensor->src->pads);
-- 
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 v2 12/17] smiapp: Obtain frame layout from the frame descriptor

2016-09-15 Thread Sakari Ailus
Besides the image data, SMIA++ compliant sensors also provide embedded
data in form of registers used to capture the image. Store this
information for later use in frame descriptor and routing.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 44 ++
 drivers/media/i2c/smiapp/smiapp.h  |  5 +++-
 2 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index b446d0a..f09665d 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -68,10 +68,9 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
u32 fmt_model_type, fmt_model_subtype, ncol_desc, nrow_desc;
unsigned int i;
-   int rval;
+   int pixel_count = 0;
int line_count = 0;
-   int embedded_start = -1, embedded_end = -1;
-   int image_start = 0;
+   int rval;
 
rval = smiapp_read(sensor, SMIAPP_REG_U8_FRAME_FORMAT_MODEL_TYPE,
   _model_type);
@@ -166,33 +165,36 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
dev_dbg(>dev, "%s pixels: %d %s\n",
what, pixels, which);
 
-   if (i < ncol_desc)
+   if (i < ncol_desc) {
+   if (pixelcode ==
+   SMIAPP_FRAME_FORMAT_DESC_PIXELCODE_VISIBLE)
+   sensor->visible_pixel_start = pixel_count;
+   pixel_count += pixels;
continue;
+   }
 
/* Handle row descriptors */
-   if (pixelcode
-   == SMIAPP_FRAME_FORMAT_DESC_PIXELCODE_EMBEDDED) {
-   embedded_start = line_count;
-   } else {
-   if (pixelcode == 
SMIAPP_FRAME_FORMAT_DESC_PIXELCODE_VISIBLE
-   || pixels >= 
sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES] / 2)
-   image_start = line_count;
-   if (embedded_start != -1 && embedded_end == -1)
-   embedded_end = line_count;
+   switch (pixelcode) {
+   case SMIAPP_FRAME_FORMAT_DESC_PIXELCODE_EMBEDDED:
+   if (sensor->embedded_end)
+   break;
+   sensor->embedded_start = line_count;
+   sensor->embedded_end = line_count + pixels;
+   break;
+   case SMIAPP_FRAME_FORMAT_DESC_PIXELCODE_VISIBLE:
+   sensor->image_start = line_count;
+   break;
}
line_count += pixels;
}
 
-   if (embedded_start == -1 || embedded_end == -1) {
-   embedded_start = 0;
-   embedded_end = 0;
-   }
-
-   sensor->image_start = image_start;
+   if (sensor->embedded_end > sensor->image_start)
+   sensor->image_start = sensor->embedded_end;
 
dev_dbg(>dev, "embedded data from lines %d to %d\n",
-   embedded_start, embedded_end);
-   dev_dbg(>dev, "image data starts at line %d\n", image_start);
+   sensor->embedded_start, sensor->embedded_end);
+   dev_dbg(>dev, "image data starts at line %d\n",
+   sensor->image_start);
 
return 0;
 }
diff --git a/drivers/media/i2c/smiapp/smiapp.h 
b/drivers/media/i2c/smiapp/smiapp.h
index f9febe0..d7b52a6 100644
--- a/drivers/media/i2c/smiapp/smiapp.h
+++ b/drivers/media/i2c/smiapp/smiapp.h
@@ -213,7 +213,10 @@ struct smiapp_sensor {
 
u8 hvflip_inv_mask; /* H/VFLIP inversion due to sensor orientation */
u8 frame_skip;
-   u16 image_start;/* Offset to first line after metadata lines */
+   u16 embedded_start; /* embedded data start line */
+   u16 embedded_end;
+   u16 image_start; /* image data start line */
+   u16 visible_pixel_start; /* start pixel of the visible image */
 
int power_count;
 
-- 
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 v2 06/17] smiapp: Remove unnecessary BUG_ON()'s

2016-09-15 Thread Sakari Ailus
Instead, calculate how much is needed and then allocate the memory
dynamically.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 24 ++--
 drivers/media/i2c/smiapp/smiapp.h  |  8 ++--
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 31d74c1..5d251b4 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -621,7 +621,7 @@ static int smiapp_init_controls(struct smiapp_sensor 
*sensor)
 static int smiapp_init_late_controls(struct smiapp_sensor *sensor)
 {
unsigned long *valid_link_freqs = >valid_link_freqs[
-   sensor->csi_format->compressed - SMIAPP_COMPRESSED_BASE];
+   sensor->csi_format->compressed - sensor->compressed_min_bpp];
unsigned int max, i;
 
for (i = 0; i < ARRAY_SIZE(sensor->test_data); i++) {
@@ -754,6 +754,7 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor 
*sensor)
 {
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
struct smiapp_pll *pll = >pll;
+   u8 compressed_max_bpp = 0;
unsigned int type, n;
unsigned int i, pixel_order;
int rval;
@@ -826,16 +827,27 @@ static int smiapp_get_mbus_formats(struct smiapp_sensor 
*sensor)
pll->scale_m = sensor->scale_m;
 
for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) {
+   sensor->compressed_min_bpp =
+   min(smiapp_csi_data_formats[i].compressed,
+   sensor->compressed_min_bpp);
+   compressed_max_bpp =
+   max(smiapp_csi_data_formats[i].compressed,
+   compressed_max_bpp);
+   }
+
+   sensor->valid_link_freqs = devm_kcalloc(
+   >dev,
+   compressed_max_bpp - sensor->compressed_min_bpp + 1,
+   sizeof(*sensor->valid_link_freqs), GFP_KERNEL);
+
+   for (i = 0; i < ARRAY_SIZE(smiapp_csi_data_formats); i++) {
const struct smiapp_csi_data_format *f =
_csi_data_formats[i];
unsigned long *valid_link_freqs =
>valid_link_freqs[
-   f->compressed - SMIAPP_COMPRESSED_BASE];
+   f->compressed - sensor->compressed_min_bpp];
unsigned int j;
 
-   BUG_ON(f->compressed < SMIAPP_COMPRESSED_BASE);
-   BUG_ON(f->compressed > SMIAPP_COMPRESSED_MAX);
-
if (!(sensor->default_mbus_frame_fmts & 1 << i))
continue;
 
@@ -1769,7 +1781,7 @@ static int smiapp_set_format_source(struct v4l2_subdev 
*subdev,
 
valid_link_freqs = 
>valid_link_freqs[sensor->csi_format->compressed
- - SMIAPP_COMPRESSED_BASE];
+ - sensor->compressed_min_bpp];
 
__v4l2_ctrl_modify_range(
sensor->link_freq, 0,
diff --git a/drivers/media/i2c/smiapp/smiapp.h 
b/drivers/media/i2c/smiapp/smiapp.h
index aae72bc..e71271e 100644
--- a/drivers/media/i2c/smiapp/smiapp.h
+++ b/drivers/media/i2c/smiapp/smiapp.h
@@ -150,11 +150,6 @@ struct smiapp_csi_data_format {
 #define SMIAPP_PAD_SRC 1
 #define SMIAPP_PADS2
 
-#define SMIAPP_COMPRESSED_BASE 8
-#define SMIAPP_COMPRESSED_MAX  16
-#define SMIAPP_NR_OF_COMPRESSED(SMIAPP_COMPRESSED_MAX - \
-SMIAPP_COMPRESSED_BASE + 1)
-
 struct smiapp_binning_subtype {
u8 horizontal:4;
u8 vertical:4;
@@ -224,6 +219,7 @@ struct smiapp_sensor {
 
bool streaming;
bool dev_init_done;
+   u8 compressed_min_bpp;
 
u8 *nvm;/* nvm memory buffer */
unsigned int nvm_size;  /* bytes */
@@ -233,7 +229,7 @@ struct smiapp_sensor {
struct smiapp_pll pll;
 
/* Is a default format supported for a given BPP? */
-   unsigned long valid_link_freqs[SMIAPP_NR_OF_COMPRESSED];
+   unsigned long *valid_link_freqs;
 
/* Pixel array controls */
struct v4l2_ctrl *analog_gain;
-- 
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 v2 05/17] smiapp: Provide a common function to obtain native pixel array size

2016-09-15 Thread Sakari Ailus
The same pixel array size is required for the active format of each
sub-device sink pad and try format of each sink pad of each opened file
handle as well as for the native size rectangle.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 39 +-
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 9022ffc..31d74c1 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2161,6 +2161,15 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
return 0;
 }
 
+static void smiapp_get_native_size(struct smiapp_subdev *ssd,
+   struct v4l2_rect *r)
+{
+   r->top = 0;
+   r->left = 0;
+   r->width = ssd->sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
+   r->height = ssd->sensor->limits[SMIAPP_LIMIT_Y_ADDR_MAX] + 1;
+}
+
 static int __smiapp_get_selection(struct v4l2_subdev *subdev,
  struct v4l2_subdev_pad_config *cfg,
  struct v4l2_subdev_selection *sel)
@@ -2192,17 +2201,12 @@ static int __smiapp_get_selection(struct v4l2_subdev 
*subdev,
switch (sel->target) {
case V4L2_SEL_TGT_CROP_BOUNDS:
case V4L2_SEL_TGT_NATIVE_SIZE:
-   if (ssd == sensor->pixel_array) {
-   sel->r.left = sel->r.top = 0;
-   sel->r.width =
-   sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
-   sel->r.height =
-   sensor->limits[SMIAPP_LIMIT_Y_ADDR_MAX] + 1;
-   } else if (sel->pad == ssd->sink_pad) {
+   if (ssd == sensor->pixel_array)
+   smiapp_get_native_size(ssd, >r);
+   else if (sel->pad == ssd->sink_pad)
sel->r = sink_fmt;
-   } else {
+   else
sel->r = *comp;
-   }
break;
case V4L2_SEL_TGT_CROP:
case V4L2_SEL_TGT_COMPOSE_BOUNDS:
@@ -2561,10 +2565,8 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
 sizeof(ssd->sd.name), "%s %s %d-%4.4x", sensor->minfo.name,
 name, i2c_adapter_id(client->adapter), client->addr);
 
-   ssd->sink_fmt.width =
-   sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
-   ssd->sink_fmt.height =
-   sensor->limits[SMIAPP_LIMIT_Y_ADDR_MAX] + 1;
+   smiapp_get_native_size(ssd, >sink_fmt);
+
ssd->compose.width = ssd->sink_fmt.width;
ssd->compose.height = ssd->sink_fmt.height;
ssd->crop[ssd->source_pad] = ssd->compose;
@@ -2838,16 +2840,13 @@ static int smiapp_open(struct v4l2_subdev *sd, struct 
v4l2_subdev_fh *fh)
struct v4l2_rect *try_crop = v4l2_subdev_get_try_crop(sd, 
fh->pad, i);
struct v4l2_rect *try_comp;
 
-   try_fmt->width = sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
-   try_fmt->height = sensor->limits[SMIAPP_LIMIT_Y_ADDR_MAX] + 1;
+   smiapp_get_native_size(ssd, try_crop);
+
+   try_fmt->width = try_crop->width;
+   try_fmt->height = try_crop->height;
try_fmt->code = mbus_code;
try_fmt->field = V4L2_FIELD_NONE;
 
-   try_crop->top = 0;
-   try_crop->left = 0;
-   try_crop->width = try_fmt->width;
-   try_crop->height = try_fmt->height;
-
if (ssd != sensor->pixel_array)
continue;
 
-- 
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 v2 13/17] smiapp: Improve debug messages from frame layout reading

2016-09-15 Thread Sakari Ailus
Provide more debugging information on reading the frame layout.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 21 +
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index f09665d..8b042e2 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -100,12 +100,11 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
u32 pixels;
char *which;
char *what;
+   u32 reg;
 
if (fmt_model_type == SMIAPP_FRAME_FORMAT_MODEL_TYPE_2BYTE) {
-   rval = smiapp_read(
-   sensor,
-   SMIAPP_REG_U16_FRAME_FORMAT_DESCRIPTOR_2(i),
-   );
+   reg = SMIAPP_REG_U16_FRAME_FORMAT_DESCRIPTOR_2(i);
+   rval = smiapp_read(sensor, reg, );
if (rval)
return rval;
 
@@ -116,10 +115,8 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
pixels = desc & SMIAPP_FRAME_FORMAT_DESC_2_PIXELS_MASK;
} else if (fmt_model_type
   == SMIAPP_FRAME_FORMAT_MODEL_TYPE_4BYTE) {
-   rval = smiapp_read(
-   sensor,
-   SMIAPP_REG_U32_FRAME_FORMAT_DESCRIPTOR_4(i),
-   );
+   reg = SMIAPP_REG_U32_FRAME_FORMAT_DESCRIPTOR_4(i);
+   rval = smiapp_read(sensor, reg, );
if (rval)
return rval;
 
@@ -130,7 +127,7 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
pixels = desc & SMIAPP_FRAME_FORMAT_DESC_4_PIXELS_MASK;
} else {
dev_dbg(>dev,
-   "invalid frame format model type %d\n",
+   "0x8.8x invalid frame format model type %d\n",
fmt_model_type);
return -EINVAL;
}
@@ -158,12 +155,12 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
*sensor)
break;
default:
what = "invalid";
-   dev_dbg(>dev, "pixelcode %d\n", pixelcode);
break;
}
 
-   dev_dbg(>dev, "%s pixels: %d %s\n",
-   what, pixels, which);
+   dev_dbg(>dev,
+   "0x%8.8x %s pixels: %d %s (pixelcode %u)\n", reg,
+   what, pixels, which, pixelcode);
 
if (i < ncol_desc) {
if (pixelcode ==
-- 
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 v2 10/17] smiapp: Unify setting up sub-devices

2016-09-15 Thread Sakari Ailus
The initialisation of the source sub-device is somewhat different as it's
not created by the smiapp driver itself. Remove redundancy in initialising
the two kind of sub-devices.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index c9aee83..b446d0a 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2574,6 +2574,7 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
if (ssd != sensor->src)
v4l2_subdev_init(>sd, _ops);
 
+   ssd->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
ssd->sensor = sensor;
 
ssd->npads = num_pads;
@@ -2599,7 +2600,6 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
if (ssd == sensor->src)
return;
 
-   ssd->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
ssd->sd.internal_ops = _internal_ops;
ssd->sd.owner = THIS_MODULE;
v4l2_set_subdevdata(>sd, client);
@@ -2843,9 +2843,6 @@ static int smiapp_probe(struct i2c_client *client,
 
v4l2_i2c_subdev_init(>src->sd, client, _ops);
sensor->src->sd.internal_ops = _internal_src_ops;
-   sensor->src->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-   sensor->src->sensor = sensor;
-   sensor->src->pads[0].flags = MEDIA_PAD_FL_SOURCE;
 
sensor->vana = devm_regulator_get(>dev, "vana");
if (IS_ERR(sensor->vana)) {
-- 
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 v2 15/17] smiapp: Obtain correct media bus code for try format

2016-09-15 Thread Sakari Ailus
The media bus code obtained for try format may have been a code that the
sensor did not even support. Use a supported code with the current pixel
order.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 3548225..521afc0 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2602,8 +2602,6 @@ static int smiapp_open(struct v4l2_subdev *sd, struct 
v4l2_subdev_fh *fh)
 {
struct smiapp_subdev *ssd = to_smiapp_subdev(sd);
struct smiapp_sensor *sensor = ssd->sensor;
-   u32 mbus_code =
-   smiapp_csi_data_formats[smiapp_pixel_order(sensor)].code;
unsigned int i;
 
mutex_lock(>mutex);
@@ -2619,7 +2617,7 @@ static int smiapp_open(struct v4l2_subdev *sd, struct 
v4l2_subdev_fh *fh)
 
try_fmt->width = try_crop->width;
try_fmt->height = try_crop->height;
-   try_fmt->code = mbus_code;
+   try_fmt->code = sensor->internal_csi_format->code;
try_fmt->field = V4L2_FIELD_NONE;
 
if (ssd != sensor->pixel_array)
-- 
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 v2 16/17] smiapp: Drop a debug print on frame size and bit depth

2016-09-15 Thread Sakari Ailus
The first time the sensor is powered on, the information is not yet
available.

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

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 521afc0..61827fd 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -922,12 +922,6 @@ static int smiapp_update_mode(struct smiapp_sensor *sensor)
unsigned int binning_mode;
int rval;
 
-   dev_dbg(>dev, "frame size: %dx%d\n",
-   sensor->src->crop[SMIAPP_PAD_SRC].width,
-   sensor->src->crop[SMIAPP_PAD_SRC].height);
-   dev_dbg(>dev, "csi format width: %d\n",
-   sensor->csi_format->width);
-
/* Binning has to be set up here; it affects limits */
if (sensor->binning_horizontal == 1 &&
sensor->binning_vertical == 1) {
-- 
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


[GIT PULL FOR v4.9] Add stih CEC driver

2016-09-15 Thread Hans Verkuil
The following changes since commit c3b809834db8b1a8891c7ff873a216eac119628d:

  [media] pulse8-cec: fix compiler warning (2016-09-12 06:42:44 -0300)

are available in the git repository at:

  git://linuxtv.org/hverkuil/media_tree.git stcec

for you to fetch changes up to 25e8af2ec02b5ba76e34b687d80f8c58bb8db809:

  add maintainer for stih-cec driver (2016-09-15 10:38:23 +0200)


Benjamin Gaignard (4):
  bindings for stih-cec driver
  add stih-cec driver
  add stih-cec driver into DT
  add maintainer for stih-cec driver

 Documentation/devicetree/bindings/media/stih-cec.txt |  25 +
 MAINTAINERS  |   7 ++
 arch/arm/boot/dts/stih407-family.dtsi|  12 +++
 drivers/staging/media/Kconfig|   2 +
 drivers/staging/media/Makefile   |   1 +
 drivers/staging/media/st-cec/Kconfig |   8 ++
 drivers/staging/media/st-cec/Makefile|   1 +
 drivers/staging/media/st-cec/stih-cec.c  | 380 
+
 8 files changed, 436 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/stih-cec.txt
 create mode 100644 drivers/staging/media/st-cec/Kconfig
 create mode 100644 drivers/staging/media/st-cec/Makefile
 create mode 100644 drivers/staging/media/st-cec/stih-cec.c
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/17] smiapp: Explicitly define number of pads in initialisation

2016-09-15 Thread Sakari Ailus
Define the number of pads explicitly in initialising the sub-devices.

Signed-off-by: Sakari Ailus 
---
 drivers/media/i2c/smiapp/smiapp-core.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
b/drivers/media/i2c/smiapp/smiapp-core.c
index 862017e..be74ba3 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -2536,7 +2536,8 @@ static void smiapp_cleanup(struct smiapp_sensor *sensor)
 }
 
 static void smiapp_create_subdev(struct smiapp_sensor *sensor,
-struct smiapp_subdev *ssd, const char *name)
+struct smiapp_subdev *ssd, const char *name,
+unsigned short num_pads)
 {
struct i2c_client *client = v4l2_get_subdevdata(>src->sd);
 
@@ -2545,12 +2546,8 @@ static void smiapp_create_subdev(struct smiapp_sensor 
*sensor,
 
ssd->sensor = sensor;
 
-   if (ssd == sensor->pixel_array) {
-   ssd->npads = 1;
-   } else {
-   ssd->npads = 2;
-   ssd->source_pad = 1;
-   }
+   ssd->npads = num_pads;
+   ssd->source_pad = num_pads - 1;
 
snprintf(ssd->sd.name,
 sizeof(ssd->sd.name), "%s %s %d-%4.4x", sensor->minfo.name,
@@ -2745,9 +2742,9 @@ static int smiapp_init(struct smiapp_sensor *sensor)
pll->flags |= SMIAPP_PLL_FLAG_NO_OP_CLOCKS;
 
if (sensor->scaler)
-   smiapp_create_subdev(sensor, sensor->scaler, "scaler");
-   smiapp_create_subdev(sensor, sensor->binner, "binner");
-   smiapp_create_subdev(sensor, sensor->pixel_array, "pixel_array");
+   smiapp_create_subdev(sensor, sensor->scaler, "scaler", 2);
+   smiapp_create_subdev(sensor, sensor->binner, "binner", 2);
+   smiapp_create_subdev(sensor, sensor->pixel_array, "pixel_array", 1);
 
dev_dbg(>dev, "profile %d\n", sensor->minfo.smiapp_profile);
 
-- 
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 v7 0/2] rcar-vin EDID control ioctls

2016-09-15 Thread Ulrich Hecht
Hi!

This is a spinoff of "Lager/Koelsch board HDMI input support" that excludes
the DT portions, and that works without the unmerged subdevice abstraction
layer.

CU
Uli


Changes since v6:
- work without subdev abstraction layer
- split off DT parts, to be handled separately

Changes since v5:
- implement vin/subdev pad translation
- move i2c devices

Changes since v4:
- drop merged patches
- adv7604: always fall back to input 0 if nothing else is specified
- rcar-vin: implement G_EDID, S_EDID in place of hard-coded EDID blob

Changes since v3:
- rvin_enum_dv_timings(): use vin->src_pad_idx
- rvin_dv_timings_cap(): likewise
- rvin_s_dv_timings(): update vin->format
- add Koelsch support

Changes since v2:
- rebased on top of rcar-vin driver v4
- removed "adv7604: fix SPA register location for ADV7612" (picked up)
- changed prefix of dts patch to "ARM: dts: lager: "


Ulrich Hecht (2):
  media: adv7604: automatic "default-input" selection
  rcar-vin: implement EDID control ioctls

 drivers/media/i2c/adv7604.c |  5 +++-
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 44 +
 drivers/media/platform/rcar-vin/rcar-vin.h  |  1 +
 3 files changed, 49 insertions(+), 1 deletion(-)

-- 
2.9.3

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


[PATCH] [media] MAINTAINERS: Add entry for the Renesas VIN driver

2016-09-15 Thread Niklas Söderlund
The driver is maintained and supported, document it as such.

Signed-off-by: Niklas Söderlund 
---
 MAINTAINERS | 9 +
 1 file changed, 9 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a12cd60..a4b5283 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7523,6 +7523,15 @@ F:   
Documentation/devicetree/bindings/media/renesas,fcp.txt
 F: drivers/media/platform/rcar-fcp.c
 F: include/media/rcar-fcp.h
 
+MEDIA DRIVERS FOR RENESAS - VIN
+M: Niklas Söderlund 
+L: linux-media@vger.kernel.org
+L: linux-renesas-...@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Supported
+F: Documentation/devicetree/bindings/media/rcar_vin.txt
+F: drivers/media/platform/rcar-vin/
+
 MEDIA DRIVERS FOR RENESAS - VSP1
 M: Laurent Pinchart 
 L: linux-media@vger.kernel.org
-- 
2.9.3

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


[PATCH v7 1/2] media: adv7604: automatic "default-input" selection

2016-09-15 Thread Ulrich Hecht
Fall back to input 0 if "default-input" property is not present.

Additionally, documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Based on patch by William Towle .

Signed-off-by: Ulrich Hecht 
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4003831..055c9df 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3077,10 +3077,13 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
if (!of_property_read_u32(endpoint, "default-input", ))
state->pdata.default_input = v;
else
-   state->pdata.default_input = -1;
+   state->pdata.default_input = 0;
 
of_node_put(endpoint);
 
+   if (!of_property_read_u32(np, "default-input", ))
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.9.3

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