cron job: media_tree daily build: WARNINGS

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

Results of the daily build of media_tree:

date:   Mon Nov 27 05:00:15 CET 2017
media-tree git hash:30b4e122d71cbec2944a5f8b558b88936ee42f10
media_build git hash:   097aaf3e4e4bfdeff130db9697dec1befeb3221b
v4l-utils git hash: a8a04d397e929381a2150bee2100fc28ad2cfbec
gcc version:i686-linux-gcc (GCC) 7.1.0
sparse version: 0.5.1 (Debian: 0.5.1-2)
smatch version: v0.5.0-3553-g78b2ea6
host hardware:  x86_64
host os:4.13.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-arm-stm32: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: WARNINGS
linux-3.12.67-i686: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0.9-i686: WARNINGS
linux-4.1.33-i686: WARNINGS
linux-4.2.8-i686: WARNINGS
linux-4.3.6-i686: WARNINGS
linux-4.4.22-i686: WARNINGS
linux-4.5.7-i686: WARNINGS
linux-4.6.7-i686: WARNINGS
linux-4.7.5-i686: WARNINGS
linux-4.8-i686: OK
linux-4.9.26-i686: OK
linux-4.10.14-i686: OK
linux-4.11-i686: OK
linux-4.12.1-i686: OK
linux-4.13-i686: OK
linux-4.14-i686: OK
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: WARNINGS
linux-3.12.67-x86_64: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.7-x86_64: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.7-x86_64: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0.9-x86_64: WARNINGS
linux-4.1.33-x86_64: WARNINGS
linux-4.2.8-x86_64: WARNINGS
linux-4.3.6-x86_64: WARNINGS
linux-4.4.22-x86_64: WARNINGS
linux-4.5.7-x86_64: WARNINGS
linux-4.6.7-x86_64: WARNINGS
linux-4.7.5-x86_64: WARNINGS
linux-4.8-x86_64: WARNINGS
linux-4.9.26-x86_64: WARNINGS
linux-4.10.14-x86_64: WARNINGS
linux-4.11-x86_64: WARNINGS
linux-4.12.1-x86_64: WARNINGS
linux-4.13-x86_64: OK
linux-4.14-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


Re: camss: camera controls missing on vfe interfaces

2017-11-26 Thread Daniel Mack
Hi Todor, everyone,

On Monday, November 20, 2017 11:59 AM, Daniel Mack wrote:
> On Monday, November 20, 2017 09:32 AM, Todor Tomov wrote:
>> It is not a missing feature, it is more of a missing userspace 
>> implementation.
>> When working with a media oriented device driver, the userspace has to
>> config the media pipeline too and if controls are exposed by the subdev 
>> nodes,
>> the userspace has to configure them on the subdev nodes.
>>
>> As there weren't a lot of media oriented drivers there is no generic
>> implementation/support for this in the userspace (at least I'm not aware of
>> any). There have been discussions about adding such functionality in libv4l
>> so that applications which do not support media configuration can still
>> use these drivers. I'm not sure if decision for this was taken or not or
>> is it just that there was noone to actually do the work. Probably Laurent,
>> Mauro or Hans know more about what were the plans for this.
> 
> Hmm, that's not good.
> 
> Considering the use-case in our application, the pipeline is set up once
> and considered more or less static, and then applications such as the
> Chrome browsers make use of the high-level VFE interface. If there are
> no controls exposed on that interface, they are not available to the
> application. Patching all userspace applications is an uphill battle
> that can't be won I'm afraid.
> 
> Is there any good reason not to expose the sensor controls on the VFE? I
> guess it would be easy to do, right?

Do you see an alternative to implementing the above in order to support
existing v4l-enabled applications?


Thanks,
Daniel


Re: [PATCH v2 06/11] dt-bindings: Document the Rockchip MIPI RX D-PHY bindings

2017-11-26 Thread Rob Herring
On Fri, Nov 24, 2017 at 10:37:01AM +0800, Jacob Chen wrote:
> Add DT bindings documentation for Rockchip MIPI D-PHY RX
> 
> Signed-off-by: Jacob Chen 
> ---
>  .../bindings/media/rockchip-mipi-dphy.txt  | 77 
> ++
>  1 file changed, 77 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/media/rockchip-mipi-dphy.txt

Same comments apply to this one.


Re: [PATCH v2 05/11] dt-bindings: Document the Rockchip ISP1 bindings

2017-11-26 Thread Rob Herring
On Fri, Nov 24, 2017 at 10:37:00AM +0800, Jacob Chen wrote:
> From: Jacob Chen 
> 
> Add DT bindings documentation for Rockchip ISP1
> 
> Signed-off-by: Jacob Chen 
> ---
>  .../devicetree/bindings/media/rockchip-isp1.txt| 61 
> ++
>  1 file changed, 61 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/rockchip-isp1.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/rockchip-isp1.txt 
> b/Documentation/devicetree/bindings/media/rockchip-isp1.txt
> new file mode 100644
> index ..5e5b72edcf81
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/rockchip-isp1.txt
> @@ -0,0 +1,61 @@
> +Rockchip SoC Image Signal Processing unit v1
> +--
> +
> +Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs
> +which contains image processing, scaling, and compression funcitons.
> +
> +Currently device tree nodes for the Rockchip ISP1 driver includes:

Bindings describe the h/w, not drivers.

> +MIPI D-PHY, ISP.
> +
> +Required properties:
> +  - compatible: value should be one of the following
> +  "rockchip,rk3288-cif-isp";
> +  "rockchip,rk3399-cif-isp";
> +  - reg : offset and length of the register set for the device.
> +  - interrupts: should contain ISP interrupt.
> +  - clocks: phandle to the required clocks.
> +  - clock-names: required clock name.
> +  - iommus: required a iommu node.
> +
> +The device node should contain one 'port' child node with child 'endpoint'
> +nodes, according to the bindings defined in 
> Documentation/devicetree/bindings/
> +media/video-interfaces.txt.

You need to enumerate the endpoints (mipi and parallel), too.
 
> +
> +Example:
> +SoC-specific DT entry:
> + isp0: isp0@ff91 {
> + compatible = "rockchip,rk3399-cif-isp";
> + reg = <0x0 0xff91 0x0 0x4000>;
> + interrupts = ;
> + clocks = < SCLK_ISP0>,
> +  < ACLK_ISP0>, < ACLK_ISP0_WRAPPER>,
> +  < HCLK_ISP0>, < HCLK_ISP0_WRAPPER>;
> + clock-names = "clk_isp",
> +   "aclk_isp", "aclk_isp_wrap",
> +   "hclk_isp", "hclk_isp_wrap";
> + power-domains = < RK3399_PD_ISP0>;
> + iommus = <_mmu>;
> + status = "disabled";
> + };
> +
> +Board-specific:

Just show the complete example. The SoC and board split is purely source 
level convention.

> + isp0: isp0@ff91 {
> + port {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + /* mipi */
> + isp0_mipi_in: endpoint@0 {
> + reg = <0>;
> + remote-endpoint = <_rx0_out>;
> + };
> +
> + /* parallel */
> + isp0_parallel_in: endpoint@1 {
> + reg = <1>;
> + remote-endpoint = <_out>;
> + };
> + };
> + };
> +
> +The MIPI-DPHY device binding is defined in rockchip-mipi-dphy.txt.
> -- 
> 2.15.0
> 


[PATCH] staging/media: lirc: style fix - replace hard-coded function names

2017-11-26 Thread Martin Homuth
This patch fixes the remaining coding style warnings in the lirc module.

It fixes the following checkpatch.pl warning:

WARNING: Prefer using '"%s...", __func__' to using 'read', this
function's name, in a string
>From f11f24667ba6696cb71ac33a67fc0c7d3b4cd542 Mon Sep 17 00:00:00 2001
From: Martin Homuth 
Date: Sun, 26 Nov 2017 20:14:33 +0100
Subject: [PATCH] lirc: style fix - replace hard-coded function names

Instead of hard coding the function name the __func__ variable
should be used.

Signed-off-by: Martin Homuth 
---
 drivers/staging/media/lirc/lirc_zilog.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c
index 6bd0717bf76e..be68ee652071 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -888,9 +888,9 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
 	unsigned int m;
 	DECLARE_WAITQUEUE(wait, current);
 
-	dev_dbg(ir->dev, "read called\n");
+	dev_dbg(ir->dev, "%s called\n", __func__);
 	if (n % rbuf->chunk_size) {
-		dev_dbg(ir->dev, "read result = -EINVAL\n");
+		dev_dbg(ir->dev, "%s result = -EINVAL\n", __func__);
 		return -EINVAL;
 	}
 
@@ -949,7 +949,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
 retries++;
 			}
 			if (retries >= 5) {
-dev_err(ir->dev, "Buffer read failed!\n");
+dev_err(ir->dev, "%s failed!\n", __func__);
 ret = -EIO;
 			}
 		}
@@ -959,7 +959,7 @@ static ssize_t read(struct file *filep, char __user *outbuf, size_t n,
 	put_ir_rx(rx, false);
 	set_current_state(TASK_RUNNING);
 
-	dev_dbg(ir->dev, "read result = %d (%s)\n", ret,
+	dev_dbg(ir->dev, "%s result = %d (%s)\n", __func__, ret,
 		ret ? "Error" : "OK");
 
 	return ret ? ret : written;
-- 
2.13.6



Re: Adjustments for a lot of function implementations

2017-11-26 Thread SF Markus Elfring
> ??? I did that: either one patch per directory with the same type of change,
> or one patch per driver combining all the changes for that driver.

Would you like to answer my still remaining questions in any more
constructive ways?

Regards,
Markus


Re: [PATCH v2 04/11] media: rkisp1: add Rockchip MIPI Synopsys DPHY driver

2017-11-26 Thread kbuild test robot
Hi Jacob,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20171124]
[cannot apply to rockchip/for-next v4.14]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Jacob-Chen/Rockchip-ISP1-Driver/20171126-224713
base:   git://linuxtv.org/media_tree.git master
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:634:66: error: expected 
identifier or '(' before '=' token
struct v4l2_async_notifier_operationsrockchip_mipidphy_async_ops = {
 ^
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c: In function 
'rockchip_mipidphy_media_init':
>> drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:707:24: error: 
>> 'rockchip_mipidphy_async_ops' undeclared (first use in this function); did 
>> you mean 'rockchip_mipidphy_match_id'?
 priv->notifier.ops = _mipidphy_async_ops;
   ^~~
   rockchip_mipidphy_match_id
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:707:24: note: each 
undeclared identifier is reported only once for each function it appears in
   At top level:
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:593:1: warning: 
'rockchip_mipidphy_notifier_complete' defined but not used [-Wunused-function]
rockchip_mipidphy_notifier_complete(struct v4l2_async_notifier *notifier)
^~~
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:579:1: warning: 
'rockchip_mipidphy_notifier_unbind' defined but not used [-Wunused-function]
rockchip_mipidphy_notifier_unbind(struct v4l2_async_notifier *notifier,
^
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:555:1: warning: 
'rockchip_mipidphy_notifier_bound' defined but not used [-Wunused-function]
rockchip_mipidphy_notifier_bound(struct v4l2_async_notifier *notifier,
^~~~

vim +707 drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c

   632  
   633  static const
 > 634  struct v4l2_async_notifier_operationsrockchip_mipidphy_async_ops = {
   635  .bound = rockchip_mipidphy_notifier_bound,
   636  .unbind = rockchip_mipidphy_notifier_unbind,
   637  .complete = rockchip_mipidphy_notifier_complete,
   638  };
   639  
   640  static int rockchip_mipidphy_fwnode_parse(struct device *dev,
   641   struct v4l2_fwnode_endpoint *vep,
   642   struct v4l2_async_subdev *asd)
   643  {
   644  struct sensor_async_subdev *s_asd =
   645  container_of(asd, struct sensor_async_subdev, 
asd);
   646  struct v4l2_mbus_config *config = _asd->mbus;
   647  
   648  if (vep->bus_type != V4L2_MBUS_CSI2) {
   649  dev_err(dev, "Only CSI2 bus type is currently 
supported\n");
   650  return -EINVAL;
   651  }
   652  
   653  if (vep->base.port != 0) {
   654  dev_err(dev, "The PHY has only port 0\n");
   655  return -EINVAL;
   656  }
   657  
   658  config->type = V4L2_MBUS_CSI2;
   659  config->flags = vep->bus.mipi_csi2.flags;
   660  s_asd->lanes = vep->bus.mipi_csi2.num_data_lanes;
   661  
   662  switch (vep->bus.mipi_csi2.num_data_lanes) {
   663  case 1:
   664  config->flags |= V4L2_MBUS_CSI2_1_LANE;
   665  break;
   666  case 2:
   667  config->flags |= V4L2_MBUS_CSI2_2_LANE;
   668  break;
   669  case 3:
   670  config->flags |= V4L2_MBUS_CSI2_3_LANE;
   671  break;
   672  case 4:
   673  config->flags |= V4L2_MBUS_CSI2_4_LANE;
   674  break;
   675  default:
   676  return -EINVAL;
   677  }
   678  
   679  return 0;
   680  }
   681  
   682  static int rockchip_mipidphy_media_init(struct mipidphy_priv *priv)
   683  {
   684  int ret;
   685  
   686  priv->pads[MIPI_DPHY_SY_PAD_SOURCE].flags =
   687  MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT;
   688  priv->pads[MIPI_DPHY_SY_PAD_SINK].flags =
   689  MEDIA_PAD_FL_SINK | MEDI

Re: [PATCH v2 03/11] media: rkisp1: add rockchip isp1 driver

2017-11-26 Thread kbuild test robot
Hi Jacob,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20171124]
[cannot apply to rockchip/for-next v4.14]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Jacob-Chen/Rockchip-ISP1-Driver/20171126-224713
base:   git://linuxtv.org/media_tree.git master
config: mips-allmodconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=mips 

All error/warnings (new ones prefixed by >>):

   drivers/media//platform/rockchip/isp1/rkisp1.c: In function 
'rkisp1_isp_sd_s_stream':
>> drivers/media//platform/rockchip/isp1/rkisp1.c:136:6: warning: 'isp_ctrl' 
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
 u32 isp_ctrl;
 ^~~~
>> drivers/media//platform/rockchip/isp1/rkisp1.c:209:2: warning: 'acq_mult' 
>> may be used uninitialized in this function [-Wmaybe-uninitialized]
 writel(acq_mult * in_frm->width, base + CIF_ISP_ACQ_H_SIZE);
 ^~~
   drivers/media//platform/rockchip/isp1/rkisp1.c:139:6: note: 'acq_mult' was 
declared here
 u32 acq_mult;
 ^~~~
--
   drivers/media//platform/rockchip/isp1/dev.c: In function 
'rkisp1_runtime_suspend':
   drivers/media//platform/rockchip/isp1/dev.c:597:9: error: implicit 
declaration of function 'pinctrl_pm_select_sleep_state' 
[-Werror=implicit-function-declaration]
 return pinctrl_pm_select_sleep_state(dev);
^
   drivers/media//platform/rockchip/isp1/dev.c: In function 
'rkisp1_runtime_resume':
>> drivers/media//platform/rockchip/isp1/dev.c:605:8: error: implicit 
>> declaration of function 'pinctrl_pm_select_default_state'; did you mean 
>> 'irq_set_default_host'? [-Werror=implicit-function-declaration]
 ret = pinctrl_pm_select_default_state(dev);
   ^~~
   irq_set_default_host
   cc1: some warnings being treated as errors
--
>> drivers/media//platform/rockchip/isp1/isp_params.c:1350:3: error: 'const 
>> struct v4l2_ioctl_ops' has no member named 'vidioc_enum_fmt_meta_out'; did 
>> you mean 'vidioc_enum_fmt_meta_cap'?
 .vidioc_enum_fmt_meta_out = rkisp1_params_enum_fmt_meta_out,
  ^~~~
  vidioc_enum_fmt_meta_cap
   drivers/media//platform/rockchip/isp1/isp_params.c:1350:30: error: 
initialization from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 .vidioc_enum_fmt_meta_out = rkisp1_params_enum_fmt_meta_out,
 ^~~
   drivers/media//platform/rockchip/isp1/isp_params.c:1350:30: note: (near 
initialization for 'rkisp1_params_ioctl.vidioc_g_std')
>> drivers/media//platform/rockchip/isp1/isp_params.c:1351:3: error: 'const 
>> struct v4l2_ioctl_ops' has no member named 'vidioc_g_fmt_meta_out'; did you 
>> mean 'vidioc_g_fmt_meta_cap'?
 .vidioc_g_fmt_meta_out = rkisp1_params_g_fmt_meta_out,
  ^
  vidioc_g_fmt_meta_cap
   drivers/media//platform/rockchip/isp1/isp_params.c:1351:27: error: 
initialization from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 .vidioc_g_fmt_meta_out = rkisp1_params_g_fmt_meta_out,
  ^~~~
   drivers/media//platform/rockchip/isp1/isp_params.c:1351:27: note: (near 
initialization for 'rkisp1_params_ioctl.vidioc_s_std')
>> drivers/media//platform/rockchip/isp1/isp_params.c:1352:3: error: 'const 
>> struct v4l2_ioctl_ops' has no member named 'vidioc_s_fmt_meta_out'; did you 
>> mean 'vidioc_s_fmt_meta_cap'?
 .vidioc_s_fmt_meta_out = rkisp1_params_g_fmt_meta_out,
  ^
  vidioc_s_fmt_meta_cap
   drivers/media//platform/rockchip/isp1/isp_params.c:1352:27: error: 
initialization from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 .vidioc_s_fmt_meta_out = rkisp1_params_g_fmt_meta_out,
  ^~~~
   drivers/media//platform/rockchip/isp1/isp_params.c:1352:27: note: (near 
initialization for 'rkisp1_params_ioctl.vidioc_querystd')
>> drivers/media//platform/rockchip/isp1/isp_params.c:1353:3: error: 'const 
>> struct v4l2_ioctl_ops' has no member named 'vidioc_try_fmt_meta_out'; did 
>> you mean 'vidioc_try_fmt_meta_cap'?
 .vidioc_try_fmt_meta_out = rkisp1_params_g_fmt_meta_out,
  ^~~
  vidioc_try_fmt_meta_cap
   drivers/media//platform/roc

Re: [PATCH] [media] ddbridge: add IOCTLs

2017-11-26 Thread Daniel Scheller
Am Tue, 22 Aug 2017 17:21:16 +0200
schrieb Daniel Scheller :

> Am Tue, 22 Aug 2017 16:05:21 +0200
> schrieb Ralph Metzler :
> 
> > Daniel Scheller writes:  
> >  > Am Sun, 20 Aug 2017 08:53:56 -0300
> >  > schrieb Mauro Carvalho Chehab :
> >  > 
> >  > > Em Sun, 20 Aug 2017 13:08:55 +0200
> >  > > Daniel Scheller  escreveu:
> >  > > 
> >  > > > From: Daniel Scheller 
> >  > > > 
> >  > > > This patch adds back the IOCTL API/functionality which is
> >  > > > present in the upstream dddvb driver package. In comparison,
> >  > > > the IOCTL handler has been factored to a separate object (and
> >  > > > with that, some functionality from -core has been moved there
> >  > > > aswell), the IOCTLs are defined in an include in the uAPI,
> >  > > > and ioctl-number.txt is updated to document that there are
> >  > > > IOCTLs present in this driver.
> >  > > > 
> >  > > > Signed-off-by: Daniel Scheller 
> >  > > > ---
> >  > > > This patch depends on the ddbridge-0.9.29 bump, see [1]. The
> >  > > > functionality was part of the driver before.
> >  > > > 
> >  > > > [1] http://www.spinics.net/lists/linux-media/msg119911.html
> >  > > > 
> >  > > >  Documentation/ioctl/ioctl-number.txt|   1 +
> >  > > >  MAINTAINERS |   1 +
> >  > > >  drivers/media/pci/ddbridge/Makefile |   2 +-
> >  > > >  drivers/media/pci/ddbridge/ddbridge-core.c  | 111 +
> >  > > >  drivers/media/pci/ddbridge/ddbridge-ioctl.c | 334
> >  > > > 
> >  > > > drivers/media/pci/ddbridge/ddbridge-ioctl.h |  32 +++
> >  > > > include/uapi/linux/ddbridge-ioctl.h | 110 + 7
> >  > > > files changed, 481 insertions(+), 110 deletions(-) create
> >  > > > mode 100644 drivers/media/pci/ddbridge/ddbridge-ioctl.c
> >  > > > create mode 100644
> >  > > > drivers/media/pci/ddbridge/ddbridge-ioctl.h create mode
> >  > > > 100644 include/uapi/linux/ddbridge-ioctl.h
> >  > > > 
> >  > > > diff --git a/Documentation/ioctl/ioctl-number.txt
> >  > > > b/Documentation/ioctl/ioctl-number.txt index
> >  > > > 3e3fdae5f3ed..d78d1cd092d2 100644 ---
> >  > > > a/Documentation/ioctl/ioctl-number.txt +++
> >  > > > b/Documentation/ioctl/ioctl-number.txt @@ -215,6 +215,7 @@
> >  > > > Code Seq#(hex)   Include FileComments
> >  > > > 'c' A0-AF   arch/x86/include/asm/msr.h   conflict! 'd'
> >  > > > 00-FFlinux/char/drm/drm.hconflict! 'd'
> >  > > > 02-40pcmcia/ds.h conflict! +'d'
> >  > > > 00-0Blinux/ddbridge-ioctl.h  conflict!  
> >  > > 
> >  > > That's where the problem with this patch starts: we don't add
> >  > > conflicts here :-)
> >  > > 
> >  > > We need more discussions with regards to the features added by
> >  > > this patchset.
> >  > 
> >  > Understood. The "good" thing is that this isn't a requirement to
> >  > drive any tuner boards (at the moment), however we shouldn't lose
> >  > track on this. Since this is the only complaint for now:
> >  > 
> >  > - We need to clear with Ralph if changing the MAGIC to something
> >  >   different is an option. In the end, if we change the userspace
> >  > apps to include the uAPI header from mainline if available (else
> >  > fallback to what ie. dddvb carries), I don't see an issue with
> >  > this. But if userspace apps keep on using private stuff, this
> >  > will break ofc.
> >  > - Other option: Fork dddvb and change userspace apps accordingly,
> >  > and keep them in sync with upstream. Since we already have to
> >  > care about the kernel part, this option is rather suboptimal.
> >  > 
> >  > Ralph, Ping :-)
> > 
> > Changing to something different from 'd' should be fine.
> > Is there anything still free?  
> 
> We could use 0xDD (for *D*igital *D*evices :-) ), subrange 0xc0-0xff
> or so, that isn't declared "in use" in ioctl-number.txt
> (0xDD/0x00-0x3f is used by some ZFCP driver). Other options would be
> ie. 0xD0-0xDA, 0xDC, 0xDE-0xE4. There are also other single values
> and value-ranges free, all according to ioctl-number.txt ofcourse.
> 
> Still yet not sure if this is everything that needs changing to be
> accepted though.

Ping.

Mauro, is there anything else you want to discuss or even want
changed besides the conflicting MAGIC? I'd like to get this stuff in so
we have everything from the original driver update patches in mainline
(and get this whole thing done, even).

Best regards,
Daniel Scheller
-- 
https://github.com/herrnst


Re: [PATCH] media: dvb_frontend: dvb_unregister_frontend must not call dvb_detach for fe->ops.release

2017-11-26 Thread Daniel Scheller
Am Fri, 24 Nov 2017 15:02:30 +0100
schrieb Wolfgang Rohdewald :

> because ops.release was never dvb_attached.
> Which makes sense because f->ops.release does not attach anything.
> 
> Now, rmmod dvb_usb_pctv452e correctly sets counters for
> stb6100/stb0899 to 0.
> 
> Before, stb0899 got a counter -1, and for my 4 receivers I got 3
> OOPses like
> 
> Nov 24 14:40:41 s5 kernel: [  194.211014] WARNING: CPU: 6 PID: 3055 at
>module_put.part.45+0x132/0x1a0
> Call Trace:
>  ? _stb0899_read_reg+0x100/0x100 [stb0899]
>  ? _stb0899_read_reg+0x100/0x100 [stb0899]
>  symbol_put_addr+0x38/0x60
>  dvb_frontend_put+0x42/0x60 [dvb_core]
>  ? stb0899_sleep+0x50/0x50 [stb0899]
>  dvb_frontend_detach+0x7c/0x90 [dvb_core]
>  dvb_usb_adapter_frontend_exit+0x57/0x80 [dvb_usb]
>  dvb_usb_exit+0x39/0xb0 [dvb_usb]
>  dvb_usb_device_exit+0x3f/0x60 [dvb_usb]
>  pctv452e_usb_disconnect+0x6f/0x80 [dvb_usb_pctv452e]
>  usb_unbind_interface+0x75/0x290
>  ? _raw_spin_unlock_irqrestore+0x4a/0x80
>  device_release_driver_internal+0x160/0x210
>  driver_detach+0x40/0x80
>  bus_remove_driver+0x5c/0xd0
>  driver_unregister+0x2c/0x40
>  usb_deregister+0x6c/0xf0
>  pctv452e_usb_driver_exit+0x10/0xec0 [dvb_usb_pctv452e]
> 
> Signed-off-by: Wolfgang Rohdewald 
> ---
>  drivers/media/dvb-core/dvb_frontend.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/dvb-core/dvb_frontend.c
> b/drivers/media/dvb-core/dvb_frontend.c index
> 9139d01ba7ed..c2cc794299c9 100644 ---
> a/drivers/media/dvb-core/dvb_frontend.c +++
> b/drivers/media/dvb-core/dvb_frontend.c @@ -150,7 +150,8 @@ static
> void __dvb_frontend_free(struct dvb_frontend *fe) 
>   dvb_free_device(fepriv->dvbdev);
>  
> - dvb_frontend_invoke_release(fe, fe->ops.release);
> + if (fe->ops.release)
> + fe->ops.release(fe);
>  
>   kfree(fepriv);
>   fe->frontend_priv = NULL;

FWIW, this patch breaks unloading for all DVB cards in my dev system,
in that attached drivers like demod and tuner drivers won't usecount
to zero anymore ("rmmod ddbridge" keeps the usecount of stv0367 and
cxd2841er up, and "rmmod budget_av" doesn't usecount the tda10023 back
to zero).

Best regards,
Daniel Scheller
-- 
https://github.com/herrnst


Re: [PATCH v2 04/11] media: rkisp1: add Rockchip MIPI Synopsys DPHY driver

2017-11-26 Thread kbuild test robot
Hi Jacob,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20171124]
[cannot apply to rockchip/for-next v4.14]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Jacob-Chen/Rockchip-ISP1-Driver/20171126-224713
base:   git://linuxtv.org/media_tree.git master
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin 

All errors (new ones prefixed by >>):

>> drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:634:66: error: expected 
>> identifier or '(' before '=' token
struct v4l2_async_notifier_operationsrockchip_mipidphy_async_ops = {
 ^
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c: In function 
'rockchip_mipidphy_media_init':
>> drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:707:24: error: 
>> 'rockchip_mipidphy_async_ops' undeclared (first use in this function)
 priv->notifier.ops = _mipidphy_async_ops;
   ^~~
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:707:24: note: each 
undeclared identifier is reported only once for each function it appears in
   At top level:
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:593:1: warning: 
'rockchip_mipidphy_notifier_complete' defined but not used [-Wunused-function]
rockchip_mipidphy_notifier_complete(struct v4l2_async_notifier *notifier)
^~~
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:579:1: warning: 
'rockchip_mipidphy_notifier_unbind' defined but not used [-Wunused-function]
rockchip_mipidphy_notifier_unbind(struct v4l2_async_notifier *notifier,
^
   drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c:555:1: warning: 
'rockchip_mipidphy_notifier_bound' defined but not used [-Wunused-function]
rockchip_mipidphy_notifier_bound(struct v4l2_async_notifier *notifier,
^~~~

vim +634 drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c

   632  
   633  static const
 > 634  struct v4l2_async_notifier_operationsrockchip_mipidphy_async_ops = {
   635  .bound = rockchip_mipidphy_notifier_bound,
   636  .unbind = rockchip_mipidphy_notifier_unbind,
   637  .complete = rockchip_mipidphy_notifier_complete,
   638  };
   639  
   640  static int rockchip_mipidphy_fwnode_parse(struct device *dev,
   641   struct v4l2_fwnode_endpoint *vep,
   642   struct v4l2_async_subdev *asd)
   643  {
   644  struct sensor_async_subdev *s_asd =
   645  container_of(asd, struct sensor_async_subdev, 
asd);
   646  struct v4l2_mbus_config *config = _asd->mbus;
   647  
   648  if (vep->bus_type != V4L2_MBUS_CSI2) {
   649  dev_err(dev, "Only CSI2 bus type is currently 
supported\n");
   650  return -EINVAL;
   651  }
   652  
   653  if (vep->base.port != 0) {
   654  dev_err(dev, "The PHY has only port 0\n");
   655  return -EINVAL;
   656  }
   657  
   658  config->type = V4L2_MBUS_CSI2;
   659  config->flags = vep->bus.mipi_csi2.flags;
   660  s_asd->lanes = vep->bus.mipi_csi2.num_data_lanes;
   661  
   662  switch (vep->bus.mipi_csi2.num_data_lanes) {
   663  case 1:
   664  config->flags |= V4L2_MBUS_CSI2_1_LANE;
   665  break;
   666  case 2:
   667  config->flags |= V4L2_MBUS_CSI2_2_LANE;
   668  break;
   669  case 3:
   670  config->flags |= V4L2_MBUS_CSI2_3_LANE;
   671  break;
   672  case 4:
   673  config->flags |= V4L2_MBUS_CSI2_4_LANE;
   674  break;
   675  default:
   676  return -EINVAL;
   677  }
   678  
   679  return 0;
   680  }
   681  
   682  static int rockchip_mipidphy_media_init(struct mipidphy_priv *priv)
   683  {
   684  int ret;
   685  
   686  priv->pads[MIPI_DPHY_SY_PAD_SOURCE].flags =
   687  MEDIA_PAD_FL_SOURCE | MEDIA_PAD_FL_MUST_CONNECT;
   688  priv->pads[MIPI_DPHY_SY_PAD_SINK].flags =
   689  MEDIA_PAD_FL_SINK | MEDIA_PAD_FL_MUST_CONNECT;
   690  
   691  ret = media_entity_pads_init(>sd.entity,
   692  

[PATCH 3/7] [media] dvb-frontends/stv6111: handle gate_ctrl errors

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

When a parent (demod) driver encounters and signals a problem with
gate_ctrl(), don't blindly continue poking the I2C bus.

Signed-off-by: Daniel Scheller 
Tested-by: Richard Scobie 
---
 drivers/media/dvb-frontends/stv6111.c | 44 +--
 1 file changed, 27 insertions(+), 17 deletions(-)

diff --git a/drivers/media/dvb-frontends/stv6111.c 
b/drivers/media/dvb-frontends/stv6111.c
index e3e90070e293..789f7b61e628 100644
--- a/drivers/media/dvb-frontends/stv6111.c
+++ b/drivers/media/dvb-frontends/stv6111.c
@@ -424,6 +424,7 @@ static int set_bandwidth(struct dvb_frontend *fe, u32 
cutoff_frequency)
 {
struct stv *state = fe->tuner_priv;
u32 index = (cutoff_frequency + 99) / 100;
+   int stat = 0;
 
if (index < 6)
index = 6;
@@ -435,12 +436,14 @@ static int set_bandwidth(struct dvb_frontend *fe, u32 
cutoff_frequency)
state->reg[0x08] = (state->reg[0x08] & ~0xFC) | ((index - 6) << 2);
state->reg[0x09] = (state->reg[0x09] & ~0x0C) | 0x08;
if (fe->ops.i2c_gate_ctrl)
-   fe->ops.i2c_gate_ctrl(fe, 1);
-   write_regs(state, 0x08, 2);
-   wait_for_call_done(state, 0x08);
-   if (fe->ops.i2c_gate_ctrl)
+   stat = fe->ops.i2c_gate_ctrl(fe, 1);
+   if (!stat) {
+   write_regs(state, 0x08, 2);
+   wait_for_call_done(state, 0x08);
+   }
+   if (fe->ops.i2c_gate_ctrl && !stat)
fe->ops.i2c_gate_ctrl(fe, 0);
-   return 0;
+   return stat;
 }
 
 static int set_lof(struct stv *state, u32 local_frequency, u32 
cutoff_frequency)
@@ -518,6 +521,7 @@ static int set_params(struct dvb_frontend *fe)
struct stv *state = fe->tuner_priv;
struct dtv_frontend_properties *p = >dtv_property_cache;
u32 freq, cutoff;
+   int stat = 0;
 
if (p->delivery_system != SYS_DVBS && p->delivery_system != SYS_DVBS2)
return -EINVAL;
@@ -526,9 +530,10 @@ static int set_params(struct dvb_frontend *fe)
cutoff = 500 + muldiv32(p->symbol_rate, 135, 200);
 
if (fe->ops.i2c_gate_ctrl)
-   fe->ops.i2c_gate_ctrl(fe, 1);
-   set_lof(state, freq, cutoff);
-   if (fe->ops.i2c_gate_ctrl)
+   stat = fe->ops.i2c_gate_ctrl(fe, 1);
+   if (!stat)
+   set_lof(state, freq, cutoff);
+   if (fe->ops.i2c_gate_ctrl && !stat)
fe->ops.i2c_gate_ctrl(fe, 0);
return 0;
 }
@@ -575,14 +580,17 @@ static int get_rf_strength(struct dvb_frontend *fe, u16 
*st)
if ((state->reg[0x03] & 0x60) == 0) {
/* RF Mode, Read AGC ADC */
u8 reg = 0;
+   int stat = 0;
 
if (fe->ops.i2c_gate_ctrl)
-   fe->ops.i2c_gate_ctrl(fe, 1);
-   write_reg(state, 0x02, state->reg[0x02] | 0x20);
-   read_reg(state, 2, );
-   if (reg & 0x20)
+   stat = fe->ops.i2c_gate_ctrl(fe, 1);
+   if (!stat) {
+   write_reg(state, 0x02, state->reg[0x02] | 0x20);
read_reg(state, 2, );
-   if (fe->ops.i2c_gate_ctrl)
+   if (reg & 0x20)
+   read_reg(state, 2, );
+   }
+   if (fe->ops.i2c_gate_ctrl && !stat)
fe->ops.i2c_gate_ctrl(fe, 0);
 
if ((state->reg[0x02] & 0x80) == 0)
@@ -652,7 +660,8 @@ struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe,
struct i2c_adapter *i2c, u8 adr)
 {
struct stv *state;
-   int stat;
+   int stat = -ENODEV;
+   int gatestat = 0;
 
state = kzalloc(sizeof(*state), GFP_KERNEL);
if (!state)
@@ -663,9 +672,10 @@ struct dvb_frontend *stv6111_attach(struct dvb_frontend 
*fe,
init_state(state);
 
if (fe->ops.i2c_gate_ctrl)
-   fe->ops.i2c_gate_ctrl(fe, 1);
-   stat = attach_init(state);
-   if (fe->ops.i2c_gate_ctrl)
+   gatestat = fe->ops.i2c_gate_ctrl(fe, 1);
+   if (!gatestat)
+   stat = attach_init(state);
+   if (fe->ops.i2c_gate_ctrl && !gatestat)
fe->ops.i2c_gate_ctrl(fe, 0);
if (stat < 0) {
kfree(state);
-- 
2.13.6



[PATCH 4/7] [media] dvb-frontends/stv0910: remove unneeded check/call to get_if_freq

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

The result (if any) isn't used anywhere besides being assigned to a local
variable (and the only current companion stv6111 doesn't even implement
get_if_frequency()), thus remove the ptr check and the call, and also
remove the now unused iffreq variable.

Reported-by: Richard Scobie 
Cc: Ralph Metzler 
Signed-off-by: Daniel Scheller 
Tested-by: Richard Scobie 
---
 drivers/media/dvb-frontends/stv0910.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/stv0910.c 
b/drivers/media/dvb-frontends/stv0910.c
index cd247ab9c62d..074374fe00be 100644
--- a/drivers/media/dvb-frontends/stv0910.c
+++ b/drivers/media/dvb-frontends/stv0910.c
@@ -1273,14 +1273,11 @@ static int set_parameters(struct dvb_frontend *fe)
 {
int stat = 0;
struct stv *state = fe->demodulator_priv;
-   u32 iffreq;
struct dtv_frontend_properties *p = >dtv_property_cache;
 
stop(state);
if (fe->ops.tuner_ops.set_params)
fe->ops.tuner_ops.set_params(fe);
-   if (fe->ops.tuner_ops.get_if_frequency)
-   fe->ops.tuner_ops.get_if_frequency(fe, );
state->symbol_rate = p->symbol_rate;
stat = start(state, p);
return stat;
-- 
2.13.6



[PATCH 5/7] [media] dvb-frontends/stv0910: read symbolrate in get_frontend()

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

Utilise get_cur_symbol_rate() in get_frontend() to update the
dtv_frontend_properties with the current symbol rate as reported by the
demodulator.

Reported-by: Richard Scobie 
Cc: Ralph Metzler 
Signed-off-by: Daniel Scheller 
Tested-by: Richard Scobie 
---
 drivers/media/dvb-frontends/stv0910.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/dvb-frontends/stv0910.c 
b/drivers/media/dvb-frontends/stv0910.c
index 074374fe00be..e9517e11b399 100644
--- a/drivers/media/dvb-frontends/stv0910.c
+++ b/drivers/media/dvb-frontends/stv0910.c
@@ -1526,6 +1526,7 @@ static int get_frontend(struct dvb_frontend *fe,
 {
struct stv *state = fe->demodulator_priv;
u8 tmp;
+   u32 symbolrate;
 
if (state->receive_mode == RCVMODE_DVBS2) {
u32 mc;
@@ -1579,6 +1580,10 @@ static int get_frontend(struct dvb_frontend *fe,
p->rolloff = ROLLOFF_35;
}
 
+   if (state->receive_mode != RCVMODE_NONE) {
+   get_cur_symbol_rate(state, );
+   p->symbol_rate = symbolrate;
+   }
return 0;
 }
 
-- 
2.13.6



[PATCH 7/7] [media] dvb-frontends/stv0910: remove unneeded dvb_math.h include

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

Since nothing from dvb_math.h is used, remove the unneeded include.

Signed-off-by: Daniel Scheller 
---
 drivers/media/dvb-frontends/stv0910.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/stv0910.c 
b/drivers/media/dvb-frontends/stv0910.c
index de8702fcffbd..618d70683559 100644
--- a/drivers/media/dvb-frontends/stv0910.c
+++ b/drivers/media/dvb-frontends/stv0910.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 
-#include "dvb_math.h"
 #include "dvb_frontend.h"
 #include "stv0910.h"
 #include "stv0910_regs.h"
-- 
2.13.6



[PATCH 6/7] [media] dvb-frontends/stv0910: remove unneeded symbol rate inquiry

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

tracking_optimization() doesn't make use of the symbol rate reported by
the demodulator, so remove the unneeded inquiry and the now unneeded
variable.

Reported-by: Richard Scobie 
Cc: Ralph Metzler 
Signed-off-by: Daniel Scheller 
Tested-by: Richard Scobie 
---
 drivers/media/dvb-frontends/stv0910.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/stv0910.c 
b/drivers/media/dvb-frontends/stv0910.c
index e9517e11b399..de8702fcffbd 100644
--- a/drivers/media/dvb-frontends/stv0910.c
+++ b/drivers/media/dvb-frontends/stv0910.c
@@ -533,10 +533,8 @@ static int get_signal_parameters(struct stv *state)
 
 static int tracking_optimization(struct stv *state)
 {
-   u32 symbol_rate = 0;
u8 tmp;
 
-   get_cur_symbol_rate(state, _rate);
read_reg(state, RSTV0910_P2_DMDCFGMD + state->regoff, );
tmp &= ~0xC0;
 
-- 
2.13.6



[PATCH 2/7] [media] dvb-frontends/stv0910: WARN_ON() on consecutive mutex_unlock()

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

Stack dump when gate_ctrl() is called in a way that consecutive unlocks
happen. This is a clear indication that other drivers interfacing with
the stv0910 driver don't do things properly or don't check for failures,
so dump stack so that those drivers can be identified and fixed.

Signed-off-by: Daniel Scheller 
Tested-by: Richard Scobie 
---
 drivers/media/dvb-frontends/stv0910.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/stv0910.c 
b/drivers/media/dvb-frontends/stv0910.c
index 8bf855c301f5..cd247ab9c62d 100644
--- a/drivers/media/dvb-frontends/stv0910.c
+++ b/drivers/media/dvb-frontends/stv0910.c
@@ -1241,7 +1241,8 @@ static int gate_ctrl(struct dvb_frontend *fe, int enable)
if (write_reg(state, state->nr ? RSTV0910_P2_I2CRPT :
  RSTV0910_P1_I2CRPT, i2crpt) < 0) {
/* don't hold the I2C bus lock on failure */
-   mutex_unlock(>base->i2c_lock);
+   if (!WARN_ON(!mutex_is_locked(>base->i2c_lock)))
+   mutex_unlock(>base->i2c_lock);
dev_err(>base->i2c->dev,
"%s() write_reg failure (enable=%d)\n",
__func__, enable);
@@ -1251,7 +1252,8 @@ static int gate_ctrl(struct dvb_frontend *fe, int enable)
state->i2crpt = i2crpt;
 
if (!enable)
-   mutex_unlock(>base->i2c_lock);
+   if (!WARN_ON(!mutex_is_locked(>base->i2c_lock)))
+   mutex_unlock(>base->i2c_lock);
return 0;
 }
 
-- 
2.13.6



[PATCH 1/7] [media] frontends/stv0910: add field offsets to field defines

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

Each field (FSTV0910_XX) is declared as reg/off/unused/sign/mask. Add
the missing offset value to the defines.

Picked up from dddvb master, commit 8a1f27c3d22c ("add field offset to field 
defines")
by Ralph Metzler , adapted to match the comment style
in the mainline driver.

Cc: Ralph Metzler 
Signed-off-by: Daniel Scheller 
---
 drivers/media/dvb-frontends/stv0910_regs.h | 1854 ++--
 1 file changed, 927 insertions(+), 927 deletions(-)

diff --git a/drivers/media/dvb-frontends/stv0910_regs.h 
b/drivers/media/dvb-frontends/stv0910_regs.h
index 32ced4eaf296..f0eb915090bd 100644
--- a/drivers/media/dvb-frontends/stv0910_regs.h
+++ b/drivers/media/dvb-frontends/stv0910_regs.h
@@ -7,15 +7,15 @@
  * Registers Declaration (Internal ST, All Applications )
  * -
  * Each register (RSTV0910__X) is defined by its address (2 bytes).
- *
- * Each field (FSTV0910__X)is defined as follow:
- * [register address -- 2bytes][field sign -- 1byte][field mask -- 1byte]
- *  ==
+ * Each field (FSTV0910__X) is defined as follow:
+ * [register address -- 2bytes][field offset -- 4 bits][unused -- 3 bits]
+ * [field sign -- 1 bit][field mask -- 1byte]
+ * ===
  */
 
 /* MID */
 #define RSTV0910_MID  0xf100
-#define FSTV0910_MCHIP_IDENT  0xf1f0
+#define FSTV0910_MCHIP_IDENT  0xf10040f0
 #define FSTV0910_MRELEASE  0xf10f
 
 /* DID */
@@ -24,7 +24,7 @@
 
 /* DACR1 */
 #define RSTV0910_DACR1  0xf113
-#define FSTV0910_DAC_MODE  0xf11300e0
+#define FSTV0910_DAC_MODE  0xf11350e0
 #define FSTV0910_DAC_VALUE1  0xf113000f
 
 /* DACR2 */
@@ -33,283 +33,283 @@
 
 /* PADCFG */
 #define RSTV0910_PADCFG  0xf11a
-#define FSTV0910_AGCRF2_OPD  0xf11a0008
-#define FSTV0910_AGCRF2_XOR  0xf11a0004
-#define FSTV0910_AGCRF1_OPD  0xf11a0002
+#define FSTV0910_AGCRF2_OPD  0xf11a3008
+#define FSTV0910_AGCRF2_XOR  0xf11a2004
+#define FSTV0910_AGCRF1_OPD  0xf11a1002
 #define FSTV0910_AGCRF1_XOR  0xf11a0001
 
 /* OUTCFG2 */
 #define RSTV0910_OUTCFG2  0xf11b
-#define FSTV0910_TS2_ERROR_XOR  0xf11b0080
-#define FSTV0910_TS2_DPN_XOR  0xf11b0040
-#define FSTV0910_TS2_STROUT_XOR  0xf11b0020
-#define FSTV0910_TS2_CLOCKOUT_XOR  0xf11b0010
-#define FSTV0910_TS1_ERROR_XOR  0xf11b0008
-#define FSTV0910_TS1_DPN_XOR  0xf11b0004
-#define FSTV0910_TS1_STROUT_XOR  0xf11b0002
+#define FSTV0910_TS2_ERROR_XOR  0xf11b7080
+#define FSTV0910_TS2_DPN_XOR  0xf11b6040
+#define FSTV0910_TS2_STROUT_XOR  0xf11b5020
+#define FSTV0910_TS2_CLOCKOUT_XOR  0xf11b4010
+#define FSTV0910_TS1_ERROR_XOR  0xf11b3008
+#define FSTV0910_TS1_DPN_XOR  0xf11b2004
+#define FSTV0910_TS1_STROUT_XOR  0xf11b1002
 #define FSTV0910_TS1_CLOCKOUT_XOR  0xf11b0001
 
 /* OUTCFG */
 #define RSTV0910_OUTCFG  0xf11c
-#define FSTV0910_TS2_OUTSER_HZ  0xf11c0020
-#define FSTV0910_TS1_OUTSER_HZ  0xf11c0010
-#define FSTV0910_TS2_OUTPAR_HZ  0xf11c0008
-#define FSTV0910_TS1_OUTPAR_HZ  0xf11c0004
-#define FSTV0910_TS_SERDATA0  0xf11c0002
+#define FSTV0910_TS2_OUTSER_HZ  0xf11c5020
+#define FSTV0910_TS1_OUTSER_HZ  0xf11c4010
+#define FSTV0910_TS2_OUTPAR_HZ  0xf11c3008
+#define FSTV0910_TS1_OUTPAR_HZ  0xf11c2004
+#define FSTV0910_TS_SERDATA0  0xf11c1002
 
 /* IRQSTATUS3 */
 #define RSTV0910_IRQSTATUS3  0xf120
-#define FSTV0910_SPLL_LOCK  0xf1200020
-#define FSTV0910_SSTREAM_LCK_1  0xf1200010
-#define FSTV0910_SSTREAM_LCK_2  0xf128
-#define FSTV0910_SDVBS1_PRF_2  0xf122
+#define FSTV0910_SPLL_LOCK  0xf1205020
+#define FSTV0910_SSTREAM_LCK_1  0xf1204010
+#define FSTV0910_SSTREAM_LCK_2  0xf1203008
+#define FSTV0910_SDVBS1_PRF_2  0xf1201002
 #define FSTV0910_SDVBS1_PRF_1  0xf121
 
 /* IRQSTATUS2 */
 #define RSTV0910_IRQSTATUS2  0xf121
-#define FSTV0910_SSPY_ENDSIM_1  0xf1210080
-#define FSTV0910_SSPY_ENDSIM_2  0xf1210040
-#define FSTV0910_SPKTDEL_ERROR_2  0xf1210010
-#define FSTV0910_SPKTDEL_LOCKB_2  0xf1210008
-#define FSTV0910_SPKTDEL_LOCK_2  0xf1210004
-#define FSTV0910_SPKTDEL_ERROR_1  0xf1210002
+#define FSTV0910_SSPY_ENDSIM_1  0xf1217080
+#define FSTV0910_SSPY_ENDSIM_2  0xf1216040
+#define FSTV0910_SPKTDEL_ERROR_2  0xf1214010
+#define FSTV0910_SPKTDEL_LOCKB_2  0xf1213008
+#define FSTV0910_SPKTDEL_LOCK_2  0xf1212004
+#define FSTV0910_SPKTDEL_ERROR_1  0xf1211002
 #define FSTV0910_SPKTDEL_LOCKB_1  0xf1210001
 
 /* IRQSTATUS1 */
 #define RSTV0910_IRQSTATUS1  0xf122
-#define FSTV0910_SPKTDEL_LOCK_1  0xf1220080
-#define FSTV0910_SFEC_LOCKB_2  0xf1220040
-#define FSTV0910_SFEC_LOCK_2  0xf1220020
-#define FSTV0910_SFEC_LOCKB_1  0xf1220010
-#define FSTV0910_SFEC_LOCK_1  0xf1220008
-#define FSTV0910_SDEMOD_LOCKB_2  0xf1220004
-#define FSTV0910_SDEMOD_LOCK_2  0xf1220002
+#define FSTV0910_SPKTDEL_LOCK_1  0xf1227080
+#define FSTV0910_SFEC_LOCKB_2  0xf1226040
+#define FSTV0910_SFEC_LOCK_2  0xf1225020
+#define 

[PATCH 0/7] stv0910+stv6111 updates/fixes/improvements

2017-11-26 Thread Daniel Scheller
From: Daniel Scheller 

This series improves (and fixes) a few pending things and a few new ones
which were discovered by Richard (thanks!), removing some redundant
calls and checks here and there, and putting the symbolrate readout and
reporting to get_frontend(). The changes have been thoroughly tested and
didn't cause any harm or regressions.

This series also includes the WARN_ON() variant of the multi-mutexunlock-
protect ([1] for ref) so users can report misbehaving subdrivers (tuners)
and devs get a chance to fix their code. Also updates stv6111 to take
care that on reported errors, it won't unconditionally penetrate the demod
anymore (so the WARN_ON() in stv0910 won't even be triggered).

Please pull during the upcoming media_tree merge cycle.

[1] http://www.spinics.net/lists/linux-media/msg124573.html

Daniel Scheller (7):
  [media] frontends/stv0910: add field offsets to field defines
  [media] dvb-frontends/stv0910: WARN_ON() on consecutive mutex_unlock()
  [media] dvb-frontends/stv6111: handle gate_ctrl errors
  [media] dvb-frontends/stv0910: remove unneeded check/call to
get_if_freq
  [media] dvb-frontends/stv0910: read symbolrate in get_frontend()
  [media] dvb-frontends/stv0910: remove unneeded symbol rate inquiry
  [media] dvb-frontends/stv0910: remove unneeded dvb_math.h include

 drivers/media/dvb-frontends/stv0910.c  |   17 +-
 drivers/media/dvb-frontends/stv0910_regs.h | 1854 ++--
 drivers/media/dvb-frontends/stv6111.c  |   44 +-
 3 files changed, 963 insertions(+), 952 deletions(-)

-- 
2.13.6



Re: [PATCH v4] drm: bridge: synopsys/dw-hdmi: Enable cec clock

2017-11-26 Thread Archit Taneja



On 11/26/2017 01:48 AM, Pierre-Hugues Husson wrote:

Support the "cec" optional clock. The documentation already mentions "cec"
optional clock and it is used by several boards, but currently the driver
doesn't enable it, thus preventing cec from working on those boards.

And even worse: a /dev/cecX device will appear for those boards, but it
won't be functioning without configuring this clock.


Thanks for the updating the commit message. I will queue this to drm-misc-fixes 
once
it's updated with the 4.15-rc1 tag.

Thanks,
Archit



Changes:
v4:
- Change commit message to stress the importance of this patch

v3:
- Drop useless braces

v2:
- Separate ENOENT errors from others
- Propagate other errors (especially -EPROBE_DEFER)

Signed-off-by: Pierre-Hugues Husson 
---
  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +
  1 file changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index bf14214fa464..d82b9747a979 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -138,6 +138,7 @@ struct dw_hdmi {
struct device *dev;
struct clk *isfr_clk;
struct clk *iahb_clk;
+   struct clk *cec_clk;
struct dw_hdmi_i2c *i2c;
  
  	struct hdmi_data_info hdmi_data;

@@ -2382,6 +2383,26 @@ __dw_hdmi_probe(struct platform_device *pdev,
goto err_isfr;
}
  
+	hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec");

+   if (PTR_ERR(hdmi->cec_clk) == -ENOENT) {
+   hdmi->cec_clk = NULL;
+   } else if (IS_ERR(hdmi->cec_clk)) {
+   ret = PTR_ERR(hdmi->cec_clk);
+   if (ret != -EPROBE_DEFER)
+   dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n",
+   ret);
+
+   hdmi->cec_clk = NULL;
+   goto err_iahb;
+   } else {
+   ret = clk_prepare_enable(hdmi->cec_clk);
+   if (ret) {
+   dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n",
+   ret);
+   goto err_iahb;
+   }
+   }
+
/* Product and revision IDs */
hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8)
  | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0);
@@ -2518,6 +2539,8 @@ __dw_hdmi_probe(struct platform_device *pdev,
cec_notifier_put(hdmi->cec_notifier);
  
  	clk_disable_unprepare(hdmi->iahb_clk);

+   if (hdmi->cec_clk)
+   clk_disable_unprepare(hdmi->cec_clk);
  err_isfr:
clk_disable_unprepare(hdmi->isfr_clk);
  err_res:
@@ -2541,6 +2564,8 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi)
  
  	clk_disable_unprepare(hdmi->iahb_clk);

clk_disable_unprepare(hdmi->isfr_clk);
+   if (hdmi->cec_clk)
+   clk_disable_unprepare(hdmi->cec_clk);
  
  	if (hdmi->i2c)

i2c_del_adapter(>i2c->adap);



--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project