Re: [PATCH net-next] net: make ndo_get_stats64 a void function

2017-01-06 Thread kbuild test robot
Hi Stephen,

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Stephen-Hemminger/net-make-ndo_get_stats64-a-void-function/20170106-160123
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/broadcom/bnx2.c: In function 'bnx2_get_stats64':
>> drivers/net/ethernet/broadcom/bnx2.c:6830:10: warning: 'return' with a 
>> value, in function returning void
  return net_stats;
 ^
   drivers/net/ethernet/broadcom/bnx2.c:6825:1: note: declared here
bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 
*net_stats)
^~~~

vim +/return +6830 drivers/net/ethernet/broadcom/bnx2.c

5d07bf26 drivers/net/bnx2.c   Eric Dumazet  2010-07-08  
6814(((u64) (ctr##_hi) << 32) + (u64) (ctr##_lo))
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6815  
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6816  #define GET_64BIT_NET_STATS(ctr)  \
354fcd77 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6817GET_64BIT_NET_STATS64(bp->stats_blk->ctr) + \
354fcd77 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6818GET_64BIT_NET_STATS64(bp->temp_stats_blk->ctr)
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6819  
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6820  #define GET_32BIT_NET_STATS(ctr)  \
354fcd77 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6821(unsigned long) (bp->stats_blk->ctr +   \
354fcd77 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6822 bp->temp_stats_blk->ctr)
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6823  
1e665d95 drivers/net/ethernet/broadcom/bnx2.c Stephen Hemminger 2017-01-05  
6824  static void
5d07bf26 drivers/net/bnx2.c   Eric Dumazet  2010-07-08  
6825  bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 
*net_stats)
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6826  {
972ec0d4 drivers/net/bnx2.c   Michael Chan  2006-01-23  
6827struct bnx2 *bp = netdev_priv(dev);
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6828  
5d07bf26 drivers/net/bnx2.c   Eric Dumazet  2010-07-08  
6829if (bp->stats_blk == NULL)
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26 
@6830return net_stats;
5d07bf26 drivers/net/bnx2.c   Eric Dumazet  2010-07-08  
6831  
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6832net_stats->rx_packets =
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6833GET_64BIT_NET_STATS(stat_IfHCInUcastPkts) +
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6834GET_64BIT_NET_STATS(stat_IfHCInMulticastPkts) +
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6835GET_64BIT_NET_STATS(stat_IfHCInBroadcastPkts);
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6836  
b6016b76 drivers/net/bnx2.c   Michael Chan  2005-05-26  
6837net_stats->tx_packets =
a4743058 drivers/net/bnx2.c   Michael Chan  2010-01-17  
6838GET_64BIT_NET_STATS(stat_IfHCOutUcastPkts) +

:: The code at line 6830 was first introduced by commit
:: b6016b767397258b58163494a869f8f1199e6897 [BNX2]: New Broadcom gigabit 
network driver.

:: TO: Michael Chan 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [greybus-dev] [PATCH] MAINTAINERS: add greybus subsystem mailing list

2017-01-06 Thread Viresh Kumar
On 06-01-17, 08:20, Greg Kroah-Hartman wrote:
> From: Greg Kroah-Hartman 
> 
> The Greybus driver subsystem has a mailing list, so list it in the
> MAINTAINERS file so that people know to send patches there as well.
> 
> Signed-off-by: Greg Kroah-Hartman 
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index cfff2c9e3d94..f6cb07684cea 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -5504,6 +5504,7 @@ M:  Alex Elder 
>  M:   Greg Kroah-Hartman 
>  S:   Maintained
>  F:   drivers/staging/greybus/
> +L:   greybus-...@lists.linaro.org
>  
>  GREYBUS AUDIO PROTOCOLS DRIVERS
>  M:   Vaibhav Agarwal 

Reviewed-by: Viresh Kumar 

-- 
viresh
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next] net: make ndo_get_stats64 a void function

2017-01-06 Thread kbuild test robot
Hi Stephen,

[auto build test WARNING on net-next/master]

url:
https://github.com/0day-ci/linux/commits/Stephen-Hemminger/net-make-ndo_get_stats64-a-void-function/20170106-160123
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   drivers/net/macsec.c: In function 'macsec_get_stats64':
>> drivers/net/macsec.c:2897:3: warning: 'return' with a value, in function 
>> returning void
  return s;
  ^

vim +/return +2897 drivers/net/macsec.c

c09440f7 Sabrina Dubroca   2016-03-11  2881 unsigned int extra = 
macsec->secy.icv_len + macsec_extra_len(true);
c09440f7 Sabrina Dubroca   2016-03-11  2882  
c09440f7 Sabrina Dubroca   2016-03-11  2883 if (macsec->real_dev->mtu - 
extra < new_mtu)
c09440f7 Sabrina Dubroca   2016-03-11  2884 return -ERANGE;
c09440f7 Sabrina Dubroca   2016-03-11  2885  
c09440f7 Sabrina Dubroca   2016-03-11  2886 dev->mtu = new_mtu;
c09440f7 Sabrina Dubroca   2016-03-11  2887  
c09440f7 Sabrina Dubroca   2016-03-11  2888 return 0;
c09440f7 Sabrina Dubroca   2016-03-11  2889  }
c09440f7 Sabrina Dubroca   2016-03-11  2890  
1e665d95 Stephen Hemminger 2017-01-05  2891  static void 
macsec_get_stats64(struct net_device *dev,
c09440f7 Sabrina Dubroca   2016-03-11  2892struct 
rtnl_link_stats64 *s)
c09440f7 Sabrina Dubroca   2016-03-11  2893  {
c09440f7 Sabrina Dubroca   2016-03-11  2894 int cpu;
c09440f7 Sabrina Dubroca   2016-03-11  2895  
c09440f7 Sabrina Dubroca   2016-03-11  2896 if (!dev->tstats)
c09440f7 Sabrina Dubroca   2016-03-11 @2897 return s;
c09440f7 Sabrina Dubroca   2016-03-11  2898  
c09440f7 Sabrina Dubroca   2016-03-11  2899 for_each_possible_cpu(cpu) {
c09440f7 Sabrina Dubroca   2016-03-11  2900 struct pcpu_sw_netstats 
*stats;
c09440f7 Sabrina Dubroca   2016-03-11  2901 struct pcpu_sw_netstats 
tmp;
c09440f7 Sabrina Dubroca   2016-03-11  2902 int start;
c09440f7 Sabrina Dubroca   2016-03-11  2903  
c09440f7 Sabrina Dubroca   2016-03-11  2904 stats = 
per_cpu_ptr(dev->tstats, cpu);
c09440f7 Sabrina Dubroca   2016-03-11  2905 do {

:: The code at line 2897 was first introduced by commit
:: c09440f7dcb304002dfced8c0fea289eb25f2da0 macsec: introduce IEEE 802.1AE 
driver

:: TO: Sabrina Dubroca 
:: CC: David S. Miller 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: greybus: remove timesync protocol support

2017-01-06 Thread Johan Hovold
On Thu, Jan 05, 2017 at 06:39:12PM +0100, Greg Kroah-Hartman wrote:
> From: Greg Kroah-Hartman 
> 
> While the timesync protocol was a great idea, it never ended up getting
> implemented by any known hardware devices.  It's also a bit
> "interesting" in how it ties into the platform controller.
> 
> So, just remove it for now.  It's not needed, no one uses it, and it's a
> stumbling block in getting the greybus core code merged out of the
> staging tree.  If anyone wants it in the future, reverting this patch is
> a great place to start from.
> 
> Signed-off-by: Greg Kroah-Hartman 

Reviewed-by: Johan Hovold 

> Note, there are some remants in the arche-platform driver, but that's
> probably next on the chopping block, so I didn't unwind it from there as
> it's a bit more complex, and it never gets built so no one will see
> it...

There are also some protocol op-code and USB vendor requests that should
be removed (and marked reserved), but that can be done in a follow-on as
well.

Thanks,
Johan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] MAINTAINERS: add greybus subsystem mailing list

2017-01-06 Thread Johan Hovold
On Fri, Jan 06, 2017 at 08:20:03AM +0100, Greg Kroah-Hartman wrote:
> From: Greg Kroah-Hartman 
> 
> The Greybus driver subsystem has a mailing list, so list it in the
> MAINTAINERS file so that people know to send patches there as well.
> 
> Signed-off-by: Greg Kroah-Hartman 

Acked-by: Johan Hovold 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: vt6656: Align lines to match open parenthesis

2017-01-06 Thread Baruch Nissenbaum
fixing checkpatch.pl check: Alignment should match open parenthesis

Signed-off-by: Baruch Nissenbaum 
---
 drivers/staging/vt6656/int.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index 73538fb..c6ffbe0 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -142,7 +142,7 @@ void vnt_int_process_data(struct vnt_private *priv)
 
if (int_data->isr0 != 0) {
if (int_data->isr0 & ISR_BNTX &&
-   priv->op_mode == NL80211_IFTYPE_AP)
+   priv->op_mode == NL80211_IFTYPE_AP)
vnt_schedule_command(priv, WLAN_CMD_BECON_SEND);
 
if (int_data->isr0 & ISR_TBTT &&
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 11/19] media: imx: Add CSI subdev driver

2017-01-06 Thread Steve Longerbeam



On 01/04/2017 05:44 AM, Vladimir Zapolskiy wrote:



diff --git a/drivers/staging/media/imx/imx-csi.c 
b/drivers/staging/media/imx/imx-csi.c
new file mode 100644
index 000..975eafb
--- /dev/null
+++ b/drivers/staging/media/imx/imx-csi.c
@@ -0,0 +1,638 @@
+/*
+ * V4L2 Capture CSI Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2014-2016 Mentor Graphics Inc.
+ *
+ * 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 

Please add the headers alphabetically ordered.


done.


+
+static int csi_start(struct csi_priv *priv)
+{
+   int ret;
+
+   if (!priv->sensor) {
+   v4l2_err(&priv->sd, "no sensor attached\n");
+   return -EINVAL;
+   }
+
+   ret = csi_setup(priv);
+   if (ret)
+   return ret;
+
+   /* start the frame interval monitor */
+   ret = imx_media_fim_set_stream(priv->fim, priv->sensor, true);
+   if (ret)
+   return ret;
+
+   ret = ipu_csi_enable(priv->csi);
+   if (ret) {
+   v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
+   return ret;
+   }
+
+   return 0;

if (ret)
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);

return ret;


I failed to cleanup in this path, so it is now:

ret = ipu_csi_enable(priv->csi);
if (ret) {
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
goto fim_off;
}

return 0;
fim_off:
if (priv->fim)
imx_media_fim_set_stream(priv->fim, priv->sensor, false);
return ret;


+
+static int csi_link_setup(struct media_entity *entity,
+ const struct media_pad *local,
+ const struct media_pad *remote, u32 flags)
+{
+   struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
+   struct csi_priv *priv = v4l2_get_subdevdata(sd);
+   struct v4l2_subdev *remote_sd;
+
+   dev_dbg(priv->dev, "link setup %s -> %s", remote->entity->name,
+   local->entity->name);
+
+   remote_sd = media_entity_to_v4l2_subdev(remote->entity);
+
+   if (local->flags & MEDIA_PAD_FL_SINK) {
+   if (flags & MEDIA_LNK_FL_ENABLED) {
+   if (priv->src_sd)
+   return -EBUSY;
+   priv->src_sd = remote_sd;
+   } else {
+   priv->src_sd = NULL;
+   return 0;

You can remove the return above.


right, fixed.




+
+   ret = v4l2_async_register_subdev(&priv->sd);
+   if (ret)
+   goto free_ctrls;
+
+   return 0;
+free_ctrls:
+   v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
+   return ret;

This is a functionally equal and simplified version:

if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);

return ret;


thanks, done.


+
+static struct platform_driver imx_csi_driver = {
+   .probe = imx_csi_probe,
+   .remove = imx_csi_remove,
+   .id_table = imx_csi_ids,
+   .driver = {
+   .name = "imx-ipuv3-csi",
+   .owner = THIS_MODULE,

Please drop .owner.


ok, I tested this and there are no regressions, done
for all modules.

Steve

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 12/19] media: imx: Add SMFC subdev driver

2017-01-06 Thread Steve Longerbeam



On 01/04/2017 06:23 AM, Vladimir Zapolskiy wrote:

On 01/03/2017 10:57 PM, Steve Longerbeam wrote:

This is a media entity subdevice driver for the i.MX Sensor Multi-FIFO
Controller module. Video frames are received from the CSI and can
be routed to various sinks including the i.MX Image Converter for
scaling, color-space conversion, motion compensated deinterlacing,
and image rotation.

Signed-off-by: Steve Longerbeam 
---
  drivers/staging/media/imx/Makefile   |   1 +
  drivers/staging/media/imx/imx-smfc.c | 739 +++
  2 files changed, 740 insertions(+)
  create mode 100644 drivers/staging/media/imx/imx-smfc.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 133672a..3559d7b 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o
  obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
  
  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o

+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o

May be

obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o imx-smfc.o


I'd prefer to keep them on separate lines, to indicate they
are all built as separate modules.



  
diff --git a/drivers/staging/media/imx/imx-smfc.c b/drivers/staging/media/imx/imx-smfc.c

new file mode 100644
index 000..565048c
--- /dev/null
+++ b/drivers/staging/media/imx/imx-smfc.c
@@ -0,0 +1,739 @@
+/*
+ * V4L2 Capture SMFC Subdev for Freescale i.MX5/6 SOC
+ *
+ * This subdevice handles capture of raw/unconverted video frames
+ * from the CSI, directly to memory via the Sensor Multi-FIFO Controller.
+ *
+ * Copyright (c) 2012-2016 Mentor Graphics Inc.
+ *
+ * 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 
+#include 

Please sort the list of headers alphabetically.


done.




+static irqreturn_t imx_smfc_eof_interrupt(int irq, void *dev_id)
+{
+   struct imx_smfc_priv *priv = dev_id;
+   struct imx_media_dma_buf *done, *next;
+   unsigned long flags;
+
+   spin_lock_irqsave(&priv->irqlock, flags);

spin_lock(&priv->irqlock) should be sufficient.


yes thanks.




+
+static const struct platform_device_id imx_smfc_ids[] = {
+   { .name = "imx-ipuv3-smfc" },
+   { },
+};
+MODULE_DEVICE_TABLE(platform, imx_smfc_ids);
+
+static struct platform_driver imx_smfc_driver = {
+   .probe = imx_smfc_probe,
+   .remove = imx_smfc_remove,
+   .id_table = imx_smfc_ids,
+   .driver = {
+   .name = "imx-ipuv3-smfc",
+   .owner = THIS_MODULE,

You can drop owner assignment.


done.


Steve

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 14/19] media: imx: Add Camera Interface subdev driver

2017-01-06 Thread Steve Longerbeam



On 01/04/2017 06:55 AM, Vladimir Zapolskiy wrote:

On 01/03/2017 10:57 PM, Steve Longerbeam wrote:


diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index d2a962c..fe9e992 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
  
  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o

  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
-
+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o

obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o imx-csi.o imx-smfc.o

as an option.


I prefer to keep on separate lines as explained earlier.




diff --git a/drivers/staging/media/imx/imx-camif.c 
b/drivers/staging/media/imx/imx-camif.c
new file mode 100644
index 000..3cf167e
--- /dev/null
+++ b/drivers/staging/media/imx/imx-camif.c
@@ -0,0 +1,1010 @@
+/*
+ * Video Camera Capture Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2012-2016 Mentor Graphics Inc.
+ *
+ * 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 
+#include 
+#include 

Please sort the list of headers alphabetically.


done.


+#include 
+#include 
+#include "imx-media.h"
+
+#define DEVICE_NAME "imx-media-camif"

I would propose to drop this macro.


done.


+
+#define CAMIF_DQ_TIMEOUT5000

Add a comment about time unit?


actually that was ancient and no longer used, removed.




+
+struct camif_priv;
+

This is a leftover apparently.


ditto, removed.


+
+   ret = v4l2_async_register_subdev(&priv->sd);
+   if (ret)
+   goto free_ctrls;
+
+   return 0;
+free_ctrls:
+   v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
+   return ret;

A shorter version:

if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);

return ret;


done.


+
+static struct platform_driver imx_camif_driver = {
+   .probe  = camif_probe,
+   .remove = camif_remove,
+   .driver = {
+   .name   = DEVICE_NAME,
+   .owner  = THIS_MODULE,

Please drop the owner assignment.


done.


Steve

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 13/19] media: imx: Add IC subdev drivers

2017-01-06 Thread Steve Longerbeam



On 01/04/2017 06:48 AM, Vladimir Zapolskiy wrote:

On 01/03/2017 10:57 PM, Steve Longerbeam wrote:


+
+   ret = ic_ops[priv->task_id]->init(priv);
+   if (ret)
+   return ret;
+
+   ret = v4l2_async_register_subdev(&priv->sd);
+   if (ret)
+   goto remove;
+
+   return 0;
+remove:
+   ic_ops[priv->task_id]->remove(priv);
+   return ret;

if (ret)
ic_ops[priv->task_id]->remove(priv);

return ret;

as an alternative.


done.




+
+static struct platform_driver imx_ic_driver = {
+   .probe = imx_ic_probe,
+   .remove = imx_ic_remove,
+   .id_table = imx_ic_ids,
+   .driver = {
+   .name = "imx-ipuv3-ic",
+   .owner = THIS_MODULE,
Please drop .owner assignment.


done.


diff --git a/drivers/staging/media/imx/imx-ic-pp.c 
b/drivers/staging/media/imx/imx-ic-pp.c
new file mode 100644
index 000..5ef0581
--- /dev/null
+++ b/drivers/staging/media/imx/imx-ic-pp.c
@@ -0,0 +1,636 @@
+/*
+ * V4L2 IC Post-Processor Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2014-2016 Mentor Graphics Inc.
+ *
+ * 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 

Please sort the list of headers alphabetically.


done.





+
+   priv->out_run = kzalloc(IMX_MEDIA_MAX_RING_BUFS *
+   sizeof(*priv->out_run), GFP_KERNEL);
+   if (!priv->out_run) {
+   v4l2_err(&ic_priv->sd, "failed to alloc src ring runs\n");

In OOM situation the core will report it, probably you can drop the message.


with a backtrace? I can't remember, if not I'd like to keep this.


diff --git a/drivers/staging/media/imx/imx-ic-prpenc.c 
b/drivers/staging/media/imx/imx-ic-prpenc.c
new file mode 100644
index 000..e17216b
--- /dev/null
+++ b/drivers/staging/media/imx/imx-ic-prpenc.c
@@ -0,0 +1,1037 @@
+/*
+ * V4L2 Capture IC Encoder Subdev for Freescale i.MX5/6 SOC
+ *
+ * This subdevice handles capture of video frames from the CSI, which
+ * are routed directly to the Image Converter preprocess encode task,
+ * for resizing, colorspace conversion, and rotation.
+ *
+ * Copyright (c) 2012-2016 Mentor Graphics Inc.
+ *
+ * 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 
+#include 

Please sort the list of headers alphabetically.


done.




+static irqreturn_t prpenc_eof_interrupt(int irq, void *dev_id)
+{
+   struct prpenc_priv *priv = dev_id;
+   struct imx_media_dma_buf *done, *next;
+   struct ipuv3_channel *channel;
+   unsigned long flags;
+
+   spin_lock_irqsave(&priv->irqlock, flags);

Here spin_lock(&priv->irqlock) should be sufficient.


done.


+
+   ret = media_entity_pads_init(&sd->entity, PRPENC_NUM_PADS, priv->pad);
+   if (ret)
+   goto free_ctrls;
+
+   return 0;
+free_ctrls:
+   v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
+   return ret;

if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);

return ret;

version is shorter.


done.



diff --git a/drivers/staging/media/imx/imx-ic-prpvf.c 
b/drivers/staging/media/imx/imx-ic-prpvf.c

new file mode 100644
index 000..53ce006
--- /dev/null
+++ b/drivers/staging/media/imx/imx-ic-prpvf.c
@@ -0,0 +1,1180 @@
+/*
+ * V4L2 IC Deinterlacer Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2014-2016 Mentor Graphics Inc.
+ *
+ * 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 

Please sort the list of headers alphabetically.


done.




+/* prpvf_out_ch EOF interrupt (progressive frame ready) */
+static irqreturn_t prpvf_out_eof_interrupt(int irq, void *dev_id)
+{
+   struct prpvf_priv *priv = dev_id;
+   struct imx_media_dma_buf *done;
+   unsigned long flags;
+
+   spin_lock_irqsave(&priv->irqlock, flags);


Here spin_lock(&priv->irqlock) should be sufficient.


done.




diff --git a/drivers/staging/media/imx/imx-ic.h 
b/drivers/staging/media/imx/imx-ic.h
new file mode 

Re: [PATCH v2 15/19] media: imx: Add MIPI CSI-2 Receiver subdev driver

2017-01-06 Thread Steve Longerbeam



On 01/04/2017 07:05 AM, Vladimir Zapolskiy wrote:

On 01/03/2017 10:57 PM, Steve Longerbeam wrote:

Adds MIPI CSI-2 Receiver subdev driver. This subdev is required
for sensors with a MIPI CSI2 interface.

Signed-off-by: Steve Longerbeam 
---
  drivers/staging/media/imx/Makefile|   1 +
  drivers/staging/media/imx/imx-mipi-csi2.c | 509 ++
  2 files changed, 510 insertions(+)
  create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index fe9e992..0decef7 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o
diff --git a/drivers/staging/media/imx/imx-mipi-csi2.c 
b/drivers/staging/media/imx/imx-mipi-csi2.c
new file mode 100644
index 000..84df16e
--- /dev/null
+++ b/drivers/staging/media/imx/imx-mipi-csi2.c
@@ -0,0 +1,509 @@
+/*
+ * MIPI CSI-2 Receiver Subdev for Freescale i.MX5/6 SOC.
+ *
+ * Copyright (c) 2012-2014 Mentor Graphics Inc.
+ *
+ * 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 
+#include 
+#include 

Please sort the list of headers alphabetically.


done.




+#include 

Why do you need to include this header?


good question. In fact this include list was in need of a lot of pruning,
so I paired it down to the essentials.


+static int imxcsi2_s_stream(struct v4l2_subdev *sd, int enable)
+{
+   struct imxcsi2_dev *csi2 = sd_to_dev(sd);
+   int i, ret = 0;
+
+   if (!csi2->src_sd)
+   return -EPIPE;
+   for (i = 0; i < CSI2_NUM_SRC_PADS; i++) {
+   if (csi2->sink_sd[i])
+   break;
+   }
+   if (i >= CSI2_NUM_SRC_PADS)
+   return -EPIPE;
+
+   v4l2_info(sd, "stream %s\n", enable ? "ON" : "OFF");
+
+   if (enable && !csi2->stream_on) {
+   clk_prepare_enable(csi2->pix_clk);

It can complicate the design for you, but in general clk_prepare_enable()
can return an error.


I added an error check and reorganized a little.


+
+static int imxcsi2_parse_endpoints(struct imxcsi2_dev *csi2)
+{
+   struct device_node *node = csi2->dev->of_node;
+   struct device_node *epnode;
+   struct v4l2_of_endpoint ep;
+   int ret = 0;
+
+   epnode = of_graph_get_next_endpoint(node, NULL);
+   if (!epnode) {
+   v4l2_err(&csi2->sd, "failed to get endpoint node\n");
+   return -EINVAL;
+   }
+
+   v4l2_of_parse_endpoint(epnode, &ep);

Do of_node_put(epnode) here and remove 'out' goto label.


done.


+static const struct of_device_id imxcsi2_dt_ids[] = {
+   { .compatible = "fsl,imx-mipi-csi2", },
+   { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imxcsi2_dt_ids);
+
+static struct platform_driver imxcsi2_driver = {
+   .driver = {
+   .name = DEVICE_NAME,
+   .owner = THIS_MODULE,

Please drop .owner assignment.


done.


Steve

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors

2017-01-06 Thread Steve Longerbeam



On 01/04/2017 07:26 AM, Fabio Estevam wrote:

On Tue, Jan 3, 2017 at 6:57 PM, Steve Longerbeam  wrote:


+   camera: ov5642@3c {
+   compatible = "ovti,ov5642";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ov5642>;
+   clocks = <&clks IMX6QDL_CLK_CKO>;
+   clock-names = "xclk";
+   reg = <0x3c>;
+   xclk = <2400>;
+   DOVDD-supply = <&vgen4_reg>; /* 1.8v */
+   AVDD-supply = <&vgen5_reg>;  /* 2.8v, rev C board is VGEN3
+   rev B board is VGEN5 */

Please use vgen3 so that by default we have the valid AVDD-supply for
revC boards which is more recent and more the users have access to.


done.




+   mipi_camera: ov5640@3c {
+   compatible = "ovti,ov5640_mipi";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ov5640>;
+   reg = <0x3c>;
+   clocks = <&clks IMX6QDL_CLK_CKO>;
+   clock-names = "xclk";
+   xclk = <2400>;
+   DOVDD-supply = <&vgen4_reg>; /* 1.8v */
+   AVDD-supply = <&vgen5_reg>;  /* 2.8v, rev C board is VGEN3
+   rev B board is VGEN5 */

Same here.


done.




+   pinctrl_ov5640: ov5640grp {
+   fsl,pins = <
+   MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x8000
+   MX6QDL_PAD_SD1_CLK__GPIO1_IO20  0x8000

Please avoid all the 0x8000 IOMUX settings and replace them by
their real values.


yeah, finally got around to this, done!

Steve

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 2/4] hv_util: switch to using timespec64

2017-01-06 Thread John Stultz
On Wed, Jan 4, 2017 at 9:24 AM, Vitaly Kuznetsov  wrote:
> do_settimeofday() is deprecated, use do_settimeofday64() instead.
>
> Signed-off-by: Vitaly Kuznetsov 


Looks sane.

Acked-by: John Stultz 

thanks
-john
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 1/4] timekeeping: export do_adjtimex() to modules

2017-01-06 Thread John Stultz
On Wed, Jan 4, 2017 at 9:24 AM, Vitaly Kuznetsov  wrote:
> While do_adjtimex() is available to userspace via adjtimex syscall it is
> not available to modules which may want to implement in-kernel 'NTP
> clients'. Hyper-V hv_utils is going to be the first one.
>
> Signed-off-by: Vitaly Kuznetsov 
> ---
>  kernel/time/timekeeping.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index da233cd..ae4f24f 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -2312,6 +2312,7 @@ int do_adjtimex(struct timex *txc)
>
> return ret;
>  }
> +EXPORT_SYMBOL_GPL(do_adjtimex);

No real objections to this, although I do want to better understand
the benefits (and drawbacks) of doing the adjtimex in the kernel
driver rather then via userspace, to make sure the need is sane.

thanks
-john
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts

2017-01-06 Thread John Stultz
On Wed, Jan 4, 2017 at 9:24 AM, Vitaly Kuznetsov  wrote:
> If we happen to receive interrupts during hv_set_host_time() execution
> our adjustments may get inaccurate. Make the whole function atomic.
> Unfortunately, we can's call do_settimeofday64() with interrupts
> disabled as some cross-CPU work is being done but this call happens
> very rarely.
>
> Signed-off-by: Vitaly Kuznetsov 
> ---
>  drivers/hv/hv_util.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
> index 7e97231..4e50a42 100644
> --- a/drivers/hv/hv_util.c
> +++ b/drivers/hv/hv_util.c
> @@ -187,6 +187,9 @@ static void hv_set_host_time(struct work_struct *work)
> struct timespec64 host_ts, our_ts;
> struct timex txc = {0};
> int ret;
> +   unsigned long flags;
> +
> +   local_irq_save(flags);
>
> wrk = container_of(work, struct adj_time_work, work);
>
> @@ -218,6 +221,7 @@ static void hv_set_host_time(struct work_struct *work)
>  * ordered to sync our time by the host.
>  */
> if (abs(delta) > MAXPHASE || wrk->flags & ICTIMESYNCFLAG_SYNC) {
> +   local_irq_restore(flags);
> do_settimeofday64(&host_ts);
> return;
> }
> @@ -232,6 +236,8 @@ static void hv_set_host_time(struct work_struct *work)
> ret = do_adjtimex(&txc);
> if (ret)
> pr_debug("Failed to adjust system time: %d\n", ret);
> +
> +   local_irq_restore(flags);


This seems like a long time to disable irqs for what your trying to
do. I'd guess you really only want to disable irqs while you aquire
the host and guest timestamps (so they are as close together as
possible).  Since the delta is then calculated, I'm not sure what
disabling irqs for calling adjtimex gets you.

thanks
-john
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 3/4] hv_util: use do_adjtimex() to update system time

2017-01-06 Thread John Stultz
On Wed, Jan 4, 2017 at 9:24 AM, Vitaly Kuznetsov  wrote:
> With TimeSync version 4 protocol support we started updating system time
> continuously through the whole lifetime of Hyper-V guests. Every 5 seconds
> there is a time sample from the host which triggers do_settimeofday[64]().
> While the time from the host is very accurate such adjustments may cause
> issues:
> - Time is jumping forward and backward, some applications may misbehave.
> - In case an NTP client is run in parallel things may go south, e.g. when
>   an NTP client tries to adjust tick/frequency with ADJ_TICK/ADJ_FREQUENCY
>   the Hyper-V module will not see this changes and time will oscillate and
>   never converge.
> - Systemd starts annoying you by printing "Time has been changed" every 5
>   seconds to the system log.
>
> Instead of calling do_settimeofday64() we can pretend being an NTP client
> and use do_adjtimex(). Do do_settimeofday64() in case the difference is too
> big or ICTIMESYNCFLAG_SYNC flag was set in the request.

So how does having the guest kernel (on behalf of the host) calling
adjtimex internally interact with NTP clients running on the guest?
The kernel sort of assumes a single user of adjtimex (having multiple
clients adjusting the clock doesn't work out so well).

thanks
-john
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 00/24] i.MX Media Driver

2017-01-06 Thread Steve Longerbeam
In version 3:

Changes suggested by Rob Herring :

  - prepended FIM node properties with vendor prefix "fsl,".

  - make mipi csi-2 receiver compatible string SoC specific:
"fsl,imx6-mipi-csi2" instead of "fsl,imx-mipi-csi2".

  - redundant "_clk" removed from mipi csi-2 receiver clock-names property.

  - removed board-specific info from the media driver binding doc. These
were all related to sensor bindings, which already are (adv7180)
or will be (ov564x) covered in separate binding docs. All reference
board info not related to DT bindings has been moved to
Documentation/media/v4l-drivers/imx.rst.

  - removed "_mipi" from the OV5640 compatible string.

Changes suggested by Vladimir Zapolskiy :

  Mostly cosmetic/non-functional changes which I won't list here, except
  for the following:

  - spin_lock_irqsave() changed to spin_lock() in a couple interrupt handlers.

  - fixed some unnecessary of_node_put()'s in for_each_child_of_node() loops.

  - check/handle return code from required reg property of CSI port nodes.

  - check/handle return code from clk_prepare_enable().

Changes suggested by Fabio Estevam :

  - switch to VGEN3 Analog Vdd supply assuming rev. C SabreSD boards.

  - finally got around to passing valid IOMUX pin config values to the
pin groups.

Other changes:

  - removed the FIM properties that overrided the v4l2 FIM control defaults
values. This was left-over from a requirement of a customer and is not
necessary here.

  - The FIM must be explicitly enabled in the fim child node under the CSI
port nodes, using the status property. If not enabled, FIM v4l2 controls
will not appear in the video capture driver.

  - brought in additional media types patch from Philipp Zabel. Use new
MEDIA_ENT_F_VID_IF_BRIDGE in mipi csi-2 receiver subdev.

  - brought in latest platform generic video multiplexer subdevice driver
from Philipp Zabel (squashed with patch that uses new MEDIA_ENT_F_MUX).

  - removed imx-media-of.h, moved those prototypes into imx-media.h.


Philipp Zabel (3):
  ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their
connections
  add mux and video interface bridge entity functions
  platform: add video-multiplexer subdevice driver

Steve Longerbeam (21):
  [media] dt-bindings: Add bindings for i.MX media driver
  ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node
  ARM: dts: imx6qdl: add media device
  ARM: dts: imx6qdl-sabrelite: remove erratum ERR006687 workaround
  ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors
  ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
  ARM: dts: imx6-sabreauto: create i2cmux for i2c3
  ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b
  ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture
  ARM: dts: imx6-sabreauto: add the ADV7180 video decoder
  UAPI: Add media UAPI Kbuild file
  media: Add userspace header file for i.MX
  media: Add i.MX media core driver
  media: imx: Add CSI subdev driver
  media: imx: Add SMFC subdev driver
  media: imx: Add IC subdev drivers
  media: imx: Add Camera Interface subdev driver
  media: imx: Add MIPI CSI-2 Receiver subdev driver
  media: imx: Add MIPI CSI-2 OV5640 sensor subdev driver
  media: imx: Add Parallel OV5642 sensor subdev driver
  ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers

 Documentation/devicetree/bindings/media/imx.txt|   57 +
 .../bindings/media/video-multiplexer.txt   |   59 +
 Documentation/media/uapi/mediactl/media-types.rst  |   22 +
 Documentation/media/v4l-drivers/imx.rst|  443 ++
 arch/arm/boot/dts/imx6dl-sabrelite.dts |5 +
 arch/arm/boot/dts/imx6dl-sabresd.dts   |5 +
 arch/arm/boot/dts/imx6dl.dtsi  |  187 +
 arch/arm/boot/dts/imx6q-sabrelite.dts  |6 +
 arch/arm/boot/dts/imx6q-sabresd.dts|5 +
 arch/arm/boot/dts/imx6q.dtsi   |  127 +
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi   |  147 +-
 arch/arm/boot/dts/imx6qdl-sabrelite.dtsi   |  122 +-
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi |  114 +-
 arch/arm/boot/dts/imx6qdl.dtsi |   25 +-
 arch/arm/configs/imx_v6_v7_defconfig   |   12 +-
 drivers/media/platform/Kconfig |8 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/video-multiplexer.c |  472 +++
 drivers/staging/media/Kconfig  |2 +
 drivers/staging/media/Makefile |1 +
 drivers/staging/media/imx/Kconfig  |   36 +
 drivers/staging/media/imx/Makefile |   15 +
 drivers/staging/media/imx/TODO |   22 +
 drivers/staging/media/imx/imx-camif.c  | 1000 +
 drivers/staging/media/imx/imx-csi.c|  644 +++
 drivers/staging/media/imx/imx-ic-common.c  |  109 +
 driver

[PATCH v3 02/24] ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node

2017-01-06 Thread Steve Longerbeam
Add to the MIPI CSI2 receiver node: compatible string, interrupt sources,
clocks.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6qdl.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 53e6e63..42926e9 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -1125,7 +1125,14 @@
};
 
mipi_csi: mipi@021dc000 {
+   compatible = "fsl,imx6-mipi-csi2";
reg = <0x021dc000 0x4000>;
+   interrupts = <0 100 0x04>, <0 101 0x04>;
+   clocks = <&clks IMX6QDL_CLK_HSI_TX>,
+<&clks IMX6QDL_CLK_VIDEO_27M>,
+<&clks IMX6QDL_CLK_EIM_SEL>;
+   clock-names = "dphy", "cfg", "pix";
+   status = "disabled";
};
 
mipi_dsi: mipi@021e {
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 01/24] [media] dt-bindings: Add bindings for i.MX media driver

2017-01-06 Thread Steve Longerbeam
Add bindings documentation for the i.MX media driver.

Signed-off-by: Steve Longerbeam 
---
 Documentation/devicetree/bindings/media/imx.txt | 57 +
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/imx.txt

diff --git a/Documentation/devicetree/bindings/media/imx.txt 
b/Documentation/devicetree/bindings/media/imx.txt
new file mode 100644
index 000..254b64a
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx.txt
@@ -0,0 +1,57 @@
+Freescale i.MX Media Video Devices
+
+Video Media Controller node
+---
+
+This is the parent media controller node for video capture support.
+
+Required properties:
+- compatible : "fsl,imx-media";
+- ports  : Should contain a list of phandles pointing to camera
+  sensor interface ports of IPU devices
+
+
+fim child node
+--
+
+This is an optional child node of the ipu_csi port nodes. If present and
+available, it enables the Frame Interval Monitor. Its properties can be
+used to modify the method in which the FIM measures frame intervals.
+Refer to Documentation/media/v4l-drivers/imx.rst for more info on the
+Frame Interval Monitor.
+
+Optional properties:
+- fsl,input-capture-channel: an input capture channel and channel flags,
+specified as . The channel number
+must be 0 or 1. The flags can be
+IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, or
+IRQ_TYPE_EDGE_BOTH, and specify which input
+capture signal edge will trigger the input
+capture event. If an input capture channel is
+specified, the FIM will use this method to
+measure frame intervals instead of via the EOF
+interrupt. The input capture method is much
+preferred over EOF as it is not subject to
+interrupt latency errors. However it requires
+routing the VSYNC or FIELD output signals of
+the camera sensor to one of the i.MX input
+capture pads (SD1_DAT0, SD1_DAT1), which also
+gives up support for SD1.
+
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 Receiver, required for MIPI
+CSI-2 sensors.
+
+Required properties:
+- compatible   : "fsl,imx6-mipi-csi2";
+- reg   : physical base address and length of the register set;
+- clocks   : the MIPI CSI-2 receiver requires three clocks: hsi_tx
+  (the DPHY clock), video_27m, and eim_sel;
+- clock-names  : must contain "dphy", "cfg", "pix";
+
+Optional properties:
+- interrupts   : must contain two level-triggered interrupts,
+  in order: 100 and 101;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 03/24] ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their connections

2017-01-06 Thread Steve Longerbeam
From: Philipp Zabel 

This patch adds the device tree graph connecting the input multiplexers
to the IPU CSIs and the MIPI-CSI2 gasket on i.MX6. The MIPI_IPU
multiplexers are added as children of the iomuxc-gpr syscon device node.
On i.MX6Q/D two two-input multiplexers in front of IPU1 CSI0 and IPU2
CSI1 allow to select between CSI0/1 parallel input pads and the MIPI
CSI-2 virtual channels 0/3.
On i.MX6DL/S two five-input multiplexers in front of IPU1 CSI0 and IPU1
CSI1 allow to select between CSI0/1 parallel input pads and any of the
four MIPI CSI-2 virtual channels.

Signed-off-by: Philipp Zabel 

--

- Removed some dangling/unused endpoints (ipu2_csi0_from_csi2ipu)
- Renamed the mipi virtual channel endpoint labels, from "mipi_csiX_..."
  to "mipi_vcX...".
- Added input endpoint anchors to the video muxes for the connections
  from parallel sensors.
- Added input endpoint anchors to the mipi_csi for the connections from
  mipi csi-2 sensors.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6dl.dtsi  | 187 +
 arch/arm/boot/dts/imx6q.dtsi   | 123 +++
 arch/arm/boot/dts/imx6qdl.dtsi |  10 ++-
 3 files changed, 319 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi
index 1ade195..0849e85 100644
--- a/arch/arm/boot/dts/imx6dl.dtsi
+++ b/arch/arm/boot/dts/imx6dl.dtsi
@@ -181,6 +181,193 @@
  "di0", "di1";
 };
 
+&gpr {
+   ipu1_csi0_mux: ipu1_csi0_mux@34 {
+   compatible = "video-multiplexer";
+   reg = <0x34>;
+   bit-mask = <0x7>;
+   bit-shift = <0>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "okay";
+
+   port@0 {
+   reg = <0>;
+
+   ipu1_csi0_mux_from_mipi_vc0: endpoint {
+   remote-endpoint = <&mipi_vc0_to_ipu1_csi0_mux>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   ipu1_csi0_mux_from_mipi_vc1: endpoint {
+   remote-endpoint = <&mipi_vc1_to_ipu1_csi0_mux>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   ipu1_csi0_mux_from_mipi_vc2: endpoint {
+   remote-endpoint = <&mipi_vc2_to_ipu1_csi0_mux>;
+   };
+   };
+
+   port@3 {
+   reg = <3>;
+
+   ipu1_csi0_mux_from_mipi_vc3: endpoint {
+   remote-endpoint = <&mipi_vc3_to_ipu1_csi0_mux>;
+   };
+   };
+
+   port@4 {
+   reg = <4>;
+
+   ipu1_csi0_mux_from_parallel_sensor: endpoint {
+   };
+   };
+
+   port@5 {
+   reg = <5>;
+
+   ipu1_csi0_mux_to_ipu1_csi0: endpoint {
+   remote-endpoint = 
<&ipu1_csi0_from_ipu1_csi0_mux>;
+   };
+   };
+   };
+
+   ipu1_csi1_mux: ipu1_csi1_mux@34 {
+   compatible = "video-multiplexer";
+   reg = <0x34>;
+   bit-mask = <0x7>;
+   bit-shift = <3>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "okay";
+
+   port@0 {
+   reg = <0>;
+
+   ipu1_csi1_mux_from_mipi_vc0: endpoint {
+   remote-endpoint = <&mipi_vc0_to_ipu1_csi1_mux>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   ipu1_csi1_mux_from_mipi_vc1: endpoint {
+   remote-endpoint = <&mipi_vc1_to_ipu1_csi1_mux>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   ipu1_csi1_mux_from_mipi_vc2: endpoint {
+   remote-endpoint = <&mipi_vc2_to_ipu1_csi1_mux>;
+   };
+   };
+
+   port@3 {
+   reg = <3>;
+
+   ipu1_csi1_mux_from_mipi_vc3: endpoint {
+   remote-endpoint = <&mipi_vc3_to_ipu1_csi1_mux>;
+   };
+   };
+
+   port@4 {
+   reg = <4>;
+
+   ipu1_csi1_mux_from_parallel_sensor: endpoint {
+   };
+   };
+
+   port@5 {
+   reg = <5>;
+
+   ipu1_csi1_mux_to_ipu1_csi1: endpoint {
+   remote-endpoint = 
<&ipu1_csi1_from_ipu1_csi1_mux>;
+   };
+   };
+ 

[PATCH v3 06/24] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors

2017-01-06 Thread Steve Longerbeam
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor.
Both hang off the same i2c2 bus, so they require different (and non-
default) i2c slave addresses.

The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux.

The OV5640 connects to the input port on the MIPI CSI-2 receiver on
mipi_csi. It is set to transmit over MIPI virtual channel 1.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6dl-sabrelite.dts   |   5 ++
 arch/arm/boot/dts/imx6q-sabrelite.dts|   6 ++
 arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 118 +++
 3 files changed, 129 insertions(+)

diff --git a/arch/arm/boot/dts/imx6dl-sabrelite.dts 
b/arch/arm/boot/dts/imx6dl-sabrelite.dts
index 0f06ca5..fec2524 100644
--- a/arch/arm/boot/dts/imx6dl-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6dl-sabrelite.dts
@@ -48,3 +48,8 @@
model = "Freescale i.MX6 DualLite SABRE Lite Board";
compatible = "fsl,imx6dl-sabrelite", "fsl,imx6dl";
 };
+
+&ipu1_csi1_from_ipu1_csi1_mux {
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+};
diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts 
b/arch/arm/boot/dts/imx6q-sabrelite.dts
index 66d10d8..9e2d26d 100644
--- a/arch/arm/boot/dts/imx6q-sabrelite.dts
+++ b/arch/arm/boot/dts/imx6q-sabrelite.dts
@@ -52,3 +52,9 @@
 &sata {
status = "okay";
 };
+
+&ipu1_csi1_from_mipi_vc1 {
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+};
+
diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
index 795b5a5..bca9fed 100644
--- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
@@ -39,6 +39,8 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
+
+#include 
 #include 
 #include 
 
@@ -96,6 +98,15 @@
};
};
 
+   mipi_xclk: mipi_xclk {
+   compatible = "pwm-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2200>;
+   clock-output-names = "mipi_pwm3";
+   pwms = <&pwm3 0 45>; /* 1 / 45 ns = 22 MHz */
+   status = "okay";
+   };
+
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
@@ -220,6 +231,22 @@
};
 };
 
+&ipu1_csi0_from_ipu1_csi0_mux {
+   bus-width = <8>;
+   data-shift = <12>; /* Lines 19:12 used */
+   hsync-active = <1>;
+   vync-active = <1>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+   remote-endpoint = <&ov5642_to_ipu1_csi0_mux>;
+};
+
+&ipu1_csi0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ipu1_csi0>;
+};
+
 &audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
@@ -299,6 +326,52 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
+
+   ov5640: camera@40 {
+   compatible = "ovti,ov5640";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ov5640>;
+   clocks = <&mipi_xclk>;
+   clock-names = "xclk";
+   reg = <0x40>;
+   xclk = <2200>;
+   reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; /* NANDF_D5 */
+   pwdn-gpios = <&gpio6 9 GPIO_ACTIVE_HIGH>; /* NANDF_WP_B */
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ov5640_to_mipi_csi: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <&mipi_csi_from_mipi_sensor>;
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+   };
+   };
+   };
+
+   ov5642: camera@42 {
+   compatible = "ovti,ov5642";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ov5642>;
+   clocks = <&clks IMX6QDL_CLK_CKO2>;
+   clock-names = "xclk";
+   reg = <0x42>;
+   xclk = <2400>;
+   reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
+   pwdn-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
+   gp-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+
+   port {
+   ov5642_to_ipu1_csi0_mux: endpoint {
+   remote-endpoint = 
<&ipu1_csi0_mux_from_parallel_sensor>;
+   bus-width = <8>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
 };
 
 &i2c3 {
@@ -412,6 +485,23 @@
>;
};
 
+   pinctrl_ipu1_csi0: ipu1csi0grp {
+   fsl,pins = <
+   MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12
0x1b0b0
+   MX6QDL_PAD_CSI0_DAT

[PATCH v3 11/24] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder

2017-01-06 Thread Steve Longerbeam
Enables the ADV7180 decoder sensor. The ADV7180 connects to the
parallel-bus mux input on ipu1_csi0_mux.

On the sabreauto, two analog video inputs are routed to the ADV7180,
composite on Ain1, and composite on Ain3. Those inputs are defined
via inputs and input-names under the ADV7180 node. The ADV7180 power
pin is via max7310_b port expander.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 61 
 1 file changed, 61 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 495709f..7999857 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -124,6 +124,24 @@
#size-cells = <0>;
reg = <1>;
 
+   adv7180: camera@21 {
+   compatible = "adi,adv7180";
+   reg = <0x21>;
+   powerdown-gpios = <&max7310_b 2 
GPIO_ACTIVE_LOW>;
+   interrupt-parent = <&gpio1>;
+   interrupts = <27 0x8>;
+   inputs = <0x00 0x02>;
+   input-names = "ADV7180 Composite on Ain1",
+   "ADV7180 Composite on Ain3";
+
+   port {
+   adv7180_to_ipu1_csi0_mux: endpoint {
+   remote-endpoint = 
<&ipu1_csi0_mux_from_parallel_sensor>;
+   bus-width = <8>;
+   };
+   };
+   };
+
max7310_a: gpio@30 {
compatible = "maxim,max7310";
reg = <0x30>;
@@ -151,6 +169,25 @@
};
 };
 
+&ipu1_csi0_from_ipu1_csi0_mux {
+   bus-width = <8>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+   remote-endpoint = <&adv7180_to_ipu1_csi0_mux>;
+   bus-width = <8>;
+};
+
+&ipu1_csi0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ipu1_csi0>;
+
+   /* enable frame interval monitor on this port */
+   fim {
+   status = "okay";
+   };
+};
+
 &clks {
assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>,
  <&clks IMX6QDL_PLL4_BYPASS>,
@@ -445,6 +482,30 @@
>;
};
 
+   pinctrl_ipu1_csi0: ipu1csi0grp {
+   fsl,pins = <
+   MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04   0x1b0b0
+   MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05   0x1b0b0
+   MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06   0x1b0b0
+   MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07   0x1b0b0
+   MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08   0x1b0b0
+   MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09   0x1b0b0
+   MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18  0x1b0b0
+   MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19  0x1b0b0
+   MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x1b0b0
+   MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC0x1b0b0
+   MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC   0x1b0b0
+   >;
+   };
+
pinctrl_max7310: max7310grp {
fsl,pins = <
MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x1b0b0
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 09/24] ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b

2017-01-06 Thread Steve Longerbeam
The reset pin to the port expander chip (MAX7310) is controlled by a gpio,
so define a reset-gpios property to control it. There are three MAX7310's
on the SabreAuto CPU card (max7310_[abc]), but all use the same pin for
their reset. Since all can't acquire the same pin, assign it to max7310_b,
that chip is needed by more functions (usb and adv7180).

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index cace88c..967c3b8 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -136,6 +136,9 @@
reg = <0x32>;
gpio-controller;
#gpio-cells = <2>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_max7310>;
+   reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
};
 
max7310_c: gpio@34 {
@@ -442,6 +445,12 @@
>;
};
 
+   pinctrl_max7310: max7310grp {
+   fsl,pins = <
+   MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x1b0b0
+   >;
+   };
+
pinctrl_pwm3: pwm1grp {
fsl,pins = <
MX6QDL_PAD_SD4_DAT1__PWM3_OUT   0x1b0b1
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 07/24] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors

2017-01-06 Thread Steve Longerbeam
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor.

The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux.

The OV5640 connects to the input port on the MIPI CSI-2 receiver on
mipi_csi. It is set to transmit over MIPI virtual channel 1.

Until the OV5652 sensor module compatible with the SabreSD becomes
available for testing, the ov5642 node is currently disabled.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6dl-sabresd.dts   |   5 ++
 arch/arm/boot/dts/imx6q-sabresd.dts|   5 ++
 arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 114 -
 3 files changed, 123 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/imx6dl-sabresd.dts 
b/arch/arm/boot/dts/imx6dl-sabresd.dts
index 1e45f2f..6cf7a50 100644
--- a/arch/arm/boot/dts/imx6dl-sabresd.dts
+++ b/arch/arm/boot/dts/imx6dl-sabresd.dts
@@ -15,3 +15,8 @@
model = "Freescale i.MX6 DualLite SABRE Smart Device Board";
compatible = "fsl,imx6dl-sabresd", "fsl,imx6dl";
 };
+
+&ipu1_csi1_from_ipu1_csi1_mux {
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+};
diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts 
b/arch/arm/boot/dts/imx6q-sabresd.dts
index 9cbdfe7..8c1d7ad 100644
--- a/arch/arm/boot/dts/imx6q-sabresd.dts
+++ b/arch/arm/boot/dts/imx6q-sabresd.dts
@@ -23,3 +23,8 @@
 &sata {
status = "okay";
 };
+
+&ipu1_csi1_from_mipi_vc1 {
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+};
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
index 55ef535..7c5dc99 100644
--- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi
@@ -10,6 +10,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
+#include 
 #include 
 #include 
 
@@ -146,6 +147,33 @@
};
 };
 
+&ipu1_csi0_from_ipu1_csi0_mux {
+   bus-width = <8>;
+   data-shift = <12>; /* Lines 19:12 used */
+   hsync-active = <1>;
+   vsync-active = <1>;
+};
+
+&ipu1_csi0_mux_from_parallel_sensor {
+   remote-endpoint = <&ov5642_to_ipu1_csi0_mux>;
+};
+
+&ipu1_csi0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ipu1_csi0>;
+};
+
+&mipi_csi {
+   status = "okay";
+};
+
+/* Incoming port from sensor */
+&mipi_csi_from_mipi_sensor {
+   remote-endpoint = <&ov5640_to_mipi_csi>;
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+};
+
 &audmux {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_audmux>;
@@ -214,7 +242,33 @@
0x8014 /* 4:FN_DMICCDAT */
0x /* 5:Default */
>;
-   };
+   };
+
+   ov5642: camera@3c {
+   compatible = "ovti,ov5642";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ov5642>;
+   clocks = <&clks IMX6QDL_CLK_CKO>;
+   clock-names = "xclk";
+   reg = <0x3c>;
+   xclk = <2400>;
+   DOVDD-supply = <&vgen4_reg>; /* 1.8v */
+   AVDD-supply = <&vgen3_reg>;  /* 2.8v, rev C board is VGEN3
+   rev B board is VGEN5 */
+   DVDD-supply = <&vgen2_reg>;  /* 1.5v*/
+   pwdn-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
+   status = "disabled";
+
+   port {
+   ov5642_to_ipu1_csi0_mux: endpoint {
+   remote-endpoint = 
<&ipu1_csi0_mux_from_parallel_sensor>;
+   bus-width = <8>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
 };
 
 &i2c2 {
@@ -223,6 +277,34 @@
pinctrl-0 = <&pinctrl_i2c2>;
status = "okay";
 
+   ov5640: camera@3c {
+   compatible = "ovti,ov5640";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_ov5640>;
+   reg = <0x3c>;
+   clocks = <&clks IMX6QDL_CLK_CKO>;
+   clock-names = "xclk";
+   xclk = <2400>;
+   DOVDD-supply = <&vgen4_reg>; /* 1.8v */
+   AVDD-supply = <&vgen3_reg>;  /* 2.8v, rev C board is VGEN3
+   rev B board is VGEN5 */
+   DVDD-supply = <&vgen2_reg>;  /* 1.5v*/
+   pwdn-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>;
+   reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
+
+   port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ov5640_to_mipi_csi: endpoint@1 {
+   reg = <1>;
+   remote-endpoint = <&mipi_csi_from_mipi_sensor>;
+   data-lanes = <0 1>;
+   clock-lanes = <2>;
+   };
+  

[PATCH v3 08/24] ARM: dts: imx6-sabreauto: create i2cmux for i2c3

2017-01-06 Thread Steve Longerbeam
The sabreauto uses a steering pin to select between the SDA signal on
i2c3 bus, and a data-in pin for an SPI NOR chip. Use i2cmux to control
this steering pin. Idle state of the i2cmux selects SPI NOR. This is not
a classic way to use i2cmux, since one side of the mux selects something
other than an i2c bus, but it works and is probably the cleanest
solution. Note that if one thread is attempting to access SPI NOR while
another thread is accessing i2c3, the SPI NOR access will fail since the
i2cmux has selected the SDA pin rather than SPI NOR data-in. This couldn't
be avoided in any case, the board is not designed to allow concurrent
i2c3 and SPI NOR functions (and the default device-tree does not enable
SPI NOR anyway).

Devices hanging off i2c3 should now be defined under i2cmux, so
that the steering pin can be properly controlled to access those
devices. The port expanders (MAX7310) are thus moved into i2cmux.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 65 +---
 1 file changed, 44 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 52390ba..cace88c 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -108,6 +108,44 @@
default-brightness-level = <7>;
status = "okay";
};
+
+   i2cmux {
+   compatible = "i2c-mux-gpio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_i2c3mux>;
+   mux-gpios = <&gpio5 4 0>;
+   i2c-parent = <&i2c3>;
+   idle-state = <0>;
+
+   i2c@1 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   reg = <1>;
+
+   max7310_a: gpio@30 {
+   compatible = "maxim,max7310";
+   reg = <0x30>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   max7310_b: gpio@32 {
+   compatible = "maxim,max7310";
+   reg = <0x32>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   max7310_c: gpio@34 {
+   compatible = "maxim,max7310";
+   reg = <0x34>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+   };
+   };
 };
 
 &clks {
@@ -291,27 +329,6 @@
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c3>;
status = "okay";
-
-   max7310_a: gpio@30 {
-   compatible = "maxim,max7310";
-   reg = <0x30>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   };
-
-   max7310_b: gpio@32 {
-   compatible = "maxim,max7310";
-   reg = <0x32>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   };
-
-   max7310_c: gpio@34 {
-   compatible = "maxim,max7310";
-   reg = <0x34>;
-   gpio-controller;
-   #gpio-cells = <2>;
-   };
 };
 
 &iomuxc {
@@ -419,6 +436,12 @@
>;
};
 
+   pinctrl_i2c3mux: i2c3muxgrp {
+   fsl,pins = <
+   MX6QDL_PAD_EIM_A24__GPIO5_IO04 0x0b0b1
+   >;
+   };
+
pinctrl_pwm3: pwm1grp {
fsl,pins = <
MX6QDL_PAD_SD4_DAT1__PWM3_OUT   0x1b0b1
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 18/24] media: imx: Add SMFC subdev driver

2017-01-06 Thread Steve Longerbeam
This is a media entity subdevice driver for the i.MX Sensor Multi-FIFO
Controller module. Video frames are received from the CSI and can
be routed to various sinks including the i.MX Image Converter for
scaling, color-space conversion, motion compensated deinterlacing,
and image rotation.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/Makefile   |   1 +
 drivers/staging/media/imx/imx-smfc.c | 737 +++
 2 files changed, 738 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx-smfc.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 133672a..3559d7b 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
 
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
 
diff --git a/drivers/staging/media/imx/imx-smfc.c 
b/drivers/staging/media/imx/imx-smfc.c
new file mode 100644
index 000..614a4381
--- /dev/null
+++ b/drivers/staging/media/imx/imx-smfc.c
@@ -0,0 +1,737 @@
+/*
+ * V4L2 Capture SMFC Subdev for Freescale i.MX5/6 SOC
+ *
+ * This subdevice handles capture of raw/unconverted video frames
+ * from the CSI, directly to memory via the Sensor Multi-FIFO Controller.
+ *
+ * Copyright (c) 2012-2016 Mentor Graphics Inc.
+ *
+ * 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 
+#include 
+#include 
+#include "imx-media.h"
+
+/*
+ * Min/Max supported width and heights.
+ *
+ * We allow planar output from the SMFC, so we have to align
+ * output width by 16 pixels to meet IDMAC alignment requirements,
+ * which also means input width must have the same alignment.
+ */
+#define MIN_W   176
+#define MIN_H   144
+#define MAX_W  8192
+#define MAX_H  4096
+#define W_ALIGN4 /* multiple of 16 pixels */
+#define H_ALIGN1 /* multiple of 2 lines */
+#define S_ALIGN1 /* multiple of 2 */
+
+#define SMFC_NUM_PADS 2
+
+struct imx_smfc_priv {
+   struct device*dev;
+   struct ipu_soc   *ipu;
+   struct imx_media_dev *md;
+   struct v4l2_subdev   sd;
+   struct media_pad pad[SMFC_NUM_PADS];
+   int ipu_id;
+   int smfc_id;
+   int input_pad;
+   int output_pad;
+
+   struct ipuv3_channel *smfc_ch;
+   struct ipu_smfc *smfc;
+
+   struct v4l2_mbus_framefmt format_mbus[SMFC_NUM_PADS];
+   const struct imx_media_pixfmt *cc[SMFC_NUM_PADS];
+
+   struct v4l2_mbus_config sensor_mbus_cfg;
+
+   /* the dma buffer ring to send to sink */
+   struct imx_media_dma_buf_ring *out_ring;
+   struct imx_media_dma_buf *next;
+
+   int ipu_buf_num;  /* ipu double buffer index: 0-1 */
+
+   /* the sink that will receive the dma buffers */
+   struct v4l2_subdev *sink_sd;
+   struct v4l2_subdev *src_sd;
+
+   /*
+* the CSI id and mipi virtual channel number at
+* link validate
+*/
+   int csi_id;
+   int vc_num;
+
+   /* the attached sensor at stream on */
+   struct imx_media_subdev *sensor;
+
+   spinlock_t irqlock;
+   struct timer_list eof_timeout_timer;
+   int eof_irq;
+   int nfb4eof_irq;
+
+   bool stream_on; /* streaming is on */
+   bool last_eof;  /* waiting for last EOF at stream off */
+   struct completion last_eof_comp;
+};
+
+static void imx_smfc_put_ipu_resources(struct imx_smfc_priv *priv)
+{
+   if (!IS_ERR_OR_NULL(priv->smfc_ch))
+   ipu_idmac_put(priv->smfc_ch);
+   priv->smfc_ch = NULL;
+
+   if (!IS_ERR_OR_NULL(priv->smfc))
+   ipu_smfc_put(priv->smfc);
+   priv->smfc = NULL;
+}
+
+static int imx_smfc_get_ipu_resources(struct imx_smfc_priv *priv)
+{
+   int ch_num, ret;
+
+   priv->ipu = priv->md->ipu[priv->ipu_id];
+
+   ch_num = IPUV3_CHANNEL_CSI0 + priv->smfc_id;
+
+   priv->smfc = ipu_smfc_get(priv->ipu, ch_num);
+   if (IS_ERR(priv->smfc)) {
+   v4l2_err(&priv->sd, "failed to get SMFC\n");
+   ret = PTR_ERR(priv->smfc);
+   goto out;
+   }
+
+   priv->smfc_ch = ipu_idmac_get(priv->ipu, ch_num);
+   if (IS_ERR(priv->smfc_ch)) {
+   v4l2_err(&priv->sd, "could not get IDMAC channel %u\n", ch_num);
+   ret = PTR_ERR(priv->smfc_ch);
+   goto out;
+   }
+
+   return 0;
+out:
+   imx_smfc_put_ipu_resources(priv);
+   return ret;
+}
+
+static irqreturn_t imx_smfc_eof_interrupt(int irq, void *dev_id)
+{
+   struct imx_smfc_priv

[PATCH v3 20/24] media: imx: Add Camera Interface subdev driver

2017-01-06 Thread Steve Longerbeam
This is the camera interface driver that provides the v4l2
user interface. Frames can be received from various sources:

- directly from SMFC for capturing unconverted images directly from
  camera sensors.

- from the IC pre-process encode task.

- from the IC pre-process viewfinder task.

- from the IC post-process task.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/Makefile|2 +-
 drivers/staging/media/imx/imx-camif.c | 1000 +
 2 files changed, 1001 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/media/imx/imx-camif.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index d2a962c..fe9e992 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
 
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
-
+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
diff --git a/drivers/staging/media/imx/imx-camif.c 
b/drivers/staging/media/imx/imx-camif.c
new file mode 100644
index 000..404f724
--- /dev/null
+++ b/drivers/staging/media/imx/imx-camif.c
@@ -0,0 +1,1000 @@
+/*
+ * Video Camera Capture Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2012-2016 Mentor Graphics Inc.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include "imx-media.h"
+
+#define CAMIF_NUM_PADS 2
+
+struct camif_priv {
+   struct device *dev;
+   struct video_devicevfd;
+   struct media_pipeline  mp;
+   struct imx_media_dev  *md;
+   struct v4l2_subdev sd;
+   struct media_pad   pad[CAMIF_NUM_PADS];
+   struct media_pad   vd_pad;
+   int id;
+   int input_pad;
+   int output_pad;
+
+   struct v4l2_mbus_framefmt format_mbus[CAMIF_NUM_PADS];
+   const struct imx_media_pixfmt *cc[CAMIF_NUM_PADS];
+
+   /* dma buffer ring */
+   struct imx_media_dma_buf_ring *in_ring;
+   struct v4l2_subdev *src_sd;
+
+   struct mutex   mutex;   /* capture device mutex */
+   spinlock_t q_lock;  /* protect ready_q */
+
+   /* buffer queue used in videobuf2 */
+   struct vb2_queue   buffer_queue;
+
+   /* streaming buffer queue */
+   struct list_head   ready_q;
+
+   /* controls inherited from subdevs */
+   struct v4l2_ctrl_handler ctrl_hdlr;
+
+   /* misc status */
+   intcurrent_input; /* the current input */
+   v4l2_std_idcurrent_std;   /* current standard */
+   bool   stop;  /* streaming is stopping */
+};
+
+/* In bytes, per queue */
+#define VID_MEM_LIMIT  SZ_64M
+
+static struct vb2_ops camif_qops;
+
+/*
+ * Video ioctls follow
+ */
+
+static int vidioc_querycap(struct file *file, void *fh,
+  struct v4l2_capability *cap)
+{
+   strncpy(cap->driver, "imx-media-camif", sizeof(cap->driver) - 1);
+   strncpy(cap->card, "imx-media-camif", sizeof(cap->card) - 1);
+   cap->bus_info[0] = 0;
+   cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+   cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
+
+   return 0;
+}
+
+static int camif_enum_fmt_vid_cap(struct file *file, void *fh,
+ struct v4l2_fmtdesc *f)
+{
+   const struct imx_media_pixfmt *cc;
+   u32 code;
+   int ret;
+
+   ret = imx_media_enum_format(&code, f->index, true, true);
+   if (ret)
+   return ret;
+   cc = imx_media_find_format(0, code, true, true);
+   if (!cc)
+   return -EINVAL;
+
+   f->pixelformat = cc->fourcc;
+
+   return 0;
+}
+
+static int camif_g_fmt_vid_cap(struct file *file, void *fh,
+  struct v4l2_format *f)
+{
+   struct camif_priv *priv = video_drvdata(file);
+   struct v4l2_mbus_framefmt *outfmt;
+
+   /* user format is the same as the format from output pad */
+   outfmt = &priv->format_mbus[priv->output_pad];
+   return imx_media_mbus_fmt_to_pix_fmt(&f->fmt.pix, outfmt);
+}
+
+static int camif_try_fmt_vid_cap(struct file *file, void *fh,
+struct v4l2_format *f)
+{
+   return camif_g_fmt_vid_cap(file, fh, f);
+}
+
+static int camif_s_fmt_vid_cap(struct file *file, void *fh,
+  struct v4l2_format *f)
+{
+   struct camif_priv *priv = video_drvdata(file);
+
+   if (vb2_is_busy(&priv->buffer_queue)) {
+  

[PATCH v3 24/24] ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers

2017-01-06 Thread Steve Longerbeam
Enable imx v4l2 staging drivers. For video capture on i.MX, the
video multiplexer subdev is required. On the SabreAuto, the ADV7180
video decoder is required along with i2c-mux-gpio. The Sabrelite
requires PWM clocks for the OV5640.

Increase max zoneorder to allow larger video buffer allocations.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/configs/imx_v6_v7_defconfig | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig 
b/arch/arm/configs/imx_v6_v7_defconfig
index cbe7faf..b67b99f 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -51,6 +51,7 @@ CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
 CONFIG_HIGHMEM=y
 CONFIG_CMA=y
+CONFIG_FORCE_MAX_ZONEORDER=14
 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
 CONFIG_KEXEC=y
 CONFIG_CPU_FREQ=y
@@ -174,13 +175,13 @@ CONFIG_INPUT_MISC=y
 CONFIG_INPUT_MMA8450=y
 CONFIG_SERIO_SERPORT=m
 # CONFIG_LEGACY_PTYS is not set
-# CONFIG_DEVKMEM is not set
 CONFIG_SERIAL_IMX=y
 CONFIG_SERIAL_IMX_CONSOLE=y
 CONFIG_SERIAL_FSL_LPUART=y
 CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
 # CONFIG_I2C_COMPAT is not set
 CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX_GPIO=y
 # CONFIG_I2C_HELPER_AUTO is not set
 CONFIG_I2C_ALGOPCF=m
@@ -194,11 +195,11 @@ CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_MC9S08DZ60=y
 CONFIG_GPIO_PCA953X=y
 CONFIG_GPIO_STMPE=y
-CONFIG_POWER_SUPPLY=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_RESET_IMX=y
 CONFIG_POWER_RESET_SYSCON=y
 CONFIG_POWER_RESET_SYSCON_POWEROFF=y
+CONFIG_POWER_SUPPLY=y
 CONFIG_SENSORS_GPIO_FAN=y
 CONFIG_SENSORS_IIO_HWMON=y
 CONFIG_THERMAL=y
@@ -221,14 +222,19 @@ CONFIG_REGULATOR_PFUZE100=y
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_MEDIA_RC_SUPPORT=y
+CONFIG_MEDIA_CONTROLLER=y
+CONFIG_VIDEO_V4L2_SUBDEV_API=y
 CONFIG_RC_DEVICES=y
 CONFIG_IR_GPIO_CIR=y
 CONFIG_MEDIA_USB_SUPPORT=y
 CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
+CONFIG_VIDEO_MULTIPLEXER=y
 CONFIG_SOC_CAMERA=y
 CONFIG_V4L_MEM2MEM_DRIVERS=y
 CONFIG_VIDEO_CODA=y
+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
+CONFIG_VIDEO_ADV7180=m
 CONFIG_SOC_CAMERA_OV2640=y
 CONFIG_IMX_IPUV3_CORE=y
 CONFIG_DRM=y
@@ -338,6 +344,8 @@ CONFIG_FSL_EDMA=y
 CONFIG_IMX_SDMA=y
 CONFIG_MXS_DMA=y
 CONFIG_STAGING=y
+CONFIG_STAGING_MEDIA=y
+CONFIG_COMMON_CLK_PWM=y
 CONFIG_IIO=y
 CONFIG_VF610_ADC=y
 CONFIG_MPL3115=y
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 12/24] add mux and video interface bridge entity functions

2017-01-06 Thread Steve Longerbeam
From: Philipp Zabel 

Signed-off-by: Philipp Zabel 
---
 Documentation/media/uapi/mediactl/media-types.rst | 22 ++
 include/uapi/linux/media.h|  6 ++
 2 files changed, 28 insertions(+)

diff --git a/Documentation/media/uapi/mediactl/media-types.rst 
b/Documentation/media/uapi/mediactl/media-types.rst
index 3e03dc2..023be29 100644
--- a/Documentation/media/uapi/mediactl/media-types.rst
+++ b/Documentation/media/uapi/mediactl/media-types.rst
@@ -298,6 +298,28 @@ Types and flags used to represent the media graph elements
  received on its sink pad and outputs the statistics data on
  its source pad.
 
+-  ..  row 29
+
+   ..  _MEDIA-ENT-F-MUX:
+
+   -  ``MEDIA_ENT_F_MUX``
+
+   - Video multiplexer. An entity capable of multiplexing must have at
+ least two sink pads and one source pad, and must pass the video
+ frame(s) received from the active sink pad to the source pad. Video
+ frame(s) from the inactive sink pads are discarded.
+
+-  ..  row 30
+
+   ..  _MEDIA-ENT-F-VID-IF-BRIDGE:
+
+   -  ``MEDIA_ENT_F_VID_IF_BRIDGE``
+
+   - Video interface bridge. A video interface bridge entity must have at
+ least one sink pad and one source pad. It receives video frame(s) on
+ its sink pad in one bus format (HDMI, eDP, MIPI CSI-2, ...) and
+ converts them and outputs them on its source pad in another bus format
+ (eDP, MIPI CSI-2, parallel, ...).
 
 ..  tabularcolumns:: |p{5.5cm}|p{12.0cm}|
 
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 4890787..08a8bfa 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -105,6 +105,12 @@ struct media_device_info {
 #define MEDIA_ENT_F_PROC_VIDEO_STATISTICS  (MEDIA_ENT_F_BASE + 0x4006)
 
 /*
+ * Switch and bridge entitites
+ */
+#define MEDIA_ENT_F_MUX(MEDIA_ENT_F_BASE + 
0x5001)
+#define MEDIA_ENT_F_VID_IF_BRIDGE  (MEDIA_ENT_F_BASE + 0x5002)
+
+/*
  * Connectors
  */
 /* It is a responsibility of the entity drivers to add connectors and links */
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 19/24] media: imx: Add IC subdev drivers

2017-01-06 Thread Steve Longerbeam
This is a set of three media entity subdevice drivers for the i.MX
Image Converter. The i.MX IC module contains three independent
"tasks":

- Pre-processing Encode task: video frames are routed directly from
  the CSI and can be scaled, color-space converted, and rotated.
  Scaled output is limited to 1024x1024 resolution. Output frames
  are routed to the camera interface entities (camif).

- Pre-processing Viewfinder task: this task can perform the same
  conversions as the pre-process encode task, but in addition can
  be used for hardware motion compensated deinterlacing. Frames can
  come either directly from the CSI or from the SMFC entities (memory
  buffers via IDMAC channels). Scaled output is limited to 1024x1024
  resolution. Output frames can be routed to various sinks including
  the post-processing task entities.

- Post-processing task: same conversions as pre-process encode. However
  this entity sends frames to the i.MX IPU image converter which supports
  image tiling, which allows scaled output up to 4096x4096 resolution.
  Output frames can be routed to the camera interfaces.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/Makefile|2 +
 drivers/staging/media/imx/imx-ic-common.c |  109 +++
 drivers/staging/media/imx/imx-ic-pp.c |  636 
 drivers/staging/media/imx/imx-ic-prpenc.c | 1033 +
 drivers/staging/media/imx/imx-ic-prpvf.c  | 1179 +
 drivers/staging/media/imx/imx-ic.h|   38 +
 6 files changed, 2997 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx-ic-common.c
 create mode 100644 drivers/staging/media/imx/imx-ic-pp.c
 create mode 100644 drivers/staging/media/imx/imx-ic-prpenc.c
 create mode 100644 drivers/staging/media/imx/imx-ic-prpvf.c
 create mode 100644 drivers/staging/media/imx/imx-ic.h

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 3559d7b..d2a962c 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -1,8 +1,10 @@
 imx-media-objs := imx-media-dev.o imx-media-fim.o imx-media-internal-sd.o \
imx-media-of.o
+imx-ic-objs := imx-ic-common.o imx-ic-prpenc.o imx-ic-prpvf.o imx-ic-pp.o
 
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
+obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
 
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
diff --git a/drivers/staging/media/imx/imx-ic-common.c 
b/drivers/staging/media/imx/imx-ic-common.c
new file mode 100644
index 000..45706ca
--- /dev/null
+++ b/drivers/staging/media/imx/imx-ic-common.c
@@ -0,0 +1,109 @@
+/*
+ * V4L2 Image Converter Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2014-2016 Mentor Graphics Inc.
+ *
+ * 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 "imx-media.h"
+#include "imx-ic.h"
+
+static struct imx_ic_ops *ic_ops[IC_NUM_TASKS] = {
+   [IC_TASK_ENCODER]= &imx_ic_prpenc_ops,
+   [IC_TASK_VIEWFINDER] = &imx_ic_prpvf_ops,
+   [IC_TASK_POST_PROCESSOR] = &imx_ic_pp_ops,
+};
+
+static int imx_ic_probe(struct platform_device *pdev)
+{
+   struct imx_media_internal_sd_platformdata *pdata;
+   struct imx_ic_priv *priv;
+   int ret;
+
+   priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+   if (!priv)
+   return -ENOMEM;
+
+   platform_set_drvdata(pdev, &priv->sd);
+   priv->dev = &pdev->dev;
+
+   /* get our ipu_id, grp_id and IC task id */
+   pdata = priv->dev->platform_data;
+   priv->ipu_id = pdata->ipu_id;
+   switch (pdata->grp_id) {
+   case IMX_MEDIA_GRP_ID_IC_PRPENC:
+   priv->task_id = IC_TASK_ENCODER;
+   break;
+   case IMX_MEDIA_GRP_ID_IC_PRPVF:
+   priv->task_id = IC_TASK_VIEWFINDER;
+   break;
+   case IMX_MEDIA_GRP_ID_IC_PP0...IMX_MEDIA_GRP_ID_IC_PP3:
+   priv->task_id = IC_TASK_POST_PROCESSOR;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   v4l2_subdev_init(&priv->sd, ic_ops[priv->task_id]->subdev_ops);
+   v4l2_set_subdevdata(&priv->sd, priv);
+   priv->sd.internal_ops = ic_ops[priv->task_id]->internal_ops;
+   priv->sd.entity.ops = ic_ops[priv->task_id]->entity_ops;
+   priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER;
+   priv->sd.dev = &pdev->dev;
+   priv->sd.owner = THIS_MODULE;
+   priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
+   priv->sd.grp_id = pdata->grp_id;
+   strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
+
+   ret = ic_ops[priv->task_id]->

[PATCH v3 21/24] media: imx: Add MIPI CSI-2 Receiver subdev driver

2017-01-06 Thread Steve Longerbeam
Adds MIPI CSI-2 Receiver subdev driver. This subdev is required
for sensors with a MIPI CSI2 interface.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/Makefile|   1 +
 drivers/staging/media/imx/imx-mipi-csi2.c | 501 ++
 2 files changed, 502 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.c

diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index fe9e992..0decef7 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o
diff --git a/drivers/staging/media/imx/imx-mipi-csi2.c 
b/drivers/staging/media/imx/imx-mipi-csi2.c
new file mode 100644
index 000..daa6e1d
--- /dev/null
+++ b/drivers/staging/media/imx/imx-mipi-csi2.c
@@ -0,0 +1,501 @@
+/*
+ * MIPI CSI-2 Receiver Subdev for Freescale i.MX5/6 SOC.
+ *
+ * Copyright (c) 2012-2014 Mentor Graphics Inc.
+ *
+ * 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 "imx-media.h"
+
+/*
+ * there must be 5 pads: 1 input pad from sensor, and
+ * the 4 virtual channel output pads
+ */
+#define CSI2_NUM_SINK_PADS  1
+#define CSI2_NUM_SRC_PADS   4
+#define CSI2_NUM_PADS   5
+
+struct imxcsi2_dev {
+   struct device  *dev;
+   struct imx_media_dev   *md;
+   struct v4l2_subdev  sd;
+   struct media_pad   pad[CSI2_NUM_PADS];
+   struct v4l2_mbus_framefmt format_mbus;
+   struct v4l2_subdev *src_sd;
+   struct v4l2_subdev *sink_sd[CSI2_NUM_SRC_PADS];
+   intinput_pad;
+   struct clk *dphy_clk;
+   struct clk *cfg_clk;
+   struct clk *pix_clk; /* what is this? */
+   void __iomem   *base;
+   int intr1;
+   int intr2;
+   struct v4l2_of_bus_mipi_csi2 bus;
+   boolon;
+   boolstream_on;
+};
+
+#define DEVICE_NAME "imx6-mipi-csi2"
+
+/* Register offsets */
+#define CSI2_VERSION0x000
+#define CSI2_N_LANES0x004
+#define CSI2_PHY_SHUTDOWNZ  0x008
+#define CSI2_DPHY_RSTZ  0x00c
+#define CSI2_RESETN 0x010
+#define CSI2_PHY_STATE  0x014
+#define CSI2_DATA_IDS_1 0x018
+#define CSI2_DATA_IDS_2 0x01c
+#define CSI2_ERR1   0x020
+#define CSI2_ERR2   0x024
+#define CSI2_MSK1   0x028
+#define CSI2_MSK2   0x02c
+#define CSI2_PHY_TST_CTRL0  0x030
+#define CSI2_PHY_TST_CTRL1  0x034
+#define CSI2_SFT_RESET  0xf00
+
+static inline struct imxcsi2_dev *sd_to_dev(struct v4l2_subdev *sdev)
+{
+   return container_of(sdev, struct imxcsi2_dev, sd);
+}
+
+static inline u32 imxcsi2_read(struct imxcsi2_dev *csi2, unsigned int regoff)
+{
+   return readl(csi2->base + regoff);
+}
+
+static inline void imxcsi2_write(struct imxcsi2_dev *csi2, u32 val,
+unsigned int regoff)
+{
+   writel(val, csi2->base + regoff);
+}
+
+static void imxcsi2_set_lanes(struct imxcsi2_dev *csi2)
+{
+   int lanes = csi2->bus.num_data_lanes;
+
+   imxcsi2_write(csi2, lanes - 1, CSI2_N_LANES);
+}
+
+static void imxcsi2_enable(struct imxcsi2_dev *csi2, bool enable)
+{
+   if (enable) {
+   imxcsi2_write(csi2, 0x, CSI2_PHY_SHUTDOWNZ);
+   imxcsi2_write(csi2, 0x, CSI2_DPHY_RSTZ);
+   imxcsi2_write(csi2, 0x, CSI2_RESETN);
+   } else {
+   imxcsi2_write(csi2, 0x0, CSI2_PHY_SHUTDOWNZ);
+   imxcsi2_write(csi2, 0x0, CSI2_DPHY_RSTZ);
+   imxcsi2_write(csi2, 0x0, CSI2_RESETN);
+   }
+}
+
+static void imxcsi2_reset(struct imxcsi2_dev *csi2)
+{
+   imxcsi2_enable(csi2, false);
+
+   imxcsi2_write(csi2, 0x0001, CSI2_PHY_TST_CTRL0);
+   imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL1);
+   imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL0);
+   imxcsi2_write(csi2, 0x0002, CSI2_PHY_TST_CTRL0);
+   imxcsi2_write(csi2, 0x00010044, CSI2_PHY_TST_CTRL1);
+   imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL0);
+   imxcsi2_write(csi2, 0x0014, CSI2_PHY_TST_CTRL1);
+   imxcsi2_write(csi2, 0x0002, CSI2_PHY_TST_CTRL0);
+   imxcsi2_write(csi2, 0x, CSI2_PHY_TST_CTRL0);
+
+   imxcsi2_enable(csi2, true);
+}
+
+static int imxcsi2_dphy_wait(struc

[PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-01-06 Thread Steve Longerbeam
From: Philipp Zabel 

This driver can handle SoC internal and external video bus multiplexers,
controlled either by register bit fields or by a GPIO. The subdevice
passes through frame interval and mbus configuration of the active input
to the output side.

Signed-off-by: Sascha Hauer 
Signed-off-by: Philipp Zabel 

--

- fixed a cut&paste error in vidsw_remove(): v4l2_async_register_subdev()
  should be unregister.

- added media_entity_cleanup() and v4l2_device_unregister_subdev()
  to vidsw_remove().

- there was a line left over from a previous iteration that negated
  the new way of determining the pad count just before it which
  has been removed (num_pads = of_get_child_count(np)).

- Philipp Zabel has developed a set of patches that allow adding
  to the subdev async notifier waiting list using a chaining method
  from the async registered callbacks (v4l2_of_subdev_registered()
  and the prep patches for that). For now, I've removed the use of
  v4l2_of_subdev_registered() for the vidmux driver's registered
  callback. This doesn't affect the functionality of this driver,
  but allows for it to be merged now, before adding the chaining
  support.

Signed-off-by: Steve Longerbeam 
---
 .../bindings/media/video-multiplexer.txt   |  59 +++
 drivers/media/platform/Kconfig |   8 +
 drivers/media/platform/Makefile|   2 +
 drivers/media/platform/video-multiplexer.c | 472 +
 4 files changed, 541 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/media/video-multiplexer.txt
 create mode 100644 drivers/media/platform/video-multiplexer.c

diff --git a/Documentation/devicetree/bindings/media/video-multiplexer.txt 
b/Documentation/devicetree/bindings/media/video-multiplexer.txt
new file mode 100644
index 000..9d133d9
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/video-multiplexer.txt
@@ -0,0 +1,59 @@
+Video Multiplexer
+=
+
+Video multiplexers allow to select between multiple input ports. Video received
+on the active input port is passed through to the output port. Muxes described
+by this binding may be controlled by a syscon register bitfield or by a GPIO.
+
+Required properties:
+- compatible : should be "video-multiplexer"
+- reg: should be register base of the register containing the control bitfield
+- bit-mask: bitmask of the control bitfield in the control register
+- bit-shift: bit offset of the control bitfield in the control register
+- gpios: alternatively to reg, bit-mask, and bit-shift, a single GPIO phandle
+  may be given to switch between two inputs
+- #address-cells: should be <1>
+- #size-cells: should be <0>
+- port@*: at least three port nodes containing endpoints connecting to the
+  source and sink devices according to of_graph bindings. The last port is
+  the output port, all others are inputs.
+
+Example:
+
+syscon {
+   compatible = "syscon", "simple-mfd";
+
+   mux {
+   compatible = "video-multiplexer";
+   /* Single bit (1 << 19) in syscon register 0x04: */
+   reg = <0x04>;
+   bit-mask = <1>;
+   bit-shift = <19>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   mux_in0: endpoint {
+   remote-endpoint = <&video_source0_out>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   mux_in1: endpoint {
+   remote-endpoint = <&video_source1_out>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   mux_out: endpoint {
+   remote-endpoint = <&capture_interface_in>;
+   };
+   };
+   };
+};
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index d944421..65614b5 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -74,6 +74,14 @@ config VIDEO_M32R_AR_M64278
  To compile this driver as a module, choose M here: the
  module will be called arv.
 
+config VIDEO_MULTIPLEXER
+   tristate "Video Multiplexer"
+   depends on VIDEO_V4L2_SUBDEV_API && MEDIA_CONTROLLER
+   help
+ This driver provides support for SoC internal N:1 video bus
+ multiplexers controlled by register bitfields as well as external
+ 2:1 video multiplexers controlled by a single GPIO.
+
 config VIDEO_OMAP3
tristate "OMAP 3 Camera support"
depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 5b3cb27..7cf0ee5 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -27,6 +27,8 @@ obj-$(CONFIG_VIDEO_

[PATCH v3 22/24] media: imx: Add MIPI CSI-2 OV5640 sensor subdev driver

2017-01-06 Thread Steve Longerbeam
This driver is based on ov5640_mipi.c from Freescale imx_3.10.17_1.0.0_beta
branch, modified heavily to bring forward to latest interfaces and code
cleanup.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/Kconfig   |8 +
 drivers/staging/media/imx/Makefile  |2 +
 drivers/staging/media/imx/ov5640-mipi.c | 2348 +++
 3 files changed, 2358 insertions(+)
 create mode 100644 drivers/staging/media/imx/ov5640-mipi.c

diff --git a/drivers/staging/media/imx/Kconfig 
b/drivers/staging/media/imx/Kconfig
index ce2d2c8..09f373d 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -17,5 +17,13 @@ config VIDEO_IMX_CAMERA
---help---
  A video4linux camera capture driver for i.MX5/6.
 
+config IMX_OV5640_MIPI
+   tristate "OmniVision OV5640 MIPI CSI-2 camera support"
+   depends on GPIOLIB && VIDEO_IMX_CAMERA
+   select IMX_MIPI_CSI2
+   default y
+   ---help---
+ MIPI CSI-2 OV5640 Camera support.
+
 endmenu
 endif
diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index 0decef7..aa954c1 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -10,3 +10,5 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
 obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o
+
+obj-$(CONFIG_IMX_OV5640_MIPI) += ov5640-mipi.o
diff --git a/drivers/staging/media/imx/ov5640-mipi.c 
b/drivers/staging/media/imx/ov5640-mipi.c
new file mode 100644
index 000..54647a7
--- /dev/null
+++ b/drivers/staging/media/imx/ov5640-mipi.c
@@ -0,0 +1,2348 @@
+/*
+ * Copyright (c) 2014 Mentor Graphics Inc.
+ * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+#define OV5640_VOLTAGE_ANALOG   280
+#define OV5640_VOLTAGE_DIGITAL_CORE 150
+#define OV5640_VOLTAGE_DIGITAL_IO   180
+
+#define MIN_FPS 15
+#define MAX_FPS 30
+#define DEFAULT_FPS 30
+
+/* min/typical/max system clock (xclk) frequencies */
+#define OV5640_XCLK_MIN  600
+#define OV5640_XCLK_TYP 2400
+#define OV5640_XCLK_MAX 5400
+
+/* min/typical/max pixel clock (mclk) frequencies */
+#define OV5640_MCLK_MIN 4800
+#define OV5640_MCLK_TYP 4800
+#define OV5640_MCLK_MAX 9600
+
+#define OV5640_CHIP_ID  0x300A
+#define OV5640_SLAVE_ID 0x3100
+#define OV5640_DEFAULT_SLAVE_ID 0x3c
+
+#define OV5640_MAX_CONTROLS 64
+
+enum ov5640_mode {
+   ov5640_mode_MIN = 0,
+   ov5640_mode_QCIF_176_144 = 0,
+   ov5640_mode_QVGA_320_240,
+   ov5640_mode_VGA_640_480,
+   ov5640_mode_NTSC_720_480,
+   ov5640_mode_PAL_720_576,
+   ov5640_mode_XGA_1024_768,
+   ov5640_mode_720P_1280_720,
+   ov5640_mode_1080P_1920_1080,
+   ov5640_mode_QSXGA_2592_1944,
+   ov5640_num_modes,
+   ov5640_mode_INIT = 0xff, /*only for sensor init*/
+};
+
+enum ov5640_frame_rate {
+   ov5640_15_fps,
+   ov5640_30_fps
+};
+
+static int ov5640_framerates[] = {
+   [ov5640_15_fps] = 15,
+   [ov5640_30_fps] = 30,
+};
+#define ov5640_num_framerates ARRAY_SIZE(ov5640_framerates)
+
+/* image size under 1280 * 960 are SUBSAMPLING
+ * image size upper 1280 * 960 are SCALING
+ */
+enum ov5640_downsize_mode {
+   SUBSAMPLING,
+   SCALING,
+};
+
+struct reg_value {
+   u16 reg_addr;
+   u8 val;
+   u8 mask;
+   u32 delay_ms;
+};
+
+struct ov5640_mode_info {
+   enum ov5640_mode mode;
+   enum ov5640_downsize_mode dn_mode;
+   u32 width;
+   u32 height;
+   struct reg_value *init_data_ptr;
+   u32 init_data_size;
+};
+
+struct ov5640_dev {
+   struct i2c_client *i2c_client;
+   struct device *dev;
+   struct v4l2_subdev sd;
+   struct media_pad pad;
+   struct v4l2_ctrl_handler ctrl_hdl;
+   struct v4l2_of_endpoint ep; /* the parsed DT endpoint info */
+   struct v4l2_mbus_framefmt fmt;
+   struct v4l2_captureparm streamcap;
+   struct clk *xclk; /* system clock to OV5640 */
+   int xclk_freq;/* requested xclk freq from devicetree */
+
+   enum ov5640_mode current_mode;
+   enum ov5640_frame_rate current_fr;
+
+   bool on;
+   bool awb_on;
+   bool agc_on;
+
+   /* cached control settings */
+   int ctrl_cache[OV5640_MAX_CONTROLS];
+
+   struct gpio_desc *reset_gpio;
+   struct gpio_desc *pwdn_gpio;
+   struct gpio_desc *gp_gp

[PATCH 1/2] staging:rtl8712: Removed unnecessary parentheses

2017-01-06 Thread Scott Matheina
Removed unnecessary parentheses identified by checkpatch

Signed-off-by: Scott Matheina 
---
 drivers/staging/rtl8712/ieee80211.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index 5dc3b5b..bfc6838 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -202,10 +202,10 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv)
  rateLen, pdev_network->rates, &sz);
/*DS parameter set*/
ie = r8712_set_ie(ie, _DSSET_IE_, 1,
- (u8 *)&(pdev_network->Configuration.DSConfig), &sz);
+ (u8 *)&pdev_network->Configuration.DSConfig, &sz);
/*IBSS Parameter Set*/
ie = r8712_set_ie(ie, _IBSS_PARA_IE_, 2,
- (u8 *)&(pdev_network->Configuration.ATIMWindow), &sz);
+ (u8 *)&pdev_network->Configuration.ATIMWindow, &sz);
return sz;
 }
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging:rtl8712 Aligned code with open parenthesis

2017-01-06 Thread Scott Matheina
Aligned code with open parenthesis to fix a checkpatch warning

Signed-off-by: Scott Matheina 
---
 drivers/staging/rtl8712/mlme_linux.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8712/mlme_linux.c 
b/drivers/staging/rtl8712/mlme_linux.c
index af7c4a4..999c16d 100644
--- a/drivers/staging/rtl8712/mlme_linux.c
+++ b/drivers/staging/rtl8712/mlme_linux.c
@@ -117,7 +117,7 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter)
backupTKIPCountermeasure = adapter->securitypriv.
   btkip_countermeasure;
memset((unsigned char *)&adapter->securitypriv, 0,
-sizeof(struct security_priv));
+  sizeof(struct security_priv));
setup_timer(&adapter->securitypriv.tkip_timer,
r8712_use_tkipkey_handler,
(unsigned long)adapter);
@@ -125,8 +125,8 @@ void r8712_os_indicate_disconnect(struct _adapter *adapter)
 * for the following connection.
 */
memcpy(&adapter->securitypriv.PMKIDList[0],
-   &backupPMKIDList[0],
-   sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE);
+  &backupPMKIDList[0],
+  sizeof(struct RT_PMKID_LIST) * NUM_PMKID_CACHE);
adapter->securitypriv.PMKIDIndex = backupPMKIDIndex;
adapter->securitypriv.btkip_countermeasure =
 backupTKIPCountermeasure;
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 04/24] ARM: dts: imx6qdl: add media device

2017-01-06 Thread Steve Longerbeam
Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6q.dtsi   | 4 
 arch/arm/boot/dts/imx6qdl.dtsi | 8 
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 9b2ca32..8867e78 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -458,3 +458,7 @@
 &vpu {
compatible = "fsl,imx6q-vpu", "cnm,coda960";
 };
+
+&media0 {
+   ports = <&ipu1_csi0>, <&ipu1_csi1>, <&ipu2_csi0>, <&ipu2_csi1>;
+};
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 010388c..cbb42ec 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -1296,5 +1296,13 @@
};
};
};
+
+   media0: media@0 {
+   compatible = "fsl,imx-media";
+   ports = <&ipu1_csi0>, <&ipu1_csi1>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   status = "okay";
+   };
};
 };
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 15/24] media: Add userspace header file for i.MX

2017-01-06 Thread Steve Longerbeam
This adds a header file for use by userspace programs wanting to interact
with the i.MX media driver. It defines custom v4l2 controls and events
generated by the i.MX v4l2 subdevices.

Signed-off-by: Steve Longerbeam 
---
 include/uapi/media/Kbuild |  1 +
 include/uapi/media/imx.h  | 30 ++
 2 files changed, 31 insertions(+)
 create mode 100644 include/uapi/media/imx.h

diff --git a/include/uapi/media/Kbuild b/include/uapi/media/Kbuild
index aafaa5a..fa78958 100644
--- a/include/uapi/media/Kbuild
+++ b/include/uapi/media/Kbuild
@@ -1 +1,2 @@
 # UAPI Header export list
+header-y += imx.h
diff --git a/include/uapi/media/imx.h b/include/uapi/media/imx.h
new file mode 100644
index 000..2421d9c
--- /dev/null
+++ b/include/uapi/media/imx.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014-2015 Mentor Graphics Inc.
+ *
+ * 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
+ */
+
+#ifndef __UAPI_MEDIA_IMX_H__
+#define __UAPI_MEDIA_IMX_H__
+
+/*
+ * events from the subdevs
+ */
+#define V4L2_EVENT_IMX_CLASS  V4L2_EVENT_PRIVATE_START
+#define V4L2_EVENT_IMX_NFB4EOF(V4L2_EVENT_IMX_CLASS + 1)
+#define V4L2_EVENT_IMX_EOF_TIMEOUT(V4L2_EVENT_IMX_CLASS + 2)
+#define V4L2_EVENT_IMX_FRAME_INTERVAL (V4L2_EVENT_IMX_CLASS + 3)
+
+enum imx_ctrl_id {
+   V4L2_CID_IMX_MOTION = (V4L2_CID_USER_IMX_BASE + 0),
+   V4L2_CID_IMX_FIM_ENABLE,
+   V4L2_CID_IMX_FIM_NUM,
+   V4L2_CID_IMX_FIM_TOLERANCE_MIN,
+   V4L2_CID_IMX_FIM_TOLERANCE_MAX,
+   V4L2_CID_IMX_FIM_NUM_SKIP,
+};
+
+#endif
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 05/24] ARM: dts: imx6qdl-sabrelite: remove erratum ERR006687 workaround

2017-01-06 Thread Steve Longerbeam
There is a pin conflict with GPIO_6. This pin functions as a power
input pin to the OV5642 camera sensor, but ENET uses it as the h/w
workaround for erratum ERR006687, to wake-up the ARM cores on normal
RX and TX packet done events. So we need to remove the h/w workaround
to support the OV5642. The result is that the CPUidle driver will no
longer allow entering the deep idle states on the sabrelite.

This is a partial revert of

commit 6261c4c8f13e ("ARM: dts: imx6qdl-sabrelite: use GPIO_6 for FEC
interrupt.")
commit a28eeb43ee57 ("ARM: dts: imx6: tag boards that have the HW workaround
for ERR006687")

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 4 
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
index 1f9076e..795b5a5 100644
--- a/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabrelite.dtsi
@@ -271,9 +271,6 @@
txd1-skew-ps = <0>;
txd2-skew-ps = <0>;
txd3-skew-ps = <0>;
-   interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
- <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
-   fsl,err006687-workaround-present;
status = "okay";
 };
 
@@ -374,7 +371,6 @@
MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
/* Phy reset */
MX6QDL_PAD_EIM_D23__GPIO3_IO23  0x000b0
-   MX6QDL_PAD_GPIO_6__ENET_IRQ 0x000b1
>;
};
 
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 17/24] media: imx: Add CSI subdev driver

2017-01-06 Thread Steve Longerbeam
This is a media entity subdevice for the i.MX Camera
Serial Interface module.

Signed-off-by: Steve Longerbeam 
---
 drivers/staging/media/imx/Kconfig   |  13 +
 drivers/staging/media/imx/Makefile  |   2 +
 drivers/staging/media/imx/imx-csi.c | 644 
 3 files changed, 659 insertions(+)
 create mode 100644 drivers/staging/media/imx/imx-csi.c

diff --git a/drivers/staging/media/imx/Kconfig 
b/drivers/staging/media/imx/Kconfig
index bfde58d..ce2d2c8 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -6,3 +6,16 @@ config VIDEO_IMX_MEDIA
  Say yes here to enable support for video4linux media controller
  driver for the i.MX5/6 SOC.
 
+if VIDEO_IMX_MEDIA
+menu "i.MX5/6 Media Sub devices"
+
+config VIDEO_IMX_CAMERA
+   tristate "i.MX5/6 Camera driver"
+   depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
+   select VIDEOBUF2_DMA_CONTIG
+   default y
+   ---help---
+ A video4linux camera capture driver for i.MX5/6.
+
+endmenu
+endif
diff --git a/drivers/staging/media/imx/Makefile 
b/drivers/staging/media/imx/Makefile
index ef9f11b..133672a 100644
--- a/drivers/staging/media/imx/Makefile
+++ b/drivers/staging/media/imx/Makefile
@@ -4,3 +4,5 @@ imx-media-objs := imx-media-dev.o imx-media-fim.o 
imx-media-internal-sd.o \
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o
 obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
 
+obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
+
diff --git a/drivers/staging/media/imx/imx-csi.c 
b/drivers/staging/media/imx/imx-csi.c
new file mode 100644
index 000..64ef862
--- /dev/null
+++ b/drivers/staging/media/imx/imx-csi.c
@@ -0,0 +1,644 @@
+/*
+ * V4L2 Capture CSI Subdev for Freescale i.MX5/6 SOC
+ *
+ * Copyright (c) 2014-2016 Mentor Graphics Inc.
+ *
+ * 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 "imx-media.h"
+
+#define CSI_NUM_PADS 2
+
+struct csi_priv {
+   struct device *dev;
+   struct ipu_soc *ipu;
+   struct imx_media_dev *md;
+   struct v4l2_subdev sd;
+   struct media_pad pad[CSI_NUM_PADS];
+   struct v4l2_mbus_framefmt format_mbus[CSI_NUM_PADS];
+   struct v4l2_mbus_config sensor_mbus_cfg;
+   struct v4l2_rect crop;
+   struct ipu_csi *csi;
+   int csi_id;
+   int input_pad;
+   int output_pad;
+   bool power_on;  /* power is on */
+   bool stream_on; /* streaming is on */
+
+   /* the sink for the captured frames */
+   struct v4l2_subdev *sink_sd;
+   enum ipu_csi_dest dest;
+   struct v4l2_subdev *src_sd;
+
+   struct v4l2_ctrl_handler ctrl_hdlr;
+   struct imx_media_fim *fim;
+
+   /* the attached sensor at stream on */
+   struct imx_media_subdev *sensor;
+};
+
+static inline struct csi_priv *sd_to_dev(struct v4l2_subdev *sdev)
+{
+   return container_of(sdev, struct csi_priv, sd);
+}
+
+/* Update the CSI whole sensor and active windows */
+static int csi_setup(struct csi_priv *priv)
+{
+   struct v4l2_mbus_framefmt infmt;
+
+   ipu_csi_set_window(priv->csi, &priv->crop);
+
+   /*
+* the ipu-csi doesn't understand ALTERNATE, but it only
+* needs to know whether the stream is interlaced, so set
+* to INTERLACED if infmt field is ALTERNATE.
+*/
+   infmt = priv->format_mbus[priv->input_pad];
+   if (infmt.field == V4L2_FIELD_ALTERNATE)
+   infmt.field = V4L2_FIELD_INTERLACED;
+
+   ipu_csi_init_interface(priv->csi, &priv->sensor_mbus_cfg, &infmt);
+
+   ipu_csi_set_dest(priv->csi, priv->dest);
+
+   ipu_csi_dump(priv->csi);
+
+   return 0;
+}
+
+static int csi_start(struct csi_priv *priv)
+{
+   int ret;
+
+   if (!priv->sensor) {
+   v4l2_err(&priv->sd, "no sensor attached\n");
+   return -EINVAL;
+   }
+
+   ret = csi_setup(priv);
+   if (ret)
+   return ret;
+
+   /* start the frame interval monitor */
+   if (priv->fim) {
+   ret = imx_media_fim_set_stream(priv->fim, priv->sensor, true);
+   if (ret)
+   return ret;
+   }
+
+   ret = ipu_csi_enable(priv->csi);
+   if (ret) {
+   v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
+   goto fim_off;
+   }
+
+   return 0;
+
+fim_off:
+   if (priv->fim)
+   imx_media_fim_set_stream(priv->fim, priv->sensor, false);
+   return ret;
+}
+
+static void csi_stop(struct csi_priv *priv)
+{
+   /* stop the frame interval monitor */
+   if (priv->fim)
+   imx_media_fim_set_stream(priv->fim, priv->sensor, false);
+
+   ipu_csi_disable(priv->csi);
+}
+
+st

[PATCH v3 16/24] media: Add i.MX media core driver

2017-01-06 Thread Steve Longerbeam
Add the core media driver for i.MX SOC.

Signed-off-by: Steve Longerbeam 
---
 Documentation/media/v4l-drivers/imx.rst   | 443 ++
 drivers/staging/media/Kconfig |   2 +
 drivers/staging/media/Makefile|   1 +
 drivers/staging/media/imx/Kconfig |   8 +
 drivers/staging/media/imx/Makefile|   6 +
 drivers/staging/media/imx/TODO|  22 +
 drivers/staging/media/imx/imx-media-common.c  | 981 ++
 drivers/staging/media/imx/imx-media-dev.c | 486 +++
 drivers/staging/media/imx/imx-media-fim.c | 471 +++
 drivers/staging/media/imx/imx-media-internal-sd.c | 457 ++
 drivers/staging/media/imx/imx-media-of.c  | 289 +++
 drivers/staging/media/imx/imx-media.h | 310 +++
 include/media/imx.h   |  15 +
 include/uapi/linux/v4l2-controls.h|   4 +
 14 files changed, 3495 insertions(+)
 create mode 100644 Documentation/media/v4l-drivers/imx.rst
 create mode 100644 drivers/staging/media/imx/Kconfig
 create mode 100644 drivers/staging/media/imx/Makefile
 create mode 100644 drivers/staging/media/imx/TODO
 create mode 100644 drivers/staging/media/imx/imx-media-common.c
 create mode 100644 drivers/staging/media/imx/imx-media-dev.c
 create mode 100644 drivers/staging/media/imx/imx-media-fim.c
 create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c
 create mode 100644 drivers/staging/media/imx/imx-media-of.c
 create mode 100644 drivers/staging/media/imx/imx-media.h
 create mode 100644 include/media/imx.h

diff --git a/Documentation/media/v4l-drivers/imx.rst 
b/Documentation/media/v4l-drivers/imx.rst
new file mode 100644
index 000..87b37b5
--- /dev/null
+++ b/Documentation/media/v4l-drivers/imx.rst
@@ -0,0 +1,443 @@
+i.MX Video Capture Driver
+=
+
+Introduction
+
+
+The Freescale i.MX5/6 contains an Image Processing Unit (IPU), which
+handles the flow of image frames to and from capture devices and
+display devices.
+
+For image capture, the IPU contains the following internal subunits:
+
+- Image DMA Controller (IDMAC)
+- Camera Serial Interface (CSI)
+- Image Converter (IC)
+- Sensor Multi-FIFO Controller (SMFC)
+- Image Rotator (IRT)
+- Video De-Interlace Controller (VDIC)
+
+The IDMAC is the DMA controller for transfer of image frames to and from
+memory. Various dedicated DMA channels exist for both video capture and
+display paths.
+
+The CSI is the frontend capture unit that interfaces directly with
+capture sensors over Parallel, BT.656/1120, and MIPI CSI-2 busses.
+
+The IC handles color-space conversion, resizing, and rotation
+operations. There are three independent "tasks" within the IC that can
+carry out conversions concurrently: pre-processing encoding,
+pre-processing preview, and post-processing.
+
+The SMFC is composed of four independent channels that each can transfer
+captured frames from sensors directly to memory concurrently.
+
+The IRT carries out 90 and 270 degree image rotation operations.
+
+The VDIC handles the conversion of interlaced video to progressive, with
+support for different motion compensation modes (low, medium, and high
+motion). The deinterlaced output frames from the VDIC can be sent to the
+IC pre-process preview task for further conversions.
+
+In addition to the IPU internal subunits, there are also two units
+outside the IPU that are also involved in video capture on i.MX:
+
+- MIPI CSI-2 Receiver for camera sensors with the MIPI CSI-2 bus
+  interface. This is a Synopsys DesignWare core.
+- A video multiplexer for selecting among multiple sensor inputs to
+  send to a CSI.
+
+For more info, refer to the latest versions of the i.MX5/6 reference
+manuals listed under References.
+
+
+Features
+
+
+Some of the features of this driver include:
+
+- Many different pipelines can be configured via media controller API,
+  that correspond to the hardware video capture pipelines supported in
+  the i.MX.
+
+- Supports parallel, BT.565, and MIPI CSI-2 interfaces.
+
+- Up to four concurrent sensor acquisitions, by configuring each
+  sensor's pipeline using independent entities. This is currently
+  demonstrated with the SabreSD and SabreLite reference boards with
+  independent OV5642 and MIPI CSI-2 OV5640 sensor modules.
+
+- Scaling, color-space conversion, and image rotation via IC task
+  subdevs.
+
+- Many pixel formats supported (RGB, packed and planar YUV, partial
+  planar YUV).
+
+- The IC pre-process preview subdev supports motion compensated
+  de-interlacing using the VDIC, with three motion compensation modes:
+  low, medium, and high motion. The mode is specified with a custom
+  control. Pipelines are defined that allow sending frames to the
+  preview subdev directly from the CSI or from the SMFC.
+
+- Includes a Frame Interval Monitor (FIM) that can correct vertical sync
+  problems wit

[PATCH v3 14/24] UAPI: Add media UAPI Kbuild file

2017-01-06 Thread Steve Longerbeam
Add an empty UAPI Kbuild file for media UAPI headers.

Signed-off-by: Steve Longerbeam 
---
 include/uapi/Kbuild   | 1 +
 include/uapi/media/Kbuild | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 include/uapi/media/Kbuild

diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild
index 245aa6e..9a51957 100644
--- a/include/uapi/Kbuild
+++ b/include/uapi/Kbuild
@@ -6,6 +6,7 @@
 header-y += asm-generic/
 header-y += linux/
 header-y += sound/
+header-y += media/
 header-y += mtd/
 header-y += rdma/
 header-y += video/
diff --git a/include/uapi/media/Kbuild b/include/uapi/media/Kbuild
new file mode 100644
index 000..aafaa5a
--- /dev/null
+++ b/include/uapi/media/Kbuild
@@ -0,0 +1 @@
+# UAPI Header export list
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: media: style fix, octal file permissions

2017-01-06 Thread Derek Robson
Changed file permissions to octal.
Found with checkpatch

Signed-off-by: Derek Robson 
---
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c 
b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index bf077f8342f6..32109cdd73a6 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -74,7 +74,7 @@
 static bool debug;
 static bool interface;
 
-module_param(interface, bool, S_IRUGO);
+module_param(interface, bool, 0444);
 module_param(debug, bool, 0644);
 
 /**
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 10/24] ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture

2017-01-06 Thread Steve Longerbeam
Add pinctrl groups for both GPT input capture channels.

Signed-off-by: Steve Longerbeam 
---
 arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 
b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
index 967c3b8..495709f 100644
--- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
@@ -457,6 +457,18 @@
>;
};
 
+   pinctrl_gpt_input_capture0: gptinputcapture0grp {
+   fsl,pins = <
+   MX6QDL_PAD_SD1_DAT0__GPT_CAPTURE1   0x1b0b0
+   >;
+   };
+
+   pinctrl_gpt_input_capture1: gptinputcapture1grp {
+   fsl,pins = <
+   MX6QDL_PAD_SD1_DAT1__GPT_CAPTURE2   0x1b0b0
+   >;
+   };
+
pinctrl_spdif: spdifgrp {
fsl,pins = <
MX6QDL_PAD_KEY_COL3__SPDIF_IN 0x1b0b0
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: media: lirc: style fix, using octal file permissions

2017-01-06 Thread Derek Robson
Change file permissions to octal style.
Found using checkpatch

Signed-off-by: Derek Robson 
---
 drivers/staging/media/lirc/lirc_imon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c 
b/drivers/staging/media/lirc/lirc_imon.c
index 1e650fba4a92..6c8a4a15278e 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -182,7 +182,7 @@ MODULE_DESCRIPTION(MOD_DESC);
 MODULE_VERSION(MOD_VERSION);
 MODULE_LICENSE("GPL");
 MODULE_DEVICE_TABLE(usb, imon_usb_id_table);
-module_param(debug, int, S_IRUGO | S_IWUSR);
+module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Debug messages: 0=no, 1=yes(default: no)");
 
 static void free_imon_context(struct imon_context *context)
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] Staging: unisys: visorbus: style fix, using octal file permissions

2017-01-06 Thread Derek Robson
Changed file permissions to octal style.
Found with checkpatch

Signed-off-by: Derek Robson 
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 3457ef338e1e..28ca291a4053 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -984,7 +984,7 @@ create_bus_instance(struct visor_device *dev)
goto err_hdr_info;
}
dev->debugfs_client_bus_info =
-   debugfs_create_file("client_bus_info", S_IRUSR | S_IRGRP,
+   debugfs_create_file("client_bus_info", 0440,
dev->debugfs_dir, dev,
&client_bus_info_debugfs_fops);
if (!dev->debugfs_client_bus_info) {
@@ -1337,10 +1337,10 @@ visorbus_exit(void)
debugfs_remove_recursive(visorbus_debugfs_dir);
 }
 
-module_param_named(forcematch, visorbus_forcematch, int, S_IRUGO);
+module_param_named(forcematch, visorbus_forcematch, int, 0444);
 MODULE_PARM_DESC(visorbus_forcematch,
 "1 to force a successful dev <--> drv match");
 
-module_param_named(forcenomatch, visorbus_forcenomatch, int, S_IRUGO);
+module_param_named(forcenomatch, visorbus_forcenomatch, int, 0444);
 MODULE_PARM_DESC(visorbus_forcenomatch,
 "1 to force an UNsuccessful dev <--> drv match");
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] Staging: unisys: visorbus: style fix, using octal file permissions

2017-01-06 Thread Derek Robson
Two files change in style fix, changes are octal file permissions.

Derek Robson (2):
  Staging: unisys: visorbus: style fix, using octal file permissions
  Staging: unisys: visorbus: style fix, using octal file permissions

 drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
 drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] Staging: unisys: visorbus: style fix, using octal file permissions

2017-01-06 Thread Derek Robson
Changed file permissions to octal sytle.
Found using checkpatch.

Signed-off-by: Derek Robson 
---
 drivers/staging/unisys/visorbus/visorchipset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index d7148c351d3f..66944e7534e9 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -2277,7 +2277,7 @@ static void exit_unisys(void)
acpi_bus_unregister_driver(&unisys_acpi_driver);
 }
 
-module_param_named(major, visorchipset_major, int, S_IRUGO);
+module_param_named(major, visorchipset_major, int, 0444);
 MODULE_PARM_DESC(visorchipset_major,
 "major device number to use for the device node");
 
-- 
2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: speakup: styel fix, octal file permissions

2017-01-06 Thread Derek Robson
Changed file permission to octal style,
Found using checkpatch

Signed-off-by: Derek Robson 
---
 drivers/staging/speakup/kobjects.c | 54 +++---
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c 
b/drivers/staging/speakup/kobjects.c
index e744aa9730ff..4e7ebc306488 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -865,66 +865,66 @@ static struct kobj_attribute version_attribute =
__ATTR_RO(version);
 
 static struct kobj_attribute delimiters_attribute =
-   __ATTR(delimiters, S_IWUSR | S_IRUGO, punc_show, punc_store);
+   __ATTR(delimiters, 0644, punc_show, punc_store);
 static struct kobj_attribute ex_num_attribute =
-   __ATTR(ex_num, S_IWUSR | S_IRUGO, punc_show, punc_store);
+   __ATTR(ex_num, 0644, punc_show, punc_store);
 static struct kobj_attribute punc_all_attribute =
-   __ATTR(punc_all, S_IWUSR | S_IRUGO, punc_show, punc_store);
+   __ATTR(punc_all, 0644, punc_show, punc_store);
 static struct kobj_attribute punc_most_attribute =
-   __ATTR(punc_most, S_IWUSR | S_IRUGO, punc_show, punc_store);
+   __ATTR(punc_most, 0644, punc_show, punc_store);
 static struct kobj_attribute punc_some_attribute =
-   __ATTR(punc_some, S_IWUSR | S_IRUGO, punc_show, punc_store);
+   __ATTR(punc_some, 0644, punc_show, punc_store);
 static struct kobj_attribute repeats_attribute =
-   __ATTR(repeats, S_IWUSR | S_IRUGO, punc_show, punc_store);
+   __ATTR(repeats, 0644, punc_show, punc_store);
 
 static struct kobj_attribute attrib_bleep_attribute =
-   __ATTR(attrib_bleep, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(attrib_bleep, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute bell_pos_attribute =
-   __ATTR(bell_pos, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(bell_pos, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute bleep_time_attribute =
-   __ATTR(bleep_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(bleep_time, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute bleeps_attribute =
-   __ATTR(bleeps, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(bleeps, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute cursor_time_attribute =
-   __ATTR(cursor_time, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(cursor_time, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute key_echo_attribute =
-   __ATTR(key_echo, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(key_echo, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute no_interrupt_attribute =
-   __ATTR(no_interrupt, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(no_interrupt, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute punc_level_attribute =
-   __ATTR(punc_level, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(punc_level, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute reading_punc_attribute =
-   __ATTR(reading_punc, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(reading_punc, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute say_control_attribute =
-   __ATTR(say_control, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(say_control, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute say_word_ctl_attribute =
-   __ATTR(say_word_ctl, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(say_word_ctl, 0644, spk_var_show, spk_var_store);
 static struct kobj_attribute spell_delay_attribute =
-   __ATTR(spell_delay, S_IWUSR | S_IRUGO, spk_var_show, spk_var_store);
+   __ATTR(spell_delay, 0644, spk_var_show, spk_var_store);
 
 /*
  * These attributes are i18n related.
  */
 static struct kobj_attribute announcements_attribute =
-   __ATTR(announcements, S_IWUSR | S_IRUGO, message_show, message_store);
+   __ATTR(announcements, 0644, message_show, message_store);
 static struct kobj_attribute characters_attribute =
-   __ATTR(characters, S_IWUSR | S_IRUGO, chars_chartab_show,
+   __ATTR(characters, 0644, chars_chartab_show,
   chars_chartab_store);
 static struct kobj_attribute chartab_attribute =
-   __ATTR(chartab, S_IWUSR | S_IRUGO, chars_chartab_show,
+   __ATTR(chartab, 0644, chars_chartab_show,
   chars_chartab_store);
 static struct kobj_attribute ctl_keys_attribute =
-   __ATTR(ctl_keys, S_IWUSR | S_IRUGO, message_show, message_store);
+   __ATTR(ctl_keys, 0644, message_show, message_store);
 static struct kobj_attribute colors_attribute =
-   __ATTR(colors, S_IWUSR | S_IRUGO, message_show, message_store);
+   __ATTR(colors, 0644, message_show, message_store);
 static struct kobj_attribute formatted_attribute =
-   __ATTR(format

RE: [PATCH 0/2] Staging: unisys: visorbus: style fix, using octal file permissions

2017-01-06 Thread Kershner, David A
> -Original Message-
> From: Derek Robson [mailto:robso...@gmail.com]
> Sent: Friday, January 6, 2017 10:48 PM
> To: Kershner, David A ;
> gre...@linuxfoundation.org; Sell, Timothy C 
> Cc: *S-Par-Maintainer ;
> de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; Derek Robson
> 
> Subject: [PATCH 0/2] Staging: unisys: visorbus: style fix, using octal file
> permissions
> 
> Two files change in style fix, changes are octal file permissions.
> 

Series looks fine to me and runs on top of the s-Par firmware.

Acked-by: David Kershner 

> Derek Robson (2):
>   Staging: unisys: visorbus: style fix, using octal file permissions
>   Staging: unisys: visorbus: style fix, using octal file permissions
> 
>  drivers/staging/unisys/visorbus/visorbus_main.c | 6 +++---
>  drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> --
> 2.11.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH] hv: use substraction to update ring buffer index

2017-01-06 Thread Long Li


> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Thursday, January 05, 2017 3:40 AM
> To: Long Li 
> Cc: KY Srinivasan ; Haiyang Zhang
> ; de...@linuxdriverproject.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] hv: use substraction to update ring buffer index
> 
> On Wed, Jan 04, 2017 at 08:08:22PM -0800, Long Li wrote:
> > From: Long Li 
> >
> > The ring buffer code uses %= to calculate index. For x86/64, %=
> > compiles to div, more than 10 times slower than sub.
> >
> > Replace div with sub for this data heavy code path.
> >
> > Signed-off-by: Long Li 
> > ---
> >  drivers/hv/ring_buffer.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index
> > cd49cb1..f8eee6e 100644
> > --- a/drivers/hv/ring_buffer.c
> > +++ b/drivers/hv/ring_buffer.c
> > @@ -135,7 +135,8 @@ hv_get_next_readlocation_withoffset(struct
> hv_ring_buffer_info *ring_info,
> > u32 next = ring_info->ring_buffer->read_index;
> >
> > next += offset;
> > -   next %= ring_info->ring_datasize;
> > +   if (next >= ring_info->ring_datasize)
> > +   next -= ring_info->ring_datasize;
> 
> I take it that we trust that offset is roughly correct and not more than 2x
> ring_info->ring_datasize?  I guess there is only one caller so it's probably
> true...

Yes, you are right. It's not possible that we are getting to 2x ring_datasize, 
because it's not possible to transfer data more than ring_datasize over ring 
buffer.

> 
> >
> > return next;
> >  }
> > @@ -179,7 +180,8 @@ static u32 hv_copyfrom_ringbuffer(
> > memcpy(dest, ring_buffer + start_read_offset, destlen);
> >
> > start_read_offset += destlen;
> > -   start_read_offset %= ring_buffer_size;
> > +   if (start_read_offset >= ring_buffer_size)
> > +   start_read_offset -= ring_buffer_size;
> 
> I totally don't understand the original code here.  We do the memset and
> then we verify that we are not copying beyond the end of the ring buffer?  If
> feels like we should verify that offset + destlen aren't more than
> ring_buffer_size before we do the memcpy().

The ring buffer pages are mapped to wraparound 2x virtual address space. Please 
see hv_ringbuffer_init(). The call to vmap() setup this virtual address space. 
So we can use memcpy across the last page.

> 
> regards,
> dan carpenter
> 

Thanks for reviewing!

Long

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v2] hv: retry infinitely on hypercall transient failures

2017-01-06 Thread Long Li
> -Original Message-
> From: Greg KH [mailto:g...@kroah.com]
> Sent: Wednesday, January 04, 2017 11:48 PM
> To: Long Li 
> Cc: KY Srinivasan ; Haiyang Zhang
> ; de...@linuxdriverproject.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH v2] hv: retry infinitely on hypercall transient failures
> 
> On Wed, Jan 04, 2017 at 06:12:20PM -0800, Long Li wrote:
> > From: Long Li 
> >
> > Hyper-v host guarantees that a hypercall will finish in reasonable time.
> > Retry infinitely on transient failures to avoid returning error to upper 
> > layer.
> 
> Again, never retry "forever", always have a way out, otherwise you will crash.
> 
> And again, why are you making this change?  What problem does it solve?

The problem it tries to solve is that in this code we are returning error 
prematurely on transient failures. The hypercall is used mostly in channel 
establishment. If we return a transient failure, the VM may not boot or not 
useful after boot due to some devices missing.

Another approach is to increase the number of retries. But we don't know how 
many retries is safe, and Windows host side expects the guest retry infinitely 
and not return error on transient failures.

> 
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: speakup: styel fix, octal file permissions

2017-01-06 Thread Greg KH
On Sat, Jan 07, 2017 at 05:11:16PM +1300, Derek Robson wrote:
> Changed file permission to octal style,
> Found using checkpatch

Typo in your subject line :(

> 
> Signed-off-by: Derek Robson 
> ---
>  drivers/staging/speakup/kobjects.c | 54 
> +++---
>  1 file changed, 27 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/staging/speakup/kobjects.c 
> b/drivers/staging/speakup/kobjects.c
> index e744aa9730ff..4e7ebc306488 100644
> --- a/drivers/staging/speakup/kobjects.c
> +++ b/drivers/staging/speakup/kobjects.c
> @@ -865,66 +865,66 @@ static struct kobj_attribute version_attribute =
>   __ATTR_RO(version);
>  
>  static struct kobj_attribute delimiters_attribute =
> - __ATTR(delimiters, S_IWUSR | S_IRUGO, punc_show, punc_store);
> + __ATTR(delimiters, 0644, punc_show, punc_store);
>  static struct kobj_attribute ex_num_attribute =
> - __ATTR(ex_num, S_IWUSR | S_IRUGO, punc_show, punc_store);
> + __ATTR(ex_num, 0644, punc_show, punc_store);

Why not just use __ATTR_RW() for all of these instead?  Be much easier
and smaller and is recommended instead of spelling out the mode values
everywhere.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] hv: retry infinitely on hypercall transient failures

2017-01-06 Thread Greg KH
On Sat, Jan 07, 2017 at 07:23:14AM +, Long Li wrote:
> > -Original Message-
> > From: Greg KH [mailto:g...@kroah.com]
> > Sent: Wednesday, January 04, 2017 11:48 PM
> > To: Long Li 
> > Cc: KY Srinivasan ; Haiyang Zhang
> > ; de...@linuxdriverproject.org; linux-
> > ker...@vger.kernel.org
> > Subject: Re: [PATCH v2] hv: retry infinitely on hypercall transient failures
> > 
> > On Wed, Jan 04, 2017 at 06:12:20PM -0800, Long Li wrote:
> > > From: Long Li 
> > >
> > > Hyper-v host guarantees that a hypercall will finish in reasonable time.
> > > Retry infinitely on transient failures to avoid returning error to upper 
> > > layer.
> > 
> > Again, never retry "forever", always have a way out, otherwise you will 
> > crash.
> > 
> > And again, why are you making this change?  What problem does it solve?
> 
> The problem it tries to solve is that in this code we are returning
> error prematurely on transient failures. The hypercall is used mostly
> in channel establishment. If we return a transient failure, the VM may
> not boot or not useful after boot due to some devices missing.
> 
> Another approach is to increase the number of retries. But we don't
> know how many retries is safe, and Windows host side expects the guest
> retry infinitely and not return error on transient failures.

That implies a lot of trust in the host side, don't you think?

Worse case, make the delay a minute or so, but give the system a way out
incase there's a bug in the host.  As there will be bugs in the host,
just like there are bugs in the client :)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/2] Staging: unisys: visorbus: style fix, using octal file permissions

2017-01-06 Thread Greg KH
On Sat, Jan 07, 2017 at 04:48:01PM +1300, Derek Robson wrote:
> Two files change in style fix, changes are octal file permissions.
> 
> Derek Robson (2):
>   Staging: unisys: visorbus: style fix, using octal file permissions
>   Staging: unisys: visorbus: style fix, using octal file permissions

You can't send different patches that do different things with identical
subject lines, as that doesn't make sense, right?

Please resend making these subject unique, and add David's ack to them
as well on the resend.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel