Re: [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped

2015-04-23 Thread Tycho Lürsen

One more question:

cx23885-dvb.c (and maybe others) contains a couple of instances of

si2168_config.ts_mode = SI2168_TS_PARALLEL;
and
si2168_config.ts_mode = SI2168_TS_SERIAL;

But you don't patch them with

si2168_config.ts_clock_gapped = true;

Is this intentional?

Kind regards,
Tycho

Op 23-04-15 om 23:11 schreef Olli Salonen:

Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen 
---
  drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index cdf59bc..0f73b1d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
memset(&si2168_config, 0, sizeof(si2168_config));
si2168_config.i2c_adapter = &i2c_adapter;
si2168_config.fe = &adap->fe[0];
-   si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2168", I2C_NAME_SIZE);
info.addr = 0x64;


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


Re: Missing additional V4L2 caps in cx18

2015-04-23 Thread Hans Verkuil
Hi Laura,

Thanks for the report. I've made a patch and CC-ed you on it.
The TS and IDX streams are internal (i.e., they do not map to a V4L2
device node), but the PCM stream isn't, and that's the one causing the
warning.

Regards,

Hans

On 04/23/2015 07:57 PM, Laura Abbott wrote:
> Hi,
> 
> We received a report of a backtrace from v4l2 with
> the cx18 module:
> 
> 
> [6.229393] [ cut here ]
> [6.229414] WARNING: CPU: 1 PID: 593 at 
> drivers/media/v4l2-core/v4l2-ioctl.c:1025 v4l_querycap+0x41/0x70 
> [videodev]()
> [6.229415] Modules linked in: cx18_alsa mxl5005s s5h1409 
> tuner_simple tuner_types cs5345 tuner intel_rapl iosf_mbi 
> x86_pkg_temp_thermal coretemp raid1 snd_hda_codec_realtek kvm_intel 
> snd_hda_codec_generic snd_hda_codec_hdmi kvm snd_oxygen(+) snd_hda_intel 
> snd_oxygen_lib snd_hda_controller snd_hda_codec snd_mpu401_uart iTCO_wdt 
> snd_rawmidi iTCO_vendor_support snd_hwdep crct10dif_pclmul crc32_pclmul 
> crc32c_intel snd_seq cx18 snd_seq_device ghash_clmulni_intel 
> videobuf_vmalloc tveeprom cx2341x snd_pcm serio_raw videobuf_core vfat 
> dvb_core fat v4l2_common snd_timer videodev snd lpc_ich i2c_i801 joydev 
> mfd_core mei_me media soundcore tpm_infineon soc_button_array tpm_tis 
> mei shpchp tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc binfmt_misc 
> i915 nouveau mxm_wmi wmi e1000e ttm i2c_algo_bit drm_kms_helper
> [6.229444]  drm ptp pps_core video
> [6.229446] CPU: 1 PID: 593 Comm: v4l_id Not tainted 
> 3.19.3-200.fc21.x86_64 #1
> [6.229447] Hardware name: Gigabyte Technology Co., Ltd. 
> Z87-D3HP/Z87-D3HP-CF, BIOS F6 01/20/2014
> [6.229448]   d12b1131 88042dacfc28 
> 8176e215
> [6.229449]    88042dacfc68 
> 8109bc1a
> [6.229451]  a0594000 88042dacfd90  
> a04e2140
> [6.229452] Call Trace:
> [6.229466]  [] dump_stack+0x45/0x57
> [6.229469]  [] warn_slowpath_common+0x8a/0xc0
> [6.229472]  [] warn_slowpath_null+0x1a/0x20
> [6.229474]  [] v4l_querycap+0x41/0x70 [videodev]
> [6.229477]  [] __video_do_ioctl+0x29c/0x320 [videodev]
> [6.229479]  [] ? do_last+0x2f1/0x1210
> [6.229491]  [] video_usercopy+0x366/0x5d0 [videodev]
> [6.229494]  [] ? v4l_querycap+0x70/0x70 [videodev]
> [6.229497]  [] video_ioctl2+0x15/0x20 [videodev]
> [6.229499]  [] v4l2_ioctl+0x164/0x180 [videodev]
> [6.229501]  [] do_vfs_ioctl+0x2f8/0x500
> [6.229502]  [] SyS_ioctl+0x81/0xa0
> [6.229505]  [] system_call_fastpath+0x12/0x17
> [6.229506] ---[ end trace dacd80d4b19277ea ]---
> 
> This is the warning about querycap not filling device_caps properly.
> The tree has dfdf780b4651cf4932b96d3fe296230afacc360a
> ('[media] cx18: add device_caps support') present already but
> I noticed several of the streams types are missing capabilities
> in cx18-streams.c (CX18_ENC_STREAM_TYPE_TS, CX18_ENC_STREAM_TYPE_PCM,
> CX18_ENC_STREAM_TYPE_IDX)
> 
> Do these need to have proper capabilities added as well to silence
> this warning?
> 
> Thanks,
> Laura
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


[PATCH] cx18: add missing caps for the PCM video device

2015-04-23 Thread Hans Verkuil
The cx18 PCM video device didn't have any capabilities set, which caused a 
warnings
in the v4l2 core:

[6.229393] [ cut here ]
[6.229414] WARNING: CPU: 1 PID: 593 at 
drivers/media/v4l2-core/v4l2-ioctl.c:1025 v4l_querycap+0x41/0x70 
[videodev]()
[6.229415] Modules linked in: cx18_alsa mxl5005s s5h1409 
tuner_simple tuner_types cs5345 tuner intel_rapl iosf_mbi 
x86_pkg_temp_thermal coretemp raid1 snd_hda_codec_realtek kvm_intel 
snd_hda_codec_generic snd_hda_codec_hdmi kvm snd_oxygen(+) snd_hda_intel 
snd_oxygen_lib snd_hda_controller snd_hda_codec snd_mpu401_uart iTCO_wdt 
snd_rawmidi iTCO_vendor_support snd_hwdep crct10dif_pclmul crc32_pclmul 
crc32c_intel snd_seq cx18 snd_seq_device ghash_clmulni_intel 
videobuf_vmalloc tveeprom cx2341x snd_pcm serio_raw videobuf_core vfat 
dvb_core fat v4l2_common snd_timer videodev snd lpc_ich i2c_i801 joydev 
mfd_core mei_me media soundcore tpm_infineon soc_button_array tpm_tis 
mei shpchp tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc binfmt_misc 
i915 nouveau mxm_wmi wmi e1000e ttm i2c_algo_bit drm_kms_helper
[6.229444]  drm ptp pps_core video
[6.229446] CPU: 1 PID: 593 Comm: v4l_id Not tainted 
3.19.3-200.fc21.x86_64 #1
[6.229447] Hardware name: Gigabyte Technology Co., Ltd. 
Z87-D3HP/Z87-D3HP-CF, BIOS F6 01/20/2014
[6.229448]   d12b1131 88042dacfc28 
8176e215
[6.229449]    88042dacfc68 
8109bc1a
[6.229451]  a0594000 88042dacfd90  
a04e2140
[6.229452] Call Trace:
[6.229466]  [] dump_stack+0x45/0x57
[6.229469]  [] warn_slowpath_common+0x8a/0xc0
[6.229472]  [] warn_slowpath_null+0x1a/0x20
[6.229474]  [] v4l_querycap+0x41/0x70 [videodev]
[6.229477]  [] __video_do_ioctl+0x29c/0x320 [videodev]
[6.229479]  [] ? do_last+0x2f1/0x1210
[6.229491]  [] video_usercopy+0x366/0x5d0 [videodev]
[6.229494]  [] ? v4l_querycap+0x70/0x70 [videodev]
[6.229497]  [] video_ioctl2+0x15/0x20 [videodev]
[6.229499]  [] v4l2_ioctl+0x164/0x180 [videodev]
[6.229501]  [] do_vfs_ioctl+0x2f8/0x500
[6.229502]  [] SyS_ioctl+0x81/0xa0
[6.229505]  [] system_call_fastpath+0x12/0x17
[6.229506] ---[ end trace dacd80d4b19277ea ]---

Added the necessary capabilities to stop this warning.

Signed-off-by: Hans Verkuil 
Reported-by: Laura Abbott 
Cc:   # for v3.19 and up
---
diff --git a/drivers/media/pci/cx18/cx18-streams.c 
b/drivers/media/pci/cx18/cx18-streams.c
index c82d25d..c986084 100644
--- a/drivers/media/pci/cx18/cx18-streams.c
+++ b/drivers/media/pci/cx18/cx18-streams.c
@@ -90,6 +90,7 @@ static struct {
"encoder PCM audio",
VFL_TYPE_GRABBER, CX18_V4L2_ENC_PCM_OFFSET,
PCI_DMA_FROMDEVICE,
+   V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE,
},
{   /* CX18_ENC_STREAM_TYPE_IDX */
"encoder IDX",
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation

2015-04-23 Thread Hans Verkuil
Hi Philipp,

Thank you for the patch, but I have one question:

On 04/23/2015 03:52 PM, Philipp Zabel wrote:
> Use the VIVID_WEBCAM_SIZES constant where appropriate and add a 1920x1080 
> pixel
> frame size setting with frame rates of 2 fps and 5 fps.

Why add both 2 and 5 fps? Is there a reason why you want both of those fps 
values?

Just wondering.

Regards,

Hans

> 
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/media/platform/vivid/vivid-vid-cap.c | 13 -
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c 
> b/drivers/media/platform/vivid/vivid-vid-cap.c
> index 867a29a..468b8b5 100644
> --- a/drivers/media/platform/vivid/vivid-vid-cap.c
> +++ b/drivers/media/platform/vivid/vivid-vid-cap.c
> @@ -60,7 +60,7 @@ static const struct vivid_fmt formats_ovl[] = {
>  };
>  
>  /* The number of discrete webcam framesizes */
> -#define VIVID_WEBCAM_SIZES 3
> +#define VIVID_WEBCAM_SIZES 4
>  /* The number of discrete webcam frameintervals */
>  #define VIVID_WEBCAM_IVALS (VIVID_WEBCAM_SIZES * 2)
>  
> @@ -69,6 +69,7 @@ static const struct v4l2_frmsize_discrete 
> webcam_sizes[VIVID_WEBCAM_SIZES] = {
>   {  320, 180 },
>   {  640, 360 },
>   { 1280, 720 },
> + { 1920, 1080 },
>  };
>  
>  /*
> @@ -76,6 +77,8 @@ static const struct v4l2_frmsize_discrete 
> webcam_sizes[VIVID_WEBCAM_SIZES] = {
>   * elements in this array as there are in webcam_sizes.
>   */
>  static const struct v4l2_fract webcam_intervals[VIVID_WEBCAM_IVALS] = {
> + {  1, 2 },
> + {  1, 5 },
>   {  1, 10 },
>   {  1, 15 },
>   {  1, 25 },
> @@ -715,8 +718,8 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
>   webcam_sizes[i].height == mp->height)
>   break;
>   dev->webcam_size_idx = i;
> - if (dev->webcam_ival_idx >= 2 * (3 - i))
> - dev->webcam_ival_idx = 2 * (3 - i) - 1;
> + if (dev->webcam_ival_idx >= 2 * (VIVID_WEBCAM_SIZES - i))
> + dev->webcam_ival_idx = 2 * (VIVID_WEBCAM_SIZES - i) - 1;
>   vivid_update_format_cap(dev, false);
>   } else {
>   struct v4l2_rect r = { 0, 0, mp->width, mp->height };
> @@ -1684,7 +1687,7 @@ int vidioc_enum_frameintervals(struct file *file, void 
> *priv,
>   break;
>   if (i == ARRAY_SIZE(webcam_sizes))
>   return -EINVAL;
> - if (fival->index >= 2 * (3 - i))
> + if (fival->index >= 2 * (VIVID_WEBCAM_SIZES - i))
>   return -EINVAL;
>   fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
>   fival->discrete = webcam_intervals[fival->index];
> @@ -1714,7 +1717,7 @@ int vivid_vid_cap_s_parm(struct file *file, void *priv,
> struct v4l2_streamparm *parm)
>  {
>   struct vivid_dev *dev = video_drvdata(file);
> - unsigned ival_sz = 2 * (3 - dev->webcam_size_idx);
> + unsigned ival_sz = 2 * (VIVID_WEBCAM_SIZES - dev->webcam_size_idx);
>   struct v4l2_fract tpf;
>   unsigned i;
>  
> 

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


Re: [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped

2015-04-23 Thread Tycho Lürsen

Hi Olli,
in saa716x_budget.c I've also got (for TBS6285)

si2168_config.i2c_adapter = &i2cadapter;
si2168_config.fe = &adapter->fe;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));

Should I just add it like this?

si2168_config.ts_mode = SI2168_TS_SERIAL;
si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));

Kind regards,
Tycho.

Op 23-04-15 om 23:11 schreef Olli Salonen:

Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen 
---
  drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index cdf59bc..0f73b1d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
memset(&si2168_config, 0, sizeof(si2168_config));
si2168_config.i2c_adapter = &i2c_adapter;
si2168_config.fe = &adap->fe[0];
-   si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2168", I2C_NAME_SIZE);
info.addr = 0x64;


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


Re: [PATCH 03/12] si2157: support selection of IF interface

2015-04-23 Thread Mauro Carvalho Chehab
Hi Olli,

Em Fri, 24 Apr 2015 00:11:02 +0300
Olli Salonen  escreveu:

> The chips supported by the si2157 driver have two IF outputs (either
> pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
> add an option to choose which output shall be used.
> 
> Signed-off-by: Olli Salonen 
> ---
>  drivers/media/tuners/si2157.c  | 4 +++-
>  drivers/media/tuners/si2157.h  | 6 ++
>  drivers/media/tuners/si2157_priv.h | 1 +
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index d74ae26..cdaf687 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
>   if (dev->chiptype == SI2157_CHIPTYPE_SI2146)
>   memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
>   else
> - memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
> + memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6);

As you're changing the default, you should fold the patches that use
si2157_config.if_port = 1 on this patch (e.g. patches 4-10), as we don't
want to break git bisectability.

Regards,
Mauro



> + cmd.args[4] = dev->if_port;
>   cmd.wlen = 6;
>   cmd.rlen = 4;
>   ret = si2157_cmd_execute(client, &cmd);
> @@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
>   i2c_set_clientdata(client, dev);
>   dev->fe = cfg->fe;
>   dev->inversion = cfg->inversion;
> + dev->if_port = cfg->if_port;
>   dev->fw_loaded = false;
>   dev->chiptype = (u8)id->driver_data;
>   dev->if_frequency = 500; /* default value of property 0x0706 */
> diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
> index a564c4a..4db97ab 100644
> --- a/drivers/media/tuners/si2157.h
> +++ b/drivers/media/tuners/si2157.h
> @@ -34,6 +34,12 @@ struct si2157_config {
>* Spectral Inversion
>*/
>   bool inversion;
> +
> + /*
> +  * Port selection
> +  * Select the RF interface to use (pins 9+11 or 12+13)
> +  */
> + u8 if_port;
>  };
>  
>  #endif
> diff --git a/drivers/media/tuners/si2157_priv.h 
> b/drivers/media/tuners/si2157_priv.h
> index cd8fa5b..71a5f8c 100644
> --- a/drivers/media/tuners/si2157_priv.h
> +++ b/drivers/media/tuners/si2157_priv.h
> @@ -28,6 +28,7 @@ struct si2157_dev {
>   bool fw_loaded;
>   bool inversion;
>   u8 chiptype;
> + u8 if_port;
>   u32 if_frequency;
>  };
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

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

Results of the daily build of media_tree:

date:   Fri Apr 24 04:00:16 CEST 2015
git branch: test
git hash:   e183201b9e917daf2530b637b2f34f1d5afb934d
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.19.0-1.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
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: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-rc1-i686: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
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: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner

2015-04-23 Thread Benjamin Larsson

On 04/23/2015 11:11 PM, Olli Salonen wrote:

GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.

It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20


[...]


For some reason, the old I2C write method sporadically failed. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.


Hi, I also experienced this with the Astrometa stick. I guess the 
new_i2c_write flag should be set on those devices also.


Do you plan on adding pid filter support also? I posted a non working 
rfc patch you could base it on.


MvH
Benjamin Larsson


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


Re: [PATCH v5 06/10] media: Add registration helpers for V4L2 flash sub-devices

2015-04-23 Thread Sakari Ailus
Hi Jacek,

Jacek Anaszewski wrote:
...
>>> +#define call_flash_op(v4l2_flash, op, arg) \
>>> +   (has_flash_op(v4l2_flash,
>>> op) ?   \
>>> +   v4l2_flash->ops->op(v4l2_flash,
>>> arg) :  \
>>> +   -EINVAL)
>>> +
>>> +static enum led_brightness __intensity_to_led_brightness(
>>> +   struct v4l2_ctrl *ctrl,
>>> +   s32 intensity)
>>
>> Fits on previous line.
>>
>>> +{
>>> +   s64 intensity64 = intensity - ctrl->minimum;
>>
>> intensity, ctrl->step and ctrl->minimum are 32-bit signed integers.
>> Do you need a 64-bit integer here?
> 
> step is u64.

Nevertheless integer controls will not have values outside the s32
range, using a step value that's outside the range makes no sense
either. I think you should use s32 instead.

> 
>>
>>> +
>>> +   do_div(intensity64, ctrl->step);
>>> +
>>> +   /*
>>> +* Indicator LEDs, unlike torch LEDs, are turned on/off
>>> basing on
>>> +* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control
>>> only.
>>> +* Therefore it must be possible to set it to 0 level
>>> which in
>>> +* the LED subsystem reflects LED_OFF state.
>>> +*/
>>> +   if (ctrl->id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
>>> +   ++intensity64;
>>
>> I think the condition could simply be ctrl->minimum instead, that way
>> I find it easier to understand what's happening here. I'd expect the
>> minimum for non-intensity controls always to be non-zero, though, so
>> the end result is the same. Up to you.
> 
> Minimum for indicator control must be 0 to make possible
> turning the indicator LED off only with this control.

Would torch be still on if the minimum torch current was 0 mA? I'd say no.

Although in that case I'd expect the driver to use a different range,
and selecting the off mode would then turn it off, I still think that's
a better condition than relying on the control id.

...

>>> +static int v4l2_flash_g_volatile_ctrl(struct v4l2_ctrl *c)
>>> +{
>>> +   struct v4l2_flash *v4l2_flash = v4l2_ctrl_to_v4l2_flash(c);
>>> +   struct led_classdev_flash *fled_cdev =
>>> v4l2_flash->fled_cdev;
>>> +   bool is_strobing;
>>> +   int ret;
>>> +
>>> +   switch (c->id) {
>>> +   case V4L2_CID_FLASH_TORCH_INTENSITY:
>>> +   case V4L2_CID_FLASH_INDICATOR_INTENSITY:
>>> +   return
>>> v4l2_flash_update_led_brightness(v4l2_flash, c);
>>> +   case V4L2_CID_FLASH_INTENSITY:
>>> +   ret = led_update_flash_brightness(fled_cdev);
>>> +   if (ret < 0)
>>> +   return ret;
>>> +   /* no conversion is needed */
>>
>> Maybe a stupid question, but why is it not needed?
> 
> Because LED Flash class also uses microamperes.

Right, I had missed that. It'd be nice if that was said in the comment,
it might not be obvious to others either.

-- 
Kind regards,

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


[PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner

2015-04-23 Thread Olli Salonen
GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.

It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20

The demodulator and the tuner will need firmwares. The Si2148 uses Si2158
firmware. Antti has the firmwares available for download:
http://palosaari.fi/linux/v4l-dvb/firmware/

Do note that for DVB-T either of the demodulators can be used. DVB-C and
DVB-T2 are only supported by the Si2168 demodulator. The driver will
register 2 frontends for the same adapter. Frontend 0 will be the RTL2832
demodulator and frontend 1 will be the Si2168 demodulator. The same
tuner is used for both.

As a consequence of the above, it's recommended to use application that
do implement proper DVBv5 support.

For some reason, the old I2C write method sporadically failed. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.

Signed-off-by: Olli Salonen 
---
 drivers/media/dvb-frontends/rtl2832.c  |   4 +
 drivers/media/dvb-frontends/rtl2832.h  |   1 +
 drivers/media/dvb-frontends/rtl2832_priv.h |  25 +++
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 116 -
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h|   5 ++
 5 files changed, 148 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/rtl2832.c 
b/drivers/media/dvb-frontends/rtl2832.c
index 20fa245..08558eb 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -376,6 +376,10 @@ static int rtl2832_init(struct dvb_frontend *fe)
len = ARRAY_SIZE(rtl2832_tuner_init_r820t);
init = rtl2832_tuner_init_r820t;
break;
+   case RTL2832_TUNER_SI2157:
+   len = ARRAY_SIZE(rtl2832_tuner_init_si2157);
+   init = rtl2832_tuner_init_si2157;
+   break;
default:
ret = -EINVAL;
goto err;
diff --git a/drivers/media/dvb-frontends/rtl2832.h 
b/drivers/media/dvb-frontends/rtl2832.h
index a8e912e..c6cdcc4 100644
--- a/drivers/media/dvb-frontends/rtl2832.h
+++ b/drivers/media/dvb-frontends/rtl2832.h
@@ -47,6 +47,7 @@ struct rtl2832_platform_data {
 #define RTL2832_TUNER_FC00130x29
 #define RTL2832_TUNER_R820T 0x2a
 #define RTL2832_TUNER_R828D 0x2b
+#define RTL2832_TUNER_SI21570x2c
u8 tuner;
 
struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h 
b/drivers/media/dvb-frontends/rtl2832_priv.h
index c3a922c..a973b8a 100644
--- a/drivers/media/dvb-frontends/rtl2832_priv.h
+++ b/drivers/media/dvb-frontends/rtl2832_priv.h
@@ -377,4 +377,29 @@ static const struct rtl2832_reg_value 
rtl2832_tuner_init_r820t[] = {
{DVBT_SPEC_INV,  0x1},
 };
 
+static const struct rtl2832_reg_value rtl2832_tuner_init_si2157[] = {
+   {DVBT_DAGC_TRG_VAL, 0x39},
+   {DVBT_AGC_TARG_VAL_0,0x0},
+   {DVBT_AGC_TARG_VAL_8_1, 0x40},
+   {DVBT_AAGC_LOOP_GAIN,   0x16},
+   {DVBT_LOOP_GAIN2_3_0,0x8},
+   {DVBT_LOOP_GAIN2_4,  0x1},
+   {DVBT_LOOP_GAIN3,   0x18},
+   {DVBT_VTOP1,0x35},
+   {DVBT_VTOP2,0x21},
+   {DVBT_VTOP3,0x21},
+   {DVBT_KRF1,  0x0},
+   {DVBT_KRF2, 0x40},
+   {DVBT_KRF3, 0x10},
+   {DVBT_KRF4, 0x10},
+   {DVBT_IF_AGC_MIN,   0x80},
+   {DVBT_IF_AGC_MAX,   0x7f},
+   {DVBT_RF_AGC_MIN,   0x80},
+   {DVBT_RF_AGC_MAX,   0x7f},
+   {DVBT_POLAR_RF_AGC,  0x0},
+   {DVBT_POLAR_IF_AGC,  0x0},
+   {DVBT_AD7_SETTING,0xe9f4},
+   {DVBT_SPEC_INV,  0x0},
+};
+
 #endif /* RTL2832_PRIV_H */
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 5e0c015..c2bd24f 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -217,7 +217,7 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
req.data = &msg[0].buf[1];
ret = rtl28xxu_ctrl_msg(d, &req);
}
-   } else if (msg[0].len < 23) {
+   } else if ((msg[0].len < 23) && (!dev->new_i2c_write)) {
/* method 2 - old I2C */
req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
req.index = CMD_I2C_WR;
@@ -363,6 +363,8 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
struct rtl28xxu

[PATCH 08/12] dvbsky: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 0f73b1d..57c8c2d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -549,6 +549,7 @@ static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe[0];
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -633,6 +634,7 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe[0];
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
-- 
1.9.1

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


[PATCH 01/12] si2168: add support for gapped clock

2015-04-23 Thread Olli Salonen
Add a parameter in si2168_config to support gapped clock.

Signed-off-by: Olli Salonen 
---
 drivers/media/dvb-frontends/si2168.c  | 3 +++
 drivers/media/dvb-frontends/si2168.h  | 3 +++
 drivers/media/dvb-frontends/si2168_priv.h | 1 +
 3 files changed, 7 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 5db588e..29a5936 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -508,6 +508,8 @@ static int si2168_init(struct dvb_frontend *fe)
/* set ts mode */
memcpy(cmd.args, "\x14\x00\x01\x10\x10\x00", 6);
cmd.args[4] |= dev->ts_mode;
+   if (dev->ts_clock_gapped)
+   cmd.args[4] |= 0x40;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2168_cmd_execute(client, &cmd);
@@ -688,6 +690,7 @@ static int si2168_probe(struct i2c_client *client,
*config->fe = &dev->fe;
dev->ts_mode = config->ts_mode;
dev->ts_clock_inv = config->ts_clock_inv;
+   dev->ts_clock_gapped = config->ts_clock_gapped;
dev->fw_loaded = false;
 
i2c_set_clientdata(client, dev);
diff --git a/drivers/media/dvb-frontends/si2168.h 
b/drivers/media/dvb-frontends/si2168.h
index 70d702a..3225d0c 100644
--- a/drivers/media/dvb-frontends/si2168.h
+++ b/drivers/media/dvb-frontends/si2168.h
@@ -42,6 +42,9 @@ struct si2168_config {
 
/* TS clock inverted */
bool ts_clock_inv;
+
+   /* TS clock gapped */
+   bool ts_clock_gapped;
 };
 
 #endif
diff --git a/drivers/media/dvb-frontends/si2168_priv.h 
b/drivers/media/dvb-frontends/si2168_priv.h
index d7efce8..d2589e3 100644
--- a/drivers/media/dvb-frontends/si2168_priv.h
+++ b/drivers/media/dvb-frontends/si2168_priv.h
@@ -38,6 +38,7 @@ struct si2168_dev {
bool fw_loaded;
u8 ts_mode;
bool ts_clock_inv;
+   bool ts_clock_gapped;
 };
 
 /* firmware command struct */
-- 
1.9.1

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


[PATCH 11/12] rtl28xxu: add I2C read without write

2015-04-23 Thread Olli Salonen
Add support for I2C read operation without a preceeding write.

While here, change the error code to EOPNOTSUPP in case an
unsupported I2C operation is attempted.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index f1a7613..5e0c015 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -232,8 +232,14 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
req.data = msg[0].buf;
ret = rtl28xxu_ctrl_msg(d, &req);
}
+   } else if (num == 1 && (msg[0].flags & I2C_M_RD)) {
+   req.value = (msg[0].addr << 1);
+   req.index = CMD_I2C_DA_RD;
+   req.size = msg[0].len;
+   req.data = msg[0].buf;
+   ret = rtl28xxu_ctrl_msg(d, &req);
} else {
-   ret = -EINVAL;
+   ret = -EOPNOTSUPP;
}
 
 err_mutex_unlock:
-- 
1.9.1

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


[PATCH 10/12] em28xx: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/em28xx/em28xx-dvb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index a5b22c5..5b7c7c88 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1579,6 +1579,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dvb->fe[0];
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1639,6 +1640,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dvb->fe[0];
+   si2157_config.if_port = 0;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2146", I2C_NAME_SIZE);
info.addr = 0x60;
-- 
1.9.1

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


[PATCH 09/12] cxusb: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb/cxusb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index ffc3704..ab71511 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1350,6 +1350,7 @@ static int cxusb_mygica_t230_frontend_attach(struct 
dvb_usb_adapter *adap)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe_adap[0].fe;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
-- 
1.9.1

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


[PATCH 04/12] cx23885: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 745caab..37fd013 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+   si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
-- 
1.9.1

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


[PATCH 03/12] si2157: support selection of IF interface

2015-04-23 Thread Olli Salonen
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.

Signed-off-by: Olli Salonen 
---
 drivers/media/tuners/si2157.c  | 4 +++-
 drivers/media/tuners/si2157.h  | 6 ++
 drivers/media/tuners/si2157_priv.h | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index d74ae26..cdaf687 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
if (dev->chiptype == SI2157_CHIPTYPE_SI2146)
memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
else
-   memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
+   memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6);
+   cmd.args[4] = dev->if_port;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2157_cmd_execute(client, &cmd);
@@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, dev);
dev->fe = cfg->fe;
dev->inversion = cfg->inversion;
+   dev->if_port = cfg->if_port;
dev->fw_loaded = false;
dev->chiptype = (u8)id->driver_data;
dev->if_frequency = 500; /* default value of property 0x0706 */
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index a564c4a..4db97ab 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -34,6 +34,12 @@ struct si2157_config {
 * Spectral Inversion
 */
bool inversion;
+
+   /*
+* Port selection
+* Select the RF interface to use (pins 9+11 or 12+13)
+*/
+   u8 if_port;
 };
 
 #endif
diff --git a/drivers/media/tuners/si2157_priv.h 
b/drivers/media/tuners/si2157_priv.h
index cd8fa5b..71a5f8c 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -28,6 +28,7 @@ struct si2157_dev {
bool fw_loaded;
bool inversion;
u8 chiptype;
+   u8 if_port;
u32 if_frequency;
 };
 
-- 
1.9.1

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


[PATCH 06/12] cx231xx: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c 
b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 610d567..66ee161 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -797,6 +797,7 @@ static int dvb_init(struct cx231xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dev->dvb->frontend;
+   si2157_config.if_port = 1;
si2157_config.inversion = true;
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -852,6 +853,7 @@ static int dvb_init(struct cx231xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dev->dvb->frontend;
+   si2157_config.if_port = 1;
si2157_config.inversion = true;
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
-- 
1.9.1

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


[PATCH 07/12] af9035: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c 
b/drivers/media/usb/dvb-usb-v2/af9035.c
index 80a29f5..7b7f75d 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1569,6 +1569,7 @@ static int it930x_tuner_attach(struct dvb_usb_adapter 
*adap)
 
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe[0];
+   si2157_config.if_port = 1;
ret = af9035_add_i2c_dev(d, "si2157", 0x63,
&si2157_config, state->i2c_adapter_demod);
 
-- 
1.9.1

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


[PATCH 05/12] smipcie: specify if_port for si2157 devices

2015-04-23 Thread Olli Salonen
Set the if_port parameter for all Si2157-based devices.

Signed-off-by: Olli Salonen 
---
 drivers/media/pci/smipcie/smipcie.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/pci/smipcie/smipcie.c 
b/drivers/media/pci/smipcie/smipcie.c
index 4115925..143fd78 100644
--- a/drivers/media/pci/smipcie/smipcie.c
+++ b/drivers/media/pci/smipcie/smipcie.c
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port->fe;
+   si2157_config.if_port = 1;
 
memset(&client_info, 0, sizeof(struct i2c_board_info));
strlcpy(client_info.type, "si2157", I2C_NAME_SIZE);
-- 
1.9.1

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


[PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped

2015-04-23 Thread Olli Salonen
Change the dvbsky driver to support gapped clock instead of the current
hack.

Signed-off-by: Olli Salonen 
---
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index cdf59bc..0f73b1d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
memset(&si2168_config, 0, sizeof(si2168_config));
si2168_config.i2c_adapter = &i2c_adapter;
si2168_config.fe = &adap->fe[0];
-   si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2168", I2C_NAME_SIZE);
info.addr = 0x64;
-- 
1.9.1

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


[PATCH 2/3] [media] v4l: VIDEOBUF2_DMA_SG should depend on HAS_DMA

2015-04-23 Thread Geert Uytterhoeven
If NO_DMA=y:

ERROR: "dma_unmap_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] 
undefined!
ERROR: "dma_map_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!
ERROR: "dma_sync_sg_for_cpu" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] 
undefined!

VIDEOBUF2_DMA_SG cannot be enabled manually by the user, it's always
selected automatically by drivers that need it. Several of those drivers
already have an explicit dependency on HAS_DMA.

Make VIDEOBUF2_DMA_SG depend on HAS_DMA. This makes it easier to find
drivers that select VIDEOBUF2_DMA_SG without depending on HAS_DMA, as
Kconfig will give a warning.

Signed-off-by: Geert Uytterhoeven 
---
 drivers/media/v4l2-core/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a73023b9ae..f7a01a72eb9e09e3 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -89,7 +89,7 @@ config VIDEOBUF2_VMALLOC
 
 config VIDEOBUF2_DMA_SG
tristate
-   #depends on HAS_DMA
+   depends on HAS_DMA
select VIDEOBUF2_CORE
select VIDEOBUF2_MEMOPS
 
-- 
1.9.1

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


[PATCH 1/3] [media] v4l: xilinx: VIDEO_XILINX should depend on HAS_DMA

2015-04-23 Thread Geert Uytterhoeven
If NO_DMA=y:

warning: (VIDEO_XILINX && VIDEO_DM365_VPFE && VIDEO_DT3155 && VIDEO_OMAP4) 
selects VIDEOBUF2_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT 
&& HAS_DMA)

media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_mmap’:
media/v4l2-core/videobuf2-dma-contig.c:207: error: implicit declaration of 
function ‘dma_mmap_coherent’
media/v4l2-core/videobuf2-dma-contig.c: In function ‘vb2_dc_get_base_sgt’:
media/v4l2-core/videobuf2-dma-contig.c:390: error: implicit declaration of 
function ‘dma_get_sgtable’

VIDEO_XILINX selects VIDEOBUF2_DMA_CONTIG, which bypasses its dependency
on HAS_DMA.  Make VIDEO_XILINX depend on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven 
---
 drivers/media/platform/xilinx/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/xilinx/Kconfig 
b/drivers/media/platform/xilinx/Kconfig
index d7324c726fc2a881..84bae795b70d3148 100644
--- a/drivers/media/platform/xilinx/Kconfig
+++ b/drivers/media/platform/xilinx/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_XILINX
tristate "Xilinx Video IP (EXPERIMENTAL)"
-   depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF
+   depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA
select VIDEOBUF2_DMA_CONTIG
---help---
  Driver for Xilinx Video IP Pipelines
-- 
1.9.1

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


[PATCH 3/3] Input: TOUCHSCREEN_SUR40 should depend on HAS_DMA

2015-04-23 Thread Geert Uytterhoeven
If NO_DMA=y:

warning: (TOUCHSCREEN_SUR40 && VIDEO_TW68 && VIDEO_CX23885 && VIDEO_CX25821 
&& VIDEO_CX88 && VIDEO_SAA7134) selects VIDEOBUF2_DMA_SG which has unmet direct 
dependencies (MEDIA_SUPPORT && HAS_DMA)

ERROR: "dma_unmap_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] 
undefined!
ERROR: "dma_map_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!
ERROR: "dma_sync_sg_for_cpu" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] 
undefined!

TOUCHSCREEN_SUR40 selects VIDEOBUF2_DMA_SG, which bypasses its
dependency on HAS_DMA.  Make TOUCHSCREEN_SUR40 depend on HAS_DMA to fix
this.

Signed-off-by: Geert Uytterhoeven 
---
 drivers/input/touchscreen/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/Kconfig 
b/drivers/input/touchscreen/Kconfig
index b0a94cdd96add5c9..4591389108f0057b 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -979,8 +979,7 @@ config TOUCHSCREEN_SUN4I
 
 config TOUCHSCREEN_SUR40
tristate "Samsung SUR40 (Surface 2.0/PixelSense) touchscreen"
-   depends on USB
-   depends on MEDIA_USB_SUPPORT
+   depends on USB && MEDIA_USB_SUPPORT && HAS_DMA
select INPUT_POLLDEV
select VIDEOBUF2_DMA_SG
help
-- 
1.9.1

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


Missing additional V4L2 caps in cx18

2015-04-23 Thread Laura Abbott

Hi,

We received a report of a backtrace from v4l2 with
the cx18 module:


[6.229393] [ cut here ]
[6.229414] WARNING: CPU: 1 PID: 593 at 
drivers/media/v4l2-core/v4l2-ioctl.c:1025 v4l_querycap+0x41/0x70 
[videodev]()
[6.229415] Modules linked in: cx18_alsa mxl5005s s5h1409 
tuner_simple tuner_types cs5345 tuner intel_rapl iosf_mbi 
x86_pkg_temp_thermal coretemp raid1 snd_hda_codec_realtek kvm_intel 
snd_hda_codec_generic snd_hda_codec_hdmi kvm snd_oxygen(+) snd_hda_intel 
snd_oxygen_lib snd_hda_controller snd_hda_codec snd_mpu401_uart iTCO_wdt 
snd_rawmidi iTCO_vendor_support snd_hwdep crct10dif_pclmul crc32_pclmul 
crc32c_intel snd_seq cx18 snd_seq_device ghash_clmulni_intel 
videobuf_vmalloc tveeprom cx2341x snd_pcm serio_raw videobuf_core vfat 
dvb_core fat v4l2_common snd_timer videodev snd lpc_ich i2c_i801 joydev 
mfd_core mei_me media soundcore tpm_infineon soc_button_array tpm_tis 
mei shpchp tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc binfmt_misc 
i915 nouveau mxm_wmi wmi e1000e ttm i2c_algo_bit drm_kms_helper

[6.229444]  drm ptp pps_core video
[6.229446] CPU: 1 PID: 593 Comm: v4l_id Not tainted 
3.19.3-200.fc21.x86_64 #1
[6.229447] Hardware name: Gigabyte Technology Co., Ltd. 
Z87-D3HP/Z87-D3HP-CF, BIOS F6 01/20/2014
[6.229448]   d12b1131 88042dacfc28 
8176e215
[6.229449]    88042dacfc68 
8109bc1a
[6.229451]  a0594000 88042dacfd90  
a04e2140

[6.229452] Call Trace:
[6.229466]  [] dump_stack+0x45/0x57
[6.229469]  [] warn_slowpath_common+0x8a/0xc0
[6.229472]  [] warn_slowpath_null+0x1a/0x20
[6.229474]  [] v4l_querycap+0x41/0x70 [videodev]
[6.229477]  [] __video_do_ioctl+0x29c/0x320 [videodev]
[6.229479]  [] ? do_last+0x2f1/0x1210
[6.229491]  [] video_usercopy+0x366/0x5d0 [videodev]
[6.229494]  [] ? v4l_querycap+0x70/0x70 [videodev]
[6.229497]  [] video_ioctl2+0x15/0x20 [videodev]
[6.229499]  [] v4l2_ioctl+0x164/0x180 [videodev]
[6.229501]  [] do_vfs_ioctl+0x2f8/0x500
[6.229502]  [] SyS_ioctl+0x81/0xa0
[6.229505]  [] system_call_fastpath+0x12/0x17
[6.229506] ---[ end trace dacd80d4b19277ea ]---

This is the warning about querycap not filling device_caps properly.
The tree has dfdf780b4651cf4932b96d3fe296230afacc360a
('[media] cx18: add device_caps support') present already but
I noticed several of the streams types are missing capabilities
in cx18-streams.c (CX18_ENC_STREAM_TYPE_TS, CX18_ENC_STREAM_TYPE_PCM,
CX18_ENC_STREAM_TYPE_IDX)

Do these need to have proper capabilities added as well to silence
this warning?

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


Re: [PATCH v5 06/10] media: Add registration helpers for V4L2 flash sub-devices

2015-04-23 Thread Jacek Anaszewski
On Thu, 23 Apr 2015 10:40:09 +0300
Hi Sakari,

Thanks for the review.

Sakari Ailus  wrote:

> Hi Jacek,
> 
> On Wed, Apr 15, 2015 at 08:48:36AM +0200, Jacek Anaszewski wrote:
> > This patch adds helper functions for registering/unregistering
> > LED Flash class devices as V4L2 sub-devices. The functions should
> > be called from the LED subsystem device driver. In case the
> > support for V4L2 Flash sub-devices is disabled in the kernel
> > config the functions' empty versions will be used.
> > 
> > Signed-off-by: Jacek Anaszewski 
> > Acked-by: Kyungmin Park 
> > Cc: Sakari Ailus 
> > Cc: Hans Verkuil 
> > ---
> >  drivers/media/v4l2-core/Kconfig  |   11 +
> >  drivers/media/v4l2-core/Makefile |2 +
> >  drivers/media/v4l2-core/v4l2-flash.c |  619
> > ++
> > include/media/v4l2-flash.h   |  145  4 files
> > changed, 777 insertions(+) create mode 100644
> > drivers/media/v4l2-core/v4l2-flash.c create mode 100644
> > include/media/v4l2-flash.h
> > 
> > diff --git a/drivers/media/v4l2-core/Kconfig
> > b/drivers/media/v4l2-core/Kconfig index ba7e21a..f034f1a 100644
> > --- a/drivers/media/v4l2-core/Kconfig
> > +++ b/drivers/media/v4l2-core/Kconfig
> > @@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
> >  tristate
> >  depends on VIDEOBUF2_CORE
> >  
> > +# Used by LED subsystem flash drivers
> > +config V4L2_FLASH_LED_CLASS
> > +   tristate "Enable support for Flash sub-devices"
> 
> How about: "V4L2 flash API for LED flash class devices"?

OK.

> > +   depends on VIDEO_V4L2_SUBDEV_API
> > +   depends on LEDS_CLASS_FLASH
> > +   ---help---
> > + Say Y here to enable support for Flash sub-devices,
> > which allow
> > + to control LED class devices with use of V4L2 Flash
> > controls.
> 
> How about this: "Say Y here to enable V4L2 flash API support for LED
> flash class drivers".

OK.

> > +
> > + When in doubt, say N.
> > +
> >  # Used by drivers that need Videobuf modules
> >  config VIDEOBUF_GEN
> > tristate
> > diff --git a/drivers/media/v4l2-core/Makefile
> > b/drivers/media/v4l2-core/Makefile index 63d29f2..44e858c 100644
> > --- a/drivers/media/v4l2-core/Makefile
> > +++ b/drivers/media/v4l2-core/Makefile
> > @@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
> >  
> >  obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
> >  
> > +obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
> > +
> >  obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
> >  obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
> >  obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
> > diff --git a/drivers/media/v4l2-core/v4l2-flash.c
> > b/drivers/media/v4l2-core/v4l2-flash.c new file mode 100644
> > index 000..bed2036
> > --- /dev/null
> > +++ b/drivers/media/v4l2-core/v4l2-flash.c
> 
> I might rename this as v4l2-flash-led-class.c to match the Kconfig
> option.

Agreed as well.

> > @@ -0,0 +1,619 @@
> > +/*
> > + * V4L2 Flash LED sub-device registration helpers.
> > + *
> > + * Copyright (C) 2015 Samsung Electronics Co., Ltd
> > + * Author: Jacek Anaszewski 
> > + *
> > + * This program is free software; you can redistribute it and/or
> > modify
> > + * it under the terms of the GNU General Public License version 2
> > as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#define has_flash_op(v4l2_flash,
> > op) \
> > +   (v4l2_flash && v4l2_flash->ops->op)
> > +
> > +#define call_flash_op(v4l2_flash, op, arg) \
> > +   (has_flash_op(v4l2_flash,
> > op) ?   \
> > +   v4l2_flash->ops->op(v4l2_flash,
> > arg) :  \
> > +   -EINVAL)
> > +
> > +static enum led_brightness __intensity_to_led_brightness(
> > +   struct v4l2_ctrl *ctrl,
> > +   s32 intensity)
> 
> Fits on previous line.
> 
> > +{
> > +   s64 intensity64 = intensity - ctrl->minimum;
> 
> intensity, ctrl->step and ctrl->minimum are 32-bit signed integers.
> Do you need a 64-bit integer here?

step is u64.

> 
> > +
> > +   do_div(intensity64, ctrl->step);
> > +
> > +   /*
> > +* Indicator LEDs, unlike torch LEDs, are turned on/off
> > basing on
> > +* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control
> > only.
> > +* Therefore it must be possible to set it to 0 level
> > which in
> > +* the LED subsystem reflects LED_OFF state.
> > +*/
> > +   if (ctrl->id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
> > +   ++intensity64;
> 
> I think the condition could simply be ctrl->minimum instead, that way
> I find it easier to understand what's happening here. I'd expect the
> minimum for non-intensity controls always to be non-zero, though, so
> the end result is the same. Up to you.

Minimum for indicator control must be 0 to make possible
turning the indicator LED of

Re: [PATCHv3 0/4] add devm_of_phy_get_by_index and update platform drivers

2015-04-23 Thread Alan Stern
On Wed, 22 Apr 2015, Arun Ramamurthy wrote:

> This patch set adds a new API to get phy by index when multiple 
> phys are present. This patch is based on discussion with Arnd Bergmann
> about dt bindings for multiple phys.
> 
> History:
> v1:
> - Removed null pointers on Dmitry's suggestion
> - Improved documentation in commit messages
> - Exported new phy api
> v2:
> - EHCI and OHCI platform Kconfigs select Generic Phy
>   to fix build errors in certain configs.
> v3:
> - Made GENERIC_PHY an invisible option so 
> that other configs can select it
> - Added stubs for devm_of_phy_get_by_index
> - Reformated code
> 
> Arun Ramamurthy (4):
>   phy: phy-core: Make GENERIC_PHY an invisible option
>   phy: core: Add devm_of_phy_get_by_index to phy-core
>   usb: ehci-platform: Use devm_of_phy_get_by_index
>   usb: ohci-platform: Use devm_of_phy_get_by_index

For patches 3 and 4:

Acked-by: Alan Stern 

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


Re: [PATCH v4 06/10] cec: add HDMI CEC framework

2015-04-23 Thread Hans Verkuil
On 04/23/2015 03:03 PM, Kamil Debski wrote:
> From: Hans Verkuil 
> 
> The added HDMI CEC framework provides a generic kernel interface for
> HDMI CEC devices.
> 
> Signed-off-by: Hans Verkuil 
> [k.deb...@samsung.com: Merged CEC Updates commit by Hans Verkuil]
> [k.deb...@samsung.com: Merged Update author commit by Hans Verkuil]
> [k.deb...@samsung.com: change kthread handling when setting logical
> address]
> [k.deb...@samsung.com: code cleanup and fixes]
> [k.deb...@samsung.com: add missing CEC commands to match spec]
> [k.deb...@samsung.com: add RC framework support]
> [k.deb...@samsung.com: move and edit documentation]
> [k.deb...@samsung.com: add vendor id reporting]
> [k.deb...@samsung.com: add possibility to clear assigned logical
> addresses]
> [k.deb...@samsung.com: documentation fixes, clenaup and expansion]
> [k.deb...@samsung.com: reorder of API structs and add reserved fields]
> [k.deb...@samsung.com: fix handling of events and fix 32/64bit timespec
> problem]
> [k.deb...@samsung.com: add cec.h to include/uapi/linux/Kbuild]
> Signed-off-by: Kamil Debski 
> ---
>  Documentation/cec.txt |  396 
>  drivers/media/Kconfig |6 +
>  drivers/media/Makefile|2 +
>  drivers/media/cec.c   | 1161 
> +
>  include/media/cec.h   |  140 ++
>  include/uapi/linux/Kbuild |1 +
>  include/uapi/linux/cec.h  |  303 
>  7 files changed, 2009 insertions(+)
>  create mode 100644 Documentation/cec.txt
>  create mode 100644 drivers/media/cec.c
>  create mode 100644 include/media/cec.h
>  create mode 100644 include/uapi/linux/cec.h
> 
> diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h
> new file mode 100644
> index 000..bb6d66c
> --- /dev/null
> +++ b/include/uapi/linux/cec.h
> @@ -0,0 +1,303 @@
> +
> +/* Userspace has to configure the adapter state (enable/disable) */
> +#define CEC_CAP_STATE(1 << 0)
> +/* Userspace has to configure the physical address */
> +#define CEC_CAP_PHYS_ADDR(1 << 1)
> +/* Userspace has to configure the logical addresses */
> +#define CEC_CAP_LOG_ADDRS(1 << 2)
> +/* Userspace can transmit messages */
> +#define CEC_CAP_TRANSMIT (1 << 3)
> +/* Userspace can receive messages */
> +#define CEC_CAP_RECEIVE  (1 << 4)
> +/* Userspace has to configure the vendor id */
> +#define CEC_CAP_VENDOR_ID(1 << 5)
> +/* The hardware has the possibility to work in the promiscuous mode */
> +#define CEC_CAP_PROMISCUOUS  (1 << 6)

Since promiscuous support has been dropped, this capability needs to be
dropped as well.

> +
> +struct cec_caps {
> + __u32 available_log_addrs;
> + __u32 capabilities;
> + __u32 vendor_id;
> + __u8  version;
> + __u8  reserved[11];

I'd increase this to 31.

> +};
> +
> +struct cec_log_addrs {
> + __u8 cec_version;
> + __u8 num_log_addrs;
> + __u8 primary_device_type[CEC_MAX_LOG_ADDRS];
> + __u8 log_addr_type[CEC_MAX_LOG_ADDRS];
> + __u8 log_addr[CEC_MAX_LOG_ADDRS];
> +
> + /* CEC 2.0 */
> + __u8 all_device_types;
> + __u8 features[CEC_MAX_LOG_ADDRS][12];
> +
> + __u8 reserved[9];

I'd increase this to 65 or so.

Regards,

Hans

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


Re: [media-workshop] [DRAFT 1] Linux Media Summit report - March, 26 2015 - San Jose - CA - USA

2015-04-23 Thread Patrick Boettcher
Hi Mauro,

On Thu, 23 Apr 2015 07:40:46 -0300 Mauro Carvalho Chehab
 wrote:
> > What about demod-diversity: demods of some manufacturers can be
> > used to combine their demodulated symbols and, due to their
> > different antennas and RF-paths, improve the overall reception
> > quality.
> > 
> > If we ever have someone contributing in this area with
> > hardware-drivers, it would be nice to have the user-space possible
> > to select demod-combinations. It should be possible to add and
> > remove a demod to a diversity-chain when and when not being tuned
> > to a channel.
> 
> It makes sense to map demod diversity via the media controller.
> 
> Not sure what would be the best way to map it though, as I don't have
> a clear understanding about how the hardware pipelines are set for
> demod diversity.
> 
> The way the media controller currently is is that it maps only the
> data flow. There are discussions about how the control flow should
> happen.
> 
> The data flow for a normal demod is:
> 
>   IF (or baseband) ---> [demod] ---> MPEG-TS
> 
> 
> From dib0700 demod drivers, I remember that several of the demods have
> a concept of a "slave demod". Are those full demods that can get an
> IF/baseband input and produce a MPEG-TS output, or are those just
> IP blocks that have the IF/baseband input but doesn't produce an
> MPEG-TS output, but, instead, sends some sort of data into the "master
> demod"?
> 
> In other words, would the dataflow be something like
> 
>  IF   TS
>   [tuner] ---> [master demod] ->[  ]
> | IF   TS   [ combiner ] ---> [demux]
> |> [slave demod]  ->[  ]
> 
> or:
>  IF  TS
>   [tuner] ---> [master demod] ---> [demux]
> | IF ^
> || (what sort of data?)
> |> [slave demod] |
> 
> Or is it something else?

Let's define a demodulation object:

+---+
|RF tuner --> IF|baseband --> demod --> FEC-decoder |
+---+

RF-tuner: RF downconverter (to a low or zero-IF)
IF|baseband: ADC and digital filters
demod: synchonization and symbol extraction
FEC-decoder: viterbi/ldpc/turbo-code forward error correction

Let's call this object a frontend.

Now imagine a board which has 4 frontends:

 high-speed-data-bus
-
  ||||
 FE3  FE2  FE1  FE0


To create a diversity-chain, for simplicity, we can say we connect at
least 2 frontends in any order. Both frontends are tuned to the same
physical channel and then a combiner will combine symbols decoded at
demod-stage.

Any FE can be connected with any FE in any order. Per board different
standards can be demodulated at the same time. For example: FE3 and FE2
are doing DVB-T and FE1 and FE0 DVB-T2 .

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


[PATCH] [media] vivid: add 1080p capture at 2 fps and 5 fps to webcam emulation

2015-04-23 Thread Philipp Zabel
Use the VIVID_WEBCAM_SIZES constant where appropriate and add a 1920x1080 pixel
frame size setting with frame rates of 2 fps and 5 fps.

Signed-off-by: Philipp Zabel 
---
 drivers/media/platform/vivid/vivid-vid-cap.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c 
b/drivers/media/platform/vivid/vivid-vid-cap.c
index 867a29a..468b8b5 100644
--- a/drivers/media/platform/vivid/vivid-vid-cap.c
+++ b/drivers/media/platform/vivid/vivid-vid-cap.c
@@ -60,7 +60,7 @@ static const struct vivid_fmt formats_ovl[] = {
 };
 
 /* The number of discrete webcam framesizes */
-#define VIVID_WEBCAM_SIZES 3
+#define VIVID_WEBCAM_SIZES 4
 /* The number of discrete webcam frameintervals */
 #define VIVID_WEBCAM_IVALS (VIVID_WEBCAM_SIZES * 2)
 
@@ -69,6 +69,7 @@ static const struct v4l2_frmsize_discrete 
webcam_sizes[VIVID_WEBCAM_SIZES] = {
{  320, 180 },
{  640, 360 },
{ 1280, 720 },
+   { 1920, 1080 },
 };
 
 /*
@@ -76,6 +77,8 @@ static const struct v4l2_frmsize_discrete 
webcam_sizes[VIVID_WEBCAM_SIZES] = {
  * elements in this array as there are in webcam_sizes.
  */
 static const struct v4l2_fract webcam_intervals[VIVID_WEBCAM_IVALS] = {
+   {  1, 2 },
+   {  1, 5 },
{  1, 10 },
{  1, 15 },
{  1, 25 },
@@ -715,8 +718,8 @@ int vivid_s_fmt_vid_cap(struct file *file, void *priv,
webcam_sizes[i].height == mp->height)
break;
dev->webcam_size_idx = i;
-   if (dev->webcam_ival_idx >= 2 * (3 - i))
-   dev->webcam_ival_idx = 2 * (3 - i) - 1;
+   if (dev->webcam_ival_idx >= 2 * (VIVID_WEBCAM_SIZES - i))
+   dev->webcam_ival_idx = 2 * (VIVID_WEBCAM_SIZES - i) - 1;
vivid_update_format_cap(dev, false);
} else {
struct v4l2_rect r = { 0, 0, mp->width, mp->height };
@@ -1684,7 +1687,7 @@ int vidioc_enum_frameintervals(struct file *file, void 
*priv,
break;
if (i == ARRAY_SIZE(webcam_sizes))
return -EINVAL;
-   if (fival->index >= 2 * (3 - i))
+   if (fival->index >= 2 * (VIVID_WEBCAM_SIZES - i))
return -EINVAL;
fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
fival->discrete = webcam_intervals[fival->index];
@@ -1714,7 +1717,7 @@ int vivid_vid_cap_s_parm(struct file *file, void *priv,
  struct v4l2_streamparm *parm)
 {
struct vivid_dev *dev = video_drvdata(file);
-   unsigned ival_sz = 2 * (3 - dev->webcam_size_idx);
+   unsigned ival_sz = 2 * (VIVID_WEBCAM_SIZES - dev->webcam_size_idx);
struct v4l2_fract tpf;
unsigned i;
 
-- 
2.1.4

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


[PATCH v4 08/10] cec: adv7604: add cec support.

2015-04-23 Thread Kamil Debski
From: Hans Verkuil 

Add CEC support to the adv7604 driver.

Signed-off-by: Hans Verkuil 
[k.deb...@samsung.com: Merged changes from CEC Updates commit by Hans Verkuil]
[k.deb...@samsung.com: add missing methods cec/io_write_and_or]
[k.deb...@samsung.com: change adv7604 to adv76xx in added functions]
Signed-off-by: Kamil Debski 
---
 drivers/media/i2c/adv7604.c |  207 ++-
 1 file changed, 206 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 60ffcf0..4921276 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -38,6 +38,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -77,6 +78,8 @@ MODULE_LICENSE("GPL");
 
 #define ADV76XX_OP_SWAP_CB_CR  (1 << 0)
 
+#define ADV76XX_MAX_ADDRS (3)
+
 enum adv76xx_type {
ADV7604,
ADV7611,
@@ -159,6 +162,10 @@ struct adv76xx_state {
u16 spa_port_a[2];
struct v4l2_fract aspect_ratio;
u32 rgb_quantization_range;
+   u8   cec_addr[ADV76XX_MAX_ADDRS];
+   u8   cec_valid_addrs;
+   bool cec_enabled_adap;
+
struct workqueue_struct *work_queues;
struct delayed_work delayed_work_enable_hotplug;
bool restart_stdi_once;
@@ -424,7 +431,15 @@ static inline int io_write(struct v4l2_subdev *sd, u8 reg, 
u8 val)
return adv_smbus_write_byte_data(state, ADV76XX_PAGE_IO, reg, val);
 }
 
-static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask, u8 
val)
+static inline int io_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask,
+ u8 val)
+{
+   return io_write(sd, reg, (io_read(sd, reg) & mask) | val);
+}
+
+
+static inline int io_write_clr_set(struct v4l2_subdev *sd, u8 reg, u8 mask,
+  u8 val)
 {
return io_write(sd, reg, (io_read(sd, reg) & ~mask) | val);
 }
@@ -457,6 +472,12 @@ static inline int cec_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state, ADV76XX_PAGE_CEC, reg, val);
 }
 
+static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask,
+  u8 val)
+{
+   return cec_write(sd, reg, (cec_read(sd, reg) & mask) | val);
+}
+
 static inline int infoframe_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv76xx_state *state = to_state(sd);
@@ -1865,6 +1886,183 @@ static int adv76xx_set_format(struct v4l2_subdev *sd,
return 0;
 }
 
+static void adv76xx_cec_tx_raw_status(struct v4l2_subdev *sd, u8 tx_raw_status)
+{
+   if ((cec_read(sd, 0x11) & 0x01) == 0) {
+   v4l2_dbg(1, debug, sd, "%s: tx raw: tx disabled\n", __func__);
+   return;
+   }
+
+   if (tx_raw_status & 0x02) {
+   v4l2_dbg(1, debug, sd, "%s: tx raw: arbitration lost\n",
+__func__);
+   v4l2_subdev_notify(sd, V4L2_SUBDEV_CEC_TX_DONE,
+  (void *)CEC_TX_STATUS_ARB_LOST);
+   return;
+   }
+   if (tx_raw_status & 0x04) {
+   v4l2_dbg(1, debug, sd, "%s: tx raw: retry failed\n", __func__);
+   v4l2_subdev_notify(sd, V4L2_SUBDEV_CEC_TX_DONE,
+  (void *)CEC_TX_STATUS_RETRY_TIMEOUT);
+   return;
+   }
+   if (tx_raw_status & 0x01) {
+   v4l2_dbg(1, debug, sd, "%s: tx raw: ready ok\n", __func__);
+   v4l2_subdev_notify(sd, V4L2_SUBDEV_CEC_TX_DONE,
+  (void *)CEC_TX_STATUS_OK);
+   return;
+   }
+}
+
+static void adv76xx_cec_isr(struct v4l2_subdev *sd, bool *handled)
+{
+   struct cec_msg msg;
+   u8 cec_irq;
+
+   /* cec controller */
+   cec_irq = io_read(sd, 0x4d) & 0x0f;
+   if (!cec_irq)
+   return;
+
+   v4l2_dbg(1, debug, sd, "%s: cec: irq 0x%x\n", __func__, cec_irq);
+   adv76xx_cec_tx_raw_status(sd, cec_irq);
+   if (cec_irq & 0x08) {
+   msg.len = cec_read(sd, 0x25) & 0x1f;
+   if (msg.len > 16)
+   msg.len = 16;
+
+   if (msg.len) {
+   u8 i;
+
+   for (i = 0; i < msg.len; i++)
+   msg.msg[i] = cec_read(sd, i + 0x15);
+   cec_write(sd, 0x26, 0x01); /* re-enable rx */
+   v4l2_subdev_notify(sd, V4L2_SUBDEV_CEC_RX_MSG, &msg);
+   }
+   }
+
+   /* note: the bit order is swapped between 0x4d and 0x4e */
+   cec_irq = ((cec_irq & 0x08) >> 3) | ((cec_irq & 0x04) >> 1) |
+ ((cec_irq & 0x02) << 1) | ((cec_irq & 0x01) << 3);
+   io_write(sd, 0x4e, cec_irq);
+
+   if (handled)
+   *handled = true;
+}
+
+static int adv76xx_cec_enable(struct v4l2_subdev *sd, bool enable)
+{
+   struct adv76xx_state *state = to_state(sd);
+
+   if (!state->c

[PATCH v4 09/10] cec: adv7511: add cec support.

2015-04-23 Thread Kamil Debski
From: Hans Verkuil 

Add CEC support to the adv7511 driver.

Signed-off-by: Hans Verkuil 
[k.deb...@samsung.com: Merged changes from CEC Updates commit by Hans Verkuil]
Signed-off-by: Kamil Debski 
---
 drivers/media/i2c/adv7511.c |  347 ++-
 include/media/adv7511.h |6 +-
 2 files changed, 343 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index 12d9320..d56e110 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static int debug;
 module_param(debug, int, 0644);
@@ -91,6 +92,12 @@ struct adv7511_state {
int chip_revision;
uint8_t i2c_edid_addr;
uint8_t i2c_cec_addr;
+
+   struct i2c_client *i2c_cec;
+   u8   cec_addr[3];
+   u8   cec_valid_addrs;
+   bool cec_enabled_adap;
+
/* Is the adv7511 powered on? */
bool power_on;
/* Did we receive hotplug and rx-sense signals? */
@@ -222,7 +229,7 @@ static int adv_smbus_read_i2c_block_data(struct i2c_client 
*client,
return ret;
 }
 
-static inline void adv7511_edid_rd(struct v4l2_subdev *sd, uint16_t len, 
uint8_t *buf)
+static void adv7511_edid_rd(struct v4l2_subdev *sd, uint16_t len, uint8_t *buf)
 {
struct adv7511_state *state = get_adv7511_state(sd);
int i;
@@ -237,6 +244,34 @@ static inline void adv7511_edid_rd(struct v4l2_subdev *sd, 
uint16_t len, uint8_t
v4l2_err(sd, "%s: i2c read error\n", __func__);
 }
 
+static inline int cec_read(struct v4l2_subdev *sd, u8 reg)
+{
+   struct adv7511_state *state = get_adv7511_state(sd);
+
+   return i2c_smbus_read_byte_data(state->i2c_cec, reg);
+}
+
+static int cec_write(struct v4l2_subdev *sd, u8 reg, u8 val)
+{
+   struct adv7511_state *state = get_adv7511_state(sd);
+   int ret;
+   int i;
+
+   for (i = 0; i < 3; i++) {
+   ret = i2c_smbus_write_byte_data(state->i2c_cec, reg, val);
+   if (ret == 0)
+   return 0;
+   }
+   v4l2_err(sd, "%s: I2C Write Problem\n", __func__);
+   return ret;
+}
+
+static inline int cec_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask,
+  u8 val)
+{
+   return cec_write(sd, reg, (cec_read(sd, reg) & mask) | val);
+}
+
 static inline bool adv7511_have_hotplug(struct v4l2_subdev *sd)
 {
return adv7511_rd(sd, 0x42) & MASK_ADV7511_HPD_DETECT;
@@ -381,16 +416,28 @@ static const struct v4l2_ctrl_ops adv7511_ctrl_ops = {
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static void adv7511_inv_register(struct v4l2_subdev *sd)
 {
+   struct adv7511_state *state = get_adv7511_state(sd);
+
v4l2_info(sd, "0x000-0x0ff: Main Map\n");
+   if (state->i2c_cec)
+   v4l2_info(sd, "0x100-0x1ff: CEC Map\n");
 }
 
 static int adv7511_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register 
*reg)
 {
+   struct adv7511_state *state = get_adv7511_state(sd);
+
reg->size = 1;
switch (reg->reg >> 8) {
case 0:
reg->val = adv7511_rd(sd, reg->reg & 0xff);
break;
+   case 1:
+   if (state->i2c_cec) {
+   reg->val = cec_read(sd, reg->reg & 0xff);
+   break;
+   }
+   /* fall through */
default:
v4l2_info(sd, "Register %03llx not supported\n", reg->reg);
adv7511_inv_register(sd);
@@ -401,10 +448,18 @@ static int adv7511_g_register(struct v4l2_subdev *sd, 
struct v4l2_dbg_register *
 
 static int adv7511_s_register(struct v4l2_subdev *sd, const struct 
v4l2_dbg_register *reg)
 {
+   struct adv7511_state *state = get_adv7511_state(sd);
+
switch (reg->reg >> 8) {
case 0:
adv7511_wr(sd, reg->reg & 0xff, reg->val & 0xff);
break;
+   case 1:
+   if (state->i2c_cec) {
+   cec_write(sd, reg->reg & 0xff, reg->val & 0xff);
+   break;
+   }
+   /* fall through */
default:
v4l2_info(sd, "Register %03llx not supported\n", reg->reg);
adv7511_inv_register(sd);
@@ -418,6 +473,7 @@ static int adv7511_log_status(struct v4l2_subdev *sd)
 {
struct adv7511_state *state = get_adv7511_state(sd);
struct adv7511_state_edid *edid = &state->edid;
+   int i;
 
static const char * const states[] = {
"in reset",
@@ -486,7 +542,21 @@ static int adv7511_log_status(struct v4l2_subdev *sd)
else
v4l2_info(sd, "no timings set\n");
v4l2_info(sd, "i2c edid addr: 0x%x\n", state->i2c_edid_addr);
+
+   if (state->i2c_cec == NULL)
+   return 0;
+
v4l2_info(sd, "i2c cec addr: 0x%x\n", state->i2c_cec_addr);
+
+   if (cec_read(sd, 0x4e) & 0x01) {
+   v4l2_info(sd, "cec: 

[PATCH v4 06/10] cec: add HDMI CEC framework

2015-04-23 Thread Kamil Debski
From: Hans Verkuil 

The added HDMI CEC framework provides a generic kernel interface for
HDMI CEC devices.

Signed-off-by: Hans Verkuil 
[k.deb...@samsung.com: Merged CEC Updates commit by Hans Verkuil]
[k.deb...@samsung.com: Merged Update author commit by Hans Verkuil]
[k.deb...@samsung.com: change kthread handling when setting logical
address]
[k.deb...@samsung.com: code cleanup and fixes]
[k.deb...@samsung.com: add missing CEC commands to match spec]
[k.deb...@samsung.com: add RC framework support]
[k.deb...@samsung.com: move and edit documentation]
[k.deb...@samsung.com: add vendor id reporting]
[k.deb...@samsung.com: add possibility to clear assigned logical
addresses]
[k.deb...@samsung.com: documentation fixes, clenaup and expansion]
[k.deb...@samsung.com: reorder of API structs and add reserved fields]
[k.deb...@samsung.com: fix handling of events and fix 32/64bit timespec
problem]
[k.deb...@samsung.com: add cec.h to include/uapi/linux/Kbuild]
Signed-off-by: Kamil Debski 
---
 Documentation/cec.txt |  396 
 drivers/media/Kconfig |6 +
 drivers/media/Makefile|2 +
 drivers/media/cec.c   | 1161 +
 include/media/cec.h   |  140 ++
 include/uapi/linux/Kbuild |1 +
 include/uapi/linux/cec.h  |  303 
 7 files changed, 2009 insertions(+)
 create mode 100644 Documentation/cec.txt
 create mode 100644 drivers/media/cec.c
 create mode 100644 include/media/cec.h
 create mode 100644 include/uapi/linux/cec.h

diff --git a/Documentation/cec.txt b/Documentation/cec.txt
new file mode 100644
index 000..2b6c08a
--- /dev/null
+++ b/Documentation/cec.txt
@@ -0,0 +1,396 @@
+CEC Kernel Support
+==
+
+The CEC framework provides a unified kernel interface for use with HDMI CEC
+hardware. It is designed to handle a multiple variants of hardware. Adding to
+the flexibility of the framework it enables to set which parts of the CEC
+protocol processing is handled by the hardware, by the driver and by the
+userspace application.
+
+
+The CEC Protocol
+
+
+The CEC protocol enables consumer electronic devices to communicate with each
+other through the HDMI connection. The protocol uses logical addresses in the
+communication. The logical address is strictly connected with the functionality
+provided by the device. The TV acting as the communication hub is always
+assigned address 0. The physical address is determined by the physical
+connection between devices.
+
+The protocol enables control of compatible devices with a single remote.
+Synchronous power on/standby, instant playback with changing the content source
+on the TV.
+
+The Kernel Interface
+
+
+CEC Adapter
+---
+
+#define CEC_LOG_ADDR_INVALID 0xff
+
+/* The maximum number of logical addresses one device can be assigned to.
+ * The CEC 2.0 spec allows for only 2 logical addresses at the moment. The
+ * Analog Devices CEC hardware supports 3. So let's go wild and go for 4. */
+#define CEC_MAX_LOG_ADDRS 4
+
+/* The "Primary Device Type" */
+#define CEC_PRIM_DEVTYPE_TV0
+#define CEC_PRIM_DEVTYPE_RECORD1
+#define CEC_PRIM_DEVTYPE_TUNER 3
+#define CEC_PRIM_DEVTYPE_PLAYBACK  4
+#define CEC_PRIM_DEVTYPE_AUDIOSYSTEM   5
+#define CEC_PRIM_DEVTYPE_SWITCH6
+#define CEC_PRIM_DEVTYPE_VIDEOPROC 7
+
+/* The "All Device Types" flags (CEC 2.0) */
+#define CEC_FL_ALL_DEVTYPE_TV  (1 << 7)
+#define CEC_FL_ALL_DEVTYPE_RECORD  (1 << 6)
+#define CEC_FL_ALL_DEVTYPE_TUNER   (1 << 5)
+#define CEC_FL_ALL_DEVTYPE_PLAYBACK(1 << 4)
+#define CEC_FL_ALL_DEVTYPE_AUDIOSYSTEM (1 << 3)
+#define CEC_FL_ALL_DEVTYPE_SWITCH  (1 << 2)
+/* And if you wondering what happened to VIDEOPROC devices: those should
+ * be mapped to a SWITCH. */
+
+/* The logical address types that the CEC device wants to claim */
+#define CEC_LOG_ADDR_TYPE_TV   0
+#define CEC_LOG_ADDR_TYPE_RECORD   1
+#define CEC_LOG_ADDR_TYPE_TUNER2
+#define CEC_LOG_ADDR_TYPE_PLAYBACK 3
+#define CEC_LOG_ADDR_TYPE_AUDIOSYSTEM  4
+#define CEC_LOG_ADDR_TYPE_SPECIFIC 5
+#define CEC_LOG_ADDR_TYPE_UNREGISTERED 6
+/* Switches should use UNREGISTERED.
+ * Video processors should use SPECIFIC. */
+
+/* The CEC version */
+#define CEC_VERSION_1_4B   5
+#define CEC_VERSION_2_06
+
+struct cec_adapter {
+   /* internal fields removed */
+
+   u16 phys_addr;
+   u32 capabilities;
+   u8 version;
+   u8 num_log_addrs;
+   u8 prim_device[CEC_MAX_LOG_ADDRS];
+   u8 log_addr_type[CEC_MAX_LOG_ADDRS];
+   u8 log_addr[CEC_MAX_LOG_ADDRS];
+
+   int (*adap_enable)(struct cec_adapter *adap, bool enable);
+   int (*adap_log_addr)(struct cec_adapter *adap, u8 logical_addr);
+   int (*adap_transmit)(struct cec_adapter *adap, struct cec_msg *msg);
+   void (*adap_transmit_timed_out)(struct cec_adapter *adap);
+

[PATCH v4 05/10] rc: Add HDMI CEC protoctol handling

2015-04-23 Thread Kamil Debski
Add handling of remote control events coming from the HDMI CEC bus.
This patch includes a new keymap that maps values found in the CEC
messages to the keys pressed and released. Also, a new protocol has
been added to the core.

Signed-off-by: Kamil Debski 
---
 drivers/media/rc/keymaps/Makefile |1 +
 drivers/media/rc/keymaps/rc-cec.c |  144 +
 drivers/media/rc/rc-main.c|1 +
 include/media/rc-core.h   |1 +
 include/media/rc-map.h|5 +-
 5 files changed, 151 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/rc/keymaps/rc-cec.c

diff --git a/drivers/media/rc/keymaps/Makefile 
b/drivers/media/rc/keymaps/Makefile
index abf6079..56f10d6 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
rc-behold.o \
rc-behold-columbus.o \
rc-budget-ci-old.o \
+   rc-cec.o \
rc-cinergy-1400.o \
rc-cinergy.o \
rc-delock-61959.o \
diff --git a/drivers/media/rc/keymaps/rc-cec.c 
b/drivers/media/rc/keymaps/rc-cec.c
new file mode 100644
index 000..cc5b318
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-cec.c
@@ -0,0 +1,144 @@
+/* Keytable for the CEC remote control
+ *
+ * Copyright (c) 2015 by Kamil Debski
+ *
+ * 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 
+
+/* CEC Spec "High-Definition Multimedia Interface Specification" can be 
obtained
+ * here: http://xtreamerdev.googlecode.com/files/CEC_Specs.pdf
+ * The list of control codes is listed in Table 27: User Control Codes p. 95 */
+
+static struct rc_map_table cec[] = {
+   { 0x00, KEY_OK },
+   { 0x01, KEY_UP },
+   { 0x02, KEY_DOWN },
+   { 0x03, KEY_LEFT },
+   { 0x04, KEY_RIGHT },
+   { 0x05, KEY_RIGHT_UP },
+   { 0x06, KEY_RIGHT_DOWN },
+   { 0x07, KEY_LEFT_UP },
+   { 0x08, KEY_LEFT_DOWN },
+   { 0x09, KEY_CONTEXT_MENU }, /* CEC Spec: Root Menu - see Note 2 */
+   /* Note 2: This is the initial display that a device shows. It is
+* device-dependent and can be, for example, a contents menu, setup
+* menu, favorite menu or other menu. The actual menu displayed
+* may also depend on the device’s current state. */
+   { 0x0a, KEY_SETUP },
+   { 0x0b, KEY_MENU }, /* CEC Spec: Contents Menu */
+   { 0x0c, KEY_FAVORITES }, /* CEC Spec: Favorite Menu */
+   { 0x0d, KEY_EXIT },
+   /* 0x0e-0x1f: Reserved */
+   /* 0x20-0x29: Keys 0 to 9 */
+   { 0x20, KEY_NUMERIC_0 },
+   { 0x21, KEY_NUMERIC_1 },
+   { 0x22, KEY_NUMERIC_2 },
+   { 0x23, KEY_NUMERIC_3 },
+   { 0x24, KEY_NUMERIC_4 },
+   { 0x25, KEY_NUMERIC_5 },
+   { 0x26, KEY_NUMERIC_6 },
+   { 0x27, KEY_NUMERIC_7 },
+   { 0x28, KEY_NUMERIC_8 },
+   { 0x29, KEY_NUMERIC_9 },
+   { 0x2a, KEY_DOT },
+   { 0x2b, KEY_ENTER },
+   { 0x2c, KEY_CLEAR },
+   /* 0x2d-0x2e: Reserved */
+   { 0x2f, KEY_NEXT_FAVORITE }, /* CEC Spec: Next Favorite */
+   { 0x30, KEY_CHANNELUP },
+   { 0x31, KEY_CHANNELDOWN },
+   { 0x32, KEY_PREVIOUS }, /* CEC Spec: Previous Channel */
+   { 0x33, KEY_SOUND }, /* CEC Spec: Sound Select */
+   { 0x34, KEY_VIDEO }, /* 0x34: CEC Spec: Input Select */
+   { 0x35, KEY_INFO }, /* CEC Spec: Display Information */
+   { 0x36, KEY_HELP },
+   { 0x37, KEY_PAGEUP },
+   { 0x38, KEY_PAGEDOWN },
+   /* 0x39-0x3f: Reserved */
+   { 0x40, KEY_POWER },
+   { 0x41, KEY_VOLUMEUP },
+   { 0x42, KEY_VOLUMEDOWN },
+   { 0x43, KEY_MUTE },
+   { 0x44, KEY_PLAY },
+   { 0x45, KEY_STOP },
+   { 0x46, KEY_PAUSE },
+   { 0x47, KEY_RECORD },
+   { 0x48, KEY_REWIND },
+   { 0x49, KEY_FASTFORWARD },
+   { 0x4a, KEY_EJECTCD }, /* CEC Spec: Eject */
+   { 0x4b, KEY_FORWARD },
+   { 0x4c, KEY_BACK },
+   { 0x4d, KEY_STOP_RECORD }, /* CEC Spec: Stop-Record */
+   { 0x4e, KEY_PAUSE_RECORD }, /* CEC Spec: Pause-Record */
+   /* 0x4f: Reserved */
+   { 0x50, KEY_ANGLE },
+   { 0x51, KEY_TV2 },
+   { 0x52, KEY_VOD }, /* CEC Spec: Video on Demand */
+   { 0x53, KEY_EPG },
+   { 0x54, KEY_TIME }, /* CEC Spec: Timer */
+   { 0x55, KEY_CONFIG },
+   /* 0x56-0x5f: Reserved */
+   { 0x60, KEY_PLAY }, /* CEC Spec: Play Function */
+   { 0x6024, KEY_PLAY },
+   { 0x6020, KEY_PAUSE },
+   { 0x61, KEY_PLAYPAUSE }, /* CEC Spec: Pause-Play Function */
+   { 0x62, KEY_RECORD }, /* Spec: Record Function */
+   { 0x63, KEY_PAUSE }, /* CEC Spec: Pause-Record Function */
+ 

[PATCH v4 04/10] HID: add HDMI CEC specific keycodes

2015-04-23 Thread Kamil Debski
Add HDMI CEC specific keycodes to the keycodes definition.

Signed-off-by: Kamil Debski 
---
 include/uapi/linux/input.h |   12 
 1 file changed, 12 insertions(+)

diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
index 731417c..7430a3f 100644
--- a/include/uapi/linux/input.h
+++ b/include/uapi/linux/input.h
@@ -752,6 +752,18 @@ struct input_keymap_entry {
 #define KEY_KBDINPUTASSIST_ACCEPT  0x264
 #define KEY_KBDINPUTASSIST_CANCEL  0x265
 
+#define KEY_RIGHT_UP   0x266
+#define KEY_RIGHT_DOWN 0x267
+#define KEY_LEFT_UP0x268
+#define KEY_LEFT_DOWN  0x269
+
+#define KEY_NEXT_FAVORITE  0x270
+#define KEY_STOP_RECORD0x271
+#define KEY_PAUSE_RECORD   0x272
+#define KEY_VOD0x273
+#define KEY_UNMUTE 0x274
+#define KEY_DVB0x275
+
 #define BTN_TRIGGER_HAPPY  0x2c0
 #define BTN_TRIGGER_HAPPY1 0x2c0
 #define BTN_TRIGGER_HAPPY2 0x2c1
-- 
1.7.9.5

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


[PATCH v4 07/10] v4l2-subdev: add HDMI CEC ops

2015-04-23 Thread Kamil Debski
From: Hans Verkuil 

Add callbacks to the v4l2_subdev_video_ops.

Signed-off-by: Hans Verkuil 
[k.deb...@samsung.com: Merged changes from CEC Updates commit by Hans Verkuil]
Signed-off-by: Kamil Debski 
---
 include/media/v4l2-subdev.h |8 
 1 file changed, 8 insertions(+)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 2f0a345..9323e10 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -40,6 +40,9 @@
 #define V4L2_SUBDEV_IR_TX_NOTIFY   _IOW('v', 1, u32)
 #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x0001
 
+#define V4L2_SUBDEV_CEC_TX_DONE_IOW('v', 2, u32)
+#define V4L2_SUBDEV_CEC_RX_MSG _IOW('v', 3, struct cec_msg)
+
 struct v4l2_device;
 struct v4l2_ctrl_handler;
 struct v4l2_event_subscription;
@@ -48,6 +51,7 @@ struct v4l2_subdev;
 struct v4l2_subdev_fh;
 struct tuner_setup;
 struct v4l2_mbus_frame_desc;
+struct cec_msg;
 
 /* decode_vbi_line */
 struct v4l2_decode_vbi_line {
@@ -352,6 +356,10 @@ struct v4l2_subdev_video_ops {
 const struct v4l2_mbus_config *cfg);
int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
   unsigned int *size);
+   int (*cec_enable)(struct v4l2_subdev *sd, bool enable);
+   int (*cec_log_addr)(struct v4l2_subdev *sd, u8 logical_addr);
+   int (*cec_transmit)(struct v4l2_subdev *sd, struct cec_msg *msg);
+   void (*cec_transmit_timed_out)(struct v4l2_subdev *sd);
 };
 
 /*
-- 
1.7.9.5

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


[PATCH v4 03/10] dts: exynos4412-odroid*: enable the HDMI CEC device

2015-04-23 Thread Kamil Debski
Add a dts node entry and enable the HDMI CEC device present in the Exynos4
family of SoCs.

Signed-off-by: Kamil Debski 
---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi |4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi 
b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
index 8de12af..e50862d 100644
--- a/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-odroid-common.dtsi
@@ -469,6 +469,10 @@
status = "okay";
};
 
+   cec@100B {
+   status = "okay";
+   };
+
hdmi_ddc: i2c@1388 {
status = "okay";
pinctrl-names = "default";
-- 
1.7.9.5

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


[PATCH v4 01/10] dts: exynos4*: add HDMI CEC pin definition to pinctrl

2015-04-23 Thread Kamil Debski
Add pinctrl nodes for the HDMI CEC device to the Exynos4210 and
Exynos4x12 SoCs. These are required by the HDMI CEC device.

Signed-off-by: Kamil Debski 
---
 arch/arm/boot/dts/exynos4210-pinctrl.dtsi |7 +++
 arch/arm/boot/dts/exynos4x12-pinctrl.dtsi |7 +++
 2 files changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
index a7c2128..9331c62 100644
--- a/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4210-pinctrl.dtsi
@@ -820,6 +820,13 @@
samsung,pin-pud = <1>;
samsung,pin-drv = <0>;
};
+
+   hdmi_cec: hdmi-cec {
+   samsung,pins = "gpx3-6";
+   samsung,pin-function = <3>;
+   samsung,pin-pud = <0>;
+   samsung,pin-drv = <0>;
+   };
};
 
pinctrl@0386 {
diff --git a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
index c141931..875464e 100644
--- a/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
+++ b/arch/arm/boot/dts/exynos4x12-pinctrl.dtsi
@@ -885,6 +885,13 @@
samsung,pin-pud = <0>;
samsung,pin-drv = <0>;
};
+
+   hdmi_cec: hdmi-cec {
+   samsung,pins = "gpx3-6";
+   samsung,pin-function = <3>;
+   samsung,pin-pud = <0>;
+   samsung,pin-drv = <0>;
+   };
};
 
pinctrl@0386 {
-- 
1.7.9.5

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


[PATCH v4 02/10] dts: exynos4: add node for the HDMI CEC device

2015-04-23 Thread Kamil Debski
This patch adds HDMI CEC node specific to the Exynos4210/4x12 SoC series.

Signed-off-by: Kamil Debski 
---
 arch/arm/boot/dts/exynos4.dtsi |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
index e20cdc2..8776db9 100644
--- a/arch/arm/boot/dts/exynos4.dtsi
+++ b/arch/arm/boot/dts/exynos4.dtsi
@@ -704,6 +704,18 @@
status = "disabled";
};
 
+   hdmicec: cec@100B {
+   compatible = "samsung,s5p-cec";
+   reg = <0x100B 0x200>;
+   interrupts = <0 114 0>;
+   clocks = <&clock CLK_HDMI_CEC>;
+   clock-names = "hdmicec";
+   samsung,syscon-phandle = <&pmu_system_controller>;
+   pinctrl-names = "default";
+   pinctrl-0 = <&hdmi_cec>;
+   status = "disabled";
+   };
+
mixer: mixer@12C1 {
compatible = "samsung,exynos4210-mixer";
interrupts = <0 91 0>;
-- 
1.7.9.5

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


[PATCH v4 00/10] HDMI CEC framework

2015-04-23 Thread Kamil Debski
Hi,

This is the fourth version of the HDMI CEC framework. I would like to thank
for all the comments and suggestions to the previous versions of this patch.
I believe that the code has matured enough to be tagged as PATCH and not RFC
as in previous version.

This patchset is base on the linux-next tree. I believe that there will be
some comments to it and there will be some things to fix, hence I am sending
this version now. The next version with appropriate fixes will be based on the
next RC (which I guess will be released soon).

The promiscuous mode included in the previous version caused some discussion and
I decided to drop it. In my opinion it can be useful for debugging, but on the
other hand I believe it can be easily added at a later time, if appropriate.

Best wishes,
Kamil Debski

Changes since v3

- remove the promiscuous mode
- rewrite the devicetree patches
- fixes, expansion and partial rewrite of the documentation
- reorder of API structures and addition of reserved fields
- use own struct to report time (32/64 bit safe)
- fix of handling events
- add cec.h to include/uapi/linux/Kbuild
- fixes in the adv76xx driver (add missing methods, change adv7604 to adv76xx)
- cleanup of debug messages in s5p-cec driver
- remove non necessary claiming of a gpio in the s5p-cec driver
- cleanup headers of the s5p-cec driver

Changes since v2
===-
- added promiscuous mode
- added new key codes to the input framework
- add vendor ID reporting
- add the possibility to clear assigned logical addresses
- cleanup of the rc cec map

Changes since v1

- documentation edited and moved to the Documentation folder
- added key up/down message handling
- add missing CEC commands to the cec.h file

Original cover letter
=

Hi,

The work on a common CEC framework was started over three years ago by Hans
Verkuil. Unfortunately the work has stalled. As I have received the task of
creating a driver for the CEC interface module present on the Exynos range of
SoCs, I got in touch with Hans. He replied that the work stalled due to his
lack of time.

The driver was done in the most part and there were only minor fixes that needed
to be implemented. I would like to bring back the discussion on a common CEC
interface framework.

There are a few things that were still left as TODO, I think they might need
some discussion - for instance the way how the remote controls should be
handled.

Best wishes,
Kamil Debski

Original RFC by Hans Verkuil/Martin Bugge
=
https://www.mail-archive.com/linux-media@vger.kernel.org/msg28735.html

Hans Verkuil (4):
  cec: add HDMI CEC framework
  v4l2-subdev: add HDMI CEC ops
  cec: adv7604: add cec support.
  cec: adv7511: add cec support.

Kamil Debski (6):
  dts: exynos4*: add HDMI CEC pin definition to pinctrl
  dts: exynos4: add node for the HDMI CEC device
  dts: exynos4412-odroid*: enable the HDMI CEC device
  HID: add HDMI CEC specific keycodes
  rc: Add HDMI CEC protoctol handling
  cec: s5p-cec: Add s5p-cec driver

 Documentation/cec.txt  |  396 +++
 .../devicetree/bindings/media/s5p-cec.txt  |   33 +
 arch/arm/boot/dts/exynos4.dtsi |   12 +
 arch/arm/boot/dts/exynos4210-pinctrl.dtsi  |7 +
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi|4 +
 arch/arm/boot/dts/exynos4x12-pinctrl.dtsi  |7 +
 drivers/media/Kconfig  |6 +
 drivers/media/Makefile |2 +
 drivers/media/cec.c| 1161 
 drivers/media/i2c/adv7511.c|  347 +-
 drivers/media/i2c/adv7604.c|  207 +++-
 drivers/media/platform/Kconfig |   10 +
 drivers/media/platform/Makefile|1 +
 drivers/media/platform/s5p-cec/Makefile|4 +
 drivers/media/platform/s5p-cec/exynos_hdmi_cec.h   |   37 +
 .../media/platform/s5p-cec/exynos_hdmi_cecctrl.c   |  208 
 drivers/media/platform/s5p-cec/regs-cec.h  |   96 ++
 drivers/media/platform/s5p-cec/s5p_cec.c   |  283 +
 drivers/media/platform/s5p-cec/s5p_cec.h   |   76 ++
 drivers/media/rc/keymaps/Makefile  |1 +
 drivers/media/rc/keymaps/rc-cec.c  |  144 +++
 drivers/media/rc/rc-main.c |1 +
 include/media/adv7511.h|6 +-
 include/media/cec.h|  140 +++
 include/media/rc-core.h|1 +
 include/media/rc-map.h |5 +-
 include/media/v4l2-subdev.h|8 +
 include/uapi/linux/Kbuild  |1 +
 include/uapi/linux/cec.h   |  303 +
 include/uapi/linux/input.h |   12 +
 30 files changed, 3507 in

Re: [DRAFT 1] Linux Media Summit report - March, 26 2015 - San Jose - CA - USA

2015-04-23 Thread Mauro Carvalho Chehab
Hi Patrick,

Em Thu, 23 Apr 2015 09:06:35 +0200
Patrick Boettcher  escreveu:

> Hi Mauro,
> 
> I could not participate at your Summit, but may have an input to the
> media-controller in DVB - see below.
> 
> 
> On Wed, 22 Apr 2015 15:31:46 -0300 Mauro Carvalho Chehab
>  wrote:
> 
> > This is the first draft for the Linux Media Summit Report.
> > 
> > Please note that the items 3 to 5 are not in good shape. In special,
> > nobody took Etherpad notes on item 4.
> > 
> > Please review. I'll publish a second (final?) draft after having some
> > feedback.
> > 
> > Regards,
> > Mauro
> > 
> > -
> > 
> > Linux Media Summit - March, 26 2015 - San Jose - CA - USA
> >  
> >  
> > Attendees:
> > 
> > 
> > Angelos Manousaridis 
> > Bob Moragues 
> > Chris Kohn
> > Guennadi Liakhovetski 
> > Hans Verkuil 
> > Hyun Kwon
> > Karthik Poduval 
> > Laurent Pinchart 
> > Mauro Carvalho Chehab 
> > Michal Lebik
> > Mohammed CHERIFI mcher...@cisco.com
> > Rafael Chehab 
> > Ron Birkett
> > Schuyler Patton
> > Shuah Khan 
> > 
> > 1) Media Controller support for DVB
> > Mauro presented a set of slides (add link) showing how the DVB
> > pipelines look like and underlined that several topics needs to be
> > addressed by the Media controller:
> > 
> > a) dynamic creation/removal of pipelines
> > b) change media_entity_pipeline_start to also define the final entity
> > c) how to setup pipelines that also envolve audio and DRM?
> > d) how to lock the media controller pipeline between enabling a
> > pipeline and starting it, in 
> > 
> > How to do complex pipelines in DVB?
> >  
> > - The DVB demux can filter MPEG-TS traffic (either in hardware or in
> > software) and can send multiplexed TS to the dvr node, elementary
> > streams to the demux node and can create network interfaces for
> > elementary streams (ES) via the net node.
> > - a given set of elementary streams can go to one of those three
> > options only, or it can be sent directly to a GPU and/or an ALSA
> > pipeline.
> > - there is support for hardware PID filtering at the Kernel, but no
> > support (yet) for a real hw demuxer that splits the MPEG TS into
> > separate DMA MPEG-TS and/or ES streams.
> > - frontend device node is to be attached to the demod entity and it
> > will control the demod, the tuner and a possible LNA via the active
> > Media Controller links.
> > - dvr/net/demux device nodes are attached to the demux entity.
> > - the net interfaces are not (yet) represented via MC: we need the
> > ability to remove entities dynamically for that, and we are not
> > really sure if we want this at all. So, it as agreed to wait for
> > support for removing entities to arrive, then this need can be
> > discussed again.
> > - For now we can safely assume that there is only one Satellite
> > Equipment Control (SEC) in each active data path that goes through a
> > tuner/demod. So each frontend will control just one SEC. Should we
> > encounter really complex scenarios, then we should consider having
> > device nodes for SEC entities.
> 
> What about demod-diversity: demods of some manufacturers can be used to
> combine their demodulated symbols and, due to their different antennas
> and RF-paths, improve the overall reception quality.
> 
> If we ever have someone contributing in this area with hardware-drivers,
> it would be nice to have the user-space possible to select
> demod-combinations. It should be possible to add and remove a demod
> to a diversity-chain when and when not being tuned to a channel.

It makes sense to map demod diversity via the media controller.

Not sure what would be the best way to map it though, as I don't have
a clear understanding about how the hardware pipelines are set for
demod diversity.

The way the media controller currently is is that it maps only the
data flow. There are discussions about how the control flow should
happen.

The data flow for a normal demod is:

IF (or baseband) ---> [demod] ---> MPEG-TS


>From dib0700 demod drivers, I remember that several of the demods have
a concept of a "slave demod". Are those full demods that can get an
IF/baseband input and produce a MPEG-TS output, or are those just
IP blocks that have the IF/baseband input but doesn't produce an
MPEG-TS output, but, instead, sends some sort of data into the "master
demod"?

In other words, would the dataflow be something like

 IF   TS
[tuner] ---> [master demod] ->[  ]
  | IF   TS   [ combiner ] ---> [demux]
  |> [slave demod]  ->[  ]

or:
 IF  TS
[tuner] ---> [master demod] ---> [demux]
  | IF ^
  || (what sort of data?)
  |> [slave demod] |

Or is it something else?

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-med

[PATCH v2 1/4] v4l2-dv-timings: fix rounding error in vsync_bp calculation

2015-04-23 Thread Prashant Laddha
Changed the rounding offsets used in vsync_bp calculation in cvt and
gtf timings. The results for vsync_bp should now match with results
from timing generator spreadsheets for cvt and gtf standards.

In the vsync_bp calculation for cvt, always round down the value of
(CVT_MIN_VSYNC_BP / h_period_est) and then add 1. It thus, reflects
the equation used in timing generator spreadsheet. Using 199 as
rounding offset, could pontentially lead to bumping up the vsync_bp
value by extra 1.

In the vsync_bp calculations for gtf, instead of round up or round
down, round the (CVT_MIN_VSYNC_BP / h_period_est) to the nearest
integer.

Cc: Hans Verkuil 
Cc: Martin Bugge 

Thanks to Martin Bugge  for validating with
standards and suggestions on equations.

Signed-off-by: Prashant Laddha 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index c0e9638..32aa25f 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -368,14 +368,14 @@ bool v4l2_detect_cvt(unsigned frame_height, unsigned 
hfreq, unsigned vsync,
/* Vertical */
if (reduced_blanking) {
v_fp = CVT_RB_V_FPORCH;
-   v_bp = (CVT_RB_MIN_V_BLANK * hfreq + 199) / 100;
+   v_bp = (CVT_RB_MIN_V_BLANK * hfreq) / 100 + 1;
v_bp -= vsync + v_fp;
 
if (v_bp < CVT_RB_MIN_V_BPORCH)
v_bp = CVT_RB_MIN_V_BPORCH;
} else {
v_fp = CVT_MIN_V_PORCH_RND;
-   v_bp = (CVT_MIN_VSYNC_BP * hfreq + 199) / 100 - vsync;
+   v_bp = (CVT_MIN_VSYNC_BP * hfreq) / 100 + 1 - vsync;
 
if (v_bp < CVT_MIN_V_BPORCH)
v_bp = CVT_MIN_V_BPORCH;
@@ -529,7 +529,8 @@ bool v4l2_detect_gtf(unsigned frame_height,
 
/* Vertical */
v_fp = GTF_V_FP;
-   v_bp = (GTF_MIN_VSYNC_BP * hfreq + 99) / 100 - vsync;
+
+   v_bp = (GTF_MIN_VSYNC_BP * hfreq + 50) / 100 - vsync;
image_height = (frame_height - v_fp - vsync - v_bp + 1) & ~0x1;
 
if (aspect.numerator == 0 || aspect.denominator == 0) {
-- 
1.9.1

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


[PATCH v2 3/4] v4l2-dv-timings: add sanity checks in cvt,gtf calculations

2015-04-23 Thread Prashant Laddha
Wrong values of hfreq and image height can lead to strange timings.
Avoid timing calculations for such values.

Suggested By: Martin Bugge 

Cc: Hans Verkuil 
Cc: Martin Bugge 
Signed-off-by: Prashant Laddha 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 16c8ac5..4e09792 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -365,6 +365,9 @@ bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, 
unsigned vsync,
else
return false;
 
+   if (hfreq == 0)
+   return false;
+
/* Vertical */
if (reduced_blanking) {
v_fp = CVT_RB_V_FPORCH;
@@ -382,6 +385,9 @@ bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, 
unsigned vsync,
}
image_height = (frame_height - v_fp - vsync - v_bp + 1) & ~0x1;
 
+   if (image_height < 0)
+   return false;
+
/* Aspect ratio based on vsync */
switch (vsync) {
case 4:
@@ -527,12 +533,18 @@ bool v4l2_detect_gtf(unsigned frame_height,
else
return false;
 
+   if (hfreq == 0)
+   return false;
+
/* Vertical */
v_fp = GTF_V_FP;
 
v_bp = (GTF_MIN_VSYNC_BP * hfreq + 50) / 100 - vsync;
image_height = (frame_height - v_fp - vsync - v_bp + 1) & ~0x1;
 
+   if (image_height < 0)
+   return false;
+
if (aspect.numerator == 0 || aspect.denominator == 0) {
aspect.numerator = 16;
aspect.denominator = 9;
-- 
1.9.1

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


fix for rounding errors in cvt/gtf calculation

2015-04-23 Thread Prashant Laddha
This is second version of patch series towards fixing rounding errors
in cvt,gtf timing calculations.

In version 1, the fixes for rounding errors have added on top of patches
meant for interlaced support. Based on the feedback from Hans, I have 
now (in v2), reworked the patches such that, patches for rounding fixes
will go first.

Also, based on suggestion from Martin, added sanity checks in v2.

Please review following patches and share your comments.   

[PATCH v2 1/4] v4l2-dv-timings: fix rounding error in vsync_bp
[PATCH v2 2/4] v4l2-dv-timings: fix rounding in hblank and hsync
[PATCH v2 3/4] v4l2-dv-timings: add sanity checks in cvt,gtf
[PATCH v2 4/4] v4l2-dv-timings: replace hsync magic number with a

Thanks to Martin for helping me to validate the rounding fixes.

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


[PATCH v2 4/4] v4l2-dv-timings: replace hsync magic number with a macro

2015-04-23 Thread Prashant Laddha
This change will not change timing calculation. In CVT generator
spreadsheet the nominal value of hsync (as a percentage of line)
is 8 percent.

Cc: Hans Verkuil 
Cc: Martin Bugge 
Signed-off-by: Prashant Laddha 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 4e09792..37f0d6f 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -313,6 +313,7 @@ EXPORT_SYMBOL_GPL(v4l2_print_dv_timings);
 #define CVT_MIN_V_BPORCH   7   /* lines */
 #define CVT_MIN_V_PORCH_RND3   /* lines */
 #define CVT_MIN_VSYNC_BP   550 /* min time of vsync + back porch (us) 
*/
+#define CVT_HSYNC_PERCENT   8   /* nominal hsync as percentage of line 
*/
 
 /* Normal blanking for CVT uses GTF to calculate horizontal blanking */
 #define CVT_CELL_GRAN  8   /* character cell granularity */
@@ -442,7 +443,7 @@ bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, 
unsigned vsync,
h_bp = h_blank / 2;
frame_width = image_width + h_blank;
 
-   hsync = frame_width * 8 / 100;
+   hsync = frame_width * CVT_HSYNC_PERCENT / 100;
hsync = (hsync / CVT_CELL_GRAN) * CVT_CELL_GRAN;
h_fp = h_blank - hsync - h_bp;
}
-- 
1.9.1

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


[PATCH v2 2/4] v4l2-dv-timings: fix rounding in hblank and hsync calculation

2015-04-23 Thread Prashant Laddha
Changed the rounding calculation for hblank and hsync to match it
to equations in cvt and gtf standards.

In cvt calculation, hsync needs to be rounded down.

In gtf calculations, hblank needs to be rounded to nearest multiple
of twice the cell granularity and hsync needs to be rounded to the
nearest multiple of cell granularity.

Cc: Hans Verkuil 
Cc: Martin Bugge 
Signed-off-by: Prashant Laddha 
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index 32aa25f..16c8ac5 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -436,8 +436,8 @@ bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, 
unsigned vsync,
h_bp = h_blank / 2;
frame_width = image_width + h_blank;
 
-   hsync = (frame_width * 8 + 50) / 100;
-   hsync = hsync - hsync % CVT_CELL_GRAN;
+   hsync = frame_width * 8 / 100;
+   hsync = (hsync / CVT_CELL_GRAN) * CVT_CELL_GRAN;
h_fp = h_blank - hsync - h_bp;
}
 
@@ -552,14 +552,15 @@ bool v4l2_detect_gtf(unsigned frame_height,
(hfreq * (100 - GTF_S_C_PRIME) + GTF_S_M_PRIME * 1000) 
/ 2) /
(hfreq * (100 - GTF_S_C_PRIME) + GTF_S_M_PRIME * 1000);
 
-   h_blank = h_blank - h_blank % (2 * GTF_CELL_GRAN);
+   h_blank = ((h_blank + GTF_CELL_GRAN) / (2 * GTF_CELL_GRAN)) *
+ (2 * GTF_CELL_GRAN);
frame_width = image_width + h_blank;
 
pix_clk = (image_width + h_blank) * hfreq;
pix_clk = pix_clk / GTF_PXL_CLK_GRAN * GTF_PXL_CLK_GRAN;
 
hsync = (frame_width * 8 + 50) / 100;
-   hsync = hsync - hsync % GTF_CELL_GRAN;
+   hsync = ((hsync + GTF_CELL_GRAN / 2) / GTF_CELL_GRAN) * GTF_CELL_GRAN;
 
h_fp = h_blank / 2 - hsync;
 
-- 
1.9.1

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


[PATCH] allow buffers allocation with DMABUF memory type

2015-04-23 Thread Benjamin Gaignard
Until now the only way to make the driver allocate buffers and
share them using dma_buf was to use V4L2_MEMORY_MMAP memory type.
Use of MMAP memory type is a problem because vb2 never call
dma_buf_map_attachment() to attach itself while queuing the buffer
so dma_buf importer will not know that another device use this buffer.

This patch allow to allocate buffer even for DMABUF memory type
and correctly manage dma_buf buffer attachment.

vb2_mem_ops attach_dmabuf() prototype has been changed to be able
to distinguish if the attachment is done on a already existing
buffer or on imported one.

Signed-off-by: Benjamin Gaignard 
---
 drivers/media/v4l2-core/videobuf2-core.c   | 76 --
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 10 ++--
 drivers/media/v4l2-core/videobuf2-dma-sg.c |  8 ++-
 drivers/media/v4l2-core/videobuf2-vmalloc.c|  8 ++-
 include/media/videobuf2-core.h |  5 +-
 5 files changed, 91 insertions(+), 16 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
b/drivers/media/v4l2-core/videobuf2-core.c
index 1329dcc..c5968aa 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -337,6 +337,67 @@ static void __setup_offsets(struct vb2_queue *q, unsigned 
int n)
 }
 
 /**
+ * __setup_dmabufs() - setup dmabuf fd for every plane in
+ * every buffer on the queue
+ */
+static void __setup_dmabufs(struct vb2_queue *q, unsigned int n)
+{
+   unsigned int buffer, plane;
+   struct vb2_buffer *vb;
+   struct vb2_plane *vb_plane;
+   struct dma_buf *dbuf;
+   void *mem_priv;
+   int fd;
+   int write = !V4L2_TYPE_IS_OUTPUT(q->type);
+   int flags = write ? O_WRONLY : O_RDONLY;
+
+   for (buffer = q->num_buffers; buffer < q->num_buffers + n; ++buffer) {
+   vb = q->bufs[buffer];
+   if (!vb)
+   continue;
+
+   for (plane = 0; plane < vb->num_planes; ++plane) {
+   vb_plane = &vb->planes[plane];
+
+   dbuf = call_ptr_memop(vb, get_dmabuf,
+ vb_plane->mem_priv,
+ flags & O_ACCMODE);
+   if (IS_ERR_OR_NULL(dbuf)) {
+   dprintk(1, "Failed to export buffer %d, " \
+   "plane %d\n", buffer, plane);
+   continue;
+   }
+
+   fd = dma_buf_fd(dbuf, flags & ~O_ACCMODE);
+   if (fd < 0) {
+   dprintk(3, "buffer %d, plane %d failed " \
+   "to export (%d)\n", buffer, plane, fd);
+   dma_buf_put(dbuf);
+   continue;
+   }
+
+   /* Acquire each plane's memory */
+   mem_priv = call_ptr_memop(vb, attach_dmabuf,
+ q->alloc_ctx[plane], dbuf,
+ vb->v4l2_planes[plane].length,
+ write, vb_plane->mem_priv);
+   if (IS_ERR(mem_priv)) {
+   dprintk(1, "Buffer %d plane %d failed "\
+   "to attach dmabuf\n", buffer, plane);
+   dma_buf_put(dbuf);
+   continue;
+   }
+
+   vb_plane->dbuf = dbuf;
+   vb->v4l2_planes[plane].m.fd = fd;
+
+   dprintk(3, "Buffer %d, plane %d fd %x\n",
+   buffer, plane, fd);
+   }
+   }
+}
+
+/**
  * __vb2_queue_alloc() - allocate videobuf buffer structures and (for MMAP 
type)
  * video buffer memory for all buffers/planes on the queue and initializes the
  * queue
@@ -369,8 +430,9 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum 
v4l2_memory memory,
vb->v4l2_buf.type = q->type;
vb->v4l2_buf.memory = memory;
 
-   /* Allocate video buffer memory for the MMAP type */
-   if (memory == V4L2_MEMORY_MMAP) {
+   /* Allocate video buffer memory for the MMAP and DMABUF types */
+   if (memory == V4L2_MEMORY_MMAP ||
+   memory == V4L2_MEMORY_DMABUF) {
ret = __vb2_buf_mem_alloc(vb);
if (ret) {
dprintk(1, "failed allocating memory for "
@@ -400,6 +462,9 @@ static int __vb2_queue_alloc(struct vb2_queue *q, enum 
v4l2_memory memory,
if (memory == V4L2_MEMORY_MMAP)
__setup_offsets(q, buffer);
 
+   if (memory == V4L2_MEMORY_DMABUF)
+   __setup_dmabufs(q, buffer);
+
dprintk(1, "allocated %d buffers, %d plane(s) e

Re: [PATCHv3 0/4] add devm_of_phy_get_by_index and update platform drivers

2015-04-23 Thread Hans de Goede

Hi,

On 23-04-15 01:04, Arun Ramamurthy wrote:

This patch set adds a new API to get phy by index when multiple
phys are present. This patch is based on discussion with Arnd Bergmann
about dt bindings for multiple phys.

History:
v1:
 - Removed null pointers on Dmitry's suggestion
 - Improved documentation in commit messages
 - Exported new phy api
v2:
 - EHCI and OHCI platform Kconfigs select Generic Phy
   to fix build errors in certain configs.
v3:
 - Made GENERIC_PHY an invisible option so
 that other configs can select it
 - Added stubs for devm_of_phy_get_by_index
 - Reformated code

Arun Ramamurthy (4):
   phy: phy-core: Make GENERIC_PHY an invisible option
   phy: core: Add devm_of_phy_get_by_index to phy-core
   usb: ehci-platform: Use devm_of_phy_get_by_index
   usb: ohci-platform: Use devm_of_phy_get_by_index

  Documentation/phy.txt |  7 +++-
  drivers/ata/Kconfig   |  1 -
  drivers/media/platform/exynos4-is/Kconfig |  2 +-
  drivers/phy/Kconfig   |  4 +-
  drivers/phy/phy-core.c| 32 ++
  drivers/usb/host/Kconfig  |  4 +-
  drivers/usb/host/ehci-platform.c  | 69 +++
  drivers/usb/host/ohci-platform.c  | 69 +++
  drivers/video/fbdev/exynos/Kconfig|  2 +-
  include/linux/phy/phy.h   |  8 
  10 files changed, 100 insertions(+), 98 deletions(-)



Patch set looks good to me:

Acked-by: Hans de Goede 

Regards,

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


Re: [PATCH v5 06/10] media: Add registration helpers for V4L2 flash sub-devices

2015-04-23 Thread Sakari Ailus
Hi Jacek,

On Wed, Apr 15, 2015 at 08:48:36AM +0200, Jacek Anaszewski wrote:
> This patch adds helper functions for registering/unregistering
> LED Flash class devices as V4L2 sub-devices. The functions should
> be called from the LED subsystem device driver. In case the
> support for V4L2 Flash sub-devices is disabled in the kernel
> config the functions' empty versions will be used.
> 
> Signed-off-by: Jacek Anaszewski 
> Acked-by: Kyungmin Park 
> Cc: Sakari Ailus 
> Cc: Hans Verkuil 
> ---
>  drivers/media/v4l2-core/Kconfig  |   11 +
>  drivers/media/v4l2-core/Makefile |2 +
>  drivers/media/v4l2-core/v4l2-flash.c |  619 
> ++
>  include/media/v4l2-flash.h   |  145 
>  4 files changed, 777 insertions(+)
>  create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
>  create mode 100644 include/media/v4l2-flash.h
> 
> diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
> index ba7e21a..f034f1a 100644
> --- a/drivers/media/v4l2-core/Kconfig
> +++ b/drivers/media/v4l2-core/Kconfig
> @@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
>  tristate
>  depends on VIDEOBUF2_CORE
>  
> +# Used by LED subsystem flash drivers
> +config V4L2_FLASH_LED_CLASS
> + tristate "Enable support for Flash sub-devices"

How about: "V4L2 flash API for LED flash class devices"?

> + depends on VIDEO_V4L2_SUBDEV_API
> + depends on LEDS_CLASS_FLASH
> + ---help---
> +   Say Y here to enable support for Flash sub-devices, which allow
> +   to control LED class devices with use of V4L2 Flash controls.

How about this: "Say Y here to enable V4L2 flash API support for LED flash
class drivers".

> +
> +   When in doubt, say N.
> +
>  # Used by drivers that need Videobuf modules
>  config VIDEOBUF_GEN
>   tristate
> diff --git a/drivers/media/v4l2-core/Makefile 
> b/drivers/media/v4l2-core/Makefile
> index 63d29f2..44e858c 100644
> --- a/drivers/media/v4l2-core/Makefile
> +++ b/drivers/media/v4l2-core/Makefile
> @@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o
>  
>  obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o
>  
> +obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
> +
>  obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
>  obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
>  obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
> diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
> b/drivers/media/v4l2-core/v4l2-flash.c
> new file mode 100644
> index 000..bed2036
> --- /dev/null
> +++ b/drivers/media/v4l2-core/v4l2-flash.c

I might rename this as v4l2-flash-led-class.c to match the Kconfig option.

> @@ -0,0 +1,619 @@
> +/*
> + * V4L2 Flash LED sub-device registration helpers.
> + *
> + *   Copyright (C) 2015 Samsung Electronics Co., Ltd
> + *   Author: Jacek Anaszewski 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define has_flash_op(v4l2_flash, op) \
> + (v4l2_flash && v4l2_flash->ops->op)
> +
> +#define call_flash_op(v4l2_flash, op, arg)   \
> + (has_flash_op(v4l2_flash, op) ? \
> + v4l2_flash->ops->op(v4l2_flash, arg) :  \
> + -EINVAL)
> +
> +static enum led_brightness __intensity_to_led_brightness(
> + struct v4l2_ctrl *ctrl,
> + s32 intensity)

Fits on previous line.

> +{
> + s64 intensity64 = intensity - ctrl->minimum;

intensity, ctrl->step and ctrl->minimum are 32-bit signed integers. Do you
need a 64-bit integer here?

> +
> + do_div(intensity64, ctrl->step);
> +
> + /*
> +  * Indicator LEDs, unlike torch LEDs, are turned on/off basing on
> +  * the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
> +  * Therefore it must be possible to set it to 0 level which in
> +  * the LED subsystem reflects LED_OFF state.
> +  */
> + if (ctrl->id != V4L2_CID_FLASH_INDICATOR_INTENSITY)
> + ++intensity64;

I think the condition could simply be ctrl->minimum instead, that way I find
it easier to understand what's happening here. I'd expect the minimum for
non-intensity controls always to be non-zero, though, so the end result is
the same. Up to you.

> +
> + return intensity64;
> +}
> +
> +static s32 __led_brightness_to_intensity(struct v4l2_ctrl *ctrl,
> +  enum led_brightness brightness)
> +{
> + /*
> +  * Indicator LEDs, unlike torch LEDs, are turned on/off basing on
> +  * the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
> +  * Do not decrement brightness read from the LED subsystem for
> +  * indicator LED as it may equal 0.

Re: [DRAFT 1] Linux Media Summit report - March, 26 2015 - San Jose - CA - USA

2015-04-23 Thread Hans Verkuil
On 04/22/15 20:31, Mauro Carvalho Chehab wrote:
> This is the first draft for the Linux Media Summit Report.
> 
> Please note that the items 3 to 5 are not in good shape. In special,
> nobody took Etherpad notes on item 4.

Item 4 was just me presenting on ongoing projects. As far as I remember
there was no discussion and a link to my presentation would be enough.
I know I mailed it to you.

> 
> Please review. I'll publish a second (final?) draft after having some
> feedback.
> 
> Regards,
> Mauro
> 
> -
> 
> Linux Media Summit - March, 26 2015 - San Jose - CA - USA
>  
>  
> Attendees:
> 
> 
> Angelos Manousaridis 
> Bob Moragues 
> Chris Kohn
> Guennadi Liakhovetski 
> Hans Verkuil 
> Hyun Kwon
> Karthik Poduval 
> Laurent Pinchart 
> Mauro Carvalho Chehab 
> Michal Lebik
> Mohammed CHERIFI mcher...@cisco.com
> Rafael Chehab 
> Ron Birkett
> Schuyler Patton
> Shuah Khan 
> 
> 1) Media Controller support for DVB
> Mauro presented a set of slides (add link) showing how the DVB pipelines look 
> like and underlined that several topics needs to be addressed by the Media 
> controller:
> 
> a) dynamic creation/removal of pipelines
> b) change media_entity_pipeline_start to also define the final entity
> c) how to setup pipelines that also envolve audio and DRM?
> d) how to lock the media controller pipeline between enabling a pipeline and 
> starting it, in 
> 
> How to do complex pipelines in DVB?
>  
> - The DVB demux can filter MPEG-TS traffic (either in hardware or in 
> software) and can send multiplexed TS to the dvr node, elementary streams to 
> the demux node and can create network interfaces for elementary streams (ES) 
> via the net node.
> - a given set of elementary streams can go to one of those three options 
> only, or it can be sent directly to a GPU and/or an ALSA pipeline.
> - there is support for hardware PID filtering at the Kernel, but no support 
> (yet) for a real hw demuxer that splits the MPEG TS into separate DMA MPEG-TS 
> and/or ES streams.
> - frontend device node is to be attached to the demod entity and it will 
> control the demod, the tuner and a possible LNA via the active Media 
> Controller links.
> - dvr/net/demux device nodes are attached to the demux entity.
> - the net interfaces are not (yet) represented via MC: we need the ability to 
> remove entities dynamically for that, and we are not really sure if we want 
> this at all. So, it as agreed to wait for support for removing entities to 
> arrive, then this need can be discussed again.
> - For now we can safely assume that there is only one Satellite Equipment 
> Control (SEC) in each active data path that goes through a tuner/demod. So 
> each frontend will control just one SEC.
>   Should we encounter really complex scenarios, then we should consider 
> having device nodes for SEC entities.
> 
> It was decided that:
> - The Satellite Equipment Control (SEC) should be an entity, linking them to 
> the connector
> - Deprecated osd, teletext, video and audio device nodes are only used in 
> av7110. The av7110 driver uses lots of deprecated stuff, we should move this 
> to staging and deprecate the whole driver and see who starts yelling.
> - Document the high-level overview of DVB (Mauro). Layout needs to be changed 
> to be in line with the other APIs (Hans?).
> - Mauro will rename “frontend” entity to “demod” at the Media Controller, as 
> the frontend is actually a set of elements.
> - Laurent will prepare a proposal of reporting device nodes via a new entity 
> properties API addition
>  
> 2) Media Tokens
> 
> Shuah submitted some RFC Patches: 
> https://git.kernel.org/cgit/linux/kernel/git/shuah/linux.git
> 
> - Changes from the previous RFC:
>- simplified after switching au0828 to vb2
>- token created by the bridge driver
> 
> It was decided that:
> - Preference for using the Media Controller. That requires that MC support 
> for Alsa is added, the usbaudio driver then needs to find and hook into the 
> MC from the bridge driver.
> - The RFC patches will help to identify on what places the driver should be 
> touched
> - Shuag

Shuag -> Shuah :-)

> from Samsung is willing to do the changes at ALSA; Rafael is willing to add 
> MC support at au0828/au8522.
> - Media controler dev (mdev) will have to be created as a dev resource on the 
> parent device to the bridge device similar to media tokens
> - Need a new media_device_create() interace to allocate it as a device 
> resource. This routine will either return media device if one is created or 
> create it.
> - Both au0828 and ALSA will first call media_device_create(). Coordinate 
> register/unregister??
>   
> 3) FPGA/Project ARA: dynamic reconfiguration (http://www.projectara.com/)
> - partial pipeline removal: controlled removal in the case of FPGA 
> reconfiguration. subdevs/entities will be removed: unsupported today.
> - no notification in MC when things change: we likely need an event

Re: [DRAFT 1] Linux Media Summit report - March, 26 2015 - San Jose - CA - USA

2015-04-23 Thread Patrick Boettcher
Hi Mauro,

I could not participate at your Summit, but may have an input to the
media-controller in DVB - see below.


On Wed, 22 Apr 2015 15:31:46 -0300 Mauro Carvalho Chehab
 wrote:

> This is the first draft for the Linux Media Summit Report.
> 
> Please note that the items 3 to 5 are not in good shape. In special,
> nobody took Etherpad notes on item 4.
> 
> Please review. I'll publish a second (final?) draft after having some
> feedback.
> 
> Regards,
> Mauro
> 
> -
> 
> Linux Media Summit - March, 26 2015 - San Jose - CA - USA
>  
>  
> Attendees:
> 
> 
> Angelos Manousaridis 
> Bob Moragues 
> Chris Kohn
> Guennadi Liakhovetski 
> Hans Verkuil 
> Hyun Kwon
> Karthik Poduval 
> Laurent Pinchart 
> Mauro Carvalho Chehab 
> Michal Lebik
> Mohammed CHERIFI mcher...@cisco.com
> Rafael Chehab 
> Ron Birkett
> Schuyler Patton
> Shuah Khan 
> 
> 1) Media Controller support for DVB
> Mauro presented a set of slides (add link) showing how the DVB
> pipelines look like and underlined that several topics needs to be
> addressed by the Media controller:
> 
> a) dynamic creation/removal of pipelines
> b) change media_entity_pipeline_start to also define the final entity
> c) how to setup pipelines that also envolve audio and DRM?
> d) how to lock the media controller pipeline between enabling a
> pipeline and starting it, in 
> 
> How to do complex pipelines in DVB?
>  
> - The DVB demux can filter MPEG-TS traffic (either in hardware or in
> software) and can send multiplexed TS to the dvr node, elementary
> streams to the demux node and can create network interfaces for
> elementary streams (ES) via the net node.
> - a given set of elementary streams can go to one of those three
> options only, or it can be sent directly to a GPU and/or an ALSA
> pipeline.
> - there is support for hardware PID filtering at the Kernel, but no
> support (yet) for a real hw demuxer that splits the MPEG TS into
> separate DMA MPEG-TS and/or ES streams.
> - frontend device node is to be attached to the demod entity and it
> will control the demod, the tuner and a possible LNA via the active
> Media Controller links.
> - dvr/net/demux device nodes are attached to the demux entity.
> - the net interfaces are not (yet) represented via MC: we need the
> ability to remove entities dynamically for that, and we are not
> really sure if we want this at all. So, it as agreed to wait for
> support for removing entities to arrive, then this need can be
> discussed again.
> - For now we can safely assume that there is only one Satellite
> Equipment Control (SEC) in each active data path that goes through a
> tuner/demod. So each frontend will control just one SEC. Should we
> encounter really complex scenarios, then we should consider having
> device nodes for SEC entities.

What about demod-diversity: demods of some manufacturers can be used to
combine their demodulated symbols and, due to their different antennas
and RF-paths, improve the overall reception quality.

If we ever have someone contributing in this area with hardware-drivers,
it would be nice to have the user-space possible to select
demod-combinations. It should be possible to add and remove a demod
to a diversity-chain when and when not being tuned to a channel.

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