drm/msm/dsi: support CPHY mode for 7nm pll/phy
Subsystems (6)
v3 cover drm/msm/dsi: support CPHY mode for 7nm pll/phy
Add the required changes to support 7nm pll/phy in CPHY mode.
This adds a "qcom,dsi-phy-cphy-mode" property for the PHY node to enable the CPHY mode.
v2:
- rebased on DSI PHY reworks
- reworked getting cphy_mode in dsi_host.c
- documentation change in separate patch
v3:
- yaml bindings
- changed binding to "phy-mode = <PHY_TYPE_DSI_CPHY>;"
Jonathan Marek (3):
dt-bindings: msm: dsi: add missing 7nm bindings
dt-bindings: msm: dsi: document phy-type property for 7nm dsi phy drm/msm/dsi: support CPHY mode for 7nm pll/phy
.../bindings/display/msm/dsi-phy-7nm.yaml | 70 +++++++++ drivers/gpu/drm/msm/dsi/dsi.xml.h | 2 + drivers/gpu/drm/msm/dsi/dsi_host.c | 34 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 49 ++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy.h | 3 + drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 145 ++++++++++++------ include/dt-bindings/phy/phy.h | 2 + 7 files changed, 258 insertions(+), 47 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
Signature · 1 line
2.26.1
PATCH v3 1/3 dt-bindings: msm: dsi: add missing 7nm bindings
These got lost when going from .txt to .yaml bindings, add them back.
--- .../bindings/display/msm/dsi-phy-7nm.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml new file +66 -0
@@ -0,0 +1,66 @@ +# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/msm/dsi-phy-7nm.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Display DSI 7nm PHY + +maintainers: + - Jonathan Marek <[email protected]> + +allOf: + - $ref: dsi-phy-common.yaml# + +properties: + compatible: + oneOf: + - const: qcom,dsi-phy-7nm + - const: qcom,dsi-phy-7nm-8150 + + reg: + items: + - description: dsi phy register set + - description: dsi phy lane register set + - description: dsi pll register set + + reg-names: + items: + - const: dsi_phy + - const: dsi_phy_lane + - const: dsi_pll + + vdds-supply: + description: | + Connected to VDD_A_DSI_PLL_0P9 pin (or VDDA_DSI{0,1}_PLL_0P9 for sm8150) + +required: + - compatible + - reg + - reg-names + - vdds-supply + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,dispcc-sm8250.h> + #include <dt-bindings/clock/qcom,rpmh.h> + + dsi-phy@ae94400 { + compatible = "qcom,dsi-phy-7nm"; + reg = <0x0ae94400 0x200>, + <0x0ae94600 0x280>, + <0x0ae94900 0x260>;; + reg-names = "dsi_phy", + "dsi_phy_lane", + "dsi_pll"; + + #clock-cells = <1>; + #phy-cells = <0>; + + vdds-supply = <&vreg_l5a_0p88>; + clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>, + <&rpmhcc RPMH_CXO_CLK>; + clock-names = "iface", "ref"; + };
Signature · 1 line
2.26.1
Rob Herring
maintainerRe: [PATCH v3 1/3] dt-bindings: msm: dsi: add missing 7nm bindings
Quoted 8 lines · Jonathan Marek
These got lost when going from .txt to .yaml bindings, add them back.
Signed-off-by Jonathan Marek <[email protected]>--- .../bindings/display/msm/dsi-phy-7nm.yaml | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Unknown file referenced: [Errno 2] No such file or directory: '/usr/local/lib/python3.8/dist-packages/dtschema/schemas/display/msm/dsi-phy-common.yaml'
xargs: dt-doc-validate: exited with status 255; aborting
Error: Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.example.dts:26.38-39 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:380: Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1416: dt_binding_check] Error 2
\ndoc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/1489620
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
PATCH v3 2/3 dt-bindings: msm: dsi: document phy-type property for 7nm dsi phy
In reply to Jonathan MarekDocument a new phy-type property which will be used to determine whether the phy should operate in D-PHY or C-PHY mode.
--- .../devicetree/bindings/display/msm/dsi-phy-7nm.yaml | 4 ++++ include/dt-bindings/phy/phy.h | 2 ++ 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +4 -0
@@ -34,6 +34,10 @@ properties: description: | Connected to VDD_A_DSI_PLL_0P9 pin (or VDDA_DSI{0,1}_PLL_0P9 for sm8150) + phy-type: + description: | + D-PHY (default) or C-PHY mode: PHY_TYPE_DSI_DPHY or PHY_TYPE_DSI_CPHY + required: - compatible - reg
include/dt-bindings/phy/phy.h +2 -0
@@ -20,5 +20,7 @@#define PHY_TYPE_XPCS 7#define PHY_TYPE_SGMII 8#define PHY_TYPE_QSGMII 9 +#define PHY_TYPE_DSI_DPHY 10 +#define PHY_TYPE_DSI_CPHY 11#endif /* _DT_BINDINGS_PHY */
Signature · 1 line
2.26.1
Re: [PATCH v3 2/3] dt-bindings: msm: dsi: document phy-type property for 7nm dsi phy
Hi Jonathan,
Thank you for the patch.
Quoted 29 lines · Jonathan Marek
Document a new phy-type property which will be used to determine whether the phy should operate in D-PHY or C-PHY mode.
Signed-off-by Jonathan Marek <[email protected]>--- .../devicetree/bindings/display/msm/dsi-phy-7nm.yaml | 4 ++++ include/dt-bindings/phy/phy.h | 2 ++ 2 files changed, 6 insertions(+)Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +4
-0@@ -34,6 +34,10 @@ properties: description: | Connected to VDD_A_DSI_PLL_0P9 pin (or VDDA_DSI{0,1}_PLL_0P9 for sm8150) + phy-type: + description: | + D-PHY (default) or C-PHY mode: PHY_TYPE_DSI_DPHY or PHY_TYPE_DSI_CPHY + required: - compatible - reginclude/dt-bindings/phy/phy.h +0
-0
include/dt-bindings/phy/phy.h line 24
Quoted 5 lines
include/dt-bindings/phy/phy.h +2
-0@@ -20,5 +20,7 @@#define PHY_TYPE_XPCS 7#define PHY_TYPE_SGMII 8#define PHY_TYPE_QSGMII 9 +#define PHY_TYPE_DSI_DPHY 10 +#define PHY_TYPE_DSI_CPHY 11
The MIPI D-PHY and C-PHY apply to both DSI and CSI. I'd name this PHY_TYPE_DPHY and PHY_TYPE_CPHY, or possibly, PHY_TYPE_MIPI_DPHY and PHY_TYPE_MIPI_CPHY, without a DSI prefix. With this addressed and the DT bindings updated accordingly,
(You may be asked to split this in two patches though, not sure)
Quoted 1 line
include/dt-bindings/phy/phy.h +0
-0#endif /* _DT_BINDINGS_PHY */
Signature · 3 lines
Regards, Laurent Pinchart
Rob Herring
maintainerRe: [PATCH v3 2/3] dt-bindings: msm: dsi: document phy-type property for 7nm dsi phy
In reply to Jonathan MarekQuoted 14 lines · Jonathan Marek
Document a new phy-type property which will be used to determine whether the phy should operate in D-PHY or C-PHY mode.
Signed-off-by Jonathan Marek <[email protected]>--- .../devicetree/bindings/display/msm/dsi-phy-7nm.yaml | 4 ++++ include/dt-bindings/phy/phy.h | 2 ++ 2 files changed, 6 insertions(+)Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +0
-0
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml properties: · line 39
Quoted 6 lines
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +3
-0@@ -34,6 +34,10 @@ properties: description: | Connected to VDD_A_DSI_PLL_0P9 pin (or VDDA_DSI{0,1}_PLL_0P9 for sm8150) + phy-type: + description: | + D-PHY (default) or C-PHY mode: PHY_TYPE_DSI_DPHY or PHY_TYPE_DSI_CPHY
Don't write prose for what can be schema. Unfortunately, can't do defines here, but you need:
enum: [ 10, 11 ]
default: 10
Quoted 18 lines
Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml +1
-0+ required: - compatible - reginclude/dt-bindings/phy/phy.h +2
-0@@ -20,5 +20,7 @@#define PHY_TYPE_XPCS 7#define PHY_TYPE_SGMII 8#define PHY_TYPE_QSGMII 9 +#define PHY_TYPE_DSI_DPHY 10 +#define PHY_TYPE_DSI_CPHY 11#endif /* _DT_BINDINGS_PHY */ Signature · 1 line
2.26.1
PATCH v3 3/3 drm/msm/dsi: support CPHY mode for 7nm pll/phy
In reply to Jonathan MarekAdd the required changes to support 7nm pll/phy in CPHY mode.
This adds a "qcom,dsi-phy-cphy-mode" property for the PHY node to enable the CPHY mode.
--- drivers/gpu/drm/msm/dsi/dsi.xml.h | 2 + drivers/gpu/drm/msm/dsi/dsi_host.c | 34 ++++- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 49 ++++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy.h | 3 + drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 145 +++++++++++++++------- 5 files changed, 186 insertions(+), 47 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.xml.h +2 -0
@@ -621,6 +621,8 @@ static inline uint32_t DSI_VERSION_MAJOR(uint32_t val)return ((val) <<DSI_VERSION_MAJOR__SHIFT ) &DSI_VERSION_MAJOR__MASK ; } +#define REG_DSI_CPHY_MODE_CTRL 0x000002d4 +#define REG_DSI_PHY_PLL_CTRL_0 0x00000200#define DSI_PHY_PLL_CTRL_0_ENABLE 0x00000001
drivers/gpu/drm/msm/dsi/dsi_host.c +30 -4
@@ -27,6 +27,7 @@#include "dsi_cfg.h" #include "msm_kms.h" #include "msm_gem.h" +#include "phy/dsi_phy.h" #define DSI_RESET_TOGGLE_DELAY_MS 20
@@ -170,6 +171,9 @@ struct msm_dsi_host {int dlane_swap;int num_data_lanes; +/* from phy DT */ +bool cphy_mode; +u32 dma_cmd_ctrl_restore;bool registered;
@@ -513,6 +517,7 @@ int msm_dsi_runtime_resume(struct device *dev)int dsi_link_clk_set_rate_6g (struct msm_dsi_host *msm_host) { +u32 byte_intf_rate;int ret; DBG("Set clk rates: pclk=%d, byteclk=%d",
@@ -532,8 +537,13 @@ int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host) }if (msm_host->byte_intf_clk) { - ret =clk_set_rate (msm_host->byte_intf_clk, - msm_host->byte_clk_rate /2 ); +/* For CPHY, byte_intf_clk is same as byte_clk */ +if (msm_host->cphy_mode) + byte_intf_rate = msm_host->byte_clk_rate; +else + byte_intf_rate = msm_host->byte_clk_rate /2 ; + + ret =clk_set_rate (msm_host->byte_intf_clk, byte_intf_rate);if (ret) {pr_err ("%s: Failed to set rate byte intf clk, %d\n" , __func__, ret);
@@ -721,7 +731,11 @@ static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_dual_dsi) lanes =1 ; } -do_div (pclk_bpp, (8 * lanes)); +/* CPHY "byte_clk" is in units of 16 bits */ +if (msm_host->cphy_mode) +do_div (pclk_bpp, (16 * lanes)); +else +do_div (pclk_bpp, (8 * lanes)); msm_host->pixel_clk_rate = pclk_rate; msm_host->byte_clk_rate = pclk_bpp;
@@ -947,6 +961,9 @@ static void dsi_ctrl_config(struct msm_dsi_host *msm_host, bool enable, data |=DSI_CTRL_ENABLE ;dsi_write (msm_host,REG_DSI_CTRL , data); + +if (msm_host->cphy_mode) +dsi_write (msm_host,REG_DSI_CPHY_MODE_CTRL ,BIT (0 )); } static void dsi_set_video_dsc(struct msm_dsi_host *msm_host,
@@ -2278,6 +2295,8 @@ int msm_dsi_host_set_src_pll(struct mipi_dsi_host *host,struct clk *byte_clk_provider, *pixel_clk_provider;int ret; + msm_host->cphy_mode = src_phy->cphy_mode; + ret =msm_dsi_phy_get_clk_provider (src_phy, &byte_clk_provider, &pixel_clk_provider);if (ret) {
@@ -2349,7 +2368,14 @@ void msm_dsi_host_get_phy_clk_req(struct mipi_dsi_host *host,return ; } - clk_req->bitclk_rate = msm_host->byte_clk_rate *8 ; +/* CPHY transmits 16 bits over 7 clock cycles +* "byte_clk" is in units of 16-bits (see dsi_calc_pclk), +* so multiply by 7 to get the "bitclk rate" +*/ +if (msm_host->cphy_mode) + clk_req->bitclk_rate = msm_host->byte_clk_rate *7 ; +else + clk_req->bitclk_rate = msm_host->byte_clk_rate *8 ; clk_req->escclk_rate = msm_host->esc_clk_rate; }
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +49 -0
73 lines not on this page · raw message
drivers/gpu/drm/msm/dsi/phy/dsi_phy.h +3 -0
@@ -99,6 +99,7 @@ struct msm_dsi_phy {enum msm_dsi_phy_usecase usecase;bool regulator_ldo_mode; +bool cphy_mode;struct clk_hw *vco_hw;bool pll_on;
@@ -119,5 +120,7 @@ int msm_dsi_dphy_timing_calc_v3(struct msm_dsi_dphy_timing *timing, struct msm_dsi_phy_clk_request *clk_req);int msm_dsi_dphy_timing_calc_v4 (struct msm_dsi_dphy_timing *timing,struct msm_dsi_phy_clk_request *clk_req); +int msm_dsi_cphy_timing_calc_v4 (struct msm_dsi_dphy_timing *timing, +struct msm_dsi_phy_clk_request *clk_req);#endif /* __DSI_PHY_H__ */
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +102 -43
222 lines not on this page · raw message
Signature · 1 line
2.26.1