cron job: media_tree daily build: ERRORS

2017-12-16 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:   Sun Dec 17 05:00:15 CET 2017
media-tree git hash:45267fed3e55845c5b4b279162b273040ae4f587
media_build git hash:   7199b00cdae29c6f914a89ad996fcb9a133e9deb
v4l-utils git hash: b638ef8b15813494e82148dccd9c0411daa214d9
gcc version:i686-linux-gcc (GCC) 7.1.0
sparse version: v0.5.0-3911-g6f737e1f
smatch version: v0.5.0-3911-g6f737e1f
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: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.18.7-i686: ERRORS
linux-3.19-i686: ERRORS
linux-4.0.9-i686: ERRORS
linux-4.1.33-i686: ERRORS
linux-4.2.8-i686: ERRORS
linux-4.3.6-i686: WARNINGS
linux-4.4.22-i686: OK
linux-4.5.7-i686: WARNINGS
linux-4.6.7-i686: OK
linux-4.7.5-i686: OK
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: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.7-x86_64: ERRORS
linux-3.19-x86_64: ERRORS
linux-4.0.9-x86_64: ERRORS
linux-4.1.33-x86_64: ERRORS
linux-4.2.8-x86_64: ERRORS
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
smatch: OK

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


[PATCH/RFC 3/4] v4l: vsp1: Add support for colorkey alpha blending

2017-12-16 Thread Laurent Pinchart
From: Alexandru Gheorghe 

The VSP2 found in R-Car Gen3 SoCs supports changing the alpha value of
source pixels that match a color key. Add support for this feature for
display pipelines through the API exposed to the DU driver.

The colorkey key value is expressed as a XYZ 888 value, where the X, Y
and Z components are either RGB or YCbCr depending on the plane format.
When the plane is configured with an RGB formats all three components
are matched by the hardware, while with an YCbCr format only the
luminance component is matched the chroma components will be ignored.

Signed-off-by: Alexandru Gheorghe 
[Group all color key parameters in a structure]
Signed-off-by: Laurent Pinchart 
---
 drivers/media/platform/vsp1/vsp1_drm.c  |  3 +++
 drivers/media/platform/vsp1/vsp1_rpf.c  | 10 --
 drivers/media/platform/vsp1/vsp1_rwpf.h |  5 +
 include/media/vsp1.h|  5 +
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drm.c 
b/drivers/media/platform/vsp1/vsp1_drm.c
index 7ce69f23f50a..68af99e5cfa3 100644
--- a/drivers/media/platform/vsp1/vsp1_drm.c
+++ b/drivers/media/platform/vsp1/vsp1_drm.c
@@ -378,6 +378,9 @@ int vsp1_du_atomic_update(struct device *dev, unsigned int 
pipe_index,
rpf->format.plane_fmt[0].bytesperline = cfg->pitch;
rpf->format.plane_fmt[1].bytesperline = cfg->pitch;
rpf->alpha = cfg->alpha;
+   rpf->colorkey.enabled = cfg->colorkey.enabled;
+   rpf->colorkey.key = cfg->colorkey.key;
+   rpf->colorkey.alpha = cfg->colorkey.alpha;
 
rpf->mem.addr[0] = cfg->mem[0];
rpf->mem.addr[1] = cfg->mem[1];
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c 
b/drivers/media/platform/vsp1/vsp1_rpf.c
index fe0633da5a5f..8c532f22013b 100644
--- a/drivers/media/platform/vsp1/vsp1_rpf.c
+++ b/drivers/media/platform/vsp1/vsp1_rpf.c
@@ -243,8 +243,14 @@ static void rpf_configure(struct vsp1_entity *entity,
}
 
vsp1_rpf_write(rpf, dl, VI6_RPF_MSK_CTRL, 0);
-   vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, 0);
-
+   if (rpf->colorkey.enabled) {
+   vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_SET0,
+  (rpf->colorkey.alpha << 24) | rpf->colorkey.key);
+   vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL,
+  VI6_RPF_CKEY_CTRL_SAPE0);
+   } else {
+   vsp1_rpf_write(rpf, dl, VI6_RPF_CKEY_CTRL, 0);
+   }
 }
 
 static void rpf_partition(struct vsp1_entity *entity,
diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h 
b/drivers/media/platform/vsp1/vsp1_rwpf.h
index 58215a7ab631..78119bb681f9 100644
--- a/drivers/media/platform/vsp1/vsp1_rwpf.h
+++ b/drivers/media/platform/vsp1/vsp1_rwpf.h
@@ -50,6 +50,11 @@ struct vsp1_rwpf {
unsigned int bru_input;
 
unsigned int alpha;
+   struct {
+   bool enabled;
+   u32 key;
+   u32 alpha;
+   } colorkey;
 
u32 mult_alpha;
u32 outfmt;
diff --git a/include/media/vsp1.h b/include/media/vsp1.h
index 68a8abe4fac5..cc6a411e2312 100644
--- a/include/media/vsp1.h
+++ b/include/media/vsp1.h
@@ -49,6 +49,11 @@ struct vsp1_du_atomic_config {
struct v4l2_rect dst;
unsigned int alpha;
unsigned int zpos;
+   struct {
+   bool enabled;
+   u32 key;
+   u32 alpha;
+   } colorkey;
 };
 
 void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index);
-- 
Regards,

Laurent Pinchart



[PATCH/RFC 2/4] drm: rcar-du: Use standard colorkey properties

2017-12-16 Thread Laurent Pinchart
Now that KMS has standard color keying properties, instantiate them for
all the non-primary planes. This replaces the custom colorkey field in
the driver plane state structure. The custom colorkey property is kept
to ensure backward-compatibility, but now implemented as an alias for
the standard colorkey.mode, colorkey.min and colorkey.max properties.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 60 +++--
 drivers/gpu/drm/rcar-du/rcar_du_plane.h |  2 --
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   |  1 -
 3 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 4a3d16cf3ed6..b3b43c280ead 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -432,7 +432,7 @@ static void rcar_du_plane_setup_mode(struct rcar_du_group 
*rgrp,
 * PnMR_SPIM_TP_OFF bit set in their pnmr field, disabling color keying
 * automatically.
 */
-   if ((state->colorkey & RCAR_DU_COLORKEY_MASK) == RCAR_DU_COLORKEY_NONE)
+   if (state->state.colorkey.mode == 0)
pnmr |= PnMR_SPIM_TP_OFF;
 
/* For packed YUV formats we need to select the U/V order. */
@@ -441,26 +441,30 @@ static void rcar_du_plane_setup_mode(struct rcar_du_group 
*rgrp,
 
rcar_du_plane_write(rgrp, index, PnMR, pnmr);
 
+   colorkey = ((state->state.colorkey.min >> 24) & 0x00ff)
+| ((state->state.colorkey.min >> 16) & 0xff00)
+| ((state->state.colorkey.min >>  8) & 0x00ff);
+
switch (state->format->fourcc) {
case DRM_FORMAT_RGB565:
-   colorkey = ((state->colorkey & 0xf8) >> 8)
-| ((state->colorkey & 0x00fc00) >> 5)
-| ((state->colorkey & 0xf8) >> 3);
+   colorkey = ((colorkey & 0xf8) >> 8)
+| ((colorkey & 0x00fc00) >> 5)
+| ((colorkey & 0xf8) >> 3);
rcar_du_plane_write(rgrp, index, PnTC2R, colorkey);
break;
 
case DRM_FORMAT_ARGB1555:
case DRM_FORMAT_XRGB1555:
-   colorkey = ((state->colorkey & 0xf8) >> 9)
-| ((state->colorkey & 0x00f800) >> 6)
-| ((state->colorkey & 0xf8) >> 3);
+   colorkey = ((colorkey & 0xf8) >> 9)
+| ((colorkey & 0x00f800) >> 6)
+| ((colorkey & 0xf8) >> 3);
rcar_du_plane_write(rgrp, index, PnTC2R, colorkey);
break;
 
case DRM_FORMAT_XRGB:
case DRM_FORMAT_ARGB:
rcar_du_plane_write(rgrp, index, PnTC3R,
-   PnTC3R_CODE | (state->colorkey & 0xff));
+   PnTC3R_CODE | colorkey);
break;
}
 }
@@ -575,6 +579,9 @@ int __rcar_du_plane_atomic_check(struct drm_plane *plane,
struct drm_rect clip;
int ret;
 
+   if (state->colorkey.min != state->colorkey.max)
+   return -EINVAL;
+
if (!state->crtc) {
/*
 * The visible field is not reset by the DRM core but only
@@ -699,7 +706,6 @@ static void rcar_du_plane_reset(struct drm_plane *plane)
state->hwindex = -1;
state->source = RCAR_DU_PLANE_MEMORY;
state->alpha = 255;
-   state->colorkey = RCAR_DU_COLORKEY_NONE;
state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
 
plane->state = >state;
@@ -714,12 +720,17 @@ static int rcar_du_plane_atomic_set_property(struct 
drm_plane *plane,
struct rcar_du_plane_state *rstate = to_rcar_plane_state(state);
struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
 
-   if (property == rcdu->props.alpha)
+   if (property == rcdu->props.alpha) {
rstate->alpha = val;
-   else if (property == rcdu->props.colorkey)
-   rstate->colorkey = val;
-   else
+   } else if (property == rcdu->props.colorkey) {
+   state->colorkey.mode = val & RCAR_DU_COLORKEY_MASK ? 1 : 0;
+   state->colorkey.min = ((val & 0x00ff) << 24)
+   | ((val & 0xff00) << 16)
+   | ((val & 0x00ff) << 8);
+   state->colorkey.max = state->colorkey.min;
+   } else {
return -EINVAL;
+   }
 
return 0;
 }
@@ -732,12 +743,18 @@ static int rcar_du_plane_atomic_get_property(struct 
drm_plane *plane,
container_of(state, const struct rcar_du_plane_state, state);
struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
 
-   if (property == rcdu->props.alpha)
+   if (property == rcdu->props.alpha) {

[PATCH/RFC 0/4] Implement standard color keying properties

2017-12-16 Thread Laurent Pinchart
Hello,

This patch series is an attempt at implementing standard properties for color
keying support in the KMS API.

Before designing the API proposal I've analyzed the KMS drivers that support
color keying in the upstream kernel. Part of the explanation below was
initially posted in a reply to "[PATCH v2 0/2] rcar-du, vsp1: rcar-gen3: Add
support for colorkey alpha blending" and is copied here to continue the
discussion.

The armada, nouveau and rcar-du drivers expose the color key through DRM
properties. The i915 and vmwgfx drivers use custom ioctls. Here is how they
currently implement color keying.

- armada

"colorkey" range  0x 0x00ff
"colorkey_min" range  0x 0x00ff
"colorkey_max" range  0x 0x00ff
"colorkey_val" range  0x 0x00ff
"colorkey_alpha" range  0x 0x00ff
"colorkey_mode" enum "disable", "Y component", "U component", "V component", 
"RGB", "R component", "G component", "B component"

All range properties store a RGB888 or YUV888 triplet.

The min and max properties store the comparison ranges. When a match occurs 
for one of the components, the value and alpha from the val and alpha 
properties replace the pixel. It's not clear which of the alpha "components" 
is used when a match occurs in RGB mode.

The colorkey property is a shortcut that stores identical values in min, max 
and val and 0 in alpha.

- i915

#define I915_SET_COLORKEY_NONE  (1<<0)
#define I915_SET_COLORKEY_DESTINATION   (1<<1)
#define I915_SET_COLORKEY_SOURCE(1<<2)

struct drm_intel_sprite_colorkey {
__u32 plane_id;
__u32 min_value;
__u32 channel_mask;
__u32 max_value;
__u32 flags;
};

- nouveau

"colorkey" range 0x 0x01ff

The format isn't documented but it seems from the source code that bits 23:0 
store the color key value (written directly to a register, so possibly in a 
pixel format-dependent format) and bit 24 enables color keying.

- rcar-du

"colorkey" range 0x 0x01ff

Bits 23:0 store the color key value in RGB888 (regardless of the pixel format 
of the plane) and bit 24 enables color keying. This supports Gen2 hardware 
only, where the only available more is  exact match. The pixel then becomes 
fully transparent (the hardware doesn't support custom target alpha values).

On Gen3 hardware color keying can be performed in exact RGB match, exact Y 
match or range Y match (only the max value is programmable, the min value is 
always 0). Furthermore in exact match modes the hardware can operate with a 
single match value, in which case it can then override the full ARGB or AYUV 
pixel, or double match value, in which case it can then override the alpha 
component only, but with two distinct match values each associated with a 
target alpha.

- vmwgfx

struct drm_vmw_control_stream_arg {
__u32 stream_id;
__u32 enabled;

__u32 flags;
__u32 color_key;

__u32 handle;
__u32 offset;
__s32 format;
__u32 size;
__u32 width;
__u32 height;
__u32 pitch[3];

__u32 pad64;
struct drm_vmw_rect src;
struct drm_vmw_rect dst;
};

The color_key field isn't documented, but the following (unused) macros hint 
that it could store an RGB888, with the color key feature enabled through the 
flags field.

#define SVGA_VIDEO_FLAG_COLORKEY0x0001
#define SVGA_VIDEO_COLORKEY_MASK 0x00ff

Looking at these drivers we can already see that the hardware implementations
differ quite widely. There are however similarities, and we could express most
of the above features through a set of generic properties similar to the ones
already implemented by the armada driver. This is what the patch series
attempts to do.

- The match range can be set through minimum and maximum properties. Drivers
that support exact match only simply report an error when minimum != maximum.

- The replacement value can be set through a value property. The property
stores both the pixel value (RGB or YUV) and the alpha value Bits that are not
applicable are ignored (for instance RGB/YUV bits when the driver supports
alpha replacement only). If programmable color replacement isn't supported (as
in the R-Car Gen2 example above) the property is omitted.

- The mode can be set through a mode property. Enabling color keying through
one bit in a color property (like done by the nouveau and rcar-du drivers) is 
a hack and I don't think we should carry it forward. A mode property allows
configuring source or destination color keying.

- Part of the mode information could be deduced automatically without a need
to specify it explicitly. For instance RGB/YUV mode can be configured based on
the pixel format of the plane. Similarly, exact match vs. range match can be
configured based on whether the minimum and maximum value differ.

- The modes exposed through the mode property are left as driver-specific in
this RFC, with 

[PATCH/RFC 4/4] drm: rcar-du: Add support for color keying on Gen3

2017-12-16 Thread Laurent Pinchart
Gen3 hardware supports color keying with replacement of the pixel value.
Implement it using the standard KMS colorkey properties.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 882d1f7a328b..54deb9567cd3 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -198,6 +198,13 @@ static void rcar_du_vsp_plane_setup(struct 
rcar_du_vsp_plane *plane)
}
}
 
+   /* Convert the colorkey from 16 bits to 8 bits per component. */
+   cfg.colorkey.enabled = state->state.colorkey.mode;
+   cfg.colorkey.alpha = state->state.colorkey.value >> 56;
+   cfg.colorkey.key = ((state->state.colorkey.min >> 24) & 0x00ff)
+| ((state->state.colorkey.min >> 16) & 0xff00)
+| ((state->state.colorkey.min >>  8) & 0x00ff);
+
vsp1_du_atomic_update(plane->vsp->vsp, crtc->vsp_pipe,
  plane->index, );
 }
@@ -383,6 +390,11 @@ static const struct drm_plane_funcs 
rcar_du_vsp_plane_funcs = {
.atomic_get_property = rcar_du_vsp_plane_atomic_get_property,
 };
 
+static const struct drm_prop_enum_list colorkey_modes[] = {
+   { 0, "disabled" },
+   { 1, "source" },
+};
+
 int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
 unsigned int crtcs)
 {
@@ -441,6 +453,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
device_node *np,
   rcdu->props.alpha, 255);
drm_plane_create_zpos_property(>plane, 1, 1,
   vsp->num_planes - 1);
+   drm_plane_create_colorkey_properties(>plane,
+colorkey_modes,
+ARRAY_SIZE(colorkey_modes),
+true);
}
 
return 0;
-- 
Regards,

Laurent Pinchart



[PATCH/RFC 1/4] drm: Add colorkey properties

2017-12-16 Thread Laurent Pinchart
Color keying is the action of replacing pixels matching a given color
(or range of colors) with transparent pixels in an overlay when
performing blitting. Depending on the hardware capabilities, the
matching pixel can either become fully transparent, or gain a
programmable alpha value.

Color keying is found in a large number of devices whose capabilities
often differ, but they still have enough common features in range to
standardize color key properties. This commit adds four properties
related to color keying named colorkey.min, colorkey.max, colorkey.alpha
and colorkey.mode. Additional properties can be defined by drivers to
expose device-specific features.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/drm_atomic.c |  16 +++
 drivers/gpu/drm/drm_blend.c  | 108 +++
 include/drm/drm_blend.h  |   4 ++
 include/drm/drm_plane.h  |  28 ++-
 4 files changed, 155 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 37445d50816a..4f57ec25e04d 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -756,6 +756,14 @@ static int drm_atomic_plane_set_property(struct drm_plane 
*plane,
state->rotation = val;
} else if (property == plane->zpos_property) {
state->zpos = val;
+   } else if (property == plane->colorkey.mode_property) {
+   state->colorkey.mode = val;
+   } else if (property == plane->colorkey.min_property) {
+   state->colorkey.min = val;
+   } else if (property == plane->colorkey.max_property) {
+   state->colorkey.max = val;
+   } else if (property == plane->colorkey.value_property) {
+   state->colorkey.value = val;
} else if (plane->funcs->atomic_set_property) {
return plane->funcs->atomic_set_property(plane, state,
property, val);
@@ -815,6 +823,14 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
*val = state->rotation;
} else if (property == plane->zpos_property) {
*val = state->zpos;
+   } else if (property == plane->colorkey.mode_property) {
+   *val = state->colorkey.mode;
+   } else if (property == plane->colorkey.min_property) {
+   *val = state->colorkey.min;
+   } else if (property == plane->colorkey.max_property) {
+   *val = state->colorkey.max;
+   } else if (property == plane->colorkey.value_property) {
+   *val = state->colorkey.value;
} else if (plane->funcs->atomic_get_property) {
return plane->funcs->atomic_get_property(plane, state, 
property, val);
} else {
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 2e5e089dd912..79da7d8a22e2 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -98,6 +98,10 @@
  *   planes. Without this property the primary plane is always below the cursor
  *   plane, and ordering between all other planes is undefined.
  *
+ * - Color keying is set up with drm_plane_create_colorkey_properties(). It 
adds
+ *   support for replacing a range of colors with a transparent color in the
+ *   plane.
+ *
  * Note that all the property extensions described here apply either to the
  * plane or the CRTC (e.g. for the background color, which currently is not
  * exposed and assumed to be black).
@@ -405,3 +409,107 @@ int drm_atomic_normalize_zpos(struct drm_device *dev,
return 0;
 }
 EXPORT_SYMBOL(drm_atomic_normalize_zpos);
+
+/**
+ * drm_plane_create_colorkey_properties - create colorkey properties
+ * @plane: drm plane
+ * @modes: array of supported color keying modes
+ * @num_modes: number of modes in the modes array
+ * @replace: if true create the colorkey.replacement property
+ *
+ * This function creates the generic color keying properties and attach them to
+ * the plane to enable color keying control for blending operations.
+ *
+ * Color keying is controlled through four properties:
+ *
+ * colorkey.mode:
+ * The mode is an enumerated property that controls how color keying
+ * operates. Modes are driver-specific, except for a "disabled" mode that
+ * disables color keying and is guaranteed to exist if color keying is
+ * supported.
+ *
+ * colorkey.min, colorkey.max:
+ * Those two properties specify the colors that are replaced by transparent
+ * pixels. Pixel whose values are in the [min, max] range are replaced, all
+ * other pixels are left untouched. The minimum and maximum values are
+ * expressed as a 64-bit integer in AXYZ16161616 format, where A is the
+ * alpha value and X, Y and Z correspond to the color components of the
+ * plane's pixel format. In most cases XYZ will be either RGB or YUV.
+ *
+ * When a single color key is supported instead of a 

Re: [alsa-devel] [PATCH 3/5] media: i2c: Add TDA1997x HDMI receiver driver

2017-12-16 Thread Fabio Estevam
Hi Tim,

On Thu, Nov 9, 2017 at 4:45 PM, Tim Harvey  wrote:

> +static int tda1997x_set_power(struct tda1997x_state *state, bool on)
> +{
> +   int ret = 0;
> +
> +   if (on) {
> +   ret = regulator_bulk_enable(TDA1997X_NUM_SUPPLIES,
> +state->supplies);
> +   msleep(300);

Didn't you miss a 'return ret' here?

Otherwise regulator_bulk_disable() will always be called below.

> +   }
> +
> +   ret = regulator_bulk_disable(TDA1997X_NUM_SUPPLIES,
> +  state->supplies);
> +   return ret;
> +}


[PATCH] libdvbv5: Add libudev to pkg-config file

2017-12-16 Thread Kieran Kunhya
>From 8ca5f86d480f397f32626250cebab5b63eb79034 Mon Sep 17 00:00:00 2001
From: Kieran Kunhya 
Date: Sat, 16 Dec 2017 18:40:22 +
Subject: [PATCH] libdvbv5: Add libudev to pkg-config file

Signed-off-by: Kieran Kunhya 
---
 lib/libdvbv5/libdvbv5.pc.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libdvbv5/libdvbv5.pc.in b/lib/libdvbv5/libdvbv5.pc.in
index 7e3c4f5c..04e0edb3 100644
--- a/lib/libdvbv5/libdvbv5.pc.in
+++ b/lib/libdvbv5/libdvbv5.pc.in
@@ -6,5 +6,5 @@ libdir=@libdir@
 Name: libdvbv5
 Description: DVBv5 utility library
 Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -ldvbv5
+Libs: -L${libdir} -ldvbv5 -ludev
 Cflags: -I${includedir}
-- 
2.11.0.windows.1


Re: [PATCH for v4.15] dt-bindings/media/cec-gpio.txt: mention the CEC/HPD max voltages

2017-12-16 Thread Rob Herring
On Sat, Dec 16, 2017 at 11:44:13AM +0100, Hans Verkuil wrote:
> Mention the maximum voltages of the CEC and HPD lines. Since in the example
> these lines are connected to a Raspberry Pi and the Rpi GPIO lines are 3.3V
> it is a good idea to warn against directly connecting the HPD to the Raspberry
> Pi's GPIO line.
> 
> Signed-off-by: Hans Verkuil 

Reviewed-by: Rob Herring 


Re: [RFC 2/5] [media] dt: bindings: Update binding documentation for sunxi IR controller

2017-12-16 Thread Rob Herring
gOn Sat, Dec 16, 2017 at 03:49:11AM +0100, Philipp Rossak wrote:
> This patch updates documentation for Device-Tree bindings for sunxi IR
> controller and adds the new requiered property for the base clock frequency.
> 
> Signed-off-by: Philipp Rossak 
> ---
>  Documentation/devicetree/bindings/media/sunxi-ir.txt | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/sunxi-ir.txt 
> b/Documentation/devicetree/bindings/media/sunxi-ir.txt
> index 91648c569b1e..5f4960c61245 100644
> --- a/Documentation/devicetree/bindings/media/sunxi-ir.txt
> +++ b/Documentation/devicetree/bindings/media/sunxi-ir.txt
> @@ -1,12 +1,13 @@
>  Device-Tree bindings for SUNXI IR controller found in sunXi SoC family
>  
>  Required properties:
> -- compatible : "allwinner,sun4i-a10-ir" or "allwinner,sun5i-a13-ir"
> -- clocks : list of clock specifiers, corresponding to
> -   entries in clock-names property;
> -- clock-names: should contain "apb" and "ir" entries;
> -- interrupts : should contain IR IRQ number;
> -- reg: should contain IO map address for IR.
> +- compatible   : "allwinner,sun4i-a10-ir" or "allwinner,sun5i-a13-ir"
> +- clocks   : list of clock specifiers, corresponding to
> + entries in clock-names property;
> +- clock-names  : should contain "apb" and "ir" entries;
> +- interrupts   : should contain IR IRQ number;
> +- reg  : should contain IO map address for IR.
> +- base-clk-frequency  : should contain the base clock frequency

Use clock-frequency or assigned-clocks.

Rob


Re: [PATCH v5 3/6] media: dt-bindings: Add bindings for TDA1997X

2017-12-16 Thread Philippe Ombredanne
Tim,

On Sat, Dec 16, 2017 at 7:00 PM, Tim Harvey  wrote:
> Cc: Rob Herring 
> Acked-by: Sakari Ailus 
> Signed-off-by: Tim Harvey 



> --- /dev/null
> +++ b/include/dt-bindings/media/tda1997x.h
> @@ -0,0 +1,78 @@
> +/*
> + * Copyright (C) 2017 Gateworks Corporation
> + *
> + * 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.
> + */

Please consider using the new SPDX tags per Thomas doc patches [1]
Thanks!
[1] https://lkml.org/lkml/2017/12/4/934
-- 
Cordially
Philippe Ombredanne, your friendly kernel licensing scruffy


[PATCH v5 0/6] TDA1997x HDMI video receiver

2017-12-16 Thread Tim Harvey
This is a v4l2 subdev driver supporting the TDA1997x HDMI video receiver.

I've tested this on a Gateworks GW54xx/GW551x with an IMX6Q/IMX6DL which
uses the TDA19971 with 16bits connected to the IMX6 CSI. For this
configuration I've tested both 16bit YUV422 and 8bit BT656 parallel video
bus modes.

While the driver should support the TDA1993 I do not have one for testing.

Further potential development efforts include:
 - CEC support
 - HDCP support
 - mbus format selection support for bus widths that support multiple
   formats
 - TDA19972 support (2 inputs)

Media graphs can be found at http://dev.gateworks.com/docs/linux/media

History:
v5:
 - added v4l2_hdmi_colorimetry() patch from Hans to series
 - bindings: added Sakari's ack to bindings
 - tda1997x: uppercase string constants
 - tda1997x: use v4l2_hdmi_rx_coloriemtry to fill format
 - tda1997x: fix V4L2_CID_DV_RX_RGB_RANGE
 - tda1997x: fix interlaced mode format
 - dts: remove leading 0 from unit address
 - dts: add newline between property list and child node
 - dts: added missing audmux in GW551x dts

v4:
 - move include/dt-bindings/media/tda1997x.h to bindings patch
 - clarify port node details in bindings
 - fix typos
 - fix default quant range for VGA
 - fix quant range handling and conv matrix
 - add additional standards and capabilities to timings_cap

v3:
 - fix typo in dt bindings
 - added dt bindings for GW551x
 - use V4L2_DV_BT_FRAME_WIDTH/HEIGHT macros
 - fixed missing break
 - use only hdmi_infoframe_log for infoframe logging
 - simplify tda1997x_s_stream error handling
 - add delayed work proc to handle hotplug enable/disable
 - fix set_edid (disable HPD before writing, enable after)
 - remove enabling edid by default
 - initialize timings
 - take quant range into account in colorspace conversion
 - remove vendor/product tracking (we provide this in log_status via
   infoframes)
 - add v4l_controls
 - add more detail to log_status
 - calculate vhref generator timings
 - timing detection fixes (rounding errors, hswidth errors)
 - rename configure_input/configure_conv functions

v2:
 - encorporate feedback into dt bindings
 - change audio dt bindings
 - implement dv timings enum/cap
 - remove deprecated g_mbus_config op
 - fix dv_query_timings
 - add EDID get/set handling
 - remove max-pixel-rate support
 - add audio codec DAI support
 - added media-ctl and v4l2-compliance details

v1:
 - initial RFC

Media device topology:
# media-ctl -d /dev/media0 -p
Media controller API version 4.13.0

Media device information

driver  imx-media
model   imx-media
serial  
bus info
hw revision 0x0
driver version  4.13.0

Device topology
- entity 1: adv7180 2-0020 (1 pad, 1 link)
type V4L2 subdev subtype Unknown flags 20004
device node name /dev/v4l-subdev0
pad0: Source
[fmt:UYVY8_2X8/720x480 field:interlaced colorspace:smpte170m]
-> "ipu2_csi1_mux":1 []

- entity 3: tda19971 2-0048 (1 pad, 1 link)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev1
pad0: Source
[fmt:UYVY8_1X16/640x480 field:none colorspace:srgb]
[dv.caps:BT.656/1120 min:640x480@1300 
max:1920x1080@16500 stds:CEA-861,DMT caps:progressive]
[dv.detect:BT.656/1120 640x480p59 (800x525) stds:CEA-861,DMT 
flags:has-cea861-vic]
[dv.current:BT.656/1120 1920x1080p60 (2200x1125) 
stds:CEA-861,DMT flags:can-reduce-fps,CE-video,has-cea861-vic]
-> "ipu1_csi0_mux":1 []

- entity 5: ipu1_vdic (3 pads, 3 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev2
pad0: Sink
[fmt:AYUV8_1X32/640x480@1/30 field:none colorspace:smpte170m 
xfer:709 ycbcr:601 quantization:lim-range]
<- "ipu1_csi0":1 []
<- "ipu1_csi1":1 []
pad1: Sink
[fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:smpte170m 
xfer:709 ycbcr:601 quantization:lim-range]
pad2: Source
[fmt:AYUV8_1X32/640x480@1/60 field:none colorspace:smpte170m 
xfer:709 ycbcr:601 quantization:lim-range]
-> "ipu1_ic_prp":0 []

- entity 9: ipu2_vdic (3 pads, 3 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev3
pad0: Sink
[fmt:AYUV8_1X32/640x480@1/30 field:none colorspace:smpte170m 
xfer:709 ycbcr:601 quantization:lim-range]
<- "ipu2_csi0":1 []
<- "ipu2_csi1":1 []
pad1: Sink
[fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:smpte170m 
xfer:709 ycbcr:601 quantization:lim-range]
pad2: Source
[fmt:AYUV8_1X32/640x480@1/60 field:none colorspace:smpte170m 
xfer:709 ycbcr:601 quantization:lim-range]
-> "ipu2_ic_prp":0 []

- entity 13: ipu1_ic_prp (3 pads, 5 links)

[PATCH v5 1/6] v4l2-dv-timings: add v4l2_hdmi_colorimetry()

2017-12-16 Thread Tim Harvey
From: Hans Verkuil 

Add the v4l2_hdmi_colorimetry() function so we have a single function
that determines the colorspace, YCbCr encoding, quantization range and
transfer function from the InfoFrame data.

Signed-off-by: Hans Verkuil 
Signed-off-by: Tim Harvey 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 141 ++
 include/media/v4l2-dv-timings.h   |  21 +
 2 files changed, 162 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 5c8c49d..4d01d52 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 MODULE_AUTHOR("Hans Verkuil");
 MODULE_DESCRIPTION("V4L2 DV Timings Helper Functions");
@@ -814,3 +815,143 @@ struct v4l2_fract v4l2_calc_aspect_ratio(u8 
hor_landscape, u8 vert_portrait)
return aspect;
 }
 EXPORT_SYMBOL_GPL(v4l2_calc_aspect_ratio);
+
+/** v4l2_hdmi_rx_colorimetry - determine HDMI colorimetry information
+ * based on various InfoFrames.
+ * @avi - the AVI InfoFrame
+ * @hdmi - the HDMI Vendor InfoFrame, may be NULL
+ * @height - the frame height
+ *
+ * Determines the HDMI colorimetry information, i.e. how the HDMI
+ * pixel color data should be interpreted.
+ *
+ * Note that some of the newer features (DCI-P3, HDR) are not yet
+ * implemented: the hdmi.h header needs to be updated to the HDMI 2.0
+ * and CTA-861-G standards.
+ */
+struct v4l2_hdmi_colorimetry
+v4l2_hdmi_rx_colorimetry(const struct hdmi_avi_infoframe *avi,
+const struct hdmi_vendor_infoframe *hdmi,
+unsigned int height)
+{
+   struct v4l2_hdmi_colorimetry c = {
+   V4L2_COLORSPACE_SRGB,
+   V4L2_YCBCR_ENC_DEFAULT,
+   V4L2_QUANTIZATION_FULL_RANGE,
+   V4L2_XFER_FUNC_SRGB
+   };
+   bool is_ce = avi->video_code || (hdmi && hdmi->vic);
+   bool is_sdtv = height <= 576;
+   bool default_is_lim_range_rgb = avi->video_code > 1;
+
+   switch (avi->colorspace) {
+   case HDMI_COLORSPACE_RGB:
+   /* RGB pixel encoding */
+   switch (avi->colorimetry) {
+   case HDMI_COLORIMETRY_EXTENDED:
+   switch (avi->extended_colorimetry) {
+   case HDMI_EXTENDED_COLORIMETRY_ADOBE_RGB:
+   c.colorspace = V4L2_COLORSPACE_ADOBERGB;
+   c.xfer_func = V4L2_XFER_FUNC_ADOBERGB;
+   break;
+   case HDMI_EXTENDED_COLORIMETRY_BT2020:
+   c.colorspace = V4L2_COLORSPACE_BT2020;
+   c.xfer_func = V4L2_XFER_FUNC_709;
+   break;
+   default:
+   break;
+   }
+   break;
+   default:
+   break;
+   }
+   switch (avi->quantization_range) {
+   case HDMI_QUANTIZATION_RANGE_LIMITED:
+   c.quantization = V4L2_QUANTIZATION_LIM_RANGE;
+   break;
+   case HDMI_QUANTIZATION_RANGE_FULL:
+   break;
+   default:
+   if (default_is_lim_range_rgb)
+   c.quantization = V4L2_QUANTIZATION_LIM_RANGE;
+   break;
+   }
+   break;
+
+   default:
+   /* YCbCr pixel encoding */
+   c.quantization = V4L2_QUANTIZATION_LIM_RANGE;
+   switch (avi->colorimetry) {
+   case HDMI_COLORIMETRY_NONE:
+   if (!is_ce)
+   break;
+   if (is_sdtv) {
+   c.colorspace = V4L2_COLORSPACE_SMPTE170M;
+   c.ycbcr_enc = V4L2_YCBCR_ENC_601;
+   } else {
+   c.colorspace = V4L2_COLORSPACE_REC709;
+   c.ycbcr_enc = V4L2_YCBCR_ENC_709;
+   }
+   c.xfer_func = V4L2_XFER_FUNC_709;
+   break;
+   case HDMI_COLORIMETRY_ITU_601:
+   c.colorspace = V4L2_COLORSPACE_SMPTE170M;
+   c.ycbcr_enc = V4L2_YCBCR_ENC_601;
+   c.xfer_func = V4L2_XFER_FUNC_709;
+   break;
+   case HDMI_COLORIMETRY_ITU_709:
+   c.colorspace = V4L2_COLORSPACE_REC709;
+   c.ycbcr_enc = V4L2_YCBCR_ENC_709;
+   c.xfer_func = V4L2_XFER_FUNC_709;
+   break;
+   case HDMI_COLORIMETRY_EXTENDED:
+   switch (avi->extended_colorimetry) 

[PATCH v5 2/6] MAINTAINERS: add entry for NXP TDA1997x driver

2017-12-16 Thread Tim Harvey
Signed-off-by: Tim Harvey 
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index aa71ab52f..502bc97 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13244,6 +13244,14 @@ T: git git://linuxtv.org/mkrufky/tuners.git
 S: Maintained
 F: drivers/media/tuners/tda18271*
 
+TDA1997x MEDIA DRIVER
+M: Tim Harvey 
+L: linux-media@vger.kernel.org
+W: https://linuxtv.org
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+S: Maintained
+F: drivers/media/i2c/tda1997x.*
+
 TDA827x MEDIA DRIVER
 M: Michael Krufky 
 L: linux-media@vger.kernel.org
-- 
2.7.4



[PATCH v5 5/6] ARM: dts: imx: Add TDA19971 HDMI Receiver to GW54xx

2017-12-16 Thread Tim Harvey
The GW54xx has a front-panel microHDMI connector routed to a TDA19971
which is connected the the IPU CSI when using IMX6Q.

Signed-off-by: Tim Harvey 
---
v5:
 - remove leading 0 from unit address
 - add newline between property list and child node

v4: no changes
v3: no changes

v2:
 - add HDMI audio input support
---
 arch/arm/boot/dts/imx6q-gw54xx.dts| 105 ++
 arch/arm/boot/dts/imx6qdl-gw54xx.dtsi |  29 +-
 2 files changed, 131 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/imx6q-gw54xx.dts 
b/arch/arm/boot/dts/imx6q-gw54xx.dts
index 56e5b50..0477120 100644
--- a/arch/arm/boot/dts/imx6q-gw54xx.dts
+++ b/arch/arm/boot/dts/imx6q-gw54xx.dts
@@ -12,10 +12,30 @@
 /dts-v1/;
 #include "imx6q.dtsi"
 #include "imx6qdl-gw54xx.dtsi"
+#include 
 
 / {
model = "Gateworks Ventana i.MX6 Dual/Quad GW54XX";
compatible = "gw,imx6q-gw54xx", "gw,ventana", "fsl,imx6q";
+
+   sound-digital {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "tda1997x-audio";
+
+   simple-audio-card,dai-link@0 {
+   format = "i2s";
+
+   cpu {
+   sound-dai = <>;
+   };
+
+   codec {
+   bitclock-master;
+   frame-master;
+   sound-dai = <>;
+   };
+   };
+   };
 };
 
  {
@@ -35,6 +55,61 @@
};
};
};
+
+   tda1997x: codec@48 {
+   compatible = "nxp,tda19971";
+   pinctrl-names = "default";
+   pinctrl-0 = <_tda1997x>;
+   reg = <0x48>;
+   interrupt-parent = <>;
+   interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+   DOVDD-supply = <_3p3v>;
+   AVDD-supply = <_reg>;
+   DVDD-supply = <_reg>;
+   #sound-dai-cells = <0>;
+   nxp,audout-format = "i2s";
+   nxp,audout-layout = <0>;
+   nxp,audout-width = <16>;
+   nxp,audout-mclk-fs = <128>;
+   /*
+* The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+* and Y[11:4] across 16bits in the same cycle
+* which we map to VP[15:08]<->CSI_DATA[19:12]
+*/
+   nxp,vidout-portcfg =
+   /*G_Y_11_8<->VP[15:12]<->CSI_DATA[19:16]*/
+   < TDA1997X_VP24_V15_12 TDA1997X_G_Y_11_8 >,
+   /*G_Y_7_4<->VP[11:08]<->CSI_DATA[15:12]*/
+   < TDA1997X_VP24_V11_08 TDA1997X_G_Y_7_4 >,
+   /*R_CR_CBCR_11_8<->VP[07:04]<->CSI_DATA[11:08]*/
+   < TDA1997X_VP24_V07_04 TDA1997X_R_CR_CBCR_11_8 >,
+   /*R_CR_CBCR_7_4<->VP[03:00]<->CSI_DATA[07:04]*/
+   < TDA1997X_VP24_V03_00 TDA1997X_R_CR_CBCR_7_4 >;
+
+   port {
+   tda1997x_to_ipu1_csi0_mux: endpoint {
+   remote-endpoint = 
<_csi0_mux_from_parallel_sensor>;
+   bus-width = <16>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   data-active = <1>;
+   };
+   };
+   };
+};
+
+_csi0_from_ipu1_csi0_mux {
+   bus-width = <16>;
+};
+
+_csi0_mux_from_parallel_sensor {
+   remote-endpoint = <_to_ipu1_csi0_mux>;
+   bus-width = <16>;
+};
+
+_csi0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_ipu1_csi0>;
 };
 
 _csi1_from_ipu2_csi1_mux {
@@ -63,6 +138,30 @@
>;
};
 
+   pinctrl_ipu1_csi0: ipu1_csi0grp {
+   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
+   

[PATCH v5 6/6] ARM: dts: imx: Add TDA19971 HDMI Receiver to GW551x

2017-12-16 Thread Tim Harvey
Signed-off-by: Tim Harvey 
---
v5:
 - add missing audmux config
---
 arch/arm/boot/dts/imx6qdl-gw551x.dtsi | 138 ++
 1 file changed, 138 insertions(+)

diff --git a/arch/arm/boot/dts/imx6qdl-gw551x.dtsi 
b/arch/arm/boot/dts/imx6qdl-gw551x.dtsi
index 30d4662..749548a 100644
--- a/arch/arm/boot/dts/imx6qdl-gw551x.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-gw551x.dtsi
@@ -46,6 +46,8 @@
  */
 
 #include 
+#include 
+#include 
 
 / {
/* these are used by bootloader for disabling nodes */
@@ -98,6 +100,50 @@
regulator-min-microvolt = <500>;
regulator-max-microvolt = <500>;
};
+
+   sound-digital {
+   compatible = "simple-audio-card";
+   simple-audio-card,name = "tda1997x-audio";
+
+   simple-audio-card,dai-link@0 {
+   format = "i2s";
+
+   cpu {
+   sound-dai = <>;
+   };
+
+   codec {
+   bitclock-master;
+   frame-master;
+   sound-dai = <>;
+   };
+   };
+   };
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_audmux>; /* AUD5<->tda1997x */
+   status = "okay";
+
+   ssi1 {
+   fsl,audmux-port = <0>;
+   fsl,port-config = <
+   (IMX_AUDMUX_V2_PTCR_TFSDIR |
+   IMX_AUDMUX_V2_PTCR_TFSEL(4+8) | /* RXFS */
+   IMX_AUDMUX_V2_PTCR_TCLKDIR |
+   IMX_AUDMUX_V2_PTCR_TCSEL(4+8) | /* RXC */
+   IMX_AUDMUX_V2_PTCR_SYN)
+   IMX_AUDMUX_V2_PDCR_RXDSEL(4)
+   >;
+   };
+
+   aud5 {
+   fsl,audmux-port = <4>;
+   fsl,port-config = <
+   IMX_AUDMUX_V2_PTCR_SYN
+   IMX_AUDMUX_V2_PDCR_RXDSEL(0)>;
+   };
 };
 
  {
@@ -263,6 +309,60 @@
#gpio-cells = <2>;
};
 
+   tda1997x: tda1997x@48 {
+   compatible = "nxp,tda19971";
+   pinctrl-names = "default";
+   pinctrl-0 = <_tda1997x>;
+   reg = <0x48>;
+   interrupt-parent = <>;
+   interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+   DOVDD-supply = <_3p3>;
+   AVDD-supply = <_1p8b>;
+   DVDD-supply = <_1p8a>;
+   #sound-dai-cells = <0>;
+   nxp,audout-format = "i2s";
+   nxp,audout-layout = <0>;
+   nxp,audout-width = <16>;
+   nxp,audout-mclk-fs = <128>;
+   /*
+* The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+* and Y[11:4] across 16bits in the same cycle
+* which we map to VP[15:08]<->CSI_DATA[19:12]
+*/
+   nxp,vidout-portcfg =
+   /*G_Y_11_8<->VP[15:12]<->CSI_DATA[19:16]*/
+   < TDA1997X_VP24_V15_12 TDA1997X_G_Y_11_8 >,
+   /*G_Y_7_4<->VP[11:08]<->CSI_DATA[15:12]*/
+   < TDA1997X_VP24_V11_08 TDA1997X_G_Y_7_4 >,
+   /*R_CR_CBCR_11_8<->VP[07:04]<->CSI_DATA[11:08]*/
+   < TDA1997X_VP24_V07_04 TDA1997X_R_CR_CBCR_11_8 >,
+   /*R_CR_CBCR_7_4<->VP[03:00]<->CSI_DATA[07:04]*/
+   < TDA1997X_VP24_V03_00 TDA1997X_R_CR_CBCR_7_4 >;
+
+   port {
+   tda1997x_to_ipu1_csi0_mux: endpoint {
+   remote-endpoint = 
<_csi0_mux_from_parallel_sensor>;
+   bus-width = <16>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   data-active = <1>;
+   };
+   };
+   };
+};
+
+_csi0_from_ipu1_csi0_mux {
+   bus-width = <16>;
+};
+
+_csi0_mux_from_parallel_sensor {
+   remote-endpoint = <_to_ipu1_csi0_mux>;
+   bus-width = <16>;
+};
+
+_csi0 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_ipu1_csi0>;
 };
 
  {
@@ -320,6 +420,14 @@
 };
 
  {
+   pinctrl_audmux: audmuxgrp {
+   fsl,pins = <
+   MX6QDL_PAD_DISP0_DAT19__AUD5_RXD0x130b0
+   MX6QDL_PAD_DISP0_DAT14__AUD5_RXC0x130b0
+   MX6QDL_PAD_DISP0_DAT13__AUD5_RXFS   0x130b0
+   >;
+   };
+
pinctrl_flexcan1: flexcan1grp {
fsl,pins = <
MX6QDL_PAD_KEY_ROW2__FLEXCAN1_RX0x1b0b1
@@ -375,6 +483,30 @@
>;
};
 
+   pinctrl_ipu1_csi0: ipu1_csi0grp {
+   fsl,pins = <
+   MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04  0x1b0b0
+   

[PATCH v5 4/6] media: i2c: Add TDA1997x HDMI receiver driver

2017-12-16 Thread Tim Harvey
Add support for the TDA1997x HDMI receivers.

Cc: Hans Verkuil 
Signed-off-by: Tim Harvey 
---
v5:
 - uppercase string constants
 - use v4l2_hdmi_rx_coloriemtry to fill format
 - fix V4L2_CID_DV_RX_RGB_RANGE
 - fix interlaced mode format

v4:
 - move include/dt-bindings/media/tda1997x.h to bindings patch
 - fix typos
 - fix default quant range for VGA
 - fix quant range handling and conv matrix
 - add additional standards and capabilities to timings_cap

v3:
 - use V4L2_DV_BT_FRAME_WIDTH/HEIGHT macros
 - fixed missing break
 - use only hdmi_infoframe_log for infoframe logging
 - simplify tda1997x_s_stream error handling
 - add delayed work proc to handle hotplug enable/disable
 - fix set_edid (disable HPD before writing, enable after)
 - remove enabling edid by default
 - initialize timings
 - take quant range into account in colorspace conversion
 - remove vendor/product tracking (we provide this in log_status via infoframes)
 - add v4l_controls
 - add more detail to log_status
 - calculate vhref generator timings
 - timing detection fixes (rounding errors, hswidth errors)
 - rename configure_input/configure_conv functions

v2:
 - implement dv timings enum/cap
 - remove deprecated g_mbus_config op
 - fix dv_query_timings
 - add EDID get/set handling
 - remove max-pixel-rate support
 - add audio codec DAI support
 - change audio bindings
---
 drivers/media/i2c/Kconfig|9 +
 drivers/media/i2c/Makefile   |1 +
 drivers/media/i2c/tda1997x.c | 3520 ++
 include/media/i2c/tda1997x.h |   53 +
 4 files changed, 3583 insertions(+)
 create mode 100644 drivers/media/i2c/tda1997x.c
 create mode 100644 include/media/i2c/tda1997x.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 3c6d642..abf24b9 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -56,6 +56,15 @@ config VIDEO_TDA9840
  To compile this driver as a module, choose M here: the
  module will be called tda9840.
 
+config VIDEO_TDA1997X
+   tristate "NXP TDA1997x HDMI receiver"
+   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ V4L2 subdevice driver for the NXP TDA1997x HDMI receivers.
+
+ To compile this driver as a module, choose M here: the
+ module will be called tda1997x.
+
 config VIDEO_TEA6415C
tristate "Philips TEA6415C audio processor"
depends on I2C
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 548a9ef..adfcae9 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
 obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
 obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
 obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o
+obj-$(CONFIG_VIDEO_TDA1997X) += tda1997x.o
 obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o
 obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o
 obj-$(CONFIG_VIDEO_SAA7110) += saa7110.o
diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c
new file mode 100644
index 000..aea970f
--- /dev/null
+++ b/drivers/media/i2c/tda1997x.c
@@ -0,0 +1,3520 @@
+/*
+ * Copyright (C) 2017 Gateworks Corporation
+ *
+ * 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 
+#include 
+#include 
+#include 
+
+#include 
+
+/* debug level */
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "debug level (0-2)");
+
+/* Page 0x00 - General Control */
+#define REG_VERSION0x
+#define REG_INPUT_SEL  0x0001
+#define REG_SVC_MODE   0x0002
+#define REG_HPD_MAN_CTRL   0x0003
+#define REG_RT_MAN_CTRL0x0004
+#define REG_STANDBY_SOFT_RST   0x000A
+#define REG_HDMI_SOFT_RST  0x000B
+#define REG_HDMI_INFO_RST  0x000C
+#define REG_INT_FLG_CLR_TOP0x000E
+#define REG_INT_FLG_CLR_SUS0x000F
+#define REG_INT_FLG_CLR_DDC0x0010
+#define REG_INT_FLG_CLR_RATE   0x0011
+#define REG_INT_FLG_CLR_MODE   0x0012
+#define REG_INT_FLG_CLR_INFO   0x0013
+#define REG_INT_FLG_CLR_AUDIO  0x0014
+#define REG_INT_FLG_CLR_HDCP   0x0015
+#define REG_INT_FLG_CLR_AFE0x0016
+#define REG_INT_MASK_TOP   0x0017
+#define REG_INT_MASK_SUS   0x0018
+#define REG_INT_MASK_DDC   0x0019
+#define REG_INT_MASK_RATE  0x001A
+#define REG_INT_MASK_MODE  0x001B
+#define REG_INT_MASK_INFO  0x001C
+#define REG_INT_MASK_AUDIO 0x001D
+#define REG_INT_MASK_HDCP  0x001E
+#define REG_INT_MASK_AFE   0x001F
+#define REG_DETECT_5V  0x0020
+#define 

[PATCH v5 3/6] media: dt-bindings: Add bindings for TDA1997X

2017-12-16 Thread Tim Harvey
Cc: Rob Herring 
Acked-by: Sakari Ailus 
Signed-off-by: Tim Harvey 
---
v5:
 - added Sakari's ack

v4:
 - move include/dt-bindings/media/tda1997x.h to bindings patch
 - clarify port node details

v3:
 - fix typo

v2:
 - add vendor prefix and remove _ from vidout-portcfg
 - remove _ from labels
 - remove max-pixel-rate property
 - describe and provide example for single output port
 - update to new audio port bindings
---
 .../devicetree/bindings/media/i2c/tda1997x.txt | 179 +
 include/dt-bindings/media/tda1997x.h   |  78 +
 2 files changed, 257 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/tda1997x.txt
 create mode 100644 include/dt-bindings/media/tda1997x.h

diff --git a/Documentation/devicetree/bindings/media/i2c/tda1997x.txt 
b/Documentation/devicetree/bindings/media/i2c/tda1997x.txt
new file mode 100644
index 000..9ab53c3
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/tda1997x.txt
@@ -0,0 +1,179 @@
+Device-Tree bindings for the NXP TDA1997x HDMI receiver
+
+The TDA19971/73 are HDMI video receivers.
+
+The TDA19971 Video port output pins can be used as follows:
+ - RGB 8bit per color (24 bits total): R[11:4] B[11:4] G[11:4]
+ - YUV444 8bit per color (24 bits total): Y[11:4] Cr[11:4] Cb[11:4]
+ - YUV422 semi-planar 8bit per component (16 bits total): Y[11:4] CbCr[11:4]
+ - YUV422 semi-planar 10bit per component (20 bits total): Y[11:2] CbCr[11:2]
+ - YUV422 semi-planar 12bit per component (24 bits total): - Y[11:0] CbCr[11:0]
+ - YUV422 BT656 8bit per component (8 bits total): YCbCr[11:4] (2-cycles)
+ - YUV422 BT656 10bit per component (10 bits total): YCbCr[11:2] (2-cycles)
+ - YUV422 BT656 12bit per component (12 bits total): YCbCr[11:0] (2-cycles)
+
+The TDA19973 Video port output pins can be used as follows:
+ - RGB 12bit per color (36 bits total): R[11:0] B[11:0] G[11:0]
+ - YUV444 12bit per color (36 bits total): Y[11:0] Cb[11:0] Cr[11:0]
+ - YUV422 semi-planar 12bit per component (24 bits total): Y[11:0] CbCr[11:0]
+ - YUV422 BT656 12bit per component (12 bits total): YCbCr[11:0] (2-cycles)
+
+The Video port output pins are mapped via 4-bit 'pin groups' allowing
+for a variety of connection possibilities including swapping pin order within
+pin groups. The video_portcfg device-tree property consists of register mapping
+pairs which map a chip-specific VP output register to a 4-bit pin group. If
+the pin group needs to be bit-swapped you can use the *_S pin-group defines.
+
+Required Properties:
+ - compatible  :
+  - "nxp,tda19971" for the TDA19971
+  - "nxp,tda19973" for the TDA19973
+ - reg : I2C slave address
+ - interrupts  : The interrupt number
+ - DOVDD-supply: Digital I/O supply
+ - DVDD-supply : Digital Core supply
+ - AVDD-supply : Analog supply
+ - nxp,vidout-portcfg  : array of pairs mapping VP output pins to pin groups.
+
+Optional Properties:
+ - nxp,audout-format   : DAI bus format: "i2s" or "spdif".
+ - nxp,audout-width: width of audio output data bus (1-4).
+ - nxp,audout-layout   : data layout (0=AP0 used, 1=AP0/AP1/AP2/AP3 used).
+ - nxp,audout-mclk-fs  : Multiplication factor between stream rate and codec
+ mclk.
+
+The port node shall contain one endpoint child node for its digital
+output video port, in accordance with the video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Optional Endpoint Properties:
+  The following three properties are defined in video-interfaces.txt and
+  are valid for the output parallel bus endpoint:
+  - hsync-active: Horizontal synchronization polarity. Defaults to active high.
+  - vsync-active: Vertical synchronization polarity. Defaults to active high.
+  - data-active: Data polarity. Defaults to active high.
+
+Examples:
+ - VP[15:0] connected to IMX6 CSI_DATA[19:4] for 16bit YUV422
+   16bit I2S layout0 with a 128*fs clock (A_WS, AP0, A_CLK pins)
+   hdmi-receiver@48 {
+   compatible = "nxp,tda19971";
+   pinctrl-names = "default";
+   pinctrl-0 = <_tda1997x>;
+   reg = <0x48>;
+   interrupt-parent = <>;
+   interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
+   DOVDD-supply = <_3p3v>;
+   AVDD-supply = <_1p8v>;
+   DVDD-supply = <_1p8v>;
+   /* audio */
+   #sound-dai-cells = <0>;
+   nxp,audout-format = "i2s";
+   nxp,audout-layout = <0>;
+   nxp,audout-width = <16>;
+   nxp,audout-mclk-fs = <128>;
+   /*
+* The 8bpp YUV422 semi-planar mode outputs CbCr[11:4]
+* and Y[11:4] across 16bits in the same pixclk cycle.
+*/
+   nxp,vidout-portcfg =
+   /* Y[11:8]<->VP[15:12]<->CSI_DATA[19:16] */

Re: [RFC 1/5] [media] rc: update sunxi-ir driver to get base frequency from devicetree

2017-12-16 Thread Philipp Rossak

Hey Mauro,

Thanks for your fast feedback!

I will rework the driver like you suggested it.

Does somebody have any concerns about the Devicetree property 
(base-clk-frequency = < frequency >;)?



Regards,
Philipp

On 16.12.2017 10:18, Mauro Carvalho Chehab wrote:

Em Sat, 16 Dec 2017 03:49:10 +0100
Philipp Rossak  escreveu:

Hi Phillip,

This is not a full review of this patchset. I just want to point you
that you should keep supporting existing DT files.


This patch updates the sunxi-ir driver to set the ir base clock from
devicetree.

This is neccessary since there are different ir recievers on the
market, that operate with different frequencys. So this value needs to
be set depending on the attached receiver.


Please don't break backward compatibility with old DT files. In this
specific case, it seems simple enough to be backward-compatible.



Signed-off-by: Philipp Rossak 
---
  drivers/media/rc/sunxi-cir.c | 20 +++-
  1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
index 97f367b446c4..55b53d6463e9 100644
--- a/drivers/media/rc/sunxi-cir.c
+++ b/drivers/media/rc/sunxi-cir.c
@@ -72,12 +72,6 @@
  /* CIR_REG register idle threshold */
  #define REG_CIR_ITHR(val)(((val) << 8) & (GENMASK(15, 8)))
  
-/* Required frequency for IR0 or IR1 clock in CIR mode */

-#define SUNXI_IR_BASE_CLK 800
-/* Frequency after IR internal divider  */
-#define SUNXI_IR_CLK  (SUNXI_IR_BASE_CLK / 64)


Keep those to definitions...


-/* Sample period in ns */
-#define SUNXI_IR_SAMPLE   (10ul / SUNXI_IR_CLK)
  /* Noise threshold in samples  */
  #define SUNXI_IR_RXNOISE  1
  /* Idle Threshold in samples */
@@ -122,7 +116,7 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
/* for each bit in fifo */
dt = readb(ir->base + SUNXI_IR_RXFIFO_REG);
rawir.pulse = (dt & 0x80) != 0;
-   rawir.duration = ((dt & 0x7f) + 1) * SUNXI_IR_SAMPLE;
+   rawir.duration = ((dt & 0x7f) + 1) * 
ir->rc->rx_resolution;
ir_raw_event_store_with_filter(ir->rc, );
}
}
@@ -148,6 +142,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
struct device_node *dn = dev->of_node;
struct resource *res;
struct sunxi_ir *ir;
+   u32 b_clk_freq;
  
  	ir = devm_kzalloc(dev, sizeof(struct sunxi_ir), GFP_KERNEL);

if (!ir)
@@ -172,6 +167,12 @@ static int sunxi_ir_probe(struct platform_device *pdev)
return PTR_ERR(ir->clk);
}
  
+	/* Required frequency for IR0 or IR1 clock in CIR mode */

+   if (of_property_read_u32(dn, "base-clk-frequency", _clk_freq)) {
+   dev_err(dev, "failed to get ir base clock frequency.\n");
+   return -ENODATA;
+   }
+


And here, instead of returning an error, if the property can't be read,
it means it is an older DT file. Just default to SUNXI_IR_BASE_CLK.
This will make it backward-compatible with old DT files that don't have
such property.

Regards,
Mauro



/* Reset (optional) */
ir->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
if (IS_ERR(ir->rst))
@@ -180,7 +181,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
if (ret)
return ret;
  
-	ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK);

+   ret = clk_set_rate(ir->clk, b_clk_freq);
if (ret) {
dev_err(dev, "set ir base clock failed!\n");
goto exit_reset_assert;
@@ -225,7 +226,8 @@ static int sunxi_ir_probe(struct platform_device *pdev)
ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
ir->rc->dev.parent = dev;
ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
-   ir->rc->rx_resolution = SUNXI_IR_SAMPLE;
+   /* Frequency after IR internal divider with sample period in ns */
+   ir->rc->rx_resolution = (10ul / (b_clk_freq / 64));
ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT);
ir->rc->driver_name = SUNXI_IR_DEV;
  


Thanks,
Mauro



Re: [BUG] NULL pointer dereference in pvr2_v4l2_internal_check

2017-12-16 Thread isely

I will do what I can.  Kind of surprising to have something like this 
happen now after so many years of stability.  There must have been some 
kind of environmental change that set this up.

  -Mike


On Sat, 16 Dec 2017, Hans Verkuil wrote:

> Hi Mike,
> 
> Can you take a look?
> 
> Regards,
> 
>   Hans
> 
> On 16/12/17 00:02, Oleksandr Ostrenko wrote:
> > Dear all,
> > 
> > Unplugging the TV tuner (WinTV HVR-1900) from USB port causes a NULL 
> > pointer dereference in pvr2_v4l2_internal_check:
> > 
> > [ 2128.129776] usb 1-1: USB disconnect, device number 6
> > [ 2128.129987] pvrusb2: Device being rendered inoperable
> > [ 2128.130055] BUG: unable to handle kernel NULL pointer dereference at 
> > 0360
> > [ 2128.130082] IP: pvr2_v4l2_internal_check+0x41/0x60 [pvrusb2]
> > [ 2128.130085] PGD 0 P4D 0
> > [ 2128.130092] Oops:  [#1] PREEMPT SMP
> > [ 2128.130097] Modules linked in: tda10048 tda18271 tda8290 tuner 
> > lirc_zilog(C) lirc_dev cx25840 rc_core pvrusb2(O) tveeprom cx2341x dvb_core 
> > v4l2_common rfcomm af_packet 8021q garp mrp stp llc
> > nf_log_ipv6 xt_comment nf_log_ipv4 nf_log_common xt_LOG xt_limit 
> > ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT 
> > nf_reject_ipv4 xt_pkttype xt_tcpudp iptable_filter
> > snd_hda_codec_hdmi ip6table_mangle nf_conntrack_netbios_ns 
> > nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables 
> > xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables bnep arc4 xfs
> > libcrc32c snd_hda_codec_realtek intel_rapl snd_hda_codec_generic 
> > x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm iwlmvm 
> > snd_hda_intel raid1 irqbypass crct10dif_pclmul snd_hda_codec
> > mac80211 crc32_pclmul snd_hda_core
> > [ 2128.130176]  ghash_clmulni_intel snd_hwdep pcbc snd_pcm iwlwifi 
> > snd_timer dell_laptop aesni_intel md_mod hid_multitouch dell_wmi iTCO_wdt 
> > aes_x86_64 snd rtsx_pci_ms iTCO_vendor_support btusb
> > crypto_simd uvcvideo dell_smbios btrtl glue_helper dell_smm_hwmon wmi_bmof 
> > dcdbas joydev hci_uart cryptd pcspkr cfg80211 videobuf2_vmalloc memstick 
> > btbcm serdev videobuf2_memops r8169 btqca soundcore
> > btintel videobuf2_v4l2 mii int3403_thermal i2c_i801 videobuf2_core videodev 
> > bluetooth battery ac sparse_keymap ecdh_generic fan thermal idma64 
> > pinctrl_sunrisepoint pinctrl_intel tpm_crb tpm_tis
> > tpm_tis_core tpm processor_thermal_device intel_lpss_acpi 
> > intel_soc_dts_iosf int3402_thermal dell_rbtn int340x_thermal_zone mei_me 
> > rfkill int3400_thermal intel_lpss_pci acpi_pad mei acpi_thermal_rel
> > intel_lpss intel_pch_thermal
> > [ 2128.130252]  acpi_als kfifo_buf shpchp industrialio btrfs xor 
> > zstd_decompress zstd_compress xxhash hid_generic usbhid i915 raid6_pq 
> > rtsx_pci_sdmmc mmc_core mxm_wmi crc32c_intel i2c_algo_bit
> > drm_kms_helper syscopyarea sysfillrect sysimgblt xhci_pci fb_sys_fops 
> > serio_raw xhci_hcd rtsx_pci drm usbcore wmi video i2c_hid button sg 
> > dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua
> > [ 2128.130300] CPU: 6 PID: 2310 Comm: pvrusb2-context Tainted: G C O
> > 4.14.6-1.g45f120a-default #1
> > [ 2128.130303] Hardware name: Dell Inc. Inspiron 7559/0H0CC0, BIOS 1.1.8 
> > 04/17/2016
> > [ 2128.130306] task: 880cae4f6000 task.stack: b3a7c2548000
> > [ 2128.130320] RIP: 0010:pvr2_v4l2_internal_check+0x41/0x60 [pvrusb2]
> > [ 2128.130324] RSP: 0018:b3a7c254bec8 EFLAGS: 00010246
> > [ 2128.130328] RAX:  RBX: 880caf05e780 RCX: 
> > c0ffe970
> > [ 2128.130331] RDX: 880c90ca1b60 RSI: 0001 RDI: 
> > 
> > [ 2128.130334] RBP: 880cac83eb00 R08: c1016a78 R09: 
> > 03d2
> > [ 2128.130337] R10: 03a9 R11: 003d0900 R12: 
> > b3a7c24ffc18
> > [ 2128.130340] R13: 880cae4f6000 R14:  R15: 
> > c1000ae0
> > [ 2128.130344] FS:  () GS:880cc1d8() 
> > knlGS:
> > [ 2128.130347] CS:  0010 DS:  ES:  CR0: 80050033
> > [ 2128.130350] CR2: 0360 CR3: 00024ec09005 CR4: 
> > 003606e0
> > [ 2128.130354] DR0:  DR1:  DR2: 
> > 
> > [ 2128.130357] DR3:  DR6: fffe0ff0 DR7: 
> > 0400
> > [ 2128.130359] Call Trace:
> > [ 2128.130378]  pvr2_context_thread_func+0xa6/0x2a0 [pvrusb2]
> > [ 2128.130388]  ? finish_wait+0x80/0x80
> > [ 2128.130394]  kthread+0x118/0x130
> > [ 2128.130399]  ? kthread_create_on_node+0x40/0x40
> > [ 2128.130406]  ret_from_fork+0x25/0x30
> > [ 2128.130412] Code: 8b 7f 38 e8 d2 e4 ff ff 48 8b 7b 40 e8 c9 e4 ff ff 48 
> > 8b 43 38 48 8b 90 60 03 00 00 48 05 60 03 00 00 48 39 d0 75 d6 48 8b 43 40 
> > <48> 8b 90 60 03 00 00 48 05 60 03 00 00 48 39 d0
> > 75 c0 48 89 df
> > [ 2128.130491] RIP: pvr2_v4l2_internal_check+0x41/0x60 [pvrusb2] RSP: 
> > b3a7c254bec8
> > [ 2128.130494] CR2: 0360
> > [ 

[BUG] atomisp_ov2680 not initializing correctly

2017-12-16 Thread Kristian Beilke
Dear all,

I am trying to get the cameras in a Lenovo IdeaPad Miix 320 (Atom
x5-Z8350 BayTrail) to work. The front camera is an ov2680. With kernel
4.14.4 and 4.15rc3 I see the following dmesg output:


[   21.469907] ov2680: module is from the staging directory, the quality
 is unknown, you have been warned.
[   21.492774] ov2680 i2c-OVTI2680:00: gmin: initializing atomisp module
subdev data.PMIC ID 1
[   21.492891] acpi OVTI2680:00: Failed to find gmin variable
OVTI2680:00_CamClk
[   21.492974] acpi OVTI2680:00: Failed to find gmin variable
OVTI2680:00_ClkSrc
[   21.493090] acpi OVTI2680:00: Failed to find gmin variable
OVTI2680:00_CsiPort
[   21.493209] acpi OVTI2680:00: Failed to find gmin variable
OVTI2680:00_CsiLanes
[   21.493511] ov2680 i2c-OVTI2680:00: i2c-OVTI2680:00 supply V1P8SX not
found, using dummy regulator
[   21.493550] ov2680 i2c-OVTI2680:00: i2c-OVTI2680:00 supply V2P8SX not
found, using dummy regulator
[   21.493569] ov2680 i2c-OVTI2680:00: i2c-OVTI2680:00 supply V1P2A not
found, using dummy regulator
[   21.493585] ov2680 i2c-OVTI2680:00: i2c-OVTI2680:00 supply VPROG4B
not found, using dummy regulator
[   21.568134] ov2680 i2c-OVTI2680:00: camera pdata: port: 0 lanes: 1
order: 0002
[   21.568257] ov2680 i2c-OVTI2680:00: read from offset 0x300a error -121
[   21.568265] ov2680 i2c-OVTI2680:00: sensor_id_high = 0x
[   21.568269] ov2680 i2c-OVTI2680:00: ov2680_detect err s_config.
[   21.568291] ov2680 i2c-OVTI2680:00: sensor power-gating failed

Afterwards I do not get a camera device.

Am I missing some firmware or dependency? Can I somehow help to improve
the driver?

Regards

Kristian



smime.p7s
Description: S/MIME Cryptographic Signature


Re: Grant

2017-12-16 Thread The Mayrhofer's
My wife and I have awarded you with a donation of $ 1,000,000.00, respond with 
your details for claims.

Best Regards,
Friedrich And Annand Mayrhofer.


Re: [PATCH 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-16 Thread Mauro Carvalho Chehab
Em Sat, 16 Dec 2017 19:53:55 +0800
Jia-Ju Bai  escreveu:

> Hi,
> 
> On 2017/12/15 22:51, Fabien DESSENNE wrote:
> > Hi
> >
> > On 12/12/17 14:47, Jia-Ju Bai wrote:  
> >> The driver may sleep under a spinlock.
> >> The function call path is:
> >> bdisp_device_run (acquire the spinlock)
> >> bdisp_hw_reset
> >>   msleep --> may sleep
> >>
> >> To fix it, msleep is replaced with mdelay.  
> > May I suggest you to use readl_poll_timeout_atomic (instead of the whole
> > "for" block): this fixes the problem and simplifies the code?  
> 
> Okay, I have submitted a patch according to your advice.
> You can have a look :)

This can still be usind mdelay() to wait for a long time.

It doesn't seem wise to do that, as it could cause system
contention. Couldn't this be reworked in a way to avoid
having the spin locked while sleeping?

Once we had a similar issue on Siano, and it was solved by this

commit 3cdadc50bbe8f04c1231c8af614cafd7ddd622bf
Author: Richard Zidlicky 
Date:   Tue Aug 24 09:52:36 2010 -0300

V4L/DVB: dvb: fix smscore_getbuffer() logic

Drivers shouldn't sleep while holding a spinlock. A previous workaround
were to release the spinlock before callinc schedule().

This patch uses a different approach: it just waits for the
siano hardware to answer.

Signed-off-by: Richard Zidlicky 
Cc: sta...@kernel.org
Signed-off-by: Mauro Carvalho Chehab 

The code as changed to use wait_event() at the kthread that was
waiting for data to arrive. Only when the data is ready, the
code with the spin lock is called.

It made the driver a way more stable, and didn't add any penalties
of needing to do long delays on a non-interruptible code.

Thanks,
Mauro


Re: [bug report] drx: add initial drx-d driver

2017-12-16 Thread Mauro Carvalho Chehab
Em Thu, 14 Dec 2017 22:55:02 +0100
Ralph Metzler  escreveu:

> Hello Dan Carpenter,
> 
> Dan Carpenter writes:
>  > Hello Ralph Metzler,
>  > 
>  > The patch 126f1e618870: "drx: add initial drx-d driver" from Mar 12,
>  > 2011, leads to the following static checker warning:
>  > 
>  >drivers/media/dvb-frontends/drxd_hard.c:1305 SC_WaitForReady()
>  >info: return a literal instead of 'status'
>  > 
>  > drivers/media/dvb-frontends/drxd_hard.c
>  >   1298  static int SC_WaitForReady(struct drxd_state *state)
>  >   1299  {
>  >   1300  int i;
>  >   1301  
>  >   1302  for (i = 0; i < DRXD_MAX_RETRIES; i += 1) {
>  >   1303  int status = Read16(state, SC_RA_RAM_CMD__A, NULL, 
> 0);
>  >   1304  if (status == 0)
>  >   1305  return status;
>  > ^
>  > The register is set to zero when ready?  The answer should obviously be
>  > yes, but it wouldn't totally surprise me if this function just always
>  > looped 1000 times...  Few of the callers check the return.  Anyway, it's
>  > more clear to just "return 0;"
>  > 
>  >   1306  }
>  >   1307  return -1;
>  >^^
>  > -1 is not a proper error code.
>  > 
>  >   1308  }
>  > 
>  > regards,
>  > dan carpenter  
> 
> I think I wrote the driver more than 10 years ago and somebody later 
> submitted it
> to the kernel.
> 
> I don't know if there is a anybody still maintaining this. Is it even used 
> anymore?
> I could write a patch but cannot test it (e.g. to see if it really always
> loops 1000 times ...)

It seems that it is used on this board (besides ngene):
EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900_R2
a. k. a.: Hauppauge WinTV HVR 900 (R2)

I might have a HVR-900 rev 2 somewhere, but if so, it is not at the
usual place. I moved a few times since when I touched at the
drxd driver, at the time it was merged upstream. Maybe Michael or
someone at Hauppauge could test a patch for it, if they still have
this device.

Thanks,
Mauro


[PATCH 1/2] media: dvb_frontend: add physical layer scrambling support

2017-12-16 Thread Athanasios Oikonomou
This commit adds a new property DTV_SCRAMBLING_SEQUENCE_INDEX.

This 18 bit field, when present, carries the index of the DVB-S2 physical
layer scrambling sequence as defined in clause 5.5.4 of EN 302 307.
There is no explicit signalling method to convey scrambling sequence index
to the receiver. If S2 satellite delivery system descriptor is available
it can be used to read the scrambling sequence index (EN 300 468 table 41).

By default, gold scrambling sequence index 0 is used. The valid scrambling
sequence index range is from 0 to 262142.

Increase the DVB API version in order userspace to be aware of the changes.

Signed-off-by: Athanasios Oikonomou 
---
 .../media/uapi/dvb/fe_property_parameters.rst  | 18 ++
 .../uapi/dvb/frontend-property-satellite-systems.rst   |  2 ++
 drivers/media/dvb-core/dvb_frontend.c  | 12 
 drivers/media/dvb-core/dvb_frontend.h  |  5 +
 include/uapi/linux/dvb/frontend.h  |  5 -
 include/uapi/linux/dvb/version.h   |  2 +-
 6 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/dvb/fe_property_parameters.rst 
b/Documentation/media/uapi/dvb/fe_property_parameters.rst
index 6eef507..3524dca 100644
--- a/Documentation/media/uapi/dvb/fe_property_parameters.rst
+++ b/Documentation/media/uapi/dvb/fe_property_parameters.rst
@@ -987,3 +987,21 @@ Possible values: 0, 1, LNA_AUTO
 1, LNA on
 
 use the special macro LNA_AUTO to set LNA auto
+
+
+.. _DTV-SCRAMBLING-SEQUENCE-INDEX:
+
+DTV_SCRAMBLING_SEQUENCE_INDEX
+=
+
+Used on DVB-S2.
+
+This 18 bit field, when present, carries the index of the DVB-S2 physical
+layer scrambling sequence as defined in clause 5.5.4 of EN 302 307.
+There is no explicit signalling method to convey scrambling sequence index
+to the receiver. If S2 satellite delivery system descriptor is available
+it can be used to read the scrambling sequence index (EN 300 468 table 41).
+
+By default, gold scrambling sequence index 0 is used.
+
+The valid scrambling sequence index range is from 0 to 262142.
diff --git 
a/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst 
b/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst
index 1f40399..2929e69 100644
--- a/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst
+++ b/Documentation/media/uapi/dvb/frontend-property-satellite-systems.rst
@@ -60,6 +60,8 @@ following parameters:
 
 -  :ref:`DTV_STREAM_ID `
 
+-  :ref:`DTV_SCRAMBLING_SEQUENCE_INDEX `
+
 In addition, the :ref:`DTV QoS statistics `
 are also valid.
 
diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index 2afaa82..e192876 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -982,6 +982,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe)
}
 
c->stream_id = NO_STREAM_ID_FILTER;
+   c->scrambling_sequence_index = 0;/* default sequence */
 
switch (c->delivery_system) {
case SYS_DVBS:
@@ -1072,6 +1073,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {
 
_DTV_CMD(DTV_STREAM_ID, 1, 0),
_DTV_CMD(DTV_DVBT2_PLP_ID_LEGACY, 1, 0),
+   _DTV_CMD(DTV_SCRAMBLING_SEQUENCE_INDEX, 1, 0),
_DTV_CMD(DTV_LNA, 1, 0),
 
/* Get */
@@ -1417,6 +1419,11 @@ static int dtv_property_process_get(struct dvb_frontend 
*fe,
tvp->u.data = c->stream_id;
break;
 
+   /* Physical layer scrambling support */
+   case DTV_SCRAMBLING_SEQUENCE_INDEX:
+   tvp->u.data = c->scrambling_sequence_index;
+   break;
+
/* ATSC-MH */
case DTV_ATSCMH_FIC_VER:
tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver;
@@ -1900,6 +1907,11 @@ static int dtv_property_process_set(struct dvb_frontend 
*fe,
c->stream_id = data;
break;
 
+   /* Physical layer scrambling support */
+   case DTV_SCRAMBLING_SEQUENCE_INDEX:
+   c->scrambling_sequence_index = data;
+   break;
+
/* ATSC-MH */
case DTV_ATSCMH_PARADE_ID:
fe->dtv_property_cache.atscmh_parade_id = data;
diff --git a/drivers/media/dvb-core/dvb_frontend.h 
b/drivers/media/dvb-core/dvb_frontend.h
index ace0c2f..2bc25f1 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -513,6 +513,8 @@ struct dvb_fe_events {
  * @layer.interleaving: per layer interleaving.
  * @stream_id: If different than zero, enable substream filtering, if
  * hardware supports (DVB-S2 and DVB-T2).
+ * @scrambling_sequence_index: Carries the index of the DVB-S2 physical layer
+ * scrambling sequence.
  * @atscmh_fic_ver:Version number of the FIC (Fast Information Channel)
  *

[PATCH 0/2] Support Physical Layer Scrambling

2017-12-16 Thread Athanasios Oikonomou
A new property DTV_SCRAMBLING_SEQUENCE_INDEX introduced to control
the gold sequence that several demods support.

Also the DVB API was increased in order userspace to be aware of the
changes.

The stv090x driver was changed to make use of the new property.

Those commits based on discussion previously made on the mailling list.
https://www.mail-archive.com/linux-media@vger.kernel.org/msg122600.html

I would like to thanks Ralph Metzler (r...@metzlerbros.de) for the
great help and ideas he provide me in order create those patches.

Athanasios Oikonomou (2):
  media: dvb_frontend: add physical layer scrambling support
  media: stv090x: add physical layer scrambling support

 .../media/uapi/dvb/fe_property_parameters.rst  | 18 ++
 .../uapi/dvb/frontend-property-satellite-systems.rst   |  2 ++
 drivers/media/dvb-core/dvb_frontend.c  | 12 
 drivers/media/dvb-core/dvb_frontend.h  |  5 +
 drivers/media/dvb-frontends/stv090x.c  | 16 
 include/uapi/linux/dvb/frontend.h  |  5 -
 include/uapi/linux/dvb/version.h   |  2 +-
 7 files changed, 58 insertions(+), 2 deletions(-)

-- 
2.1.4



[PATCH 2/2] media: stv090x: add physical layer scrambling support

2017-12-16 Thread Athanasios Oikonomou
This commit uses the new property scrambling_sequence_index
to control PLS.
By default we are using the gold sequence 0 and only gold sequences
expected on the new property.

Please note that all services use PLS, just most with the default
sequence 0 and many demods only support gold 0.

Signed-off-by: Athanasios Oikonomou 
---
 drivers/media/dvb-frontends/stv090x.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/media/dvb-frontends/stv090x.c 
b/drivers/media/dvb-frontends/stv090x.c
index 7ef469c..9369a11 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -3429,6 +3429,21 @@ static enum stv090x_signal_state stv090x_algo(struct 
stv090x_state *state)
return -1;
 }
 
+static int stv090x_set_pls(struct stv090x_state *state, u32 pls_code)
+{
+   dprintk(FE_DEBUG, 1, "Set Gold PLS code %d", pls_code);
+   if (STV090x_WRITE_DEMOD(state, PLROOT0, pls_code & 0xff) < 0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, PLROOT1, (pls_code >> 8) & 0xff) < 0)
+   goto err;
+   if (STV090x_WRITE_DEMOD(state, PLROOT2, 0x04 | (pls_code >> 16)) < 0)
+   goto err;
+   return 0;
+err:
+   dprintk(FE_ERROR, 1, "I/O error");
+   return -1;
+}
+
 static int stv090x_set_mis(struct stv090x_state *state, int mis)
 {
u32 reg;
@@ -3491,6 +3506,7 @@ static enum dvbfe_search stv090x_search(struct 
dvb_frontend *fe)
state->search_range = 500;
}
 
+   stv090x_set_pls(state, props->scrambling_sequence_index);
stv090x_set_mis(state, props->stream_id);
 
if (stv090x_algo(state) == STV090x_RANGEOK) {
-- 
2.1.4



Re: [bug report] drx: add initial drx-d driver

2017-12-16 Thread Dan Carpenter
I'm really sorry.  This warning showed up in my new warnings pile and I
didn't look at the date.  :/  Sorry for the noise.

regards,
dan carpenter



Re: [PATCH 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-16 Thread Jia-Ju Bai

Hi,

On 2017/12/15 22:51, Fabien DESSENNE wrote:

Hi

On 12/12/17 14:47, Jia-Ju Bai wrote:

The driver may sleep under a spinlock.
The function call path is:
bdisp_device_run (acquire the spinlock)
bdisp_hw_reset
  msleep --> may sleep

To fix it, msleep is replaced with mdelay.

May I suggest you to use readl_poll_timeout_atomic (instead of the whole
"for" block): this fixes the problem and simplifies the code?


Okay, I have submitted a patch according to your advice.
You can have a look :)


Thanks,
Jia-Ju Bai



This bug is found by my static analysis tool(DSAC) and checked by my code 
review.

Signed-off-by: Jia-Ju Bai 
---
   drivers/media/platform/sti/bdisp/bdisp-hw.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c 
b/drivers/media/platform/sti/bdisp/bdisp-hw.c
index b7892f3..4b62ceb 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
@@ -382,7 +382,7 @@ int bdisp_hw_reset(struct bdisp_dev *bdisp)
for (i = 0; i < POLL_RST_MAX; i++) {
if (readl(bdisp->regs + BLT_STA1) & BLT_STA1_IDLE)
break;
-   msleep(POLL_RST_DELAY_MS);
+   mdelay(POLL_RST_DELAY_MS);
}
if (i == POLL_RST_MAX)
dev_err(bdisp->dev, "Reset timeout\n");




[PATCH V2 1/2] bdisp: Fix a possible sleep-in-atomic bug in bdisp_hw_reset

2017-12-16 Thread Jia-Ju Bai
The driver may sleep under a spinlock.
The function call path is:
bdisp_device_run (acquire the spinlock)
  bdisp_hw_reset
msleep --> may sleep

To fix it, readl_poll_timeout_atomic is used to replace msleep.

This bug is found by my static analysis tool(DSAC) and 
checked by my code review.

Signed-off-by: Jia-Ju Bai 
---
 drivers/media/platform/sti/bdisp/bdisp-hw.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/sti/bdisp/bdisp-hw.c 
b/drivers/media/platform/sti/bdisp/bdisp-hw.c
index b7892f3..e94a371 100644
--- a/drivers/media/platform/sti/bdisp/bdisp-hw.c
+++ b/drivers/media/platform/sti/bdisp/bdisp-hw.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 
 #include "bdisp.h"
 #include "bdisp-filter.h"
@@ -366,7 +367,7 @@ struct bdisp_filter_addr {
  */
 int bdisp_hw_reset(struct bdisp_dev *bdisp)
 {
-   unsigned int i;
+   u32 tmp;
 
dev_dbg(bdisp->dev, "%s\n", __func__);
 
@@ -379,15 +380,14 @@ int bdisp_hw_reset(struct bdisp_dev *bdisp)
writel(0, bdisp->regs + BLT_CTL);
 
/* Wait for reset done */
-   for (i = 0; i < POLL_RST_MAX; i++) {
-   if (readl(bdisp->regs + BLT_STA1) & BLT_STA1_IDLE)
-   break;
-   msleep(POLL_RST_DELAY_MS);
-   }
-   if (i == POLL_RST_MAX)
+   if (readl_poll_timeout_atomic(bdisp->regs + BLT_STA1, tmp,
+   (tmp & BLT_STA1_IDLE), POLL_RST_DELAY_MS,
+   POLL_RST_DELAY_MS * POLL_RST_MAX)) {
dev_err(bdisp->dev, "Reset timeout\n");
+   return -EAGAIN;
+   }
 
-   return (i == POLL_RST_MAX) ? -EAGAIN : 0;
+   return 0;
 }
 
 /**
-- 
1.7.9.5



Re: more build failures

2017-12-16 Thread Mauro Carvalho Chehab
Em Sat, 16 Dec 2017 14:49:41 +1100
Vincent McIntyre  escreveu:

> On Fri, Dec 15, 2017 at 11:41:13PM +1100, Vincent McIntyre wrote:
> > 
> > ...
> > 
> > $ make allyesconfig
> > make -C /home/me/git/clones/media_build/v4l allyesconfig
> > make[1]: Entering directory '/home/me/git/clones/media_build/v4l'
> > No version yet, using 4.4.0-103-generic
> > make[2]: Entering directory '/home/me/git/clones/media_build/linux'
> > Syncing with dir ../media/
> > Applying patches for kernel 4.4.0-103-generic
> > patch -s -f -N -p1 -i ../backports/api_version.patch
> > patch -s -f -N -p1 -i ../backports/pr_fmt.patch
> > patch -s -f -N -p1 -i ../backports/debug.patch
> > patch -s -f -N -p1 -i ../backports/drx39xxj.patch
> > patch -s -f -N -p1 -i ../backports/v4.14_compiler_h.patch
> > patch -s -f -N -p1 -i ../backports/v4.14_saa7146_timer_cast.patch
> > patch -s -f -N -p1 -i ../backports/v4.14_module_param_call.patch
> > patch -s -f -N -p1 -i 
> > ../backports/v4.12_revert_solo6x10_copykerneluser.patch
> > patch -s -f -N -p1 -i ../backports/v4.10_sched_signal.patch
> > 1 out of 1 hunk FAILED
> > The text leading up to this was:
> > --
> > |diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
> > b/drivers/staging/media/lirc/lirc_zilog.c
> > |index 015e41bd036e..fd61081b47d9 100644
> > |--- a/drivers/staging/media/lirc/lirc_zilog.c
> > |+++ b/drivers/staging/media/lirc/lirc_zilog.c
> > --
> > No file to patch.  Skipping patch.
> > 1 out of 1 hunk ignored
> > Makefile:130: recipe for target 'apply_patches' failed
> > make[2]: *** [apply_patches] Error 1
> > make[2]: Leaving directory '/home/me/git/clones/media_build/linux'
> > Makefile:374: recipe for target 'allyesconfig' failed
> > make[1]: *** [allyesconfig] Error 2
> > make[1]: Leaving directory '/home/me/git/clones/media_build/v4l'
> > Makefile:26: recipe for target 'allyesconfig' failed
> > make: *** [allyesconfig] Error 2
> > can't select all drivers at ./build line 525
> > + status=29
> > + date
> > Friday 15 December  23:29:17 AEDT 2017
> > + [ 0 = 29 ]  
> 
> I managed to get past the failure above with this change
> 
>  - media: rc: move ir-lirc-codec.c contents into lirc_dev.c
>media: lirc: remove last remnants of lirc kapi
>  - Sean removed lirc_zilog.c, so it no longer needs patching
> 
> --- a/backports/v4.10_sched_signal.patch
> +++ b/backports/v4.10_sched_signal.patch
> @@ -195,19 +195,6 @@ index 0e8025b7b4dd..8c59d4f53200 100644
>   #include 
>   #include 
>   #include 
> -diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
> -index db1e7b70c998..fc03068e22b5 100644
>  a/drivers/media/rc/lirc_dev.c
> -+++ b/drivers/media/rc/lirc_dev.c
> -@@ -18,7 +18,7 @@
> - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> - 
> - #include 
> --#include 
> -+#include 
> - #include 
> - #include 
> - #include 
>  diff --git a/drivers/media/usb/cpia2/cpia2_core.c 
> b/drivers/media/usb/cpia2/cpia2_core.c
>  index 0efba0da0a45..5d8aa65ab40b 100644
>  --- a/drivers/media/usb/cpia2/cpia2_core.c
> @@ -246,19 +233,6 @@ index 0b5c43f7e020..36bd904946bd 100644
>   #include 
>   #include 
>   
> -diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
> b/drivers/staging/media/lirc/lirc_zilog.c
> -index 015e41bd036e..fd61081b47d9 100644
>  a/drivers/staging/media/lirc/lirc_zilog.c
> -+++ b/drivers/staging/media/lirc/lirc_zilog.c
> -@@ -42,7 +42,7 @@
> - #include 
> - #include 
> - #include 
> --#include 
> -+#include 
> - #include 
> - #include 
> - #include 
> 
> 
> However it falls over later in a way I don't think I can help with.
> 
> ...
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-i2c-core.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-audio.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-encoder.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-video-v4l.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-eeprom.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-main.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-hdw.o
> /home/me/git/clones/media_build/v4l/pvrusb2-hdw.c: In function 
> 'pvr2_send_request_ex':
> /home/me/git/clones/media_build/v4l/pvrusb2-hdw.c:3651:7: error: implicit 
> declaration of function 'usb_urb_ep_type_check' 
> [-Werror=implicit-function-declaration]
>if (usb_urb_ep_type_check(hdw->ctl_write_urb)) {
>^
> cc1: some warnings being treated as errors
> scripts/Makefile.build:258: recipe for target 
> '/home/me/git/clones/media_build/v4l/pvrusb2-hdw.o' failed
> make[3]: *** [/home/me/git/clones/media_build/v4l/pvrusb2-hdw.o] Error 1
> Makefile:1423: recipe for target 
> '_module_/home/me/git/clones/media_build/v4l' failed
> make[2]: *** [_module_/home/me/git/clones/media_build/v4l] Error 2
> make[2]: Leaving directory '/usr/src/linux-headers-4.4.0-103-generic'
> Makefile:51: recipe for target 'default' failed
> make[1]: *** [default] Error 2
> make[1]: Leaving directory 

Re: Grant

2017-12-16 Thread The Mayrhofer's
My wife and I have awarded you with a donation of $ 1,000,000.00, respond with 
your details for claims.

Best Regards,
Friedrich And Annand Mayrhofer.


[PATCH for v4.15] dt-bindings/media/cec-gpio.txt: mention the CEC/HPD max voltages

2017-12-16 Thread Hans Verkuil
Mention the maximum voltages of the CEC and HPD lines. Since in the example
these lines are connected to a Raspberry Pi and the Rpi GPIO lines are 3.3V
it is a good idea to warn against directly connecting the HPD to the Raspberry
Pi's GPIO line.

Signed-off-by: Hans Verkuil 
---
diff --git a/Documentation/devicetree/bindings/media/cec-gpio.txt 
b/Documentation/devicetree/bindings/media/cec-gpio.txt
index 46a0bac8b3b9..b36490aba7eb 100644
--- a/Documentation/devicetree/bindings/media/cec-gpio.txt
+++ b/Documentation/devicetree/bindings/media/cec-gpio.txt
@@ -4,6 +4,10 @@ The HDMI CEC GPIO module supports CEC implementations where 
the CEC line
 is hooked up to a pull-up GPIO line and - optionally - the HPD line is
 hooked up to another GPIO line.

+Please note: the maximum voltage for the CEC line is 3.63V, for the HPD
+line it is 5.3V. So you may need some sort of level conversion circuitry
+when connecting them to a GPIO line.
+
 Required properties:
   - compatible: value must be "cec-gpio".
   - cec-gpios: gpio that the CEC line is connected to. The line should be
@@ -21,7 +25,7 @@ the following property is optional:

 Example for the Raspberry Pi 3 where the CEC line is connected to
 pin 26 aka BCM7 aka CE1 on the GPIO pin header and the HPD line is
-connected to pin 11 aka BCM17:
+connected to pin 11 aka BCM17 (some level shifter is needed for this!):

 #include 




Re: more build failures

2017-12-16 Thread Hans Verkuil
Hi Vincent,

A lot of code has been merged this week and more is in the pipeline for next 
week.
I'd rather wait until that's in before looking at build failures.

Regards,

Hans

On 16/12/17 04:49, Vincent McIntyre wrote:
> On Fri, Dec 15, 2017 at 11:41:13PM +1100, Vincent McIntyre wrote:
>>
>> ...
>>
>> $ make allyesconfig
>> make -C /home/me/git/clones/media_build/v4l allyesconfig
>> make[1]: Entering directory '/home/me/git/clones/media_build/v4l'
>> No version yet, using 4.4.0-103-generic
>> make[2]: Entering directory '/home/me/git/clones/media_build/linux'
>> Syncing with dir ../media/
>> Applying patches for kernel 4.4.0-103-generic
>> patch -s -f -N -p1 -i ../backports/api_version.patch
>> patch -s -f -N -p1 -i ../backports/pr_fmt.patch
>> patch -s -f -N -p1 -i ../backports/debug.patch
>> patch -s -f -N -p1 -i ../backports/drx39xxj.patch
>> patch -s -f -N -p1 -i ../backports/v4.14_compiler_h.patch
>> patch -s -f -N -p1 -i ../backports/v4.14_saa7146_timer_cast.patch
>> patch -s -f -N -p1 -i ../backports/v4.14_module_param_call.patch
>> patch -s -f -N -p1 -i ../backports/v4.12_revert_solo6x10_copykerneluser.patch
>> patch -s -f -N -p1 -i ../backports/v4.10_sched_signal.patch
>> 1 out of 1 hunk FAILED
>> The text leading up to this was:
>> --
>> |diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
>> b/drivers/staging/media/lirc/lirc_zilog.c
>> |index 015e41bd036e..fd61081b47d9 100644
>> |--- a/drivers/staging/media/lirc/lirc_zilog.c
>> |+++ b/drivers/staging/media/lirc/lirc_zilog.c
>> --
>> No file to patch.  Skipping patch.
>> 1 out of 1 hunk ignored
>> Makefile:130: recipe for target 'apply_patches' failed
>> make[2]: *** [apply_patches] Error 1
>> make[2]: Leaving directory '/home/me/git/clones/media_build/linux'
>> Makefile:374: recipe for target 'allyesconfig' failed
>> make[1]: *** [allyesconfig] Error 2
>> make[1]: Leaving directory '/home/me/git/clones/media_build/v4l'
>> Makefile:26: recipe for target 'allyesconfig' failed
>> make: *** [allyesconfig] Error 2
>> can't select all drivers at ./build line 525
>> + status=29
>> + date
>> Friday 15 December  23:29:17 AEDT 2017
>> + [ 0 = 29 ]
> 
> I managed to get past the failure above with this change
> 
>  - media: rc: move ir-lirc-codec.c contents into lirc_dev.c
>media: lirc: remove last remnants of lirc kapi
>  - Sean removed lirc_zilog.c, so it no longer needs patching
> 
> --- a/backports/v4.10_sched_signal.patch
> +++ b/backports/v4.10_sched_signal.patch
> @@ -195,19 +195,6 @@ index 0e8025b7b4dd..8c59d4f53200 100644
>   #include 
>   #include 
>   #include 
> -diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
> -index db1e7b70c998..fc03068e22b5 100644
>  a/drivers/media/rc/lirc_dev.c
> -+++ b/drivers/media/rc/lirc_dev.c
> -@@ -18,7 +18,7 @@
> - #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> - 
> - #include 
> --#include 
> -+#include 
> - #include 
> - #include 
> - #include 
>  diff --git a/drivers/media/usb/cpia2/cpia2_core.c 
> b/drivers/media/usb/cpia2/cpia2_core.c
>  index 0efba0da0a45..5d8aa65ab40b 100644
>  --- a/drivers/media/usb/cpia2/cpia2_core.c
> @@ -246,19 +233,6 @@ index 0b5c43f7e020..36bd904946bd 100644
>   #include 
>   #include 
>   
> -diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
> b/drivers/staging/media/lirc/lirc_zilog.c
> -index 015e41bd036e..fd61081b47d9 100644
>  a/drivers/staging/media/lirc/lirc_zilog.c
> -+++ b/drivers/staging/media/lirc/lirc_zilog.c
> -@@ -42,7 +42,7 @@
> - #include 
> - #include 
> - #include 
> --#include 
> -+#include 
> - #include 
> - #include 
> - #include 
> 
> 
> However it falls over later in a way I don't think I can help with.
> 
> ...
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-i2c-core.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-audio.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-encoder.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-video-v4l.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-eeprom.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-main.o
>   CC [M]  /home/me/git/clones/media_build/v4l/pvrusb2-hdw.o
> /home/me/git/clones/media_build/v4l/pvrusb2-hdw.c: In function 
> 'pvr2_send_request_ex':
> /home/me/git/clones/media_build/v4l/pvrusb2-hdw.c:3651:7: error: implicit 
> declaration of function 'usb_urb_ep_type_check' 
> [-Werror=implicit-function-declaration]
>if (usb_urb_ep_type_check(hdw->ctl_write_urb)) {
>^
> cc1: some warnings being treated as errors
> scripts/Makefile.build:258: recipe for target 
> '/home/me/git/clones/media_build/v4l/pvrusb2-hdw.o' failed
> make[3]: *** [/home/me/git/clones/media_build/v4l/pvrusb2-hdw.o] Error 1
> Makefile:1423: recipe for target 
> '_module_/home/me/git/clones/media_build/v4l' failed
> make[2]: *** [_module_/home/me/git/clones/media_build/v4l] Error 2
> make[2]: Leaving directory '/usr/src/linux-headers-4.4.0-103-generic'
> Makefile:51: recipe for 

Re: [BUG] NULL pointer dereference in pvr2_v4l2_internal_check

2017-12-16 Thread Hans Verkuil
Hi Mike,

Can you take a look?

Regards,

Hans

On 16/12/17 00:02, Oleksandr Ostrenko wrote:
> Dear all,
> 
> Unplugging the TV tuner (WinTV HVR-1900) from USB port causes a NULL pointer 
> dereference in pvr2_v4l2_internal_check:
> 
> [ 2128.129776] usb 1-1: USB disconnect, device number 6
> [ 2128.129987] pvrusb2: Device being rendered inoperable
> [ 2128.130055] BUG: unable to handle kernel NULL pointer dereference at 
> 0360
> [ 2128.130082] IP: pvr2_v4l2_internal_check+0x41/0x60 [pvrusb2]
> [ 2128.130085] PGD 0 P4D 0
> [ 2128.130092] Oops:  [#1] PREEMPT SMP
> [ 2128.130097] Modules linked in: tda10048 tda18271 tda8290 tuner 
> lirc_zilog(C) lirc_dev cx25840 rc_core pvrusb2(O) tveeprom cx2341x dvb_core 
> v4l2_common rfcomm af_packet 8021q garp mrp stp llc
> nf_log_ipv6 xt_comment nf_log_ipv4 nf_log_common xt_LOG xt_limit ip6t_REJECT 
> nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT nf_reject_ipv4 
> xt_pkttype xt_tcpudp iptable_filter
> snd_hda_codec_hdmi ip6table_mangle nf_conntrack_netbios_ns 
> nf_conntrack_broadcast nf_conntrack_ipv4 nf_defrag_ipv4 ip_tables 
> xt_conntrack nf_conntrack ip6table_filter ip6_tables x_tables bnep arc4 xfs
> libcrc32c snd_hda_codec_realtek intel_rapl snd_hda_codec_generic 
> x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm iwlmvm 
> snd_hda_intel raid1 irqbypass crct10dif_pclmul snd_hda_codec
> mac80211 crc32_pclmul snd_hda_core
> [ 2128.130176]  ghash_clmulni_intel snd_hwdep pcbc snd_pcm iwlwifi snd_timer 
> dell_laptop aesni_intel md_mod hid_multitouch dell_wmi iTCO_wdt aes_x86_64 
> snd rtsx_pci_ms iTCO_vendor_support btusb
> crypto_simd uvcvideo dell_smbios btrtl glue_helper dell_smm_hwmon wmi_bmof 
> dcdbas joydev hci_uart cryptd pcspkr cfg80211 videobuf2_vmalloc memstick 
> btbcm serdev videobuf2_memops r8169 btqca soundcore
> btintel videobuf2_v4l2 mii int3403_thermal i2c_i801 videobuf2_core videodev 
> bluetooth battery ac sparse_keymap ecdh_generic fan thermal idma64 
> pinctrl_sunrisepoint pinctrl_intel tpm_crb tpm_tis
> tpm_tis_core tpm processor_thermal_device intel_lpss_acpi intel_soc_dts_iosf 
> int3402_thermal dell_rbtn int340x_thermal_zone mei_me rfkill int3400_thermal 
> intel_lpss_pci acpi_pad mei acpi_thermal_rel
> intel_lpss intel_pch_thermal
> [ 2128.130252]  acpi_als kfifo_buf shpchp industrialio btrfs xor 
> zstd_decompress zstd_compress xxhash hid_generic usbhid i915 raid6_pq 
> rtsx_pci_sdmmc mmc_core mxm_wmi crc32c_intel i2c_algo_bit
> drm_kms_helper syscopyarea sysfillrect sysimgblt xhci_pci fb_sys_fops 
> serio_raw xhci_hcd rtsx_pci drm usbcore wmi video i2c_hid button sg 
> dm_multipath dm_mod scsi_dh_rdac scsi_dh_emc scsi_dh_alua
> [ 2128.130300] CPU: 6 PID: 2310 Comm: pvrusb2-context Tainted: G C O
> 4.14.6-1.g45f120a-default #1
> [ 2128.130303] Hardware name: Dell Inc. Inspiron 7559/0H0CC0, BIOS 1.1.8 
> 04/17/2016
> [ 2128.130306] task: 880cae4f6000 task.stack: b3a7c2548000
> [ 2128.130320] RIP: 0010:pvr2_v4l2_internal_check+0x41/0x60 [pvrusb2]
> [ 2128.130324] RSP: 0018:b3a7c254bec8 EFLAGS: 00010246
> [ 2128.130328] RAX:  RBX: 880caf05e780 RCX: 
> c0ffe970
> [ 2128.130331] RDX: 880c90ca1b60 RSI: 0001 RDI: 
> 
> [ 2128.130334] RBP: 880cac83eb00 R08: c1016a78 R09: 
> 03d2
> [ 2128.130337] R10: 03a9 R11: 003d0900 R12: 
> b3a7c24ffc18
> [ 2128.130340] R13: 880cae4f6000 R14:  R15: 
> c1000ae0
> [ 2128.130344] FS:  () GS:880cc1d8() 
> knlGS:
> [ 2128.130347] CS:  0010 DS:  ES:  CR0: 80050033
> [ 2128.130350] CR2: 0360 CR3: 00024ec09005 CR4: 
> 003606e0
> [ 2128.130354] DR0:  DR1:  DR2: 
> 
> [ 2128.130357] DR3:  DR6: fffe0ff0 DR7: 
> 0400
> [ 2128.130359] Call Trace:
> [ 2128.130378]  pvr2_context_thread_func+0xa6/0x2a0 [pvrusb2]
> [ 2128.130388]  ? finish_wait+0x80/0x80
> [ 2128.130394]  kthread+0x118/0x130
> [ 2128.130399]  ? kthread_create_on_node+0x40/0x40
> [ 2128.130406]  ret_from_fork+0x25/0x30
> [ 2128.130412] Code: 8b 7f 38 e8 d2 e4 ff ff 48 8b 7b 40 e8 c9 e4 ff ff 48 8b 
> 43 38 48 8b 90 60 03 00 00 48 05 60 03 00 00 48 39 d0 75 d6 48 8b 43 40 <48> 
> 8b 90 60 03 00 00 48 05 60 03 00 00 48 39 d0
> 75 c0 48 89 df
> [ 2128.130491] RIP: pvr2_v4l2_internal_check+0x41/0x60 [pvrusb2] RSP: 
> b3a7c254bec8
> [ 2128.130494] CR2: 0360
> [ 2128.130499] ---[ end trace b7d1a2a4867177f2 ]---
> 
> Upon reconnect the device is no longer recognized by the driver and no 
> firmware is uploaded:
> 
> [ 2135.323115] usb 1-1: new high-speed USB device number 7 using xhci_hcd
> [ 2135.481292] usb 1-1: New USB device found, idVendor=2040, idProduct=7300
> [ 2135.481302] usb 1-1: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=3
> [ 2135.481306] usb 1-1: Product: 

Re: [RFC 1/5] [media] rc: update sunxi-ir driver to get base frequency from devicetree

2017-12-16 Thread Mauro Carvalho Chehab
Em Sat, 16 Dec 2017 03:49:10 +0100
Philipp Rossak  escreveu:

Hi Phillip,

This is not a full review of this patchset. I just want to point you
that you should keep supporting existing DT files.

> This patch updates the sunxi-ir driver to set the ir base clock from
> devicetree.
> 
> This is neccessary since there are different ir recievers on the
> market, that operate with different frequencys. So this value needs to
> be set depending on the attached receiver.

Please don't break backward compatibility with old DT files. In this
specific case, it seems simple enough to be backward-compatible.

> 
> Signed-off-by: Philipp Rossak 
> ---
>  drivers/media/rc/sunxi-cir.c | 20 +++-
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
> index 97f367b446c4..55b53d6463e9 100644
> --- a/drivers/media/rc/sunxi-cir.c
> +++ b/drivers/media/rc/sunxi-cir.c
> @@ -72,12 +72,6 @@
>  /* CIR_REG register idle threshold */
>  #define REG_CIR_ITHR(val)(((val) << 8) & (GENMASK(15, 8)))
>  
> -/* Required frequency for IR0 or IR1 clock in CIR mode */
> -#define SUNXI_IR_BASE_CLK 800
> -/* Frequency after IR internal divider  */
> -#define SUNXI_IR_CLK  (SUNXI_IR_BASE_CLK / 64)

Keep those to definitions...

> -/* Sample period in ns */
> -#define SUNXI_IR_SAMPLE   (10ul / SUNXI_IR_CLK)
>  /* Noise threshold in samples  */
>  #define SUNXI_IR_RXNOISE  1
>  /* Idle Threshold in samples */
> @@ -122,7 +116,7 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id)
>   /* for each bit in fifo */
>   dt = readb(ir->base + SUNXI_IR_RXFIFO_REG);
>   rawir.pulse = (dt & 0x80) != 0;
> - rawir.duration = ((dt & 0x7f) + 1) * SUNXI_IR_SAMPLE;
> + rawir.duration = ((dt & 0x7f) + 1) * 
> ir->rc->rx_resolution;
>   ir_raw_event_store_with_filter(ir->rc, );
>   }
>   }
> @@ -148,6 +142,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>   struct device_node *dn = dev->of_node;
>   struct resource *res;
>   struct sunxi_ir *ir;
> + u32 b_clk_freq;
>  
>   ir = devm_kzalloc(dev, sizeof(struct sunxi_ir), GFP_KERNEL);
>   if (!ir)
> @@ -172,6 +167,12 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>   return PTR_ERR(ir->clk);
>   }
>  
> + /* Required frequency for IR0 or IR1 clock in CIR mode */
> + if (of_property_read_u32(dn, "base-clk-frequency", _clk_freq)) {
> + dev_err(dev, "failed to get ir base clock frequency.\n");
> + return -ENODATA;
> + }
> +

And here, instead of returning an error, if the property can't be read, 
it means it is an older DT file. Just default to SUNXI_IR_BASE_CLK. 
This will make it backward-compatible with old DT files that don't have
such property.

Regards,
Mauro


>   /* Reset (optional) */
>   ir->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
>   if (IS_ERR(ir->rst))
> @@ -180,7 +181,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>   if (ret)
>   return ret;
>  
> - ret = clk_set_rate(ir->clk, SUNXI_IR_BASE_CLK);
> + ret = clk_set_rate(ir->clk, b_clk_freq);
>   if (ret) {
>   dev_err(dev, "set ir base clock failed!\n");
>   goto exit_reset_assert;
> @@ -225,7 +226,8 @@ static int sunxi_ir_probe(struct platform_device *pdev)
>   ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
>   ir->rc->dev.parent = dev;
>   ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
> - ir->rc->rx_resolution = SUNXI_IR_SAMPLE;
> + /* Frequency after IR internal divider with sample period in ns */
> + ir->rc->rx_resolution = (10ul / (b_clk_freq / 64));
>   ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT);
>   ir->rc->driver_name = SUNXI_IR_DEV;
>  

Thanks,
Mauro