Geschäftsvorschlag

2014-11-11 Thread Daniel Cressman
Geschäftsvorschlag

Gruß, mein Name ist Herr Andrew WANG Shuhui. Ich bin aus Hong Kong.

Ich habe einen Geschäftsvorschlag für Sie.

Wenn Sie interessiert sind, bitte schreiben Sie mir zurück über meine private

E-Mail-Adresse: andrew...@bigpond.com. Und ich gebe Ihnen weitere 
Informationen. Sprechen Sie Englisch? Vielen Dank.


--
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] stv090x: use lookup tables for carrier/noise ratio

2014-11-11 Thread Mauro Carvalho Chehab
Em Wed, 18 Sep 2013 01:05:20 +0200
Joerg Riechardt j.riecha...@gmx.de escreveu:

 The stv090x driver uses the lookup table for signal strength already, 
 with this patch we use the lookup tables for carrier/noise ratio as well.
 This has the advantage, that values for DVB-S and DVB-S2 are now 
 corresponding, while before they were way off. The values are now 
 proportional to real carrier/noise ratio, while before they were 
 corresponding to register values. So now applications are able to give 
 the user real carrier/noise ratio.
 
 Because the output has to be within 0x...0x the three negative 
 values for DVB-S2 are omitted. This is no significant loss, because 
 reception is lost at 7.5 dB already (TT S2-1600, Cine S2), so the 
 negative values are not really important, and also for DVB-S they don´t 
 exist.
 
 Signed-off-by: Joerg Riechardt j.riecha...@gmx.de
 
 Regards,
 Joerg
 
 --- stv090x.c.bak 2013-09-06 20:59:01.132365872 +0200
 +++ stv090x.c 2013-09-10 03:21:48.884115191 +0200
 @@ -173,9 +173,9 @@
  
  /* DVBS2 C/N Lookup table */
  static const struct stv090x_tab stv090x_s2cn_tab[] = {
 - { -30, 13348 }, /* -3.0dB */
 - { -20, 12640 }, /* -2d.0B */
 - { -10, 11883 }, /* -1.0dB */
 +//   { -30, 13348 }, /* -3.0dB */
 +//   { -20, 12640 }, /* -2d.0B */
 +//   { -10, 11883 }, /* -1.0dB */
   {   0, 11101 }, /* -0.0dB */
   {   5, 10718 }, /*  0.5dB */
   {  10, 10339 }, /*  1.0dB */

Instead of commenting, just truncate the value at the DVBv3 stats
function.

 @@ -3697,9 +3697,10 @@
   }
   val /= 16;
   last = ARRAY_SIZE(stv090x_s2cn_tab) - 1;
 - div = stv090x_s2cn_tab[0].read -
 -   stv090x_s2cn_tab[last].read;
 - *cnr = 0x - ((val * 0x) / div);
 + div = stv090x_s2cn_tab[last].real -
 +   stv090x_s2cn_tab[0].real;
 + val = stv090x_table_lookup(stv090x_s2cn_tab, last, val);
 + *cnr = val * 0x / div;
   }
   break;
  
 @@ -3719,9 +3720,10 @@
   }
   val /= 16;
   last = ARRAY_SIZE(stv090x_s1cn_tab) - 1;
 - div = stv090x_s1cn_tab[0].read -
 -   stv090x_s1cn_tab[last].read;
 - *cnr = 0x - ((val * 0x) / div);
 + div = stv090x_s1cn_tab[last].real -
 +   stv090x_s1cn_tab[0].real;
 + val = stv090x_table_lookup(stv090x_s1cn_tab, last, val);
 + *cnr = val * 0x / div;
   }

As, with this patch, C/N will be a properly scaled value, the best
is to add support for DVBv5 stats. With DVBv5 stats, the scale can
be sent to userspace.

   break;
   default:

Regards,
Mauro
--
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


[GIT FIXES for v3.18] Fix unintended BUG() in smiapp driver

2014-11-11 Thread Sakari Ailus
Hi Mauro,

This simple patch fixes an unintended BUG() in the smiapp driver. This
should go to stable as well.

The patch in the tree is the same than sent to the list, except it cc's
sta...@vger.kernel.org. This issue has existed since the very beginning so
the patch should be applied to the stable series as well.

The following changes since commit 4895cc47a072dcb32d3300d0a46a251a8c6db5f1:

  [media] s5p-mfc: fix sparse error (2014-11-05 08:29:27 -0200)

are available in the git repository at:

  ssh://linuxtv.org/git/sailus/media_tree.git smiapp-fix-v3.18

for you to fetch changes up to b88104c04eb9611a34a6e6ab3fead33d0e93a19c:

  smiapp: Only some selection targets are settable (2014-11-09 01:57:49 +0200)


Sakari Ailus (1):
  smiapp: Only some selection targets are settable

 drivers/media/i2c/smiapp/smiapp-core.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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: [GIT PULL FOR v3.19] uvcvideo changes

2014-11-11 Thread Mauro Carvalho Chehab
Em Fri, 07 Nov 2014 08:16:28 +0200
Laurent Pinchart laurent.pinch...@ideasonboard.com escreveu:

 Hi Mauro,
 
 The following changes since commit 4895cc47a072dcb32d3300d0a46a251a8c6db5f1:
 
   [media] s5p-mfc: fix sparse error (2014-11-05 08:29:27 -0200)
 
 are available in the git repository at:
 
   git://linuxtv.org/pinchartl/media.git remotes/media/uvc/next

It seems that there's something weird with this URL... remotes

Regards,
Mauro
--
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: [RFCv2 1/8] [media] si4713: switch to devm regulator API

2014-11-11 Thread Mauro Carvalho Chehab
Em Tue, 21 Oct 2014 17:07:00 +0200
Sebastian Reichel s...@kernel.org escreveu:

 This switches back to the normal regulator API (but use
 managed variant) in preparation for device tree support.

This patch broke compilation. Please be sure that none of the patches in
the series would break it, as otherwise git bisect would be broken.

Thanks,
Mauro

drivers/media/radio/si4713/si4713.c: In function 'si4713_powerup':
drivers/media/radio/si4713/si4713.c:369:10: error: 'struct si4713_device' has 
no member named 'supplies'
 
  ^
drivers/media/radio/si4713/si4713.c:370:35: error: 'struct si4713_device' has 
no member named 'supplies'
  if (sdev-vdd) {
   ^
drivers/media/radio/si4713/si4713.c:370:51: error: 'struct si4713_device' has 
no member named 'supply_data'
  if (sdev-vdd) {
   ^
drivers/media/radio/si4713/si4713.c:402:10: error: 'struct si4713_device' has 
no member named 'supplies'
   v4l2_dbg(1, debug, sdev-sd, Device in power up mode\n);
  ^
drivers/media/radio/si4713/si4713.c:403:36: error: 'struct si4713_device' has 
no member named 'supplies'
   sdev-power_state = POWER_ON;
^
drivers/media/radio/si4713/si4713.c:403:52: error: 'struct si4713_device' has 
no member named 'supply_data'
   sdev-power_state = POWER_ON;
^
drivers/media/radio/si4713/si4713.c: In function 'si4713_powerdown':
drivers/media/radio/si4713/si4713.c:435:11: error: 'struct si4713_device' has 
no member named 'supplies'
  int err;
   ^
drivers/media/radio/si4713/si4713.c:436:37: error: 'struct si4713_device' has 
no member named 'supplies'
  u8 resp[SI4713_PWDN_NRESP];
 ^
drivers/media/radio/si4713/si4713.c:437:16: error: 'struct si4713_device' has 
no member named 'supply_data'
 
^
drivers/media/radio/si4713/si4713.c: In function 'si4713_probe':
drivers/media/radio/si4713/si4713.c:1444:7: error: 'struct si4713_device' has 
no member named 'supplies'
 /* si4713_probe - probe for the device */
   ^
drivers/media/radio/si4713/si4713.c:1447:22: error: 'struct si4713_device' has 
no member named 'supplies'
 {
  ^
drivers/media/radio/si4713/si4713.c:1448:7: error: 'struct si4713_device' has 
no member named 'supply_data'
  struct si4713_device *sdev;
   ^
drivers/media/radio/si4713/si4713.c:1450:46: error: 'struct si4713_device' has 
no member named 'supplies'
  struct v4l2_ctrl_handler *hdl;
  ^
drivers/media/radio/si4713/si4713.c:1451:11: error: 'struct si4713_device' has 
no member named 'supply_data'
  int rval, i;
   ^
drivers/media/radio/si4713/si4713.c:1583:26: error: 'struct si4713_device' has 
no member named 'supplies'
 
  ^
drivers/media/radio/si4713/si4713.c:1583:42: error: 'struct si4713_device' has 
no member named 'supply_data'
 
  ^
drivers/media/radio/si4713/si4713.c: In function 'si4713_remove':
drivers/media/radio/si4713/si4713.c:1607:26: error: 'struct si4713_device' has 
no member named 'supplies'
   goto free_irq;
  ^
drivers/media/radio/si4713/si4713.c:1607:42: error: 'struct si4713_device' has 
no member named 'supply_data'
   goto free_irq;
--
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: [GIT PULL FOR v3.19] Various fixes

2014-11-11 Thread Mauro Carvalho Chehab
Em Mon, 10 Nov 2014 12:04:50 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

 Sparse fixes for saa7164, adv EDID fixes and si4713 improvements in 
 preparation
 for adding DT support. Tested the si4713 with my USB dev board.
 
 Regards,
 
   Hans
 
 The following changes since commit 4895cc47a072dcb32d3300d0a46a251a8c6db5f1:
 
   [media] s5p-mfc: fix sparse error (2014-11-05 08:29:27 -0200)
 
 are available in the git repository at:
 
   git://linuxtv.org/hverkuil/media_tree.git for-v3.19f
 
 for you to fetch changes up to 017f179ebd74ec3bd3f2484c3cc0fe48c306a36e:
 
   si4713: use managed irq request (2014-11-10 12:03:30 +0100)
 

...

 Sebastian Reichel (4):
   si4713: switch to devm regulator API
   si4713: switch reset gpio to devm_gpiod API
   si4713: use managed memory allocation
   si4713: use managed irq request

None of the above was applied, as the first si4713 patch broke compilation.

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


Re: [PATCH] media: v4l2: make alloction alogthim more robust and flexible

2014-11-11 Thread Sakari Ailus
Hi Zhaowei,

My apologies for the delayed reply.

On Wed, Jul 30, 2014 at 11:55:32AM +0800, Zhaowei Yuan wrote:
 Current algothim relies on the fact that caller will align the
 size to PAGE_SIZE, otherwise order will be decreased to negative
 when remain size is less than PAGE_SIZE, it makes the function
 hard to be migrated.
 This patch sloves the hidden problem.
 
 Signed-off-by: Zhaowei Yuan zhaowei.y...@samsung.com
 ---
  drivers/media/v4l2-core/videobuf2-dma-sg.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c 
 b/drivers/media/v4l2-core/videobuf2-dma-sg.c
 index adefc31..40d18aa 100644
 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
 +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
 @@ -58,7 +58,7 @@ static int vb2_dma_sg_alloc_compacted(struct vb2_dma_sg_buf 
 *buf,
 
   order = get_order(size);
   /* Dont over allocate*/
 - if ((PAGE_SIZE  order)  size)
 + if (order  0  (PAGE_SIZE  order)  size)
   order--;
 
   pages = NULL;

With comments from Andreas taken into account,

Acked-by: Sakari Ailus sakari.ai...@linux.intel.com

I'd consider this for the stable series as well.

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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 2/3] media: rc: add driver for Amlogic Meson IR remote receiver

2014-11-11 Thread Beniamino Galvani
On Sun, Nov 09, 2014 at 08:36:09PM +, Sean Young wrote:
  [...]
  +   dev_info(dev, receiver initialized\n);
  +
  +   return 0;
  +out_unreg:
  +   rc_unregister_device(ir-rc);
 
 rc_unregister_device() already calls rc_free_device().

Right, I will fix this.

Thanks,
Beniamino
--
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: [GIT PULL FOR v3.19] Various fixes

2014-11-11 Thread Hans Verkuil
On 11/11/14 12:09, Mauro Carvalho Chehab wrote:
 Em Mon, 10 Nov 2014 12:04:50 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
 Sparse fixes for saa7164, adv EDID fixes and si4713 improvements in 
 preparation
 for adding DT support. Tested the si4713 with my USB dev board.

 Regards,

  Hans

 The following changes since commit 4895cc47a072dcb32d3300d0a46a251a8c6db5f1:

   [media] s5p-mfc: fix sparse error (2014-11-05 08:29:27 -0200)

 are available in the git repository at:

   git://linuxtv.org/hverkuil/media_tree.git for-v3.19f

 for you to fetch changes up to 017f179ebd74ec3bd3f2484c3cc0fe48c306a36e:

   si4713: use managed irq request (2014-11-10 12:03:30 +0100)

 
 ...
 
 Sebastian Reichel (4):
   si4713: switch to devm regulator API
   si4713: switch reset gpio to devm_gpiod API
   si4713: use managed memory allocation
   si4713: use managed irq request
 
 None of the above was applied, as the first si4713 patch broke compilation.

No problem, I'll look at this on Friday. I should have checked this myself,
sorry about that.

Regards,

Hans

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


Re: [RFCv2 1/8] [media] si4713: switch to devm regulator API

2014-11-11 Thread Sebastian Reichel
Hi Mauro,

On Tue, Nov 11, 2014 at 09:07:10AM -0200, Mauro Carvalho Chehab wrote:
 Em Tue, 21 Oct 2014 17:07:00 +0200
 Sebastian Reichel s...@kernel.org escreveu:
 
  This switches back to the normal regulator API (but use
  managed variant) in preparation for device tree support.
 
 This patch broke compilation. Please be sure that none of the patches in
 the series would break it, as otherwise git bisect would be broken.

 [...]

mh, the errors seem to be from the old code (without the patch
applied to drivers/media/radio/si4713/si4713.c) and the inlined code
fragment displayed by the compiler seems to be the new code (with
the patch applied to drivers/media/radio/si4713/si4713.c).

Possible reasons I can think of:

 * You are using some kind of object cache, which assumed it could
   link the previously compiled si4713.o
 * You started the kernel compilation before merging the patch and
   the commit was only half applied when the compilation reached
   the si4713 driver.

-- Sebastian


signature.asc
Description: Digital signature


[RFC] solo6x10 freeze, even with Oct 31's linux-next... any ideas or help?

2014-11-11 Thread Andrey Utkin
At Bluecherry, we have issues with servers which have 3 solo6110 cards
(and cards have up to 16 analog video cameras connected to them, and
being actively read).
This is a kernel which I tested with such a server last time. It is
based on linux-next of October, 31, with few patches of mine (all are
in review for upstream).
https://github.com/krieger-od/linux/ . The HEAD commit is
949e18db86ebf45acab91d188b247abd40b6e2a1 at the moment.

The problem is the following: after ~1 hour of uptime with working
application reading the streams, one card (the same one every time)
stops producing interrupts (counter in /proc/interrupts freezes), and
all threads reading from that card hang forever in
ioctl(VIDIOC_DQBUF). The application uses libavformat (ffmpeg) API to
read the corresponding /dev/videoX devices of H264 encoders.
Application restart doesn't help, just interrupt counter increases by
64. To help that, we need reboot or programmatic PCI device reset by
echo 1  /sys/bus/pci/devices/\:03\:05.0/reset, which requires
unloading app and driver and is not a solution obviously.

We had this issue for a long time, even before we used libavformat for
reading from such sources.
A few days ago, we had standalone ffmpeg processes working stable for
several days. The kernel was 3.17, the only probably-relevant change
in code over the above mentioned revision is an additional bool
variable set in solo_enc_v4l2_isr() and checked in solo_ring_thread()
to figure out whether to do or skip solo_handle_ring(). The variable
was guarded with spin_lock_irqsave(). I am not sure if it makes any
difference, will try it again eventually.

Any thoughts, can it be a bug in driver code causing that (please
point which areas of code to review/fix)? Or is that desperate
hardware issue? How to figure out for sure whether it is the former or
the latter?

-- 
Bluecherry developer.
--
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] KWorld UB435Q V3 (ATSC) tuner

2014-11-11 Thread Mauro Carvalho Chehab
Hi,

Em Fri, 07 Nov 2014 14:04:56 -0600
The Bit Pit thebit...@earthlink.net escreveu:

 From Wilson Michaels thebit...@earthlink.net
 
 This patch fixes the KWorld UB435-Q V3 (ATSC) tuner functions:
 1) The LED indicator now works.
 2) Start up initialization is faster.
 3) Add lgdt330x device name i2c_devs array used for debugging
 4) Correct comments about the UB435-Q V3
 
 Signed-off-by: Wilson Michaels thebit...@earthlink.net
 
 #
 # On branch media_tree/master
 # Your branch is up-to-date with 'r_media_tree/master'.
 #
 # Changes to be committed:
 # modified:   drivers/media/usb/em28xx/em28xx-cards.c
 # modified:   drivers/media/usb/em28xx/em28xx-i2c.c
 #
 diff --git a/drivers/media/usb/em28xx/em28xx-cards.c
 b/drivers/media/usb/em28xx/em28xx-cards.c
 index 3c97bf1..96835de 100644
 --- a/drivers/media/usb/em28xx/em28xx-cards.c
 +++ b/drivers/media/usb/em28xx/em28xx-cards.c
 @@ -189,11 +189,19 @@ static struct em28xx_reg_seq kworld_a340_digital[] = {
 {   -1, -1, -1, -1},
  };
  
 +/*
 + * KWorld UB435-Q V3 (ATSC) GPIOs map:
 + * EM_GPIO_0 - i2c disable/enable (1 = off, 0 = on)
 + * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
 + * EM_GPIO_2 - currently unknown
 + * EM_GPIO_3 - currently unknown
 + * EM_GPIO_4 - currently unknown
 + * EM_GPIO_5 - TDA18272/M tuner (1 = active, 0 = in reset)
 + * EM_GPIO_6 - LGDT3304 ATSC/QAM demod (1 = active, 0 = in reset)
 + * EM_GPIO_7 - currently unknown
 + */

This is wrong.

At least here on my Kworld UB435-Q v3, I'm pretty sure that
the LED is controlled by EM_GPIO_7.

This is something easy to test with:

# v4l2-dbg -s 0x80 0x80
Register 0x0080 set to 0x80
# v4l2-dbg -s 0x80 0x00 
Register 0x0080 set to 0x0

And the patch below to force the creation of a video device, allowing
the usage of the VIDIOC_DBG_S_REGISTER ioctl at the /dev/video0 interface:

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index 0db880c..120c689 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3342,6 +3342,8 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
}
}
 
+/* HACK! */
+has_video=1;
if (!(has_vendor_audio || has_video || has_dvb)) {
retval = -ENODEV;
goto err_free;

  static struct em28xx_reg_seq kworld_ub435q_v3_digital[] = {
 -   {EM2874_R80_GPIO_P0_CTRL,   0xff,   0xff,   100},
 -   {EM2874_R80_GPIO_P0_CTRL,   0xfe,   0xff,   100},
 -   {EM2874_R80_GPIO_P0_CTRL,   0xbe,   0xff,   100},
 -   {EM2874_R80_GPIO_P0_CTRL,   0xfe,   0xff,   100},
 +   {EM2874_R80_GPIO_P0_CTRL,   0x6e,   ~EM_GPIO_4, 10},
 {   -1, -1, -1, -1},
  };

Also, the above sequence were obtained from the original driver,
by sniffing its traffic. 

Perhaps you have a different model?

 @@ -532,7 +540,7 @@ static struct em28xx_led kworld_ub435q_v3_leds[] = {
 {
 .role  = EM28XX_LED_DIGITAL_CAPTURING,
 .gpio_reg  = EM2874_R80_GPIO_P0_CTRL,
 -   .gpio_mask = 0x80,
 +   .gpio_mask = 0x02,
 .inverted  = 1,
 },
 {-1, 0, 0, 0},

The above is wrong, as 0x80 is where the led is, as shown above.

 @@ -2182,7 +2190,7 @@ struct em28xx_board em28xx_boards[] = {
 },
 /*
  * 1b80:e34c KWorld USB ATSC TV Stick UB435-Q V3
 -* Empia EM2874B + LG DT3305 + NXP TDA18271HDC2
 +* Empia EM2874B + LG DT3305 + NXP TDA18272/M

I think I didn't actually open the hardware, to check what's
inside, but you're probably right: for sure it has a 18272 tuner.

  */
 [EM2874_BOARD_KWORLD_UB435Q_V3] = {
 .name   = KWorld USB ATSC TV Stick UB435-Q V3,


 diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c
 b/drivers/media/usb/em28xx/em28xx-i2c.c
 index 1048c1a..5bc6ef1 100644
 --- a/drivers/media/usb/em28xx/em28xx-i2c.c
 +++ b/drivers/media/usb/em28xx/em28xx-i2c.c
 @@ -877,6 +877,7 @@ static struct i2c_client em28xx_client_template = {
   * incomplete list of known devices
   */
  static char *i2c_devs[128] = {
 +   [0x1c  1] = lgdt330x,
 [0x3e  1] = remote IR sensor,
 [0x4a  1] = saa7113h,
 [0x52  1] = drxk,

You can send this on a separate patch.

Regards,
Mauro
--
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: [RFCv2 1/8] [media] si4713: switch to devm regulator API

2014-11-11 Thread Hans Verkuil
Hi Mauro,

On 11/11/2014 12:07 PM, Mauro Carvalho Chehab wrote:
 Em Tue, 21 Oct 2014 17:07:00 +0200
 Sebastian Reichel s...@kernel.org escreveu:
 
 This switches back to the normal regulator API (but use
 managed variant) in preparation for device tree support.
 
 This patch broke compilation. Please be sure that none of the patches in
 the series would break it, as otherwise git bisect would be broken.

Weird, as reported by Sebastian, it works for me.

However, after applying this patch I get these new warnings:

  CC  drivers/media/radio/si4713/radio-usb-si4713.o
drivers/media/radio/si4713/si4713.c: In function ‘si4713_probe’:
drivers/media/radio/si4713/si4713.c:1617:1: warning: label ‘free_gpio’ defined 
but not used [-Wunused-label]
 free_gpio:
 ^
drivers/media/radio/si4713/si4713.c:1451:12: warning: unused variable ‘i’ 
[-Wunused-variable]
  int rval, i;
^

So it's probably not a good idea to merge this patch anyway until this is fixed.

Sebastian, can you fix these warnings and repost?

Thanks!

Hans

 
 Thanks,
 Mauro
 
 drivers/media/radio/si4713/si4713.c: In function 'si4713_powerup':
 drivers/media/radio/si4713/si4713.c:369:10: error: 'struct si4713_device' has 
 no member named 'supplies'
  
   ^
 drivers/media/radio/si4713/si4713.c:370:35: error: 'struct si4713_device' has 
 no member named 'supplies'
   if (sdev-vdd) {
^
 drivers/media/radio/si4713/si4713.c:370:51: error: 'struct si4713_device' has 
 no member named 'supply_data'
   if (sdev-vdd) {
^
 drivers/media/radio/si4713/si4713.c:402:10: error: 'struct si4713_device' has 
 no member named 'supplies'
v4l2_dbg(1, debug, sdev-sd, Device in power up mode\n);
   ^
 drivers/media/radio/si4713/si4713.c:403:36: error: 'struct si4713_device' has 
 no member named 'supplies'
sdev-power_state = POWER_ON;
 ^
 drivers/media/radio/si4713/si4713.c:403:52: error: 'struct si4713_device' has 
 no member named 'supply_data'
sdev-power_state = POWER_ON;
 ^
 drivers/media/radio/si4713/si4713.c: In function 'si4713_powerdown':
 drivers/media/radio/si4713/si4713.c:435:11: error: 'struct si4713_device' has 
 no member named 'supplies'
   int err;
^
 drivers/media/radio/si4713/si4713.c:436:37: error: 'struct si4713_device' has 
 no member named 'supplies'
   u8 resp[SI4713_PWDN_NRESP];
  ^
 drivers/media/radio/si4713/si4713.c:437:16: error: 'struct si4713_device' has 
 no member named 'supply_data'
  
 ^
 drivers/media/radio/si4713/si4713.c: In function 'si4713_probe':
 drivers/media/radio/si4713/si4713.c:1444:7: error: 'struct si4713_device' has 
 no member named 'supplies'
  /* si4713_probe - probe for the device */
^
 drivers/media/radio/si4713/si4713.c:1447:22: error: 'struct si4713_device' 
 has no member named 'supplies'
  {
   ^
 drivers/media/radio/si4713/si4713.c:1448:7: error: 'struct si4713_device' has 
 no member named 'supply_data'
   struct si4713_device *sdev;
^
 drivers/media/radio/si4713/si4713.c:1450:46: error: 'struct si4713_device' 
 has no member named 'supplies'
   struct v4l2_ctrl_handler *hdl;
   ^
 drivers/media/radio/si4713/si4713.c:1451:11: error: 'struct si4713_device' 
 has no member named 'supply_data'
   int rval, i;
^
 drivers/media/radio/si4713/si4713.c:1583:26: error: 'struct si4713_device' 
 has no member named 'supplies'
  
   ^
 drivers/media/radio/si4713/si4713.c:1583:42: error: 'struct si4713_device' 
 has no member named 'supply_data'
  
   ^
 drivers/media/radio/si4713/si4713.c: In function 'si4713_remove':
 drivers/media/radio/si4713/si4713.c:1607:26: error: 'struct si4713_device' 
 has no member named 'supplies'
goto free_irq;
   ^
 drivers/media/radio/si4713/si4713.c:1607:42: error: 'struct si4713_device' 
 has no member named 'supply_data'
goto free_irq;
 --
 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: [RFC] solo6x10 freeze, even with Oct 31's linux-next... any ideas or help?

2014-11-11 Thread Hans Verkuil
On 11/11/2014 06:46 PM, Andrey Utkin wrote:
 At Bluecherry, we have issues with servers which have 3 solo6110 cards
 (and cards have up to 16 analog video cameras connected to them, and
 being actively read).
 This is a kernel which I tested with such a server last time. It is
 based on linux-next of October, 31, with few patches of mine (all are
 in review for upstream).
 https://github.com/krieger-od/linux/ . The HEAD commit is
 949e18db86ebf45acab91d188b247abd40b6e2a1 at the moment.
 
 The problem is the following: after ~1 hour of uptime with working
 application reading the streams, one card (the same one every time)
 stops producing interrupts (counter in /proc/interrupts freezes), and
 all threads reading from that card hang forever in
 ioctl(VIDIOC_DQBUF). The application uses libavformat (ffmpeg) API to
 read the corresponding /dev/videoX devices of H264 encoders.
 Application restart doesn't help, just interrupt counter increases by
 64. To help that, we need reboot or programmatic PCI device reset by
 echo 1  /sys/bus/pci/devices/\:03\:05.0/reset, which requires
 unloading app and driver and is not a solution obviously.
 
 We had this issue for a long time, even before we used libavformat for
 reading from such sources.
 A few days ago, we had standalone ffmpeg processes working stable for
 several days. The kernel was 3.17, the only probably-relevant change
 in code over the above mentioned revision is an additional bool
 variable set in solo_enc_v4l2_isr() and checked in solo_ring_thread()
 to figure out whether to do or skip solo_handle_ring(). The variable
 was guarded with spin_lock_irqsave(). I am not sure if it makes any
 difference, will try it again eventually.
 
 Any thoughts, can it be a bug in driver code causing that (please
 point which areas of code to review/fix)? Or is that desperate
 hardware issue? How to figure out for sure whether it is the former or
 the latter?

I would first try to exclude hardware issues: since you say it is always
the same card, try either replacing it or swapping it with another solo
card and see if the problem follows the card or not. If it does, then it
is likely a hardware problem. If it doesn't, then it suggests a race
condition in the interrupt handling somewhere.

Regards,

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


Re: [RFC] solo6x10 freeze, even with Oct 31's linux-next... any ideas or help?

2014-11-11 Thread Andrey Utkin
On Tue, Nov 11, 2014 at 8:05 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 I would first try to exclude hardware issues: since you say it is always
 the same card, try either replacing it or swapping it with another solo
 card and see if the problem follows the card or not. If it does, then it
 is likely a hardware problem. If it doesn't, then it suggests a race
 condition in the interrupt handling somewhere.

Thanks for reply, Hans.
Surely valid idea. I will ask for this, but it is out of my physical reach.
If you have any suspects about driver code, please let me know.

-- 
Bluecherry developer.
--
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: [RFCv2 1/8] [media] si4713: switch to devm regulator API

2014-11-11 Thread Mauro Carvalho Chehab
Em Tue, 11 Nov 2014 18:59:31 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

 Hi Mauro,
 
 On 11/11/2014 12:07 PM, Mauro Carvalho Chehab wrote:
  Em Tue, 21 Oct 2014 17:07:00 +0200
  Sebastian Reichel s...@kernel.org escreveu:
  
  This switches back to the normal regulator API (but use
  managed variant) in preparation for device tree support.
  
  This patch broke compilation. Please be sure that none of the patches in
  the series would break it, as otherwise git bisect would be broken.
 
 Weird, as reported by Sebastian, it works for me.

Weird. Not sure what happened here.

 
 However, after applying this patch I get these new warnings:
 
   CC  drivers/media/radio/si4713/radio-usb-si4713.o
 drivers/media/radio/si4713/si4713.c: In function ‘si4713_probe’:
 drivers/media/radio/si4713/si4713.c:1617:1: warning: label ‘free_gpio’ 
 defined but not used [-Wunused-label]
  free_gpio:
  ^
 drivers/media/radio/si4713/si4713.c:1451:12: warning: unused variable ‘i’ 
 [-Wunused-variable]
   int rval, i;
 ^
 
 So it's probably not a good idea to merge this patch anyway until this is 
 fixed.

Agreed. Also, v3 of this series apparently came after the pull request.

Regards,
Mauro


 Sebastian, can you fix these warnings and repost?
 
 Thanks!
 
   Hans
 
  
  Thanks,
  Mauro
  
  drivers/media/radio/si4713/si4713.c: In function 'si4713_powerup':
  drivers/media/radio/si4713/si4713.c:369:10: error: 'struct si4713_device' 
  has no member named 'supplies'
   
^
  drivers/media/radio/si4713/si4713.c:370:35: error: 'struct si4713_device' 
  has no member named 'supplies'
if (sdev-vdd) {
 ^
  drivers/media/radio/si4713/si4713.c:370:51: error: 'struct si4713_device' 
  has no member named 'supply_data'
if (sdev-vdd) {
 ^
  drivers/media/radio/si4713/si4713.c:402:10: error: 'struct si4713_device' 
  has no member named 'supplies'
 v4l2_dbg(1, debug, sdev-sd, Device in power up mode\n);
^
  drivers/media/radio/si4713/si4713.c:403:36: error: 'struct si4713_device' 
  has no member named 'supplies'
 sdev-power_state = POWER_ON;
  ^
  drivers/media/radio/si4713/si4713.c:403:52: error: 'struct si4713_device' 
  has no member named 'supply_data'
 sdev-power_state = POWER_ON;
  ^
  drivers/media/radio/si4713/si4713.c: In function 'si4713_powerdown':
  drivers/media/radio/si4713/si4713.c:435:11: error: 'struct si4713_device' 
  has no member named 'supplies'
int err;
 ^
  drivers/media/radio/si4713/si4713.c:436:37: error: 'struct si4713_device' 
  has no member named 'supplies'
u8 resp[SI4713_PWDN_NRESP];
   ^
  drivers/media/radio/si4713/si4713.c:437:16: error: 'struct si4713_device' 
  has no member named 'supply_data'
   
  ^
  drivers/media/radio/si4713/si4713.c: In function 'si4713_probe':
  drivers/media/radio/si4713/si4713.c:1444:7: error: 'struct si4713_device' 
  has no member named 'supplies'
   /* si4713_probe - probe for the device */
 ^
  drivers/media/radio/si4713/si4713.c:1447:22: error: 'struct si4713_device' 
  has no member named 'supplies'
   {
^
  drivers/media/radio/si4713/si4713.c:1448:7: error: 'struct si4713_device' 
  has no member named 'supply_data'
struct si4713_device *sdev;
 ^
  drivers/media/radio/si4713/si4713.c:1450:46: error: 'struct si4713_device' 
  has no member named 'supplies'
struct v4l2_ctrl_handler *hdl;
^
  drivers/media/radio/si4713/si4713.c:1451:11: error: 'struct si4713_device' 
  has no member named 'supply_data'
int rval, i;
 ^
  drivers/media/radio/si4713/si4713.c:1583:26: error: 'struct si4713_device' 
  has no member named 'supplies'
   
^
  drivers/media/radio/si4713/si4713.c:1583:42: error: 'struct si4713_device' 
  has no member named 'supply_data'
   
^
  drivers/media/radio/si4713/si4713.c: In function 'si4713_remove':
  drivers/media/radio/si4713/si4713.c:1607:26: error: 'struct si4713_device' 
  has no member named 'supplies'
 goto free_irq;
^
  drivers/media/radio/si4713/si4713.c:1607:42: error: 'struct si4713_device' 
  has no member named 'supply_data'
 goto free_irq;
  --
  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: [PATCH] KWorld UB435Q V3 (ATSC) tuner

2014-11-11 Thread The Bit Pit
I initially was unable to make my tuner work with the released driver
because I was using a USB-2 slot on my ASUS Z87-EXPERT motherboard.  It
sometimes initialized on USB-2 according to information in dmesg.  When
I tried w_scan, it always immediately disconnected.  Frustrated, I tried
USB-3 -- and my patches worked perfectly including a functioning LED,

Today, I retested the linux 3.16.7 release driver on USB-3 and it works.

More comments below.

On 11/11/2014 11:56 AM, Mauro Carvalho Chehab wrote:
 Hi,

 Em Fri, 07 Nov 2014 14:04:56 -0600
 The Bit Pit thebit...@earthlink.net escreveu:

 From Wilson Michaels thebit...@earthlink.net

 This patch fixes the KWorld UB435-Q V3 (ATSC) tuner functions:
 1) The LED indicator now works.
 2) Start up initialization is faster.
 3) Add lgdt330x device name i2c_devs array used for debugging
 4) Correct comments about the UB435-Q V3

 Signed-off-by: Wilson Michaels thebit...@earthlink.net

 #
 # On branch media_tree/master
 # Your branch is up-to-date with 'r_media_tree/master'.
 #
 # Changes to be committed:
 # modified:   drivers/media/usb/em28xx/em28xx-cards.c
 # modified:   drivers/media/usb/em28xx/em28xx-i2c.c
 #
 diff --git a/drivers/media/usb/em28xx/em28xx-cards.c
 b/drivers/media/usb/em28xx/em28xx-cards.c
 index 3c97bf1..96835de 100644
 --- a/drivers/media/usb/em28xx/em28xx-cards.c
 +++ b/drivers/media/usb/em28xx/em28xx-cards.c
 @@ -189,11 +189,19 @@ static struct em28xx_reg_seq kworld_a340_digital[] = {
 {   -1, -1, -1, -1},
  };
  
 +/*
 + * KWorld UB435-Q V3 (ATSC) GPIOs map:
 + * EM_GPIO_0 - i2c disable/enable (1 = off, 0 = on)
 + * EM_GPIO_1 - LED disable/enable (1 = off, 0 = on)
 + * EM_GPIO_2 - currently unknown
 + * EM_GPIO_3 - currently unknown
 + * EM_GPIO_4 - currently unknown
 + * EM_GPIO_5 - TDA18272/M tuner (1 = active, 0 = in reset)
 + * EM_GPIO_6 - LGDT3304 ATSC/QAM demod (1 = active, 0 = in reset)
 + * EM_GPIO_7 - currently unknown
 + */
 This is wrong.

 At least here on my Kworld UB435-Q v3, I'm pretty sure that
 the LED is controlled by EM_GPIO_7.

 This is something easy to test with:

 # v4l2-dbg -s 0x80 0x80
 Register 0x0080 set to 0x80
 # v4l2-dbg -s 0x80 0x00 
 Register 0x0080 set to 0x0
I was concerned that the test was also setting bits other than EM_GPIO_7
so I read the register first then set only the EM_GPIO_7 bit:

# v4l2-dbg -g 0x80
ioctl: VIDIOC_DBG_G_REGISTER
Register 0x0080 = feh (254d  1110b)
# v4l2-dbg -s 0x80 0x7e
Register 0x0080 set to 0x7e
# v4l2-dbg -s 0x80 0xfe
Register 0x0080 set to 0xfe

This actually controls the LED.  You are correct and I am wrong,  My
incorrect initialization was leaving the LED turned on.



 And the patch below to force the creation of a video device, allowing
 the usage of the VIDIOC_DBG_S_REGISTER ioctl at the /dev/video0 interface:

 diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
 b/drivers/media/usb/em28xx/em28xx-cards.c
 index 0db880c..120c689 100644
 --- a/drivers/media/usb/em28xx/em28xx-cards.c
 +++ b/drivers/media/usb/em28xx/em28xx-cards.c
 @@ -3342,6 +3342,8 @@ static int em28xx_usb_probe(struct usb_interface 
 *interface,
   }
   }
  
 +/* HACK! */
 +has_video=1;
   if (!(has_vendor_audio || has_video || has_dvb)) {
   retval = -ENODEV;
   goto err_free;
Helpful hack ;-)

  static struct em28xx_reg_seq kworld_ub435q_v3_digital[] = {
 -   {EM2874_R80_GPIO_P0_CTRL,   0xff,   0xff,   100},
 -   {EM2874_R80_GPIO_P0_CTRL,   0xfe,   0xff,   100},
 -   {EM2874_R80_GPIO_P0_CTRL,   0xbe,   0xff,   100},
 -   {EM2874_R80_GPIO_P0_CTRL,   0xfe,   0xff,   100},
 +   {EM2874_R80_GPIO_P0_CTRL,   0x6e,   ~EM_GPIO_4, 10},
 {   -1, -1, -1, -1},
  };
 Also, the above sequence were obtained from the original driver,
 by sniffing its traffic. 

 Perhaps you have a different model?
Same model, my error made it seem to work properly.

 @@ -532,7 +540,7 @@ static struct em28xx_led kworld_ub435q_v3_leds[] = {
 {
 .role  = EM28XX_LED_DIGITAL_CAPTURING,
 .gpio_reg  = EM2874_R80_GPIO_P0_CTRL,
 -   .gpio_mask = 0x80,
 +   .gpio_mask = 0x02,
 .inverted  = 1,
 },
 {-1, 0, 0, 0},
 The above is wrong, as 0x80 is where the led is, as shown above.
I agree.

 @@ -2182,7 +2190,7 @@ struct em28xx_board em28xx_boards[] = {
 },
 /*
  * 1b80:e34c KWorld USB ATSC TV Stick UB435-Q V3
 -* Empia EM2874B + LG DT3305 + NXP TDA18271HDC2
 +* Empia EM2874B + LG DT3305 + NXP TDA18272/M
 I think I didn't actually open the hardware, to check what's
 inside, but you're probably right: for sure it has a 18272 tuner.
I did open up my hardware, the part is marked TDA18272/M.
  */
 [EM2874_BOARD_KWORLD_UB435Q_V3] = {
 .name   = KWorld USB ATSC TV Stick UB435-Q V3,
 

[PATCH] add lgdt330x device name i2c_devs array

2014-11-11 Thread The Bit Pit
From Wilson Michaels thebit...@earthlink.net

This patch adds lgdt330x device name i2c_devs array used for debugging

Signed-off-by: Wilson Michaels thebit...@earthlink.net

#
# On branch media_tree/master
# Your branch is up-to-date with 'r_media_tree/master'.
#
# Changes to be committed:
# modified:   drivers/media/usb/em28xx/em28xx-i2c.c
#
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c
b/drivers/media/usb/em28xx/em28xx-i2c.c
index 1048c1a..5bc6ef1 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -877,6 +877,7 @@ static struct i2c_client em28xx_client_template = {
  * incomplete list of known devices
  */
 static char *i2c_devs[128] = {
+   [0x1c  1] = lgdt330x,
[0x3e  1] = remote IR sensor,
[0x4a  1] = saa7113h,
[0x52  1] = drxk,


--
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: soc-camera and focuser vcm devices

2014-11-11 Thread Andrew Chew
  I think I get it, but just to clarify...currently, I'm going with the
  patch in [1], and I currently have multiple subdevs (sensors) hooked
  up and working with my soc-camera host driver.  [2] was an alternate
  implementation, right? (as in, I don't need it).
 
 No. [1] you don't need, it is already in the mainline, resp. its slightly 
 updated
 version. I only quoted that thread for you above to read explanations about
 why that implementation didn't support multiple subdevices per host. To fix
 that support for multiple devices should be added to the current soc-camera
 mainline. To help with this task I quoted [2], which is my very early
 implementation attempt. [3] is just some more reading for general
 understanding.
 
  So I understand that I can just hook up the focuser and flash subdevs
  to the camera host via device tree, in the same exact way of using the
  of_graph stuff to hook up the sensor subdev.  My question is, is it
  then left up to the camera host driver to make sense of which subdevs
  do what?  Or should/will there be a common mechanism to bind ports on
  a camera host to a sensor, focuser, and flash under a common group
  which makes up an image pipeline?
 
 Exactly, that's why you need multiple subdevices in groups, to have the
 whole pipeline probe only after all subdevices are available.

Thanks, Guennadi.  I think I'm still misunderstanding something, since I 
basically took
[1], and am now (with a tiny modification of removing the hardcoded snippet of 
code
that explicitly prevented multiple subdevs from getting probed) able to 
instantiate
two sensors, both going through the camera host driver (i.e. I have /dev/video0 
and
/dev/video1 both able to capture from each sensor, going through the same camera
host).

The part I don't understand is specifically how subdevs like focusers and flash
devices are supposed to work.  In examining the behavior of soc-camera more
closely after I add my focuser subdev, it seems that there is this general 
assumption
that all subdevs are image capture devices (because the subdev probe process
finishes around soc_camera_probe_finish(), which tries (and fails with the 
focuser)
to get supported capture formats.

But maybe I'm misunderstanding how focuser and flash devices are intended to be
Implemented?  I was under the impression that a focuser driver looks pretty 
much like
a sensor driver (as in, it eventually calls v4l2_i2c_subdev_init() and
v4l2_async_register_subdev().  In my case, the focuser's 
v4l2_async_register_subdev()
call fails because soc_camera_probe_finish() failed its 
soc_camera_init_user_formats().

Soc_camera_init_user_formats() calls into the camera host driver's 
get_formats(), which
tries to call the subdev's enum_mbus_fmt method.  Of course, the focuser subdev
doesn't implement this method, so it fails.  Even if I changed the camera host 
driver so
that it does something special with this subdev, the end result seems to me 
that we'll
get a /dev/video2 for the focuser, which isn't the behavior we want (we want 
the focuser
subdev to be available to the camera host, but it doesn't represent its own 
image
capture entity).

So what is the proper thing to do with the focuser driver to get it somehow 
aggregated
with a particular sensor subdev?  Or is this something that the soc-camera 
framework
doesn't define?  I don't see any example focuser drivers to go by, so this is 
all new to me.
---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
--
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-11-11 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:   Wed Nov 12 04:00:15 CET 2014
git branch: test
git hash:   dd0a6fe2bc3055cd61e369f97982c88183b1f0a0
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-35-gc1c3f96
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.17-2.slh.2-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: ERRORS
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: ERRORS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: ERRORS
linux-git-powerpc64: OK
linux-git-sh: ERRORS
linux-git-x86_64: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17-i686: OK
linux-3.18-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-x86_64: OK
linux-3.17-x86_64: OK
linux-3.18-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.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


[PATCH 05/11] mn88472: rename state to dev

2014-11-11 Thread Antti Palosaari
Rename state to dev.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88472.c  | 141 +++--
 drivers/media/dvb-frontends/mn88472_priv.h |   2 +-
 2 files changed, 72 insertions(+), 71 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
index a3c4ae1..1d72e02 100644
--- a/drivers/media/dvb-frontends/mn88472.c
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -19,7 +19,7 @@
 static struct dvb_frontend_ops mn88472_ops;
 
 /* write multiple registers */
-static int mn88472_wregs(struct mn88472_state *s, u16 reg, const u8 *val, int 
len)
+static int mn88472_wregs(struct mn88472_dev *dev, u16 reg, const u8 *val, int 
len)
 {
 #define MAX_WR_LEN 21
 #define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
@@ -40,11 +40,11 @@ static int mn88472_wregs(struct mn88472_state *s, u16 reg, 
const u8 *val, int le
buf[0] = (reg  0)  0xff;
memcpy(buf[1], val, len);
 
-   ret = i2c_transfer(s-i2c, msg, 1);
+   ret = i2c_transfer(dev-i2c, msg, 1);
if (ret == 1) {
ret = 0;
} else {
-   dev_warn(s-i2c-dev,
+   dev_warn(dev-i2c-dev,
%s: i2c wr failed=%d reg=%02x len=%d\n,
KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
@@ -54,7 +54,7 @@ static int mn88472_wregs(struct mn88472_state *s, u16 reg, 
const u8 *val, int le
 }
 
 /* read multiple registers */
-static int mn88472_rregs(struct mn88472_state *s, u16 reg, u8 *val, int len)
+static int mn88472_rregs(struct mn88472_dev *dev, u16 reg, u8 *val, int len)
 {
 #define MAX_RD_LEN 2
 #define MAX_RD_XFER_LEN (MAX_RD_LEN)
@@ -79,12 +79,12 @@ static int mn88472_rregs(struct mn88472_state *s, u16 reg, 
u8 *val, int len)
 
buf[0] = (reg  0)  0xff;
 
-   ret = i2c_transfer(s-i2c, msg, 2);
+   ret = i2c_transfer(dev-i2c, msg, 2);
if (ret == 2) {
memcpy(val, buf, len);
ret = 0;
} else {
-   dev_warn(s-i2c-dev,
+   dev_warn(dev-i2c-dev,
%s: i2c rd failed=%d reg=%02x len=%d\n,
KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
@@ -94,15 +94,15 @@ static int mn88472_rregs(struct mn88472_state *s, u16 reg, 
u8 *val, int len)
 }
 
 /* write single register */
-static int mn88472_wreg(struct mn88472_state *s, u16 reg, u8 val)
+static int mn88472_wreg(struct mn88472_dev *dev, u16 reg, u8 val)
 {
-   return mn88472_wregs(s, reg, val, 1);
+   return mn88472_wregs(dev, reg, val, 1);
 }
 
 /* read single register */
-static int mn88472_rreg(struct mn88472_state *s, u16 reg, u8 *val)
+static int mn88472_rreg(struct mn88472_dev *dev, u16 reg, u8 *val)
 {
-   return mn88472_rregs(s, reg, val, 1);
+   return mn88472_rregs(dev, reg, val, 1);
 }
 
 static int mn88472_get_tune_settings(struct dvb_frontend *fe,
@@ -114,16 +114,16 @@ static int mn88472_get_tune_settings(struct dvb_frontend 
*fe,
 
 static int mn88472_set_frontend(struct dvb_frontend *fe)
 {
-   struct mn88472_state *s = fe-demodulator_priv;
+   struct mn88472_dev *dev = fe-demodulator_priv;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret;
u32 if_frequency = 0;
-   dev_dbg(s-i2c-dev,
+   dev_dbg(dev-i2c-dev,
%s: delivery_system=%d modulation=%d frequency=%d 
symbol_rate=%d inversion=%d\n,
__func__, c-delivery_system, c-modulation,
c-frequency, c-symbol_rate, c-inversion);
 
-   if (!s-warm) {
+   if (!dev-warm) {
ret = -EAGAIN;
goto err;
}
@@ -140,96 +140,96 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
-   dev_dbg(s-i2c-dev, %s: get_if_frequency=%d\n,
+   dev_dbg(dev-i2c-dev, %s: get_if_frequency=%d\n,
__func__, if_frequency);
}
 
if (if_frequency != 507) {
-   dev_err(s-i2c-dev, %s: IF frequency %d not supported\n,
+   dev_err(dev-i2c-dev, %s: IF frequency %d not supported\n,
KBUILD_MODNAME, if_frequency);
ret = -EINVAL;
goto err;
}
 
-   ret = mn88472_wregs(s, 0x1c08, \x1d, 1);
+   ret = mn88472_wregs(dev, 0x1c08, \x1d, 1);
if (ret)
goto err;
 
-   ret = mn88472_wregs(s, 0x18d9, \xe3, 1);
+   ret = mn88472_wregs(dev, 0x18d9, \xe3, 1);
if (ret)
goto err;
 
-   ret = mn88472_wregs(s, 0x1c83, \x01, 1);
+   ret = mn88472_wregs(dev, 0x1c83, \x01, 1);
if (ret)
goto err;
 
-   ret = mn88472_wregs(s, 0x1c00, \x66\x00\x01\x04\x00, 5);
+   ret = mn88472_wregs(dev, 0x1c00, \x66\x00\x01\x04\x00, 5);
  

[PATCH 09/11] mn88472: move to staging

2014-11-11 Thread Antti Palosaari
It is not ready enough to be released on mainline.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig  |   8 -
 drivers/media/dvb-frontends/Makefile |   1 -
 drivers/media/dvb-frontends/mn88472.c| 523 ---
 drivers/media/dvb-frontends/mn88472_priv.h   |  36 --
 drivers/staging/media/Kconfig|   2 +
 drivers/staging/media/Makefile   |   1 +
 drivers/staging/media/mn88472/Kconfig|   7 +
 drivers/staging/media/mn88472/Makefile   |   5 +
 drivers/staging/media/mn88472/mn88472.c  | 523 +++
 drivers/staging/media/mn88472/mn88472_priv.h |  36 ++
 10 files changed, 574 insertions(+), 568 deletions(-)
 delete mode 100644 drivers/media/dvb-frontends/mn88472.c
 delete mode 100644 drivers/media/dvb-frontends/mn88472_priv.h
 create mode 100644 drivers/staging/media/mn88472/Kconfig
 create mode 100644 drivers/staging/media/mn88472/Makefile
 create mode 100644 drivers/staging/media/mn88472/mn88472.c
 create mode 100644 drivers/staging/media/mn88472/mn88472_priv.h

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 207843e..6c75418 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -441,14 +441,6 @@ config DVB_CXD2820R
help
  Say Y when you want to support this frontend.
 
-config DVB_MN88472
-   tristate Panasonic MN88472
-   depends on DVB_CORE  I2C
-   select REGMAP_I2C
-   default m if !MEDIA_SUBDRV_AUTOSELECT
-   help
- Say Y when you want to support this frontend.
-
 config DVB_RTL2830
tristate Realtek RTL2830 DVB-T
depends on DVB_CORE  I2C
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index b82225f6..ba59df6 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -103,7 +103,6 @@ obj-$(CONFIG_DVB_MB86A20S) += mb86a20s.o
 obj-$(CONFIG_DVB_IX2505V) += ix2505v.o
 obj-$(CONFIG_DVB_STV0367) += stv0367.o
 obj-$(CONFIG_DVB_CXD2820R) += cxd2820r.o
-obj-$(CONFIG_DVB_MN88472) += mn88472.o
 obj-$(CONFIG_DVB_DRXK) += drxk.o
 obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o
 obj-$(CONFIG_DVB_SI2165) += si2165.o
diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
deleted file mode 100644
index 52de8f8..000
--- a/drivers/media/dvb-frontends/mn88472.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- * Panasonic MN88472 DVB-T/T2/C demodulator driver
- *
- * Copyright (C) 2013 Antti Palosaari cr...@iki.fi
- *
- *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.
- */
-
-#include mn88472_priv.h
-
-static int mn88472_get_tune_settings(struct dvb_frontend *fe,
-   struct dvb_frontend_tune_settings *s)
-{
-   s-min_delay_ms = 400;
-   return 0;
-}
-
-static int mn88472_set_frontend(struct dvb_frontend *fe)
-{
-   struct i2c_client *client = fe-demodulator_priv;
-   struct mn88472_dev *dev = i2c_get_clientdata(client);
-   struct dtv_frontend_properties *c = fe-dtv_property_cache;
-   int ret, i;
-   u32 if_frequency = 0;
-   u8 delivery_system_val, if_val[3], bw_val[7], bw_val2;
-
-   dev_dbg(client-dev,
-   delivery_system=%d modulation=%d frequency=%d 
symbol_rate=%d inversion=%d\n,
-   c-delivery_system, c-modulation,
-   c-frequency, c-symbol_rate, c-inversion);
-
-   if (!dev-warm) {
-   ret = -EAGAIN;
-   goto err;
-   }
-
-   switch (c-delivery_system) {
-   case SYS_DVBT:
-   delivery_system_val = 0x02;
-   break;
-   case SYS_DVBT2:
-   delivery_system_val = 0x03;
-   break;
-   case SYS_DVBC_ANNEX_A:
-   delivery_system_val = 0x04;
-   break;
-   default:
-   ret = -EINVAL;
-   goto err;
-   }
-
-   switch (c-delivery_system) {
-   case SYS_DVBT:
-   case SYS_DVBT2:
-   if (c-bandwidth_hz = 600) {
-   /* IF 357 Hz, BW 600 Hz */
-   memcpy(if_val, \x2c\x94\xdb, 3);
-   memcpy(bw_val, \xbf\x55\x55\x15\x6b\x15\x6b, 7);
-   bw_val2 = 0x02;
-   } else if (c-bandwidth_hz = 700) {
-   /* IF 457 Hz, BW 700 Hz */
-   memcpy(if_val, 

[PATCH 06/11] mn88472: convert driver to I2C client

2014-11-11 Thread Antti Palosaari
It uses I2C bus so better to implement it as a standard I2C driver
model. It was using proprietary DVB binding.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88472.c  | 241 ++---
 drivers/media/dvb-frontends/mn88472.h  |  30 ++--
 drivers/media/dvb-frontends/mn88472_priv.h |   6 +-
 3 files changed, 165 insertions(+), 112 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
index 1d72e02..a65741a 100644
--- a/drivers/media/dvb-frontends/mn88472.c
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -40,13 +40,13 @@ static int mn88472_wregs(struct mn88472_dev *dev, u16 reg, 
const u8 *val, int le
buf[0] = (reg  0)  0xff;
memcpy(buf[1], val, len);
 
-   ret = i2c_transfer(dev-i2c, msg, 1);
+   ret = i2c_transfer(dev-client[0]-adapter, msg, 1);
if (ret == 1) {
ret = 0;
} else {
-   dev_warn(dev-i2c-dev,
-   %s: i2c wr failed=%d reg=%02x len=%d\n,
-   KBUILD_MODNAME, ret, reg, len);
+   dev_warn(dev-client[0]-dev,
+   i2c wr failed=%d reg=%02x len=%d\n,
+   ret, reg, len);
ret = -EREMOTEIO;
}
 
@@ -79,14 +79,14 @@ static int mn88472_rregs(struct mn88472_dev *dev, u16 reg, 
u8 *val, int len)
 
buf[0] = (reg  0)  0xff;
 
-   ret = i2c_transfer(dev-i2c, msg, 2);
+   ret = i2c_transfer(dev-client[0]-adapter, msg, 2);
if (ret == 2) {
memcpy(val, buf, len);
ret = 0;
} else {
-   dev_warn(dev-i2c-dev,
-   %s: i2c rd failed=%d reg=%02x len=%d\n,
-   KBUILD_MODNAME, ret, reg, len);
+   dev_warn(dev-client[0]-dev,
+   i2c rd failed=%d reg=%02x len=%d\n,
+   ret, reg, len);
ret = -EREMOTEIO;
}
 
@@ -114,13 +114,15 @@ static int mn88472_get_tune_settings(struct dvb_frontend 
*fe,
 
 static int mn88472_set_frontend(struct dvb_frontend *fe)
 {
-   struct mn88472_dev *dev = fe-demodulator_priv;
+   struct i2c_client *client = fe-demodulator_priv;
+   struct mn88472_dev *dev = i2c_get_clientdata(client);
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret;
u32 if_frequency = 0;
-   dev_dbg(dev-i2c-dev,
-   %s: delivery_system=%d modulation=%d frequency=%d 
symbol_rate=%d inversion=%d\n,
-   __func__, c-delivery_system, c-modulation,
+
+   dev_dbg(client-dev,
+   delivery_system=%d modulation=%d frequency=%d 
symbol_rate=%d inversion=%d\n,
+   c-delivery_system, c-modulation,
c-frequency, c-symbol_rate, c-inversion);
 
if (!dev-warm) {
@@ -140,13 +142,12 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
-   dev_dbg(dev-i2c-dev, %s: get_if_frequency=%d\n,
-   __func__, if_frequency);
+   dev_dbg(client-dev, get_if_frequency=%d\n, if_frequency);
}
 
if (if_frequency != 507) {
-   dev_err(dev-i2c-dev, %s: IF frequency %d not supported\n,
-   KBUILD_MODNAME, if_frequency);
+   dev_err(client-dev, IF frequency %d not supported\n,
+   if_frequency);
ret = -EINVAL;
goto err;
}
@@ -212,13 +213,14 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
 
return 0;
 err:
-   dev_dbg(dev-i2c-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(client-dev, failed=%d\n, ret);
return ret;
 }
 
 static int mn88472_read_status(struct dvb_frontend *fe, fe_status_t *status)
 {
-   struct mn88472_dev *dev = fe-demodulator_priv;
+   struct i2c_client *client = fe-demodulator_priv;
+   struct mn88472_dev *dev = i2c_get_clientdata(client);
int ret;
u8 u8tmp;
 
@@ -239,17 +241,19 @@ static int mn88472_read_status(struct dvb_frontend *fe, 
fe_status_t *status)
 
return 0;
 err:
-   dev_dbg(dev-i2c-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(client-dev, failed=%d\n, ret);
return ret;
 }
 
 static int mn88472_init(struct dvb_frontend *fe)
 {
-   struct mn88472_dev *dev = fe-demodulator_priv;
+   struct i2c_client *client = fe-demodulator_priv;
+   struct mn88472_dev *dev = i2c_get_clientdata(client);
int ret, len, remaining;
const struct firmware *fw = NULL;
u8 *fw_file = MN88472_FIRMWARE;
-   dev_dbg(dev-i2c-dev, %s:\n, __func__);
+
+   dev_dbg(client-dev, \n);
 
/* set cold state by default */
dev-warm = false;
@@ -264,32 +268,31 @@ static 

[PATCH 02/11] mn88472: correct attach symbol name

2014-11-11 Thread Antti Palosaari
Wrong symbol name causes demod attach failure.

Reported-by: Benjamin Larsson benja...@southpole.se
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88472.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88472.h 
b/drivers/media/dvb-frontends/mn88472.h
index 29aa485..c817bfb 100644
--- a/drivers/media/dvb-frontends/mn88472.h
+++ b/drivers/media/dvb-frontends/mn88472.h
@@ -28,12 +28,12 @@ struct mn88472_c_config {
 };
 
 #if IS_ENABLED(CONFIG_DVB_MN88472)
-extern struct dvb_frontend *mn88472_c_attach(
+extern struct dvb_frontend *mn88472_attach_c(
const struct mn88472_c_config *cfg,
struct i2c_adapter *i2c
 );
 #else
-static inline struct dvb_frontend *mn88472_c_attach(
+static inline struct dvb_frontend *mn88472_attach_c(
const struct mn88472_c_config *cfg,
struct i2c_adapter *i2c
 )
-- 
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 04/11] mn88472: rename mn88472_c.c = mn88472.c

2014-11-11 Thread Antti Palosaari
Original plan was to implement driver as one file per used demod
standard (mn88472_c.c, mn88472_t.c and mn88472_t2.c). However, that
plan was a mistake as driver code differences are so small between
different standards. Due to that rename this file and implement all
the needed functionality to that file.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Makefile   |   1 -
 drivers/media/dvb-frontends/mn88472.c  | 423 +
 drivers/media/dvb-frontends/mn88472.h  |  10 +-
 drivers/media/dvb-frontends/mn88472_c.c| 423 -
 drivers/media/dvb-frontends/mn88472_priv.h |   2 +-
 5 files changed, 429 insertions(+), 430 deletions(-)
 create mode 100644 drivers/media/dvb-frontends/mn88472.c
 delete mode 100644 drivers/media/dvb-frontends/mn88472_c.c

diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index 27d82b6..b82225f6 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -15,7 +15,6 @@ stv0900-objs := stv0900_core.o stv0900_sw.o
 drxd-objs := drxd_firm.o drxd_hard.o
 cxd2820r-objs := cxd2820r_core.o cxd2820r_c.o cxd2820r_t.o cxd2820r_t2.o
 drxk-objs := drxk_hard.o
-mn88472-objs := mn88472_c.o
 
 obj-$(CONFIG_DVB_PLL) += dvb-pll.o
 obj-$(CONFIG_DVB_STV0299) += stv0299.o
diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
new file mode 100644
index 000..a3c4ae1
--- /dev/null
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -0,0 +1,423 @@
+/*
+ * Panasonic MN88472 DVB-T/T2/C demodulator driver
+ *
+ * Copyright (C) 2013 Antti Palosaari cr...@iki.fi
+ *
+ *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.
+ */
+
+#include mn88472_priv.h
+
+static struct dvb_frontend_ops mn88472_ops;
+
+/* write multiple registers */
+static int mn88472_wregs(struct mn88472_state *s, u16 reg, const u8 *val, int 
len)
+{
+#define MAX_WR_LEN 21
+#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
+   int ret;
+   u8 buf[MAX_WR_XFER_LEN];
+   struct i2c_msg msg[1] = {
+   {
+   .addr = (reg  8)  0xff,
+   .flags = 0,
+   .len = 1 + len,
+   .buf = buf,
+   }
+   };
+
+   if (WARN_ON(len  MAX_WR_LEN))
+   return -EINVAL;
+
+   buf[0] = (reg  0)  0xff;
+   memcpy(buf[1], val, len);
+
+   ret = i2c_transfer(s-i2c, msg, 1);
+   if (ret == 1) {
+   ret = 0;
+   } else {
+   dev_warn(s-i2c-dev,
+   %s: i2c wr failed=%d reg=%02x len=%d\n,
+   KBUILD_MODNAME, ret, reg, len);
+   ret = -EREMOTEIO;
+   }
+
+   return ret;
+}
+
+/* read multiple registers */
+static int mn88472_rregs(struct mn88472_state *s, u16 reg, u8 *val, int len)
+{
+#define MAX_RD_LEN 2
+#define MAX_RD_XFER_LEN (MAX_RD_LEN)
+   int ret;
+   u8 buf[MAX_RD_XFER_LEN];
+   struct i2c_msg msg[2] = {
+   {
+   .addr = (reg  8)  0xff,
+   .flags = 0,
+   .len = 1,
+   .buf = buf,
+   }, {
+   .addr = (reg  8)  0xff,
+   .flags = I2C_M_RD,
+   .len = len,
+   .buf = buf,
+   }
+   };
+
+   if (WARN_ON(len  MAX_RD_LEN))
+   return -EINVAL;
+
+   buf[0] = (reg  0)  0xff;
+
+   ret = i2c_transfer(s-i2c, msg, 2);
+   if (ret == 2) {
+   memcpy(val, buf, len);
+   ret = 0;
+   } else {
+   dev_warn(s-i2c-dev,
+   %s: i2c rd failed=%d reg=%02x len=%d\n,
+   KBUILD_MODNAME, ret, reg, len);
+   ret = -EREMOTEIO;
+   }
+
+   return ret;
+}
+
+/* write single register */
+static int mn88472_wreg(struct mn88472_state *s, u16 reg, u8 val)
+{
+   return mn88472_wregs(s, reg, val, 1);
+}
+
+/* read single register */
+static int mn88472_rreg(struct mn88472_state *s, u16 reg, u8 *val)
+{
+   return mn88472_rregs(s, reg, val, 1);
+}
+
+static int mn88472_get_tune_settings(struct dvb_frontend *fe,
+   struct dvb_frontend_tune_settings *s)
+{
+   s-min_delay_ms = 400;
+   return 0;
+}
+
+static int mn88472_set_frontend(struct dvb_frontend *fe)
+{
+   struct mn88472_state *s = fe-demodulator_priv;
+ 

[PATCH 10/11] mn88472: add staging TODO

2014-11-11 Thread Antti Palosaari
Add TODO for mainlining.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/mn88472/TODO | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 drivers/staging/media/mn88472/TODO

diff --git a/drivers/staging/media/mn88472/TODO 
b/drivers/staging/media/mn88472/TODO
new file mode 100644
index 000..b90a14b
--- /dev/null
+++ b/drivers/staging/media/mn88472/TODO
@@ -0,0 +1,21 @@
+Driver general quality is not good enough for mainline. Also, other
+device drivers (USB-bridge, tuner) needed for Astrometa receiver in
+question could need some changes. However, if that driver is mainlined
+due to some other device than Astrometa, unrelated TODOs could be
+skipped. In that case rtl28xxu driver needs module parameter to prevent
+driver loading.
+
+Required TODOs:
+* missing lock flags
+* I2C errors
+* tuner sensitivity
+
+*Do not* send any patch fixing checkpatch.pl issues. Currently it passes
+checkpatch.pl tests. I don't want waste my time to review this kind of
+trivial stuff. *Do not* add missing register I/O error checks. Those are
+missing for the reason it is much easier to compare I2C data sniffs when
+there is less lines. Those error checks are about the last thing to be added.
+
+Patches should be submitted to:
+linux-media@vger.kernel.org and Antti Palosaari cr...@iki.fi
+
-- 
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 08/11] mn88472: implement DVB-T and DVB-T2

2014-11-11 Thread Antti Palosaari
Implement initial support for DVB-T and DVB-T2 modes. Now driver has
basic support for all the modes, DVB-C/T/T2.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88472.c | 176 ++
 1 file changed, 135 insertions(+), 41 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
index c680154..52de8f8 100644
--- a/drivers/media/dvb-frontends/mn88472.c
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -28,8 +28,9 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
struct i2c_client *client = fe-demodulator_priv;
struct mn88472_dev *dev = i2c_get_clientdata(client);
struct dtv_frontend_properties *c = fe-dtv_property_cache;
-   int ret;
+   int ret, i;
u32 if_frequency = 0;
+   u8 delivery_system_val, if_val[3], bw_val[7], bw_val2;
 
dev_dbg(client-dev,
delivery_system=%d modulation=%d frequency=%d 
symbol_rate=%d inversion=%d\n,
@@ -41,6 +42,55 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
goto err;
}
 
+   switch (c-delivery_system) {
+   case SYS_DVBT:
+   delivery_system_val = 0x02;
+   break;
+   case SYS_DVBT2:
+   delivery_system_val = 0x03;
+   break;
+   case SYS_DVBC_ANNEX_A:
+   delivery_system_val = 0x04;
+   break;
+   default:
+   ret = -EINVAL;
+   goto err;
+   }
+
+   switch (c-delivery_system) {
+   case SYS_DVBT:
+   case SYS_DVBT2:
+   if (c-bandwidth_hz = 600) {
+   /* IF 357 Hz, BW 600 Hz */
+   memcpy(if_val, \x2c\x94\xdb, 3);
+   memcpy(bw_val, \xbf\x55\x55\x15\x6b\x15\x6b, 7);
+   bw_val2 = 0x02;
+   } else if (c-bandwidth_hz = 700) {
+   /* IF 457 Hz, BW 700 Hz */
+   memcpy(if_val, \x39\x11\xbc, 3);
+   memcpy(bw_val, \xa4\x00\x00\x0f\x2c\x0f\x2c, 7);
+   bw_val2 = 0x01;
+   } else if (c-bandwidth_hz = 800) {
+   /* IF 457 Hz, BW 800 Hz */
+   memcpy(if_val, \x39\x11\xbc, 3);
+   memcpy(bw_val, \x8f\x80\x00\x08\xee\x08\xee, 7);
+   bw_val2 = 0x00;
+   } else {
+   ret = -EINVAL;
+   goto err;
+   }
+   break;
+   case SYS_DVBC_ANNEX_A:
+   /* IF 507 Hz, BW 800 Hz */
+   memcpy(if_val, \x3f\x50\x2c, 3);
+   memcpy(bw_val, \x8f\x80\x00\x08\xee\x08\xee, 7);
+   bw_val2 = 0x00;
+   break;
+   default:
+   ret = -EINVAL;
+   goto err;
+   }
+
/* program tuner */
if (fe-ops.tuner_ops.set_params) {
ret = fe-ops.tuner_ops.set_params(fe);
@@ -56,67 +106,98 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
dev_dbg(client-dev, get_if_frequency=%d\n, if_frequency);
}
 
-   if (if_frequency != 507) {
+   switch (if_frequency) {
+   case 357:
+   case 457:
+   case 507:
+   break;
+   default:
dev_err(client-dev, IF frequency %d not supported\n,
if_frequency);
ret = -EINVAL;
goto err;
}
 
-   ret = regmap_write(dev-regmap[2], 0x08, 0x1d);
-   if (ret)
-   goto err;
-
-   ret = regmap_write(dev-regmap[0], 0xd9, 0xe3);
-   if (ret)
-   goto err;
-
-   ret = regmap_write(dev-regmap[2], 0x83, 0x01);
+   ret = regmap_write(dev-regmap[2], 0xfb, 0x13);
+   ret = regmap_write(dev-regmap[2], 0xef, 0x13);
+   ret = regmap_write(dev-regmap[2], 0xf9, 0x13);
if (ret)
goto err;
 
-   ret = regmap_bulk_write(dev-regmap[2], 0x00,
-   \x66\x00\x01\x04\x00, 5);
+   ret = regmap_write(dev-regmap[2], 0x00, 0x66);
if (ret)
goto err;
-
-   ret = regmap_bulk_write(dev-regmap[2], 0x10,
-   \x3f\x50\x2c\x8f\x80\x00\x08\xee\x08\xee, 10);
+   ret = regmap_write(dev-regmap[2], 0x01, 0x00);
if (ret)
goto err;
-
-   ret = regmap_write(dev-regmap[0], 0x46, 0x00);
+   ret = regmap_write(dev-regmap[2], 0x02, 0x01);
if (ret)
goto err;
-
-   ret = regmap_write(dev-regmap[0], 0xae, 0x00);
-   if (ret)
-   goto err;
-
-   ret = regmap_write(dev-regmap[0], 0xb0, 0x0b);
-   if (ret)
-   goto err;
-
-   ret = regmap_write(dev-regmap[0], 0xb4, 0x00);
+   ret = regmap_write(dev-regmap[2], 0x03, delivery_system_val);
if (ret)

[PATCH 07/11] mn88472: Convert driver to I2C RegMap API

2014-11-11 Thread Antti Palosaari
Convert driver to I2C RegMap API.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig|   1 +
 drivers/media/dvb-frontends/mn88472.c  | 180 ++---
 drivers/media/dvb-frontends/mn88472_priv.h |   2 +
 3 files changed, 64 insertions(+), 119 deletions(-)

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 02bada4..207843e 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -444,6 +444,7 @@ config DVB_CXD2820R
 config DVB_MN88472
tristate Panasonic MN88472
depends on DVB_CORE  I2C
+   select REGMAP_I2C
default m if !MEDIA_SUBDRV_AUTOSELECT
help
  Say Y when you want to support this frontend.
diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
index a65741a..c680154 100644
--- a/drivers/media/dvb-frontends/mn88472.c
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -16,95 +16,6 @@
 
 #include mn88472_priv.h
 
-static struct dvb_frontend_ops mn88472_ops;
-
-/* write multiple registers */
-static int mn88472_wregs(struct mn88472_dev *dev, u16 reg, const u8 *val, int 
len)
-{
-#define MAX_WR_LEN 21
-#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
-   int ret;
-   u8 buf[MAX_WR_XFER_LEN];
-   struct i2c_msg msg[1] = {
-   {
-   .addr = (reg  8)  0xff,
-   .flags = 0,
-   .len = 1 + len,
-   .buf = buf,
-   }
-   };
-
-   if (WARN_ON(len  MAX_WR_LEN))
-   return -EINVAL;
-
-   buf[0] = (reg  0)  0xff;
-   memcpy(buf[1], val, len);
-
-   ret = i2c_transfer(dev-client[0]-adapter, msg, 1);
-   if (ret == 1) {
-   ret = 0;
-   } else {
-   dev_warn(dev-client[0]-dev,
-   i2c wr failed=%d reg=%02x len=%d\n,
-   ret, reg, len);
-   ret = -EREMOTEIO;
-   }
-
-   return ret;
-}
-
-/* read multiple registers */
-static int mn88472_rregs(struct mn88472_dev *dev, u16 reg, u8 *val, int len)
-{
-#define MAX_RD_LEN 2
-#define MAX_RD_XFER_LEN (MAX_RD_LEN)
-   int ret;
-   u8 buf[MAX_RD_XFER_LEN];
-   struct i2c_msg msg[2] = {
-   {
-   .addr = (reg  8)  0xff,
-   .flags = 0,
-   .len = 1,
-   .buf = buf,
-   }, {
-   .addr = (reg  8)  0xff,
-   .flags = I2C_M_RD,
-   .len = len,
-   .buf = buf,
-   }
-   };
-
-   if (WARN_ON(len  MAX_RD_LEN))
-   return -EINVAL;
-
-   buf[0] = (reg  0)  0xff;
-
-   ret = i2c_transfer(dev-client[0]-adapter, msg, 2);
-   if (ret == 2) {
-   memcpy(val, buf, len);
-   ret = 0;
-   } else {
-   dev_warn(dev-client[0]-dev,
-   i2c rd failed=%d reg=%02x len=%d\n,
-   ret, reg, len);
-   ret = -EREMOTEIO;
-   }
-
-   return ret;
-}
-
-/* write single register */
-static int mn88472_wreg(struct mn88472_dev *dev, u16 reg, u8 val)
-{
-   return mn88472_wregs(dev, reg, val, 1);
-}
-
-/* read single register */
-static int mn88472_rreg(struct mn88472_dev *dev, u16 reg, u8 *val)
-{
-   return mn88472_rregs(dev, reg, val, 1);
-}
-
 static int mn88472_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s)
 {
@@ -152,60 +63,61 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
goto err;
}
 
-   ret = mn88472_wregs(dev, 0x1c08, \x1d, 1);
+   ret = regmap_write(dev-regmap[2], 0x08, 0x1d);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x18d9, \xe3, 1);
+   ret = regmap_write(dev-regmap[0], 0xd9, 0xe3);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x1c83, \x01, 1);
+   ret = regmap_write(dev-regmap[2], 0x83, 0x01);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x1c00, \x66\x00\x01\x04\x00, 5);
+   ret = regmap_bulk_write(dev-regmap[2], 0x00,
+   \x66\x00\x01\x04\x00, 5);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x1c10,
+   ret = regmap_bulk_write(dev-regmap[2], 0x10,
\x3f\x50\x2c\x8f\x80\x00\x08\xee\x08\xee, 10);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x1846, \x00, 1);
+   ret = regmap_write(dev-regmap[0], 0x46, 0x00);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x18ae, \x00, 1);
+   ret = regmap_write(dev-regmap[0], 0xae, 0x00);
if (ret)
goto err;
 
-   ret = mn88472_wregs(dev, 0x18b0, \x0b, 1);
+   ret = 

[PATCH 11/11] MAINTAINERS: add mn88472 (Panasonic MN88472)

2014-11-11 Thread Antti Palosaari
Add mn88472 driver from staging. DVB-T/T2/C demodulator driver.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 MAINTAINERS | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2a9cff1..644a1ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6115,6 +6115,17 @@ S:   Supported
 F: include/linux/mlx5/
 F: drivers/infiniband/hw/mlx5/
 
+MN88472 MEDIA DRIVER
+M: Antti Palosaari cr...@iki.fi
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+W: http://palosaari.fi/linux/
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+T: git git://linuxtv.org/anttip/media_tree.git
+S: Maintained
+F: drivers/staging/media/mn88472/
+F: drivers/media/dvb-frontends/mn88472.h
+
 MODULE SUPPORT
 M: Rusty Russell ru...@rustcorp.com.au
 S: Maintained
-- 
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 01/11] mn88472: Panasonic MN88472 demod driver (DVB-C only)

2014-11-11 Thread Antti Palosaari
Only DVB-C mode is supported, DVB-T and DVB-T2 are not supported.
Very much feature reduced version, no signal statistics nor normal
chip configuration options.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig|   7 +
 drivers/media/dvb-frontends/Makefile   |   2 +
 drivers/media/dvb-frontends/mn88472.h  |  46 
 drivers/media/dvb-frontends/mn88472_c.c| 414 +
 drivers/media/dvb-frontends/mn88472_priv.h |  36 +++
 5 files changed, 505 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/mn88472.h
 create mode 100644 drivers/media/dvb-frontends/mn88472_c.c
 create mode 100644 drivers/media/dvb-frontends/mn88472_priv.h

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 6c75418..02bada4 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -441,6 +441,13 @@ config DVB_CXD2820R
help
  Say Y when you want to support this frontend.
 
+config DVB_MN88472
+   tristate Panasonic MN88472
+   depends on DVB_CORE  I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y when you want to support this frontend.
+
 config DVB_RTL2830
tristate Realtek RTL2830 DVB-T
depends on DVB_CORE  I2C
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index ba59df6..27d82b6 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -15,6 +15,7 @@ stv0900-objs := stv0900_core.o stv0900_sw.o
 drxd-objs := drxd_firm.o drxd_hard.o
 cxd2820r-objs := cxd2820r_core.o cxd2820r_c.o cxd2820r_t.o cxd2820r_t2.o
 drxk-objs := drxk_hard.o
+mn88472-objs := mn88472_c.o
 
 obj-$(CONFIG_DVB_PLL) += dvb-pll.o
 obj-$(CONFIG_DVB_STV0299) += stv0299.o
@@ -103,6 +104,7 @@ obj-$(CONFIG_DVB_MB86A20S) += mb86a20s.o
 obj-$(CONFIG_DVB_IX2505V) += ix2505v.o
 obj-$(CONFIG_DVB_STV0367) += stv0367.o
 obj-$(CONFIG_DVB_CXD2820R) += cxd2820r.o
+obj-$(CONFIG_DVB_MN88472) += mn88472.o
 obj-$(CONFIG_DVB_DRXK) += drxk.o
 obj-$(CONFIG_DVB_TDA18271C2DD) += tda18271c2dd.o
 obj-$(CONFIG_DVB_SI2165) += si2165.o
diff --git a/drivers/media/dvb-frontends/mn88472.h 
b/drivers/media/dvb-frontends/mn88472.h
new file mode 100644
index 000..29aa485
--- /dev/null
+++ b/drivers/media/dvb-frontends/mn88472.h
@@ -0,0 +1,46 @@
+/*
+ * Panasonic MN88472 DVB-T/T2/C demodulator driver
+ *
+ * Copyright (C) 2013 Antti Palosaari cr...@iki.fi
+ *
+ *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.
+ */
+
+#ifndef MN88472_H
+#define MN88472_H
+
+#include linux/dvb/frontend.h
+
+struct mn88472_c_config {
+   /*
+* max bytes I2C client could write
+* Value must be set.
+*/
+   int i2c_wr_max;
+};
+
+#if IS_ENABLED(CONFIG_DVB_MN88472)
+extern struct dvb_frontend *mn88472_c_attach(
+   const struct mn88472_c_config *cfg,
+   struct i2c_adapter *i2c
+);
+#else
+static inline struct dvb_frontend *mn88472_c_attach(
+   const struct mn88472_c_config *cfg,
+   struct i2c_adapter *i2c
+)
+{
+   dev_warn(i2c-dev, %s: driver disabled by Kconfig\n, __func__);
+   return NULL;
+}
+#endif
+
+#endif
diff --git a/drivers/media/dvb-frontends/mn88472_c.c 
b/drivers/media/dvb-frontends/mn88472_c.c
new file mode 100644
index 000..59d48e7
--- /dev/null
+++ b/drivers/media/dvb-frontends/mn88472_c.c
@@ -0,0 +1,414 @@
+/*
+ * Panasonic MN88472 DVB-T/T2/C demodulator driver
+ *
+ * Copyright (C) 2013 Antti Palosaari cr...@iki.fi
+ *
+ *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.
+ */
+
+#include mn88472_priv.h
+
+static struct dvb_frontend_ops mn88472_ops_c;
+
+/* write multiple registers */
+static int mn88472_wregs(struct mn88472_state *s, u16 reg, const u8 *val, int 
len)
+{
+#define MAX_WR_LEN 21
+#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
+   int ret;
+   u8 buf[MAX_WR_XFER_LEN];
+   struct i2c_msg msg[1] = {
+   {
+   .addr = (reg  8)  0xff,
+

[PATCH 03/11] mn88472: add small delay to wait DVB-C lock

2014-11-11 Thread Antti Palosaari
400ms delay seems to be enough in order to gain DVB-C lock.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88472_c.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/dvb-frontends/mn88472_c.c 
b/drivers/media/dvb-frontends/mn88472_c.c
index 59d48e7..b5bd326 100644
--- a/drivers/media/dvb-frontends/mn88472_c.c
+++ b/drivers/media/dvb-frontends/mn88472_c.c
@@ -105,6 +105,13 @@ static int mn88472_rreg(struct mn88472_state *s, u16 reg, 
u8 *val)
return mn88472_rregs(s, reg, val, 1);
 }
 
+static int mn88472_get_tune_settings(struct dvb_frontend *fe,
+   struct dvb_frontend_tune_settings *s)
+{
+   s-min_delay_ms = 400;
+   return 0;
+}
+
 static int mn88472_set_frontend_c(struct dvb_frontend *fe)
 {
struct mn88472_state *s = fe-demodulator_priv;
@@ -398,6 +405,8 @@ static struct dvb_frontend_ops mn88472_ops_c = {
 
.release = mn88472_release_c,
 
+   .get_tune_settings = mn88472_get_tune_settings,
+
.init = mn88472_init_c,
.sleep = mn88472_sleep_c,
 
-- 
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 00/11] Panasonic MN88472 DVB-T/T2/C demod driver

2014-11-11 Thread Antti Palosaari
Reverse-engineered driver, which I moved to staging, due to
quality issues. Chip documentation would be nice. Any help to
pressure Panasonic to release documentation is welcome.


MS recently released Xbox One Digital TV Tuner is build upon that same demod 
chip.
https://tvheadend.org/boards/5/topics/13685


Here is device internals:
http://blog.palosaari.fi/2013/10/naked-hardware-14-dvb-t2-usb-tv-stick.html



Antti Palosaari (11):
  mn88472: Panasonic MN88472 demod driver (DVB-C only)
  mn88472: correct attach symbol name
  mn88472: add small delay to wait DVB-C lock
  mn88472: rename mn88472_c.c = mn88472.c
  mn88472: rename state to dev
  mn88472: convert driver to I2C client
  mn88472: Convert driver to I2C RegMap API
  mn88472: implement DVB-T and DVB-T2
  mn88472: move to staging
  mn88472: add staging TODO
  MAINTAINERS: add mn88472 (Panasonic MN88472)

 MAINTAINERS  |  11 +
 drivers/media/dvb-frontends/mn88472.h|  38 ++
 drivers/staging/media/Kconfig|   2 +
 drivers/staging/media/Makefile   |   1 +
 drivers/staging/media/mn88472/Kconfig|   7 +
 drivers/staging/media/mn88472/Makefile   |   5 +
 drivers/staging/media/mn88472/TODO   |  21 ++
 drivers/staging/media/mn88472/mn88472.c  | 523 +++
 drivers/staging/media/mn88472/mn88472_priv.h |  36 ++
 9 files changed, 644 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/mn88472.h
 create mode 100644 drivers/staging/media/mn88472/Kconfig
 create mode 100644 drivers/staging/media/mn88472/Makefile
 create mode 100644 drivers/staging/media/mn88472/TODO
 create mode 100644 drivers/staging/media/mn88472/mn88472.c
 create mode 100644 drivers/staging/media/mn88472/mn88472_priv.h

-- 
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 3/9] mn88473: implement DVB-T mode

2014-11-11 Thread Antti Palosaari
Implement DVB-T mode.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88473.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
index 68bfb65..cda0bdb 100644
--- a/drivers/media/dvb-frontends/mn88473.c
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -132,6 +132,13 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
}
 
switch (c-delivery_system) {
+   case SYS_DVBT:
+   delivery_system = 0x02;
+   if (c-bandwidth_hz = 700)
+   memcpy(params, 
\x2e\xcb\xfb\xc8\x00\x00\x17\x0a\x17\x0a, 10);
+   else if (c-bandwidth_hz = 800)
+   memcpy(params, 
\x2e\xcb\xfb\xaf\x00\x00\x11\xec\x11\xec, 10);
+   break;
case SYS_DVBT2:
delivery_system = 0x03;
if (c-bandwidth_hz = 700)
@@ -194,10 +201,12 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
ret = mn88473_wregs(dev, 0x1c2d, \x3b, 1);
ret = mn88473_wregs(dev, 0x1c2e, \x00, 1);
ret = mn88473_wregs(dev, 0x1c56, \x0d, 1);
+   ret = mn88473_wregs(dev, 0x1801, \xba, 1);
ret = mn88473_wregs(dev, 0x1802, \x13, 1);
ret = mn88473_wregs(dev, 0x1803, \x80, 1);
ret = mn88473_wregs(dev, 0x1804, \xba, 1);
ret = mn88473_wregs(dev, 0x1805, \x91, 1);
+   ret = mn88473_wregs(dev, 0x1807, \xe7, 1);
ret = mn88473_wregs(dev, 0x1808, \x28, 1);
ret = mn88473_wregs(dev, 0x180a, \x1a, 1);
ret = mn88473_wregs(dev, 0x1813, \x1f, 1);
@@ -382,7 +391,7 @@ err:
 EXPORT_SYMBOL(mn88473_attach);
 
 static struct dvb_frontend_ops mn88473_ops = {
-   .delsys = {SYS_DVBT2, SYS_DVBC_ANNEX_AC},
+   .delsys = {SYS_DVBT, SYS_DVBT2, SYS_DVBC_ANNEX_AC},
.info = {
.name = Panasonic MN88473,
.caps = FE_CAN_FEC_1_2  |
-- 
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 9/9] MAINTAINERS: add mn88473 (Panasonic MN88473)

2014-11-11 Thread Antti Palosaari
Add mn88473 driver from staging. DVB-T/T2/C demodulator driver.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 MAINTAINERS | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 644a1ae..a6288ca 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6126,6 +6126,17 @@ S:   Maintained
 F: drivers/staging/media/mn88472/
 F: drivers/media/dvb-frontends/mn88472.h
 
+MN88473 MEDIA DRIVER
+M: Antti Palosaari cr...@iki.fi
+L: linux-media@vger.kernel.org
+W: http://linuxtv.org/
+W: http://palosaari.fi/linux/
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+T: git git://linuxtv.org/anttip/media_tree.git
+S: Maintained
+F: drivers/staging/media/mn88473/
+F: drivers/media/dvb-frontends/mn88473.h
+
 MODULE SUPPORT
 M: Rusty Russell ru...@rustcorp.com.au
 S: Maintained
-- 
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 1/9] mn88473: Panasonic MN88473 DVB-T/T2/C demod driver

2014-11-11 Thread Antti Palosaari
Only DVB-C is implemented.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig|   7 +
 drivers/media/dvb-frontends/Makefile   |   1 +
 drivers/media/dvb-frontends/mn88473.c  | 393 +
 drivers/media/dvb-frontends/mn88473.h  |  46 
 drivers/media/dvb-frontends/mn88473_priv.h |  34 +++
 5 files changed, 481 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/mn88473.c
 create mode 100644 drivers/media/dvb-frontends/mn88473.h
 create mode 100644 drivers/media/dvb-frontends/mn88473_priv.h

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 6c75418..2720b8f 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -471,6 +471,13 @@ config DVB_SI2168
help
  Say Y when you want to support this frontend.
 
+config DVB_MN88473
+   tristate Panasonic MN88473
+   depends on DVB_CORE  I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y when you want to support this frontend.
+
 config DVB_AS102_FE
tristate
depends on DVB_CORE
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index ba59df6..8be6eb0 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -113,6 +113,7 @@ obj-$(CONFIG_DVB_RTL2830) += rtl2830.o
 obj-$(CONFIG_DVB_RTL2832) += rtl2832.o
 obj-$(CONFIG_DVB_RTL2832_SDR) += rtl2832_sdr.o
 obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
+obj-$(CONFIG_DVB_MN88473) += mn88473.o
 obj-$(CONFIG_DVB_AF9033) += af9033.o
 obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o
 obj-$(CONFIG_DVB_TC90522) += tc90522.o
diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
new file mode 100644
index 000..afe59f3
--- /dev/null
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -0,0 +1,393 @@
+/*
+ * Panasonic MN88473 DVB-T/T2/C demodulator driver
+ *
+ * Copyright (C) 2014 Antti Palosaari cr...@iki.fi
+ *
+ *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.
+ */
+
+#include mn88473_priv.h
+
+static struct dvb_frontend_ops mn88473_ops;
+
+/* write multiple registers */
+static int mn88473_wregs(struct mn88473_dev *dev, u16 reg, const u8 *val, int 
len)
+{
+#define MAX_WR_LEN 21
+#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
+   int ret;
+   u8 buf[MAX_WR_XFER_LEN];
+   struct i2c_msg msg[1] = {
+   {
+   .addr = (reg  8)  0xff,
+   .flags = 0,
+   .len = 1 + len,
+   .buf = buf,
+   }
+   };
+
+   if (WARN_ON(len  MAX_WR_LEN))
+   return -EINVAL;
+
+   buf[0] = (reg  0)  0xff;
+   memcpy(buf[1], val, len);
+
+   ret = i2c_transfer(dev-i2c, msg, 1);
+   if (ret == 1) {
+   ret = 0;
+   } else {
+   dev_warn(dev-i2c-dev,
+   %s: i2c wr failed=%d reg=%02x len=%d\n,
+   KBUILD_MODNAME, ret, reg, len);
+   ret = -EREMOTEIO;
+   }
+
+   return ret;
+}
+
+/* read multiple registers */
+static int mn88473_rregs(struct mn88473_dev *dev, u16 reg, u8 *val, int len)
+{
+#define MAX_RD_LEN 2
+#define MAX_RD_XFER_LEN (MAX_RD_LEN)
+   int ret;
+   u8 buf[MAX_RD_XFER_LEN];
+   struct i2c_msg msg[2] = {
+   {
+   .addr = (reg  8)  0xff,
+   .flags = 0,
+   .len = 1,
+   .buf = buf,
+   }, {
+   .addr = (reg  8)  0xff,
+   .flags = I2C_M_RD,
+   .len = len,
+   .buf = buf,
+   }
+   };
+
+   if (WARN_ON(len  MAX_RD_LEN))
+   return -EINVAL;
+
+   buf[0] = (reg  0)  0xff;
+
+   ret = i2c_transfer(dev-i2c, msg, 2);
+   if (ret == 2) {
+   memcpy(val, buf, len);
+   ret = 0;
+   } else {
+   dev_warn(dev-i2c-dev,
+   %s: i2c rd failed=%d reg=%02x len=%d\n,
+   KBUILD_MODNAME, ret, reg, len);
+   ret = -EREMOTEIO;
+   }
+
+   return ret;
+}
+
+/* write single register */
+static int mn88473_wreg(struct mn88473_dev *dev, u16 reg, u8 val)
+{
+   return mn88473_wregs(dev, reg, val, 1);
+}
+
+/* read single register */
+static int 

[PATCH 0/9] Panasonic MN88473 DVB-T/T2/C demod driver

2014-11-11 Thread Antti Palosaari
Reverse-engineered driver, which I moved to staging, due to
quality issues. Chip documentation would be nice. Any help to
pressure Panasonic to release documentation is welcome.


Here is device internals:
http://blog.palosaari.fi/2014/09/naked-hardware-18-astrometa-amdvb-t2-v2.html


Antti Palosaari (9):
  mn88473: Panasonic MN88473 DVB-T/T2/C demod driver
  mn88473: add support for DVB-T2
  mn88473: implement DVB-T mode
  mn88473: improve IF frequency and BW handling
  mn88473: convert driver to I2C binding
  mn88473: convert to RegMap API
  mn88473: move to staging
  mn88473: add staging TODO
  MAINTAINERS: add mn88473 (Panasonic MN88473)

 MAINTAINERS  |  11 +
 drivers/media/dvb-frontends/mn88473.h|  38 +++
 drivers/staging/media/Kconfig|   2 +
 drivers/staging/media/Makefile   |   1 +
 drivers/staging/media/mn88473/Kconfig|   7 +
 drivers/staging/media/mn88473/Makefile   |   5 +
 drivers/staging/media/mn88473/TODO   |  21 ++
 drivers/staging/media/mn88473/mn88473.c  | 464 +++
 drivers/staging/media/mn88473/mn88473_priv.h |  36 +++
 9 files changed, 585 insertions(+)
 create mode 100644 drivers/media/dvb-frontends/mn88473.h
 create mode 100644 drivers/staging/media/mn88473/Kconfig
 create mode 100644 drivers/staging/media/mn88473/Makefile
 create mode 100644 drivers/staging/media/mn88473/TODO
 create mode 100644 drivers/staging/media/mn88473/mn88473.c
 create mode 100644 drivers/staging/media/mn88473/mn88473_priv.h

-- 
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 4/9] mn88473: improve IF frequency and BW handling

2014-11-11 Thread Antti Palosaari
Separate IF and BW based registers.
Add support for DVB-T and DVB-T2 6MHz channel bandwidth.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88473.c | 64 +--
 1 file changed, 47 insertions(+), 17 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
index cda0bdb..2c81a83 100644
--- a/drivers/media/dvb-frontends/mn88473.c
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -117,8 +117,8 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
struct mn88473_dev *dev = fe-demodulator_priv;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret, i;
-   u32 if_frequency = 0;
-   u8 params[10], delivery_system;
+   u32 if_frequency;
+   u8 delivery_system_val, if_val[3], bw_val[7];
 
dev_dbg(dev-i2c-dev,
%s: delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n,
@@ -133,22 +133,43 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
 
switch (c-delivery_system) {
case SYS_DVBT:
-   delivery_system = 0x02;
-   if (c-bandwidth_hz = 700)
-   memcpy(params, 
\x2e\xcb\xfb\xc8\x00\x00\x17\x0a\x17\x0a, 10);
-   else if (c-bandwidth_hz = 800)
-   memcpy(params, 
\x2e\xcb\xfb\xaf\x00\x00\x11\xec\x11\xec, 10);
+   delivery_system_val = 0x02;
break;
case SYS_DVBT2:
-   delivery_system = 0x03;
-   if (c-bandwidth_hz = 700)
-   memcpy(params, 
\x2e\xcb\xfb\xc8\x00\x00\x17\x0a\x17\x0a, 10);
-   else if (c-bandwidth_hz = 800)
-   memcpy(params, 
\x2e\xcb\xfb\xaf\x00\x00\x11\xec\x11\xec, 10);
+   delivery_system_val = 0x03;
break;
case SYS_DVBC_ANNEX_A:
-   delivery_system = 0x04;
-   memcpy(params, \x33\xea\xb3\xaf\x00\x00\x11\xec\x11\xec, 10);
+   delivery_system_val = 0x04;
+   break;
+   default:
+   ret = -EINVAL;
+   goto err;
+   }
+
+   switch (c-delivery_system) {
+   case SYS_DVBT:
+   case SYS_DVBT2:
+   if (c-bandwidth_hz = 600) {
+   /* IF 357 Hz, BW 600 Hz */
+   memcpy(if_val, \x24\x8e\x8a, 3);
+   memcpy(bw_val, \xe9\x55\x55\x1c\x29\x1c\x29, 7);
+   } else if (c-bandwidth_hz = 700) {
+   /* IF 457 Hz, BW 700 Hz */
+   memcpy(if_val, \x2e\xcb\xfb, 3);
+   memcpy(bw_val, \xc8\x00\x00\x17\x0a\x17\x0a, 7);
+   } else if (c-bandwidth_hz = 800) {
+   /* IF 457 Hz, BW 800 Hz */
+   memcpy(if_val, \x2e\xcb\xfb, 3);
+   memcpy(bw_val, \xaf\x00\x00\x11\xec\x11\xec, 7);
+   } else {
+   ret = -EINVAL;
+   goto err;
+   }
+   break;
+   case SYS_DVBC_ANNEX_A:
+   /* IF 507 Hz, BW 800 Hz */
+   memcpy(if_val, \x33\xea\xb3, 3);
+   memcpy(bw_val, \xaf\x00\x00\x11\xec\x11\xec, 7);
break;
default:
ret = -EINVAL;
@@ -169,9 +190,12 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
 
dev_dbg(dev-i2c-dev, %s: get_if_frequency=%d\n,
__func__, if_frequency);
+   } else {
+   if_frequency = 0;
}
 
switch (if_frequency) {
+   case 357:
case 457:
case 507:
break;
@@ -189,11 +213,17 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
ret = mn88473_wregs(dev, 0x1c00, \x18, 1);
ret = mn88473_wregs(dev, 0x1c01, \x01, 1);
ret = mn88473_wregs(dev, 0x1c02, \x21, 1);
-   ret = mn88473_wreg(dev, 0x1c03, delivery_system);
+   ret = mn88473_wreg(dev, 0x1c03, delivery_system_val);
ret = mn88473_wregs(dev, 0x1c0b, \x00, 1);
 
-   for (i = 0; i  10; i++) {
-   ret = mn88473_wreg(dev, 0x1c10 + i, params[i]);
+   for (i = 0; i  sizeof(if_val); i++) {
+   ret = mn88473_wreg(dev, 0x1c10 + i, if_val[i]);
+   if (ret)
+   goto err;
+   }
+
+   for (i = 0; i  sizeof(bw_val); i++) {
+   ret = mn88473_wreg(dev, 0x1c13 + i, bw_val[i]);
if (ret)
goto err;
}
-- 
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 6/9] mn88473: convert to RegMap API

2014-11-11 Thread Antti Palosaari
Convert driver to I2C RegMap API. That offers unified register
access routines, register value caching and more.

We need 3 register maps, one for each register page, as chips has
3 I2C address.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig|   1 +
 drivers/media/dvb-frontends/mn88473.c  | 233 +++--
 drivers/media/dvb-frontends/mn88473_priv.h |   2 +
 3 files changed, 90 insertions(+), 146 deletions(-)

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index 2720b8f..e60614b 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -474,6 +474,7 @@ config DVB_SI2168
 config DVB_MN88473
tristate Panasonic MN88473
depends on DVB_CORE  I2C
+   select REGMAP_I2C
default m if !MEDIA_SUBDRV_AUTOSELECT
help
  Say Y when you want to support this frontend.
diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
index ff67c4c..1659335 100644
--- a/drivers/media/dvb-frontends/mn88473.c
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -16,95 +16,6 @@
 
 #include mn88473_priv.h
 
-static struct dvb_frontend_ops mn88473_ops;
-
-/* write multiple registers */
-static int mn88473_wregs(struct mn88473_dev *dev, u16 reg, const u8 *val, int 
len)
-{
-#define MAX_WR_LEN 21
-#define MAX_WR_XFER_LEN (MAX_WR_LEN + 1)
-   int ret;
-   u8 buf[MAX_WR_XFER_LEN];
-   struct i2c_msg msg[1] = {
-   {
-   .addr = (reg  8)  0xff,
-   .flags = 0,
-   .len = 1 + len,
-   .buf = buf,
-   }
-   };
-
-   if (WARN_ON(len  MAX_WR_LEN))
-   return -EINVAL;
-
-   buf[0] = (reg  0)  0xff;
-   memcpy(buf[1], val, len);
-
-   ret = i2c_transfer(dev-client[0]-adapter, msg, 1);
-   if (ret == 1) {
-   ret = 0;
-   } else {
-   dev_warn(dev-client[0]-dev,
-   i2c wr failed=%d reg=%02x len=%d\n,
-   ret, reg, len);
-   ret = -EREMOTEIO;
-   }
-
-   return ret;
-}
-
-/* read multiple registers */
-static int mn88473_rregs(struct mn88473_dev *dev, u16 reg, u8 *val, int len)
-{
-#define MAX_RD_LEN 2
-#define MAX_RD_XFER_LEN (MAX_RD_LEN)
-   int ret;
-   u8 buf[MAX_RD_XFER_LEN];
-   struct i2c_msg msg[2] = {
-   {
-   .addr = (reg  8)  0xff,
-   .flags = 0,
-   .len = 1,
-   .buf = buf,
-   }, {
-   .addr = (reg  8)  0xff,
-   .flags = I2C_M_RD,
-   .len = len,
-   .buf = buf,
-   }
-   };
-
-   if (WARN_ON(len  MAX_RD_LEN))
-   return -EINVAL;
-
-   buf[0] = (reg  0)  0xff;
-
-   ret = i2c_transfer(dev-client[0]-adapter, msg, 2);
-   if (ret == 2) {
-   memcpy(val, buf, len);
-   ret = 0;
-   } else {
-   dev_warn(dev-client[0]-dev,
-   i2c rd failed=%d reg=%02x len=%d\n,
-   ret, reg, len);
-   ret = -EREMOTEIO;
-   }
-
-   return ret;
-}
-
-/* write single register */
-static int mn88473_wreg(struct mn88473_dev *dev, u16 reg, u8 val)
-{
-   return mn88473_wregs(dev, reg, val, 1);
-}
-
-/* read single register */
-static int mn88473_rreg(struct mn88473_dev *dev, u16 reg, u8 *val)
-{
-   return mn88473_rregs(dev, reg, val, 1);
-}
-
 static int mn88473_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s)
 {
@@ -206,64 +117,64 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
goto err;
}
 
-   ret = mn88473_wregs(dev, 0x1c05, \x00, 1);
-   ret = mn88473_wregs(dev, 0x1cfb, \x13, 1);
-   ret = mn88473_wregs(dev, 0x1cef, \x13, 1);
-   ret = mn88473_wregs(dev, 0x1cf9, \x13, 1);
-   ret = mn88473_wregs(dev, 0x1c00, \x18, 1);
-   ret = mn88473_wregs(dev, 0x1c01, \x01, 1);
-   ret = mn88473_wregs(dev, 0x1c02, \x21, 1);
-   ret = mn88473_wreg(dev, 0x1c03, delivery_system_val);
-   ret = mn88473_wregs(dev, 0x1c0b, \x00, 1);
+   ret = regmap_write(dev-regmap[2], 0x05, 0x00);
+   ret = regmap_write(dev-regmap[2], 0xfb, 0x13);
+   ret = regmap_write(dev-regmap[2], 0xef, 0x13);
+   ret = regmap_write(dev-regmap[2], 0xf9, 0x13);
+   ret = regmap_write(dev-regmap[2], 0x00, 0x18);
+   ret = regmap_write(dev-regmap[2], 0x01, 0x01);
+   ret = regmap_write(dev-regmap[2], 0x02, 0x21);
+   ret = regmap_write(dev-regmap[2], 0x03, delivery_system_val);
+   ret = regmap_write(dev-regmap[2], 0x0b, 0x00);
 
for (i = 0; i  sizeof(if_val); i++) {
-   ret = mn88473_wreg(dev, 0x1c10 + i, 

[PATCH 7/9] mn88473: move to staging

2014-11-11 Thread Antti Palosaari
It is not ready enough to be released on mainline.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/Kconfig  |   8 -
 drivers/media/dvb-frontends/Makefile |   1 -
 drivers/media/dvb-frontends/mn88473.c| 464 ---
 drivers/media/dvb-frontends/mn88473_priv.h   |  36 ---
 drivers/staging/media/Kconfig|   2 +
 drivers/staging/media/Makefile   |   1 +
 drivers/staging/media/mn88473/Kconfig|   7 +
 drivers/staging/media/mn88473/Makefile   |   5 +
 drivers/staging/media/mn88473/mn88473.c  | 464 +++
 drivers/staging/media/mn88473/mn88473_priv.h |  36 +++
 10 files changed, 515 insertions(+), 509 deletions(-)
 delete mode 100644 drivers/media/dvb-frontends/mn88473.c
 delete mode 100644 drivers/media/dvb-frontends/mn88473_priv.h
 create mode 100644 drivers/staging/media/mn88473/Kconfig
 create mode 100644 drivers/staging/media/mn88473/Makefile
 create mode 100644 drivers/staging/media/mn88473/mn88473.c
 create mode 100644 drivers/staging/media/mn88473/mn88473_priv.h

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index e60614b..6c75418 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -471,14 +471,6 @@ config DVB_SI2168
help
  Say Y when you want to support this frontend.
 
-config DVB_MN88473
-   tristate Panasonic MN88473
-   depends on DVB_CORE  I2C
-   select REGMAP_I2C
-   default m if !MEDIA_SUBDRV_AUTOSELECT
-   help
- Say Y when you want to support this frontend.
-
 config DVB_AS102_FE
tristate
depends on DVB_CORE
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index 8be6eb0..ba59df6 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -113,7 +113,6 @@ obj-$(CONFIG_DVB_RTL2830) += rtl2830.o
 obj-$(CONFIG_DVB_RTL2832) += rtl2832.o
 obj-$(CONFIG_DVB_RTL2832_SDR) += rtl2832_sdr.o
 obj-$(CONFIG_DVB_M88RS2000) += m88rs2000.o
-obj-$(CONFIG_DVB_MN88473) += mn88473.o
 obj-$(CONFIG_DVB_AF9033) += af9033.o
 obj-$(CONFIG_DVB_AS102_FE) += as102_fe.o
 obj-$(CONFIG_DVB_TC90522) += tc90522.o
diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
deleted file mode 100644
index 1659335..000
--- a/drivers/media/dvb-frontends/mn88473.c
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Panasonic MN88473 DVB-T/T2/C demodulator driver
- *
- * Copyright (C) 2014 Antti Palosaari cr...@iki.fi
- *
- *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.
- */
-
-#include mn88473_priv.h
-
-static int mn88473_get_tune_settings(struct dvb_frontend *fe,
-   struct dvb_frontend_tune_settings *s)
-{
-   s-min_delay_ms = 1000;
-   return 0;
-}
-
-static int mn88473_set_frontend(struct dvb_frontend *fe)
-{
-   struct i2c_client *client = fe-demodulator_priv;
-   struct mn88473_dev *dev = i2c_get_clientdata(client);
-   struct dtv_frontend_properties *c = fe-dtv_property_cache;
-   int ret, i;
-   u32 if_frequency;
-   u8 delivery_system_val, if_val[3], bw_val[7];
-
-   dev_dbg(client-dev,
-   delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n,
-   c-delivery_system, c-modulation,
-   c-frequency, c-bandwidth_hz, c-symbol_rate,
-   c-inversion, c-stream_id);
-
-   if (!dev-warm) {
-   ret = -EAGAIN;
-   goto err;
-   }
-
-   switch (c-delivery_system) {
-   case SYS_DVBT:
-   delivery_system_val = 0x02;
-   break;
-   case SYS_DVBT2:
-   delivery_system_val = 0x03;
-   break;
-   case SYS_DVBC_ANNEX_A:
-   delivery_system_val = 0x04;
-   break;
-   default:
-   ret = -EINVAL;
-   goto err;
-   }
-
-   switch (c-delivery_system) {
-   case SYS_DVBT:
-   case SYS_DVBT2:
-   if (c-bandwidth_hz = 600) {
-   /* IF 357 Hz, BW 600 Hz */
-   memcpy(if_val, \x24\x8e\x8a, 3);
-   memcpy(bw_val, \xe9\x55\x55\x1c\x29\x1c\x29, 7);
-   } else if (c-bandwidth_hz = 700) {
-   /* IF 457 Hz, BW 700 Hz */
-   

[PATCH 8/9] mn88473: add staging TODO

2014-11-11 Thread Antti Palosaari
Add TODO for mainlining.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/staging/media/mn88473/TODO | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 drivers/staging/media/mn88473/TODO

diff --git a/drivers/staging/media/mn88473/TODO 
b/drivers/staging/media/mn88473/TODO
new file mode 100644
index 000..b90a14b
--- /dev/null
+++ b/drivers/staging/media/mn88473/TODO
@@ -0,0 +1,21 @@
+Driver general quality is not good enough for mainline. Also, other
+device drivers (USB-bridge, tuner) needed for Astrometa receiver in
+question could need some changes. However, if that driver is mainlined
+due to some other device than Astrometa, unrelated TODOs could be
+skipped. In that case rtl28xxu driver needs module parameter to prevent
+driver loading.
+
+Required TODOs:
+* missing lock flags
+* I2C errors
+* tuner sensitivity
+
+*Do not* send any patch fixing checkpatch.pl issues. Currently it passes
+checkpatch.pl tests. I don't want waste my time to review this kind of
+trivial stuff. *Do not* add missing register I/O error checks. Those are
+missing for the reason it is much easier to compare I2C data sniffs when
+there is less lines. Those error checks are about the last thing to be added.
+
+Patches should be submitted to:
+linux-media@vger.kernel.org and Antti Palosaari cr...@iki.fi
+
-- 
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 5/9] mn88473: convert driver to I2C binding

2014-11-11 Thread Antti Palosaari
Driver was using DVB proprietary binding model. As it is I2C
device, we could change it to normal kernel I2C driver.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88473.c  | 238 ++---
 drivers/media/dvb-frontends/mn88473.h  |  30 ++--
 drivers/media/dvb-frontends/mn88473_priv.h |   4 +-
 3 files changed, 162 insertions(+), 110 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
index 2c81a83..ff67c4c 100644
--- a/drivers/media/dvb-frontends/mn88473.c
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -40,13 +40,13 @@ static int mn88473_wregs(struct mn88473_dev *dev, u16 reg, 
const u8 *val, int le
buf[0] = (reg  0)  0xff;
memcpy(buf[1], val, len);
 
-   ret = i2c_transfer(dev-i2c, msg, 1);
+   ret = i2c_transfer(dev-client[0]-adapter, msg, 1);
if (ret == 1) {
ret = 0;
} else {
-   dev_warn(dev-i2c-dev,
-   %s: i2c wr failed=%d reg=%02x len=%d\n,
-   KBUILD_MODNAME, ret, reg, len);
+   dev_warn(dev-client[0]-dev,
+   i2c wr failed=%d reg=%02x len=%d\n,
+   ret, reg, len);
ret = -EREMOTEIO;
}
 
@@ -79,14 +79,14 @@ static int mn88473_rregs(struct mn88473_dev *dev, u16 reg, 
u8 *val, int len)
 
buf[0] = (reg  0)  0xff;
 
-   ret = i2c_transfer(dev-i2c, msg, 2);
+   ret = i2c_transfer(dev-client[0]-adapter, msg, 2);
if (ret == 2) {
memcpy(val, buf, len);
ret = 0;
} else {
-   dev_warn(dev-i2c-dev,
-   %s: i2c rd failed=%d reg=%02x len=%d\n,
-   KBUILD_MODNAME, ret, reg, len);
+   dev_warn(dev-client[0]-dev,
+   i2c rd failed=%d reg=%02x len=%d\n,
+   ret, reg, len);
ret = -EREMOTEIO;
}
 
@@ -114,15 +114,16 @@ static int mn88473_get_tune_settings(struct dvb_frontend 
*fe,
 
 static int mn88473_set_frontend(struct dvb_frontend *fe)
 {
-   struct mn88473_dev *dev = fe-demodulator_priv;
+   struct i2c_client *client = fe-demodulator_priv;
+   struct mn88473_dev *dev = i2c_get_clientdata(client);
struct dtv_frontend_properties *c = fe-dtv_property_cache;
int ret, i;
u32 if_frequency;
u8 delivery_system_val, if_val[3], bw_val[7];
 
-   dev_dbg(dev-i2c-dev,
-   %s: delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n,
-   __func__, c-delivery_system, c-modulation,
+   dev_dbg(client-dev,
+   delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n,
+   c-delivery_system, c-modulation,
c-frequency, c-bandwidth_hz, c-symbol_rate,
c-inversion, c-stream_id);
 
@@ -188,8 +189,7 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
-   dev_dbg(dev-i2c-dev, %s: get_if_frequency=%d\n,
-   __func__, if_frequency);
+   dev_dbg(client-dev, get_if_frequency=%d\n, if_frequency);
} else {
if_frequency = 0;
}
@@ -200,8 +200,8 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
case 507:
break;
default:
-   dev_err(dev-i2c-dev, %s: IF frequency %d not supported\n,
-   KBUILD_MODNAME, if_frequency);
+   dev_err(client-dev, IF frequency %d not supported\n,
+   if_frequency);
ret = -EINVAL;
goto err;
}
@@ -271,13 +271,14 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
 
return 0;
 err:
-   dev_dbg(dev-i2c-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(client-dev, failed=%d\n, ret);
return ret;
 }
 
 static int mn88473_read_status(struct dvb_frontend *fe, fe_status_t *status)
 {
-   struct mn88473_dev *dev = fe-demodulator_priv;
+   struct i2c_client *client = fe-demodulator_priv;
+   struct mn88473_dev *dev = i2c_get_clientdata(client);
int ret;
 
*status = 0;
@@ -292,49 +293,48 @@ static int mn88473_read_status(struct dvb_frontend *fe, 
fe_status_t *status)
 
return 0;
 err:
-   dev_dbg(dev-i2c-dev, %s: failed=%d\n, __func__, ret);
+   dev_dbg(client-dev, failed=%d\n, ret);
return ret;
 }
 
 static int mn88473_init(struct dvb_frontend *fe)
 {
-   struct mn88473_dev *dev = fe-demodulator_priv;
+   struct i2c_client *client = fe-demodulator_priv;
+   struct mn88473_dev *dev = i2c_get_clientdata(client);
  

[PATCH 2/9] mn88473: add support for DVB-T2

2014-11-11 Thread Antti Palosaari
Add support for DVB-T2.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/mn88473.c | 45 +--
 1 file changed, 38 insertions(+), 7 deletions(-)

diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
index afe59f3..68bfb65 100644
--- a/drivers/media/dvb-frontends/mn88473.c
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -116,19 +116,38 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
 {
struct mn88473_dev *dev = fe-demodulator_priv;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
-   int ret;
+   int ret, i;
u32 if_frequency = 0;
+   u8 params[10], delivery_system;
 
dev_dbg(dev-i2c-dev,
-   %s: delivery_system=%d modulation=%d frequency=%d 
symbol_rate=%d inversion=%d\n,
+   %s: delivery_system=%u modulation=%u frequency=%u 
bandwidth_hz=%u symbol_rate=%u inversion=%d stream_id=%d\n,
__func__, c-delivery_system, c-modulation,
-   c-frequency, c-symbol_rate, c-inversion);
+   c-frequency, c-bandwidth_hz, c-symbol_rate,
+   c-inversion, c-stream_id);
 
if (!dev-warm) {
ret = -EAGAIN;
goto err;
}
 
+   switch (c-delivery_system) {
+   case SYS_DVBT2:
+   delivery_system = 0x03;
+   if (c-bandwidth_hz = 700)
+   memcpy(params, 
\x2e\xcb\xfb\xc8\x00\x00\x17\x0a\x17\x0a, 10);
+   else if (c-bandwidth_hz = 800)
+   memcpy(params, 
\x2e\xcb\xfb\xaf\x00\x00\x11\xec\x11\xec, 10);
+   break;
+   case SYS_DVBC_ANNEX_A:
+   delivery_system = 0x04;
+   memcpy(params, \x33\xea\xb3\xaf\x00\x00\x11\xec\x11\xec, 10);
+   break;
+   default:
+   ret = -EINVAL;
+   goto err;
+   }
+
/* program tuner */
if (fe-ops.tuner_ops.set_params) {
ret = fe-ops.tuner_ops.set_params(fe);
@@ -145,7 +164,11 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
__func__, if_frequency);
}
 
-   if (if_frequency != 507) {
+   switch (if_frequency) {
+   case 457:
+   case 507:
+   break;
+   default:
dev_err(dev-i2c-dev, %s: IF frequency %d not supported\n,
KBUILD_MODNAME, if_frequency);
ret = -EINVAL;
@@ -159,9 +182,15 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
ret = mn88473_wregs(dev, 0x1c00, \x18, 1);
ret = mn88473_wregs(dev, 0x1c01, \x01, 1);
ret = mn88473_wregs(dev, 0x1c02, \x21, 1);
-   ret = mn88473_wregs(dev, 0x1c03, \x04, 1);
+   ret = mn88473_wreg(dev, 0x1c03, delivery_system);
ret = mn88473_wregs(dev, 0x1c0b, \x00, 1);
-   ret = mn88473_wregs(dev, 0x1c10, 
\x33\xea\xb3\xaf\x00\x00\x11\xec\x11\xec, 10);
+
+   for (i = 0; i  10; i++) {
+   ret = mn88473_wreg(dev, 0x1c10 + i, params[i]);
+   if (ret)
+   goto err;
+   }
+
ret = mn88473_wregs(dev, 0x1c2d, \x3b, 1);
ret = mn88473_wregs(dev, 0x1c2e, \x00, 1);
ret = mn88473_wregs(dev, 0x1c56, \x0d, 1);
@@ -193,6 +222,8 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
ret = mn88473_wregs(dev, 0x1c08, \x1d, 1);
ret = mn88473_wregs(dev, 0x18b2, \x37, 1);
ret = mn88473_wregs(dev, 0x18d7, \x04, 1);
+   ret = mn88473_wregs(dev, 0x1c32, \x80, 1);
+   ret = mn88473_wregs(dev, 0x1c36, \x00, 1);
ret = mn88473_wregs(dev, 0x1cf8, \x9f, 1);
if (ret)
goto err;
@@ -351,7 +382,7 @@ err:
 EXPORT_SYMBOL(mn88473_attach);
 
 static struct dvb_frontend_ops mn88473_ops = {
-   .delsys = {SYS_DVBC_ANNEX_AC},
+   .delsys = {SYS_DVBT2, SYS_DVBC_ANNEX_AC},
.info = {
.name = Panasonic MN88473,
.caps = FE_CAN_FEC_1_2  |
-- 
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 7/8] rtl28xxu: remove unused SDR attach logic

2014-11-11 Thread Antti Palosaari
That logic was duplicated from rtl2832_sdr.h in order to avoid hard
dependency for staging directory. rtl2832_sdr is moved to media, so
we could remove that code now.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 20 +---
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 47360d3..eadde72 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -24,6 +24,7 @@
 
 #include rtl2830.h
 #include rtl2832.h
+#include rtl2832_sdr.h
 #include mn88472.h
 #include mn88473.h
 
@@ -37,25 +38,6 @@
 #include tua9001.h
 #include r820t.h
 
-/*
- * RTL2832_SDR module is in staging. That logic is added in order to avoid any
- * hard dependency to drivers/staging/ directory as we want compile mainline
- * driver even whole staging directory is missing.
- */
-#include media/v4l2-subdev.h
-
-#if IS_ENABLED(CONFIG_DVB_RTL2832_SDR)
-struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
-   struct i2c_adapter *i2c, const struct rtl2832_config *cfg,
-   struct v4l2_subdev *sd);
-#else
-static inline struct dvb_frontend *rtl2832_sdr_attach(struct dvb_frontend *fe,
-   struct i2c_adapter *i2c, const struct rtl2832_config *cfg,
-   struct v4l2_subdev *sd)
-{
-   return NULL;
-}
-#endif
 
 #ifdef CONFIG_MEDIA_ATTACH
 #define dvb_attach_sdr(FUNCTION, ARGS...) ({ \
-- 
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 1/8] r820t: add DVB-C config

2014-11-11 Thread Antti Palosaari
Add config values for SYS_DVBC_ANNEX_A.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/tuners/r820t.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
index a759742..8e040cf 100644
--- a/drivers/media/tuners/r820t.c
+++ b/drivers/media/tuners/r820t.c
@@ -959,6 +959,18 @@ static int r820t_set_tv_standard(struct r820t_priv *priv,
lt_att = 0x00;  /* r31[7], lt att enable */
flt_ext_widest = 0x00;  /* r15[7]: flt_ext_wide off */
polyfil_cur = 0x60; /* r25[6:5]:min */
+   } else if (delsys == SYS_DVBC_ANNEX_A) {
+   if_khz = 5070;
+   filt_cal_lo = 73500;
+   filt_gain = 0x10;   /* +3db, 6mhz on */
+   img_r = 0x00;   /* image negative */
+   filt_q = 0x10;  /* r10[4]:low q(1'b1) */
+   hp_cor = 0x0b;  /* 1.7m disable, +0cap, 1.0mhz */
+   ext_enable = 0x40;  /* r30[6]=1 ext enable; r30[5]:1 ext at 
lna max-1 */
+   loop_through = 0x00;/* r5[7], lt on */
+   lt_att = 0x00;  /* r31[7], lt att enable */
+   flt_ext_widest = 0x00;  /* r15[7]: flt_ext_wide off */
+   polyfil_cur = 0x60; /* r25[6:5]:min */
} else {
if (bw = 6) {
if_khz = 3570;
-- 
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 2/8] rtl2832: implement PIP mode

2014-11-11 Thread Antti Palosaari
Implement PIP mode to stream from slave demodulator. PIP mode is
enabled when .set_frontend is called with RF frequency 0, otherwise
normal demod mode is enabled.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/dvb-frontends/rtl2832.c | 42 ---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/rtl2832.c 
b/drivers/media/dvb-frontends/rtl2832.c
index eb737cf..a58b456 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, u8 
reg, u8 page, u8 *val,
return rtl2832_rd(priv, reg, val, len);
 }
 
-#if 0 /* currently not used */
 /* write single register */
 static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val)
 {
return rtl2832_wr_regs(priv, reg, page, val, 1);
 }
-#endif
 
 /* read single register */
 static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val)
@@ -595,6 +593,44 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
%s: frequency=%d bandwidth_hz=%d inversion=%d\n,
__func__, c-frequency, c-bandwidth_hz, c-inversion);
 
+   /* PIP mode */
+   if (c-frequency == 0) {
+   dev_dbg(priv-i2c-dev, %s: setting PIP mode\n, __func__);
+   ret = rtl2832_wr_regs(priv, 0x0c, 1, \x5f\xff, 2);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_demod_reg(priv, DVBT_PIP_ON, 0x1);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0xbc, 0, 0x18);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x22, 0, 0x01);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x26, 0, 0x1f);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x27, 0, 0xff);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_regs(priv, 0x92, 1, \x7f\xf7\xff, 3);
+   if (ret)
+   goto err;
+
+   goto exit_soft_reset;
+   } else {
+   ret = rtl2832_wr_regs(priv, 0x92, 1, \x00\x0f\xff, 3);
+   if (ret)
+   goto err;
+   }
+
/* program tuner */
if (fe-ops.tuner_ops.set_params)
fe-ops.tuner_ops.set_params(fe);
@@ -661,7 +697,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
-
+exit_soft_reset:
/* soft reset */
ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
if (ret)
-- 
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 0/8] Astrometa DVB USB support

2014-11-11 Thread Antti Palosaari
There is 2 device versions. Other has Panasonic MN88472 demod and
the other Panasonic MN88473 demod.

Both demod drivers will go to staging due to multiple problems.

Antti Palosaari (8):
  r820t: add DVB-C config
  rtl2832: implement PIP mode
  rtl28xxu: enable demod ADC only when needed
  rtl28xxu: add support for Panasonic MN88472 slave demod
  rtl28xxu: add support for Panasonic MN88473 slave demod
  rtl28xxu: rename tuner I2C client pointer
  rtl28xxu: remove unused SDR attach logic
  rtl28xxu: add SDR module for devices having R828D tuner

 drivers/media/dvb-frontends/rtl2832.c   |  42 +-
 drivers/media/tuners/r820t.c|  12 ++
 drivers/media/usb/dvb-usb-v2/Kconfig|   2 +
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 239 +++-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   8 +-
 5 files changed, 235 insertions(+), 68 deletions(-)

-- 
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 3/8] rtl28xxu: enable demod ADC only when needed

2014-11-11 Thread Antti Palosaari
Enable integrated demod ADC only when demod is used. Keep integrated
demod ADC disabled when external demod is used. This fixes corrupted
stream in a case external demod was used.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 37 ++---
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 27b1e03..5ea52c7 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1201,13 +1201,6 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, 
int onoff)
if (ret)
goto err;
 
-   mdelay(5);
-
-   /* enable ADC */
-   ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x48, 0x48);
-   if (ret)
-   goto err;
-
/* streaming EP: clear stall  reset */
ret = rtl28xx_wr_regs(d, USB_EPA_CTL, \x00\x00, 2);
if (ret)
@@ -1222,11 +1215,6 @@ static int rtl2832u_power_ctrl(struct dvb_usb_device *d, 
int onoff)
if (ret)
goto err;
 
-   /* disable ADC */
-   ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x48);
-   if (ret)
-   goto err;
-
/* disable PLL */
ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, 0x00, 0x80);
if (ret)
@@ -1244,6 +1232,30 @@ err:
return ret;
 }
 
+static int rtl2832u_frontend_ctrl(struct dvb_frontend *fe, int onoff)
+{
+   struct dvb_usb_device *d = fe_to_d(fe);
+   int ret;
+   u8 val;
+
+   dev_dbg(d-udev-dev, %s: fe=%d onoff=%d\n, __func__, fe-id, onoff);
+
+   /* control internal demod ADC */
+   if (fe-id == 0  onoff)
+   val = 0x48; /* enable ADC */
+   else
+   val = 0x00; /* disable ADC */
+
+   ret = rtl28xx_wr_reg_mask(d, SYS_DEMOD_CTL, val, 0x48);
+   if (ret)
+   goto err;
+
+   return 0;
+err:
+   dev_dbg(d-udev-dev, %s: failed=%d\n, __func__, ret);
+   return ret;
+}
+
 #if IS_ENABLED(CONFIG_RC_CORE)
 static int rtl2831u_rc_query(struct dvb_usb_device *d)
 {
@@ -1467,6 +1479,7 @@ static const struct dvb_usb_device_properties 
rtl2832u_props = {
.size_of_priv = sizeof(struct rtl28xxu_priv),
 
.power_ctrl = rtl2832u_power_ctrl,
+   .frontend_ctrl = rtl2832u_frontend_ctrl,
.i2c_algo = rtl28xxu_i2c_algo,
.read_config = rtl2832u_read_config,
.frontend_attach = rtl2832u_frontend_attach,
-- 
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 8/8] rtl28xxu: add SDR module for devices having R828D tuner

2014-11-11 Thread Antti Palosaari
Load SDR sub-driver in order to support SDR for devices having
this tuner too.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index eadde72..4af8a61 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1129,6 +1129,10 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
adap-fe[1]-ops.read_signal_strength =

adap-fe[1]-ops.tuner_ops.get_rf_strength;
}
+
+   /* attach SDR */
+   dvb_attach_sdr(rtl2832_sdr_attach, adap-fe[0], d-i2c_adap,
+   rtl28xxu_rtl2832_r820t_config, NULL);
break;
default:
dev_err(d-udev-dev, %s: unknown tuner=%d\n, KBUILD_MODNAME,
-- 
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 5/8] rtl28xxu: add support for Panasonic MN88473 slave demod

2014-11-11 Thread Antti Palosaari
There is RTL2832P devices having extra MN88473 demodulator. This
patch add support for such configuration. Logically MN88473 slave
demodulator is connected to RTL2832 master demodulator, both I2C
bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
chips. Chip version RTL2832P has extra TS interface for connecting
slave demodulator.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/Kconfig|  1 +
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 31 +++
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |  3 ++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
b/drivers/media/usb/dvb-usb-v2/Kconfig
index 9050933..f452a11 100644
--- a/drivers/media/usb/dvb-usb-v2/Kconfig
+++ b/drivers/media/usb/dvb-usb-v2/Kconfig
@@ -131,6 +131,7 @@ config DVB_USB_RTL28XXU
select DVB_RTL2832
select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT  MEDIA_SDR_SUPPORT)
select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_MN88473 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index e3c20f4..93f8afc 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -25,6 +25,7 @@
 #include rtl2830.h
 #include rtl2832.h
 #include mn88472.h
+#include mn88473.h
 
 #include qt1010.h
 #include mt2060.h
@@ -422,6 +423,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
+   struct rtl28xxu_req req_mn88473 = {0xff38, CMD_I2C_RD, 1, buf};
 
dev_dbg(d-udev-dev, %s:\n, __func__);
 
@@ -567,6 +569,13 @@ tuner_found:
priv-slave_demod = SLAVE_DEMOD_MN88472;
goto demod_found;
}
+
+   ret = rtl28xxu_ctrl_msg(d, req_mn88473);
+   if (ret == 0  buf[0] == 0x03) {
+   dev_dbg(d-udev-dev, %s: MN88473 found\n, __func__);
+   priv-slave_demod = SLAVE_DEMOD_MN88473;
+   goto demod_found;
+   }
}
 
 demod_found:
@@ -889,6 +898,28 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter 
*adap)
}
 
priv-i2c_client_slave_demod = client;
+   } else {
+   struct mn88473_config mn88473_config = {};
+
+   mn88473_config.fe = adap-fe[1];
+   mn88473_config.i2c_wr_max = 22,
+   strlcpy(info.type, mn88473, I2C_NAME_SIZE);
+   info.addr = 0x18;
+   info.platform_data = mn88473_config;
+   request_module(info.type);
+   client = i2c_new_device(priv-demod_i2c_adapter, info);
+   if (client == NULL || client-dev.driver == NULL) {
+   priv-slave_demod = SLAVE_DEMOD_NONE;
+   goto err_slave_demod_failed;
+   }
+
+   if (!try_module_get(client-dev.driver-owner)) {
+   i2c_unregister_device(client);
+   priv-slave_demod = SLAVE_DEMOD_NONE;
+   goto err_slave_demod_failed;
+   }
+
+   priv-i2c_client_slave_demod = client;
}
 
/* override init as we want configure RTL2832 as TS input */
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
index 58f2730..9c059ac 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -62,7 +62,8 @@ struct rtl28xxu_priv {
int (*init)(struct dvb_frontend *fe);
#define SLAVE_DEMOD_NONE   0
#define SLAVE_DEMOD_MN884721
-   unsigned int slave_demod:1;
+   #define SLAVE_DEMOD_MN884732
+   unsigned int slave_demod:2;
 };
 
 enum rtl28xxu_chip_id {
-- 
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 4/8] rtl28xxu: add support for Panasonic MN88472 slave demod

2014-11-11 Thread Antti Palosaari
There is RTL2832P devices having extra MN88472 demodulator. This
patch add support for such configuration. Logically MN88472 slave
demodulator is connected to RTL2832 master demodulator, both I2C
bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
chips. Chip version RTL2832P has extra TS interface for connecting
slave demodulator.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/Kconfig|   1 +
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 143 +---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   5 ++
 3 files changed, 118 insertions(+), 31 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
b/drivers/media/usb/dvb-usb-v2/Kconfig
index 7423033..9050933 100644
--- a/drivers/media/usb/dvb-usb-v2/Kconfig
+++ b/drivers/media/usb/dvb-usb-v2/Kconfig
@@ -130,6 +130,7 @@ config DVB_USB_RTL28XXU
select DVB_RTL2830
select DVB_RTL2832
select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT  MEDIA_SDR_SUPPORT)
+   select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 5ea52c7..e3c20f4 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -24,6 +24,7 @@
 
 #include rtl2830.h
 #include rtl2832.h
+#include mn88472.h
 
 #include qt1010.h
 #include mt2060.h
@@ -420,6 +421,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
+   struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
 
dev_dbg(d-udev-dev, %s:\n, __func__);
 
@@ -449,7 +451,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0xa1) {
priv-tuner = TUNER_RTL2832_FC0012;
priv-tuner_name = FC0012;
-   goto found;
+   goto tuner_found;
}
 
/* check FC0013 ID register; reg=00 val=a3 */
@@ -457,7 +459,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0xa3) {
priv-tuner = TUNER_RTL2832_FC0013;
priv-tuner_name = FC0013;
-   goto found;
+   goto tuner_found;
}
 
/* check MT2266 ID register; reg=00 val=85 */
@@ -465,7 +467,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x85) {
priv-tuner = TUNER_RTL2832_MT2266;
priv-tuner_name = MT2266;
-   goto found;
+   goto tuner_found;
}
 
/* check FC2580 ID register; reg=01 val=56 */
@@ -473,7 +475,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x56) {
priv-tuner = TUNER_RTL2832_FC2580;
priv-tuner_name = FC2580;
-   goto found;
+   goto tuner_found;
}
 
/* check MT2063 ID register; reg=00 val=9e || 9c */
@@ -481,7 +483,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  (buf[0] == 0x9e || buf[0] == 0x9c)) {
priv-tuner = TUNER_RTL2832_MT2063;
priv-tuner_name = MT2063;
-   goto found;
+   goto tuner_found;
}
 
/* check MAX3543 ID register; reg=00 val=38 */
@@ -489,7 +491,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x38) {
priv-tuner = TUNER_RTL2832_MAX3543;
priv-tuner_name = MAX3543;
-   goto found;
+   goto tuner_found;
}
 
/* check TUA9001 ID register; reg=7e val=2328 */
@@ -497,7 +499,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x23  buf[1] == 0x28) {
priv-tuner = TUNER_RTL2832_TUA9001;
priv-tuner_name = TUA9001;
-   goto found;
+   goto tuner_found;
}
 
/* check MXL5007R ID register; reg=d9 val=14 */
@@ -505,7 +507,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x14) {
priv-tuner = TUNER_RTL2832_MXL5007T;
priv-tuner_name = MXL5007T;
-   goto found;
+   goto tuner_found;
}
 
/* check E4000 ID register; reg=02 val=40 */
@@ -513,7 +515,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x40) {
priv-tuner = TUNER_RTL2832_E4000;
priv-tuner_name = E4000;
-   goto 

[PATCH 6/8] rtl28xxu: rename tuner I2C client pointer

2014-11-11 Thread Antti Palosaari
Better to rename tuner I2C to something which clearly says it is
for tuner as there is now multiple different I2C clients used.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 6 +++---
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 93f8afc..47360d3 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1094,7 +1094,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
break;
}
 
-   priv-client = client;
+   priv-i2c_client_tuner = client;
sd = i2c_get_clientdata(client);
i2c_set_adapdata(i2c_adap_internal, d);
 
@@ -1153,7 +1153,7 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter 
*adap)
priv-tuner);
}
 
-   if (fe == NULL  priv-client == NULL) {
+   if (fe == NULL  priv-i2c_client_tuner == NULL) {
ret = -ENODEV;
goto err;
}
@@ -1206,7 +1206,7 @@ static void rtl28xxu_exit(struct dvb_usb_device *d)
dev_dbg(d-udev-dev, %s:\n, __func__);
 
/* remove I2C tuner */
-   client = priv-client;
+   client = priv-i2c_client_tuner;
if (client) {
module_put(client-dev.driver-owner);
i2c_unregister_device(client);
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
index 9c059ac..bfc0b57 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -57,7 +57,7 @@ struct rtl28xxu_priv {
u8 page; /* integrated demod active register page */
struct i2c_adapter *demod_i2c_adapter;
bool rc_active;
-   struct i2c_client *client;
+   struct i2c_client *i2c_client_tuner;
struct i2c_client *i2c_client_slave_demod;
int (*init)(struct dvb_frontend *fe);
#define SLAVE_DEMOD_NONE   0
-- 
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 1/1] cx23885: add DVBSky T982(Dual DVB-T2/T/C) support

2014-11-11 Thread Nibble Max
DVBSky T982 DVB-T2/T/C dual PCIe card:
1dvb frontend: SI2158A20(tuner),SI2168A30(demod)
2PCIe bridge: CX23885(port b: parallel mode, port c: serial mode)
3rc: cx23885 integrated.

Signed-off-by: Nibble Max nibble@gmail.com
---
 drivers/media/pci/cx23885/cx23885-cards.c | 15 
 drivers/media/pci/cx23885/cx23885-dvb.c   | 60 ++-
 drivers/media/pci/cx23885/cx23885-input.c |  3 ++
 drivers/media/pci/cx23885/cx23885.h   |  1 +
 4 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx23885/cx23885-cards.c 
b/drivers/media/pci/cx23885/cx23885-cards.c
index 4bad27d..db99ca2 100644
--- a/drivers/media/pci/cx23885/cx23885-cards.c
+++ b/drivers/media/pci/cx23885/cx23885-cards.c
@@ -701,6 +701,11 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
},
+   [CX23885_BOARD_DVBSKY_T982] = {
+   .name   = DVBSky T982,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   },
 };
 const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);
 
@@ -980,6 +985,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x4254,
.subdevice = 0x0952,
.card  = CX23885_BOARD_DVBSKY_S952,
+   }, {
+   .subvendor = 0x4254,
+   .subdevice = 0x0982,
+   .card  = CX23885_BOARD_DVBSKY_T982,
},
 };
 const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -1576,6 +1585,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
break;
case CX23885_BOARD_DVBSKY_T9580:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
/* enable GPIO3-18 pins */
cx_write(MC417_CTL, 0x0037);
cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1);
@@ -1708,6 +1718,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
if (!enable_885_ir)
break;
dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
@@ -1760,6 +1771,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
/* sd_ir is a duplicate pointer to the AV Core, just clear it */
dev-sd_ir = NULL;
@@ -1813,6 +1825,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
if (dev-sd_ir)
cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
break;
@@ -1968,6 +1981,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
ts2-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
break;
case CX23885_BOARD_DVBSKY_T9580:
+   case CX23885_BOARD_DVBSKY_T982:
ts1-gen_ctrl_val  = 0x5; /* Parallel */
ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */
ts1-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
@@ -2051,6 +2065,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev,
dev-i2c_bus[2].i2c_adap,
cx25840, 0x88  1, NULL);
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 2457b64..1ed92ee 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1945,6 +1945,63 @@ static int dvb_register(struct cx23885_tsport *port)
 
port-i2c_client_tuner = client_tuner;
break;
+   case CX23885_BOARD_DVBSKY_T982:
+   memset(si2168_config, 0, sizeof(si2168_config));
+   switch (port-nr) {
+   /* port b */
+   case 1:
+   i2c_bus = dev-i2c_bus[1];
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   break;
+   /* port c */
+   case 2:
+   i2c_bus = dev-i2c_bus[0];
+   si2168_config.ts_mode = SI2168_TS_SERIAL;
+   break;
+   }
+
+   /* attach frontend */
+   si2168_config.i2c_adapter = adapter;

Re: [PATCH 1/1] cx23885: add DVBSky T982(Dual DVB-T2/T/C) support

2014-11-11 Thread Antti Palosaari

Moikka!

On 11/12/2014 06:23 AM, Nibble Max wrote:

DVBSky T982 DVB-T2/T/C dual PCIe card:
1dvb frontend: SI2158A20(tuner),SI2168A30(demod)
2PCIe bridge: CX23885(port b: parallel mode, port c: serial mode)
3rc: cx23885 integrated.

Signed-off-by: Nibble Max nibble@gmail.com


Reviewed-by: Antti Palosaari cr...@iki.fi

Antti



---
  drivers/media/pci/cx23885/cx23885-cards.c | 15 
  drivers/media/pci/cx23885/cx23885-dvb.c   | 60 ++-
  drivers/media/pci/cx23885/cx23885-input.c |  3 ++
  drivers/media/pci/cx23885/cx23885.h   |  1 +
  4 files changed, 78 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx23885/cx23885-cards.c 
b/drivers/media/pci/cx23885/cx23885-cards.c
index 4bad27d..db99ca2 100644
--- a/drivers/media/pci/cx23885/cx23885-cards.c
+++ b/drivers/media/pci/cx23885/cx23885-cards.c
@@ -701,6 +701,11 @@ struct cx23885_board cx23885_boards[] = {
.portb  = CX23885_MPEG_DVB,
.portc  = CX23885_MPEG_DVB,
},
+   [CX23885_BOARD_DVBSKY_T982] = {
+   .name   = DVBSky T982,
+   .portb  = CX23885_MPEG_DVB,
+   .portc  = CX23885_MPEG_DVB,
+   },
  };
  const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards);

@@ -980,6 +985,10 @@ struct cx23885_subid cx23885_subids[] = {
.subvendor = 0x4254,
.subdevice = 0x0952,
.card  = CX23885_BOARD_DVBSKY_S952,
+   }, {
+   .subvendor = 0x4254,
+   .subdevice = 0x0982,
+   .card  = CX23885_BOARD_DVBSKY_T982,
},
  };
  const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids);
@@ -1576,6 +1585,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev)
break;
case CX23885_BOARD_DVBSKY_T9580:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
/* enable GPIO3-18 pins */
cx_write(MC417_CTL, 0x0037);
cx23885_gpio_enable(dev, GPIO_2 | GPIO_11, 1);
@@ -1708,6 +1718,7 @@ int cx23885_ir_init(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
if (!enable_885_ir)
break;
dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE);
@@ -1760,6 +1771,7 @@ void cx23885_ir_fini(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
cx23885_irq_remove(dev, PCI_MSK_AV_CORE);
/* sd_ir is a duplicate pointer to the AV Core, just clear it */
dev-sd_ir = NULL;
@@ -1813,6 +1825,7 @@ void cx23885_ir_pci_int_enable(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
if (dev-sd_ir)
cx23885_irq_add_enable(dev, PCI_MSK_AV_CORE);
break;
@@ -1968,6 +1981,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
ts2-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
break;
case CX23885_BOARD_DVBSKY_T9580:
+   case CX23885_BOARD_DVBSKY_T982:
ts1-gen_ctrl_val  = 0x5; /* Parallel */
ts1-ts_clk_en_val = 0x1; /* Enable TS_CLK */
ts1-src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
@@ -2051,6 +2065,7 @@ void cx23885_card_setup(struct cx23885_dev *dev)
case CX23885_BOARD_TT_CT2_4500_CI:
case CX23885_BOARD_DVBSKY_S950:
case CX23885_BOARD_DVBSKY_S952:
+   case CX23885_BOARD_DVBSKY_T982:
dev-sd_cx25840 = v4l2_i2c_new_subdev(dev-v4l2_dev,
dev-i2c_bus[2].i2c_adap,
cx25840, 0x88  1, NULL);
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 2457b64..1ed92ee 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1945,6 +1945,63 @@ static int dvb_register(struct cx23885_tsport *port)

port-i2c_client_tuner = client_tuner;
break;
+   case CX23885_BOARD_DVBSKY_T982:
+   memset(si2168_config, 0, sizeof(si2168_config));
+   switch (port-nr) {
+   /* port b */
+   case 1:
+   i2c_bus = dev-i2c_bus[1];
+   si2168_config.ts_mode = SI2168_TS_PARALLEL;
+   break;
+   /* port c */
+   case 2:
+   i2c_bus = dev-i2c_bus[0];
+   si2168_config.ts_mode = SI2168_TS_SERIAL;
+