Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193089
b: refs/heads/master
c: 0de8e35
h: refs/heads/master
i:
  193087: a86856e
v: v3
  • Loading branch information
Randy Dunlap authored and Mauro Carvalho Chehab committed May 19, 2010
1 parent f4647b2 commit 2e66880
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 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: 0b42760a75afb852be6718fb5e6b54988123b40e
refs/heads/master: 0de8e3533e08745616a30bdb3fa5106c85083e51
35 changes: 22 additions & 13 deletions trunk/drivers/media/dvb/frontends/dib3000mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,42 +814,51 @@ EXPORT_SYMBOL(dib3000mc_set_config);

int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[])
{
struct dib3000mc_state st = { .i2c_adap = i2c };
struct dib3000mc_state *dmcst;
int k;
u8 new_addr;

static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};

dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
if (dmcst == NULL)
return -ENODEV;

dmcst->i2c_adap = i2c;

for (k = no_of_demods-1; k >= 0; k--) {
st.cfg = &cfg[k];
dmcst->cfg = &cfg[k];

/* designated i2c address */
new_addr = DIB3000MC_I2C_ADDRESS[k];
st.i2c_addr = new_addr;
if (dib3000mc_identify(&st) != 0) {
st.i2c_addr = default_addr;
if (dib3000mc_identify(&st) != 0) {
dmcst->i2c_addr = new_addr;
if (dib3000mc_identify(dmcst) != 0) {
dmcst->i2c_addr = default_addr;
if (dib3000mc_identify(dmcst) != 0) {
dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
kfree(dmcst);
return -ENODEV;
}
}

dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK);
dib3000mc_set_output_mode(dmcst, OUTMODE_MPEG2_PAR_CONT_CLK);

// set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1);
st.i2c_addr = new_addr;
dib3000mc_write_word(dmcst, 1024, (new_addr << 3) | 0x1);
dmcst->i2c_addr = new_addr;
}

for (k = 0; k < no_of_demods; k++) {
st.cfg = &cfg[k];
st.i2c_addr = DIB3000MC_I2C_ADDRESS[k];
dmcst->cfg = &cfg[k];
dmcst->i2c_addr = DIB3000MC_I2C_ADDRESS[k];

dib3000mc_write_word(&st, 1024, st.i2c_addr << 3);
dib3000mc_write_word(dmcst, 1024, dmcst->i2c_addr << 3);

/* turn off data output */
dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z);
dib3000mc_set_output_mode(dmcst, OUTMODE_HIGH_Z);
}

kfree(dmcst);
return 0;
}
EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
Expand Down

0 comments on commit 2e66880

Please sign in to comment.