From d5e5e440afeaf806937455dfdbaec1ad451808d1 Mon Sep 17 00:00:00 2001 From: Zefa Chen Date: Tue, 7 Jan 2025 11:04:52 +0800 Subject: [PATCH] media: i2c: sc450ai fixes error of compile Signed-off-by: Zefa Chen Change-Id: I7a458a0eecafc22df828727e2cd370e61860aa5b --- drivers/media/i2c/sc450ai.c | 39 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/media/i2c/sc450ai.c b/drivers/media/i2c/sc450ai.c index 8e0bbc256717..022fd33f2012 100644 --- a/drivers/media/i2c/sc450ai.c +++ b/drivers/media/i2c/sc450ai.c @@ -568,7 +568,7 @@ static const struct sc450ai_mode supported_modes[] = { .hdr_mode = NO_HDR, .xvclk_freq = 27000000, .link_freq_idx = 0, - .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0, + .vc[PAD0] = 0, }, { .width = 1344, @@ -585,7 +585,7 @@ static const struct sc450ai_mode supported_modes[] = { .hdr_mode = NO_HDR, .xvclk_freq = 27000000, .link_freq_idx = 0, - .vc[PAD0] = V4L2_MBUS_CSI2_CHANNEL_0, + .vc[PAD0] = 0, }, }; @@ -791,7 +791,7 @@ sc450ai_find_best_fit(struct v4l2_subdev_format *fmt) } static int sc450ai_set_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { struct sc450ai *sc450ai = to_sc450ai(sd); @@ -809,7 +809,7 @@ static int sc450ai_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(&sc450ai->mutex); return -ENOTTY; @@ -839,7 +839,7 @@ static int sc450ai_set_fmt(struct v4l2_subdev *sd, } static int sc450ai_get_fmt(struct v4l2_subdev *sd, - struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { struct sc450ai *sc450ai = to_sc450ai(sd); @@ -848,7 +848,7 @@ static int sc450ai_get_fmt(struct v4l2_subdev *sd, mutex_lock(&sc450ai->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(&sc450ai->mutex); return -ENOTTY; @@ -870,7 +870,7 @@ static int sc450ai_get_fmt(struct v4l2_subdev *sd, } static int sc450ai_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 sc450ai *sc450ai = to_sc450ai(sd); @@ -883,7 +883,7 @@ static int sc450ai_enum_mbus_code(struct v4l2_subdev *sd, } static int sc450ai_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) { if (fse->index >= ARRAY_SIZE(supported_modes)) @@ -934,20 +934,8 @@ static int sc450ai_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, struct v4l2_mbus_config *config) { - struct sc450ai *sc450ai = to_sc450ai(sd); - const struct sc450ai_mode *mode = sc450ai->cur_mode; - - u32 val = 1 << (SC450AI_LANES - 1) | - V4L2_MBUS_CSI2_CHANNEL_0 | - V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; - - if (mode->hdr_mode != NO_HDR) - val |= V4L2_MBUS_CSI2_CHANNEL_1; - if (mode->hdr_mode == HDR_X3) - val |= V4L2_MBUS_CSI2_CHANNEL_2; - config->type = V4L2_MBUS_CSI2_DPHY; - config->flags = val; + config->bus.mipi_csi2.num_data_lanes = SC450AI_LANES; return 0; } @@ -1392,7 +1380,7 @@ static int sc450ai_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { struct sc450ai *sc450ai = to_sc450ai(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 sc450ai_mode *def_mode = &supported_modes[0]; mutex_lock(&sc450ai->mutex); @@ -1410,7 +1398,7 @@ static int sc450ai_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) #endif static int sc450ai_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) { if (fie->index >= ARRAY_SIZE(supported_modes)) @@ -1818,7 +1806,7 @@ static int sc450ai_probe(struct i2c_client *client, snprintf(sd->name, sizeof(sd->name), "m%02d_%s_%s %s", sc450ai->module_index, facing, SC450AI_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; @@ -1847,7 +1835,7 @@ err_destroy_mutex: return ret; } -static int sc450ai_remove(struct i2c_client *client) +static void sc450ai_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); struct sc450ai *sc450ai = to_sc450ai(sd); @@ -1866,7 +1854,6 @@ static int sc450ai_remove(struct i2c_client *client) __sc450ai_power_off(sc450ai); pm_runtime_set_suspended(&client->dev); - return 0; } #if IS_ENABLED(CONFIG_OF)