Skip to content

Commit

Permalink
[media] dib0700: properly setup GPIOs for PCTV 340e
Browse files Browse the repository at this point in the history
Provide a frontend setup routine for the PCTV 340e which takes into account
the specific GPIO setup of the board.

Note that this patch does *not* take into account the xc4000 reset pin, which
is attached to the dib7000.

Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Cc: Patrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Devin Heitmueller authored and Mauro Carvalho Chehab committed Jul 27, 2011
1 parent 33fb168 commit 01f1626
Showing 1 changed file with 63 additions and 1 deletion.
64 changes: 63 additions & 1 deletion drivers/media/dvb/dvb-usb/dib0700_devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -2675,6 +2675,68 @@ static int dib0700_xc4000_tuner_callback(void *priv, int component,
return 0;
}

/* FIXME: none of these inputs are validated yet */
static struct dib7000p_config pctv_340e_config = {
.output_mpeg2_in_188_bytes = 1,

.agc_config_count = 1,
.agc = &stk7700p_7000p_mt2060_agc_config,
.bw = &stk7700p_pll_config,

/* FIXME: need to take xc4000 out of reset */
.gpio_dir = DIB7000M_GPIO_DEFAULT_DIRECTIONS,
.gpio_val = DIB7000M_GPIO_DEFAULT_VALUES,
.gpio_pwm_pos = DIB7000M_GPIO_DEFAULT_PWM_POS,
};

/* PCTV 340e GPIOs map:
dib0700:
GPIO2 - CX25843 sleep
GPIO3 - CS5340 reset
GPIO5 - IRD
GPIO6 - Power Supply
GPIO8 - LNA (1=off 0=on)
GPIO10 - CX25843 reset
dib7000:
GPIO8 - xc4000 reset
*/
static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap)
{
struct dib0700_state *st = adap->dev->priv;

/* Power Supply on */
dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0);
msleep(50);
dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1);
msleep(100); /* Allow power supply to settle before probing */

/* cx25843 reset */
dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0);
msleep(1); /* cx25843 datasheet say 350us required */
dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1);

/* LNA off for now */
dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1);

/* Put the CX25843 to sleep for now since we're in digital mode */
dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1);

/* FIXME: not verified yet */
dib0700_ctrl_clock(adap->dev, 72, 1);

if (dib7000pc_detection(&adap->dev->i2c_adap) == 0) {
/* Demodulator not found for some reason? */
return -ENODEV;
}

adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x12,
&pctv_340e_config);
st->is_dib7000pc = 1;

return adap->fe == NULL ? -ENODEV : 0;
}


static struct xc4000_config s5h1411_xc4000_tunerconfig = {
.i2c_address = 0x64,
.if_khz = 5380,
Expand Down Expand Up @@ -3814,7 +3876,7 @@ struct dvb_usb_device_properties dib0700_devices[] = {
.num_adapters = 1,
.adapter = {
{
.frontend_attach = stk7700ph_frontend_attach,
.frontend_attach = pctv340e_frontend_attach,
.tuner_attach = xc4000_tuner_attach,

DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
Expand Down

0 comments on commit 01f1626

Please sign in to comment.