Commit a5293dbd authored by Matthias Schwarzott's avatar Matthias Schwarzott Committed by Mauro Carvalho Chehab

[media] si2165: create function si2165_write_reg_list for writing register lists

It is common the need of writing a table of values. Add a function to provide a
helper to address such case. This will allow further code cleanups.
Signed-off-by: default avatarMatthias Schwarzott <zzam@gentoo.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent c1c49674
...@@ -243,6 +243,27 @@ static int si2165_writereg_mask8(struct si2165_state *state, const u16 reg, ...@@ -243,6 +243,27 @@ static int si2165_writereg_mask8(struct si2165_state *state, const u16 reg,
return ret; return ret;
} }
#define REG16(reg, val) { (reg), (val) & 0xff }, { (reg)+1, (val)>>8 & 0xff }
struct si2165_reg_value_pair {
u16 reg;
u8 val;
};
static int si2165_write_reg_list(struct si2165_state *state,
const struct si2165_reg_value_pair *regs,
int count)
{
int i;
int ret;
for (i = 0; i < count; i++) {
ret = si2165_writereg8(state, regs[i].reg, regs[i].val);
if (ret < 0)
return ret;
}
return 0;
}
static int si2165_get_tune_settings(struct dvb_frontend *fe, static int si2165_get_tune_settings(struct dvb_frontend *fe,
struct dvb_frontend_tune_settings *s) struct dvb_frontend_tune_settings *s)
{ {
......
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