Re: Regression: DVBSky S960 USB tuner doesn't work in 4.10 or newer

2018-04-28 Thread Olli Salonen
I did test the patch and while it doesn't seem to introduce any
negative side effects it does not provide a remedy for the original
problem that was seen after introducing
9d659ae14b545c4296e812c70493bfdc999b5c1c (you probably did not expect
that either).


Cheers,
-olli

On 27 April 2018 at 18:33, Mauro Carvalho Chehab
<mchehab+sams...@kernel.org> wrote:
> Em Fri, 27 Apr 2018 16:25:08 +0200
> Olli Salonen <olli.salo...@iki.fi> escreveu:
>
>> Thanks for the suggestion Antti.
>>
>> I've tried to add a delay in various places, but haven't seen any
>> improvement. However, what I did saw was that if I added an msleep
>> after the lock:
>>
>> static int dvbsky_usb_generic_rw(struct dvb_usb_device *d,
>> u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
>> {
>> int ret;
>> struct dvbsky_state *state = d_to_priv(d);
>>
>> mutex_lock(>usb_mutex);
>> msleep(20);
>>
>> The error was seen very within a minute. If I increased the msleep to
>> 50, it failed within seconds. This doesn't seem to make sense to me.
>> This is the only function where usb_mutex is used. If the mutex is
>> held for a longer time, the next attempt to lock the mutex should just
>> be delayed a bit, no?
>
> I don't like the idea of having two mutexes there to protect reading/writing
> to data one for "generic" r/w ops, and another one just for streaming
> control, with ends by calling the "generic" mutex.
>
> IMHO, I would get rid of one of the mutexes, e. g. something like the
> patch below (untested).
>
> Regards,
> Mauro
>
> media: dvbsky: use just one mutex for serializing device R/W ops
>
> Right now, there are two mutexes serializing r/w ops: one "generic"
> and another one specifically for stream on/off.
>
> Clean it a little bit, getting rid of one of the mutexes.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+sams...@kernel.org>
>
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
> b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> index 43eb82884555..50553975c39d 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -31,7 +31,6 @@ MODULE_PARM_DESC(disable_rc, "Disable inbuilt IR 
> receiver.");
>  DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
>
>  struct dvbsky_state {
> -   struct mutex stream_mutex;
> u8 ibuf[DVBSKY_BUF_LEN];
> u8 obuf[DVBSKY_BUF_LEN];
> u8 last_lock;
> @@ -68,18 +67,17 @@ static int dvbsky_usb_generic_rw(struct dvb_usb_device *d,
>
>  static int dvbsky_stream_ctrl(struct dvb_usb_device *d, u8 onoff)
>  {
> -   struct dvbsky_state *state = d_to_priv(d);
> int ret;
> -   u8 obuf_pre[3] = { 0x37, 0, 0 };
> -   u8 obuf_post[3] = { 0x36, 3, 0 };
> +   static u8 obuf_pre[3] = { 0x37, 0, 0 };
> +   static u8 obuf_post[3] = { 0x36, 3, 0 };
>
> -   mutex_lock(>stream_mutex);
> -   ret = dvbsky_usb_generic_rw(d, obuf_pre, 3, NULL, 0);
> +   mutex_lock(>usb_mutex);
> +   ret = dvb_usbv2_generic_rw_locked(d, obuf_pre, 3, NULL, 0);
> if (!ret && onoff) {
> msleep(20);
> -   ret = dvbsky_usb_generic_rw(d, obuf_post, 3, NULL, 0);
> +   ret = dvb_usbv2_generic_rw_locked(d, obuf_post, 3, NULL, 0);
> }
> -   mutex_unlock(>stream_mutex);
> +   mutex_unlock(>usb_mutex);
> return ret;
>  }
>
> @@ -744,8 +742,6 @@ static int dvbsky_init(struct dvb_usb_device *d)
> if (ret)
> return ret;
> */
> -   mutex_init(>stream_mutex);
> -
> state->last_lock = 0;
>
> return 0;
>
>
>
> Thanks,
> Mauro


Re: Regression: DVBSky S960 USB tuner doesn't work in 4.10 or newer

2018-04-27 Thread Olli Salonen
Thanks for the suggestion Antti.

I've tried to add a delay in various places, but haven't seen any
improvement. However, what I did saw was that if I added an msleep
after the lock:

static int dvbsky_usb_generic_rw(struct dvb_usb_device *d,
u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
{
int ret;
struct dvbsky_state *state = d_to_priv(d);

mutex_lock(>usb_mutex);
msleep(20);

The error was seen very within a minute. If I increased the msleep to
50, it failed within seconds. This doesn't seem to make sense to me.
This is the only function where usb_mutex is used. If the mutex is
held for a longer time, the next attempt to lock the mutex should just
be delayed a bit, no?

Cheers,
-olli

On 18 April 2018 at 10:49, Antti Palosaari <cr...@iki.fi> wrote:
>
> On 04/18/2018 07:49 AM, Olli Salonen wrote:
>>
>> Thank you for your response Peter!
>>
>> Indeed, it seems strange. dvbsky.c driver seems to use mutex_lock in
>> very much the same way as many other drivers. I've now confirmed that
>> I can get a 4.10 kernel with working DVBSky S960 by reverting the
>> following 4 patches:
>>
>> 549bdd3 Revert "locking/mutex: Add lock handoff to avoid starvation"
>> 3210f31 Revert "locking/mutex: Restructure wait loop"
>> 418a170 Revert "locking/mutex: Simplify some ww_mutex code in
>> __mutex_lock_common()"
>> 0b1fb8f Revert "locking/mutex: Enable optimistic spinning of woken waiter"
>> c470abd Linux 4.10
>
>
> These kind of issues tend to be timing issues very often. Just add some
> sleeps to i2c adapter algo / usb control messages and test.
>
> regards
> Antti
>
>
>
>
> --
> http://palosaari.fi/


Re: Regression: DVBSky S960 USB tuner doesn't work in 4.10 or newer

2018-04-17 Thread Olli Salonen
Thank you for your response Peter!

Indeed, it seems strange. dvbsky.c driver seems to use mutex_lock in
very much the same way as many other drivers. I've now confirmed that
I can get a 4.10 kernel with working DVBSky S960 by reverting the
following 4 patches:

549bdd3 Revert "locking/mutex: Add lock handoff to avoid starvation"
3210f31 Revert "locking/mutex: Restructure wait loop"
418a170 Revert "locking/mutex: Simplify some ww_mutex code in
__mutex_lock_common()"
0b1fb8f Revert "locking/mutex: Enable optimistic spinning of woken waiter"
c470abd Linux 4.10

The other 3 three I need to revert to be able to revert 9d659ae.

I added some more debugging into the DVBsky driver to better
understand what's happening.

After the point when the fault starts any I2C read from the m88ds3103
demodulator provides answer "07 ff 49 00" or a subset of it. Before
13:59:42 there are no I2C reads returning an answer starting with 07.

Apr 10 13:59:42 nucserver kernel: [ 4744.048206]
dvb_usb_dvbsky:dvbsky_rc_query: usb 1-1:
Apr 10 13:59:42 nucserver kernel: [ 4744.048319]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 10, read: ff ff
Apr 10 13:59:42 nucserver kernel: [ 4744.080229]
dvb_usb_dvbsky:dvbsky_usb_read_status: usb 1-1:
Apr 10 13:59:42 nucserver kernel: [ 4744.080245]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 2
Apr 10 13:59:42 nucserver kernel: [ 4744.080915]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 09 01 01 68 0d,
read: 08 01
Apr 10 13:59:42 nucserver kernel: [ 4744.080931]
m88ds3103:m88ds3103_read_status: m88ds3103 4-0068: lock=01 status=00
Apr 10 13:59:42 nucserver kernel: [ 4744.080943]
m88ds3103:m88ds3103_set_frontend: m88ds3103 4-0068: delivery_system=6
modulation=9 frequency=1097000 symbol_rate=2300 inversion=2
pilot=2 rolloff=0
Apr 10 13:59:42 nucserver kernel: [ 4744.080953]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 1
Apr 10 13:59:42 nucserver kernel: [ 4744.081452]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 08 68 02 07 80,
read: 08
Apr 10 13:59:42 nucserver kernel: [ 4744.081562]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 2
Apr 10 13:59:42 nucserver kernel: [ 4744.082263]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 09 01 01 68 3f,
read: 08 ff
Apr 10 13:59:42 nucserver kernel: [ 4744.082287]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 1
Apr 10 13:59:42 nucserver kernel: [ 4744.082706]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 08 68 02 03 11,
read: 07
Apr 10 13:59:42 nucserver kernel: [ 4744.082715]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 2
Apr 10 13:59:42 nucserver kernel: [ 4744.083119]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 09 01 01 60 3d,
read: 07 ff
Apr 10 13:59:42 nucserver kernel: [ 4744.083230]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 1
Apr 10 13:59:42 nucserver kernel: [ 4744.083645]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 08 68 02 07 00,
read: 07
Apr 10 13:59:42 nucserver kernel: [ 4744.083752]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 1
Apr 10 13:59:42 nucserver kernel: [ 4744.084114]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 08 68 02 03 11,
read: 07
Apr 10 13:59:42 nucserver kernel: [ 4744.084130]
dvb_usb_dvbsky:dvbsky_i2c_xfer: usb 1-1: num: 2
Apr 10 13:59:42 nucserver kernel: [ 4744.084484]
dvb_usb_dvbsky:dvbsky_usb_generic_rw: usb 1-1: write: 09 01 01 60 21,
read: 07 ff

I really cannot see any obvious link between the mutexes and the I2C
operations starting to fail, but indeed the device starts to work as
normal if I revert that patch.

Cheers,
-olli


On 9 April 2018 at 11:14, Peter Zijlstra <pet...@infradead.org> wrote:
> On Wed, Apr 04, 2018 at 02:41:51PM +0300, Olli Salonen wrote:
>> Hello Peter and Max,
>>
>> I noticed that when using kernel 4.10 or newer my DVBSky S960 and
>> S960CI satellite USB TV tuners stopped working properly. Basically,
>> they will fail at one point when tuning to a channel. This typically
>> takes less than 100 tuning attempts. For perspective, when performing
>> a full channel scan on my system, the tuner tunes at least 500 times.
>> After the tuner fails, I need to reboot the PC (probably unloading the
>> driver and loading it again would do).
>>
>> 2018-04-04 10:17:36.756 [   INFO] mpegts: 12149H in 4.8E - tuning on
>> Montage Technology M88DS3103 : DVB-S #0
>> 2018-04-04 10:17:37.159 [  ERROR] diseqc: failed to send diseqc cmd
>> (e=Connection timed out)
>> 2018-04-04 10:17:37.160 [   INFO] mpegts: 12265H in 4.8E - tuning on
>> Montage Technology M88DS3103 : DVB-S #0
>> 2018-04-04 10:17:37.535 [  ERROR] diseqc: failed to send diseqc cmd
>> (e=Connection timed out)
>>
>> I did a kernel bisect between 4.9 and 4.10. It seems the commit that
>> breaks my tuner is the following one:
>>
>> 9d659ae14b545c4296e812c70493bfdc999b5c1c is the fir

Re: Regression: DVBSky S960 USB tuner doesn't work in 4.10 or newer

2018-04-08 Thread Olli Salonen
I created a report of the issue in Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=199323

I'd be grateful for any tips on how to debug this further.

Cheers,
-olli

On 4 April 2018 at 14:41, Olli Salonen <olli.salo...@iki.fi> wrote:
> Hello Peter and Max,
>
> I noticed that when using kernel 4.10 or newer my DVBSky S960 and
> S960CI satellite USB TV tuners stopped working properly. Basically,
> they will fail at one point when tuning to a channel. This typically
> takes less than 100 tuning attempts. For perspective, when performing
> a full channel scan on my system, the tuner tunes at least 500 times.
> After the tuner fails, I need to reboot the PC (probably unloading the
> driver and loading it again would do).
>
> 2018-04-04 10:17:36.756 [   INFO] mpegts: 12149H in 4.8E - tuning on
> Montage Technology M88DS3103 : DVB-S #0
> 2018-04-04 10:17:37.159 [  ERROR] diseqc: failed to send diseqc cmd
> (e=Connection timed out)
> 2018-04-04 10:17:37.160 [   INFO] mpegts: 12265H in 4.8E - tuning on
> Montage Technology M88DS3103 : DVB-S #0
> 2018-04-04 10:17:37.535 [  ERROR] diseqc: failed to send diseqc cmd
> (e=Connection timed out)
>
> I did a kernel bisect between 4.9 and 4.10. It seems the commit that
> breaks my tuner is the following one:
>
> 9d659ae14b545c4296e812c70493bfdc999b5c1c is the first bad commit
> commit 9d659ae14b545c4296e812c70493bfdc999b5c1c
> Author: Peter Zijlstra <pet...@infradead.org>
> Date:   Tue Aug 23 14:40:16 2016 +0200
>
> locking/mutex: Add lock handoff to avoid starvation
>
> I couldn't easily revert that commit only. I can see that the
> drivers/media/usb/dvb-usb-v2/dvbsky.c driver does use mutex_lock() and
> mutex_lock_interruptible() in a few places.
>
> Do you guys see anything that's obviously wrong in the way the mutexes
> are used in dvbsky.c or anything in that particular patch that could
> cause this issue?
>
> Thanks and best regards,
> -olli


Regression: DVBSky S960 USB tuner doesn't work in 4.10 or newer

2018-04-04 Thread Olli Salonen
Hello Peter and Max,

I noticed that when using kernel 4.10 or newer my DVBSky S960 and
S960CI satellite USB TV tuners stopped working properly. Basically,
they will fail at one point when tuning to a channel. This typically
takes less than 100 tuning attempts. For perspective, when performing
a full channel scan on my system, the tuner tunes at least 500 times.
After the tuner fails, I need to reboot the PC (probably unloading the
driver and loading it again would do).

2018-04-04 10:17:36.756 [   INFO] mpegts: 12149H in 4.8E - tuning on
Montage Technology M88DS3103 : DVB-S #0
2018-04-04 10:17:37.159 [  ERROR] diseqc: failed to send diseqc cmd
(e=Connection timed out)
2018-04-04 10:17:37.160 [   INFO] mpegts: 12265H in 4.8E - tuning on
Montage Technology M88DS3103 : DVB-S #0
2018-04-04 10:17:37.535 [  ERROR] diseqc: failed to send diseqc cmd
(e=Connection timed out)

I did a kernel bisect between 4.9 and 4.10. It seems the commit that
breaks my tuner is the following one:

9d659ae14b545c4296e812c70493bfdc999b5c1c is the first bad commit
commit 9d659ae14b545c4296e812c70493bfdc999b5c1c
Author: Peter Zijlstra 
Date:   Tue Aug 23 14:40:16 2016 +0200

locking/mutex: Add lock handoff to avoid starvation

I couldn't easily revert that commit only. I can see that the
drivers/media/usb/dvb-usb-v2/dvbsky.c driver does use mutex_lock() and
mutex_lock_interruptible() in a few places.

Do you guys see anything that's obviously wrong in the way the mutexes
are used in dvbsky.c or anything in that particular patch that could
cause this issue?

Thanks and best regards,
-olli


Mygica 230C defined in two drivers

2018-01-05 Thread Olli Salonen
Hi Stefan and all,

I noticed that the Mygica 230C is currently defined in two different drivers.

in dvbsky.c:

{ DVB_USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230C,
_t230c_props, "MyGica Mini DVB-T2 USB Stick T230C",
RC_MAP_TOTAL_MEDIA_IN_HAND_02) },


in cxusb.c:

[MYGICA_T230] = {
USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230)
},
[MYGICA_T230C] = {
USB_DEVICE(USB_VID_CONEXANT, USB_PID_MYGICA_T230+1)
},

and in dvb-usb-ids.h:

#define USB_PID_MYGICA_T2300xc688
#define USB_PID_MYGICA_T230C0xc689

I think you've played around with this device earlier. Do you have any
insight on which driver works better or all they all the same?

Cheers,
-olli


[PATCH] dtv-scan-tables: update all Finnish Digita DVB-T2 transponders

2017-12-26 Thread Olli Salonen
Update Finnish frequencies for Digita.

---
 dvb-t/fi-Anjalankoski_Ruotila | 18 +-
 dvb-t/fi-Enontekio_Kuttanen   |  7 +--
 dvb-t/fi-Espoo| 11 +++
 dvb-t/fi-Eurajoki | 20 ++--
 dvb-t/fi-Fiskars  | 11 +++
 dvb-t/fi-Hyvinkaa | 13 -
 dvb-t/fi-Joutseno | 18 +-
 dvb-t/fi-Jyvaskyla| 17 ++---
 dvb-t/fi-Karkkila | 17 ++---
 dvb-t/fi-Kruunupyy| 20 ++--
 dvb-t/fi-Kuopio   | 18 +-
 dvb-t/fi-Lahti| 11 +++
 dvb-t/fi-Lapua| 18 +-
 dvb-t/fi-Lohja| 14 +-
 dvb-t/fi-Oulu | 13 -
 dvb-t/fi-Tammela  | 21 +++--
 dvb-t/fi-Tampere  | 12 
 dvb-t/fi-Tampere_Pyynikki | 18 +-
 dvb-t/fi-Turku| 11 +++
 dvb-t/fi-Vantaa_Hakunila  |  7 +--
 20 files changed, 119 insertions(+), 176 deletions(-)

diff --git a/dvb-t/fi-Anjalankoski_Ruotila b/dvb-t/fi-Anjalankoski_Ruotila
index 8ae1231..4d3ab83 100644
--- a/dvb-t/fi-Anjalankoski_Ruotila
+++ b/dvb-t/fi-Anjalankoski_Ruotila
@@ -1,27 +1,27 @@
 # 2014-04-18 Antti Palosaari 
 # generated from 
http://www.digita.fi/kuluttajat/tv/nakyvyysalueet/kanavanumerot_ja_taajuudet
 
-[Anjalankoski_Ruotila]
+[Anjalankoski-A]
DELIVERY_SYSTEM = DVBT
FREQUENCY = 48200
BANDWIDTH_HZ = 800
 
-[Anjalankoski_Ruotila]
-   DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 52200
+[Anjalankoski-B]
+   DELIVERY_SYSTEM = DVBT2
+   FREQUENCY = 65800
BANDWIDTH_HZ = 800
 
-[Anjalankoski_Ruotila]
+[Anjalankoski-C]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 73000
+   FREQUENCY = 51400
BANDWIDTH_HZ = 800
 
-[Anjalankoski_Ruotila]
+[Anjalankoski-D]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 75400
+   FREQUENCY = 61800
BANDWIDTH_HZ = 800
 
-[Anjalankoski_Ruotila]
+[Anjalankoski-E]
DELIVERY_SYSTEM = DVBT2
FREQUENCY = 63400
BANDWIDTH_HZ = 800
diff --git a/dvb-t/fi-Enontekio_Kuttanen b/dvb-t/fi-Enontekio_Kuttanen
index f9a6af8..a792d59 100644
--- a/dvb-t/fi-Enontekio_Kuttanen
+++ b/dvb-t/fi-Enontekio_Kuttanen
@@ -3,11 +3,6 @@
 
 [Enontekio_Kuttanen]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 73000
-   BANDWIDTH_HZ = 800
-
-[Enontekio_Kuttanen]
-   DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 77000
+   FREQUENCY = 52200
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Espoo b/dvb-t/fi-Espoo
index 6fb0ff2..bc01a39 100644
--- a/dvb-t/fi-Espoo
+++ b/dvb-t/fi-Espoo
@@ -7,8 +7,8 @@
BANDWIDTH_HZ = 800
 
 [Espoo-B]
-   DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 65800
+   DELIVERY_SYSTEM = DVBT2
+   FREQUENCY = 65000
BANDWIDTH_HZ = 800
 
 [Espoo-C]
@@ -21,12 +21,7 @@
FREQUENCY = 51400
BANDWIDTH_HZ = 800
 
-[Espoo-D]
-   DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 65000
-   BANDWIDTH_HZ = 800
-
-[Espoo-H]
+[Espoo-F]
DELIVERY_SYSTEM = DVBT2
FREQUENCY = 61800
BANDWIDTH_HZ = 800
diff --git a/dvb-t/fi-Eurajoki b/dvb-t/fi-Eurajoki
index 1d090a5..2ccc418 100644
--- a/dvb-t/fi-Eurajoki
+++ b/dvb-t/fi-Eurajoki
@@ -1,28 +1,28 @@
 # 2014-04-18 Antti Palosaari 
 # generated from 
http://www.digita.fi/kuluttajat/tv/nakyvyysalueet/kanavanumerot_ja_taajuudet
 
-[Eurajoki]
+[Eurajoki-A]
DELIVERY_SYSTEM = DVBT
FREQUENCY = 61000
BANDWIDTH_HZ = 800
 
-[Eurajoki]
-   DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 66600
+[Eurajoki-B]
+   DELIVERY_SYSTEM = DVBT2
+   FREQUENCY = 59400
BANDWIDTH_HZ = 800
 
-[Eurajoki]
+[Eurajoki-C]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 72200
+   FREQUENCY = 64200
BANDWIDTH_HZ = 800
 
-[Eurajoki]
+[Eurajoki-E]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 74600
+   FREQUENCY = 60200
BANDWIDTH_HZ = 800
 
-[Eurajoki]
+[Eurajoki-F]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 59400
+   FREQUENCY = 57000
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Fiskars b/dvb-t/fi-Fiskars
index 2b6b791..5f8cacc 100644
--- a/dvb-t/fi-Fiskars
+++ b/dvb-t/fi-Fiskars
@@ -1,22 +1,17 @@
 # 2014-04-18 Antti Palosaari 
 # generated from 
http://www.digita.fi/kuluttajat/tv/nakyvyysalueet/kanavanumerot_ja_taajuudet
 
-[Fiskars]
+[Fiskars-A]
DELIVERY_SYSTEM = DVBT
FREQUENCY = 56200
BANDWIDTH_HZ = 800
 
-[Fiskars]
-   DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 49800
-   BANDWIDTH_HZ = 800
-
-[Fiskars]
+[Fiskars-C]
DELIVERY_SYSTEM = DVBT
FREQUENCY = 

[PATCHv4 2/2] dib0700: add support for Xbox One Digital TV Tuner

2017-11-23 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

Xbox One Digital TV Tuner is a low-cost USB 2.0 multistandard TV tuner. It 
supports DVB-T, DVB-T2 and DVB-C broadcast standards.

USB bridge: DibCom 0700C
Demodulator: Panasonic MN88472
Tuner: TDA18250BHN

The demodulator requires firmware. Download one from here:
http://palosaari.fi/linux/v4l-dvb/firmware/MN88472/02/latest/

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-core/dvb-usb-ids.h|   2 +
 drivers/media/usb/dvb-usb/Kconfig   |   2 +
 drivers/media/usb/dvb-usb/dib0700.h |   2 +
 drivers/media/usb/dvb-usb/dib0700_core.c|  26 ++-
 drivers/media/usb/dvb-usb/dib0700_devices.c | 109 +++-
 5 files changed, 139 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index 5b6041d..daf49ec 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -80,6 +80,7 @@
 #define USB_VID_AZUREWAVE  0x13d3
 #define USB_VID_TECHNISAT  0x14f7
 #define USB_VID_HAMA   0x147f
+#define USB_VID_MICROSOFT  0x045e
 
 /* Product IDs */
 #define USB_PID_ADSTECH_USB2_COLD  0xa333
@@ -417,4 +418,5 @@
 #define USB_PID_WINTV_SOLOHD0x0264
 #define USB_PID_EVOLVEO_XTRATV_STICK   0xa115
 #define USB_PID_HAMA_DVBT_HYBRID   0x2758
+#define USB_PID_XBOX_ONE_TUNER  0x02d5
 #endif
diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 959fa09..2651ae2 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -86,6 +86,7 @@ config DVB_USB_DIB0700
select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0090 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
@@ -94,6 +95,7 @@ config DVB_USB_DIB0700
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_XC4000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_TDA18250 if MEDIA_SUBDRV_AUTOSELECT
help
  Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. 
The
  USB bridge is also present in devices having the DiB7700 DVB-T-USB
diff --git a/drivers/media/usb/dvb-usb/dib0700.h 
b/drivers/media/usb/dvb-usb/dib0700.h
index f89ab3b..3a9d4c2 100644
--- a/drivers/media/usb/dvb-usb/dib0700.h
+++ b/drivers/media/usb/dvb-usb/dib0700.h
@@ -51,6 +51,8 @@ struct dib0700_state {
int (*read_status)(struct dvb_frontend *, enum fe_status *);
int (*sleep)(struct dvb_frontend* fe);
u8 buf[255];
+   struct i2c_client *i2c_client_demod;
+   struct i2c_client *i2c_client_tuner;
 };
 
 extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c 
b/drivers/media/usb/dvb-usb/dib0700_core.c
index 1ee7ec5..94bd176 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -911,10 +911,34 @@ static int dib0700_probe(struct usb_interface *intf,
return -ENODEV;
 }
 
+static void dib0700_disconnect(struct usb_interface *intf)
+{
+   struct dvb_usb_device *d = usb_get_intfdata(intf);
+   struct dib0700_state *st = d->priv;
+   struct i2c_client *client;
+
+   /* remove I2C client for tuner */
+   client = st->i2c_client_tuner;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   /* remove I2C client for demodulator */
+   client = st->i2c_client_demod;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   dvb_usb_device_exit(intf);
+}
+
+
 static struct usb_driver dib0700_driver = {
.name   = "dvb_usb_dib0700",
.probe  = dib0700_probe,
-   .disconnect = dvb_usb_device_exit,
+   .disconnect = dib0700_disconnect,
.id_table   = dib0700_usb_id_table,
 };
 
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c 
b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 92098c1b..8afcd11 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -23,6 +23,9 @@
 #include "dib0090.h"
 #include "lgdt3305.h"
 #include "mxl5007t.h"
+#include "mn88472.h"
+#include "tda18250.h"
+
 
 static int force_lna_

[PATCHv4 1/2] tda18250: support for new silicon tuner

2017-11-23 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

NXP TDA18250 silicon tuner driver.

Version 4 includes some checkpatch fixes.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 MAINTAINERS  |   9 +
 drivers/media/tuners/Kconfig |   7 +
 drivers/media/tuners/Makefile|   1 +
 drivers/media/tuners/tda18250.c  | 902 +++
 drivers/media/tuners/tda18250.h  |  51 ++
 drivers/media/tuners/tda18250_priv.h | 145 ++
 6 files changed, 1115 insertions(+)
 create mode 100644 drivers/media/tuners/tda18250.c
 create mode 100644 drivers/media/tuners/tda18250.h
 create mode 100644 drivers/media/tuners/tda18250_priv.h

diff --git a/MAINTAINERS b/MAINTAINERS
index ff987d8..f26204e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -13086,6 +13086,15 @@ T: git git://linuxtv.org/anttip/media_tree.git
 S: Maintained
 F: drivers/media/tuners/tda18218*
 
+TDA18250 MEDIA DRIVER
+M: Olli Salonen <olli.salo...@iki.fi>
+L: linux-media@vger.kernel.org
+W: https://linuxtv.org
+Q: http://patchwork.linuxtv.org/project/linux-media/list/
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/tuners/tda18250*
+
 TDA18271 MEDIA DRIVER
 M: Michael Krufky <mkru...@linuxtv.org>
 L: linux-media@vger.kernel.org
diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 05998f0..6687514 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -26,6 +26,13 @@ config MEDIA_TUNER_SIMPLE
help
  Say Y here to include support for various simple tuners.
 
+config MEDIA_TUNER_TDA18250
+   tristate "NXP TDA18250 silicon tuner"
+   depends on MEDIA_SUPPORT && I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y here to include support for TDA18250 tuner.
+
 config MEDIA_TUNER_TDA8290
tristate "TDA 8290/8295 + 8275(a)/18271 tuner combo"
depends on MEDIA_SUPPORT && I2C
diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile
index 06a9ab6..4b9444b 100644
--- a/drivers/media/tuners/Makefile
+++ b/drivers/media/tuners/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o
 obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o
 obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o
 obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o
+obj-$(CONFIG_MEDIA_TUNER_TDA18250) += tda18250.o
 
 ccflags-y += -I$(srctree)/drivers/media/dvb-core
 ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
diff --git a/drivers/media/tuners/tda18250.c b/drivers/media/tuners/tda18250.c
new file mode 100644
index 000..20d12b0
--- /dev/null
+++ b/drivers/media/tuners/tda18250.c
@@ -0,0 +1,902 @@
+/*
+ * NXP TDA18250 silicon tuner driver
+ *
+ * Copyright (C) 2017 Olli Salonen <olli.salo...@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 "tda18250_priv.h"
+#include 
+
+static const struct dvb_tuner_ops tda18250_ops;
+
+static int tda18250_power_control(struct dvb_frontend *fe,
+   unsigned int power_state)
+{
+   struct i2c_client *client = fe->tuner_priv;
+   struct tda18250_dev *dev = i2c_get_clientdata(client);
+   int ret;
+   unsigned int utmp;
+
+   dev_dbg(>dev, "power state: %d", power_state);
+
+   switch (power_state) {
+   case TDA18250_POWER_NORMAL:
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 0x00);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 0xc0);
+   if (ret)
+   goto err;
+   break;
+   case TDA18250_POWER_STANDBY:
+   if (dev->loopthrough) {
+   ret = regmap_write_bits(dev->regmap,
+   R25_REF, 0xc0, 0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap,
+   R06_POWER2, 0x07, 0x02);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap,
+   R10_LT1, 0x80, 0x00);
+   if (ret)
+   goto err;
+   } else {
+ 

Re: [PATCHv3 1/2] tda18250: support for new silicon tuner

2017-10-29 Thread Olli Salonen
Hello Michael,

Many thanks for taking the time to review the patches.

On 27 October 2017 at 13:27, Michael Ira Krufky  wrote:
>> +static int tda18250_sleep(struct dvb_frontend *fe)
>> +{
>> +   struct i2c_client *client = fe->tuner_priv;
>> +   struct tda18250_dev *dev = i2c_get_clientdata(client);
>> +   int ret;
>> +
>> +   dev_dbg(>dev, "\n");
>> +
>> +   /* power down LNA */
>> +   ret = regmap_write_bits(dev->regmap, R0C_AGC11, 0x80, 0x00);
>> +   if (ret)
>> +   return ret;
>> +
>> +   ret = tda18250_power_control(fe, TDA18250_POWER_STANDBY);
>> +   return ret;
>> +}
>
> Do we know for sure if the IF_FREQUENCY is preserved after returning
> from a sleep?   It might be a good idea to set `dev->if_frequency = 0`
> within `tda18250_sleep` to be sure that it gets set again on the next
> tune, but you may want to check the specification first, if its
> available.
>
> This is not a show-stopper -- We can merge this as-is and this can be
> handled in a follow-up patch.

I will look into this and send a patch on top of this one if needed.

Thank you for pointing it out.

Cheers,
-olli


[PATCHv3 1/2] tda18250: support for new silicon tuner

2017-08-02 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

NXP TDA18250 silicon tuner driver.

Version 3 removes regmap_exit as I was pointed out that device
management code automatically frees the regmap.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/tuners/Kconfig |   7 +
 drivers/media/tuners/Makefile|   1 +
 drivers/media/tuners/tda18250.c  | 921 +++
 drivers/media/tuners/tda18250.h  |  51 ++
 drivers/media/tuners/tda18250_priv.h | 153 ++
 5 files changed, 1133 insertions(+)
 create mode 100644 drivers/media/tuners/tda18250.c
 create mode 100644 drivers/media/tuners/tda18250.h
 create mode 100644 drivers/media/tuners/tda18250_priv.h

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 05998f0..6687514 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -26,6 +26,13 @@ config MEDIA_TUNER_SIMPLE
help
  Say Y here to include support for various simple tuners.
 
+config MEDIA_TUNER_TDA18250
+   tristate "NXP TDA18250 silicon tuner"
+   depends on MEDIA_SUPPORT && I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y here to include support for TDA18250 tuner.
+
 config MEDIA_TUNER_TDA8290
tristate "TDA 8290/8295 + 8275(a)/18271 tuner combo"
depends on MEDIA_SUPPORT && I2C
diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile
index 06a9ab6..4b9444b 100644
--- a/drivers/media/tuners/Makefile
+++ b/drivers/media/tuners/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o
 obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o
 obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o
 obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o
+obj-$(CONFIG_MEDIA_TUNER_TDA18250) += tda18250.o
 
 ccflags-y += -I$(srctree)/drivers/media/dvb-core
 ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
diff --git a/drivers/media/tuners/tda18250.c b/drivers/media/tuners/tda18250.c
new file mode 100644
index 000..3a10bd1
--- /dev/null
+++ b/drivers/media/tuners/tda18250.c
@@ -0,0 +1,921 @@
+/*
+ * NXP TDA18250 silicon tuner driver
+ *
+ * Copyright (C) 2017 Olli Salonen <olli.salo...@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 "tda18250_priv.h"
+#include 
+
+static const struct dvb_tuner_ops tda18250_ops;
+
+static int tda18250_power_control(struct dvb_frontend *fe,
+   unsigned int power_state)
+{
+   struct i2c_client *client = fe->tuner_priv;
+   struct tda18250_dev *dev = i2c_get_clientdata(client);
+   int ret;
+   unsigned int utmp;
+
+   dev_dbg(>dev, "power state: %d", power_state);
+
+   switch (power_state) {
+   case TDA18250_POWER_NORMAL:
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 0x00);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 0xc0);
+   if (ret)
+   goto err;
+   break;
+   case TDA18250_POWER_STANDBY:
+   if (dev->loopthrough) {
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 
0x02);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R10_LT1, 0x80, 
0x00);
+   if (ret)
+   goto err;
+   } else {
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 
0x01);
+   if (ret)
+   goto err;
+   ret = regmap_read(dev->regmap, R0D_AGC12, );
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R0D_AGC12, 0x03, 
0x03);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R10_LT1, 0x80, 
0x80);
+   if (ret)
+

[PATCHv3 2/2] dib0700: add support for Xbox One Digital TV Tuner

2017-08-02 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

Xbox One Digital TV Tuner is a low-cost USB 2.0 multistandard TV tuner. It
supports DVB-T, DVB-T2 and DVB-C broadcast standards.

USB bridge: DibCom 0700C
Demodulator: Panasonic MN88472
Tuner: TDA18250BHN

The demodulator requires firmware. Download one from here:
http://palosaari.fi/linux/v4l-dvb/firmware/MN88472/02/latest/

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-core/dvb-usb-ids.h|   2 +
 drivers/media/usb/dvb-usb/Kconfig   |   2 +
 drivers/media/usb/dvb-usb/dib0700.h |   2 +
 drivers/media/usb/dvb-usb/dib0700_core.c|  26 ++-
 drivers/media/usb/dvb-usb/dib0700_devices.c | 109 +++-
 5 files changed, 139 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index 5b6041d..daf49ec 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -80,6 +80,7 @@
 #define USB_VID_AZUREWAVE  0x13d3
 #define USB_VID_TECHNISAT  0x14f7
 #define USB_VID_HAMA   0x147f
+#define USB_VID_MICROSOFT  0x045e
 
 /* Product IDs */
 #define USB_PID_ADSTECH_USB2_COLD  0xa333
@@ -417,4 +418,5 @@
 #define USB_PID_WINTV_SOLOHD0x0264
 #define USB_PID_EVOLVEO_XTRATV_STICK   0xa115
 #define USB_PID_HAMA_DVBT_HYBRID   0x2758
+#define USB_PID_XBOX_ONE_TUNER  0x02d5
 #endif
diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 959fa09..2651ae2 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -86,6 +86,7 @@ config DVB_USB_DIB0700
select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0090 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
@@ -94,6 +95,7 @@ config DVB_USB_DIB0700
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_XC4000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_TDA18250 if MEDIA_SUBDRV_AUTOSELECT
help
  Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. 
The
  USB bridge is also present in devices having the DiB7700 DVB-T-USB
diff --git a/drivers/media/usb/dvb-usb/dib0700.h 
b/drivers/media/usb/dvb-usb/dib0700.h
index 8fd8f5b..5f29128 100644
--- a/drivers/media/usb/dvb-usb/dib0700.h
+++ b/drivers/media/usb/dvb-usb/dib0700.h
@@ -51,6 +51,8 @@ struct dib0700_state {
int (*read_status)(struct dvb_frontend *, enum fe_status *);
int (*sleep)(struct dvb_frontend* fe);
u8 buf[255];
+   struct i2c_client *i2c_client_demod;
+   struct i2c_client *i2c_client_tuner;
 };
 
 extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c 
b/drivers/media/usb/dvb-usb/dib0700_core.c
index bea1b47..dbd031c 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -911,10 +911,34 @@ static int dib0700_probe(struct usb_interface *intf,
return -ENODEV;
 }
 
+static void dib0700_disconnect(struct usb_interface *intf)
+{
+   struct dvb_usb_device *d = usb_get_intfdata(intf);
+   struct dib0700_state *st = d->priv;
+   struct i2c_client *client;
+
+   /* remove I2C client for tuner */
+   client = st->i2c_client_tuner;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   /* remove I2C client for demodulator */
+   client = st->i2c_client_demod;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   dvb_usb_device_exit(intf);
+}
+
+
 static struct usb_driver dib0700_driver = {
.name   = "dvb_usb_dib0700",
.probe  = dib0700_probe,
-   .disconnect = dvb_usb_device_exit,
+   .disconnect = dib0700_disconnect,
.id_table   = dib0700_usb_id_table,
 };
 
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c 
b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 6a57fc6..7c0fb18 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -23,6 +23,9 @@
 #include "dib0090.h"
 #include "lgdt3305.h"
 #include "mxl5007t.h"
+#include "mn88472.h"
+#include "tda18250.h"
+
 
 static int force_lna_

[PATCHv2 2/2] dib0700: add support for Xbox One Digital TV Tuner

2017-08-01 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

Xbox One Digital TV Tuner is a low-cost USB 2.0 multistandard TV tuner. It
supports DVB-T, DVB-T2 and DVB-C broadcast standards.

USB bridge: DibCom 0700C
Demodulator: Panasonic MN88472
Tuner: TDA18250BHN

The demodulator requires firmware. Download one from here:
http://palosaari.fi/linux/v4l-dvb/firmware/MN88472/02/latest/

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-core/dvb-usb-ids.h|   2 +
 drivers/media/usb/dvb-usb/Kconfig   |   2 +
 drivers/media/usb/dvb-usb/dib0700.h |   2 +
 drivers/media/usb/dvb-usb/dib0700_core.c|  26 ++-
 drivers/media/usb/dvb-usb/dib0700_devices.c | 109 +++-
 5 files changed, 139 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index 5b6041d..daf49ec 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -80,6 +80,7 @@
 #define USB_VID_AZUREWAVE  0x13d3
 #define USB_VID_TECHNISAT  0x14f7
 #define USB_VID_HAMA   0x147f
+#define USB_VID_MICROSOFT  0x045e
 
 /* Product IDs */
 #define USB_PID_ADSTECH_USB2_COLD  0xa333
@@ -417,4 +418,5 @@
 #define USB_PID_WINTV_SOLOHD0x0264
 #define USB_PID_EVOLVEO_XTRATV_STICK   0xa115
 #define USB_PID_HAMA_DVBT_HYBRID   0x2758
+#define USB_PID_XBOX_ONE_TUNER  0x02d5
 #endif
diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 959fa09..2651ae2 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -86,6 +86,7 @@ config DVB_USB_DIB0700
select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0090 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
@@ -94,6 +95,7 @@ config DVB_USB_DIB0700
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_XC4000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_TDA18250 if MEDIA_SUBDRV_AUTOSELECT
help
  Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. 
The
  USB bridge is also present in devices having the DiB7700 DVB-T-USB
diff --git a/drivers/media/usb/dvb-usb/dib0700.h 
b/drivers/media/usb/dvb-usb/dib0700.h
index 8fd8f5b..5f29128 100644
--- a/drivers/media/usb/dvb-usb/dib0700.h
+++ b/drivers/media/usb/dvb-usb/dib0700.h
@@ -51,6 +51,8 @@ struct dib0700_state {
int (*read_status)(struct dvb_frontend *, enum fe_status *);
int (*sleep)(struct dvb_frontend* fe);
u8 buf[255];
+   struct i2c_client *i2c_client_demod;
+   struct i2c_client *i2c_client_tuner;
 };
 
 extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c 
b/drivers/media/usb/dvb-usb/dib0700_core.c
index bea1b47..dbd031c 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -911,10 +911,34 @@ static int dib0700_probe(struct usb_interface *intf,
return -ENODEV;
 }
 
+static void dib0700_disconnect(struct usb_interface *intf)
+{
+   struct dvb_usb_device *d = usb_get_intfdata(intf);
+   struct dib0700_state *st = d->priv;
+   struct i2c_client *client;
+
+   /* remove I2C client for tuner */
+   client = st->i2c_client_tuner;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   /* remove I2C client for demodulator */
+   client = st->i2c_client_demod;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   dvb_usb_device_exit(intf);
+}
+
+
 static struct usb_driver dib0700_driver = {
.name   = "dvb_usb_dib0700",
.probe  = dib0700_probe,
-   .disconnect = dvb_usb_device_exit,
+   .disconnect = dib0700_disconnect,
.id_table   = dib0700_usb_id_table,
 };
 
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c 
b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 6a57fc6..7c0fb18 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -23,6 +23,9 @@
 #include "dib0090.h"
 #include "lgdt3305.h"
 #include "mxl5007t.h"
+#include "mn88472.h"
+#include "tda18250.h"
+
 
 static int force_lna_

[PATCHv2 1/2] tda18250: support for new silicon tuner

2017-08-01 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

NXP TDA18250 silicon tuner driver.

Version 2 adds media controller support and does regmap_exit at exit.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/tuners/Kconfig |   7 +
 drivers/media/tuners/Makefile|   1 +
 drivers/media/tuners/tda18250.c  | 924 +++
 drivers/media/tuners/tda18250.h  |  51 ++
 drivers/media/tuners/tda18250_priv.h | 153 ++
 5 files changed, 1136 insertions(+)
 create mode 100644 drivers/media/tuners/tda18250.c
 create mode 100644 drivers/media/tuners/tda18250.h
 create mode 100644 drivers/media/tuners/tda18250_priv.h

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 05998f0..6687514 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -26,6 +26,13 @@ config MEDIA_TUNER_SIMPLE
help
  Say Y here to include support for various simple tuners.
 
+config MEDIA_TUNER_TDA18250
+   tristate "NXP TDA18250 silicon tuner"
+   depends on MEDIA_SUPPORT && I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y here to include support for TDA18250 tuner.
+
 config MEDIA_TUNER_TDA8290
tristate "TDA 8290/8295 + 8275(a)/18271 tuner combo"
depends on MEDIA_SUPPORT && I2C
diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile
index 06a9ab6..4b9444b 100644
--- a/drivers/media/tuners/Makefile
+++ b/drivers/media/tuners/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o
 obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o
 obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o
 obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o
+obj-$(CONFIG_MEDIA_TUNER_TDA18250) += tda18250.o
 
 ccflags-y += -I$(srctree)/drivers/media/dvb-core
 ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
diff --git a/drivers/media/tuners/tda18250.c b/drivers/media/tuners/tda18250.c
new file mode 100644
index 000..201e1c1
--- /dev/null
+++ b/drivers/media/tuners/tda18250.c
@@ -0,0 +1,924 @@
+/*
+ * NXP TDA18250 silicon tuner driver
+ *
+ * Copyright (C) 2017 Olli Salonen <olli.salo...@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 "tda18250_priv.h"
+#include 
+
+static const struct dvb_tuner_ops tda18250_ops;
+
+static int tda18250_power_control(struct dvb_frontend *fe,
+   unsigned int power_state)
+{
+   struct i2c_client *client = fe->tuner_priv;
+   struct tda18250_dev *dev = i2c_get_clientdata(client);
+   int ret;
+   unsigned int utmp;
+
+   dev_dbg(>dev, "power state: %d", power_state);
+
+   switch (power_state) {
+   case TDA18250_POWER_NORMAL:
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 0x00);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 0xc0);
+   if (ret)
+   goto err;
+   break;
+   case TDA18250_POWER_STANDBY:
+   if (dev->loopthrough) {
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 
0x02);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R10_LT1, 0x80, 
0x00);
+   if (ret)
+   goto err;
+   } else {
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 
0x01);
+   if (ret)
+   goto err;
+   ret = regmap_read(dev->regmap, R0D_AGC12, );
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R0D_AGC12, 0x03, 
0x03);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R10_LT1, 0x80, 
0x80);
+   if (ret)
+  

[PATCH 1/2] tda18250: support for new silicon tuner

2017-07-31 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

NXP TDA18250 silicon tuner driver.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/tuners/Kconfig |   7 +
 drivers/media/tuners/Makefile|   1 +
 drivers/media/tuners/tda18250.c  | 890 +++
 drivers/media/tuners/tda18250.h  |  51 ++
 drivers/media/tuners/tda18250_priv.h | 145 ++
 5 files changed, 1094 insertions(+)
 create mode 100644 drivers/media/tuners/tda18250.c
 create mode 100644 drivers/media/tuners/tda18250.h
 create mode 100644 drivers/media/tuners/tda18250_priv.h

diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 05998f0..6687514 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -26,6 +26,13 @@ config MEDIA_TUNER_SIMPLE
help
  Say Y here to include support for various simple tuners.
 
+config MEDIA_TUNER_TDA18250
+   tristate "NXP TDA18250 silicon tuner"
+   depends on MEDIA_SUPPORT && I2C
+   default m if !MEDIA_SUBDRV_AUTOSELECT
+   help
+ Say Y here to include support for TDA18250 tuner.
+
 config MEDIA_TUNER_TDA8290
tristate "TDA 8290/8295 + 8275(a)/18271 tuner combo"
depends on MEDIA_SUPPORT && I2C
diff --git a/drivers/media/tuners/Makefile b/drivers/media/tuners/Makefile
index 06a9ab6..4b9444b 100644
--- a/drivers/media/tuners/Makefile
+++ b/drivers/media/tuners/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_MEDIA_TUNER_R820T) += r820t.o
 obj-$(CONFIG_MEDIA_TUNER_MXL301RF) += mxl301rf.o
 obj-$(CONFIG_MEDIA_TUNER_QM1D1C0042) += qm1d1c0042.o
 obj-$(CONFIG_MEDIA_TUNER_M88RS6000T) += m88rs6000t.o
+obj-$(CONFIG_MEDIA_TUNER_TDA18250) += tda18250.o
 
 ccflags-y += -I$(srctree)/drivers/media/dvb-core
 ccflags-y += -I$(srctree)/drivers/media/dvb-frontends
diff --git a/drivers/media/tuners/tda18250.c b/drivers/media/tuners/tda18250.c
new file mode 100644
index 000..21180f4
--- /dev/null
+++ b/drivers/media/tuners/tda18250.c
@@ -0,0 +1,890 @@
+/*
+ * NXP TDA18250 silicon tuner driver
+ *
+ * Copyright (C) 2017 Olli Salonen <olli.salo...@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 "tda18250_priv.h"
+#include 
+
+static const struct dvb_tuner_ops tda18250_ops;
+
+static int tda18250_power_control(struct dvb_frontend *fe,
+   unsigned int power_state)
+{
+   struct i2c_client *client = fe->tuner_priv;
+   struct tda18250_dev *dev = i2c_get_clientdata(client);
+   int ret;
+   unsigned int utmp;
+
+   dev_dbg(>dev, "power state: %d", power_state);
+
+   switch (power_state) {
+   case TDA18250_POWER_NORMAL:
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 0x00);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 0xc0);
+   if (ret)
+   goto err;
+   break;
+   case TDA18250_POWER_STANDBY:
+   if (dev->loopthrough) {
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 
0x02);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R10_LT1, 0x80, 
0x00);
+   if (ret)
+   goto err;
+   } else {
+   ret = regmap_write_bits(dev->regmap, R25_REF, 0xc0, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R06_POWER2, 0x07, 
0x01);
+   if (ret)
+   goto err;
+   ret = regmap_read(dev->regmap, R0D_AGC12, );
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R0D_AGC12, 0x03, 
0x03);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev->regmap, R10_LT1, 0x80, 
0x80);
+   if (ret)
+   goto err;
+   ret = regmap_write_bits(dev-&

[PATCH 2/2] dib0700: add support for Xbox One Digital TV Tuner

2017-07-31 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

Xbox One Digital TV Tuner is a low-cost USB 2.0 multistandard TV tuner. It 
supports DVB-T, DVB-T2 and DVB-C broadcast standards.

USB bridge: DibCom 0700C
Demodulator: Panasonic MN88472
Tuner: TDA18250BHN

The demodulator requires firmware. Download one from here: 
http://palosaari.fi/linux/v4l-dvb/firmware/MN88472/02/latest/

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-core/dvb-usb-ids.h|   2 +
 drivers/media/usb/dvb-usb/Kconfig   |   2 +
 drivers/media/usb/dvb-usb/dib0700.h |   2 +
 drivers/media/usb/dvb-usb/dib0700_core.c|  26 ++-
 drivers/media/usb/dvb-usb/dib0700_devices.c | 109 +++-
 5 files changed, 139 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index 5b6041d..daf49ec 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -80,6 +80,7 @@
 #define USB_VID_AZUREWAVE  0x13d3
 #define USB_VID_TECHNISAT  0x14f7
 #define USB_VID_HAMA   0x147f
+#define USB_VID_MICROSOFT  0x045e
 
 /* Product IDs */
 #define USB_PID_ADSTECH_USB2_COLD  0xa333
@@ -417,4 +418,5 @@
 #define USB_PID_WINTV_SOLOHD0x0264
 #define USB_PID_EVOLVEO_XTRATV_STICK   0xa115
 #define USB_PID_HAMA_DVBT_HYBRID   0x2758
+#define USB_PID_XBOX_ONE_TUNER  0x02d5
 #endif
diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 959fa09..2651ae2 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -86,6 +86,7 @@ config DVB_USB_DIB0700
select DVB_USB_DIB3000MC if MEDIA_SUBDRV_AUTOSELECT
select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT
select DVB_LGDT3305 if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0070 if MEDIA_SUBDRV_AUTOSELECT
select DVB_TUNER_DIB0090 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
@@ -94,6 +95,7 @@ config DVB_USB_DIB0700
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_XC4000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5007T if MEDIA_SUBDRV_AUTOSELECT
+   select MEDIA_TUNER_TDA18250 if MEDIA_SUBDRV_AUTOSELECT
help
  Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. 
The
  USB bridge is also present in devices having the DiB7700 DVB-T-USB
diff --git a/drivers/media/usb/dvb-usb/dib0700.h 
b/drivers/media/usb/dvb-usb/dib0700.h
index 8fd8f5b..5f29128 100644
--- a/drivers/media/usb/dvb-usb/dib0700.h
+++ b/drivers/media/usb/dvb-usb/dib0700.h
@@ -51,6 +51,8 @@ struct dib0700_state {
int (*read_status)(struct dvb_frontend *, enum fe_status *);
int (*sleep)(struct dvb_frontend* fe);
u8 buf[255];
+   struct i2c_client *i2c_client_demod;
+   struct i2c_client *i2c_client_tuner;
 };
 
 extern int dib0700_get_version(struct dvb_usb_device *d, u32 *hwversion,
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c 
b/drivers/media/usb/dvb-usb/dib0700_core.c
index bea1b47..dbd031c 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -911,10 +911,34 @@ static int dib0700_probe(struct usb_interface *intf,
return -ENODEV;
 }
 
+static void dib0700_disconnect(struct usb_interface *intf)
+{
+   struct dvb_usb_device *d = usb_get_intfdata(intf);
+   struct dib0700_state *st = d->priv;
+   struct i2c_client *client;
+
+   /* remove I2C client for tuner */
+   client = st->i2c_client_tuner;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   /* remove I2C client for demodulator */
+   client = st->i2c_client_demod;
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   dvb_usb_device_exit(intf);
+}
+
+
 static struct usb_driver dib0700_driver = {
.name   = "dvb_usb_dib0700",
.probe  = dib0700_probe,
-   .disconnect = dvb_usb_device_exit,
+   .disconnect = dib0700_disconnect,
.id_table   = dib0700_usb_id_table,
 };
 
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c 
b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 6a57fc6..7c0fb18 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -23,6 +23,9 @@
 #include "dib0090.h"
 #include "lgdt3305.h"
 #include "mxl5007t.h"
+#include "mn88472.h"
+#include "tda18250.h"
+
 
 static int force_lna_

[PATCH 1/2] mn88472: reset stream ID reg if no PLP given

2017-07-30 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the 
PLP register. Set PLP to 0 instead.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-frontends/mn88472.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/mn88472.c 
b/drivers/media/dvb-frontends/mn88472.c
index f6938f96..5e8fd63 100644
--- a/drivers/media/dvb-frontends/mn88472.c
+++ b/drivers/media/dvb-frontends/mn88472.c
@@ -377,7 +377,9 @@ static int mn88472_set_frontend(struct dvb_frontend *fe)
ret = regmap_write(dev->regmap[1], 0xf6, 0x05);
if (ret)
goto err;
-   ret = regmap_write(dev->regmap[2], 0x32, c->stream_id);
+   ret = regmap_write(dev->regmap[2], 0x32,
+   (c->stream_id == NO_STREAM_ID_FILTER) ? 0 :
+   c->stream_id );
if (ret)
goto err;
break;
-- 
2.7.4



[PATCH 2/2] mn88473: reset stream ID reg if no PLP given

2017-07-30 Thread olli . salonen
From: Olli Salonen <olli.salo...@iki.fi>

If the PLP given is NO_STREAM_ID_FILTER (~0u) don't try to set that into the 
PLP register. Set PLP to 0 instead.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-frontends/mn88473.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-frontends/mn88473.c 
b/drivers/media/dvb-frontends/mn88473.c
index 1587424..5824743 100644
--- a/drivers/media/dvb-frontends/mn88473.c
+++ b/drivers/media/dvb-frontends/mn88473.c
@@ -225,7 +225,9 @@ static int mn88473_set_frontend(struct dvb_frontend *fe)
 
/* PLP */
if (c->delivery_system == SYS_DVBT2) {
-   ret = regmap_write(dev->regmap[2], 0x36, c->stream_id);
+   ret = regmap_write(dev->regmap[2], 0x36,
+   (c->stream_id == NO_STREAM_ID_FILTER) ? 0 :
+   c->stream_id );
if (ret)
goto err;
}
-- 
2.7.4



media_build: fails to install

2017-05-30 Thread Olli Salonen
It seems that I'm able to build the media_build correctly on Ubuntu
16.04.2 with kernel 4.8, but make install fails:

~/src/media_build$ sudo make install
make -C /home/olli/src/media_build/v4l install
make[1]: Entering directory '/home/olli/src/media_build/v4l'
make[1]: *** No rule to make target 'media-install', needed by 'install'.  Stop.
make[1]: Leaving directory '/home/olli/src/media_build/v4l'
Makefile:15: recipe for target 'install' failed
make: *** [install] Error 2

Full console log here:
http://paste.ubuntu.com/24720478/

Cheers,
-olli


[PATCH] dvb-scan-tables: updated Digita frequencies for Finland

2017-04-08 Thread Olli Salonen
In summer 2016 some DVB-T/DVB-T2 frequencies were changed by the broadcaster 
Digita. Here are some that have already changed.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 dvb-t/fi-Espoo  |  6 +++---
 dvb-t/fi-Fiskars|  4 ++--
 dvb-t/fi-Kustavi_Viherlahti |  8 
 dvb-t/fi-Lahti  |  8 
 dvb-t/fi-Salo_Isokyla   |  6 +++---
 dvb-t/fi-Tampere|  8 
 dvb-t/fi-Tampere_Pyynikki   |  6 +++---
 dvb-t/fi-Turku  | 12 ++--
 8 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/dvb-t/fi-Espoo b/dvb-t/fi-Espoo
index ceb906d..6fb0ff2 100644
--- a/dvb-t/fi-Espoo
+++ b/dvb-t/fi-Espoo
@@ -18,16 +18,16 @@
 
 [Espoo-E]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 73000
+   FREQUENCY = 51400
BANDWIDTH_HZ = 800
 
 [Espoo-D]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 58600
+   FREQUENCY = 65000
BANDWIDTH_HZ = 800
 
 [Espoo-H]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 51400
+   FREQUENCY = 61800
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Fiskars b/dvb-t/fi-Fiskars
index 0f84bb7..2b6b791 100644
--- a/dvb-t/fi-Fiskars
+++ b/dvb-t/fi-Fiskars
@@ -8,7 +8,7 @@
 
 [Fiskars]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 65800
+   FREQUENCY = 49800
BANDWIDTH_HZ = 800
 
 [Fiskars]
@@ -18,6 +18,6 @@
 
 [Fiskars]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 77000
+   FREQUENCY = 49000
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Kustavi_Viherlahti b/dvb-t/fi-Kustavi_Viherlahti
index ecef74d..9840401 100644
--- a/dvb-t/fi-Kustavi_Viherlahti
+++ b/dvb-t/fi-Kustavi_Viherlahti
@@ -3,21 +3,21 @@
 
 [Kustavi_Viherlahti]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 71400
+   FREQUENCY = 53800
BANDWIDTH_HZ = 800
 
 [Kustavi_Viherlahti]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 73800
+   FREQUENCY = 65800
BANDWIDTH_HZ = 800
 
 [Kustavi_Viherlahti]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 76200
+   FREQUENCY = 68200
BANDWIDTH_HZ = 800
 
 [Kustavi_Viherlahti]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 78600
+   FREQUENCY = 63400
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Lahti b/dvb-t/fi-Lahti
index f4c89b8..ea4163c 100644
--- a/dvb-t/fi-Lahti
+++ b/dvb-t/fi-Lahti
@@ -13,21 +13,21 @@
 
 [Lahti-C]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 76200
+   FREQUENCY = 62600
BANDWIDTH_HZ = 800
 
 [Lahti-E]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 71400
+   FREQUENCY = 69000
BANDWIDTH_HZ = 800
 
 [Lahti-D]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 62600
+   FREQUENCY = 60200
BANDWIDTH_HZ = 800
 
 [Lahti-H]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 69000
+   FREQUENCY = 64200
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Salo_Isokyla b/dvb-t/fi-Salo_Isokyla
index 42df3b4..0cf08b8 100644
--- a/dvb-t/fi-Salo_Isokyla
+++ b/dvb-t/fi-Salo_Isokyla
@@ -3,7 +3,7 @@
 
 [Salo_Isokyla]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 51400
+   FREQUENCY = 61000
BANDWIDTH_HZ = 800
 
 [Salo_Isokyla]
@@ -13,11 +13,11 @@
 
 [Salo_Isokyla]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 68200
+   FREQUENCY = 53000
BANDWIDTH_HZ = 800
 
 [Salo_Isokyla]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 57000
+   FREQUENCY = 69000
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Tampere b/dvb-t/fi-Tampere
index 27cf3a7..33d40c4 100644
--- a/dvb-t/fi-Tampere
+++ b/dvb-t/fi-Tampere
@@ -13,21 +13,21 @@
 
 [Tampere-C]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 77000
+   FREQUENCY = 65800
BANDWIDTH_HZ = 800
 
 [Tampere-E]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 77800
+   FREQUENCY = 67400
BANDWIDTH_HZ = 800
 
 [Tampere-D]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 64200
+   FREQUENCY = 65000
BANDWIDTH_HZ = 800
 
 [Tampere-H]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 67400
+   FREQUENCY = 49800
BANDWIDTH_HZ = 800
 
diff --git a/dvb-t/fi-Tampere_Pyynikki b/dvb-t/fi-Tampere_Pyynikki
index 03e8ecc..1da6662 100644
--- a/dvb-t/fi-Tampere_Pyynikki
+++ b/dvb-t/fi-Tampere_Pyynikki
@@ -8,7 +8,7 @@
 
 [Tampere_Pyynikki]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 65800
+   FREQUENCY = 51400
BANDWIDTH_HZ = 800
 
 [Tampere_Pyynikki]
@@ -18,11 +18,11 @@
 
 [Tampere_Pyynikki]
DELIVERY_SYSTEM = DVBT
-   FREQUENCY = 58600
+   FREQUENCY = 61000
BANDWIDTH_HZ = 800
 
 [Tampere_Pyynikki]
DELIVERY_SYSTEM = DVBT2
-   FREQUENCY = 64200
+   FREQUENCY = 56200
BANDWIDTH_HZ = 800

Re: em28xx WinTV dualHD in Raspbian

2016-10-23 Thread Olli Salonen
Hi Andrey,

When I submitted the original patch to add support for this device I
stated that it only supports the first tuner. The em28xx driver is not
built with dual-tuner support in mind and I had not enough interest to
start changing it (the driver supports like 100 devices and is quite
massive). There should not be many issues in using the second tuner
itself on this device, it's just another I2C bus...

Cheers,
-olli


On 23 October 2016 at 13:03, Andrey Utkin  wrote:
> On Sat, Oct 22, 2016 at 07:36:13PM +0200, ps0...@yahoo.de wrote:
>> Hopefully some driver expert can get the second tuner working, that would be
>> awesome
>
> What's the problem? I don't see it described in this discussion thread.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] dvb-usb-dvbsky: Add support for TechnoTrend S2-4650 CI

2016-09-09 Thread Olli Salonen
TechnoTrend TT-connect S2-4650 CI seems to be a variation of
the DVBSky S960CI device.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-core/dvb-usb-ids.h  | 1 +
 drivers/media/usb/dvb-usb-v2/dvbsky.c | 4 
 2 files changed, 5 insertions(+)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index a7a4674..a52c5c7 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -262,6 +262,7 @@
 #define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI0x3012
 #define USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI_2  0x3015
 #define USB_PID_TECHNOTREND_TVSTICK_CT2_4400   0x3014
+#define USB_PID_TECHNOTREND_CONNECT_S2_4650_CI 0x3017
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY   0x005a
 #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY_2 0x0081
 #define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058
diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c 
b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 02dbc6c..0636eac 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -851,6 +851,10 @@ static const struct usb_device_id dvbsky_id_table[] = {
USB_PID_TECHNOTREND_CONNECT_CT2_4650_CI_2,
_t680c_props, "TechnoTrend TT-connect CT2-4650 CI v1.1",
RC_MAP_TT_1500) },
+   { DVB_USB_DEVICE(USB_VID_TECHNOTREND,
+   USB_PID_TECHNOTREND_CONNECT_S2_4650_CI,
+   _s960c_props, "TechnoTrend TT-connect S2-4650 CI",
+   RC_MAP_TT_1500) },
{ DVB_USB_DEVICE(USB_VID_TERRATEC,
USB_PID_TERRATEC_H7_3,
_t680c_props, "Terratec H7 Rev.4",
-- 
2.7.4

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


Re: [PATCH] [media] dw2102: Add support for Terratec Cinergy S2 USB BOX

2016-07-16 Thread Olli Salonen
Hi guys,

It seems Philipp added the support for this device in dw2102 driver
and Benjamin did that for the dvbsky driver a bit earlier.

# grep -i 0ccdp0105 /lib/modules/$(uname -r)/modules.alias
alias usb:v0CCDp0105d*dc*dsc*dp*ic*isc*ip*in* dvb_usb_dvbsky
alias usb:v0CCDp0105d*dc*dsc*dp*ic*isc*ip*in* dvb_usb_dw2102

Any suggestions on how to resolve this conflict?

Cheers,
-olli

On 4 January 2016 at 20:32, Philipp Zabel  wrote:
> The Terratec Cinergy S2 USB BOX uses a Montage M88TS2022 tuner
> and a M88DS3103 demodulator, same as Technotrend TT-connect S2-4600.
> This patch adds the missing USB Product ID to make it work.
>
> Signed-off-by: Philipp Zabel 
> ---
>  drivers/media/usb/dvb-usb/dw2102.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
> b/drivers/media/usb/dvb-usb/dw2102.c
> index 14ef25d..9d18801 100644
> --- a/drivers/media/usb/dvb-usb/dw2102.c
> +++ b/drivers/media/usb/dvb-usb/dw2102.c
> @@ -1688,6 +1688,7 @@ enum dw2102_table_entry {
> TECHNOTREND_S2_4600,
> TEVII_S482_1,
> TEVII_S482_2,
> +   TERRATEC_CINERGY_S2_BOX,
>  };
>
>  static struct usb_device_id dw2102_table[] = {
> @@ -1715,6 +1716,7 @@ static struct usb_device_id dw2102_table[] = {
> USB_PID_TECHNOTREND_CONNECT_S2_4600)},
> [TEVII_S482_1] = {USB_DEVICE(0x9022, 0xd483)},
> [TEVII_S482_2] = {USB_DEVICE(0x9022, 0xd484)},
> +   [TERRATEC_CINERGY_S2_BOX] = {USB_DEVICE(USB_VID_TERRATEC, 0x0105)},
> { }
>  };
>
> @@ -2232,7 +2234,7 @@ static struct dvb_usb_device_properties 
> tt_s2_4600_properties = {
> } },
> }
> },
> -   .num_device_descs = 3,
> +   .num_device_descs = 4,
> .devices = {
> { "TechnoTrend TT-connect S2-4600",
> { _table[TECHNOTREND_S2_4600], NULL },
> @@ -2246,6 +2248,10 @@ static struct dvb_usb_device_properties 
> tt_s2_4600_properties = {
> { _table[TEVII_S482_2], NULL },
> { NULL },
> },
> +   { "Terratec Cinergy S2 USB BOX",
> +   { _table[TERRATEC_CINERGY_S2_BOX], NULL },
> +   { NULL },
> +   },
> }
>  };
>
> --
> 2.6.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: si2157 driver

2016-06-28 Thread Olli Salonen
Hi Oleg,

Correct, only digital TV is supported currently by the driver.

Cheers,
-olli

On 28 June 2016 at 23:22, Oleh Kravchenko  wrote:
> Hello linux media developers!
>
> I try add support for usb hybrid tuner, it based on:
> CX23102-112, Si2158, Si2168
>
> I updated cx231xx-cards.c with valid ids, but I don't have idea how to
> use Si2158.
> It is not listed in tuner-types.c
>
> Why si2157.c is absent in tuner-types.c?
> Or at the current state si2157.c don't have analog support?
> --
> 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: dvb usb stick Hauppauge WinTV-soloHD

2016-06-22 Thread Olli Salonen
Hi Thomas,

I made some more investigation and figured out that you have a DVB-T2
mux at 642 MHz in Berlin, and can also see that your w_scan actually
locks on that DVB-T2 mux as you wrote. Sorry, I did not read properly
what you were saying in the beginning.

Then it should be just a question of finding software that will work
with your DVB-T2 channels as well. I've got no experience of VLC, but
as far as I have understood it should support DVB-T2 as well. I've
used dvbv5-zap and tvheadend with good success, but there are many
others as well. Basically it is important the software implements the
version 5 of the DVB API (DVBv5) instead of the older version 3.

Cheers,
-olli



On 22 June 2016 at 22:10, Olli Salonen <olli.salo...@iki.fi> wrote:
> Hi Thomas,
>
> Ok, the correct firmwares are there:
> [  101.423697] si2168 11-0064: found a 'Silicon Labs Si2168-B40'
> [  101.428693] si2168 11-0064: downloading firmware from file
> 'dvb-demod-si2168-b40-01.fw'
> [  101.657999] si2168 11-0064: firmware version: 4.0.11
> [  101.661225] si2157 12-0060: found a 'Silicon Labs Si2157-A30'
> [  101.709738] si2157 12-0060: firmware version: 3.0.5
>
> Basically everything looks good. Does this work on a Windows computer
> using the same antenna cable and the same USB tuner?
>
> DVB-T2 support in w_scan has been evolving also, so make sure you've
> got quite recent version.
>
> I've found that dvbv5-scan does the best job when scanning for
> channels. However that needs initial scan table to start with. The
> initial scan tables for Berlin don't seem to contain any DVB-T2 muxes
> though: https://git.linuxtv.org/dtv-scan-tables.git/tree/dvb-t/de-Berlin
> This means they're probably a bit out  of date. If you know the DVB-T2
> mux details, you can add them yourself and try dvbv5-scan.
>
> Cheers,
> -olli
>
> On 18 June 2016 at 20:17, Thomas Stein <himbe...@meine-oma.de> wrote:
>> Hi Olli.
>>
>> Thanks for your answer.
>>
>> Here we go.
>>
>> [0.00] Linux version 4.6.2 (root@rather) (gcc version 5.3.0 (Gentoo
>> 5.3.0 p1.0, pie-0.6.5) ) #3 SMP Sat Jun 18 13:34:40 CEST 2016
>> [0.00] Command line: BOOT_IMAGE=/kernel-4.6.2 root=/dev/sda3 ro
>> net.ifnames=0
>> [0.00] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
>> [0.00] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point
>> registers'
>> [0.00] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
>> [0.00] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
>> [0.00] x86/fpu: Enabled xstate features 0x7, context size is 832
>> bytes, using 'standard' format.
>> [0.00] x86/fpu: Using 'eager' FPU context switches.
>> [0.00] e820: BIOS-provided physical RAM map:
>> [0.00] BIOS-e820: [mem 0x-0x0009cfff] usable
>> [0.00] BIOS-e820: [mem 0x0009d000-0x0009]
>> reserved
>> [0.00] BIOS-e820: [mem 0x000e-0x000f]
>> reserved
>> [0.00] BIOS-e820: [mem 0x0010-0xce20] usable
>> [0.00] BIOS-e820: [mem 0xce21-0xdcd3efff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xdcd3f000-0xdce7efff] ACPI
>> NVS
>> [0.00] BIOS-e820: [mem 0xdce7f000-0xdcefefff] ACPI
>> data
>> [0.00] BIOS-e820: [mem 0xdceff000-0xdfa0]
>> reserved
>> [0.00] BIOS-e820: [mem 0xf800-0xfbff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xfe101000-0xfe112fff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xfec0-0xfec00fff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xfed08000-0xfed08fff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xfed1-0xfed19fff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xfed1c000-0xfed1]
>> reserved
>> [0.00] BIOS-e820: [mem 0xfee0-0xfee00fff]
>> reserved
>> [0.00] BIOS-e820: [mem 0xffc0-0x]
>> reserved
>> [0.00] BIOS-e820: [mem 0x0001-0x00021f5f] usable
>> [0.00] NX (Execute Disable) protection: active
>> [0.00] SMBIOS 2.7 present.
>> [0.00] DMI: LENOVO 20A7005MGE/20A7005MGE, BIOS GRET46WW (1.23 )
>> 11/04/2015
>> [0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
>> [0.00] e820: remove [mem 0x000a-0x000f] usable
>> [0.00] e820: last_pfn = 0x21f600 max_arch_pfn 

Re: dvb usb stick Hauppauge WinTV-soloHD

2016-06-22 Thread Olli Salonen
Hi Thomas,

Ok, the correct firmwares are there:
[  101.423697] si2168 11-0064: found a 'Silicon Labs Si2168-B40'
[  101.428693] si2168 11-0064: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[  101.657999] si2168 11-0064: firmware version: 4.0.11
[  101.661225] si2157 12-0060: found a 'Silicon Labs Si2157-A30'
[  101.709738] si2157 12-0060: firmware version: 3.0.5

Basically everything looks good. Does this work on a Windows computer
using the same antenna cable and the same USB tuner?

DVB-T2 support in w_scan has been evolving also, so make sure you've
got quite recent version.

I've found that dvbv5-scan does the best job when scanning for
channels. However that needs initial scan table to start with. The
initial scan tables for Berlin don't seem to contain any DVB-T2 muxes
though: https://git.linuxtv.org/dtv-scan-tables.git/tree/dvb-t/de-Berlin
This means they're probably a bit out  of date. If you know the DVB-T2
mux details, you can add them yourself and try dvbv5-scan.

Cheers,
-olli

On 18 June 2016 at 20:17, Thomas Stein  wrote:
> Hi Olli.
>
> Thanks for your answer.
>
> Here we go.
>
> [0.00] Linux version 4.6.2 (root@rather) (gcc version 5.3.0 (Gentoo
> 5.3.0 p1.0, pie-0.6.5) ) #3 SMP Sat Jun 18 13:34:40 CEST 2016
> [0.00] Command line: BOOT_IMAGE=/kernel-4.6.2 root=/dev/sda3 ro
> net.ifnames=0
> [0.00] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
> [0.00] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point
> registers'
> [0.00] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
> [0.00] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
> [0.00] x86/fpu: Enabled xstate features 0x7, context size is 832
> bytes, using 'standard' format.
> [0.00] x86/fpu: Using 'eager' FPU context switches.
> [0.00] e820: BIOS-provided physical RAM map:
> [0.00] BIOS-e820: [mem 0x-0x0009cfff] usable
> [0.00] BIOS-e820: [mem 0x0009d000-0x0009]
> reserved
> [0.00] BIOS-e820: [mem 0x000e-0x000f]
> reserved
> [0.00] BIOS-e820: [mem 0x0010-0xce20] usable
> [0.00] BIOS-e820: [mem 0xce21-0xdcd3efff]
> reserved
> [0.00] BIOS-e820: [mem 0xdcd3f000-0xdce7efff] ACPI
> NVS
> [0.00] BIOS-e820: [mem 0xdce7f000-0xdcefefff] ACPI
> data
> [0.00] BIOS-e820: [mem 0xdceff000-0xdfa0]
> reserved
> [0.00] BIOS-e820: [mem 0xf800-0xfbff]
> reserved
> [0.00] BIOS-e820: [mem 0xfe101000-0xfe112fff]
> reserved
> [0.00] BIOS-e820: [mem 0xfec0-0xfec00fff]
> reserved
> [0.00] BIOS-e820: [mem 0xfed08000-0xfed08fff]
> reserved
> [0.00] BIOS-e820: [mem 0xfed1-0xfed19fff]
> reserved
> [0.00] BIOS-e820: [mem 0xfed1c000-0xfed1]
> reserved
> [0.00] BIOS-e820: [mem 0xfee0-0xfee00fff]
> reserved
> [0.00] BIOS-e820: [mem 0xffc0-0x]
> reserved
> [0.00] BIOS-e820: [mem 0x0001-0x00021f5f] usable
> [0.00] NX (Execute Disable) protection: active
> [0.00] SMBIOS 2.7 present.
> [0.00] DMI: LENOVO 20A7005MGE/20A7005MGE, BIOS GRET46WW (1.23 )
> 11/04/2015
> [0.00] e820: update [mem 0x-0x0fff] usable ==> reserved
> [0.00] e820: remove [mem 0x000a-0x000f] usable
> [0.00] e820: last_pfn = 0x21f600 max_arch_pfn = 0x4
> [0.00] MTRR default type: write-back
> [0.00] MTRR fixed ranges enabled:
> [0.00]   0-9 write-back
> [0.00]   A-B uncachable
> [0.00]   C-F write-protect
> [0.00] MTRR variable ranges enabled:
> [0.00]   0 base 00E000 mask 7FE000 uncachable
> [0.00]   1 base 00DE00 mask 7FFE00 uncachable
> [0.00]   2 base 00DD00 mask 7FFF00 uncachable
> [0.00]   3 base 00DCF0 mask 70 uncachable
> [0.00]   4 disabled
> [0.00]   5 disabled
> [0.00]   6 disabled
> [0.00]   7 disabled
> [0.00]   8 disabled
> [0.00]   9 disabled
> [0.00] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT
> [0.00] e820: last_pfn = 0xce210 max_arch_pfn = 0x4
> [0.00] found SMP MP-table at [mem 0x000f0100-0x000f010f] mapped at
> [880f0100]
> [0.00] Scanning 1 areas for low memory corruption
> [0.00] Base memory trampoline at [88097000] 97000 size 24576
> [0.00] Using GB pages for direct mapping
> [0.00] BRK [0x02101000, 0x02101fff] PGTABLE
> [0.00] BRK [0x02102000, 0x02102fff] PGTABLE
> [0.00] BRK [0x02103000, 

Re: dvb usb stick Hauppauge WinTV-soloHD

2016-06-18 Thread Olli Salonen
Hi Thomas,

Please reboot your PC, run w_scan and then send the full output of
dmesg command. Maybe the driver has printed something in the logs that
can help us narrow the cause.

Cheers,
-olli

On 18 June 2016 at 18:55, Thomas Stein  wrote:
> Hello.
>
> I'm trying to get a dvb usb stick Hauppauge WinTV-soloHD running. I saw
> there is general support already in the kernel.
> https://git.linuxtv.org/media_tree.git/commit/?id=1efc21701d94ed0c5b91467b042bed8b8becd5cc
>
> I'm able to use this device for dvb-t but not dvb-t2. I'm living in berlin
> so it should work. w_scan is scanning dvb-t2 and seems
> to find channels:
>
> Scanning DVB-T2...
> Scanning 7MHz frequencies...
> 177500: (time: 02:17.828)
> 184500: (time: 02:19.828)
> 191500: (time: 02:21.876)
> 198500: (time: 02:23.924)
> 205500: (time: 02:25.971)
> 212500: (time: 02:27.971)
> 219500: (time: 02:30.021)
> 226500: (time: 02:32.071)
> Scanning 8MHz frequencies...
> 474000: (time: 02:34.120)
> 482000: (time: 02:36.121)
> 49: (time: 02:38.169)
> 498000: (time: 02:40.219)
> 506000: skipped (already known transponder)
> 514000: (time: 02:42.268)
> 522000: skipped (already known transponder)
> 53: (time: 02:44.318)
> 538000: (time: 02:46.368)
> 546000: (time: 02:48.417)
> 554000: (time: 02:50.417)
> 562000: (time: 02:52.467)
> 57: skipped (already known transponder)
> 578000: (time: 02:54.467)
> 586000: (time: 02:56.469)
> 594000: (time: 02:58.469)
> 602000: (time: 03:00.518)
> 61: (time: 03:02.567)
> 618000: skipped (already known transponder)
> 626000: (time: 03:04.617)
> 634000: (time: 03:06.617)
> 642000: (time: 03:08.667) signal ok:QAM_AUTO f = 642000 kHz
> I999B8C999D999T999G999Y999P0 (0:0:0)
> QAM_AUTO f = 642000 kHz I999B8C999D999T999G999Y999P0 (0:0:0) :
> updating transport_stream_id: -> (0:0:16481)
> QAM_AUTO f = 642000 kHz I999B8C999D999T999G999Y999P0 (0:0:16481) :
> updating network_id -> (0:12352:16481)
> QAM_AUTO f = 642000 kHz I999B8C999D999T999G999Y999P0 (0:12352:16481)
> : updating original_network_id -> (8468:12352:16481)
> updating transponder:
>(QAM_AUTO f = 642000 kHz I999B8C999D999T999G999Y999P0
> (8468:12352:16481)) 0x
> to (QAM_AUTO f = 65 kHz I999B8C999D999T32G16Y999P0
> (8468:12352:16481)) 0x4004
> new transponder: (QAM_AUTO f = 642000 kHz I999B8C0D0T32G16Y0P1
> (8468:12352:16497)) 0x4004
> 65: skipped (already known transponder)
> 658000: skipped (already known transponder)
> 666000: (time: 03:10.382)
> 674000: (time: 03:12.429)
> 682000: skipped (already known transponder)
> 69: (time: 03:14.476)
> 698000: (time: 03:16.528)
> 706000: skipped (already known transponder)
> 714000: (time: 03:18.575)
> 722000: (time: 03:20.623)
> 73: (time: 03:22.669)
> 738000: (time: 03:24.716)
> 746000: (time: 03:26.764)
> 754000: skipped (already known transponder)
> 762000: (time: 03:28.811)
> 77: (time: 03:30.860)
> 778000: skipped (already known transponder)
> 786000: (time: 03:32.908)
> 794000: (time: 03:34.953)
> 802000: (time: 03:36.999)
> 81: (time: 03:39.045)
> 818000: (time: 03:41.045)
> 826000: (time: 03:43.091)
> 834000: (time: 03:45.137)
> 842000: (time: 03:47.185)
> 85: (time: 03:49.231)
> 858000: (time: 03:51.277)
>
> So the question is, what is going wrong? When i start vlc with dvb-t2
> channels file for berlin i get:
>
> [7f7e0c01a0e8] ts demux error: cannot peek
>
> Any hints appreciated.
>
> cheers
> t.
--
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: dvb-s2 card "TeVii S472" (cx23885)

2016-04-28 Thread Olli Salonen
Hi Hendrik,

Can you check that the chip on the board is indeed M88DS3103? I could
not read the text on the chip on the photo you sent earlier.

Furthermore, could you load the m88ds3103 driver with debugging
enabled before loading the cx23885 module:
modprobe m88ds3103 dyndbg==pmf

Then send the dmesg printout and maybe we can get some hints why the
firmware is not running.

Cheers,
-olli

On 27 April 2016 at 22:39, Hendrik Oenings <deb...@oenings.de> wrote:
> Hi together,
>
> I tried to recompile with the newest media_tree, so I just copied your
> modifications to the new media_tree. (I also refetched the media_build.)
> It wasn't very helpful, but I've seen that there is a kernel
> error message (which was there before too, but I hadn't seen it because
> I worked on X).
>
> $ su -c "modprobe cx23885"
> modprobe: ERROR: could not insert 'cx23885': Exec format error
> $ dmesg
> ...
> [XX.XX] frame_vector: exports duplicate symbol
> frame_vector_create (owned by kernel)
>
> I've looked up the reason for the re-export and I have seen that
> frame_vector was built as an module, but is compiled into the kernel.
>
> Changing this in the ./media/v4l/.config from m to y worked, so I can
> now load the module.
>
> The kernel message is gone away, but there is another problem now,
> dmesg says and w_scan doesn't work either:
>
> [XXX] m88ds3103 7-0068: found a 'Montage Technology M88DS3103' in cold
> state
>
> [XXX] m88ds3103 7-0068: downloading firmware from file
> 'dvb-demod-m88ds3103.fw'
>
> [XXX] m88ds3103 7-0068: firmware did not run
>
> I've copied the firmware as suggested to /lib/firmware.
>
> Regards,
> Hendrik
>
> Am Tue, 26 Apr 2016 09:03:24 +0300
> schrieb Olli Salonen <olli.salo...@iki.fi>:
>
>> Hi Hendrik, Hans,
>>
>> My media_tree Hendrik is pulling from Github is just a rather recent
>> copy of the media_tree master branch on git.linuxtv.org (it's missing
>> like the last 10 patches that have been added within the last 24
>> hours) with 2 simple patches on top that should not break anything.
>>
>> Also, the media_build is recent, since you just cloned it.
>>
>> Hans, do you know if there are any known issues with the current
>> media_build/media_tree on certain kernels?
>>
>> Thanks.
>>
>> Cheers,
>> -olli
>>
>> On 25 April 2016 at 19:14, Hendrik Oenings <deb...@oenings.de> wrote:
>> > Hi Olli,
>> >
>> > I've tested the driver, it compiles well and I've installed it on my
>> > system.
>> > But there's a problem: Everytime I try to load the driver (exact:
>> > the module cx23885), modprobe (or insmod) is giving me the
>> > following: # modprobe cx23885
>> > modprobe: ERROR: could not insert 'cx23885': Exec format error
>> >
>> > I've also tried to compile it with the current 4.6er kernel, but it
>> > stays the same.
>> > $ uname -r
>> > 4.6.0-rc5
>> >
>> > I've also tried to recompile the driver, but it didn't help.
>> >
>> > Maybe it is important to mention that some patches fail at the
>> > beginning of the build process (pr_fmt, debug).
>> >
>> > The installed module seems to be correct file format (my arch is
>> > x86_64):
>> > $ file \
>> >  /lib/modules/4.6.0-rc5/kernel/drivers/media/pci/cx23885/cx23885.ko
>> >
>> > /lib/modules/4.6.0-rc5/kernel/drivers/media/pci/cx23885/cx23885.ko:
>> > ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV),
>> > BuildID[sha1]=07a3f2f2fe383ab691b0022568dcd4d8315dc4b8, not stripped
>> >
>> > Regards,
>> > Hendrik
>> >
>> > On Mo, 25 Apr 2016 11:56:37 +0300, Olli Salonen
>> > <olli.salo...@iki.fi> wrote:
>> >
>> >> Hello Hendrik,
>> >>
>> >> I've created an initial version of the driver.
>> >> https://github.com/trsqr/media_tree/commit/b59f25b18bbe84e009618eefeaf646f5939bdd53
>> >>
>> >> To build, do the following:
>> >>
>> >> git clone git://linuxtv.org/media_build.git
>> >> git clone --depth=1 https://github.com/trsqr/media_tree.git -b
>> >> s472 ./media cd media_build
>> >> make dir DIR=../media
>> >> make distclean
>> >> make
>> >>
>> >> To install after a successful build:
>> >>
>> >> sudo make install
>> >>
>> >> Download also the following firmware and place it in /lib/firmware:
>> >> http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/3.B/
>&g

Re: dvb-s2 card "TeVii S472" (cx23885)

2016-04-26 Thread Olli Salonen
Hi Hendrik, Hans,

My media_tree Hendrik is pulling from Github is just a rather recent
copy of the media_tree master branch on git.linuxtv.org (it's missing
like the last 10 patches that have been added within the last 24
hours) with 2 simple patches on top that should not break anything.

Also, the media_build is recent, since you just cloned it.

Hans, do you know if there are any known issues with the current
media_build/media_tree on certain kernels?

Thanks.

Cheers,
-olli

On 25 April 2016 at 19:14, Hendrik Oenings <deb...@oenings.de> wrote:
> Hi Olli,
>
> I've tested the driver, it compiles well and I've installed it on my
> system.
> But there's a problem: Everytime I try to load the driver (exact: the
> module cx23885), modprobe (or insmod) is giving me the following:
> # modprobe cx23885
> modprobe: ERROR: could not insert 'cx23885': Exec format error
>
> I've also tried to compile it with the current 4.6er kernel, but it
> stays the same.
> $ uname -r
> 4.6.0-rc5
>
> I've also tried to recompile the driver, but it didn't help.
>
> Maybe it is important to mention that some patches fail at the
> beginning of the build process (pr_fmt, debug).
>
> The installed module seems to be correct file format (my arch is
> x86_64):
> $ file \
>  /lib/modules/4.6.0-rc5/kernel/drivers/media/pci/cx23885/cx23885.ko
>
> /lib/modules/4.6.0-rc5/kernel/drivers/media/pci/cx23885/cx23885.ko: ELF
> 64-bit LSB relocatable, x86-64, version 1 (SYSV),
> BuildID[sha1]=07a3f2f2fe383ab691b0022568dcd4d8315dc4b8, not stripped
>
> Regards,
> Hendrik
>
> On Mo, 25 Apr 2016 11:56:37 +0300, Olli Salonen <olli.salo...@iki.fi>
> wrote:
>
>> Hello Hendrik,
>>
>> I've created an initial version of the driver.
>> https://github.com/trsqr/media_tree/commit/b59f25b18bbe84e009618eefeaf646f5939bdd53
>>
>> To build, do the following:
>>
>> git clone git://linuxtv.org/media_build.git
>> git clone --depth=1 https://github.com/trsqr/media_tree.git -b
>> s472 ./media cd media_build
>> make dir DIR=../media
>> make distclean
>> make
>>
>> To install after a successful build:
>>
>> sudo make install
>>
>> Download also the following firmware and place it in /lib/firmware:
>> http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/3.B/
>>
>> The thing is, I had to guess the following parameters in
>> drivers/media/pci/cx23885/cx23885-dvb.c file:
>>
>> +static const struct m88ds3103_config tevii_s472_m88ds3103_config = {
>> +   .i2c_addr = 0x68,
>> +   .clock = 2700,
>> +   .i2c_wr_max = 33,
>> +   .clock_out = 0,
>> +   .ts_mode = M88DS3103_TS_PARALLEL,
>> +   .ts_clk = 16000,
>> +   .ts_clk_pol = 0,
>> +   .lnb_en_pol = 0,
>> +   .lnb_hv_pol = 1,
>> +   .agc = 0x99,
>> +};
>>
>> If the driver does not work (it loads and appears to tune, but does
>> not find channels), try altering ts_clk_pol, lnb_en_pol and
>> lnb_hv_pol. The possible values are 1 and 0 so there should not be
>> that many iterations needed.. Current values are based on best guess.
>>
>> Cheers,
>> -olli
>>
>>
>>
>> On 24 April 2016 at 19:00, Hendrik Oenings <deb...@oenings.de> wrote:
>> > Hi Olli,
>> >
>> > I'm glad that there is someone trying to help me and of course I'm
>> > able to test a driver.
>> >
>> > Because of the attached photos, I think it is better not to send
>> > this mail to the mailing list.
>> >
>> > cx23885, m88ds3103 and m88ts2022 are the values I also think they're
>> > correct. cx23885 is also mentioned by lspci, the other values I've
>> > also seen often while searching for a solution.
>> >
>> > Here is also the full output of lspci concerning the tv card which
>> > is probably helpful.
>> > # lspci -vv
>> > [...]
>> > 03:00.0 Multimedia video controller: Conexant Systems, Inc. CX23885
>> > PCI Video and Audio Decoder (rev 04) Subsystem: Device d472:9022
>> > Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
>> > ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF-
>> > FastB2B- ParErr- DEVSEL=fast >TAbort- SERR-
>> > > > routed to IRQ 19 Region 0: Memory at f7c0 (64-bit,
>> > non-prefetchable) [size=2M] Capabilities: [40] Express (v1)
>> > Endpoint, MSI 00 DevCap: MaxPayload 128 bytes, PhantFunc 0,
>> > Latency L0s <64ns, L1 <1us ExtTag- AttnBtn- AttnInd- PwrInd- RBE-
>> > FLReset- DevCtl:Report errors: Correctable- Non-Fa

Fwd: [PATCH] em28xx: add support for Hauppauge WinTV-dualHD DVB tuner

2016-04-11 Thread Olli Salonen
Hi Christian,

Thanks for reporting back your experience. Certainly there's a chance
of supporting the second tuner too. There are still two issues that I
have not solved:

1. I haven't gotten the 2nd tuner working yet (alone, without the
first tuner), even if I think all the pieces of the puzzle are there.
2. em28xx driver is built with one tuner in mind and needs significant
structural changes. If there's anyone very familiar with the em28xx
driver here, I'd be happy to hear your idea of what is entailed for
this.

Cheers,
-olli

On 10 April 2016 at 18:23, Christian Steiner
<christian.stei...@outlook.de> wrote:
>
> On 04.04.2016 17:12, Olli Salonen wrote:
> > Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
> > following components:
> >
> > USB bridge: Empia EM28274 (chip id is the same as EM28174)
> > Demodulator: 2x Silicon Labs Si2168-B40
> > Tuner: 2x Silicon Labs Si2157-A30
> >
> > This patch adds support only for the first tuner.
> >
> > [...]
>
> Thank you very much!
> Works fine for me:
>
> > [  419.413188] em28xx: New device HCW dualHD @ 480 Mbps (2040:0265, 
> > interface 0, class 0)
> > [  419.413195] em28xx: DVB interface 0 found: isoc
> > [  419.413265] em28xx: chip ID is em28174
> > [  420.529619] em28174 #0: EEPROM ID = 26 00 01 00, EEPROM hash = 0x7addc1c8
> > [  420.529626] em28174 #0: EEPROM info:
> > [  420.529630] em28174 #0:  microcode start address = 0x0004, boot 
> > configuration = 0x01
> > [  420.536077] em28174 #0:  AC97 audio (5 sample rates)
> > [  420.536084] em28174 #0:  500mA max power
> > [  420.536089] em28174 #0:  Table at offset 0x27, strings=0x0e6a, 
> > 0x1888, 0x087e
> > [  420.536188] em28174 #0: Identified as Hauppauge WinTV-dualHD DVB 
> > (card=98)
> > [  420.537974] tveeprom 8-0050: Hauppauge model 204109, rev B2I6, serial# 
> > 11XX
> > [  420.537981] tveeprom 8-0050: tuner model is SiLabs Si2157 (idx 186, type 
> > 4)
> > [  420.537986] tveeprom 8-0050: TV standards PAL(B/G) NTSC(M) PAL(I) 
> > SECAM(L/L') PAL(D/D1/K) ATSC/DVB Digital (eeprom 0xfc)
> > [  420.537989] tveeprom 8-0050: audio processor is None (idx 0)
> > [  420.537993] tveeprom 8-0050: has no radio, has IR receiver, has no IR 
> > transmitter
> > [  420.537997] em28174 #0: dvb set to isoc mode.
> > [  420.538056] usbcore: registered new interface driver em28xx
> > [  420.541087] em28174 #0: Binding DVB extension
> > [  420.544008] i2c i2c-8: Added multiplexed i2c bus 9
> > [  420.544016] si2168 8-0064: Silicon Labs Si2168 successfully attached
> > [  420.548372] si2157 9-0060: Silicon Labs Si2147/2148/2157/2158 
> > successfully attached
> > [  420.548389] DVB: registering new adapter (em28174 #0)
> > [  420.548396] usb 2-2: DVB: registering adapter 0 frontend 0 (Silicon Labs 
> > Si2168)...
> > [  420.549737] em28174 #0: DVB extension successfully initialized
> > [  420.549743] em28xx: Registered (Em28xx dvb Extension) extension
> > [  435.418798] si2168 8-0064: found a 'Silicon Labs Si2168-B40'
> > [  435.418823] si2168 8-0064: downloading firmware from file 
> > 'dvb-demod-si2168-b40-01.fw'
> > [  435.617181] si2168 8-0064: firmware version: 4.0.11
> > [  435.619791] si2157 9-0060: found a 'Silicon Labs Si2157-A30'
> > [  435.642006] si2157 9-0060: firmware version: 3.0.5
>
> (I have replaced the last digits of the serial number with X)
>
> Is there any chance to add support for the second tuner, too?
> This would be awesome.
>
> Best,
> Christian
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] em28xx: add support for Hauppauge WinTV-dualHD DVB tuner

2016-04-04 Thread Olli Salonen
Hauppauge WinTV-dualHD is a USB 2.0 dual DVB-T/T2/C tuner with
following components:

USB bridge: Empia EM28274 (chip id is the same as EM28174)
Demodulator: 2x Silicon Labs Si2168-B40
Tuner: 2x Silicon Labs Si2157-A30

This patch adds support only for the first tuner.

The demodulator needs firmware, available for example here:
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/4.0.11/

The demodulators sit on the same I2C bus and their addresses
are 0x64 and 0x67. The tuners are behind the demodulators and
their addresses are 0x60 and 0x63.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 Documentation/video4linux/CARDLIST.em28xx |  1 +
 drivers/media/usb/em28xx/em28xx-cards.c   | 54 ++
 drivers/media/usb/em28xx/em28xx-dvb.c | 64 +++
 drivers/media/usb/em28xx/em28xx-reg.h | 13 +++
 drivers/media/usb/em28xx/em28xx.h |  2 +
 5 files changed, 134 insertions(+)

diff --git a/Documentation/video4linux/CARDLIST.em28xx 
b/Documentation/video4linux/CARDLIST.em28xx
index 6720999..09ff940 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -96,3 +96,4 @@
  95 -> Leadtek VC100(em2861)[0413:6f07]
  96 -> Terratec Cinergy T2 Stick HD (em28178)
  97 -> Elgato EyeTV Hybrid 2008 INT (em2884)[0fd9:0018]
+ 98 -> Hauppauge WinTV-dualHD DVB   (em28174)   [2040:0265]
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index 930e3e3..5a57f75 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -492,6 +492,29 @@ static struct em28xx_reg_seq terratec_t2_stick_hd[] = {
{-1, -1,   -1, -1},
 };
 
+/* 2040:0265 Hauppauge WinTV-dualHD DVB
+ * reg 0x80/0x84:
+ * GPIO_0: Yellow LED tuner 1, 0=on, 1=off
+ * GPIO_1: Green LED tuner 1, 0=on, 1=off
+ * GPIO_2: Yellow LED tuner 2, 0=on, 1=off
+ * GPIO_3: Green LED tuner 2, 0=on, 1=off
+ * GPIO_5: Reset #2, 0=active
+ * GPIO_6: Reset #1, 0=active
+ */
+static struct em28xx_reg_seq hauppauge_dualhd_dvb[] = {
+   {EM2874_R80_GPIO_P0_CTRL,  0xff, 0xff,  0},
+   {0x0d, 0xff, 0xff,200},
+   {0x50, 0x04, 0xff,300},
+   {EM2874_R80_GPIO_P0_CTRL,  0xbf, 0xff,100}, /* demod 1 reset */
+   {EM2874_R80_GPIO_P0_CTRL,  0xff, 0xff,100},
+   {EM2874_R80_GPIO_P0_CTRL,  0xdf, 0xff,100}, /* demod 2 reset */
+   {EM2874_R80_GPIO_P0_CTRL,  0xff, 0xff,100},
+   {EM2874_R5F_TS_ENABLE, 0x44, 0xff, 50},
+   {EM2874_R5D_TS1_PKT_SIZE,  0x05, 0xff, 50},
+   {EM2874_R5E_TS2_PKT_SIZE,  0x05, 0xff, 50},
+   {-1, -1,   -1, -1},
+};
+
 /*
  *  Button definitions
  */
@@ -571,6 +594,22 @@ static struct em28xx_led terratec_grabby_leds[] = {
{-1, 0, 0, 0},
 };
 
+static struct em28xx_led hauppauge_dualhd_leds[] = {
+   {
+   .role  = EM28XX_LED_DIGITAL_CAPTURING,
+   .gpio_reg  = EM2874_R80_GPIO_P0_CTRL,
+   .gpio_mask = EM_GPIO_1,
+   .inverted  = 1,
+   },
+   {
+   .role  = EM28XX_LED_DIGITAL_CAPTURING_TS2,
+   .gpio_reg  = EM2874_R80_GPIO_P0_CTRL,
+   .gpio_mask = EM_GPIO_3,
+   .inverted  = 1,
+   },
+   {-1, 0, 0, 0},
+};
+
 /*
  *  Board definitions
  */
@@ -2306,6 +2345,18 @@ struct em28xx_board em28xx_boards[] = {
.has_dvb   = 1,
.ir_codes  = RC_MAP_TERRATEC_SLIM_2,
},
+   /* 2040:0265 Hauppauge WinTV-dualHD (DVB version).
+* Empia EM28274, 2x Silicon Labs Si2168, 2x Silicon Labs Si2157 */
+   [EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB] = {
+   .name  = "Hauppauge WinTV-dualHD DVB",
+   .def_i2c_bus   = 1,
+   .i2c_speed = EM28XX_I2C_CLK_WAIT_ENABLE | 
EM28XX_I2C_FREQ_400_KHZ,
+   .tuner_type= TUNER_ABSENT,
+   .tuner_gpio= hauppauge_dualhd_dvb,
+   .has_dvb   = 1,
+   .ir_codes  = RC_MAP_HAUPPAUGE,
+   .leds  = hauppauge_dualhd_leds,
+   },
 };
 EXPORT_SYMBOL_GPL(em28xx_boards);
 
@@ -2429,6 +2480,8 @@ struct usb_device_id em28xx_id_table[] = {
.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950 },
{ USB_DEVICE(0x2040, 0x651f),
.driver_info = EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 },
+   { USB_DEVICE(0x2040, 0x0265),
+   .driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB 
},
{ USB_DEVICE(0x0438, 0xb002),
.driver_info = EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600 },
{ USB_DEVICE(0x2001, 0xf112),

Re: [PATCH 1/2] media/dvb-core: fix inverted check

2016-03-21 Thread Olli Salonen
Hi Max,

Already in the tree:
http://git.linuxtv.org/media_tree.git/commit/drivers/media/dvb-core?id=711f3fba6ffd3914fd1b5ed9faf8d22bab6f2203

Cheers,
-olli

On 18 March 2016 at 23:31, Max Kellermann  wrote:
> Breakage caused by commit f50d51661a
>
> Signed-off-by: Max Kellermann 
> ---
>  drivers/media/dvb-core/dvbdev.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
> index 560450a..c756d4b 100644
> --- a/drivers/media/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb-core/dvbdev.c
> @@ -682,7 +682,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap,
> if (demux && ca) {
> ret = media_create_pad_link(demux, 1, ca,
> 0, MEDIA_LNK_FL_ENABLED);
> -   if (!ret)
> +   if (ret)
> return -ENOMEM;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] mceusb: add support for Adaptec eHome receiver

2016-03-19 Thread Olli Salonen
New USB ID for Adaptec eHome receiver in some HP laptops.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/rc/mceusb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 35155ae..09ca9f6 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -188,6 +188,7 @@
 #define VENDOR_TWISTEDMELON0x2596
 #define VENDOR_HAUPPAUGE   0x2040
 #define VENDOR_PCTV0x2013
+#define VENDOR_ADAPTEC 0x03f3
 
 enum mceusb_model_type {
MCE_GEN2 = 0,   /* Most boards */
@@ -405,6 +406,8 @@ static struct usb_device_id mceusb_dev_table[] = {
  .driver_info = HAUPPAUGE_CX_HYBRID_TV },
{ USB_DEVICE(VENDOR_PCTV, 0x025e),
  .driver_info = HAUPPAUGE_CX_HYBRID_TV },
+   /* Adaptec / HP eHome Receiver */
+   { USB_DEVICE(VENDOR_ADAPTEC, 0x0094) },
 
/* Terminating entry */
{ }
-- 
1.9.1

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


[PATCH] pctv452e: correct parameters for TechnoTrend TT S2-3600

2016-03-19 Thread Olli Salonen
2008-02-25 Andre Weidemann added support for TT S2-3600 and noted
that he still gets image distortions every now and then.

It seems to be common knowledge in many projects that changing
the USB parameters seems to help. OpenELEC has included this patch
for a few years, for example. Nobody bothered to report the issue
upstream though, it seems.

References:
https://github.com/OpenELEC/OpenELEC.tv/issues/1957
http://www.vdr-portal.de/board60-linux/board14-betriebssystem/board96-yavdr/p1033458-darstellungsproblem-bei-2-tt-3600-usb/#post1033458
 (in German)

I'd suggest we include the patch below. Any objections?

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/usb/dvb-usb/pctv452e.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/pctv452e.c 
b/drivers/media/usb/dvb-usb/pctv452e.c
index ec397c4..c05de1b 100644
--- a/drivers/media/usb/dvb-usb/pctv452e.c
+++ b/drivers/media/usb/dvb-usb/pctv452e.c
@@ -995,11 +995,11 @@ static struct dvb_usb_device_properties 
tt_connect_s2_3600_properties = {
/* parameter for the MPEG2-data transfer */
.stream = {
.type = USB_ISOC,
-   .count = 7,
+   .count = 4,
.endpoint = 0x02,
.u = {
.isoc = {
-   .framesperurb = 4,
+   .framesperurb = 64,
.framesize = 940,
.interval = 1
}
-- 
1.9.1

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


[PATCH 2/2] mceusb: add support for SMK eHome receiver

2016-03-19 Thread Olli Salonen
Add USB ID of SMK RXX6000 series IR receiver. Often branded as
Lenovo receiver.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/rc/mceusb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 09ca9f6..5cf2e74 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -303,6 +303,9 @@ static struct usb_device_id mceusb_dev_table[] = {
/* SMK/I-O Data GV-MC7/RCKIT Receiver */
{ USB_DEVICE(VENDOR_SMK, 0x0353),
  .driver_info = MCE_GEN2_NO_TX },
+   /* SMK RXX6000 Infrared Receiver */
+   { USB_DEVICE(VENDOR_SMK, 0x0357),
+ .driver_info = MCE_GEN2_NO_TX },
/* Tatung eHome Infrared Transceiver */
{ USB_DEVICE(VENDOR_TATUNG, 0x9150) },
/* Shuttle eHome Infrared Transceiver */
-- 
1.9.1

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


[PATCH] az6027: Add support for Elgato EyeTV Sat v3

2016-03-18 Thread Olli Salonen
Another version of Elgato EyeTV Sat USB DVB-S2 adapter needs just
a USB ID addition.

Signed-off-by: Christian Knippel <nam...@gmail.com>
Reported-by: Olli Salonen <olli.salo...@iki.fi>

---
 drivers/media/dvb-core/dvb-usb-ids.h | 1 +
 drivers/media/usb/dvb-usb/az6027.c   | 7 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/dvb-core/dvb-usb-ids.h 
b/drivers/media/dvb-core/dvb-usb-ids.h
index 0afad39..f94e58f 100644
--- a/drivers/media/dvb-core/dvb-usb-ids.h
+++ b/drivers/media/dvb-core/dvb-usb-ids.h
@@ -373,6 +373,7 @@
 #define USB_PID_ELGATO_EYETV_DTT_Dlx   0x0020
 #define USB_PID_ELGATO_EYETV_SAT   0x002a
 #define USB_PID_ELGATO_EYETV_SAT_V20x0025
+#define USB_PID_ELGATO_EYETV_SAT_V30x0036
 #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_COLD0x5000
 #define USB_PID_DVB_T_USB_STICK_HIGH_SPEED_WARM0x5001
 #define USB_PID_FRIIO_WHITE0x0001
diff --git a/drivers/media/usb/dvb-usb/az6027.c 
b/drivers/media/usb/dvb-usb/az6027.c
index 92e47d6..2e71136 100644
--- a/drivers/media/usb/dvb-usb/az6027.c
+++ b/drivers/media/usb/dvb-usb/az6027.c
@@ -1090,6 +1090,7 @@ static struct usb_device_id az6027_usb_table[] = {
{ USB_DEVICE(USB_VID_TECHNISAT, USB_PID_TECHNISAT_USB2_HDCI_V2) },
{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT) },
{ USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT_V2) },
+   { USB_DEVICE(USB_VID_ELGATO, USB_PID_ELGATO_EYETV_SAT_V3) },
{ },
 };
 
@@ -1138,7 +1139,7 @@ static struct dvb_usb_device_properties az6027_properties 
= {
 
.i2c_algo = _i2c_algo,
 
-   .num_device_descs = 7,
+   .num_device_descs = 8,
.devices = {
{
.name = "AZUREWAVE DVB-S/S2 USB2.0 (AZ6027)",
@@ -1168,6 +1169,10 @@ static struct dvb_usb_device_properties 
az6027_properties = {
.name = "Elgato EyeTV Sat",
.cold_ids = { _usb_table[6], NULL },
.warm_ids = { NULL },
+   }, {
+   .name = "Elgato EyeTV Sat",
+   .cold_ids = { _usb_table[7], NULL },
+   .warm_ids = { NULL },
},
{ NULL },
}
-- 
1.9.1

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


[PATCHv2 1/2] ds3000: return meaningful return codes

2016-03-16 Thread Olli Salonen
The ds3000 driver returned 1 as an error code in many places.

v1 of the patch series got incorrect subject lines.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-frontends/ds3000.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/media/dvb-frontends/ds3000.c 
b/drivers/media/dvb-frontends/ds3000.c
index e8fc032..addffc3 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -458,7 +458,7 @@ static int ds3000_read_status(struct dvb_frontend *fe, enum 
fe_status *status)
 
break;
default:
-   return 1;
+   return -EINVAL;
}
 
if (state->config->set_lock_led)
@@ -528,7 +528,7 @@ static int ds3000_read_ber(struct dvb_frontend *fe, u32* 
ber)
*ber = 0x;
break;
default:
-   return 1;
+   return -EINVAL;
}
 
return 0;
@@ -623,7 +623,7 @@ static int ds3000_read_snr(struct dvb_frontend *fe, u16 
*snr)
snr_reading, *snr);
break;
default:
-   return 1;
+   return -EINVAL;
}
 
return 0;
@@ -661,7 +661,7 @@ static int ds3000_read_ucblocks(struct dvb_frontend *fe, 
u32 *ucblocks)
state->prevUCBS2 = _ucblocks;
break;
default:
-   return 1;
+   return -EINVAL;
}
 
return 0;
@@ -754,7 +754,7 @@ static int ds3000_send_diseqc_msg(struct dvb_frontend *fe,
data |= 0x80;
ds3000_writereg(state, 0xa2, data);
 
-   return 1;
+   return -ETIMEDOUT;
}
 
data = ds3000_readreg(state, 0xa2);
@@ -808,7 +808,7 @@ static int ds3000_diseqc_send_burst(struct dvb_frontend *fe,
data |= 0x80;
ds3000_writereg(state, 0xa2, data);
 
-   return 1;
+   return -ETIMEDOUT;
}
 
data = ds3000_readreg(state, 0xa2);
@@ -951,7 +951,7 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
ds3000_writereg(state, 0xfe, 0x98);
break;
default:
-   return 1;
+   return -EINVAL;
}
 
/* enable 27MHz clock output */
-- 
1.9.1

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


[PATCHv2 2/2] ds3000: return error if invalid symbol rate is set

2016-03-16 Thread Olli Salonen
Return -EINVAL if ds3000_set_frontend is called with invalid parameters.

v1 of the patch series got incorrect subject lines.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-frontends/ds3000.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/dvb-frontends/ds3000.c 
b/drivers/media/dvb-frontends/ds3000.c
index addffc3..447b518 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -959,6 +959,15 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
/* enable ac coupling */
ds3000_writereg(state, 0x25, 0x8a);
 
+   if ((c->symbol_rate < ds3000_ops.info.symbol_rate_min) ||
+   (c->symbol_rate > ds3000_ops.info.symbol_rate_max)) {
+   dprintk("%s() symbol_rate %u out of range (%u ... %u)\n",
+   __func__, c->symbol_rate,
+   ds3000_ops.info.symbol_rate_min,
+   ds3000_ops.info.symbol_rate_max);
+   return -EINVAL;
+   }
+
/* enhance symbol rate performance */
if ((c->symbol_rate / 1000) <= 5000) {
value = 29777 / (c->symbol_rate / 1000) + 1;
-- 
1.9.1

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


[PATCH 1/2] ds3000: return meaningful return codes

2016-03-16 Thread Olli Salonen
The ds3000 driver returned 1 as an error code in many places.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-frontends/ds3000.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/media/dvb-frontends/ds3000.c 
b/drivers/media/dvb-frontends/ds3000.c
index e8fc032..addffc3 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -458,7 +458,7 @@ static int ds3000_read_status(struct dvb_frontend *fe, enum 
fe_status *status)
 
break;
default:
-   return 1;
+   return -EINVAL;
}
 
if (state->config->set_lock_led)
@@ -528,7 +528,7 @@ static int ds3000_read_ber(struct dvb_frontend *fe, u32* 
ber)
*ber = 0x;
break;
default:
-   return 1;
+   return -EINVAL;
}
 
return 0;
@@ -623,7 +623,7 @@ static int ds3000_read_snr(struct dvb_frontend *fe, u16 
*snr)
snr_reading, *snr);
break;
default:
-   return 1;
+   return -EINVAL;
}
 
return 0;
@@ -661,7 +661,7 @@ static int ds3000_read_ucblocks(struct dvb_frontend *fe, 
u32 *ucblocks)
state->prevUCBS2 = _ucblocks;
break;
default:
-   return 1;
+   return -EINVAL;
}
 
return 0;
@@ -754,7 +754,7 @@ static int ds3000_send_diseqc_msg(struct dvb_frontend *fe,
data |= 0x80;
ds3000_writereg(state, 0xa2, data);
 
-   return 1;
+   return -ETIMEDOUT;
}
 
data = ds3000_readreg(state, 0xa2);
@@ -808,7 +808,7 @@ static int ds3000_diseqc_send_burst(struct dvb_frontend *fe,
data |= 0x80;
ds3000_writereg(state, 0xa2, data);
 
-   return 1;
+   return -ETIMEDOUT;
}
 
data = ds3000_readreg(state, 0xa2);
@@ -951,7 +951,7 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
ds3000_writereg(state, 0xfe, 0x98);
break;
default:
-   return 1;
+   return -EINVAL;
}
 
/* enable 27MHz clock output */
-- 
1.9.1

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


[PATCH 1/2] ds3000: return meaningful return codes

2016-03-16 Thread Olli Salonen
Return -EINVAL if ds3000_set_frontend is called with invalid parameters.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/dvb-frontends/ds3000.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/dvb-frontends/ds3000.c 
b/drivers/media/dvb-frontends/ds3000.c
index addffc3..447b518 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -959,6 +959,15 @@ static int ds3000_set_frontend(struct dvb_frontend *fe)
/* enable ac coupling */
ds3000_writereg(state, 0x25, 0x8a);
 
+   if ((c->symbol_rate < ds3000_ops.info.symbol_rate_min) ||
+   (c->symbol_rate > ds3000_ops.info.symbol_rate_max)) {
+   dprintk("%s() symbol_rate %u out of range (%u ... %u)\n",
+   __func__, c->symbol_rate,
+   ds3000_ops.info.symbol_rate_min,
+   ds3000_ops.info.symbol_rate_max);
+   return -EINVAL;
+   }
+
/* enhance symbol rate performance */
if ((c->symbol_rate / 1000) <= 5000) {
value = 29777 / (c->symbol_rate / 1000) + 1;
-- 
1.9.1

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


[PATCH] smipcie: add RC map into card configuration options

2016-03-10 Thread Olli Salonen
Remove the if..else statement from smipcie-ir.c and add the remote
controller map as a configuration parameter for the card.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/pci/smipcie/smipcie-ir.c   | 5 +
 drivers/media/pci/smipcie/smipcie-main.c | 4 
 drivers/media/pci/smipcie/smipcie.h  | 1 +
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/smipcie/smipcie-ir.c 
b/drivers/media/pci/smipcie/smipcie-ir.c
index d737b5e..826c7c7 100644
--- a/drivers/media/pci/smipcie/smipcie-ir.c
+++ b/drivers/media/pci/smipcie/smipcie-ir.c
@@ -203,10 +203,7 @@ int smi_ir_init(struct smi_dev *dev)
rc_dev->dev.parent = >pci_dev->dev;
 
rc_dev->driver_type = RC_DRIVER_SCANCODE;
-   if (dev->info->type == SMI_TECHNOTREND_S2_4200)
-   rc_dev->map_name = RC_MAP_TT_1500;
-   else
-   rc_dev->map_name = RC_MAP_DVBSKY;
+   rc_dev->map_name = dev->info->rc_map;
 
ir->rc_dev = rc_dev;
ir->dev = dev;
diff --git a/drivers/media/pci/smipcie/smipcie-main.c 
b/drivers/media/pci/smipcie/smipcie-main.c
index 4a9275a..83981d61 100644
--- a/drivers/media/pci/smipcie/smipcie-main.c
+++ b/drivers/media/pci/smipcie/smipcie-main.c
@@ -1067,6 +1067,7 @@ static struct smi_cfg_info dvbsky_s950_cfg = {
.ts_1 = SMI_TS_DMA_BOTH,
.fe_0 = DVBSKY_FE_NULL,
.fe_1 = DVBSKY_FE_M88DS3103,
+   .rc_map = RC_MAP_DVBSKY,
 };
 
 static struct smi_cfg_info dvbsky_s952_cfg = {
@@ -1076,6 +1077,7 @@ static struct smi_cfg_info dvbsky_s952_cfg = {
.ts_1 = SMI_TS_DMA_BOTH,
.fe_0 = DVBSKY_FE_M88RS6000,
.fe_1 = DVBSKY_FE_M88RS6000,
+   .rc_map = RC_MAP_DVBSKY,
 };
 
 static struct smi_cfg_info dvbsky_t9580_cfg = {
@@ -1085,6 +1087,7 @@ static struct smi_cfg_info dvbsky_t9580_cfg = {
.ts_1 = SMI_TS_DMA_BOTH,
.fe_0 = DVBSKY_FE_SIT2,
.fe_1 = DVBSKY_FE_M88DS3103,
+   .rc_map = RC_MAP_DVBSKY,
 };
 
 static struct smi_cfg_info technotrend_s2_4200_cfg = {
@@ -1094,6 +1097,7 @@ static struct smi_cfg_info technotrend_s2_4200_cfg = {
.ts_1 = SMI_TS_DMA_BOTH,
.fe_0 = DVBSKY_FE_M88RS6000,
.fe_1 = DVBSKY_FE_M88RS6000,
+   .rc_map = RC_MAP_TT_1500,
 };
 
 /* PCI IDs */
diff --git a/drivers/media/pci/smipcie/smipcie.h 
b/drivers/media/pci/smipcie/smipcie.h
index 5528e48..611e4f0 100644
--- a/drivers/media/pci/smipcie/smipcie.h
+++ b/drivers/media/pci/smipcie/smipcie.h
@@ -233,6 +233,7 @@ struct smi_cfg_info {
 #define DVBSKY_FE_SIT2  3
int fe_0;
int fe_1;
+   char *rc_map;
 };
 
 struct smi_rc {
-- 
1.9.1

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


[PATCH 1/2] smipcie: add support for TechnoTrend S2-4200 Twin

2016-03-09 Thread Olli Salonen
Add support for TechnoTrend TT-budget S2-4200 Twin DVB-S2 tuner. The
device seems to be rather similar to DVBSky S952 V3. This is a PCIe
card with 2 tuners. SMI PCIe bridge is used and the card has two 
Montage M88RS6000 demod/tuners.

The M88RS6000 demod/tuner package needs firmware. You can download
one here:
http://palosaari.fi/linux/v4l-dvb/firmware/M88RS6000/

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/pci/smipcie/smipcie-ir.c   |  5 -
 drivers/media/pci/smipcie/smipcie-main.c | 10 ++
 drivers/media/pci/smipcie/smipcie.h  |  1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/smipcie/smipcie-ir.c 
b/drivers/media/pci/smipcie/smipcie-ir.c
index d018673..d737b5e 100644
--- a/drivers/media/pci/smipcie/smipcie-ir.c
+++ b/drivers/media/pci/smipcie/smipcie-ir.c
@@ -203,7 +203,10 @@ int smi_ir_init(struct smi_dev *dev)
rc_dev->dev.parent = >pci_dev->dev;
 
rc_dev->driver_type = RC_DRIVER_SCANCODE;
-   rc_dev->map_name = RC_MAP_DVBSKY;
+   if (dev->info->type == SMI_TECHNOTREND_S2_4200)
+   rc_dev->map_name = RC_MAP_TT_1500;
+   else
+   rc_dev->map_name = RC_MAP_DVBSKY;
 
ir->rc_dev = rc_dev;
ir->dev = dev;
diff --git a/drivers/media/pci/smipcie/smipcie-main.c 
b/drivers/media/pci/smipcie/smipcie-main.c
index b039a22..993a2d1 100644
--- a/drivers/media/pci/smipcie/smipcie-main.c
+++ b/drivers/media/pci/smipcie/smipcie-main.c
@@ -1086,6 +1086,15 @@ static struct smi_cfg_info dvbsky_t9580_cfg = {
.fe_1 = DVBSKY_FE_M88DS3103,
 };
 
+static struct smi_cfg_info technotrend_s2_4200_cfg = {
+   .type = SMI_TECHNOTREND_S2_4200,
+   .name = "TechnoTrend TT-budget S2-4200 Twin",
+   .ts_0 = SMI_TS_DMA_BOTH,
+   .ts_1 = SMI_TS_DMA_BOTH,
+   .fe_0 = DVBSKY_FE_M88RS6000,
+   .fe_1 = DVBSKY_FE_M88RS6000,
+};
+
 /* PCI IDs */
 #define SMI_ID(_subvend, _subdev, _driverdata) {   \
.vendor  = SMI_VID,.device= SMI_PID, \
@@ -1096,6 +1105,7 @@ static const struct pci_device_id smi_id_table[] = {
SMI_ID(0x4254, 0x0550, dvbsky_s950_cfg),
SMI_ID(0x4254, 0x0552, dvbsky_s952_cfg),
SMI_ID(0x4254, 0x5580, dvbsky_t9580_cfg),
+   SMI_ID(0x13c2, 0x3016, technotrend_s2_4200_cfg),
{0}
 };
 MODULE_DEVICE_TABLE(pci, smi_id_table);
diff --git a/drivers/media/pci/smipcie/smipcie.h 
b/drivers/media/pci/smipcie/smipcie.h
index 68cdda2..5528e48 100644
--- a/drivers/media/pci/smipcie/smipcie.h
+++ b/drivers/media/pci/smipcie/smipcie.h
@@ -216,6 +216,7 @@ struct smi_cfg_info {
 #define SMI_DVBSKY_S950 1
 #define SMI_DVBSKY_T95802
 #define SMI_DVBSKY_T982 3
+#define SMI_TECHNOTREND_S2_4200 4
int type;
char *name;
 #define SMI_TS_NULL 0
-- 
1.9.1

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


[PATCH 2/2] smipcie: MAC address printout formatting

2016-03-09 Thread Olli Salonen
Modify the printout for MAC address to be more vendor agnostic.
Print also the port number.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/pci/smipcie/smipcie-main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/smipcie/smipcie-main.c 
b/drivers/media/pci/smipcie/smipcie-main.c
index 993a2d1..4a9275a 100644
--- a/drivers/media/pci/smipcie/smipcie-main.c
+++ b/drivers/media/pci/smipcie/smipcie-main.c
@@ -716,7 +716,8 @@ static int smi_fe_init(struct smi_port *port)
/* init MAC.*/
ret = smi_read_eeprom(>i2c_bus[0], 0xc0, mac_ee, 16);
dev_info(>dev->pci_dev->dev,
-   "DVBSky SMI PCIe MAC= %pM\n", mac_ee + (port->idx)*8);
+   "%s port %d MAC: %pM\n", dev->info->name,
+   port->idx, mac_ee + (port->idx)*8);
memcpy(adap->proposed_mac, mac_ee + (port->idx)*8, 6);
return ret;
 }
-- 
1.9.1

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


Re: How to see the content of my device's EEPROM?

2016-03-07 Thread Olli Salonen
Hi,

Load the module with i2c_debug on:

From: em28xx-i2c.c:

693 if (i2c_debug) {
694 /* Display eeprom content */
695 print_hex_dump(KERN_INFO, "eeprom ", DUMP_PREFIX_OFFSET,
69616, 1, data, len, true);
697
698 if (dev->eeprom_addrwidth_16bit)
699 em28xx_info("eeprom %06x: ... (skipped)\n", 256);
700 }

modprobe em28xx i2c_debug=1 should do it.

Cheers,
-olli

On 8 March 2016 at 05:03, Alexandre-Xavier Labonté-Lamoureux
 wrote:
> Hello everyone,
>
> On the kernel version 4.3.3, when I do dmesg to see the content of the
> EEPROM of the device that I just connected, I don't see it.
>
> I only see this: https://justpaste.it/qchd
>
> On older kernel versions like 3.10, I had what I wanted:
> https://justpaste.it/qchh
>
> i2c eeprom 00: 1a eb 67 95 1a eb 51 50 50 00 20 03 82 34 6a 04
> i2c eeprom 10: 6e 14 27 57 06 02 00 00 00 00 00 00 00 00 00 00
> i2c eeprom 20: 02 00 01 00 f0 10 01 00 b8 00 00 00 5b 00 00 00
> i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 00 00 00 00 00 00
> i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 c4 00 00
> i2c eeprom 50: 00 a2 00 87 81 00 00 00 00 00 00 00 00 00 00 00
> i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 04 03 30 00 14 03
> i2c eeprom 70: 49 00 4f 00 4e 00 20 00 41 00 75 00 64 00 69 00
> i2c eeprom 80: 6f 00 34 03 49 00 4f 00 4e 00 20 00 41 00 75 00
> i2c eeprom 90: 64 00 69 00 6f 00 20 00 55 00 53 00 42 00 20 00
> i2c eeprom a0: 32 00 38 00 36 00 31 00 20 00 44 00 65 00 76 00
> i2c eeprom b0: 69 00 63 00 65 00 00 00 00 00 00 00 00 00 00 00
> i2c eeprom c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> i2c eeprom d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> i2c eeprom f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>
> Why do newer kernels print less information to dmesg? How do I do if I want
> to see the content of my EEPROM on kernel v4.3.3 ?
>
> Thanks in advance,
> Alexandre-Xavier
--
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: DVBSky T980C CI issues (kernel 4.0.x)

2016-03-04 Thread Olli Salonen
Hi Jurgen,

Ah, that's interesting. My T980C (and based on printout from Torbjörn
his as well) have Si2168-A20 chips.

Some things I'd like to understand:
- is there a difference if the CI slot is populated or not?
- is there any difference between the different firmwares?
- does it work with the DVBSky provided driver?
- when you say it doesn't work, is the issue that the demodulator does
not lock on the DVB-T2 muxes?

Two different firmwares for A30 chip:
https://github.com/OpenELEC/dvb-firmware/blob/18b12de1f57b3c70a681983638989f94590b19f1/firmware/dvb-demod-si2168-a30-01.fw?raw=true
https://github.com/OpenELEC/dvb-firmware/raw/dc7cf270e328de144e75a30d970b6e147e8bcb6e/firmware/dvb-demod-si2168-a30-01.fw

I think the second one is newer, but don't have the means to verify right now...

Cheers,
-olli

On 4 March 2016 at 10:15, Jurgen Kramer <gtmkra...@xs4all.nl> wrote:
> Hi Olli,
>
> On Thu, 2016-03-03 at 13:02 +0200, Olli Salonen wrote:
>> Hi Jurgen, Torbjörn,
>>
>> I've noticed that there is currently a small confusion about the
>> firmware versions for the Si2168-A20 demodulator. This is used in the
>> older versions of DVBSky T680C (TechnoTrend CT2-4650 CI) and DVBSky
>> T980C (TechnoTrend CT2-4500 CI).
>>
>> The version 2.0.5 does not support PLP handling and seems to work
>> very
>> badly with the Linux driver - at least for me. Version 2.0.35 on the
>> other hand seems to find all DVB-T/T2 channels for me just fine with
>> both dvbv5-scan and w_scan (devices used for this test: TechnoTrend
>> CT2-4650 CI and TechnoTrend CT2-4500 CI new version).
>>
>> Versions used:
>> dvbv5-scan version 1.7.0
>> w_scan version 20150111 (compiled for DVB API 5.10)
>>
>> So if you are running these Si2168-A20 based devices, make sure
>> you've
>> got the firmware 2.0.35 that can be downloaded for example here:
>> http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-A20/32e06713
>> b33915f674bfb2c209beaea5/
>
> It seems my TC980Cs have Si2168-A30's on board
>
> [  118.526665] si2168 8-0064: found a 'Silicon Labs Si2168-A30'
> [  118.640642] si2168 8-0064: downloading firmware from file 'dvb-
> demod-si2168-a30-01.fw'
> [  121.762983] si2168 8-0064: firmware version: 3.0.16
>
> dvbv5_scan does not work me.
> sha1sum for this firmware is:
> 59a0b90703d65229fb2589b52834ca68d1e96ad9  dvb-demod-si2168-a30-01.fw
>
> Jurgen
>
--
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: AverMedia HD Duet (White Box) A188WB drivers

2016-03-03 Thread Olli Salonen
Hi Manu,

How's it going with the SAA7160? I'd be really happy to see the driver
being mainlined, but do not really understand if there is some major
showstoppers still that keep this from happening.

Luis has his personal media_tree here
https://github.com/ljalves/linux_media/wiki that contains Manu's
SAA7160 driver and as far as I understand many people are using that
tree with good success. If that could integrated into the tree, I'm
sure the community can help to iron out any possible issues existing
there still.

Cheers,
-olli

On 7 December 2015 at 14:06, Manu Abraham  wrote:
> Hi Jemma,
>
> I am having a downtime, the development machine in a recovery
> process. If things go well, expecting the system next week.
>
> Regards,
>
> Manu
>
>
> On Mon, Dec 7, 2015 at 3:52 PM, Jemma Denson  wrote:
>> Hi Manu,
>>
>> On 08/10/15 17:28, Manu Abraham wrote:
>>>
>>> Hi,
>>>
>>> I just got back at work again. Will set things up this weekend/next week.
>>
>>
>> Have you had a chance to make any more progress on this?
>>
>> As you're probably aware there are quite a few drivers waiting for saa716x
>> to be integrated into the tree; if you need some help here is the work
>> remaining to be done something that can be picked up by other people?
>>
>> Regards,
>>
>> Jemma.
>>
>>
>>
> --
> 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] media: fix null pointer dereference in v4l_vb2q_enable_media_source()

2016-03-03 Thread Olli Salonen
Hi Shuah,

Thanks for your quick reaction. This patch seems to fix the oops I got earlier.

Tested-by: Olli Salonen <olli.salo...@iki.fi>

Cheers,
-olli

On 4 March 2016 at 04:24, Shuah Khan <shua...@osg.samsung.com> wrote:
> Fix the null pointer dereference in v4l_vb2q_enable_media_source().
> DVB only drivers don't have valid struct v4l2_fh pointer.
>
> [  548.443272] BUG: unable to handle kernel NULL pointer dereference
> at 0010
> [  548.452036] IP: []
> v4l_vb2q_enable_media_source+0x9/0x50 [videodev]
> [  548.460792] PGD b820e067 PUD bb3df067 PMD 0
> [  548.465582] Oops:  [#1] SMP
>
> Signed-off-by: Shuah Khan <shua...@osg.samsung.com>
> Reported-by: Olli Salonen <olli.salo...@iki.fi>
> ---
>  drivers/media/v4l2-core/v4l2-mc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-mc.c 
> b/drivers/media/v4l2-core/v4l2-mc.c
> index 643686d..a39a3cd 100644
> --- a/drivers/media/v4l2-core/v4l2-mc.c
> +++ b/drivers/media/v4l2-core/v4l2-mc.c
> @@ -214,6 +214,8 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q)
>  {
> struct v4l2_fh *fh = q->owner;
>
> -   return v4l_enable_media_source(fh->vdev);
> +   if (fh && fh->vdev)
> +   return v4l_enable_media_source(fh->vdev);
> +   return 0;
>  }
>  EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source);
> --
> 2.5.0
>
--
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 v3 13/22] media: Change v4l-core to check if source is free

2016-03-03 Thread Olli Salonen
Hello Shuah,

This patch seems to cause issues with my setup. Basically, when I try
to tune to a channel, I get an oops. I'm using TechnoTrend CT2-4650
PCIe DVB-T tuner (cx23885).

Here's the oops:

[  548.443272] BUG: unable to handle kernel NULL pointer dereference
at 0010
[  548.452036] IP: []
v4l_vb2q_enable_media_source+0x9/0x50 [videodev]
[  548.460792] PGD b820e067 PUD bb3df067 PMD 0
[  548.465582] Oops:  [#1] SMP
[  548.469199] Modules linked in: sp2(OE) si2157(OE) si2168(OE)
cx25840(OE) cx23885(OE) altera_ci(OE) tda18271(OE) altera_stapl(OE)
videobuf2_dvb(OE) m88ds3103(OE) tveeprom(OE) cx2341x(OE) dvb_core(OE)
rc_core(OE) videobuf2_dma_sg(OE) videobuf2_memops(OE)
frame_vector(POE) v4l2_common(OE) videobuf2_v4l2(OE)
videobuf2_core(OE) videodev(OE) media(OE) i2c_mux snd_pcm snd_timer
snd soundcore des_generic md4 nls_utf8 cifs fscache ipmi_ssif
intel_powerclamp coretemp kvm_intel kvm crct10dif_pclmul crc32_pclmul
ghash_clmulni_intel gpio_ich aesni_intel aes_x86_64 lrw gf128mul
glue_helper ablk_helper cryptd serio_raw i7core_edac ipmi_si edac_core
shpchp ipmi_msghandler tpm_infineon lpc_ich lp 8250_fintek mac_hid
parport igb i2c_algo_bit dca ahci ptp libahci pps_core [last unloaded:
tveeprom]
[  548.546864] CPU: 12 PID: 18651 Comm: dvbv5-scan Tainted: P
IOE   4.1.7-040107-generic #201509131330
[  548.557833] Hardware name: HP ProLiant DL160 G6  , BIOS O33 07/01/2013
[  548.565117] task: 880239c9b250 ti: 88013a738000 task.ti:
88013a738000
[  548.573466] RIP: 0010:[]  []
v4l_vb2q_enable_media_source+0x9/0x50 [videodev]
[  548.584936] RSP: 0018:88013a73bba0  EFLAGS: 00010287
[  548.590862] RAX:  RBX: 88023a55e828 RCX: 88023a55e9b0
[  548.598824] RDX: 0002 RSI: 0001 RDI: 88023a55e828
[  548.606788] RBP: 88013a73bbc8 R08: 02f0 R09: 
[  548.614751] R10: 81ab5eb7 R11: eadad080 R12: 88013a7c7000
[  548.622712] R13:  R14: 88023a55e9a8 R15: 0020
[  548.630675] FS:  7fe55f94d740() GS:88013bb8()
knlGS:
[  548.639704] CS:  0010 DS:  ES:  CR0: 8005003b
[  548.646114] CR2: 0010 CR3: baa41000 CR4: 06e0
[  548.654076] Stack:
[  548.656318]  c01caf15 88013a7c7000 
88023a55e9a8
[  548.664610]  88023a55e828 88013a73bc18 c01cce13
c01cd689
[  548.672902]  0021 8163 88023a55e828
c01f2220
[  548.681194] Call Trace:
[  548.683926]  [] ? vb2_core_streamon+0x125/0x170
[videobuf2_core]
[  548.692376]  [] __vb2_init_fileio+0x273/0x2f0
[videobuf2_core]
[  548.700631]  [] ? vb2_thread_start+0x69/0x9e0
[videobuf2_core]
[  548.708886]  [] ? vb2_dvb_start_feed+0xc0/0xc0
[videobuf2_dvb]
[  548.717141]  [] vb2_thread_start+0x96/0x9e0
[videobuf2_core]
[  548.725204]  [] ? map_vm_area+0x35/0x40
[  548.731228]  [] vb2_dvb_start_feed+0x88/0xc0
[videobuf2_dvb]
[  548.739290]  []
dmx_section_feed_start_filtering+0xe1/0x1b0 [dvb_core]
[  548.748322]  []
dvb_dmxdev_filter_start+0x20e/0x470 [dvb_core]
[  548.756578]  [] dvb_demux_do_ioctl+0x2a3/0x700 [dvb_core]
[  548.764349]  [] dvb_usercopy+0x115/0x190 [dvb_core]
[  548.771539]  [] ? update_curr+0xe4/0x180
[  548.777663]  [] ?
dvb_dmxdev_filter_start+0x470/0x470 [dvb_core]
[  548.786112]  [] ? pick_next_entity+0xa9/0x190
[  548.792716]  [] ? pick_next_task_fair+0x65b/0x910
[  548.799710]  [] dvb_demux_ioctl+0x15/0x20 [dvb_core]
[  548.806994]  [] do_vfs_ioctl+0x2f8/0x510
[  548.813117]  [] ? __schedule+0x386/0x9a0
[  548.819237]  [] SyS_ioctl+0x81/0xa0
[  548.824872]  [] ? schedule+0x37/0x90
[  548.830608]  [] ? math_state_restore+0xdb/0x1d0
[  548.837401]  [] system_call_fastpath+0x16/0x75
[  548.844103] Code: 8b 80 c8 05 00 00 48 85 c0 74 07 55 48 89 e5 ff
d0 5d f3 c3 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90
48 8b 47 18 <48> 8b 78 10 48 8b 07 48 85 c0 74 2b 48 8b 90 c0 05 00 00
31 c0
[  548.865851] RIP  []
v4l_vb2q_enable_media_source+0x9/0x50 [videodev]
[  548.874704]  RSP 
[  548.878593] CR2: 0010
[  548.882304] ---[ end trace 38ce56384a5e39e2 ]---

Here's the git bisect result:

77fa4e072998705883c4dc672963b4bf7483cea9 is the first bad commit
commit 77fa4e072998705883c4dc672963b4bf7483cea9
Author: Shuah Khan 
Date:   Thu Feb 11 21:41:29 2016 -0200

[media] media: Change v4l-core to check if source is free

Change s_input, s_fmt, s_tuner, s_frequency, querystd, s_hw_freq_seek,
and vb2_core_streamon interfaces that alter the tuner configuration to
check if it is free, by calling v4l_enable_media_source().

If source isn't free, return -EBUSY.

v4l_disable_media_source() is called from v4l2_fh_exit() to release
tuner (source).

vb2_core_streamon() uses v4l_vb2q_enable_media_source().

Signed-off-by: Shuah Khan 
Signed-off-by: Mauro 

Re: DVBSky T980C CI issues (kernel 4.0.x)

2016-03-03 Thread Olli Salonen
Hi Jurgen, Torbjörn,

I've noticed that there is currently a small confusion about the
firmware versions for the Si2168-A20 demodulator. This is used in the
older versions of DVBSky T680C (TechnoTrend CT2-4650 CI) and DVBSky
T980C (TechnoTrend CT2-4500 CI).

The version 2.0.5 does not support PLP handling and seems to work very
badly with the Linux driver - at least for me. Version 2.0.35 on the
other hand seems to find all DVB-T/T2 channels for me just fine with
both dvbv5-scan and w_scan (devices used for this test: TechnoTrend
CT2-4650 CI and TechnoTrend CT2-4500 CI new version).

Versions used:
dvbv5-scan version 1.7.0
w_scan version 20150111 (compiled for DVB API 5.10)

So if you are running these Si2168-A20 based devices, make sure you've
got the firmware 2.0.35 that can be downloaded for example here:
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-A20/32e06713b33915f674bfb2c209beaea5/

Cheers,
-olli

On 20 February 2016 at 19:20, Jurgen Kramer <gtmkra...@xs4all.nl> wrote:
> Hi,
>
> On Sat, 2016-02-20 at 16:57 +0100, Torbjorn Jansson wrote:
>> i have tested your patch with my dvbsky dvb-t2 card.
>> testing was done by compiling a custom kernel with your patch
>> included.
>> test was done against fedora 22 4.3.4-200 kernel
>>
>> with the patch included the CI slot is found.
>> so there is some progress for sure
>> -
>> [   10.189408] cx25840 11-0044: loaded v4l-cx23885-avcore-01.fw
>> firmware
>> (16382 bytes)
>> [   10.206683] cx23885_dvb_register() allocating 1 frontend(s)
>> [   10.207968] cx23885[0]: cx23885 based dvb card
>> [   10.224306] i2c i2c-10: Added multiplexed i2c bus 12
>> [   10.225633] si2168 10-0064: Silicon Labs Si2168 successfully
>> attached
>> [   10.243310] si2157 12-0060: Silicon Labs Si2147/2148/2157/2158
>> successfully attached
>> [   10.244560] DVB: registering new adapter (cx23885[0])
>> [   10.245807] cx23885 :07:00.0: DVB: registering adapter 0
>> frontend
>> 0 (Silicon Labs Si2168)...
>> [   10.417402] sp2 9-0040: CIMaX SP2 successfully attached
>> [   10.447120] DVBSky T980C MAC address: 00:17:42:54:09:85
>> [   10.448844] cx23885_dev_checkrevision() Hardware revision = 0xa5
>> [   10.450550] cx23885[0]/0: found at :07:00.0, rev: 4, irq: 19,
>> latency: 0, mmio: 0xf6e0
>>
>> later when tuning:
>>
>> [   67.728109] si2168 10-0064: found a 'Silicon Labs Si2168-A20'
>> [   67.802203] si2168 10-0064: downloading firmware from file
>> 'dvb-demod-si2168-a20-01.fw'
>> [   68.968336] si2168 10-0064: firmware version: 2.0.5
>> [   68.977071] si2157 12-0060: found a 'Silicon Labs Si2158-A20'
>> [   69.961057] si2157 12-0060: downloading firmware from file
>> 'dvb-tuner-si2158-a20-01.fw'
>> [   70.969094] si2157 12-0060: firmware version: 2.1.9
>> 
>>
>> but using dvbv5-scan to scan it doesn't find any channel.
>> all i get is this:
>> 
>> Scanning frequency #1 77000
>> (0x00) Signal= -114.00dBm
>> Scanning frequency #2 75400
>> (0x00) Signal= -27.00dBm C/N= 32.50dB
>> Scanning frequency #3 54600
>> (0x00) Signal= -25.00dBm C/N= 33.75dB
>> Scanning frequency #4 65000
>> (0x00) Signal= -18.00dBm C/N= 36.00dB
>> Scanning frequency #5 52200
>> (0x00) Signal= -28.00dBm C/N= 33.00dB
>> ----
>>
>> so something else is broken too.
>>
> I have been using the patches for a few days. So far everything works
> great (using MythTV). Scanning with dvbv5_scan does indeed not work
> (never did for me). w_scan works though.
>
> Can these patches please be included in the stable kernels ?
>
> Jurgen
>
>
>> On 2016-02-16 21:20, Olli Salonen wrote:
>> > Hi all,
>> >
>> > Found the issue and submitted a patch.
>> >
>> > The I2C buses for T980C/T2-4500CI were crossed when CI registration
>> > was moved to its own function.
>> >
>> > Cheers,
>> > -olli
>> >
>> > On 31 January 2016 at 10:55, Torbjorn Jansson
>> > <torbjorn.jans...@mbox200.swipnet.se> wrote:
>> > > this ci problem is the reason i decided to buy the CT2-4650 usb
>> > > based device
>> > > instead.
>> > > but the 4650 was a slightly newer revision needing a patch i
>> > > submitted
>> > > earlier.
>> > > and also this 4650 device does not have auto switching between
>> > > dvb-t and t2
>> > > like the dvbsky card have, so i also need an updated version of
>> > > mythtv.
>> > >
>> > > my long term wish is to

[PATCH 1/2] dw2102: ts2020 included twice

2016-03-02 Thread Olli Salonen
ts2020.h was already included a few lines earlier. Remove the unnecessary entry.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/usb/dvb-usb/dw2102.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index dd46d6c..8fd1aae 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -33,7 +33,6 @@
 #include "tda18271.h"
 #include "cxd2820r.h"
 #include "m88ds3103.h"
-#include "ts2020.h"
 
 /* Max transfer size done by I2C transfer functions */
 #define MAX_XFER_SIZE  64
-- 
1.7.0.4

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


[PATCH 2/2] dw2102: add support for TeVii S662

2016-03-02 Thread Olli Salonen
TeVii S662 is a USB 2.0 DVB-S2 tuner that's identical to TechnoTrend
S2-4600 tuner. Add the USB ID to dw2102 driver.

Signed-off-by: Olli Salonen <olli.salo...@iki.fi>
---
 drivers/media/usb/dvb-usb/dw2102.c |   23 +--
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 8fd1aae..aa9a203 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -1,9 +1,10 @@
 /* DVB USB framework compliant Linux driver for the
  * DVBWorld DVB-S 2101, 2102, DVB-S2 2104, DVB-C 3101,
- * TeVii S600, S630, S650, S660, S480, S421, S632
+ * TeVii S421, S480, S482, S600, S630, S632, S650, S660, S662,
  * Prof 1100, 7500,
  * Geniatech SU3000, T220,
- * TechnoTrend S2-4600 Cards
+ * TechnoTrend S2-4600,
+ * Terratec Cinergy S2 cards
  * Copyright (C) 2008-2012 Igor M. Liplianin (liplia...@me.by)
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -65,6 +66,10 @@
 #define USB_PID_TEVII_S660 0xd660
 #endif
 
+#ifndef USB_PID_TEVII_S662
+#define USB_PID_TEVII_S662 0xd662
+#endif
+
 #ifndef USB_PID_TEVII_S480_1
 #define USB_PID_TEVII_S480_1 0xd481
 #endif
@@ -1688,6 +1693,7 @@ enum dw2102_table_entry {
TEVII_S482_1,
TEVII_S482_2,
TERRATEC_CINERGY_S2_BOX,
+   TEVII_S662
 };
 
 static struct usb_device_id dw2102_table[] = {
@@ -1716,6 +1722,7 @@ static struct usb_device_id dw2102_table[] = {
[TEVII_S482_1] = {USB_DEVICE(0x9022, 0xd483)},
[TEVII_S482_2] = {USB_DEVICE(0x9022, 0xd484)},
[TERRATEC_CINERGY_S2_BOX] = {USB_DEVICE(USB_VID_TERRATEC, 0x0105)},
+   [TEVII_S662] = {USB_DEVICE(0x9022, USB_PID_TEVII_S662)},
{ }
 };
 
@@ -2233,7 +2240,7 @@ static struct dvb_usb_device_properties 
tt_s2_4600_properties = {
} },
}
},
-   .num_device_descs = 4,
+   .num_device_descs = 5,
.devices = {
{ "TechnoTrend TT-connect S2-4600",
{ _table[TECHNOTREND_S2_4600], NULL },
@@ -2251,6 +2258,10 @@ static struct dvb_usb_device_properties 
tt_s2_4600_properties = {
{ _table[TERRATEC_CINERGY_S2_BOX], NULL },
{ NULL },
},
+   { "TeVii S662",
+   { _table[TEVII_S662], NULL },
+   { NULL },
+   },
}
 };
 
@@ -2364,10 +2375,10 @@ module_usb_driver(dw2102_driver);
 MODULE_AUTHOR("Igor M. Liplianin (c) liplia...@me.by");
 MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101, 2102, DVB-S2 2104,"
" DVB-C 3101 USB2.0,"
-   " TeVii S600, S630, S650, S660, S480, S421, S632"
-   " Prof 1100, 7500 USB2.0,"
+   " TeVii S421, S480, S482, S600, S630, S632, S650,"
+   " TeVii S660, S662, Prof 1100, 7500 USB2.0,"
" Geniatech SU3000, T220,"
-   " TechnoTrend S2-4600 devices");
+   " TechnoTrend S2-4600, Terratec Cinergy S2 devices");
 MODULE_VERSION("0.1");
 MODULE_LICENSE("GPL");
 MODULE_FIRMWARE(DW2101_FIRMWARE);
-- 
1.7.0.4

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


Re: Changes in dw2102.c to support my Tevii S662

2015-12-06 Thread Olli Salonen
Hello Steffen,

The patch itself looks valid. If you could submit it in a formally
correct format it could probably be added to the linux-media tree for
other people's enjoyment as well. Have a look at points 2, 6, 10 and
11 in the following link:
https://www.kernel.org/doc/Documentation/SubmittingPatches

Cheers,
-olli

On 6 December 2015 at 10:03, Steffen Günther  wrote:
> Hi,
>
> I made some small changes on top of this patch
>
> https://patchwork.linuxtv.org/patch/28925/
>
> to support my Tevii S662 with module dvb-usb-dw2102.
>
> Scanning and tuning in works for me.
>
> Hope this is usefull!?
>
> Regards
> Steffen
--
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: DVBSky T330 DVB-C regression Linux 4.1.12 to 4.3

2015-11-09 Thread Olli Salonen
Hi Stephan,

I had a look at recent changes to si2168 and dvb-usb-dvbsky drivers
that are the ones most relevant here. si2157 is probably not the issue
here as your demod does lock.

si2168:

2015-08-11[media] dvb-frontends: Drop owner assignment from i2c_driver
2015-06-09[media] dvb: Get rid of typedev usage for enums
2015-06-05[media] si2168: Implement own I2C adapter locking

dvb-usb-dvbsky:

2015-10-03[media] Add Terratec H7 Revision 4 to DVBSky driver
2015-06-10[media] TS2020: Calculate tuner gain correctly
2015-06-09[media] dvb: Get rid of typedev usage for enums

All these changes seem rather innocent. I've got the same tuner (sold
as a TechnoTrend device) and I could try the 4.3 kernel to confirm
it's still ok for DVB-T/T2 broadcasts that I've got available here,
but it'll be a while as I'm travelling at the moment. Hopefully
someone else can confirm before that.

Cheers,
-olli


On 8 November 2015 at 02:37, Stephan Eisvogel  wrote:
> Hi Antti, hi Olli,
>
> I'm a Raspberry Pi 2 + TVHeadend + DVBSky T330 clone owner/user and am
> observing
> a regression from Linux 4.1.12 to 4.3. TVheadend is delivering this error:
>
> Nov 04 19:32:17 RPI2 tvheadend[714]: mpegts: 450MHz in Kabel Deutschland -
> scan no data, failed
>
> Basically EPG and TV is full dead. I saw the
>
>   "9cd700e m88ds3103: use own update_bits() implementation"
>   "a8e2219 m88ds3103: use regmap for I2C register access"
>
> bits that went into 4.3 recently. Anything like that applicable to the
> Si2168/Si2157 USB varieties?
>
> Device:
>
> Bus 001 Device 005: ID 0572:0320 Conexant Systems (Rockwell), Inc. DVBSky
> T330 DVB-T2/C tuner
>
> Relevant dmesg:
>
> [2.063240] usb 1-1.2: new high-speed USB device number 5 using dwc_otg
> [2.157399] usb 1-1.2: New USB device found, idVendor=0572,
> idProduct=0320
> [2.157422] usb 1-1.2: New USB device strings: Mfr=1, Product=2,
> SerialNumber=3
> [2.157433] usb 1-1.2: Product: DVB-T2/C USB-Stick
> [2.157443] usb 1-1.2: Manufacturer: Bestunar Inc
> [2.157453] usb 1-1.2: SerialNumber: 20140126
> [6.273255] usb 1-1.2: dvb_usb_v2: found a 'DVBSky T330' in warm state
> [6.273832] usb 1-1.2: dvb_usb_v2: will pass the complete MPEG2 transport
> stream to the software demuxer
> [6.273921] DVB: registering new adapter (DVBSky T330)
> [6.275286] usb 1-1.2: dvb_usb_v2: MAC address: 00:cc:10:a5:33:0c
> [6.474110] i2c i2c-3: Added multiplexed i2c bus 4
> [6.474138] si2168 3-0064: Silicon Labs Si2168 successfully attached
> [6.680772] si2157 4-0060: Silicon Labs Si2147/2148/2157/2158
> successfully attached
> [6.680835] usb 1-1.2: DVB: registering adapter 0 frontend 0 (Silicon
> Labs Si2168)...
> [6.933236] Registered IR keymap rc-dvbsky
> [6.933705] input: DVBSky T330 as
> /devices/platform/soc/3f98.usb/usb1/1-1/1-1.2/rc/rc0/input4
> [6.933972] rc0: DVBSky T330 as
> /devices/platform/soc/3f98.usb/usb1/1-1/1-1.2/rc/rc0
> [6.933998] usb 1-1.2: dvb_usb_v2: schedule remote query interval to 300
> msecs
> [6.934013] usb 1-1.2: dvb_usb_v2: 'DVBSky T330' successfully initialized
> and connected
> [6.934146] usbcore: registered new interface driver dvb_usb_dvbsky
> [   15.066829] si2168 3-0064: found a 'Silicon Labs Si2168-B40'
> [   15.086772] si2168 3-0064: downloading firmware from file
> 'dvb-demod-si2168-b40-01.fw'
> [   16.568679] si2168 3-0064: firmware version: 4.0.19
> [   16.579069] si2157 4-0060: found a 'Silicon Labs Si2158-A20'
> [   16.599232] si2157 4-0060: downloading firmware from file
> 'dvb-tuner-si2158-a20-01.fw'
> [   17.581060] si2157 4-0060: firmware version: 2.1.6
> [   17.581145] usb 1-1.2: DVB: adapter 0 frontend 0 frequency 0 out of range
> (5500..86200)
>
>
> Thanks for any insight!
>
> Best regards from Nuremberg/Germany,
> Stephan
>
--
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: Geniatech / Mygica T230

2015-11-05 Thread Olli Salonen
Hi Mike,

Can you also paste the dmesg output here, so we can see if the driver
is starting up correctly?

Cheers,
-olli

On 3 November 2015 at 23:35, Mike Parkins  wrote:
> Hi,
> I can't get this dvb-t2 USB device to work despite the linuxtv site
> claiming it is working since 3.19 kernel. I tried talking to the driver
> team on IRC a few months ago and they said they would look at it but I have
> recently pulled the linuxtv git tree and compiled it on my Linux Mint 4.09
> kernel system and it has not changed. Below is the output of a typical
> tuning attempt:
>
> mp@Aurorabox ~ $ dvbv5-scan uk-CrystalPalace -I CHANNEL
> Scanning frequency #1 49000
> Lock   (0x1f) C/N= 28.25dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x11c0
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1200
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1240
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1280
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1600
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1640
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1680
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x16c0
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1700
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1740
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1780
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1804
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1a40
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1a80
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1ac0
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1b00
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the PMT table for service 0x1c00
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the NIT table
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while reading the SDT table
> WARNING: no SDT table - storing channel(s) without their names
> Storing Service ID 4164: '490.00MHz#4164'
> Storing Service ID 4287: '490.00MHz#4287'
> Storing Service ID 4288: '490.00MHz#4288'
> Storing Service ID 4352: '490.00MHz#4352'
> Storing Service ID 4416: '490.00MHz#4416'
> Scanning frequency #2 51400
> Lock   (0x1f) Signal= -29.00dBm C/N= 21.50dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #3 545833000
> Lock   (0x1f) Signal= -30.00dBm C/N= 31.00dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #4 50600
> Lock   (0x1f) Signal= -30.00dBm C/N= 28.50dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #5 48200
> Lock   (0x1f) Signal= -30.00dBm C/N= 21.75dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #6 529833000
> Lock   (0x1f) Signal= -29.00dBm C/N= 21.75dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #7 53800
> Lock   (0x1f) Signal= -29.00dBm C/N= 16.50dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #8 57000
> Lock   (0x1f) Signal= -46.00dBm C/N= 26.50dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> Scanning frequency #9 58600
> Lock   (0x1f) Signal= -39.00dBm C/N= 26.25dB
> ERRORdvb_read_sections: no data read on section filter
> ERRORerror while waiting for PAT table
> mp@Aurorabox ~ $
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More 

Re: [PATCHv2] si2157: Bounds check firmware

2015-10-08 Thread Olli Salonen
Reviewed-by: Olli Salonen <olli.salo...@iki.fi>
Tested-by: Olli Salonen <olli.salo...@iki.fi>


On 6 October 2015 at 01:33, Laura Abbott <labb...@fedoraproject.org> wrote:
>
> When reading the firmware and sending commands, the length
> must be bounds checked to avoid overrunning the size of the command
> buffer and smashing the stack if the firmware is not in the
> expected format. Add the proper check.
>
> Cc: sta...@kernel.org
> Signed-off-by: Laura Abbott <labb...@fedoraproject.org>
> ---
> v2: Set the return code properly
> ---
>  drivers/media/tuners/si2157.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index 5073821..0e1ca2b 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -166,6 +166,11 @@ static int si2157_init(struct dvb_frontend *fe)
>
> for (remaining = fw->size; remaining > 0; remaining -= 17) {
> len = fw->data[fw->size - remaining];
> +   if (len > SI2157_ARGLEN) {
> +   dev_err(>dev, "Bad firmware length\n");
> +   ret = -EINVAL;
> +   goto err_release_firmware;
> +   }
> memcpy(cmd.args, >data[(fw->size - remaining) + 1], len);
> cmd.wlen = len;
> cmd.rlen = 1;
> --
> 2.4.3
>
--
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 2/2] si2157: Bounds check firmware

2015-10-05 Thread Olli Salonen
Hi Laura,

While the patch itself does what it says, the return code for the
si2157_init will be 0 even if there's a faulty firmware file. Wouldn't
it be better to set the return code as -EINVAL like done a few lines
earlier in the code (see below)?

if (fw->size % 17 != 0) {
dev_err(>dev, "firmware file '%s' is invalid\n",
fw_name);
ret = -EINVAL;
goto err_release_firmware;
}

Cheers,
-olli

On 30 September 2015 at 02:10, Laura Abbott  wrote:
> When reading the firmware and sending commands, the length
> must be bounds checked to avoid overrunning the size of the command
> buffer and smashing the stack if the firmware is not in the
> expected format. Add the proper check.
>
> Cc: sta...@kernel.org
> Signed-off-by: Laura Abbott 
> ---
>  drivers/media/tuners/si2157.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index 5073821..ce157ed 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -166,6 +166,10 @@ static int si2157_init(struct dvb_frontend *fe)
>
> for (remaining = fw->size; remaining > 0; remaining -= 17) {
> len = fw->data[fw->size - remaining];
> +   if (len > SI2157_ARGLEN) {
> +   dev_err(>dev, "Bad firmware length\n");
> +   goto err_release_firmware;
> +   }
> memcpy(cmd.args, >data[(fw->size - remaining) + 1], len);
> cmd.wlen = len;
> cmd.rlen = 1;
> --
> 2.4.3
>
--
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: Terratec H7 Rev. 4 is DVBSky

2015-09-15 Thread Olli Salonen
Hi Erik,

Your patch looks good to my eyes. I heard already earlier that the new
H7 is the same as the DVBSky receiver and your experience seems to
confirm that. Could you resend the patch again with a proper title and
a signed-off line to the mailing list?
https://www.kernel.org/doc/Documentation/SubmittingPatches is good
reading as well.

Cheers,
-olli


On 11 September 2015 at 17:04, Erik Andresen  wrote:
> Hi,
>
> I recently got a Terratec H7 in Revision 4 and turned out that it is not
> just a new revision, but a new product with USB ProductID 0x10a5.
> Previous revisions have been AZ6007, but this revision does not work
> with this driver [1].
>
> Output of lsusb (extended output attached):
> Bus 001 Device 011: ID 0ccd:10a5 TerraTec Electronic GmbH
>
> The revision 4 seems to a DVBSky variant, adding its Product ID to
> dvbsky.c with the attached patch enabled me to scan for channels and
> watch DVB-C and DVB-T.
>
> greetings,
> Erik
>
> [1] https://www.mail-archive.com/linux-media@vger.kernel.org/msg70934.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: PCTV Triplestick and Raspberry Pi B+

2015-07-08 Thread Olli Salonen
Patrick has suggested many things here worth trying. In addition, you
can load the modules with more debugging enabled:

unload the modules first
modprobe si2168 dyndbg==pmf
modprobe si2157 dyndbg==pmf
modprobe em28xx debug=1

If you are willing to try, TechnoTrend CT2-4400 has the same si2168
and si2157 chips, but instead of the EM28xx it uses another USB
bridge. There are at least a few reports of people having a working
CT2-4400 with RPi2 here:
http://openelec.tv/forum/71-pvr-live-tv/72071-experimental-support-for-tt-ct2-4400-dvb-t2-c?start=30

Furthermore, kernel 3.16 was the first one to support the TripleStick
and the Si2168/si2157 chips. The drivers for those SiLabs devices have
improved quite significantly since that. Also, be extra careful with
the firmwares - I remember there was something different in the way
kernel 3.16 handled the Si2168 firmware compared to anything newer
than that. If you could try to upgrade the intel devices to 3.17 at
least (or with the latest media-build), download the firmware from
http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/4.0.11/
and place it in /lib/firmware and then redo your test, it would be
helpful.

Cheers,
-olli


On 8 July 2015 at 09:33, Patrick Boettcher patrick.boettc...@posteo.de wrote:
 On Tue, 7 Jul 2015 18:51:16 +0200 (SST) Peter Fassberg p...@leissner.se
 wrote:

 On Tue, 7 Jul 2015, Patrick Boettcher wrote:

  Might be the RF frequency that is truncated on 32bit platforms
  somewhere. That could explain that there is no crash but simply not
  tuning.

 This is the current status:

 ARM 32-bit, kernel 4.0.6, updated media_tree: Works with DVB-T, no lock on 
 DVB-T2.

 Intel 32-bit, kernel 3.16.0, standard media_tree: Locks, but no PSIs 
 detected.

 Intel 64-bit, kernel 3.16.0, standard media_tree: Works like a charm.


 So I don't think that en RF freq is truncated.

 Yes, it was an assumption - not a right one as it turned out. I didn't
 find any obvious 32/64-problem in the si*-drivers you are using.

 I'm too afraid to look into the em*-drivers and I doubt that there is
 any obvious 32/64-bit-problem.

 If I were you, I would try to compare the usb-traffic (using
 usbmon with wireshark) between a working tune on one frequency with one
 standard on each of the 3 scenarios (maybe starting with the intel 32
 and 64 platform).

 For example

 on each platform:

 1) start wireshark-capture on the right USB-port,
 2) plug the device,
 3) tune (tzap) a valid DVB-T frequency
 4) stop capturing

 Then compare the traffic log. Most outgoing data should be
 identical. Incoming data (except monitoring values and TS) should be
 equal as well.

 If you see differences in data-buffer-sizes or during the
 firmware-download-phase or anywhere else, we can try to find the code
 which corresponds and place debug messages. You are lucky, your drivers
 are using embedded firmwares which simplifies the communication between
 the driver and the device.

 regards,
 --
 Patrick.
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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: Unable to compile v4l-dvb in ubuntu 14.04

2015-06-10 Thread Olli Salonen
Hi Michal,

That mercurial repo is updated last time in 2011 as far as I can see.

Really, if you're looking forward to just build the latest media
drivers, run the 4 commands listed here (you may need to install some
depedencies first, like git and run the make install with sudo):
http://git.linuxtv.org/cgit.cgi/media_build.git/about/

Cheers,
-olli


On 9 June 2015 at 12:56, CIJOML CIJOMLovic cij...@gmail.com wrote:
 Hello Olli,

 I think tar.bz2 generated fromhttp://linuxtv.org/hg/v4l-dvb are
 current snaphots from git. Or Am I wrong?
 But back to my problem YES I have kernel 3.16.0-38 and also headers
 3.16.0-38. I also realized that compiler claims 3.6.0, but it is
 wrong. I don't have such kernel.

 Thank you for fix

 Michal

 2015-06-09 12:08 GMT+02:00 Olli Salonen olli.salo...@iki.fi:
 Hi,

 Do you have a specific reason for not using the media_build? You're
 getting the following warning:

 WARNING: You're using an obsolete driver! You shouldn't be using it!
  If you want anything new, you can use:
 http://git.linuxtv.org/media_build.git.
  The tree is still here just to preserve the development history.
  You've been warned.

 Also, check the kernel and linux-header versions you have installed.
 Is it 3.16 or 3.6?

 Cheers,
 -olli

 On 8 June 2015 at 18:06, CIJOML CIJOMLovic cij...@gmail.com wrote:
 Hello,

 I am trying to compile v4l git with no success. I have kernel and
 headers installed.
 Is problem at my side or in source?

 Thank you for help or solving the problem:

 root@Latitude-E5550:/usr/src/v4l-dvb-3724e93f7af5# make
 make -C /usr/src/v4l-dvb-3724e93f7af5/v4l
 make[1]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 No version yet, using 3.16.0-38-generic
 make[1]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 make[1]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 scripts/make_makefile.pl
 Updating/Creating .config
 Preparing to compile for kernel version 3.6.0

 ***WARNING:*** You do not have the full kernel sources installed.
 This does not prevent you from building the v4l-dvb tree if you have the
 kernel headers, but the full kernel source may be required in order to use
 make menuconfig / xconfig / qconfig.

 If you are experiencing problems building the v4l-dvb tree, please try
 building against a vanilla kernel before reporting a bug.

 Vanilla kernels are available at http://kernel.org.
 On most distros, this will compile a newly downloaded kernel:

 cp /boot/config-`uname -r` your kernel dir/.config
 cd your kernel dir
 make all modules_install install

 Please see your distro's web site for instructions to build a new kernel.

 WARNING: You're using an obsolete driver! You shouldn't be using it!
  If you want anything new, you can use:
 http://git.linuxtv.org/media_build.git.
  The tree is still here just to preserve the development history.
  You've been warned.
 Created default (all yes) .config file
 ./scripts/make_myconfig.pl
 make[1]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 make[1]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 perl scripts/make_config_compat.pl /lib/modules/3.6.0-38-generic/build
 ./.myconfig ./config-compat.h
 creating symbolic links...
 ln -sf . oss
 make -C firmware prep
 make[2]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
 make[2]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
 make -C firmware
 make[2]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
   CC  ihex2fw
 Generating vicam/firmware.fw
 Generating dabusb/firmware.fw
 Generating dabusb/bitstream.bin
 Generating ttusb-budget/dspbootcode.bin
 Generating cpia2/stv0672_vp4.bin
 Generating av7110/bootcode.bin
 make[2]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
 Kernel build directory is /lib/modules/3.6.0-38-generic/build
 make -C /lib/modules/3.6.0-38-generic/build
 SUBDIRS=/usr/src/v4l-dvb-3724e93f7af5/v4l CFLAGS=-I../linux/include
 -D__KERNEL__ -I/include -DEXPORT_SYMTAB modules
 make[2]: Entering directory `/usr/src/linux-headers-3.16.0-38-generic'
   CC [M]  /usr/src/v4l-dvb-3724e93f7af5/v4l/tuner-xc2028.o
 In file included from command-line:0:0:
 /usr/src/v4l-dvb-3724e93f7af5/v4l/config-compat.h:1235:1: fatal error:
 include/linux/version.h: No such file or directory
  #endif
  ^
 compilation terminated.
 make[3]: *** [/usr/src/v4l-dvb-3724e93f7af5/v4l/tuner-xc2028.o] Error 1
 make[2]: *** [_module_/usr/src/v4l-dvb-3724e93f7af5/v4l] Error 2
 make[2]: Leaving directory `/usr/src/linux-headers-3.16.0-38-generic'
 make[1]: *** [default] Error 2
 make[1]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 make: *** [all] Error 2


 Best regards

 Michal
 --
 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

Re: Hauppauge 2250 on Ubuntu 15.04

2015-06-10 Thread Olli Salonen
Hi Jeff,

Based on the PCI subsystem ID I think your card is actually HVR-2255
and not the older HVR-2250. Check what it says on the card. Some
people have reported buying a HVR-2250, but receiving actually a
HVR-2255.

Anyway, HVR-2255 is supported by the media_tree these days, but you
need to build the driver yourself before kernel 4.2 is out. Follow the
steps here to do that:
http://git.linuxtv.org/cgit.cgi/media_build.git/about/

Cheers,
-olli

On 10 June 2015 at 19:23, Jeff Allen worthspend...@gmail.com wrote:
 I am trying to get the firmware to load on a fresh install of Ubuntu 15.04
 desktop 64-bit on a new system.

 uname -a
 Linux 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64
 x86_64 x86_64 GNU/Linux

 lshw
 description: Computer
 width: 64 bits
 capabilities: smbios-2.7 vsyscall32
   *-core
description: Motherboard
physical id: 0
  *-memory
   description: System memory
   physical id: 0
   size: 7884MiB
  *-cpu
   product: AMD FX(tm)-8320 Eight-Core Processor
   vendor: Advanced Micro Devices [AMD]
   physical id: 1
   bus info: cpu@0
   size: 1400MHz
   capacity: 3500MHz
   width: 64 bits
   capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8
 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx
 mmxext fxsr_opt pdpe1gb rdtscp x86-64 constant_tsc rep_good nopl nonstop_tsc
 extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2
 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm
 sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce
 nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv
 svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists
 pausefilter pfthreshold vmmcall bmi1 cpufreq

 I have tried for a few hours now.  Many combinations / suggestions from the
 documentation, forum posts, etc.  The most recent attempts were made with
 another fresh install of Ubuntu 15.04 and following the instructions at the
 following link:
 http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-2250

 Here is what I did on my last attempt after the fresh install.

 sudo lshw -C multimedia
   *-multimedia
description: Multimedia controller
product: SAA7164
vendor: Philips Semiconductors
physical id: 0
bus info: pci@:05:00.0
version: 81
width: 64 bits
clock: 33MHz
capabilities: msi pciexpress pm bus_master cap_list
configuration: driver=saa7164 latency=0
resources: irq:47 memory:fe00-fe3f memory:fdc0-fdff

 dmesg | grep 7164

 [0.00] On node 0 totalpages: 2071641
 [0.530288] pci :05:00.0: [1131:7164] type 00 class 0x048000
 [5.977865] saa7164 driver loaded
 [5.977973] saa7164[0]: Your board isn't known (yet) to the driver.
 saa7164[0]: Try to pick one of the existing card configs via
 saa7164[0]: card=n insmod option.  Updating to the latest
 saa7164[0]: version might help as well.
 [5.977976] saa7164[0]: Here are valid choices for the card=n insmod
 option:
 [5.977977] saa7164[0]:card=0 - Unknown
 [5.977978] saa7164[0]:card=1 - Generic Rev2
 [5.977979] saa7164[0]:card=2 - Generic Rev3
 [5.977981] saa7164[0]:card=3 - Hauppauge WinTV-HVR2250
 [5.977981] saa7164[0]:card=4 - Hauppauge WinTV-HVR2200
 [5.977982] saa7164[0]:card=5 - Hauppauge WinTV-HVR2200
 [5.977983] saa7164[0]:card=6 - Hauppauge WinTV-HVR2200
 [5.977984] saa7164[0]:card=7 - Hauppauge WinTV-HVR2250
 [5.977985] saa7164[0]:card=8 - Hauppauge WinTV-HVR2250
 [5.977986] saa7164[0]:card=9 - Hauppauge WinTV-HVR2200
 [5.977987] saa7164[0]:card=10 - Hauppauge WinTV-HVR2200
 [5.978018] CORE saa7164[0]: subsystem: 0070:f111, board: Unknown
 [card=0,autodetected]
 [5.978021] saa7164[0]/0: found at :05:00.0, rev: 129, irq: 47,
 latency: 0, mmio: 0xfe00
 [5.978037] saa7164_initdev() Unsupported board detected, registering
 without firmware


 - created a file at: /etc/modprobe.d/saa7164.conf with the following
 contents

   options saa7164 card=8

 - downloaded the firmware and copied it to /lib/firmware

   wget
 http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164-2010-03-10.1.fw
   cp *.fw /lib/firmware

 -  reboot

 - after reboot

 dmesg | grep 7164

 [0.00] On node 0 totalpages: 2071641
 [0.530265] pci :05:00.0: [1131:7164] type 00 class 0x048000
 [1.571643] device-mapper: ioctl: 4.29.0-ioctl (2014-10-28) initialised:
 dm-de...@redhat.com
 [6.584365] saa7164 driver loaded
 [6.584503] CORE saa7164[0]: subsystem: 0070:f111, board: Hauppauge
 WinTV-HVR2250 [card=8,insmod option]
 [6.584506] saa7164[0]/0: found at :05:00.0, rev: 129, irq: 47,
 latency: 0, mmio: 0xfe00
 [6.758475] 

Re: Unable to compile v4l-dvb in ubuntu 14.04

2015-06-09 Thread Olli Salonen
Hi,

Do you have a specific reason for not using the media_build? You're
getting the following warning:

WARNING: You're using an obsolete driver! You shouldn't be using it!
 If you want anything new, you can use:
http://git.linuxtv.org/media_build.git.
 The tree is still here just to preserve the development history.
 You've been warned.

Also, check the kernel and linux-header versions you have installed.
Is it 3.16 or 3.6?

Cheers,
-olli

On 8 June 2015 at 18:06, CIJOML CIJOMLovic cij...@gmail.com wrote:
 Hello,

 I am trying to compile v4l git with no success. I have kernel and
 headers installed.
 Is problem at my side or in source?

 Thank you for help or solving the problem:

 root@Latitude-E5550:/usr/src/v4l-dvb-3724e93f7af5# make
 make -C /usr/src/v4l-dvb-3724e93f7af5/v4l
 make[1]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 No version yet, using 3.16.0-38-generic
 make[1]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 make[1]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 scripts/make_makefile.pl
 Updating/Creating .config
 Preparing to compile for kernel version 3.6.0

 ***WARNING:*** You do not have the full kernel sources installed.
 This does not prevent you from building the v4l-dvb tree if you have the
 kernel headers, but the full kernel source may be required in order to use
 make menuconfig / xconfig / qconfig.

 If you are experiencing problems building the v4l-dvb tree, please try
 building against a vanilla kernel before reporting a bug.

 Vanilla kernels are available at http://kernel.org.
 On most distros, this will compile a newly downloaded kernel:

 cp /boot/config-`uname -r` your kernel dir/.config
 cd your kernel dir
 make all modules_install install

 Please see your distro's web site for instructions to build a new kernel.

 WARNING: You're using an obsolete driver! You shouldn't be using it!
  If you want anything new, you can use:
 http://git.linuxtv.org/media_build.git.
  The tree is still here just to preserve the development history.
  You've been warned.
 Created default (all yes) .config file
 ./scripts/make_myconfig.pl
 make[1]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 make[1]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 perl scripts/make_config_compat.pl /lib/modules/3.6.0-38-generic/build
 ./.myconfig ./config-compat.h
 creating symbolic links...
 ln -sf . oss
 make -C firmware prep
 make[2]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
 make[2]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
 make -C firmware
 make[2]: Entering directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
   CC  ihex2fw
 Generating vicam/firmware.fw
 Generating dabusb/firmware.fw
 Generating dabusb/bitstream.bin
 Generating ttusb-budget/dspbootcode.bin
 Generating cpia2/stv0672_vp4.bin
 Generating av7110/bootcode.bin
 make[2]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l/firmware'
 Kernel build directory is /lib/modules/3.6.0-38-generic/build
 make -C /lib/modules/3.6.0-38-generic/build
 SUBDIRS=/usr/src/v4l-dvb-3724e93f7af5/v4l CFLAGS=-I../linux/include
 -D__KERNEL__ -I/include -DEXPORT_SYMTAB modules
 make[2]: Entering directory `/usr/src/linux-headers-3.16.0-38-generic'
   CC [M]  /usr/src/v4l-dvb-3724e93f7af5/v4l/tuner-xc2028.o
 In file included from command-line:0:0:
 /usr/src/v4l-dvb-3724e93f7af5/v4l/config-compat.h:1235:1: fatal error:
 include/linux/version.h: No such file or directory
  #endif
  ^
 compilation terminated.
 make[3]: *** [/usr/src/v4l-dvb-3724e93f7af5/v4l/tuner-xc2028.o] Error 1
 make[2]: *** [_module_/usr/src/v4l-dvb-3724e93f7af5/v4l] Error 2
 make[2]: Leaving directory `/usr/src/linux-headers-3.16.0-38-generic'
 make[1]: *** [default] Error 2
 make[1]: Leaving directory `/usr/src/v4l-dvb-3724e93f7af5/v4l'
 make: *** [all] Error 2


 Best regards

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


[PATCH 1/2] saa7164: change Si2168 reglen to 0 bit

2015-06-06 Thread Olli Salonen
The i2c_reg_len for Si2168 should be 0 for correct I2C communication.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/saa7164/saa7164-cards.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-cards.c 
b/drivers/media/pci/saa7164/saa7164-cards.c
index 8a6455d..c2b7382 100644
--- a/drivers/media/pci/saa7164/saa7164-cards.c
+++ b/drivers/media/pci/saa7164/saa7164-cards.c
@@ -621,7 +621,7 @@ struct saa7164_board saa7164_boards[] = {
.name   = SI2168-1,
.i2c_bus_nr = SAA7164_I2C_BUS_2,
.i2c_bus_addr   = 0xc8  1,
-   .i2c_reg_len= REGLEN_8bit,
+   .i2c_reg_len= REGLEN_0bit,
}, {
.id = 0x25,
.type   = SAA7164_UNIT_TUNER,
@@ -635,7 +635,7 @@ struct saa7164_board saa7164_boards[] = {
.name   = SI2168-2,
.i2c_bus_nr = SAA7164_I2C_BUS_2,
.i2c_bus_addr   = 0xcc  1,
-   .i2c_reg_len= REGLEN_8bit,
+   .i2c_reg_len= REGLEN_0bit,
} },
},
 };
-- 
1.9.1

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


[PATCH 2/2] Revert [media] saa7164: Improvements for I2C handling

2015-06-06 Thread Olli Salonen
This reverts commit ad90b6b0f10566d4a5546e27fe455ce3b5e6b6c7.

This patch breaks I2C communication towards Si2168. After reverting and 
applying the other patch in this series the I2C communication is 
correct.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/saa7164/saa7164-api.c | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-api.c 
b/drivers/media/pci/saa7164/saa7164-api.c
index e807703..e7e586c 100644
--- a/drivers/media/pci/saa7164/saa7164-api.c
+++ b/drivers/media/pci/saa7164/saa7164-api.c
@@ -1385,8 +1385,7 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 
addr, u32 reglen, u8 *reg,
 *   08... register address
 */
memset(buf, 0, sizeof(buf));
-   if (reg)
-   memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen);
+   memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen);
*((u32 *)(buf + 0 * sizeof(u32))) = reglen;
*((u32 *)(buf + 1 * sizeof(u32))) = datalen;
 
@@ -1475,14 +1474,6 @@ int saa7164_api_i2c_write(struct saa7164_i2c *bus, u8 
addr, u32 datalen,
 *   04-07 dest bytes to write
 *   08... register address
 */
-   if (datalen == 1) {
-   /* Workaround for issues with i2c components
-* that issue writes with no data. IE: SI2168/2157
-* Increase reglen by 1, strobe out an additional byte,
-* ignored by SI2168/2157.
-*/
-   datalen++;
-   }
*((u32 *)(buf + 0 * sizeof(u32))) = reglen;
*((u32 *)(buf + 1 * sizeof(u32))) = datalen - reglen;
memcpy((buf + 2 * sizeof(u32)), data, datalen);
-- 
1.9.1

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


Re: [PATCH][media] SI2168: Resolve unknown chip version errors with different HVR22x5 models

2015-06-06 Thread Olli Salonen
Hi,

Indeed, the HVR-2205 I have works fine with that patch reverted and
after setting REGLEN_0bit for the Si2168 chips in the saa7164-cards.

The chip detection and firmware load is correct now.

[ 2046.684246] si2168 2-0064: found a 'Silicon Labs Si2168-B40'
[ 2046.684278] si2168 2-0064: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[ 2049.242810] si2168 2-0064: firmware version: 4.0.11
[ 2049.261896] si2157 0-0060: found a 'Silicon Labs Si2157-A30'
[ 2049.294328] si2157 0-0060: firmware version: 3.0.5

I'll send the patches on to linux-media so Steven can evaluate the
impact on other boards, if any.

Cheers,
-olli


On 5 June 2015 at 16:18, Antti Palosaari cr...@iki.fi wrote:
 On 06/05/2015 04:40 PM, Olli Salonen wrote:

 Hi Steven,

 It seems to me that that part of the code is identical to your driver, no?

 The media_tree driver:

 retval = saa7164_api_i2c_read(bus,
   msgs[i].addr,
   0 /* reglen */,
   NULL /* reg */, msgs[i].len, msgs[i].buf);

 It's exactly the same with a little bit different formatting.


 And that looks correct.

 But the patch which does not look correct, or is at least unclear, is that
 [media] saa7164: Improvements for I2C handling
 http://permalink.gmane.org/gmane.comp.video.linuxtv.scm/22211

 First change does not have any effect as len should be zero in any case and
 memcpy() should do nothing.

 Second change looks something that is likely wrong. There is some hack which
 increases data len. All that register len stuff is logically wrong - I2C
 adapter handles just bytes and should not know nothing about client register
 layout. OK, there is some exceptions (like af9035) where I2C firmware
 actually knows register layout for some strange reason.

 So could you remove that patch and test?

 Antti

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


Re: si2168/dvbsky - blind-scan for DVB-T2 with PLP fails

2015-06-05 Thread Olli Salonen
Even easier way to activate dynamic debugging at module load time
(assuming your kernel has dynamic debugging enabled):

modprobe si2168 dyndbg==pmf

Cheers,
-olli

On 4 June 2015 at 21:28, Antti Palosaari cr...@iki.fi wrote:


 On 06/04/2015 08:36 PM, Hurda wrote:

 How can I enable debug-output to get the log-messages like

 http://git.linuxtv.org/cgit.cgi/media_tree.git/tree/drivers/media/dvb-frontends/si2168.c#n164
 ?


 Compile kernel with dynamic debugs. After that you could enable debugs:
 modprobe si2168; echo -n 'module si2168 =pft' 
 /sys/kernel/debug/dynamic_debug/control

 Antti



 Am 28.05.2015 07:26, schrieb Antti Palosaari:

 On 05/28/2015 01:27 AM, Hurda wrote:

 Hello.

 I think I came across a bug in either of the drivers si2168 and dvbsky
 regarding
 blind-scanning DVB-T2-frequencies.

 HW: Technotrend CT2-4400v2 (afaik based on or the same as DVBSky T330)
  demod: Si2168-B40
  tuner: Si2158-A20
 OS: Ubuntu 15.04 (kernel 3.19)

 In Austria, the DVB-T2-service SimpliTV is currently airing up to four
 muxes, next to one or two DVB-T-muxes.
 In my region, the frequencies are 490MHz, 546MHz, 690MHz, 714MHz for
 DVB-T2,
 and 498MHz for DVB-T.
 These numbers might be of interest when reading the logs.

 The peculiar aspect of these T2-muxes is that they're aired on PLP 1
 without
 there being a PLP 0. I think this is also the root of my problem.


 dvbv5-scan is working, but w_scan not?

 Could you hack si2168.c file and test?

 if (c-delivery_system == SYS_DVBT2) {
 /* select PLP */
 cmd.args[0] = 0x52;
 cmd.args[1] = c-stream_id  0xff;
 //cmd.args[2] = c-stream_id == NO_STREAM_ID_FILTER ? 0 : 1;
 cmd.args[2] = 0;
 cmd.wlen = 3;
 cmd.rlen = 1;
 ret = si2168_cmd_execute(client, cmd);
 if (ret)
 goto err;
 }

 Antti



 When doing a blind-scan using w_scan 20140727 on Ubuntu 15.04 (kernel
 3.19),
 w_scan does not find any of these four DVB-T2-muxes.
 It just finds the DVB-T-mux.

 Logs:
 media-tree_dmesg_lsusb.txt http://pastebin.com/0ixFPMSA
 media-tree_w_scan.txt http://pastebin.com/yyG3jSwj

 The found transponder:
 initial_v3_media_build_trunk.conf http://pastebin.com/LmFQavpy
 initial_v5.conf http://pastebin.com/Jx6kymVt

 I also tried a fresh checkout from git.linuxtv.org as of last weekend
 and the
 most recent w_scan version (20141122).

 As you can see, w_scan tries to tune(?) the DVB-T2-frequencies, but
 ultimately doesn't find anything on them.


 Then I tried the DVBSky-linux-driver[1]
 (media_build-bst-20150322.tar.gz)[2]
 from their site, which is using a binary called sit2 for this card.
 Using this driver, w_scan found all four DVB-T2-muxes and the DVB-T-mux.
 Additionally, it found the DVB-T2-muxes during the DVB-T-scan.

 Logs:
 media_build-bst_dmesg_lsusb.txt http://pastebin.com/vJeDMxtu
 media_build-bst_w_scan.txt http://pastebin.com/yhwAYjen

 Found transponders:
 initial_v3_bst.conf http://pastebin.com/ECKQvRWX
 initial_v5_bst.conf http://pastebin.com/CbhY6Hpz

 Of course, doing a channel-scan using dvbv5-scan on these transponders
 worked
 too:

 dvbv5_sit2.conf http://pastebin.com/3W52bbhv
 dvbv5_sit2.log http://pastebin.com/nc66PTkt

 Afterwards, I tried to do a channel-scan with the same initial
 tuning-file
 using the opensource-driver, which also worked:

 dvbv5_si2168.conf http://pastebin.com/A6FbqUL1
 dvbv5_si2168.log http://pastebin.com/ewyVPJR2

 This should verify that tuning PLP 1 without there being PLP 0 is not
 the issue.


 Additionally, if you compare the two channel-lists, you find interesting
 differences:

 The scan with si2168 has AUTO for MODULATION and INVERSION for
 DVB-T2-channels, and for CODE_RATE_LP and INVERSION for
 DVB-T-channels.

 The scan with sit2 has the respective values in the channel-list.

 The dvbv5-scan-logs also differ, as using sit2 also displays the signal
 quality
 during tuning.


 I know that there were changes regarding DVB-T2-scanning[3], but as the
 blog-
 article specifically mentions si2168 and w_scan to be fully
 dvbv5-compliant
 and good for using with DVB-T2, I thought you should know about this
 particular problem.


 In the attachment I've packed the previously linked logs, for archival
 reasons.


 Thank you for your attention.

 [1] http://www.dvbsky.net/Support_linux.html
 [2] http://www.dvbsky.net/download/linux/media_build-bst-150322.tar.gz
 [3] http://blog.palosaari.fi/2014/09/linux-dvb-t2-tuning-problems.html

 PS: Interesting comments regarding auto-detection for si2168:

 http://blog.palosaari.fi/2014/09/linux-dvb-t2-tuning-problems.html?showComment=1427233615765#c8591459871945922951



 http://blog.palosaari.fi/2014/09/linux-dvb-t2-tuning-problems.html?showComment=1427234034259#c6500661729983566638





 --
 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
--
To unsubscribe from this 

Re: [PATCH][media] SI2168: Resolve unknown chip version errors with different HVR22x5 models

2015-06-05 Thread Olli Salonen
Hi Steven,

It seems to me that that part of the code is identical to your driver, no?

The media_tree driver:

retval = saa7164_api_i2c_read(bus,
 msgs[i].addr,
 0 /* reglen */,
 NULL /* reg */, msgs[i].len, msgs[i].buf);

It's exactly the same with a little bit different formatting.

Cheers,
-olli


On 4 June 2015 at 16:03, Steven Toth st...@kernellabs.com wrote:
 On Thu, Jun 4, 2015 at 9:22 AM, Olli Salonen olli.salo...@iki.fi wrote:
 I compiled an old HVR-2205 driver from my git tree:
 https://github.com/trsqr/media_tree/tree/hvr2205

 https://github.com/trsqr/media_tree/commit/61c2ef874b8a9620f498c9a4ab4138e97119462b

 That's the difference perhaps.

 --
 Steven Toth - Kernel Labs
 http://www.kernellabs.com
--
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: Hauppauge WinTV-HVR2205 driver feedback

2015-06-04 Thread Olli Salonen
My card has been always installed in a machine that does not have
Windows, so any interference with the Windows driver should not be an
issue. I found some old console logs from February 21 when I was
trying to put together a driver for the board. It shows that the
Si2168 chip on my board was at that time correctly detected as
Si2168-B40 by the si2168 driver and the 4.0.11 firmware was loaded ok.

[   28.646668] DVB: registering new adapter (saa7164)
[   28.646671] saa7164 :07:00.0: DVB: registering adapter 1
frontend 0 (Silicon Labs Si2168)...
[   28.648633] i2c i2c-4: Added multiplexed i2c bus 6
[   28.648638] si2168 4-0066: Silicon Labs Si2168 successfully attached
[   28.658000] si2157 6-0060: Silicon Labs Si2147/2148/2157/2158
successfully attached
[   28.658439] DVB: registering new adapter (saa7164)
[   28.658442] saa7164 :07:00.0: DVB: registering adapter 2
frontend 0 (Silicon Labs Si2168)...
[   28.732812] init: plymouth-splash main process (1305) terminated
with status 1
[   35.214858] random: nonblocking pool is initialized
[  582.391928] si2168 3-0064: found a 'Silicon Labs Si2168-B40'
[  582.392289] si2168 3-0064: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[  584.946560] si2168 3-0064: firmware version: 4.0.11
[  584.984386] si2157 5-0060: found a 'Silicon Labs Si2157-A30'
[  585.058396] si2157 5-0060: firmware version: 3.0.5

I have some w_scan logs from that day that show that the card was
indeed working.

Cheers,
-olli


On 3 June 2015 at 21:46, Antti Palosaari cr...@iki.fi wrote:
 On 06/03/2015 10:08 PM, Olli Salonen wrote:

 I cold booted my number cruncher after a hiatus of a couple of weeks,
 applied a couple of extra dev_dbg printouts in the si2168_cmd_execute
 and installed the newly built module. The results:

 [  663.147757] si2168 2-0066: Silicon Labs Si2168 successfully attached
 [  663.151735] si2157 1-0060: Silicon Labs Si2147/2148/2157/2158
 successfully attached
 [  663.152436] DVB: registering new adapter (saa7164)
 [  663.152441] saa7164 :07:00.0: DVB: registering adapter 1
 frontend 0 (Silicon Labs Si2168)...
 [  678.690104] si2168:si2168_init: si2168 2-0064:
 [  678.690111] si2168:si2168_cmd_execute: si2168 2-0064: wlen: 13, rlen: 0
 [  678.690115] si2168:si2168_cmd_execute: si2168 2-0064: i2c write: c0
 12 00 0c 00 0d 16 00 00 00 00 00 00
 [  678.693331] si2168:si2168_cmd_execute: si2168 2-0064: wlen: 8, rlen: 1
 [  678.693337] si2168:si2168_cmd_execute: si2168 2-0064: i2c write: c0
 06 01 0f 00 20 20 01
 [  678.701914] si2168:si2168_cmd_execute: si2168 2-0064: i2c read: 80
 [  678.701920] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution
 took 6 ms
 [  678.701923] si2168:si2168_cmd_execute: si2168 2-0064: wlen: 1, rlen: 13
 [  678.701926] si2168:si2168_cmd_execute: si2168 2-0064: i2c write: 02
 [  678.708631] si2168:si2168_cmd_execute: si2168 2-0064: i2c read: 80
 00 44 34 30 02 00 00 00 00 00 00 00
 [  678.708636] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution
 took 2 ms
 [  678.708639] si2168 2-0064: unknown chip version Si2168-
 [  678.714777] si2168:si2168_init: si2168 2-0064: failed=-22
 [  678.727424] si2157 0-0060: found a 'Silicon Labs Si2157-A30'
 [  678.783587] si2157 0-0060: firmware version: 3.0.5

 The answer to the 02 command seems really odd. You can see it is a
 Si2168, version 40, but I'd expect the second octet to say 42 instead
 of 00.


 Yeah, very odd. That byte should be letter A (0x41) or B (0x42) or likely C
 (0x43) in future when current C revision chips are seen.

 Are you really sure it has returned (and worked) 0x42 earlier? Have you used
 Windows driver - I speculate if it could make permanent upgrade to chip to
 change it.

 Timing issues are also possible. Maybe you could test with some extra
 sleeps, like adding 100ms delay between command request and reply.

 Unfortunately value of those 3 bytes are really important as driver selects
 firmware to download according them.

 regards
 Antti

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


Re: [PATCH][media] SI2168: Resolve unknown chip version errors with different HVR22x5 models

2015-06-04 Thread Olli Salonen
I'll test it with my old code I should have hanging around still
somewhere. I'm sure the chip on my card has been previously been
identified as Si2168-B40 by the code (I posted the logs already
earlier) and it definitely has not turned into a Si2168-D40 chip
somehow.

I don't think there's version D here. The third byte in the answer
from the demod indicates which Si21xx chip is being used. For Si2168
there should be decimal value 68, for Si2157 there's value 57, etc.
This how every single Silabs chip I've seen so far indicates it. I
think it is just the fact that the ASCII value of letter D is 68 that
caused you to assume that there's revision D now.

In addition there's the firmware version numbering that Antti points
out. I do have Si2168 devices that have the A20, A30 and B40
firmwares. Also, for all these chips I can find some references in the
internet. There's nothing regarding a Si2168-D40 (which is not a
conclusive proof that one would not exist, of course).

Cheers,
-olli


On 4 June 2015 at 14:47, Antti Palosaari cr...@iki.fi wrote:
 On 06/04/2015 03:38 PM, Steven Toth wrote:

 We're seeing a mix of SI2168 demodulators appearing on HVR2205 and
 HVR2215 cards, the chips are stamped with different build dates,
 verified on my cards.

 The si2168 driver detects some cards fine, others not at all. I can
 reproduce the working and non-working case. The fix, if we detect a
 newer card (D40) load the B firmware.

 This fix works well for me and properly enables DVB-T tuning behavior
 using tzap.

 Thanks to Peter Faulkner-Ball for describing his workaround.


 hymm, I am not sure that patch at all. It is Olli who has been responsible
 adding support for multiple chip revisions, so I will leave that for Olli. I
 have only 2 Si2168 devices and both are B40 version.

 Anyhow, for me it looks like firmware major version is always increased when
 new major revision of chip is made. Due to that I expected 5.0 after B
 version 5.0.
 A 1.0
 A 2.0
 A 3.0
 B 4.0
 C 5.0 ?
 D 6.0 ?


 And how we could explain situation Olli has device that had been working
 earlier, but now it does not? Could you Olli look back you old git tree and
 test if it still works? One possible reason could be also PCIe interface I2C
 adapter bug. Or timing issue.


 regards
 Antti


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


Re: [PATCH][media] SI2168: Resolve unknown chip version errors with different HVR22x5 models

2015-06-04 Thread Olli Salonen
I compiled an old HVR-2205 driver from my git tree:
https://github.com/trsqr/media_tree/tree/hvr2205

And kaboom, the device is identified correctly and correct firmware is loaded:

[  882.227379] si2168 1-0064: found a 'Silicon Labs Si2168-B40'
[  882.227763] si2168 1-0064: downloading firmware from file
'dvb-demod-si2168-b40-01.fw'
[  884.784024] si2168 1-0064: firmware version: 4.0.11
[  884.822457] si2157 3-0060: found a 'Silicon Labs Si2157-A30'
[  884.898296] si2157 3-0060: firmware version: 3.0.5

I also added some additional debug to printout the chip id string
returned by command 02:
[ 1169.056353] si2168 1-0064: chip id string: 80 42 44 34 30 02 00 00
00 00 00 00 01

However, the current media_tree driver makes the card return the
following value:
80 00 44 34 30 02 00 00 00 00 00 00 00

There is something wrong here. Why is the second byte 00 with the
current driver and 42 with my old driver? I don't think we should work
around this issue with the patch suggested.

Cheers,
-olli

On 4 June 2015 at 14:57, Olli Salonen olli.salo...@iki.fi wrote:
 I'll test it with my old code I should have hanging around still
 somewhere. I'm sure the chip on my card has been previously been
 identified as Si2168-B40 by the code (I posted the logs already
 earlier) and it definitely has not turned into a Si2168-D40 chip
 somehow.

 I don't think there's version D here. The third byte in the answer
 from the demod indicates which Si21xx chip is being used. For Si2168
 there should be decimal value 68, for Si2157 there's value 57, etc.
 This how every single Silabs chip I've seen so far indicates it. I
 think it is just the fact that the ASCII value of letter D is 68 that
 caused you to assume that there's revision D now.

 In addition there's the firmware version numbering that Antti points
 out. I do have Si2168 devices that have the A20, A30 and B40
 firmwares. Also, for all these chips I can find some references in the
 internet. There's nothing regarding a Si2168-D40 (which is not a
 conclusive proof that one would not exist, of course).

 Cheers,
 -olli


 On 4 June 2015 at 14:47, Antti Palosaari cr...@iki.fi wrote:
 On 06/04/2015 03:38 PM, Steven Toth wrote:

 We're seeing a mix of SI2168 demodulators appearing on HVR2205 and
 HVR2215 cards, the chips are stamped with different build dates,
 verified on my cards.

 The si2168 driver detects some cards fine, others not at all. I can
 reproduce the working and non-working case. The fix, if we detect a
 newer card (D40) load the B firmware.

 This fix works well for me and properly enables DVB-T tuning behavior
 using tzap.

 Thanks to Peter Faulkner-Ball for describing his workaround.


 hymm, I am not sure that patch at all. It is Olli who has been responsible
 adding support for multiple chip revisions, so I will leave that for Olli. I
 have only 2 Si2168 devices and both are B40 version.

 Anyhow, for me it looks like firmware major version is always increased when
 new major revision of chip is made. Due to that I expected 5.0 after B
 version 5.0.
 A 1.0
 A 2.0
 A 3.0
 B 4.0
 C 5.0 ?
 D 6.0 ?


 And how we could explain situation Olli has device that had been working
 earlier, but now it does not? Could you Olli look back you old git tree and
 test if it still works? One possible reason could be also PCIe interface I2C
 adapter bug. Or timing issue.


 regards
 Antti


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


Re: Hauppauge WinTV-HVR2205 driver feedback

2015-06-03 Thread Olli Salonen
I cold booted my number cruncher after a hiatus of a couple of weeks,
applied a couple of extra dev_dbg printouts in the si2168_cmd_execute
and installed the newly built module. The results:

[  663.147757] si2168 2-0066: Silicon Labs Si2168 successfully attached
[  663.151735] si2157 1-0060: Silicon Labs Si2147/2148/2157/2158
successfully attached
[  663.152436] DVB: registering new adapter (saa7164)
[  663.152441] saa7164 :07:00.0: DVB: registering adapter 1
frontend 0 (Silicon Labs Si2168)...
[  678.690104] si2168:si2168_init: si2168 2-0064:
[  678.690111] si2168:si2168_cmd_execute: si2168 2-0064: wlen: 13, rlen: 0
[  678.690115] si2168:si2168_cmd_execute: si2168 2-0064: i2c write: c0
12 00 0c 00 0d 16 00 00 00 00 00 00
[  678.693331] si2168:si2168_cmd_execute: si2168 2-0064: wlen: 8, rlen: 1
[  678.693337] si2168:si2168_cmd_execute: si2168 2-0064: i2c write: c0
06 01 0f 00 20 20 01
[  678.701914] si2168:si2168_cmd_execute: si2168 2-0064: i2c read: 80
[  678.701920] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution took 6 ms
[  678.701923] si2168:si2168_cmd_execute: si2168 2-0064: wlen: 1, rlen: 13
[  678.701926] si2168:si2168_cmd_execute: si2168 2-0064: i2c write: 02
[  678.708631] si2168:si2168_cmd_execute: si2168 2-0064: i2c read: 80
00 44 34 30 02 00 00 00 00 00 00 00
[  678.708636] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution took 2 ms
[  678.708639] si2168 2-0064: unknown chip version Si2168-
[  678.714777] si2168:si2168_init: si2168 2-0064: failed=-22
[  678.727424] si2157 0-0060: found a 'Silicon Labs Si2157-A30'
[  678.783587] si2157 0-0060: firmware version: 3.0.5

The answer to the 02 command seems really odd. You can see it is a
Si2168, version 40, but I'd expect the second octet to say 42 instead
of 00.

Cheers,
-olli

On 3 June 2015 at 17:34, Antti Palosaari cr...@iki.fi wrote:
 On 06/03/2015 12:29 PM, Olli Salonen wrote:

 I'm seeing the same issue as well. I thought that maybe some recent
 Si2168 changes did impact this, but it does not seem to be the case.

 I made a quick test myself. I reverted the latest si2168 patches one
 by one, but that did not remedy the situation. Anyway, the kernel log
 does not seem to indicate that the si2168_cmd_execute itself would
 fail (which is what happens after the I2C error handling patch in case
 the demod sets the error bit).

 olli@dl160:~/src/media_tree/drivers/media/dvb-frontends$ git log
 --oneline si2168.c

 d4b3830 Revert [media] si2168: add support for gapped clock
 eb62eb1 Revert [media] si2168: add I2C error handling
 7adf99d [media] si2168: add I2C error handling
 8117a31 [media] si2168: add support for gapped clock
 17d4d6a [media] si2168: add support for 1.7MHz bandwidth
 683e98b [media] si2168: return error if set_frontend is called with
 invalid para
 c32b281 [media] si2168: change firmware variable name and type
 9b7839c [media] si2168: print chip version

 dmesg lines when it fails (this is with a card that has worked before):

 [1.336898] saa7164[0]: registered device video0 [mpeg]
 [1.567295] saa7164[0]: registered device video1 [mpeg]
 [1.778660] saa7164[0]: registered device vbi0 [vbi]
 [1.778817] saa7164[0]: registered device vbi1 [vbi]
 [66675.175508] si2168:si2168_init: si2168 2-0064:
 [66675.187299] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution
 took 6 ms
 [66675.194105] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution
 took 2 ms [OLLI: The result of this I2C cmd must be bogus]
 [66675.194110] si2168 2-0064: unknown chip version Si2168-
 [66675.200244] si2168:si2168_init: si2168 2-0064: failed=-22
 [66675.213020] si2157 0-0060: found a 'Silicon Labs Si2157-A30'
 [66675.242856] si2157 0-0060: firmware version: 3.0.5


 Okei, so it has been working earlier... Could you enable I2C debugs to see
 what kind of data that command returns?

 What I suspect in first hand is that Windows driver has downloaded firmware
 to chip and linux driver does it again, but with incompatible firmware,
 which leads to situation it starts failing. But if that is issue you likely
 already noted it.

 regards
 Antti

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


Re: Hauppauge WinTV-HVR2205 driver feedback

2015-06-03 Thread Olli Salonen
I'm seeing the same issue as well. I thought that maybe some recent
Si2168 changes did impact this, but it does not seem to be the case.

I made a quick test myself. I reverted the latest si2168 patches one
by one, but that did not remedy the situation. Anyway, the kernel log
does not seem to indicate that the si2168_cmd_execute itself would
fail (which is what happens after the I2C error handling patch in case
the demod sets the error bit).

olli@dl160:~/src/media_tree/drivers/media/dvb-frontends$ git log
--oneline si2168.c

d4b3830 Revert [media] si2168: add support for gapped clock
eb62eb1 Revert [media] si2168: add I2C error handling
7adf99d [media] si2168: add I2C error handling
8117a31 [media] si2168: add support for gapped clock
17d4d6a [media] si2168: add support for 1.7MHz bandwidth
683e98b [media] si2168: return error if set_frontend is called with invalid para
c32b281 [media] si2168: change firmware variable name and type
9b7839c [media] si2168: print chip version

dmesg lines when it fails (this is with a card that has worked before):

[1.336898] saa7164[0]: registered device video0 [mpeg]
[1.567295] saa7164[0]: registered device video1 [mpeg]
[1.778660] saa7164[0]: registered device vbi0 [vbi]
[1.778817] saa7164[0]: registered device vbi1 [vbi]
[66675.175508] si2168:si2168_init: si2168 2-0064:
[66675.187299] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution took 6 ms
[66675.194105] si2168:si2168_cmd_execute: si2168 2-0064: cmd execution
took 2 ms [OLLI: The result of this I2C cmd must be bogus]
[66675.194110] si2168 2-0064: unknown chip version Si2168-
[66675.200244] si2168:si2168_init: si2168 2-0064: failed=-22
[66675.213020] si2157 0-0060: found a 'Silicon Labs Si2157-A30'
[66675.242856] si2157 0-0060: firmware version: 3.0.5

Cheers,
-olli

On 3 June 2015 at 10:02, Antti Palosaari cr...@iki.fi wrote:
 On 06/03/2015 10:55 AM, Antti Palosaari wrote:

 On 06/03/2015 06:55 AM, Stephen Allan wrote:

 I am aware that there is some development going on for the saa7164
 driver to support the Hauppauge WinTV-HVR2205.  I thought I would post
 some feedback.  I have recently compiled the driver as at 2015-05-31
 using media build tree.  I am unable to tune a channel.  When
 running the following w_scan command:

 w_scan -a4 -ft -cAU -t 3 -X  /tmp/tzap/channels.conf

 I get the following error after scanning the frequency range for
 Australia.

 ERROR: Sorry - i couldn't get any working frequency/transponder
   Nothing to scan!!

 At the same time I get the following messages being logged to the
 Linux console.

 dmesg
 [165512.436662] si2168 22-0066: unknown chip version Si2168-
 [165512.450315] si2157 21-0060: found a 'Silicon Labs Si2157-A30'
 [165512.480559] si2157 21-0060: firmware version: 3.0.5
 [165517.981155] si2168 22-0064: unknown chip version Si2168-
 [165517.994620] si2157 20-0060: found a 'Silicon Labs Si2157-A30'
 [165518.024867] si2157 20-0060: firmware version: 3.0.5
 [165682.334171] si2168 22-0064: unknown chip version Si2168-
 [165730.579085] si2168 22-0064: unknown chip version Si2168-
 [165838.420693] si2168 22-0064: unknown chip version Si2168-
 [166337.342437] si2168 22-0064: unknown chip version Si2168-
 [167305.393572] si2168 22-0064: unknown chip version Si2168-


 Many thanks to the developers for all of your hard work.


 Let me guess they have changed Si2168 chip to latest C version. Driver
 supports only A and B (A20, A30 and B40). I have never seen C version.


 gah, looking the driver I think that is not issue - it will likely print
 unknown chip version Si2168-C.. on that case already. However, I remember
 I have seen that kind of issue earlier too, but don't remember what was
 actual reason. Probably something to do with firmware, wrong firmware and
 loading has failed? Could you make cold boot, remove socket from the wallet
 and wait minute it really powers down, then boot and look what happens.

 regards
 Antti



 --
 http://palosaari.fi/
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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: DVB-T2 PCIe vs DVB-S2

2015-05-26 Thread Olli Salonen
There are indeed a few DVB-T2 PCIe cards that are supported (DVBSky
T9580, T980C, T982C, TechnoTrend CT2-4500 CI, Hauppauge HVR-2205,
Hauppauge HVR-5525 at least come to my mind). PCTV 290e is a USB
device, not PCIe. In the wiki there's currently some issue with the
filtering when it comes to the tables - that's why every PCIe device
is printed instead of just the DVB-T2 supporting ones.

As Jemma points out, the application should be clever enough to tell
the driver that DVB-T2 delivery system is wanted. For the cxd2820r
driver (PCTV 290e) Antti made the fudge, but has decided not to
implement it in the Si2168 driver (reasoning, to which I
wholeheartedly agree, is here:
http://blog.palosaari.fi/2014/09/linux-dvb-t2-tuning-problems.html ).

When it comes to PVR backends, at least tvheadend supports DVBv5 fully
- I don't have a clear picture of other backends.

Cheers,
-olli

On 26 May 2015 at 17:44, Jemma Denson jden...@gmail.com wrote:
 On 26/05/15 08:53, Ian Campbell wrote:

 Hello,

 I'm looking to get a DVB-T2 tuner card to add UK Freeview HD to my
 mythtv box.

 Looking at http://linuxtv.org/wiki/index.php/DVB-T2_PCIe_Cards is seems
 that many (the majority even) of the cards there are actually DVB-S2.

 Is this a mistake or is there something I don't know (like maybe S2 is
 compatible with T2)?

 Thanks,
 Ian.


 That's a mistake - I don't recall that table looking like that when I was
 looking for one, and S2 is quite definitely not compatible with T2!

 I can confirm that the 290e works out of the box with myth with very few
 problems, however it's well out of production now and you might not be after
 a USB device. I'm not sure anything else would work without some hacking
 because last I heard myth doesn't do T2 the proper way using DVBv5 yet, and
 afaik only the 290e driver has a fudge to allow T2 on v3.
 (http://lists.mythtv.org/pipermail/mythtv-users/2014-November/374441.html
 and https://code.mythtv.org/trac/ticket/12342)


 Jemma.
 --
 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 v3 5/6] si2168: add I2C error handling

2015-05-07 Thread Olli Salonen
Hi Antti,

I basically used the same code that was used earlier in the same
function in case i2c_master_send/recv returns an unexpected result.

When working with the RTL2832P based Si2168 device I noticed that at
some point, often but not always during firmware loading, the Si2168
started to return error. When that happened any subsequent firmware
commands would fail as well. So it made sense to interrupt the loading
of firmware at the point when the first error is returned by the
demod. The reason for these I2C problems is not known - two hacks (rc
query interval increase and usage of the new I2C write method) were
used to mitigate the issue.

Based on the descriptions in
https://www.kernel.org/doc/Documentation/i2c/fault-codes EIO could be
applicable, though very loosely specified (which isn't necessary
wrong, as I don't have exact knowledge on which cases the error bit is
set):

EIO
This rather vague error means something went wrong when
performing an I/O operation.  Use a more specific fault
code when you can.

The description for EINVAL doesn't match when it comes to the before
any I/O operation was started, but other than that it might be
usable:

EINVAL
This rather vague error means an invalid parameter has been
detected before any I/O operation was started.  Use a more
specific fault code when you can.

Looking at other DVB drivers, it seems it's mainly EREMOTEIO or EINVAL
that's used, depending on the case.

Cheers,
-olli

On 7 May 2015 at 22:49, Antti Palosaari cr...@iki.fi wrote:
 Moikka!
 I didn't make any tests, but I could guess that error flag is set by
 firmware when some unsupported / invalid parameter is given as a firmware
 command request.

 Anyhow, I am not sure which is proper error code to return. Could you please
 study, check from API docs and so, which are suitable error codes. EINVAL
 sounds proper code, but imho it is not good as generally it is returned by
 driver when invalid parameters are requested and I would like to see some
 other code to make difference (between driver and firmware error).

 regards
 Antti


 On 05/03/2015 04:00 PM, Olli Salonen wrote:

 Return error from si2168_cmd_execute in case the demodulator returns an
 error.

 Signed-off-by: Olli Salonen olli.salo...@iki.fi
 ---
   drivers/media/dvb-frontends/si2168.c | 6 ++
   1 file changed, 6 insertions(+)

 diff --git a/drivers/media/dvb-frontends/si2168.c
 b/drivers/media/dvb-frontends/si2168.c
 index 29a5936..b68ab34 100644
 --- a/drivers/media/dvb-frontends/si2168.c
 +++ b/drivers/media/dvb-frontends/si2168.c
 @@ -60,6 +60,12 @@ static int si2168_cmd_execute(struct i2c_client
 *client, struct si2168_cmd *cmd)
 jiffies_to_msecs(jiffies) -
 (jiffies_to_msecs(timeout) - TIMEOUT));

 +   /* error bit set? */
 +   if ((cmd-args[0]  6)  0x01) {
 +   ret = -EREMOTEIO;
 +   goto err_mutex_unlock;
 +   }
 +
 if (!((cmd-args[0]  7)  0x01)) {
 ret = -ETIMEDOUT;
 goto err_mutex_unlock;


 --
 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/4] dw2102: remove unnecessary printing of MAC address

2015-05-05 Thread Olli Salonen
While reading the MAC address for SU3000-based devices the system was
printing excessive debug information in the logs:

Output before the patch:

[ 1515.780692] bc 00 00 00 00 00
[ 1515.781440] bc ea 00 00 00 00
[ 1515.782251] bc ea 2b 00 00 00
[ 1515.783094] bc ea 2b 46 00 00
[ 1515.783816] bc ea 2b 46 12 00
[ 1515.784565] bc ea 2b 46 12 92
[ 1515.784571] dvb-usb: MAC address: bc:ea:2b:46:12:92

Output after the patch:

[ 3803.495706] dvb-usb: MAC address: bc:ea:2b:46:12:92

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/usb/dvb-usb/dw2102.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 28fd6ba..4ad6bb2 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -928,8 +928,6 @@ static int su3000_read_mac_address(struct dvb_usb_device 
*d, u8 mac[6])
break;
else
mac[i] = ibuf[0];
-
-   debug_dump(mac, 6, printk);
}
 
return 0;
-- 
1.9.1

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


[PATCH 2/4] dw2102: remove unnecessary newline from log printouts

2015-05-05 Thread Olli Salonen
The info and warn functions already add a newline to the end of the
log printouts, so remove the extra newline from the printouts.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/usb/dvb-usb/dw2102.c | 60 +++---
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 4ad6bb2..b1f8a3f 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -307,7 +307,7 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter 
*adap, struct i2c_msg ms
u8 ibuf[MAX_XFER_SIZE], obuf[3];
 
if (2 + msg[1].len  sizeof(ibuf)) {
-   warn(i2c rd: len=%d is too big!\n,
+   warn(i2c rd: len=%d is too big!,
 msg[1].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -332,7 +332,7 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter 
*adap, struct i2c_msg ms
u8 obuf[MAX_XFER_SIZE];
 
if (2 + msg[0].len  sizeof(obuf)) {
-   warn(i2c wr: len=%d is too big!\n,
+   warn(i2c wr: len=%d is too big!,
 msg[1].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -350,7 +350,7 @@ static int dw2102_earda_i2c_transfer(struct i2c_adapter 
*adap, struct i2c_msg ms
u8 obuf[MAX_XFER_SIZE];
 
if (2 + msg[0].len  sizeof(obuf)) {
-   warn(i2c wr: len=%d is too big!\n,
+   warn(i2c wr: len=%d is too big!,
 msg[1].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -426,7 +426,7 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[], i
u8  ibuf[MAX_XFER_SIZE];
 
if (2 + msg[j].len  sizeof(ibuf)) {
-   warn(i2c rd: len=%d is too big!\n,
+   warn(i2c rd: len=%d is too big!,
 msg[j].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -463,7 +463,7 @@ static int dw2104_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[], i
u8 obuf[MAX_XFER_SIZE];
 
if (2 + msg[j].len  sizeof(obuf)) {
-   warn(i2c wr: len=%d is too big!\n,
+   warn(i2c wr: len=%d is too big!,
 msg[j].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -507,7 +507,7 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
u8 ibuf[MAX_XFER_SIZE], obuf[3];
 
if (2 + msg[1].len  sizeof(ibuf)) {
-   warn(i2c rd: len=%d is too big!\n,
+   warn(i2c rd: len=%d is too big!,
 msg[1].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -532,7 +532,7 @@ static int dw3101_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
u8 obuf[MAX_XFER_SIZE];
 
if (2 + msg[0].len  sizeof(obuf)) {
-   warn(i2c wr: len=%d is too big!\n,
+   warn(i2c wr: len=%d is too big!,
 msg[0].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -623,7 +623,7 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
u8 ibuf[MAX_XFER_SIZE];
 
if (msg[j].len  sizeof(ibuf)) {
-   warn(i2c rd: len=%d is too big!\n,
+   warn(i2c rd: len=%d is too big!,
 msg[j].len);
ret = -EOPNOTSUPP;
goto unlock;
@@ -658,7 +658,7 @@ static int s6x0_i2c_transfer(struct i2c_adapter *adap, 
struct i2c_msg msg[],
u8 obuf[MAX_XFER_SIZE];
 
if (2 + msg[j].len  sizeof(obuf)) {
-   warn(i2c wr: len=%d is too big!\n,
+   warn(i2c wr: len=%d is too big!,
 msg[j].len);
ret = -EOPNOTSUPP

[PATCH 4/4] dw2102: resync fifo when demod locks

2015-05-05 Thread Olli Salonen
If the streaming_ctrl is called to enable TS before demod has locked
the TS will be empty. Copied the solution from the dvbsky driver for the
TechnoTrend S2-4600 device: when the state changes from unlock to
lock, call su3000_streaming_ctrl again.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/usb/dvb-usb/dw2102.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 7552521..f9ad57f 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -117,8 +117,13 @@
 
 struct dw2102_state {
u8 initialized;
+   u8 last_lock;
struct i2c_client *i2c_client_tuner;
+
+   /* fe hook functions*/
int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v);
+   int (*fe_read_status)(struct dvb_frontend *fe,
+   fe_status_t *status);
 };
 
 /* debug */
@@ -1001,6 +1006,23 @@ static void dw210x_led_ctrl(struct dvb_frontend *fe, int 
offon)
i2c_transfer(udev_adap-dev-i2c_adap, msg, 1);
 }
 
+static int tt_s2_4600_read_status(struct dvb_frontend *fe, fe_status_t *status)
+{
+   struct dvb_usb_adapter *d =
+   (struct dvb_usb_adapter *)(fe-dvb-priv);
+   struct dw2102_state *st = (struct dw2102_state *)d-dev-priv;
+   int ret;
+
+   ret = st-fe_read_status(fe, status);
+
+   /* resync slave fifo when signal change from unlock to lock */
+   if ((*status  FE_HAS_LOCK)  (!st-last_lock))
+   su3000_streaming_ctrl(d, 1);
+
+   st-last_lock = (*status  FE_HAS_LOCK) ? 1 : 0;
+   return ret;
+}
+
 static struct stv0299_config sharp_z0194a_config = {
.demod_address = 0x68,
.inittab = sharp_z0194a_inittab,
@@ -1553,6 +1575,12 @@ static int tt_s2_4600_frontend_attach(struct 
dvb_usb_adapter *adap)
 
state-i2c_client_tuner = client;
 
+   /* hook fe: need to resync the slave fifo when signal locks */
+   state-fe_read_status = adap-fe_adap[0].fe-ops.read_status;
+   adap-fe_adap[0].fe-ops.read_status = tt_s2_4600_read_status;
+
+   state-last_lock = 0;
+
return 0;
 }
 
-- 
1.9.1

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


[PATCH 3/4] dw2102: debugging improvements

2015-05-05 Thread Olli Salonen
Move some info printouts to be debugging printouts that are only shown
if debugging for the module is enabled. The module already implemented
deb_rc and deb_xfer, but not deb_info.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/usb/dvb-usb/dw2102.c | 6 --
 drivers/media/usb/dvb-usb/dw2102.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index b1f8a3f..7552521 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -881,6 +881,8 @@ static int su3000_streaming_ctrl(struct dvb_usb_adapter 
*adap, int onoff)
.len = 1
};
 
+   deb_info(%s: onoff: %d\n, __func__, onoff);
+
i2c_transfer(adap-dev-i2c_adap, msg, 1);
 
return 0;
@@ -891,7 +893,7 @@ static int su3000_power_ctrl(struct dvb_usb_device *d, int 
i)
struct dw2102_state *state = (struct dw2102_state *)d-priv;
u8 obuf[] = {0xde, 0};
 
-   info(%s: %d, initialized %d, __func__, i, state-initialized);
+   deb_info(%s: %d, initialized %d\n, __func__, i, state-initialized);
 
if (i  !state-initialized) {
state-initialized = 1;
@@ -938,7 +940,7 @@ static int su3000_identify_state(struct usb_device *udev,
 struct dvb_usb_device_description **desc,
 int *cold)
 {
-   info(%s, __func__);
+   deb_info(%s\n, __func__);
 
*cold = 0;
return 0;
diff --git a/drivers/media/usb/dvb-usb/dw2102.h 
b/drivers/media/usb/dvb-usb/dw2102.h
index 5cd0b0e..1602368 100644
--- a/drivers/media/usb/dvb-usb/dw2102.h
+++ b/drivers/media/usb/dvb-usb/dw2102.h
@@ -4,6 +4,7 @@
 #define DVB_USB_LOG_PREFIX dw2102
 #include dvb-usb.h
 
+#define deb_info(args...) dprintk(dvb_usb_dw2102_debug, 0x01, args)
 #define deb_xfer(args...) dprintk(dvb_usb_dw2102_debug, 0x02, args)
 #define deb_rc(args...)   dprintk(dvb_usb_dw2102_debug, 0x04, args)
 #endif
-- 
1.9.1

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


[PATCHv4 0/6] GoTView MasterHD 3 USB tuner

2015-05-05 Thread Olli Salonen
Fourth version of this patch series as there had been new si2157 devices 
that were added to the media_tree since the last submission. The 
si2157-patch in this series now takes care of those devices as well.

Olli Salonen (6):
  si2168: add support for gapped clock
  dvbsky: use si2168 config option ts_clock_gapped
  si2168: add I2C error handling
  si2157: support selection of IF interface
  rtl28xxu: add I2C read without write
  rtl2832: add support for GoTView MasterHD 3 USB tuner

 drivers/media/dvb-frontends/rtl2832.c  |   4 +
 drivers/media/dvb-frontends/rtl2832.h  |   1 +
 drivers/media/dvb-frontends/rtl2832_priv.h |  25 ++
 drivers/media/dvb-frontends/si2168.c   |   9 +++
 drivers/media/dvb-frontends/si2168.h   |   3 +
 drivers/media/dvb-frontends/si2168_priv.h  |   1 +
 drivers/media/pci/cx23885/cx23885-dvb.c|   4 +
 drivers/media/pci/saa7164/saa7164-dvb.c|   3 +
 drivers/media/pci/smipcie/smipcie.c|   1 +
 drivers/media/tuners/si2157.c  |   4 +-
 drivers/media/tuners/si2157.h  |   6 ++
 drivers/media/tuners/si2157_priv.h |   1 +
 drivers/media/usb/cx231xx/cx231xx-dvb.c|   2 +
 drivers/media/usb/dvb-usb-v2/af9035.c  |   1 +
 drivers/media/usb/dvb-usb-v2/dvbsky.c  |   5 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 125 -
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h|   5 ++
 drivers/media/usb/dvb-usb/cxusb.c  |   1 +
 drivers/media/usb/em28xx/em28xx-dvb.c  |   2 +
 19 files changed, 197 insertions(+), 6 deletions(-)

-- 
1.9.1

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


[PATCH v4 1/6] si2168: add support for gapped clock

2015-05-05 Thread Olli Salonen
Add a parameter in si2168_config to support gapped clock. This might be 
necessary on some devices with higher bitrates.

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

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

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


[PATCH v4 2/6] dvbsky: use si2168 config option ts_clock_gapped

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

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

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

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


[PATCH v4 4/6] si2157: support selection of IF interface

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

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 4 
 drivers/media/pci/saa7164/saa7164-dvb.c | 3 +++
 drivers/media/pci/smipcie/smipcie.c | 1 +
 drivers/media/tuners/si2157.c   | 4 +++-
 drivers/media/tuners/si2157.h   | 6 ++
 drivers/media/tuners/si2157_priv.h  | 1 +
 drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++
 drivers/media/usb/dvb-usb-v2/af9035.c   | 1 +
 drivers/media/usb/dvb-usb-v2/dvbsky.c   | 2 ++
 drivers/media/usb/dvb-usb/cxusb.c   | 1 +
 drivers/media/usb/em28xx/em28xx-dvb.c   | 2 ++
 11 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 745caab..37fd013 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
diff --git a/drivers/media/pci/saa7164/saa7164-dvb.c 
b/drivers/media/pci/saa7164/saa7164-dvb.c
index 9969800..e9a783b 100644
--- a/drivers/media/pci/saa7164/saa7164-dvb.c
+++ b/drivers/media/pci/saa7164/saa7164-dvb.c
@@ -111,6 +111,7 @@ static struct lgdt3306a_config hauppauge_hvr2255b_config = {
 
 static struct si2157_config hauppauge_hvr2255_tuner_config = {
.inversion = 1,
+   .if_port = 1,
 };
 
 static int si2157_attach(struct saa7164_port *port, struct i2c_adapter 
*adapter,
@@ -665,6 +666,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
 
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
+   si2157_config.if_port = 1;
si2157_config.fe = port-dvb.frontend;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
@@ -710,6 +712,7 @@ int saa7164_dvb_register(struct saa7164_port *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0xc0  1;
diff --git a/drivers/media/pci/smipcie/smipcie.c 
b/drivers/media/pci/smipcie/smipcie.c
index 4115925..143fd78 100644
--- a/drivers/media/pci/smipcie/smipcie.c
+++ b/drivers/media/pci/smipcie/smipcie.c
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port-fe;
+   si2157_config.if_port = 1;
 
memset(client_info, 0, sizeof(struct i2c_board_info));
strlcpy(client_info.type, si2157

[PATCH v4 5/6] rtl28xxu: add I2C read without write

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

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

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

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

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


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

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

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

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

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

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

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

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/dvb-frontends/rtl2832.c  |   4 +
 drivers/media/dvb-frontends/rtl2832.h  |   1 +
 drivers/media/dvb-frontends/rtl2832_priv.h |  25 ++
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 117 -
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h|   5 ++
 5 files changed, 149 insertions(+), 3 deletions(-)

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

[PATCH v4 3/6] si2168: add I2C error handling

2015-05-05 Thread Olli Salonen
Return error from si2168_cmd_execute in case the demodulator returns an 
error.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/dvb-frontends/si2168.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 29a5936..b68ab34 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -60,6 +60,12 @@ static int si2168_cmd_execute(struct i2c_client *client, 
struct si2168_cmd *cmd)
jiffies_to_msecs(jiffies) -
(jiffies_to_msecs(timeout) - TIMEOUT));
 
+   /* error bit set? */
+   if ((cmd-args[0]  6)  0x01) {
+   ret = -EREMOTEIO;
+   goto err_mutex_unlock;
+   }
+
if (!((cmd-args[0]  7)  0x01)) {
ret = -ETIMEDOUT;
goto err_mutex_unlock;
-- 
1.9.1

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


Re: Mystique SaTiX-S2 Sky V2 USB (DVBSKY S960 clone) - Linux driver.

2015-05-03 Thread Olli Salonen
Hi Steve,

I've got the device in question and can confirm that it works ok.

lsusb definitely should work ok - maybe there's indeed something wrong
with your device. As suggested by P. van Gaans, maybe you can try your
device on another computer or even on Windows and see if it works
there.

Cheers,
-olli


On 2 May 2015 at 03:32, P. van Gaans w3ird_n...@gmx.net wrote:
 On 05/01/2015 04:57 PM, Steve wrote:

 Hi,

 I'm trying a direct mail to you as you are associated with this page:

  http://linuxtv.org/wiki/index.php/DVB-S2_USB_Devices

 I have bought a Mystique SaTiX-S2 Sky V2 USB (DVBSKY S960 clone) - but
 it doesn't work with my 3.19 kernel, which I'd assumed it would from the
 above page.

 I've tried asking about the problem in various ways - first to
 AskUbuntu:


 http://askubuntu.com/questions/613406/absent-frontend0-with-usb-dvbsky-s960-s860-driver-bug


 ... and, more recently, on the Linux-Media mailing list.  Without
 convincing myself that I've contacted the right person/people to give
 constructive feedback.

 By any chance can you offer me some advice about who it is best to
 approach?  (Obviously I'd also be grateful if you can shed any light on
 this problem.)

 Steve



 Hi Steve,

 The page actually states Support in-kernel is expected in Linux kernel
 3.18.. Devil's advocate, but it doesn't say it's actually there or
 guarantees it ever will. At the time it was written, 3.18 wasn't out yet.
 Looking at your dmesg output however it seems your kernel is aware of the
 device. (so the patch made it) As for me, I was offered a bargain for
 another device so I have no S960.

 Linux-media mailing list is the right place. (and here we are) A few quick
 suggestions:

 Did you really, really, really get the right firmware and are you absolutely
 positive it's in the right location and has the right filename? Does dmesg
 mention the firmware being loaded?

 Get/compile the latest v4l-dvb sources.
 (http://linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers)
 Maybe it's just a bug that has already been fixed.

 Try another program to access the device. But if even lsusb hangs, this is
 pretty much moot.

 Make sure the power supply/device is functioning properly. Try it on another
 OS to make sure it's not defective.

 Try another computer, preferably with another chipset. If your RAM is faulty
 or you have a funky USB-controller, you can experience strange problems.

 Good luck!

 Best regards,

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


[PATCH v3 4/6] rtl28xxu: add I2C read without write

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

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

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

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

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


[PATCH v3 5/6] si2168: add I2C error handling

2015-05-03 Thread Olli Salonen
Return error from si2168_cmd_execute in case the demodulator returns an
error.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/dvb-frontends/si2168.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/dvb-frontends/si2168.c 
b/drivers/media/dvb-frontends/si2168.c
index 29a5936..b68ab34 100644
--- a/drivers/media/dvb-frontends/si2168.c
+++ b/drivers/media/dvb-frontends/si2168.c
@@ -60,6 +60,12 @@ static int si2168_cmd_execute(struct i2c_client *client, 
struct si2168_cmd *cmd)
jiffies_to_msecs(jiffies) -
(jiffies_to_msecs(timeout) - TIMEOUT));
 
+   /* error bit set? */
+   if ((cmd-args[0]  6)  0x01) {
+   ret = -EREMOTEIO;
+   goto err_mutex_unlock;
+   }
+
if (!((cmd-args[0]  7)  0x01)) {
ret = -ETIMEDOUT;
goto err_mutex_unlock;
-- 
1.9.1

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


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

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

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

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

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

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

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

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/dvb-frontends/rtl2832.c  |   4 +
 drivers/media/dvb-frontends/rtl2832.h  |   1 +
 drivers/media/dvb-frontends/rtl2832_priv.h |  25 ++
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c| 117 -
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h|   5 ++
 5 files changed, 149 insertions(+), 3 deletions(-)

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

[PATCH v3 1/6] si2168: add support for gapped clock

2015-05-03 Thread Olli Salonen
Add a parameter in si2168_config to support gapped clock. This might be 
necessary on
some devices with higher bitrates.

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

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

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


[PATCH v3 2/6] dvbsky: use si2168 config option ts_clock_gapped

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

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

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

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


[PATCH v3 3/6] si2157: support selection of IF interface

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

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 4 
 drivers/media/pci/smipcie/smipcie.c | 1 +
 drivers/media/tuners/si2157.c   | 4 +++-
 drivers/media/tuners/si2157.h   | 6 ++
 drivers/media/tuners/si2157_priv.h  | 1 +
 drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++
 drivers/media/usb/dvb-usb-v2/af9035.c   | 1 +
 drivers/media/usb/dvb-usb-v2/dvbsky.c   | 2 ++
 drivers/media/usb/dvb-usb/cxusb.c   | 1 +
 drivers/media/usb/em28xx/em28xx-dvb.c   | 2 ++
 10 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 745caab..37fd013 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
diff --git a/drivers/media/pci/smipcie/smipcie.c 
b/drivers/media/pci/smipcie/smipcie.c
index 4115925..143fd78 100644
--- a/drivers/media/pci/smipcie/smipcie.c
+++ b/drivers/media/pci/smipcie/smipcie.c
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port-fe;
+   si2157_config.if_port = 1;
 
memset(client_info, 0, sizeof(struct i2c_board_info));
strlcpy(client_info.type, si2157, I2C_NAME_SIZE);
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index d74ae26..cdaf687 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
if (dev-chiptype == SI2157_CHIPTYPE_SI2146)
memcpy(cmd.args, \x14\x00\x02\x07\x00\x01, 6);
else
-   memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6);
+   memcpy(cmd.args, \x14\x00\x02\x07\x00\x00, 6);
+   cmd.args[4] = dev-if_port;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2157_cmd_execute(client, cmd);
@@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, dev);
dev-fe = cfg-fe;
dev-inversion = cfg-inversion;
+   dev-if_port = cfg-if_port;
dev-fw_loaded = false;
dev-chiptype = (u8)id-driver_data;
dev-if_frequency = 500; /* default value of property 0x0706 */
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index a564c4a..4db97ab 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -34,6 +34,12 @@ struct si2157_config {
 * Spectral Inversion
 */
bool inversion;
+
+   /*
+* Port selection
+* Select the RF interface to use (pins 9+11 or 12+13)
+*/
+   u8 if_port;
 };
 
 #endif
diff --git a/drivers/media/tuners

Re: issue with TechnoTrend CT2-4650 CI

2015-05-01 Thread Olli Salonen
Hi Michal,

I've seen something like this before with some CAMs. It seems that the
CAM needs to be initialized if it is plugged in. This does not happen
if you use software which does not have CAM support (such as w_scan).

The linuxtv.org wiki has the following comment on the CT2-4650 page:

Some CAMs require initialization before they will work. Without
initialization it's possible that even non-encrypted channels do not
work. If there's no CAM inserted, there's no issue.

gnutv could be used to initialize the CAM, for example:
gnutv -timeout 1 -out file /var/tmp/test.ts -channels ~/channels.conf FOX

Of course ideally the CAM should be initialized by the driver...

Cheers,
-olli



On 1 May 2015 at 11:39, Michal B developer...@gmail.com wrote:
 Hi all,

 i bought new TechnoTrend  CT2-4650 CI ,
 i tried to use it on wind* , successfuly also with encrypted channels with 
 CAM,
 then i tried on linux with kernel 3.19.6, and i got two behaviors:
 when CAM is unplugged i'm able to watch unencrypted channels correctly,
 but when i plugged in CAM i'm unable to find any channel during scan
 with w_scan,
 and also i'm unable to tune any channel previously found,

 and i have second issue: when i have CAM plugged and i unplug
 TechnoTrend from USB on my computer - my computer freezes - so i have
 to reset by button on the case,

 please somebody could help me to get it running with CAM to watch
 encrypted channels ?

 here is output when CAM is unplugged:

 [ 1381.807428] usb 3-10: new high-speed USB device number 4 using xhci_hcd
 [ 1381.935870] usb 3-10: New USB device found, idVendor=0b48, idProduct=3012
 [ 1381.935872] usb 3-10: New USB device strings: Mfr=1, Product=2,
 SerialNumber=3
 [ 1381.935874] usb 3-10: Product: TechnoTrend USB2.0
 [ 1381.935874] usb 3-10: Manufacturer: CityCom GmbH
 [ 1381.935875] usb 3-10: SerialNumber: 20130422
 [ 1382.222836] usb 3-10: dvb_usb_v2: found a 'TechnoTrend TT-connect
 CT2-4650 CI' in warm state
 [ 1382.222868] usb 3-10: dvb_usb_v2: will pass the complete MPEG2
 transport stream to the software demuxer
 [ 1382.222875] DVB: registering new adapter (TechnoTrend TT-connect CT2-4650 
 CI)
 [ 1382.224114] usb 3-10: dvb_usb_v2: MAC address: bc:ea:2b:65:00:ad
 [ 1382.245403] i2c i2c-7: Added multiplexed i2c bus 8
 [ 1382.245406] si2168 7-0064: Silicon Labs Si2168 successfully attached
 [ 1382.259984] si2157 8-0060: Silicon Labs Si2147/2148/2157/2158
 successfully attached
 [ 1382.273787] sp2 7-0040: CIMaX SP2 successfully attached
 [ 1382.273794] usb 3-10: DVB: registering adapter 0 frontend 0
 (Silicon Labs Si2168)...
 [ 1382.310693] Registered IR keymap rc-tt-1500
 [ 1382.310744] input: TechnoTrend TT-connect CT2-4650 CI as
 /devices/pci:00/:00:14.0/usb3/3-10/rc/rc0/input23
 [ 1382.310827] rc0: TechnoTrend TT-connect CT2-4650 CI as
 /devices/pci:00/:00:14.0/usb3/3-10/rc/rc0
 [ 1382.310831] usb 3-10: dvb_usb_v2: schedule remote query interval to 300 
 msecs
 [ 1382.310832] usb 3-10: dvb_usb_v2: 'TechnoTrend TT-connect CT2-4650
 CI' successfully initialized and connected
 [ 1382.310847] usbcore: registered new interface driver dvb_usb_dvbsky

 when i start vlc:
 [ 1485.824805] si2168 7-0064: found a 'Silicon Labs Si2168' in cold state
 [ 1485.835991] si2168 7-0064: downloading firmware from file
 'dvb-demod-si2168-a20-01.fw'
 [ 1491.074442] si2168 7-0064: found a 'Silicon Labs Si2168' in warm state
 [ 1491.083144] si2157 8-0060: found a 'Silicon Labs
 Si2146/2147/2148/2157/2158' in cold state
 [ 1491.090486] si2157 8-0060: downloading firmware from file
 'dvb-tuner-si2158-a20-01.fw'


 Kind regards,
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
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


[PATCHv2 2/5] dvbsky: use si2168 config option ts_clock_gapped

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

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

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

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


[PATCHv2 3/5] si2157: support selection of IF interface

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

As this patch changes the default behaviour, the IF interface is
specified in each driver currently using si2157 driver. This is to
keep bisectability.

Signed-off-by: Olli Salonen olli.salo...@iki.fi
---
 drivers/media/pci/cx23885/cx23885-dvb.c | 4 
 drivers/media/pci/smipcie/smipcie.c | 1 +
 drivers/media/tuners/si2157.c   | 4 +++-
 drivers/media/tuners/si2157.h   | 6 ++
 drivers/media/tuners/si2157_priv.h  | 1 +
 drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++
 drivers/media/usb/dvb-usb-v2/af9035.c   | 1 +
 drivers/media/usb/dvb-usb-v2/dvbsky.c   | 2 ++
 drivers/media/usb/dvb-usb/cxusb.c   | 1 +
 drivers/media/usb/em28xx/em28xx-dvb.c   | 2 ++
 10 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c 
b/drivers/media/pci/cx23885/cx23885-dvb.c
index 745caab..37fd013 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0-dvb.frontend;
+   si2157_config.if_port = 1;
memset(info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, si2157, I2C_NAME_SIZE);
info.addr = 0x60;
diff --git a/drivers/media/pci/smipcie/smipcie.c 
b/drivers/media/pci/smipcie/smipcie.c
index 4115925..143fd78 100644
--- a/drivers/media/pci/smipcie/smipcie.c
+++ b/drivers/media/pci/smipcie/smipcie.c
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
/* attach tuner */
memset(si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port-fe;
+   si2157_config.if_port = 1;
 
memset(client_info, 0, sizeof(struct i2c_board_info));
strlcpy(client_info.type, si2157, I2C_NAME_SIZE);
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index d74ae26..cdaf687 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
if (dev-chiptype == SI2157_CHIPTYPE_SI2146)
memcpy(cmd.args, \x14\x00\x02\x07\x00\x01, 6);
else
-   memcpy(cmd.args, \x14\x00\x02\x07\x01\x00, 6);
+   memcpy(cmd.args, \x14\x00\x02\x07\x00\x00, 6);
+   cmd.args[4] = dev-if_port;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2157_cmd_execute(client, cmd);
@@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, dev);
dev-fe = cfg-fe;
dev-inversion = cfg-inversion;
+   dev-if_port = cfg-if_port;
dev-fw_loaded = false;
dev-chiptype = (u8)id-driver_data;
dev-if_frequency = 500; /* default value of property 0x0706 */
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index a564c4a..4db97ab 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -34,6 +34,12 @@ struct si2157_config {
 * Spectral Inversion
 */
bool inversion;
+
+   /*
+* Port selection
+* Select the RF interface to use (pins 9+11 or 12+13)
+*/
+   u8 if_port;
 };
 
 #endif
diff --git a/drivers/media/tuners

[PATCHv2 1/5] si2168: add support for gapped clock

2015-04-29 Thread Olli Salonen
Add a parameter in si2168_config to support gapped clock. This might be 
necessary on
some devices with higher bitrates.

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

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

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


[PATCHv2 4/5] rtl28xxu: add I2C read without write

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

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

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

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

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


[PATCHv2 5/5] rtl2832: add support for GoTView MasterHD 3 USB tuner

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

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

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

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

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

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

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

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

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

2015-04-27 Thread Olli Salonen
Thank you Steven,

That's helpful to know. I've been bumping into some issues with
another Si2168-based device and certain DVB-C streams. Will try to see
if this could help in that case...

Cheers,
-olli

On 24 April 2015 at 15:16, Steven Toth st...@kernellabs.com wrote:
 I've also seen that the Hauppauge HVR-2205 Windows driver enables this
 option, but it seems to me that that board works ok also without this.

 Olli, I found out why this is, I thought you'd appreciate the comment

 Apparently the issue only occurs with DVB streams faster than
 approximately 50Mbps, which standard DVB-T/T2, ATSC and QAM-B never
 are.

 The issue apparently, is with some QAM-A (DVB-C) streams in
 Europe. This explains why I've never seen it. That's being said, I
 do plan to add the gapped clock patch to the SAA7164 shortly - for
 safety.

 --
 Steven Toth - Kernel Labs
 http://www.kernellabs.com
 --
 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 02/12] dvbsky: use si2168 config option ts_clock_gapped

2015-04-24 Thread Olli Salonen
Hi Tycho,

Yes, so far the only device that I know should use gapped clock is the
DVBSky T330 a.k.a. TechnoTrend CT2-4400.

I've also seen that the Hauppauge HVR-2205 Windows driver enables this
option, but it seems to me that that board works ok also without this.

Cheers,
-olli

On 24 April 2015 at 09:01, Olli Salonen olli.salo...@iki.fi wrote:
 Hi Tycho,

 Yes, so far the only device that I know should use gapped clock is the
 DVBSky T330 a.k.a. TechnoTrend CT2-4400.

 I've also seen that the Hauppauge HVR-2205 Windows driver enables this
 option, but it seems to me that that board works ok also without this.

 Cheers,
 -olli

 On 24 April 2015 at 08:57, Tycho Lürsen tycholur...@gmail.com wrote:

 One more question:

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

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

 But you don't patch them with

 si2168_config.ts_clock_gapped = true;

 Is this intentional?

 Kind regards,
 Tycho

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

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

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

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



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


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

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

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

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

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

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

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

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

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

  1   2   3   >