Rockchip ISP Driver
Subsystems (3)
v12 cover Rockchip ISP Driver
Hi,
This patchset adds support for the Image signal processor unit version 1.0 of the Rockchip RK3399 SoC in the staging tree.
There are still some missing things to move it from staging (please, see TODO file), but the driver is already being used by several people (libcamera, for instance, already supports an older version of the driver) and adding in staging make the work flow easier for collaboration within the community.
I plan to be actively working on the driver to move it out of staging asap.
It is also available at
https://gitlab.collabora.com/koike/linux/tree/rockchip/isp/v12
NOTE: This series only touches MAINTAINERS file and drivers/staging/
Major changes in V12
--------------------
* Cleanups
For this version of the patchset, several cleanups were made, including renaming functions, variables, structs, enum and files to have the "rkisp1" prefix. Some print and comments were re-written, and several of them that were unecessary were removed.regs.c and all the headers besides rkisp1-common.h were removed. Several unecessary functions were removed, parts of the code were re-written to be readable, reduce indentation, and remove redundant code.
More helper functions from the media core is being used.
Header files were removed, except for rkisp1-common.h and rkisp1-regs.h, there are not that much shared code, keep then in a single place instead of spreading it through several header files, it is easier to navigate. More cleanups are still possible, but at least now we have a more organized and standardized code, which makes it easier to read and to maintain.
* An entry in Debugfs was added to keep track of errors and data loss.
* A new subdevice entity for the resizer was added.
Previously, resizer was being implemented in the capture devices, but since capture devices don't have pad operations, the code was accepting unmatching links between ISP and the capture.
Separating the resizer to it's own entity removed several hacks from the capture, besides simplifying the code, making it easier to read. Cropping was also moved out from the capture to the resizer subdevices. This also changes userspace API (as the topology changed), but now resizing is more explicitly represented instead of hided in the capture.
* Format propagation between pads was fixed.
* Ascii art block diagram to remove the http link reference.
* More items in the TODO file, including reviewing the locks.
* Fix Jacob Chen's email address, keep the original [email protected] email.
* yaml Device Tree bindings: the txt bindings docs got replaced, so it can be verified with make dt_bindings_check and make dtbs_check
NOTE: the changes were focused on the main loop sensor->isp->capture, I almost didn't touch params and stats, mostly because I didn't setup a testing framework yet for those, so they have lots of space for improvements.
Commands output:
----------------
media-ctl -p : http://ix.io/25DG
media-ctl --print-dot: http://col.la/rkisp1v12dot
v4l2-compliance -m0: http://ix.io/25DI
NOTE: there is a failure in v4l2-compliance, but comes from the sensor, not from the ISP.
Testing:
--------
SEN_DEV=/dev/v4l-subdev3
ISP_DEV=/dev/v4l-subdev0
RSZ_SP_DEV=/dev/v4l-subdev2
RSZ_MP_DEV=/dev/v4l-subdev1
CAP_SP_DEV=/dev/video1
CAP_MP_DEV=/dev/video0
WIDTH=1280
HEIGHT=960
v4l2-ctl --set-subdev-fmt pad=0,width=$WIDTH,height=$HEIGHT,code=0x3001 -d $SEN_DEV
v4l2-ctl --set-subdev-fmt pad=0,width=$WIDTH,height=$HEIGHT,code=0x3001 -d $ISP_DEV v4l2-ctl --set-subdev-selection pad=0,target=crop,top=0,left=0,width=$WIDTH,height=$HEIGHT -d $ISP_DEV
v4l2-ctl --set-subdev-selection pad=2,target=crop,top=0,left=0,width=$WIDTH,height=$HEIGHT -d $ISP_DEV v4l2-ctl --set-subdev-fmt pad=2,width=$WIDTH,height=$HEIGHT,code=0x2008 -d $ISP_DEV
v4l2-ctl --set-subdev-fmt pad=0,width=$WIDTH,height=$HEIGHT,code=0x2008 -d $RSZ_SP_DEV v4l2-ctl --set-subdev-fmt pad=1,width=$WIDTH,height=$HEIGHT,code=0x2008 -d $RSZ_SP_DEV
v4l2-ctl --set-subdev-selection pad=0,target=crop,top=0,left=0,width=$WIDTH,height=$HEIGHT -d $RSZ_SP_DEV
v4l2-ctl --set-subdev-fmt pad=0,width=$WIDTH,height=$HEIGHT,code=0x2008 -d $RSZ_MP_DEV v4l2-ctl --set-subdev-fmt pad=1,width=$WIDTH,height=$HEIGHT,code=0x2008 -d $RSZ_MP_DEV
v4l2-ctl --set-subdev-selection pad=0,target=crop,top=0,left=0,width=$WIDTH,height=$HEIGHT -d $RSZ_MP_DEV
v4l2-ctl -v width=$WIDTH,height=$HEIGHT,pixelformat=NV12 -d $CAP_SP_DEV v4l2-ctl -v width=$WIDTH,height=$HEIGHT,pixelformat=NV12 -d $CAP_MP_DEV
v4l2-ctl --stream-mmap --stream-count=100 -d $CAP_SP_DEV --stream-to=/tmp/test_sp.raw v4l2-ctl --stream-mmap --stream-count=100 -d $CAP_MP_DEV --stream-to=/tmp/test_mp.raw
ffplay -loglevel warning -v info -f rawvideo -pixel_format nv12 -video_size "1280x960" tmp/test_sp.raw ffplay -loglevel warning -v info -f rawvideo -pixel_format nv12 -video_size "1280x960" tmp/test_mp.raw
Thanks
Helen
Ezequiel Garcia (1):
media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY
driver
Helen Koike (6):
media: staging: rkisp1: add Rockchip ISP1 base driver
media: staging: rkisp1: add streaming paths
media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
media: staging: rkisp1: add TODO file for staging
MAINTAINERS: add entry for Rockchip ISP1 driver
Jacob Chen (3):
media: staging: rkisp1: add capture device for statistics
media: staging: rkisp1: add output device for parameters
media: staging: rkisp1: add document for rkisp1 meta buffer format
Jeffy Chen (1):
media: staging: rkisp1: add user space ABI definitions
MAINTAINERS | 6 + drivers/staging/media/Kconfig | 4 + drivers/staging/media/Makefile | 2 + .../bindings/phy/rockchip-mipi-dphy.yaml | 75 + .../staging/media/phy-rockchip-dphy/Kconfig | 11 + .../staging/media/phy-rockchip-dphy/Makefile | 2 + drivers/staging/media/phy-rockchip-dphy/TODO | 6 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 396 ++++ .../bindings/media/rockchip-isp1.yaml | 193 ++ .../uapi/v4l/pixfmt-meta-rkisp1-params.rst | 23 + .../uapi/v4l/pixfmt-meta-rkisp1-stat.rst | 22 + drivers/staging/media/rkisp1/Kconfig | 13 + drivers/staging/media/rkisp1/Makefile | 8 + drivers/staging/media/rkisp1/TODO | 23 + drivers/staging/media/rkisp1/rkisp1-capture.c | 1437 +++++++++++++++ drivers/staging/media/rkisp1/rkisp1-common.c | 37 + drivers/staging/media/rkisp1/rkisp1-common.h | 337 ++++ drivers/staging/media/rkisp1/rkisp1-dev.c | 574 ++++++ drivers/staging/media/rkisp1/rkisp1-isp.c | 1164 ++++++++++++ drivers/staging/media/rkisp1/rkisp1-params.c | 1630 +++++++++++++++++ drivers/staging/media/rkisp1/rkisp1-regs.h | 1264 +++++++++++++ drivers/staging/media/rkisp1/rkisp1-resizer.c | 775 ++++++++ drivers/staging/media/rkisp1/rkisp1-stats.c | 530 ++++++ .../staging/media/rkisp1/uapi/rkisp1-config.h | 819 +++++++++ 24 files changed, 9351 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml create mode 100644 drivers/staging/media/phy-rockchip-dphy/Kconfig create mode 100644 drivers/staging/media/phy-rockchip-dphy/Makefile create mode 100644 drivers/staging/media/phy-rockchip-dphy/TODO create mode 100644 drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml create mode 100644 drivers/staging/media/rkisp1/Documentation/media/uapi/v4l/pixfmt-meta-rkisp1-params.rst create mode 100644 drivers/staging/media/rkisp1/Documentation/media/uapi/v4l/pixfmt-meta-rkisp1-stat.rst create mode 100644 drivers/staging/media/rkisp1/Kconfig create mode 100644 drivers/staging/media/rkisp1/Makefile create mode 100644 drivers/staging/media/rkisp1/TODO create mode 100644 drivers/staging/media/rkisp1/rkisp1-capture.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-common.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-common.h create mode 100644 drivers/staging/media/rkisp1/rkisp1-dev.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-isp.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-params.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-regs.h create mode 100644 drivers/staging/media/rkisp1/rkisp1-resizer.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-stats.c create mode 100644 drivers/staging/media/rkisp1/uapi/rkisp1-config.h
Signature · 1 line
2.24.0
PATCH v12 1/11 media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
From: Ezequiel Garcia <[email protected]>
Add driver for Rockchip MIPI Synopsys DPHY driver
---
Changes in v12:
- several cleanups
- remove "rx" from function names, as this driver only supports rx
Changes in v11:
- fix checkpatch errors
Changes in v10: None
Changes in v9:
- Move to staging
- replace memcpy by a directly assignment
- remove unecessary ret variable in rockchip_dphy_init
- s/0x1/1
- s/0x0/0
- coding style changes
- dphy_reg variable sizes
- variables from int to unsigned int
- rename functions to start with rk_
- rename dphy0 to rx
- fix hardcoded lane0 usage
- disable rx on power off
- general cleanups of unused variables
Changes in v8:
- Remove boiler plate license text
Changes in v7:
- Migrate dphy specific code from drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c to drivers/phy/rockchip/phy-rockchip-dphy.c
- Drop support for rk3288
- Drop support for dphy txrx
- code styling and checkpatch fixes
drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + .../staging/media/phy-rockchip-dphy/Kconfig | 11 + .../staging/media/phy-rockchip-dphy/Makefile | 2 + drivers/staging/media/phy-rockchip-dphy/TODO | 6 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 396 ++++++++++++++++++ 6 files changed, 418 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Kconfig create mode 100644 drivers/staging/media/phy-rockchip-dphy/Makefile create mode 100644 drivers/staging/media/phy-rockchip-dphy/TODO create mode 100644 drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c
drivers/staging/media/Kconfig +2 -0
@@ -38,4 +38,6 @@ source "drivers/staging/media/ipu3/Kconfig" source "drivers/staging/media/soc_camera/Kconfig" +source "drivers/staging/media/phy-rockchip-dphy/Kconfig" + endif
drivers/staging/media/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_TEGRA_VDE) += tegra-vde/ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy/
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Rockchip platforms +# +config PHY_ROCKCHIP_DPHY + tristate "Rockchip MIPI Synopsys DPHY driver" + depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF + select GENERIC_PHY_MIPI_DPHY + select GENERIC_PHY + help + Enable this to support the Rockchip MIPI Synopsys DPHY.
drivers/staging/media/phy-rockchip-dphy/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy.o
drivers/staging/media/phy-rockchip-dphy/TODO new file +6 -0
@@ -0,0 +1,6 @@ +The major reason for keeping this in staging is because the only driver +who uses this is rkisp1 who is also in staging. It should be moved together +rkisp1. + +Please CC patches to Linux Media <[email protected]> and +Helen Koike <[email protected]>.
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +396 -0
396 lines not on this page · raw message
Signature · 1 line
2.24.0
Re: [PATCH v12 01/11] media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
Hi Helen,
Thanks for taking care of this.
Quoted 79 lines · Helen Koike
From: Ezequiel Garcia <[email protected]>
Add driver for Rockchip MIPI Synopsys DPHY driver
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>Signed-off-by Helen Koike <[email protected]>---
Changes in v12:
- several cleanups
- remove "rx" from function names, as this driver only supports rxChanges in v11:
- fix checkpatch errorsChanges in v10: None
Changes in v9:
- Move to staging
- replace memcpy by a directly assignment
- remove unecessary ret variable inrockchip_dphy_init
- s/0x1/1
- s/0x0/0
- coding style changes
-dphy_regvariable sizes
- variables from int to unsigned int
- rename functions to start withrk_
- rename dphy0 to rx
- fix hardcoded lane0 usage
- disable rx on power off
- general cleanups of unused variablesChanges in v8:
- Remove boiler plate license textChanges in v7:
- Migrate dphy specific code fromdrivers/media/platform/rockchip/isp1/mipi_dphy_sy.ctodrivers/phy/rockchip/phy-rockchip-dphy.c
- Drop support for rk3288
- Drop support for dphy txrx
- code styling and checkpatch fixesdrivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + .../staging/media/phy-rockchip-dphy/Kconfig | 11 + .../staging/media/phy-rockchip-dphy/Makefile | 2 + drivers/staging/media/phy-rockchip-dphy/TODO | 6 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 396 ++++++++++++++++++ 6 files changed, 418 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Kconfig create mode 100644 drivers/staging/media/phy-rockchip-dphy/Makefile create mode 100644 drivers/staging/media/phy-rockchip-dphy/TODO create mode 100644 drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.cdrivers/staging/media/Kconfig +2
-0@@ -38,4 +38,6 @@ source "drivers/staging/media/ipu3/Kconfig" source "drivers/staging/media/soc_camera/Kconfig" +source "drivers/staging/media/phy-rockchip-dphy/Kconfig" + endifdrivers/staging/media/Makefile +1
-0@@ -8,3 +8,4 @@ obj-$(CONFIG_TEGRA_VDE) += tegra-vde/ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy/drivers/staging/media/phy-rockchip-dphy/Kconfig new file +0
-0
drivers/staging/media/phy-rockchip-dphy/Kconfig
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +0
-1--- /dev/null
Seems I overlooked the Kconfig file for this driver, sorry about that!
drivers/staging/media/phy-rockchip-dphy/Kconfig line 11
Quoted 13 lines
+++ b/drivers/staging/media/phy-rockchip-dphy/Kconfig
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +11
-0@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Rockchip platforms +# +config PHY_ROCKCHIP_DPHY + tristate "Rockchip MIPI Synopsys DPHY driver" + depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF + select GENERIC_PHY_MIPI_DPHY + select GENERIC_PHY + help + Enable this to support the Rockchip MIPI Synopsys DPHY.
Following a more user-friendly convention, this should read more like:
"""
Enable this to support the Rockchip MIPI Synopsys DPHY associated to the Rockchip ISP module present in RK3399 SoCs.
To compile this driver as a module, choose M here: the module will be called phy-rockchip-dphy.
"""
And I believe the same improvement should be applied to the ISP driver Kconfig help.
Thanks,
Ezequiel
Re: [PATCH v12 01/11] media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
In reply to Helen KoikeHi Helen and Ezequiel,
Thank you for the patch.
Quoted 82 lines · Helen Koike
From: Ezequiel Garcia <[email protected]>
Add driver for Rockchip MIPI Synopsys DPHY driver
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>Signed-off-by Helen Koike <[email protected]>---
Changes in v12:
- several cleanups
- remove "rx" from function names, as this driver only supports rxChanges in v11:
- fix checkpatch errorsChanges in v10: None
Changes in v9:
- Move to staging
- replace memcpy by a directly assignment
- remove unecessary ret variable inrockchip_dphy_init
- s/0x1/1
- s/0x0/0
- coding style changes
-dphy_regvariable sizes
- variables from int to unsigned int
- rename functions to start withrk_
- rename dphy0 to rx
- fix hardcoded lane0 usage
- disable rx on power off
- general cleanups of unused variablesChanges in v8:
- Remove boiler plate license textChanges in v7:
- Migrate dphy specific code fromdrivers/media/platform/rockchip/isp1/mipi_dphy_sy.ctodrivers/phy/rockchip/phy-rockchip-dphy.c
- Drop support for rk3288
- Drop support for dphy txrx
- code styling and checkpatch fixesdrivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + .../staging/media/phy-rockchip-dphy/Kconfig | 11 + .../staging/media/phy-rockchip-dphy/Makefile | 2 + drivers/staging/media/phy-rockchip-dphy/TODO | 6 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 396 ++++++++++++++++++ 6 files changed, 418 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Kconfig create mode 100644 drivers/staging/media/phy-rockchip-dphy/Makefile create mode 100644 drivers/staging/media/phy-rockchip-dphy/TODO create mode 100644 drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.cdrivers/staging/media/Kconfig +2
-0@@ -38,4 +38,6 @@ source "drivers/staging/media/ipu3/Kconfig" source "drivers/staging/media/soc_camera/Kconfig" +source "drivers/staging/media/phy-rockchip-dphy/Kconfig" + endifdrivers/staging/media/Makefile +1
-0@@ -8,3 +8,4 @@ obj-$(CONFIG_TEGRA_VDE) += tegra-vde/ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy/drivers/staging/media/phy-rockchip-dphy/Kconfig new file +0
-0
drivers/staging/media/phy-rockchip-dphy/Kconfig line 3
Quoted 3 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +3
-0@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Rockchip platforms
s/Phy/MIPI D-PHY/
Quoted 22 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +8
-0+# +config PHY_ROCKCHIP_DPHY + tristate "Rockchip MIPI Synopsys DPHY driver" + depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF + select GENERIC_PHY_MIPI_DPHY + select GENERIC_PHY + help + Enable this to support the Rockchip MIPI Synopsys DPHY.drivers/staging/media/phy-rockchip-dphy/Makefile new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy.odrivers/staging/media/phy-rockchip-dphy/TODO new file +0
-0
drivers/staging/media/phy-rockchip-dphy/TODO line 1
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0@@ -0,0 +1,6 @@ +The major reason for keeping this in staging is because the only driver
s/major/main/
drivers/staging/media/phy-rockchip-dphy/TODO line 2
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0+who uses this is rkisp1 who is also in staging. It should be moved together
s/who uses this/that uses this/
s/who is also/, which is also/
drivers/staging/media/phy-rockchip-dphy/TODO line 3
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0+rkisp1.
s/rkisp1/with rkisp1/ ?
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 1
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/TODO new file +3
-0+ +Please CC patches to Linux Media <[email protected]> and +Helen Koike <[email protected]>.drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +1
-0@@ -0,0 +1,396 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
Any reason for this ? Kernel code is usually GPL-2.0.
Quoted 156 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +156
-0+/* +* Rockchip MIPI Synopsys DPHY driver +* +* Copyright (C) 2019 Collabora, Ltd. +* +* Based on: +* +* drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c +* in https://chromium.googlesource.com/chromiumos/third_party/kernel, +* chromeos-4.4 branch. +* +* Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd. +* Jacob Chen <[email protected]> +* Shunqian Zheng <[email protected]> +*/ + +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/mfd/syscon.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/phy/phy.h> +#include <linux/phy/phy-mipi-dphy.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#define RK3399_GRF_SOC_CON9 0x6224 +#define RK3399_GRF_SOC_CON21 0x6254 +#define RK3399_GRF_SOC_CON22 0x6258 +#define RK3399_GRF_SOC_CON23 0x625c +#define RK3399_GRF_SOC_CON24 0x6260 +#define RK3399_GRF_SOC_CON25 0x6264 +#define RK3399_GRF_SOC_STATUS1 0xe2a4 + +#define CLOCK_LANE_HS_RX_CONTROL 0x34 +#define LANE0_HS_RX_CONTROL 0x44 +#define LANE1_HS_RX_CONTROL 0x54 +#define LANE2_HS_RX_CONTROL 0x84 +#define LANE3_HS_RX_CONTROL 0x94 +#define LANES_THS_SETTLE_CONTROL 0x75 +#define THS_SETTLE_COUNTER_THRESHOLD 0x04 + +struct hsfreq_range { +u16 range_h; +u8 cfg_bit; +}; + +static const struct hsfreq_range rk3399_mipidphy_hsfreq_ranges[] = { + {89 ,0x00 }, {99 ,0x10 }, {109 ,0x20 }, {129 ,0x01 }, + {139 ,0x11 }, {149 ,0x21 }, {169 ,0x02 }, {179 ,0x12 }, + {199 ,0x22 }, {219 ,0x03 }, {239 ,0x13 }, {249 ,0x23 }, + {269 ,0x04 }, {299 ,0x14 }, {329 ,0x05 }, {359 ,0x15 }, + {399 ,0x25 }, {449 ,0x06 }, {499 ,0x16 }, {549 ,0x07 }, + {599 ,0x17 }, {649 ,0x08 }, {699 ,0x18 }, {749 ,0x09 }, + {799 ,0x19 }, {849 ,0x29 }, {899 ,0x39 }, {949 ,0x0a }, + {999 ,0x1a }, {1049 ,0x2a }, {1099 ,0x3a }, {1149 ,0x0b }, + {1199 ,0x1b }, {1249 ,0x2b }, {1299 ,0x3b }, {1349 ,0x0c }, + {1399 ,0x1c }, {1449 ,0x2c }, {1500 ,0x3c } +}; + +static const char *const rk3399_mipidphy_clks[] = { +"dphy-ref" , +"dphy-cfg" , +"grf" , +}; + +enum dphy_reg_id { +GRF_DPHY_RX0_TURNDISABLE =0 , +GRF_DPHY_RX0_FORCERXMODE , +GRF_DPHY_RX0_FORCETXSTOPMODE , +GRF_DPHY_RX0_ENABLE , +GRF_DPHY_RX0_TESTCLR , +GRF_DPHY_RX0_TESTCLK , +GRF_DPHY_RX0_TESTEN , +GRF_DPHY_RX0_TESTDIN , +GRF_DPHY_RX0_TURNREQUEST , +GRF_DPHY_RX0_TESTDOUT , +GRF_DPHY_TX0_TURNDISABLE , +GRF_DPHY_TX0_FORCERXMODE , +GRF_DPHY_TX0_FORCETXSTOPMODE , +GRF_DPHY_TX0_TURNREQUEST , +GRF_DPHY_TX1RX1_TURNDISABLE , +GRF_DPHY_TX1RX1_FORCERXMODE , +GRF_DPHY_TX1RX1_FORCETXSTOPMODE , +GRF_DPHY_TX1RX1_ENABLE , +GRF_DPHY_TX1RX1_MASTERSLAVEZ , +GRF_DPHY_TX1RX1_BASEDIR , +GRF_DPHY_TX1RX1_ENABLECLK , +GRF_DPHY_TX1RX1_TURNREQUEST , +GRF_DPHY_RX1_SRC_SEL , +/* rk3288 only */ +GRF_CON_DISABLE_ISP , +GRF_CON_ISP_DPHY_SEL , +GRF_DSI_CSI_TESTBUS_SEL , +GRF_DVP_V18SEL , +/* below is for rk3399 only */ +GRF_DPHY_RX0_CLK_INV_SEL , +GRF_DPHY_RX1_CLK_INV_SEL , +}; + +struct dphy_reg { +u16 offset; +u8 mask; +u8 shift; +}; + +#define PHY_REG (_offset, _width, _shift) \ + { .offset = _offset, .mask = BIT(_width) - 1, .shift = _shift, } + +static const struct dphy_reg rk3399_grf_dphy_regs[] = { + [GRF_DPHY_RX0_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON9 ,4 ,0 ), + [GRF_DPHY_RX0_CLK_INV_SEL ] =PHY_REG (RK3399_GRF_SOC_CON9 ,1 ,10 ), + [GRF_DPHY_RX1_CLK_INV_SEL ] =PHY_REG (RK3399_GRF_SOC_CON9 ,1 ,11 ), + [GRF_DPHY_RX0_ENABLE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,0 ), + [GRF_DPHY_RX0_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,4 ), + [GRF_DPHY_RX0_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,8 ), + [GRF_DPHY_RX0_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,12 ), + [GRF_DPHY_TX0_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,0 ), + [GRF_DPHY_TX0_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,4 ), + [GRF_DPHY_TX0_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,8 ), + [GRF_DPHY_TX0_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,12 ), + [GRF_DPHY_TX1RX1_ENABLE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,0 ), + [GRF_DPHY_TX1RX1_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,4 ), + [GRF_DPHY_TX1RX1_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,8 ), + [GRF_DPHY_TX1RX1_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,12 ), + [GRF_DPHY_TX1RX1_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON24 ,4 ,0 ), + [GRF_DPHY_RX1_SRC_SEL ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,4 ), + [GRF_DPHY_TX1RX1_BASEDIR ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,5 ), + [GRF_DPHY_TX1RX1_ENABLECLK ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,6 ), + [GRF_DPHY_TX1RX1_MASTERSLAVEZ ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,7 ), + [GRF_DPHY_RX0_TESTDIN ] =PHY_REG (RK3399_GRF_SOC_CON25 ,8 ,0 ), + [GRF_DPHY_RX0_TESTEN ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,8 ), + [GRF_DPHY_RX0_TESTCLK ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,9 ), + [GRF_DPHY_RX0_TESTCLR ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,10 ), + [GRF_DPHY_RX0_TESTDOUT ] =PHY_REG (RK3399_GRF_SOC_STATUS1 ,8 ,0 ), +}; + +struct rk_dphy_drv_data { +const char *const *clks; +unsigned int num_clks; +const struct hsfreq_range *hsfreq_ranges; +unsigned int num_hsfreq_ranges; +const struct dphy_reg *regs; +}; + +struct rk_dphy { +struct device *dev; +struct regmap *grf; +struct clk_bulk_data *clks; + +const struct rk_dphy_drv_data *drv_data; +struct phy_configure_opts_mipi_dphy config; + +u8 hsfreq; +};
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 167
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +10
-0+ +static inline void rk_dphy_write_grf (struct rk_dphy *priv, +unsigned int index,u8 value) +{ +const struct dphy_reg *reg = &priv->drv_data->regs[index]; +/* Update high word */ +unsigned int val = (value << reg->shift) | + (reg->mask << (reg->shift +16 )); + +WARN_ON (!reg->offset);
Maybe
if (WARN_ON(!reg->offset)) return;
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 179
Quoted 12 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +12
-0+regmap_write (priv->grf, reg->offset, val); +} + +static void rk_dphy_write (struct rk_dphy *priv, +u8 test_code,u8 test_data) +{ +/* +* With the falling edge on TESTCLK, the TESTDIN[7:0] signal content +* is latched internally as the current test code. Test data is +* programmed internally by rising edge on TESTCLK. +*/ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 );
Do we need this first line, as the function always exits with TESTCLK=1, and TESTCLK is initialized to 1 before calling rk_dphy_write for the first time ?
Quoted 42 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +42
-0+rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTDIN , test_code); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTEN ,1 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTEN ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTDIN , test_data); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 ); +} + +static void rk_dphy_enable (struct rk_dphy *priv) +{ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_FORCERXMODE ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_FORCETXSTOPMODE ,0 ); + +/* Disable lane turn around, which is ignored in receive mode */ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TURNREQUEST ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TURNDISABLE ,0xf ); + +rk_dphy_write_grf (priv,GRF_DPHY_RX0_ENABLE , +GENMASK (priv->config.lanes -1 ,0 )); + +/* dphy start */ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLR ,1 ); +usleep_range (100 ,150 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLR ,0 ); +usleep_range (100 ,150 ); + +/* set clock lane */ +/* HS hsfreq_range & lane 0 settle bypass */ +rk_dphy_write (priv,CLOCK_LANE_HS_RX_CONTROL ,0 ); +/* HS RX Control of lane0 */ +rk_dphy_write (priv,LANE0_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane1 */ +rk_dphy_write (priv,LANE1_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane2 */ +rk_dphy_write (priv,LANE2_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane3 */ +rk_dphy_write (priv,LANE3_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Data Lanes Settle State Time Control */ +rk_dphy_write (priv,LANES_THS_SETTLE_CONTROL , +THS_SETTLE_COUNTER_THRESHOLD ); +
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 231
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +10
-0+/* Normal operation */ +rk_dphy_write (priv,0x0 ,0 ); +} + +static int rk_dphy_configure (struct phy *phy,union phy_configure_opts *opts) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); +const struct rk_dphy_drv_data *drv_data = priv->drv_data; +struct phy_configure_opts_mipi_dphy *config = &opts->mipi_dphy; +unsigned int i, hsfreq =0 , data_rate_mbps = config->hs_clk_rate;
Maybe one variable per line ?
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 237
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +6
-0+int ret; + +/* pass with phy_mipi_dphy_get_default_config (with pixel rate?) */ + ret =phy_mipi_dphy_config_validate (config); +if (ret) +return ret;
I would add a blank line here.
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 238
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +1
-0+do_div (data_rate_mbps,1000 *1000 );
data_rate_mbps is an unsigned int, so you can use
data_rate_mbps /= 1000 * 1000;
However, you're potentially truncating hs_clk_rate by assigning it to data_rate_mbps, so I would remove the assignment at declaration time and do
data_rate_mbps = div_u64(config->hs_clk_rate, 1000 * 1000);
or define data_rate_mbps as an unsigned long.
Quoted 101 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +101
-0+ +dev_dbg (priv->dev,"lanes %d - data_rate_mbps %u\n" , + config->lanes, data_rate_mbps); +for (i =0 ; i < drv_data->num_hsfreq_ranges; i++) { +if (drv_data->hsfreq_ranges[i].range_h >= data_rate_mbps) { + hsfreq = drv_data->hsfreq_ranges[i].cfg_bit; +break ; + } + } +if (!hsfreq) +return -EINVAL ; + + priv->hsfreq = hsfreq; + priv->config = *config; +return 0 ; +} + +static int rk_dphy_power_on (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); +int ret; + + ret =clk_bulk_enable (priv->drv_data->num_clks, priv->clks); +if (ret) +return ret; + +rk_dphy_enable (priv); + +return 0 ; +} + +static int rk_dphy_power_off (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +rk_dphy_write_grf (priv,GRF_DPHY_RX0_ENABLE ,0 ); +clk_bulk_disable (priv->drv_data->num_clks, priv->clks); +return 0 ; +} + +static int rk_dphy_init (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +return clk_bulk_prepare (priv->drv_data->num_clks, priv->clks); +} + +static int rk_dphy_exit (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +clk_bulk_unprepare (priv->drv_data->num_clks, priv->clks); +return 0 ; +} + +static const struct phy_ops rk_dphy_ops = { + .power_on = rk_dphy_power_on, + .power_off = rk_dphy_power_off, + .init = rk_dphy_init, + .exit = rk_dphy_exit, + .configure = rk_dphy_configure, + .owner =THIS_MODULE , +}; + +static const struct rk_dphy_drv_data rk3399_mipidphy_drv_data = { + .clks = rk3399_mipidphy_clks, + .num_clks =ARRAY_SIZE (rk3399_mipidphy_clks), + .hsfreq_ranges = rk3399_mipidphy_hsfreq_ranges, + .num_hsfreq_ranges =ARRAY_SIZE (rk3399_mipidphy_hsfreq_ranges), + .regs = rk3399_grf_dphy_regs, +}; + +static const struct of_device_id rk_dphy_dt_ids[] = { + { + .compatible ="rockchip,rk3399-mipi-dphy" , + .data = &rk3399_mipidphy_drv_data, + }, + {} +}; +MODULE_DEVICE_TABLE (of, rk_dphy_dt_ids); + +static int rk_dphy_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +const struct rk_dphy_drv_data *drv_data; +struct phy_provider *phy_provider; +const struct of_device_id *of_id; +struct rk_dphy *priv; +struct regmap *grf; +struct phy *phy; +unsigned int i; +int ret; + +if (!dev->parent || !dev->parent->of_node) +return -ENODEV ; + +if (platform_get_resource (pdev,IORESOURCE_MEM ,0 )) { +dev_err (dev,"Rockchip DPHY driver only suports RX mode\n" ); +return -EINVAL ; + }
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 349
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +10
-0+ + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + priv->dev = dev; + + grf =syscon_node_to_regmap (dev->parent->of_node); +if (IS_ERR (grf)) { + grf =syscon_regmap_lookup_by_phandle (dev->of_node, +"rockchip,grf" );
Is this for backward compatibility with older bindings ? Do we still need it ? If so I would add a comment to explain why.
With the above small issues fixed,
Quoted 47 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +47
-0+if (IS_ERR (grf)) { +dev_err (dev,"Can't find GRF syscon\n" ); +return -ENODEV ; + } + } + priv->grf = grf; + + of_id =of_match_device (rk_dphy_dt_ids, dev); +if (!of_id) +return -EINVAL ; + + drv_data = of_id->data; + priv->drv_data = drv_data; + priv->clks =devm_kcalloc (&pdev->dev, drv_data->num_clks, +sizeof (*priv->clks),GFP_KERNEL ); +if (!priv->clks) +return -ENOMEM ; +for (i =0 ; i < drv_data->num_clks; i++) + priv->clks[i].id = drv_data->clks[i]; + ret =devm_clk_bulk_get (&pdev->dev, drv_data->num_clks, priv->clks); +if (ret) +return ret; + + phy =devm_phy_create (dev, np, &rk_dphy_ops); +if (IS_ERR (phy)) { +dev_err (dev,"failed to create phy\n" ); +return PTR_ERR (phy); + } +phy_set_drvdata (phy, priv); + + phy_provider =devm_of_phy_provider_register (dev, of_phy_simple_xlate); + +return PTR_ERR_OR_ZERO (phy_provider); +} + +static struct platform_driver rk_dphy_driver = { + .probe = rk_dphy_probe, + .driver = { + .name ="rockchip-mipi-dphy" , + .of_match_table = rk_dphy_dt_ids, + }, +}; +module_platform_driver (rk_dphy_driver); + +MODULE_AUTHOR ("Ezequiel Garcia <[email protected]>" ); +MODULE_DESCRIPTION ("Rockchip MIPI Synopsys DPHY driver" ); +MODULE_LICENSE ("Dual MIT/GPL" );
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v12 01/11] media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
Quoted 84 lines · Laurent Pinchart
Hi Helen and Ezequiel,
Thank you for the patch.
Quoted 79 lines · Helen Koike
From: Ezequiel Garcia <[email protected]>
Add driver for Rockchip MIPI Synopsys DPHY driver
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>Signed-off-by Helen Koike <[email protected]>---
Changes in v12:
- several cleanups
- remove "rx" from function names, as this driver only supports rxChanges in v11:
- fix checkpatch errorsChanges in v10: None
Changes in v9:
- Move to staging
- replace memcpy by a directly assignment
- remove unecessary ret variable inrockchip_dphy_init
- s/0x1/1
- s/0x0/0
- coding style changes
-dphy_regvariable sizes
- variables from int to unsigned int
- rename functions to start withrk_
- rename dphy0 to rx
- fix hardcoded lane0 usage
- disable rx on power off
- general cleanups of unused variablesChanges in v8:
- Remove boiler plate license textChanges in v7:
- Migrate dphy specific code fromdrivers/media/platform/rockchip/isp1/mipi_dphy_sy.ctodrivers/phy/rockchip/phy-rockchip-dphy.c
- Drop support for rk3288
- Drop support for dphy txrx
- code styling and checkpatch fixesdrivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + .../staging/media/phy-rockchip-dphy/Kconfig | 11 + .../staging/media/phy-rockchip-dphy/Makefile | 2 + drivers/staging/media/phy-rockchip-dphy/TODO | 6 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 396 ++++++++++++++++++ 6 files changed, 418 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Kconfig create mode 100644 drivers/staging/media/phy-rockchip-dphy/Makefile create mode 100644 drivers/staging/media/phy-rockchip-dphy/TODO create mode 100644 drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.cdrivers/staging/media/Kconfig +2
-0@@ -38,4 +38,6 @@ source "drivers/staging/media/ipu3/Kconfig" source "drivers/staging/media/soc_camera/Kconfig" +source "drivers/staging/media/phy-rockchip-dphy/Kconfig" + endifdrivers/staging/media/Makefile +1
-0@@ -8,3 +8,4 @@ obj-$(CONFIG_TEGRA_VDE) += tegra-vde/ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy/drivers/staging/media/phy-rockchip-dphy/Kconfig new file +0
-0
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig line 3
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +3
-0@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Rockchip platformss/Phy/MIPI D-PHY/
Ack.
Quoted 17 lines
Quoted 17 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +8
-0+# +config PHY_ROCKCHIP_DPHY + tristate "Rockchip MIPI Synopsys DPHY driver" + depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF + select GENERIC_PHY_MIPI_DPHY + select GENERIC_PHY + help + Enable this to support the Rockchip MIPI Synopsys DPHY.drivers/staging/media/phy-rockchip-dphy/Makefile new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy.odrivers/staging/media/phy-rockchip-dphy/TODO +0
-0
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/TODO line 1
Quoted 6 lines
new file mode 100644
index 000000000000..e1fda55babefdrivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0@@ -0,0 +1,6 @@ +The major reason for keeping this in staging is because the only drivers/major/main/
What's wrong with "The major reason"?
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/TODO line 2
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0+who uses this is rkisp1 who is also in staging. It should be moved togethers/who uses this/that uses this/
s/who is also/, which is also/drivers/staging/media/phy-rockchip-dphy/TODO line 3
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0+rkisp1.s/rkisp1/with rkisp1/ ?
I see your point. Let me rephrase it.
Quoted 4 lines
Quoted 4 lines
drivers/staging/media/phy-rockchip-dphy/TODO new file +3
-0+ +Please CC patches to Linux Media <[email protected]> and +Helen Koike <[email protected]>.drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c +0
-0
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 1
Quoted 6 lines
new file mode 100644
index 000000000000..c3fe9c64b45fdrivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +1
-0@@ -0,0 +1,396 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) Any reason for this ? Kernel code is usually GPL-2.0.
The ChromeOS driver is originally dual licensed,
so we tried to respect that.
Quoted 169 lines
Quoted 156 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +156
-0+/* +* Rockchip MIPI Synopsys DPHY driver +* +* Copyright (C) 2019 Collabora, Ltd. +* +* Based on: +* +* drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c +* in https://chromium.googlesource.com/chromiumos/third_party/kernel, +* chromeos-4.4 branch. +* +* Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd. +* Jacob Chen <[email protected]> +* Shunqian Zheng <[email protected]> +*/ + +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/mfd/syscon.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/phy/phy.h> +#include <linux/phy/phy-mipi-dphy.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#define RK3399_GRF_SOC_CON9 0x6224 +#define RK3399_GRF_SOC_CON21 0x6254 +#define RK3399_GRF_SOC_CON22 0x6258 +#define RK3399_GRF_SOC_CON23 0x625c +#define RK3399_GRF_SOC_CON24 0x6260 +#define RK3399_GRF_SOC_CON25 0x6264 +#define RK3399_GRF_SOC_STATUS1 0xe2a4 + +#define CLOCK_LANE_HS_RX_CONTROL 0x34 +#define LANE0_HS_RX_CONTROL 0x44 +#define LANE1_HS_RX_CONTROL 0x54 +#define LANE2_HS_RX_CONTROL 0x84 +#define LANE3_HS_RX_CONTROL 0x94 +#define LANES_THS_SETTLE_CONTROL 0x75 +#define THS_SETTLE_COUNTER_THRESHOLD 0x04 + +struct hsfreq_range { +u16 range_h; +u8 cfg_bit; +}; + +static const struct hsfreq_range rk3399_mipidphy_hsfreq_ranges[] = { + {89 ,0x00 }, {99 ,0x10 }, {109 ,0x20 }, {129 ,0x01 }, + {139 ,0x11 }, {149 ,0x21 }, {169 ,0x02 }, {179 ,0x12 }, + {199 ,0x22 }, {219 ,0x03 }, {239 ,0x13 }, {249 ,0x23 }, + {269 ,0x04 }, {299 ,0x14 }, {329 ,0x05 }, {359 ,0x15 }, + {399 ,0x25 }, {449 ,0x06 }, {499 ,0x16 }, {549 ,0x07 }, + {599 ,0x17 }, {649 ,0x08 }, {699 ,0x18 }, {749 ,0x09 }, + {799 ,0x19 }, {849 ,0x29 }, {899 ,0x39 }, {949 ,0x0a }, + {999 ,0x1a }, {1049 ,0x2a }, {1099 ,0x3a }, {1149 ,0x0b }, + {1199 ,0x1b }, {1249 ,0x2b }, {1299 ,0x3b }, {1349 ,0x0c }, + {1399 ,0x1c }, {1449 ,0x2c }, {1500 ,0x3c } +}; + +static const char *const rk3399_mipidphy_clks[] = { +"dphy-ref" , +"dphy-cfg" , +"grf" , +}; + +enum dphy_reg_id { +GRF_DPHY_RX0_TURNDISABLE =0 , +GRF_DPHY_RX0_FORCERXMODE , +GRF_DPHY_RX0_FORCETXSTOPMODE , +GRF_DPHY_RX0_ENABLE , +GRF_DPHY_RX0_TESTCLR , +GRF_DPHY_RX0_TESTCLK , +GRF_DPHY_RX0_TESTEN , +GRF_DPHY_RX0_TESTDIN , +GRF_DPHY_RX0_TURNREQUEST , +GRF_DPHY_RX0_TESTDOUT , +GRF_DPHY_TX0_TURNDISABLE , +GRF_DPHY_TX0_FORCERXMODE , +GRF_DPHY_TX0_FORCETXSTOPMODE , +GRF_DPHY_TX0_TURNREQUEST , +GRF_DPHY_TX1RX1_TURNDISABLE , +GRF_DPHY_TX1RX1_FORCERXMODE , +GRF_DPHY_TX1RX1_FORCETXSTOPMODE , +GRF_DPHY_TX1RX1_ENABLE , +GRF_DPHY_TX1RX1_MASTERSLAVEZ , +GRF_DPHY_TX1RX1_BASEDIR , +GRF_DPHY_TX1RX1_ENABLECLK , +GRF_DPHY_TX1RX1_TURNREQUEST , +GRF_DPHY_RX1_SRC_SEL , +/* rk3288 only */ +GRF_CON_DISABLE_ISP , +GRF_CON_ISP_DPHY_SEL , +GRF_DSI_CSI_TESTBUS_SEL , +GRF_DVP_V18SEL , +/* below is for rk3399 only */ +GRF_DPHY_RX0_CLK_INV_SEL , +GRF_DPHY_RX1_CLK_INV_SEL , +}; + +struct dphy_reg { +u16 offset; +u8 mask; +u8 shift; +}; + +#define PHY_REG (_offset, _width, _shift) \ + { .offset = _offset, .mask = BIT(_width) - 1, .shift = _shift, } + +static const struct dphy_reg rk3399_grf_dphy_regs[] = { + [GRF_DPHY_RX0_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON9 ,4 ,0 ), + [GRF_DPHY_RX0_CLK_INV_SEL ] =PHY_REG (RK3399_GRF_SOC_CON9 ,1 ,10 ), + [GRF_DPHY_RX1_CLK_INV_SEL ] =PHY_REG (RK3399_GRF_SOC_CON9 ,1 ,11 ), + [GRF_DPHY_RX0_ENABLE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,0 ), + [GRF_DPHY_RX0_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,4 ), + [GRF_DPHY_RX0_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,8 ), + [GRF_DPHY_RX0_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,12 ), + [GRF_DPHY_TX0_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,0 ), + [GRF_DPHY_TX0_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,4 ), + [GRF_DPHY_TX0_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,8 ), + [GRF_DPHY_TX0_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,12 ), + [GRF_DPHY_TX1RX1_ENABLE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,0 ), + [GRF_DPHY_TX1RX1_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,4 ), + [GRF_DPHY_TX1RX1_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,8 ), + [GRF_DPHY_TX1RX1_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,12 ), + [GRF_DPHY_TX1RX1_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON24 ,4 ,0 ), + [GRF_DPHY_RX1_SRC_SEL ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,4 ), + [GRF_DPHY_TX1RX1_BASEDIR ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,5 ), + [GRF_DPHY_TX1RX1_ENABLECLK ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,6 ), + [GRF_DPHY_TX1RX1_MASTERSLAVEZ ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,7 ), + [GRF_DPHY_RX0_TESTDIN ] =PHY_REG (RK3399_GRF_SOC_CON25 ,8 ,0 ), + [GRF_DPHY_RX0_TESTEN ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,8 ), + [GRF_DPHY_RX0_TESTCLK ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,9 ), + [GRF_DPHY_RX0_TESTCLR ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,10 ), + [GRF_DPHY_RX0_TESTDOUT ] =PHY_REG (RK3399_GRF_SOC_STATUS1 ,8 ,0 ), +}; + +struct rk_dphy_drv_data { +const char *const *clks; +unsigned int num_clks; +const struct hsfreq_range *hsfreq_ranges; +unsigned int num_hsfreq_ranges; +const struct dphy_reg *regs; +}; + +struct rk_dphy { +struct device *dev; +struct regmap *grf; +struct clk_bulk_data *clks; + +const struct rk_dphy_drv_data *drv_data; +struct phy_configure_opts_mipi_dphy config; + +u8 hsfreq; +};drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 167
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +10
-0+ +static inline void rk_dphy_write_grf (struct rk_dphy *priv, +unsigned int index,u8 value) +{ +const struct dphy_reg *reg = &priv->drv_data->regs[index]; +/* Update high word */ +unsigned int val = (value << reg->shift) | + (reg->mask << (reg->shift +16 )); + +WARN_ON (!reg->offset);Maybe
Quoted 3 lines
if (WARN_ON(!reg->offset)) return;
Right.
Quoted 8 lines
Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +8
-0+regmap_write (priv->grf, reg->offset, val); +} + +static void rk_dphy_write (struct rk_dphy *priv, +u8 test_code,u8 test_data) +{ +/* +* With the falling edge on TESTCLK, the TESTDIN[7:0] signal content
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 179
Quoted 4 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +4
-0+* is latched internally as the current test code. Test data is +* programmed internally by rising edge on TESTCLK. +*/ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 );Do we need this first line, as the function always exits with TESTCLK=1, and TESTCLK is initialized to 1 before calling
rk_dphy_writefor the first time ?
You might be right.
Perhaps we can test if it's fine to drop it, and put a comment saying TESTCLK must be =1 here, so the assumption is clearly stated.
Quoted 46 lines
Quoted 46 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +46
-0+rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTDIN , test_code); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTEN ,1 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTEN ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTDIN , test_data); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 ); +} + +static void rk_dphy_enable (struct rk_dphy *priv) +{ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_FORCERXMODE ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_FORCETXSTOPMODE ,0 ); + +/* Disable lane turn around, which is ignored in receive mode */ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TURNREQUEST ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TURNDISABLE ,0xf ); + +rk_dphy_write_grf (priv,GRF_DPHY_RX0_ENABLE , +GENMASK (priv->config.lanes -1 ,0 )); + +/* dphy start */ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLR ,1 ); +usleep_range (100 ,150 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLR ,0 ); +usleep_range (100 ,150 ); + +/* set clock lane */ +/* HS hsfreq_range & lane 0 settle bypass */ +rk_dphy_write (priv,CLOCK_LANE_HS_RX_CONTROL ,0 ); +/* HS RX Control of lane0 */ +rk_dphy_write (priv,LANE0_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane1 */ +rk_dphy_write (priv,LANE1_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane2 */ +rk_dphy_write (priv,LANE2_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane3 */ +rk_dphy_write (priv,LANE3_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Data Lanes Settle State Time Control */ +rk_dphy_write (priv,LANES_THS_SETTLE_CONTROL , +THS_SETTLE_COUNTER_THRESHOLD ); + +/* Normal operation */ +rk_dphy_write (priv,0x0 ,0 ); +} +
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 231
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +6
-0+static int rk_dphy_configure (struct phy *phy,union phy_configure_opts *opts) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); +const struct rk_dphy_drv_data *drv_data = priv->drv_data; +struct phy_configure_opts_mipi_dphy *config = &opts->mipi_dphy; +unsigned int i, hsfreq =0 , data_rate_mbps = config->hs_clk_rate;Maybe one variable per line ?
Yeah.
Quoted 15 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 237
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +6
-0+int ret; + +/* pass with phy_mipi_dphy_get_default_config (with pixel rate?) */ + ret =phy_mipi_dphy_config_validate (config); +if (ret) +return ret;I would add a blank line here.
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 238
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +1
-0+do_div (data_rate_mbps,1000 *1000 );
data_rate_mbpsis an unsigned int, so you can usedata_rate_mbps /= 1000 * 1000;
Quoted 8 lines
However, you're potentially truncating
hs_clk_rateby assigning it todata_rate_mbps, so I would remove the assignment at declaration time and dodata_rate_mbps = div_u64(config->hs_clk_rate, 1000 * 1000);or define
data_rate_mbpsas an unsigned long.
Ah, good catch.
Quoted 106 lines
Quoted 106 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +106
-0+ +dev_dbg (priv->dev,"lanes %d - data_rate_mbps %u\n" , + config->lanes, data_rate_mbps); +for (i =0 ; i < drv_data->num_hsfreq_ranges; i++) { +if (drv_data->hsfreq_ranges[i].range_h >= data_rate_mbps) { + hsfreq = drv_data->hsfreq_ranges[i].cfg_bit; +break ; + } + } +if (!hsfreq) +return -EINVAL ; + + priv->hsfreq = hsfreq; + priv->config = *config; +return 0 ; +} + +static int rk_dphy_power_on (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); +int ret; + + ret =clk_bulk_enable (priv->drv_data->num_clks, priv->clks); +if (ret) +return ret; + +rk_dphy_enable (priv); + +return 0 ; +} + +static int rk_dphy_power_off (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +rk_dphy_write_grf (priv,GRF_DPHY_RX0_ENABLE ,0 ); +clk_bulk_disable (priv->drv_data->num_clks, priv->clks); +return 0 ; +} + +static int rk_dphy_init (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +return clk_bulk_prepare (priv->drv_data->num_clks, priv->clks); +} + +static int rk_dphy_exit (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +clk_bulk_unprepare (priv->drv_data->num_clks, priv->clks); +return 0 ; +} + +static const struct phy_ops rk_dphy_ops = { + .power_on = rk_dphy_power_on, + .power_off = rk_dphy_power_off, + .init = rk_dphy_init, + .exit = rk_dphy_exit, + .configure = rk_dphy_configure, + .owner =THIS_MODULE , +}; + +static const struct rk_dphy_drv_data rk3399_mipidphy_drv_data = { + .clks = rk3399_mipidphy_clks, + .num_clks =ARRAY_SIZE (rk3399_mipidphy_clks), + .hsfreq_ranges = rk3399_mipidphy_hsfreq_ranges, + .num_hsfreq_ranges =ARRAY_SIZE (rk3399_mipidphy_hsfreq_ranges), + .regs = rk3399_grf_dphy_regs, +}; + +static const struct of_device_id rk_dphy_dt_ids[] = { + { + .compatible ="rockchip,rk3399-mipi-dphy" , + .data = &rk3399_mipidphy_drv_data, + }, + {} +}; +MODULE_DEVICE_TABLE (of, rk_dphy_dt_ids); + +static int rk_dphy_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +const struct rk_dphy_drv_data *drv_data; +struct phy_provider *phy_provider; +const struct of_device_id *of_id; +struct rk_dphy *priv; +struct regmap *grf; +struct phy *phy; +unsigned int i; +int ret; + +if (!dev->parent || !dev->parent->of_node) +return -ENODEV ; + +if (platform_get_resource (pdev,IORESOURCE_MEM ,0 )) { +dev_err (dev,"Rockchip DPHY driver only suports RX mode\n" ); +return -EINVAL ; + } + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + priv->dev = dev;
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 349
Quoted 5 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +5
-0+ + grf =syscon_node_to_regmap (dev->parent->of_node); +if (IS_ERR (grf)) { + grf =syscon_regmap_lookup_by_phandle (dev->of_node, +"rockchip,grf" );Is this for backward compatibility with older bindings ? Do we still need it ? If so I would add a comment to explain why.
Right. I think this might end up being required, depending on how the bindings end up loooking like.
Quoted 4 lines
With the above small issues fixed,
Reviewed-by Laurent Pinchart <[email protected]>
Thanks,
Ezequiel
Re: [PATCH v12 01/11] media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
Hi Ezequiel,
Quoted 118 lines · Ezequiel Garcia
Quoted 80 lines · Laurent Pinchart
Quoted 79 lines · Helen Koike
From: Ezequiel Garcia <[email protected]>
Add driver for Rockchip MIPI Synopsys DPHY driver
Signed-off-by Tomasz Figa <[email protected]>Signed-off-by Ezequiel Garcia <[email protected]>Signed-off-by Helen Koike <[email protected]>---
Changes in v12:
- several cleanups
- remove "rx" from function names, as this driver only supports rxChanges in v11:
- fix checkpatch errorsChanges in v10: None
Changes in v9:
- Move to staging
- replace memcpy by a directly assignment
- remove unecessary ret variable inrockchip_dphy_init
- s/0x1/1
- s/0x0/0
- coding style changes
-dphy_regvariable sizes
- variables from int to unsigned int
- rename functions to start withrk_
- rename dphy0 to rx
- fix hardcoded lane0 usage
- disable rx on power off
- general cleanups of unused variablesChanges in v8:
- Remove boiler plate license textChanges in v7:
- Migrate dphy specific code fromdrivers/media/platform/rockchip/isp1/mipi_dphy_sy.ctodrivers/phy/rockchip/phy-rockchip-dphy.c
- Drop support for rk3288
- Drop support for dphy txrx
- code styling and checkpatch fixesdrivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + .../staging/media/phy-rockchip-dphy/Kconfig | 11 + .../staging/media/phy-rockchip-dphy/Makefile | 2 + drivers/staging/media/phy-rockchip-dphy/TODO | 6 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 396 ++++++++++++++++++ 6 files changed, 418 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Kconfig create mode 100644 drivers/staging/media/phy-rockchip-dphy/Makefile create mode 100644 drivers/staging/media/phy-rockchip-dphy/TODO create mode 100644 drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.cdrivers/staging/media/Kconfig +2
-0@@ -38,4 +38,6 @@ source "drivers/staging/media/ipu3/Kconfig" source "drivers/staging/media/soc_camera/Kconfig" +source "drivers/staging/media/phy-rockchip-dphy/Kconfig" + endifdrivers/staging/media/Makefile +1
-0@@ -8,3 +8,4 @@ obj-$(CONFIG_TEGRA_VDE) += tegra-vde/ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_SOC_CAMERA) += soc_camera/ +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy/drivers/staging/media/phy-rockchip-dphy/Kconfig new file +0
-0Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig line 3
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +3
-0@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Phy drivers for Rockchip platformss/Phy/MIPI D-PHY/
Ack.
Quoted 17 lines
Quoted 17 lines
drivers/staging/media/phy-rockchip-dphy/Kconfig new file +8
-0+# +config PHY_ROCKCHIP_DPHY + tristate "Rockchip MIPI Synopsys DPHY driver" + depends on (ARCH_ROCKCHIP || COMPILE_TEST) && OF + select GENERIC_PHY_MIPI_DPHY + select GENERIC_PHY + help + Enable this to support the Rockchip MIPI Synopsys DPHY.drivers/staging/media/phy-rockchip-dphy/Makefile new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy.odrivers/staging/media/phy-rockchip-dphy/TODO +0
-0Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/TODO line 1
Quoted 6 lines
new file mode 100644
index 000000000000..e1fda55babefdrivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0@@ -0,0 +1,6 @@ +The major reason for keeping this in staging is because the only drivers/major/main/
Quoted 1 line
What's wrong with "The major reason"?
I was under the impression you could say "A major reason" but not "The major reason", but I could be wrong.
Quoted 24 lines
Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/TODO line 2
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0+who uses this is rkisp1 who is also in staging. It should be moved togethers/who uses this/that uses this/
s/who is also/, which is also/drivers/staging/media/phy-rockchip-dphy/TODO line 3
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/TODO new file +1
-0+rkisp1.s/rkisp1/with rkisp1/ ?
I see your point. Let me rephrase it.
Quoted 4 lines
Quoted 4 lines
drivers/staging/media/phy-rockchip-dphy/TODO new file +3
-0+ +Please CC patches to Linux Media <[email protected]> and +Helen Koike <[email protected]>.drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c +0
-0Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 1
Quoted 6 lines
new file mode 100644
index 000000000000..c3fe9c64b45fdrivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +1
-0@@ -0,0 +1,396 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) Any reason for this ? Kernel code is usually GPL-2.0.
Quoted 2 lines
The ChromeOS driver is originally dual licensed,
so we tried to respect that.
That's up to you, but you can pick any license you want as long as it's compatible with the original license. GPL-2.0 is a subset of GPL-2.0+ OR MIT, so it would be fine. Of course you can't enforce a !MIT restriction on the original code as you're not the copyright holder :-) But it may make future contributions easier, as many people expect kernel code to be licensed under GPL only. Furthermore the kernel binary compiled with this driver included would have to be GPL-licensed anyway, so it's not very useful to add a OR MIT.
Quoted 191 lines
Quoted 169 lines
Quoted 156 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +156
-0+/* +* Rockchip MIPI Synopsys DPHY driver +* +* Copyright (C) 2019 Collabora, Ltd. +* +* Based on: +* +* drivers/media/platform/rockchip/isp1/mipi_dphy_sy.c +* in https://chromium.googlesource.com/chromiumos/third_party/kernel, +* chromeos-4.4 branch. +* +* Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd. +* Jacob Chen <[email protected]> +* Shunqian Zheng <[email protected]> +*/ + +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/mfd/syscon.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/phy/phy.h> +#include <linux/phy/phy-mipi-dphy.h> +#include <linux/platform_device.h> +#include <linux/regmap.h> + +#define RK3399_GRF_SOC_CON9 0x6224 +#define RK3399_GRF_SOC_CON21 0x6254 +#define RK3399_GRF_SOC_CON22 0x6258 +#define RK3399_GRF_SOC_CON23 0x625c +#define RK3399_GRF_SOC_CON24 0x6260 +#define RK3399_GRF_SOC_CON25 0x6264 +#define RK3399_GRF_SOC_STATUS1 0xe2a4 + +#define CLOCK_LANE_HS_RX_CONTROL 0x34 +#define LANE0_HS_RX_CONTROL 0x44 +#define LANE1_HS_RX_CONTROL 0x54 +#define LANE2_HS_RX_CONTROL 0x84 +#define LANE3_HS_RX_CONTROL 0x94 +#define LANES_THS_SETTLE_CONTROL 0x75 +#define THS_SETTLE_COUNTER_THRESHOLD 0x04 + +struct hsfreq_range { +u16 range_h; +u8 cfg_bit; +}; + +static const struct hsfreq_range rk3399_mipidphy_hsfreq_ranges[] = { + {89 ,0x00 }, {99 ,0x10 }, {109 ,0x20 }, {129 ,0x01 }, + {139 ,0x11 }, {149 ,0x21 }, {169 ,0x02 }, {179 ,0x12 }, + {199 ,0x22 }, {219 ,0x03 }, {239 ,0x13 }, {249 ,0x23 }, + {269 ,0x04 }, {299 ,0x14 }, {329 ,0x05 }, {359 ,0x15 }, + {399 ,0x25 }, {449 ,0x06 }, {499 ,0x16 }, {549 ,0x07 }, + {599 ,0x17 }, {649 ,0x08 }, {699 ,0x18 }, {749 ,0x09 }, + {799 ,0x19 }, {849 ,0x29 }, {899 ,0x39 }, {949 ,0x0a }, + {999 ,0x1a }, {1049 ,0x2a }, {1099 ,0x3a }, {1149 ,0x0b }, + {1199 ,0x1b }, {1249 ,0x2b }, {1299 ,0x3b }, {1349 ,0x0c }, + {1399 ,0x1c }, {1449 ,0x2c }, {1500 ,0x3c } +}; + +static const char *const rk3399_mipidphy_clks[] = { +"dphy-ref" , +"dphy-cfg" , +"grf" , +}; + +enum dphy_reg_id { +GRF_DPHY_RX0_TURNDISABLE =0 , +GRF_DPHY_RX0_FORCERXMODE , +GRF_DPHY_RX0_FORCETXSTOPMODE , +GRF_DPHY_RX0_ENABLE , +GRF_DPHY_RX0_TESTCLR , +GRF_DPHY_RX0_TESTCLK , +GRF_DPHY_RX0_TESTEN , +GRF_DPHY_RX0_TESTDIN , +GRF_DPHY_RX0_TURNREQUEST , +GRF_DPHY_RX0_TESTDOUT , +GRF_DPHY_TX0_TURNDISABLE , +GRF_DPHY_TX0_FORCERXMODE , +GRF_DPHY_TX0_FORCETXSTOPMODE , +GRF_DPHY_TX0_TURNREQUEST , +GRF_DPHY_TX1RX1_TURNDISABLE , +GRF_DPHY_TX1RX1_FORCERXMODE , +GRF_DPHY_TX1RX1_FORCETXSTOPMODE , +GRF_DPHY_TX1RX1_ENABLE , +GRF_DPHY_TX1RX1_MASTERSLAVEZ , +GRF_DPHY_TX1RX1_BASEDIR , +GRF_DPHY_TX1RX1_ENABLECLK , +GRF_DPHY_TX1RX1_TURNREQUEST , +GRF_DPHY_RX1_SRC_SEL , +/* rk3288 only */ +GRF_CON_DISABLE_ISP , +GRF_CON_ISP_DPHY_SEL , +GRF_DSI_CSI_TESTBUS_SEL , +GRF_DVP_V18SEL , +/* below is for rk3399 only */ +GRF_DPHY_RX0_CLK_INV_SEL , +GRF_DPHY_RX1_CLK_INV_SEL , +}; + +struct dphy_reg { +u16 offset; +u8 mask; +u8 shift; +}; + +#define PHY_REG (_offset, _width, _shift) \ + { .offset = _offset, .mask = BIT(_width) - 1, .shift = _shift, } + +static const struct dphy_reg rk3399_grf_dphy_regs[] = { + [GRF_DPHY_RX0_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON9 ,4 ,0 ), + [GRF_DPHY_RX0_CLK_INV_SEL ] =PHY_REG (RK3399_GRF_SOC_CON9 ,1 ,10 ), + [GRF_DPHY_RX1_CLK_INV_SEL ] =PHY_REG (RK3399_GRF_SOC_CON9 ,1 ,11 ), + [GRF_DPHY_RX0_ENABLE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,0 ), + [GRF_DPHY_RX0_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,4 ), + [GRF_DPHY_RX0_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,8 ), + [GRF_DPHY_RX0_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON21 ,4 ,12 ), + [GRF_DPHY_TX0_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,0 ), + [GRF_DPHY_TX0_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,4 ), + [GRF_DPHY_TX0_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,8 ), + [GRF_DPHY_TX0_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON22 ,4 ,12 ), + [GRF_DPHY_TX1RX1_ENABLE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,0 ), + [GRF_DPHY_TX1RX1_FORCERXMODE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,4 ), + [GRF_DPHY_TX1RX1_FORCETXSTOPMODE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,8 ), + [GRF_DPHY_TX1RX1_TURNDISABLE ] =PHY_REG (RK3399_GRF_SOC_CON23 ,4 ,12 ), + [GRF_DPHY_TX1RX1_TURNREQUEST ] =PHY_REG (RK3399_GRF_SOC_CON24 ,4 ,0 ), + [GRF_DPHY_RX1_SRC_SEL ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,4 ), + [GRF_DPHY_TX1RX1_BASEDIR ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,5 ), + [GRF_DPHY_TX1RX1_ENABLECLK ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,6 ), + [GRF_DPHY_TX1RX1_MASTERSLAVEZ ] =PHY_REG (RK3399_GRF_SOC_CON24 ,1 ,7 ), + [GRF_DPHY_RX0_TESTDIN ] =PHY_REG (RK3399_GRF_SOC_CON25 ,8 ,0 ), + [GRF_DPHY_RX0_TESTEN ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,8 ), + [GRF_DPHY_RX0_TESTCLK ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,9 ), + [GRF_DPHY_RX0_TESTCLR ] =PHY_REG (RK3399_GRF_SOC_CON25 ,1 ,10 ), + [GRF_DPHY_RX0_TESTDOUT ] =PHY_REG (RK3399_GRF_SOC_STATUS1 ,8 ,0 ), +}; + +struct rk_dphy_drv_data { +const char *const *clks; +unsigned int num_clks; +const struct hsfreq_range *hsfreq_ranges; +unsigned int num_hsfreq_ranges; +const struct dphy_reg *regs; +}; + +struct rk_dphy { +struct device *dev; +struct regmap *grf; +struct clk_bulk_data *clks; + +const struct rk_dphy_drv_data *drv_data; +struct phy_configure_opts_mipi_dphy config; + +u8 hsfreq; +};drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 167
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +10
-0+ +static inline void rk_dphy_write_grf (struct rk_dphy *priv, +unsigned int index,u8 value) +{ +const struct dphy_reg *reg = &priv->drv_data->regs[index]; +/* Update high word */ +unsigned int val = (value << reg->shift) | + (reg->mask << (reg->shift +16 )); + +WARN_ON (!reg->offset);Maybe
Quoted 2 lines
if (WARN_ON(!reg->offset)) return;Right.
Quoted 8 lines
Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +8
-0+regmap_write (priv->grf, reg->offset, val); +} + +static void rk_dphy_write (struct rk_dphy *priv, +u8 test_code,u8 test_data) +{ +/* +* With the falling edge on TESTCLK, the TESTDIN[7:0] signal content Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 179
Quoted 4 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +4
-0+* is latched internally as the current test code. Test data is +* programmed internally by rising edge on TESTCLK. +*/ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 );Do we need this first line, as the function always exits with TESTCLK=1, and TESTCLK is initialized to 1 before calling
rk_dphy_writefor the first time ?
Quoted 5 lines
You might be right.
Perhaps we can test if it's fine to drop it, and put a comment saying TESTCLK must be =1 here, so the assumption is clearly stated.
Sounds good to me.
Quoted 203 lines
Quoted 46 lines
Quoted 46 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +46
-0+rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTDIN , test_code); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTEN ,1 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTEN ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTDIN , test_data); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 ); +} + +static void rk_dphy_enable (struct rk_dphy *priv) +{ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_FORCERXMODE ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_FORCETXSTOPMODE ,0 ); + +/* Disable lane turn around, which is ignored in receive mode */ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TURNREQUEST ,0 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TURNDISABLE ,0xf ); + +rk_dphy_write_grf (priv,GRF_DPHY_RX0_ENABLE , +GENMASK (priv->config.lanes -1 ,0 )); + +/* dphy start */ +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLK ,1 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLR ,1 ); +usleep_range (100 ,150 ); +rk_dphy_write_grf (priv,GRF_DPHY_RX0_TESTCLR ,0 ); +usleep_range (100 ,150 ); + +/* set clock lane */ +/* HS hsfreq_range & lane 0 settle bypass */ +rk_dphy_write (priv,CLOCK_LANE_HS_RX_CONTROL ,0 ); +/* HS RX Control of lane0 */ +rk_dphy_write (priv,LANE0_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane1 */ +rk_dphy_write (priv,LANE1_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane2 */ +rk_dphy_write (priv,LANE2_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Control of lane3 */ +rk_dphy_write (priv,LANE3_HS_RX_CONTROL , priv->hsfreq <<1 ); +/* HS RX Data Lanes Settle State Time Control */ +rk_dphy_write (priv,LANES_THS_SETTLE_CONTROL , +THS_SETTLE_COUNTER_THRESHOLD ); + +/* Normal operation */ +rk_dphy_write (priv,0x0 ,0 ); +} +Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 231
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +6
-0+static int rk_dphy_configure (struct phy *phy,union phy_configure_opts *opts) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); +const struct rk_dphy_drv_data *drv_data = priv->drv_data; +struct phy_configure_opts_mipi_dphy *config = &opts->mipi_dphy; +unsigned int i, hsfreq =0 , data_rate_mbps = config->hs_clk_rate;Maybe one variable per line ?
Yeah.
Quoted 15 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 237
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +6
-0+int ret; + +/* pass with phy_mipi_dphy_get_default_config (with pixel rate?) */ + ret =phy_mipi_dphy_config_validate (config); +if (ret) +return ret;I would add a blank line here.
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 238
Quoted 1 line
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +1
-0+do_div (data_rate_mbps,1000 *1000 );
data_rate_mbpsis an unsigned int, so you can usedata_rate_mbps /= 1000 * 1000;Quoted 7 lines
However, you're potentially truncating
hs_clk_rateby assigning it todata_rate_mbps, so I would remove the assignment at declaration time and dodata_rate_mbps = div_u64(config->hs_clk_rate, 1000 * 1000);or define
data_rate_mbpsas an unsigned long.Ah, good catch.
Quoted 106 lines
Quoted 106 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +106
-0+ +dev_dbg (priv->dev,"lanes %d - data_rate_mbps %u\n" , + config->lanes, data_rate_mbps); +for (i =0 ; i < drv_data->num_hsfreq_ranges; i++) { +if (drv_data->hsfreq_ranges[i].range_h >= data_rate_mbps) { + hsfreq = drv_data->hsfreq_ranges[i].cfg_bit; +break ; + } + } +if (!hsfreq) +return -EINVAL ; + + priv->hsfreq = hsfreq; + priv->config = *config; +return 0 ; +} + +static int rk_dphy_power_on (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); +int ret; + + ret =clk_bulk_enable (priv->drv_data->num_clks, priv->clks); +if (ret) +return ret; + +rk_dphy_enable (priv); + +return 0 ; +} + +static int rk_dphy_power_off (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +rk_dphy_write_grf (priv,GRF_DPHY_RX0_ENABLE ,0 ); +clk_bulk_disable (priv->drv_data->num_clks, priv->clks); +return 0 ; +} + +static int rk_dphy_init (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +return clk_bulk_prepare (priv->drv_data->num_clks, priv->clks); +} + +static int rk_dphy_exit (struct phy *phy) +{ +struct rk_dphy *priv =phy_get_drvdata (phy); + +clk_bulk_unprepare (priv->drv_data->num_clks, priv->clks); +return 0 ; +} + +static const struct phy_ops rk_dphy_ops = { + .power_on = rk_dphy_power_on, + .power_off = rk_dphy_power_off, + .init = rk_dphy_init, + .exit = rk_dphy_exit, + .configure = rk_dphy_configure, + .owner =THIS_MODULE , +}; + +static const struct rk_dphy_drv_data rk3399_mipidphy_drv_data = { + .clks = rk3399_mipidphy_clks, + .num_clks =ARRAY_SIZE (rk3399_mipidphy_clks), + .hsfreq_ranges = rk3399_mipidphy_hsfreq_ranges, + .num_hsfreq_ranges =ARRAY_SIZE (rk3399_mipidphy_hsfreq_ranges), + .regs = rk3399_grf_dphy_regs, +}; + +static const struct of_device_id rk_dphy_dt_ids[] = { + { + .compatible ="rockchip,rk3399-mipi-dphy" , + .data = &rk3399_mipidphy_drv_data, + }, + {} +}; +MODULE_DEVICE_TABLE (of, rk_dphy_dt_ids); + +static int rk_dphy_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +const struct rk_dphy_drv_data *drv_data; +struct phy_provider *phy_provider; +const struct of_device_id *of_id; +struct rk_dphy *priv; +struct regmap *grf; +struct phy *phy; +unsigned int i; +int ret; + +if (!dev->parent || !dev->parent->of_node) +return -ENODEV ; + +if (platform_get_resource (pdev,IORESOURCE_MEM ,0 )) { +dev_err (dev,"Rockchip DPHY driver only suports RX mode\n" ); +return -EINVAL ; + } + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + priv->dev = dev;Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c line 349
Quoted 5 lines
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +5
-0+ + grf =syscon_node_to_regmap (dev->parent->of_node); +if (IS_ERR (grf)) { + grf =syscon_regmap_lookup_by_phandle (dev->of_node, +"rockchip,grf" );Is this for backward compatibility with older bindings ? Do we still need it ? If so I would add a comment to explain why.
Right. I think this might end up being required, depending on how the bindings end up loooking like.
Quoted 3 lines
With the above small issues fixed,
Reviewed-by Laurent Pinchart <[email protected]>
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v12 2/11 media: staging: rkisp1: add Rockchip ISP1 base driver
In reply to Helen KoikeAdd base driver for Rockchip Image Signal Processing v1 Unit, with isp subdevice and sensor biddings.
---
Changes in v12:
- Several cleanups, renaming, removal of unecessary code, re-writting for redability, re-structuring
- Fix format/crop pad propagation
- Commit re-organization to not break bisectability
- Fix module's license macro
Changes in v11:
- Fix compiling warnings
- Fix checkpatch errors
Changes in v10:
- unsquash
Changes in v9:
isp
- remove unnecessary double parenthesis
- remove double call to media_entity_remote_pad(local) in get_remote_sensor()
- remove ctrl_handler from struct rkisp1_isp_subdev
- replace v4l2_{dgb,info,warn,err} by dev_*
- fix error returned in link_validate
- remove s_power() callback
- add regwrite/regread wrappers
- add macros RKISP1_DEF_SRC_PAD_FMT/RKISP1_DEF_SINK_PAD_FMT
- several minor cleanups
- s/RKISP1_ISP_PAD_SINK([^_])/RKISP1_ISP_PAD_SINK_VIDEO\1/
- merge tables rkisp1_isp_input_formats and rkisp1_isp_output_formats
- in_fmt and out_fmt as pointers
- simply struct rkisp1_isp_subdev to work correctly with try format
- fix crop/fmt propagation
- squash
- migrate to staging
core
- remove ctrl_handler from struct rkisp1_isp_subdev
- replace v4l2_{dgb,info,warn,err} by dev_*
- s/pr_info/dev_dbg
- s/int size/unsigned int size
- remove module param rkisp1_debug
- coding style fixes
- fix error in subdev_notifier_bound, check dphy before assigning to sensor->dphy
- remove subdevs fixed size array from rkisp1_pipeline
- remove sensors list, as it can be identified from the media topology
- Kconfig: add COMPILE_TEST in the dependency
- use v4l2_pipeline_pm_use and remove _isp_pipeline_s_power() and _subdev_set_power()
- remove struct rkisp1_pipeline and retrieve pipeline information from the media framework
- remove remaining rk3288 code
- cache pixel rate control in sctruct sensor_async_subdev
- remove enum rkisp1_sd_type
- squash
- move to staging
Changes in v8: None
Changes in v7:
isp
- fixed warning because of unknown entity type
- fixed v4l2-compliance errors regarding rkisp1 formats, try formats and default values
- fix typo riksp1/rkisp1
- redesign: remove mipi/csi subdevice, sensors connect directly to the isp subdevice in the media topology now. As a consequence, remove the hack in mipidphy_g_mbus_config() where information from the sensor was being propagated through the topology.
- From the old dphy:
* cache get_remote_sensor() in s_stream
* use V4L2_CID_PIXEL_RATE instead of V4L2_CID_LINK_FREQ
- Replace stream state with a boolean
- code styling and checkpatch fixes
- fix stop_stream (return after calling stop, do not reenable the stream)
- fix rkisp1_isp_sd_get_selection when V4L2_SUBDEV_FORMAT_TRY is set
- fix get format in output (isp_sd->out_fmt.mbus_code was being ignored)
- s/intput/input
- remove #define sd_to_isp_sd(_sd), add a static inline as it will be reused by the capture
core
- VIDEO_ROCKCHIP_ISP1 selects VIDEOBUF2_VMALLOC
- add PHY_ROCKCHIP_DPHY as a dependency for VIDEO_ROCKCHIP_ISP1
- Fix compilation and runtime errors due to bitrotting
The code has bit-rotten since March 2018, fix compilation errors. The new V4L2 async notifier API requires notifiers to be initialized by a call to v4l2_async_notifier_init() before being used, do so.
- Add missing module device table
- use clk_bulk framework
- add missing notifiers cleanups
- s/strlcpy/strscpy
- normalize bus_info name
- fix s_stream error path, stream_cnt wans't being decremented properly
- use devm_platform_ioremap_resource() helper
- s/deice/device
- redesign: remove mipi/csi subdevice, sensors connect directly to the isp subdevice in the media topology now.
- remove "saved_state" member from rkisp1_stream struct
- Reverse the order of MIs
- Simplify MI interrupt handling
Rather than adding unnecessary indirection, just use stream index to handle MI interrupt enable/disable/clear, since the stream index matches the order of bits now, thanks to previous patch. While at it, remove some dead code.
- code styling and checkpatch fixes
drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/rkisp1/Kconfig | 13 + drivers/staging/media/rkisp1/Makefile | 4 + drivers/staging/media/rkisp1/rkisp1-common.c | 37 + drivers/staging/media/rkisp1/rkisp1-common.h | 200 +++ drivers/staging/media/rkisp1/rkisp1-dev.c | 466 +++++++ drivers/staging/media/rkisp1/rkisp1-isp.c | 1133 ++++++++++++++++ drivers/staging/media/rkisp1/rkisp1-regs.h | 1264 ++++++++++++++++++ 9 files changed, 3120 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Kconfig create mode 100644 drivers/staging/media/rkisp1/Makefile create mode 100644 drivers/staging/media/rkisp1/rkisp1-common.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-common.h create mode 100644 drivers/staging/media/rkisp1/rkisp1-dev.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-isp.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-regs.h
drivers/staging/media/Kconfig +2 -0
@@ -40,4 +40,6 @@ source "drivers/staging/media/soc_camera/Kconfig" source "drivers/staging/media/phy-rockchip-dphy/Kconfig" +source "drivers/staging/media/rkisp1/Kconfig" + endif
drivers/staging/media/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_SOC_CAMERA) += soc_camera/ obj-$(CONFIG_PHY_ROCKCHIP_DPHY) += phy-rockchip-dphy/ +obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rkisp1/
drivers/staging/media/rkisp1/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_ROCKCHIP_ISP1 + tristate "Rockchip Image Signal Processing v1 Unit driver" + depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on ARCH_ROCKCHIP || COMPILE_TEST + select VIDEOBUF2_DMA_CONTIG + select VIDEOBUF2_VMALLOC + select V4L2_FWNODE + select PHY_ROCKCHIP_DPHY + default n + help + Support for ISP1 on the rockchip SoC.
drivers/staging/media/rkisp1/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rockchip-isp1.o +rockchip-isp1-objs += rkisp1-common.o \ + rkisp1-dev.o \ + rkisp1-isp.o
drivers/staging/media/rkisp1/rkisp1-common.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* +* Rockchip ISP1 Driver - Common definitions +* +* Copyright (C) 2019 Collabora, Ltd. +*/ + +#include <media/v4l2-rect.h> + +#include "rkisp1-common.h" + +static const struct v4l2_rect rkisp1_sd_min_crop = { + .width =RKISP1_ISP_MIN_WIDTH , + .height =RKISP1_ISP_MIN_HEIGHT , + .top =0 , + .left =0 , +}; + +void rkisp1_sd_adjust_crop_rect (struct v4l2_rect *crop, +const struct v4l2_rect *bounds) +{ +v4l2_rect_set_min_size (crop, &rkisp1_sd_min_crop); +v4l2_rect_map_inside (crop, bounds); +} + +void rkisp1_sd_adjust_crop (struct v4l2_rect *crop, +const struct v4l2_mbus_framefmt *bounds) +{ +struct v4l2_rect crop_bounds = { + .left =0 , + .top =0 , + .width = bounds->width, + .height = bounds->height, + }; + +rkisp1_sd_adjust_crop_rect (crop, &crop_bounds); +}
drivers/staging/media/rkisp1/rkisp1-common.h new file +200 -0
200 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-dev.c new file +466 -0
466 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-isp.c new file +1133 -0
1,133 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-regs.h new file +1264 -0
1,137 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.24.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH v12 02/11] media: staging: rkisp1: add Rockchip ISP1 base driver
Hi Helen,
Just spotted a small thing.
On Fri, 2019-12-27 at 17:01 -0300, Helen Koike wrote:
[..]
Quoted 71 lines
drivers/staging/media/rkisp1/rkisp1-dev.c new file +71
-0+static int rkisp1_probe (struct platform_device *pdev) +{ +struct device_node *node = pdev->dev.of_node; +const struct rkisp1_match_data *clk_data; +const struct of_device_id *match; +struct device *dev = &pdev->dev; +struct rkisp1_device *rkisp1; +struct v4l2_device *v4l2_dev; +unsigned int i; +int ret, irq; + + match =of_match_node (rkisp1_of_match, node); + rkisp1 =devm_kzalloc (dev,sizeof (*rkisp1),GFP_KERNEL ); +if (!rkisp1) +return -ENOMEM ; + +dev_set_drvdata (dev, rkisp1); + rkisp1->dev = dev; + +rkisp1_debug_init (rkisp1); + + rkisp1->base_addr =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (rkisp1->base_addr)) +return PTR_ERR (rkisp1->base_addr); + + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; + + ret =devm_request_irq (dev, irq, rkisp1_isr,IRQF_SHARED , +dev_driver_string (dev), dev); +if (ret) { +dev_err (dev,"request irq failed: %d\n" , ret); +return ret; + } + + rkisp1->irq = irq; + clk_data = match->data; + +for (i =0 ; i < clk_data->size; i++) + rkisp1->clks[i].id = clk_data->clks[i]; + ret =devm_clk_bulk_get (dev, clk_data->size, rkisp1->clks); +if (ret) +return ret; + rkisp1->clk_size = clk_data->size; + +pm_runtime_enable (&pdev->dev); + +strscpy (rkisp1->media_dev.model,RKISP1_DRIVER_NAME , +sizeof (rkisp1->media_dev.model)); + rkisp1->media_dev.dev = &pdev->dev; +strscpy (rkisp1->media_dev.bus_info, +"platform: " RKISP1_DRIVER_NAME , +sizeof (rkisp1->media_dev.bus_info)); +media_device_init (&rkisp1->media_dev); + + v4l2_dev = &rkisp1->v4l2_dev; + v4l2_dev->mdev = &rkisp1->media_dev; +strscpy (v4l2_dev->name,RKISP1_DRIVER_NAME ,sizeof (v4l2_dev->name)); + + ret =v4l2_device_register (rkisp1->dev, &rkisp1->v4l2_dev); +if (ret) +return ret; + + ret =media_device_register (&rkisp1->media_dev); +if (ret) { +dev_err (dev,"Failed to register media device: %d\n" , ret); + goto err_unreg_v4l2_dev; + } + + ret =rkisp1_entities_register (rkisp1);
drivers/staging/media/rkisp1/rkisp1-dev.c line 432
Quoted 10 lines
drivers/staging/media/rkisp1/rkisp1-dev.c new file +10
-0+if (ret) + goto err_unreg_media_dev; + +return 0 ; + +err_unreg_media_dev: +media_device_unregister (&rkisp1->media_dev); +err_unreg_v4l2_dev: +v4l2_device_unregister (&rkisp1->v4l2_dev); +pm_runtime_disable (&pdev->dev);
There's a missing call to debugfs_remove_recursive here.
Quoted 11 lines
drivers/staging/media/rkisp1/rkisp1-dev.c new file +11
-0+return ret; +} + +static int rkisp1_remove (struct platform_device *pdev) +{ +struct rkisp1_device *rkisp1 =platform_get_drvdata (pdev); + +v4l2_async_notifier_unregister (&rkisp1->notifier); +v4l2_async_notifier_cleanup (&rkisp1->notifier); + +rkisp1_isp_unregister (rkisp1);
drivers/staging/media/rkisp1/rkisp1-dev.c line 453
Quoted 10 lines
drivers/staging/media/rkisp1/rkisp1-dev.c new file +10
-0+ +media_device_unregister (&rkisp1->media_dev); +v4l2_device_unregister (&rkisp1->v4l2_dev); + +pm_runtime_disable (&pdev->dev); + +debugfs_remove_recursive (rkisp1->debug.debugfs_dir); +return 0 ; +} +
Thanks,
Ezequiel
PATCH v12 3/11 media: staging: rkisp1: add streaming paths
In reply to Helen KoikeAdd v4l2 capture device interface to rkisp1 driver, allowing users to get frames from ISP1.
ISP1 has two major streaming paths, mainpah and selfpah, with different capabilities.
Each one has an independent crop and resizer, thus add a capture video device and a resizer subdevice for each of the paths.
---
Changes in v12:
- Several cleanups, renaming, removal of unecessary code, re-writting for redability, code re-structuring to increase maintainability
- debugfs
- resizer and crop was moved out from the capture to its own media subdevice implemented in rkisp1-resizer.c
- Commit re-organization to not break bisectability
Changes in v11:
capture
- fix checkpatch errors
Changes in v10:
- unsquash
Changes in v9:
- fix typos
- fix queue_setup: different behaviour when num_plane is 0 or not
- replace v4l2_{dgb,info,warn,err} by dev_*
- squash
- move to staging
Changes in v8: None
Changes in v7:
- s/strlcpy/strscpy
- Fix v4l2-compliance issues:
* remove input ioctls
media api can be used to define the topology, this input api is not required. Besides it, if an input is enumerated, v4l2-compliance is not happy with G_FMT returning the default colorspace instead of something more specific.
* return the pixelformat to the userspace
G_/S_/TRY_ FORMAT should return a valid pixelformat to the user, even if the user gave an invalid one
* add missing default colorspace and ycbcr
* fix wrong pixformat in mp_fmts[] table
* add buf type check in s_/g_selection
* queue_setup - check sizes
* normalize bus_info name
* fix field any v4l2-compliance -s complain - set field none when streaming
- Fix compiling error: s/vidioc_enum_fmt_vid_cap_mplane/vidioc_enum_fmt_vid_cap
- Replace stream state with a boolean
The rkisp1_state enum consists only of 3 entries, where 1 is completely unused and the other two respectively mean not streaming or streaming. Replace it with a boolean called "streaming".
- Simplify MI interrupt handling
Rather than adding unnecessary indirection, just use stream index to handle MI interrupt enable/disable/clear, since the stream index matches the order of bits now, thanks to previous patch. While at it, remove some dead code.
- code styling and checkpatch fixes
- add link_validate: don't allow a link with bayer/non-bayer mismatch
drivers/staging/media/rkisp1/Makefile | 6 +- drivers/staging/media/rkisp1/rkisp1-capture.c | 1437 +++++++++++++++++ drivers/staging/media/rkisp1/rkisp1-common.h | 72 + drivers/staging/media/rkisp1/rkisp1-dev.c | 81 +- drivers/staging/media/rkisp1/rkisp1-resizer.c | 775 +++++++++ 5 files changed, 2364 insertions(+), 7 deletions(-) create mode 100644 drivers/staging/media/rkisp1/rkisp1-capture.c create mode 100644 drivers/staging/media/rkisp1/rkisp1-resizer.c
drivers/staging/media/rkisp1/Makefile +4 -2
@@ -1,4 +1,6 @@ obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rockchip-isp1.o -rockchip-isp1-objs += rkisp1-common.o \ +rockchip-isp1-objs += rkisp1-capture.o \ + rkisp1-common.o \ rkisp1-dev.o \ - rkisp1-isp.o + rkisp1-isp.o \ + rkisp1-resizer.o
drivers/staging/media/rkisp1/rkisp1-capture.c new file +1437 -0
1,437 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-common.h +72 -0
106 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-dev.c +76 -5
143 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-resizer.c new file +775 -0
775 lines not on this page · raw message
Signature · 1 line
2.24.0
PATCH v12 4/11 media: staging: rkisp1: add user space ABI definitions
In reply to Helen KoikeFrom: Jeffy Chen <[email protected]>
Add the header for userspace
---
Changes in v12:
- Change Jacob's email to original [email protected]
Changes in v11:
- fix checkpatch errors
Changes in v10:
- unsquash
- define metadata pixelformats in uapi/rkisp1-config.h
Changes in v9:
- squash
- move to staging
Changes in v8: None
Changes in v7:
- Fix checkpatch errors (lines over 80 and SPDX)
- Add TODO to improve docs
.../staging/media/rkisp1/uapi/rkisp1-config.h | 819 ++++++++++++++++++ 1 file changed, 819 insertions(+) create mode 100644 drivers/staging/media/rkisp1/uapi/rkisp1-config.h
drivers/staging/media/rkisp1/uapi/rkisp1-config.h new file +819 -0
@@ -0,0 +1,819 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ +/* +* Rockchip ISP1 userspace API +* Copyright (C) 2017 Rockchip Electronics Co., Ltd. +*/ + +/* +* TODO: Improve documentation, mostly regarding abbreviation and hardware +* specificities. Reference: "REF_01 - ISP_user_manual, Rev 2.57" (not public) +*/ + +#ifndef _UAPI_RKISP1_CONFIG_H +#define _UAPI_RKISP1_CONFIG_H + +#include <linux/types.h> + +/* Vendor specific - used for RK_ISP1 camera sub-system */ +#define V4L2_META_FMT_RK_ISP1_PARAMS v4l2_fourcc('R', 'K', '1', 'P')/* Rockchip ISP1 params */ +#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S')/* Rockchip ISP1 3A statistics */ + +#define RKISP1_CIF_ISP_MODULE_DPCC BIT(0) +#define RKISP1_CIF_ISP_MODULE_BLS BIT(1) +#define RKISP1_CIF_ISP_MODULE_SDG BIT(2) +#define RKISP1_CIF_ISP_MODULE_HST BIT(3) +#define RKISP1_CIF_ISP_MODULE_LSC BIT(4) +#define RKISP1_CIF_ISP_MODULE_AWB_GAIN BIT(5) +#define RKISP1_CIF_ISP_MODULE_FLT BIT(6) +#define RKISP1_CIF_ISP_MODULE_BDM BIT(7) +#define RKISP1_CIF_ISP_MODULE_CTK BIT(8) +#define RKISP1_CIF_ISP_MODULE_GOC BIT(9) +#define RKISP1_CIF_ISP_MODULE_CPROC BIT(10) +#define RKISP1_CIF_ISP_MODULE_AFC BIT(11) +#define RKISP1_CIF_ISP_MODULE_AWB BIT(12) +#define RKISP1_CIF_ISP_MODULE_IE BIT(13) +#define RKISP1_CIF_ISP_MODULE_AEC BIT(14) +#define RKISP1_CIF_ISP_MODULE_WDR BIT(15) +#define RKISP1_CIF_ISP_MODULE_DPF BIT(16) +#define RKISP1_CIF_ISP_MODULE_DPF_STRENGTH BIT(17) + +#define RKISP1_CIF_ISP_CTK_COEFF_MAX 0x100 +#define RKISP1_CIF_ISP_CTK_OFFSET_MAX 0x800 + +#define RKISP1_CIF_ISP_AE_MEAN_MAX 25 +#define RKISP1_CIF_ISP_HIST_BIN_N_MAX 16 +#define RKISP1_CIF_ISP_AFM_MAX_WINDOWS 3 +#define RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE 17 + +#define RKISP1_CIF_ISP_BDM_MAX_TH 0xff + +/* +* Black level compensation +*/ +/* maximum value for horizontal start address */ +#define RKISP1_CIF_ISP_BLS_START_H_MAX 0x00000fff +/* maximum value for horizontal stop address */ +#define RKISP1_CIF_ISP_BLS_STOP_H_MAX 0x00000fff +/* maximum value for vertical start address */ +#define RKISP1_CIF_ISP_BLS_START_V_MAX 0x00000fff +/* maximum value for vertical stop address */ +#define RKISP1_CIF_ISP_BLS_STOP_V_MAX 0x00000fff +/* maximum is 2^18 = 262144*/ +#define RKISP1_CIF_ISP_BLS_SAMPLES_MAX 0x00000012 +/* maximum value for fixed black level */ +#define RKISP1_CIF_ISP_BLS_FIX_SUB_MAX 0x00000fff +/* minimum value for fixed black level */ +#define RKISP1_CIF_ISP_BLS_FIX_SUB_MIN 0xfffff000 +/* 13 bit range (signed)*/ +#define RKISP1_CIF_ISP_BLS_FIX_MASK 0x00001fff + +/* +* Automatic white balance measurments +*/ +#define RKISP1_CIF_ISP_AWB_MAX_GRID 1 +#define RKISP1_CIF_ISP_AWB_MAX_FRAMES 7 + +/* +* Gamma out +*/ +/* Maximum number of color samples supported */ +#define RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES 17 + +/* +* Lens shade correction +*/ +#define RKISP1_CIF_ISP_LSC_GRAD_TBL_SIZE 8 +#define RKISP1_CIF_ISP_LSC_SIZE_TBL_SIZE 8 +/* +* The following matches the tuning process, +* not the max capabilities of the chip. +* Last value unused. +*/ +#define RKISP1_CIF_ISP_LSC_DATA_TBL_SIZE 290 + +/* +* Histogram calculation +*/ +/* Last 3 values unused. */ +#define RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE 28 + +/* +* Defect Pixel Cluster Correction +*/ +#define RKISP1_CIF_ISP_DPCC_METHODS_MAX 3 + +/* +* Denoising pre filter +*/ +#define RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS 17 +#define RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS 6 + +/* +* Measurement types +*/ +#define RKISP1_CIF_ISP_STAT_AWB BIT(0) +#define RKISP1_CIF_ISP_STAT_AUTOEXP BIT(1) +#define RKISP1_CIF_ISP_STAT_AFM_FIN BIT(2) +#define RKISP1_CIF_ISP_STAT_HIST BIT(3) + +enum rkisp1_cif_isp_histogram_mode { +RKISP1_CIF_ISP_HISTOGRAM_MODE_DISABLE , +RKISP1_CIF_ISP_HISTOGRAM_MODE_RGB_COMBINED , +RKISP1_CIF_ISP_HISTOGRAM_MODE_R_HISTOGRAM , +RKISP1_CIF_ISP_HISTOGRAM_MODE_G_HISTOGRAM , +RKISP1_CIF_ISP_HISTOGRAM_MODE_B_HISTOGRAM , +RKISP1_CIF_ISP_HISTOGRAM_MODE_Y_HISTOGRAM +}; + +enum rkisp1_cif_isp_awb_mode_type { +RKISP1_CIF_ISP_AWB_MODE_MANUAL , +RKISP1_CIF_ISP_AWB_MODE_RGB , +RKISP1_CIF_ISP_AWB_MODE_YCBCR +}; + +enum rkisp1_cif_isp_flt_mode { +RKISP1_CIF_ISP_FLT_STATIC_MODE , +RKISP1_CIF_ISP_FLT_DYNAMIC_MODE +}; + +/** +* enum rkisp1_cif_isp_exp_ctrl_autostop - stop modes +* @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0: continuous measurement +* @RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1: stop measuring after a complete frame +*/ +enum rkisp1_cif_isp_exp_ctrl_autostop { +RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_0 =0 , +RKISP1_CIF_ISP_EXP_CTRL_AUTOSTOP_1 =1 , +}; + +/** +* enum rkisp1_cif_isp_exp_meas_mode - Exposure measure mode +* @RKISP1_CIF_ISP_EXP_MEASURING_MODE_0: Y = 16 + 0.25R + 0.5G + 0.1094B +* @RKISP1_CIF_ISP_EXP_MEASURING_MODE_1: Y = (R + G + B) x (85/256) +*/ +enum rkisp1_cif_isp_exp_meas_mode { +RKISP1_CIF_ISP_EXP_MEASURING_MODE_0 , +RKISP1_CIF_ISP_EXP_MEASURING_MODE_1 , +}; + +/*---------- PART1: Input Parameters ------------*/ + +struct rkisp1_cif_isp_window { +__u16 h_offs; +__u16 v_offs; +__u16 h_size; +__u16 v_size; +} __packed; + +/** +* struct rkisp1_cif_isp_bls_fixed_val - BLS fixed subtraction values +* +* The values will be subtracted from the sensor +* values. Therefore a negative value means addition instead of subtraction! +* +* @r: Fixed (signed!) subtraction value for Bayer pattern R +* @gr: Fixed (signed!) subtraction value for Bayer pattern Gr +* @gb: Fixed (signed!) subtraction value for Bayer pattern Gb +* @b: Fixed (signed!) subtraction value for Bayer pattern B +*/ +struct rkisp1_cif_isp_bls_fixed_val { +__s16 r; +__s16 gr; +__s16 gb; +__s16 b; +} __packed; + +/** +* struct rkisp1_cif_isp_bls_config - Configuration used by black level subtraction +* +* @enable_auto: Automatic mode activated means that the measured values +* are subtracted. Otherwise the fixed subtraction +* values will be subtracted. +* @en_windows: enabled window +* @bls_window1: Measurement window 1 size +* @bls_window2: Measurement window 2 size +* @bls_samples: Set amount of measured pixels for each Bayer position +* (A, B,C and D) to 2^bls_samples. +* @fixed_val: Fixed subtraction values +*/ +struct rkisp1_cif_isp_bls_config { +__u8 enable_auto; +__u8 en_windows; +struct rkisp1_cif_isp_window bls_window1; +struct rkisp1_cif_isp_window bls_window2; +__u8 bls_samples; +struct rkisp1_cif_isp_bls_fixed_val fixed_val; +} __packed; + +/** +* struct rkisp1_cif_isp_dpcc_methods_config - Methods Configuration used by DPCC +* +* Methods Configuration used by Defect Pixel Cluster Correction +* +* @method: Method enable bits +* @line_thresh: Line threshold +* @line_mad_fac: Line MAD factor +* @pg_fac: Peak gradient factor +* @rnd_thresh: Rank Neighbor Difference threshold +* @rg_fac: Rank gradient factor +*/ +struct rkisp1_cif_isp_dpcc_methods_config { +__u32 method; +__u32 line_thresh; +__u32 line_mad_fac; +__u32 pg_fac; +__u32 rnd_thresh; +__u32 rg_fac; +} __packed; + +/** +* struct rkisp1_cif_isp_dpcc_config - Configuration used by DPCC +* +* Configuration used by Defect Pixel Cluster Correction +* +* @mode: dpcc output mode +* @output_mode: whether use hard coded methods +* @set_use: stage1 methods set +* @methods: methods config +* @ro_limits: rank order limits +* @rnd_offs: differential rank offsets for rank neighbor difference +*/ +struct rkisp1_cif_isp_dpcc_config { +__u32 mode; +__u32 output_mode; +__u32 set_use; +struct rkisp1_cif_isp_dpcc_methods_config methods[RKISP1_CIF_ISP_DPCC_METHODS_MAX ]; +__u32 ro_limits; +__u32 rnd_offs; +} __packed; + +struct rkisp1_cif_isp_gamma_corr_curve { +__u16 gamma_y[RKISP1_CIF_ISP_DEGAMMA_CURVE_SIZE ]; +} __packed; + +struct rkisp1_cif_isp_gamma_curve_x_axis_pnts { +__u32 gamma_dx0; +__u32 gamma_dx1; +} __packed; + +/** +* struct rkisp1_cif_isp_sdg_config - Configuration used by sensor degamma +* +* @curve_x: gamma curve point definition axis for x +* @xa_pnts: x increments +*/ +struct rkisp1_cif_isp_sdg_config { +struct rkisp1_cif_isp_gamma_corr_curve curve_r; +struct rkisp1_cif_isp_gamma_corr_curve curve_g; +struct rkisp1_cif_isp_gamma_corr_curve curve_b; +struct rkisp1_cif_isp_gamma_curve_x_axis_pnts xa_pnts; +} __packed; + +/** +* struct rkisp1_cif_isp_lsc_config - Configuration used by Lens shading correction +* +* refer to REF_01 for details +*/ +struct rkisp1_cif_isp_lsc_config { +__u32 r_data_tbl[RKISP1_CIF_ISP_LSC_DATA_TBL_SIZE ]; +__u32 gr_data_tbl[RKISP1_CIF_ISP_LSC_DATA_TBL_SIZE ]; +__u32 gb_data_tbl[RKISP1_CIF_ISP_LSC_DATA_TBL_SIZE ]; +__u32 b_data_tbl[RKISP1_CIF_ISP_LSC_DATA_TBL_SIZE ]; + +__u32 x_grad_tbl[RKISP1_CIF_ISP_LSC_GRAD_TBL_SIZE ]; +__u32 y_grad_tbl[RKISP1_CIF_ISP_LSC_GRAD_TBL_SIZE ]; + +__u32 x_size_tbl[RKISP1_CIF_ISP_LSC_SIZE_TBL_SIZE ]; +__u32 y_size_tbl[RKISP1_CIF_ISP_LSC_SIZE_TBL_SIZE ]; +__u16 config_width; +__u16 config_height; +} __packed; + +/** +* struct rkisp1_cif_isp_ie_config - Configuration used by image effects +* +* @eff_mat_1: 3x3 Matrix Coefficients for Emboss Effect 1 +* @eff_mat_2: 3x3 Matrix Coefficients for Emboss Effect 2 +* @eff_mat_3: 3x3 Matrix Coefficients for Emboss 3/Sketch 1 +* @eff_mat_4: 3x3 Matrix Coefficients for Sketch Effect 2 +* @eff_mat_5: 3x3 Matrix Coefficients for Sketch Effect 3 +* @eff_tint: Chrominance increment values of tint (used for sepia effect) +*/ +struct rkisp1_cif_isp_ie_config { +__u16 effect; +__u16 color_sel; +__u16 eff_mat_1; +__u16 eff_mat_2; +__u16 eff_mat_3; +__u16 eff_mat_4; +__u16 eff_mat_5; +__u16 eff_tint; +} __packed; + +/** +* struct rkisp1_cif_isp_cproc_config - Configuration used by Color Processing +* +* @c_out_range: Chrominance pixel clipping range at output. +* (0 for limit, 1 for full) +* @y_in_range: Luminance pixel clipping range at output. +* @y_out_range: Luminance pixel clipping range at output. +* @contrast: 00~ff, 0.0~1.992 +* @brightness: 80~7F, -128~+127 +* @sat: saturation, 00~FF, 0.0~1.992 +* @hue: 80~7F, -90~+87.188 +*/ +struct rkisp1_cif_isp_cproc_config { +__u8 c_out_range; +__u8 y_in_range; +__u8 y_out_range; +__u8 contrast; +__u8 brightness; +__u8 sat; +__u8 hue; +} __packed; + +/** +* struct rkisp1_cif_isp_awb_meas_config - Configuration used by auto white balance +* +* @awb_wnd: white balance measurement window (in pixels) +* (from enum rkisp1_cif_isp_awb_mode_type) +* @max_y: only pixels values < max_y contribute to awb measurement, set to 0 +* to disable this feature +* @min_y: only pixels values > min_y contribute to awb measurement +* @max_csum: Chrominance sum maximum value, only consider pixels with Cb+Cr, +* smaller than threshold for awb measurements +* @min_c: Chrominance minimum value, only consider pixels with Cb/Cr +* each greater than threshold value for awb measurements +* @frames: number of frames - 1 used for mean value calculation +* (ucFrames=0 means 1 Frame) +* @awb_ref_cr: reference Cr value for AWB regulation, target for AWB +* @awb_ref_cb: reference Cb value for AWB regulation, target for AWB +*/ +struct rkisp1_cif_isp_awb_meas_config { +/* +* Note: currently the h and v offsets are mapped to grid offsets +*/ +struct rkisp1_cif_isp_window awb_wnd; +__u32 awb_mode; +__u8 max_y; +__u8 min_y; +__u8 max_csum; +__u8 min_c; +__u8 frames; +__u8 awb_ref_cr; +__u8 awb_ref_cb; +__u8 enable_ymax_cmp; +} __packed; + +/** +* struct rkisp1_cif_isp_awb_gain_config - Configuration used by auto white balance gain +* +* out_data_x = ( AWB_GEAIN_X * in_data + 128) >> 8 +*/ +struct rkisp1_cif_isp_awb_gain_config { +__u16 gain_red; +__u16 gain_green_r; +__u16 gain_blue; +__u16 gain_green_b; +} __packed; + +/** +* struct rkisp1_cif_isp_flt_config - Configuration used by ISP filtering +* +* @mode: ISP_FILT_MODE register fields (from enum rkisp1_cif_isp_flt_mode) +* @grn_stage1: ISP_FILT_MODE register fields +* @chr_h_mode: ISP_FILT_MODE register fields +* @chr_v_mode: ISP_FILT_MODE register fields +* +* refer to REF_01 for details. +*/ + +struct rkisp1_cif_isp_flt_config { +__u32 mode; +__u8 grn_stage1; +__u8 chr_h_mode; +__u8 chr_v_mode; +__u32 thresh_bl0; +__u32 thresh_bl1; +__u32 thresh_sh0; +__u32 thresh_sh1; +__u32 lum_weight; +__u32 fac_sh1; +__u32 fac_sh0; +__u32 fac_mid; +__u32 fac_bl0; +__u32 fac_bl1; +} __packed; + +/** +* struct rkisp1_cif_isp_bdm_config - Configuration used by Bayer DeMosaic +* +* @demosaic_th: threshod for bayer demosaicing texture detection +*/ +struct rkisp1_cif_isp_bdm_config { +__u8 demosaic_th; +} __packed; + +/** +* struct rkisp1_cif_isp_ctk_config - Configuration used by Cross Talk correction +* +* @coeff: color correction matrix +* @ct_offset_b: offset for the crosstalk correction matrix +*/ +struct rkisp1_cif_isp_ctk_config { +__u16 coeff0; +__u16 coeff1; +__u16 coeff2; +__u16 coeff3; +__u16 coeff4; +__u16 coeff5; +__u16 coeff6; +__u16 coeff7; +__u16 coeff8; +__u16 ct_offset_r; +__u16 ct_offset_g; +__u16 ct_offset_b; +} __packed; + +enum rkisp1_cif_isp_goc_mode { +RKISP1_CIF_ISP_GOC_MODE_LOGARITHMIC , +RKISP1_CIF_ISP_GOC_MODE_EQUIDISTANT +}; + +/** +* struct rkisp1_cif_isp_goc_config - Configuration used by Gamma Out correction +* +* @mode: goc mode (from enum rkisp1_cif_isp_goc_mode) +* @gamma_y: gamma out curve y-axis for all color components +*/ +struct rkisp1_cif_isp_goc_config { +__u32 mode; +__u16 gamma_y[RKISP1_CIF_ISP_GAMMA_OUT_MAX_SAMPLES ]; +} __packed; + +/** +* struct rkisp1_cif_isp_hst_config - Configuration used by Histogram +* +* @mode: histogram mode (from enum rkisp1_cif_isp_histogram_mode) +* @histogram_predivider: process every stepsize pixel, all other pixels are +* skipped +* @meas_window: coordinates of the measure window +* @hist_weight: weighting factor for sub-windows +*/ +struct rkisp1_cif_isp_hst_config { +__u32 mode; +__u8 histogram_predivider; +struct rkisp1_cif_isp_window meas_window; +__u8 hist_weight[RKISP1_CIF_ISP_HISTOGRAM_WEIGHT_GRIDS_SIZE ]; +} __packed; + +/** +* struct rkisp1_cif_isp_aec_config - Configuration used by Auto Exposure Control +* +* @mode: Exposure measure mode (from enum rkisp1_cif_isp_exp_meas_mode) +* @autostop: stop mode (from enum rkisp1_cif_isp_exp_ctrl_autostop) +* @meas_window: coordinates of the measure window +*/ +struct rkisp1_cif_isp_aec_config { +__u32 mode; +__u32 autostop; +struct rkisp1_cif_isp_window meas_window; +} __packed; + +/** +* struct rkisp1_cif_isp_afc_config - Configuration used by Auto Focus Control +* +* @num_afm_win: max RKISP1_CIF_ISP_AFM_MAX_WINDOWS +* @afm_win: coordinates of the meas window +* @thres: threshold used for minimizing the influence of noise +* @var_shift: the number of bits for the shift operation at the end of the +* calculation chain. +*/ +struct rkisp1_cif_isp_afc_config { +__u8 num_afm_win; +struct rkisp1_cif_isp_window afm_win[RKISP1_CIF_ISP_AFM_MAX_WINDOWS ]; +__u32 thres; +__u32 var_shift; +} __packed; + +/** +* enum rkisp1_cif_isp_dpf_gain_usage - dpf gain usage +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED: don't use any gains in preprocessing stage +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS: use only the noise function gains from +* registers DPF_NF_GAIN_R, ... +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS: use only the gains from LSC module +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS: use the noise function gains and the +* gains from LSC module +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS: use only the gains from AWB module +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS: use the gains from AWB and LSC module +* @RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX: upper border (only for an internal evaluation) +*/ +enum rkisp1_cif_isp_dpf_gain_usage { +RKISP1_CIF_ISP_DPF_GAIN_USAGE_DISABLED , +RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_GAINS , +RKISP1_CIF_ISP_DPF_GAIN_USAGE_LSC_GAINS , +RKISP1_CIF_ISP_DPF_GAIN_USAGE_NF_LSC_GAINS , +RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_GAINS , +RKISP1_CIF_ISP_DPF_GAIN_USAGE_AWB_LSC_GAINS , +RKISP1_CIF_ISP_DPF_GAIN_USAGE_MAX +}; + +/** +* enum rkisp1_cif_isp_dpf_rb_filtersize - Red and blue filter sizes +* @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9: red and blue filter kernel size 13x9 +* (means 7x5 active pixel) +* @RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9: red and blue filter kernel size 9x9 +* (means 5x5 active pixel) +*/ +enum rkisp1_cif_isp_dpf_rb_filtersize { + RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_13x9, + RKISP1_CIF_ISP_DPF_RB_FILTERSIZE_9x9, +}; + +/** +* enum rkisp1_cif_isp_dpf_nll_scale_mode - dpf noise level scale mode +* @RKISP1_CIF_ISP_NLL_SCALE_LINEAR: use a linear scaling +* @RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC: use a logarithmic scaling +*/ +enum rkisp1_cif_isp_dpf_nll_scale_mode { +RKISP1_CIF_ISP_NLL_SCALE_LINEAR , +RKISP1_CIF_ISP_NLL_SCALE_LOGARITHMIC , +}; + +/** +* struct rkisp1_cif_isp_dpf_nll - Noise level lookup +* +* @coeff: Noise level Lookup coefficient +* @scale_mode: dpf noise level scale mode (from enum rkisp1_cif_isp_dpf_nll_scale_mode) +*/ +struct rkisp1_cif_isp_dpf_nll { +__u16 coeff[RKISP1_CIF_ISP_DPF_MAX_NLF_COEFFS ]; +__u32 scale_mode; +} __packed; + +/** +* struct rkisp1_cif_isp_dpf_rb_flt - Red blue filter config +* +* @fltsize: The filter size for the red and blue pixels +* (from enum rkisp1_cif_isp_dpf_rb_filtersize) +* @spatial_coeff: Spatial weights +* @r_enable: enable filter processing for red pixels +* @b_enable: enable filter processing for blue pixels +*/ +struct rkisp1_cif_isp_dpf_rb_flt { +__u32 fltsize; +__u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS ]; +__u8 r_enable; +__u8 b_enable; +} __packed; + +/** +* struct rkisp1_cif_isp_dpf_g_flt - Green filter Configuration +* +* @spatial_coeff: Spatial weights +* @gr_enable: enable filter processing for green pixels in green/red lines +* @gb_enable: enable filter processing for green pixels in green/blue lines +*/ +struct rkisp1_cif_isp_dpf_g_flt { +__u8 spatial_coeff[RKISP1_CIF_ISP_DPF_MAX_SPATIAL_COEFFS ]; +__u8 gr_enable; +__u8 gb_enable; +} __packed; + +/** +* struct rkisp1_cif_isp_dpf_gain - Noise function Configuration +* +* @mode: dpf gain usage (from enum rkisp1_cif_isp_dpf_gain_usage) +* @nf_r_gain: Noise function Gain that replaces the AWB gain for red pixels +* @nf_b_gain: Noise function Gain that replaces the AWB gain for blue pixels +* @nf_gr_gain: Noise function Gain that replaces the AWB gain +* for green pixels in a red line +* @nf_gb_gain: Noise function Gain that replaces the AWB gain +* for green pixels in a blue line +*/ +struct rkisp1_cif_isp_dpf_gain { +__u32 mode; +__u16 nf_r_gain; +__u16 nf_b_gain; +__u16 nf_gr_gain; +__u16 nf_gb_gain; +} __packed; + +/** +* struct rkisp1_cif_isp_dpf_config - Configuration used by De-noising pre-filter +* +* @gain: noise function gain +* @g_flt: green filter config +* @rb_flt: red blue filter config +* @nll: noise level lookup +*/ +struct rkisp1_cif_isp_dpf_config { +struct rkisp1_cif_isp_dpf_gain gain; +struct rkisp1_cif_isp_dpf_g_flt g_flt; +struct rkisp1_cif_isp_dpf_rb_flt rb_flt; +struct rkisp1_cif_isp_dpf_nll nll; +} __packed; + +/** +* struct rkisp1_cif_isp_dpf_strength_config - strength of the filter +* +* @r: filter strength of the RED filter +* @g: filter strength of the GREEN filter +* @b: filter strength of the BLUE filter +*/ +struct rkisp1_cif_isp_dpf_strength_config { +__u8 r; +__u8 g; +__u8 b; +} __packed; + +/** +* struct rkisp1_cif_isp_isp_other_cfg - Parameters for some blocks in rockchip isp1 +* +* @dpcc_config: Defect Pixel Cluster Correction config +* @bls_config: Black Level Subtraction config +* @sdg_config: sensor degamma config +* @lsc_config: Lens Shade config +* @awb_gain_config: Auto White balance gain config +* @flt_config: filter config +* @bdm_config: demosaic config +* @ctk_config: cross talk config +* @goc_config: gamma out config +* @bls_config: black level subtraction config +* @dpf_config: De-noising pre-filter config +* @dpf_strength_config: dpf strength config +* @cproc_config: color process config +* @ie_config: image effects config +*/ +struct rkisp1_cif_isp_isp_other_cfg { +struct rkisp1_cif_isp_dpcc_config dpcc_config; +struct rkisp1_cif_isp_bls_config bls_config; +struct rkisp1_cif_isp_sdg_config sdg_config; +struct rkisp1_cif_isp_lsc_config lsc_config; +struct rkisp1_cif_isp_awb_gain_config awb_gain_config; +struct rkisp1_cif_isp_flt_config flt_config; +struct rkisp1_cif_isp_bdm_config bdm_config; +struct rkisp1_cif_isp_ctk_config ctk_config; +struct rkisp1_cif_isp_goc_config goc_config; +struct rkisp1_cif_isp_dpf_config dpf_config; +struct rkisp1_cif_isp_dpf_strength_config dpf_strength_config; +struct rkisp1_cif_isp_cproc_config cproc_config; +struct rkisp1_cif_isp_ie_config ie_config; +} __packed; + +/** +* struct rkisp1_cif_isp_isp_meas_cfg - Rockchip ISP1 Measure Parameters +* +* @awb_meas_config: auto white balance config +* @hst_config: histogram config +* @aec_config: auto exposure config +* @afc_config: auto focus config +*/ +struct rkisp1_cif_isp_isp_meas_cfg { +struct rkisp1_cif_isp_awb_meas_config awb_meas_config; +struct rkisp1_cif_isp_hst_config hst_config; +struct rkisp1_cif_isp_aec_config aec_config; +struct rkisp1_cif_isp_afc_config afc_config; +} __packed; + +/** +* struct rkisp1_params_cfg - Rockchip ISP1 Input Parameters Meta Data +* +* @module_en_update: mask the enable bits of which module should be updated +* @module_ens: mask the enable value of each module, only update the module +* which correspond bit was set in module_en_update +* @module_cfg_update: mask the config bits of which module should be updated +* @meas: measurement config +* @others: other config +*/ +struct rkisp1_params_cfg { +__u32 module_en_update; +__u32 module_ens; +__u32 module_cfg_update; + +struct rkisp1_cif_isp_isp_meas_cfg meas; +struct rkisp1_cif_isp_isp_other_cfg others; +} __packed; + +/*---------- PART2: Measurement Statistics ------------*/ + +/** +* struct rkisp1_cif_isp_awb_meas - AWB measured values +* +* @cnt: White pixel count, number of "white pixels" found during last +* measurement +* @mean_y_or_g: Mean value of Y within window and frames, +* Green if RGB is selected. +* @mean_cb_or_b: Mean value of Cb within window and frames, +* Blue if RGB is selected. +* @mean_cr_or_r: Mean value of Cr within window and frames, +* Red if RGB is selected. +*/ +struct rkisp1_cif_isp_awb_meas { +__u32 cnt; +__u8 mean_y_or_g; +__u8 mean_cb_or_b; +__u8 mean_cr_or_r; +} __packed; + +/** +* struct rkisp1_cif_isp_awb_stat - statistics automatic white balance data +* +* @awb_mean: Mean measured data +*/ +struct rkisp1_cif_isp_awb_stat { +struct rkisp1_cif_isp_awb_meas awb_mean[RKISP1_CIF_ISP_AWB_MAX_GRID ]; +} __packed; + +/** +* struct rkisp1_cif_isp_bls_meas_val - BLS measured values +* +* @meas_r: Mean measured value for Bayer pattern R +* @meas_gr: Mean measured value for Bayer pattern Gr +* @meas_gb: Mean measured value for Bayer pattern Gb +* @meas_b: Mean measured value for Bayer pattern B +*/ +struct rkisp1_cif_isp_bls_meas_val { +__u16 meas_r; +__u16 meas_gr; +__u16 meas_gb; +__u16 meas_b; +} __packed; + +/** +* struct rkisp1_cif_isp_ae_stat - statistics auto exposure data +* +* @exp_mean: Mean luminance value of block xx +* @bls_val: BLS measured values +* +* Image is divided into 5x5 blocks. +*/ +struct rkisp1_cif_isp_ae_stat { +__u8 exp_mean[RKISP1_CIF_ISP_AE_MEAN_MAX ]; +struct rkisp1_cif_isp_bls_meas_val bls_val; +} __packed; + +/** +* struct rkisp1_cif_isp_af_meas_val - AF measured values +* +* @sum: sharpness, refer to REF_01 for definition +* @lum: luminance, refer to REF_01 for definition +*/ +struct rkisp1_cif_isp_af_meas_val { +__u32 sum; +__u32 lum; +} __packed; + +/** +* struct rkisp1_cif_isp_af_stat - statistics auto focus data +* +* @window: AF measured value of window x +* +* The module measures the sharpness in 3 windows of selectable size via +* register settings(ISP_AFM_*_A/B/C) +*/ +struct rkisp1_cif_isp_af_stat { +struct rkisp1_cif_isp_af_meas_val window[RKISP1_CIF_ISP_AFM_MAX_WINDOWS ]; +} __packed; + +/** +* struct rkisp1_cif_isp_hist_stat - statistics histogram data +* +* @hist_bins: measured bin counters +* +* Measurement window divided into 25 sub-windows, set +* with ISP_HIST_XXX +*/ +struct rkisp1_cif_isp_hist_stat { +__u16 hist_bins[RKISP1_CIF_ISP_HIST_BIN_N_MAX ]; +} __packed; + +/** +* struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Data +* +* @rkisp1_cif_isp_awb_stat: statistics data for automatic white balance +* @rkisp1_cif_isp_ae_stat: statistics data for auto exposure +* @rkisp1_cif_isp_af_stat: statistics data for auto focus +* @rkisp1_cif_isp_hist_stat: statistics histogram data +*/ +struct rkisp1_cif_isp_stat { +struct rkisp1_cif_isp_awb_stat awb; +struct rkisp1_cif_isp_ae_stat ae; +struct rkisp1_cif_isp_af_stat af; +struct rkisp1_cif_isp_hist_stat hist; +} __packed; + +/** +* struct rkisp1_stat_buffer - Rockchip ISP1 Statistics Meta Data +* +* @meas_type: measurement types (RKISP1_CIF_ISP_STAT_ definitions) +* @frame_id: frame ID for sync +* @params: statistics data +*/ +struct rkisp1_stat_buffer { +__u32 meas_type; +__u32 frame_id; +struct rkisp1_cif_isp_stat params; +} __packed; + +#endif /* _UAPI_RKISP1_CONFIG_H */
Signature · 1 line
2.24.0
PATCH v12 5/11 media: staging: rkisp1: add capture device for statistics
In reply to Helen KoikeFrom: Jacob Chen <[email protected]>
Add the capture video driver for rockchip isp1 statistics block.
---
Changes in v12:
- Several cleanups
- Commit re-organization to not break bisectability
Changes in v11:
stats
- fix compiling warnings
- fix checkpatch errors
Changes in v10:
- unsquash
Changes in v9:
- replace v4l2_{dgb,info,warn,err} by dev_*
- remove LOG_ISR_EXE_TIME ifndef's
- constify ops structs
- s/strlcpy/strscpy
- add missing mutex_destroy() calls in rkisp1_register_stats_vdev error path
- squash
- move to staging
Changes in v8: None
Changes in v7:
- s/strlcpy/strscpy
- sort out the locks in isp stats
- code styling and checkpatch fixes
drivers/staging/media/rkisp1/Makefile | 3 +- drivers/staging/media/rkisp1/rkisp1-common.h | 30 ++ drivers/staging/media/rkisp1/rkisp1-dev.c | 41 +- drivers/staging/media/rkisp1/rkisp1-isp.c | 12 + drivers/staging/media/rkisp1/rkisp1-stats.c | 530 +++++++++++++++++++ 5 files changed, 605 insertions(+), 11 deletions(-) create mode 100644 drivers/staging/media/rkisp1/rkisp1-stats.c
drivers/staging/media/rkisp1/Makefile +2 -1
@@ -3,4 +3,5 @@ rockchip-isp1-objs += rkisp1-capture.o \ rkisp1-common.o \ rkisp1-dev.o \ rkisp1-isp.o \ - rkisp1-resizer.o + rkisp1-resizer.o \ + rkisp1-stats.o
drivers/staging/media/rkisp1/rkisp1-common.h +30 -0
@@ -20,6 +20,7 @@#include <media/videobuf2-v4l2.h> #include "rkisp1-regs.h" +#include "uapi/rkisp1-config.h" #define RKISP1_ISP_MAX_WIDTH 4032#define RKISP1_ISP_MAX_HEIGHT 3024
@@ -174,6 +175,26 @@ struct rkisp1_capture { } pix; }; +/* +* struct rkisp1_stats - ISP Statistics device +* +* @irq_lock: buffer queue lock +* @stat: stats buffer list +* @readout_wq: workqueue for statistics information read +*/ +struct rkisp1_stats { +struct rkisp1_vdev_node vnode; +struct rkisp1_device *rkisp1; + +spinlock_t irq_lock; +struct list_head stat; +struct v4l2_format vdev_fmt; +bool is_streaming; + +struct workqueue_struct *readout_wq; +struct mutex wq_lock; +}; +struct rkisp1_resizer {struct v4l2_subdev sd;enum rkisp1_stream_id id;
@@ -189,6 +210,7 @@ struct rkisp1_debug {unsigned long data_loss;unsigned long pic_size_error;unsigned long mipi_error; +unsigned long stats_error;unsigned long stop_timeout[2 ];unsigned long frame_drop[2 ]; };
@@ -199,6 +221,7 @@ struct rkisp1_debug {* @active_sensor: sensor in-use, set when streaming on * @isp: ISP sub-device * @rkisp1_capture: capture video device +* @stats: ISP statistics output device */ struct rkisp1_device {void __iomem *base_addr;
@@ -214,6 +237,7 @@ struct rkisp1_device {struct rkisp1_isp isp;struct rkisp1_resizer resizer_devs[2 ];struct rkisp1_capture capture_devs[2 ]; +struct rkisp1_stats stats;struct media_pipeline pipe;struct vb2_alloc_ctx *alloc_ctx;struct rkisp1_debug debug;
@@ -262,6 +286,7 @@ const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code);void rkisp1_isp_isr (struct rkisp1_device *rkisp1);void rkisp1_mipi_isr (struct rkisp1_device *rkisp1);void rkisp1_capture_isr (struct rkisp1_device *rkisp1); +void rkisp1_stats_isr (struct rkisp1_stats *stats,u32 isp_ris);int rkisp1_capture_devs_register (struct rkisp1_device *rkisp1);void rkisp1_capture_devs_unregister (struct rkisp1_device *rkisp1);
@@ -269,4 +294,9 @@ void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1);int rkisp1_resizer_devs_register (struct rkisp1_device *rkisp1);void rkisp1_resizer_devs_unregister (struct rkisp1_device *rkisp1); +int rkisp1_stats_register (struct rkisp1_stats *stats, +struct v4l2_device *v4l2_dev, +struct rkisp1_device *rkisp1); +void rkisp1_stats_unregister (struct rkisp1_stats *stats); +#endif /* _RKISP1_COMMON_H */
drivers/staging/media/rkisp1/rkisp1-dev.c +31 -10
84 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-isp.c +12 -0
@@ -1130,4 +1130,16 @@ void rkisp1_isp_isr(struct rkisp1_device *rkisp1)/* keep track of data_loss in debugfs */ rkisp1->debug.data_loss++; } + +if (status &RKISP1_CIF_ISP_FRAME ) { +u32 isp_ris; + +/* New frame from the sensor received */ + isp_ris =rkisp1_read (rkisp1,RKISP1_CIF_ISP_RIS ); +if (isp_ris & (RKISP1_CIF_ISP_AWB_DONE | +RKISP1_CIF_ISP_AFM_FIN | +RKISP1_CIF_ISP_EXP_END | +RKISP1_CIF_ISP_HIST_MEASURE_RDY )) +rkisp1_stats_isr (&rkisp1->stats, isp_ris); + } }
drivers/staging/media/rkisp1/rkisp1-stats.c new file +530 -0
530 lines not on this page · raw message
Signature · 1 line
2.24.0
PATCH v12 6/11 media: staging: rkisp1: add output device for parameters
In reply to Helen KoikeFrom: Jacob Chen <[email protected]>
Add the output video driver that accept parameters from userspace.
---
Changes in v12:
- Several cleanups
- Commit re-organization to not break bisectability
Changes in v11:
params
- fix compiling warnings
- fix checkpatch errors
Changes in v10:
- unsquash
Changes in v9:
- squash
- move to staging
Changes in v8: None
Changes in v7:
- s/strlcpy/strscpy
- s/strcpy/strscpy
- fix config lsc error
LSC data table size is 17x17, but when configuring data to ISP, should be aligned to 18x17. That means every last data of last line should be filled with 0, and not filled with the data of next line.
- Update new ISP parameters immediately
For those sub modules that have shadow registers in core isp, the new programing parameters would not be active if both CIF_ISP_CTRL_ISP_CFG_UPD_PERMANENT and CFG_UPD are not set. Now we configure CFG_UPD to force update the shadow registers when new ISP parameters are configured.
- fix some ISP parameters config error
Some ISP parameter config functions may override the old enable bit value, because the enable bits of these modules are in the same registers with parameters. So we should save the old enable bits firstly.
- code styling and checkpatch fixes
drivers/staging/media/rkisp1/Makefile | 3 +- drivers/staging/media/rkisp1/rkisp1-common.h | 35 + drivers/staging/media/rkisp1/rkisp1-dev.c | 46 +- drivers/staging/media/rkisp1/rkisp1-isp.c | 19 + drivers/staging/media/rkisp1/rkisp1-params.c | 1630 ++++++++++++++++++ 5 files changed, 1717 insertions(+), 16 deletions(-) create mode 100644 drivers/staging/media/rkisp1/rkisp1-params.c
drivers/staging/media/rkisp1/Makefile +2 -1
@@ -4,4 +4,5 @@ rockchip-isp1-objs += rkisp1-capture.o \ rkisp1-dev.o \ rkisp1-isp.o \ rkisp1-resizer.o \ - rkisp1-stats.o + rkisp1-stats.o \ + rkisp1-params.o
drivers/staging/media/rkisp1/rkisp1-common.h +35 -0
@@ -195,6 +195,27 @@ struct rkisp1_stats {struct mutex wq_lock; }; +/* +* struct rkisp1_params - ISP input parameters device +* +* @cur_params: Current ISP parameters +* @is_first_params: the first params should take effect immediately +*/ +struct rkisp1_params { +struct rkisp1_vdev_node vnode; +struct rkisp1_device *rkisp1; + +spinlock_t config_lock; +struct list_head params; +struct rkisp1_params_cfg cur_params; +struct v4l2_format vdev_fmt; +bool is_streaming; +bool is_first_params; + +enum v4l2_quantization quantization; +enum rkisp1_fmt_raw_pat_type raw_type; +}; +struct rkisp1_resizer {struct v4l2_subdev sd;enum rkisp1_stream_id id;
@@ -222,6 +243,7 @@ struct rkisp1_debug {* @isp: ISP sub-device * @rkisp1_capture: capture video device * @stats: ISP statistics output device +* @params: ISP input parameters device */ struct rkisp1_device {void __iomem *base_addr;
@@ -238,6 +260,7 @@ struct rkisp1_device {struct rkisp1_resizer resizer_devs[2 ];struct rkisp1_capture capture_devs[2 ];struct rkisp1_stats stats; +struct rkisp1_params params;struct media_pipeline pipe;struct vb2_alloc_ctx *alloc_ctx;struct rkisp1_debug debug;
@@ -287,6 +310,7 @@ void rkisp1_isp_isr(struct rkisp1_device *rkisp1);void rkisp1_mipi_isr (struct rkisp1_device *rkisp1);void rkisp1_capture_isr (struct rkisp1_device *rkisp1);void rkisp1_stats_isr (struct rkisp1_stats *stats,u32 isp_ris); +void rkisp1_params_isr (struct rkisp1_device *rkisp1,u32 isp_mis);int rkisp1_capture_devs_register (struct rkisp1_device *rkisp1);void rkisp1_capture_devs_unregister (struct rkisp1_device *rkisp1);
@@ -299,4 +323,15 @@ int rkisp1_stats_register(struct rkisp1_stats *stats, struct rkisp1_device *rkisp1);void rkisp1_stats_unregister (struct rkisp1_stats *stats); +void rkisp1_params_configure (struct rkisp1_params *params, +enum rkisp1_fmt_raw_pat_type bayer_pat, +enum v4l2_quantization quantization); +void rkisp1_params_disable (struct rkisp1_params *params); +int rkisp1_params_register (struct rkisp1_params *params, +struct v4l2_device *v4l2_dev, +struct rkisp1_device *rkisp1); +void rkisp1_params_unregister (struct rkisp1_params *params); + +void rkisp1_params_isr_handler (struct rkisp1_device *rkisp1,u32 isp_mis); +#endif /* _RKISP1_COMMON_H */
drivers/staging/media/rkisp1/rkisp1-dev.c +31 -15
83 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1-isp.c +19 -0
@@ -357,6 +357,18 @@ static int rkisp1_config_isp(struct rkisp1_device *rkisp1)RKISP1_CIF_ISP_PIC_SIZE_ERROR |RKISP1_CIF_ISP_FRAME_IN ;rkisp1_write (rkisp1, irq_mask,RKISP1_CIF_ISP_IMSC ); +if (src_fmt->fmt_type ==RKISP1_FMT_BAYER ) { +rkisp1_params_disable (&rkisp1->params); + }else { +struct v4l2_mbus_framefmt *src_frm; + + src_frm =rkisp1_isp_get_pad_fmt (&rkisp1->isp,NULL , +RKISP1_ISP_PAD_SINK_VIDEO , +V4L2_SUBDEV_FORMAT_ACTIVE ); +rkisp1_params_configure (&rkisp1->params, sink_fmt->bayer_pat, + src_frm->quantization); + } +return 0 ; }
@@ -1142,4 +1154,11 @@ void rkisp1_isp_isr(struct rkisp1_device *rkisp1) RKISP1_CIF_ISP_HIST_MEASURE_RDY)) rkisp1_stats_isr(&rkisp1->stats, isp_ris); } + +/* +* Then update changed configs. Some of them involve +* lot of register writes. Do those only one per frame. +* Do the updates in the order of the processing flow. +*/ +rkisp1_params_isr (rkisp1, status); }
drivers/staging/media/rkisp1/rkisp1-params.c new file +1630 -0
1,630 lines not on this page · raw message
Signature · 1 line
2.24.0
PATCH v12 7/11 media: staging: rkisp1: add document for rkisp1 meta buffer format
In reply to Helen KoikeFrom: Jacob Chen <[email protected]>
This commit add document for rkisp1 meta buffer format
---
Changes in v12:
- Change Jacob's email to original [email protected]
Changes in v11: None
Changes in v10:
- unsquash
Changes in v9:
- squash
- migrate to staging
- remove meta-formats.rst update
Changes in v8:
- Add SPDX in the header
- Remove emacs configs
- Fix doc style
Changes in v7:
- s/correspond/corresponding
- s/use/uses
- s/docuemnt/document
.../uapi/v4l/pixfmt-meta-rkisp1-params.rst | 23 +++++++++++++++++++ .../uapi/v4l/pixfmt-meta-rkisp1-stat.rst | 22 ++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/media/uapi/v4l/pixfmt-meta-rkisp1-params.rst create mode 100644 drivers/staging/media/rkisp1/Documentation/media/uapi/v4l/pixfmt-meta-rkisp1-stat.rst
drivers/staging/media/rkisp1/Documentation/media/uapi/v4l/pixfmt-meta-rkisp1-params.rst new file +23 -0
@@ -0,0 +1,23 @@ +.. SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +.. _v4l2-meta-fmt-rkisp1-params: + +============================ +V4L2_META_FMT_RK_ISP1_PARAMS +============================ + +Rockchip ISP1 Parameters Data + +Description +=========== + +This format describes input parameters for the Rockchip ISP1. + +It uses c-struct :c:type:`rkisp1_params_cfg`, which is defined in +the ``linux/rkisp1-config.h`` header file. + +The parameters consist of multiple modules. +The module won't be updated if the corresponding bit was not set in module_*_update. + +.. kernel-doc:: include/uapi/linux/rkisp1-config.h + :functions: rkisp1_params_cfg
drivers/staging/media/rkisp1/Documentation/media/uapi/v4l/pixfmt-meta-rkisp1-stat.rst new file +22 -0
@@ -0,0 +1,22 @@ +.. SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +.. _v4l2-meta-fmt-rkisp1-stat: + +============================= +V4L2_META_FMT_RK_ISP1_STAT_3A +============================= + + +Rockchip ISP1 Statistics Data + +Description +=========== + +This format describes image color statistics information generated by the Rockchip +ISP1. + +It uses c-struct :c:type:`rkisp1_stat_buffer`, which is defined in +the ``linux/rkisp1-config.h`` header file. + +.. kernel-doc:: include/uapi/linux/rkisp1-config.h + :functions: rkisp1_stat_buffer
Signature · 1 line
2.24.0
PATCH v12 8/11 media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
In reply to Helen KoikeAdd yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mv drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml Documentation/devicetree/bindings/media/ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with make dtbs_check and make dt_binding_check
Changes in v11:
- add clock-names values
Changes in v10:
- unsquash
Changes in v9:
- squash
- move to staging
Changes in v8:
- fix title division style
Changes in v7:
- update document with new design and tested example
.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +193 -0
@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons. + +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys: + maxItems: 1 + description: phandle for the PHY port + + phy-names: + const: dphy + + clocks: + items: + - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clock + + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap + + # See ./video-interfaces.txt for details + ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + port@0: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reg: + const: 0 + description: port identifier. + + patternProperties: + endpoint: + type: object + additionalProperties: false + + properties: + reg: + maxItems: 1 + description: endpoint identifier. + + data-lanes: + minItems: 1 + maxItems: 4 + + remote-endpoint: true + + required: + - port@0 + +required: + - compatible + - interrupts + - clocks + - clock-names + - power-domains + - iommus + - phys + - phy-names + - ports + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/rk3399-power.h> + + parent0: parent@0 { + #address-cells = <2>; + #size-cells = <2>; + + isp0: isp0@ff910000 { + compatible = "rockchip,rk3399-cif-isp"; + reg = <0x0 0xff910000 0x0 0x4000>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru SCLK_ISP0>, + <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>, + <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>; + clock-names = "clk_isp", + "aclk_isp", "aclk_isp_wrap", + "hclk_isp", "hclk_isp_wrap"; + power-domains = <&power RK3399_PD_ISP0>; + iommus = <&isp0_mmu>; + phys = <&dphy>; + phy-names = "dphy"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_in_wcam: endpoint@0 { + reg = <0>; + remote-endpoint = <&wcam_out>; + data-lanes = <1 2>; + }; + + mipi_in_ucam: endpoint@1 { + reg = <1>; + remote-endpoint = <&ucam_out>; + data-lanes = <1>; + }; + }; + }; + }; + + i2c7: i2c@ff160000 { + clock-frequency = <400000>; + #address-cells = <1>; + #size-cells = <0>; + + wcam: camera@36 { + compatible = "ovti,ov5695"; + reg = <0x36>; + + port { + wcam_out: endpoint { + remote-endpoint = <&mipi_in_wcam>; + data-lanes = <1 2>; + }; + }; + }; + + ucam: camera@3c { + compatible = "ovti,ov2685"; + reg = <0x3c>; + + port { + ucam_out: endpoint { + remote-endpoint = <&mipi_in_ucam>; + data-lanes = <1>; + }; + }; + }; + }; + };
Signature · 1 line
2.24.0
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
Quoted 31 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division style
Quoted 6 lines
Changes in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
In reply to Helen KoikeHi Helen,
Thank you for the patch.
Quoted 67 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division styleChanges in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamldrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +24
-0@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons. + +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 34
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+ + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys: + maxItems: 1 + description: phandle for the PHY port
According to http://opensource.rock-chips.com/wiki_Camera_driver, RK3388 can route either of DPHY RX0 or DPHY RX1 to the single ISP instance, while RK3399 has one PHY per ISP instance, with DPHY RX1 being shared with the display. Have you given any thought on how we will support this in a backward-compatible way in the DT bindings ?
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 45
Quoted 11 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +11
-0+ + phy-names: + const: dphy + + clocks: + items: + - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clock
I wonder what aclk and hclk stand far. In any case those names match the CRU documentation, so that seems fine.
Quoted 14 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +14
-0+ + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap + + # See ./video-interfaces.txt for details + ports: + type: object + additionalProperties: false +
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 69
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+ properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + port@0: + type: object + additionalProperties: false
I think this should have a description to tell what this port corresponds to.
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 80
Quoted 11 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +11
-0+ + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reg: + const: 0 + description: port identifier.
Here and for the endpoint below the description is probably not needed.
Quoted 69 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +69
-0+ + patternProperties: + endpoint: + type: object + additionalProperties: false + + properties: + reg: + maxItems: 1 + description: endpoint identifier. + + data-lanes: + minItems: 1 + maxItems: 4 + + remote-endpoint: true + + required: + - port@0 + +required: + - compatible + - interrupts + - clocks + - clock-names + - power-domains + - iommus + - phys + - phy-names + - ports + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/rk3399-power.h> + + parent0: parent@0 { + #address-cells = <2>; + #size-cells = <2>; + + isp0: isp0@ff910000 { + compatible = "rockchip,rk3399-cif-isp"; + reg = <0x0 0xff910000 0x0 0x4000>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru SCLK_ISP0>, + <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>, + <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>; + clock-names = "clk_isp", + "aclk_isp", "aclk_isp_wrap", + "hclk_isp", "hclk_isp_wrap"; + power-domains = <&power RK3399_PD_ISP0>; + iommus = <&isp0_mmu>; + phys = <&dphy>; + phy-names = "dphy"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_in_wcam: endpoint@0 {
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 159
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+ reg = <0>; + remote-endpoint = <&wcam_out>; + data-lanes = <1 2>; + }; + + mipi_in_ucam: endpoint@1 { + reg = <1>; + remote-endpoint = <&ucam_out>; + data-lanes = <1>; + };
Are those two cameras connected to the same CSI-2 lines with at most one sensor out of reset ?
With the above small issues addressed,
Quoted 34 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +34
-0+ }; + }; + }; + + i2c7: i2c@ff160000 { + clock-frequency = <400000>; + #address-cells = <1>; + #size-cells = <0>; + + wcam: camera@36 { + compatible = "ovti,ov5695"; + reg = <0x36>; + + port { + wcam_out: endpoint { + remote-endpoint = <&mipi_in_wcam>; + data-lanes = <1 2>; + }; + }; + }; + + ucam: camera@3c { + compatible = "ovti,ov2685"; + reg = <0x3c>; + + port { + ucam_out: endpoint { + remote-endpoint = <&mipi_in_ucam>; + data-lanes = <1>; + }; + }; + }; + }; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
Quoted 81 lines · Laurent Pinchart
Hi Helen,
Thank you for the patch.
Quoted 76 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division styleChanges in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamldrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +32
-0@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons. + +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys:
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 34
Quoted 2 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +2
-0+ maxItems: 1 + description: phandle for the PHY portAccording to http://opensource.rock-chips.com/wiki_Camera_driver, RK3388 can route either of DPHY RX0 or DPHY RX1 to the single ISP instance, while RK3399 has one PHY per ISP instance, with DPHY RX1 being shared with the display. Have you given any thought on how we will support this in a backward-compatible way in the DT bindings ?
As discussed on IRC, we could have multiple PHYs specifiers in the phy property. The ISP would have multiple ports, with one PHY per port.
Quoted 6 lines
Quoted 6 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +6
-0+ + phy-names: + const: dphy + + clocks: + items:
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 45
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clockI wonder what aclk and hclk stand far. In any case those names match the CRU documentation, so that seems fine.
IIRC, traditionally, Rockchip calls aclk to the AXI clock, and hclk to the AHB. We'll improve this description.
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 54
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +9
-0+ + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap +
I wonder if we should better amend the names as well.
Quoted 10 lines
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+ # See ./video-interfaces.txt for details + ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells":
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 69
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ const: 0 + + port@0: + type: object + additionalProperties: falseI think this should have a description to tell what this port corresponds to.
OK.
Quoted 5 lines
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ + properties: + "#address-cells": + const: 1 +
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 80
Quoted 6 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +6
-0+ "#size-cells": + const: 0 + + reg: + const: 0 + description: port identifier.Here and for the endpoint below the description is probably not needed.
OK.
Quoted 74 lines
Quoted 74 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +74
-0+ + patternProperties: + endpoint: + type: object + additionalProperties: false + + properties: + reg: + maxItems: 1 + description: endpoint identifier. + + data-lanes: + minItems: 1 + maxItems: 4 + + remote-endpoint: true + + required: + - port@0 + +required: + - compatible + - interrupts + - clocks + - clock-names + - power-domains + - iommus + - phys + - phy-names + - ports + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/rk3399-power.h> + + parent0: parent@0 { + #address-cells = <2>; + #size-cells = <2>; + + isp0: isp0@ff910000 { + compatible = "rockchip,rk3399-cif-isp"; + reg = <0x0 0xff910000 0x0 0x4000>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru SCLK_ISP0>, + <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>, + <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>; + clock-names = "clk_isp", + "aclk_isp", "aclk_isp_wrap", + "hclk_isp", "hclk_isp_wrap"; + power-domains = <&power RK3399_PD_ISP0>; + iommus = <&isp0_mmu>; + phys = <&dphy>; + phy-names = "dphy"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_in_wcam: endpoint@0 { + reg = <0>; + remote-endpoint = <&wcam_out>; + data-lanes = <1 2>; + }; +
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 159
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ mipi_in_ucam: endpoint@1 { + reg = <1>; + remote-endpoint = <&ucam_out>; + data-lanes = <1>; + };Are those two cameras connected to the same CSI-2 lines with at most one sensor out of reset ?
Indeed, these are two cameras connected to the same DPHY, and only one can work at a time.
Quoted 4 lines
With the above small issues addressed,
Reviewed-by Laurent Pinchart <[email protected]>
Thanks for the review!
Ezequiel
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
Hi Ezequiel,
Quoted 109 lines · Ezequiel Garcia
Quoted 77 lines · Laurent Pinchart
Quoted 76 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division styleChanges in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamldrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +32
-0@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons. + +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys:Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 34
Quoted 2 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +2
-0+ maxItems: 1 + description: phandle for the PHY portAccording to http://opensource.rock-chips.com/wiki_Camera_driver, RK3388 can route either of DPHY RX0 or DPHY RX1 to the single ISP instance, while RK3399 has one PHY per ISP instance, with DPHY RX1 being shared with the display. Have you given any thought on how we will support this in a backward-compatible way in the DT bindings ?
As discussed on IRC, we could have multiple PHYs specifiers in the phy property. The ISP would have multiple ports, with one PHY per port.
Quoted 6 lines
Quoted 6 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +6
-0+ + phy-names: + const: dphy + + clocks: + items:Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 45
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clockI wonder what aclk and hclk stand far. In any case those names match the CRU documentation, so that seems fine.
IIRC, traditionally, Rockchip calls aclk to the AXI clock, and hclk to the AHB. We'll improve this description.
Quoted 11 lines
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 54
Quoted 9 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +9
-0+ + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap +I wonder if we should better amend the names as well.
We could, but they match the names in the CRU documentation, so I think they're fine.
Quoted 126 lines
Quoted 10 lines
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+ # See ./video-interfaces.txt for details + ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells":Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 69
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ const: 0 + + port@0: + type: object + additionalProperties: falseI think this should have a description to tell what this port corresponds to.
OK.
Quoted 5 lines
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ + properties: + "#address-cells": + const: 1 +Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 80
Quoted 6 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +6
-0+ "#size-cells": + const: 0 + + reg: + const: 0 + description: port identifier.Here and for the endpoint below the description is probably not needed.
OK.
Quoted 74 lines
Quoted 74 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +74
-0+ + patternProperties: + endpoint: + type: object + additionalProperties: false + + properties: + reg: + maxItems: 1 + description: endpoint identifier. + + data-lanes: + minItems: 1 + maxItems: 4 + + remote-endpoint: true + + required: + - port@0 + +required: + - compatible + - interrupts + - clocks + - clock-names + - power-domains + - iommus + - phys + - phy-names + - ports + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/rk3399-power.h> + + parent0: parent@0 { + #address-cells = <2>; + #size-cells = <2>; + + isp0: isp0@ff910000 { + compatible = "rockchip,rk3399-cif-isp"; + reg = <0x0 0xff910000 0x0 0x4000>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru SCLK_ISP0>, + <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>, + <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>; + clock-names = "clk_isp", + "aclk_isp", "aclk_isp_wrap", + "hclk_isp", "hclk_isp_wrap"; + power-domains = <&power RK3399_PD_ISP0>; + iommus = <&isp0_mmu>; + phys = <&dphy>; + phy-names = "dphy"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_in_wcam: endpoint@0 { + reg = <0>; + remote-endpoint = <&wcam_out>; + data-lanes = <1 2>; + }; +Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 159
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ mipi_in_ucam: endpoint@1 { + reg = <1>; + remote-endpoint = <&ucam_out>; + data-lanes = <1>; + };Are those two cameras connected to the same CSI-2 lines with at most one sensor out of reset ?
Indeed, these are two cameras connected to the same DPHY, and only one can work at a time.
Quoted 3 lines
With the above small issues addressed,
Reviewed-by Laurent Pinchart <[email protected]>
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
In reply to Helen KoikeHi Helen,
Quoted 47 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division styleChanges in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamldrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +4
-0@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml#
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 14
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons.
"functions"
Quoted 43 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +43
-0+ +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys: + maxItems: 1 + description: phandle for the PHY port + + phy-names: + const: dphy + + clocks: + items: + - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clock + + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap + + # See ./video-interfaces.txt for details + ports: + type: object
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 67
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+ additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + port@0:
If you only have a single port node, you could drop reg as well as @0 on the port node.
Quoted 126 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +126
-0+ type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reg: + const: 0 + description: port identifier. + + patternProperties: + endpoint: + type: object + additionalProperties: false + + properties: + reg: + maxItems: 1 + description: endpoint identifier. + + data-lanes: + minItems: 1 + maxItems: 4 + + remote-endpoint: true + + required: + - port@0 + +required: + - compatible + - interrupts + - clocks + - clock-names + - power-domains + - iommus + - phys + - phy-names + - ports + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/rk3399-power.h> + + parent0: parent@0 { + #address-cells = <2>; + #size-cells = <2>; + + isp0: isp0@ff910000 { + compatible = "rockchip,rk3399-cif-isp"; + reg = <0x0 0xff910000 0x0 0x4000>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru SCLK_ISP0>, + <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>, + <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>; + clock-names = "clk_isp", + "aclk_isp", "aclk_isp_wrap", + "hclk_isp", "hclk_isp_wrap"; + power-domains = <&power RK3399_PD_ISP0>; + iommus = <&isp0_mmu>; + phys = <&dphy>; + phy-names = "dphy"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_in_wcam: endpoint@0 { + reg = <0>; + remote-endpoint = <&wcam_out>; + data-lanes = <1 2>; + }; + + mipi_in_ucam: endpoint@1 { + reg = <1>; + remote-endpoint = <&ucam_out>; + data-lanes = <1>; + }; + }; + }; + }; + + i2c7: i2c@ff160000 { + clock-frequency = <400000>; + #address-cells = <1>; + #size-cells = <0>; + + wcam: camera@36 { + compatible = "ovti,ov5695"; + reg = <0x36>; + + port { + wcam_out: endpoint { + remote-endpoint = <&mipi_in_wcam>; + data-lanes = <1 2>; + }; + }; + }; + + ucam: camera@3c { + compatible = "ovti,ov2685"; + reg = <0x3c>; + + port { + ucam_out: endpoint { + remote-endpoint = <&mipi_in_ucam>; + data-lanes = <1>; + }; + }; + }; + }; + };
Signature · 3 lines
Kind regards, Sakari Ailus
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
Hi,
Thank you for your review.
Quoted 111 lines · Sakari Ailus
Hi Helen,
Quoted 47 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division styleChanges in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamldrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +4
-0@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml#drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 14
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons."functions"
Quoted 48 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +48
-0+ +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys: + maxItems: 1 + description: phandle for the PHY port + + phy-names: + const: dphy + + clocks: + items: + - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clock + + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap + + # See ./video-interfaces.txt for details + ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1
Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 67
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ + "#size-cells": + const: 0 + + port@0:If you only have a single port node, you could drop reg as well as @0 on the port node.
After the discussions, we have a single port for now, but we might have port@1 for tx1rx1 in the future.
Helen
Quoted 128 lines
Quoted 127 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +126
-0+ type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + reg: + const: 0 + description: port identifier. + + patternProperties: + endpoint: + type: object + additionalProperties: false + + properties: + reg: + maxItems: 1 + description: endpoint identifier. + + data-lanes: + minItems: 1 + maxItems: 4 + + remote-endpoint: true + + required: + - port@0 + +required: + - compatible + - interrupts + - clocks + - clock-names + - power-domains + - iommus + - phys + - phy-names + - ports + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/power/rk3399-power.h> + + parent0: parent@0 { + #address-cells = <2>; + #size-cells = <2>; + + isp0: isp0@ff910000 { + compatible = "rockchip,rk3399-cif-isp"; + reg = <0x0 0xff910000 0x0 0x4000>; + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&cru SCLK_ISP0>, + <&cru ACLK_ISP0>, <&cru ACLK_ISP0_WRAPPER>, + <&cru HCLK_ISP0>, <&cru HCLK_ISP0_WRAPPER>; + clock-names = "clk_isp", + "aclk_isp", "aclk_isp_wrap", + "hclk_isp", "hclk_isp_wrap"; + power-domains = <&power RK3399_PD_ISP0>; + iommus = <&isp0_mmu>; + phys = <&dphy>; + phy-names = "dphy"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + mipi_in_wcam: endpoint@0 { + reg = <0>; + remote-endpoint = <&wcam_out>; + data-lanes = <1 2>; + }; + + mipi_in_ucam: endpoint@1 { + reg = <1>; + remote-endpoint = <&ucam_out>; + data-lanes = <1>; + }; + }; + }; + }; + + i2c7: i2c@ff160000 { + clock-frequency = <400000>; + #address-cells = <1>; + #size-cells = <0>; + + wcam: camera@36 { + compatible = "ovti,ov5695"; + reg = <0x36>; + + port { + wcam_out: endpoint { + remote-endpoint = <&mipi_in_wcam>; + data-lanes = <1 2>; + }; + }; + }; + + ucam: camera@3c { + compatible = "ovti,ov2685"; + reg = <0x3c>; + + port { + ucam_out: endpoint { + remote-endpoint = <&mipi_in_ucam>; + data-lanes = <1>; + }; + }; + }; + }; + };
Re: [PATCH v12 08/11] media: staging: dt-bindings: add Rockchip ISP1 yaml bindings
Quoted 125 lines · Helen Koike
Hi,
Thank you for your review.
Quoted 111 lines · Sakari Ailus
Hi Helen,
Quoted 47 lines · Helen Koike
Add yaml DT bindings for Rockchip ISP1.
This was tested and verified with:
mvdrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamlDocumentation/devicetree/bindings/media/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-isp1.yamlSigned-off-by Helen Koike <helen.koike-ZGY8ohtN/[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip ISP1 bindings This new patch adds yaml binding and was verified with makedtbs_checkand makedt_binding_checkChanges in v11:
- add clock-names valuesChanges in v10:
- unsquashChanges in v9:
- squash
- move to stagingChanges in v8:
- fix title division styleChanges in v7:
- update document with new design and tested example.../bindings/media/rockchip-isp1.yaml | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yamldrivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +4
-0@@ -0,0 +1,193 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/rockchip-isp1.yaml#drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 14
Quoted 10 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +10
-0+$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC Image Signal Processing unit v1 + +maintainers: + - Helen Koike <helen.koike-ZGY8ohtN/[email protected]> + +description: | + Rockchip ISP1 is the Camera interface for the Rockchip series of SoCs + which contains image processing, scaling, and compression funcitons."functions"
Quoted 48 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +48
-0+ +properties: + compatible: + const: rockchip,rk3399-cif-isp + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + iommus: + maxItems: 1 + + power-domains: + maxItems: 1 + + phys: + maxItems: 1 + description: phandle for the PHY port + + phy-names: + const: dphy + + clocks: + items: + - description: ISP clock + - description: ISP aclk clock + - description: ISP aclk wrapper clock + - description: ISP hclk clock + - description: ISP hclk wrapper clock + + clock-names: + items: + - const: clk_isp + - const: aclk_isp + - const: aclk_isp_wrap + - const: hclk_isp + - const: hclk_isp_wrap + + # See ./video-interfaces.txt for details + ports: + type: object + additionalProperties: false + + properties: + "#address-cells": + const: 1Quoted 8 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml line 67
Quoted 5 lines
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.yaml new file +5
-0+ + "#size-cells": + const: 0 + + port@0:If you only have a single port node, you could drop reg as well as @0 on the port node.
Quoted 2 lines
After the discussions, we have a single port for now, but we might have port@1 for tx1rx1 in the future.
Ack. Please keep it as-is then.
Signature · 2 lines
Sakari Ailus sakari.ailus-VuQAYsv1563Yd54FQh9/[email protected]
PATCH v12 9/11 media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
In reply to Helen KoikeAdd yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mv drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml Documentation/devicetree/bindings/phy/ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
make dtbs_check and make dt_binding_check
Changes in v11: None
Changes in v10:
- unsquash
Changes in v9:
- fix title division style
- squash
- move to staging
Changes in v8: None
Changes in v7:
- updated doc with new design and tested example
.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +75 -0
@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree Bindings + +maintainers: + - Helen Koike <[email protected]> + - Ezequiel Garcia <[email protected]> + +description: | + The Rockchip SoC has a MIPI D-PHY bus with an RX0 entry which connects to + the ISP1 (Image Signal Processing unit v1.0) for CSI cameras. + +properties: + compatible: + const: rockchip,rk3399-mipi-dphy + + reg: + maxItems: 1 + + clocks: + items: + - description: Mipi d-phy ref clock + - description: Mipi d-phy rx0 cfg clock + - description: Video in/out general register file clock + + clock-names: + items: + - const: dphy-ref + - const: dphy-cfg + - const: grf + + '#phy-cells': + const: 0 + + power-domains: + description: Video in/out power domain. + maxItems: 1 + +required: + - compatible + - clocks + - clock-names + - '#phy-cells' + - power-domains + +additionalProperties: false + +examples: + - | + + /* + * MIPI RX D-PHY use registers in "general register files", it + * should be a child of the GRF. + * + * grf: syscon@ff770000 { + * compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; + * ... + */ + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/power/rk3399-power.h> + + dphy: mipi-dphy { + compatible = "rockchip,rk3399-mipi-dphy"; + clocks = <&cru SCLK_MIPIDPHY_REF>, + <&cru SCLK_DPHY_RX0_CFG>, + <&cru PCLK_VIO_GRF>; + clock-names = "dphy-ref", "dphy-cfg", "grf"; + power-domains = <&power RK3399_PD_VIO>; + #phy-cells = <0>; + };
Signature · 1 line
2.24.0
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Quoted 27 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to staging
Quoted 7 lines
Changes in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
In reply to Helen KoikeHi Helen,
Thank you for the patch.
Quoted 40 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +0
-0
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 7 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +7
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree Bindings
Should this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ? Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +10
-0+ +maintainers: + - Helen Koike <[email protected]> + - Ezequiel Garcia <[email protected]> + +description: | + The Rockchip SoC has a MIPI D-PHY bus with an RX0 entry which connects to + the ISP1 (Image Signal Processing unit v1.0) for CSI cameras. + +properties:
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 27
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +10
-0+ compatible: + const: rockchip,rk3399-mipi-dphy + + reg: + maxItems: 1 + + clocks: + items: + - description: Mipi d-phy ref clock + - description: Mipi d-phy rx0 cfg clock
s/Mipi d-phy/MIPI D-PHY/
Quoted 24 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +24
-0+ - description: Video in/out general register file clock + + clock-names: + items: + - const: dphy-ref + - const: dphy-cfg + - const: grf + + '#phy-cells': + const: 0 + + power-domains: + description: Video in/out power domain. + maxItems: 1 + +required: + - compatible + - clocks + - clock-names + - '#phy-cells' + - power-domains + +additionalProperties: false +
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 61
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +10
-0+examples: + - | + + /* + * MIPI RX D-PHY use registers in "general register files", it + * should be a child of the GRF. + * + * grf: syscon@ff770000 { + * compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; + * ...
missing
* };
Quoted 14 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +14
-0+ */ + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/power/rk3399-power.h> + + dphy: mipi-dphy { + compatible = "rockchip,rk3399-mipi-dphy"; + clocks = <&cru SCLK_MIPIDPHY_REF>, + <&cru SCLK_DPHY_RX0_CFG>, + <&cru PCLK_VIO_GRF>; + clock-names = "dphy-ref", "dphy-cfg", "grf"; + power-domains = <&power RK3399_PD_VIO>; + #phy-cells = <0>; + };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Hi Laurent,
Thanks a lot for reviewing this.
Quoted 39 lines · Laurent Pinchart
Hi Helen,
Thank you for the patch.
Quoted 34 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
Quoted 16 lines
Quoted 7 lines
drivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 7 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +7
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 3 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Quoted 14 lines
Quoted 14 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +14
-0+ +maintainers: + - Helen Koike <[email protected]> + - Ezequiel Garcia <[email protected]> + +description: | + The Rockchip SoC has a MIPI D-PHY bus with an RX0 entry which connects to + the ISP1 (Image Signal Processing unit v1.0) for CSI cameras. + +properties: + compatible: + const: rockchip,rk3399-mipi-dphy + + reg:
Quoted 9 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 27
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+ maxItems: 1 + + clocks: + items: + - description: Mipi d-phy ref clock + - description: Mipi d-phy rx0 cfg clocks/Mipi d-phy/MIPI D-PHY/
Yep.
Quoted 37 lines
Quoted 24 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +24
-0+ - description: Video in/out general register file clock + + clock-names: + items: + - const: dphy-ref + - const: dphy-cfg + - const: grf + + '#phy-cells': + const: 0 + + power-domains: + description: Video in/out power domain. + maxItems: 1 + +required: + - compatible + - clocks + - clock-names + - '#phy-cells' + - power-domains + +additionalProperties: false +drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 61
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +10
-0+examples: + - | + + /* + * MIPI RX D-PHY use registers in "general register files", it + * should be a child of the GRF. + * + * grf: syscon@ff770000 { + * compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; + * ...missing
Quoted 2 lines
* };
OK.
Quoted 14 lines
Quoted 14 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +14
-0+ */ + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/power/rk3399-power.h> + + dphy: mipi-dphy { + compatible = "rockchip,rk3399-mipi-dphy"; + clocks = <&cru SCLK_MIPIDPHY_REF>, + <&cru SCLK_DPHY_RX0_CFG>, + <&cru PCLK_VIO_GRF>; + clock-names = "dphy-ref", "dphy-cfg", "grf"; + power-domains = <&power RK3399_PD_VIO>; + #phy-cells = <0>; + };
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Quoted 57 lines · Ezequiel Garcia
Quoted 39 lines · Laurent Pinchart
Hi Helen,
Thank you for the patch.
Quoted 34 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlQuoted 16 lines
Quoted 7 lines
drivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 7 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +7
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
Quoted 8 lines
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
Quoted 80 lines
Quoted 14 lines
Quoted 14 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +14
-0+ +maintainers: + - Helen Koike <[email protected]> + - Ezequiel Garcia <[email protected]> + +description: | + The Rockchip SoC has a MIPI D-PHY bus with an RX0 entry which connects to + the ISP1 (Image Signal Processing unit v1.0) for CSI cameras. + +properties: + compatible: + const: rockchip,rk3399-mipi-dphy + + reg:Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 27
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+ maxItems: 1 + + clocks: + items: + - description: Mipi d-phy ref clock + - description: Mipi d-phy rx0 cfg clocks/Mipi d-phy/MIPI D-PHY/
Yep.
Quoted 37 lines
Quoted 24 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +24
-0+ - description: Video in/out general register file clock + + clock-names: + items: + - const: dphy-ref + - const: dphy-cfg + - const: grf + + '#phy-cells': + const: 0 + + power-domains: + description: Video in/out power domain. + maxItems: 1 + +required: + - compatible + - clocks + - clock-names + - '#phy-cells' + - power-domains + +additionalProperties: false +drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 61
Quoted 10 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +10
-0+examples: + - | + + /* + * MIPI RX D-PHY use registers in "general register files", it + * should be a child of the GRF. + * + * grf: syscon@ff770000 { + * compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; + * ...missing
Quoted 1 line
* };
OK.
Quoted 14 lines
Quoted 14 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +14
-0+ */ + + #include <dt-bindings/clock/rk3399-cru.h> + #include <dt-bindings/power/rk3399-power.h> + + dphy: mipi-dphy { + compatible = "rockchip,rk3399-mipi-dphy"; + clocks = <&cru SCLK_MIPIDPHY_REF>, + <&cru SCLK_DPHY_RX0_CFG>, + <&cru PCLK_VIO_GRF>; + clock-names = "dphy-ref", "dphy-cfg", "grf"; + power-domains = <&power RK3399_PD_VIO>; + #phy-cells = <0>; + };
Signature · 3 lines
Regards, Laurent Pinchart
Heiko Stübner
maintainerRe: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 64 lines · Ezequiel Garcia
Quoted 63 lines · Laurent Pinchart
Quoted 39 lines
Hi Helen,
Thank you for the patch.
Quoted 34 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml
makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlQuoted 16 lines
Quoted 7 lines
drivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 7 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +7
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88
With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Heiko
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Hi Heiko, Laurent,
Quoted 81 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 7 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 {
compatible = "rockchip,rk3399-mipi-dphy";
reg = <0x0 0xff968000 0x0 0x8000>;
rockchip,grf = <&grf>;
};
grf: syscon@ff770000 {
mipi_dphy_rx0: mipi-dphy-rx0 {
compatible = "rockchip,rk3399-mipi-dphy";
};
};Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
Thanks,
Ezequiel
Heiko Stübner
maintainerRe: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Hi Ezequiel,
Am Dienstag, 7. Januar 2020, 14:20:10 CET schrieb Ezequiel Garcia:
Quoted 92 lines
Hi Heiko, Laurent,
Quoted 81 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 7 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Quoted 8 lines
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 { compatible = "rockchip,rk3399-mipi-dphy"; reg = <0x0 0xff968000 0x0 0x8000>; rockchip,grf = <&grf>; };
0xff968000 actually really is the dsi1 controller, so we'll already have a node for that area. That is the reason I went that way to make the rockchip-dsi optionally also behave as phy-provider.
So when it's used in combination with drm and a panel or so it will behave as dsi controller, but when requested via the phy-framework it will expose the dphy functionality.
Quoted 6 lines
grf: syscon@ff770000 {
mipi_dphy_rx0: mipi-dphy-rx0 {
compatible = "rockchip,rk3399-mipi-dphy";
};
};Quoted 6 lines
Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
so I really think we shouldn't merge these two things together, especially to not break the dsi1 controller part.
Heiko
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Hi Heiko,
Quoted 98 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 14:20:10 CET schrieb Ezequiel Garcia:
Quoted 88 lines · Heiko Stübner
Quoted 81 lines
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 5 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Quoted 8 lines
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 { compatible = "rockchip,rk3399-mipi-dphy"; reg = <0x0 0xff968000 0x0 0x8000>; rockchip,grf = <&grf>; };
Quoted 7 lines
0xff968000actually really is the dsi1 controller, so we'll already have a node for that area. That is the reason I went that way to make the rockchip-dsi optionally also behave as phy-provider.So when it's used in combination with drm and a panel or so it will behave as dsi controller, but when requested via the phy-framework it will expose the dphy functionality.
Doesn't RX1/TX1 also expose controls through GRF ? For instance GRF_SOC_CON9 has a dphy_rx1_clk_inv_sel bit.
Quoted 15 lines
Quoted 6 lines
grf: syscon@ff770000 { mipi_dphy_rx0: mipi-dphy-rx0 { compatible = "rockchip,rk3399-mipi-dphy"; }; };Quoted 6 lines
Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
so I really think we shouldn't merge these two things together, especially to not break the dsi1 controller part.
Signature · 3 lines
Regards, Laurent Pinchart
Heiko Stuebner
maintainerRe: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Am Dienstag, 7. Januar 2020, 22:57:39 CET schrieb Laurent Pinchart:
Quoted 105 lines
Hi Heiko,
Quoted 102 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 14:20:10 CET schrieb Ezequiel Garcia:
Quoted 88 lines · Heiko Stübner
Quoted 81 lines
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 5 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Quoted 8 lines
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 { compatible = "rockchip,rk3399-mipi-dphy"; reg = <0x0 0xff968000 0x0 0x8000>; rockchip,grf = <&grf>; };
0xff968000actually really is the dsi1 controller, so we'll already have a node for that area. That is the reason I went that way to make the rockchip-dsi optionally also behave as phy-provider.
Quoted 6 lines
Quoted 3 lines
So when it's used in combination with drm and a panel or so it will behave as dsi controller, but when requested via the phy-framework it will expose the dphy functionality.
Doesn't RX1/TX1 also expose controls through GRF ? For instance
GRF_SOC_CON9has adphy_rx1_clk_inv_selbit.
There are parts in the GRF but the whole phy-write stuff is inside the dsi controller area. See the vendor kernel at
https://github.com/rockchip-linux/kernel/blob/develop-4.4/drivers/phy/rockchip/phy-rockchip-mipi-rx.c#L1427
where you get write_grf_reg() for GRF bits but also the write_txrx_reg() and mipidphy1_wr_reg() calls that access registers inside the dsi1 controller space.
Heiko
Quoted 18 lines
Quoted 16 lines
Quoted 7 lines
grf: syscon@ff770000 { mipi_dphy_rx0: mipi-dphy-rx0 { compatible = "rockchip,rk3399-mipi-dphy"; }; };Quoted 6 lines
Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
so I really think we shouldn't merge these two things together, especially to not break the dsi1 controller part.
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
In reply to Heiko StübnerQuoted 104 lines · Heiko Stübner
Hi Ezequiel,
Am Dienstag, 7. Januar 2020, 14:20:10 CET schrieb Ezequiel Garcia:
Quoted 92 lines
Hi Heiko, Laurent,
Quoted 81 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 7 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Quoted 8 lines
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 { compatible = "rockchip,rk3399-mipi-dphy"; reg = <0x0 0xff968000 0x0 0x8000>; rockchip,grf = <&grf>; };
Quoted 8 lines
0xff968000actually really is the dsi1 controller, so we'll already have a node for that area. That is the reason I went that way to make the rockchip-dsi optionally also behave as phy-provider.So when it's used in combination with drm and a panel or so it will behave as dsi controller, but when requested via the phy-framework it will expose the dphy functionality.
Hm, and will this driver also support RX1?
Quoted 11 lines
Quoted 11 lines
grf: syscon@ff770000 { mipi_dphy_rx0: mipi-dphy-rx0 { compatible = "rockchip,rk3399-mipi-dphy"; }; };Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Quoted 6 lines
Quoted 2 lines
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
so I really think we shouldn't merge these two things together, especially to not break the dsi1 controller part.
I don't think it would necesarily break the dsi1 controller part.
You can declare both device nodes as sharing the address region, and then the driver can request the I/O resource only when it needs to, i.e. in the PHY .init hook.
It's not super nice, but there's no real reason two devices can't share an I/O memory resource.
I like this approach because it exposes the different PHYs explicitly, instead of implicitly.
Thanks,
Ezequiel
Heiko Stuebner
maintainerRe: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Am Dienstag, 7. Januar 2020, 23:03:54 CET schrieb Ezequiel Garcia:
Quoted 109 lines · Heiko Stübner
Quoted 108 lines
Hi Ezequiel,
Am Dienstag, 7. Januar 2020, 14:20:10 CET schrieb Ezequiel Garcia:
Quoted 92 lines
Hi Heiko, Laurent,
Quoted 81 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 7 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Quoted 8 lines
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 { compatible = "rockchip,rk3399-mipi-dphy"; reg = <0x0 0xff968000 0x0 0x8000>; rockchip,grf = <&grf>; };
0xff968000actually really is the dsi1 controller, so we'll already have a node for that area. That is the reason I went that way to make the rockchip-dsi optionally also behave as phy-provider.
Quoted 6 lines
Quoted 4 lines
So when it's used in combination with drm and a panel or so it will behave as dsi controller, but when requested via the phy-framework it will expose the dphy functionality.
Hm, and will this driver also support RX1?
what is RX1 in your book? :-)
According to the TRM the rk3399 has 3 DPHYs,
tx0 - connected exclusively to dsi0
(this is handled internally by the dw-mipi-dsi driver with controls
in the dsi0 register space)
rx0 - connected exclusively to isp0
(this is handled by the individual dphy driver from Helen's series)
tx1rx1 - shared between dsi1 and isp1
(again inside the dsi1 register space)
Quoted 19 lines
Quoted 12 lines
Quoted 12 lines
grf: syscon@ff770000 { mipi_dphy_rx0: mipi-dphy-rx0 { compatible = "rockchip,rk3399-mipi-dphy"; }; };Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Quoted 6 lines
Quoted 2 lines
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
so I really think we shouldn't merge these two things together, especially to not break the dsi1 controller part.
Quoted 5 lines
I don't think it would necesarily break the dsi1 controller part.
You can declare both device nodes as sharing the address region, and then the driver can request the I/O resource only when it needs to, i.e. in the PHY .init hook.
dsi1 is of course a dw-mipi-dsi one, which in turn shares a common bridge driver over multiple variants (non-rockchip), which expects its registers mapped during probe.
I think it would not really work well if you need to make the whole world follow that idea ;-) .
Hence my approach with exposing the phy interface from the dsi driver. If you look at the dts part, it also just looks like it should be ... as a regular phy:
https://github.com/mmind/linux-rockchip/blob/wip/tc358749/arch/arm64/boot/dts/rockchip/rk3399.dtsi#L1764
And on the driver side there is even some short circuit protection. When used as phy, it won't allow to be used as a component and vice versa.
Quoted 2 lines
It's not super nice, but there's no real reason two devices can't share an I/O memory resource.
Counter argument, devicetree is not a means to handle Linux peculiarites - instead it should describe the hardware ... and the area there _is_ the dsi1 controller ;-)
Heiko
Re: [PATCH v12 09/11] media: staging: dt-bindings: add Rockchip MIPI RX D-PHY yaml bindings
Quoted 110 lines · Heiko Stuebner
Am Dienstag, 7. Januar 2020, 23:03:54 CET schrieb Ezequiel Garcia:
Quoted 109 lines · Heiko Stübner
Quoted 108 lines
Hi Ezequiel,
Am Dienstag, 7. Januar 2020, 14:20:10 CET schrieb Ezequiel Garcia:
Quoted 92 lines
Hi Heiko, Laurent,
Quoted 81 lines · Heiko Stübner
Am Dienstag, 7. Januar 2020, 03:37:21 CET schrieb Laurent Pinchart:
Quoted 66 lines · Ezequiel Garcia
Quoted 65 lines · Laurent Pinchart
Quoted 49 lines
Hi Helen,
Thank you for the patch.
Quoted 44 lines · Helen Koike
Add yaml DT bindings for Rockchip MIPI D-PHY RX
This was tested and verified with:
mvdrivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlDocumentation/devicetree/bindings/phy/
makedt_binding_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml makedtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlSigned-off-by Helen Koike <[email protected]>---
Changes in v12:
- The commit replaces the following commit in previous series named
media: staging: dt-bindings: Document the Rockchip MIPI RX D-PHY bindings This new patch adds yaml binding and was verified with
makedtbs_checkand makedt_binding_checkChanges in v11: None
Changes in v10:
- unsquashChanges in v9:
- fix title division style
- squash
- move to stagingChanges in v8: None
Changes in v7:
- updated doc with new design and tested example.../bindings/phy/rockchip-mipi-dphy.yaml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamldrivers/staging/media/phy- renamed from drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml +0
-0
rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yamlnew file mode 100644
index 000000000000..af97f1b3e005drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +1
-0@@ -0,0 +1,75 @@ +# SPDX-License-Identifier: (GPL-2.0+ OR MIT)Quoted 8 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml line 7
Quoted 6 lines
drivers/staging/media/phy-rockchip-dphy/Documentation/devicetree/bindings/phy/rockchip-mipi-dphy.yaml new file +6
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/rockchip-mipi-dphy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip SoC MIPI RX0 D-PHY Device Tree BindingsShould this be s/RX0/RX/ ? Or do you expect different bindings for RX1 ?
The driver currently only supports RX0, but I think you are right, it should say RX here. This binding could be extended for RX1.
Quoted 2 lines
Looking at the PHY driver, it seems to handle all PHYs with a single struct device. Should we thus use #phy-cells = <1> to select the PHY ?
Quoted 6 lines
Quoted 2 lines
I am not following this. The driver handles just one PHY. Each PHY should have its own node.
Looking at the registers, it seems that the different PHYs are intertwined and we would could have trouble handling the different PHYs with different DT nodes and thus struct device instances.
I have to confess to not following _ALL_ of the threads, so may say something stupid, but I don't think the PHYs are intertwined so much.
Where RX0 is controlled from the "General Register Files" alone [register dumping ground for soc designers], the TX1RX1-phy actually gets controlled from inside the dsi1 register area it seems.
Quoted 7 lines
So in my previous (still unsucessful) tests, I was rolling with something like
https://github.com/mmind/linux-rockchip/commit/e0d4b03976d2aab85a8c1630be937ea003b5df88With the actual "logic" picked from the vendor kernel, that just double- maps the dsi1-registers in both dsi and dphy driver, which was strange.
Quoted 8 lines
Describing each PHY in its own device node (as we currently do) results in:
mipi_dphy_tx1rx1: mipi-dphy-tx1rx1@ff968000 { compatible = "rockchip,rk3399-mipi-dphy"; reg = <0x0 0xff968000 0x0 0x8000>; rockchip,grf = <&grf>; };
0xff968000actually really is the dsi1 controller, so we'll already have a node for that area. That is the reason I went that way to make the rockchip-dsi optionally also behave as phy-provider.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
So when it's used in combination with drm and a panel or so it will behave as dsi controller, but when requested via the phy-framework it will expose the dphy functionality.
Hm, and will this driver also support RX1?
what is RX1 in your book? :-)
I meant tx1rx1 configured as a receiver,
sorry for the confusion!
Quoted 9 lines
According to the TRM the rk3399 has 3 DPHYs,
tx0 - connected exclusively to dsi0
(this is handled internally by the dw-mipi-dsi driver with controls
in the dsi0 register space)
rx0 - connected exclusively to isp0
(this is handled by the individual dphy driver from Helen's series)
tx1rx1 - shared between dsi1 and isp1
(again inside the dsi1 register space)
Exactly.
Quoted 32 lines
Quoted 18 lines
Quoted 11 lines
Quoted 11 lines
grf: syscon@ff770000 { mipi_dphy_rx0: mipi-dphy-rx0 { compatible = "rockchip,rk3399-mipi-dphy"; }; };Which is mildly ugly, as it uses two mechanism to describe the GRF resource. In addition, the driver will then _infer_ which device node is RX0 and which is TX1RX1, from this.
Quoted 6 lines
Quoted 2 lines
Perhaps Laurent's proposal, describing each PHY explicitly, would be cleaner?
so I really think we shouldn't merge these two things together, especially to not break the dsi1 controller part.
Quoted 5 lines
I don't think it would necesarily break the dsi1 controller part.
You can declare both device nodes as sharing the address region, and then the driver can request the I/O resource only when it needs to, i.e. in the PHY .init hook.
dsi1 is of course a dw-mipi-dsi one, which in turn shares a common bridge driver over multiple variants (non-rockchip), which expects its registers mapped during probe.
I think it would not really work well if you need to make the whole world follow that idea ;-) .
Quoted 9 lines
Hence my approach with exposing the phy interface from the dsi driver. If you look at the dts part, it also just looks like it should be ... as a regular phy:
https://github.com/mmind/linux-rockchip/blob/wip/tc358749/arch/arm64/boot/dts/rockchip/rk3399.dtsi#L1764And on the driver side there is even some short circuit protection. When used as phy, it won't allow to be used as a component and vice versa.
OK, it's more clear now.
If this bindings will only ever support the RX0 PHY, will not support anything else, then we don't need to worry.
It can stay as a GRF syscon child, and will have
phy-cells = 0.
Thanks,
Ezequiel
PATCH v12 10/11 media: staging: rkisp1: add TODO file for staging
In reply to Helen KoikeAdd TODO file with requirements to move this driver out of staging.
---
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
drivers/staging/media/rkisp1/TODO | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 drivers/staging/media/rkisp1/TODO
drivers/staging/media/rkisp1/TODO new file +23 -0
@@ -0,0 +1,23 @@ +* Fix serialization on subdev ops. +* Don't use v4l2_async_notifier_parse_fwnode_endpoints_by_port(). +e.g. isp_parse_of_endpoints in drivers/media/platform/omap3isp/isp.c +cio2_parse_firmware in drivers/media/pci/intel/ipu3/ipu3-cio2.c. +* Fix pad format size for statistics and parameters entities. +* Use threaded interrupt for rkisp1_stats_isr(), remove work queue. +* Fix checkpatch errors. +* Make sure uapi structs have the same size and layout in 32 and 62 bits, +and that there are no holes in the structures (pahole is a utility that +can be used to test this). +* Review and comment every lock +* Handle quantization +* Document rkisp1-common.h +* streaming paths (mainpath and selfpath) check if the other path is streaming +in several places of the code, review this, specially that it doesn't seem it +supports streaming from both paths at the same time. + +NOTES: +* All v4l2-compliance test must pass. +* Stats and params can be tested with libcamera and ChromiumOS stack. + +Please CC patches to Linux Media <[email protected]> and +Helen Koike <[email protected]>.
Signature · 1 line
2.24.0
PATCH v12 11/11 MAINTAINERS: add entry for Rockchip ISP1 driver
In reply to Helen KoikeAdd MAINTAINERS entry for the rockchip isp1 driver.
---
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9:
- Move to staging
Changes in v8: None
Changes in v7: None
MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -14117,6 +14117,12 @@ F: drivers/hid/hid-roccat* F: include/linux/hid-roccat* F: Documentation/ABI/*/sysfs-driver-hid-roccat* +ROCKCHIP ISP V1 DRIVER +M: Helen Koike <[email protected]> +L: [email protected] +S: Maintained +F: drivers/staging/media/rkisp1/ + ROCKCHIP RASTER 2D GRAPHIC ACCELERATION UNIT DRIVER M: Jacob Chen <[email protected]> M: Ezequiel Garcia <[email protected]>
Signature · 1 line
2.24.0