[RFC] add i2c_gate_ctrl to mb86a20s.c

2011-05-19 Thread Manoel PN
The register 0xfe controls the i2c-bus from the mb86a20s to tuner.


Signed-off-by: Manoel Pinheiro 


diff --git a/drivers/media/dvb/frontends/mb86a20s.c 
b/drivers/media/dvb/frontends/mb86a20s.c
index 0f867a5..f3c4013 100644
--- a/drivers/media/dvb/frontends/mb86a20s.c
+++ b/drivers/media/dvb/frontends/mb86a20s.c
@@ -370,6 +370,17 @@ static int mb86a20s_i2c_readreg(struct mb86a20s_state 
*state,
mb86a20s_i2c_writeregdata(state, state->config->demod_address, \
regdata, ARRAY_SIZE(regdata))
 
+static int mb86a20s_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
+{
+   struct mb86a20s_state *state = fe->demodulator_priv;
+
+   /* Enable/Disable I2C bus for tuner control */
+   if (enable)
+   return mb86a20s_writereg(state, 0xfe, 0);
+   else
+   return mb86a20s_writereg(state, 0xfe, 1);
+}
+
 static int mb86a20s_initfe(struct dvb_frontend *fe)
 {
struct mb86a20s_state *state = fe->demodulator_priv;
@@ -626,6 +637,7 @@ static struct dvb_frontend_ops mb86a20s_ops = {
 
.release = mb86a20s_release,
 
+   .i2c_gate_ctrl = mb86a20s_i2c_gate_ctrl,
.init = mb86a20s_initfe,
.set_frontend = mb86a20s_set_frontend,
.get_frontend = mb86a20s_get_frontend,


--
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] saa7134-dvb.c kworld_sbtvd

2011-05-19 Thread Manoel PN
The correct place to put i2c_gate_ctrl is before calling tda18271_attach,
because the driver tda18271 will use it to enable or disable the i2c-bus
from the demodulator to the tuner.

And thus eliminate the error message: "Unknown device (255) detected
@ 1-00c0, device not supported" in the driver tda18271.

In the device kworld_sbtvd (hybrid analog and digital TV) the control
of the i2c-bus to tuner is done in the analog demodulator and not in
the digital demodulator.


Signed-off-by: Manoel Pinheiro 


diff --git a/drivers/media/video/saa7134/saa7134-dvb.c 
b/drivers/media/video/saa7134/saa7134-dvb.c
index f65cad2..c1a18d1 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1666,10 +1666,10 @@ static int dvb_init(struct saa7134_dev *dev)
dvb_attach(tda829x_attach, fe0->dvb.frontend,
   &dev->i2c_adap, 0x4b,
   &tda829x_no_probe);
+   fe0->dvb.frontend->ops.i2c_gate_ctrl = 
kworld_sbtvd_gate_ctrl;
dvb_attach(tda18271_attach, fe0->dvb.frontend,
   0x60, &dev->i2c_adap,
   &kworld_tda18271_config);
-   fe0->dvb.frontend->ops.i2c_gate_ctrl = 
kworld_sbtvd_gate_ctrl;
}
 
/* mb86a20s need to use the I2C gateway */


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


[RFC]Add i2c_gate_ctrl do mb86a20s

2011-05-13 Thread Manoel PN

This function enables and disables the i2c bus of the mb86a20s to tuner.
  --
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] Modifications to the driver mb86a20s‏‏

2011-05-12 Thread Manoel PN


This patch implement changes to the function mb86a20s_read_signal_strength.

The original function, binary search, does not work with device dtb08.

I would like to know if this function works.


Signed-off-by: Manoel Pinheiro 


  

signal_strength.patch
Description: Binary data


[PATCH 3/4] Modifications to the driver mb86a20s‏

2011-05-12 Thread Manoel PN

This patch implements some modifications in the function

This patch implements some modifications in the initialization function of the 
mb86a20s.

Explanation:

Several registers of mb86a20s can be programmed and to simplify this task and 
due to lack of technical literature to elaborate the necessary calculations was 
opted by the sending of values already ready for the registers, eliminating the 
process of calculations.
The technique is quite simple: to each register that can be modified an 
identification (REG_IDCFG) was attributed and those that do not need 
modification was attributed REG_IDCFG_NONE.

The device that uses the demodulator mb86a20s simply informs the registers to 
be modified through the configuration parameter of the function frontend_attach.

Like in the example:

static struct mb86a20s_config_regs_val mb86a20s_config_regs[] = {
    { REG2820_IDCFG, 0x33ddcd },
    { REG50D5_IDCFG, 0x00 },    /* use output TS parallel */
    { REG50D6_IDCFG, 0x17 }
};

static struct mb86a20s_config mb86a20s_cfg = {
    .demod_address = DEMOD_I2C_ADDR,
    .config_regs_size = ARRAY_SIZE(mb86a20s_config_regs),
    .config_regs = mb86a20s_config_regs,
};

If there are no registers to be modified to do just this:

static struct mb86a20s_config mb86a20s_cfg = {
    .demod_address = DEMOD_I2C_ADDR,
};

static int tbs_dtb08_frontend_attach(struct dvb_usb_adapter *adap)
{
    adap->fe = dvb_attach(mb86a20s_attach, &mb86a20s_cfg, &adap->dev->i2c_adap);
    if (adap->fe) {
        frontend_tuner_attach(adap);
    }
}



Signed-off-by: Manoel Pinheiro 



  

regs_init.patch
Description: Binary data


[PATCH 2/4] Modifications to the driver mb86a20s

2011-05-12 Thread Manoel PN

This patch implements mb86a20s_read_snr and adds mb86a20s_read_ber and 
mb86a20s_read_ucblocks both without practical utility but that programs as 
dvbsnoop need.


Signed-off-by: Manoel Pinheiro 



  

read_snr.patch
Description: Binary data


[PATCH 2/4] Modifications to the driver mb86a20s

2011-05-12 Thread Manoel PN

This patch implements mb86a20s_read_snr and adds mb86a20s_read_ber and 
mb86a20s_read_ucblocks both without practical utility but that programs as 
dvbsnoop need.


Signed-off-by: Manoel Pinheiro 


  --
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] Modifications to the driver mb86a20s

2011-05-12 Thread Manoel PN

Hi to all,

I added some modifications to the driver mb86a20s and would appreciate your 
comments.

>
> File: drivers/media/dvb/frontends/mb86a20s.c
>
> -static int debug = 1;
> +static int debug = 0;
> module_param(debug, int, 0644);
> MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)");
>
 
How is in the description by default debug is off.

>
> -#define rc(args...)  do {
> +#define printk_rc(args...)  do {
>

For clarity, only rc is somewhat vague.

>
> +static int mb86a20s_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) 
> 

Adds the i2c_gate_ctrl to mb86a20s driver.


The mb86a20s has an i2c bus which controls the flow of data to the tuner. When 
enabled, the data stream flowing normally through the i2c bus, when disabled 
the data stream to the tuner is cut and the i2c bus between mb86a20s and the 
tuner goes to tri-state. The data flow between the mb86a20s and its controller 
(CPU, USB), is not affected.

In hybrid systems with analog and digital TV, the i2c bus control can be done 
in the analog demodulator.

>
> -    if (fe->ops.i2c_gate_ctrl)
>-        fe->ops.i2c_gate_ctrl(fe, 0);
>     val = mb86a20s_readreg(state, 0x0a) & 0xf;
> -    if (fe->ops.i2c_gate_ctrl)
> -        fe->ops.i2c_gate_ctrl(fe, 1);
>

The i2c_gate_ctrl controls the i2c bus of the tuner so does not need to enable 
it or disable it here.


>
> +    for (i = 0; i < 20; i++) {
> +        if (mb86a20s_readreg(state, 0x0a) >= 8) break;
> +        msleep(100);
> +    }
>

Waits for the stabilization of the demodulator.

>
> +static int mb86a20s_get_algo(struct dvb_frontend *fe)
> +{
> +    return DVBFE_ALGO_HW;
> +}
>

Because the mb86a20s_tune function was implemented.

Thanks, best regards,

Manoel.


Signed-off-by: Manoel Pinheiro 



  

i2c_gate_ctrl.patch
Description: Binary data


[PATCH] dvb-usb.h function rc5_scan‏

2011-05-06 Thread Manoel PN


Hi,

The function "rc5_scan" in "dvb_usb.h" is returning invalid value.
The value should be returned "u16" but is returning "u8".

See example below in "drivers/media/dvb/dvb-usb/opera1.c".


/*--*/

drivers/media/dvb/dvb-usb/opera1.c

static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state)
{

.
.
.

send_key = (send_key & 0x) | 0x0100;

for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) {
if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0x)) {
*state = REMOTE_KEY_PRESSED;
*event = rc_map_opera1_table[i].keycode;
opst->last_key_pressed =
rc_map_opera1_table[i].keycode;
break;
}
opst->last_key_pressed = 0;
}

}

/*--*/


Signed-off-by: Manoel Pinheiro


diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h 
b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 76a8096..7d35d07 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -85,7 +85,7 @@ static inline u8 rc5_data(struct rc_map_table *key)
 return key->scancode & 0xff;
 }

-static inline u8 rc5_scan(struct rc_map_table *key)
+static inline u16 rc5_scan(struct rc_map_table *key)
 {
 return key->scancode & 0x;
 }

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