Rockchip ISP Driver
Subsystems (3)
v9 cover Rockchip ISP Driver
Hello,
I'm submitting v9 of the Rockchip ISP driver to staging this time.
The main reason is that people are already using it from the mailing list (including libcamera), and having it mainlined makes the workflow easier. Also, it is easier for other people to contribute back (with code or testing the driver).
We plan to actively work on this driver to get it our of staging.
I squashed the patches in a single commit. The previous series splitted the commits by files, but since they had dependencies on each other, it was harder to review.
This patchset is also available at:
https://gitlab.collabora.com/koike/linux/tree/rockchip/isp/v9
Libcamera patched to work with this version:
https://gitlab.collabora.com/koike/libcamera
(also sent to the mailing list)
Thanks
Helen
Changes in v9:
* dphy
- 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
- Move to staging
- Previous patch series had a patch for file and the last commit would
add the Makefile bits to make it compile. But one file was dependent on each other, so it doesn't make much sense to have a patch for each file and it doesn't make it easier to review.
* capture.c
- replace v4l2_{dgb,info,warn,err} by dev_*
* isp_stats.c
- 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
* rkisp1.c:
- 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
* dev.h / dev.c / regs.c / regs.h / common.h
- 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
Please see a more complete history of changes at
https://patchwork.kernel.org/cover/11066499/
Helen Koike (3):
media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY
driver
media: staging: rkisp1: add Rockchip ISP1 driver
MAINTAINERS: add entry for Rockchip ISP1 driver
Shunqian Zheng (1):
media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
MAINTAINERS | 6 + drivers/media/v4l2-core/v4l2-ioctl.c | 2 + drivers/staging/media/Kconfig | 4 + drivers/staging/media/Makefile | 2 + .../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 | 400 ++++ .../bindings/media/rockchip-isp1.txt | 71 + .../bindings/media/rockchip-mipi-dphy.txt | 38 + .../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 | 7 + drivers/staging/media/rkisp1/TODO | 20 + drivers/staging/media/rkisp1/capture.c | 1869 +++++++++++++++++ drivers/staging/media/rkisp1/capture.h | 164 ++ drivers/staging/media/rkisp1/common.h | 98 + drivers/staging/media/rkisp1/dev.c | 439 ++++ drivers/staging/media/rkisp1/dev.h | 67 + drivers/staging/media/rkisp1/isp_params.c | 1604 ++++++++++++++ drivers/staging/media/rkisp1/isp_params.h | 50 + drivers/staging/media/rkisp1/isp_stats.c | 494 +++++ drivers/staging/media/rkisp1/isp_stats.h | 60 + drivers/staging/media/rkisp1/regs.c | 224 ++ drivers/staging/media/rkisp1/regs.h | 1525 ++++++++++++++ drivers/staging/media/rkisp1/rkisp1.c | 1246 +++++++++++ drivers/staging/media/rkisp1/rkisp1.h | 97 + .../staging/media/rkisp1/uapi/rkisp1-config.h | 815 +++++++ include/uapi/linux/videodev2.h | 4 + 30 files changed, 9383 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 create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.txt create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-mipi-dphy.txt 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/capture.c create mode 100644 drivers/staging/media/rkisp1/capture.h create mode 100644 drivers/staging/media/rkisp1/common.h create mode 100644 drivers/staging/media/rkisp1/dev.c create mode 100644 drivers/staging/media/rkisp1/dev.h create mode 100644 drivers/staging/media/rkisp1/isp_params.c create mode 100644 drivers/staging/media/rkisp1/isp_params.h create mode 100644 drivers/staging/media/rkisp1/isp_stats.c create mode 100644 drivers/staging/media/rkisp1/isp_stats.h create mode 100644 drivers/staging/media/rkisp1/regs.c create mode 100644 drivers/staging/media/rkisp1/regs.h create mode 100644 drivers/staging/media/rkisp1/rkisp1.c create mode 100644 drivers/staging/media/rkisp1/rkisp1.h create mode 100644 drivers/staging/media/rkisp1/uapi/rkisp1-config.h
Signature · 1 line
2.22.0
PATCH v9 1/4 media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format V4L2_META_FMT_RK_ISP1_PARAMS and metadata format V4L2_META_FMT_RK_ISP1_STAT_3A for 3A.
---
Changes in v9:
- Add reviewed-by tag from Laurent
Changes in v8: None
Changes in v7:
- s/IPU3/RK_ISP1
drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +2 -0
@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ; +case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;default :/* Compressed formats */
include/uapi/linux/videodev2.h +4 -0
@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
Signature · 1 line
2.22.0
Re: [PATCH v9 1/4] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
Quoted 9 lines · Helen Koike
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMSand metadata formatV4L2_META_FMT_RK_ISP1_STAT_3Afor 3A.Signed-off-by Shunqian Zheng <[email protected]>Signed-off-by Jacob Chen <[email protected]>Acked-by Hans Verkuil <[email protected]>
I acked this? It is missing documentation for these new formats.
Quoted 22 lines
[refactored for upstream]Signed-off-by Helen Koike <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>---
Changes in v9:
- Add reviewed-by tag from LaurentChanges in v8: None
Changes in v7:
- s/IPU3/RK_ISP1drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1344
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ;
params -> Params
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;
statistics -> Statistics
Quoted 9 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0default :/* Compressed formats */ include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 771
Quoted 10 lines
include/uapi/linux/videodev2.h +4
-0@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe
Regards,
Hans
Re: [PATCH v9 1/4] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
Quoted 7 lines · Hans Verkuil (hansverk)
Quoted 6 lines · Helen Koike
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMSand metadata formatV4L2_META_FMT_RK_ISP1_STAT_3Afor 3A.
Quoted 5 lines
Quoted 3 lines
Signed-off-by Shunqian Zheng <[email protected]>Signed-off-by Jacob Chen <[email protected]>Acked-by Hans Verkuil <[email protected]>I acked this? It is missing documentation for these new formats.
I think so https://www.spinics.net/lists/linux-rockchip/msg18999.html :)
I'll update the docs and the fixes you pointed below.
Thanks.
Helen
Quoted 58 lines
Quoted 23 lines
[refactored for upstream]Signed-off-by Helen Koike <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>---
Changes in v9:
- Add reviewed-by tag from LaurentChanges in v8: None
Changes in v7:
- s/IPU3/RK_ISP1drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1344
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ;params -> Params
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;statistics -> Statistics
Quoted 9 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0default :/* Compressed formats */ include/uapi/linux/videodev2.h +0
-0include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 771
Quoted 10 lines
include/uapi/linux/videodev2.h +4
-0@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafeRegards,
Hans
Re: [PATCH v9 1/4] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
Hi Hans, Helen:
Quoted 56 lines · Helen Koike
Quoted 7 lines · Hans Verkuil (hansverk)
Quoted 6 lines · Helen Koike
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMSand metadata formatV4L2_META_FMT_RK_ISP1_STAT_3Afor 3A.Quoted 5 lines
Quoted 3 lines
Signed-off-by Shunqian Zheng <[email protected]>Signed-off-by Jacob Chen <[email protected]>Acked-by Hans Verkuil <[email protected]>I acked this? It is missing documentation for these new formats.
I think so https://www.spinics.net/lists/linux-rockchip/msg18999.html :)
I'll update the docs and the fixes you pointed below.
Thanks.
HelenQuoted 34 lines
Quoted 22 lines
[refactored for upstream]Signed-off-by Helen Koike <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>---
Changes in v9:
- Add reviewed-by tag from LaurentChanges in v8: None
Changes in v7:
- s/IPU3/RK_ISP1drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1344
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ;params -> Params
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;statistics -> Statistics
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
include/uapi/linux/videodev2.h
Quoted 6 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0default :/* Compressed formats */ include/uapi/linux/videodev2.h +0
-0
Can we avoid touching videodev2.h, as we did for the stateless codec pixfmts?
Thanks,
Ezequiel
Quoted 17 lines
Quoted 17 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 771
Quoted 12 lines
include/uapi/linux/videodev2.h +4
-0@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafeRegards,
Hans
Re: [PATCH v9 1/4] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
Quoted 19 lines · Ezequiel Garcia
Hi Hans, Helen:
Quoted 16 lines · Helen Koike
Quoted 7 lines · Hans Verkuil (hansverk)
Quoted 6 lines · Helen Koike
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMSand metadata formatV4L2_META_FMT_RK_ISP1_STAT_3Afor 3A.Quoted 5 lines
Quoted 3 lines
Signed-off-by Shunqian Zheng <[email protected]>Signed-off-by Jacob Chen <[email protected]>Acked-by Hans Verkuil <[email protected]>I acked this? It is missing documentation for these new formats.
I think so https://www.spinics.net/lists/linux-rockchip/msg18999.html :)
Hmm, I probably had an off-day :-)
I noticed that the documentation was included in patch 3/4 (which didn't reach the ML because it was too big), but I asked Helen to split off the documentation into a separate patch (or add it to this patch).
Regards,
Hans
Quoted 71 lines
Quoted 40 lines
I'll update the docs and the fixes you pointed below.
Thanks.
HelenQuoted 34 lines
Quoted 22 lines
[refactored for upstream]Signed-off-by Helen Koike <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>---
Changes in v9:
- Add reviewed-by tag from LaurentChanges in v8: None
Changes in v7:
- s/IPU3/RK_ISP1drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1344
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ;params -> Params
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;statistics -> Statistics
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
include/uapi/linux/videodev2.h
Quoted 6 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0default :/* Compressed formats */ include/uapi/linux/videodev2.h +0
-0Can we avoid touching
videodev2.h, as we did for the stateless codec pixfmts?Thanks,
EzequielQuoted 17 lines
Quoted 17 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 771
Quoted 12 lines
include/uapi/linux/videodev2.h +4
-0@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafeRegards,
Hans
Re: [PATCH v9 1/4] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
In reply to Ezequiel GarciaQuoted 59 lines · Ezequiel Garcia
Hi Hans, Helen:
Quoted 56 lines · Helen Koike
Quoted 7 lines · Hans Verkuil (hansverk)
Quoted 6 lines · Helen Koike
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMSand metadata formatV4L2_META_FMT_RK_ISP1_STAT_3Afor 3A.Quoted 5 lines
Quoted 3 lines
Signed-off-by Shunqian Zheng <[email protected]>Signed-off-by Jacob Chen <[email protected]>Acked-by Hans Verkuil <[email protected]>I acked this? It is missing documentation for these new formats.
I think so https://www.spinics.net/lists/linux-rockchip/msg18999.html :)
I'll update the docs and the fixes you pointed below.
Thanks.
HelenQuoted 34 lines
Quoted 22 lines
[refactored for upstream]Signed-off-by Helen Koike <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>---
Changes in v9:
- Add reviewed-by tag from LaurentChanges in v8: None
Changes in v7:
- s/IPU3/RK_ISP1drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1344
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ;params -> Params
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;statistics -> Statistics
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
include/uapi/linux/videodev2.h
Quoted 6 lines
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0default :/* Compressed formats */ include/uapi/linux/videodev2.h +0
-0Can we avoid touching
videodev2.h, as we did for the stateless codec pixfmts?
I think it should be part of the uapi, as it is the metadata format used in the video output device. I propose to leave it inside drivers/staging/media/rkisp1/uapi/rkisp1-config.h while the driver is in staging, then we expose it later with a better documentation too. Make sense?
Thanks,
Helen
Quoted 23 lines
Thanks,
EzequielQuoted 17 lines
Quoted 17 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 771
Quoted 12 lines
include/uapi/linux/videodev2.h +4
-0@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafeRegards,
Hans
Re: [PATCH v9 1/4] media: videodev2.h, v4l2-ioctl: add rkisp1 meta buffer format
Quoted 72 lines · Helen Koike
Quoted 59 lines · Ezequiel Garcia
Hi Hans, Helen:
Quoted 56 lines · Helen Koike
Quoted 7 lines · Hans Verkuil (hansverk)
Quoted 6 lines · Helen Koike
From: Shunqian Zheng <[email protected]>
Add the Rockchip ISP1 specific processing parameter format
V4L2_META_FMT_RK_ISP1_PARAMSand metadata formatV4L2_META_FMT_RK_ISP1_STAT_3Afor 3A.Quoted 5 lines
Quoted 3 lines
Signed-off-by Shunqian Zheng <[email protected]>Signed-off-by Jacob Chen <[email protected]>Acked-by Hans Verkuil <[email protected]>I acked this? It is missing documentation for these new formats.
I think so https://www.spinics.net/lists/linux-rockchip/msg18999.html :)
I'll update the docs and the fixes you pointed below.
Thanks.
HelenQuoted 34 lines
Quoted 22 lines
[refactored for upstream]Signed-off-by Helen Koike <helen.koike-ZGY8ohtN/[email protected]>---
Changes in v9:
- Add reviewed-by tag from LaurentChanges in v8: None
Changes in v7:
- s/IPU3/RK_ISP1drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1344
Quoted 4 lines
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0@@ -1341,6 +1341,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_UVC : descr ="UVC Payload Header Metadata" ;break ;case V4L2_META_FMT_D4XX : descr ="Intel D4xx UVC Metadata" ;break ;case V4L2_META_FMT_VIVID : descr ="Vivid Metadata" ;break ; +case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A params" ;break ;params -> Params
drivers/media/v4l2-core/v4l2-ioctl.c static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) · line 1345
Quoted 1 line
drivers/media/v4l2-core/v4l2-ioctl.c +1
-0+case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A statistics" ;break ;statistics -> Statistics
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
include/uapi/linux/videodev2.h
Quoted 6 lines
default: /* Compressed formats */include/uapi/linux/videodev2.h +0
-0Can we avoid touching
videodev2.h, as we did for the stateless codec pixfmts?
Quoted 3 lines
I think it should be part of the uapi, as it is the metadata format used in the video output device. I propose to leave it inside
drivers/staging/media/rkisp1/uapi/rkisp1-config.hwhile the driver is in staging, then we expose it later with a better documentation too. Make sense?
Makes sense, as it's also what we've done for ipu3, +/- a slightly different path:
https://elixir.bootlin.com/linux/latest/source/drivers/staging/media/ipu3/include/intel-ipu3.h#L12
We could possibly move the header to include/rockchip-isp1.h to be consistent.
Best regards,
Tomasz
Quoted 27 lines
Thanks,
HelenQuoted 23 lines
Thanks,
EzequielQuoted 17 lines
Quoted 17 lines
include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 771
Quoted 12 lines
include/uapi/linux/videodev2.h +4
-0@@ -762,6 +762,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_D4XX v4l2_fourcc('D', '4', 'X', 'X')/* D4XX Payload Header metadata */ #define V4L2_META_FMT_VIVID v4l2_fourcc('V', 'I', 'V', 'D')/* Vivid Metadata */ +/* 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 */ +/* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafeRegards,
Hans
PATCH v9 2/4 media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
In reply to Helen KoikeAdd driver for Rockchip MIPI Synopsys DPHY
---
Changes in v9:
dphy
- 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 | 3 + .../phy-rockchip-dphy/phy-rockchip-dphy.c | 400 ++++++++++++++++++ 6 files changed, 419 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 +3 -0
@@ -0,0 +1,3 @@ +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.
drivers/staging/media/phy-rockchip-dphy/phy-rockchip-dphy.c new file +400 -0
400 lines not on this page · raw message
Signature · 1 line
2.22.0
kbuild test robot
build botRe: [PATCH v9 2/4] media: staging: phy-rockchip-dphy: add Rockchip MIPI Synopsys DPHY driver
I love your patch! Perhaps something to improve:
Hi Helen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on next-20191108]
[cannot apply to v5.4-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Helen-Koike/Rockchip-ISP-Driver/20191109-020448 base: git://linuxtv.org/media_tree.git master config: mips-allmodconfig (attached as .config) compiler: mips-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag
All warnings (new ones prefixed by >>):
In file included from arch/mips/include/asm/div64.h:12:0,
from include/linux/kernel.h:18,
from include/linux/clk.h:13,
from drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c:11:
drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c: In function 'rk_dphy_rx_stream_on':
include/asm-generic/div64.h:226:28: warning: comparison of distinct pointer types lacks a cast
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
^
>> drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c:201:2: note: in expansion of macro 'do_div'
do_div(data_rate_mbps, 1000 * 1000);
^~~~~~
In file included from include/linux/err.h:5:0,
from include/linux/clk.h:12,
from drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c:11:
include/asm-generic/div64.h:239:25: warning: right shift count >= width of type [-Wshift-count-overflow]
} else if (likely(((n) >> 32) == 0)) { \
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
>> drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c:201:2: note: in expansion of macro 'do_div'
do_div(data_rate_mbps, 1000 * 1000);
^~~~~~
In file included from arch/mips/include/asm/div64.h:12:0,
from include/linux/kernel.h:18,
from include/linux/clk.h:13,
from drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c:11:
include/asm-generic/div64.h:243:22: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types]
__rem = __div64_32(&(n), __base); \
^
>> drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c:201:2: note: in expansion of macro 'do_div'
do_div(data_rate_mbps, 1000 * 1000);
^~~~~~
include/asm-generic/div64.h:217:17: note: expected 'uint64_t * {aka long long unsigned int *}' but argument is of type 'unsigned int *'
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);
^~~~~~~~~~cc1: some warnings being treated as errors
vim +/do_div +201 drivers/staging//media/phy-rockchip-dphy/phy-rockchip-dphy.c
> 11 #include <linux/clk.h>
12 #include <linux/io.h>
13 #include <linux/mfd/syscon.h>
14 #include <linux/module.h>
15 #include <linux/of.h>
16 #include <linux/of_device.h>
17 #include <linux/phy/phy.h>
18 #include <linux/phy/phy-mipi-dphy.h>
19 #include <linux/platform_device.h>
20 #include <linux/regmap.h>
21
22 #define RK3399_GRF_SOC_CON9 0x6224
23 #define RK3399_GRF_SOC_CON21 0x6254
24 #define RK3399_GRF_SOC_CON22 0x6258
25 #define RK3399_GRF_SOC_CON23 0x625c
26 #define RK3399_GRF_SOC_CON24 0x6260
27 #define RK3399_GRF_SOC_CON25 0x6264
28 #define RK3399_GRF_SOC_STATUS1 0xe2a4
29
30 #define CLOCK_LANE_HS_RX_CONTROL 0x34
31 #define LANE0_HS_RX_CONTROL 0x44
32 #define LANE1_HS_RX_CONTROL 0x54
33 #define LANE2_HS_RX_CONTROL 0x84
34 #define LANE3_HS_RX_CONTROL 0x94
35 #define HS_RX_DATA_LANES_THS_SETTLE_CONTROL 0x75
36
37 #define MAX_DPHY_CLK 8
38
39 #define PHY_TESTEN_ADDR (1 << 16)
40 #define PHY_TESTEN_DATA (0 << 16)
41 #define PHY_TESTCLK (1 << 1)
42 #define PHY_TESTCLR (1 << 0)
43 #define THS_SETTLE_COUNTER_THRESHOLD 0x04
44
45 #define GRF_SOC_CON12 0x0274
46
47 #define GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK BIT(20)
48 #define GRF_EDP_REF_CLK_SEL_INTER BIT(4)
49
50 #define GRF_EDP_PHY_SIDDQ_HIWORD_MASK BIT(21)
51 #define GRF_EDP_PHY_SIDDQ_ON 0
52 #define GRF_EDP_PHY_SIDDQ_OFF BIT(5)
53
54 struct hsfreq_range {
55 u16 range_h;
56 u8 cfg_bit;
57 };
58
59 static const struct hsfreq_range rk3399_mipidphy_hsfreq_ranges[] = {
60 { 89, 0x00 }, { 99, 0x10 }, { 109, 0x20 }, { 129, 0x01 },
61 { 139, 0x11 }, { 149, 0x21 }, { 169, 0x02 }, { 179, 0x12 },
62 { 199, 0x22 }, { 219, 0x03 }, { 239, 0x13 }, { 249, 0x23 },
63 { 269, 0x04 }, { 299, 0x14 }, { 329, 0x05 }, { 359, 0x15 },
64 { 399, 0x25 }, { 449, 0x06 }, { 499, 0x16 }, { 549, 0x07 },
65 { 599, 0x17 }, { 649, 0x08 }, { 699, 0x18 }, { 749, 0x09 },
66 { 799, 0x19 }, { 849, 0x29 }, { 899, 0x39 }, { 949, 0x0a },
67 { 999, 0x1a }, { 1049, 0x2a }, { 1099, 0x3a }, { 1149, 0x0b },
68 { 1199, 0x1b }, { 1249, 0x2b }, { 1299, 0x3b }, { 1349, 0x0c },
69 { 1399, 0x1c }, { 1449, 0x2c }, { 1500, 0x3c }
70 };
71
72 static const char * const rk3399_mipidphy_clks[] = {
73 "dphy-ref",
74 "dphy-cfg",
75 "grf",
76 };
77
78 enum dphy_reg_id {
79 GRF_DPHY_RX0_TURNDISABLE = 0,
80 GRF_DPHY_RX0_FORCERXMODE,
81 GRF_DPHY_RX0_FORCETXSTOPMODE,
82 GRF_DPHY_RX0_ENABLE,
83 GRF_DPHY_RX0_TESTCLR,
84 GRF_DPHY_RX0_TESTCLK,
85 GRF_DPHY_RX0_TESTEN,
86 GRF_DPHY_RX0_TESTDIN,
87 GRF_DPHY_RX0_TURNREQUEST,
88 GRF_DPHY_RX0_TESTDOUT,
89 GRF_DPHY_TX0_TURNDISABLE,
90 GRF_DPHY_TX0_FORCERXMODE,
91 GRF_DPHY_TX0_FORCETXSTOPMODE,
92 GRF_DPHY_TX0_TURNREQUEST,
93 GRF_DPHY_TX1RX1_TURNDISABLE,
94 GRF_DPHY_TX1RX1_FORCERXMODE,
95 GRF_DPHY_TX1RX1_FORCETXSTOPMODE,
96 GRF_DPHY_TX1RX1_ENABLE,
97 GRF_DPHY_TX1RX1_MASTERSLAVEZ,
98 GRF_DPHY_TX1RX1_BASEDIR,
99 GRF_DPHY_TX1RX1_ENABLECLK,
100 GRF_DPHY_TX1RX1_TURNREQUEST,
101 GRF_DPHY_RX1_SRC_SEL,
102 /* rk3288 only */
103 GRF_CON_DISABLE_ISP,
104 GRF_CON_ISP_DPHY_SEL,
105 GRF_DSI_CSI_TESTBUS_SEL,
106 GRF_DVP_V18SEL,
107 /* below is for rk3399 only */
108 GRF_DPHY_RX0_CLK_INV_SEL,
109 GRF_DPHY_RX1_CLK_INV_SEL,
110 };
111
112 struct dphy_reg {
113 u16 offset;
114 u8 mask;
115 u8 shift;
116 };
117
118 #define PHY_REG(_offset, _width, _shift) \
119 { .offset = _offset, .mask = BIT(_width) - 1, .shift = _shift, }
120
121 static const struct dphy_reg rk3399_grf_dphy_regs[] = {
122 [GRF_DPHY_RX0_TURNREQUEST] = PHY_REG(RK3399_GRF_SOC_CON9, 4, 0),
123 [GRF_DPHY_RX0_CLK_INV_SEL] = PHY_REG(RK3399_GRF_SOC_CON9, 1, 10),
124 [GRF_DPHY_RX1_CLK_INV_SEL] = PHY_REG(RK3399_GRF_SOC_CON9, 1, 11),
125 [GRF_DPHY_RX0_ENABLE] = PHY_REG(RK3399_GRF_SOC_CON21, 4, 0),
126 [GRF_DPHY_RX0_FORCERXMODE] = PHY_REG(RK3399_GRF_SOC_CON21, 4, 4),
127 [GRF_DPHY_RX0_FORCETXSTOPMODE] = PHY_REG(RK3399_GRF_SOC_CON21, 4, 8),
128 [GRF_DPHY_RX0_TURNDISABLE] = PHY_REG(RK3399_GRF_SOC_CON21, 4, 12),
129 [GRF_DPHY_TX0_FORCERXMODE] = PHY_REG(RK3399_GRF_SOC_CON22, 4, 0),
130 [GRF_DPHY_TX0_FORCETXSTOPMODE] = PHY_REG(RK3399_GRF_SOC_CON22, 4, 4),
131 [GRF_DPHY_TX0_TURNDISABLE] = PHY_REG(RK3399_GRF_SOC_CON22, 4, 8),
132 [GRF_DPHY_TX0_TURNREQUEST] = PHY_REG(RK3399_GRF_SOC_CON22, 4, 12),
133 [GRF_DPHY_TX1RX1_ENABLE] = PHY_REG(RK3399_GRF_SOC_CON23, 4, 0),
134 [GRF_DPHY_TX1RX1_FORCERXMODE] = PHY_REG(RK3399_GRF_SOC_CON23, 4, 4),
135 [GRF_DPHY_TX1RX1_FORCETXSTOPMODE] = PHY_REG(RK3399_GRF_SOC_CON23, 4, 8),
136 [GRF_DPHY_TX1RX1_TURNDISABLE] = PHY_REG(RK3399_GRF_SOC_CON23, 4, 12),
137 [GRF_DPHY_TX1RX1_TURNREQUEST] = PHY_REG(RK3399_GRF_SOC_CON24, 4, 0),
138 [GRF_DPHY_RX1_SRC_SEL] = PHY_REG(RK3399_GRF_SOC_CON24, 1, 4),
139 [GRF_DPHY_TX1RX1_BASEDIR] = PHY_REG(RK3399_GRF_SOC_CON24, 1, 5),
140 [GRF_DPHY_TX1RX1_ENABLECLK] = PHY_REG(RK3399_GRF_SOC_CON24, 1, 6),
141 [GRF_DPHY_TX1RX1_MASTERSLAVEZ] = PHY_REG(RK3399_GRF_SOC_CON24, 1, 7),
142 [GRF_DPHY_RX0_TESTDIN] = PHY_REG(RK3399_GRF_SOC_CON25, 8, 0),
143 [GRF_DPHY_RX0_TESTEN] = PHY_REG(RK3399_GRF_SOC_CON25, 1, 8),
144 [GRF_DPHY_RX0_TESTCLK] = PHY_REG(RK3399_GRF_SOC_CON25, 1, 9),
145 [GRF_DPHY_RX0_TESTCLR] = PHY_REG(RK3399_GRF_SOC_CON25, 1, 10),
146 [GRF_DPHY_RX0_TESTDOUT] = PHY_REG(RK3399_GRF_SOC_STATUS1, 8, 0),
147 };
148
149 struct dphy_drv_data {
150 const char * const *clks;
151 unsigned int num_clks;
152 const struct hsfreq_range *hsfreq_ranges;
153 unsigned int num_hsfreq_ranges;
154 const struct dphy_reg *regs;
155 };
156
157 struct rockchip_dphy {
158 struct device *dev;
159 struct regmap *grf;
160 struct clk_bulk_data clks[MAX_DPHY_CLK];
161
162 const struct dphy_drv_data *drv_data;
163 struct phy_configure_opts_mipi_dphy config;
164 };
165
166 static inline void rk_dphy_write_grf(struct rockchip_dphy *priv,
167 unsigned int index, u8 value)
168 {
169 const struct dphy_reg *reg = &priv->drv_data->regs[index];
170 /* Update high word */
171 unsigned int val = (value << reg->shift) |
172 (reg->mask << (reg->shift + 16));
173
174 WARN_ON(!reg->offset);
175 regmap_write(priv->grf, reg->offset, val);
176 }
177
178 static void rk_dphy_write_rx(struct rockchip_dphy *priv,
179 u8 test_code, u8 test_data)
180 {
181 /*
182 * With the falling edge on TESTCLK, the TESTDIN[7:0] signal content
183 * is latched internally as the current test code. Test data is
184 * programmed internally by rising edge on TESTCLK.
185 */
186 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTCLK, 1);
187 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTDIN, test_code);
188 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTEN, 1);
189 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTCLK, 0);
190 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTEN, 0);
191 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTDIN, test_data);
192 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTCLK, 1);
193 }
194
195 static void rk_dphy_rx_stream_on(struct rockchip_dphy *priv)
196 {
197 const struct dphy_drv_data *drv_data = priv->drv_data;
198 struct phy_configure_opts_mipi_dphy *config = &priv->config;
199 unsigned int i, hsfreq = 0, data_rate_mbps = config->hs_clk_rate;
200
> 201 do_div(data_rate_mbps, 1000 * 1000); 202
203 dev_dbg(priv->dev, "%s: lanes %d - data_rate_mbps %u\n",
204 __func__, config->lanes, data_rate_mbps);
205
206 for (i = 0; i < drv_data->num_hsfreq_ranges; i++) {
207 if (drv_data->hsfreq_ranges[i].range_h >= data_rate_mbps) {
208 hsfreq = drv_data->hsfreq_ranges[i].cfg_bit;
209 break;
210 }
211 }
212
213 rk_dphy_write_grf(priv, GRF_DPHY_RX0_FORCERXMODE, 0);
214 rk_dphy_write_grf(priv, GRF_DPHY_RX0_FORCETXSTOPMODE, 0);
215
216 /* Disable lane turn around, which is ignored in receive mode */
217 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TURNREQUEST, 0);
218 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TURNDISABLE, 0xf);
219
220 rk_dphy_write_grf(priv, GRF_DPHY_RX0_ENABLE, GENMASK(config->lanes - 1, 0));
221
222 /* dphy start */
223 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTCLK, 1);
224 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTCLR, 1);
225 usleep_range(100, 150);
226 rk_dphy_write_grf(priv, GRF_DPHY_RX0_TESTCLR, 0);
227 usleep_range(100, 150);
228
229 /* set clock lane */
230 /* HS hsfreq_range & lane 0 settle bypass */
231 rk_dphy_write_rx(priv, CLOCK_LANE_HS_RX_CONTROL, 0);
232 /* HS RX Control of lane0 */
233 rk_dphy_write_rx(priv, LANE0_HS_RX_CONTROL, hsfreq << 1);
234 /* HS RX Control of lane1 */
235 rk_dphy_write_rx(priv, LANE1_HS_RX_CONTROL, hsfreq << 1);
236 /* HS RX Control of lane2 */
237 rk_dphy_write_rx(priv, LANE2_HS_RX_CONTROL, hsfreq << 1);
238 /* HS RX Control of lane3 */
239 rk_dphy_write_rx(priv, LANE3_HS_RX_CONTROL, hsfreq << 1);
240 /* HS RX Data Lanes Settle State Time Control */
241 rk_dphy_write_rx(priv, HS_RX_DATA_LANES_THS_SETTLE_CONTROL,
242 THS_SETTLE_COUNTER_THRESHOLD);
243
244 /* Normal operation */
245 rk_dphy_write_rx(priv, 0x0, 0);
246 }
247
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
PATCH v9 3/4 media: staging: rkisp1: add Rockchip ISP1 driver
In reply to Helen KoikeAdd Rockchip ISP1 driver to the staging tree.
---
Changes in v9:
- Move to staging
- Previous patch series had a patch for file and the last commit would
add the Makefile bits to make it compile. But one file was dependent on
each other, so it doesn't make much sense to have a patch for each file
and it doesn't make it easier to review.
* capture.c
- replace v4l2_{dgb,info,warn,err} by dev_*
* isp_stats.c
- 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
* rkisp1:
- 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
* dev.h / dev.c / regs.c / regs.h / common.h
- 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
Please see a more complete history of changes at
https://patchwork.kernel.org/cover/11066499/
drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/phy-rockchip-dphy/TODO | 3 + .../bindings/media/rockchip-isp1.txt | 71 + .../bindings/media/rockchip-mipi-dphy.txt | 38 + .../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 | 7 + drivers/staging/media/rkisp1/TODO | 20 + drivers/staging/media/rkisp1/capture.c | 1869 +++++++++++++++++ drivers/staging/media/rkisp1/capture.h | 164 ++ drivers/staging/media/rkisp1/common.h | 98 + drivers/staging/media/rkisp1/dev.c | 439 ++++ drivers/staging/media/rkisp1/dev.h | 67 + drivers/staging/media/rkisp1/isp_params.c | 1604 ++++++++++++++ drivers/staging/media/rkisp1/isp_params.h | 50 + drivers/staging/media/rkisp1/isp_stats.c | 494 +++++ drivers/staging/media/rkisp1/isp_stats.h | 60 + drivers/staging/media/rkisp1/regs.c | 224 ++ drivers/staging/media/rkisp1/regs.h | 1525 ++++++++++++++ drivers/staging/media/rkisp1/rkisp1.c | 1246 +++++++++++ drivers/staging/media/rkisp1/rkisp1.h | 97 + .../staging/media/rkisp1/uapi/rkisp1-config.h | 815 +++++++ 24 files changed, 8952 insertions(+) create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.txt create mode 100644 drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-mipi-dphy.txt 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/capture.c create mode 100644 drivers/staging/media/rkisp1/capture.h create mode 100644 drivers/staging/media/rkisp1/common.h create mode 100644 drivers/staging/media/rkisp1/dev.c create mode 100644 drivers/staging/media/rkisp1/dev.h create mode 100644 drivers/staging/media/rkisp1/isp_params.c create mode 100644 drivers/staging/media/rkisp1/isp_params.h create mode 100644 drivers/staging/media/rkisp1/isp_stats.c create mode 100644 drivers/staging/media/rkisp1/isp_stats.h create mode 100644 drivers/staging/media/rkisp1/regs.c create mode 100644 drivers/staging/media/rkisp1/regs.h create mode 100644 drivers/staging/media/rkisp1/rkisp1.c create mode 100644 drivers/staging/media/rkisp1/rkisp1.h create mode 100644 drivers/staging/media/rkisp1/uapi/rkisp1-config.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/phy-rockchip-dphy/TODO +3 -0
@@ -1,3 +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/rkisp1/Documentation/devicetree/bindings/media/rockchip-isp1.txt new file +71 -0
71 lines not on this page · raw message
drivers/staging/media/rkisp1/Documentation/devicetree/bindings/media/rockchip-mipi-dphy.txt new file +38 -0
@@ -0,0 +1,38 @@ +Rockchip SoC MIPI RX D-PHY +-------------------------- + +Required properties: +- compatible: value should be one of the following + "rockchip,rk3288-mipi-dphy" + "rockchip,rk3399-mipi-dphy" +- clocks : list of clock specifiers, corresponding to entries in + clock-names property; +- clock-names: required clock name. +- #phy-cells: Number of cells in a PHY specifier; Should be 0. + +MIPI RX D-PHY use registers in "general register files", it +should be a child of the GRF. + +Optional properties: +- reg: offset and length of the register set for the device. +- rockchip,grf: MIPI TX1RX1 D-PHY not only has its own register but also + the GRF, so it is only necessary for MIPI TX1RX1 D-PHY. + +Device node example +------------------- + +grf: syscon@ff770000 { + compatible = "rockchip,rk3399-grf", "syscon", "simple-mfd"; + +... + + 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>; + }; +};
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_isp_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_isp_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
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 +7 -0
@@ -0,0 +1,7 @@ +obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rockchip-isp1.o +rockchip-isp1-objs += rkisp1.o \ + dev.o \ + regs.o \ + isp_stats.o \ + isp_params.o \ + capture.o
drivers/staging/media/rkisp1/TODO new file +20 -0
@@ -0,0 +1,20 @@ +* Implement resizer subdevice. +* Fix serialization on subdev ops. +* Reject out of range hsfreq in rockchip_dphy_configure(). +* 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 race conditions when interrupt get delayed +* Fix pad format size for statistics and parameters entities. +* Cleanup link_validate to use v4l2_subdev_link_validate_default() +* Documentation for uapi +* Use threaded interrupt for rkisp1_stats_isr() +* Fix reloading the module +* Fix checkpatch errors + +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]>.
drivers/staging/media/rkisp1/capture.c new file +1869 -0
1,869 lines not on this page · raw message
drivers/staging/media/rkisp1/capture.h new file +164 -0
164 lines not on this page · raw message
drivers/staging/media/rkisp1/common.h new file +98 -0
98 lines not on this page · raw message
drivers/staging/media/rkisp1/dev.c new file +439 -0
439 lines not on this page · raw message
drivers/staging/media/rkisp1/dev.h new file +67 -0
67 lines not on this page · raw message
drivers/staging/media/rkisp1/isp_params.c new file +1604 -0
153 lines not on this page · raw message
drivers/staging/media/rkisp1/isp_params.h new file +50 -0
50 lines not on this page · raw message
drivers/staging/media/rkisp1/isp_stats.c new file +494 -0
494 lines not on this page · raw message
drivers/staging/media/rkisp1/isp_stats.h new file +60 -0
60 lines not on this page · raw message
drivers/staging/media/rkisp1/regs.c new file +224 -0
224 lines not on this page · raw message
drivers/staging/media/rkisp1/regs.h new file +1525 -0
1,525 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1.c new file +1246 -0
1,246 lines not on this page · raw message
drivers/staging/media/rkisp1/rkisp1.h new file +97 -0
97 lines not on this page · raw message
drivers/staging/media/rkisp1/uapi/rkisp1-config.h new file +815 -0
815 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.22.0
Part of the diff is not shown here. View the raw message.
PATCH v9 4/4 MAINTAINERS: add entry for Rockchip ISP1 driver
In reply to Helen KoikeAdd MAINTAINERS entry for the rockchip isp1 driver.
---
MAINTAINERS | 6 ++++++ 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
@@ -13933,6 +13933,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.22.0