Re: [PATCH] cx23885: fix support for TBS 6920 card

2010-02-02 Thread Konstantin Dimitrov
hi Mauro,

it seems all things that this patch does were submitted to main V4L
repository by Igor M. Liplianin on Nov 25, 2009:

http://linuxtv.org/hg/v4l-dvb/rev/05e8056afc59

as well as my code for Montage DS3000/TS2020 DVB-S2 demodulator and tuner.

however, the following:

"add: module_param "lnb_pwr_ctrl" as option to choose between "type 0"
and "type 1" of LNB power control"

is not part of what was submitted and as a result only "type 1" of LNB
power control is for TBS 6920 card is supported by the current code.

best regards,
konstantin

On Tue, Feb 2, 2010 at 4:47 PM, Mauro Carvalho Chehab
 wrote:
> Hi Steven,
>
> Steven Toth wrote:
>> On 8/19/09 7:20 PM, Konstantin Dimitrov wrote:
>>>
>>> fix: GPIO initialization for TBS 6920
>>> fix: wrong I2C address for demod on TBS 6920
>>> fix: wrong I2C bus number for demod on TBS 6920
>>> fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some
>>> other cards)
>>> add: module_param "lnb_pwr_ctrl" as option to choose between "type 0"
>>> and "type 1" of LNB power control (two TBS 6920 boards no matter that
>>> they are marked as the same hardware revision may have different types
>>> of LNB power control)
>>> fix: LNB power control function for type 0 doesn't preserve the
>>> previous GPIO state, which is critical
>>> add: LNB power control function for type 1
>>>
>>> Signed-off-by: Bob Liu
>>> Signed-off-by: Konstantin Dimitrov
>>
>> I got a weird HTML related email bounce from vger when I responded
>> originally to this via gmail. Maybe this time via thunderbird will bring
>> success.
>>
>> ...
>>
>> Hmm. A custom hanging off of a gpio to something that looks like an i2c
>> power control device. I want to review some of these generic (and
>> no-so-generic) changes before we merge this patch.
>>
>> Is the datasheet for the LNB power control device available to the
>> public? I'd like to understand some of the register details.
>>
>
> What's the status of the current patch? It was submitted back on Aug, 2009,
> and marked as under review since then. Btw, the patch is currently broken,
> probably due to the changes on cx23885 driver during this period of time.
>
> patching file drivers/media/video/cx23885/cx23885-cards.c
> Hunk #1 FAILED at 704.
> Hunk #2 succeeded at 1020 with fuzz 2 (offset 133 lines).
> 1 out of 2 hunks FAILED -- saving rejects to file 
> drivers/media/video/cx23885/cx23885-cards.c.rej
> patching file drivers/media/video/cx23885/cx23885-dvb.c
> Hunk #1 FAILED at 55.
> Hunk #2 succeeded at 75 (offset 3 lines).
> Hunk #3 FAILED at 427.
> Hunk #4 FAILED at 785.
> Hunk #5 FAILED at 805.
> 4 out of 5 hunks FAILED -- saving rejects to file 
> drivers/media/video/cx23885/cx23885-dvb.c.rej
> patching file drivers/media/video/cx23885/Makefile
> Hunk #1 FAILED at 1.
> 1 out of 1 hunk FAILED -- saving rejects to file 
> drivers/media/video/cx23885/Makefile.rej
> patching file drivers/media/video/cx23885/tbs_lnb_pwr.c
> patching file drivers/media/video/cx23885/tbs_lnb_pwr.h
> Patch doesn't apply
>
> ---
>
> Subject: cx23885: fix support for TBS 6920 card
> Date: Wed, 19 Aug 2009 23:20:02 -
> From: Konstantin Dimitrov 
> X-Patchwork-Id: 42777
>
> fix: GPIO initialization for TBS 6920
> fix: wrong I2C address for demod on TBS 6920
> fix: wrong I2C bus number for demod on TBS 6920
> fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some other 
> cards)
> add: module_param "lnb_pwr_ctrl" as option to choose between "type 0" and 
> "type 1" of LNB power control (two TBS 6920 boards no matter that they are 
> marked as the same hardware revision may have different types of LNB power 
> control)
> fix: LNB power control function for type 0 doesn't preserve the previous GPIO 
> state, which is critical
> add: LNB power control function for type 1
>
> Signed-off-by: Bob Liu 
> Signed-off-by: Konstantin Dimitrov 
>
> ---
> 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
>
> --- a/drivers/media/video/cx23885/cx23885-cards.c       2009-08-19 
> 14:11:49.0 +0300
> +++ a/drivers/media/video/cx23885/cx23885-cards.c       2009-08-19 
> 14:30:10.0 +0300
> @@ -704,7 +704,14 @@ void cx23885_gpio_setup(struct cx23885_d
>        case CX23885_BOARD_TEVII_S470:
>                cx_write(MC417_CTL, 0x0036);
>                cx_write(MC417_OEN, 0x1000);
> -               cx_write(MC417_RWD, 0x1800);
> +
> +               cx_set(MC417_RWD, 0x0002);
> +               mdelay(200);
> +
> +               cx_clear(MC417_RWD, 0x0800);
> +               mdelay(200);
> +               cx_set(MC417_RWD, 0x0800);
> +               mdelay(200);
>                break;
>        case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
>                /* GPIO-0 INTA from CiMax1
> @@ -880,7 +887,7 @@ void cx23885_card_setup(struct cx23885_d
>        case CX23885_BOARD_TEVII_S470:
>        case 

Re: [PATCH] cx23885: fix support for TBS 6920 card

2010-02-02 Thread Mauro Carvalho Chehab
Hi Steven,

Steven Toth wrote:
> On 8/19/09 7:20 PM, Konstantin Dimitrov wrote:
>>
>> fix: GPIO initialization for TBS 6920
>> fix: wrong I2C address for demod on TBS 6920
>> fix: wrong I2C bus number for demod on TBS 6920
>> fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some
>> other cards)
>> add: module_param "lnb_pwr_ctrl" as option to choose between "type 0"
>> and "type 1" of LNB power control (two TBS 6920 boards no matter that
>> they are marked as the same hardware revision may have different types
>> of LNB power control)
>> fix: LNB power control function for type 0 doesn't preserve the
>> previous GPIO state, which is critical
>> add: LNB power control function for type 1
>>
>> Signed-off-by: Bob Liu
>> Signed-off-by: Konstantin Dimitrov
> 
> I got a weird HTML related email bounce from vger when I responded
> originally to this via gmail. Maybe this time via thunderbird will bring
> success.
> 
> ...
> 
> Hmm. A custom hanging off of a gpio to something that looks like an i2c
> power control device. I want to review some of these generic (and
> no-so-generic) changes before we merge this patch.
> 
> Is the datasheet for the LNB power control device available to the
> public? I'd like to understand some of the register details.
> 

What's the status of the current patch? It was submitted back on Aug, 2009,
and marked as under review since then. Btw, the patch is currently broken,
probably due to the changes on cx23885 driver during this period of time.

patching file drivers/media/video/cx23885/cx23885-cards.c
Hunk #1 FAILED at 704.
Hunk #2 succeeded at 1020 with fuzz 2 (offset 133 lines).
1 out of 2 hunks FAILED -- saving rejects to file 
drivers/media/video/cx23885/cx23885-cards.c.rej
patching file drivers/media/video/cx23885/cx23885-dvb.c
Hunk #1 FAILED at 55.
Hunk #2 succeeded at 75 (offset 3 lines).
Hunk #3 FAILED at 427.
Hunk #4 FAILED at 785.
Hunk #5 FAILED at 805.
4 out of 5 hunks FAILED -- saving rejects to file 
drivers/media/video/cx23885/cx23885-dvb.c.rej
patching file drivers/media/video/cx23885/Makefile
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file 
drivers/media/video/cx23885/Makefile.rej
patching file drivers/media/video/cx23885/tbs_lnb_pwr.c
patching file drivers/media/video/cx23885/tbs_lnb_pwr.h
Patch doesn't apply

---

Subject: cx23885: fix support for TBS 6920 card
Date: Wed, 19 Aug 2009 23:20:02 -
From: Konstantin Dimitrov 
X-Patchwork-Id: 42777

fix: GPIO initialization for TBS 6920
fix: wrong I2C address for demod on TBS 6920
fix: wrong I2C bus number for demod on TBS 6920
fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some other cards)
add: module_param "lnb_pwr_ctrl" as option to choose between "type 0" and "type 
1" of LNB power control (two TBS 6920 boards no matter that they are marked as 
the same hardware revision may have different types of LNB power control)
fix: LNB power control function for type 0 doesn't preserve the previous GPIO 
state, which is critical
add: LNB power control function for type 1

Signed-off-by: Bob Liu 
Signed-off-by: Konstantin Dimitrov 

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

--- a/drivers/media/video/cx23885/cx23885-cards.c   2009-08-19 
14:11:49.0 +0300
+++ a/drivers/media/video/cx23885/cx23885-cards.c   2009-08-19 
14:30:10.0 +0300
@@ -704,7 +704,14 @@ void cx23885_gpio_setup(struct cx23885_d
case CX23885_BOARD_TEVII_S470:
cx_write(MC417_CTL, 0x0036);
cx_write(MC417_OEN, 0x1000);
-   cx_write(MC417_RWD, 0x1800);
+
+   cx_set(MC417_RWD, 0x0002);
+   mdelay(200);
+
+   cx_clear(MC417_RWD, 0x0800);
+   mdelay(200);
+   cx_set(MC417_RWD, 0x0800);
+   mdelay(200);
break;
case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
/* GPIO-0 INTA from CiMax1
@@ -880,7 +887,7 @@ void cx23885_card_setup(struct cx23885_d
case CX23885_BOARD_TEVII_S470:
case CX23885_BOARD_TBS_6920:
case CX23885_BOARD_DVBWORLD_2005:
-   ts1->gen_ctrl_val  = 0x5; /* Parallel */
+   ts1->gen_ctrl_val  = 0x4; /* Parallel */
ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
break;
--- a/drivers/media/video/cx23885/cx23885-dvb.c 2009-08-19 14:11:49.0 
+0300
+++ a/drivers/media/video/cx23885/cx23885-dvb.c 2009-08-19 15:25:57.0 
+0300
@@ -55,6 +55,7 @@
 #include "netup-eeprom.h"
 #include "netup-init.h"
 #include "lgdt3305.h"
+#include "tbs_lnb_pwr.h"
 
 static unsigned int debug;
 
@@ -71,6 +72,10 @@ MODULE_PARM_DESC(alt_tuner, "Enable alte
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
+static unsigned 

Re: [PATCH] cx23885: fix support for TBS 6920 card

2009-08-30 Thread Mauro Carvalho Chehab
Hi Steven,

As I'm understanding that you're reveiwing it, I'm marking this patch as such
at Patchwork.

Cheers,
Mauro.

Em Thu, 20 Aug 2009 18:38:46 +0300
Konstantin Dimitrov  escreveu:

> On Thu, Aug 20, 2009 at 4:03 PM, Steven Toth wrote:
> > On 8/19/09 7:20 PM, Konstantin Dimitrov wrote:
> >>
> >> fix: GPIO initialization for TBS 6920
> >> fix: wrong I2C address for demod on TBS 6920
> >> fix: wrong I2C bus number for demod on TBS 6920
> >> fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some other
> >> cards)
> >> add: module_param "lnb_pwr_ctrl" as option to choose between "type 0" and
> >> "type 1" of LNB power control (two TBS 6920 boards no matter that they are
> >> marked as the same hardware revision may have different types of LNB power
> >> control)
> >> fix: LNB power control function for type 0 doesn't preserve the previous
> >> GPIO state, which is critical
> >> add: LNB power control function for type 1
> >>
> >> Signed-off-by: Bob Liu
> >> Signed-off-by: Konstantin Dimitrov
> > Hmm. A custom hanging off of a gpio to something that looks like an i2c
> > power control device. I want to review some of these generic (and
> > no-so-generic) changes before we merge this patch.
> >
> > Is the datasheet for the LNB power control device available to the public?
> > I'd like to understand some of the register details.
> 
> the datasheet is not available at least to me and i don't know any
> more details. the code in question was given to me by the author under
> GPLv2 license and that's why i put it in separate file
> "tbs_lnb_pwr.c".
> 
> also, the cards that use this type of LNB power control, which i
> called for short "type 1", have the same device IDs as the one that
> don't use it and use "type 0" of LNB power control instead.
> 
> --konstantin
> 
> >
> > Thanks,
> >
> > --
> > 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




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


Re: [PATCH] cx23885: fix support for TBS 6920 card

2009-08-20 Thread Konstantin Dimitrov
On Thu, Aug 20, 2009 at 4:03 PM, Steven Toth wrote:
> On 8/19/09 7:20 PM, Konstantin Dimitrov wrote:
>>
>> fix: GPIO initialization for TBS 6920
>> fix: wrong I2C address for demod on TBS 6920
>> fix: wrong I2C bus number for demod on TBS 6920
>> fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some other
>> cards)
>> add: module_param "lnb_pwr_ctrl" as option to choose between "type 0" and
>> "type 1" of LNB power control (two TBS 6920 boards no matter that they are
>> marked as the same hardware revision may have different types of LNB power
>> control)
>> fix: LNB power control function for type 0 doesn't preserve the previous
>> GPIO state, which is critical
>> add: LNB power control function for type 1
>>
>> Signed-off-by: Bob Liu
>> Signed-off-by: Konstantin Dimitrov
>
> I got a weird HTML related email bounce from vger when I responded
> originally to this via gmail. Maybe this time via thunderbird will bring
> success.
>
> ...
>
> Hmm. A custom hanging off of a gpio to something that looks like an i2c
> power control device. I want to review some of these generic (and
> no-so-generic) changes before we merge this patch.
>
> Is the datasheet for the LNB power control device available to the public?
> I'd like to understand some of the register details.

the datasheet is not available at least to me and i don't know any
more details. the code in question was given to me by the author under
GPLv2 license and that's why i put it in separate file
"tbs_lnb_pwr.c".

also, the cards that use this type of LNB power control, which i
called for short "type 1", have the same device IDs as the one that
don't use it and use "type 0" of LNB power control instead.

--konstantin

>
> Thanks,
>
> --
> 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] cx23885: fix support for TBS 6920 card

2009-08-20 Thread Steven Toth

On 8/19/09 7:20 PM, Konstantin Dimitrov wrote:


fix: GPIO initialization for TBS 6920
fix: wrong I2C address for demod on TBS 6920
fix: wrong I2C bus number for demod on TBS 6920
fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some other cards)
add: module_param "lnb_pwr_ctrl" as option to choose between "type 0" and "type 
1" of LNB power control (two TBS 6920 boards no matter that they are marked as the same hardware 
revision may have different types of LNB power control)
fix: LNB power control function for type 0 doesn't preserve the previous GPIO 
state, which is critical
add: LNB power control function for type 1

Signed-off-by: Bob Liu
Signed-off-by: Konstantin Dimitrov


I got a weird HTML related email bounce from vger when I responded originally to 
this via gmail. Maybe this time via thunderbird will bring success.


...

Hmm. A custom hanging off of a gpio to something that looks like an i2c power 
control device. I want to review some of these generic (and no-so-generic) 
changes before we merge this patch.


Is the datasheet for the LNB power control device available to the public? I'd 
like to understand some of the register details.


Thanks,

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


[PATCH] cx23885: fix support for TBS 6920 card

2009-08-19 Thread Konstantin Dimitrov

fix: GPIO initialization for TBS 6920
fix: wrong I2C address for demod on TBS 6920
fix: wrong I2C bus number for demod on TBS 6920
fix: wrong "gen_ctrl_val" value for TS1 port on TBS 6920 (and some other cards)
add: module_param "lnb_pwr_ctrl" as option to choose between "type 0" and "type 
1" of LNB power control (two TBS 6920 boards no matter that they are marked as 
the same hardware revision may have different types of LNB power control)
fix: LNB power control function for type 0 doesn't preserve the previous GPIO 
state, which is critical
add: LNB power control function for type 1

Signed-off-by: Bob Liu 
Signed-off-by: Konstantin Dimitrov 

--- a/linux/drivers/media/video/cx23885/cx23885-cards.c 2009-08-19 
14:11:49.0 +0300
+++ b/linux/drivers/media/video/cx23885/cx23885-cards.c 2009-08-19 
14:30:10.0 +0300
@@ -704,7 +704,14 @@ void cx23885_gpio_setup(struct cx23885_d
case CX23885_BOARD_TEVII_S470:
cx_write(MC417_CTL, 0x0036);
cx_write(MC417_OEN, 0x1000);
-   cx_write(MC417_RWD, 0x1800);
+
+   cx_set(MC417_RWD, 0x0002);
+   mdelay(200);
+
+   cx_clear(MC417_RWD, 0x0800);
+   mdelay(200);
+   cx_set(MC417_RWD, 0x0800);
+   mdelay(200);
break;
case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
/* GPIO-0 INTA from CiMax1
@@ -880,7 +887,7 @@ void cx23885_card_setup(struct cx23885_d
case CX23885_BOARD_TEVII_S470:
case CX23885_BOARD_TBS_6920:
case CX23885_BOARD_DVBWORLD_2005:
-   ts1->gen_ctrl_val  = 0x5; /* Parallel */
+   ts1->gen_ctrl_val  = 0x4; /* Parallel */
ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */
ts1->src_sel_val   = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO;
break;
--- a/linux/drivers/media/video/cx23885/cx23885-dvb.c   2009-08-19 
14:11:49.0 +0300
+++ b/linux/drivers/media/video/cx23885/cx23885-dvb.c   2009-08-19 
15:25:57.0 +0300
@@ -55,6 +55,7 @@
 #include "netup-eeprom.h"
 #include "netup-init.h"
 #include "lgdt3305.h"
+#include "tbs_lnb_pwr.h"
 
 static unsigned int debug;
 
@@ -71,6 +72,10 @@ MODULE_PARM_DESC(alt_tuner, "Enable alte
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
+static unsigned int lnb_pwr_ctrl;
+module_param(lnb_pwr_ctrl, int, 0644);
+MODULE_PARM_DESC(lnb_pwr_ctrl,"set LNB power control 0=default type, 1=another 
type");
+
 /* -- */
 
 static int dvb_buf_setup(struct videobuf_queue *q,
@@ -419,22 +424,31 @@ static struct stv6110_config netup_stv61
.clk_div = 1,
 };
 
-static int tbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
+static int tbs6920_set_voltage(struct dvb_frontend *fe,
+   fe_sec_voltage_t voltage)
 {
struct cx23885_tsport *port = fe->dvb->priv;
struct cx23885_dev *dev = port->dev;
 
-   if (voltage == SEC_VOLTAGE_18)
-   cx_write(MC417_RWD, 0x1e00);/* GPIO-13 high */
-   else if (voltage == SEC_VOLTAGE_13)
-   cx_write(MC417_RWD, 0x1a00);/* GPIO-13 low */
-   else
-   cx_write(MC417_RWD, 0x1800);/* GPIO-12 low */
+   switch (voltage) {
+   case SEC_VOLTAGE_13:
+   cx_set(MC417_RWD, 0x0200);
+   cx_clear(MC417_RWD, 0x0400);
+   break;
+   case SEC_VOLTAGE_18:
+   cx_set(MC417_RWD, 0x0200);
+   cx_set(MC417_RWD, 0x0400);
+   break;
+   case SEC_VOLTAGE_OFF:
+   cx_clear(MC417_RWD, 0x0200);
+   break;
+   }
+
return 0;
 }
 
 static struct cx24116_config tbs_cx24116_config = {
-   .demod_address = 0x05,
+   .demod_address = 0x55,
 };
 
 static struct cx24116_config tevii_cx24116_config = {
@@ -768,14 +782,18 @@ static int dvb_register(struct cx23885_t
}
break;
case CX23885_BOARD_TBS_6920:
-   i2c_bus = &dev->i2c_bus[0];
+   i2c_bus = &dev->i2c_bus[1];
 
fe0->dvb.frontend = dvb_attach(cx24116_attach,
&tbs_cx24116_config,
&i2c_bus->i2c_adap);
-   if (fe0->dvb.frontend != NULL)
-   fe0->dvb.frontend->ops.set_voltage = tbs_set_voltage;
-
+   if (fe0->dvb.frontend != NULL) {
+   if (!lnb_pwr_ctrl)
+   fe0->dvb.frontend->ops.set_voltage = 
tbs6920_set_voltage;
+   else 
+   fe0->dvb.frontend->ops.set_voltage = 
tbs_set_voltage;
+   }
+   
break;
case CX23885_BOARD_TEVII_S470:
i2c_bus = &dev->i2c_bus[1];
@@ -784,7 +802,7 @@ static int dvb_register(struct cx23885_t