[PATCH] MAINTAINERS: Update ivtv mailing lists as subscriber-only

2014-10-26 Thread Joe Perches
Mark these as subscriber-only mailing lists.

Signed-off-by: Joe Perches 
---
I got rejects not moderation emails for patches to these lists...

 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1b063fc..2e353c7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2684,7 +2684,7 @@ F:drivers/net/wireless/cw1200/
 
 CX18 VIDEO4LINUX DRIVER
 M: Andy Walls 
-L: ivtv-de...@ivtvdriver.org (moderated for non-subscribers)
+L: ivtv-de...@ivtvdriver.org (subscribers-only)
 L: linux-media@vger.kernel.org
 T: git git://linuxtv.org/media_tree.git
 W: http://linuxtv.org
@@ -5152,7 +5152,7 @@ F:drivers/media/tuners/it913x*
 
 IVTV VIDEO4LINUX DRIVER
 M: Andy Walls 
-L: ivtv-de...@ivtvdriver.org (moderated for non-subscribers)
+L: ivtv-de...@ivtvdriver.org (subscribers-only)
 L: linux-media@vger.kernel.org
 T: git git://linuxtv.org/media_tree.git
 W: http://www.ivtvdriver.org


--
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 00/11] treewide: mask then shift defects and style updates

2014-10-26 Thread Joe Perches
logical mask has lower precedence than shift but should be
done before the shift so parentheses are generally required.

And when masking with a fixed value after a shift, normal kernel
style has the shift on the left, then the shift on the right so
convert a few non-conforming uses.

Joe Perches (11):
  block: nvme-scsi: Fix probable mask then right shift defects
  radeon: evergreen: Fix probable mask then right shift defects
  aiptek: Fix probable mask then right shift defects
  dvb-net: Fix probable mask then right shift defects
  cx25840/cx18: Use standard ordering of mask and shift
  wm8350-core: Fix probable mask then right shift defect
  iwlwifi: dvm: Fix probable mask then right shift defect
  ssb: driver_chip_comon_pmu: Fix probable mask then right shift defect
  tty: ipwireless: Fix probable mask then right shift defects
  hwa-hc: Fix probable mask then right shift defect
  sound: ad1889: Fix probable mask then right shift defects

 drivers/block/nvme-scsi.c| 12 ++--
 drivers/gpu/drm/radeon/evergreen.c   |  3 ++-
 drivers/input/tablet/aiptek.c|  6 +++---
 drivers/media/dvb-core/dvb_net.c |  4 +++-
 drivers/media/i2c/cx25840/cx25840-core.c | 12 ++--
 drivers/media/pci/cx18/cx18-av-core.c| 16 
 drivers/mfd/wm8350-core.c|  2 +-
 drivers/net/wireless/iwlwifi/dvm/lib.c   |  4 ++--
 drivers/ssb/driver_chipcommon_pmu.c  |  4 ++--
 drivers/tty/ipwireless/hardware.c| 12 ++--
 drivers/usb/host/hwa-hc.c|  2 +-
 sound/pci/ad1889.c   |  8 
 12 files changed, 44 insertions(+), 41 deletions(-)

-- 
2.1.2

--
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/11] dvb-net: Fix probable mask then right shift defects

2014-10-26 Thread Joe Perches
Precedence of & and >> is not the same and is not left to right.
shift has higher precedence and should be done after the mask.

Add parentheses around the mask.

Signed-off-by: Joe Perches 
---
 drivers/media/dvb-core/dvb_net.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
index 059e611..441814b 100644
--- a/drivers/media/dvb-core/dvb_net.c
+++ b/drivers/media/dvb-core/dvb_net.c
@@ -379,7 +379,9 @@ static void dvb_net_ule( struct net_device *dev, const u8 
*buf, size_t buf_len )
/* Check TS error conditions: sync_byte, 
transport_error_indicator, scrambling_control . */
if ((ts[0] != TS_SYNC) || (ts[1] & TS_TEI) || ((ts[3] & 
TS_SC) != 0)) {
printk(KERN_WARNING "%lu: Invalid TS cell: SYNC 
%#x, TEI %u, SC %#x.\n",
-  priv->ts_count, ts[0], ts[1] & TS_TEI >> 
7, ts[3] & 0xC0 >> 6);
+  priv->ts_count, ts[0],
+  (ts[1] & TS_TEI) >> 7,
+  (ts[3] & 0xC0) >> 6);
 
/* Drop partly decoded SNDU, reset state, 
resync on PUSI. */
if (priv->ule_skb) {
-- 
2.1.2

--
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/11] cx25840/cx18: Use standard ordering of mask and shift

2014-10-26 Thread Joe Perches
Precedence of & and >> is not the same and is not left to right.
shift has higher precedence and should be done after the mask.

This use has a mask then shift which is not the normal style.

Move the shift before the mask to match nearly all the other
uses in kernel.

Signed-off-by: Joe Perches 
---
 drivers/media/i2c/cx25840/cx25840-core.c | 12 ++--
 drivers/media/pci/cx18/cx18-av-core.c| 16 
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
b/drivers/media/i2c/cx25840/cx25840-core.c
index e453a3f..0327032 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -879,7 +879,7 @@ void cx25840_std_setup(struct i2c_client *client)
/* Sets horizontal blanking delay and active lines */
cx25840_write(client, 0x470, hblank);
cx25840_write(client, 0x471,
-   0xff & (((hblank >> 8) & 0x3) | (hactive << 4)));
+ (((hblank >> 8) & 0x3) | (hactive << 4)) & 0xff);
cx25840_write(client, 0x472, hactive >> 4);
 
/* Sets burst gate delay */
@@ -888,13 +888,13 @@ void cx25840_std_setup(struct i2c_client *client)
/* Sets vertical blanking delay and active duration */
cx25840_write(client, 0x474, vblank);
cx25840_write(client, 0x475,
-   0xff & (((vblank >> 8) & 0x3) | (vactive << 4)));
+ (((vblank >> 8) & 0x3) | (vactive << 4)) & 0xff);
cx25840_write(client, 0x476, vactive >> 4);
cx25840_write(client, 0x477, vblank656);
 
/* Sets src decimation rate */
-   cx25840_write(client, 0x478, 0xff & src_decimation);
-   cx25840_write(client, 0x479, 0xff & (src_decimation >> 8));
+   cx25840_write(client, 0x478, src_decimation & 0xff);
+   cx25840_write(client, 0x479, (src_decimation >> 8) & 0xff);
 
/* Sets Luma and UV Low pass filters */
cx25840_write(client, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30));
@@ -904,8 +904,8 @@ void cx25840_std_setup(struct i2c_client *client)
 
/* Sets SC Step*/
cx25840_write(client, 0x47c, sc);
-   cx25840_write(client, 0x47d, 0xff & sc >> 8);
-   cx25840_write(client, 0x47e, 0xff & sc >> 16);
+   cx25840_write(client, 0x47d, (sc >> 8) & 0xff);
+   cx25840_write(client, 0x47e, (sc >> 16) & 0xff);
 
/* Sets VBI parameters */
if (std & V4L2_STD_625_50) {
diff --git a/drivers/media/pci/cx18/cx18-av-core.c 
b/drivers/media/pci/cx18/cx18-av-core.c
index 2d3afe0..45be26c 100644
--- a/drivers/media/pci/cx18/cx18-av-core.c
+++ b/drivers/media/pci/cx18/cx18-av-core.c
@@ -490,8 +490,8 @@ void cx18_av_std_setup(struct cx18 *cx)
 
/* Sets horizontal blanking delay and active lines */
cx18_av_write(cx, 0x470, hblank);
-   cx18_av_write(cx, 0x471, 0xff & (((hblank >> 8) & 0x3) |
-   (hactive << 4)));
+   cx18_av_write(cx, 0x471,
+ (((hblank >> 8) & 0x3) | (hactive << 4)) & 0xff);
cx18_av_write(cx, 0x472, hactive >> 4);
 
/* Sets burst gate delay */
@@ -499,14 +499,14 @@ void cx18_av_std_setup(struct cx18 *cx)
 
/* Sets vertical blanking delay and active duration */
cx18_av_write(cx, 0x474, vblank);
-   cx18_av_write(cx, 0x475, 0xff & (((vblank >> 8) & 0x3) |
-   (vactive << 4)));
+   cx18_av_write(cx, 0x475,
+ (((vblank >> 8) & 0x3) | (vactive << 4)) & 0xff);
cx18_av_write(cx, 0x476, vactive >> 4);
cx18_av_write(cx, 0x477, vblank656);
 
/* Sets src decimation rate */
-   cx18_av_write(cx, 0x478, 0xff & src_decimation);
-   cx18_av_write(cx, 0x479, 0xff & (src_decimation >> 8));
+   cx18_av_write(cx, 0x478, src_decimation & 0xff);
+   cx18_av_write(cx, 0x479, (src_decimation >> 8) & 0xff);
 
/* Sets Luma and UV Low pass filters */
cx18_av_write(cx, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30));
@@ -516,8 +516,8 @@ void cx18_av_std_setup(struct cx18 *cx)
 
/* Sets SC Step*/
cx18_av_write(cx, 0x47c, sc);
-   cx18_av_write(cx, 0x47d, 0xff & sc >> 8);
-   cx18_av_write(cx, 0x47e, 0xff & sc >> 16);
+   cx18_av_write(cx, 0x47d, (sc >> 8) & 0xff);
+   cx18_av_write(cx, 0x47e, (sc >> 16) & 0xff);
 
if (std & V4L2_STD_625_50) {
state->slicer_line_delay = 1;
-- 
2.1.2

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


cron job: media_tree daily build: ERRORS

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

Results of the daily build of media_tree:

date:   Mon Oct 27 04:00:39 CET 2014
git branch: test
git hash:   1ef24960ab78554fe7e8e77d8fc86524fbd60d3c
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-34-g71e642a
host hardware:  x86_64
host os:3.17-0.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: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.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: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: 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-i686: OK
linux-3.17-i686: OK
linux-3.18-rc1-i686: ERRORS
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: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: 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-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-rc1-x86_64: ERRORS
apps: OK
spec-git: OK
sparse: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/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: SPI interface camera sensor driver for soc_camera framework

2014-10-26 Thread Kassey
hi, Dmitri:
is there any sample driver for SPI interface camera sensor driver
base don soc_camera framework, other than the i2c interface ?
thanks.

-- 
Best regards
Kassey
--
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: [RFCv4 PATCH 01/15] videobuf2-core.h: improve documentation

2014-10-26 Thread Laurent Pinchart
Hi Hans,

Thank you for the patch.

On Thursday 23 October 2014 13:21:28 Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> Document that drivers can access/modify the buffer contents in buf_prepare
> and buf_finish. That was not clearly stated before.
> 
> Signed-off-by: Hans Verkuil 

Acked-by: Laurent Pinchart 

> ---
>  include/media/videobuf2-core.h | 32 +---
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
> index 6ef2d01..70ace7c 100644
> --- a/include/media/videobuf2-core.h
> +++ b/include/media/videobuf2-core.h
> @@ -270,22 +270,24 @@ struct vb2_buffer {
>   *   queue setup from completing successfully; optional.
>   * @buf_prepare: called every time the buffer is queued from userspace
>   *   and from the VIDIOC_PREPARE_BUF ioctl; drivers may
> - *   perform any initialization required before each hardware
> - *   operation in this callback; drivers that support
> - *   VIDIOC_CREATE_BUFS must also validate the buffer size;
> - *   if an error is returned, the buffer will not be queued
> - *   in driver; optional.
> + *   perform any initialization required before each
> + *   hardware operation in this callback; drivers can
> + *   access/modify the buffer here as it is still synced for
> + *   the CPU; drivers that support VIDIOC_CREATE_BUFS must
> + *   also validate the buffer size; if an error is returned,
> + *   the buffer will not be queued in driver; optional.
>   * @buf_finish:  called before every dequeue of the buffer back 
> to
> - *   userspace; drivers may perform any operations required
> - *   before userspace accesses the buffer; optional. The
> - *   buffer state can be one of the following: DONE and
> - *   ERROR occur while streaming is in progress, and the
> - *   PREPARED state occurs when the queue has been canceled
> - *   and all pending buffers are being returned to their
> - *   default DEQUEUED state. Typically you only have to do
> - *   something if the state is VB2_BUF_STATE_DONE, since in
> - *   all other cases the buffer contents will be ignored
> - *   anyway.
> + *   userspace; the buffer is synced for the CPU, so drivers
> + *   can access/modify the buffer contents; drivers may
> + *   perform any operations required before userspace
> + *   accesses the buffer; optional. The buffer state can be
> + *   one of the following: DONE and ERROR occur while
> + *   streaming is in progress, and the PREPARED state occurs
> + *   when the queue has been canceled and all pending
> + *   buffers are being returned to their default DEQUEUED
> + *   state. Typically you only have to do something if the
> + *   state is VB2_BUF_STATE_DONE, since in all other cases
> + *   the buffer contents will be ignored anyway.
>   * @buf_cleanup: called once before the buffer is freed; drivers may
>   *   perform any additional cleanup; optional.
>   * @start_streaming: called once to enter 'streaming' state; the driver 
may

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] adv7604: Add DT parsing support

2014-10-26 Thread Laurent Pinchart
Hi Jean-Michel,

On Thursday 23 October 2014 07:51:50 Jean-Michel Hautbois wrote:
> 2014-10-23 1:53 GMT+02:00 Laurent Pinchart:
> > On Wednesday 22 October 2014 17:34:21 Jean-Michel Hautbois wrote:
> >> This patch adds support for DT parsing of ADV7604 as well as ADV7611.
> >> It needs to be improved in order to get ports parsing too.
> > 
> > Let's improve it then :-) The DT bindings as proposed by this patch are
> > incomplete, that's just asking for trouble.
> > 
> > How would you model the adv7604 ports ?
> 
> I am opened to suggestions :).
> But it has to remain as simple as possible, ideally allowing for giving
> names to the ports.
> As done today, it works, ports are parsed but are all the same...

The ADV7611 was easy, it had a single HDMI input only. The ADV7612 is easy as 
well as it just has two separate HDMI inputs.

The ADV7604 is a more complex beast. The HDMI inputs shouldn't be much of an 
issue as they're independent and multiplexed internally. You can just create 
one pad per HDMI input.

The analog inputs, however, can't be modeled as easily. A naive approach would 
be to create one pad for each of the 12 analog inputs, but the chip has three 
separate ADCs and can combine 3 inputs in a single digital video stream. I 
don't know how we should model support for that. Lars-Peter, Hans, would you 
have a revolutionary idea to same the world today ?

> >> Signed-off-by: Jean-Michel Hautbois 

[...]

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 1/2] i2c: Add generic support passing secondary devices addresses

2014-10-26 Thread Laurent Pinchart
Hi Jean-Michel,

On Thursday 23 October 2014 07:59:53 Jean-Michel Hautbois wrote:
> 2014-10-23 1:37 GMT+02:00 Laurent Pinchart:
> > On Wednesday 22 October 2014 17:30:47 Jean-Michel Hautbois wrote:
> >> Some I2C devices have multiple addresses assigned, for example each
> >> address corresponding to a different internal register map page of the
> >> device. So far drivers which need support for this have handled this with
> >> a driver specific and non-generic implementation, e.g. passing the
> >> additional address via platform data.
> >> 
> >> This patch provides a new helper function called
> >> i2c_new_secondary_device()
> >> which is intended to provide a generic way to get the secondary address
> >> as well as instantiate a struct i2c_client for the secondary address.
> >> 
> >> The function expects a pointer to the primary i2c_client, a name
> >> for the secondary address and an optional default address. The name is
> >> used as a handle to specify which secondary address to get.
> >> 
> >> The default address is used as a fallback in case no secondary address
> >> was explicitly specified. In case no secondary address and no default
> >> address were specified the function returns NULL.
> >> 
> >> For now the function only supports look-up of the secondary address
> >> from devicetree, but it can be extended in the future
> >> to for example support board files and/or ACPI.
> > 
> > As this is core code I believe the DT bindings should be documented
> > somewhere in Documentation/devicetree/bindings/i2c/.
> 
> Mmh, probably yes, but I don't know where precisely, as all the
> bindings are devices specific here...

Lucky you, you can create the I2C core DT bindings documentation :-) 
Documentation/devicetree/bindings/i2c/i2c.txt sounds like a good candidate.

> >> Signed-off-by: Jean-Michel Hautbois 
> >> ---
> >> 
> >>  drivers/i2c/i2c-core.c | 40 
> >>  include/linux/i2c.h|  8 
> >>  2 files changed, 48 insertions(+)
> >> 
> >> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> >> index 2f90ac6..fd3b07c 100644
> >> --- a/drivers/i2c/i2c-core.c
> >> +++ b/drivers/i2c/i2c-core.c
> >> @@ -1166,6 +1166,46 @@ struct i2c_client *i2c_new_dummy(struct
> >> i2c_adapter
> >> *adapter, u16 address) }
> >> 
> >>  EXPORT_SYMBOL_GPL(i2c_new_dummy);
> >> 
> >> +/**
> >> + * i2c_new_secondary_device - Helper to get the instantiated secondary
> >> address
> > 
> > It does more than that, it also creates the device.
> 
> Right, how about :
> + * i2c_new_secondary_device - Helper to get the instantiated secondary
> address
> + * and create the associated device
> 
> >> + * @client: Handle to the primary client
> >> + * @name: Handle to specify which secondary address to get
> >> + * @default_addr: Used as a fallback if no secondary address was
> >> specified
> >> + * Context: can sleep
> >> + *
> >> + * This returns an I2C client bound to the "dummy" driver based on DT
> >> parsing.
> > 
> > Could you elaborate on that ? I would explain that the address is
> > retrieved from the firmware based on the name, and that default_addr is
> > used in case the firmware doesn't provide any information.
> 
> Something like that ?
> + * This returns an I2C client bound to the "dummy" driver based on DT
> parsing.
> + * It retrieves the address based on the name.
> + * It uses default_addr if no information is provided by firmware.

"I2C clients can be composed of multiple I2C slaves bound together in a single 
component. The I2C client driver then binds to the master I2C slave and needs 
to create I2C dummy clients to communicate with all the other slaves.

This function creates an returns an I2C dummy client whose I2C address is 
retrieved from the platform firmware based on the given slave name. If no 
address is specified by the firmware default_addr is used.

On DT-based platforms the address is retrieved from the "reg" property entry 
cell whose "reg-names" value matches the slave name."

> >> + *
> >> + * This returns the new i2c client, which should be saved for later use
> >> with
> >> + * i2c_unregister_device(); or NULL to indicate an error.
> >> + */
> >> +struct i2c_client *i2c_new_secondary_device(struct i2c_client *client,
> >> + const char *name,
> >> + u16 default_addr)
> >> +{
> >> + int i;
> >> + u32 addr;
> >> + struct device_node *np;
> >> +
> >> + np = client->dev.of_node;
> >> +
> >> + if (np) {
> >> + i = of_property_match_string(np, "reg-names", name);
> >> + if (i >= 0)
> >> + of_property_read_u32_index(np, "reg", i, &addr);
> > 
> > This call could fail in which case addr will be uninitialized.
> > 
> >> + else if (default_addr != 0)
> >> + addr = default_addr;
> >> + else
> >> + addr = NULL;
> > 
> > addr isn't a pointer. I'm s

Re: [PATCH] [media] uvc: Fix destruction order in uvc_delete()

2014-10-26 Thread Laurent Pinchart
Hi Takashi,

Thank you for the patch.

On Friday 24 October 2014 10:10:20 Takashi Iwai wrote:
> We've got a bug report at disconnecting a Webcam, where the kernel
> spews warnings like below:
>   WARNING: CPU: 0 PID: 8385 at ../fs/sysfs/group.c:219
> sysfs_remove_group+0x87/0x90() sysfs group c0b2350c not found for kobject
> 'event3'
>   CPU: 0 PID: 8385 Comm: queue2:src Not tainted 3.16.2-1.gdcee397-default #1
> Hardware name: ASUSTeK Computer INC. A7N8X-E/A7N8X-E, BIOS ASUS A7N8X-E
> Deluxe ACPI BIOS Rev 1013  11/12/2004 c08d0705 ddc75cbc c0718c5b ddc75ccc
> c024b654 c08c6d44 ddc75ce8 20c1 c08d0705 00db c03d1ec7 c03d1ec7
> 0009  c0b2350c d62c9064 ddc75cd4 c024b6a3 0009 ddc75ccc
> c08c6d44 ddc75ce8 ddc75cfc c03d1ec7 Call Trace:
> [] try_stack_unwind+0x156/0x170
> [] dump_trace+0x53/0x180
> [] show_trace_log_lvl+0x46/0x50
> [] show_stack_log_lvl+0x51/0xe0
> [] show_stack+0x27/0x50
> [] dump_stack+0x3e/0x4e
> [] warn_slowpath_common+0x84/0xa0
> [] warn_slowpath_fmt+0x33/0x40
> [] sysfs_remove_group+0x87/0x90
> [] device_del+0x34/0x180
> [] evdev_disconnect+0x19/0x50
> [] __input_unregister_device+0x9a/0x140
> [] input_unregister_device+0x45/0x80
> [] uvc_delete+0x26/0x110 [uvcvideo]
> [] v4l2_device_release+0x98/0xc0 [videodev]
> [] device_release+0x2b/0x90
> [] kobject_cleanup+0x6f/0x1a0
> [] v4l2_release+0x43/0x70 [videodev]
> [] __fput+0xb1/0x1b0
> [] task_work_run+0x91/0xb0
> [] do_exit+0x265/0x910
> [] do_group_exit+0x34/0xa0
> [] get_signal_to_deliver+0x17f/0x590
> [] do_signal+0x3a/0x960
> [] do_notify_resume+0x67/0x90
> [] work_notifysig+0x30/0x3b
> [] 0xb7739e5f
>---[ end trace b1e56095a485b631 ]---
> 
> The cause is that uvc_status_cleanup() is called after usb_put_*() in
> uvc_delete().  usb_put_*() removes the sysfs parent and eventually
> removes the children recursively, so the later device_del() can't find
> its sysfs.  The fix is simply rearrange the call orders in
> uvc_delete() so that the child is removed before the parent.
> 
> Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=897736
> Reported-and-tested-by: Martin Pluskal 
> Cc: 
> Signed-off-by: Takashi Iwai 

Acked-by: Laurent Pinchart 

I've applied the patch to my tree and will send a pull request for the next 
kernel version.

> ---
>  drivers/media/usb/uvc/uvc_driver.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c
> b/drivers/media/usb/uvc/uvc_driver.c index 7c8322d4fc63..3c07af96b30f
> 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1623,12 +1623,12 @@ static void uvc_delete(struct uvc_device *dev)
>  {
>   struct list_head *p, *n;
> 
> - usb_put_intf(dev->intf);
> - usb_put_dev(dev->udev);
> -
>   uvc_status_cleanup(dev);
>   uvc_ctrl_cleanup_device(dev);
> 
> + usb_put_intf(dev->intf);
> + usb_put_dev(dev->udev);
> +
>   if (dev->vdev.dev)
>   v4l2_device_unregister(&dev->vdev);
>  #ifdef CONFIG_MEDIA_CONTROLLER

-- 
Regards,

Laurent Pinchart

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


Re: VBI on PVR-500 stopped working between kernels 3.6 and 3.13

2014-10-26 Thread Andy Walls
On October 26, 2014 5:35:30 PM EDT, Christopher Neufeld 
 wrote:
>Andy,
>
>On Sun, 26 Oct 2014 13:41:14 -0400, Andy Walls
> said:
>
>> Can you verify that 
>
>>  v4l2-ctl -d  --get-fmt-sliced-vbi --get-ctrl=stream_vbi_format
>
>> also fails, and that
>
>Yes, that also fails.
>
>>  v4l2-ctl --list-devices
>>  v4l2-ctl -d /dev/vbi --set-fmt-sliced-vbi=cc=1
>--set-ctrl=stream_vbi_format=1
>>  v4l2-ctl -d /dev/vbi --get-fmt-sliced-vbi
>--get-ctrl=stream_vbi_format
>
>> both succeed on the corresponding vbi node?
>
>Yes, those succeed.  So, that solves my problem, thank you.
>
>> If you can use the /dev/vbiN node as a work-around, please do.
>
>I will switch to doing that, and update the MythTV wiki appropriately. 
>I
>assume that this is the correct invocation for any similar capture
>devices,
>not just the PVR-500 and family.
>
>
>On Sun, 26 Oct 2014 14:28:15 -0400, Andy Walls
> said:
>
>> FYI, MythTV has already worked around it:
>> https://code.mythtv.org/trac/ticket/11723
>>
>https://github.com/MythTV/mythtv/commit/25310069a1154213cbc94c903c8b0ace30893ec4
>
>Ah, well then that part of my bug report was incorrect.  Sometimes
>shows
>don't send caption data, even the same program one week later.  I
>happened
>to have two recordings in standard definition that had no captions, but
>one
>recorded last night did, as might be expected if MythTV already worked
>around it.
>
>Thank you for your time on this, Andy and Hans.  I will update my
>scripts,
>and this will work perfectly for me.

Hi Chris,

Well, I didn't look at MythTV's logic for finding the correct vbi device.  You 
might not get captions from MythTV recordings, if it guessed the wrong vbi node 
or if it didn't have sufficient permissions to access the vbi node.

Regards,
Andy
--
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: VBI on PVR-500 stopped working between kernels 3.6 and 3.13

2014-10-26 Thread Christopher Neufeld
Andy,

On Sun, 26 Oct 2014 13:41:14 -0400, Andy Walls  said:

> Can you verify that 

>   v4l2-ctl -d  --get-fmt-sliced-vbi --get-ctrl=stream_vbi_format

> also fails, and that

Yes, that also fails.

>   v4l2-ctl --list-devices
>   v4l2-ctl -d /dev/vbi --set-fmt-sliced-vbi=cc=1 
> --set-ctrl=stream_vbi_format=1
>   v4l2-ctl -d /dev/vbi --get-fmt-sliced-vbi 
> --get-ctrl=stream_vbi_format

> both succeed on the corresponding vbi node?

Yes, those succeed.  So, that solves my problem, thank you.

> If you can use the /dev/vbiN node as a work-around, please do.

I will switch to doing that, and update the MythTV wiki appropriately.  I
assume that this is the correct invocation for any similar capture devices,
not just the PVR-500 and family.


On Sun, 26 Oct 2014 14:28:15 -0400, Andy Walls  said:

> FYI, MythTV has already worked around it:
> https://code.mythtv.org/trac/ticket/11723
> https://github.com/MythTV/mythtv/commit/25310069a1154213cbc94c903c8b0ace30893ec4

Ah, well then that part of my bug report was incorrect.  Sometimes shows
don't send caption data, even the same program one week later.  I happened
to have two recordings in standard definition that had no captions, but one
recorded last night did, as might be expected if MythTV already worked
around it.

Thank you for your time on this, Andy and Hans.  I will update my scripts,
and this will work perfectly for me.


-- 
 Christopher Neufeld
 Home page:  http://www.cneufeld.ca/neufeld
 "Don't edit reality for the sake of simplicity"
--
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 v2 1/2] [media] rc-core: fix protocol_change regression in ir_raw_event_register

2014-10-26 Thread Tomas Melin
On Sat, Oct 25, 2014 at 12:03 PM, David Härdeman  wrote:
> Wouldn't something like this be a simpler way of achieving the same
> result? (untested):

The idea was to remove the empty change_protocol function that had
been added in the breaking commit.
IMHO, it would be better to not have functions that don't do anything.
Actually, another problem with that empty function is that if the
driver first sets up a "real" change_protocol function and related
data, and then calls rc_register_device, the driver defined
change_protocol function would be overwritten.


> diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
> index a7991c7..d521f20 100644
> --- a/drivers/media/rc/rc-main.c
> +++ b/drivers/media/rc/rc-main.c
> @@ -1421,6 +1421,9 @@ int rc_register_device(struct rc_dev *dev)
>
> if (dev->change_protocol) {
> u64 rc_type = (1 << rc_map->rc_type);
> +   if (dev->driver_type == RC_DRIVER_IR_RAW)
> +   rc_type |= RC_BIT_LIRC;
> +
> rc = dev->change_protocol(dev, &rc_type);
> if (rc < 0)
> goto out_raw;

But otherwise yes, your suggestion could work, with the addition that
we still need to update enabled_protocols (and not init
enabled_protocols anymore in ir_raw_event_register() ).
+   dev->enabled_protocols = (rc_type | RC_BIT_LIRC);

Please let me know your preferences on which you prefer, and, if
needed, I'll make a new patch version.
Tomas
--
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: VBI on PVR-500 stopped working between kernels 3.6 and 3.13

2014-10-26 Thread Andy Walls
On Sun, 2014-10-26 at 13:41 -0400, Andy Walls wrote:
> Hi Chris,
> 
> On Sun, 2014-10-26 at 08:10 -0400, Christopher Neufeld wrote:
> > Hello Hans,
> > 
> > On Sun, 26 Oct 2014 06:50:36 +0100, Hans Verkuil  said:
> > 
> > >> The script that I use to set up captions invokes this command:
> > >> v4l2-ctl -d  --set-fmt-sliced-vbi=cc --set-ctrl=stream_vbi_format=1
> > >> 
> > >> This now errors out.  Part of that is a parsing bug in v4l2-ctl, it wants
> > >> to see more text after the 'cc'.  I can change it to 
> > >> v4l2-ctl -d  --set-fmt-sliced-vbi=cc=1 
> > >> --set-ctrl=stream_vbi_format=1
> > 
> > > This is a v4l2-ctl bug. I'll fix that asap. But using cc=1 is a valid 
> > > workaround.
> > 
> > >> 
> > >> with this change, it no longer complains about the command line, but it
> > >> errors out in the ioctls.  This behaviour is seen with three versions of
> > >> v4l2-ctl: the old one packaged with the old kernel, the new one packaged
> > >> with the newer kernel, and the git-head, compiled against the headers of
> > >> the new kernel.
> 
> Can you verify that 
> 
>   v4l2-ctl -d  --get-fmt-sliced-vbi --get-ctrl=stream_vbi_format
> 
> also fails, and that
> 
>   v4l2-ctl --list-devices
>   v4l2-ctl -d /dev/vbi --set-fmt-sliced-vbi=cc=1 
> --set-ctrl=stream_vbi_format=1
>   v4l2-ctl -d /dev/vbi --get-fmt-sliced-vbi 
> --get-ctrl=stream_vbi_format
> 
> both succeed on the corresponding vbi node?
> 
> Looking at the v3.16 kernel code that I'm compiling right now, it looks
> like extra checks put in the v4l2-core don't allow setting sliced VBI
> formats using video device nodes:
> 
> http://git.linuxtv.org/cgit.cgi/v4l-utils.git/tree/utils/v4l2-ctl/v4l2-ctl-vbi.cpp#n209
> http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n959
> http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n1192
> http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n1265
> 
> I have to actually install and test, but this is my current guess.

FWIW, those checks were introduced in this commit:
http://git.linuxtv.org/cgit.cgi/media_tree.git/commit/?id=4b20259fa642d6f7a2dabef0b3adc14ca9dadbde

Hans,
I'm inclined to say these checks are good things, but they did break
existing behavior for user scripts and apps at about kernel v3.7 AFAICT.

FYI, MythTV has already worked around it:
https://code.mythtv.org/trac/ticket/11723
https://github.com/MythTV/mythtv/commit/25310069a1154213cbc94c903c8b0ace30893ec4

But I don't know about any other apps.

Regards,
Andy

> If you can use the /dev/vbiN node as a work-around, please do.
> 
> Regards,
> Andy
> 
> > > Are you calling this when MythTV is already running? If nobody else is 
> > > using
> > > the PVR-500, does it work?
> > 
> > When my script is running, MythTV is not using that unit of the PVR-500.  I
> > use the "recording groups" feature to ensure that that unit is made
> > unavailable for recordings whenever high-definition recordings are being
> > made.  The details of what I'm doing can be found here:
> > https://www.mythtv.org/wiki/Captions_With_HD_PVR
> > 
> > I would not expect this command to succeed if the unit were in use, in fact
> > the script detects that as an error case and loops until the device is
> > free.  The v4l2-ctl command that I use has historically returned an error
> > if somebody had the unit's video device open for reading.  Now, though, it
> > errors even when the unit is unused.
> > 
> > For my script, it is necessary that the MythTV backend be running, the
> > script is invoked by the backend, but when it is invoked, nobody is using
> > that unit of the PVR-500 (and, in practice, the other unit is almost never
> > used, as it's quite rare that I make standard-definition recordings).
> > 
> > My script is not used when MythTV directly makes a standard-definition
> > recording from the PVR-500.  In that case, the program presumably issues
> > its own ioctl equivalents of the v4l2-ctl command, and those are not
> > working, because the recordings produced do not have VBI data, while those
> > recorded before the kernel upgrade do.
> > 
> > > I won't be able to test this myself until next weekend at the earliest.
> > 
> > Captions are mostly for my wife's benefit, and I checked, most of her
> > upcoming shows are being recorded from OTA broadcasts, which provide ATSC
> > captions independently of the PVR-500, so I can wait for a week or two.
> > 
> > 
> > Thank you for looking into this.
> > 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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


Re: VBI on PVR-500 stopped working between kernels 3.6 and 3.13

2014-10-26 Thread Andy Walls
Hi Chris,

On Sun, 2014-10-26 at 08:10 -0400, Christopher Neufeld wrote:
> Hello Hans,
> 
> On Sun, 26 Oct 2014 06:50:36 +0100, Hans Verkuil  said:
> 
> >> The script that I use to set up captions invokes this command:
> >> v4l2-ctl -d  --set-fmt-sliced-vbi=cc --set-ctrl=stream_vbi_format=1
> >> 
> >> This now errors out.  Part of that is a parsing bug in v4l2-ctl, it wants
> >> to see more text after the 'cc'.  I can change it to 
> >> v4l2-ctl -d  --set-fmt-sliced-vbi=cc=1 --set-ctrl=stream_vbi_format=1
> 
> > This is a v4l2-ctl bug. I'll fix that asap. But using cc=1 is a valid 
> > workaround.
> 
> >> 
> >> with this change, it no longer complains about the command line, but it
> >> errors out in the ioctls.  This behaviour is seen with three versions of
> >> v4l2-ctl: the old one packaged with the old kernel, the new one packaged
> >> with the newer kernel, and the git-head, compiled against the headers of
> >> the new kernel.

Can you verify that 

v4l2-ctl -d  --get-fmt-sliced-vbi --get-ctrl=stream_vbi_format

also fails, and that

v4l2-ctl --list-devices
v4l2-ctl -d /dev/vbi --set-fmt-sliced-vbi=cc=1 
--set-ctrl=stream_vbi_format=1
v4l2-ctl -d /dev/vbi --get-fmt-sliced-vbi 
--get-ctrl=stream_vbi_format

both succeed on the corresponding vbi node?

Looking at the v3.16 kernel code that I'm compiling right now, it looks
like extra checks put in the v4l2-core don't allow setting sliced VBI
formats using video device nodes:

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/tree/utils/v4l2-ctl/v4l2-ctl-vbi.cpp#n209
http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n959
http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n1192
http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/v4l2-core/v4l2-ioctl.c#n1265

I have to actually install and test, but this is my current guess.

If you can use the /dev/vbiN node as a work-around, please do.

Regards,
Andy

> > Are you calling this when MythTV is already running? If nobody else is using
> > the PVR-500, does it work?
> 
> When my script is running, MythTV is not using that unit of the PVR-500.  I
> use the "recording groups" feature to ensure that that unit is made
> unavailable for recordings whenever high-definition recordings are being
> made.  The details of what I'm doing can be found here:
> https://www.mythtv.org/wiki/Captions_With_HD_PVR
> 
> I would not expect this command to succeed if the unit were in use, in fact
> the script detects that as an error case and loops until the device is
> free.  The v4l2-ctl command that I use has historically returned an error
> if somebody had the unit's video device open for reading.  Now, though, it
> errors even when the unit is unused.
> 
> For my script, it is necessary that the MythTV backend be running, the
> script is invoked by the backend, but when it is invoked, nobody is using
> that unit of the PVR-500 (and, in practice, the other unit is almost never
> used, as it's quite rare that I make standard-definition recordings).
> 
> My script is not used when MythTV directly makes a standard-definition
> recording from the PVR-500.  In that case, the program presumably issues
> its own ioctl equivalents of the v4l2-ctl command, and those are not
> working, because the recordings produced do not have VBI data, while those
> recorded before the kernel upgrade do.
> 
> > I won't be able to test this myself until next weekend at the earliest.
> 
> Captions are mostly for my wife's benefit, and I checked, most of her
> upcoming shows are being recorded from OTA broadcasts, which provide ATSC
> captions independently of the PVR-500, so I can wait for a week or two.
> 
> 
> Thank you for looking into this.
> 


--
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] dvb:tc90522: bugfix of always-false expression

2014-10-26 Thread Antti Palosaari



On 10/26/2014 03:58 PM, Akihiro TSUKADA wrote:

Reported by David Binderman


^^ See Documentation/SubmittingPatches


Though I knew that Reported-by: tag should not be used,
I wrote it just to express my appreciation for his report,
and did not mean to attach the tag.
But I admit that it is confusing,
so I'd like to beg Mauro to do me the kindness
to delete the line when this patch is committed.
(or I'll re-send the patch if it is necessary.)


Main reason I picked it up, was that tag was formally bad.

regards
Antti

--
http://palosaari.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


Re: Re: [PATCH 3/3] DVBSky V3 PCIe card: add some changes to M88DS3103forsupporting the demod of M88RS6000

2014-10-26 Thread Nibble Max
Hello:
On 2014-10-25 07:19:15, Antti Palosaari wrote:
>Moikka!
>
>On 10/22/2014 03:16 PM, Nibble Max wrote:
>> On 2014-10-22 05:24:02, Antti Palosaari wrote:
>>>
>>>
>>> On 10/13/2014 09:44 AM, Nibble Max wrote:
 M88RS6000 is the integrated chip, which includes tuner and demod.
 Its internal demod is similar with M88DS3103 except some registers 
 definition.
 The main different part of this internal demod from others is its 
 clock/pll generation IP block sitting inside the tuner die.
 So clock/pll functions should be configed through its tuner i2c bus, NOT 
 its demod i2c bus.
 The demod of M88RS6000 need the firmware: dvb-demod-m88rs6000.fw
 firmware download link: 
 http://www.dvbsky.net/download/linux/dvbsky-firmware.tar.gz
>>>
 @@ -250,6 +251,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend 
 *fe)
u16 u16tmp, divide_ratio;
u32 tuner_frequency, target_mclk;
s32 s32tmp;
 +  struct m88rs6000_mclk_config mclk_cfg;

dev_dbg(&priv->i2c->dev,
"%s: delivery_system=%d modulation=%d 
 frequency=%d symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n",
 @@ -291,6 +293,26 @@ static int m88ds3103_set_frontend(struct dvb_frontend 
 *fe)
if (ret)
goto err;

 +  if (priv->chip_id == M88RS6000_CHIP_ID) {
 +  ret = m88ds3103_wr_reg(priv, 0x06, 0xe0);
 +  if (ret)
 +  goto err;
 +  if (fe->ops.tuner_ops.set_config) {
 +  /* select main mclk */
 +  mclk_cfg.config_op = 0;
 +  mclk_cfg.TunerfreqMHz = c->frequency / 1000;
 +  mclk_cfg.SymRateKSs = c->symbol_rate / 1000;
 +  ret = fe->ops.tuner_ops.set_config(fe, &mclk_cfg);
 +  if (ret)
 +  goto err;
 +  priv->mclk_khz = mclk_cfg.MclkKHz;
 +  }
 +  ret = m88ds3103_wr_reg(priv, 0x06, 0x00);
 +  if (ret)
 +  goto err;
 +  usleep_range(1, 2);
 +  }
>>>
>>> That looks odd and also ugly. You pass some values from demod to tuner
>>> using set_config callback. Tuner driver can get symbol_rate and
>>> frequency just similarly from property cache than demod. Why you do it
>>> like that?
>>>
>>> Clock is provided by tuner as you mention. I see you use that to pass
>>> used clock frequency from tuner to demod. This does not look nice and I
>>> would like to see clock framework instead. Or calculate clock on both
>>> drivers. Does the demod clock even needs to be changed? I think it is
>>> only TS stream size which defines used clock frequency - smaller the TS
>>> bitstream, the smaller the clock frequency needed => optimizes power
>>> consumption a little. But TS clock is calculated on tuner driver in any
>>> case?
>>>
>> Yes, M88RS6000 looks odd. This integrated chip has two part die, tuner die 
>> and demod die.
>> Its demod's clock(PLL) block is sitting insided the tuner die. The demod has 
>> no PLL ip block that makes demod die smaller.
>> The demod's clock can be adjusted according to the transponder's frequency 
>> and symbol rate.
>> So that the demod's clock and its harmonic frequency will not overlap with 
>> the transponder's frequency range.
>> It will improve its tuner's sensitivity.
>>
>> However the tuner driver can get the values from property cache.
>> Tuner driver does not know when need adjust this demod pll
>> and return the current demod pll value to the demod driver.
>> in "struct dvb_tuner_ops", there is no call back to do this directly.
>> So I select the general "set_config" call back.
>> TS main clock of demdod also need to be controlled in the tuner die.
>>
>> These demod's PLL registers have no relationship with tuner at all.
>> Logically, These demod's PLL registers should go with demod die as usual.
>> But in this case they goes with the tuner die physically and controlled 
>> through tuner i2c bus.
>>
>> The current dvb-frontend driver requires the tuner and demod to split into 
>> the seperate drivers.
>> The demod driver will not access tuner i2c bus directly.
>> But this integrate chip has more tighter relationship of its tuner and demod 
>> die.
>> That is reason why these odd call backs happen.
>
>I understand situation pretty well.
>Let me say it shortly still to make it clear for the possible others; 
>M88RS6000 is integrated DVB-S2 receiver containing demod IP block that 
>is very near to M88DS3103 demod and tuner which is not so near any 
>existing tuner chip. Both IP blocks, demod and tuner, are connected to 
>I2C bus. However, all demodulator clocks (master clock and TS master 
>clock) are coming from tuner die. Tuner gets reference clock from 27 MHz 
>Xtal and there is PLL or multiple PLLs to derive/generate all the other 
>need

Re: [PATCH] dvb:tc90522: bugfix of always-false expression

2014-10-26 Thread Akihiro TSUKADA
>> Reported by David Binderman
> 
> ^^ See Documentation/SubmittingPatches

Though I knew that Reported-by: tag should not be used,
I wrote it just to express my appreciation for his report,
and did not mean to attach the tag.
But I admit that it is confusing,
so I'd like to beg Mauro to do me the kindness
to delete the line when this patch is committed.
(or I'll re-send the patch if it is necessary.)

regards,
akihiro
--
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: [yavta PATCH 1/1] yavta: Add --queue-late option for delay queueing buffers over streaming start

2014-10-26 Thread Laurent Pinchart
Hi Sakari,

Thank you for the patch. I've pushed it to the yavta git tree.

On Friday 24 October 2014 17:23:58 Sakari Ailus wrote:
> Queue buffers to the device after VIDIOC_STREAMON, not before. This does not
> affect queueing behaviour otherwise.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  yavta.c | 29 +
>  1 file changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/yavta.c b/yavta.c
> index 20bbe29..7f9e814 100644
> --- a/yavta.c
> +++ b/yavta.c
> @@ -1429,7 +1429,6 @@ static int video_prepare_capture(struct device *dev,
> int nbufs, unsigned int off const char *filename, enum buffer_fill_mode
> fill)
>  {
>   unsigned int padding;
> - unsigned int i;
>   int ret;
> 
>   /* Allocate and map buffers. */
> @@ -1443,6 +1442,14 @@ static int video_prepare_capture(struct device *dev,
> int nbufs, unsigned int off return ret;
>   }
> 
> + return 0;
> +}
> +
> +static int video_queue_all_buffers(struct device *dev, enum
> buffer_fill_mode fill) +{
> + unsigned int i;
> + int ret;
> +
>   /* Queue the buffers. */
>   for (i = 0; i < dev->nbufs; ++i) {
>   ret = video_queue_buffer(dev, i, fill);
> @@ -1554,7 +1561,7 @@ static void video_save_image(struct device *dev,
> struct v4l2_buffer *buf,
> 
>  static int video_do_capture(struct device *dev, unsigned int nframes,
>   unsigned int skip, unsigned int delay, const char *pattern,
> - int do_requeue_last, enum buffer_fill_mode fill)
> + int do_requeue_last, int do_queue_late, enum buffer_fill_mode fill)
>  {
>   struct v4l2_plane planes[VIDEO_MAX_PLANES];
>   struct v4l2_buffer buf;
> @@ -1572,6 +1579,9 @@ static int video_do_capture(struct device *dev,
> unsigned int nframes, if (ret < 0)
>   goto done;
> 
> + if (do_queue_late)
> + video_queue_all_buffers(dev, fill);
> +
>   size = 0;
>   clock_gettime(CLOCK_MONOTONIC, &start);
>   last.tv_sec = start.tv_sec;
> @@ -1712,6 +1722,7 @@ static void usage(const char *argv0)
>   printf("--no-query  Don't query capabilities on 
> open\n");
>   printf("--offsetUser pointer buffer offset from 
> page 
start\n");
>   printf("--premultiplied Color components are 
> premultiplied by 
alpha
> value\n"); +  printf("--queue-lateQueue buffers after 
> streamon, 
not
> before\n"); printf("--requeue-lastRequeue the last 
> buffers before
> streamoff\n"); printf("--timestamp-source Set timestamp source on
> output buffers [eof, soe]\n"); printf("--skip n   Skip 
> the first 
n
> frames\n");
> @@ -1733,6 +1744,7 @@ static void usage(const char *argv0)
>  #define OPT_LOG_STATUS   267
>  #define OPT_BUFFER_SIZE  268
>  #define OPT_PREMULTIPLIED269
> +#define OPT_QUEUE_LATE   270
> 
>  static struct option opts[] = {
>   {"buffer-size", 1, 0, OPT_BUFFER_SIZE},
> @@ -1757,6 +1769,7 @@ static struct option opts[] = {
>   {"pause", 0, 0, 'p'},
>   {"premultiplied", 0, 0, OPT_PREMULTIPLIED},
>   {"quality", 1, 0, 'q'},
> + {"queue-late", 0, 0, OPT_QUEUE_LATE},
>   {"get-control", 1, 0, 'r'},
>   {"requeue-last", 0, 0, OPT_REQUEUE_LAST},
>   {"realtime", 2, 0, 'R'},
> @@ -1788,7 +1801,7 @@ int main(int argc, char *argv[])
>   int do_list_controls = 0, do_get_control = 0, do_set_control = 0;
>   int do_sleep_forever = 0, do_requeue_last = 0;
>   int do_rt = 0, do_log_status = 0;
> - int no_query = 0;
> + int no_query = 0, do_queue_late = 0;
>   char *endptr;
>   int c;
> 
> @@ -1971,6 +1984,9 @@ int main(int argc, char *argv[])
>   case OPT_PREMULTIPLIED:
>   fmt_flags |= V4L2_PIX_FMT_FLAG_PREMUL_ALPHA;
>   break;
> + case OPT_QUEUE_LATE:
> + do_queue_late = 1;
> + break;
>   case OPT_REQUEUE_LAST:
>   do_requeue_last = 1;
>   break;
> @@ -2107,6 +2123,11 @@ int main(int argc, char *argv[])
>   return 1;
>   }
> 
> + if (!do_queue_late && video_queue_all_buffers(&dev, fill_mode)) {
> + video_close(&dev);
> + return 1;
> + }
> +
>   if (do_pause) {
>   printf("Press enter to start capture\n");
>   getchar();
> @@ -2122,7 +2143,7 @@ int main(int argc, char *argv[])
>   }
> 
>   if (video_do_capture(&dev, nframes, skip, delay, filename,
> -  do_requeue_last, fill_mode) < 0) {
> +  do_requeue_last, do_queue_late, fill_mode) < 0) {
>   video_close(&dev);
>   return 1;
>   }

-- 
Regards,

Laurent Pinchart

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

Re: VBI on PVR-500 stopped working between kernels 3.6 and 3.13

2014-10-26 Thread Christopher Neufeld
Hello Hans,

On Sun, 26 Oct 2014 06:50:36 +0100, Hans Verkuil  said:

>> The script that I use to set up captions invokes this command:
>> v4l2-ctl -d  --set-fmt-sliced-vbi=cc --set-ctrl=stream_vbi_format=1
>> 
>> This now errors out.  Part of that is a parsing bug in v4l2-ctl, it wants
>> to see more text after the 'cc'.  I can change it to 
>> v4l2-ctl -d  --set-fmt-sliced-vbi=cc=1 --set-ctrl=stream_vbi_format=1

> This is a v4l2-ctl bug. I'll fix that asap. But using cc=1 is a valid 
> workaround.

>> 
>> with this change, it no longer complains about the command line, but it
>> errors out in the ioctls.  This behaviour is seen with three versions of
>> v4l2-ctl: the old one packaged with the old kernel, the new one packaged
>> with the newer kernel, and the git-head, compiled against the headers of
>> the new kernel.

> Are you calling this when MythTV is already running? If nobody else is using
> the PVR-500, does it work?

When my script is running, MythTV is not using that unit of the PVR-500.  I
use the "recording groups" feature to ensure that that unit is made
unavailable for recordings whenever high-definition recordings are being
made.  The details of what I'm doing can be found here:
https://www.mythtv.org/wiki/Captions_With_HD_PVR

I would not expect this command to succeed if the unit were in use, in fact
the script detects that as an error case and loops until the device is
free.  The v4l2-ctl command that I use has historically returned an error
if somebody had the unit's video device open for reading.  Now, though, it
errors even when the unit is unused.

For my script, it is necessary that the MythTV backend be running, the
script is invoked by the backend, but when it is invoked, nobody is using
that unit of the PVR-500 (and, in practice, the other unit is almost never
used, as it's quite rare that I make standard-definition recordings).

My script is not used when MythTV directly makes a standard-definition
recording from the PVR-500.  In that case, the program presumably issues
its own ioctl equivalents of the v4l2-ctl command, and those are not
working, because the recordings produced do not have VBI data, while those
recorded before the kernel upgrade do.

> I won't be able to test this myself until next weekend at the earliest.

Captions are mostly for my wife's benefit, and I checked, most of her
upcoming shows are being recorded from OTA broadcasts, which provide ATSC
captions independently of the PVR-500, so I can wait for a week or two.


Thank you for looking into this.

-- 
 Christopher Neufeld
 Home page:  http://www.cneufeld.ca/neufeld
 "Don't edit reality for the sake of simplicity"
--
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] dvb:tc90522: bugfix of always-false expression

2014-10-26 Thread Antti Palosaari



On 10/26/2014 02:05 PM, tsk...@gmail.com wrote:

From: Akihiro Tsukada 

Reported by David Binderman


^^ See Documentation/SubmittingPatches

Antti


---
  drivers/media/dvb-frontends/tc90522.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/tc90522.c 
b/drivers/media/dvb-frontends/tc90522.c
index d9905fb..bca81ef 100644
--- a/drivers/media/dvb-frontends/tc90522.c
+++ b/drivers/media/dvb-frontends/tc90522.c
@@ -363,7 +363,7 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe)
u8 v;

c->isdbt_partial_reception = val[0] & 0x01;
-   c->isdbt_sb_mode = (val[0] & 0xc0) == 0x01;
+   c->isdbt_sb_mode = (val[0] & 0xc0) == 0x40;

/* layer A */
v = (val[2] & 0x78) >> 3;



--
http://palosaari.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


Re: [PATCH] dvb-core: set default properties of ISDB-S

2014-10-26 Thread Antti Palosaari

Moikka
How is channel bandwidth defined? Is it static? 38961000 Hz?

regards
Antti

On 10/26/2014 02:01 PM, tsk...@gmail.com wrote:

From: Akihiro Tsukada 

delsys-fixed props should be set in dvb-core instead of in each driver.
---
  drivers/media/dvb-core/dvb_frontend.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index c862ad7..1e9b814 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -962,6 +962,10 @@ static int dvb_frontend_clear_cache(struct dvb_frontend 
*fe)
case SYS_ATSC:
c->modulation = VSB_8;
break;
+   case SYS_ISDBS:
+   c->symbol_rate = 2886;
+   c->rolloff = ROLLOFF_35;
+   break;
default:
c->modulation = QAM_AUTO;
break;
@@ -2074,6 +2078,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
break;
case SYS_DVBS:
case SYS_TURBO:
+   case SYS_ISDBS:
rolloff = 135;
break;
case SYS_DVBS2:



--
http://palosaari.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] dvb:tc90522: fix stats report

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

* report per-transponder symbolrate instead of per-TS one (moved to dvb-core)
* add output TS-ID report, which might be useful if an user did not specify
  stream id or set a wrong one, and the demod chose the first TS_ID found.
---
 drivers/media/dvb-frontends/tc90522.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/media/dvb-frontends/tc90522.c 
b/drivers/media/dvb-frontends/tc90522.c
index bca81ef..b35d65c 100644
--- a/drivers/media/dvb-frontends/tc90522.c
+++ b/drivers/media/dvb-frontends/tc90522.c
@@ -216,32 +216,30 @@ static int tc90522s_get_frontend(struct dvb_frontend *fe)
c->delivery_system = SYS_ISDBS;
 
layers = 0;
-   ret = reg_read(state, 0xe8, val, 3);
+   ret = reg_read(state, 0xe6, val, 5);
if (ret == 0) {
-   int slots;
u8 v;
 
+   c->stream_id = val[0] << 8 | val[1];
+
/* high/single layer */
-   v = (val[0] & 0x70) >> 4;
+   v = (val[2] & 0x70) >> 4;
c->modulation = (v == 7) ? PSK_8 : QPSK;
c->fec_inner = fec_conv_sat[v];
c->layer[0].fec = c->fec_inner;
c->layer[0].modulation = c->modulation;
-   c->layer[0].segment_count = val[1] & 0x3f; /* slots */
+   c->layer[0].segment_count = val[3] & 0x3f; /* slots */
 
/* low layer */
-   v = (val[0] & 0x07);
+   v = (val[2] & 0x07);
c->layer[1].fec = fec_conv_sat[v];
if (v == 0)  /* no low layer */
c->layer[1].segment_count = 0;
else
-   c->layer[1].segment_count = val[2] & 0x3f; /* slots */
+   c->layer[1].segment_count = val[4] & 0x3f; /* slots */
/* actually, BPSK if v==1, but not defined in fe_modulation_t */
c->layer[1].modulation = QPSK;
layers = (v > 0) ? 2 : 1;
-
-   slots =  c->layer[0].segment_count +  c->layer[1].segment_count;
-   c->symbol_rate = 2886 * slots / 48;
}
 
/* statistics */
-- 
2.1.2

--
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] dvb:tc90522: bugfix of always-false expression

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

Reported by David Binderman
---
 drivers/media/dvb-frontends/tc90522.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/tc90522.c 
b/drivers/media/dvb-frontends/tc90522.c
index d9905fb..bca81ef 100644
--- a/drivers/media/dvb-frontends/tc90522.c
+++ b/drivers/media/dvb-frontends/tc90522.c
@@ -363,7 +363,7 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe)
u8 v;
 
c->isdbt_partial_reception = val[0] & 0x01;
-   c->isdbt_sb_mode = (val[0] & 0xc0) == 0x01;
+   c->isdbt_sb_mode = (val[0] & 0xc0) == 0x40;
 
/* layer A */
v = (val[2] & 0x78) >> 3;
-- 
2.1.2

--
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] dvb-core: set default properties of ISDB-S

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

delsys-fixed props should be set in dvb-core instead of in each driver.
---
 drivers/media/dvb-core/dvb_frontend.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index c862ad7..1e9b814 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -962,6 +962,10 @@ static int dvb_frontend_clear_cache(struct dvb_frontend 
*fe)
case SYS_ATSC:
c->modulation = VSB_8;
break;
+   case SYS_ISDBS:
+   c->symbol_rate = 2886;
+   c->rolloff = ROLLOFF_35;
+   break;
default:
c->modulation = QAM_AUTO;
break;
@@ -2074,6 +2078,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
break;
case SYS_DVBS:
case SYS_TURBO:
+   case SYS_ISDBS:
rolloff = 135;
break;
case SYS_DVBS2:
-- 
2.1.2

--
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 5/7] v4l-utils/libdvbv5: add gconv module for the text translation of ISDB-S/T.

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

---
 lib/Makefile.am |   5 +-
 lib/gconv/arib-std-b24.c| 775 +
 lib/gconv/en300-468-tab00.c | 564 ++
 lib/gconv/gconv-modules |   7 +
 lib/gconv/gconv.map |   8 +
 lib/gconv/iconv/loop.c  | 523 
 lib/gconv/iconv/skeleton.c  | 829 
 lib/gconv/jisx0213.h| 102 ++
 8 files changed, 2811 insertions(+), 2 deletions(-)
 create mode 100644 lib/gconv/arib-std-b24.c
 create mode 100644 lib/gconv/en300-468-tab00.c
 create mode 100644 lib/gconv/gconv-modules
 create mode 100644 lib/gconv/gconv.map
 create mode 100644 lib/gconv/iconv/loop.c
 create mode 100644 lib/gconv/iconv/skeleton.c
 create mode 100644 lib/gconv/jisx0213.h

diff --git a/lib/Makefile.am b/lib/Makefile.am
index 3a0e19c..b21103b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -7,5 +7,6 @@ SUBDIRS = \
 
 if LINUX_OS
 SUBDIRS += \
-   libdvbv5
-endif
\ No newline at end of file
+   libdvbv5 \
+   gconv
+endif
diff --git a/lib/gconv/arib-std-b24.c b/lib/gconv/arib-std-b24.c
new file mode 100644
index 000..c4ee1e2
--- /dev/null
+++ b/lib/gconv/arib-std-b24.c
@@ -0,0 +1,775 @@
+/* Conversion module for ARIB-STD-B24.
+   Copyright (C) 1998-2014 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper , 1998,
+   Bruno Haible , 2002,
+   and Akihiro Tsukada 
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   .  */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "jisx0213.h"
+
+/* Definitions used in the body of the `gconv' function.  */
+#define CHARSET_NAME   "ARIB-STD-B24//"
+#define DEFINE_INIT1
+#define DEFINE_FINI1
+#define ONE_DIRECTION  1
+#define FROM_LOOP  from_aribb24_loop
+#define TO_LOOP FROM_LOOP
+#define FROM_LOOP_MIN_NEEDED_FROM 1
+#define FROM_LOOP_MAX_NEEDED_FROM 1
+#define FROM_LOOP_MIN_NEEDED_TO 4
+#define FROM_LOOP_MAX_NEEDED_TO (4 * 4)
+#define TO_LOOP_MIN_NEEDED_FROM 4
+#define TO_LOOP_MAX_NEEDED_FROM 4
+#define TO_LOOP_MIN_NEEDED_TO 1
+#define TO_LOOP_MAX_NEEDED_TO 7
+
+#define PREPARE_LOOP \
+  __mbstate_t saved_state;   \
+  __mbstate_t *statep = data->__statep;   \
+  status = __GCONV_OK;
+
+/* Since we might have to reset input pointer we must be able to save
+   and retore the state.  */
+#define SAVE_RESET_STATE(Save) \
+  if (Save)  \
+saved_state = *statep;   \
+  else   \
+*statep = saved_state
+
+/* This makes obvious what everybody knows: 0x1b is the Esc character.  */
+#define ESC 0x1b
+/* other control characters */
+#define SS2 0x19
+#define SS3 0x1d
+#define LS0 0x0f
+#define LS1 0x0e
+
+#define LS2 0x6e
+#define LS3 0x6f
+#define LS1R 0x7e
+#define LS2R 0x7d
+#define LS3R 0x7c
+
+#define LF 0x0a
+#define CR 0x0d
+#define BEL 0x07
+#define BS 0x08
+#define COL 0x90
+#define CDC 0x92
+#define MACRO_CTRL 0x95
+#define CSI 0x9b
+#define TIME 0x9d
+
+/* code sets */
+enum g_set
+{
+  KANJI_set = '\x42', /* 2Byte set */
+  ASCII_set = '\x40',
+  ASCII_x_set = '\x4a',
+  HIRAGANA_set = '\x30',
+  KATAKANA_set = '\x31',
+  MOSAIC_A_set = '\x32',
+  MOSAIC_B_set = '\x33',
+  MOSAIC_C_set = '\x34',
+  MOSAIC_D_set = '\x35',
+  PROP_ASCII_set = '\x36',
+  PROP_HIRA_set = '\x37',
+  PROP_KATA_set = '\x38',
+  JIS0201_KATA_set = '\x49',
+  JISX0213_1_set = '\x39',/* 2Byte set */
+  JISX0213_2_set = '\x3a',/* 2Byte set */
+  EXTRA_SYMBOLS_set = '\x3b', /* 2Byte set */
+
+  DRCS0_set = 0x40 | 0x80,/* 2Byte set */
+  DRCS1_set = 0x41 | 0x80,
+  DRCS15_set = 0x4f | 0x80,
+  MACRO_set = 0x70 | 0x80,
+};
+
+
+/* First define the conversion function from ARIB-STD-B24 to UCS-4.  */
+
+enum mode_e
+{
+  NORMAL,
+  ESCAPE,
+  G_SEL_1B,
+  G_SEL_MB,
+  CTRL_SEQ,
+  DESIGNATE_MB,
+  DRCS_SEL_1B,
+  DRCS_SEL_MB,
+  MB_2ND,
+};
+
+/*
+ * __GCONV_INPUT_INCOMPLETE is never used in this conversion, thus
+ * we can re-use mbstate_t.__value and .__count:3 for the ot

[PATCH v2 7/7] v4l-utils/libdvbv5, dvbv5-scan: generalize channel duplication check

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

include stream id to duplication check
---
 lib/include/libdvbv5/dvb-scan.h |  11 ++--
 lib/libdvbv5/dvb-scan.c | 132 
 utils/dvb/dvbv5-scan.c  |  16 ++---
 3 files changed, 49 insertions(+), 110 deletions(-)

diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
index e3a0d24..aad6d01 100644
--- a/lib/include/libdvbv5/dvb-scan.h
+++ b/lib/include/libdvbv5/dvb-scan.h
@@ -385,16 +385,17 @@ void dvb_add_scaned_transponders(struct dvb_v5_fe_parms 
*parms,
  */
 int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
 
-int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry 
*last_entry,
-  uint32_t freq, enum dvb_sat_polarization pol, int 
shift);
-int dvb_new_ts_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
-  uint32_t freq, int shift, uint32_t ts_id);
+int dvb_new_entry_is_needed(struct dvb_entry *entry,
+  struct dvb_entry *last_entry,
+  uint32_t freq, int shift,
+  enum dvb_sat_polarization pol, uint32_t stream_id);
 
 struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
 struct dvb_entry *first_entry,
 struct dvb_entry *entry,
 uint32_t freq, uint32_t shift,
-enum dvb_sat_polarization pol);
+enum dvb_sat_polarization pol,
+uint32_t stream_id);
 
 void dvb_update_transponders(struct dvb_v5_fe_parms *parms,
 struct dvb_v5_descriptors *dvb_scan_handler,
diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
index f265f97..e11a915 100644
--- a/lib/libdvbv5/dvb-scan.c
+++ b/lib/libdvbv5/dvb-scan.c
@@ -693,93 +693,32 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
return shift;
 }
 
-int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry 
*last_entry,
-  uint32_t freq, enum dvb_sat_polarization pol, int 
shift)
+int dvb_new_entry_is_needed(struct dvb_entry *entry,
+   struct dvb_entry *last_entry,
+   uint32_t freq, int shift,
+   enum dvb_sat_polarization pol, uint32_t stream_id)
 {
-   int i;
-   uint32_t data;
-
for (; entry != last_entry; entry = entry->next) {
-   for (i = 0; i < entry->n_props; i++) {
-   data = entry->props[i].u.data;
-   if (entry->props[i].cmd == DTV_POLARIZATION) {
-   if (data != pol)
-   continue;
-   }
-   if (entry->props[i].cmd == DTV_FREQUENCY) {
-   if (( freq >= data - shift) && (freq <= data + 
shift))
-   return 0;
-   }
-   }
-   }
-
-   return 1;
-}
-
-struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *__p,
-struct dvb_entry *first_entry,
-struct dvb_entry *entry,
-uint32_t freq, uint32_t shift,
-enum dvb_sat_polarization pol)
-{
-   struct dvb_v5_fe_parms_priv *parms = (void *)__p;
-   struct dvb_entry *new_entry;
-   int i, n = 2;
-
-   if (!dvb_new_freq_is_needed(first_entry, NULL, freq, pol, shift))
-   return NULL;
-
-   /* Clone the current entry into a new entry */
-   new_entry = calloc(sizeof(*new_entry), 1);
-   if (!new_entry) {
-   dvb_perror("not enough memory for a new scanning frequency");
-   return NULL;
-   }
+   int i;
 
-   memcpy(new_entry, entry, sizeof(*entry));
+   for (i = 0; i < entry->n_props; i++) {
+   uint32_t data = entry->props[i].u.data;
 
-   /*
-* The frequency should change to the new one. Seek for it and
-* replace its value to the desired one.
-*/
-   for (i = 0; i < new_entry->n_props; i++) {
-   if (new_entry->props[i].cmd == DTV_FREQUENCY) {
-   new_entry->props[i].u.data = freq;
-   /* Navigate to the end of the entry list */
-   while (entry->next) {
-   entry = entry->next;
-   n++;
+   if (entry->props[i].cmd == DTV_FREQUENCY) {
+   if (freq < data - shift || freq > data + shift)
+   break;
}
-   dvb_log("New transponder/channel found: #%d: %d",
-

[PATCH v2 0/7] v4l-utils/libdvbv5,dvb: add support for ISDB-S

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

This patch series adds tuning and scanning features for ISDB-S,
and required modifications to libdvbv5 and utils/dvb to support it.

Other part of the libdvbv5 API may not work for ISDB-S.
At least the the parser for extended event descriptors do not work now,
as they require some ISDB-S(/T) specific modifications.

Changes from v1:
* added COUNTER property to distingush country variant of ISDB-T
* added character conversion modules
* reflected the reviews on v1.

Akihiro Tsukada (7):
  v4l-utils/libdvbv5: fix auto generating of channel names
  v4l-utils/libdvbv5: add support for ISDB-S tuning
  v4l-utils/libdvbv5: add support for ISDB-S scanning
  v4l-utils/dvb: add COUNTRY property
  v4l-utils/libdvbv5: add gconv module for the text translation of
ISDB-S/T.
  v4l-utils/libdvbv5: don't discard config-supplied parameters
  v4l-utils/libdvbv5, dvbv5-scan: generalize channel duplication check

 configure.ac  |   4 +
 lib/Makefile.am   |   5 +-
 lib/gconv/arib-std-b24.c  | 775 +++
 lib/gconv/en300-468-tab00.c   | 564 ++
 lib/gconv/gconv-modules   |   7 +
 lib/gconv/gconv.map   |   8 +
 lib/gconv/iconv/loop.c| 523 
 lib/gconv/iconv/skeleton.c| 829 ++
 lib/gconv/jisx0213.h  | 102 +
 lib/include/libdvbv5/countries.h  | 308 ++
 lib/include/libdvbv5/dvb-fe.h |   4 +
 lib/include/libdvbv5/dvb-scan.h   |   9 +-
 lib/include/libdvbv5/dvb-v5-std.h |   7 +-
 lib/libdvbv5/Makefile.am  |   2 +
 lib/libdvbv5/countries.c  | 403 ++
 lib/libdvbv5/dvb-fe.c |  58 ++-
 lib/libdvbv5/dvb-file.c   |  68 +++-
 lib/libdvbv5/dvb-sat.c|   9 +
 lib/libdvbv5/dvb-scan.c   | 122 +-
 lib/libdvbv5/dvb-v5-std.c |   6 +-
 lib/libdvbv5/parse_string.c   |  15 +-
 utils/dvb/dvb-format-convert.c|   3 +-
 utils/dvb/dvbv5-scan.c|  28 +-
 utils/dvb/dvbv5-zap.c |  11 +
 24 files changed, 3815 insertions(+), 55 deletions(-)
 create mode 100644 lib/gconv/arib-std-b24.c
 create mode 100644 lib/gconv/en300-468-tab00.c
 create mode 100644 lib/gconv/gconv-modules
 create mode 100644 lib/gconv/gconv.map
 create mode 100644 lib/gconv/iconv/loop.c
 create mode 100644 lib/gconv/iconv/skeleton.c
 create mode 100644 lib/gconv/jisx0213.h
 create mode 100644 lib/include/libdvbv5/countries.h
 create mode 100644 lib/libdvbv5/countries.c

-- 
2.1.2

--
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 6/7] v4l-utils/libdvbv5: don't discard config-supplied parameters

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

When an user enabled the option to update parameters with PSI,
the parameters that were supplied from config file and  not mandatory
to the delivery system were discarded.
---
 lib/libdvbv5/dvb-fe.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index 05f7d03..52af4e4 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -575,6 +575,7 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *p)
int i, n = 0;
const unsigned int *sys_props;
struct dtv_properties prop;
+   struct dtv_property fe_prop[DTV_MAX_COMMAND];
struct dvb_frontend_parameters v3_parms;
uint32_t bw;
 
@@ -583,19 +584,14 @@ int dvb_fe_get_parms(struct dvb_v5_fe_parms *p)
return EINVAL;
 
while (sys_props[n]) {
-   parms->dvb_prop[n].cmd = sys_props[n];
+   fe_prop[n].cmd = sys_props[n];
n++;
}
-   parms->dvb_prop[n].cmd = DTV_DELIVERY_SYSTEM;
-   parms->dvb_prop[n].u.data = parms->p.current_sys;
+   fe_prop[n].cmd = DTV_DELIVERY_SYSTEM;
+   fe_prop[n].u.data = parms->p.current_sys;
n++;
 
-   /* Keep it ready for set */
-   parms->dvb_prop[n].cmd = DTV_TUNE;
-   parms->n_props = n;
-
-   struct dtv_property fe_prop[DTV_MAX_COMMAND];
-   n = dvb_copy_fe_props(parms->dvb_prop, n, fe_prop);
+   n = dvb_copy_fe_props(fe_prop, n, fe_prop);
 
prop.props = fe_prop;
prop.num = n;
-- 
2.1.2

--
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/7] v4l-utils/dvb: add COUNTRY property

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

to distinguish country variants of delivery systems like ISDB-T.
---
 configure.ac  |   4 +
 lib/include/libdvbv5/countries.h  | 308 +
 lib/include/libdvbv5/dvb-fe.h |   4 +
 lib/include/libdvbv5/dvb-v5-std.h |   7 +-
 lib/libdvbv5/Makefile.am  |   2 +
 lib/libdvbv5/countries.c  | 403 ++
 lib/libdvbv5/dvb-fe.c |  42 +++-
 lib/libdvbv5/dvb-file.c   |  19 ++
 lib/libdvbv5/dvb-v5-std.c |   2 +
 utils/dvb/dvbv5-scan.c|  11 ++
 utils/dvb/dvbv5-zap.c |  11 ++
 11 files changed, 810 insertions(+), 3 deletions(-)
 create mode 100644 lib/include/libdvbv5/countries.h
 create mode 100644 lib/libdvbv5/countries.c

diff --git a/configure.ac b/configure.ac
index 94a857e..b1c5e54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,8 @@ AC_CONFIG_FILES([Makefile
utils/media-ctl/libv4l2subdev.pc
 ])
 
+AC_GNU_SOURCE
+
 AM_INIT_AUTOMAKE([1.9 subdir-objects no-dist-gzip dist-bzip2 
-Wno-portability]) # 1.10 is needed for target_LIBTOOLFLAGS
 
 AM_MAINTAINER_MODE
@@ -73,6 +75,8 @@ gl_VISIBILITY
 AC_CHECK_HEADERS([sys/klog.h])
 AC_CHECK_FUNCS([klogctl])
 
+AC_CHECK_FUNCS([__secure_getenv secure_getenv])
+
 # Check host os
 case "$host_os" in
   linux*)
diff --git a/lib/include/libdvbv5/countries.h b/lib/include/libdvbv5/countries.h
new file mode 100644
index 000..945094f
--- /dev/null
+++ b/lib/include/libdvbv5/countries.h
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009 Winfried Koehler
+ * Copyright (C) 2014 Akihiro Tsukada
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * Or, point your browser to 
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+ *
+ */
+
+/**
+ * @file countries.h
+ * @ingroup ancillary
+ * @brief Provides ancillary code to convert ISO 3166-1 country codes
+ * @copyright GNU General Public License version 2 (GPLv2)
+ * @author Winfried Koehler
+ * @author Akihiro Tsukada
+ *
+ * @par Bug Report
+ * Please submit bug reports and patches to linux-media@vger.kernel.org
+ */
+
+#ifndef _COUNTRIES_H_
+#define _COUNTRIES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Every country has its own number here. if adding new one
+ * simply append to enum.
+ */
+enum country_t {
+COUNTRY_UNKNOWN,
+
+AF,
+AX,
+AL,
+DZ,
+AS,
+AD,
+AO,
+AI,
+AQ,
+AG,
+AR,
+AM,
+AW,
+AU,
+AT,
+AZ,
+BS,
+BH,
+BD,
+BB,
+BY,
+BE,
+BZ,
+BJ,
+BM,
+BT,
+BO,
+BQ,
+BA,
+BW,
+BV,
+BR,
+IO,
+BN,
+BG,
+BF,
+BI,
+KH,
+CM,
+CA,
+CV,
+KY,
+CF,
+TD,
+CL,
+CN,
+CX,
+CC,
+CO,
+KM,
+CG,
+CD,
+CK,
+CR,
+CI,
+HR,
+CU,
+CW,
+CY,
+CZ,
+DK,
+DJ,
+DM,
+DO,
+EC,
+EG,
+SV,
+GQ,
+ER,
+EE,
+ET,
+FK,
+FO,
+FJ,
+FI,
+FR,
+GF,
+PF,
+TF,
+GA,
+GM,
+GE,
+DE,
+GH,
+GI,
+GR,
+GL,
+GD,
+GP,
+GU,
+GT,
+GG,
+GN,
+GW,
+GY,
+HT,
+HM,
+VA,
+HN,
+HK,
+HU,
+IS,
+IN,
+ID,
+IR,
+IQ,
+IE,
+IM,
+IL,
+IT,
+JM,
+JP,
+JE,
+JO,
+KZ,
+KE,
+KI,
+KP,
+KR,
+KW,
+KG,
+LA,
+LV,
+LB,
+LS,
+LR,
+LY,
+LI,
+LT,
+LU,
+MO,
+MK,
+MG,
+MW,
+MY,
+MV,
+ML,
+MT,
+MH,
+MQ,
+MR,
+MU,
+YT,
+MX,
+FM,
+MD,
+MC,
+MN,
+ME,
+MS,
+MA,
+MZ,
+MM,
+NA,
+NR,
+NP,
+NL,
+NC,
+NZ,
+NI,
+NE,
+NG,
+NU,
+NF,
+MP,
+NO,
+OM,
+PK,
+PW,
+PS,
+PA,
+PG,
+PY,
+PE,
+PH,
+PN,
+PL,
+PT,
+PR,
+QA,
+RE,
+RO,
+RU,
+RW,
+BL,
+SH,
+KN,
+LC,
+MF,
+PM,
+VC,
+WS,
+SM,
+ST,
+SA,
+SN,
+RS,
+SC,
+SL,
+SX,
+SG,
+SK,
+SI,
+SB,
+SO,
+ZA,
+GS,
+ES,
+LK,
+SD,
+SR,
+SJ,
+SZ,
+SE,
+CH,
+SY,
+TW,
+TJ

[PATCH v2 1/7] v4l-utils/libdvbv5: fix auto generation of channel names

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

when channel name was not available, it was generated from unset variables,
and leaked memory.
---
 lib/libdvbv5/dvb-file.c | 28 +++-
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 27d9a63..1ea14c4 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1121,20 +1121,23 @@ static int get_program_and_store(struct 
dvb_v5_fe_parms_priv *parms,
if (rc)
dvb_logerr("Couldn't get frontend props");
}
+   for (j = 0; j < parms->n_props; j++) {
+   entry->props[j].cmd = parms->dvb_prop[j].cmd;
+   entry->props[j].u.data = parms->dvb_prop[j].u.data;
+
+   if (!*channel)
+   freq = entry->props[j].u.data;
+   }
if (!*channel) {
-   r = asprintf(&channel, "%.2fMHz#%d", freq/100., service_id);
+   free(channel);
+   r = asprintf(&channel, "%.2f%cHz#%d", freq / 100.,
+   dvb_fe_is_satellite(parms->p.current_sys) ? 'G' : 'M',
+   service_id);
if (r < 0)
dvb_perror("asprintf");
if (parms->p.verbose)
dvb_log("Storing as: '%s'", channel);
}
-   for (j = 0; j < parms->n_props; j++) {
-   entry->props[j].cmd = parms->dvb_prop[j].cmd;
-   entry->props[j].u.data = parms->dvb_prop[j].u.data;
-
-   if (!*channel && entry->props[j].cmd == DTV_FREQUENCY)
-   freq = parms->dvb_prop[j].u.data;
-   }
entry->n_props = parms->n_props;
entry->channel = channel;
 
@@ -1225,12 +1228,19 @@ int dvb_store_channel(struct dvb_file **dvb_file,
continue;
 
service_id = 
dvb_scan_handler->program[i].pat_pgm->service_id;
+   rc = asprintf(&channel, "#%d", service_id);
+   if (rc < 0) {
+   dvb_perror("asprintf");
+   return rc;
+   }
 
rc = get_program_and_store(parms, *dvb_file, 
dvb_scan_handler,
   service_id, channel, NULL,
   get_detected, get_nit);
-   if (rc < 0)
+   if (rc < 0) {
+   free(channel);
return rc;
+   }
}
 
return 0;
-- 
2.1.2

--
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/7] v4l-utils/libdvbv5: add support for ISDB-S tuning

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

Added LNB support for Japanese satellites.
Currently tested with dvbv5-zap, dvb-fe-tool.
At least the charset conversion and the parser of
extended event descriptors are not implemented now,
as they require some ISDB-S(/T) specific modification.
---
 lib/libdvbv5/dvb-sat.c| 9 +
 lib/libdvbv5/dvb-v5-std.c | 4 
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index e8df06b..010aebe 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -91,6 +91,13 @@ static const struct dvb_sat_lnb lnb[] = {
.freqrange = {
{ 12200, 12700 }
}
+   }, {
+   .name = "Japan 110BS/CS LNBf",
+   .alias = "110BS",
+   .lowfreq = 10678,
+   .freqrange = {
+   { 11710, 12751 }
+   }
},
 };
 
@@ -304,6 +311,8 @@ static int dvbsat_diseqc_set_input(struct 
dvb_v5_fe_parms_priv *parms,
 */
pol_v = 0;
high_band = 1;
+   if (parms->p.current_sys == SYS_ISDBS)
+   vol_high = 1;
} else {
/* Adjust voltage/tone accordingly */
if (parms->p.sat_number < 2) {
diff --git a/lib/libdvbv5/dvb-v5-std.c b/lib/libdvbv5/dvb-v5-std.c
index 871de95..50365cb 100644
--- a/lib/libdvbv5/dvb-v5-std.c
+++ b/lib/libdvbv5/dvb-v5-std.c
@@ -154,11 +154,7 @@ const unsigned int sys_turbo_props[] = {
 
 const unsigned int sys_isdbs_props[] = {
DTV_FREQUENCY,
-   DTV_INVERSION,
-   DTV_SYMBOL_RATE,
-   DTV_INNER_FEC,
DTV_STREAM_ID,
-   DTV_POLARIZATION,
0
 };
 
-- 
2.1.2

--
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/7] v4l-utils/libdvbv5: add support for ISDB-S scanning

2014-10-26 Thread tskd08
From: Akihiro Tsukada 

added NIT scan for ISDB-S,
fixed wrong/too-close frequency of the scanned entries,
when "freq_offset"/bandwith was not set properly.
---
 lib/include/libdvbv5/dvb-scan.h |   2 +
 lib/libdvbv5/dvb-fe.c   |   6 +-
 lib/libdvbv5/dvb-file.c |  23 ++-
 lib/libdvbv5/dvb-scan.c | 138 +++-
 lib/libdvbv5/parse_string.c |  15 -
 utils/dvb/dvb-format-convert.c  |   3 +-
 utils/dvb/dvbv5-scan.c  |  19 ++
 7 files changed, 200 insertions(+), 6 deletions(-)

diff --git a/lib/include/libdvbv5/dvb-scan.h b/lib/include/libdvbv5/dvb-scan.h
index fe50687..e3a0d24 100644
--- a/lib/include/libdvbv5/dvb-scan.h
+++ b/lib/include/libdvbv5/dvb-scan.h
@@ -387,6 +387,8 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *parms);
 
 int dvb_new_freq_is_needed(struct dvb_entry *entry, struct dvb_entry 
*last_entry,
   uint32_t freq, enum dvb_sat_polarization pol, int 
shift);
+int dvb_new_ts_is_needed(struct dvb_entry *entry, struct dvb_entry *last_entry,
+  uint32_t freq, int shift, uint32_t ts_id);
 
 struct dvb_entry *dvb_scan_add_entry(struct dvb_v5_fe_parms *parms,
 struct dvb_entry *first_entry,
diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c
index f535311..93c0b9b 100644
--- a/lib/libdvbv5/dvb-fe.c
+++ b/lib/libdvbv5/dvb-fe.c
@@ -372,6 +372,8 @@ int dvb_set_sys(struct dvb_v5_fe_parms *p, 
fe_delivery_system_t sys)
parms->p.current_sys = sys;
parms->n_props = rc;
 
+   if (sys == SYS_ISDBS /* || sys == SYS_ISDBT */)
+   parms->p.default_charset = "arib-std-b24";
return 0;
 }
 
@@ -683,8 +685,10 @@ int dvb_fe_set_parms(struct dvb_v5_fe_parms *p)
dvb_logdbg("LNA is %s", parms->p.lna ? "ON" : "OFF");
}
 
-   if (dvb_fe_is_satellite(tmp_parms.p.current_sys))
+   if (dvb_fe_is_satellite(tmp_parms.p.current_sys)) {
dvb_sat_set_parms(&tmp_parms.p);
+   parms->freq_offset = tmp_parms.freq_offset;
+   }
 
/* Filter out any user DTV_foo property such as DTV_POLARIZATION */
tmp_parms.n_props = dvb_copy_fe_props(tmp_parms.dvb_prop,
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 1ea14c4..fa4d370 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -1125,7 +1125,28 @@ static int get_program_and_store(struct 
dvb_v5_fe_parms_priv *parms,
entry->props[j].cmd = parms->dvb_prop[j].cmd;
entry->props[j].u.data = parms->dvb_prop[j].u.data;
 
-   if (!*channel)
+   /* [ISDB-S]
+* Update DTV_STREAM_ID if it was not specified by a user
+* or set to a wrong one.
+* In those cases, demod must have selected the first TS_ID.
+* The update must be after the above dvb_fe_get_parms() call,
+* since a lazy FE driver that does not update stream_id prop
+* cache in FE.get_frontend() may overwrite the setting again
+* with the initial / user-specified wrong value.
+*/
+   if (entry->props[j].cmd == DTV_STREAM_ID
+   && entry->props[j].u.data == 0
+   && parms->p.current_sys == SYS_ISDBS)
+   entry->props[j].u.data = 
dvb_scan_handler->pat->header.id;
+
+   if (entry->props[j].cmd != DTV_FREQUENCY)
+   continue;
+
+   if (dvb_fe_is_satellite(parms->p.current_sys) &&
+   entry->props[j].u.data < parms->freq_offset)
+   entry->props[j].u.data += parms->freq_offset;
+
+   if (!channel || !*channel)
freq = entry->props[j].u.data;
}
if (!*channel) {
diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c
index 3b70f5a..f265f97 100644
--- a/lib/libdvbv5/dvb-scan.c
+++ b/lib/libdvbv5/dvb-scan.c
@@ -635,7 +635,6 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
rolloff = 115;
break;
case SYS_DVBS:
-   case SYS_ISDBS: /* FIXME: not sure if this rollof is right for ISDB-S */
divisor = 10;
rolloff = 135;
break;
@@ -662,6 +661,12 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
case SYS_DVBC_ANNEX_B:
bw = 600;
break;
+   case SYS_ISDBS:
+   /* since ISDBS uses fixed symbol_rate & rolloff,
+* those parameters are not mandatory in channel config file.
+*/
+   bw = 28860 * 135 / 100;
+   break;
default:
break;
}
@@ -676,7 +681,9 @@ int dvb_estimate_freq_shift(struct dvb_v5_fe_parms *__p)
}
if (!bw)
dvb_fe_retrieve_parm(&parms->p, DTV_BANDWIDTH

Re: [PATCH] cxusb: TS mode setting for TT CT2-4400

2014-10-26 Thread Antti Palosaari

Reviewed-by: Antti Palosaari 

Antti

On 10/26/2014 09:56 AM, Olli Salonen wrote:

There is a new version of the TechnoTrend CT2-4400 USB tuner. The difference is 
the demodulator that is used (Si2168-B40 instead of -A30).

For TT CT2-4400v2 a TS stream related parameter needs to be set, otherwise the 
stream becomes corrupted. The Windows driver for both CT2-4400 and CT2-4400v2 
sets this as well. After this patch the driver works for both versions.

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

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 356abb3..8925b3946 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1438,6 +1438,12 @@ static int cxusb_tt_ct2_4400_attach(struct 
dvb_usb_adapter *adap)
si2168_config.i2c_adapter = &adapter;
si2168_config.fe = &adap->fe_adap[0].fe;
si2168_config.ts_mode = SI2168_TS_PARALLEL;
+
+   /* CT2-4400v2 TS gets corrupted without this */
+   if (d->udev->descriptor.idProduct ==
+   USB_PID_TECHNOTREND_TVSTICK_CT2_4400)
+   si2168_config.ts_mode |= 0x40;
+
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2168", I2C_NAME_SIZE);
info.addr = 0x64;



--
http://palosaari.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


Re: VBI on PVR-500 stopped working between kernels 3.6 and 3.13

2014-10-26 Thread Andy Walls
On October 26, 2014 1:50:36 AM EDT, Hans Verkuil  wrote:
>Hi Christopher,
>
>On 10/26/2014 01:15 AM, Christopher Neufeld wrote:
>> I've been using a PVR-500 to record shows in MythTV, and to capture
>the VBI
>> part of the stream from the standard-definition output of my STB when
>it
>> records high definition.  This has worked for about 7 years now.
>> 
>> I recently updated my LinHES MythTV distribution, and part of the
>update
>> involved moving to a new kernel.  The old kernel went by the code
>> 3.6.7-1-ARCH, while the new one is 3.13.7-2-ARCH.
>> 
>> With the updated kernel, my VBI captures no longer function.
>> Standard-definition recordings made from MythTV using the PVR-500
>before
>> the update have caption data in the stream, those made after do not.
>> 
>> The retrieval of caption data for high-definition shows involves some
>> manual scripting to set the modes for the PVR-500, after which I run
>> ccextractor on the V4L device node and just pull out the captions
>data (the
>> audio and video being output separately on high-definition outputs of
>the
>> STB, and captured by a HD-PVR).
>> 
>> The script that I use to set up captions invokes this command:
>> v4l2-ctl -d  --set-fmt-sliced-vbi=cc
>--set-ctrl=stream_vbi_format=1
>> 
>> This now errors out.  Part of that is a parsing bug in v4l2-ctl, it
>wants
>> to see more text after the 'cc'.  I can change it to 
>> v4l2-ctl -d  --set-fmt-sliced-vbi=cc=1
>--set-ctrl=stream_vbi_format=1
>
>This is a v4l2-ctl bug. I'll fix that asap. But using cc=1 is a valid
>workaround.
>
>> 
>> with this change, it no longer complains about the command line, but
>it
>> errors out in the ioctls.  This behaviour is seen with three versions
>of
>> v4l2-ctl: the old one packaged with the old kernel, the new one
>packaged
>> with the newer kernel, and the git-head, compiled against the headers
>of
>> the new kernel.
>
>Are you calling this when MythTV is already running? If nobody else is
>using
>the PVR-500, does it work?
>
>> 
>> I strace-d the v4l2-ctl command.  The relevant output is:
>> open("/dev/pvr_500_1", O_RDWR)  = 3
>> ioctl(3, VIDIOC_QUERYCAP or VT_OPENQRY, 0x7fff836aac10) = 0
>> ioctl(3, VIDIOC_QUERYCTRL, 0x7fff836aaa70) = 0
>> ioctl(3, VIDIOC_QUERYCTRL, 0x7fff836aaa70) = 0
>> brk(0)  = 0x12ca000
>> brk(0x12eb000)  = 0x12eb000
>> ioctl(3, VIDIOC_QUERYCTRL, 0x7fff836aaa70) = 0
>>  <<>>
>> ioctl(3, VIDIOC_QUERYCTRL, 0x7fff836aaa70) = 0
>> ioctl(3, VIDIOC_QUERYCTRL, 0x7fff836aaa70) = -1 EINVAL (Invalid
>argument)
>> ioctl(3, VIDIOC_S_FMT or VT_RELDISP, 0x62eae0) = -1 EINVAL (Invalid
>argument)
>> fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(136, 0), ...}) = 0
>> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
>0) = 0x7fe8233bf000
>> write(1, "VIDIOC_S_FMT: failed: Invalid ar"..., 39VIDIOC_S_FMT:
>failed: Invalid argument
>> ) = 39
>> close(3)= 0
>> exit_group(-1)  = ?
>> 
>> I did once see VBI data arriving from one of the paired devices in
>the
>> PVR-500, and not from the other.  I would guess that to be because it
>> started up in that state.  When this happened, I ran v4l2-ctl --all
>on both
>> devices, captured the output, and stored it to files.  I did not see
>any
>> relevent differences in these outputs, but I present the diff here:
>> 
>> --- file1   2014-10-25 13:40:36.698703171 -0400
>> +++ file2   2014-10-25 13:40:41.248614481 -0400
>> @@ -1,15 +1,14 @@
>>  Driver Info (not using libv4l2):
>> Driver name   : ivtv
>> -   Card type : WinTV PVR 500 (unit #1)
>> -   Bus info  : PCI::06:08.0
>> +   Card type : WinTV PVR 500 (unit #2)
>> +   Bus info  : PCI::06:09.0
>> Driver version: 3.13.7
>> -   Capabilities  : 0x81070051
>> +   Capabilities  : 0x81030051
>> Video Capture
>> VBI Capture
>> Sliced VBI Capture
>> Tuner
>> Audio
>> -   Radio
>> Read/Write
>> Device Capabilities
>> Device Caps   : 0x01030001
>> @@ -18,7 +17,7 @@
>> Audio
>> Read/Write
>>  Priority: 2
>> -Frequency for tuner 0: 4148 (259.25 MHz)
>> +Frequency for tuner 0: 884 (55.25 MHz)
>>  Tuner 0:
>> Name : ivtv TV Tuner
>> Capabilities : 62.5 kHz multi-standard stereo lang1
>lang2 freq-bands 
>> 
>> 
>> The fact that I once saw valid VBI data suggests that the driver is
>still
>> capable of the feature, but something about the ioctl invocations in
>> v4l2-ctl and in MythTV 0.27.4 is wrong for getting the driver
>reliably into
>> the state where VBI data is present in the stream coming from the
>device.
>
>I won't be able to test this myself until next weekend at the earliest.
>Andy, are you able to look at this?
>
>Regards,
>
>   Hans
>--

Re: [PATCH 1/1] dvb-usb-dvbsky: add s960ci dvb-s/s2 usb ci box support

2014-10-26 Thread Olli Salonen

Reviewed-by: Olli Salonen 

On Mon, 20 Oct 2014, Nibble Max wrote:


DVBSky s960ci dvb-s/s2 usb ci box:
1>dvb frontend: M88TS2022(tuner),M88DS3103(demod)
2>usb controller: CY7C86013A
3>ci controller: CIMAX SP2 or its clone.

Signed-off-by: Nibble Max 
---
drivers/media/usb/dvb-usb-v2/Kconfig  |   1 +
drivers/media/usb/dvb-usb-v2/dvbsky.c | 188 ++
2 files changed, 189 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
b/drivers/media/usb/dvb-usb-v2/Kconfig
index 5b34323..7423033 100644
--- a/drivers/media/usb/dvb-usb-v2/Kconfig
+++ b/drivers/media/usb/dvb-usb-v2/Kconfig
@@ -146,5 +146,6 @@ config DVB_USB_DVBSKY
depends on DVB_USB_V2
select DVB_M88DS3103 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_M88TS2022 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_SP2 if MEDIA_SUBDRV_AUTOSELECT
help
  Say Y here to support the USB receivers from DVBSky.
diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 34688c8..e3439f6 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -21,6 +21,7 @@
#include "dvb_usb.h"
#include "m88ds3103.h"
#include "m88ts2022.h"
+#include "sp2.h"

#define DVBSKY_MSG_DELAY0/*2000*/
#define DVBSKY_BUF_LEN  64
@@ -33,6 +34,7 @@ struct dvbsky_state {
u8 obuf[DVBSKY_BUF_LEN];
u8 last_lock;
struct i2c_client *i2c_client_tuner;
+   struct i2c_client *i2c_client_ci;

/* fe hook functions*/
int (*fe_set_voltage)(struct dvb_frontend *fe,
@@ -362,6 +364,157 @@ fail_attach:
return ret;
}

+static int dvbsky_usb_ci_set_voltage(struct dvb_frontend *fe,
+   fe_sec_voltage_t voltage)
+{
+   struct dvb_usb_device *d = fe_to_d(fe);
+   struct dvbsky_state *state = d_to_priv(d);
+   u8 value;
+
+   if (voltage == SEC_VOLTAGE_OFF)
+   value = 0;
+   else
+   value = 1;
+   dvbsky_gpio_ctrl(d, 0x00, value);
+
+   return state->fe_set_voltage(fe, voltage);
+}
+
+static int dvbsky_ci_ctrl(void *priv, u8 read, int addr,
+   u8 data, int *mem)
+{
+   struct dvb_usb_device *d = priv;
+   int ret = 0;
+   u8 command[4], respond[2], command_size, respond_size;
+
+   command[1] = (u8)((addr >> 8) & 0xff); /*high part of address*/
+   command[2] = (u8)(addr & 0xff); /*low part of address*/
+   if (read) {
+   command[0] = 0x71;
+   command_size = 3;
+   respond_size = 2;
+   } else {
+   command[0] = 0x70;
+   command[3] = data;
+   command_size = 4;
+   respond_size = 1;
+   }
+   ret = dvbsky_usb_generic_rw(d, command, command_size,
+   respond, respond_size);
+   if (ret)
+   goto err;
+   if (read)
+   *mem = respond[1];
+   return ret;
+err:
+   dev_err(&d->udev->dev, "ci control failed=%d\n", ret);
+   return ret;
+}
+
+static const struct m88ds3103_config dvbsky_s960c_m88ds3103_config = {
+   .i2c_addr = 0x68,
+   .clock = 2700,
+   .i2c_wr_max = 33,
+   .clock_out = 0,
+   .ts_mode = M88DS3103_TS_CI,
+   .ts_clk = 1,
+   .ts_clk_pol = 1,
+   .agc = 0x99,
+   .lnb_hv_pol = 0,
+   .lnb_en_pol = 1,
+};
+
+static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap)
+{
+   struct dvbsky_state *state = adap_to_priv(adap);
+   struct dvb_usb_device *d = adap_to_d(adap);
+   int ret = 0;
+   /* demod I2C adapter */
+   struct i2c_adapter *i2c_adapter;
+   struct i2c_client *client_tuner, *client_ci;
+   struct i2c_board_info info;
+   struct sp2_config sp2_config;
+   struct m88ts2022_config m88ts2022_config = {
+   .clock = 2700,
+   };
+   memset(&info, 0, sizeof(struct i2c_board_info));
+
+   /* attach demod */
+   adap->fe[0] = dvb_attach(m88ds3103_attach,
+   &dvbsky_s960c_m88ds3103_config,
+   &d->i2c_adap,
+   &i2c_adapter);
+   if (!adap->fe[0]) {
+   dev_err(&d->udev->dev, "dvbsky_s960ci_attach fail.\n");
+   ret = -ENODEV;
+   goto fail_attach;
+   }
+
+   /* attach tuner */
+   m88ts2022_config.fe = adap->fe[0];
+   strlcpy(info.type, "m88ts2022", I2C_NAME_SIZE);
+   info.addr = 0x60;
+   info.platform_data = &m88ts2022_config;
+   request_module("m88ts2022");
+   client_tuner = i2c_new_device(i2c_adapter, &info);
+   if (client_tuner == NULL || client_tuner->dev.driver == NULL) {
+   ret = -ENODEV;
+   goto fail_tuner_device;
+   }
+
+   if (!try_module_get(client_tuner->dev.driver->owner)) {
+   ret = -ENODEV;
+   goto fail_tuner_module;
+   }
+
+   /* attach ci controller */
+ 

Re: [alsa-devel] [PATCH v2 5/6] sound/usb: pcm changes to use media token api

2014-10-26 Thread Takashi Iwai
At Sat, 25 Oct 2014 11:41:15 -0200,
Mauro Carvalho Chehab wrote:
> 
> (re-sending from my third e-mail - somehow, the two emails I have at
>  Samsung didn't seem to be delivering to vger.kernel.org today)
> 
> Em Wed, 22 Oct 2014 14:26:41 -0500
> Pierre-Louis Bossart  escreveu:
> 
> > On 10/21/14, 11:08 AM, Devin Heitmueller wrote:
> > >> Sorry, I'm not convinced by that.  If the device has to be controlled
> > >> exclusively, the right position is the open/close.  Otherwise, the
> > >> program cannot know when it becomes inaccessible out of sudden during
> > >> its operation.
> > >
> > > I can say that I've definitely seen cases where if you configure a
> > > device as the "default" capture device in PulseAudio, then pulse will
> > > continue to capture from it even if you're not actively capturing the
> > > audio from pulse.  I only spotted this because I had a USB analyzer on
> > > the device and was dumbfounded when the ISOC packets kept arriving
> > > even after I had closed VLC.
> > 
> > this seems like a feature, not a bug. PulseAudio starts streaming before 
> > clients push any data and likewise keeps sources active even after for 
> > some time after clients stop recording. Closing VLC in your example 
> > doesn't immediately close the ALSA device. look for 
> > module-suspend-on-idle in your default.pa config file.
> 
> This could be a feature for an audio capture device that is standalone,
> but for sure it isn't a feature for an audio capture device where the
> audio is only available if video is also being streamed.
> 
> A V4L device with ALSA capture is a different beast than a standalone
> capture port. In a simplified way, it will basically follow the following
> state machine:
> 
>  +---+
>  | start |
>  +---+
>|
>|
>v
>  ++
>  |  idle  | <+
>  ++  |
>|^   ||
>||   ||
>v|   ||
>  +---+  |   ||
>  | configuration |  |   ||
>  +---+  |   ||
>||   ||
>||   ||
>v|   ||
>  +---+  |   ||
>   +> |   streaming   | -+   ||
>   |  +---+  ||
>   ||||
>   ||||
>   |vv|
>   |  +---+---++  |
>   +- |   1   | suspended |  2 | -+
>  +---+---++
> 
> 
> 1) start state
> 
> This is when the V4L2 device gots probed. It checks if the hardware is
> present and initializes some vars/registers, turning off everything
> that can be powered down.
> 
> The tuner on put in sleep mode, analog audio/video decoders and the
> dvb frontend and demux are also turned off.
> 
> 2) idle state
> 
> As the device is powered off, audio won't produce anything. 
> 
> Depending on the device, reading for audio may return a sequence of 
> zeros, or may even fail, as the DMA engine is not ready yet for
> streaming.
> 
> Also, the audio mixer is muted, but the audio input switch is on a
> random state.
> 
> 2) configuration state
> 
> When V4L2 node device is opened and configured, the audio mixer will
> be switched to input audio from the same source of the video stream.
> The corresponding audio input is also unmuted. Almost all devices have 
> at least two audio/video inputs: TV TUNER and COMPOSITE. Other devices
> may also have S-VIDEO, COMPOSITE 2, RADIO TUNER, etc.
> 
> If the device is set on TUNER mode, on modern devices, a tuner firmware
> will be loaded. That may require a long time. Typically, most devices
> take 1/2 seconds to load a firmware, but some devices may take up to 30
> seconds. The firmware may depend on the TV standard that will be used,
> so this can't be loaded at driver warm up state. 
> 
> Also, the power consumption of the tuners is high (it can be ~100-200 mW
> or more when powered, and ~16mW when just I2C is powered). We don't want
> to keep it powered when the device is not used, as this spends battery.
> Also, the life of the device reduces a lot if we keep it always powered.
> 
> During this stage, if an ALSA call is issued, it may interfere at the
> device settings and/or firmware load, with can cause the audio to fail. 
> On such cases, applications might need to close the V4L2 node and re-open
> again.
> 
> 3) streaming state
> 
> The change to this staging requires a V4L2 ioctl.
> 
> Please notice, however, that some apps will open the audio device before
> the V4L2 node, while others will open it after that.
> 
> In any case, audio will only start to produce data after the V4L2 ioctl
> at V4L2 that starts the DMA eng

[PATCH] cxusb: TS mode setting for TT CT2-4400

2014-10-26 Thread Olli Salonen
There is a new version of the TechnoTrend CT2-4400 USB tuner. The difference is 
the demodulator that is used (Si2168-B40 instead of -A30).

For TT CT2-4400v2 a TS stream related parameter needs to be set, otherwise the 
stream becomes corrupted. The Windows driver for both CT2-4400 and CT2-4400v2 
sets this as well. After this patch the driver works for both versions.

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

diff --git a/drivers/media/usb/dvb-usb/cxusb.c 
b/drivers/media/usb/dvb-usb/cxusb.c
index 356abb3..8925b3946 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1438,6 +1438,12 @@ static int cxusb_tt_ct2_4400_attach(struct 
dvb_usb_adapter *adap)
si2168_config.i2c_adapter = &adapter;
si2168_config.fe = &adap->fe_adap[0].fe;
si2168_config.ts_mode = SI2168_TS_PARALLEL;
+
+   /* CT2-4400v2 TS gets corrupted without this */
+   if (d->udev->descriptor.idProduct ==
+   USB_PID_TECHNOTREND_TVSTICK_CT2_4400)
+   si2168_config.ts_mode |= 0x40;
+
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