static int tegra_channel_capture_setup(struct tegra_channel *chan)
{
+ if (!chan->fops)
+ return 0;
return chan->fops->soc_channel_capture_setup(chan);
}
static int tegra_channel_error_status(struct tegra_channel *chan)
{
+ if (!chan->fops)
+ return 0;
return chan->fops->soc_channel_error_status(chan);
}
* TODO: Get frame rate from sub-device and adopt timeout
*/
chan->timeout = 20;
-
+ if (!chan->fops)
+ return;
chan->fops->soc_channel_ec_init(chan);
}
/* Disable pad power to start recovery */
tegra_csi_pad_control(chan->vi->csi, chan->port, DISABLE);
-
+ if (!chan->fops)
+ return;
chan->fops->soc_channel_ec_recover(chan);
/* Re-init VI and CSI */
int state = VB2_BUF_STATE_DONE;
/* Init registers related to each frames */
+ if (!chan->fops)
+ return 0;
chan->fops->soc_channel_capture_frame_init(chan, buf, thresh);
if (!chan->bfirst_fstart) {
return err;
}
/* Enable input stream once the VI registers are configured */
+ if (!chan->fops)
+ return 0;
chan->fops->soc_channel_capture_frame_enable(chan);
}
/* Arm capture and wait for notifier or syncpoint */
+ if (!chan->fops)
+ return 0;
err = chan->fops->soc_channel_capture_frame(chan, &ts, thresh);
if (err) {
state = VB2_BUF_STATE_ERROR;
buf = dequeue_buffer(chan);
if (!buf)
return;
-
+ if (!chan->fops)
+ return;
err = chan->fops->soc_channel_capture_done(chan, buf, &ts);
if (err) {
state = VB2_BUF_STATE_ERROR;
nvhost_module_disable_clk(chan->vi->dev);*/
return ret;
}
-
chan->capture_state = CAPTURE_IDLE;
for (i = 0; i < chan->valid_ports; i++) {
tegra_csi_start_streaming(chan->vi->csi, chan->port[i]);
entity = pad->entity;
chan->subdev[num_sd++] = media_entity_to_v4l2_subdev(entity);
+ chan->subdev_on_csi = sd;
index = pad->index - 1;
}
chan->num_subdevs = num_sd;
int ret;
struct video_device *vdev = video_devdata(fp);
struct tegra_channel *chan = video_get_drvdata(vdev);
- struct vi *tegra_vi;
+ //struct vi *tegra_vi;
struct tegra_mc_vi *vi;
struct tegra_csi_device *csi;
}
vi = chan->vi;
- tegra_vi = vi->vi;
+ //tegra_vi = vi->vi;
csi = vi->csi;
/* TPG mode and a real sensor is open, return busy */
+ /*
if (vi->pg_mode && tegra_vi->sensor_opened)
- return -EBUSY;
+ return -EBUSY;*/
/* None TPG mode and a TPG channel is opened, return busy */
+ /*
if (!vi->pg_mode && tegra_vi->tpg_opened)
return -EBUSY;
+ */
/* The first open then turn on power */
if (atomic_add_return(1, &vi->power_on_refcnt) == 1) {
- tegra_vi_power_on(vi);
+ /*tegra_vi_power_on(vi);
tegra_csi_power_on(csi);
if (vi->pg_mode)
tegra_vi->tpg_opened = true;
else
tegra_vi->sensor_opened = true;
+ */
}
if (!vi->pg_mode &&
(atomic_add_return(1, &chan->power_on_refcnt) == 1)) {
/* power on sensors connected in channel */
- tegra_csi_channel_power_on(csi, chan->port);
+ //tegra_csi_channel_power_on(csi, chan->port);
ret = tegra_channel_set_power(chan, 1);
if (ret < 0)
goto unlock;
struct video_device *vdev = video_devdata(fp);
struct tegra_channel *chan = video_get_drvdata(vdev);
struct tegra_mc_vi *vi = chan->vi;
- struct vi *tegra_vi = vi->vi;
- struct tegra_csi_device *csi = vi->csi;
+ //struct vi *tegra_vi = vi->vi;
+ //struct tegra_csi_device *csi = vi->csi;
bool is_singular;
mutex_lock(&chan->video_lock);
if (!vi->pg_mode &&
atomic_dec_and_test(&chan->power_on_refcnt)) {
/* power off sensors connected in channel */
- tegra_csi_channel_power_off(csi, chan->port);
+ //tegra_csi_channel_power_off(csi, chan->port);
ret = tegra_channel_set_power(chan, 0);
if (ret < 0)
dev_err(vi->dev, "Failed to power off subdevices\n");
/* The last release then turn off power */
if (atomic_dec_and_test(&vi->power_on_refcnt)) {
- tegra_csi_power_off(csi);
+ /*tegra_csi_power_off(csi);
tegra_vi_power_off(vi);
if (vi->pg_mode)
tegra_vi->tpg_opened = false;
else
tegra_vi->sensor_opened = false;
+ */
}
mutex_unlock(&chan->video_lock);
nvhost_syncpt_put_ref_ext(chan->vi->ndev, chan->syncpt[i]);
}
+static void tegra_channel_csi_init(struct tegra_mc_vi *vi, unsigned int index) __maybe_unused;
static void tegra_channel_csi_init(struct tegra_mc_vi *vi, unsigned int index)
{
int numlanes = 0;
struct tegra_channel *chan = &vi->chans[index];
/* VI/CSI is in bypass mode, then channel has to be in bypass */
- if (vi->vi->bypass)
- chan->bypass = true;
+ //if (vi->vi->bypass)
+ chan->bypass = true;
chan->vi = vi;
- chan->fops = vi->vi->data->channel_fops;
- tegra_channel_csi_init(vi, index);
+ //chan->fops = vi->vi->data->channel_fops;
+ //tegra_channel_csi_init(vi, index);
chan->width_align = TEGRA_WIDTH_ALIGNMENT;
chan->stride_align = TEGRA_STRIDE_ALIGNMENT;
if (enable) {
for (i = 0; csi_port_is_valid(port_num[i]); i++) {
port = port_num[i];
- camera_common_dpd_disable(&csi->s_data[port]);
+ //camera_common_dpd_disable(&csi->s_data[port]);
}
} else {
for (i = 0; csi_port_is_valid(port_num[i]); i++) {
port = port_num[i];
- camera_common_dpd_enable(&csi->s_data[port]);
+ // camera_common_dpd_enable(&csi->s_data[port]);
}
}
}
csi->cil[cil_num], csi->clk_freq);
if (err)
dev_err(csi->dev, "cil clk start error\n");
- camera_common_dpd_disable(&csi->s_data[port]);
+ //camera_common_dpd_disable(&csi->s_data[port]);
}
} else {
for (i = 0; csi_port_is_valid(port_num[i]); i++) {
port = port_num[i];
cil_num = port >> 1;
- camera_common_dpd_enable(&csi->s_data[port]);
+ //camera_common_dpd_enable(&csi->s_data[port]);
clk_disable_unprepare(csi->cil[cil_num]);
}
}
void tegra_csi_start_streaming(struct tegra_csi_device *csi,
enum tegra_csi_port_num port_num)
{
+ if (!csi->fops)
+ return;
csi->fops->soc_start_streaming(csi, port_num);
}
EXPORT_SYMBOL(tegra_csi_start_streaming);
int tegra_csi_error(struct tegra_csi_device *csi,
enum tegra_csi_port_num port_num)
{
+ if (!csi->fops)
+ return 0;
return csi->fops->soc_error(csi, port_num);
}
void tegra_csi_status(struct tegra_csi_device *csi,
enum tegra_csi_port_num port_num)
{
+ if (!csi->fops)
+ return;
csi->fops->soc_status(csi, port_num);
}
EXPORT_SYMBOL(tegra_csi_status);
void tegra_csi_error_recover(struct tegra_csi_device *csi,
enum tegra_csi_port_num port_num)
{
+ if (!csi->fops)
+ return;
csi->fops->soc_error_recover(csi, port_num);
}
void tegra_csi_stop_streaming(struct tegra_csi_device *csi,
enum tegra_csi_port_num port_num)
{
+ if (!csi->fops)
+ return;
csi->fops->soc_stop_streaming(csi, port_num);
}
EXPORT_SYMBOL(tegra_csi_stop_streaming);
struct tegra_channel *chan;
int index;
+ return 0;
+
if (csi->pg_mode)
return 0;
* V4L2 Subdevice Pad Operations
*/
+static int tegra_csi_get_format(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_format *fmt) __maybe_unused;
static int tegra_csi_get_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *fmt)
return 0;
}
+static int tegra_csi_set_format(struct v4l2_subdev *subdev,
+ struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_format *fmt) __maybe_unused;
static int tegra_csi_set_format(struct v4l2_subdev *subdev,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *fmt)
};
static struct v4l2_subdev_pad_ops tegra_csi_pad_ops = {
- .get_fmt = tegra_csi_get_format,
- .set_fmt = tegra_csi_set_format,
+ //.get_fmt = tegra_csi_get_format,
+ //.set_fmt = tegra_csi_set_format,
.enum_frame_size = tegra_csi_enum_framesizes,
.enum_frame_interval = tegra_csi_enum_frameintervals,
};
return ret;
ret = tegra_csi_init(csi, pdev);
- if (ret < 0)
- return ret;
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Failed to init csi property,clks\n");
+ }
/* Initialize V4L2 subdevice and media entity */
subdev = &csi->subdev;