tegra-video: add CSI support for Tegra20 and Tegra30
Subsystems (10)
v5 cover tegra-video: add CSI support for Tegra20 and Tegra30
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
---
Changes in v2:
- vi_sensor gated through csus
- TEGRA30_CLK_CLK_MAX moved to clk-tegra30
- adjusted commit titles and messages
- clk_register_clkdev dropped from pad clock registration
- removed tegra30-vi/vip and used tegra20 fallback
- added separate csi schema for tegra20-csi and tegra30-csi
- fixet number of VI channels
- adjusted tegra_vi_out naming
- fixed yuv_input_format to main_input_format
- MIPI calibration refsctored for Tegra114+ and added support for pre-Tegra114 to use CSI as a MIPI calibration device
- switched ENOMEM to EBUSY
- added check into tegra_channel_get_remote_csi_subdev
- moved avdd-dsi-csi-supply into CSI
- next_fs_sp_idx > next_fs_sp_value
- removed host1x_syncpt_incr from framecounted syncpoint
- csi subdev request moved before frame cycle
Changes in v3:
- tegra20 and tegra30 csi schema merged
- removed unneeded properties and requirements from schema
- improved vendor specific properties description
- added tegra20 csus parent mux
- improved commit descriptions
- redesigned MIPI-calibration to expose less SoC related data into header
- commit "staging: media: tegra-video: csi: add support for SoCs with integrated MIPI calibration" dropped as unneeded
- improved tegra_channel_get_remote_device_subdev logic
- avdd-dsi-csi-supply moved from vi to csi for p2597 and p3450-0000
- software syncpoint counters switched to direct reading
- adjusted planar formats offset calculation
Changes in v4:
- removed ifdefs from tegra_mipi_driver
- document Tegra132 MIPI calibration device
- switched to use BIT macro in tegra114-mipi
- pinctrl changes moved to a separate patch
- ERESTARTSYS workaround preserved for now
- tegra_mipi_add_provider replaced with devm_tegra_mipi_add_provider
- reworked bytesperline and sizeimage calculaion
Changes in v5:
- dropped patch 1/24 of v4 since it was picked to pinctrl tree
- added reasoning for tegra132 comaptible into commit desctiption
- moved clocks into common section in tegra20-csi schema
- added note regarding ERESTARTSYS
---
Svyatoslav Ryhel (23):
clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 and
Tegra114
dt-bindings: clock: tegra30: Add IDs for CSI pad clocks
clk: tegra30: add CSI pad clock gates
dt-bindings: display: tegra: document Tegra30 VI and VIP
staging: media: tegra-video: expand VI and VIP support to Tegra30
staging: media: tegra-video: vi: adjust get_selection op check
staging: media: tegra-video: vi: add flip controls only if no source
controls are provided
staging: media: tegra-video: csi: move CSI helpers to header
gpu: host1x: convert MIPI to use operation function pointers
dt-bindings: display: tegra: document Tegra132 MIPI calibration device
staging: media: tegra-video: vi: improve logic of source requesting
staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to
CSI
arm64: tegra: move avdd-dsi-csi-supply into CSI node
staging: media: tegra-video: tegra20: set correct maximum width and
height
staging: media: tegra-video: tegra20: add support for second output of
VI
staging: media: tegra-video: tegra20: adjust format align calculations
staging: media: tegra-video: tegra20: set VI HW revision
staging: media: tegra-video: tegra20: increase maximum VI clock
frequency
staging: media: tegra-video: tegra20: expand format support with
RAW8/10 and YUV422/YUV420p 1X16 staging: media: tegra-video: tegra20: adjust luma buffer stride
dt-bindings: display: tegra: document Tegra20 and Tegra30 CSI
ARM: tegra: add CSI nodes for Tegra20 and Tegra30
staging: media: tegra-video: add CSI support for Tegra20 and Tegra30
.../display/tegra/nvidia,tegra114-mipi.yaml | 1 + .../display/tegra/nvidia,tegra20-csi.yaml | 138 +++ .../display/tegra/nvidia,tegra20-vi.yaml | 19 +- .../display/tegra/nvidia,tegra20-vip.yaml | 9 +- arch/arm/boot/dts/nvidia/tegra20.dtsi | 19 +- arch/arm/boot/dts/nvidia/tegra30.dtsi | 24 +- .../arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 +- .../boot/dts/nvidia/tegra210-p3450-0000.dts | 4 +- drivers/clk/tegra/clk-tegra114.c | 7 +- drivers/clk/tegra/clk-tegra20.c | 20 +- drivers/clk/tegra/clk-tegra30.c | 21 +- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 ++--------- drivers/gpu/host1x/tegra114-mipi.c | 483 +++++++++++ drivers/staging/media/tegra-video/Makefile | 1 + drivers/staging/media/tegra-video/csi.c | 70 +- drivers/staging/media/tegra-video/csi.h | 16 + drivers/staging/media/tegra-video/tegra20.c | 820 +++++++++++++++--- drivers/staging/media/tegra-video/vi.c | 56 +- drivers/staging/media/tegra-video/vi.h | 6 +- drivers/staging/media/tegra-video/video.c | 8 +- drivers/staging/media/tegra-video/vip.c | 4 +- include/dt-bindings/clock/tegra30-car.h | 3 +- include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 ++ 26 files changed, 1657 insertions(+), 670 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-csi.yaml create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
Signature · 1 line
2.48.1
PATCH v5 1/23 clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 and Tegra114
The CSUS clock is a clock gate for the output clock signal primarily sourced from the VI_SENSOR clock. This clock signal is used as an input MCLK clock for cameras.
Unlike later Tegra SoCs, the Tegra 20 can change its CSUS parent, which is why csus_mux is added in a similar way to how CDEV1 and CDEV2 are handled.
--- drivers/clk/tegra/clk-tegra114.c | 7 ++++++- drivers/clk/tegra/clk-tegra20.c | 20 +++++++++++++------- drivers/clk/tegra/clk-tegra30.c | 7 ++++++- 3 files changed, 25 insertions(+), 9 deletions(-)
drivers/clk/tegra/clk-tegra114.c +6 -1
@@ -691,7 +691,6 @@ static struct tegra_clk tegra114_clks[tegra_clk_max] __initdata = { [tegra_clk_tsec] = { .dt_id = TEGRA114_CLK_TSEC, .present = true }, [tegra_clk_xusb_host] = { .dt_id = TEGRA114_CLK_XUSB_HOST, .present = true }, [tegra_clk_msenc] = { .dt_id = TEGRA114_CLK_MSENC, .present = true }, - [tegra_clk_csus] = { .dt_id = TEGRA114_CLK_CSUS, .present = true }, [tegra_clk_mselect] = { .dt_id = TEGRA114_CLK_MSELECT, .present = true }, [tegra_clk_tsensor] = { .dt_id = TEGRA114_CLK_TSENSOR, .present = true }, [tegra_clk_i2s3] = { .dt_id = TEGRA114_CLK_I2S3, .present = true },
@@ -1047,6 +1046,12 @@ static __init void tegra114_periph_clk_init(void __iomem *clk_base, 0, 82, periph_clk_enb_refcnt); clks[TEGRA114_CLK_DSIB ] = clk; +/* csus */ + clk =tegra_clk_register_periph_gate ("csus" ,"vi_sensor" ,0 , + clk_base,0 ,TEGRA114_CLK_CSUS , + periph_clk_enb_refcnt); + clks[TEGRA114_CLK_CSUS ] = clk; +/* emc mux */ clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm, ARRAY_SIZE(mux_pllmcp_clkm),
drivers/clk/tegra/clk-tegra20.c +13 -7
@@ -530,7 +530,6 @@ static struct tegra_clk tegra20_clks[tegra_clk_max] __initdata = { [tegra_clk_rtc] = { .dt_id = TEGRA20_CLK_RTC, .present = true }, [tegra_clk_timer] = { .dt_id = TEGRA20_CLK_TIMER, .present = true }, [tegra_clk_kbc] = { .dt_id = TEGRA20_CLK_KBC, .present = true }, - [tegra_clk_csus] = { .dt_id = TEGRA20_CLK_CSUS, .present = true }, [tegra_clk_vcp] = { .dt_id = TEGRA20_CLK_VCP, .present = true }, [tegra_clk_bsea] = { .dt_id = TEGRA20_CLK_BSEA, .present = true }, [tegra_clk_bsev] = { .dt_id = TEGRA20_CLK_BSEV, .present = true },
@@ -834,6 +833,12 @@ static void __init tegra20_periph_clk_init(void) clk_base, 0, 93, periph_clk_enb_refcnt); clks[TEGRA20_CLK_CDEV2 ] = clk; +/* csus */ + clk =tegra_clk_register_periph_gate ("csus" ,"csus_mux" ,0 , + clk_base,0 ,TEGRA20_CLK_CSUS , + periph_clk_enb_refcnt); + clks[TEGRA20_CLK_CSUS ] = clk; +for (i =0 ; i <ARRAY_SIZE (tegra_periph_clk_list); i++) { data = &tegra_periph_clk_list[i]; clk =tegra_clk_register_periph_data (clk_base, data);
@@ -1093,14 +1098,15 @@ static struct clk *tegra20_clk_src_onecell_get(struct of_phandle_args *clkspec, hw =__clk_get_hw (clk);/* -* Tegra20 CDEV1 and CDEV2 clocks are a bit special case, their parent -* clock is created by the pinctrl driver. It is possible for clk user -* to request these clocks before pinctrl driver got probed and hence -* user will get an orphaned clock. That might be undesirable because -* user may expect parent clock to be enabled by the child. +* Tegra20 CDEV1, CDEV2 and CSUS clocks are a bit special case, their +* parent clock is created by the pinctrl driver. It is possible for +* clk user to request these clocks before pinctrl driver got probed +* and hence user will get an orphaned clock. That might be undesirable +* because user may expect parent clock to be enabled by the child. */ if (clkspec->args[0 ] ==TEGRA20_CLK_CDEV1 || - clkspec->args[0 ] ==TEGRA20_CLK_CDEV2 ) { + clkspec->args[0 ] ==TEGRA20_CLK_CDEV2 || + clkspec->args[0 ] ==TEGRA20_CLK_CSUS ) { parent_hw =clk_hw_get_parent (hw);if (!parent_hw)return ERR_PTR (-EPROBE_DEFER );
drivers/clk/tegra/clk-tegra30.c +6 -1
@@ -779,7 +779,6 @@ static struct tegra_clk tegra30_clks[tegra_clk_max] __initdata = { [tegra_clk_rtc] = { .dt_id = TEGRA30_CLK_RTC, .present = true }, [tegra_clk_timer] = { .dt_id = TEGRA30_CLK_TIMER, .present = true }, [tegra_clk_kbc] = { .dt_id = TEGRA30_CLK_KBC, .present = true }, - [tegra_clk_csus] = { .dt_id = TEGRA30_CLK_CSUS, .present = true }, [tegra_clk_vcp] = { .dt_id = TEGRA30_CLK_VCP, .present = true }, [tegra_clk_bsea] = { .dt_id = TEGRA30_CLK_BSEA, .present = true }, [tegra_clk_bsev] = { .dt_id = TEGRA30_CLK_BSEV, .present = true },
@@ -1008,6 +1007,12 @@ static void __init tegra30_periph_clk_init(void) 0, 48, periph_clk_enb_refcnt); clks[TEGRA30_CLK_DSIA ] = clk; +/* csus */ + clk =tegra_clk_register_periph_gate ("csus" ,"vi_sensor" ,0 , + clk_base,0 ,TEGRA30_CLK_CSUS , + periph_clk_enb_refcnt); + clks[TEGRA30_CLK_CSUS ] = clk; +/* pcie */ clk =tegra_clk_register_periph_gate ("pcie" ,"clk_m" ,0 , clk_base,0 ,70 , periph_clk_enb_refcnt);
Signature · 1 line
2.48.1
PATCH v5 2/23 dt-bindings: clock: tegra30: Add IDs for CSI pad clocks
In reply to Svyatoslav RyhelTegra30 has CSI pad clock enable bits embedded into PLLD/PLLD2 registers. Add ids for these clocks. Additionally, move TEGRA30_CLK_CLK_MAX into clk-tegra30 source.
--- drivers/clk/tegra/clk-tegra30.c | 1 + include/dt-bindings/clock/tegra30-car.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra30.c +1 -0
@@ -53,6 +53,7 @@#define SYSTEM_CLK_RATE 0x030#define TEGRA30_CLK_PERIPH_BANKS 5 +#define TEGRA30_CLK_CLK_MAX 311#define PLLC_BASE 0x80#define PLLC_MISC 0x8c
include/dt-bindings/clock/tegra30-car.h +2 -1
@@ -271,6 +271,7 @@#define TEGRA30_CLK_AUDIO3_MUX 306#define TEGRA30_CLK_AUDIO4_MUX 307#define TEGRA30_CLK_SPDIF_MUX 308 -#define TEGRA30_CLK_CLK_MAX 309 +#define TEGRA30_CLK_CSIA_PAD 309 +#define TEGRA30_CLK_CSIB_PAD 310#endif /* _DT_BINDINGS_CLOCK_TEGRA30_CAR_H */
Signature · 1 line
2.48.1
PATCH v5 3/23 clk: tegra30: add CSI pad clock gates
In reply to Svyatoslav RyhelTegra30 has CSI pad bits in both PLLD and PLLD2 clocks that are required for the correct work of the CSI block. Add CSI pad A and pad B clock gates with PLLD/PLLD2 parents, respectively. Add a plld2 spinlock, like one plld uses, to prevent simultaneous access since both the PLLDx and CSIx_PAD clocks use the same registers
--- drivers/clk/tegra/clk-tegra30.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-tegra30.c +12 -1
@@ -154,6 +154,7 @@ static unsigned long input_freq;static DEFINE_SPINLOCK (cml_lock);static DEFINE_SPINLOCK (pll_d_lock); +static DEFINE_SPINLOCK (pll_d2_lock);#define TEGRA_INIT_DATA_MUX (_name, _parents, _offset, \ _clk_num, _gate_flags, _clk_id) \
@@ -859,7 +860,7 @@ static void __init tegra30_pll_init(void)/* PLLD2 */ clk =tegra_clk_register_pll ("pll_d2" ,"pll_ref" , clk_base, pmc_base,0 , - &pll_d2_params,NULL ); + &pll_d2_params, &pll_d2_lock); clks[TEGRA30_CLK_PLL_D2 ] = clk;/* PLLD2_OUT0 */
@@ -1008,6 +1009,16 @@ static void __init tegra30_periph_clk_init(void) 0, 48, periph_clk_enb_refcnt); clks[TEGRA30_CLK_DSIA ] = clk; +/* csia_pad */ + clk =clk_register_gate (NULL ,"csia_pad" ,"pll_d" ,CLK_SET_RATE_PARENT , + clk_base +PLLD_BASE ,26 ,0 , &pll_d_lock); + clks[TEGRA30_CLK_CSIA_PAD ] = clk; + +/* csib_pad */ + clk =clk_register_gate (NULL ,"csib_pad" ,"pll_d2" ,CLK_SET_RATE_PARENT , + clk_base +PLLD2_BASE ,26 ,0 , &pll_d2_lock); + clks[TEGRA30_CLK_CSIB_PAD ] = clk; +/* csus */ clk = tegra_clk_register_periph_gate("csus", "vi_sensor", 0, clk_base, 0, TEGRA30_CLK_CSUS,
Signature · 1 line
2.48.1
PATCH v5 4/23 dt-bindings: display: tegra: document Tegra30 VI and VIP
In reply to Svyatoslav RyhelExisting Parallel VI interface schema for Tegra20 is fully compatible with Tegra30; hence, lets reuse it by setting fallback for Tegra30.
Adjust existing VI schema to reflect that Tegra20 VI is compatible with Tegra30 by setting a fallback for Tegra30. Additionally, switch to using an enum instead of list of const.
--- .../display/tegra/nvidia,tegra20-vi.yaml | 19 ++++++++++++------- .../display/tegra/nvidia,tegra20-vip.yaml | 9 +++++++-- 2 files changed, 19 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-vi.yaml +12 -7
@@ -16,16 +16,21 @@ properties: compatible: oneOf: - - const: nvidia,tegra20-vi - - const: nvidia,tegra30-vi - - const: nvidia,tegra114-vi - - const: nvidia,tegra124-vi + - enum: + - nvidia,tegra20-vi + - nvidia,tegra114-vi + - nvidia,tegra124-vi + - nvidia,tegra210-vi + - nvidia,tegra186-vi + - nvidia,tegra194-vi + + - items: + - const: nvidia,tegra30-vi + - const: nvidia,tegra20-vi + - items: - const: nvidia,tegra132-vi - const: nvidia,tegra124-vi - - const: nvidia,tegra210-vi - - const: nvidia,tegra186-vi - - const: nvidia,tegra194-vi reg: maxItems: 1
Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-vip.yaml +7 -2
@@ -11,8 +11,13 @@ maintainers: properties: compatible: - enum: - - nvidia,tegra20-vip + oneOf: + - enum: + - nvidia,tegra20-vip + + - items: + - const: nvidia,tegra30-vip + - const: nvidia,tegra20-vip ports: $ref: /schemas/graph.yaml#/properties/ports
Signature · 1 line
2.48.1
PATCH v5 5/23 staging: media: tegra-video: expand VI and VIP support to Tegra30
In reply to Svyatoslav RyhelExisting VI and VIP implementation for Tegra20 is fully compatible with Tegra30.
--- drivers/staging/media/tegra-video/Makefile | 1 + drivers/staging/media/tegra-video/vi.c | 2 +- drivers/staging/media/tegra-video/vi.h | 2 +- drivers/staging/media/tegra-video/video.c | 2 +- drivers/staging/media/tegra-video/vip.c | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-)
drivers/staging/media/tegra-video/Makefile +1 -0
@@ -6,5 +6,6 @@ tegra-video-objs := \ csi.o tegra-video-$(CONFIG_ARCH_TEGRA_2x_SOC) += tegra20.o +tegra-video-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra20.o tegra-video-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210.o obj-$(CONFIG_VIDEO_TEGRA) += tegra-video.o
drivers/staging/media/tegra-video/vi.c +1 -1
@@ -1956,7 +1956,7 @@ static void tegra_vi_remove(struct platform_device *pdev) }static const struct of_device_id tegra_vi_of_id_table[] = { -#if defined(CONFIG_ARCH_TEGRA_2x_SOC) +#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC) { .compatible ="nvidia,tegra20-vi" , .data = &tegra20_vi_soc }, #endif #if defined(CONFIG_ARCH_TEGRA_210_SOC)
drivers/staging/media/tegra-video/vi.h +1 -1
@@ -296,7 +296,7 @@ struct tegra_video_format {u32 fourcc; }; -#if defined(CONFIG_ARCH_TEGRA_2x_SOC) +#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC)extern const struct tegra_vi_soc tegra20_vi_soc;#endif #if defined(CONFIG_ARCH_TEGRA_210_SOC )
drivers/staging/media/tegra-video/video.c +1 -1
@@ -123,7 +123,7 @@ static int host1x_video_remove(struct host1x_device *dev) }static const struct of_device_id host1x_video_subdevs[] = { -#if defined(CONFIG_ARCH_TEGRA_2x_SOC) +#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC) { .compatible ="nvidia,tegra20-vip" , }, { .compatible ="nvidia,tegra20-vi" , }, #endif
drivers/staging/media/tegra-video/vip.c +2 -2
@@ -263,12 +263,12 @@ static void tegra_vip_remove(struct platform_device *pdev)pm_runtime_disable (&pdev->dev); } -#if defined(CONFIG_ARCH_TEGRA_2x_SOC) +#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC)extern const struct tegra_vip_soc tegra20_vip_soc;#endif static const struct of_device_id tegra_vip_of_id_table[] = { -#if defined(CONFIG_ARCH_TEGRA_2x_SOC) +#if defined(CONFIG_ARCH_TEGRA_2x_SOC) || defined(CONFIG_ARCH_TEGRA_3x_SOC) { .compatible ="nvidia,tegra20-vip" , .data = &tegra20_vip_soc }, #endif { }
Signature · 1 line
2.48.1
PATCH v5 6/23 staging: media: tegra-video: vi: adjust get_selection op check
In reply to Svyatoslav RyhelGet_selection operation may be implemented only for sink pad and may return error code. Set try_crop to 0 instead of returning error.
--- drivers/staging/media/tegra-video/vi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/media/tegra-video/vi.c +2 -6
@@ -476,15 +476,11 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, fse.code = fmtinfo->code; ret =v4l2_subdev_call (subdev, pad, enum_frame_size, sd_state, &fse);if (ret) { -if (!v4l2_subdev_has_op (subdev, pad, get_selection)) { +if (!v4l2_subdev_has_op (subdev, pad, get_selection) || +v4l2_subdev_call (subdev, pad, get_selection,NULL , &sdsel)) { try_crop->width =0 ; try_crop->height =0 ; }else { - ret =v4l2_subdev_call (subdev, pad, get_selection, -NULL , &sdsel); -if (ret) -return -EINVAL ; - try_crop->width = sdsel.r.width; try_crop->height = sdsel.r.height; }
Signature · 1 line
2.48.1
Re: [PATCH v5 06/23] staging: media: tegra-video: vi: adjust get_selection op check
Hi Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Get_selectionoperation may be implemented only for sink pad and may return error code. Settry_cropto 0 instead of returning error.
Can you mention why try_crop is set to 0 instead of returning an error?
That would be good to have in the commit log. And in fact, it's not clear to me either why you want this.
Quoted 11 lines
Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/staging/media/tegra-video/vi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)drivers/staging/media/tegra-video/vi.c +0
-0
drivers/staging/media/tegra-video/vi.c static int __tegra_channel_try_format(struct tegra_vi_channel *chan, · line 482
Quoted 8 lines
drivers/staging/media/tegra-video/vi.c +2
-1@@ -476,15 +476,11 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, fse.code = fmtinfo->code; ret =v4l2_subdev_call (subdev, pad, enum_frame_size, sd_state, &fse);if (ret) { -if (!v4l2_subdev_has_op (subdev, pad, get_selection)) { +if (!v4l2_subdev_has_op (subdev, pad, get_selection) || +v4l2_subdev_call (subdev, pad, get_selection,NULL , &sdsel)) { try_crop->width =0 ; try_crop->height =0 ;
This looks all a bit magical. Which subdev is queried here? I.e. what is the corresponding subdev driver that implements get_selection?
drivers/staging/media/tegra-video/vi.c static int __tegra_channel_try_format(struct tegra_vi_channel *chan, · line 486
Quoted 9 lines
drivers/staging/media/tegra-video/vi.c +0
-5}else { - ret =v4l2_subdev_call (subdev, pad, get_selection, -NULL , &sdsel); -if (ret) -return -EINVAL ; - try_crop->width = sdsel.r.width; try_crop->height = sdsel.r.height; }
It looks odd (esp. setting try_crop to 0), and I wonder if this code path has been tested.
Regards,
Hans
Re: [PATCH v5 06/23] staging: media: tegra-video: vi: adjust get_selection op check
пн, 27 жовт. 2025 р. о 17:44 Hans Verkuil <[email protected]> пише:
Quoted 18 lines
Hi Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Get_selectionoperation may be implemented only for sink pad and may return error code. Settry_cropto 0 instead of returning error.Can you mention why
try_cropis set to 0 instead of returning an error?That would be good to have in the commit log. And in fact, it's not clear to me either why you want this.
Quoted 6 lines
Signed-off-by Svyatoslav Ryhel <[email protected]>--- drivers/staging/media/tegra-video/vi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
Quoted 17 lines
drivers/staging/media/tegra-video/vi.c static int __tegra_channel_try_format(struct tegra_vi_channel *chan, · line 482
Quoted 13 lines
drivers/staging/media/tegra-video/vi.c +2
-1@@ -476,15 +476,11 @@ static int __tegra_channel_try_format(struct tegra_vi_channel *chan, fse.code = fmtinfo->code; ret =v4l2_subdev_call (subdev, pad, enum_frame_size, sd_state, &fse);if (ret) { -if (!v4l2_subdev_has_op (subdev, pad, get_selection)) { +if (!v4l2_subdev_has_op (subdev, pad, get_selection) || +v4l2_subdev_call (subdev, pad, get_selection,NULL , &sdsel)) { try_crop->width =0 ; try_crop->height =0 ;This looks all a bit magical. Which subdev is queried here? I.e. what is the corresponding subdev driver that implements
get_selection?
Camera sensor subdev, Tegra VI driver directly interacts with camera sensor.
Quoted 10 lines
drivers/staging/media/tegra-video/vi.c static int __tegra_channel_try_format(struct tegra_vi_channel *chan, · line 486
Quoted 9 lines
drivers/staging/media/tegra-video/vi.c +0
-5}else { - ret =v4l2_subdev_call (subdev, pad, get_selection, -NULL , &sdsel); -if (ret) -return -EINVAL ; - try_crop->width = sdsel.r.width; try_crop->height = sdsel.r.height; }
Quoted 2 lines
It looks odd (esp. setting
try_cropto 0), and I wonder if this code path has been tested.
Yes it was tested.
Original code checked if the camera sensor has get_selection implemented and if such operation is supported then it applies width and height from get_selection, else zeroes. This works just fine with most cameras and v4l2 compliance tests pass fine, with most but not with mt9m114 which implements get_selection only for its ifp source pad while sink pad always returns -EINVAL, hence VI driver fails with -EINVAL too. To address drivers like mt9m114 instead of just fail with -EINVAL if get_selection returns error try_crop width and height will be set the same as get_selection is not implemented.
Quoted 3 lines
Regards,
Hans
PATCH v5 7/23 staging: media: tegra-video: vi: add flip controls only if no source controls are provided
In reply to Svyatoslav RyhelBecause the current Tegra video driver is video-centric, it exposes all controls via /dev/video. If both the camera sensor and the VI provide hflip and vflip, the driver will fail because only one control is allowed. To address this, hflip and vflip should be added from the SoC only if the camera sensor doesn't provide those controls.
--- drivers/staging/media/tegra-video/vi.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/staging/media/tegra-video/vi.c +6 -3
@@ -961,6 +961,7 @@ static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan) }#else struct v4l2_subdev *subdev; +struct v4l2_ctrl *hflip, *vflip;/* custom control */ v4l2_ctrl_new_custom (&chan->ctrl_handler, &syncpt_timeout_ctrl,NULL );
@@ -986,11 +987,13 @@ static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan) return ret; } -if (chan->vi->soc->has_h_v_flip) { + hflip =v4l2_ctrl_find (subdev->ctrl_handler,V4L2_CID_HFLIP ); +if (chan->vi->soc->has_h_v_flip && !hflip)v4l2_ctrl_new_std (&chan->ctrl_handler, &vi_ctrl_ops,V4L2_CID_HFLIP ,0 ,1 ,1 ,0 ); -v4l2_ctrl_new_std (&chan->ctrl_handler, &vi_ctrl_ops,V4L2_CID_VFLIP ,0 ,1 ,1 ,0 ); - } + vflip =v4l2_ctrl_find (subdev->ctrl_handler,V4L2_CID_VFLIP ); +if (chan->vi->soc->has_h_v_flip && !vflip) +v4l2_ctrl_new_std (&chan->ctrl_handler, &vi_ctrl_ops,V4L2_CID_VFLIP ,0 ,1 ,1 ,0 );#endif /* setup the controls */
Signature · 1 line
2.48.1
PATCH v5 8/23 staging: media: tegra-video: csi: move CSI helpers to header
In reply to Svyatoslav RyhelMove CSI helpers into the header for easier access from SoC-specific video driver parts.
--- drivers/staging/media/tegra-video/csi.c | 11 ----------- drivers/staging/media/tegra-video/csi.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/staging/media/tegra-video/csi.c +0 -11
@@ -20,17 +20,6 @@#define MHZ 1000000 -static inline struct tegra_csi * -host1x_client_to_csi (struct host1x_client *client) -{ - return container_of(client, struct tegra_csi, client); -} - -static inline struct tegra_csi_channel *to_csi_chan (struct v4l2_subdev *subdev) -{ - return container_of(subdev, struct tegra_csi_channel, subdev); -} -/* * CSI is a separate subdevice which has 6 source pads to generate * test pattern. CSI subdevice pad ops are used only for TPG and
drivers/staging/media/tegra-video/csi.h +10 -0
@@ -151,6 +151,16 @@ struct tegra_csi {struct list_head csi_chans; }; +static inline struct tegra_csi *host1x_client_to_csi (struct host1x_client *client) +{ + return container_of(client, struct tegra_csi, client); +} + +static inline struct tegra_csi_channel *to_csi_chan (struct v4l2_subdev *subdev) +{ + return container_of(subdev, struct tegra_csi_channel, subdev); +} +void tegra_csi_error_recover (struct v4l2_subdev *subdev); void tegra_csi_calc_settle_time(struct tegra_csi_channel *csi_chan, u8 csi_port_num,
Signature · 1 line
2.48.1
PATCH v5 9/23 gpu: host1x: convert MIPI to use operation function pointers
In reply to Svyatoslav RyhelConvert existing MIPI code to use operation function pointers, a necessary step for supporting Tegra20/Tegra30 SoCs. All common MIPI configuration that is SoC-independent remains in mipi.c, while all SoC-specific code is moved to tegra114-mipi.c (The naming matches the first SoC generation with a dedicated calibration block). Shared structures and function calls are placed into tegra-mipi-cal.h.
--- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 +++--------------------- drivers/gpu/host1x/tegra114-mipi.c | 483 ++++++++++++++++++++++ drivers/staging/media/tegra-video/csi.c | 1 + include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 +++ 7 files changed, 599 insertions(+), 479 deletions(-) create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
drivers/gpu/drm/tegra/dsi.c +1 -0
@@ -14,6 +14,7 @@#include <linux/pm_runtime.h> #include <linux/regulator/consumer.h> #include <linux/reset.h> +#include <linux/tegra-mipi-cal.h> #include <video/mipi_display.h>
drivers/gpu/host1x/Makefile +1 -0
@@ -9,6 +9,7 @@ host1x-y = \ job.o \ debug.o \ mipi.o \ + tegra114-mipi.o \ fence.o \ hw/host1x01.o \ hw/host1x02.o \
drivers/gpu/host1x/mipi.c +56 -469
592 lines not on this page · raw message
drivers/gpu/host1x/tegra114-mipi.c new file +483 -0
483 lines not on this page · raw message
drivers/staging/media/tegra-video/csi.c +1 -0
@@ -12,6 +12,7 @@#include <linux/of_graph.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/tegra-mipi-cal.h> #include <media/v4l2-fwnode.h>
include/linux/host1x.h +0 -10
@@ -453,16 +453,6 @@ void host1x_client_unregister(struct host1x_client *client);int host1x_client_suspend (struct host1x_client *client);int host1x_client_resume (struct host1x_client *client); -struct tegra_mipi_device ; - -struct tegra_mipi_device *tegra_mipi_request (struct device *device, -struct device_node *np); -void tegra_mipi_free (struct tegra_mipi_device *device); -int tegra_mipi_enable (struct tegra_mipi_device *device); -int tegra_mipi_disable (struct tegra_mipi_device *device); -int tegra_mipi_start_calibration (struct tegra_mipi_device *device); -int tegra_mipi_finish_calibration (struct tegra_mipi_device *device); -/* host1x memory contexts */ struct host1x_memory_context {
include/linux/tegra-mipi-cal.h new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH v5 09/23] gpu: host1x: convert MIPI to use operation function pointers
Quoted 9 lines · Svyatoslav Ryhel
Convert existing MIPI code to use operation function pointers, a necessary step for supporting Tegra20/Tegra30 SoCs. All common MIPI configuration that is SoC-independent remains in
mipi.c, while all SoC-specific code is moved totegra114-mipi.c(The naming matches the first SoC generation with a dedicated calibration block). Shared structures and function calls are placed intotegra-mipi-cal.h.Signed-off-by Svyatoslav Ryhel <[email protected]>Acked-by Mikko Perttunen <[email protected]>
Quoted 11 lines
--- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 +++--------------------- drivers/gpu/host1x/tegra114-mipi.c | 483 ++++++++++++++++++++++ drivers/staging/media/tegra-video/csi.c | 1 + include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 +++ 7 files changed, 599 insertions(+), 479 deletions(-) create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
Not sure if I missed this earlier, but I don't understand why the code was moved around like this. tegra114-mipi.c now contains the code for all of Tegra114, Tegra124, Tegra132 and Tegra210, so the name doesn't make any more sense than the old name.
Furthermore, moving the header file contents now also means that we have a cross-dependency within the series that makes this more difficult to merge. Obviously that's something we can make work, /if/ there's a need, but from what I can tell there's really no benefit to this extra churn.
I also don't fully understand the benefit of converting the code into operation function pointers if we always use the same function pointers for all generations. Effectively this adds boilerplate and an extra indirection for no benefit at all.
Splitting the "SoC specific" parts from the generic parts also now needlessly exports a symbol for absolutely no reason. Both files are linked into the same driver/module, there's no need for an exported symbol.
The only slight bit of information that might justify this is the hint in this commit message that Tegra20/Tegra30 requires this. But I don't see patches for this anywhere, making it impossible to review this change.
Looking at other parts of the series, and given it's spread across a large number of trees with compile-time dependencies between them, I think it would be better to split this up differently. I think it could be three series in total: one for the clock changes needed for this, another with all of the MIPI changes (in which case it would make sense to include the Tegra20/Tegra30 bits as well to actually show why the rework in this patch is needed) and a final one with the staging/media bits that make use if this all. Well, maybe also a fourth series that adds the DT changes needed to make it all work.
I think if you avoid splitting the MIPI prototypes into tegra-mipi-cal.h you should be able to get rid of the cross-dependency. Clock changes should already be independent. Also, I think it's probably fine if we keep all of the MIPI driver code in the one file that it's currently in. This removes the need for the odd exported symbol. It's not a great deal of code, and I doubt that Tegra20/Tegra30 support would add significantly to it.
Thierry
PATCH v5 10/23 dt-bindings: display: tegra: document Tegra132 MIPI calibration device
In reply to Svyatoslav RyhelDocument MIPI calibration device found in Tegra132. This compatible already exists in the Linux kernel, I have just documented it to satisfy warnings.
Each Tegra SoC generation has unique set of registers which should be configured. They all differ, hence fallback is not suitable here.
--- .../devicetree/bindings/display/tegra/nvidia,tegra114-mipi.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/tegra/nvidia,tegra114-mipi.yaml +1 -0
@@ -18,6 +18,7 @@ properties: enum: - nvidia,tegra114-mipi - nvidia,tegra124-mipi + - nvidia,tegra132-mipi - nvidia,tegra210-mipi - nvidia,tegra186-mipi
Signature · 1 line
2.48.1
PATCH v5 11/23 staging: media: tegra-video: vi: improve logic of source requesting
In reply to Svyatoslav RyhelBy default tegra_channel_get_remote_csi_subdev returns next device in pipe assuming it is CSI but in case of Tegra20 and Tegra30 it can also be VIP or even HOST.
Define tegra_channel_get_remote_csi_subdev within CSI and add check if returned device is actually CSI by comparing subdevice operations.
Previous tegra_channel_get_remote_csi_subdev definition in VI rename to tegra_channel_get_remote_bridge_subdev and use it only in VI driver since core VI driver does not care about source and does not call any specific functions.
--- drivers/staging/media/tegra-video/csi.c | 16 ++++++++++++++++ drivers/staging/media/tegra-video/vi.c | 14 +++++++------- 2 files changed, 23 insertions(+), 7 deletions(-)
drivers/staging/media/tegra-video/csi.c +16 -0
@@ -445,6 +445,22 @@ static const struct v4l2_subdev_ops tegra_csi_ops = { .pad = &tegra_csi_pad_ops, }; +struct v4l2_subdev *tegra_channel_get_remote_csi_subdev (struct tegra_vi_channel *chan) +{ +struct media_pad *pad; +struct v4l2_subdev *subdev; + + pad =media_pad_remote_pad_first (&chan->pad); +if (!pad) +return NULL ; + + subdev =media_entity_to_v4l2_subdev (pad->entity); +if (!subdev) +return NULL ; + +return subdev->ops == &tegra_csi_ops ? subdev :NULL ; +} + static int tegra_csi_channel_alloc(struct tegra_csi *csi, struct device_node *node, unsigned int port_num, unsigned int lanes,
drivers/staging/media/tegra-video/vi.c +7 -7
@@ -160,8 +160,8 @@ static void tegra_channel_buffer_queue(struct vb2_buffer *vb)wake_up_interruptible (&chan->start_wait); } -struct v4l2_subdev * -tegra_channel_get_remote_csi_subdev (struct tegra_vi_channel *chan) +static struct v4l2_subdev * +tegra_channel_get_remote_bridge_subdev (struct tegra_vi_channel *chan) {struct media_pad *pad;
@@ -182,7 +182,7 @@ tegra_channel_get_remote_source_subdev(struct tegra_vi_channel *chan)struct v4l2_subdev *subdev;struct media_entity *entity; - subdev =tegra_channel_get_remote_csi_subdev (chan); + subdev =tegra_channel_get_remote_bridge_subdev (chan);if (!subdev)return NULL ;
@@ -204,7 +204,7 @@ static int tegra_channel_enable_stream(struct tegra_vi_channel *chan)struct v4l2_subdev *subdev;int ret; - subdev =tegra_channel_get_remote_csi_subdev (chan); + subdev =tegra_channel_get_remote_bridge_subdev (chan); ret =v4l2_subdev_call (subdev, video, s_stream, true);if (ret <0 && ret != -ENOIOCTLCMD )return ret;
@@ -217,7 +217,7 @@ static int tegra_channel_disable_stream(struct tegra_vi_channel *chan)struct v4l2_subdev *subdev;int ret; - subdev =tegra_channel_get_remote_csi_subdev (chan); + subdev =tegra_channel_get_remote_bridge_subdev (chan); ret =v4l2_subdev_call (subdev, video, s_stream, false);if (ret <0 && ret != -ENOIOCTLCMD )return ret;
@@ -1630,11 +1630,11 @@ static int tegra_vi_graph_notify_complete(struct v4l2_async_notifier *notifier) goto unregister_video; } - subdev =tegra_channel_get_remote_csi_subdev (chan); + subdev =tegra_channel_get_remote_bridge_subdev (chan);if (!subdev) { ret = -ENODEV ;dev_err (vi->dev, -"failed to get remote csi subdev: %d\n" , ret); +"failed to get remote bridge subdev: %d\n" , ret); goto unregister_video; }
Signature · 1 line
2.48.1
PATCH v5 12/23 staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to CSI
In reply to Svyatoslav RyhelThe avdd-dsi-csi-supply is CSI power supply not VI, hence move it to proper place.
--- drivers/staging/media/tegra-video/csi.c | 19 ++++++++++++++++++- drivers/staging/media/tegra-video/csi.h | 2 ++ drivers/staging/media/tegra-video/vi.c | 23 ++--------------------- drivers/staging/media/tegra-video/vi.h | 2 -- 4 files changed, 22 insertions(+), 24 deletions(-)
drivers/staging/media/tegra-video/csi.c +18 -1
@@ -710,6 +710,8 @@ static int __maybe_unused csi_runtime_suspend(struct device *dev)clk_bulk_disable_unprepare (csi->soc->num_clks, csi->clks); +regulator_disable (csi->vdd); +return 0 ; }
@@ -718,13 +720,23 @@ static int __maybe_unused csi_runtime_resume(struct device *dev)struct tegra_csi *csi =dev_get_drvdata (dev);int ret; + ret =regulator_enable (csi->vdd); +if (ret) { +dev_err (dev,"failed to enable VDD supply: %d\n" , ret); +return ret; + } + ret =clk_bulk_prepare_enable (csi->soc->num_clks, csi->clks);if (ret <0 ) {dev_err (csi->dev,"failed to enable clocks: %d\n" , ret); -return ret; + goto disable_vdd; }return 0 ; + +disable_vdd: +regulator_disable (csi->vdd); +return ret; }static int tegra_csi_init (struct host1x_client *client)
@@ -802,6 +814,11 @@ static int tegra_csi_probe(struct platform_device *pdev)return ret; } + csi->vdd =devm_regulator_get (&pdev->dev,"avdd-dsi-csi" ); +if (IS_ERR (csi->vdd)) +return dev_err_probe (&pdev->dev,PTR_ERR (csi->vdd), +"failed to get VDD supply" ); +if (!pdev->dev.pm_domain) { ret = -ENOENT ;dev_warn (&pdev->dev,"PM domain is not attached: %d\n" , ret);
drivers/staging/media/tegra-video/csi.h +2 -0
@@ -137,6 +137,7 @@ struct tegra_csi_soc {* @client: host1x_client struct * @iomem: register base * @clks: clock for CSI and CIL +* @vdd: vdd regulator for CSI hardware, usually avdd_dsi_csi * @soc: pointer to SoC data structure * @ops: csi operations * @csi_chans: list head for CSI channels
@@ -146,6 +147,7 @@ struct tegra_csi {struct host1x_client client;void __iomem *iomem;struct clk_bulk_data *clks; +struct regulator *vdd;const struct tegra_csi_soc *soc;const struct tegra_csi_ops *ops;struct list_head csi_chans;
drivers/staging/media/tegra-video/vi.c +2 -21
@@ -1417,29 +1417,19 @@ static int __maybe_unused vi_runtime_resume(struct device *dev)struct tegra_vi *vi =dev_get_drvdata (dev);int ret; - ret =regulator_enable (vi->vdd); -if (ret) { -dev_err (dev,"failed to enable VDD supply: %d\n" , ret); -return ret; - } - ret =clk_set_rate (vi->clk, vi->soc->vi_max_clk_hz);if (ret) {dev_err (dev,"failed to set vi clock rate: %d\n" , ret); - goto disable_vdd; +return ret; } ret =clk_prepare_enable (vi->clk);if (ret) {dev_err (dev,"failed to enable vi clock: %d\n" , ret); - goto disable_vdd; +return ret; }return 0 ; - -disable_vdd: -regulator_disable (vi->vdd); -return ret; }static int __maybe_unused vi_runtime_suspend (struct device *dev)
@@ -1448,8 +1438,6 @@ static int __maybe_unused vi_runtime_suspend(struct device *dev)clk_disable_unprepare (vi->clk); -regulator_disable (vi->vdd); -return 0 ; }
@@ -1894,13 +1882,6 @@ static int tegra_vi_probe(struct platform_device *pdev)return ret; } - vi->vdd =devm_regulator_get (&pdev->dev,"avdd-dsi-csi" ); -if (IS_ERR (vi->vdd)) { - ret =PTR_ERR (vi->vdd); -dev_err (&pdev->dev,"failed to get VDD supply: %d\n" , ret); -return ret; - } -if (!pdev->dev.pm_domain) { ret = -ENOENT ;dev_warn (&pdev->dev,"PM domain is not attached: %d\n" , ret);
drivers/staging/media/tegra-video/vi.h +0 -2
@@ -94,7 +94,6 @@ struct tegra_vi_soc {* @client: host1x_client struct * @iomem: register base * @clk: main clock for VI block -* @vdd: vdd regulator for VI hardware, normally it is avdd_dsi_csi * @soc: pointer to SoC data structure * @ops: vi operations * @vi_chans: list head for VI channels
@@ -104,7 +103,6 @@ struct tegra_vi {struct host1x_client client;void __iomem *iomem;struct clk *clk; -struct regulator *vdd;const struct tegra_vi_soc *soc;const struct tegra_vi_ops *ops;struct list_head vi_chans;
Signature · 1 line
2.48.1
PATCH v5 13/23 arm64: tegra: move avdd-dsi-csi-supply into CSI node
In reply to Svyatoslav Ryhelavdd-dsi-csi-supply belongs in CSI node, not VI.
--- arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 ++-- arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi +2 -2
@@ -20,10 +20,10 @@ dpaux@54040000 { vi@54080000 { status = "okay"; - avdd-dsi-csi-supply = <&vdd_dsi_csi>; - csi@838 { status = "okay"; + + avdd-dsi-csi-supply = <&vdd_dsi_csi>; }; };
arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts +2 -2
@@ -64,10 +64,10 @@ dpaux@54040000 { vi@54080000 { status = "okay"; - avdd-dsi-csi-supply = <&vdd_sys_1v2>; - csi@838 { status = "okay"; + + avdd-dsi-csi-supply = <&vdd_sys_1v2>; }; };
Signature · 1 line
2.48.1
Re: [PATCH v5 13/23] arm64: tegra: move avdd-dsi-csi-supply into CSI node
Quoted 8 lines · Svyatoslav Ryhel
avdd-dsi-csi-supply belongs in CSI node, not VI.
Signed-off-by Svyatoslav Ryhel <[email protected]>Reviewed-by Mikko Perttunen <[email protected]>--- arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 ++-- arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
This looks completely independent from the rest, so I've applied this.
Thanks,
Thierry
PATCH v5 14/23 staging: media: tegra-video: tegra20: set correct maximum width and height
In reply to Svyatoslav RyhelMaximum width and height for Tegra20 and Tegra30 is determined by respective register field, rounded down to factor of 2, which is 8191U rounded down to 8190U.
--- drivers/staging/media/tegra-video/tegra20.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/media/tegra-video/tegra20.c +2 -3
@@ -23,11 +23,10 @@#define TEGRA_VI_SYNCPT_WAIT_TIMEOUT msecs_to_jiffies(200) -/* This are just good-sense numbers. The actual min/max is not documented. */ #define TEGRA20_MIN_WIDTH 32U +#define TEGRA20_MAX_WIDTH 8190U#define TEGRA20_MIN_HEIGHT 32U -#define TEGRA20_MAX_WIDTH 2048U -#define TEGRA20_MAX_HEIGHT 2048U +#define TEGRA20_MAX_HEIGHT 8190U/* -------------------------------------------------------------------------- * Registers
Signature · 1 line
2.48.1
PATCH v5 15/23 staging: media: tegra-video: tegra20: add support for second output of VI
In reply to Svyatoslav RyhelVI in Tegra20/Tegra30 has 2 VI outputs with different set of supported formats. Convert output registers to macros for simpler work with both outputs since apart formats their layout matches.
--- drivers/staging/media/tegra-video/tegra20.c | 83 ++++++++++++--------- 1 file changed, 47 insertions(+), 36 deletions(-)
drivers/staging/media/tegra-video/tegra20.c +47 -36
@@ -28,13 +28,19 @@#define TEGRA20_MIN_HEIGHT 32U#define TEGRA20_MAX_HEIGHT 8190U +/* Tegra20/Tegra30 has 2 outputs in VI */ +enum tegra_vi_out { +TEGRA_VI_OUT_1 =0 , +TEGRA_VI_OUT_2 =1 , +}; +/* -------------------------------------------------------------------------- * Registers */ -#define TEGRA_VI_CONT_SYNCPT_OUT_1 0x0060 -#define VI_CONT_SYNCPT_OUT_1_CONTINUOUS_SYNCPT BIT(8) -#define VI_CONT_SYNCPT_OUT_1_SYNCPT_IDX_SFT 0 +#define TEGRA_VI_CONT_SYNCPT_OUT (n) (0x0060 + (n) * 4) +#define VI_CONT_SYNCPT_OUT_CONTINUOUS_SYNCPT BIT(8) +#define VI_CONT_SYNCPT_OUT_SYNCPT_IDX_SFT 0#define TEGRA_VI_VI_INPUT_CONTROL 0x0088#define VI_INPUT_FIELD_DETECT BIT(27)
@@ -46,6 +52,7 @@#define VI_INPUT_YUV_INPUT_FORMAT_YVYU (3 << VI_INPUT_YUV_INPUT_FORMAT_SFT)#define VI_INPUT_INPUT_FORMAT_SFT 2/* bits [5:2] */ #define VI_INPUT_INPUT_FORMAT_YUV422 (0 << VI_INPUT_INPUT_FORMAT_SFT) +#define VI_INPUT_INPUT_FORMAT_BAYER (2 << VI_INPUT_INPUT_FORMAT_SFT)#define VI_INPUT_VIP_INPUT_ENABLE BIT(1)#define TEGRA_VI_VI_CORE_CONTROL 0x008c
@@ -66,7 +73,7 @@#define VI_VI_CORE_CONTROL_OUTPUT_TO_EPP_SFT 2#define VI_VI_CORE_CONTROL_OUTPUT_TO_ISP_SFT 0 -#define TEGRA_VI_VI_FIRST_OUTPUT_CONTROL 0x0090 +#define TEGRA_VI_VI_OUTPUT_CONTROL (n) (0x0090 + (n) * 4)#define VI_OUTPUT_FORMAT_EXT BIT(22)#define VI_OUTPUT_V_DIRECTION BIT(20)#define VI_OUTPUT_H_DIRECTION BIT(19)
@@ -80,6 +87,8 @@#define VI_OUTPUT_OUTPUT_FORMAT_SFT 0#define VI_OUTPUT_OUTPUT_FORMAT_YUV422POST (3 << VI_OUTPUT_OUTPUT_FORMAT_SFT)#define VI_OUTPUT_OUTPUT_FORMAT_YUV420PLANAR (6 << VI_OUTPUT_OUTPUT_FORMAT_SFT) +/* TEGRA_VI_OUT_2 supported formats */ +#define VI_OUTPUT_OUTPUT_FORMAT_VIP_BAYER_DIRECT (9 << VI_OUTPUT_OUTPUT_FORMAT_SFT)#define TEGRA_VI_VIP_H_ACTIVE 0x00a4#define VI_VIP_H_ACTIVE_PERIOD_SFT 16/* active pixels/line, must be even */
@@ -89,26 +98,26 @@#define VI_VIP_V_ACTIVE_PERIOD_SFT 16/* active lines */ #define VI_VIP_V_ACTIVE_START_SFT 0 -#define TEGRA_VI_VB0_START_ADDRESS_FIRST 0x00c4 -#define TEGRA_VI_VB0_BASE_ADDRESS_FIRST 0x00c8 +#define TEGRA_VI_VB0_START_ADDRESS (n) (0x00c4 + (n) * 44) +#define TEGRA_VI_VB0_BASE_ADDRESS (n) (0x00c8 + (n) * 44)#define TEGRA_VI_VB0_START_ADDRESS_U 0x00cc#define TEGRA_VI_VB0_BASE_ADDRESS_U 0x00d0#define TEGRA_VI_VB0_START_ADDRESS_V 0x00d4#define TEGRA_VI_VB0_BASE_ADDRESS_V 0x00d8 -#define TEGRA_VI_FIRST_OUTPUT_FRAME_SIZE 0x00e0 -#define VI_FIRST_OUTPUT_FRAME_HEIGHT_SFT 16 -#define VI_FIRST_OUTPUT_FRAME_WIDTH_SFT 0 +#define TEGRA_VI_OUTPUT_FRAME_SIZE (n) (0x00e0 + (n) * 24) +#define VI_OUTPUT_FRAME_HEIGHT_SFT 16 +#define VI_OUTPUT_FRAME_WIDTH_SFT 0 -#define TEGRA_VI_VB0_COUNT_FIRST 0x00e4 +#define TEGRA_VI_VB0_COUNT (n) (0x00e4 + (n) * 24) -#define TEGRA_VI_VB0_SIZE_FIRST 0x00e8 -#define VI_VB0_SIZE_FIRST_V_SFT 16 -#define VI_VB0_SIZE_FIRST_H_SFT 0 +#define TEGRA_VI_VB0_SIZE (n) (0x00e8 + (n) * 24) +#define VI_VB0_SIZE_V_SFT 16 +#define VI_VB0_SIZE_H_SFT 0 -#define TEGRA_VI_VB0_BUFFER_STRIDE_FIRST 0x00ec -#define VI_VB0_BUFFER_STRIDE_FIRST_CHROMA_SFT 30 -#define VI_VB0_BUFFER_STRIDE_FIRST_LUMA_SFT 0 +#define TEGRA_VI_VB0_BUFFER_STRIDE (n) (0x00ec + (n) * 24) +#define VI_VB0_BUFFER_STRIDE_CHROMA_SFT 30 +#define VI_VB0_BUFFER_STRIDE_LUMA_SFT 0#define TEGRA_VI_H_LPF_CONTROL 0x0108#define VI_H_LPF_CONTROL_CHROMA_SFT 16
@@ -136,7 +145,7 @@#define VI_CAMERA_CONTROL_TEST_MODE BIT(1)#define VI_CAMERA_CONTROL_VIP_ENABLE BIT(0) -#define TEGRA_VI_VI_ENABLE 0x01a4 +#define TEGRA_VI_VI_ENABLE (n) (0x01a4 + (n) * 4)#define VI_VI_ENABLE_SW_FLOW_CONTROL_OUT1 BIT(1)#define VI_VI_ENABLE_FIRST_OUTPUT_TO_MEM_DISABLE BIT(0)
@@ -366,8 +375,8 @@ static void tegra20_channel_vi_buffer_setup(struct tegra_vi_channel *chan,case V4L2_PIX_FMT_VYUY :case V4L2_PIX_FMT_YUYV :case V4L2_PIX_FMT_YVYU : -tegra20_vi_write (chan,TEGRA_VI_VB0_BASE_ADDRESS_FIRST , base); -tegra20_vi_write (chan,TEGRA_VI_VB0_START_ADDRESS_FIRST , base + chan->start_offset); +tegra20_vi_write (chan,TEGRA_VI_VB0_BASE_ADDRESS (TEGRA_VI_OUT_1 ), base); +tegra20_vi_write (chan,TEGRA_VI_VB0_START_ADDRESS (TEGRA_VI_OUT_1 ), base + chan->start_offset);break ; } }
@@ -455,6 +464,7 @@ static void tegra20_camera_capture_setup(struct tegra_vi_channel *chan)int stride_l = chan->format.bytesperline;int stride_c = (output_fourcc ==V4L2_PIX_FMT_YUV420 || output_fourcc ==V4L2_PIX_FMT_YVU420 ) ?1 :0 ; +enum tegra_vi_out output_channel =TEGRA_VI_OUT_1 ;int main_output_format;int yuv_output_format;
@@ -472,33 +482,33 @@ static void tegra20_camera_capture_setup(struct tegra_vi_channel *chan)/* Set up raise-on-edge, so we get an interrupt on end of frame. */ tegra20_vi_write (chan,TEGRA_VI_VI_RAISE ,VI_VI_RAISE_ON_EDGE ); -tegra20_vi_write (chan,TEGRA_VI_VI_FIRST_OUTPUT_CONTROL , +tegra20_vi_write (chan,TEGRA_VI_VI_OUTPUT_CONTROL (output_channel), (chan->vflip ?VI_OUTPUT_V_DIRECTION :0 ) | (chan->hflip ?VI_OUTPUT_H_DIRECTION :0 ) | yuv_output_format <<VI_OUTPUT_YUV_OUTPUT_FORMAT_SFT | main_output_format <<VI_OUTPUT_OUTPUT_FORMAT_SFT );/* Set up frame size */ -tegra20_vi_write (chan,TEGRA_VI_FIRST_OUTPUT_FRAME_SIZE , - height <<VI_FIRST_OUTPUT_FRAME_HEIGHT_SFT | - width <<VI_FIRST_OUTPUT_FRAME_WIDTH_SFT ); +tegra20_vi_write (chan,TEGRA_VI_OUTPUT_FRAME_SIZE (output_channel), + height <<VI_OUTPUT_FRAME_HEIGHT_SFT | + width <<VI_OUTPUT_FRAME_WIDTH_SFT );/* First output memory enabled */ -tegra20_vi_write (chan,TEGRA_VI_VI_ENABLE ,0 ); +tegra20_vi_write (chan,TEGRA_VI_VI_ENABLE (output_channel),0 );/* Set the number of frames in the buffer */ -tegra20_vi_write (chan,TEGRA_VI_VB0_COUNT_FIRST ,1 ); +tegra20_vi_write (chan,TEGRA_VI_VB0_COUNT (output_channel),1 );/* Set up buffer frame size */ -tegra20_vi_write (chan,TEGRA_VI_VB0_SIZE_FIRST , - height <<VI_VB0_SIZE_FIRST_V_SFT | - width <<VI_VB0_SIZE_FIRST_H_SFT ); +tegra20_vi_write (chan,TEGRA_VI_VB0_SIZE (output_channel), + height <<VI_VB0_SIZE_V_SFT | + width <<VI_VB0_SIZE_H_SFT ); -tegra20_vi_write (chan,TEGRA_VI_VB0_BUFFER_STRIDE_FIRST , - stride_l <<VI_VB0_BUFFER_STRIDE_FIRST_LUMA_SFT | - stride_c <<VI_VB0_BUFFER_STRIDE_FIRST_CHROMA_SFT ); +tegra20_vi_write (chan,TEGRA_VI_VB0_BUFFER_STRIDE (output_channel), + stride_l <<VI_VB0_BUFFER_STRIDE_LUMA_SFT | + stride_c <<VI_VB0_BUFFER_STRIDE_CHROMA_SFT ); -tegra20_vi_write (chan,TEGRA_VI_VI_ENABLE ,0 ); +tegra20_vi_write (chan,TEGRA_VI_VI_ENABLE (output_channel),0 ); }static int tegra20_vi_start_streaming (struct vb2_queue *vq,u32 count)
@@ -587,7 +597,7 @@ const struct tegra_vi_soc tegra20_vi_soc = { .nformats = ARRAY_SIZE(tegra20_video_formats), .default_video_format = &tegra20_video_formats[0], .ops = &tegra20_vi_ops, - .vi_max_channels = 1, /* parallel input (VIP) */ + .vi_max_channels = 2, /* TEGRA_VI_OUT_1 and TEGRA_VI_OUT_2 */ .vi_max_clk_hz = 150000000, .has_h_v_flip = true, };
@@ -607,6 +617,7 @@ static int tegra20_vip_start_streaming(struct tegra_vip_channel *vip_chan)struct tegra_vi_channel *vi_chan =v4l2_get_subdev_hostdata (&vip_chan->subdev);int width = vi_chan->format.width;int height = vi_chan->format.height; +enum tegra_vi_out output_channel =TEGRA_VI_OUT_1 ;unsigned int main_input_format;unsigned int yuv_input_format;
@@ -637,10 +648,10 @@ static int tegra20_vip_start_streaming(struct tegra_vip_channel *vip_chan) GENMASK(9, 2) << VI_DATA_INPUT_SFT);tegra20_vi_write (vi_chan,TEGRA_VI_PIN_INVERSION ,0 ); -tegra20_vi_write (vi_chan,TEGRA_VI_CONT_SYNCPT_OUT_1 , -VI_CONT_SYNCPT_OUT_1_CONTINUOUS_SYNCPT | +tegra20_vi_write (vi_chan,TEGRA_VI_CONT_SYNCPT_OUT (output_channel), +VI_CONT_SYNCPT_OUT_CONTINUOUS_SYNCPT |host1x_syncpt_id (vi_chan->mw_ack_sp[0 ]) - <<VI_CONT_SYNCPT_OUT_1_SYNCPT_IDX_SFT ); + <<VI_CONT_SYNCPT_OUT_SYNCPT_IDX_SFT );tegra20_vi_write (vi_chan,TEGRA_VI_CAMERA_CONTROL ,VI_CAMERA_CONTROL_STOP_CAPTURE );
Signature · 1 line
2.48.1
PATCH v5 16/23 staging: media: tegra-video: tegra20: adjust format align calculations
In reply to Svyatoslav RyhelExpand supported formats structure with data_type and bit_width fields required for CSI support. Adjust tegra20_fmt_align by factoring out common bytesperline and sizeimage calculation logic shared by supported planar and non-planar formats and leaving planar-related correction under a switch.
--- drivers/staging/media/tegra-video/tegra20.c | 39 ++++++++++----------- 1 file changed, 19 insertions(+), 20 deletions(-)
drivers/staging/media/tegra-video/tegra20.c +19 -20
@@ -280,18 +280,13 @@ static void tegra20_fmt_align(struct v4l2_pix_format *pix, unsigned int bpp) pix->width =clamp (pix->width,TEGRA20_MIN_WIDTH ,TEGRA20_MAX_WIDTH ); pix->height =clamp (pix->height,TEGRA20_MIN_HEIGHT ,TEGRA20_MAX_HEIGHT ); + pix->bytesperline =roundup (pix->width,8 ) * bpp; + pix->sizeimage = pix->bytesperline * pix->height; +switch (pix->pixelformat) { -case V4L2_PIX_FMT_UYVY : -case V4L2_PIX_FMT_VYUY : -case V4L2_PIX_FMT_YUYV : -case V4L2_PIX_FMT_YVYU : - pix->bytesperline =roundup (pix->width,2 ) *2 ; - pix->sizeimage =roundup (pix->width,2 ) *2 * pix->height; -break ;case V4L2_PIX_FMT_YUV420 :case V4L2_PIX_FMT_YVU420 : - pix->bytesperline =roundup (pix->width,8 ); - pix->sizeimage =roundup (pix->width,8 ) * pix->height *3 /2 ; + pix->sizeimage = pix->sizeimage *3 /2 ;break ; } }
@@ -576,20 +571,24 @@ static const struct tegra_vi_ops tegra20_vi_ops = { .vi_stop_streaming = tegra20_vi_stop_streaming, }; -#define TEGRA20_VIDEO_FMT (MBUS_CODE ,BPP ,FOURCC ) \ -{ \ - .code = MEDIA_BUS_FMT_##MBUS_CODE, \ - .bpp = BPP, \ - .fourcc = V4L2_PIX_FMT_##FOURCC, \ +#define TEGRA20_VIDEO_FMT (DATA_TYPE ,BIT_WIDTH ,MBUS_CODE ,BPP ,FOURCC ) \ +{ \ + .img_dt = TEGRA_IMAGE_DT_##DATA_TYPE, \ + .bit_width = BIT_WIDTH, \ + .code = MEDIA_BUS_FMT_##MBUS_CODE, \ + .bpp = BPP, \ + .fourcc = V4L2_PIX_FMT_##FOURCC, \ }static const struct tegra_video_format tegra20_video_formats[] = { -TEGRA20_VIDEO_FMT (UYVY8_2X8 ,2 ,UYVY ), -TEGRA20_VIDEO_FMT (VYUY8_2X8 ,2 ,VYUY ), -TEGRA20_VIDEO_FMT (YUYV8_2X8 ,2 ,YUYV ), -TEGRA20_VIDEO_FMT (YVYU8_2X8 ,2 ,YVYU ), -TEGRA20_VIDEO_FMT (UYVY8_2X8 ,1 ,YUV420 ), -TEGRA20_VIDEO_FMT (UYVY8_2X8 ,1 ,YVU420 ), +/* YUV422 */ +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_2X8 ,2 ,UYVY ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,VYUY8_2X8 ,2 ,VYUY ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,YUYV8_2X8 ,2 ,YUYV ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,YVYU8_2X8 ,2 ,YVYU ), +/* YUV420P */ +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_2X8 ,1 ,YUV420 ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_2X8 ,1 ,YVU420 ), };const struct tegra_vi_soc tegra20_vi_soc = {
Signature · 1 line
2.48.1
PATCH v5 17/23 staging: media: tegra-video: tegra20: set VI HW revision
In reply to Svyatoslav RyhelAccording to TRM Tegra20, Tegra30 and Tegra114 have VI revision 1, Tegra124 has revision 2 and Tegra210 has revision 3. Set correct revision in tegra20_vi_soc like tegra210 does.
--- drivers/staging/media/tegra-video/tegra20.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/tegra-video/tegra20.c +1 -0
@@ -596,6 +596,7 @@ const struct tegra_vi_soc tegra20_vi_soc = { .nformats = ARRAY_SIZE(tegra20_video_formats), .default_video_format = &tegra20_video_formats[0], .ops = &tegra20_vi_ops, + .hw_revision = 1, .vi_max_channels = 2, /* TEGRA_VI_OUT_1 and TEGRA_VI_OUT_2 */ .vi_max_clk_hz = 150000000, .has_h_v_flip = true,
Signature · 1 line
2.48.1
PATCH v5 18/23 staging: media: tegra-video: tegra20: increase maximum VI clock frequency
In reply to Svyatoslav RyhelIncrease maximum VI clock frequency to 450MHz to allow correct work with high resolution camera sensors.
--- drivers/staging/media/tegra-video/tegra20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/tegra-video/tegra20.c +1 -1
@@ -598,7 +598,7 @@ const struct tegra_vi_soc tegra20_vi_soc = { .ops = &tegra20_vi_ops, .hw_revision = 1, .vi_max_channels = 2, /* TEGRA_VI_OUT_1 and TEGRA_VI_OUT_2 */ - .vi_max_clk_hz = 150000000, + .vi_max_clk_hz = 450000000, .has_h_v_flip = true, };
Signature · 1 line
2.48.1
PATCH v5 19/23 staging: media: tegra-video: tegra20: expand format support with RAW8/10 and YUV422/YUV420p 1X16
In reply to Svyatoslav RyhelAdd support for Bayer formats (RAW8 and RAW10) and YUV422/420p 1X16 versions of existing YUV422/YUV420p 2X8.
--- drivers/staging/media/tegra-video/tegra20.c | 74 ++++++++++++++++++++- 1 file changed, 71 insertions(+), 3 deletions(-)
drivers/staging/media/tegra-video/tegra20.c +71 -3
@@ -187,6 +187,18 @@ static void tegra20_vi_get_input_formats(struct tegra_vi_channel *chan,case MEDIA_BUS_FMT_YVYU8_2X8 : (*yuv_input_format) =VI_INPUT_YUV_INPUT_FORMAT_YVYU ;break ; +/* RAW8 */ +case MEDIA_BUS_FMT_SBGGR8_1X8 : +case MEDIA_BUS_FMT_SGBRG8_1X8 : +case MEDIA_BUS_FMT_SGRBG8_1X8 : +case MEDIA_BUS_FMT_SRGGB8_1X8 : +/* RAW10 */ +case MEDIA_BUS_FMT_SBGGR10_1X10 : +case MEDIA_BUS_FMT_SGBRG10_1X10 : +case MEDIA_BUS_FMT_SGRBG10_1X10 : +case MEDIA_BUS_FMT_SRGGB10_1X10 : + (*main_input_format) =VI_INPUT_INPUT_FORMAT_BAYER ; +break ; } }
@@ -221,6 +233,18 @@ static void tegra20_vi_get_output_formats(struct tegra_vi_channel *chan,case V4L2_PIX_FMT_YVU420 : (*main_output_format) =VI_OUTPUT_OUTPUT_FORMAT_YUV420PLANAR ;break ; +/* RAW8 */ +case V4L2_PIX_FMT_SBGGR8 : +case V4L2_PIX_FMT_SGBRG8 : +case V4L2_PIX_FMT_SGRBG8 : +case V4L2_PIX_FMT_SRGGB8 : +/* RAW10 */ +case V4L2_PIX_FMT_SBGGR10 : +case V4L2_PIX_FMT_SGBRG10 : +case V4L2_PIX_FMT_SGRBG10 : +case V4L2_PIX_FMT_SRGGB10 : + (*main_output_format) =VI_OUTPUT_OUTPUT_FORMAT_VIP_BAYER_DIRECT ; +break ; } }
@@ -308,6 +332,16 @@ static void tegra20_channel_queue_setup(struct tegra_vi_channel *chan)case V4L2_PIX_FMT_VYUY :case V4L2_PIX_FMT_YUYV :case V4L2_PIX_FMT_YVYU : +/* RAW8 */ +case V4L2_PIX_FMT_SRGGB8 : +case V4L2_PIX_FMT_SGRBG8 : +case V4L2_PIX_FMT_SGBRG8 : +case V4L2_PIX_FMT_SBGGR8 : +/* RAW10 */ +case V4L2_PIX_FMT_SRGGB10 : +case V4L2_PIX_FMT_SGRBG10 : +case V4L2_PIX_FMT_SGBRG10 : +case V4L2_PIX_FMT_SBGGR10 :if (chan->vflip) chan->start_offset += stride * (height -1 );if (chan->hflip)
@@ -373,6 +407,19 @@ static void tegra20_channel_vi_buffer_setup(struct tegra_vi_channel *chan,tegra20_vi_write (chan,TEGRA_VI_VB0_BASE_ADDRESS (TEGRA_VI_OUT_1 ), base);tegra20_vi_write (chan,TEGRA_VI_VB0_START_ADDRESS (TEGRA_VI_OUT_1 ), base + chan->start_offset);break ; +/* RAW8 */ +case V4L2_PIX_FMT_SRGGB8 : +case V4L2_PIX_FMT_SGRBG8 : +case V4L2_PIX_FMT_SGBRG8 : +case V4L2_PIX_FMT_SBGGR8 : +/* RAW10 */ +case V4L2_PIX_FMT_SRGGB10 : +case V4L2_PIX_FMT_SGRBG10 : +case V4L2_PIX_FMT_SGBRG10 : +case V4L2_PIX_FMT_SBGGR10 : +tegra20_vi_write (chan,TEGRA_VI_VB0_BASE_ADDRESS (TEGRA_VI_OUT_2 ), base); +tegra20_vi_write (chan,TEGRA_VI_VB0_START_ADDRESS (TEGRA_VI_OUT_2 ), base + chan->start_offset); +break ; } }
@@ -454,12 +501,15 @@ static int tegra20_chan_capture_kthread_start(void *data)static void tegra20_camera_capture_setup (struct tegra_vi_channel *chan) {u32 output_fourcc = chan->format.pixelformat; +u32 data_type = chan->fmtinfo->img_dt;int width = chan->format.width;int height = chan->format.height;int stride_l = chan->format.bytesperline;int stride_c = (output_fourcc ==V4L2_PIX_FMT_YUV420 || output_fourcc ==V4L2_PIX_FMT_YVU420 ) ?1 :0 ; -enum tegra_vi_out output_channel =TEGRA_VI_OUT_1 ; +enum tegra_vi_out output_channel = (data_type ==TEGRA_IMAGE_DT_RAW8 || + data_type ==TEGRA_IMAGE_DT_RAW10 ) ? +TEGRA_VI_OUT_2 :TEGRA_VI_OUT_1 ;int main_output_format;int yuv_output_format;
@@ -586,9 +636,25 @@ static const struct tegra_video_format tegra20_video_formats[] = {TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,VYUY8_2X8 ,2 ,VYUY ),TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,YUYV8_2X8 ,2 ,YUYV ),TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,YVYU8_2X8 ,2 ,YVYU ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_1X16 ,2 ,UYVY ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,VYUY8_1X16 ,2 ,VYUY ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,YUYV8_1X16 ,2 ,YUYV ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,YVYU8_1X16 ,2 ,YVYU ),/* YUV420P */ TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_2X8 ,1 ,YUV420 ),TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_2X8 ,1 ,YVU420 ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_1X16 ,1 ,YUV420 ), +TEGRA20_VIDEO_FMT (YUV422_8 ,16 ,UYVY8_1X16 ,1 ,YVU420 ), +/* RAW 8 */ +TEGRA20_VIDEO_FMT (RAW8 ,8 ,SRGGB8_1X8 ,2 ,SRGGB8 ), +TEGRA20_VIDEO_FMT (RAW8 ,8 ,SGRBG8_1X8 ,2 ,SGRBG8 ), +TEGRA20_VIDEO_FMT (RAW8 ,8 ,SGBRG8_1X8 ,2 ,SGBRG8 ), +TEGRA20_VIDEO_FMT (RAW8 ,8 ,SBGGR8_1X8 ,2 ,SBGGR8 ), +/* RAW 10 */ +TEGRA20_VIDEO_FMT (RAW10 ,10 ,SRGGB10_1X10 ,2 ,SRGGB10 ), +TEGRA20_VIDEO_FMT (RAW10 ,10 ,SGRBG10_1X10 ,2 ,SGRBG10 ), +TEGRA20_VIDEO_FMT (RAW10 ,10 ,SGBRG10_1X10 ,2 ,SGBRG10 ), + TEGRA20_VIDEO_FMT(RAW10, 10, SBGGR10_1X10, 2, SBGGR10), }; const struct tegra_vi_soc tegra20_vi_soc = {
@@ -615,10 +681,12 @@ const struct tegra_vi_soc tegra20_vi_soc = {static int tegra20_vip_start_streaming (struct tegra_vip_channel *vip_chan) {struct tegra_vi_channel *vi_chan =v4l2_get_subdev_hostdata (&vip_chan->subdev); +u32 data_type = vi_chan->fmtinfo->img_dt;int width = vi_chan->format.width;int height = vi_chan->format.height; -enum tegra_vi_out output_channel =TEGRA_VI_OUT_1 ; - +enum tegra_vi_out output_channel = (data_type ==TEGRA_IMAGE_DT_RAW8 || + data_type ==TEGRA_IMAGE_DT_RAW10 ) ? +TEGRA_VI_OUT_2 :TEGRA_VI_OUT_1 ;unsigned int main_input_format;unsigned int yuv_input_format;
Signature · 1 line
2.48.1
PATCH v5 20/23 staging: media: tegra-video: tegra20: adjust luma buffer stride
In reply to Svyatoslav RyhelLuma buffer stride is calculated by multiplying height in pixels of image by bytes per line. Adjust that value accordingly.
--- drivers/staging/media/tegra-video/tegra20.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/tegra-video/tegra20.c +1 -1
@@ -504,7 +504,7 @@ static void tegra20_camera_capture_setup(struct tegra_vi_channel *chan)u32 data_type = chan->fmtinfo->img_dt;int width = chan->format.width;int height = chan->format.height; -int stride_l = chan->format.bytesperline; +int stride_l = chan->format.bytesperline * height;int stride_c = (output_fourcc ==V4L2_PIX_FMT_YUV420 || output_fourcc ==V4L2_PIX_FMT_YVU420 ) ?1 :0 ; enum tegra_vi_out output_channel = (data_type == TEGRA_IMAGE_DT_RAW8 ||
Signature · 1 line
2.48.1
Hi Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Other than patch 06/23 that looked iffy (although the original code was iffy as already), for which I posted a review, this series looks almost ready.
Should the clk patches be merged together with the media patches? Or can those go in via the clk subsystem? If it is the latter, then I'll need an Acked-by from the clk subsystem maintainer.
Regarding the bindings: all except 21/23 are Acked.
I have one question regarding testing: in the past I tested this driver with a Jetson TX1 devkit and a camera sensor. One of the main reasons this driver is still in staging is that I never got that to work reliably: after 10-30 minutes it would lose sync and streaming would stop.
Unfortunately I never had the time to dig deeper into that.
So have you tested this with a camera sensor? And if so, does it stream reliably? I.e. just let it stream for 24 hours and see if that works.
If it is reliable for you, then I think this driver should be moved to drivers/media.
Regards,
Hans
Quoted 114 lines
---
Changes in v2:
-vi_sensorgated through csus
-TEGRA30_CLK_CLK_MAXmoved to clk-tegra30
- adjusted commit titles and messages
-clk_register_clkdevdropped from pad clock registration
- removed tegra30-vi/vip and used tegra20 fallback
- added separate csi schema for tegra20-csi and tegra30-csi
- fixet number of VI channels
- adjustedtegra_vi_outnaming
- fixedyuv_input_formattomain_input_format
- MIPI calibration refsctored for Tegra114+ and added support for pre-Tegra114 to use CSI as a MIPI calibration device
- switched ENOMEM to EBUSY
- added check intotegra_channel_get_remote_csi_subdev
- moved avdd-dsi-csi-supply into CSI
-next_fs_sp_idx>next_fs_sp_value
- removedhost1x_syncpt_incrfrom framecounted syncpoint
- csi subdev request moved before frame cycleChanges in v3:
- tegra20 and tegra30 csi schema merged
- removed unneeded properties and requirements from schema
- improved vendor specific properties description
- added tegra20 csus parent mux
- improved commit descriptions
- redesigned MIPI-calibration to expose less SoC related data into header
- commit "staging: media: tegra-video: csi: add support for SoCs with integrated MIPI calibration" dropped as unneeded
- improvedtegra_channel_get_remote_device_subdevlogic
- avdd-dsi-csi-supply moved from vi to csi for p2597 and p3450-0000
- software syncpoint counters switched to direct reading
- adjusted planar formats offset calculationChanges in v4:
- removed ifdefs fromtegra_mipi_driver
- document Tegra132 MIPI calibration device
- switched to use BIT macro in tegra114-mipi
- pinctrl changes moved to a separate patch
- ERESTARTSYS workaround preserved for now
-tegra_mipi_add_providerreplaced withdevm_tegra_mipi_add_provider
- reworked bytesperline and sizeimage calculaionChanges in v5:
- dropped patch 1/24 of v4 since it was picked to pinctrl tree
- added reasoning for tegra132 comaptible into commit desctiption
- moved clocks into common section in tegra20-csi schema
- added note regarding ERESTARTSYS
---Svyatoslav Ryhel (23):
clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 andTegra114 dt-bindings: clock: tegra30: Add IDs for CSI pad clocks clk: tegra30: add CSI pad clock gates dt-bindings: display: tegra: document Tegra30 VI and VIP staging: media: tegra-video: expand VI and VIP support to Tegra30 staging: media: tegra-video: vi: adjust get_selection op check staging: media: tegra-video: vi: add flip controls only if no source controls are provided staging: media: tegra-video: csi: move CSI helpers to header gpu: host1x: convert MIPI to use operation function pointers dt-bindings: display: tegra: document Tegra132 MIPI calibration device staging: media: tegra-video: vi: improve logic of source requesting staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to CSI arm64: tegra: move avdd-dsi-csi-supply into CSI node staging: media: tegra-video: tegra20: set correct maximum width and height staging: media: tegra-video: tegra20: add support for second output of VI staging: media: tegra-video: tegra20: adjust format align calculations staging: media: tegra-video: tegra20: set VI HW revision staging: media: tegra-video: tegra20: increase maximum VI clock frequency staging: media: tegra-video: tegra20: expand format support with RAW8/10 and YUV422/YUV420p 1X16staging: media: tegra-video: tegra20: adjust luma buffer stride
dt-bindings: display: tegra: document Tegra20 and Tegra30 CSI
ARM: tegra: add CSI nodes for Tegra20 and Tegra30
staging: media: tegra-video: add CSI support for Tegra20 and Tegra30.../display/tegra/nvidia,tegra114-mipi.yaml | 1 + .../display/tegra/nvidia,tegra20-csi.yaml | 138 +++ .../display/tegra/nvidia,tegra20-vi.yaml | 19 +- .../display/tegra/nvidia,tegra20-vip.yaml | 9 +- arch/arm/boot/dts/nvidia/tegra20.dtsi | 19 +- arch/arm/boot/dts/nvidia/tegra30.dtsi | 24 +- .../arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 +- .../boot/dts/nvidia/tegra210-p3450-0000.dts | 4 +- drivers/clk/tegra/clk-tegra114.c | 7 +- drivers/clk/tegra/clk-tegra20.c | 20 +- drivers/clk/tegra/clk-tegra30.c | 21 +- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 ++--------- drivers/gpu/host1x/tegra114-mipi.c | 483 +++++++++++ drivers/staging/media/tegra-video/Makefile | 1 + drivers/staging/media/tegra-video/csi.c | 70 +- drivers/staging/media/tegra-video/csi.h | 16 + drivers/staging/media/tegra-video/tegra20.c | 820 +++++++++++++++--- drivers/staging/media/tegra-video/vi.c | 56 +- drivers/staging/media/tegra-video/vi.h | 6 +- drivers/staging/media/tegra-video/video.c | 8 +- drivers/staging/media/tegra-video/vip.c | 4 +- include/dt-bindings/clock/tegra30-car.h | 3 +- include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 ++ 26 files changed, 1657 insertions(+), 670 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-csi.yaml create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
пн, 27 жовт. 2025 р. о 18:08 Hans Verkuil <[email protected]> пише:
Quoted 9 lines
Hi Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Other than patch 06/23 that looked iffy (although the original code was iffy as already), for which I posted a review, this series looks almost ready.
06/23 addresses issue I have encountered while testing with mt9m114 I will add detailed explanation later in the 06/23 commit discussion.
Quoted 5 lines
Should the clk patches be merged together with the media patches? Or can those go in via the clk subsystem? If it is the latter, then I'll need an Acked-by from the clk subsystem maintainer.
I suppose this should be discussed between staging and clk subsystem maintainers I am fine with any conclusion.
Quoted 1 line
Regarding the bindings: all except 21/23 are Acked.
Maybe you did not notice, but 21/23 has reviewed-by from Rob Herring.
Quoted 6 lines
I have one question regarding testing: in the past I tested this driver with a Jetson TX1 devkit and a camera sensor. One of the main reasons this driver is still in staging is that I never got that to work reliably: after 10-30 minutes it would lose sync and streaming would stop.
Quoted 6 lines
Unfortunately I never had the time to dig deeper into that.
So have you tested this with a camera sensor? And if so, does it stream reliably? I.e. just let it stream for 24 hours and see if that works.
If it is reliable for you, then I think this driver should be moved to
drivers/media.
Streaming works but I did not tested for such prolonged periods of time. Scope of this patchset is bringing CSI support for Tegra20/Tegra30, extended testing and move to media can be done in followup.
Quoted 120 lines
Regards,
Hans
Quoted 114 lines
---
Changes in v2:
-vi_sensorgated through csus
-TEGRA30_CLK_CLK_MAXmoved to clk-tegra30
- adjusted commit titles and messages
-clk_register_clkdevdropped from pad clock registration
- removed tegra30-vi/vip and used tegra20 fallback
- added separate csi schema for tegra20-csi and tegra30-csi
- fixet number of VI channels
- adjustedtegra_vi_outnaming
- fixedyuv_input_formattomain_input_format
- MIPI calibration refsctored for Tegra114+ and added support for pre-Tegra114 to use CSI as a MIPI calibration device
- switched ENOMEM to EBUSY
- added check intotegra_channel_get_remote_csi_subdev
- moved avdd-dsi-csi-supply into CSI
-next_fs_sp_idx>next_fs_sp_value
- removedhost1x_syncpt_incrfrom framecounted syncpoint
- csi subdev request moved before frame cycleChanges in v3:
- tegra20 and tegra30 csi schema merged
- removed unneeded properties and requirements from schema
- improved vendor specific properties description
- added tegra20 csus parent mux
- improved commit descriptions
- redesigned MIPI-calibration to expose less SoC related data into header
- commit "staging: media: tegra-video: csi: add support for SoCs with integrated MIPI calibration" dropped as unneeded
- improvedtegra_channel_get_remote_device_subdevlogic
- avdd-dsi-csi-supply moved from vi to csi for p2597 and p3450-0000
- software syncpoint counters switched to direct reading
- adjusted planar formats offset calculationChanges in v4:
- removed ifdefs fromtegra_mipi_driver
- document Tegra132 MIPI calibration device
- switched to use BIT macro in tegra114-mipi
- pinctrl changes moved to a separate patch
- ERESTARTSYS workaround preserved for now
-tegra_mipi_add_providerreplaced withdevm_tegra_mipi_add_provider
- reworked bytesperline and sizeimage calculaionChanges in v5:
- dropped patch 1/24 of v4 since it was picked to pinctrl tree
- added reasoning for tegra132 comaptible into commit desctiption
- moved clocks into common section in tegra20-csi schema
- added note regarding ERESTARTSYS
---Svyatoslav Ryhel (23):
clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 andTegra114 dt-bindings: clock: tegra30: Add IDs for CSI pad clocks clk: tegra30: add CSI pad clock gates dt-bindings: display: tegra: document Tegra30 VI and VIP staging: media: tegra-video: expand VI and VIP support to Tegra30 staging: media: tegra-video: vi: adjust get_selection op check staging: media: tegra-video: vi: add flip controls only if no source controls are provided staging: media: tegra-video: csi: move CSI helpers to header gpu: host1x: convert MIPI to use operation function pointers dt-bindings: display: tegra: document Tegra132 MIPI calibration device staging: media: tegra-video: vi: improve logic of source requesting staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to CSI arm64: tegra: move avdd-dsi-csi-supply into CSI node staging: media: tegra-video: tegra20: set correct maximum width and height staging: media: tegra-video: tegra20: add support for second output of VI staging: media: tegra-video: tegra20: adjust format align calculations staging: media: tegra-video: tegra20: set VI HW revision staging: media: tegra-video: tegra20: increase maximum VI clock frequency staging: media: tegra-video: tegra20: expand format support with RAW8/10 and YUV422/YUV420p 1X16staging: media: tegra-video: tegra20: adjust luma buffer stride
dt-bindings: display: tegra: document Tegra20 and Tegra30 CSI
ARM: tegra: add CSI nodes for Tegra20 and Tegra30
staging: media: tegra-video: add CSI support for Tegra20 and Tegra30.../display/tegra/nvidia,tegra114-mipi.yaml | 1 + .../display/tegra/nvidia,tegra20-csi.yaml | 138 +++ .../display/tegra/nvidia,tegra20-vi.yaml | 19 +- .../display/tegra/nvidia,tegra20-vip.yaml | 9 +- arch/arm/boot/dts/nvidia/tegra20.dtsi | 19 +- arch/arm/boot/dts/nvidia/tegra30.dtsi | 24 +- .../arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 +- .../boot/dts/nvidia/tegra210-p3450-0000.dts | 4 +- drivers/clk/tegra/clk-tegra114.c | 7 +- drivers/clk/tegra/clk-tegra20.c | 20 +- drivers/clk/tegra/clk-tegra30.c | 21 +- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 ++--------- drivers/gpu/host1x/tegra114-mipi.c | 483 +++++++++++ drivers/staging/media/tegra-video/Makefile | 1 + drivers/staging/media/tegra-video/csi.c | 70 +- drivers/staging/media/tegra-video/csi.h | 16 + drivers/staging/media/tegra-video/tegra20.c | 820 +++++++++++++++--- drivers/staging/media/tegra-video/vi.c | 56 +- drivers/staging/media/tegra-video/vi.h | 6 +- drivers/staging/media/tegra-video/video.c | 8 +- drivers/staging/media/tegra-video/vip.c | 4 +- include/dt-bindings/clock/tegra30-car.h | 3 +- include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 ++ 26 files changed, 1657 insertions(+), 670 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-csi.yaml create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
Quoted 20 lines · Svyatoslav Ryhel
пн, 27 жовт. 2025 р. о 18:08 Hans Verkuil <[email protected]> пише:
Quoted 9 lines
Hi Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Other than patch 06/23 that looked iffy (although the original code was iffy as already), for which I posted a review, this series looks almost ready.
06/23 addresses issue I have encountered while testing with mt9m114 I will add detailed explanation later in the 06/23 commit discussion.
Quoted 5 lines
Should the clk patches be merged together with the media patches? Or can those go in via the clk subsystem? If it is the latter, then I'll need an Acked-by from the clk subsystem maintainer.
Quoted 6 lines
I suppose this should be discussed between staging and clk subsystem maintainers I am fine with any conclusion.
Quoted 1 line
Regarding the bindings: all except 21/23 are Acked.
Maybe you did not notice, but 21/23 has reviewed-by from Rob Herring.
Ah yes, Rob replied. Good.
Quoted 12 lines
Quoted 12 lines
I have one question regarding testing: in the past I tested this driver with a Jetson TX1 devkit and a camera sensor. One of the main reasons this driver is still in staging is that I never got that to work reliably: after 10-30 minutes it would lose sync and streaming would stop.
Unfortunately I never had the time to dig deeper into that.
So have you tested this with a camera sensor? And if so, does it stream reliably? I.e. just let it stream for 24 hours and see if that works.
Quoted 6 lines
Quoted 1 line
If it is reliable for you, then I think this driver should be moved to
drivers/media.Streaming works but I did not tested for such prolonged periods of time. Scope of this patchset is bringing CSI support for Tegra20/Tegra30, extended testing and move to media can be done in followup.
I'd really appreciate it if you can do a duration test. Perhaps start streaming on Friday and let it run for the weekend?
Regards,
Hans
Quoted 121 lines
Quoted 121 lines
Regards,
Hans
Quoted 114 lines
---
Changes in v2:
-vi_sensorgated through csus
-TEGRA30_CLK_CLK_MAXmoved to clk-tegra30
- adjusted commit titles and messages
-clk_register_clkdevdropped from pad clock registration
- removed tegra30-vi/vip and used tegra20 fallback
- added separate csi schema for tegra20-csi and tegra30-csi
- fixet number of VI channels
- adjustedtegra_vi_outnaming
- fixedyuv_input_formattomain_input_format
- MIPI calibration refsctored for Tegra114+ and added support for pre-Tegra114 to use CSI as a MIPI calibration device
- switched ENOMEM to EBUSY
- added check intotegra_channel_get_remote_csi_subdev
- moved avdd-dsi-csi-supply into CSI
-next_fs_sp_idx>next_fs_sp_value
- removedhost1x_syncpt_incrfrom framecounted syncpoint
- csi subdev request moved before frame cycleChanges in v3:
- tegra20 and tegra30 csi schema merged
- removed unneeded properties and requirements from schema
- improved vendor specific properties description
- added tegra20 csus parent mux
- improved commit descriptions
- redesigned MIPI-calibration to expose less SoC related data into header
- commit "staging: media: tegra-video: csi: add support for SoCs with integrated MIPI calibration" dropped as unneeded
- improvedtegra_channel_get_remote_device_subdevlogic
- avdd-dsi-csi-supply moved from vi to csi for p2597 and p3450-0000
- software syncpoint counters switched to direct reading
- adjusted planar formats offset calculationChanges in v4:
- removed ifdefs fromtegra_mipi_driver
- document Tegra132 MIPI calibration device
- switched to use BIT macro in tegra114-mipi
- pinctrl changes moved to a separate patch
- ERESTARTSYS workaround preserved for now
-tegra_mipi_add_providerreplaced withdevm_tegra_mipi_add_provider
- reworked bytesperline and sizeimage calculaionChanges in v5:
- dropped patch 1/24 of v4 since it was picked to pinctrl tree
- added reasoning for tegra132 comaptible into commit desctiption
- moved clocks into common section in tegra20-csi schema
- added note regarding ERESTARTSYS
---Svyatoslav Ryhel (23):
clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 andTegra114 dt-bindings: clock: tegra30: Add IDs for CSI pad clocks clk: tegra30: add CSI pad clock gates dt-bindings: display: tegra: document Tegra30 VI and VIP staging: media: tegra-video: expand VI and VIP support to Tegra30 staging: media: tegra-video: vi: adjust get_selection op check staging: media: tegra-video: vi: add flip controls only if no source controls are provided staging: media: tegra-video: csi: move CSI helpers to header gpu: host1x: convert MIPI to use operation function pointers dt-bindings: display: tegra: document Tegra132 MIPI calibration device staging: media: tegra-video: vi: improve logic of source requesting staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to CSI arm64: tegra: move avdd-dsi-csi-supply into CSI node staging: media: tegra-video: tegra20: set correct maximum width and height staging: media: tegra-video: tegra20: add support for second output of VI staging: media: tegra-video: tegra20: adjust format align calculations staging: media: tegra-video: tegra20: set VI HW revision staging: media: tegra-video: tegra20: increase maximum VI clock frequency staging: media: tegra-video: tegra20: expand format support with RAW8/10 and YUV422/YUV420p 1X16staging: media: tegra-video: tegra20: adjust luma buffer stride
dt-bindings: display: tegra: document Tegra20 and Tegra30 CSI
ARM: tegra: add CSI nodes for Tegra20 and Tegra30
staging: media: tegra-video: add CSI support for Tegra20 and Tegra30.../display/tegra/nvidia,tegra114-mipi.yaml | 1 + .../display/tegra/nvidia,tegra20-csi.yaml | 138 +++ .../display/tegra/nvidia,tegra20-vi.yaml | 19 +- .../display/tegra/nvidia,tegra20-vip.yaml | 9 +- arch/arm/boot/dts/nvidia/tegra20.dtsi | 19 +- arch/arm/boot/dts/nvidia/tegra30.dtsi | 24 +- .../arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 +- .../boot/dts/nvidia/tegra210-p3450-0000.dts | 4 +- drivers/clk/tegra/clk-tegra114.c | 7 +- drivers/clk/tegra/clk-tegra20.c | 20 +- drivers/clk/tegra/clk-tegra30.c | 21 +- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 ++--------- drivers/gpu/host1x/tegra114-mipi.c | 483 +++++++++++ drivers/staging/media/tegra-video/Makefile | 1 + drivers/staging/media/tegra-video/csi.c | 70 +- drivers/staging/media/tegra-video/csi.h | 16 + drivers/staging/media/tegra-video/tegra20.c | 820 +++++++++++++++--- drivers/staging/media/tegra-video/vi.c | 56 +- drivers/staging/media/tegra-video/vi.h | 6 +- drivers/staging/media/tegra-video/video.c | 8 +- drivers/staging/media/tegra-video/vip.c | 4 +- include/dt-bindings/clock/tegra30-car.h | 3 +- include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 ++ 26 files changed, 1657 insertions(+), 670 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-csi.yaml create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
пн, 27 жовт. 2025 р. о 18:30 Hans Verkuil <[email protected]> пише:
Quoted 45 lines · Svyatoslav Ryhel
Quoted 20 lines
пн, 27 жовт. 2025 р. о 18:08 Hans Verkuil <[email protected]> пише:
Quoted 9 lines
Hi Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Other than patch 06/23 that looked iffy (although the original code was iffy as already), for which I posted a review, this series looks almost ready.
06/23 addresses issue I have encountered while testing with mt9m114 I will add detailed explanation later in the 06/23 commit discussion.
Quoted 5 lines
Should the clk patches be merged together with the media patches? Or can those go in via the clk subsystem? If it is the latter, then I'll need an Acked-by from the clk subsystem maintainer.
Quoted 6 lines
I suppose this should be discussed between staging and clk subsystem maintainers I am fine with any conclusion.
Quoted 1 line
Regarding the bindings: all except 21/23 are Acked.
Maybe you did not notice, but 21/23 has reviewed-by from Rob Herring.
Ah yes, Rob replied. Good.
Quoted 14 lines
Quoted 13 lines
I have one question regarding testing: in the past I tested this driver with a Jetson TX1 devkit and a camera sensor. One of the main reasons this driver is still in staging is that I never got that to work reliably: after 10-30 minutes it would lose sync and streaming would stop.
Unfortunately I never had the time to dig deeper into that.
So have you tested this with a camera sensor? And if so, does it stream reliably? I.e. just let it stream for 24 hours and see if that works.
If it is reliable for you, then I think this driver should be moved to
drivers/media.
Quoted 7 lines
Quoted 4 lines
Streaming works but I did not tested for such prolonged periods of time. Scope of this patchset is bringing CSI support for Tegra20/Tegra30, extended testing and move to media can be done in followup.
I'd really appreciate it if you can do a duration test. Perhaps start streaming on Friday and let it run for the weekend?
With all do respect this will not happen any time soon.
Quoted 126 lines
Regards,
Hans
Quoted 121 lines
Quoted 121 lines
Regards,
Hans
Quoted 114 lines
---
Changes in v2:
-vi_sensorgated through csus
-TEGRA30_CLK_CLK_MAXmoved to clk-tegra30
- adjusted commit titles and messages
-clk_register_clkdevdropped from pad clock registration
- removed tegra30-vi/vip and used tegra20 fallback
- added separate csi schema for tegra20-csi and tegra30-csi
- fixet number of VI channels
- adjustedtegra_vi_outnaming
- fixedyuv_input_formattomain_input_format
- MIPI calibration refsctored for Tegra114+ and added support for pre-Tegra114 to use CSI as a MIPI calibration device
- switched ENOMEM to EBUSY
- added check intotegra_channel_get_remote_csi_subdev
- moved avdd-dsi-csi-supply into CSI
-next_fs_sp_idx>next_fs_sp_value
- removedhost1x_syncpt_incrfrom framecounted syncpoint
- csi subdev request moved before frame cycleChanges in v3:
- tegra20 and tegra30 csi schema merged
- removed unneeded properties and requirements from schema
- improved vendor specific properties description
- added tegra20 csus parent mux
- improved commit descriptions
- redesigned MIPI-calibration to expose less SoC related data into header
- commit "staging: media: tegra-video: csi: add support for SoCs with integrated MIPI calibration" dropped as unneeded
- improvedtegra_channel_get_remote_device_subdevlogic
- avdd-dsi-csi-supply moved from vi to csi for p2597 and p3450-0000
- software syncpoint counters switched to direct reading
- adjusted planar formats offset calculationChanges in v4:
- removed ifdefs fromtegra_mipi_driver
- document Tegra132 MIPI calibration device
- switched to use BIT macro in tegra114-mipi
- pinctrl changes moved to a separate patch
- ERESTARTSYS workaround preserved for now
-tegra_mipi_add_providerreplaced withdevm_tegra_mipi_add_provider
- reworked bytesperline and sizeimage calculaionChanges in v5:
- dropped patch 1/24 of v4 since it was picked to pinctrl tree
- added reasoning for tegra132 comaptible into commit desctiption
- moved clocks into common section in tegra20-csi schema
- added note regarding ERESTARTSYS
---Svyatoslav Ryhel (23):
clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 andTegra114 dt-bindings: clock: tegra30: Add IDs for CSI pad clocks clk: tegra30: add CSI pad clock gates dt-bindings: display: tegra: document Tegra30 VI and VIP staging: media: tegra-video: expand VI and VIP support to Tegra30 staging: media: tegra-video: vi: adjust get_selection op check staging: media: tegra-video: vi: add flip controls only if no source controls are provided staging: media: tegra-video: csi: move CSI helpers to header gpu: host1x: convert MIPI to use operation function pointers dt-bindings: display: tegra: document Tegra132 MIPI calibration device staging: media: tegra-video: vi: improve logic of source requesting staging: media: tegra-video: csi: move avdd-dsi-csi-supply from VI to CSI arm64: tegra: move avdd-dsi-csi-supply into CSI node staging: media: tegra-video: tegra20: set correct maximum width and height staging: media: tegra-video: tegra20: add support for second output of VI staging: media: tegra-video: tegra20: adjust format align calculations staging: media: tegra-video: tegra20: set VI HW revision staging: media: tegra-video: tegra20: increase maximum VI clock frequency staging: media: tegra-video: tegra20: expand format support with RAW8/10 and YUV422/YUV420p 1X16staging: media: tegra-video: tegra20: adjust luma buffer stride
dt-bindings: display: tegra: document Tegra20 and Tegra30 CSI
ARM: tegra: add CSI nodes for Tegra20 and Tegra30
staging: media: tegra-video: add CSI support for Tegra20 and Tegra30.../display/tegra/nvidia,tegra114-mipi.yaml | 1 + .../display/tegra/nvidia,tegra20-csi.yaml | 138 +++ .../display/tegra/nvidia,tegra20-vi.yaml | 19 +- .../display/tegra/nvidia,tegra20-vip.yaml | 9 +- arch/arm/boot/dts/nvidia/tegra20.dtsi | 19 +- arch/arm/boot/dts/nvidia/tegra30.dtsi | 24 +- .../arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 4 +- .../boot/dts/nvidia/tegra210-p3450-0000.dts | 4 +- drivers/clk/tegra/clk-tegra114.c | 7 +- drivers/clk/tegra/clk-tegra20.c | 20 +- drivers/clk/tegra/clk-tegra30.c | 21 +- drivers/gpu/drm/tegra/dsi.c | 1 + drivers/gpu/host1x/Makefile | 1 + drivers/gpu/host1x/mipi.c | 525 ++--------- drivers/gpu/host1x/tegra114-mipi.c | 483 +++++++++++ drivers/staging/media/tegra-video/Makefile | 1 + drivers/staging/media/tegra-video/csi.c | 70 +- drivers/staging/media/tegra-video/csi.h | 16 + drivers/staging/media/tegra-video/tegra20.c | 820 +++++++++++++++--- drivers/staging/media/tegra-video/vi.c | 56 +- drivers/staging/media/tegra-video/vi.h | 6 +- drivers/staging/media/tegra-video/video.c | 8 +- drivers/staging/media/tegra-video/vip.c | 4 +- include/dt-bindings/clock/tegra30-car.h | 3 +- include/linux/host1x.h | 10 - include/linux/tegra-mipi-cal.h | 57 ++ 26 files changed, 1657 insertions(+), 670 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/tegra/nvidia,tegra20-csi.yaml create mode 100644 drivers/gpu/host1x/tegra114-mipi.c create mode 100644 include/linux/tegra-mipi-cal.h
Hello Svyatoslav,
Quoted 2 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Whole v5 series (including patches 21-23):
As you seem to have issues with sending a long series over e-mail, I may suggest looking at b4 [0] for the future. It automates many boring and repetitive tasks in handling a patch series, and also offers a way to send e-mails when an SMTP server is problematic e.g. due to limitations in e-mails per hour.
[0] https://b4.docs.kernel.org
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Thierry Reding
AppliedRe: (subset) [PATCH v5 00/23] tegra-video: add CSI support for Tegra20 and Tegra30
In reply to Svyatoslav RyhelFrom: Thierry Reding <[email protected]>
Quoted 3 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Applied, thanks!
[10/23] dt-bindings: display: tegra: document Tegra132 MIPI calibration device
commit: d6e8b796d0d67699c74ee3cbc46601cf9ec925bb
Best regards,
Signature · 1 line
Thierry Reding <[email protected]>
Thierry Reding
AppliedRe: (subset) [PATCH v5 00/23] tegra-video: add CSI support for Tegra20 and Tegra30
In reply to Svyatoslav RyhelFrom: Thierry Reding <[email protected]>
Quoted 3 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Applied, thanks!
[04/23] dt-bindings: display: tegra: document Tegra30 VI and VIP
commit: d262d030baef287da33344a932639aab5f913c3a
Best regards,
Signature · 1 line
Thierry Reding <[email protected]>
Thierry Reding
AppliedRe: (subset) [PATCH v5 00/23] tegra-video: add CSI support for Tegra20 and Tegra30
In reply to Svyatoslav RyhelFrom: Thierry Reding <[email protected]>
Quoted 3 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Applied, thanks!
[01/23] clk: tegra: set CSUS as vi_sensor's gate for Tegra20, Tegra30 and Tegra114
(no commit info)
Best regards,
Signature · 1 line
Thierry Reding <[email protected]>
Thierry Reding
AppliedRe: (subset) [PATCH v5 00/23] tegra-video: add CSI support for Tegra20 and Tegra30
In reply to Svyatoslav RyhelFrom: Thierry Reding <[email protected]>
Quoted 3 lines · Svyatoslav Ryhel
Add support for MIPI CSI device found in Tegra20 and Tegra30 SoC along with a set of changes required for that.
Applied, thanks!
[03/23] clk: tegra30: add CSI pad clock gates
(no commit info)
Best regards,
Signature · 1 line
Thierry Reding <[email protected]>