2020-07-23 23:51:15

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH v4 00/14] Support for Tegra video capture from external sensor

This series adds support for video capture from external camera sensor to
Tegra video driver.

Jetson TX1 has camera expansion connector and supports custom camera module
designed as per TX1 design specification.

This series also enables camera capture support for Jetson Nano which has
Raspberry PI camera header.

This series is tested with IMX219 camera sensor.

This series include,

VI I2C related fixes
- Camera sensor programming happens through VI I2C which is on host1x bus.
- These patches includes device tree and I2C driver fixes for VI I2C.

Tegra video driver updates
- TPG Vs Non-TPG based on Kconfig
- Support for external sensor video capture based on device graph from DT.
- Support for selection ioctl operations
- Tegra MIPI CSI pads calibration
- CSI T-CLK and T-HS settle time computation based on clock rates.

Host1x driver updates
- Adds API to allow creating mipi device for specific device node.
- Splits MIPI pads calibrate start and waiting for calibration to be done.

Device tree updates
- Adds camera connector 2V8, 1V8, 1V2 regulator supplies to Jetson TX1 DT.
- Enabled VI and CSI support in Jetson Nano DT.


Delta between patch versions:
[v4]: Includes below fix based on v3 feedback
- Patches are based on latest linux-next.
- With split of tegra_mipi_calibrate() and tegra_mipi_wait(), mipi
clock is not left enabled till calibration done. This series adds
a patch to fix this by keeping clock enabled till calibration is
done.

Note:
Patch-0010 has compilation dependency on
https://patchwork.kernel.org/patch/11659521/

[v3]: Includes v2 feedback
- Uses separate helper function for retrieving remote csi subdevice
and source subdevice.
- Added check for presence of subdevice ops set/get_selection
- dropped vb2_queue_release from driver and using
vb2_video_unregister_device instead of video_unregister_device.
- video device register should happen in the last after all video
device related setup is done in the driver. This is being addressed
in below RFC patch. Once proper implementation of this is available
will update Tegra video driver to use split APIs and do all setup
prior to device register. Added this as TODO in the driver.
https://www.spinics.net/lists/linux-media/msg172761.html

Note:
Patch-0012 has compilation dependency on
https://patchwork.kernel.org/patch/11659521/


[v2]: Includes below changes based on v1 feedback
- dt-binding document and the driver update for device graph to use
separate ports for sink endpoint and source endpoint for csi.
- Use data-lanes endpoint property for csi.
- Update tegra_mipi_request() to take device node pointer argument
rather than adding extra API.
- Remove checking for clk pointer before clk_disable.


Sowjanya Komatineni (14):
i2c: tegra: Don't mark VI I2C as IRQ safe runtime PM
i2c: tegra: Remove NULL pointer check before
clk_enable/disable/prepare/unprepare
i2c: tegra: Fix the error path in tegra_i2c_runtime_resume
i2c: tegra: Fix runtime resume to re-init VI I2C
i2c: tegra: Avoid tegra_i2c_init_dma() for Tegra210 vi i2c
media: tegra-video: Fix channel format alignment
media: tegra-video: Enable TPG based on kernel config
media: tegra-video: Update format lookup to offset based
dt-bindings: tegra: Update VI and CSI bindings with port info
media: tegra-video: Add support for external sensor capture
media: tegra-video: Add support for selection ioctl ops
gpu: host1x: mipi: Keep MIPI clock enabled till calibration is done
media: tegra-video: Add CSI MIPI pads calibration
media: tegra-video: Compute settle times based on the clock rate

.../display/tegra/nvidia,tegra20-host1x.txt | 92 ++-
drivers/gpu/drm/tegra/dsi.c | 4 +-
drivers/gpu/host1x/mipi.c | 19 +-
drivers/i2c/busses/i2c-tegra.c | 101 +--
drivers/staging/media/tegra-video/Kconfig | 7 +
drivers/staging/media/tegra-video/csi.c | 258 ++++++-
drivers/staging/media/tegra-video/csi.h | 8 +
drivers/staging/media/tegra-video/tegra210.c | 25 +-
drivers/staging/media/tegra-video/vi.c | 800 +++++++++++++++++++--
drivers/staging/media/tegra-video/vi.h | 25 +-
drivers/staging/media/tegra-video/video.c | 23 +-
include/linux/host1x.h | 5 +-
12 files changed, 1224 insertions(+), 143 deletions(-)

--
2.7.4


2020-07-23 23:51:26

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH v4 11/14] media: tegra-video: Add support for selection ioctl ops

This patch adds selection v4l2 ioctl operations to allow configuring
a selection rectangle in the sensor through the Tegra video device
node.

Some sensor drivers supporting crop uses try_crop rectangle from
v4l2_subdev_pad_config during try format for computing binning.

So with selection ops support, this patch also updates try format
to use try crop rectangle either from subdev frame size enumeration
or from subdev crop boundary.

Signed-off-by: Sowjanya Komatineni <[email protected]>
---
drivers/staging/media/tegra-video/vi.c | 106 +++++++++++++++++++++++++++++++++
1 file changed, 106 insertions(+)

diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c
index f7dbea2..fc43629 100644
--- a/drivers/staging/media/tegra-video/vi.c
+++ b/drivers/staging/media/tegra-video/vi.c
@@ -437,6 +437,13 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan,
struct v4l2_subdev *subdev;
struct v4l2_subdev_format fmt;
struct v4l2_subdev_pad_config *pad_cfg;
+ struct v4l2_subdev_frame_size_enum fse = {
+ .which = V4L2_SUBDEV_FORMAT_TRY,
+ };
+ struct v4l2_subdev_selection sdsel = {
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ .target = V4L2_SEL_TGT_CROP_BOUNDS,
+ };
int ret;

subdev = tegra_channel_get_remote_source_subdev(chan);
@@ -462,6 +469,24 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan,
fmt.which = V4L2_SUBDEV_FORMAT_TRY;
fmt.pad = 0;
v4l2_fill_mbus_format(&fmt.format, pix, fmtinfo->code);
+
+ /*
+ * Attempt to obtain the format size from subdev.
+ * If not available, try to get crop boundary from subdev.
+ */
+ fse.code = fmtinfo->code;
+ ret = v4l2_subdev_call(subdev, pad, enum_frame_size, pad_cfg, &fse);
+ if (ret) {
+ ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel);
+ if (ret)
+ return -EINVAL;
+ pad_cfg->try_crop.width = sdsel.r.width;
+ pad_cfg->try_crop.height = sdsel.r.height;
+ } else {
+ pad_cfg->try_crop.width = fse.max_width;
+ pad_cfg->try_crop.height = fse.max_height;
+ }
+
ret = v4l2_subdev_call(subdev, pad, set_fmt, pad_cfg, &fmt);
if (ret < 0)
return ret;
@@ -551,6 +576,85 @@ static int tegra_channel_set_subdev_active_fmt(struct tegra_vi_channel *chan)
return 0;
}

+static int tegra_channel_g_selection(struct file *file, void *priv,
+ struct v4l2_selection *sel)
+{
+ struct tegra_vi_channel *chan = video_drvdata(file);
+ struct v4l2_subdev *subdev;
+ struct v4l2_subdev_format fmt = {
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ };
+ struct v4l2_subdev_selection sdsel = {
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ .target = sel->target,
+ };
+ int ret;
+
+ subdev = tegra_channel_get_remote_source_subdev(chan);
+ if (!v4l2_subdev_has_op(subdev, pad, get_selection))
+ return -ENOTTY;
+
+ if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+ return -EINVAL;
+ /*
+ * Try the get selection operation and fallback to get format if not
+ * implemented.
+ */
+ ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel);
+ if (!ret)
+ sel->r = sdsel.r;
+ if (ret != -ENOIOCTLCMD)
+ return ret;
+
+ ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
+ if (ret < 0)
+ return ret;
+
+ sel->r.left = 0;
+ sel->r.top = 0;
+ sel->r.width = fmt.format.width;
+ sel->r.height = fmt.format.height;
+
+ return 0;
+}
+
+static int tegra_channel_s_selection(struct file *file, void *fh,
+ struct v4l2_selection *sel)
+{
+ struct tegra_vi_channel *chan = video_drvdata(file);
+ struct v4l2_subdev *subdev;
+ int ret;
+ struct v4l2_subdev_selection sdsel = {
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ .target = sel->target,
+ .flags = sel->flags,
+ .r = sel->r,
+ };
+
+ subdev = tegra_channel_get_remote_source_subdev(chan);
+ if (!v4l2_subdev_has_op(subdev, pad, set_selection))
+ return -ENOTTY;
+
+ if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+ return -EINVAL;
+
+ if (vb2_is_busy(&chan->queue))
+ return -EBUSY;
+
+ ret = v4l2_subdev_call(subdev, pad, set_selection, NULL, &sdsel);
+ if (!ret) {
+ sel->r = sdsel.r;
+ /*
+ * Subdev active format resolution may have changed during
+ * set selection operation. So, update channel format to
+ * the sub-device active format.
+ */
+ return tegra_channel_set_subdev_active_fmt(chan);
+ }
+
+ return ret;
+}
+
static int tegra_channel_enum_input(struct file *file, void *fh,
struct v4l2_input *inp)
{
@@ -608,6 +712,8 @@ static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
+ .vidioc_g_selection = tegra_channel_g_selection,
+ .vidioc_s_selection = tegra_channel_s_selection,
};

/*
--
2.7.4

2020-07-23 23:52:03

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH v4 09/14] dt-bindings: tegra: Update VI and CSI bindings with port info

Update VI and CSI bindings to add port and endpoint nodes as per
media video-interfaces DT binding document.

Acked-by: Rob Herring <[email protected]>
Signed-off-by: Sowjanya Komatineni <[email protected]>
---
.../display/tegra/nvidia,tegra20-host1x.txt | 92 +++++++++++++++++++++-
1 file changed, 90 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt b/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
index 4731921..ac63ae4a 100644
--- a/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
+++ b/Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-host1x.txt
@@ -51,8 +51,16 @@ of the following host1x client modules:
- vi
- Tegra210:
- power-domains: Must include venc powergate node as vi is in VE partition.
- - Tegra210 has CSI part of VI sharing same host interface and register space.
- So, VI device node should have CSI child node.
+
+ ports (optional node)
+ vi can have optional ports node and max 6 ports are supported. Each port
+ should have single 'endpoint' child node. All port nodes are grouped under
+ ports node. Please refer to the bindings defined in
+ Documentation/devicetree/bindings/media/video-interfaces.txt
+
+ csi (required node)
+ Tegra210 has CSI part of VI sharing same host interface and register space.
+ So, VI device node should have CSI child node.

- csi: mipi csi interface to vi

@@ -65,6 +73,46 @@ of the following host1x client modules:
- power-domains: Must include sor powergate node as csicil is in
SOR partition.

+ channel (optional nodes)
+ Maximum 6 channels are supported with each csi brick as either x4 or x2
+ based on hw connectivity to sensor.
+
+ Required properties:
+ - reg: csi port number. Valid port numbers are 0 through 5.
+ - nvidia,mipi-calibrate: Should contain a phandle and a specifier
+ specifying which pads are used by this CSI port and need to be
+ calibrated. See also ../display/tegra/nvidia,tegra114-mipi.txt.
+
+ Each channel node must contain 2 port nodes which can be grouped
+ under 'ports' node and each port should have a single child 'endpoint'
+ node.
+
+ ports node
+ Please refer to the bindings defined in
+ Documentation/devicetree/bindings/media/video-interfaces.txt
+
+ ports node must contain below 2 port nodes.
+ port@0 with single child 'endpoint' node always a sink.
+ port@1 with single child 'endpoint' node always a source.
+
+ port@0 (required node)
+ Required properties:
+ - reg: 0
+
+ endpoint (required node)
+ Required properties:
+ - data-lanes: an array of data lane from 1 to 4. Valid array
+ lengths are 1/2/4.
+ - remote-endpoint: phandle to sensor 'endpoint' node.
+
+ port@1 (required node)
+ Required properties:
+ - reg: 1
+
+ endpoint (required node)
+ Required properties:
+ - remote-endpoint: phandle to vi port 'endpoint' node.
+
- epp: encoder pre-processor

Required properties:
@@ -340,6 +388,18 @@ Example:

ranges = <0x0 0x0 0x54080000 0x2000>;

+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ imx219_vi_in0: endpoint {
+ remote-endpoint = <&imx219_csi_out0>;
+ };
+ };
+ };
+
csi@838 {
compatible = "nvidia,tegra210-csi";
reg = <0x838 0x1300>;
@@ -362,6 +422,34 @@ Example:
<&tegra_car TEGRA210_CLK_CSI_TPG>;
clock-names = "csi", "cilab", "cilcd", "cile", "csi_tpg";
power-domains = <&pd_sor>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ channel@0 {
+ reg = <0>;
+ nvidia,mipi-calibrate = <&mipi 0x001>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ imx219_csi_in0: endpoint {
+ data-lanes = <1 2>;
+ remote-endpoint = <&imx219_out0>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+ imx219_csi_out0: endpoint {
+ remote-endpoint = <&imx219_vi_in0>;
+ };
+ };
+ };
+ };
};
};

--
2.7.4

2020-07-23 23:52:19

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH v4 06/14] media: tegra-video: Fix channel format alignment

Pixel format width is mistakenly aligned to surface align bytes
and altering width to aligned value may force sensor mode change
other than the requested one and also cause mismatch in width
programmed between sensor and vi which can lead to capture errors.

This patch removes width alignment and clamps width as per Tegra
minimum and maximum limits.

Signed-off-by: Sowjanya Komatineni <[email protected]>
---
drivers/staging/media/tegra-video/vi.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c
index 1b5e660..d621ebc 100644
--- a/drivers/staging/media/tegra-video/vi.c
+++ b/drivers/staging/media/tegra-video/vi.c
@@ -359,25 +359,15 @@ static void tegra_channel_fmt_align(struct tegra_vi_channel *chan,
struct v4l2_pix_format *pix,
unsigned int bpp)
{
- unsigned int align;
- unsigned int min_width;
- unsigned int max_width;
- unsigned int width;
unsigned int min_bpl;
unsigned int max_bpl;
unsigned int bpl;

/*
- * The transfer alignment requirements are expressed in bytes. Compute
- * minimum and maximum values, clamp the requested width and convert
- * it back to pixels. Use bytesperline to adjust the width.
+ * The transfer alignment requirements are expressed in bytes.
+ * Clamp the requested width and height to the limits.
*/
- align = lcm(SURFACE_ALIGN_BYTES, bpp);
- min_width = roundup(TEGRA_MIN_WIDTH, align);
- max_width = rounddown(TEGRA_MAX_WIDTH, align);
- width = roundup(pix->width * bpp, align);
-
- pix->width = clamp(width, min_width, max_width) / bpp;
+ pix->width = clamp(pix->width, TEGRA_MIN_WIDTH, TEGRA_MAX_WIDTH);
pix->height = clamp(pix->height, TEGRA_MIN_HEIGHT, TEGRA_MAX_HEIGHT);

/* Clamp the requested bytes per line value. If the maximum bytes per
--
2.7.4

2020-07-23 23:52:31

by Sowjanya Komatineni

[permalink] [raw]
Subject: [RFC PATCH v4 01/14] i2c: tegra: Don't mark VI I2C as IRQ safe runtime PM

Tegra VI I2C is part of VE power domain and typically used for
camera usecases.

VE power domain is not always on and is non-IRQ safe. So, IRQ safe
device cannot be attached to a non-IRQ safe domain as it prevents
powering off the PM domain and generic power domain driver will warn.

Current driver marks all I2C devices as IRQ safe and VI I2C device
does not require IRQ safe as it will not be used for atomic transfers.

This patch has fix to make VI I2C as non-IRQ safe.

Signed-off-by: Sowjanya Komatineni <[email protected]>
---
drivers/i2c/busses/i2c-tegra.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 1577296..3be1018 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1750,7 +1750,15 @@ static int tegra_i2c_probe(struct platform_device *pdev)
goto unprepare_slow_clk;
}

- pm_runtime_irq_safe(&pdev->dev);
+ /*
+ * VI I2C is in VE power domain which is not always on and not
+ * an IRQ safe. So, IRQ safe device can't be attached to a non-IRQ
+ * safe domain as it prevents powering off the PM domain.
+ * Also, VI I2C device don't need to use runtime IRQ safe as it will
+ * not be used for atomic transfers.
+ */
+ if (!i2c_dev->is_vi)
+ pm_runtime_irq_safe(&pdev->dev);
pm_runtime_enable(&pdev->dev);
if (!pm_runtime_enabled(&pdev->dev)) {
ret = tegra_i2c_runtime_resume(&pdev->dev);
--
2.7.4

2020-07-24 09:44:18

by Hans Verkuil

[permalink] [raw]
Subject: Re: [RFC PATCH v4 00/14] Support for Tegra video capture from external sensor

Thierry, Dmitry,

I'm happy with this series from a media perspective. However, patches 1-5 fix
various i2c-tegra.c issues and patch 12 changes mipi calibration functions in
drivers/gpu that patch 13 relies on.

I think the i2c-tegra.c patches can be merged independently into the i2c
subsystem, but patch 12 needs to be merged with the media patches. So for patch
12 I need an Acked-by from Thierry.

I can also take the i2c-tegra patches if preferred, but there too I need Acks.
Dmitry, can you either take these i2c patches, or reply with Acks if you want
me to take it?

Regards,

Hans


On 24/07/2020 01:50, Sowjanya Komatineni wrote:
> This series adds support for video capture from external camera sensor to
> Tegra video driver.
>
> Jetson TX1 has camera expansion connector and supports custom camera module
> designed as per TX1 design specification.
>
> This series also enables camera capture support for Jetson Nano which has
> Raspberry PI camera header.
>
> This series is tested with IMX219 camera sensor.
>
> This series include,
>
> VI I2C related fixes
> - Camera sensor programming happens through VI I2C which is on host1x bus.
> - These patches includes device tree and I2C driver fixes for VI I2C.
>
> Tegra video driver updates
> - TPG Vs Non-TPG based on Kconfig
> - Support for external sensor video capture based on device graph from DT.
> - Support for selection ioctl operations
> - Tegra MIPI CSI pads calibration
> - CSI T-CLK and T-HS settle time computation based on clock rates.
>
> Host1x driver updates
> - Adds API to allow creating mipi device for specific device node.
> - Splits MIPI pads calibrate start and waiting for calibration to be done.
>
> Device tree updates
> - Adds camera connector 2V8, 1V8, 1V2 regulator supplies to Jetson TX1 DT.
> - Enabled VI and CSI support in Jetson Nano DT.
>
>
> Delta between patch versions:
> [v4]: Includes below fix based on v3 feedback
> - Patches are based on latest linux-next.
> - With split of tegra_mipi_calibrate() and tegra_mipi_wait(), mipi
> clock is not left enabled till calibration done. This series adds
> a patch to fix this by keeping clock enabled till calibration is
> done.
>
> Note:
> Patch-0010 has compilation dependency on
> https://patchwork.kernel.org/patch/11659521/
>
> [v3]: Includes v2 feedback
> - Uses separate helper function for retrieving remote csi subdevice
> and source subdevice.
> - Added check for presence of subdevice ops set/get_selection
> - dropped vb2_queue_release from driver and using
> vb2_video_unregister_device instead of video_unregister_device.
> - video device register should happen in the last after all video
> device related setup is done in the driver. This is being addressed
> in below RFC patch. Once proper implementation of this is available
> will update Tegra video driver to use split APIs and do all setup
> prior to device register. Added this as TODO in the driver.
> https://www.spinics.net/lists/linux-media/msg172761.html
>
> Note:
> Patch-0012 has compilation dependency on
> https://patchwork.kernel.org/patch/11659521/
>
>
> [v2]: Includes below changes based on v1 feedback
> - dt-binding document and the driver update for device graph to use
> separate ports for sink endpoint and source endpoint for csi.
> - Use data-lanes endpoint property for csi.
> - Update tegra_mipi_request() to take device node pointer argument
> rather than adding extra API.
> - Remove checking for clk pointer before clk_disable.
>
>
> Sowjanya Komatineni (14):
> i2c: tegra: Don't mark VI I2C as IRQ safe runtime PM
> i2c: tegra: Remove NULL pointer check before
> clk_enable/disable/prepare/unprepare
> i2c: tegra: Fix the error path in tegra_i2c_runtime_resume
> i2c: tegra: Fix runtime resume to re-init VI I2C
> i2c: tegra: Avoid tegra_i2c_init_dma() for Tegra210 vi i2c
> media: tegra-video: Fix channel format alignment
> media: tegra-video: Enable TPG based on kernel config
> media: tegra-video: Update format lookup to offset based
> dt-bindings: tegra: Update VI and CSI bindings with port info
> media: tegra-video: Add support for external sensor capture
> media: tegra-video: Add support for selection ioctl ops
> gpu: host1x: mipi: Keep MIPI clock enabled till calibration is done
> media: tegra-video: Add CSI MIPI pads calibration
> media: tegra-video: Compute settle times based on the clock rate
>
> .../display/tegra/nvidia,tegra20-host1x.txt | 92 ++-
> drivers/gpu/drm/tegra/dsi.c | 4 +-
> drivers/gpu/host1x/mipi.c | 19 +-
> drivers/i2c/busses/i2c-tegra.c | 101 +--
> drivers/staging/media/tegra-video/Kconfig | 7 +
> drivers/staging/media/tegra-video/csi.c | 258 ++++++-
> drivers/staging/media/tegra-video/csi.h | 8 +
> drivers/staging/media/tegra-video/tegra210.c | 25 +-
> drivers/staging/media/tegra-video/vi.c | 800 +++++++++++++++++++--
> drivers/staging/media/tegra-video/vi.h | 25 +-
> drivers/staging/media/tegra-video/video.c | 23 +-
> include/linux/host1x.h | 5 +-
> 12 files changed, 1224 insertions(+), 143 deletions(-)
>

2020-07-24 19:17:37

by Wolfram Sang

[permalink] [raw]
Subject: Re: [RFC PATCH v4 00/14] Support for Tegra video capture from external sensor


> I can also take the i2c-tegra patches if preferred, but there too I need Acks.
> Dmitry, can you either take these i2c patches, or reply with Acks if you want
> me to take it?

There are some more patches for i2c-tegra pending, so I'd rather pick
them into my I2C tree once the Tegra maintainers acked them. I can
provide a immutable branch, though, if there is interest.


Attachments:
(No filename) (385.00 B)
signature.asc (849.00 B)
Download all attachments

2020-07-26 23:30:42

by Dmitry Osipenko

[permalink] [raw]
Subject: Re: [RFC PATCH v4 01/14] i2c: tegra: Don't mark VI I2C as IRQ safe runtime PM

24.07.2020 02:50, Sowjanya Komatineni пишет:
> Tegra VI I2C is part of VE power domain and typically used for
> camera usecases.
>
> VE power domain is not always on and is non-IRQ safe. So, IRQ safe
> device cannot be attached to a non-IRQ safe domain as it prevents
> powering off the PM domain and generic power domain driver will warn.
>
> Current driver marks all I2C devices as IRQ safe and VI I2C device
> does not require IRQ safe as it will not be used for atomic transfers.
>
> This patch has fix to make VI I2C as non-IRQ safe.
>
> Signed-off-by: Sowjanya Komatineni <[email protected]>
> ---
> drivers/i2c/busses/i2c-tegra.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 1577296..3be1018 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -1750,7 +1750,15 @@ static int tegra_i2c_probe(struct platform_device *pdev)
> goto unprepare_slow_clk;
> }
>
> - pm_runtime_irq_safe(&pdev->dev);
> + /*
> + * VI I2C is in VE power domain which is not always on and not
> + * an IRQ safe. So, IRQ safe device can't be attached to a non-IRQ
> + * safe domain as it prevents powering off the PM domain.
> + * Also, VI I2C device don't need to use runtime IRQ safe as it will
> + * not be used for atomic transfers.
> + */
> + if (!i2c_dev->is_vi)
> + pm_runtime_irq_safe(&pdev->dev);
> pm_runtime_enable(&pdev->dev);
> if (!pm_runtime_enabled(&pdev->dev)) {
> ret = tegra_i2c_runtime_resume(&pdev->dev);
>

Reviewed-by: Dmitry Osipenko <[email protected]>

2020-07-27 00:26:57

by Dmitry Osipenko

[permalink] [raw]
Subject: Re: [RFC PATCH v4 00/14] Support for Tegra video capture from external sensor

24.07.2020 12:43, Hans Verkuil пишет:
> Thierry, Dmitry,
>
> I'm happy with this series from a media perspective. However, patches 1-5 fix
> various i2c-tegra.c issues and patch 12 changes mipi calibration functions in
> drivers/gpu that patch 13 relies on.
>
> I think the i2c-tegra.c patches can be merged independently into the i2c
> subsystem, but patch 12 needs to be merged with the media patches. So for patch
> 12 I need an Acked-by from Thierry.
>
> I can also take the i2c-tegra patches if preferred, but there too I need Acks.
> Dmitry, can you either take these i2c patches, or reply with Acks if you want
> me to take it?

Hello, Hans and everyone! The I2C patches are good to me.

Either way of merging the patches should be fine since it's a hardware
bring up phase, and thus, it's not critical if patches will be applied
in a wrong order.

I'm listed as a reviewer and not a maintainer of the Tegra I2C driver,
so it should be up to Thierry and Wolfram to decide how to merge the I2C
patches.