Commit 69eb1803 authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] m5mols: Simplify the I2C registers definition

The redundant definitions of the m5mols I2C register addresses within
the pages (categories) are removed. In place of symbolic definitions
plain numbers are used which simplifies the code and eases identifying
the registers in the documentation.

Also make the m5mols_busy() function accept I2C_REG() value as a register
address, like all other functions, rather than using the category and
command values.
Acked-by: default avatarHeungJun Kim <riverful.kim@samsung.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent dafb9c70
......@@ -257,7 +257,7 @@ int m5mols_read_u8(struct v4l2_subdev *sd, u32 reg_comb, u8 *val);
int m5mols_read_u16(struct v4l2_subdev *sd, u32 reg_comb, u16 *val);
int m5mols_read_u32(struct v4l2_subdev *sd, u32 reg_comb, u32 *val);
int m5mols_write(struct v4l2_subdev *sd, u32 reg_comb, u32 val);
int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u8 value);
int m5mols_busy(struct v4l2_subdev *sd, u32 reg, u8 value);
/*
* Mode operation of the M-5MOLS
......
......@@ -272,14 +272,14 @@ int m5mols_write(struct v4l2_subdev *sd, u32 reg, u32 val)
return 0;
}
int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u8 mask)
int m5mols_busy(struct v4l2_subdev *sd, u32 reg, u8 mask)
{
u8 busy;
int i;
int ret;
for (i = 0; i < M5MOLS_I2C_CHECK_RETRY; i++) {
ret = m5mols_read_u8(sd, I2C_REG(category, cmd, 1), &busy);
ret = m5mols_read_u8(sd, reg, &busy);
if (ret < 0)
return ret;
if ((busy & mask) == mask)
......@@ -317,7 +317,7 @@ static int m5mols_reg_mode(struct v4l2_subdev *sd, u8 mode)
{
int ret = m5mols_write(sd, SYSTEM_SYSMODE, mode);
return ret ? ret : m5mols_busy(sd, CAT_SYSTEM, CAT0_SYSMODE, mode);
return ret ? ret : m5mols_busy(sd, mode, SYSTEM_SYSMODE);
}
/**
......@@ -829,8 +829,7 @@ static int m5mols_s_power(struct v4l2_subdev *sd, int on)
if (!ret)
ret = m5mols_write(sd, AF_MODE, REG_AF_POWEROFF);
if (!ret)
ret = m5mols_busy(sd, CAT_SYSTEM, CAT0_STATUS,
REG_AF_IDLE);
ret = m5mols_busy(sd, SYSTEM_STATUS, REG_AF_IDLE);
if (!ret)
v4l2_info(sd, "Success soft-landing lens\n");
}
......
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