Skip to content

Commit

Permalink
RPL-P Beta release (#70)
Browse files Browse the repository at this point in the history
Signed-off-by: zouxiaoh <[email protected]>

Signed-off-by: zouxiaoh <[email protected]>
  • Loading branch information
zouxiaoh authored Dec 7, 2022
1 parent 250f8f0 commit a285b51
Show file tree
Hide file tree
Showing 17 changed files with 532 additions and 317 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
export EXTERNAL_BUILD = 1

export CONFIG_VIDEO_INTEL_IPU6 = m
export CONFIG_VIDEO_INTEL_IPU_SOC = y
export CONFIG_VIDEO_INTEL_IPU_USE_PLATFORMDATA = y
export CONFIG_INTEL_SKL_INT3472 = m
export CONFIG_INTEL_IPU6_ACPI = m
obj-y += drivers/media/pci/intel/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ obj-$(CONFIG_VIDEO_D4XX) += d4xx.o
CONFIG_VIDEO_D4XX=m
CONFIG_INTEL_IPU6_ACPI=m
CONFIG_VIDEO_INTEL_IPU_SOC=y
CONFIG_VIDEO_INTEL_IPU_USE_PLATFORMDATA=m
CONFIG_VIDEO_INTEL_IPU_USE_PLATFORMDATA=y
```
### 2. Build outside kernel source tree
Expand Down
39 changes: 38 additions & 1 deletion drivers/media/i2c/imx390.c
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,11 @@ static int __maybe_unused imx390_resume(struct device *dev)
}

static int imx390_set_format(struct v4l2_subdev *sd,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
struct v4l2_subdev_pad_config *cfg,
#else
struct v4l2_subdev_state *sd_state,
#endif
struct v4l2_subdev_format *fmt)
{
struct imx390 *imx390 = to_imx390(sd);
Expand Down Expand Up @@ -1714,7 +1718,11 @@ static int imx390_set_format(struct v4l2_subdev *sd,

imx390_update_pad_format(mode, &fmt->format);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
*v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format;
#else
*v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format;
#endif
} else {
imx390->cur_mode = mode;
__v4l2_ctrl_s_ctrl(imx390->link_freq, mode->link_freq_index);
Expand Down Expand Up @@ -1746,15 +1754,24 @@ static int imx390_set_format(struct v4l2_subdev *sd,
}

static int imx390_get_format(struct v4l2_subdev *sd,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
struct v4l2_subdev_pad_config *cfg,
#else
struct v4l2_subdev_state *sd_state,
#endif
struct v4l2_subdev_format *fmt)
{
struct imx390 *imx390 = to_imx390(sd);

mutex_lock(&imx390->mutex);
if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
fmt->format = *v4l2_subdev_get_try_format(&imx390->sd, cfg,
fmt->pad);
#else
fmt->format = *v4l2_subdev_get_try_format(&imx390->sd, sd_state,
fmt->pad);
#endif
else
imx390_update_pad_format(imx390->cur_mode, &fmt->format);

Expand All @@ -1774,14 +1791,17 @@ static int imx390_get_frame_desc(struct v4l2_subdev *sd,
desc->entry[i].flags = 0;
desc->entry[i].pixelcode = MEDIA_BUS_FMT_FIXED;
desc->entry[i].length = 0;
desc->entry[i].bus.csi2.channel = i;
}

return 0;
}

static int imx390_enum_mbus_code(struct v4l2_subdev *sd,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
struct v4l2_subdev_pad_config *cfg,
#else
struct v4l2_subdev_state *sd_state,
#endif
struct v4l2_subdev_mbus_code_enum *code)
{
if (code->index >= ARRAY_SIZE(supported_formats))
Expand All @@ -1793,7 +1813,11 @@ static int imx390_enum_mbus_code(struct v4l2_subdev *sd,
}

static int imx390_enum_frame_size(struct v4l2_subdev *sd,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
struct v4l2_subdev_pad_config *cfg,
#else
struct v4l2_subdev_state *sd_state,
#endif
struct v4l2_subdev_frame_size_enum *fse)
{
if (fse->index >= ARRAY_SIZE(supported_modes))
Expand All @@ -1810,7 +1834,11 @@ static int imx390_enum_frame_size(struct v4l2_subdev *sd,
static int imx390_frame_rate[] = { 40, 20 };

static int imx390_enum_frame_interval(struct v4l2_subdev *subdev,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
struct v4l2_subdev_pad_config *cfg,
#else
struct v4l2_subdev_state *sd_state,
#endif
struct v4l2_subdev_frame_interval_enum *fie)
{
int mode_size = ARRAY_SIZE(supported_modes);
Expand Down Expand Up @@ -1839,8 +1867,13 @@ static int imx390_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
struct imx390 *imx390 = to_imx390(sd);

mutex_lock(&imx390->mutex);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)
imx390_update_pad_format(&supported_modes[0],
v4l2_subdev_get_try_format(sd, fh->pad, 0));
#else
imx390_update_pad_format(&supported_modes[0],
v4l2_subdev_get_try_format(sd, fh->state, 0));
#endif
mutex_unlock(&imx390->mutex);

return 0;
Expand Down Expand Up @@ -1994,7 +2027,11 @@ static int imx390_probe(struct i2c_client *client)
goto probe_error_v4l2_ctrl_handler_free;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0)
ret = v4l2_async_register_subdev_sensor_common(&imx390->sd);
#else
ret = v4l2_async_register_subdev_sensor(&imx390->sd);
#endif
if (ret < 0) {
dev_err(&client->dev, "failed to register V4L2 subdev: %d",
ret);
Expand Down
Loading

0 comments on commit a285b51

Please sign in to comment.