Skip to content

Commit

Permalink
iotg adl-n mr1 release (#112)
Browse files Browse the repository at this point in the history
Signed-off-by: zouxiaoh <xiaohong.zou@intel.com>
  • Loading branch information
zouxiaoh authored Mar 23, 2023
1 parent 32dbac5 commit c61e2c8
Show file tree
Hide file tree
Showing 21 changed files with 863 additions and 321 deletions.
971 changes: 719 additions & 252 deletions drivers/media/i2c/d4xx.c

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions drivers/media/i2c/hm11b1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,11 @@ static int hm11b1_identify_module(struct hm11b1 *hm11b1)
return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
static int hm11b1_remove(struct i2c_client *client)
#else
static void hm11b1_remove(struct i2c_client *client)
#endif
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct hm11b1 *hm11b1 = to_hm11b1(sd);
Expand All @@ -1064,7 +1068,9 @@ static int hm11b1_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
mutex_destroy(&hm11b1->mutex);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
return 0;
#endif
}

#if IS_ENABLED(CONFIG_INTEL_SKL_INT3472)
Expand Down
13 changes: 13 additions & 0 deletions drivers/media/i2c/lt6911uxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,26 @@ static u64 __maybe_unused get_hblank(struct lt6911uxc_state *lt6911uxc)
return hblank;
}

static int lt6911uxc_set_stream(struct v4l2_subdev *sd, int enable);

static int lt6911uxc_set_ctrl(struct v4l2_ctrl *ctrl)
{
struct lt6911uxc_state *lt6911uxc = container_of(ctrl->handler,
struct lt6911uxc_state, ctrl_handler);
struct i2c_client *client = v4l2_get_subdevdata(&lt6911uxc->sd);
s64 exposure_max;
int ret = 0;
u32 val;

/* Set streaming when ipu set sub_stream */
if (ctrl->id == V4L2_CID_IPU_SET_SUB_STREAM) {
val = (*ctrl->p_new.p_s64 & 0xFFFF);
dev_info(&client->dev, "V4L2_CID_IPU_SET_SUB_STREAM %x\n", val);
mutex_unlock(&lt6911uxc->mutex);
ret = lt6911uxc_set_stream(&lt6911uxc->sd, val & 0x00FF);
mutex_lock(&lt6911uxc->mutex);
return ret;
}

/* Propagate change of current control to all related controls */
if (ctrl->id == V4L2_CID_VBLANK) {
Expand Down
8 changes: 7 additions & 1 deletion drivers/media/i2c/ov01a10.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020-2021 Intel Corporation.
// Copyright (c) 2020-2022 Intel Corporation.

#include <asm/unaligned.h>
#include <linux/acpi.h>
Expand Down Expand Up @@ -837,7 +837,11 @@ static int ov01a10_identify_module(struct ov01a10 *ov01a10)
return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
static int ov01a10_remove(struct i2c_client *client)
#else
static void ov01a10_remove(struct i2c_client *client)
#endif
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov01a10 *ov01a10 = to_ov01a10(sd);
Expand All @@ -848,7 +852,9 @@ static int ov01a10_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
mutex_destroy(&ov01a10->mutex);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
return 0;
#endif
}

static int ov01a10_probe(struct i2c_client *client)
Expand Down
6 changes: 6 additions & 0 deletions drivers/media/i2c/ov01a1s.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,11 @@ static int ov01a1s_identify_module(struct ov01a1s *ov01a1s)
return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
static int ov01a1s_remove(struct i2c_client *client)
#else
static void ov01a1s_remove(struct i2c_client *client)
#endif
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov01a1s *ov01a1s = to_ov01a1s(sd);
Expand All @@ -892,7 +896,9 @@ static int ov01a1s_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
mutex_destroy(&ov01a1s->mutex);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
return 0;
#endif
}

#if IS_ENABLED(CONFIG_INTEL_SKL_INT3472)
Expand Down
6 changes: 6 additions & 0 deletions drivers/media/i2c/ov02c10.c
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,11 @@ static int ov02c10_identify_module(struct ov02c10 *ov02c10)
return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
static int ov02c10_remove(struct i2c_client *client)
#else
static void ov02c10_remove(struct i2c_client *client)
#endif
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov02c10 *ov02c10 = to_ov02c10(sd);
Expand All @@ -1232,7 +1236,9 @@ static int ov02c10_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
mutex_destroy(&ov02c10->mutex);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
return 0;
#endif
}

static int ov02c10_probe(struct i2c_client *client)
Expand Down
7 changes: 7 additions & 0 deletions drivers/media/i2c/ov13858_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down Expand Up @@ -2013,7 +2014,11 @@ static int ov13858_probe(struct i2c_client *client,
return ret;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
static int ov13858_remove(struct i2c_client *client)
#else
static void ov13858_remove(struct i2c_client *client)
#endif
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov13858 *ov13858 = to_ov13858(sd);
Expand All @@ -2024,7 +2029,9 @@ static int ov13858_remove(struct i2c_client *client)

pm_runtime_disable(&client->dev);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
return 0;
#endif
}

static const struct i2c_device_id ov13858_id_table[] = {
Expand Down
8 changes: 7 additions & 1 deletion drivers/media/i2c/ov8856.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2021 Intel Corporation.
// Copyright (c) 2021-2022 Intel Corporation.

#include <asm/unaligned.h>
#include <linux/acpi.h>
Expand Down Expand Up @@ -1197,7 +1197,11 @@ static int ov8856_identify_module(struct ov8856 *ov8856)
return 0;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
static int ov8856_remove(struct i2c_client *client)
#else
static void ov8856_remove(struct i2c_client *client)
#endif
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct ov8856 *ov8856 = to_ov8856(sd);
Expand All @@ -1208,7 +1212,9 @@ static int ov8856_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
mutex_destroy(&ov8856->mutex);

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
return 0;
#endif
}

static int ov8856_probe(struct i2c_client *client)
Expand Down
7 changes: 3 additions & 4 deletions drivers/media/pci/intel/ipu-isys-csi2-be-soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ static const u32 csi2_be_soc_supported_codes_pad[] = {
MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_UYVY8_1X16,
MEDIA_BUS_FMT_YUYV8_1X16,
MEDIA_BUS_FMT_VYUY8_1X16,
MEDIA_BUS_FMT_SBGGR12_1X12,
MEDIA_BUS_FMT_SGBRG12_1X12,
MEDIA_BUS_FMT_SGRBG12_1X12,
Expand Down Expand Up @@ -109,9 +108,9 @@ __subdev_link_validate(struct v4l2_subdev *sd, struct media_link *link,
struct v4l2_subdev_format *source_fmt,
struct v4l2_subdev_format *sink_fmt)
{
struct ipu_isys_pipeline *ip = container_of(sd->entity.pipe,
struct ipu_isys_pipeline,
pipe);
struct ipu_isys_pipeline *ip =
container_of(media_entity_pipeline(&sd->entity),
struct ipu_isys_pipeline, pipe);

ip->csi2_be_soc = to_ipu_isys_csi2_be_soc(sd);
return ipu_isys_subdev_link_validate(sd, link, source_fmt, sink_fmt);
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/pci/intel/ipu-isys-csi2-be.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ static int __subdev_link_validate(struct v4l2_subdev *sd,
struct v4l2_subdev_format *source_fmt,
struct v4l2_subdev_format *sink_fmt)
{
struct ipu_isys_pipeline *ip = container_of(sd->entity.pipe,
struct ipu_isys_pipeline,
pipe);
struct ipu_isys_pipeline *ip =
container_of(media_entity_pipeline(&sd->entity),
struct ipu_isys_pipeline, pipe);

ip->csi2_be = to_ipu_isys_csi2_be(sd);
return ipu_isys_subdev_link_validate(sd, link, source_fmt, sink_fmt);
Expand Down
38 changes: 18 additions & 20 deletions drivers/media/pci/intel/ipu-isys-csi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ static const u32 csi2_supported_codes_pad_sink[] = {
MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_UYVY8_1X16,
MEDIA_BUS_FMT_YUYV8_1X16,
MEDIA_BUS_FMT_VYUY8_1X16,
MEDIA_BUS_FMT_YUYV10_1X20,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_SGBRG10_1X10,
Expand Down Expand Up @@ -53,7 +52,6 @@ static const u32 csi2_supported_codes_pad_source[] = {
MEDIA_BUS_FMT_RGB888_1X24,
MEDIA_BUS_FMT_UYVY8_1X16,
MEDIA_BUS_FMT_YUYV8_1X16,
MEDIA_BUS_FMT_VYUY8_1X16,
MEDIA_BUS_FMT_YUYV10_1X20,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_SGBRG10_1X10,
Expand All @@ -80,9 +78,9 @@ static struct v4l2_subdev_internal_ops csi2_sd_internal_ops = {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 255)
int ipu_isys_csi2_get_link_freq(struct ipu_isys_csi2 *csi2, s64 *link_freq)
{
struct ipu_isys_pipeline *pipe = container_of(csi2->asd.sd.entity.pipe,
struct ipu_isys_pipeline,
pipe);
struct ipu_isys_pipeline *pipe =
container_of(media_entity_pipeline(&csi2->asd.sd.entity),
struct ipu_isys_pipeline, pipe);
struct v4l2_subdev *ext_sd =
media_entity_to_v4l2_subdev(pipe->external->entity);
struct device *dev = &csi2->isys->adev->dev;
Expand Down Expand Up @@ -111,9 +109,9 @@ int ipu_isys_csi2_get_link_freq(struct ipu_isys_csi2 *csi2, s64 *link_freq)
#else
int ipu_isys_csi2_get_link_freq(struct ipu_isys_csi2 *csi2, __s64 *link_freq)
{
struct ipu_isys_pipeline *pipe = container_of(csi2->asd.sd.entity.pipe,
struct ipu_isys_pipeline,
pipe);
struct ipu_isys_pipeline *pipe =
container_of(media_entity_pipeline(&csi2->asd.sd.entity),
struct ipu_isys_pipeline, pipe);
struct v4l2_subdev *ext_sd =
media_entity_to_v4l2_subdev(pipe->external->entity);
struct v4l2_ext_control c = {.id = V4L2_CID_LINK_FREQ, };
Expand Down Expand Up @@ -261,9 +259,8 @@ ipu_isys_csi2_calc_timing(struct ipu_isys_csi2 *csi2,
static int set_stream(struct v4l2_subdev *sd, int enable)
{
struct ipu_isys_csi2 *csi2 = to_ipu_isys_csi2(sd);
struct ipu_isys_pipeline *ip = container_of(sd->entity.pipe,
struct ipu_isys_pipeline,
pipe);
struct ipu_isys_pipeline *ip =
to_ipu_isys_pipeline(media_entity_pipeline(&sd->entity));
struct ipu_isys_csi2_config *cfg;
struct v4l2_subdev *ext_sd;
struct ipu_isys_csi2_timing timing = {0};
Expand Down Expand Up @@ -329,21 +326,23 @@ static void csi2_capture_done(struct ipu_isys_pipeline *ip,

static int csi2_link_validate(struct media_link *link)
{
struct media_pipeline *media_pipe;
struct ipu_isys_csi2 *csi2;
struct ipu_isys_pipeline *ip;
int rval;

if (!link->sink->entity ||
!link->sink->entity->pipe || !link->source->entity)
if (!link->sink->entity || !link->source->entity)
return -EINVAL;
media_pipe = media_entity_pipeline(link->sink->entity);
if (!media_pipe)
return -EINVAL;
csi2 =
to_ipu_isys_csi2(media_entity_to_v4l2_subdev(link->sink->entity));
ip = to_ipu_isys_pipeline(link->sink->entity->pipe);

ip = to_ipu_isys_pipeline(media_pipe);
csi2->receiver_errors = 0;
ip->csi2 = csi2;
ipu_isys_video_add_capture_done(to_ipu_isys_pipeline
(link->sink->entity->pipe),
csi2_capture_done);
ipu_isys_video_add_capture_done(ip, csi2_capture_done);

rval = v4l2_subdev_link_validate(link);
if (rval)
Expand Down Expand Up @@ -410,9 +409,8 @@ static int __subdev_link_validate(struct v4l2_subdev *sd,
struct v4l2_subdev_format *source_fmt,
struct v4l2_subdev_format *sink_fmt)
{
struct ipu_isys_pipeline *ip = container_of(sd->entity.pipe,
struct ipu_isys_pipeline,
pipe);
struct ipu_isys_pipeline *ip =
to_ipu_isys_pipeline(media_entity_pipeline(&sd->entity));

if (source_fmt->format.field == V4L2_FIELD_ALTERNATE)
ip->interlaced = true;
Expand Down
Loading

0 comments on commit c61e2c8

Please sign in to comment.