[PATCH v4 2/2] drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

2024-05-13 Thread Shengyang Chen
From: Keith Zhao 

Add display bridge support for dsi on StarFive JH7110 SoC.

The mainly modification is followed:
1.Add extra clock and reset operation for JH7110.
2.Add callback for JH7110.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 +++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  19 +++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 138 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 6 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig 
b/drivers/gpu/drm/bridge/cadence/Kconfig
index cced81633ddc..ad9f572f4720 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E
help
  Support J721E Cadence DSI wrapper. The wrapper manages
  the routing of the DSS DPI signal to the Cadence DSI.
+
+config DRM_CDNS_DSI_JH7110
+   bool "JH7110 SOC Cadence DSI support"
+   default n
+   help
+ Cadence DPI to DSI bridge which is embedded in the
+ StarFive JH7110 SoC.
 endif
 
 config DRM_CDNS_MHDP8546
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile 
b/drivers/gpu/drm/bridge/cadence/Makefile
index c95fd5b81d13..87f603a9f4ad 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 cdns-dsi-y := cdns-dsi-core.o
 cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
+cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o
 obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
 cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
 cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 7457d38622b0..c0c81745e765 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -27,6 +27,10 @@
 #include "cdns-dsi-j721e.h"
 #endif
 
+#ifdef CONFIG_DRM_CDNS_DSI_JH7110
+#include "cdns-dsi-jh7110.h"
+#endif
+
 #define IP_CONF0x0
 #define SP_HS_FIFO_DEPTH(x)(((x) & GENMASK(30, 26)) >> 26)
 #define SP_LP_FIFO_DEPTH(x)(((x) & GENMASK(25, 21)) >> 21)
@@ -552,6 +556,10 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
/* data rate was in bytes/sec, convert to bits/sec. */
phy_cfg->hs_clk_rate = dlane_bps * 8;
 
+   if (dsi->platform_ops && dsi->platform_ops->mode_fixup)
+   adj_dsi_htotal = dsi->platform_ops->mode_fixup(dsi, dsi_cfg, 
phy_cfg,
+  dpi_hz, dpi_htotal, 
dsi_htotal);
+
dsi_hfp_ext = adj_dsi_htotal - dsi_htotal;
dsi_cfg->hfp += dsi_hfp_ext;
dsi_cfg->htotal = dsi_htotal + dsi_hfp_ext;
@@ -683,7 +691,7 @@ static void cdns_dsi_bridge_post_disable(struct drm_bridge 
*bridge)
pm_runtime_put(dsi->base.dev);
 }
 
-static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
+void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 {
struct cdns_dsi_output *output = &dsi->output;
u32 status;
@@ -1026,6 +1034,14 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host 
*host,
 
cdns_dsi_init_link(dsi);
 
+   /*
+* on JH7110 SoC , when transfer dsi command ,
+* cdns_dsi_hs_init is needed.
+* or the final ret will be error value.
+*/
+   if (dsi->platform_ops && dsi->platform_ops->transfer)
+   dsi->platform_ops->transfer(dsi);
+
ret = mipi_dsi_create_packet(&packet, msg);
if (ret)
goto out;
@@ -1142,6 +1158,9 @@ static int __maybe_unused cdns_dsi_resume(struct device 
*dev)
clk_prepare_enable(dsi->dsi_p_clk);
clk_prepare_enable(dsi->dsi_sys_clk);
 
+   if (dsi->platform_ops && dsi->platform_ops->resume)
+   dsi->platform_ops->resume(dsi);
+
return 0;
 }
 
@@ -1152,6 +1171,10 @@ static int __maybe_unused cdns_dsi_suspend(struct device 
*dev)
clk_disable_unprepare(dsi->dsi_sys_clk);
clk_disable_unprepare(dsi->dsi_p_clk);
reset_control_assert(dsi->dsi_p_rst);
+
+   if (dsi->platform_ops && dsi->platform_ops->suspend)
+   dsi->platform_ops->suspend(dsi);
+
dsi->link_initialized = false;
return 0;
 }
@@ -1294,6 +1317,10 @@ static const struct 

[PATCH v4 1/2] dt-bindings: display: bridge: cdns: Add display bridge support for dsi on StarFive JH7110 SoC

2024-05-13 Thread Shengyang Chen
From: Keith Zhao 

Add compatible to support dsi bridge on StarFive JH7110 SoC

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
Reviewed-by: Conor Dooley 
---
 .../bindings/display/bridge/cdns,dsi.yaml | 56 ++-
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
index 23060324d16e..4ad0ecaacaae 100644
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -16,6 +16,7 @@ properties:
   compatible:
 enum:
   - cdns,dsi
+  - starfive,jh7110-dsi
   - ti,j721e-dsi
 
   reg:
@@ -27,14 +28,20 @@ properties:
   Register block for wrapper settings registers in case of TI J7 SoCs.
 
   clocks:
+minItems: 2
 items:
   - description: PSM clock, used by the IP
   - description: sys clock, used by the IP
+  - description: dpi clock, used by the IP
+  - description: txesc clock, used by the IP
 
   clock-names:
+minItems: 2
 items:
   - const: dsi_p_clk
   - const: dsi_sys_clk
+  - const: dpi
+  - const: txesc
 
   phys:
 maxItems: 1
@@ -46,10 +53,22 @@ properties:
 maxItems: 1
 
   resets:
-maxItems: 1
+minItems: 1
+items:
+  - description: apb reset, associated to dsi_p_clk
+  - description: sys reset, associated to sys clock
+  - description: dpi reset, associated to dpi clock
+  - description: txesc reset, associated to txesc clock
+  - description: txbytehs reset, associated to txbytehs clock
 
   reset-names:
-const: dsi_p_rst
+minItems: 1
+items:
+  - const: dsi_p_rst
+  - const: sys
+  - const: dpi
+  - const: txesc
+  - const: txbytehs
 
   ports:
 $ref: /schemas/graph.yaml#/properties/ports
@@ -90,6 +109,39 @@ allOf:
 reg:
   maxItems: 1
 
+  - if:
+  properties:
+compatible:
+  contains:
+const: starfive,jh7110-dsi
+then:
+  properties:
+clocks:
+  minItems: 4
+  maxItems: 4
+clock-names:
+  minItems: 4
+  maxItems: 4
+resets:
+  minItems: 5
+  maxItems: 5
+reset-names:
+  minItems: 5
+  maxItems: 5
+  required:
+- resets
+- reset-names
+else:
+  properties:
+clocks:
+  maxItems: 2
+clock-names:
+  maxItems: 2
+resets:
+  maxItems: 1
+reset-names:
+  maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.17.1



[RESEND PATCH v4 0/2] Add StarFive JH7110 SoC DSI support

2024-05-13 Thread Shengyang Chen
This series is the series that attempts to support
the CDNS DSI driver used to converts DPI to DSI.
CDNS DSI is embedded in StarFive JH7110 SoC.
The series has been tested on the VisionFive 2 board.


change since v3:
- Rebased on tag v6.8-rc6.

patch 2:
- Replace clk API with clk_bulk_ API.
- Replace rst API with reset_control_bulk API.
- Use roundup() in cdns_dsi_jh7110_mode_fixup().
- Add assert for txbytehs reset operation by reset_control_bulk API  in suspend 
function.
- Add clk_bulk_disable_unprepare() in cdns_dsi_jh7110_resume() for deassert 
failure situation.

v3: 
https://patchwork.kernel.org/project/dri-devel/cover/20240206065709.108684-1-shengyang.c...@starfivetech.com/

change since v2:
- Rebased on tag v6.8-rc3.

patch 1:
- Modify commit message and patch subject
- Change 'starfve,jh7110-dsi' to 'starfive,jh7110-dsi'
- Add constraints for reset-names and clock names
- Add resets, reset-names attribute
- Correct reset and clock names

patch 2:
- Modify commit message and patch subject
- Drop useless MAINTAINERS modification
- Change callback name from 'update' to 'mode_fixup'
- Optimize the mode_fixup function.
- Change devm_reset_control_get() to devm_reset_control_get_exclusive()
- Correct reset and clock names

v2: 
https://patchwork.kernel.org/project/dri-devel/cover/20240109072516.24328-1-shengyang.c...@starfivetech.com/



changes since v1:
- Rebased on tag v6.7.

patch 1:
- Changed the 'starfive,cdns-dsi' to 'starfve,jh7110-dsi'.
- Changed the compatible enum alphabetical order.
- Restrict other variants.
- Drop 'dsi_' prefix.

patch 2:
- Optimize the calculation process.
- Drop useless definition.

v1: 
https://patchwork.kernel.org/project/dri-devel/cover/20231127113436.57361-1-shengyang.c...@starfivetech.com/


Keith Zhao (2):
  dt-bindings: display: bridge: cdns: Add display bridge support for dsi
on StarFive JH7110 SoC
  drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

 .../bindings/display/bridge/cdns,dsi.yaml |  56 ++-
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 +++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  19 +++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 138 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 7 files changed, 263 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

-- 
2.17.1



RE: [PATCH v4 0/2] Add StarFive JH7110 SoC DSI support

2024-03-17 Thread Shengyang Chen
> This series is the series that attempts to support the CDNS DSI driver used to
> converts DPI to DSI.
> CDNS DSI is embedded in StarFive JH7110 SoC.
> The series has been tested on the VisionFive 2 board.
> 
> 
Hi, Andrzej, Neil, Robert, Laurent, Jonas and Jernej

Could you please help to review and give me some suggestions for this patch 
series? Thank you for your time.

Best regards,
Shengyang


[PATCH v4 2/2] drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

2024-02-29 Thread Shengyang Chen
From: Keith Zhao 

Add display bridge support for dsi on StarFive JH7110 SoC.

The mainly modification is followed:
1.Add extra clock and reset operation for JH7110.
2.Add callback for JH7110.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 +++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  19 +++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 138 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 6 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig 
b/drivers/gpu/drm/bridge/cadence/Kconfig
index cced81633ddc..ad9f572f4720 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E
help
  Support J721E Cadence DSI wrapper. The wrapper manages
  the routing of the DSS DPI signal to the Cadence DSI.
+
+config DRM_CDNS_DSI_JH7110
+   bool "JH7110 SOC Cadence DSI support"
+   default n
+   help
+ Cadence DPI to DSI bridge which is embedded in the
+ StarFive JH7110 SoC.
 endif
 
 config DRM_CDNS_MHDP8546
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile 
b/drivers/gpu/drm/bridge/cadence/Makefile
index c95fd5b81d13..87f603a9f4ad 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 cdns-dsi-y := cdns-dsi-core.o
 cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
+cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o
 obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
 cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
 cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 7457d38622b0..c0c81745e765 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -27,6 +27,10 @@
 #include "cdns-dsi-j721e.h"
 #endif
 
+#ifdef CONFIG_DRM_CDNS_DSI_JH7110
+#include "cdns-dsi-jh7110.h"
+#endif
+
 #define IP_CONF0x0
 #define SP_HS_FIFO_DEPTH(x)(((x) & GENMASK(30, 26)) >> 26)
 #define SP_LP_FIFO_DEPTH(x)(((x) & GENMASK(25, 21)) >> 21)
@@ -552,6 +556,10 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
/* data rate was in bytes/sec, convert to bits/sec. */
phy_cfg->hs_clk_rate = dlane_bps * 8;
 
+   if (dsi->platform_ops && dsi->platform_ops->mode_fixup)
+   adj_dsi_htotal = dsi->platform_ops->mode_fixup(dsi, dsi_cfg, 
phy_cfg,
+  dpi_hz, dpi_htotal, 
dsi_htotal);
+
dsi_hfp_ext = adj_dsi_htotal - dsi_htotal;
dsi_cfg->hfp += dsi_hfp_ext;
dsi_cfg->htotal = dsi_htotal + dsi_hfp_ext;
@@ -683,7 +691,7 @@ static void cdns_dsi_bridge_post_disable(struct drm_bridge 
*bridge)
pm_runtime_put(dsi->base.dev);
 }
 
-static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
+void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 {
struct cdns_dsi_output *output = &dsi->output;
u32 status;
@@ -1026,6 +1034,14 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host 
*host,
 
cdns_dsi_init_link(dsi);
 
+   /*
+* on JH7110 SoC , when transfer dsi command ,
+* cdns_dsi_hs_init is needed.
+* or the final ret will be error value.
+*/
+   if (dsi->platform_ops && dsi->platform_ops->transfer)
+   dsi->platform_ops->transfer(dsi);
+
ret = mipi_dsi_create_packet(&packet, msg);
if (ret)
goto out;
@@ -1142,6 +1158,9 @@ static int __maybe_unused cdns_dsi_resume(struct device 
*dev)
clk_prepare_enable(dsi->dsi_p_clk);
clk_prepare_enable(dsi->dsi_sys_clk);
 
+   if (dsi->platform_ops && dsi->platform_ops->resume)
+   dsi->platform_ops->resume(dsi);
+
return 0;
 }
 
@@ -1152,6 +1171,10 @@ static int __maybe_unused cdns_dsi_suspend(struct device 
*dev)
clk_disable_unprepare(dsi->dsi_sys_clk);
clk_disable_unprepare(dsi->dsi_p_clk);
reset_control_assert(dsi->dsi_p_rst);
+
+   if (dsi->platform_ops && dsi->platform_ops->suspend)
+   dsi->platform_ops->suspend(dsi);
+
dsi->link_initialized = false;
return 0;
 }
@@ -1294,6 +1317,10 @@ static const struct 

[PATCH v4 0/2] Add StarFive JH7110 SoC DSI support

2024-02-29 Thread Shengyang Chen
This series is the series that attempts to support
the CDNS DSI driver used to converts DPI to DSI.
CDNS DSI is embedded in StarFive JH7110 SoC.
The series has been tested on the VisionFive 2 board.


change since v3:
- Rebased on tag v6.8-rc6.

patch 2:
- Replace clk API with clk_bulk_ API.
- Replace rst API with reset_control_bulk API.
- Use roundup() in cdns_dsi_jh7110_mode_fixup().
- Add assert for txbytehs reset operation by reset_control_bulk API  in suspend 
function.
- Add clk_bulk_disable_unprepare() in cdns_dsi_jh7110_resume() for deassert 
failure situation.

v3: 
https://patchwork.kernel.org/project/dri-devel/cover/20240206065709.108684-1-shengyang.c...@starfivetech.com/

change since v2:
- Rebased on tag v6.8-rc3.

patch 1:
- Modify commit message and patch subject
- Change 'starfve,jh7110-dsi' to 'starfive,jh7110-dsi'
- Add constraints for reset-names and clock names
- Add resets, reset-names attribute
- Correct reset and clock names

patch 2:
- Modify commit message and patch subject
- Drop useless MAINTAINERS modification
- Change callback name from 'update' to 'mode_fixup'
- Optimize the mode_fixup function.
- Change devm_reset_control_get() to devm_reset_control_get_exclusive()
- Correct reset and clock names

v2: 
https://patchwork.kernel.org/project/dri-devel/cover/20240109072516.24328-1-shengyang.c...@starfivetech.com/



changes since v1:
- Rebased on tag v6.7.

patch 1:
- Changed the 'starfive,cdns-dsi' to 'starfve,jh7110-dsi'.
- Changed the compatible enum alphabetical order.
- Restrict other variants.
- Drop 'dsi_' prefix.

patch 2:
- Optimize the calculation process.
- Drop useless definition.

v1: 
https://patchwork.kernel.org/project/dri-devel/cover/20231127113436.57361-1-shengyang.c...@starfivetech.com/


Keith Zhao (2):
  dt-bindings: display: bridge: cdns: Add display bridge support for dsi
on StarFive JH7110 SoC
  drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

 .../bindings/display/bridge/cdns,dsi.yaml |  56 ++-
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 +++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  19 +++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 138 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 7 files changed, 263 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

-- 
2.17.1



[PATCH v4 1/2] dt-bindings: display: bridge: cdns: Add display bridge support for dsi on StarFive JH7110 SoC

2024-02-29 Thread Shengyang Chen
From: Keith Zhao 

Add compatible to support dsi bridge on StarFive JH7110 SoC

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
Reviewed-by: Conor Dooley 
---
 .../bindings/display/bridge/cdns,dsi.yaml | 56 ++-
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
index 23060324d16e..4ad0ecaacaae 100644
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -16,6 +16,7 @@ properties:
   compatible:
 enum:
   - cdns,dsi
+  - starfive,jh7110-dsi
   - ti,j721e-dsi
 
   reg:
@@ -27,14 +28,20 @@ properties:
   Register block for wrapper settings registers in case of TI J7 SoCs.
 
   clocks:
+minItems: 2
 items:
   - description: PSM clock, used by the IP
   - description: sys clock, used by the IP
+  - description: dpi clock, used by the IP
+  - description: txesc clock, used by the IP
 
   clock-names:
+minItems: 2
 items:
   - const: dsi_p_clk
   - const: dsi_sys_clk
+  - const: dpi
+  - const: txesc
 
   phys:
 maxItems: 1
@@ -46,10 +53,22 @@ properties:
 maxItems: 1
 
   resets:
-maxItems: 1
+minItems: 1
+items:
+  - description: apb reset, associated to dsi_p_clk
+  - description: sys reset, associated to sys clock
+  - description: dpi reset, associated to dpi clock
+  - description: txesc reset, associated to txesc clock
+  - description: txbytehs reset, associated to txbytehs clock
 
   reset-names:
-const: dsi_p_rst
+minItems: 1
+items:
+  - const: dsi_p_rst
+  - const: sys
+  - const: dpi
+  - const: txesc
+  - const: txbytehs
 
   ports:
 $ref: /schemas/graph.yaml#/properties/ports
@@ -90,6 +109,39 @@ allOf:
 reg:
   maxItems: 1
 
+  - if:
+  properties:
+compatible:
+  contains:
+const: starfive,jh7110-dsi
+then:
+  properties:
+clocks:
+  minItems: 4
+  maxItems: 4
+clock-names:
+  minItems: 4
+  maxItems: 4
+resets:
+  minItems: 5
+  maxItems: 5
+reset-names:
+  minItems: 5
+  maxItems: 5
+  required:
+- resets
+- reset-names
+else:
+  properties:
+clocks:
+  maxItems: 2
+clock-names:
+  maxItems: 2
+resets:
+  maxItems: 1
+reset-names:
+  maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.17.1



RE: [PATCH v3 2/2] drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

2024-02-22 Thread Shengyang Chen
Hi, Dmitry

Thanks for review and comment.

> -Original Message-
> From: Dmitry Baryshkov 
> Sent: 2024年2月7日 18:58
> To: Shengyang Chen 
> Cc: devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org;
> andrzej.ha...@intel.com; neil.armstr...@linaro.org; rf...@kernel.org;
> laurent.pinch...@ideasonboard.com; jo...@kwiboo.se;
> jernej.skra...@gmail.com; maarten.lankho...@linux.intel.com;
> mrip...@kernel.org; tzimmerm...@suse.de; airl...@gmail.com;
> dan...@ffwll.ch; robh...@kernel.org; krzysztof.kozlowski...@linaro.org;
> conor...@kernel.org; p.za...@pengutronix.de;
> tomi.valkei...@ideasonboard.com; r-raviku...@ti.com;
> aford...@gmail.com; a...@sigxcpu.org; rdun...@infradead.org;
> u.kleine-koe...@pengutronix.de; s...@ravnborg.org; bbrezil...@kernel.org;
> Changhuang Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v3 2/2] drm/bridge: cdns-dsi: Add support for StarFive
> JH7110 SoC
> 
> On Tue, 6 Feb 2024 at 08:57, Shengyang Chen
>  wrote:
> >
> > From: Keith Zhao 
> >
> > Add display bridge support for dsi on StarFive JH7110 SoC.
> >
> > The mainly modification is followed:
> > 1.Add extra clock and reset operation for JH7110.
> > 2.Add callback for JH7110.
> >
> > Signed-off-by: Keith Zhao 
> > Signed-off-by: Shengyang Chen 
> > ---
> >  drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
> >  drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
> >  .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 ++-
> >  .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  21 ++
> >  .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 193
> > ++  .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |
> > 16 ++
> >  6 files changed, 266 insertions(+), 1 deletion(-)  create mode 100644
> > drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
> >  create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h
> >
> > diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig
> > b/drivers/gpu/drm/bridge/cadence/Kconfig
> > index cced81633ddc..ad9f572f4720 100644
> > --- a/drivers/gpu/drm/bridge/cadence/Kconfig
> > +++ b/drivers/gpu/drm/bridge/cadence/Kconfig
> > @@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E
> > help
> >   Support J721E Cadence DSI wrapper. The wrapper manages
> >   the routing of the DSS DPI signal to the Cadence DSI.
> > +
> > +config DRM_CDNS_DSI_JH7110
> > +   bool "JH7110 SOC Cadence DSI support"
> > +   default n
> > +   help
> > + Cadence DPI to DSI bridge which is embedded in the
> > + StarFive JH7110 SoC.
> >  endif
> >
> >  config DRM_CDNS_MHDP8546
> > diff --git a/drivers/gpu/drm/bridge/cadence/Makefile
> > b/drivers/gpu/drm/bridge/cadence/Makefile
> > index c95fd5b81d13..87f603a9f4ad 100644
> > --- a/drivers/gpu/drm/bridge/cadence/Makefile
> > +++ b/drivers/gpu/drm/bridge/cadence/Makefile
> > @@ -2,6 +2,7 @@
> >  obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o  cdns-dsi-y :=
> > cdns-dsi-core.o
> >  cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
> > +cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o
> >  obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
> cdns-mhdp8546-y
> > := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
> >  cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) +=
> > cdns-mhdp8546-j721e.o diff --git
> > a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > index 7457d38622b0..c0c81745e765 100644
> > --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > @@ -27,6 +27,10 @@
> >  #include "cdns-dsi-j721e.h"
> >  #endif
> >
> > +#ifdef CONFIG_DRM_CDNS_DSI_JH7110
> > +#include "cdns-dsi-jh7110.h"
> > +#endif
> > +
> >  #define IP_CONF0x0
> >  #define SP_HS_FIFO_DEPTH(x)(((x) & GENMASK(30, 26)) >>
> 26)
> >  #define SP_LP_FIFO_DEPTH(x)(((x) & GENMASK(25, 21)) >>
> 21)
> > @@ -552,6 +556,10 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi
> *dsi,
> > /* data rate was in bytes/sec, convert to bits/sec. */
> > phy_cfg->hs_clk_rate = dlane_bps * 8;
> >
> > +   if (dsi->platform_ops && dsi->platform_ops->mode_fixup)
> > +   adj_dsi_htotal = dsi->platform_ops->mode_fixup(dsi,
> dsi_cfg, phy_cfg,
> > +
> dpi_hz,
> > + dpi_htotal

[PATCH v3 2/2] drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

2024-02-05 Thread Shengyang Chen
From: Keith Zhao 

Add display bridge support for dsi on StarFive JH7110 SoC.

The mainly modification is followed:
1.Add extra clock and reset operation for JH7110.
2.Add callback for JH7110.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 ++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  21 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 193 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 6 files changed, 266 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig 
b/drivers/gpu/drm/bridge/cadence/Kconfig
index cced81633ddc..ad9f572f4720 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E
help
  Support J721E Cadence DSI wrapper. The wrapper manages
  the routing of the DSS DPI signal to the Cadence DSI.
+
+config DRM_CDNS_DSI_JH7110
+   bool "JH7110 SOC Cadence DSI support"
+   default n
+   help
+ Cadence DPI to DSI bridge which is embedded in the
+ StarFive JH7110 SoC.
 endif
 
 config DRM_CDNS_MHDP8546
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile 
b/drivers/gpu/drm/bridge/cadence/Makefile
index c95fd5b81d13..87f603a9f4ad 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 cdns-dsi-y := cdns-dsi-core.o
 cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
+cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o
 obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
 cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
 cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 7457d38622b0..c0c81745e765 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -27,6 +27,10 @@
 #include "cdns-dsi-j721e.h"
 #endif
 
+#ifdef CONFIG_DRM_CDNS_DSI_JH7110
+#include "cdns-dsi-jh7110.h"
+#endif
+
 #define IP_CONF0x0
 #define SP_HS_FIFO_DEPTH(x)(((x) & GENMASK(30, 26)) >> 26)
 #define SP_LP_FIFO_DEPTH(x)(((x) & GENMASK(25, 21)) >> 21)
@@ -552,6 +556,10 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
/* data rate was in bytes/sec, convert to bits/sec. */
phy_cfg->hs_clk_rate = dlane_bps * 8;
 
+   if (dsi->platform_ops && dsi->platform_ops->mode_fixup)
+   adj_dsi_htotal = dsi->platform_ops->mode_fixup(dsi, dsi_cfg, 
phy_cfg,
+  dpi_hz, dpi_htotal, 
dsi_htotal);
+
dsi_hfp_ext = adj_dsi_htotal - dsi_htotal;
dsi_cfg->hfp += dsi_hfp_ext;
dsi_cfg->htotal = dsi_htotal + dsi_hfp_ext;
@@ -683,7 +691,7 @@ static void cdns_dsi_bridge_post_disable(struct drm_bridge 
*bridge)
pm_runtime_put(dsi->base.dev);
 }
 
-static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
+void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 {
struct cdns_dsi_output *output = &dsi->output;
u32 status;
@@ -1026,6 +1034,14 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host 
*host,
 
cdns_dsi_init_link(dsi);
 
+   /*
+* on JH7110 SoC , when transfer dsi command ,
+* cdns_dsi_hs_init is needed.
+* or the final ret will be error value.
+*/
+   if (dsi->platform_ops && dsi->platform_ops->transfer)
+   dsi->platform_ops->transfer(dsi);
+
ret = mipi_dsi_create_packet(&packet, msg);
if (ret)
goto out;
@@ -1142,6 +1158,9 @@ static int __maybe_unused cdns_dsi_resume(struct device 
*dev)
clk_prepare_enable(dsi->dsi_p_clk);
clk_prepare_enable(dsi->dsi_sys_clk);
 
+   if (dsi->platform_ops && dsi->platform_ops->resume)
+   dsi->platform_ops->resume(dsi);
+
return 0;
 }
 
@@ -1152,6 +1171,10 @@ static int __maybe_unused cdns_dsi_suspend(struct device 
*dev)
clk_disable_unprepare(dsi->dsi_sys_clk);
clk_disable_unprepare(dsi->dsi_p_clk);
reset_control_assert(dsi->dsi_p_rst);
+
+   if (dsi->platform_ops && dsi->platform_ops->suspend)
+   dsi->platform_ops->suspend(dsi);
+
dsi->link_initialized = false;
return 0;
 }
@@ -1294,6 +1317,10 @@ static const struct 

[PATCH v3 0/2] Add StarFive JH7110 SoC DSI support

2024-02-05 Thread Shengyang Chen
This series is the series that attempts to support
the CDNS DSI driver used to converts DPI to DSI.
CDNS DSI is embedded in StarFive JH7110 SoC.
The series has been tested on the VisionFive 2 board.


change since v2:
- Rebased on tag v6.8-rc3.

patch 1:
- Modify commit message and patch subject
- Change 'starfve,jh7110-dsi' to 'starfive,jh7110-dsi'
- Add constraints for reset-names and clock names
- Add resets, reset-names attribute
- Correct reset and clock names

patch 2:
- Modify commit message and patch subject
- Drop useless MAINTAINERS modification
- Change callback name from 'update' to 'mode_fixup'
- Optimize the mode_fixup function.
- Change devm_reset_control_get() to devm_reset_control_get_exclusive()
- Correct reset and clock names

v2: 
https://patchwork.kernel.org/project/dri-devel/cover/20240109072516.24328-1-shengyang.c...@starfivetech.com/



changes since v1:
- Rebased on tag v6.7.

patch 1:
- Changed the 'starfive,cdns-dsi' to 'starfve,jh7110-dsi'.
- Changed the compatible enum alphabetical order.
- Restrict other variants.
- Drop 'dsi_' prefix.

patch 2:
- Optimize the calculation process.
- Drop useless definition.

v1: 
https://patchwork.kernel.org/project/dri-devel/cover/20231127113436.57361-1-shengyang.c...@starfivetech.com/

Keith Zhao (2):
  dt-bindings: display: bridge: cdns: Add display bridge support for dsi
on StarFive JH7110 SoC
  drm/bridge: cdns-dsi: Add support for StarFive JH7110 SoC

 .../bindings/display/bridge/cdns,dsi.yaml |  56 -
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 ++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  21 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 193 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 7 files changed, 320 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

-- 
2.17.1



[PATCH v3 1/2] dt-bindings: display: bridge: cdns: Add display bridge support for dsi on StarFive JH7110 SoC

2024-02-05 Thread Shengyang Chen
From: Keith Zhao 

Add compatible to support dsi bridge on StarFive JH7110 SoC

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 .../bindings/display/bridge/cdns,dsi.yaml | 56 ++-
 1 file changed, 54 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
index 23060324d16e..4ad0ecaacaae 100644
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -16,6 +16,7 @@ properties:
   compatible:
 enum:
   - cdns,dsi
+  - starfive,jh7110-dsi
   - ti,j721e-dsi
 
   reg:
@@ -27,14 +28,20 @@ properties:
   Register block for wrapper settings registers in case of TI J7 SoCs.
 
   clocks:
+minItems: 2
 items:
   - description: PSM clock, used by the IP
   - description: sys clock, used by the IP
+  - description: dpi clock, used by the IP
+  - description: txesc clock, used by the IP
 
   clock-names:
+minItems: 2
 items:
   - const: dsi_p_clk
   - const: dsi_sys_clk
+  - const: dpi
+  - const: txesc
 
   phys:
 maxItems: 1
@@ -46,10 +53,22 @@ properties:
 maxItems: 1
 
   resets:
-maxItems: 1
+minItems: 1
+items:
+  - description: apb reset, associated to dsi_p_clk
+  - description: sys reset, associated to sys clock
+  - description: dpi reset, associated to dpi clock
+  - description: txesc reset, associated to txesc clock
+  - description: txbytehs reset, associated to txbytehs clock
 
   reset-names:
-const: dsi_p_rst
+minItems: 1
+items:
+  - const: dsi_p_rst
+  - const: sys
+  - const: dpi
+  - const: txesc
+  - const: txbytehs
 
   ports:
 $ref: /schemas/graph.yaml#/properties/ports
@@ -90,6 +109,39 @@ allOf:
 reg:
   maxItems: 1
 
+  - if:
+  properties:
+compatible:
+  contains:
+const: starfive,jh7110-dsi
+then:
+  properties:
+clocks:
+  minItems: 4
+  maxItems: 4
+clock-names:
+  minItems: 4
+  maxItems: 4
+resets:
+  minItems: 5
+  maxItems: 5
+reset-names:
+  minItems: 5
+  maxItems: 5
+  required:
+- resets
+- reset-names
+else:
+  properties:
+clocks:
+  maxItems: 2
+clock-names:
+  maxItems: 2
+resets:
+  maxItems: 1
+reset-names:
+  maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.17.1



RE: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support

2024-01-16 Thread Shengyang Chen
Hi, Neil

> -Original Message-
> From: neil.armstr...@linaro.org 
> Sent: 2024年1月16日 17:34
> To: Shengyang Chen ;
> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org
> Cc: quic_jessz...@quicinc.com; s...@ravnborg.org; airl...@gmail.com;
> dan...@ffwll.ch; maarten.lankho...@linux.intel.com; mrip...@kernel.org;
> tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org; wahre...@gmx.net;
> dave.steven...@raspberrypi.com; thierry.red...@gmail.com; Changhuang
> Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support
> 
> On 16/01/2024 10:32, Shengyang Chen wrote:
> > Hi, Neil
> >
> > Thanks for your comment.
> >
> >> -Original Message-
> >> From: neil.armstr...@linaro.org 
> >> Sent: 2024年1月9日 19:19
> >> To: Shengyang Chen ;
> >> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org
> >> Cc: quic_jessz...@quicinc.com; s...@ravnborg.org; airl...@gmail.com;
> >> dan...@ffwll.ch; maarten.lankho...@linux.intel.com;
> >> mrip...@kernel.org; tzimmerm...@suse.de; robh...@kernel.org;
> >> krzysztof.kozlowski...@linaro.org; conor...@kernel.org;
> >> wahre...@gmx.net; dave.steven...@raspberrypi.com;
> >> thierry.red...@gmail.com; Changhuang Liang
> >> ; Keith Zhao
> >> ; Jack Zhu ;
> >> linux-ker...@vger.kernel.org
> >> Subject: Re: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel
> >> support
> >>
> >> Hi,
> >>
> >> On 09/01/2024 08:09, Shengyang Chen wrote:
> >>> This patchset adds waveshare 7inch touchscreen panel support for the
> >>> StarFive JH7110 SoC.
> >>
> >> Could you precise which SKU you're referring to ? is it 19885 =>
> >> https://www.waveshare.com/7inch-dsi-lcd.htm ?
> >>
> >
> > yes, it is
> > sorry for confusing you.
> >
> >> Are you sure it requires different timings from the RPi one ? In the
> >> Waveshare wiki it explicitly uses the rpi setup (vc4-kms-dsi-7inch) to 
> >> drive it:
> >> https://www.waveshare.com/wiki/7inch_DSI_LCD
> >>
> >
> > Referring to Keith's answer
> > https://lists.freedesktop.org/archives/dri-devel/2023-December/434200.
> > html the panel timing value is generated to fit phy's bitrate and
> > prevent overflow and underflow.
> >
> > Referring to the suggestion, we may try other timing from panel-simple to
> drive the panel.
> 
> Please implement a mode_fixup in your DSI host driver instead.
> 

The mode fixup method is already used. As reference:
https://patchwork.kernel.org/project/dri-devel/patch/20240109072516.24328-3-shengyang.c...@starfivetech.com/
you can check it in cdns_dsi_jh7110_update(). 
This code is being reviewed and may need to be optimized later.

> Neil
> 
> >
> >> Neil
> >>
> >>>
> >>>
> >>> changes since v1:
> >>> - Rebased on tag v6.7.
> >>>
> >>> patch 1:
> >>> - Gave up original changing.
> >>> - Changed the commit message.
> >>> - Add compatible in panel-simple.yaml
> >>>
> >>> patch 2:
> >>> - Gave up original changing.
> >>> - Changed the commit message.
> >>> - Add new mode for the panel in panel-simple.c
> >>>
> >>> v1:
> >>> https://patchwork.kernel.org/project/dri-devel/cover/20231124104451.
> >>> 44 271-1-shengyang.c...@starfivetech.com/
> >>>
> >>> Shengyang Chen (2):
> >>> dt-bindings: display: panel: panel-simple: Add compatible property for
> >>>   waveshare 7inch touchscreen panel
> >>> gpu: drm: panel: panel-simple: add new display mode for waveshare
> >>>   7inch touchscreen panel
> >>>
> >>>.../bindings/display/panel/panel-simple.yaml  |  2 ++
> >>>drivers/gpu/drm/panel/panel-simple.c  | 28
> >> +++
> >>>2 files changed, 30 insertions(+)
> >>>
> >
> >
> > Best Regards,
> > Shengyang

Best Regards,
Shengyang


RE: [PATCH v2 2/2] gpu: drm: panel: panel-simple: add new display mode for waveshare 7inch touchscreen panel

2024-01-16 Thread Shengyang Chen
Hi, Jessica

Thanks for your comment and review

> -Original Message-
> From: Jessica Zhang 
> Sent: 2024年1月10日 2:26
> To: Shengyang Chen ;
> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org
> Cc: neil.armstr...@linaro.org; s...@ravnborg.org; airl...@gmail.com;
> dan...@ffwll.ch; maarten.lankho...@linux.intel.com; mrip...@kernel.org;
> tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org; wahre...@gmx.net;
> dave.steven...@raspberrypi.com; thierry.red...@gmail.com; Changhuang
> Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 2/2] gpu: drm: panel: panel-simple: add new display
> mode for waveshare 7inch touchscreen panel
> 
> 
> 
> On 1/8/2024 11:09 PM, Shengyang Chen wrote:
> > The waveshare 7" 800x480 panel is a clone of Raspberry Pi 7" 800x480
> > panel It also uses a Toshiba TC358762 DSI to DPI bridge chip but it
> > needs different timing from Raspberry Pi panel. Add new timing for it.
> 
> Hi Shengyang,
> 
> The patch itself LGTM, but in case you have to put out a new revision, can you
> please use the "drm/panel: :" prefix format that other drm/panel
> commits use?
> 

Thanks for your suggestion. The prefix format will be used if we have next 
version.
btw, referring to the suggestions, we are going to try other timing from 
panel-simple
in our platform. Maybe we are not necessary to submit new version.
Thanks a lot

> Reviewed-by: Jessica Zhang 
> 
> Thanks,
> 
> Jessica Zhang
> 
> >
> > Signed-off-by: Keith Zhao 
> > Signed-off-by: Shengyang Chen 
> > ---
> >   drivers/gpu/drm/panel/panel-simple.c | 28
> 
> >   1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c
> > b/drivers/gpu/drm/panel/panel-simple.c
> > index 9367a4572dcf..e0896873ea33 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -4110,6 +4110,31 @@ static const struct panel_desc vl050_8048nt_c01
> = {
> > .bus_flags = DRM_BUS_FLAG_DE_HIGH |
> DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
> >   };
> >
> > +static const struct drm_display_mode waveshare_7inch_mode = {
> > +   .clock = 2970 / 1000,
> > +   .hdisplay = 800,
> > +   .hsync_start = 800 + 90,
> > +   .hsync_end = 800 + 90 + 5,
> > +   .htotal = 800 + 90 + 5 + 5,
> > +   .vdisplay = 480,
> > +   .vsync_start = 480 + 60,
> > +   .vsync_end = 480 + 60 + 5,
> > +   .vtotal = 480 + 60 + 5 + 5,
> > +   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, };
> > +
> > +static const struct panel_desc waveshare_7inch = {
> > +   .modes = &waveshare_7inch_mode,
> > +   .num_modes = 1,
> > +   .bpc = 8,
> > +   .size = {
> > +   .width = 154,
> > +   .height = 86,
> > +   },
> > +   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
> > +   .connector_type = DRM_MODE_CONNECTOR_DSI, };
> > +
> >   static const struct drm_display_mode winstar_wf35ltiacd_mode = {
> > .clock = 6410,
> > .hdisplay = 320,
> > @@ -4592,6 +4617,9 @@ static const struct of_device_id
> platform_of_match[] = {
> > }, {
> > .compatible = "vxt,vl050-8048nt-c01",
> > .data = &vl050_8048nt_c01,
> > +   }, {
> > +   .compatible = "waveshare,7inch-touchscreen",
> > +   .data = &waveshare_7inch,
> > }, {
> > .compatible = "winstar,wf35ltiacd",
> > .data = &winstar_wf35ltiacd,
> > --
> > 2.17.1
> >

thanks

Best Regards,
Shengyang


RE: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support

2024-01-16 Thread Shengyang Chen
Hi, Dave

Thanks for your comment

> -Original Message-
> From: Dave Stevenson 
> Sent: 2024年1月10日 1:29
> To: neil.armstr...@linaro.org
> Cc: Shengyang Chen ;
> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org;
> quic_jessz...@quicinc.com; s...@ravnborg.org; airl...@gmail.com;
> dan...@ffwll.ch; maarten.lankho...@linux.intel.com; mrip...@kernel.org;
> tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org; wahre...@gmx.net;
> thierry.red...@gmail.com; Changhuang Liang
> ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support
> 
> Hi
> 
> On Tue, 9 Jan 2024 at 11:19,  wrote:
> >
> > Hi,
> >
> > On 09/01/2024 08:09, Shengyang Chen wrote:
> > > This patchset adds waveshare 7inch touchscreen panel support for the
> > > StarFive JH7110 SoC.
> >
> > Could you precise which SKU you're referring to ? is it 19885 =>
> https://www.waveshare.com/7inch-dsi-lcd.htm ?
> >
> > Are you sure it requires different timings from the RPi one ? In the
> > Waveshare wiki it explicitly uses the rpi setup (vc4-kms-dsi-7inch) to
> > drive it: https://www.waveshare.com/wiki/7inch_DSI_LCD
> 
> I raise the same question.
> 
> Keith Zhao earlier submitted effectively the same set of patches [1] and the
> response for the updated timing was:
> 
> My platform dphy tx hardware has certain limitations.
> Only supports integer multiples of 10M bitrate:
> such as 160M ,170M, 180M,190M,...1G(max)
> 
> as common dphy bitrate = pixclock*bpp/lanes.
> This value cannot match successfully in most cases.
> 
> so in order to match bitrate , I choose a bitrate value around 
> pixclock*bpp/lanes,
> Prevent overflow and underflow by fine-tuning the timing parameters:-( that
> will make the new timming value.
> 
> 
> I then suggested mode_fixup should be used in the DSI host driver, and Keith
> acknowledged that.
> 
> Is this new timing still because of the DSI host requirement?
> 

Actually, the mode fixup method is referred and used in DSI's new patch
https://patchwork.kernel.org/project/dri-devel/patch/20240109072516.24328-3-shengyang.c...@starfivetech.com/
you can check it in cdns_dsi_jh7110_update()
This code is being reviewed and may need to be optimized later.

And the timing in this panel patch is tested and verified but we did not try 
other timing. Sorry about that.
As Stefan suggested, we should try other timing from panel-simple for example 
"powertip,ph800480t013-idf02".

If the other timing from panel-simple can be used, maybe it is not necessary 
for us to submit panel timing patch.

>   Dave
> 
> [1]
> https://lists.freedesktop.org/archives/dri-devel/2023-December/434150.html
> 
> > Neil
> >
> > >
> > >
> > > changes since v1:
> > > - Rebased on tag v6.7.
> > >
> > > patch 1:
> > > - Gave up original changing.
> > > - Changed the commit message.
> > > - Add compatible in panel-simple.yaml
> > >
> > > patch 2:
> > > - Gave up original changing.
> > > - Changed the commit message.
> > > - Add new mode for the panel in panel-simple.c
> > >
> > > v1:
> > > https://patchwork.kernel.org/project/dri-devel/cover/20231124104451.
> > > 44271-1-shengyang.c...@starfivetech.com/
> > >
> > > Shengyang Chen (2):
> > >dt-bindings: display: panel: panel-simple: Add compatible property for
> > >  waveshare 7inch touchscreen panel
> > >gpu: drm: panel: panel-simple: add new display mode for waveshare
> > >  7inch touchscreen panel
> > >
> > >   .../bindings/display/panel/panel-simple.yaml  |  2 ++
> > >   drivers/gpu/drm/panel/panel-simple.c  | 28
> +++
> > >   2 files changed, 30 insertions(+)
> > >
> >

Best Regards,
Shengyang


RE: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support

2024-01-16 Thread Shengyang Chen
Hi, Stefan

Thanks for your comment and suggestion.

> -Original Message-
> From: Stefan Wahren 
> Sent: 2024年1月10日 1:22
> To: neil.armstr...@linaro.org; Shengyang Chen
> ; devicet...@vger.kernel.org;
> dri-devel@lists.freedesktop.org
> Cc: quic_jessz...@quicinc.com; s...@ravnborg.org; airl...@gmail.com;
> dan...@ffwll.ch; maarten.lankho...@linux.intel.com; mrip...@kernel.org;
> tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org;
> dave.steven...@raspberrypi.com; thierry.red...@gmail.com; Changhuang
> Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support
> 
> Hi Neil,
> 
> Am 09.01.24 um 12:19 schrieb neil.armstr...@linaro.org:
> > Hi,
> >
> > On 09/01/2024 08:09, Shengyang Chen wrote:
> >> This patchset adds waveshare 7inch touchscreen panel support for the
> >> StarFive JH7110 SoC.
> >
> > Could you precise which SKU you're referring to ? is it 19885 =>
> > https://www.waveshare.com/7inch-dsi-lcd.htm ?
> >
> > Are you sure it requires different timings from the RPi one ? In the
> > Waveshare wiki it explicitly uses the rpi setup (vc4-kms-dsi-7inch) to
> > drive it:
> > https://www.waveshare.com/wiki/7inch_DSI_LCD
> i don't have an anser for your question, but the Raspberry Pi vendor tree use
> different timings than the Mainline kernel:
> 
> https://github.com/raspberrypi/linux/commit/222b9baa97cc4c880d040a8c6a5
> da80d6a42c8e8
> 
> Additionally the
> arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rpidsi.dtso suggests that
> it uses the Raspberry Pi 7inch, but uses the timings of
> powertip,ph800480t013-idf02 from panel-simple.
> 
> Maybe Shengyang could test these timings with the Waveshare touch. At the
> end this rely on a proper implementation on the underlying drivers.
> 
> Sorry, for adding more confusion.
> 
Thanks for suggestion.
We will try other timing from panel-simple.
Maybe we are not going to commit new panel timing patch
if we find useful timing from panel-simple to drive the panel.

> Regards
> >
> > Neil
> >
> >>
> >>
> >> changes since v1:
> >> - Rebased on tag v6.7.
> >>
> >> patch 1:
> >> - Gave up original changing.
> >> - Changed the commit message.
> >> - Add compatible in panel-simple.yaml
> >>
> >> patch 2:
> >> - Gave up original changing.
> >> - Changed the commit message.
> >> - Add new mode for the panel in panel-simple.c
> >>
> >> v1:
> >> https://patchwork.kernel.org/project/dri-devel/cover/20231124104451.4
> >> 4271-1-shengyang.c...@starfivetech.com/
> >>
> >> Shengyang Chen (2):
> >>    dt-bindings: display: panel: panel-simple: Add compatible property
> >> for
> >>  waveshare 7inch touchscreen panel
> >>    gpu: drm: panel: panel-simple: add new display mode for waveshare
> >>  7inch touchscreen panel
> >>
> >>   .../bindings/display/panel/panel-simple.yaml  |  2 ++
> >>   drivers/gpu/drm/panel/panel-simple.c  | 28
> >> +++
> >>   2 files changed, 30 insertions(+)
> >>
> >

thanks

Best Regards,
Shengyang


RE: [PATCH v2 1/2] dt-bindings: display: panel: panel-simple: Add compatible property for waveshare 7inch touchscreen panel

2024-01-16 Thread Shengyang Chen


> -Original Message-
> From: neil.armstr...@linaro.org 
> Sent: 2024年1月10日 17:06
> To: Conor Dooley ; Shengyang Chen
> 
> Cc: devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org;
> quic_jessz...@quicinc.com; s...@ravnborg.org; airl...@gmail.com;
> dan...@ffwll.ch; maarten.lankho...@linux.intel.com; mrip...@kernel.org;
> tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org; wahre...@gmx.net;
> dave.steven...@raspberrypi.com; thierry.red...@gmail.com; Changhuang
> Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] dt-bindings: display: panel: panel-simple: Add
> compatible property for waveshare 7inch touchscreen panel
> 
> On 09/01/2024 17:32, Conor Dooley wrote:
> > On Tue, Jan 09, 2024 at 03:09:48PM +0800, Shengyang Chen wrote:
> >> The waveshare 7" 800x480 panel is a clone of Raspberry Pi 7" 800x480
> >> panel It can be drived by Raspberry Pi panel's process but it needs
> >> different timing from Raspberry Pi panel. Add compatible property for it.
> >>
> >> Signed-off-by: Keith Zhao 
> >> Signed-off-by: Shengyang Chen 
> >> ---
> >>   .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git
> >> a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> >> b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> >> index 11422af3477e..02f6b1b2ddc9 100644
> >> ---
> >> a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> >> +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.ya
> >> +++ ml
> >> @@ -335,6 +335,8 @@ properties:
> >> - vivax,tpc9150-panel
> >>   # VXT 800x480 color TFT LCD panel
> >> - vxt,vl050-8048nt-c01
> >> +# Waveshare 7" (800x480) touchscreen LCD panel
> >> +  - waveshare,7inch-touchscreen
> >
> > Is "7inch-touchscreen" really a specific enough identifier for this
> > device?
> 
> Waveshare has very precise SKUs, this should be something like
> waveshare,7inch-dsi-sku19885 perhaps
> 
> Neil

thanks for mention, It will be checked if next version is needed.

> 
> >
> >>   # Winstar Display Corporation 3.5" QVGA (320x240) TFT LCD
> panel
> >> - winstar,wf35ltiacd
> >>   # Yes Optoelectronics YTC700TLAG-05-201C 7" TFT LCD panel
> >> --
> >> 2.17.1
> >>



RE: [PATCH v2 1/2] dt-bindings: display: panel: panel-simple: Add compatible property for waveshare 7inch touchscreen panel

2024-01-16 Thread Shengyang Chen
Hi, Conor

Thanks for comment.

> -Original Message-
> From: Conor Dooley 
> Sent: 2024年1月10日 0:32
> To: Shengyang Chen 
> Cc: devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org;
> neil.armstr...@linaro.org; quic_jessz...@quicinc.com; s...@ravnborg.org;
> airl...@gmail.com; dan...@ffwll.ch; maarten.lankho...@linux.intel.com;
> mrip...@kernel.org; tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org; wahre...@gmx.net;
> dave.steven...@raspberrypi.com; thierry.red...@gmail.com; Changhuang
> Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] dt-bindings: display: panel: panel-simple: Add
> compatible property for waveshare 7inch touchscreen panel
> 
> On Tue, Jan 09, 2024 at 03:09:48PM +0800, Shengyang Chen wrote:
> > The waveshare 7" 800x480 panel is a clone of Raspberry Pi 7" 800x480
> > panel It can be drived by Raspberry Pi panel's process but it needs
> > different timing from Raspberry Pi panel. Add compatible property for it.
> >
> > Signed-off-by: Keith Zhao 
> > Signed-off-by: Shengyang Chen 
> > ---
> >  .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> > b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> > index 11422af3477e..02f6b1b2ddc9 100644
> > ---
> > a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
> > +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yam
> > +++ l
> > @@ -335,6 +335,8 @@ properties:
> >- vivax,tpc9150-panel
> >  # VXT 800x480 color TFT LCD panel
> >- vxt,vl050-8048nt-c01
> > +# Waveshare 7" (800x480) touchscreen LCD panel
> > +  - waveshare,7inch-touchscreen
> 
> Is "7inch-touchscreen" really a specific enough identifier for this device?
> 

Referring to official website[1] and Neil's suggestion, maybe I should change to
"7inch-touchscreen-dsi-lcd" or "waveshare,7inch-dsi-sku19885" if the next patch 
version is needed.

[1]: https://www.waveshare.com/7inch-dsi-lcd.htm

> >  # Winstar Display Corporation 3.5" QVGA (320x240) TFT LCD panel
> >- winstar,wf35ltiacd
> >  # Yes Optoelectronics YTC700TLAG-05-201C 7" TFT LCD panel
> > --
> > 2.17.1
> >


Best Regards,
Shengyang


RE: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support

2024-01-16 Thread Shengyang Chen
Hi, Neil

Thanks for your comment.

> -Original Message-
> From: neil.armstr...@linaro.org 
> Sent: 2024年1月9日 19:19
> To: Shengyang Chen ;
> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org
> Cc: quic_jessz...@quicinc.com; s...@ravnborg.org; airl...@gmail.com;
> dan...@ffwll.ch; maarten.lankho...@linux.intel.com; mrip...@kernel.org;
> tzimmerm...@suse.de; robh...@kernel.org;
> krzysztof.kozlowski...@linaro.org; conor...@kernel.org; wahre...@gmx.net;
> dave.steven...@raspberrypi.com; thierry.red...@gmail.com; Changhuang
> Liang ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 0/2] Add waveshare 7inch touchscreen panel support
> 
> Hi,
> 
> On 09/01/2024 08:09, Shengyang Chen wrote:
> > This patchset adds waveshare 7inch touchscreen panel support for the
> > StarFive JH7110 SoC.
> 
> Could you precise which SKU you're referring to ? is it 19885 =>
> https://www.waveshare.com/7inch-dsi-lcd.htm ?
> 

yes, it is
sorry for confusing you.

> Are you sure it requires different timings from the RPi one ? In the Waveshare
> wiki it explicitly uses the rpi setup (vc4-kms-dsi-7inch) to drive it:
> https://www.waveshare.com/wiki/7inch_DSI_LCD
> 

Referring to Keith's answer
https://lists.freedesktop.org/archives/dri-devel/2023-December/434200.html
the panel timing value is generated to fit phy's bitrate and prevent overflow 
and underflow.

Referring to the suggestion, we may try other timing from panel-simple to drive 
the panel.

> Neil
> 
> >
> >
> > changes since v1:
> > - Rebased on tag v6.7.
> >
> > patch 1:
> > - Gave up original changing.
> > - Changed the commit message.
> > - Add compatible in panel-simple.yaml
> >
> > patch 2:
> > - Gave up original changing.
> > - Changed the commit message.
> > - Add new mode for the panel in panel-simple.c
> >
> > v1:
> > https://patchwork.kernel.org/project/dri-devel/cover/20231124104451.44
> > 271-1-shengyang.c...@starfivetech.com/
> >
> > Shengyang Chen (2):
> >dt-bindings: display: panel: panel-simple: Add compatible property for
> >  waveshare 7inch touchscreen panel
> >gpu: drm: panel: panel-simple: add new display mode for waveshare
> >  7inch touchscreen panel
> >
> >   .../bindings/display/panel/panel-simple.yaml  |  2 ++
> >   drivers/gpu/drm/panel/panel-simple.c  | 28
> +++
> >   2 files changed, 30 insertions(+)
> >


Best Regards,
Shengyang


RE: [PATCH v2 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC

2024-01-16 Thread Shengyang Chen
Hi, Krzysztof

Thanks for review and comment.

> -Original Message-
> From: Krzysztof Kozlowski 
> Sent: 2024年1月11日 5:06
> To: Shengyang Chen ;
> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org
> Cc: andrzej.ha...@intel.com; neil.armstr...@linaro.org; rf...@kernel.org;
> laurent.pinch...@ideasonboard.com; jo...@kwiboo.se;
> jernej.skra...@gmail.com; maarten.lankho...@linux.intel.com;
> mrip...@kernel.org; tzimmerm...@suse.de; airl...@gmail.com;
> dan...@ffwll.ch; robh...@kernel.org; krzysztof.kozlowski...@linaro.org;
> conor...@kernel.org; p.za...@pengutronix.de;
> tomi.valkei...@ideasonboard.com; r-raviku...@ti.com;
> aford...@gmail.com; rdun...@infradead.org;
> u.kleine-koe...@pengutronix.de; bbrezil...@kernel.org; Changhuang Liang
> ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 1/2] dt-bindings: display: bridge: cdns: Add 
> properties to
> support StarFive JH7110 SoC
> 
> On 09/01/2024 08:25, Shengyang Chen wrote:
> > From: Keith Zhao 
> >
> > Add properties in CDNS DSI yaml file to match with CDNS DSI module in
> > StarFive JH7110 SoC.
> 
> Please wrap commit message according to Linux coding style / submission
> process (neither too early nor over the limit):
> https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submi
> tting-patches.rst#L597
> 
> Subject: Make it concise, like: "Add StarFive JH7110 SoC display bridge or
> something".
> 

ok, will follow up this issue.
thanks for suggestion.

> >
> > Signed-off-by: Keith Zhao 
> > ---
> >  .../bindings/display/bridge/cdns,dsi.yaml | 44 ++-
> >  1 file changed, 42 insertions(+), 2 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> > b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> > index 23060324d16e..da091e105794 100644
> > --- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> > +++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
> > @@ -16,6 +16,7 @@ properties:
> >compatible:
> >  enum:
> >- cdns,dsi
> > +  - starfve,jh7110-dsi
> >- ti,j721e-dsi
> >
> >reg:
> > @@ -27,14 +28,20 @@ properties:
> >Register block for wrapper settings registers in case of TI J7
> SoCs.
> >
> >clocks:
> > +minItems: 2
> >  items:
> >- description: PSM clock, used by the IP
> >- description: sys clock, used by the IP
> > +  - description: apb clock, used by the IP
> > +  - description: txesc clock, used by the IP
> >
> >clock-names:
> > +minItems: 2
> >  items:
> >- const: dsi_p_clk
> >- const: dsi_sys_clk
> > +  - const: apb
> > +  - const: txesc
> >
> >phys:
> >  maxItems: 1
> > @@ -46,10 +53,21 @@ properties:
> >  maxItems: 1
> >
> >resets:
> > -maxItems: 1
> > +minItems: 1
> > +items:
> > +  - description: dsi sys reset line
> > +  - description: dsi dpi reset line
> > +  - description: dsi apb reset line
> > +  - description: dsi txesc reset line
> > +  - description: dsi txbytehs reset line
> >
> >reset-names:
> > -const: dsi_p_rst
> > +items:
> > +  - const: dsi_p_rst
> > +  - const: dpi
> > +  - const: apb
> > +  - const: txesc
> > +  - const: txbytehs
> >
> >ports:
> >  $ref: /schemas/graph.yaml#/properties/ports
> > @@ -90,6 +108,28 @@ allOf:
> >  reg:
> >maxItems: 1
> >
> > +  - if:
> > +  properties:
> > +compatible:
> > +  contains:
> > +const: starfive,jh7110-dsi
> > +then:
> > +  properties:
> > +clocks:
> > +  minItems: 4
> > +  maxItems: 4
> > +resets:
> > +  minItems: 5
> > +  maxItems: 5
> 
> Missing constraints for xxx-names.
> 

ok, will fix it

> > +  required:
> > +- reset-names
> > +else:
> > +  properties:
> > +clocks:
> > +  maxItems: 2
> > +resets:
> > +  maxItems: 1
> 
> Same problem.
> 

ok, will fix it

> Best regards,
> Krzysztof

thanks.

Best Regards,
Shengyang


RE: [PATCH v2 2/2] gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive JH7110 SoC

2024-01-16 Thread Shengyang Chen
Hi, Philipp

Thanks for review and comment.

> -Original Message-
> From: Philipp Zabel 
> Sent: 2024年1月9日 17:08
> To: Shengyang Chen ;
> devicet...@vger.kernel.org; dri-devel@lists.freedesktop.org
> Cc: andrzej.ha...@intel.com; neil.armstr...@linaro.org; rf...@kernel.org;
> laurent.pinch...@ideasonboard.com; jo...@kwiboo.se;
> jernej.skra...@gmail.com; maarten.lankho...@linux.intel.com;
> mrip...@kernel.org; tzimmerm...@suse.de; airl...@gmail.com;
> dan...@ffwll.ch; robh...@kernel.org; krzysztof.kozlowski...@linaro.org;
> conor...@kernel.org; tomi.valkei...@ideasonboard.com; r-raviku...@ti.com;
> aford...@gmail.com; rdun...@infradead.org;
> u.kleine-koe...@pengutronix.de; bbrezil...@kernel.org; Changhuang Liang
> ; Keith Zhao
> ; Jack Zhu ;
> linux-ker...@vger.kernel.org
> Subject: Re: [PATCH v2 2/2] gpu: drm: bridge: cadence: Add a driver and
> platform ops for StarFive JH7110 SoC
> 
> On Di, 2024-01-09 at 15:25 +0800, Shengyang Chen wrote:
> > +static int cdns_dsi_get_reset(struct device *dev, struct cdns_dsi
> > +*dsi) {
> > +   dsi->dpi_rst = devm_reset_control_get(dev, "dpi");
> > +   if (IS_ERR(dsi->dpi_rst))
> > +   return PTR_ERR(dsi->dpi_rst);
> 
> Please use devm_reset_control_get_exclusive() directly.
> 
> Also, consider using devm_reset_control_bulk_get_exclusive() instead, to
> control "dpi"/"apb"/"txesc" resets together - if the hardware can handle
> deasserting in reversed order.
> 

ok, will follow up this issue.

> > +
> > +   dsi->apb_rst = devm_reset_control_get(dev, "apb");
> > +   if (IS_ERR(dsi->apb_rst))
> > +   return PTR_ERR(dsi->apb_rst);
> > +
> > +   dsi->txesc_rst = devm_reset_control_get(dev, "txesc");
> > +   if (IS_ERR(dsi->txesc_rst))
> > +   return PTR_ERR(dsi->txesc_rst);
> > +
> > +   dsi->txbytehs_rst = devm_reset_control_get(dev, "txbytehs");
> > +   if (IS_ERR(dsi->txbytehs_rst))
> > +   return PTR_ERR(dsi->txbytehs_rst);
> > +
> > +   return 0;
> > +}
> 
> regards
> Philipp


thanks.

Best Regards,
Shengyang


[PATCH v2 2/2] gpu: drm: panel: panel-simple: add new display mode for waveshare 7inch touchscreen panel

2024-01-08 Thread Shengyang Chen
The waveshare 7" 800x480 panel is a clone of Raspberry Pi 7" 800x480 panel
It also uses a Toshiba TC358762 DSI to DPI bridge chip but it needs different
timing from Raspberry Pi panel. Add new timing for it.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 drivers/gpu/drm/panel/panel-simple.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index 9367a4572dcf..e0896873ea33 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -4110,6 +4110,31 @@ static const struct panel_desc vl050_8048nt_c01 = {
.bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
 };
 
+static const struct drm_display_mode waveshare_7inch_mode = {
+   .clock = 2970 / 1000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 90,
+   .hsync_end = 800 + 90 + 5,
+   .htotal = 800 + 90 + 5 + 5,
+   .vdisplay = 480,
+   .vsync_start = 480 + 60,
+   .vsync_end = 480 + 60 + 5,
+   .vtotal = 480 + 60 + 5 + 5,
+   .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+};
+
+static const struct panel_desc waveshare_7inch = {
+   .modes = &waveshare_7inch_mode,
+   .num_modes = 1,
+   .bpc = 8,
+   .size = {
+   .width = 154,
+   .height = 86,
+   },
+   .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+   .connector_type = DRM_MODE_CONNECTOR_DSI,
+};
+
 static const struct drm_display_mode winstar_wf35ltiacd_mode = {
.clock = 6410,
.hdisplay = 320,
@@ -4592,6 +4617,9 @@ static const struct of_device_id platform_of_match[] = {
}, {
.compatible = "vxt,vl050-8048nt-c01",
.data = &vl050_8048nt_c01,
+   }, {
+   .compatible = "waveshare,7inch-touchscreen",
+   .data = &waveshare_7inch,
}, {
.compatible = "winstar,wf35ltiacd",
.data = &winstar_wf35ltiacd,
-- 
2.17.1



[PATCH v2 2/2] gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive JH7110 SoC

2024-01-08 Thread Shengyang Chen
From: Keith Zhao 

In order to fit CDNS DSI module in StarFive JH7110 SoC,
The mainly modification is followed:

1.Add driver for StarFive JH7110 SoC to drive its CDNS DSI module.
2.Add platform ops in cdns-dsi.c for StarFive JH7110 SoC probing.

Signed-off-by: Keith Zhao 
---
 MAINTAINERS   |   8 +
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 ++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  21 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 193 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 7 files changed, 274 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

diff --git a/MAINTAINERS b/MAINTAINERS
index d32920dd943f..a220ea04f5c4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6847,6 +6847,14 @@ F:   
Documentation/devicetree/bindings/display/solomon,ssd-common.yaml
 F: Documentation/devicetree/bindings/display/solomon,ssd13*.yaml
 F: drivers/gpu/drm/solomon/ssd130x*
 
+DRM DRIVERS FOR STARFIVE
+M: Keith Zhao 
+M: Shengyang Chen 
+L: dri-devel@lists.freedesktop.org
+S: Maintained
+T: git git://anongit.freedesktop.org/drm/drm-misc
+F: drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110*
+
 DRM DRIVER FOR ST-ERICSSON MCDE
 M: Linus Walleij 
 S: Maintained
diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig 
b/drivers/gpu/drm/bridge/cadence/Kconfig
index cced81633ddc..ad9f572f4720 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E
help
  Support J721E Cadence DSI wrapper. The wrapper manages
  the routing of the DSS DPI signal to the Cadence DSI.
+
+config DRM_CDNS_DSI_JH7110
+   bool "JH7110 SOC Cadence DSI support"
+   default n
+   help
+ Cadence DPI to DSI bridge which is embedded in the
+ StarFive JH7110 SoC.
 endif
 
 config DRM_CDNS_MHDP8546
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile 
b/drivers/gpu/drm/bridge/cadence/Makefile
index c95fd5b81d13..87f603a9f4ad 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 cdns-dsi-y := cdns-dsi-core.o
 cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
+cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o
 obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
 cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
 cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 7457d38622b0..a8f976f9eeed 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -27,6 +27,10 @@
 #include "cdns-dsi-j721e.h"
 #endif
 
+#ifdef CONFIG_DRM_CDNS_DSI_JH7110
+#include "cdns-dsi-jh7110.h"
+#endif
+
 #define IP_CONF0x0
 #define SP_HS_FIFO_DEPTH(x)(((x) & GENMASK(30, 26)) >> 26)
 #define SP_LP_FIFO_DEPTH(x)(((x) & GENMASK(25, 21)) >> 21)
@@ -552,6 +556,10 @@ static int cdns_dsi_adjust_phy_config(struct cdns_dsi *dsi,
/* data rate was in bytes/sec, convert to bits/sec. */
phy_cfg->hs_clk_rate = dlane_bps * 8;
 
+   if (dsi->platform_ops && dsi->platform_ops->update)
+   adj_dsi_htotal = dsi->platform_ops->update(dsi, dsi_cfg, 
phy_cfg,
+  dpi_hz, dpi_htotal, 
dsi_htotal);
+
dsi_hfp_ext = adj_dsi_htotal - dsi_htotal;
dsi_cfg->hfp += dsi_hfp_ext;
dsi_cfg->htotal = dsi_htotal + dsi_hfp_ext;
@@ -683,7 +691,7 @@ static void cdns_dsi_bridge_post_disable(struct drm_bridge 
*bridge)
pm_runtime_put(dsi->base.dev);
 }
 
-static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
+void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 {
struct cdns_dsi_output *output = &dsi->output;
u32 status;
@@ -1026,6 +1034,14 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host 
*host,
 
cdns_dsi_init_link(dsi);
 
+   /*
+* on JH7110 SoC , when transfer dsi command ,
+* cdns_dsi_hs_init is needed.
+* or the final ret will be error value.
+*/
+   if (dsi->platform_ops && dsi->platform_ops->transfer)
+   dsi->platform_ops->transfer(dsi);
+
ret = mipi_dsi_create_packet(&packet, msg);
if (ret)
goto out;
@@ -1142,6 +1158,9 @@ static int __maybe_unused cdns_dsi_resume(struct device 
*dev)
clk_prepare_enable(dsi-

[PATCH v2 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC

2024-01-08 Thread Shengyang Chen
From: Keith Zhao 

Add properties in CDNS DSI yaml file to match with
CDNS DSI module in StarFive JH7110 SoC.

Signed-off-by: Keith Zhao 
---
 .../bindings/display/bridge/cdns,dsi.yaml | 44 ++-
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
index 23060324d16e..da091e105794 100644
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -16,6 +16,7 @@ properties:
   compatible:
 enum:
   - cdns,dsi
+  - starfve,jh7110-dsi
   - ti,j721e-dsi
 
   reg:
@@ -27,14 +28,20 @@ properties:
   Register block for wrapper settings registers in case of TI J7 SoCs.
 
   clocks:
+minItems: 2
 items:
   - description: PSM clock, used by the IP
   - description: sys clock, used by the IP
+  - description: apb clock, used by the IP
+  - description: txesc clock, used by the IP
 
   clock-names:
+minItems: 2
 items:
   - const: dsi_p_clk
   - const: dsi_sys_clk
+  - const: apb
+  - const: txesc
 
   phys:
 maxItems: 1
@@ -46,10 +53,21 @@ properties:
 maxItems: 1
 
   resets:
-maxItems: 1
+minItems: 1
+items:
+  - description: dsi sys reset line
+  - description: dsi dpi reset line
+  - description: dsi apb reset line
+  - description: dsi txesc reset line
+  - description: dsi txbytehs reset line
 
   reset-names:
-const: dsi_p_rst
+items:
+  - const: dsi_p_rst
+  - const: dpi
+  - const: apb
+  - const: txesc
+  - const: txbytehs
 
   ports:
 $ref: /schemas/graph.yaml#/properties/ports
@@ -90,6 +108,28 @@ allOf:
 reg:
   maxItems: 1
 
+  - if:
+  properties:
+compatible:
+  contains:
+const: starfive,jh7110-dsi
+then:
+  properties:
+clocks:
+  minItems: 4
+  maxItems: 4
+resets:
+  minItems: 5
+  maxItems: 5
+  required:
+- reset-names
+else:
+  properties:
+clocks:
+  maxItems: 2
+resets:
+  maxItems: 1
+
 required:
   - compatible
   - reg
-- 
2.17.1



[PATCH v2 0/2] Add StarFive JH7110 SoC DSI support

2024-01-08 Thread Shengyang Chen
This series is the series that attempts to support
the CDNS DSI driver used to converts DPI to DSI.
CDNS DSI is embedded in StarFive JH7110 SoC.
The series has been tested on the VisionFive 2 board.


changes since v1:
- Rebased on tag v6.7.

patch 1:
- Changed the 'starfive,cdns-dsi' to 'starfve,jh7110-dsi'.
- Changed the compatible enum alphabetical order.
- Restrict other variants.
- Drop 'dsi_' prefix.

patch 2:
- Optimize the calculation process.
- Drop useless definition.

v1: 
https://patchwork.kernel.org/project/dri-devel/cover/20231127113436.57361-1-shengyang.c...@starfivetech.com/

Keith Zhao (2):
  dt-bindings: display: bridge: cdns: Add properties to support StarFive
JH7110 SoC
  gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive
JH7110 SoC

 .../bindings/display/bridge/cdns,dsi.yaml |  44 +++-
 MAINTAINERS   |   8 +
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  29 ++-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  21 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 193 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  |  16 ++
 8 files changed, 316 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

-- 
2.17.1



[PATCH v2 0/2] Add waveshare 7inch touchscreen panel support

2024-01-08 Thread Shengyang Chen
This patchset adds waveshare 7inch touchscreen panel support
for the StarFive JH7110 SoC.


changes since v1:
- Rebased on tag v6.7.

patch 1:
- Gave up original changing.
- Changed the commit message.
- Add compatible in panel-simple.yaml

patch 2:
- Gave up original changing.
- Changed the commit message.
- Add new mode for the panel in panel-simple.c

v1: 
https://patchwork.kernel.org/project/dri-devel/cover/20231124104451.44271-1-shengyang.c...@starfivetech.com/

Shengyang Chen (2):
  dt-bindings: display: panel: panel-simple: Add compatible property for
waveshare 7inch touchscreen panel
  gpu: drm: panel: panel-simple: add new display mode for waveshare
7inch touchscreen panel

 .../bindings/display/panel/panel-simple.yaml  |  2 ++
 drivers/gpu/drm/panel/panel-simple.c  | 28 +++
 2 files changed, 30 insertions(+)

-- 
2.17.1



[PATCH v2 1/2] dt-bindings: display: panel: panel-simple: Add compatible property for waveshare 7inch touchscreen panel

2024-01-08 Thread Shengyang Chen
The waveshare 7" 800x480 panel is a clone of Raspberry Pi 7" 800x480 panel
It can be drived by Raspberry Pi panel's process but it needs different
timing from Raspberry Pi panel. Add compatible property for it.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 .../devicetree/bindings/display/panel/panel-simple.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
index 11422af3477e..02f6b1b2ddc9 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
@@ -335,6 +335,8 @@ properties:
   - vivax,tpc9150-panel
 # VXT 800x480 color TFT LCD panel
   - vxt,vl050-8048nt-c01
+# Waveshare 7" (800x480) touchscreen LCD panel
+  - waveshare,7inch-touchscreen
 # Winstar Display Corporation 3.5" QVGA (320x240) TFT LCD panel
   - winstar,wf35ltiacd
 # Yes Optoelectronics YTC700TLAG-05-201C 7" TFT LCD panel
-- 
2.17.1



Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC

2023-12-07 Thread Shengyang Chen
Hi, Rob

Thanks for review and comment.

On 2023/11/28 23:52, Rob Herring wrote:
> On Mon, Nov 27, 2023 at 07:34:35PM +0800, Shengyang Chen wrote:
>> From: Keith Zhao 
>> 
>> Add properties in CDNS DSI yaml file to match with
>> CDNS DSI module in StarFive JH7110 SoC.
>> 
>> Signed-off-by: Keith Zhao 
>> ---
>>  .../bindings/display/bridge/cdns,dsi.yaml | 38 ++-
>>  1 file changed, 36 insertions(+), 2 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
>> b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> index 23060324d16e..3f02ee383aad 100644
>> --- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> +++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> @@ -17,6 +17,7 @@ properties:
>>  enum:
>>- cdns,dsi
>>- ti,j721e-dsi
>> +  - starfive,cdns-dsi
>>  
>>reg:
>>  minItems: 1
>> @@ -27,14 +28,20 @@ properties:
>>Register block for wrapper settings registers in case of TI J7 
>> SoCs.
>>  
>>clocks:
>> +minItems: 2
>>  items:
>>- description: PSM clock, used by the IP
>>- description: sys clock, used by the IP
>> +  - description: apb clock, used by the IP
>> +  - description: txesc clock, used by the IP
>>  
>>clock-names:
>> +minItems: 2
>>  items:
>>- const: dsi_p_clk
>>- const: dsi_sys_clk
>> +  - const: apb
>> +  - const: txesc
>>  
>>phys:
>>  maxItems: 1
>> @@ -46,10 +53,21 @@ properties:
>>  maxItems: 1
>>  
>>resets:
>> -maxItems: 1
>> +minItems: 1
>> +items:
>> +  - description: dsi sys reset line
>> +  - description: dsi dpi reset line
>> +  - description: dsi apb reset line
>> +  - description: dsi txesc reset line
>> +  - description: dsi txbytehs reset line
>>  
>>reset-names:
>> -const: dsi_p_rst
>> +items:
>> +  - const: dsi_p_rst
>> +  - const: dsi_dpi
>> +  - const: dsi_apb
>> +  - const: dsi_txesc
>> +  - const: dsi_txbytehs
> 
> Let's not continue the redundant 'dsi_' prefix. We're stuck with it for 
> the first one, but not the new ones.
> 

ok, "dsi_" will be dropped in next commit.

> Rob

thanks.

Best Regards,
Shengyang


Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC

2023-12-07 Thread Shengyang Chen



On 2023/11/27 20:23, Krzysztof Kozlowski wrote:
> On 27/11/2023 12:34, Shengyang Chen wrote:
>> From: Keith Zhao 
>> 
>> Add properties in CDNS DSI yaml file to match with
>> CDNS DSI module in StarFive JH7110 SoC.
>> 
>> Signed-off-by: Keith Zhao 
>> ---
>>  .../bindings/display/bridge/cdns,dsi.yaml | 38 ++-
>>  1 file changed, 36 insertions(+), 2 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
>> b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> index 23060324d16e..3f02ee383aad 100644
>> --- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> +++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> @@ -17,6 +17,7 @@ properties:
>>  enum:
>>- cdns,dsi
>>- ti,j721e-dsi
>> +  - starfive,cdns-dsi
> 
> BTW, one more thing, I really doubt that starfive created "cdns" block.
> "cdns" is vendor prefix. Use SoCs-specific compatibles.
> 

The StarFive SoC contains cdns dsi ip inside. It did not create cdns block. 
Sorry about that.
It will be fixed by using SoCs-specific compatibles.
thanks

> Best regards,
> Krzysztof
> 


Re: [PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC

2023-12-07 Thread Shengyang Chen
Hi,Krzysztof

Thanks for review and comment.

On 2023/11/27 20:22, Krzysztof Kozlowski wrote:
> On 27/11/2023 12:34, Shengyang Chen wrote:
>> From: Keith Zhao 
>> 
>> Add properties in CDNS DSI yaml file to match with
>> CDNS DSI module in StarFive JH7110 SoC.
>> 
>> Signed-off-by: Keith Zhao 
>> ---
>>  .../bindings/display/bridge/cdns,dsi.yaml | 38 ++-
>>  1 file changed, 36 insertions(+), 2 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
>> b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> index 23060324d16e..3f02ee383aad 100644
>> --- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> +++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
>> @@ -17,6 +17,7 @@ properties:
>>  enum:
>>- cdns,dsi
>>- ti,j721e-dsi
>> +  - starfive,cdns-dsi
> 
> Keep alphabetical order.
> 

ok, will keep it order

>>  
>>reg:
>>  minItems: 1
>> @@ -27,14 +28,20 @@ properties:
>>Register block for wrapper settings registers in case of TI J7 
>> SoCs.
>>  
>>clocks:
>> +minItems: 2
>>  items:
>>- description: PSM clock, used by the IP
>>- description: sys clock, used by the IP
>> +  - description: apb clock, used by the IP
>> +  - description: txesc clock, used by the IP
>>  
>>clock-names:
>> +minItems: 2
>>  items:
>>- const: dsi_p_clk
>>- const: dsi_sys_clk
>> +  - const: apb
>> +  - const: txesc
>>  
>>phys:
>>  maxItems: 1
>> @@ -46,10 +53,21 @@ properties:
>>  maxItems: 1
>>  
>>resets:
>> -maxItems: 1
>> +minItems: 1
>> +items:
>> +  - description: dsi sys reset line
>> +  - description: dsi dpi reset line
>> +  - description: dsi apb reset line
>> +  - description: dsi txesc reset line
>> +  - description: dsi txbytehs reset line
>>  
>>reset-names:
>> -const: dsi_p_rst
>> +items:
>> +  - const: dsi_p_rst
>> +  - const: dsi_dpi
>> +  - const: dsi_apb
>> +  - const: dsi_txesc
>> +  - const: dsi_txbytehs
>>  
>>ports:
>>  $ref: /schemas/graph.yaml#/properties/ports
>> @@ -90,6 +108,22 @@ allOf:
>>  reg:
>>maxItems: 1
>>  
> 
> You need to restrict other variants, because you just relaxed several
> properties for everyone...
> 
> 

ok, will fix it

> Best regards,
> Krzysztof
> 

thanks.

Best Regards,
Shengyang


Re: [PATCH v1 1/2] dt-bindings: display: panel: raspberrypi: Add compatible property for waveshare 7inch touchscreen panel

2023-12-06 Thread Shengyang Chen
Hi, Conor

thanks for comment

On 2023/12/6 23:40, Conor Dooley wrote:
> On Wed, Dec 06, 2023 at 05:43:48PM +0800, Shengyang Chen wrote:
>> Hi, Conor
>> 
>> On 2023/11/24 20:31, Conor Dooley wrote:
>> > On Fri, Nov 24, 2023 at 06:44:50PM +0800, Shengyang Chen wrote:
>> >> The waveshare 7inch touchscreen panel is a kind of raspberrypi pi
>> >> panel
>> > 
>> > Can you be more specific about what "is a kind of rpi panel" means?
>> > Are they using identical chips as controllers or something like that?
>> > 
>> 
>> Wareshare panel has same i2c slave address and registers address with 
>> the original raspberry pi panel. They both use Atmel firmware and they
>> got same reg id. It can be operated by using the driver of raspberry pi 
>> driver
>> after some change of the code. So I suppose it may be a kind of raspberry pi 
>> panel 
>> and discribe it in this way. It's my own judgement. Sorry about that.
>> Maybe just like Dave said, It cloned the behaviour of the raspberri pi panel.
>> I will change the discribtion in next version to not make other confused.
>> 
>> By the way, we will try Stefan's method before next version. 
>> The method we used in this patch may be abandoned if Stefan's method is 
>> verified in our platform.
>> At that time yaml may also be changed to fit new method.
> 
> I don't know what Stefan's approach is, but I do not think that a
> bindings patch should be dropped. The waveshare might be a clone, but it
> is a distinct device. If the same driver can control both, then the
> compatible setups that should be permitted are:
> compatible = "raspberrypi,7inch-touchscreen-panel";
> and
> compatible = "waveshare,7inch-touchscreen-panel", 
> "raspberrypi,7inch-touchscreen-panel";
> 
> Cheers,
> Conor.
> 

Here is our consideration of this submit:

Although Waveshare panel reuse the driver of raspberry pi panel, they are 
different in probing process
and panel parameters.
we try to use compatible and data to distinguish these two panel

Here are the reference
driver part:
https://elixir.bootlin.com/linux/v6.7-rc3/source/drivers/gpu/drm/panel/panel-simple.c
dt-binding part:
https://elixir.bootlin.com/linux/v6.7-rc3/source/Documentation/devicetree/bindings/display/panel/panel-simple.yaml


For example:

in driver part:

in drivers/gpu/drm/panel/panel-simple.c:#in line 4189
--
we can got different compatible with its own data.

static const struct of_device_id platform_of_match[] = {
//the of_match array list
{
.compatible = "ampire,am-1280800n3tzqw-t00h",
.data = &ire_am_1280800n3tzqw_t00h,  //we define our 
panel parameter or special panel function, which can distinguish different 
panels
}, {
.compatible = "ampire,am-480272h3tmqw-t01h",
.data = &ire_am_480272h3tmqw_t01h,
}, 
...
...
}
===

in drivers/gpu/drm/panel/panel-simple.c:#in line 4611
--
we can use the generic probing process to probe our driver
after getting its own data.

static int panel_simple_platform_probe(struct platform_device *pdev)
{
const struct panel_desc *desc;

desc = of_device_get_match_data(&pdev->dev);//we 
get our panel parameter
if (!desc)
return -ENODEV;

return panel_simple_probe(&pdev->dev, desc);//probe 
with returned data
}





in yamel part:

in /Documentation/devicetree/bindings/display/panel/panel-simple.yaml#in line 33
--
We refer to this approach, adding our compatible to the yaml of raspberry pi 
panel


properties:
  compatible:
enum:
# compatible must be listed in alphabetical order, ordered by compatible.
# The description in the comment is mandatory for each compatible.

# Ampire AM-1280800N3TZQW-T00H 10.1" WQVGA TFT LCD panel
  - ampire,am-1280800n3tzqw-t00h
# Ampire AM-480272H3TMQW-T01H 4.3" WQVGA TFT LCD panel
  - ampire,am-480272h3tmqw-t01h




If we use Stenfan's method, we can reuse the code of panel-simple.c
we may submit our patch to
/Documentation/devicetree/bindings/display/panel/panel-simple.

Re: [PATCH v1 0/2] Add waveshare 7inch touchscreen panel support

2023-12-06 Thread Shengyang Chen
Hi, Stefan

Thanks for your comment and review

On 2023/11/24 22:54, Stefan Wahren wrote:
> Hi Shengyang,
> 
> [fix address of Emma]
> 
> Am 24.11.23 um 11:44 schrieb Shengyang Chen:
>> This patchset adds waveshare 7inch touchscreen panel support
>> for the StarFive JH7110 SoC.
>>
>> Patch 1 add new compatible for the raspberrypi panel driver and its 
>> dt-binding.
>> Patch 2 add new display mode and new probing process for raspberrypi panel 
>> driver.
>>
>> Waveshare 7inch touchscreen panel is a kind of raspberrypi panel
>> which can be drived by raspberrypi panel driver.
>>
>> The series has been tested on the VisionFive 2 board.
> surprisingly i was recently working on the official Raspberry Pi
> touchscreen and was able to get it running the new way.
> 
> What do i mean with the new way. There is almost nothing special to the
> Raspberry Pi touchscreen, so we should try to use/extend existing
> components like:
> 
> CONFIG_DRM_PANEL_SIMPLE
> CONFIG_TOUCHSCREEN_EDT_FT5X06
> CONFIG_DRM_TOSHIBA_TC358762
> 
> The only special part is the Attiny on the connector PCB which requires:
> 
> CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY
> 
> So the whole point is to avoid writing monolitic drivers for simple
> panel like that.
> 
> There is a WIP branch based on top of Linux 6.7-rcX, which should
> demonstrate this approach [1]. Unfortunately it is not ready for
> upstreaming, but it has been tested on a Raspberry Pi 3 B Plus. Maybe
> this is helpful for your case.
> 
> Actually i consider panel-raspberrypi-touchscreen.c as a dead end, which
> shouldn't be extended.
> 
> Btw there are already DT overlays in mainline which seems to use the
> Raspberry Pi 7inch panel (without touch function yet) [2].
> 
> [1] - https://github.com/lategoodbye/rpi-zero/commits/v6.7-7inch-ts
> [2] -
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-rpidsi.dtso?h=v6.6.2&id=6b4da1354fd81adace0cda448c77d8f2a47d8474
> 

Thank you very much for your advice. We will try this method before making new 
patch.
This method will be used if its verified in our soc.
If there is any problem, we may continue to contact. Thanks a lot.

>>
>> Shengyang Chen (2):
>>    dt-bindings: display: panel: raspberrypi: Add compatible property for
>>  waveshare 7inch touchscreen panel
>>    gpu: drm: panel: raspberrypi: add new display mode and new probing
>>  process
>>
>>   .../panel/raspberrypi,7inch-touchscreen.yaml  |  4 +-
>>   .../drm/panel/panel-raspberrypi-touchscreen.c | 99 ---
>>   2 files changed, 91 insertions(+), 12 deletions(-)
>>
> 


thanks

Best Regards,
Shengyang


Re: [PATCH v1 1/2] dt-bindings: display: panel: raspberrypi: Add compatible property for waveshare 7inch touchscreen panel

2023-12-06 Thread Shengyang Chen
Hi, Conor

On 2023/11/24 20:31, Conor Dooley wrote:
> On Fri, Nov 24, 2023 at 06:44:50PM +0800, Shengyang Chen wrote:
>> The waveshare 7inch touchscreen panel is a kind of raspberrypi pi
>> panel
> 
> Can you be more specific about what "is a kind of rpi panel" means?
> Are they using identical chips as controllers or something like that?
> 

Wareshare panel has same i2c slave address and registers address with 
the original raspberry pi panel. They both use Atmel firmware and they
got same reg id. It can be operated by using the driver of raspberry pi driver
after some change of the code. So I suppose it may be a kind of raspberry pi 
panel 
and discribe it in this way. It's my own judgement. Sorry about that.
Maybe just like Dave said, It cloned the behaviour of the raspberri pi panel.
I will change the discribtion in next version to not make other confused.

By the way, we will try Stefan's method before next version. 
The method we used in this patch may be abandoned if Stefan's method is 
verified in our platform.
At that time yaml may also be changed to fit new method.


>> and it can be drived by panel-raspberrypi-touchscreen.c.
>> Add compatible property for it.
>> 
>> Signed-off-by: Keith Zhao 
>> Signed-off-by: Shengyang Chen 
>> ---
>>  .../bindings/display/panel/raspberrypi,7inch-touchscreen.yaml | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
>>  
>> b/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
>> index 22a083f7bc8e..e4e6cb4d4e5b 100644
>> --- 
>> a/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
>> +++ 
>> b/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
>> @@ -22,7 +22,9 @@ description: |+
>>  
>>  properties:
>>compatible:
>> -const: raspberrypi,7inch-touchscreen-panel
>> +enum:
>> +  - raspberrypi,7inch-touchscreen-panel
>> +  - waveshare,7inch-touchscreen-panel
>>  
>>reg:
>>  const: 0x45
>> -- 
>> 2.17.1
>> 


thanks.

Best Regards,
Shengyang



[PATCH v1 2/2] gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive JH7110 SoC

2023-11-27 Thread Shengyang Chen
From: Keith Zhao 

In order to fit CDNS DSI module in StarFive JH7110 SoC,
The mainly modification is followed:

1.Add driver for StarFive JH7110 SoC to drive its CDNS DSI module.
2.Add platform ops in cdns-dsi.c for StarFive JH7110 SoC probing.

Signed-off-by: Keith Zhao 
---
 MAINTAINERS   |   8 +
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  28 +-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  19 +
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 386 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  | 186 +
 7 files changed, 634 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

diff --git a/MAINTAINERS b/MAINTAINERS
index ea790149af79..e3c8e81c7656 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6868,6 +6868,14 @@ F:   
Documentation/devicetree/bindings/display/solomon,ssd-common.yaml
 F: Documentation/devicetree/bindings/display/solomon,ssd13*.yaml
 F: drivers/gpu/drm/solomon/ssd130x*
 
+DRM DRIVERS FOR STARFIVE
+M: Keith Zhao 
+M: Shengyang Chen 
+L: dri-devel@lists.freedesktop.org
+S: Maintained
+T: git git://anongit.freedesktop.org/drm/drm-misc
+F: drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110*
+
 DRM DRIVER FOR ST-ERICSSON MCDE
 M: Linus Walleij 
 S: Maintained
diff --git a/drivers/gpu/drm/bridge/cadence/Kconfig 
b/drivers/gpu/drm/bridge/cadence/Kconfig
index cced81633ddc..ad9f572f4720 100644
--- a/drivers/gpu/drm/bridge/cadence/Kconfig
+++ b/drivers/gpu/drm/bridge/cadence/Kconfig
@@ -19,6 +19,13 @@ config DRM_CDNS_DSI_J721E
help
  Support J721E Cadence DSI wrapper. The wrapper manages
  the routing of the DSS DPI signal to the Cadence DSI.
+
+config DRM_CDNS_DSI_JH7110
+   bool "JH7110 SOC Cadence DSI support"
+   default n
+   help
+ Cadence DPI to DSI bridge which is embedded in the
+ StarFive JH7110 SoC.
 endif
 
 config DRM_CDNS_MHDP8546
diff --git a/drivers/gpu/drm/bridge/cadence/Makefile 
b/drivers/gpu/drm/bridge/cadence/Makefile
index c95fd5b81d13..87f603a9f4ad 100644
--- a/drivers/gpu/drm/bridge/cadence/Makefile
+++ b/drivers/gpu/drm/bridge/cadence/Makefile
@@ -2,6 +2,7 @@
 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
 cdns-dsi-y := cdns-dsi-core.o
 cdns-dsi-$(CONFIG_DRM_CDNS_DSI_J721E) += cdns-dsi-j721e.o
+cdns-dsi-$(CONFIG_DRM_CDNS_DSI_JH7110) += cdns-dsi-jh7110.o
 obj-$(CONFIG_DRM_CDNS_MHDP8546) += cdns-mhdp8546.o
 cdns-mhdp8546-y := cdns-mhdp8546-core.o cdns-mhdp8546-hdcp.o
 cdns-mhdp8546-$(CONFIG_DRM_CDNS_MHDP8546_J721E) += cdns-mhdp8546-j721e.o
diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c 
b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 7457d38622b0..114385890dd1 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -27,6 +27,10 @@
 #include "cdns-dsi-j721e.h"
 #endif
 
+#ifdef CONFIG_DRM_CDNS_DSI_JH7110
+#include "cdns-dsi-jh7110.h"
+#endif
+
 #define IP_CONF0x0
 #define SP_HS_FIFO_DEPTH(x)(((x) & GENMASK(30, 26)) >> 26)
 #define SP_LP_FIFO_DEPTH(x)(((x) & GENMASK(25, 21)) >> 21)
@@ -586,6 +590,9 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,
if (ret)
return ret;
 
+   if (dsi->platform_ops && dsi->platform_ops->update)
+   dsi->platform_ops->update(dsi, dsi_cfg, mode);
+
dsi_hss_hsa_hse_hbp = dsi_cfg->hbp + DSI_HBP_FRAME_OVERHEAD;
if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE)
dsi_hss_hsa_hse_hbp += dsi_cfg->hsa + DSI_HSA_FRAME_OVERHEAD;
@@ -683,7 +690,7 @@ static void cdns_dsi_bridge_post_disable(struct drm_bridge 
*bridge)
pm_runtime_put(dsi->base.dev);
 }
 
-static void cdns_dsi_hs_init(struct cdns_dsi *dsi)
+void cdns_dsi_hs_init(struct cdns_dsi *dsi)
 {
struct cdns_dsi_output *output = &dsi->output;
u32 status;
@@ -1026,6 +1033,14 @@ static ssize_t cdns_dsi_transfer(struct mipi_dsi_host 
*host,
 
cdns_dsi_init_link(dsi);
 
+   /*
+* on Jh7110 soc , when transfer dsi command ,
+* cdns_dsi_hs_init is needed.
+* or the final ret will be error value.
+*/
+   if (dsi->platform_ops && dsi->platform_ops->transfer)
+   dsi->platform_ops->transfer(dsi);
+
ret = mipi_dsi_create_packet(&packet, msg);
if (ret)
goto out;
@@ -1142,6 +1157,9 @@ static int __maybe_unused cdns_dsi_resume(struct device 
*dev)
clk_prepare_enable(dsi->dsi_p_clk);
clk_prepare_enable(dsi->dsi_sys_clk);
 
+   if (dsi->platform_ops &

[PATCH v1 0/2] Add StarFive JH7110 SoC DSI support

2023-11-27 Thread Shengyang Chen
This series is the v1 series that attempts to support
the CDNS DSI driver used to converts DPI to DSI.
CDNS DSI is embedded in StarFive JH7110 SoC.
The series has been tested on the VisionFive 2 board.

Keith Zhao (2):
  dt-bindings: display: bridge: cdns: Add properties to support StarFive
JH7110 SoC
  gpu: drm: bridge: cadence: Add a driver and platform ops for StarFive
JH7110 SoC

 .../bindings/display/bridge/cdns,dsi.yaml |  38 +-
 MAINTAINERS   |   8 +
 drivers/gpu/drm/bridge/cadence/Kconfig|   7 +
 drivers/gpu/drm/bridge/cadence/Makefile   |   1 +
 .../gpu/drm/bridge/cadence/cdns-dsi-core.c|  28 +-
 .../gpu/drm/bridge/cadence/cdns-dsi-core.h|  19 +
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.c  | 386 ++
 .../gpu/drm/bridge/cadence/cdns-dsi-jh7110.h  | 186 +
 8 files changed, 670 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.c
 create mode 100644 drivers/gpu/drm/bridge/cadence/cdns-dsi-jh7110.h

-- 
2.17.1



[PATCH v1 1/2] dt-bindings: display: bridge: cdns: Add properties to support StarFive JH7110 SoC

2023-11-27 Thread Shengyang Chen
From: Keith Zhao 

Add properties in CDNS DSI yaml file to match with
CDNS DSI module in StarFive JH7110 SoC.

Signed-off-by: Keith Zhao 
---
 .../bindings/display/bridge/cdns,dsi.yaml | 38 ++-
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml 
b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
index 23060324d16e..3f02ee383aad 100644
--- a/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
+++ b/Documentation/devicetree/bindings/display/bridge/cdns,dsi.yaml
@@ -17,6 +17,7 @@ properties:
 enum:
   - cdns,dsi
   - ti,j721e-dsi
+  - starfive,cdns-dsi
 
   reg:
 minItems: 1
@@ -27,14 +28,20 @@ properties:
   Register block for wrapper settings registers in case of TI J7 SoCs.
 
   clocks:
+minItems: 2
 items:
   - description: PSM clock, used by the IP
   - description: sys clock, used by the IP
+  - description: apb clock, used by the IP
+  - description: txesc clock, used by the IP
 
   clock-names:
+minItems: 2
 items:
   - const: dsi_p_clk
   - const: dsi_sys_clk
+  - const: apb
+  - const: txesc
 
   phys:
 maxItems: 1
@@ -46,10 +53,21 @@ properties:
 maxItems: 1
 
   resets:
-maxItems: 1
+minItems: 1
+items:
+  - description: dsi sys reset line
+  - description: dsi dpi reset line
+  - description: dsi apb reset line
+  - description: dsi txesc reset line
+  - description: dsi txbytehs reset line
 
   reset-names:
-const: dsi_p_rst
+items:
+  - const: dsi_p_rst
+  - const: dsi_dpi
+  - const: dsi_apb
+  - const: dsi_txesc
+  - const: dsi_txbytehs
 
   ports:
 $ref: /schemas/graph.yaml#/properties/ports
@@ -90,6 +108,22 @@ allOf:
 reg:
   maxItems: 1
 
+  - if:
+  properties:
+compatible:
+  contains:
+const: starfive,cdns-dsi
+then:
+  properties:
+clocks:
+  minItems: 4
+  maxItems: 4
+resets:
+  minItems: 5
+  maxItems: 5
+  required:
+- reset-names
+
 required:
   - compatible
   - reg
-- 
2.17.1



[PATCH v1 1/2] dt-bindings: display: panel: raspberrypi: Add compatible property for waveshare 7inch touchscreen panel

2023-11-24 Thread Shengyang Chen
The waveshare 7inch touchscreen panel is a kind of raspberrypi pi
panel and it can be drived by panel-raspberrypi-touchscreen.c.
Add compatible property for it.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 .../bindings/display/panel/raspberrypi,7inch-touchscreen.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
 
b/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
index 22a083f7bc8e..e4e6cb4d4e5b 100644
--- 
a/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
+++ 
b/Documentation/devicetree/bindings/display/panel/raspberrypi,7inch-touchscreen.yaml
@@ -22,7 +22,9 @@ description: |+
 
 properties:
   compatible:
-const: raspberrypi,7inch-touchscreen-panel
+enum:
+  - raspberrypi,7inch-touchscreen-panel
+  - waveshare,7inch-touchscreen-panel
 
   reg:
 const: 0x45
-- 
2.17.1



[PATCH v1 0/2] Add waveshare 7inch touchscreen panel support

2023-11-24 Thread Shengyang Chen
This patchset adds waveshare 7inch touchscreen panel support
for the StarFive JH7110 SoC.

Patch 1 add new compatible for the raspberrypi panel driver and its dt-binding.
Patch 2 add new display mode and new probing process for raspberrypi panel 
driver.

Waveshare 7inch touchscreen panel is a kind of raspberrypi panel
which can be drived by raspberrypi panel driver.

The series has been tested on the VisionFive 2 board.

Shengyang Chen (2):
  dt-bindings: display: panel: raspberrypi: Add compatible property for
waveshare 7inch touchscreen panel
  gpu: drm: panel: raspberrypi: add new display mode and new probing
process

 .../panel/raspberrypi,7inch-touchscreen.yaml  |  4 +-
 .../drm/panel/panel-raspberrypi-touchscreen.c | 99 ---
 2 files changed, 91 insertions(+), 12 deletions(-)

-- 
2.17.1



[PATCH v1 2/2] gpu: drm: panel: raspberrypi: add new display mode and new probing process

2023-11-24 Thread Shengyang Chen
The waveshare 7inch touchscreen panel is a kind of raspberrypi
pi panel and it can be drived by panel-raspberrypi-touchscreen.c.
Add new display mode for it.

In order to fit CDNS DSI driver which used by StarFive SoCs like JH7110,
add new probing process for it. The compatible is used to distinguishing.

Signed-off-by: Keith Zhao 
Signed-off-by: Shengyang Chen 
---
 .../drm/panel/panel-raspberrypi-touchscreen.c | 99 ---
 1 file changed, 88 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c 
b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 4618c892cdd6..4478f1568205 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -194,6 +194,13 @@ struct rpi_touchscreen {
struct i2c_client *i2c;
 };
 
+struct touchscreen_info {
+   const struct drm_display_mode *display_mode;
+   u32 display_mode_size;
+   int (*touchscreen_post_probe)(struct rpi_touchscreen *ts, struct 
mipi_dsi_host *host,
+ struct mipi_dsi_device_info *info);
+};
+
 static const struct drm_display_mode rpi_touchscreen_modes[] = {
{
/* Modeline comes from the Raspberry Pi firmware, with HFP=1
@@ -211,6 +218,20 @@ static const struct drm_display_mode 
rpi_touchscreen_modes[] = {
},
 };
 
+static const struct drm_display_mode ws_touchscreen_modes[] = {
+   {
+   .clock = 2970 / 1000,
+   .hdisplay = 800,
+   .hsync_start = 800 + 90,
+   .hsync_end = 800 + 90 + 5,
+   .htotal = 800 + 90 + 5 + 5,
+   .vdisplay = 480,
+   .vsync_start = 480 + 60,
+   .vsync_end = 480 + 60 + 5,
+   .vtotal = 480 + 60 + 5 + 5,
+   },
+};
+
 static struct rpi_touchscreen *panel_to_ts(struct drm_panel *panel)
 {
return container_of(panel, struct rpi_touchscreen, base);
@@ -319,9 +340,13 @@ static int rpi_touchscreen_get_modes(struct drm_panel 
*panel,
 {
unsigned int i, num = 0;
static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;
+   const struct touchscreen_info *screen_info;
+
+   screen_info = of_device_get_match_data(panel->dev);
+
+   for (i = 0; i < screen_info->display_mode_size; i++) {
+   const struct drm_display_mode *m = 
&screen_info->display_mode[i];
 
-   for (i = 0; i < ARRAY_SIZE(rpi_touchscreen_modes); i++) {
-   const struct drm_display_mode *m = &rpi_touchscreen_modes[i];
struct drm_display_mode *mode;
 
mode = drm_mode_duplicate(connector->dev, m);
@@ -360,12 +385,13 @@ static const struct drm_panel_funcs rpi_touchscreen_funcs 
= {
.get_modes = rpi_touchscreen_get_modes,
 };
 
-static int rpi_touchscreen_probe(struct i2c_client *i2c)
+static int touchscreen_probe(struct i2c_client *i2c)
 {
struct device *dev = &i2c->dev;
struct rpi_touchscreen *ts;
struct device_node *endpoint, *dsi_host_node;
struct mipi_dsi_host *host;
+   const struct touchscreen_info *screen_info;
int ver;
struct mipi_dsi_device_info info = {
.type = RPI_DSI_DRIVER_NAME,
@@ -421,14 +447,29 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c)
 
of_node_put(endpoint);
 
-   ts->dsi = mipi_dsi_device_register_full(host, &info);
+   screen_info = of_device_get_match_data(&i2c->dev);
+   if (!screen_info->touchscreen_post_probe)
+   return -ENODEV;
+
+   return screen_info->touchscreen_post_probe(ts, host, &info);
+
+error:
+   of_node_put(endpoint);
+
+   return -ENODEV;
+}
+
+static int rpi_touchscreen_probe(struct rpi_touchscreen *ts, struct 
mipi_dsi_host *host,
+struct mipi_dsi_device_info *info)
+{
+   ts->dsi = mipi_dsi_device_register_full(host, info);
if (IS_ERR(ts->dsi)) {
-   dev_err(dev, "DSI device registration failed: %ld\n",
+   dev_err(&ts->i2c->dev, "DSI device registration failed: %ld\n",
PTR_ERR(ts->dsi));
return PTR_ERR(ts->dsi);
}
 
-   drm_panel_init(&ts->base, dev, &rpi_touchscreen_funcs,
+   drm_panel_init(&ts->base, &ts->i2c->dev, &rpi_touchscreen_funcs,
   DRM_MODE_CONNECTOR_DSI);
 
/* This appears last, as it's what will unblock the DSI host
@@ -437,10 +478,33 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c)
drm_panel_add(&ts->base);
 
return 0;
+}
 
-error:
-   of_node_put(endpoint);
-   return -ENODEV;
+static int ws_touchscreen_probe(struct rpi_touchscreen *ts, struct 
mipi_dsi_host *host,
+   struct mipi_dsi_devi