media: i2c: sc831ai fix compile error

Change-Id: I7c7cccdd947c42f57180279011d18edaf4702912
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
This commit is contained in:
Zefa Chen
2025-08-20 09:23:38 +08:00
parent 996336689c
commit b2d836232b

View File

@@ -365,7 +365,7 @@ static const struct sc831ai_mode supported_modes[] = {
.hdr_mode = NO_HDR,
.mipi_freq_idx = 0,
.bpp = 10,
.vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0,
.vc[PAD0] = 0,
},
};
@@ -498,7 +498,7 @@ static void sc831ai_change_mode(struct sc831ai *sc831ai,
}
static int sc831ai_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -515,7 +515,7 @@ static int sc831ai_set_fmt(struct v4l2_subdev *sd,
fmt->format.field = V4L2_FIELD_NONE;
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
*v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format;
*v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format;
#else
mutex_unlock(&sc831ai->mutex);
return -ENOTTY;
@@ -543,7 +543,7 @@ static int sc831ai_set_fmt(struct v4l2_subdev *sd,
}
static int sc831ai_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *fmt)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -552,7 +552,7 @@ static int sc831ai_get_fmt(struct v4l2_subdev *sd,
mutex_lock(&sc831ai->mutex);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad);
#else
mutex_unlock(&sc831ai->mutex);
return -ENOTTY;
@@ -573,7 +573,7 @@ static int sc831ai_get_fmt(struct v4l2_subdev *sd,
}
static int sc831ai_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -586,7 +586,7 @@ static int sc831ai_enum_mbus_code(struct v4l2_subdev *sd,
}
static int sc831ai_enum_frame_sizes(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_size_enum *fse)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -638,20 +638,8 @@ static int sc831ai_g_frame_interval(struct v4l2_subdev *sd,
static int sc831ai_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
struct v4l2_mbus_config *config)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
const struct sc831ai_mode *mode = sc831ai->cur_mode;
u32 val = 0;
if (mode->hdr_mode == NO_HDR)
val = 1 << (SC831AI_2LANES - 1) | V4L2_MBUS_CSI2_CHANNEL_0 |
V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
if (mode->hdr_mode == HDR_X2)
val = 1 << (SC831AI_2LANES - 1) | V4L2_MBUS_CSI2_CHANNEL_0 |
V4L2_MBUS_CSI2_CONTINUOUS_CLOCK |
V4L2_MBUS_CSI2_CHANNEL_1;
config->type = V4L2_MBUS_CSI2_DPHY;
config->flags = val;
config->bus.mipi_csi2.num_data_lanes = SC831AI_2LANES;
return 0;
}
@@ -1282,7 +1270,7 @@ static int sc831ai_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
struct v4l2_mbus_framefmt *try_fmt =
v4l2_subdev_get_try_format(sd, fh->pad, 0);
v4l2_subdev_get_try_format(sd, fh->state, 0);
const struct sc831ai_mode *def_mode = &supported_modes[0];
mutex_lock(&sc831ai->mutex);
@@ -1301,7 +1289,7 @@ static int sc831ai_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
static int
sc831ai_enum_frame_interval(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_frame_interval_enum *fie)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -1324,7 +1312,7 @@ sc831ai_enum_frame_interval(struct v4l2_subdev *sd,
#define DST_HEIGHT_1080 1080
static int sc831ai_get_selection(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_selection *sel)
{
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -1771,7 +1759,7 @@ static int sc831ai_probe(struct i2c_client *client,
sc831ai->module_index, facing, SC831AI_NAME,
dev_name(sd->dev));
ret = v4l2_async_register_subdev_sensor_common(sd);
ret = v4l2_async_register_subdev_sensor(sd);
if (ret) {
dev_err(dev, "v4l2 async register subdev failed\n");
goto err_clean_entity;
@@ -1800,7 +1788,7 @@ err_destroy_mutex:
return ret;
}
static int sc831ai_remove(struct i2c_client *client)
static void sc831ai_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct sc831ai *sc831ai = to_sc831ai(sd);
@@ -1818,8 +1806,6 @@ static int sc831ai_remove(struct i2c_client *client)
if (!pm_runtime_status_suspended(&client->dev))
__sc831ai_power_off(sc831ai);
pm_runtime_set_suspended(&client->dev);
return 0;
}
#if IS_ENABLED(CONFIG_OF)
@@ -1841,8 +1827,8 @@ static struct i2c_driver sc831ai_i2c_driver = {
.pm = &sc831ai_pm_ops,
.of_match_table = of_match_ptr(sc831ai_of_match),
},
.probe = &sc831ai_probe,
.remove = &sc831ai_remove,
.probe = sc831ai_probe,
.remove = sc831ai_remove,
.id_table = sc831ai_match_id,
};