Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306168
b: refs/heads/master
c: 7d3d0d8
h: refs/heads/master
v: v3
  • Loading branch information
Michael Krufky authored and Mauro Carvalho Chehab committed Apr 19, 2012
1 parent ac8ea7b commit 1372a3d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5aeee8cb28317ef608ecac421abc4d986d585d2
refs/heads/master: 7d3d0d8d6fd50fd180a6bc3953bb68acf7089b2b
39 changes: 35 additions & 4 deletions trunk/drivers/media/common/tuners/xc5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct xc5000_priv {
struct list_head hybrid_tuner_instance_list;

u32 if_khz;
u32 xtal_khz;
u32 freq_hz;
u32 bandwidth;
u8 video_standard;
Expand Down Expand Up @@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = {
.size = 12401,
};

static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = {
.name = "dvb-fe-xc5000c-41.024.5-31875.fw",
.size = 16503,
static const struct xc5000_fw_cfg xc5000c_41_024_5 = {
.name = "dvb-fe-xc5000c-41.024.5.fw",
.size = 16497,
};

static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
Expand All @@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
case XC5000A:
return &xc5000a_1_6_114;
case XC5000C:
return &xc5000c_41_024_5_31875;
return &xc5000c_41_024_5;
}
}

Expand Down Expand Up @@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode)
return found;
}

static int xc_set_xtal(struct dvb_frontend *fe)
{
struct xc5000_priv *priv = fe->tuner_priv;
int ret = XC_RESULT_SUCCESS;

switch (priv->chip_id) {
default:
case XC5000A:
/* 32.000 MHz xtal is default */
break;
case XC5000C:
switch (priv->xtal_khz) {
default:
case 32000:
/* 32.000 MHz xtal is default */
break;
case 31875:
/* 31.875 MHz xtal configuration */
ret = xc_write_reg(priv, 0x000f, 0x8081);
break;
}
break;
}
return ret;
}

static int xc5000_fwupload(struct dvb_frontend *fe)
{
Expand Down Expand Up @@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe)
} else {
printk(KERN_INFO "xc5000: firmware uploading...\n");
ret = xc_load_i2c_sequence(fe, fw->data);
if (XC_RESULT_SUCCESS == ret)
ret = xc_set_xtal(fe);
printk(KERN_INFO "xc5000: firmware upload complete...\n");
}

Expand Down Expand Up @@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
priv->if_khz = cfg->if_khz;
}

if (priv->xtal_khz == 0)
priv->xtal_khz = cfg->xtal_khz;

if (priv->radio_input == 0)
priv->radio_input = cfg->radio_input;

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/media/common/tuners/xc5000.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct xc5000_config {
u8 i2c_address;
u32 if_khz;
u8 radio_input;
u32 xtal_khz;

int chip_id;
};
Expand Down

0 comments on commit 1372a3d

Please sign in to comment.