Skip to content

Commit

Permalink
Realsense PV release for ADL-P. (#143)
Browse files Browse the repository at this point in the history
Signed-off-by: zouxiaoh <[email protected]>
  • Loading branch information
zouxiaoh authored May 22, 2023
1 parent f804a4a commit f8c0659
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 8 deletions.
2 changes: 1 addition & 1 deletion drivers/media/i2c/d4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ static const struct ds5_format ds5_y_formats_ds5u[] = {
{
/* First format: default */
.data_type = 0x2a, /* Y8 */
.mbus_code = MEDIA_BUS_FMT_SBGGR8_1X8,
.mbus_code = MEDIA_BUS_FMT_Y8_1X8,
.n_resolutions = ARRAY_SIZE(y8_sizes),
.resolutions = y8_sizes,
}, {
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/pci/intel/ipu-buttress.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#define BUTTRESS_IS_FREQ_STEP 25U
#define BUTTRESS_MIN_FORCE_IS_FREQ (BUTTRESS_IS_FREQ_STEP * 8)
#define BUTTRESS_MAX_FORCE_IS_FREQ (BUTTRESS_IS_FREQ_STEP * 16)
#define BUTTRESS_MAX_FORCE_IS_FREQ (BUTTRESS_IS_FREQ_STEP * 22)

struct ipu_buttress_ctrl {
u32 freq_ctl, pwr_sts_shift, pwr_sts_mask, pwr_sts_on, pwr_sts_off;
Expand Down
1 change: 1 addition & 0 deletions drivers/media/pci/intel/ipu-isys-csi2-be-soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static const u32 csi2_be_soc_supported_codes_pad[] = {
MEDIA_BUS_FMT_SGRBG8_1X8,
MEDIA_BUS_FMT_SRGGB8_1X8,
MEDIA_BUS_FMT_Y8_1X8,
MEDIA_BUS_FMT_FIXED,
0,
};

Expand Down
35 changes: 35 additions & 0 deletions drivers/media/pci/intel/ipu-isys-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const struct ipu_isys_pixelformat ipu_isys_pfmts_be_soc[] = {
IPU_FW_ISYS_FRAME_FORMAT_RAW8},
{V4L2_PIX_FMT_GREY, 8, 8, 0, MEDIA_BUS_FMT_Y8_1X8,
IPU_FW_ISYS_FRAME_FORMAT_RAW8},
{V4L2_META_FMT_D4XX, 8, 8, 0, MEDIA_BUS_FMT_FIXED, 0},
{}
};

Expand Down Expand Up @@ -417,6 +418,16 @@ static int vidioc_g_fmt_vid_cap_mplane(struct file *file, void *fh,
{
struct ipu_isys_video *av = video_drvdata(file);

if (fmt->type == V4L2_BUF_TYPE_META_CAPTURE) {
fmt->fmt.meta.buffersize = av->mpix.plane_fmt[0].sizeimage;
fmt->fmt.meta.bytesperline = av->mpix.plane_fmt[0].bytesperline;
fmt->fmt.meta.width = av->mpix.width;
fmt->fmt.meta.height = av->mpix.height;
fmt->fmt.meta.dataformat = av->mpix.pixelformat;

return 0;
}

fmt->fmt.pix_mp = av->mpix;

return 0;
Expand Down Expand Up @@ -540,10 +551,29 @@ static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
struct ipu_isys_video *av = video_drvdata(file);
struct v4l2_pix_format_mplane mpix;

if (av->aq.vbq.streaming)
return -EBUSY;

if (f->type == V4L2_BUF_TYPE_META_CAPTURE) {
memset(&av->mpix, 0, sizeof(av->mpix));
memset(&mpix, 0, sizeof(mpix));
mpix.width = f->fmt.meta.width;
mpix.height = f->fmt.meta.height;
mpix.pixelformat = f->fmt.meta.dataformat;
av->pfmt = av->try_fmt_vid_mplane(av, &mpix);
av->aq.vbq.type = V4L2_BUF_TYPE_META_CAPTURE;
av->aq.vbq.is_multiplanar = false;
av->aq.vbq.is_output = false;
av->mpix = mpix;
f->fmt.meta.width = mpix.width;
f->fmt.meta.height = mpix.height;
f->fmt.meta.dataformat = mpix.pixelformat;
f->fmt.meta.bytesperline = mpix.plane_fmt[0].bytesperline;
f->fmt.meta.buffersize = mpix.plane_fmt[0].sizeimage;
return 0;
}
av->pfmt = av->try_fmt_vid_mplane(av, &f->fmt.pix_mp);
av->mpix = f->fmt.pix_mp;

Expand Down Expand Up @@ -2333,6 +2363,10 @@ static const struct v4l2_ioctl_ops ioctl_ops_mplane = {
.vidioc_g_fmt_vid_cap_mplane = vidioc_g_fmt_vid_cap_mplane,
.vidioc_s_fmt_vid_cap_mplane = vidioc_s_fmt_vid_cap_mplane,
.vidioc_try_fmt_vid_cap_mplane = vidioc_try_fmt_vid_cap_mplane,
.vidioc_enum_fmt_meta_cap = ipu_isys_vidioc_enum_fmt,
.vidioc_g_fmt_meta_cap = vidioc_g_fmt_vid_cap_mplane,
.vidioc_s_fmt_meta_cap = vidioc_s_fmt_vid_cap_mplane,
.vidioc_try_fmt_meta_cap = vidioc_try_fmt_vid_cap_mplane,
.vidioc_reqbufs = vb2_ioctl_reqbufs,
.vidioc_create_bufs = vb2_ioctl_create_bufs,
.vidioc_prepare_buf = vb2_ioctl_prepare_buf,
Expand Down Expand Up @@ -2401,6 +2435,7 @@ int ipu_isys_video_init(struct ipu_isys_video *av,
av->aq.vbq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
ioctl_ops = &ioctl_ops_mplane;
av->vdev.device_caps |= V4L2_CAP_VIDEO_CAPTURE_MPLANE;
av->vdev.device_caps |= V4L2_CAP_META_CAPTURE;
av->vdev.vfl_dir = VFL_DIR_RX;
} else {
av->aq.vbq.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
Expand Down
32 changes: 26 additions & 6 deletions drivers/media/pci/intel/ipu.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@
enum ipu_version ipu_ver;
EXPORT_SYMBOL(ipu_ver);

static int isys_freq_overwrite = -1;
module_param(isys_freq_overwrite, int, 0660);
MODULE_PARM_DESC(isys_freq_overwrite, "overwrite isys freq default value");
static int isys_freq_override = -1;
module_param(isys_freq_override, int, 0660);
MODULE_PARM_DESC(isys_freq_override, "override isys freq default value");

static int psys_freq_override = -1;
module_param(psys_freq_override, int, 0660);
MODULE_PARM_DESC(psys_freq_override, "override psys freq default value");

#if IS_ENABLED(CONFIG_INTEL_IPU6_ACPI)
static int isys_init_acpi_add_device(struct device *dev, void *priv,
Expand Down Expand Up @@ -656,12 +660,16 @@ static int ipu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto out_ipu_bus_del_devices;
}

if ((isys_freq_overwrite >= IPU_IS_FREQ_MIN) && (isys_freq_overwrite <= IPU_IS_FREQ_MAX)) {
u64 val = isys_freq_overwrite;
if (isys_freq_override >= BUTTRESS_MIN_FORCE_IS_FREQ &&
isys_freq_override <= BUTTRESS_MAX_FORCE_IS_FREQ) {
u64 val = isys_freq_override;

do_div(val, BUTTRESS_IS_FREQ_STEP);
dev_info(&isp->pdev->dev, "isys freq overwrite to %d\n", isys_freq_overwrite);
isys_ctrl->divisor = val;
dev_info(&isp->pdev->dev,
"adusted isys freq from input (%d) and set (%d)\n",
isys_freq_override,
isys_ctrl->divisor * BUTTRESS_IS_FREQ_STEP);
}

psys_ctrl = devm_kzalloc(&pdev->dev, sizeof(*psys_ctrl), GFP_KERNEL);
Expand All @@ -681,6 +689,18 @@ static int ipu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto out_ipu_bus_del_devices;
}

if (psys_freq_override >= BUTTRESS_MIN_FORCE_PS_FREQ &&
psys_freq_override <= BUTTRESS_MAX_FORCE_PS_FREQ) {
u64 val = psys_freq_override;

do_div(val, BUTTRESS_PS_FREQ_STEP);
psys_ctrl->divisor = val;
psys_ctrl->qos_floor = val;
dev_info(&isp->pdev->dev,
"adjusted psys freq from input (%d) and set (%d)\n",
psys_freq_override,
psys_ctrl->divisor * BUTTRESS_PS_FREQ_STEP);
}
rval = pm_runtime_get_sync(&isp->psys->dev);
if (rval < 0) {
dev_err(&isp->psys->dev, "Failed to get runtime PM\n");
Expand Down

0 comments on commit f8c0659

Please sign in to comment.