Commit 3b536127 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

media: af9013: convert inittabs suitable for regmap_update_bits

Convert inttabs to format (reg, mask, val) which are suitable
parameters to pass directly for regmap_update_bits.
Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 49bade9f
...@@ -843,7 +843,7 @@ static int af9013_init(struct dvb_frontend *fe) ...@@ -843,7 +843,7 @@ static int af9013_init(struct dvb_frontend *fe)
int ret, i, len; int ret, i, len;
unsigned int utmp; unsigned int utmp;
u8 buf[3]; u8 buf[3];
const struct af9013_reg_bit *init; const struct af9013_reg_mask_val *tab;
dev_dbg(&client->dev, "\n"); dev_dbg(&client->dev, "\n");
...@@ -898,72 +898,66 @@ static int af9013_init(struct dvb_frontend *fe) ...@@ -898,72 +898,66 @@ static int af9013_init(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
/* load OFSM settings */ /* Demod core settings */
dev_dbg(&client->dev, "load ofsm settings\n"); dev_dbg(&client->dev, "load demod core settings\n");
len = ARRAY_SIZE(ofsm_init); len = ARRAY_SIZE(demod_init_tab);
init = ofsm_init; tab = demod_init_tab;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
u16 reg = init[i].addr; ret = regmap_update_bits(state->regmap, tab[i].reg, tab[i].mask,
u8 mask = GENMASK(init[i].pos + init[i].len - 1, init[i].pos); tab[i].val);
u8 val = init[i].val << init[i].pos;
ret = regmap_update_bits(state->regmap, reg, mask, val);
if (ret) if (ret)
goto err; goto err;
} }
/* load tuner specific settings */ /* Demod tuner specific settings */
dev_dbg(&client->dev, "load tuner specific settings\n"); dev_dbg(&client->dev, "load tuner specific settings\n");
switch (state->tuner) { switch (state->tuner) {
case AF9013_TUNER_MXL5003D: case AF9013_TUNER_MXL5003D:
len = ARRAY_SIZE(tuner_init_mxl5003d); len = ARRAY_SIZE(tuner_init_tab_mxl5003d);
init = tuner_init_mxl5003d; tab = tuner_init_tab_mxl5003d;
break; break;
case AF9013_TUNER_MXL5005D: case AF9013_TUNER_MXL5005D:
case AF9013_TUNER_MXL5005R: case AF9013_TUNER_MXL5005R:
case AF9013_TUNER_MXL5007T: case AF9013_TUNER_MXL5007T:
len = ARRAY_SIZE(tuner_init_mxl5005); len = ARRAY_SIZE(tuner_init_tab_mxl5005);
init = tuner_init_mxl5005; tab = tuner_init_tab_mxl5005;
break; break;
case AF9013_TUNER_ENV77H11D5: case AF9013_TUNER_ENV77H11D5:
len = ARRAY_SIZE(tuner_init_env77h11d5); len = ARRAY_SIZE(tuner_init_tab_env77h11d5);
init = tuner_init_env77h11d5; tab = tuner_init_tab_env77h11d5;
break; break;
case AF9013_TUNER_MT2060: case AF9013_TUNER_MT2060:
len = ARRAY_SIZE(tuner_init_mt2060); len = ARRAY_SIZE(tuner_init_tab_mt2060);
init = tuner_init_mt2060; tab = tuner_init_tab_mt2060;
break; break;
case AF9013_TUNER_MC44S803: case AF9013_TUNER_MC44S803:
len = ARRAY_SIZE(tuner_init_mc44s803); len = ARRAY_SIZE(tuner_init_tab_mc44s803);
init = tuner_init_mc44s803; tab = tuner_init_tab_mc44s803;
break; break;
case AF9013_TUNER_QT1010: case AF9013_TUNER_QT1010:
case AF9013_TUNER_QT1010A: case AF9013_TUNER_QT1010A:
len = ARRAY_SIZE(tuner_init_qt1010); len = ARRAY_SIZE(tuner_init_tab_qt1010);
init = tuner_init_qt1010; tab = tuner_init_tab_qt1010;
break; break;
case AF9013_TUNER_MT2060_2: case AF9013_TUNER_MT2060_2:
len = ARRAY_SIZE(tuner_init_mt2060_2); len = ARRAY_SIZE(tuner_init_tab_mt2060_2);
init = tuner_init_mt2060_2; tab = tuner_init_tab_mt2060_2;
break; break;
case AF9013_TUNER_TDA18271: case AF9013_TUNER_TDA18271:
case AF9013_TUNER_TDA18218: case AF9013_TUNER_TDA18218:
len = ARRAY_SIZE(tuner_init_tda18271); len = ARRAY_SIZE(tuner_init_tab_tda18271);
init = tuner_init_tda18271; tab = tuner_init_tab_tda18271;
break; break;
case AF9013_TUNER_UNKNOWN: case AF9013_TUNER_UNKNOWN:
default: default:
len = ARRAY_SIZE(tuner_init_unknown); len = ARRAY_SIZE(tuner_init_tab_unknown);
init = tuner_init_unknown; tab = tuner_init_tab_unknown;
break; break;
} }
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
u16 reg = init[i].addr; ret = regmap_update_bits(state->regmap, tab[i].reg, tab[i].mask,
u8 mask = GENMASK(init[i].pos + init[i].len - 1, init[i].pos); tab[i].val);
u8 val = init[i].val << init[i].pos;
ret = regmap_update_bits(state->regmap, reg, mask, val);
if (ret) if (ret)
goto err; goto err;
} }
......
This diff is collapsed.
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