Camera: OOT: misc code fixes for drivers

1. Sensor deep power down and mclk enable
   and disable code.
2. Assign pads member in v4l2_subdev_state
   struct passed to v4l2_subdev_call.
3. emc and iso.emc clock are not available
   in K5.15. Disable clock get function.

Bug 3898807

Change-Id: If9e24ccd837af00df250571e6fc4c907886faf93
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2835934
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Ankur Pawar
2023-01-02 07:18:24 +00:00
committed by mobile promotions
parent 8b04ed92cb
commit 5957f061b3
3 changed files with 27 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
/* /*
* camera_common.c - utilities for tegra camera driver * camera_common.c - utilities for tegra camera driver
* *
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved.
*/ */
#include <linux/types.h> #include <linux/types.h>
#include <media/tegra-v4l2-camera.h> #include <media/tegra-v4l2-camera.h>
@@ -923,7 +923,18 @@ int camera_common_s_power(struct v4l2_subdev *sd, int on)
dev_err(s_data->dev, "%s: error power on\n", __func__); dev_err(s_data->dev, "%s: error power on\n", __func__);
return err; return err;
} }
err = camera_common_mclk_enable(s_data);
if (err) {
dev_err(s_data->dev, "%s: failed to enable mclk\n",
__func__);
call_s_op(s_data, power_off);
return err;
}
camera_common_dpd_disable(s_data);
} else { } else {
camera_common_dpd_enable(s_data);
camera_common_mclk_disable(s_data);
call_s_op(s_data, power_off); call_s_op(s_data, power_off);
} }

View File

@@ -2,7 +2,7 @@
/* /*
* NVIDIA Tegra Video Input Device * NVIDIA Tegra Video Input Device
* *
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved.
*/ */
#include <linux/atomic.h> #include <linux/atomic.h>
@@ -299,7 +299,9 @@ static void tegra_channel_fmts_bitmap_init(struct tegra_channel *chan)
struct v4l2_subdev_mbus_code_enum code = { struct v4l2_subdev_mbus_code_enum code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE, .which = V4L2_SUBDEV_FORMAT_ACTIVE,
}; };
struct v4l2_subdev_state cfg = {};
struct v4l2_subdev_pad_config pad_cfg;
struct v4l2_subdev_state cfg = {.pads = &pad_cfg};
bitmap_zero(chan->fmts_bitmap, MAX_FORMAT_NUM); bitmap_zero(chan->fmts_bitmap, MAX_FORMAT_NUM);
/* /*
@@ -1042,7 +1044,8 @@ tegra_channel_enum_framesizes(struct file *file, void *fh,
struct tegra_channel *chan = video_drvdata(file); struct tegra_channel *chan = video_drvdata(file);
struct v4l2_subdev *sd = chan->subdev_on_csi; struct v4l2_subdev *sd = chan->subdev_on_csi;
struct v4l2_subdev_frame_size_enum fse; struct v4l2_subdev_frame_size_enum fse;
struct v4l2_subdev_state cfg = {}; struct v4l2_subdev_pad_config pad_cfg;
struct v4l2_subdev_state cfg = {.pads = &pad_cfg};
int ret = 0; int ret = 0;
/* Convert v4l2 pixel format (fourcc) into media bus format code */ /* Convert v4l2 pixel format (fourcc) into media bus format code */
@@ -1071,7 +1074,8 @@ tegra_channel_enum_frameintervals(struct file *file, void *fh,
struct tegra_channel *chan = video_drvdata(file); struct tegra_channel *chan = video_drvdata(file);
struct v4l2_subdev *sd = chan->subdev_on_csi; struct v4l2_subdev *sd = chan->subdev_on_csi;
struct v4l2_subdev_frame_interval_enum fie; struct v4l2_subdev_frame_interval_enum fie;
struct v4l2_subdev_state cfg = {}; struct v4l2_subdev_pad_config pad_cfg;
struct v4l2_subdev_state cfg = {.pads = &pad_cfg};
int ret = 0; int ret = 0;
/* Convert v4l2 pixel format (fourcc) into media bus format code */ /* Convert v4l2 pixel format (fourcc) into media bus format code */
@@ -2017,7 +2021,8 @@ __tegra_channel_try_format(struct tegra_channel *chan,
const struct tegra_video_format *vfmt; const struct tegra_video_format *vfmt;
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt;
struct v4l2_subdev *sd = chan->subdev_on_csi; struct v4l2_subdev *sd = chan->subdev_on_csi;
struct v4l2_subdev_state cfg = {}; struct v4l2_subdev_pad_config pad_cfg;
struct v4l2_subdev_state cfg = {.pads = &pad_cfg};
int ret = 0; int ret = 0;
/* Use the channel format if pixformat is not supported */ /* Use the channel format if pixformat is not supported */
@@ -2065,7 +2070,8 @@ __tegra_channel_set_format(struct tegra_channel *chan,
const struct tegra_video_format *vfmt; const struct tegra_video_format *vfmt;
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt;
struct v4l2_subdev *sd = chan->subdev_on_csi; struct v4l2_subdev *sd = chan->subdev_on_csi;
struct v4l2_subdev_state cfg = {}; struct v4l2_subdev_pad_config pad_cfg;
struct v4l2_subdev_state cfg = {.pads = &pad_cfg};
int ret = 0; int ret = 0;
vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat); vfmt = tegra_core_get_format_by_fourcc(chan, pix->pixelformat);

View File

@@ -12,6 +12,7 @@
#include <linux/platform/tegra/bwmgr_mc.h> #include <linux/platform/tegra/bwmgr_mc.h>
#include <linux/platform/tegra/latency_allowance.h> #include <linux/platform/tegra/latency_allowance.h>
#include <linux/platform/tegra/isomgr.h> #include <linux/platform/tegra/isomgr.h>
#include <linux/platform/tegra/mc_utils.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/nvhost.h> #include <linux/nvhost.h>
@@ -483,7 +484,7 @@ int tegra_camera_update_isobw(void)
#endif #endif
/* Use Khz to prevent overflow */ /* Use Khz to prevent overflow */
total_khz = 0U; total_khz = emc_bw_to_freq(bw);
total_khz = min(ULONG_MAX / 1000, total_khz); total_khz = min(ULONG_MAX / 1000, total_khz);
dev_dbg(info->dev, "%s:Set iso bw %lu kbyteps at %lu KHz\n", dev_dbg(info->dev, "%s:Set iso bw %lu kbyteps at %lu KHz\n",
@@ -544,7 +545,7 @@ static long tegra_camera_ioctl(struct file *file,
} }
/* Use Khz to prevent overflow */ /* Use Khz to prevent overflow */
mc_khz = 0; mc_khz = emc_bw_to_freq(kcopy.bw);
mc_khz = min(ULONG_MAX / 1000, mc_khz); mc_khz = min(ULONG_MAX / 1000, mc_khz);
if (kcopy.is_iso) { if (kcopy.is_iso) {
@@ -714,20 +715,6 @@ static int tegra_camera_probe(struct platform_device *pdev)
strcpy(info->devname, tegra_camera_misc.name); strcpy(info->devname, tegra_camera_misc.name);
info->dev = tegra_camera_misc.this_device; info->dev = tegra_camera_misc.this_device;
#if !defined(CONFIG_TEGRA_BWMGR)
info->emc = devm_clk_get(info->dev, "emc");
if (IS_ERR(info->emc)) {
dev_err(info->dev, "Failed to get camera.emc\n");
return -EINVAL;
}
clk_set_rate(info->emc, 0);
info->iso_emc = devm_clk_get(info->dev, "iso.emc");
if (IS_ERR(info->iso_emc)) {
dev_err(info->dev, "Failed to get camera_iso.emc\n");
return -EINVAL;
}
clk_set_rate(info->iso_emc, 0);
#endif
mutex_init(&info->update_bw_lock); mutex_init(&info->update_bw_lock);
#if IS_ENABLED(CONFIG_INTERCONNECT) && IS_ENABLED(CONFIG_TEGRA_T23X_GRHOST) #if IS_ENABLED(CONFIG_INTERCONNECT) && IS_ENABLED(CONFIG_TEGRA_T23X_GRHOST)
info->icc_iso_id = TEGRA_ICC_VI; info->icc_iso_id = TEGRA_ICC_VI;