Commit 06487dee authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] m88ds3103: I/O optimize inittab write

Write inittab using reg address auto-increment in order to reduce
I/O a little bit.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent dcaf0fbf
...@@ -157,6 +157,38 @@ static int m88ds3103_rd_reg_mask(struct m88ds3103_priv *priv, ...@@ -157,6 +157,38 @@ static int m88ds3103_rd_reg_mask(struct m88ds3103_priv *priv,
return 0; return 0;
} }
/* write reg val table using reg addr auto increment */
static int m88ds3103_wr_reg_val_tab(struct m88ds3103_priv *priv,
const struct m88ds3103_reg_val *tab, int tab_len)
{
int ret, i, j;
u8 buf[83];
dev_dbg(&priv->i2c->dev, "%s: tab_len=%d\n", __func__, tab_len);
if (tab_len > 83) {
ret = -EINVAL;
goto err;
}
for (i = 0, j = 0; i < tab_len; i++, j++) {
buf[j] = tab[i].val;
if (i == tab_len - 1 || tab[i].reg != tab[i + 1].reg - 1 ||
!((j + 1) % (priv->cfg->i2c_wr_max - 1))) {
ret = m88ds3103_wr_regs(priv, tab[i].reg - j, buf, j + 1);
if (ret)
goto err;
j = -1;
}
}
return 0;
err:
dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
static int m88ds3103_read_status(struct dvb_frontend *fe, fe_status_t *status) static int m88ds3103_read_status(struct dvb_frontend *fe, fe_status_t *status)
{ {
struct m88ds3103_priv *priv = fe->demodulator_priv; struct m88ds3103_priv *priv = fe->demodulator_priv;
...@@ -214,7 +246,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) ...@@ -214,7 +246,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
{ {
struct m88ds3103_priv *priv = fe->demodulator_priv; struct m88ds3103_priv *priv = fe->demodulator_priv;
struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dtv_frontend_properties *c = &fe->dtv_property_cache;
int ret, i, len; int ret, len;
const struct m88ds3103_reg_val *init; const struct m88ds3103_reg_val *init;
u8 u8tmp, u8tmp1, u8tmp2; u8 u8tmp, u8tmp1, u8tmp2;
u8 buf[2]; u8 buf[2];
...@@ -308,13 +340,10 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) ...@@ -308,13 +340,10 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe)
/* program init table */ /* program init table */
if (c->delivery_system != priv->delivery_system) { if (c->delivery_system != priv->delivery_system) {
dev_dbg(&priv->i2c->dev, "%s: program init\n", __func__); ret = m88ds3103_wr_reg_val_tab(priv, init, len);
for (i = 0; i < len; i++) {
ret = m88ds3103_wr_reg(priv, init[i].reg, init[i].val);
if (ret) if (ret)
goto err; goto err;
} }
}
u8tmp1 = 0; /* silence compiler warning */ u8tmp1 = 0; /* silence compiler warning */
switch (priv->cfg->ts_mode) { switch (priv->cfg->ts_mode) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment