Commit 3aa39a49 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp-ov2680: Make ov2680_read_reg() support 24 bit registers

Some ov2680 registers like exposure are 24 bit,
ov2680_read_reg() already mostly supports this, we just
need to change the return type from u16 to u32.

Link: https://lore.kernel.org/linux-media/20211107171549.267583-8-hdegoede@redhat.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 4ed2caf8
...@@ -48,7 +48,7 @@ static enum atomisp_bayer_order ov2680_bayer_order_mapping[] = { ...@@ -48,7 +48,7 @@ static enum atomisp_bayer_order ov2680_bayer_order_mapping[] = {
/* i2c read/write stuff */ /* i2c read/write stuff */
static int ov2680_read_reg(struct i2c_client *client, static int ov2680_read_reg(struct i2c_client *client,
int len, u16 reg, u16 *val) int len, u16 reg, u32 *val)
{ {
struct i2c_msg msgs[2]; struct i2c_msg msgs[2];
u8 addr_buf[2] = { reg >> 8, reg & 0xff }; u8 addr_buf[2] = { reg >> 8, reg & 0xff };
...@@ -168,7 +168,7 @@ static int ov2680_get_intg_factor(struct i2c_client *client, ...@@ -168,7 +168,7 @@ static int ov2680_get_intg_factor(struct i2c_client *client,
{ {
struct atomisp_sensor_mode_data *buf = &info->data; struct atomisp_sensor_mode_data *buf = &info->data;
unsigned int pix_clk_freq_hz; unsigned int pix_clk_freq_hz;
u16 reg_val; u32 reg_val;
int ret; int ret;
dev_dbg(&client->dev, "++++ov2680_get_intg_factor\n"); dev_dbg(&client->dev, "++++ov2680_get_intg_factor\n");
...@@ -410,7 +410,7 @@ static long ov2680_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) ...@@ -410,7 +410,7 @@ static long ov2680_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
static int ov2680_q_exposure(struct v4l2_subdev *sd, s32 *value) static int ov2680_q_exposure(struct v4l2_subdev *sd, s32 *value)
{ {
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
u16 reg_v, reg_v2; u32 reg_v, reg_v2;
int ret; int ret;
/* get exposure */ /* get exposure */
...@@ -433,7 +433,7 @@ static int ov2680_q_exposure(struct v4l2_subdev *sd, s32 *value) ...@@ -433,7 +433,7 @@ static int ov2680_q_exposure(struct v4l2_subdev *sd, s32 *value)
if (ret) if (ret)
goto err; goto err;
*value = reg_v + (((u32)reg_v2 << 16)); *value = reg_v + (reg_v2 << 16);
err: err:
return ret; return ret;
} }
...@@ -443,7 +443,7 @@ static int ov2680_v_flip(struct v4l2_subdev *sd, s32 value) ...@@ -443,7 +443,7 @@ static int ov2680_v_flip(struct v4l2_subdev *sd, s32 value)
struct camera_mipi_info *ov2680_info = NULL; struct camera_mipi_info *ov2680_info = NULL;
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret; int ret;
u16 val; u32 val;
u8 index; u8 index;
dev_dbg(&client->dev, "@%s: value:%d\n", __func__, value); dev_dbg(&client->dev, "@%s: value:%d\n", __func__, value);
...@@ -473,7 +473,7 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value) ...@@ -473,7 +473,7 @@ static int ov2680_h_flip(struct v4l2_subdev *sd, s32 value)
struct camera_mipi_info *ov2680_info = NULL; struct camera_mipi_info *ov2680_info = NULL;
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret; int ret;
u16 val; u32 val;
u8 index; u8 index;
dev_dbg(&client->dev, "@%s: value:%d\n", __func__, value); dev_dbg(&client->dev, "@%s: value:%d\n", __func__, value);
...@@ -933,7 +933,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd, ...@@ -933,7 +933,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
static int ov2680_detect(struct i2c_client *client) static int ov2680_detect(struct i2c_client *client)
{ {
struct i2c_adapter *adapter = client->adapter; struct i2c_adapter *adapter = client->adapter;
u16 high, low; u32 high, low;
int ret; int ret;
u16 id; u16 id;
u8 revision; u8 revision;
......
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