From: Sowjanya Komatineni <skomatineni@nvidia.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
thierry.reding@gmail.com, jonathanh@nvidia.com,
frankc@nvidia.com, sakari.ailus@iki.fi, robh+dt@kernel.org,
helen.koike@collabora.com
Cc: digetx@gmail.com, sboyd@kernel.org, gregkh@linuxfoundation.org,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org
Subject: Re: [RFC PATCH v2 08/18] media: tegra-video: Enable TPG based on kernel config
Date: Mon, 29 Jun 2020 07:48:43 -0700 [thread overview]
Message-ID: <91c70ed2-2a86-e99f-8dcb-73501a25b3d8@nvidia.com> (raw)
In-Reply-To: <f0f362e2-3748-5efe-b4a2-4ad344ae6a1e@xs4all.nl>
On 6/29/20 2:28 AM, Hans Verkuil wrote:
> On 17/06/2020 03:41, Sowjanya Komatineni wrote:
>> Tegra internal TPG mode is only for Tegra vi and csi testing
>> without a real sensor and driver should default support real
>> sensor.
>>
>> So, This patch adds CONFIG_VIDEO_TEGRA_TPG and enables Tegra
>> internal TPG mode only when this config is selected.
>>
>> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
>> ---
>> drivers/staging/media/tegra-video/Kconfig | 6 +++++
>> drivers/staging/media/tegra-video/csi.c | 38 +++++++++++++++++++++++-----
>> drivers/staging/media/tegra-video/tegra210.c | 6 +++++
>> drivers/staging/media/tegra-video/vi.c | 13 +++++++---
>> drivers/staging/media/tegra-video/video.c | 23 +++++++++--------
>> 5 files changed, 65 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/staging/media/tegra-video/Kconfig b/drivers/staging/media/tegra-video/Kconfig
>> index f6c61ec..566da62 100644
>> --- a/drivers/staging/media/tegra-video/Kconfig
>> +++ b/drivers/staging/media/tegra-video/Kconfig
>> @@ -10,3 +10,9 @@ config VIDEO_TEGRA
>>
>> To compile this driver as a module, choose M here: the module
>> will be called tegra-video.
>> +
>> +config VIDEO_TEGRA_TPG
>> + bool "NVIDIA Tegra VI driver TPG mode"
>> + depends on VIDEO_TEGRA
>> + help
>> + Say yes here to enable Tegra internal TPG mode
> This is not clear: if this is enabled, will the driver use TPG for
> ALL CSI ports? Or just for those that are not connected to anything?
> (i.e. the unused ports).
>
> I always assumed that the latter was intended, but it kind of looks from
> the code that this switches to TPG completely.
>
> It would also be nice if you can still use the TPG even for connected
> CSI ports by just setting the TEST_PATTERN control. I believe that's also what
> happens in the driver that is in the L4T tree.
>
> In any case, it is definitely not clear from this config description what
> it does.
>
> Regards,
>
> Hans
Same v4l2 test pattern control is used by sensor subdevices as well and
we can't differentiate between Tegra Vs Sensor test patterns.
Current patches are based on our prior discussions where Tegra internal
TPG is enabled for all channels/ports only when TPG Kconfig is set
otherwise it will be for sensor capture based on the device graph.
To be clear, will update Kconfig description specifying all channels
will be in TPG mode only when TPG Kconfig is set otherwise media links
are purely based on the device graph from DT.
Thanks
Sowjanya
>
>> diff --git a/drivers/staging/media/tegra-video/csi.c b/drivers/staging/media/tegra-video/csi.c
>> index 40ea195..fb667df 100644
>> --- a/drivers/staging/media/tegra-video/csi.c
>> +++ b/drivers/staging/media/tegra-video/csi.c
>> @@ -62,6 +62,9 @@ static int csi_enum_bus_code(struct v4l2_subdev *subdev,
>> struct v4l2_subdev_pad_config *cfg,
>> struct v4l2_subdev_mbus_code_enum *code)
>> {
>> + if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + return -ENOIOCTLCMD;
>> +
>> if (code->index >= ARRAY_SIZE(tegra_csi_tpg_fmts))
>> return -EINVAL;
>>
>> @@ -76,6 +79,9 @@ static int csi_get_format(struct v4l2_subdev *subdev,
>> {
>> struct tegra_csi_channel *csi_chan = to_csi_chan(subdev);
>>
>> + if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + return -ENOIOCTLCMD;
>> +
>> fmt->format = csi_chan->format;
>>
>> return 0;
>> @@ -121,6 +127,9 @@ static int csi_enum_framesizes(struct v4l2_subdev *subdev,
>> {
>> unsigned int i;
>>
>> + if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + return -ENOIOCTLCMD;
>> +
>> if (fse->index >= ARRAY_SIZE(tegra_csi_tpg_sizes))
>> return -EINVAL;
>>
>> @@ -148,6 +157,9 @@ static int csi_enum_frameintervals(struct v4l2_subdev *subdev,
>> const struct tpg_framerate *frmrate = csi->soc->tpg_frmrate_table;
>> int index;
>>
>> + if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + return -ENOIOCTLCMD;
>> +
>> /* one framerate per format and resolution */
>> if (fie->index > 0)
>> return -EINVAL;
>> @@ -172,6 +184,9 @@ static int csi_set_format(struct v4l2_subdev *subdev,
>> const struct v4l2_frmsize_discrete *sizes;
>> unsigned int i;
>>
>> + if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + return -ENOIOCTLCMD;
>> +
>> sizes = v4l2_find_nearest_size(tegra_csi_tpg_sizes,
>> ARRAY_SIZE(tegra_csi_tpg_sizes),
>> width, height,
>> @@ -208,6 +223,9 @@ static int tegra_csi_g_frame_interval(struct v4l2_subdev *subdev,
>> {
>> struct tegra_csi_channel *csi_chan = to_csi_chan(subdev);
>>
>> + if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + return -ENOIOCTLCMD;
>> +
>> vfi->interval.numerator = 1;
>> vfi->interval.denominator = csi_chan->framerate;
>>
>> @@ -311,8 +329,12 @@ static int tegra_csi_channel_init(struct tegra_csi_channel *chan)
>> subdev = &chan->subdev;
>> v4l2_subdev_init(subdev, &tegra_csi_ops);
>> subdev->dev = csi->dev;
>> - snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s-%d", "tpg",
>> - chan->csi_port_num);
>> + if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s-%d", "tpg",
>> + chan->csi_port_num);
>> + else
>> + snprintf(subdev->name, V4L2_SUBDEV_NAME_SIZE, "%s",
>> + kbasename(chan->of_node->full_name));
>>
>> v4l2_set_subdevdata(subdev, chan);
>> subdev->fwnode = of_fwnode_handle(chan->of_node);
>> @@ -405,11 +427,13 @@ static int tegra_csi_init(struct host1x_client *client)
>>
>> INIT_LIST_HEAD(&csi->csi_chans);
>>
>> - ret = tegra_csi_tpg_channels_alloc(csi);
>> - if (ret < 0) {
>> - dev_err(csi->dev,
>> - "failed to allocate tpg channels: %d\n", ret);
>> - goto cleanup;
>> + if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)) {
>> + ret = tegra_csi_tpg_channels_alloc(csi);
>> + if (ret < 0) {
>> + dev_err(csi->dev,
>> + "failed to allocate tpg channels: %d\n", ret);
>> + goto cleanup;
>> + }
>> }
>>
>> ret = tegra_csi_channels_init(csi);
>> diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c
>> index 3baa4e3..3492a8a 100644
>> --- a/drivers/staging/media/tegra-video/tegra210.c
>> +++ b/drivers/staging/media/tegra-video/tegra210.c
>> @@ -631,7 +631,11 @@ const struct tegra_vi_soc tegra210_vi_soc = {
>> .ops = &tegra210_vi_ops,
>> .hw_revision = 3,
>> .vi_max_channels = 6,
>> +#if IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)
>> .vi_max_clk_hz = 499200000,
>> +#else
>> + .vi_max_clk_hz = 998400000,
>> +#endif
>> };
>>
>> /* Tegra210 CSI PHY registers accessors */
>> @@ -957,7 +961,9 @@ static const char * const tegra210_csi_cil_clks[] = {
>> "cilab",
>> "cilcd",
>> "cile",
>> +#if IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)
>> "csi_tpg",
>> +#endif
>> };
>>
>> /* Tegra210 CSI operations */
>> diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c
>> index d621ebc..0197f4e 100644
>> --- a/drivers/staging/media/tegra-video/vi.c
>> +++ b/drivers/staging/media/tegra-video/vi.c
>> @@ -565,6 +565,7 @@ static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan)
>> {
>> int ret;
>>
>> +#if IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)
>> /* add test pattern control handler to v4l2 device */
>> v4l2_ctrl_new_std_menu_items(&chan->ctrl_handler, &vi_ctrl_ops,
>> V4L2_CID_TEST_PATTERN,
>> @@ -576,6 +577,7 @@ static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan)
>> v4l2_ctrl_handler_free(&chan->ctrl_handler);
>> return chan->ctrl_handler.error;
>> }
>> +#endif
>>
>> /* setup the controls */
>> ret = v4l2_ctrl_handler_setup(&chan->ctrl_handler);
>> @@ -918,10 +920,13 @@ static int tegra_vi_init(struct host1x_client *client)
>>
>> INIT_LIST_HEAD(&vi->vi_chans);
>>
>> - ret = tegra_vi_tpg_channels_alloc(vi);
>> - if (ret < 0) {
>> - dev_err(vi->dev, "failed to allocate tpg channels: %d\n", ret);
>> - goto free_chans;
>> + if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)) {
>> + ret = tegra_vi_tpg_channels_alloc(vi);
>> + if (ret < 0) {
>> + dev_err(vi->dev,
>> + "failed to allocate tpg channels: %d\n", ret);
>> + goto free_chans;
>> + }
>> }
>>
>> ret = tegra_vi_channels_init(vi);
>> diff --git a/drivers/staging/media/tegra-video/video.c b/drivers/staging/media/tegra-video/video.c
>> index 30816aa..e50bd70 100644
>> --- a/drivers/staging/media/tegra-video/video.c
>> +++ b/drivers/staging/media/tegra-video/video.c
>> @@ -60,15 +60,17 @@ static int host1x_video_probe(struct host1x_device *dev)
>> if (ret < 0)
>> goto unregister_v4l2;
>>
>> - /*
>> - * Both vi and csi channels are available now.
>> - * Register v4l2 nodes and create media links for TPG.
>> - */
>> - ret = tegra_v4l2_nodes_setup_tpg(vid);
>> - if (ret < 0) {
>> - dev_err(&dev->dev,
>> - "failed to setup tpg graph: %d\n", ret);
>> - goto device_exit;
>> + if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)) {
>> + /*
>> + * Both vi and csi channels are available now.
>> + * Register v4l2 nodes and create media links for TPG.
>> + */
>> + ret = tegra_v4l2_nodes_setup_tpg(vid);
>> + if (ret < 0) {
>> + dev_err(&dev->dev,
>> + "failed to setup tpg graph: %d\n", ret);
>> + goto device_exit;
>> + }
>> }
>>
>> return 0;
>> @@ -91,7 +93,8 @@ static int host1x_video_remove(struct host1x_device *dev)
>> {
>> struct tegra_video_device *vid = dev_get_drvdata(&dev->dev);
>>
>> - tegra_v4l2_nodes_cleanup_tpg(vid);
>> + if (IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG))
>> + tegra_v4l2_nodes_cleanup_tpg(vid);
>>
>> host1x_device_exit(dev);
>>
>>
next prev parent reply other threads:[~2020-06-29 14:48 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 1:41 [RFC PATCH v2 00/18] Support for Tegra video capture from external sensor Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 01/18] dt-bindings: i2c: tegra: Document Tegra210 VI I2C clocks and power-domains Sowjanya Komatineni
[not found] ` <1592358094-23459-2-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-13 23:49 ` Rob Herring
2020-06-17 1:41 ` [RFC PATCH v2 05/18] i2c: tegra: Fix runtime resume to re-init VI I2C Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 06/18] i2c: tegra: Avoid tegra_i2c_init_dma() for Tegra210 vi i2c Sowjanya Komatineni
[not found] ` <1592358094-23459-1-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-17 1:41 ` [RFC PATCH v2 02/18] arm64: tegra: Add missing clocks and power-domains to Tegra210 VI I2C Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 03/18] i2c: tegra: Don't mark VI I2C as IRQ safe runtime PM Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 04/18] i2c: tegra: Fix the error path in tegra_i2c_runtime_resume Sowjanya Komatineni
[not found] ` <1592358094-23459-5-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-17 4:52 ` Dmitry Osipenko
2020-06-17 1:41 ` [RFC PATCH v2 07/18] media: tegra-video: Fix channel format alignment Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 08/18] media: tegra-video: Enable TPG based on kernel config Sowjanya Komatineni
2020-06-29 9:28 ` Hans Verkuil
2020-06-29 14:48 ` Sowjanya Komatineni [this message]
2020-06-17 1:41 ` [RFC PATCH v2 10/18] dt-bindings: tegra: Update VI and CSI bindings with port info Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 11/18] media: tegra-video: Add support for external sensor capture Sowjanya Komatineni
[not found] ` <1592358094-23459-12-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-06 9:10 ` Hans Verkuil
[not found] ` <50deca28-c198-703c-96e2-82c53f48cd65-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-07-06 16:53 ` Sowjanya Komatineni
[not found] ` <6e09f5d3-85ca-5bf9-8617-b9c8bec36615@nvidia.com>
[not found] ` <6e09f5d3-85ca-5bf9-8617-b9c8bec36615-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-07 9:51 ` Hans Verkuil
2020-07-07 10:32 ` Sowjanya Komatineni
[not found] ` <6ee18b4d-b63b-8053-1b7e-c3ec7c1d4956@nvidia.com>
[not found] ` <6846e5bb-db1d-c2ff-c52c-70a2094c5b50@nvidia.com>
2020-07-07 19:35 ` Hans Verkuil
[not found] ` <af11cb24-57b2-7326-ca29-e168dcbb8006-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-07-07 20:29 ` Sowjanya Komatineni
[not found] ` <c08ea38f-7629-1800-fb74-a2f75daf2eb0-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-07 20:41 ` Sowjanya Komatineni
[not found] ` <47134481-1aec-9c1b-0ed2-8e39158d69b5-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-07 21:15 ` Sowjanya Komatineni
2020-07-06 11:49 ` Hans Verkuil
2020-06-30 9:21 ` [RFC PATCH v2 00/18] Support for Tegra video capture from external sensor Hans Verkuil
2020-06-30 14:58 ` Sowjanya Komatineni
2020-06-30 15:13 ` Hans Verkuil
[not found] ` <a60d8f80-312d-fce3-61f5-328e7f2a7a64-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-06-30 15:44 ` Sowjanya Komatineni
[not found] ` <72ca3b09-7ca6-7421-4a9d-98326d1af087-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-30 16:17 ` Sowjanya Komatineni
[not found] ` <e8a8a678-e9e8-e941-8dcb-0e747616ba59-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-30 16:34 ` Sowjanya Komatineni
[not found] ` <a606ac84-e0bc-aa85-5799-eeeb544d130d-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-01 16:54 ` Hans Verkuil
[not found] ` <92f25457-f4e5-78ea-d453-2b5cf8f272e8-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-07-01 17:07 ` Sowjanya Komatineni
2020-07-02 10:49 ` Hans Verkuil
2020-07-02 14:08 ` Hans Verkuil
[not found] ` <68d5b863-2ff1-203c-bd30-9ad0dcdf76f7-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-07-02 21:21 ` Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 09/18] media: tegra-video: Update format lookup to offset based Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 12/18] media: tegra-video: Add support for selection ioctl ops Sowjanya Komatineni
[not found] ` <1592358094-23459-13-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-07-02 13:54 ` Hans Verkuil
[not found] ` <efc84cff-76d5-78a2-e84e-0342459d3756-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-07-02 21:20 ` Sowjanya Komatineni
2020-07-03 8:06 ` Hans Verkuil
[not found] ` <a95717b6-e2ee-78df-5145-de265805b3d4-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2020-07-03 17:12 ` Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 13/18] gpu: host1x: mipi: Update tegra_mipi_request() to be node based Sowjanya Komatineni
[not found] ` <1592358094-23459-14-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-18 0:27 ` Dmitry Osipenko
2020-06-17 1:41 ` [RFC PATCH v2 14/18] gpu: host1x: mipi: Split tegra_mipi_calibrate and tegra_mipi_wait Sowjanya Komatineni
[not found] ` <1592358094-23459-15-git-send-email-skomatineni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2020-06-18 0:35 ` Dmitry Osipenko
2020-06-17 1:41 ` [RFC PATCH v2 15/18] media: tegra-video: Add CSI MIPI pads calibration Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 16/18] media: tegra-video: Compute settle times based on the clock rate Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 17/18] arm64: tegra: jetson-tx1: Add camera supplies Sowjanya Komatineni
2020-06-17 1:41 ` [RFC PATCH v2 18/18] arm64: tegra: Enable Tegra VI CSI support for Jetson Nano Sowjanya Komatineni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91c70ed2-2a86-e99f-8dcb-73501a25b3d8@nvidia.com \
--to=skomatineni@nvidia.com \
--cc=devicetree@vger.kernel.org \
--cc=digetx@gmail.com \
--cc=frankc@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=helen.koike@collabora.com \
--cc=hverkuil@xs4all.nl \
--cc=jonathanh@nvidia.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=sboyd@kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).