Add eDP support for RK3588
Subsystems (9)
v5 cover Add eDP support for RK3588
These patchs have been tested with a 1536x2048p60 eDP panel on RK3588S EVB1 board, and HDMI 1080P/4K display also has been verified on RK3588 EVB1 board. Furthermore, the eDP display has been rechecked on RK3399 sapphire excavator board.
Patch 1~4 are the eDP mode support of samsung hdptx phy driver.
Patch 5~8 are preparations for the RK3588 eDP support on both Analogix
side and Rockchip side.
Patch 9~12 are to support to get panel from the DP AUX bus. Patch 13~15 are the RK3588 Analogix DP driver support.
Patch 16 is to add the power sequencing delays for panel model
LP079QX1-SP0V.
Patch 17~18 are the renaming of hdptxphy node. It is not only used by
HDMI display but also for the eDP display.
Patch 19 is the addition of RK3588 eDP0 node.
Patch 20 is to enable the eDP0 display on RK3588S EVB1 board.
Damon Ding (20):
phy: phy-rockchip-samsung-hdptx: Swap the definitions of LCPLL_REF and
ROPLL_REF
phy: phy-rockchip-samsung-hdptx: Supplement some register names with
their full version
phy: phy-rockchip-samsung-hdptx: Add the '_MASK' suffix to all
registers
phy: phy-rockchip-samsung-hdptx: Add eDP mode support for RK3588 drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...()
or dev_...()
drm/rockchip: analogix_dp: Use formalized struct definition for grf
field
drm/rockchip: analogix_dp: Expand device data to support multiple edp
display
drm/bridge: analogix_dp: Add support for phy configuration.
dt-bindings: display: rockchip: analogix-dp: Add support to get panel
from the DP AUX bus
drm/bridge: analogix_dp: support to get &analogix_dp_device.plat_data
and &analogix_dp_device.aux
drm/bridge: analogix_dp: Add support to get panel from the DP AUX bus drm/rockchip: analogix_dp: Add support to get panel from the DP AUX
bus
dt-bindings: display: rockchip: analogix-dp: Add support for RK3588 drm/bridge: analogix_dp: Add support for RK3588 drm/rockchip: analogix_dp: Add support for RK3588 drm/edp-panel: Add LG Display panel model LP079QX1-SP0V
dt-bindings: display: rockchip: Fix label name of hdptxphy for RK3588
HDMI TX Controller
arm64: dts: rockchip: Fix label name of hdptxphy for RK3588
arm64: dts: rockchip: Add eDP0 node for RK3588
arm64: dts: rockchip: Enable eDP0 display on RK3588S EVB1 board
.../rockchip/rockchip,analogix-dp.yaml | 40 +- .../rockchip/rockchip,rk3588-dw-hdmi-qp.yaml | 2 +- arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 32 +- .../dts/rockchip/rk3588-coolpi-cm5-evb.dts | 2 +- .../rockchip/rk3588-coolpi-cm5-genbook.dts | 2 +- .../boot/dts/rockchip/rk3588-evb1-v10.dts | 2 +- .../rk3588-friendlyelec-cm3588-nas.dts | 2 +- .../arm64/boot/dts/rockchip/rk3588-jaguar.dts | 2 +- .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi | 2 +- .../dts/rockchip/rk3588-orangepi-5-plus.dts | 2 +- .../boot/dts/rockchip/rk3588-rock-5b.dts | 2 +- .../boot/dts/rockchip/rk3588-tiger-haikou.dts | 2 +- .../boot/dts/rockchip/rk3588s-coolpi-4b.dts | 2 +- .../boot/dts/rockchip/rk3588s-evb1-v10.dts | 54 + .../dts/rockchip/rk3588s-indiedroid-nova.dts | 2 +- .../boot/dts/rockchip/rk3588s-nanopi-r6.dtsi | 2 +- .../boot/dts/rockchip/rk3588s-odroid-m2.dts | 2 +- .../boot/dts/rockchip/rk3588s-orangepi-5.dtsi | 2 +- .../boot/dts/rockchip/rk3588s-rock-5a.dts | 2 +- .../boot/dts/rockchip/rk3588s-rock-5c.dts | 2 +- .../drm/bridge/analogix/analogix_dp_core.c | 81 +- .../drm/bridge/analogix/analogix_dp_core.h | 1 + .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 52 + drivers/gpu/drm/panel/panel-edp.c | 8 + .../gpu/drm/rockchip/analogix_dp-rockchip.c | 233 +++-- .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 971 +++++++++++++++++- include/drm/bridge/analogix_dp.h | 7 +- 27 files changed, 1344 insertions(+), 169 deletions(-)
Signature · 1 line
2.34.1
PATCH v5 1/20 phy: phy-rockchip-samsung-hdptx: Swap the definitions of LCPLL_REF and ROPLL_REF
According to the datasheet, setting the dig_clk_sel bit of CMN_REG(0097) to 1'b1 selects LCPLL as the reference clock, while setting it to 1'b0 selects the ROPLL.
--- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +2 -2
@@ -94,8 +94,8 @@#define LCPLL_ALONE_MODE BIT(1)/* CMN_REG(0097) */ #define DIG_CLK_SEL BIT(1) -#define ROPLL_REF BIT(1) -#define LCPLL_REF 0 +#define LCPLL_REF BIT(1) +#define ROPLL_REF 0/* CMN_REG(0099) */ #define CMN_ROPLL_ALONE_MODE BIT(2)#define ROPLL_ALONE_MODE BIT(2)
Signature · 1 line
2.34.1
PATCH v5 2/20 phy: phy-rockchip-samsung-hdptx: Supplement some register names with their full version
In reply to Damon DingComplete the register names of CMN_REG(0081) and CMN_REG(0087) to their full version, and it can help to better match the datasheet.
--- drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +3 -3
@@ -82,14 +82,14 @@#define ROPLL_SSC_EN BIT(0)/* CMN_REG(0081) */ #define OVRD_PLL_CD_CLK_EN BIT(8) -#define PLL_CD_HSCLK_EAST_EN BIT(0) +#define ANA_PLL_CD_HSCLK_EAST_EN BIT(0)/* CMN_REG(0086) */ #define PLL_PCG_POSTDIV_SEL_MASK GENMASK(7, 4)#define PLL_PCG_CLK_SEL_MASK GENMASK(3, 1)#define PLL_PCG_CLK_EN BIT(0)/* CMN_REG(0087) */ -#define PLL_FRL_MODE_EN BIT(3) -#define PLL_TX_HS_CLK_EN BIT(2) +#define ANA_PLL_FRL_MODE_EN BIT(3) +#define ANA_PLL_TX_HS_CLK_EN BIT(2)/* CMN_REG(0089) */ #define LCPLL_ALONE_MODE BIT(1)/* CMN_REG(0097) */
Signature · 1 line
2.34.1
PATCH v5 3/20 phy: phy-rockchip-samsung-hdptx: Add the '_MASK' suffix to all registers
In reply to Damon DingAdding the '_MASK' suffix to all registers in order to ensures consistency in the naming convention for register macros throughout the file.
---
Changes in v4:
- Split the older patch related to the renaming of registers into three different commits
--- .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +44 -44
@@ -50,60 +50,60 @@#define LCPLL_PI_EN_MASK BIT(5)#define LCPLL_100M_CLK_EN_MASK BIT(0)/* CMN_REG(0025) */ -#define LCPLL_PMS_IQDIV_RSTN BIT(4) +#define LCPLL_PMS_IQDIV_RSTN_MASK BIT(4)/* CMN_REG(0028) */ -#define LCPLL_SDC_FRAC_EN BIT(2) -#define LCPLL_SDC_FRAC_RSTN BIT(0) +#define LCPLL_SDC_FRAC_EN_MASK BIT(2) +#define LCPLL_SDC_FRAC_RSTN_MASK BIT(0)/* CMN_REG(002d) */ #define LCPLL_SDC_N_MASK GENMASK(3, 1)/* CMN_REG(002e) */ #define LCPLL_SDC_NUMBERATOR_MASK GENMASK(5, 0)/* CMN_REG(002f) */ #define LCPLL_SDC_DENOMINATOR_MASK GENMASK(7, 2) -#define LCPLL_SDC_NDIV_RSTN BIT(0) +#define LCPLL_SDC_NDIV_RSTN_MASK BIT(0)/* CMN_REG(003d) */ -#define ROPLL_LCVCO_EN BIT(4) +#define ROPLL_LCVCO_EN_MASK BIT(4)/* CMN_REG(004e) */ -#define ROPLL_PI_EN BIT(5) +#define ROPLL_PI_EN_MASK BIT(5)/* CMN_REG(005c) */ -#define ROPLL_PMS_IQDIV_RSTN BIT(5) +#define ROPLL_PMS_IQDIV_RSTN_MASK BIT(5)/* CMN_REG(005e) */ #define ROPLL_SDM_EN_MASK BIT(6) -#define ROPLL_SDM_FRAC_EN_RBR BIT(3) -#define ROPLL_SDM_FRAC_EN_HBR BIT(2) -#define ROPLL_SDM_FRAC_EN_HBR2 BIT(1) -#define ROPLL_SDM_FRAC_EN_HBR3 BIT(0) +#define ROPLL_SDC_FRAC_EN_RBR_MASK BIT(3) +#define ROPLL_SDC_FRAC_EN_HBR_MASK BIT(2) +#define ROPLL_SDC_FRAC_EN_HBR2_MASK BIT(1) +#define ROPLL_SDM_FRAC_EN_HBR3_MASK BIT(0)/* CMN_REG(0064) */ #define ROPLL_SDM_NUM_SIGN_RBR_MASK BIT(3)/* CMN_REG(0069) */ #define ROPLL_SDC_N_RBR_MASK GENMASK(2, 0)/* CMN_REG(0074) */ -#define ROPLL_SDC_NDIV_RSTN BIT(2) -#define ROPLL_SSC_EN BIT(0) +#define ROPLL_SDC_NDIV_RSTN_MASK BIT(2) +#define ROPLL_SSC_EN_MASK BIT(0)/* CMN_REG(0081) */ -#define OVRD_PLL_CD_CLK_EN BIT(8) -#define ANA_PLL_CD_HSCLK_EAST_EN BIT(0) +#define OVRD_PLL_CD_CLK_EN_MASK BIT(8) +#define ANA_PLL_CD_HSCLK_EAST_EN_MASK BIT(0)/* CMN_REG(0086) */ #define PLL_PCG_POSTDIV_SEL_MASK GENMASK(7, 4)#define PLL_PCG_CLK_SEL_MASK GENMASK(3, 1) -#define PLL_PCG_CLK_EN BIT(0) +#define PLL_PCG_CLK_EN_MASK BIT(0)/* CMN_REG(0087) */ -#define ANA_PLL_FRL_MODE_EN BIT(3) -#define ANA_PLL_TX_HS_CLK_EN BIT(2) +#define ANA_PLL_FRL_MODE_EN_MASK BIT(3) +#define ANA_PLL_TX_HS_CLK_EN_MASK BIT(2)/* CMN_REG(0089) */ -#define LCPLL_ALONE_MODE BIT(1) +#define LCPLL_ALONE_MODE_MASK BIT(1)/* CMN_REG(0097) */ -#define DIG_CLK_SEL BIT(1) +#define DIG_CLK_SEL_MASK BIT(1)#define LCPLL_REF BIT(1)#define ROPLL_REF 0/* CMN_REG(0099) */ -#define CMN_ROPLL_ALONE_MODE BIT(2) +#define CMN_ROPLL_ALONE_MODE_MASK BIT(2)#define ROPLL_ALONE_MODE BIT(2)/* CMN_REG(009a) */ -#define HS_SPEED_SEL BIT(0) +#define HS_SPEED_SEL_MASK BIT(0)#define DIV_10_CLOCK BIT(0)/* CMN_REG(009b) */ -#define IS_SPEED_SEL BIT(4) +#define LS_SPEED_SEL_MASK BIT(4)#define LINK_SYMBOL_CLOCK BIT(4)#define LINK_SYMBOL_CLOCK1_2 0
@@ -161,36 +161,36 @@#define SB_READY_MASK BIT(4)/* LNTOP_REG(0200) */ -#define PROTOCOL_SEL BIT(2) +#define PROTOCOL_SEL_MASK BIT(2)#define HDMI_MODE BIT(2)#define HDMI_TMDS_FRL_SEL BIT(1)/* LNTOP_REG(0206) */ -#define DATA_BUS_SEL BIT(0) +#define DATA_BUS_WIDTH_SEL_MASK BIT(0)#define DATA_BUS_36_40 BIT(0)/* LNTOP_REG(0207) */ -#define LANE_EN 0xf +#define LANE_EN_MASK 0xf#define ALL_LANE_EN 0xf/* LANE_REG(0312) */ -#define LN0_TX_SER_RATE_SEL_RBR BIT(5) -#define LN0_TX_SER_RATE_SEL_HBR BIT(4) -#define LN0_TX_SER_RATE_SEL_HBR2 BIT(3) -#define LN0_TX_SER_RATE_SEL_HBR3 BIT(2) +#define LN0_TX_SER_RATE_SEL_RBR_MASK BIT(5) +#define LN0_TX_SER_RATE_SEL_HBR_MASK BIT(4) +#define LN0_TX_SER_RATE_SEL_HBR2_MASK BIT(3) +#define LN0_TX_SER_RATE_SEL_HBR3_MASK BIT(2)/* LANE_REG(0412) */ -#define LN1_TX_SER_RATE_SEL_RBR BIT(5) -#define LN1_TX_SER_RATE_SEL_HBR BIT(4) -#define LN1_TX_SER_RATE_SEL_HBR2 BIT(3) -#define LN1_TX_SER_RATE_SEL_HBR3 BIT(2) +#define LN1_TX_SER_RATE_SEL_RBR_MASK BIT(5) +#define LN1_TX_SER_RATE_SEL_HBR_MASK BIT(4) +#define LN1_TX_SER_RATE_SEL_HBR2_MASK BIT(3) +#define LN1_TX_SER_RATE_SEL_HBR3_MASK BIT(2)/* LANE_REG(0512) */ -#define LN2_TX_SER_RATE_SEL_RBR BIT(5) -#define LN2_TX_SER_RATE_SEL_HBR BIT(4) -#define LN2_TX_SER_RATE_SEL_HBR2 BIT(3) -#define LN2_TX_SER_RATE_SEL_HBR3 BIT(2) +#define LN2_TX_SER_RATE_SEL_RBR_MASK BIT(5) +#define LN2_TX_SER_RATE_SEL_HBR_MASK BIT(4) +#define LN2_TX_SER_RATE_SEL_HBR2_MASK BIT(3) +#define LN2_TX_SER_RATE_SEL_HBR3_MASK BIT(2)/* LANE_REG(0612) */ -#define LN3_TX_SER_RATE_SEL_RBR BIT(5) -#define LN3_TX_SER_RATE_SEL_HBR BIT(4) -#define LN3_TX_SER_RATE_SEL_HBR2 BIT(3) -#define LN3_TX_SER_RATE_SEL_HBR3 BIT(2) +#define LN3_TX_SER_RATE_SEL_RBR_MASK BIT(5) +#define LN3_TX_SER_RATE_SEL_HBR_MASK BIT(4) +#define LN3_TX_SER_RATE_SEL_HBR2_MASK BIT(3) +#define LN3_TX_SER_RATE_SEL_HBR3_MASK BIT(2)#define HDMI20_MAX_RATE 600000000
@@ -813,8 +813,8 @@ static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx,regmap_update_bits (hdptx->regmap,CMN_REG (0086 ),PLL_PCG_POSTDIV_SEL_MASK ,FIELD_PREP (PLL_PCG_POSTDIV_SEL_MASK , cfg->pms_sdiv)); -regmap_update_bits (hdptx->regmap,CMN_REG (0086 ),PLL_PCG_CLK_EN , -PLL_PCG_CLK_EN ); +regmap_update_bits (hdptx->regmap,CMN_REG (0086 ),PLL_PCG_CLK_EN_MASK , +FIELD_PREP (PLL_PCG_CLK_EN_MASK ,0x1 ));return rk_hdptx_post_enable_pll (hdptx); }
Signature · 1 line
2.34.1
PATCH v5 4/20 phy: phy-rockchip-samsung-hdptx: Add eDP mode support for RK3588
In reply to Damon DingThe PHY is based on a Samsung IP block that supports HDMI 2.1, and eDP 1.4b. RK3588 integrates the Analogix eDP 1.3 TX controller IP and the HDMI/eDP TX Combo PHY to support eDP display.
Add basic support for RBR/HBR/HBR2 link rates, and the voltage swing and pre-emphasis configurations of each link rate are set according to the eDP 1.3 requirements.
---
Changes in v2:
- Add the module author
Changes in v3:
- Split this patch into two, one for correction and the other for extension
Changes in v4:
- Add link_rate and lanes parameters in struct rk_hdptx_phy to store the phy_configure() result for &phy_configure_opts.dp.link_rate and &phy_configure_opts.dp.lanes
Changes in v5:
- Reuse the existing functions rk_hdptx_phy_consumer_get() and rk_hdptx_phy_consumer_put()
- Return 0 instead of -EINVAL in rk_hdptx_phy_configure()
- Remove rk_hdptx_phy_lane_disable() and related check of 0 lanes
- Mention the design details in the commit message
- Remove unnecessary rk_hdptx_phy_set_mode()
--- .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 879 +++++++++++++++++- 1 file changed, 869 insertions(+), 10 deletions(-)
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c +869 -10
@@ -25,6 +25,7 @@#define HDPTX_I_PLL_EN BIT(7)#define HDPTX_I_BIAS_EN BIT(6)#define HDPTX_I_BGR_EN BIT(5) +#define HDPTX_MODE_SEL BIT(0)#define GRF_HDPTX_STATUS 0x80#define HDPTX_O_PLL_LOCK_DONE BIT(3)#define HDPTX_O_PHY_CLK_RDY BIT(2)
@@ -44,6 +45,7 @@#define LANE_REG (n) HDTPX_REG(n, 0300, 062d)/* CMN_REG(0008) */ +#define OVRD_LCPLL_EN_MASK BIT(7)#define LCPLL_EN_MASK BIT(6)#define LCPLL_LCVCO_MODE_EN_MASK BIT(4)/* CMN_REG(001e) */
@@ -61,28 +63,88 @@/* CMN_REG(002f) */ #define LCPLL_SDC_DENOMINATOR_MASK GENMASK(7, 2)#define LCPLL_SDC_NDIV_RSTN_MASK BIT(0) +/* CMN_REG(003c) */ +#define ANA_LCPLL_RESERVED7_MASK BIT(7)/* CMN_REG(003d) */ +#define OVRD_ROPLL_EN_MASK BIT(7) +#define ROPLL_EN_MASK BIT(6)#define ROPLL_LCVCO_EN_MASK BIT(4) +/* CMN_REG(0046) */ +#define ROPLL_ANA_CPP_CTRL_COARSE_MASK GENMASK(7, 4) +#define ROPLL_ANA_CPP_CTRL_FINE_MASK GENMASK(3, 0) +/* CMN_REG(0047) */ +#define ROPLL_ANA_LPF_C_SEL_COARSE_MASK GENMASK(5, 3) +#define ROPLL_ANA_LPF_C_SEL_FINE_MASK GENMASK(2, 0)/* CMN_REG(004e) */ #define ROPLL_PI_EN_MASK BIT(5) +/* CMN_REG(0051) */ +#define ROPLL_PMS_MDIV_MASK GENMASK(7, 0) +/* CMN_REG(0055) */ +#define ROPLL_PMS_MDIV_AFC_MASK GENMASK(7, 0) +/* CMN_REG(0059) */ +#define ANA_ROPLL_PMS_PDIV_MASK GENMASK(7, 4) +#define ANA_ROPLL_PMS_REFDIV_MASK GENMASK(3, 0) +/* CMN_REG(005a) */ +#define ROPLL_PMS_SDIV_RBR_MASK GENMASK(7, 4) +#define ROPLL_PMS_SDIV_HBR_MASK GENMASK(3, 0) +/* CMN_REG(005b) */ +#define ROPLL_PMS_SDIV_HBR2_MASK GENMASK(7, 4)/* CMN_REG(005c) */ #define ROPLL_PMS_IQDIV_RSTN_MASK BIT(5)/* CMN_REG(005e) */ #define ROPLL_SDM_EN_MASK BIT(6) +#define OVRD_ROPLL_SDM_RSTN_MASK BIT(5) +#define ROPLL_SDM_RSTN_MASK BIT(4)#define ROPLL_SDC_FRAC_EN_RBR_MASK BIT(3)#define ROPLL_SDC_FRAC_EN_HBR_MASK BIT(2)#define ROPLL_SDC_FRAC_EN_HBR2_MASK BIT(1)#define ROPLL_SDM_FRAC_EN_HBR3_MASK BIT(0) +/* CMN_REG(005f) */ +#define OVRD_ROPLL_SDC_RSTN_MASK BIT(5) +#define ROPLL_SDC_RSTN_MASK BIT(4) +/* CMN_REG(0060) */ +#define ROPLL_SDM_DENOMINATOR_MASK GENMASK(7, 0)/* CMN_REG(0064) */ #define ROPLL_SDM_NUM_SIGN_RBR_MASK BIT(3) +#define ROPLL_SDM_NUM_SIGN_HBR_MASK BIT(2) +#define ROPLL_SDM_NUM_SIGN_HBR2_MASK BIT(1) +/* CMN_REG(0065) */ +#define ROPLL_SDM_NUM_MASK GENMASK(7, 0)/* CMN_REG(0069) */ #define ROPLL_SDC_N_RBR_MASK GENMASK(2, 0) +/* CMN_REG(006a) */ +#define ROPLL_SDC_N_HBR_MASK GENMASK(5, 3) +#define ROPLL_SDC_N_HBR2_MASK GENMASK(2, 0) +/* CMN_REG(006b) */ +#define ROPLL_SDC_N_HBR3_MASK GENMASK(3, 1) +/* CMN_REG(006c) */ +#define ROPLL_SDC_NUM_MASK GENMASK(5, 0) +/* cmn_reg0070 */ +#define ROPLL_SDC_DENO_MASK GENMASK(5, 0)/* CMN_REG(0074) */ +#define OVRD_ROPLL_SDC_NDIV_RSTN_MASK BIT(3)#define ROPLL_SDC_NDIV_RSTN_MASK BIT(2) +#define OVRD_ROPLL_SSC_EN_MASK BIT(1)#define ROPLL_SSC_EN_MASK BIT(0) +/* CMN_REG(0075) */ +#define ANA_ROPLL_SSC_FM_DEVIATION_MASK GENMASK(5, 0) +/* CMN_REG(0076) */ +#define ANA_ROPLL_SSC_FM_FREQ_MASK GENMASK(6, 2) +/* CMN_REG(0077) */ +#define ANA_ROPLL_SSC_CLK_DIV_SEL_MASK GENMASK(6, 3)/* CMN_REG(0081) */ #define OVRD_PLL_CD_CLK_EN_MASK BIT(8) +#define ANA_PLL_CD_TX_SER_RATE_SEL_MASK BIT(3) +#define ANA_PLL_CD_HSCLK_WEST_EN_MASK BIT(1)#define ANA_PLL_CD_HSCLK_EAST_EN_MASK BIT(0) +/* CMN_REG(0082) */ +#define ANA_PLL_CD_VREG_GAIN_CTRL_MASK GENMASK(3, 0) +/* CMN_REG(0083) */ +#define ANA_PLL_CD_VREG_ICTRL_MASK GENMASK(6, 5) +/* CMN_REG(0084) */ +#define PLL_LCRO_CLK_SEL_MASK BIT(5) +/* CMN_REG(0085) */ +#define ANA_PLL_SYNC_LOSS_DET_MODE_MASK GENMASK(1, 0)/* CMN_REG(0086) */ #define PLL_PCG_POSTDIV_SEL_MASK GENMASK(7, 4)#define PLL_PCG_CLK_SEL_MASK GENMASK(3, 1)
@@ -92,11 +154,14 @@#define ANA_PLL_TX_HS_CLK_EN_MASK BIT(2)/* CMN_REG(0089) */ #define LCPLL_ALONE_MODE_MASK BIT(1) +/* CMN_REG(0095) */ +#define DP_TX_LINK_BW_MASK GENMASK(1, 0)/* CMN_REG(0097) */ #define DIG_CLK_SEL_MASK BIT(1)#define LCPLL_REF BIT(1)#define ROPLL_REF 0/* CMN_REG(0099) */ +#define SSC_EN_MASK GENMASK(7, 6)#define CMN_ROPLL_ALONE_MODE_MASK BIT(2)#define ROPLL_ALONE_MODE BIT(2)/* CMN_REG(009a) */
@@ -118,6 +183,8 @@/* SB_REG(0104) */ #define OVRD_SB_EN_MASK BIT(5)#define SB_EN_MASK BIT(4) +#define OVRD_SB_AUX_EN_MASK BIT(1) +#define SB_AUX_EN_MASK BIT(0)/* SB_REG(0105) */ #define OVRD_SB_EARC_CMDC_EN_MASK BIT(6)#define SB_EARC_CMDC_EN_MASK BIT(5)
@@ -126,6 +193,8 @@#define ANA_SB_TX_LLVL_PROG_MASK GENMASK(6, 4)/* SB_REG(0109) */ #define ANA_SB_DMRX_AFC_DIV_RATIO_MASK GENMASK(2, 0) +/* SB_REG(010d) */ +#define ANA_SB_DMRX_LPBK_DATA_MASK BIT(4)/* SB_REG(010f) */ #define OVRD_SB_VREG_EN_MASK BIT(7)#define SB_VREG_EN_MASK BIT(6)
@@ -133,6 +202,7 @@#define SB_VREG_LPF_BYPASS_MASK BIT(4)#define ANA_SB_VREG_GAIN_CTRL_MASK GENMASK(3, 0)/* SB_REG(0110) */ +#define ANA_SB_VREG_OUT_SEL_MASK BIT(1)#define ANA_SB_VREG_REF_SEL_MASK BIT(0)/* SB_REG(0113) */ #define SB_RX_RCAL_OPT_CODE_MASK GENMASK(5, 4)
@@ -147,13 +217,24 @@#define AFC_RSTN_DELAY_TIME_MASK GENMASK(6, 4)/* SB_REG(0117) */ #define FAST_PULSE_TIME_MASK GENMASK(3, 0) +/* SB_REG(0118) */ +#define SB_TG_EARC_DMRX_RECVRD_CLK_CNT_MASK GENMASK(7, 0) +/* SB_REG(011a) */ +#define SB_TG_CNT_RUN_NO_7_0_MASK GENMASK(7, 0)/* SB_REG(011b) */ #define SB_EARC_SIG_DET_BYPASS_MASK BIT(4)#define SB_AFC_TOL_MASK GENMASK(3, 0) +/* SB_REG(011c) */ +#define SB_AFC_STB_NUM_MASK GENMASK(3, 0) +/* SB_REG(011d) */ +#define SB_TG_OSC_CNT_MIN_MASK GENMASK(7, 0) +/* SB_REG(011e) */ +#define SB_TG_OSC_CNT_MAX_MASK GENMASK(7, 0)/* SB_REG(011f) */ #define SB_PWM_AFC_CTRL_MASK GENMASK(7, 2)#define SB_RCAL_RSTN_MASK BIT(1)/* SB_REG(0120) */ +#define SB_AUX_EN_IN_MASK BIT(7)#define SB_EARC_EN_MASK BIT(1)#define SB_EARC_AFC_EN_MASK BIT(2)/* SB_REG(0123) */
@@ -165,27 +246,74 @@#define HDMI_MODE BIT(2)#define HDMI_TMDS_FRL_SEL BIT(1)/* LNTOP_REG(0206) */ +#define DATA_BUS_WIDTH_MASK GENMASK(2, 1)#define DATA_BUS_WIDTH_SEL_MASK BIT(0)#define DATA_BUS_36_40 BIT(0)/* LNTOP_REG(0207) */ #define LANE_EN_MASK 0xf#define ALL_LANE_EN 0xf +/* LANE_REG(0301) */ +#define OVRD_LN_TX_DRV_EI_EN_MASK BIT(7) +#define LN_TX_DRV_EI_EN_MASK BIT(6) +/* LANE_REG(0303) */ +#define OVRD_LN_TX_DRV_LVL_CTRL_MASK BIT(5) +#define LN_TX_DRV_LVL_CTRL_MASK GENMASK(4, 0) +/* LANE_REG(0304) */ +#define OVRD_LN_TX_DRV_POST_LVL_CTRL_MASK BIT(4) +#define LN_TX_DRV_POST_LVL_CTRL_MASK GENMASK(3, 0) +/* LANE_REG(0305) */ +#define OVRD_LN_TX_DRV_PRE_LVL_CTRL_MASK BIT(6) +#define LN_TX_DRV_PRE_LVL_CTRL_MASK GENMASK(5, 2) +/* LANE_REG(0306) */ +#define LN_ANA_TX_DRV_IDRV_IDN_CTRL_MASK GENMASK(7, 5) +#define LN_ANA_TX_DRV_IDRV_IUP_CTRL_MASK GENMASK(4, 2) +#define LN_ANA_TX_DRV_ACCDRV_EN_MASK BIT(0) +/* LANE_REG(0307) */ +#define LN_ANA_TX_DRV_ACCDRV_POL_SEL_MASK BIT(6) +#define LN_ANA_TX_DRV_ACCDRV_CTRL_MASK GENMASK(5, 3) +/* LANE_REG(030a) */ +#define LN_ANA_TX_JEQ_EN_MASK BIT(4) +#define LN_TX_JEQ_EVEN_CTRL_RBR_MASK GENMASK(3, 0) +/* LANE_REG(030b) */ +#define LN_TX_JEQ_EVEN_CTRL_HBR_MASK GENMASK(7, 4) +#define LN_TX_JEQ_EVEN_CTRL_HBR2_MASK GENMASK(3, 0) +/* LANE_REG(030c) */ +#define LN_TX_JEQ_ODD_CTRL_RBR_MASK GENMASK(3, 0) +/* LANE_REG(030d) */ +#define LN_TX_JEQ_ODD_CTRL_HBR_MASK GENMASK(7, 4) +#define LN_TX_JEQ_ODD_CTRL_HBR2_MASK GENMASK(3, 0) +/* LANE_REG(0310) */ +#define LN_ANA_TX_SYNC_LOSS_DET_MODE_MASK GENMASK(1, 0) +/* LANE_REG(0311) */ +#define LN_TX_SER_40BIT_EN_RBR_MASK BIT(3) +#define LN_TX_SER_40BIT_EN_HBR_MASK BIT(2) +#define LN_TX_SER_40BIT_EN_HBR2_MASK BIT(1)/* LANE_REG(0312) */ #define LN0_TX_SER_RATE_SEL_RBR_MASK BIT(5)#define LN0_TX_SER_RATE_SEL_HBR_MASK BIT(4)#define LN0_TX_SER_RATE_SEL_HBR2_MASK BIT(3)#define LN0_TX_SER_RATE_SEL_HBR3_MASK BIT(2) +/* LANE_REG(0316) */ +#define LN_ANA_TX_SER_VREG_GAIN_CTRL_MASK GENMASK(3, 0) +/* LANE_REG(031B) */ +#define LN_ANA_TX_RESERVED_MASK GENMASK(7, 0) +/* LANE_REG(031e) */ +#define LN_POLARITY_INV_MASK BIT(2) +#define LN_LANE_MODE_MASK BIT(1) +/* LANE_REG(0412) */ #define LN1_TX_SER_RATE_SEL_RBR_MASK BIT(5)#define LN1_TX_SER_RATE_SEL_HBR_MASK BIT(4)#define LN1_TX_SER_RATE_SEL_HBR2_MASK BIT(3)#define LN1_TX_SER_RATE_SEL_HBR3_MASK BIT(2) +/* LANE_REG(0512) */ #define LN2_TX_SER_RATE_SEL_RBR_MASK BIT(5)#define LN2_TX_SER_RATE_SEL_HBR_MASK BIT(4)#define LN2_TX_SER_RATE_SEL_HBR2_MASK BIT(3)#define LN2_TX_SER_RATE_SEL_HBR3_MASK BIT(2) +/* LANE_REG(0612) */ #define LN3_TX_SER_RATE_SEL_RBR_MASK BIT(5)#define LN3_TX_SER_RATE_SEL_HBR_MASK BIT(4)
@@ -194,6 +322,12 @@#define HDMI20_MAX_RATE 600000000 +enum dp_link_rate { +DP_BW_RBR , +DP_BW_HBR , +DP_BW_HBR2 , +}; +struct lcpll_config {u32 bit_rate;u8 lcvco_mode_en;
@@ -255,6 +389,19 @@ struct ropll_config {u8 cd_tx_ser_rate_sel; }; +struct tx_drv_ctrl { +u8 tx_drv_lvl_ctrl; +u8 tx_drv_post_lvl_ctrl; +u8 ana_tx_drv_idrv_idn_ctrl; +u8 ana_tx_drv_idrv_iup_ctrl; +u8 ana_tx_drv_accdrv_en; +u8 ana_tx_drv_accdrv_ctrl; +u8 tx_drv_pre_lvl_ctrl; +u8 ana_tx_jeq_en; +u8 tx_jeq_even_ctrl; +u8 tx_jeq_odd_ctrl; +}; +enum rk_hdptx_reset {RST_APB =0 ,RST_INIT ,
@@ -279,6 +426,10 @@ struct rk_hdptx_phy {unsigned long rate;atomic_t usage_count; + +/* used for dp mode */ +unsigned int link_rate; +unsigned int lanes; };static const struct ropll_config ropll_tmds_cfg[] = {
@@ -557,6 +708,90 @@ static const struct reg_sequence rk_hdtpx_tmds_lane_init_seq[] = { REG_SEQ0(LANE_REG(0606), 0x1c), }; +static struct tx_drv_ctrl tx_drv_ctrl_rbr[4 ][4 ] = { +/* voltage swing 0, pre-emphasis 0->3 */ + { + {0x2 ,0x0 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0x4 ,0x3 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0x7 ,0x6 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0xd ,0xc ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 1, pre-emphasis 0->2 */ + { + {0x4 ,0x0 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0x9 ,0x5 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0xc ,0x8 ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 2, pre-emphasis 0->1 */ + { + {0x8 ,0x0 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0xc ,0x5 ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 3, pre-emphasis 0 */ + { + {0xb ,0x0 ,0x7 ,0x7 ,0x1 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + } +}; + +static struct tx_drv_ctrl tx_drv_ctrl_hbr[4 ][4 ] = { +/* voltage swing 0, pre-emphasis 0->3 */ + { + {0x2 ,0x0 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0x5 ,0x4 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0x9 ,0x8 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0xd ,0xc ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 1, pre-emphasis 0->2 */ + { + {0x6 ,0x1 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0xa ,0x6 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0xc ,0x8 ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 2, pre-emphasis 0->1 */ + { + {0x9 ,0x1 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0xd ,0x6 ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 3, pre-emphasis 0 */ + { + {0xc ,0x1 ,0x7 ,0x7 ,0x1 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + } +}; + +static struct tx_drv_ctrl tx_drv_ctrl_hbr2[4 ][4 ] = { +/* voltage swing 0, pre-emphasis 0->3 */ + { + {0x2 ,0x1 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0x5 ,0x4 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0x9 ,0x8 ,0x4 ,0x6 ,0x1 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0xd ,0xc ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 1, pre-emphasis 0->2 */ + { + {0x6 ,0x1 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0xb ,0x7 ,0x4 ,0x6 ,0x0 ,0x4 ,0x0 ,0x1 ,0x7 ,0x7 }, + {0xd ,0x9 ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 2, pre-emphasis 0->1 */ + { + {0x8 ,0x1 ,0x4 ,0x6 ,0x0 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + {0xc ,0x6 ,0x7 ,0x7 ,0x1 ,0x7 ,0x0 ,0x1 ,0x7 ,0x7 }, + }, + +/* voltage swing 3, pre-emphasis 0 */ + { + {0xb ,0x0 ,0x7 ,0x7 ,0x1 ,0x4 ,0x1 ,0x1 ,0x7 ,0x7 }, + } +}; +static bool rk_hdptx_phy_is_rw_reg (struct device *dev,unsigned int reg) {switch (reg) {
@@ -843,9 +1078,45 @@ static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx,return rk_hdptx_post_enable_lane (hdptx); } +static void rk_hdptx_dp_reset (struct rk_hdptx_phy *hdptx) +{ +reset_control_assert (hdptx->rsts[RST_LANE ].rstc); +reset_control_assert (hdptx->rsts[RST_CMN ].rstc); +reset_control_assert (hdptx->rsts[RST_INIT ].rstc); + +reset_control_assert (hdptx->rsts[RST_APB ].rstc); +udelay (10 ); +reset_control_deassert (hdptx->rsts[RST_APB ].rstc); + +regmap_update_bits (hdptx->regmap,LANE_REG (0301 ), +OVRD_LN_TX_DRV_EI_EN_MASK |LN_TX_DRV_EI_EN_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_EI_EN_MASK ,1 ) | +FIELD_PREP (LN_TX_DRV_EI_EN_MASK ,0 )); +regmap_update_bits (hdptx->regmap,LANE_REG (0401 ), +OVRD_LN_TX_DRV_EI_EN_MASK |LN_TX_DRV_EI_EN_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_EI_EN_MASK ,1 ) | +FIELD_PREP (LN_TX_DRV_EI_EN_MASK ,0 )); +regmap_update_bits (hdptx->regmap,LANE_REG (0501 ), +OVRD_LN_TX_DRV_EI_EN_MASK |LN_TX_DRV_EI_EN_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_EI_EN_MASK ,1 ) | +FIELD_PREP (LN_TX_DRV_EI_EN_MASK ,0 )); +regmap_update_bits (hdptx->regmap,LANE_REG (0601 ), +OVRD_LN_TX_DRV_EI_EN_MASK |LN_TX_DRV_EI_EN_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_EI_EN_MASK ,1 ) | +FIELD_PREP (LN_TX_DRV_EI_EN_MASK ,0 )); + +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_PLL_EN <<16 |FIELD_PREP (HDPTX_I_PLL_EN ,0x0 )); +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_BIAS_EN <<16 |FIELD_PREP (HDPTX_I_BIAS_EN ,0x0 )); +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_BGR_EN <<16 |FIELD_PREP (HDPTX_I_BGR_EN ,0x0 )); +} +static int rk_hdptx_phy_consumer_get (struct rk_hdptx_phy *hdptx,unsigned int rate) { +enum phy_mode mode =phy_get_mode (hdptx->phy);u32 status;int ret;
@@ -859,10 +1130,14 @@ static int rk_hdptx_phy_consumer_get(struct rk_hdptx_phy *hdptx,if (status &HDPTX_O_PLL_LOCK_DONE )dev_warn (hdptx->dev,"PLL locked by unknown consumer!\n" ); -if (rate) { - ret =rk_hdptx_ropll_tmds_cmn_config (hdptx, rate); -if (ret) - goto dec_usage; +if (mode ==PHY_MODE_DP ) { +rk_hdptx_dp_reset (hdptx); + }else { +if (rate) { + ret =rk_hdptx_ropll_tmds_cmn_config (hdptx, rate); +if (ret) + goto dec_usage; + } }return 0 ;
@@ -874,6 +1149,7 @@ static int rk_hdptx_phy_consumer_get(struct rk_hdptx_phy *hdptx,static int rk_hdptx_phy_consumer_put (struct rk_hdptx_phy *hdptx,bool force) { +enum phy_mode mode =phy_get_mode (hdptx->phy);u32 status;int ret;
@@ -887,8 +1163,12 @@ static int rk_hdptx_phy_consumer_put(struct rk_hdptx_phy *hdptx, bool force) }else { ret =regmap_read (hdptx->grf,GRF_HDPTX_STATUS , &status);if (!ret) { -if (status &HDPTX_O_PLL_LOCK_DONE ) -rk_hdptx_phy_disable (hdptx); +if (status &HDPTX_O_PLL_LOCK_DONE ) { +if (mode ==PHY_MODE_DP ) +rk_hdptx_dp_reset (hdptx); +else +rk_hdptx_phy_disable (hdptx); + }return 0 ; }else if (force) {return 0 ;
@@ -899,11 +1179,262 @@ static int rk_hdptx_phy_consumer_put(struct rk_hdptx_phy *hdptx, bool force)return ret; } +static void rk_hdptx_dp_pll_init (struct rk_hdptx_phy *hdptx) +{ + regmap_update_bits(hdptx->regmap, CMN_REG(003c), ANA_LCPLL_RESERVED7_MASK, +FIELD_PREP (ANA_LCPLL_RESERVED7_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0046 ), +ROPLL_ANA_CPP_CTRL_COARSE_MASK |ROPLL_ANA_CPP_CTRL_FINE_MASK , +FIELD_PREP (ROPLL_ANA_CPP_CTRL_COARSE_MASK ,0xe ) | +FIELD_PREP (ROPLL_ANA_CPP_CTRL_FINE_MASK ,0xe )); +regmap_update_bits (hdptx->regmap,CMN_REG (0047 ), +ROPLL_ANA_LPF_C_SEL_COARSE_MASK | +ROPLL_ANA_LPF_C_SEL_FINE_MASK , +FIELD_PREP (ROPLL_ANA_LPF_C_SEL_COARSE_MASK ,0x4 ) | +FIELD_PREP (ROPLL_ANA_LPF_C_SEL_FINE_MASK ,0x4 )); + +regmap_write (hdptx->regmap,CMN_REG (0051 ),FIELD_PREP (ROPLL_PMS_MDIV_MASK ,0x87 )); +regmap_write (hdptx->regmap,CMN_REG (0052 ),FIELD_PREP (ROPLL_PMS_MDIV_MASK ,0x71 )); +regmap_write (hdptx->regmap,CMN_REG (0053 ),FIELD_PREP (ROPLL_PMS_MDIV_MASK ,0x71 )); + +regmap_write (hdptx->regmap,CMN_REG (0055 ), +FIELD_PREP (ROPLL_PMS_MDIV_AFC_MASK ,0x87 )); +regmap_write (hdptx->regmap,CMN_REG (0056 ), +FIELD_PREP (ROPLL_PMS_MDIV_AFC_MASK ,0x71 )); +regmap_write (hdptx->regmap,CMN_REG (0057 ), +FIELD_PREP (ROPLL_PMS_MDIV_AFC_MASK ,0x71 )); + +regmap_write (hdptx->regmap,CMN_REG (0059 ), +FIELD_PREP (ANA_ROPLL_PMS_PDIV_MASK ,0x1 ) | +FIELD_PREP (ANA_ROPLL_PMS_REFDIV_MASK ,0x1 )); + regmap_write(hdptx->regmap, CMN_REG(005a), +FIELD_PREP (ROPLL_PMS_SDIV_RBR_MASK ,0x3 ) | +FIELD_PREP (ROPLL_PMS_SDIV_HBR_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (005b ),ROPLL_PMS_SDIV_HBR2_MASK , +FIELD_PREP (ROPLL_PMS_SDIV_HBR2_MASK ,0x0 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (005e ),ROPLL_SDM_EN_MASK , +FIELD_PREP (ROPLL_SDM_EN_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (005e ), +OVRD_ROPLL_SDM_RSTN_MASK |ROPLL_SDM_RSTN_MASK , +FIELD_PREP (OVRD_ROPLL_SDM_RSTN_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SDM_RSTN_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (005e ),ROPLL_SDC_FRAC_EN_RBR_MASK , +FIELD_PREP (ROPLL_SDC_FRAC_EN_RBR_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (005e ),ROPLL_SDC_FRAC_EN_HBR_MASK , +FIELD_PREP (ROPLL_SDC_FRAC_EN_HBR_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (005e ),ROPLL_SDC_FRAC_EN_HBR2_MASK , +FIELD_PREP (ROPLL_SDC_FRAC_EN_HBR2_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (005f ), +OVRD_ROPLL_SDC_RSTN_MASK |ROPLL_SDC_RSTN_MASK , +FIELD_PREP (OVRD_ROPLL_SDC_RSTN_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SDC_RSTN_MASK ,0x1 )); +regmap_write (hdptx->regmap,CMN_REG (0060 ), +FIELD_PREP (ROPLL_SDM_DENOMINATOR_MASK ,0x21 )); +regmap_write (hdptx->regmap,CMN_REG (0061 ), +FIELD_PREP (ROPLL_SDM_DENOMINATOR_MASK ,0x27 )); +regmap_write (hdptx->regmap,CMN_REG (0062 ), +FIELD_PREP (ROPLL_SDM_DENOMINATOR_MASK ,0x27 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0064 ), +ROPLL_SDM_NUM_SIGN_RBR_MASK | +ROPLL_SDM_NUM_SIGN_HBR_MASK | +ROPLL_SDM_NUM_SIGN_HBR2_MASK , +FIELD_PREP (ROPLL_SDM_NUM_SIGN_RBR_MASK ,0x0 ) | +FIELD_PREP (ROPLL_SDM_NUM_SIGN_HBR_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SDM_NUM_SIGN_HBR2_MASK ,0x1 )); +regmap_write (hdptx->regmap,CMN_REG (0065 ), +FIELD_PREP (ROPLL_SDM_NUM_MASK ,0x0 )); +regmap_write (hdptx->regmap,CMN_REG (0066 ), +FIELD_PREP (ROPLL_SDM_NUM_MASK ,0xd )); +regmap_write (hdptx->regmap,CMN_REG (0067 ), +FIELD_PREP (ROPLL_SDM_NUM_MASK ,0xd )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0069 ),ROPLL_SDC_N_RBR_MASK , +FIELD_PREP (ROPLL_SDC_N_RBR_MASK ,0x2 )); + + regmap_update_bits(hdptx->regmap, CMN_REG(006a), +ROPLL_SDC_N_HBR_MASK |ROPLL_SDC_N_HBR2_MASK , +FIELD_PREP (ROPLL_SDC_N_HBR_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SDC_N_HBR2_MASK ,0x1 )); + + regmap_write(hdptx->regmap, CMN_REG(006c), +FIELD_PREP (ROPLL_SDC_NUM_MASK ,0x3 )); +regmap_write (hdptx->regmap,CMN_REG (006d ), +FIELD_PREP (ROPLL_SDC_NUM_MASK ,0x7 )); +regmap_write (hdptx->regmap,CMN_REG (006e ), +FIELD_PREP (ROPLL_SDC_NUM_MASK ,0x7 )); + +regmap_write (hdptx->regmap,CMN_REG (0070 ), +FIELD_PREP (ROPLL_SDC_DENO_MASK ,0x8 )); +regmap_write (hdptx->regmap,CMN_REG (0071 ), +FIELD_PREP (ROPLL_SDC_DENO_MASK ,0x18 )); +regmap_write (hdptx->regmap,CMN_REG (0072 ), +FIELD_PREP (ROPLL_SDC_DENO_MASK ,0x18 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0074 ), +OVRD_ROPLL_SDC_NDIV_RSTN_MASK |ROPLL_SDC_NDIV_RSTN_MASK , +FIELD_PREP (OVRD_ROPLL_SDC_NDIV_RSTN_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SDC_NDIV_RSTN_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0077 ),ANA_ROPLL_SSC_CLK_DIV_SEL_MASK , +FIELD_PREP (ANA_ROPLL_SSC_CLK_DIV_SEL_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0081 ),ANA_PLL_CD_TX_SER_RATE_SEL_MASK , +FIELD_PREP (ANA_PLL_CD_TX_SER_RATE_SEL_MASK ,0x0 )); +regmap_update_bits (hdptx->regmap,CMN_REG (0081 ), +ANA_PLL_CD_HSCLK_EAST_EN_MASK |ANA_PLL_CD_HSCLK_WEST_EN_MASK , +FIELD_PREP (ANA_PLL_CD_HSCLK_EAST_EN_MASK ,0x1 ) | +FIELD_PREP (ANA_PLL_CD_HSCLK_WEST_EN_MASK ,0x0 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0082 ),ANA_PLL_CD_VREG_GAIN_CTRL_MASK , +FIELD_PREP (ANA_PLL_CD_VREG_GAIN_CTRL_MASK ,0x4 )); +regmap_update_bits (hdptx->regmap,CMN_REG (0083 ),ANA_PLL_CD_VREG_ICTRL_MASK , +FIELD_PREP (ANA_PLL_CD_VREG_ICTRL_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (0084 ),PLL_LCRO_CLK_SEL_MASK , +FIELD_PREP (PLL_LCRO_CLK_SEL_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (0085 ),ANA_PLL_SYNC_LOSS_DET_MODE_MASK , +FIELD_PREP (ANA_PLL_SYNC_LOSS_DET_MODE_MASK ,0x3 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0087 ),ANA_PLL_TX_HS_CLK_EN_MASK , +FIELD_PREP (ANA_PLL_TX_HS_CLK_EN_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0097 ),DIG_CLK_SEL_MASK , +FIELD_PREP (DIG_CLK_SEL_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0099 ),CMN_ROPLL_ALONE_MODE_MASK , +FIELD_PREP (CMN_ROPLL_ALONE_MODE_MASK ,0x1 )); + regmap_update_bits(hdptx->regmap, CMN_REG(009a), HS_SPEED_SEL_MASK, +FIELD_PREP (HS_SPEED_SEL_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,CMN_REG (009b ),LS_SPEED_SEL_MASK , +FIELD_PREP (LS_SPEED_SEL_MASK ,0x1 )); +} + +static int rk_hdptx_dp_aux_init (struct rk_hdptx_phy *hdptx) +{ +u32 status; +int ret; + +regmap_update_bits (hdptx->regmap,SB_REG (0102 ),ANA_SB_RXTERM_OFFSP_MASK , +FIELD_PREP (ANA_SB_RXTERM_OFFSP_MASK ,0x3 )); +regmap_update_bits (hdptx->regmap,SB_REG (0103 ),ANA_SB_RXTERM_OFFSN_MASK , +FIELD_PREP (ANA_SB_RXTERM_OFFSN_MASK ,0x3 )); +regmap_update_bits (hdptx->regmap,SB_REG (0104 ),SB_AUX_EN_MASK , +FIELD_PREP (SB_AUX_EN_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,SB_REG (0105 ),ANA_SB_TX_HLVL_PROG_MASK , +FIELD_PREP (ANA_SB_TX_HLVL_PROG_MASK ,0x7 )); +regmap_update_bits (hdptx->regmap,SB_REG (0106 ),ANA_SB_TX_LLVL_PROG_MASK , +FIELD_PREP (ANA_SB_TX_LLVL_PROG_MASK ,0x7 )); + +regmap_update_bits (hdptx->regmap,SB_REG (010d ),ANA_SB_DMRX_LPBK_DATA_MASK , +FIELD_PREP (ANA_SB_DMRX_LPBK_DATA_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,SB_REG (010f ),ANA_SB_VREG_GAIN_CTRL_MASK , +FIELD_PREP (ANA_SB_VREG_GAIN_CTRL_MASK ,0x0 )); +regmap_update_bits (hdptx->regmap,SB_REG (0110 ), +ANA_SB_VREG_OUT_SEL_MASK |ANA_SB_VREG_REF_SEL_MASK , +FIELD_PREP (ANA_SB_VREG_OUT_SEL_MASK ,0x1 ) | +FIELD_PREP (ANA_SB_VREG_REF_SEL_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,SB_REG (0113 ), +SB_RX_RCAL_OPT_CODE_MASK |SB_RX_RTERM_CTRL_MASK , +FIELD_PREP (SB_RX_RCAL_OPT_CODE_MASK ,0x1 ) | +FIELD_PREP (SB_RX_RTERM_CTRL_MASK ,0x3 )); +regmap_update_bits (hdptx->regmap,SB_REG (0114 ), +SB_TG_SB_EN_DELAY_TIME_MASK |SB_TG_RXTERM_EN_DELAY_TIME_MASK , +FIELD_PREP (SB_TG_SB_EN_DELAY_TIME_MASK ,0x2 ) | +FIELD_PREP (SB_TG_RXTERM_EN_DELAY_TIME_MASK ,0x2 )); +regmap_update_bits (hdptx->regmap,SB_REG (0115 ), +SB_READY_DELAY_TIME_MASK |SB_TG_OSC_EN_DELAY_TIME_MASK , +FIELD_PREP (SB_READY_DELAY_TIME_MASK ,0x2 ) | +FIELD_PREP (SB_TG_OSC_EN_DELAY_TIME_MASK ,0x2 )); +regmap_update_bits (hdptx->regmap,SB_REG (0116 ), +AFC_RSTN_DELAY_TIME_MASK , +FIELD_PREP (AFC_RSTN_DELAY_TIME_MASK ,0x2 )); +regmap_update_bits (hdptx->regmap,SB_REG (0117 ), +FAST_PULSE_TIME_MASK , +FIELD_PREP (FAST_PULSE_TIME_MASK ,0x4 )); +regmap_update_bits (hdptx->regmap,SB_REG (0118 ), +SB_TG_EARC_DMRX_RECVRD_CLK_CNT_MASK , +FIELD_PREP (SB_TG_EARC_DMRX_RECVRD_CLK_CNT_MASK ,0xa )); + + regmap_update_bits(hdptx->regmap, SB_REG(011a), SB_TG_CNT_RUN_NO_7_0_MASK, +FIELD_PREP (SB_TG_CNT_RUN_NO_7_0_MASK ,0x3 )); +regmap_update_bits (hdptx->regmap,SB_REG (011b ), +SB_EARC_SIG_DET_BYPASS_MASK |SB_AFC_TOL_MASK , +FIELD_PREP (SB_EARC_SIG_DET_BYPASS_MASK ,0x1 ) | +FIELD_PREP (SB_AFC_TOL_MASK ,0x3 )); + regmap_update_bits(hdptx->regmap, SB_REG(011c), SB_AFC_STB_NUM_MASK, +FIELD_PREP (SB_AFC_STB_NUM_MASK ,0x4 )); +regmap_update_bits (hdptx->regmap,SB_REG (011d ),SB_TG_OSC_CNT_MIN_MASK , +FIELD_PREP (SB_TG_OSC_CNT_MIN_MASK ,0x67 )); +regmap_update_bits (hdptx->regmap,SB_REG (011e ),SB_TG_OSC_CNT_MAX_MASK , +FIELD_PREP (SB_TG_OSC_CNT_MAX_MASK ,0x6a )); +regmap_update_bits (hdptx->regmap,SB_REG (011f ),SB_PWM_AFC_CTRL_MASK , +FIELD_PREP (SB_PWM_AFC_CTRL_MASK ,0x5 )); +regmap_update_bits (hdptx->regmap,SB_REG (011f ),SB_RCAL_RSTN_MASK , +FIELD_PREP (SB_RCAL_RSTN_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,SB_REG (0120 ),SB_AUX_EN_IN_MASK , +FIELD_PREP (SB_AUX_EN_IN_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,SB_REG (0102 ),OVRD_SB_RXTERM_EN_MASK , +FIELD_PREP (OVRD_SB_RXTERM_EN_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,SB_REG (0103 ),OVRD_SB_RX_RESCAL_DONE_MASK , +FIELD_PREP (OVRD_SB_RX_RESCAL_DONE_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,SB_REG (0104 ),OVRD_SB_EN_MASK , +FIELD_PREP (OVRD_SB_EN_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,SB_REG (0104 ),OVRD_SB_AUX_EN_MASK , +FIELD_PREP (OVRD_SB_AUX_EN_MASK ,0x1 )); + +regmap_update_bits (hdptx->regmap,SB_REG (010f ),OVRD_SB_VREG_EN_MASK , +FIELD_PREP (OVRD_SB_VREG_EN_MASK ,0x1 )); + +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_BGR_EN <<16 |FIELD_PREP (HDPTX_I_BGR_EN ,0x1 )); +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_BIAS_EN <<16 |FIELD_PREP (HDPTX_I_BIAS_EN ,0x1 )); +usleep_range (20 ,25 ); + +reset_control_deassert (hdptx->rsts[RST_INIT ].rstc); +usleep_range (20 ,25 ); +reset_control_deassert (hdptx->rsts[RST_CMN ].rstc); +usleep_range (20 ,25 ); + +regmap_update_bits (hdptx->regmap,SB_REG (0103 ),OVRD_SB_RX_RESCAL_DONE_MASK , +FIELD_PREP (OVRD_SB_RX_RESCAL_DONE_MASK ,0x1 )); +usleep_range (100 ,110 ); +regmap_update_bits (hdptx->regmap,SB_REG (0104 ),SB_EN_MASK , +FIELD_PREP (SB_EN_MASK ,0x1 )); +usleep_range (100 ,110 ); +regmap_update_bits (hdptx->regmap,SB_REG (0102 ),SB_RXTERM_EN_MASK , +FIELD_PREP (SB_RXTERM_EN_MASK ,0x1 )); +usleep_range (20 ,25 ); +regmap_update_bits (hdptx->regmap,SB_REG (010f ),SB_VREG_EN_MASK , +FIELD_PREP (SB_VREG_EN_MASK ,0x1 )); +usleep_range (20 ,25 ); +regmap_update_bits (hdptx->regmap,SB_REG (0104 ),SB_AUX_EN_MASK , +FIELD_PREP (SB_AUX_EN_MASK ,0x1 )); +usleep_range (100 ,110 ); + + ret =regmap_read_poll_timeout (hdptx->grf,GRF_HDPTX_STATUS , + status,FIELD_GET (HDPTX_O_SB_RDY , status), +50 ,1000 ); +if (ret) { +dev_err (hdptx->dev,"Failed to get phy sb ready: %d\n" , ret); +return ret; + } + +return 0 ; +} +static int rk_hdptx_phy_power_on (struct phy *phy) {struct rk_hdptx_phy *hdptx =phy_get_drvdata (phy);int bus_width =phy_get_bus_width (hdptx->phy); -int ret; +enum phy_mode mode =phy_get_mode (phy); +int ret, lane;/* * FIXME: Temporary workaround to pass pixel_clk_rate
@@ -919,9 +1450,37 @@ static int rk_hdptx_phy_power_on(struct phy *phy)if (ret)return ret; - ret =rk_hdptx_ropll_tmds_mode_config (hdptx, rate); -if (ret) -rk_hdptx_phy_consumer_put (hdptx, true); +if (mode ==PHY_MODE_DP ) { +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_MODE_SEL <<16 |FIELD_PREP (HDPTX_MODE_SEL ,0x1 )); + +for (lane =0 ; lane <4 ; lane++) { +regmap_update_bits (hdptx->regmap,LANE_REG (031e ) +0x400 * lane, +LN_POLARITY_INV_MASK |LN_LANE_MODE_MASK , +FIELD_PREP (LN_POLARITY_INV_MASK ,0 ) | +FIELD_PREP (LN_LANE_MODE_MASK ,1 )); + } + +regmap_update_bits (hdptx->regmap,LNTOP_REG (0200 ),PROTOCOL_SEL_MASK , +FIELD_PREP (PROTOCOL_SEL_MASK ,0x0 )); +regmap_update_bits (hdptx->regmap,LNTOP_REG (0206 ),DATA_BUS_WIDTH_MASK , +FIELD_PREP (DATA_BUS_WIDTH_MASK ,0x1 )); +regmap_update_bits (hdptx->regmap,LNTOP_REG (0206 ),DATA_BUS_WIDTH_SEL_MASK , +FIELD_PREP (DATA_BUS_WIDTH_SEL_MASK ,0x0 )); + +rk_hdptx_dp_pll_init (hdptx); + + ret =rk_hdptx_dp_aux_init (hdptx); +if (ret) +rk_hdptx_phy_consumer_put (hdptx, true); + }else { +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_MODE_SEL <<16 |FIELD_PREP (HDPTX_MODE_SEL ,0x0 )); + + ret =rk_hdptx_ropll_tmds_mode_config (hdptx, rate); +if (ret) +rk_hdptx_phy_consumer_put (hdptx, true); + }return ret; }
@@ -933,9 +1492,308 @@ static int rk_hdptx_phy_power_off(struct phy *phy)return rk_hdptx_phy_consumer_put (hdptx, false); } +static int rk_hdptx_phy_verify_config (struct rk_hdptx_phy *hdptx, +struct phy_configure_opts_dp *dp) +{ +int i; + +if (dp->set_rate) { +switch (dp->link_rate) { +case 1620 : +case 2700 : +case 5400 : +break ; +default : +return -EINVAL ; + } + } + +if (dp->set_lanes) { +switch (dp->lanes) { +case 1 : +case 2 : +case 4 : +break ; +default : +return -EINVAL ; + } + } + +if (dp->set_voltages) { +for (i =0 ; i < hdptx->lanes; i++) { +if (dp->voltage[i] >3 || dp->pre[i] >3 ) +return -EINVAL ; + +if (dp->voltage[i] + dp->pre[i] >3 ) +return -EINVAL ; + } + } + +return 0 ; +} + +static int rk_hdptx_phy_set_rate (struct rk_hdptx_phy *hdptx, +struct phy_configure_opts_dp *dp) +{ +u32 bw, status; +int ret; + +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_PLL_EN <<16 |FIELD_PREP (HDPTX_I_PLL_EN ,0x0 )); + +switch (dp->link_rate) { +case 1620 : + bw =DP_BW_RBR ; +break ; +case 2700 : + bw =DP_BW_HBR ; +break ; +case 5400 : + bw =DP_BW_HBR2 ; +break ; +default : +return -EINVAL ; + } + hdptx->link_rate = dp->link_rate; + +regmap_update_bits (hdptx->regmap,CMN_REG (0008 ),OVRD_LCPLL_EN_MASK |LCPLL_EN_MASK , +FIELD_PREP (OVRD_LCPLL_EN_MASK ,0x1 ) | +FIELD_PREP (LCPLL_EN_MASK ,0x0 )); + +regmap_update_bits (hdptx->regmap,CMN_REG (003d ),OVRD_ROPLL_EN_MASK |ROPLL_EN_MASK , +FIELD_PREP (OVRD_ROPLL_EN_MASK ,0x1 ) | +FIELD_PREP (ROPLL_EN_MASK ,0x1 )); + +if (dp->ssc) { +regmap_update_bits (hdptx->regmap,CMN_REG (0074 ), +OVRD_ROPLL_SSC_EN_MASK |ROPLL_SSC_EN_MASK , +FIELD_PREP (OVRD_ROPLL_SSC_EN_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SSC_EN_MASK ,0x1 )); +regmap_write (hdptx->regmap,CMN_REG (0075 ), +FIELD_PREP (ANA_ROPLL_SSC_FM_DEVIATION_MASK ,0xc )); +regmap_update_bits (hdptx->regmap,CMN_REG (0076 ), +ANA_ROPLL_SSC_FM_FREQ_MASK , +FIELD_PREP (ANA_ROPLL_SSC_FM_FREQ_MASK ,0x1f )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0099 ),SSC_EN_MASK , +FIELD_PREP (SSC_EN_MASK ,0x2 )); + }else { +regmap_update_bits (hdptx->regmap,CMN_REG (0074 ), +OVRD_ROPLL_SSC_EN_MASK |ROPLL_SSC_EN_MASK , +FIELD_PREP (OVRD_ROPLL_SSC_EN_MASK ,0x1 ) | +FIELD_PREP (ROPLL_SSC_EN_MASK ,0x0 )); +regmap_write (hdptx->regmap,CMN_REG (0075 ), +FIELD_PREP (ANA_ROPLL_SSC_FM_DEVIATION_MASK ,0x20 )); +regmap_update_bits (hdptx->regmap,CMN_REG (0076 ), +ANA_ROPLL_SSC_FM_FREQ_MASK , +FIELD_PREP (ANA_ROPLL_SSC_FM_FREQ_MASK ,0xc )); + +regmap_update_bits (hdptx->regmap,CMN_REG (0099 ),SSC_EN_MASK , +FIELD_PREP (SSC_EN_MASK ,0x0 )); + } + +regmap_update_bits (hdptx->regmap,CMN_REG (0095 ),DP_TX_LINK_BW_MASK , +FIELD_PREP (DP_TX_LINK_BW_MASK , bw)); + +regmap_write (hdptx->grf,GRF_HDPTX_CON0 , +HDPTX_I_PLL_EN <<16 |FIELD_PREP (HDPTX_I_PLL_EN ,0x1 )); + + ret =regmap_read_poll_timeout (hdptx->grf,GRF_HDPTX_STATUS , + status,FIELD_GET (HDPTX_O_PLL_LOCK_DONE , status), +50 ,1000 ); +if (ret) { +dev_err (hdptx->dev,"Failed to get phy pll lock: %d\n" , ret); +return ret; + } + +return 0 ; +} + +static int rk_hdptx_phy_set_lanes (struct rk_hdptx_phy *hdptx, +struct phy_configure_opts_dp *dp) +{ + hdptx->lanes = dp->lanes; + +regmap_update_bits (hdptx->regmap,LNTOP_REG (0207 ),LANE_EN_MASK , +FIELD_PREP (LANE_EN_MASK ,GENMASK (hdptx->lanes -1 ,0 ))); + +return 0 ; +} + +static void rk_hdptx_phy_set_voltage (struct rk_hdptx_phy *hdptx, +struct phy_configure_opts_dp *dp, +u8 lane) +{ +const struct tx_drv_ctrl *ctrl; +u32 offset = lane *0x400 ; + +switch (hdptx->link_rate) { +case 1620 : + ctrl = &tx_drv_ctrl_rbr[dp->voltage[lane]][dp->pre[lane]]; + regmap_update_bits(hdptx->regmap, LANE_REG(030a) + offset, +LN_TX_JEQ_EVEN_CTRL_RBR_MASK , +FIELD_PREP (LN_TX_JEQ_EVEN_CTRL_RBR_MASK , + ctrl->tx_jeq_even_ctrl)); + regmap_update_bits(hdptx->regmap, LANE_REG(030c) + offset, +LN_TX_JEQ_ODD_CTRL_RBR_MASK , +FIELD_PREP (LN_TX_JEQ_ODD_CTRL_RBR_MASK , + ctrl->tx_jeq_odd_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (0311 ) + offset, +LN_TX_SER_40BIT_EN_RBR_MASK , +FIELD_PREP (LN_TX_SER_40BIT_EN_RBR_MASK ,0x1 )); +break ; +case 2700 : + ctrl = &tx_drv_ctrl_hbr[dp->voltage[lane]][dp->pre[lane]]; +regmap_update_bits (hdptx->regmap,LANE_REG (030b ) + offset, +LN_TX_JEQ_EVEN_CTRL_HBR_MASK , +FIELD_PREP (LN_TX_JEQ_EVEN_CTRL_HBR_MASK , + ctrl->tx_jeq_even_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (030d ) + offset, +LN_TX_JEQ_ODD_CTRL_HBR_MASK , +FIELD_PREP (LN_TX_JEQ_ODD_CTRL_HBR_MASK , + ctrl->tx_jeq_odd_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (0311 ) + offset, +LN_TX_SER_40BIT_EN_HBR_MASK , +FIELD_PREP (LN_TX_SER_40BIT_EN_HBR_MASK ,0x1 )); +break ; +case 5400 : +default : + ctrl = &tx_drv_ctrl_hbr2[dp->voltage[lane]][dp->pre[lane]]; +regmap_update_bits (hdptx->regmap,LANE_REG (030b ) + offset, +LN_TX_JEQ_EVEN_CTRL_HBR2_MASK , +FIELD_PREP (LN_TX_JEQ_EVEN_CTRL_HBR2_MASK , + ctrl->tx_jeq_even_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (030d ) + offset, +LN_TX_JEQ_ODD_CTRL_HBR2_MASK , +FIELD_PREP (LN_TX_JEQ_ODD_CTRL_HBR2_MASK , + ctrl->tx_jeq_odd_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (0311 ) + offset, +LN_TX_SER_40BIT_EN_HBR2_MASK , +FIELD_PREP (LN_TX_SER_40BIT_EN_HBR2_MASK ,0x1 )); +break ; + } + +regmap_update_bits (hdptx->regmap,LANE_REG (0303 ) + offset, +OVRD_LN_TX_DRV_LVL_CTRL_MASK |LN_TX_DRV_LVL_CTRL_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_LVL_CTRL_MASK ,0x1 ) | +FIELD_PREP (LN_TX_DRV_LVL_CTRL_MASK , + ctrl->tx_drv_lvl_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (0304 ) + offset, +OVRD_LN_TX_DRV_POST_LVL_CTRL_MASK | +LN_TX_DRV_POST_LVL_CTRL_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_POST_LVL_CTRL_MASK ,0x1 ) | +FIELD_PREP (LN_TX_DRV_POST_LVL_CTRL_MASK , + ctrl->tx_drv_post_lvl_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (0305 ) + offset, +OVRD_LN_TX_DRV_PRE_LVL_CTRL_MASK | +LN_TX_DRV_PRE_LVL_CTRL_MASK , +FIELD_PREP (OVRD_LN_TX_DRV_PRE_LVL_CTRL_MASK ,0x1 ) | +FIELD_PREP (LN_TX_DRV_PRE_LVL_CTRL_MASK , + ctrl->tx_drv_pre_lvl_ctrl)); +regmap_update_bits (hdptx->regmap,LANE_REG (0306 ) + offset, +LN_ANA_TX_DRV_IDRV_IDN_CTRL_MASK | +LN_ANA_TX_DRV_IDRV_IUP_CTRL_MASK | +LN_ANA_TX_DRV_ACCDRV_EN_MASK , +FIELD_PREP (LN_ANA_TX_DRV_IDRV_IDN_CTRL_MASK , + ctrl->ana_tx_drv_idrv_idn_ctrl) | +FIELD_PREP (LN_ANA_TX_DRV_IDRV_IUP_CTRL_MASK , + ctrl->ana_tx_drv_idrv_iup_ctrl) | +FIELD_PREP (LN_ANA_TX_DRV_ACCDRV_EN_MASK , + ctrl->ana_tx_drv_accdrv_en)); +regmap_update_bits (hdptx->regmap,LANE_REG (0307 ) + offset, +LN_ANA_TX_DRV_ACCDRV_POL_SEL_MASK | +LN_ANA_TX_DRV_ACCDRV_CTRL_MASK , +FIELD_PREP (LN_ANA_TX_DRV_ACCDRV_POL_SEL_MASK ,0x1 ) | +FIELD_PREP (LN_ANA_TX_DRV_ACCDRV_CTRL_MASK , + ctrl->ana_tx_drv_accdrv_ctrl)); + + regmap_update_bits(hdptx->regmap, LANE_REG(030a) + offset, +LN_ANA_TX_JEQ_EN_MASK , +FIELD_PREP (LN_ANA_TX_JEQ_EN_MASK , ctrl->ana_tx_jeq_en)); + +regmap_update_bits (hdptx->regmap,LANE_REG (0310 ) + offset, +LN_ANA_TX_SYNC_LOSS_DET_MODE_MASK , +FIELD_PREP (LN_ANA_TX_SYNC_LOSS_DET_MODE_MASK ,0x3 )); + +regmap_update_bits (hdptx->regmap,LANE_REG (0316 ) + offset, +LN_ANA_TX_SER_VREG_GAIN_CTRL_MASK , +FIELD_PREP (LN_ANA_TX_SER_VREG_GAIN_CTRL_MASK ,0x2 )); + +regmap_update_bits (hdptx->regmap,LANE_REG (031b ) + offset, +LN_ANA_TX_RESERVED_MASK , +FIELD_PREP (LN_ANA_TX_RESERVED_MASK ,0x1 )); +} + +static int rk_hdptx_phy_set_voltages (struct rk_hdptx_phy *hdptx, +struct phy_configure_opts_dp *dp) +{ +u8 lane; +u32 status; +int ret; + +for (lane =0 ; lane < hdptx->lanes; lane++) +rk_hdptx_phy_set_voltage (hdptx, dp, lane); + +reset_control_deassert (hdptx->rsts[RST_LANE ].rstc); + + ret =regmap_read_poll_timeout (hdptx->grf,GRF_HDPTX_STATUS , + status,FIELD_GET (HDPTX_O_PHY_RDY , status), +50 ,5000 ); +if (ret) { +dev_err (hdptx->dev,"Failed to get phy ready: %d\n" , ret); +return ret; + } + +return 0 ; +} + +static int rk_hdptx_phy_configure (struct phy *phy,union phy_configure_opts *opts) +{ +struct rk_hdptx_phy *hdptx =phy_get_drvdata (phy); +enum phy_mode mode =phy_get_mode (phy); +int ret; + +if (mode !=PHY_MODE_DP ) +return 0 ; + + ret =rk_hdptx_phy_verify_config (hdptx, &opts->dp); +if (ret) { +dev_err (hdptx->dev,"invalid params for phy configure\n" ); +return ret; + } + +if (opts->dp.set_rate) { + ret =rk_hdptx_phy_set_rate (hdptx, &opts->dp); +if (ret) { +dev_err (hdptx->dev,"failed to set rate: %d\n" , ret); +return ret; + } + } + +if (opts->dp.set_lanes) { + ret =rk_hdptx_phy_set_lanes (hdptx, &opts->dp); +if (ret) { +dev_err (hdptx->dev,"failed to set lanes: %d\n" , ret); +return ret; + } + } + +if (opts->dp.set_voltages) { + ret =rk_hdptx_phy_set_voltages (hdptx, &opts->dp); +if (ret) { +dev_err (hdptx->dev,"failed to set voltages: %d\n" , + ret); +return ret; + } + } + +return 0 ; +} +static const struct phy_ops rk_hdptx_phy_ops = { .power_on = rk_hdptx_phy_power_on, .power_off = rk_hdptx_phy_power_off, + .configure = rk_hdptx_phy_configure, .owner =THIS_MODULE , };
@@ -1150,5 +2008,6 @@ module_platform_driver(rk_hdptx_phy_driver);MODULE_AUTHOR ("Algea Cao <[email protected]>" );MODULE_AUTHOR ("Cristian Ciocaltea <[email protected]>" ); +MODULE_AUTHOR ("Damon Ding <[email protected]>" );MODULE_DESCRIPTION ("Samsung HDMI/eDP Transmitter Combo PHY Driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.34.1
Re: [PATCH v5 04/20] phy: phy-rockchip-samsung-hdptx: Add eDP mode support for RK3588
Quoted 31 lines · Damon Ding
The PHY is based on a Samsung IP block that supports HDMI 2.1, and eDP 1.4b. RK3588 integrates the Analogix eDP 1.3 TX controller IP and the HDMI/eDP TX Combo PHY to support eDP display.
Add basic support for RBR/HBR/HBR2 link rates, and the voltage swing and pre-emphasis configurations of each link rate are set according to the eDP 1.3 requirements.
Signed-off-by Damon Ding <[email protected]>---
Changes in v2:
- Add the module authorChanges in v3:
- Split this patch into two, one for correction and the other for extensionChanges in v4:
- Addlink_rateand lanes parameters in structrk_hdptx_phyto store thephy_configure()result for &phy_configure_opts.dp.link_rate and &phy_configure_opts.dp.lanesChanges in v5:
- Reuse the existing functionsrk_hdptx_phy_consumer_get()andrk_hdptx_phy_consumer_put()
- Return 0 instead of-EINVALinrk_hdptx_phy_configure()
- Removerk_hdptx_phy_lane_disable()and related check of 0 lanes
- Mention the design details in the commit message
- Remove unnecessaryrk_hdptx_phy_set_mode()
Quoted 4 lines
--- .../phy/rockchip/phy-rockchip-samsung-hdptx.c | 879 +++++++++++++++++- 1 file changed, 869 insertions(+), 10 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH v5 5/20 drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...()
In reply to Damon DingAccording to the comments in include/drm/drm_print.h, the DRM_...() functions are deprecated in favor of drm_...() or dev_...() functions.
Use drm_err()/drm_dbg_core()/drm_dbg_kms() instead of DRM_DEV_ERROR()/DRM_ERROR()/DRM_DEV_DEBUG()/DRM_DEBUG_KMS() after rockchip_dp_bind() is called, and replace DRM_DEV_ERROR() with dev_err() before calling it.
--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +15 -14
@@ -100,13 +100,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable pclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret);return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to dp pre init %d\n" , ret); +drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }
@@ -126,12 +126,13 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)static int rockchip_dp_get_modes (struct analogix_dp_plat_data *plat_data,struct drm_connector *connector) { +struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data);struct drm_display_info *di = &connector->display_info;/* VOP couldn't output YUV video format for eDP rightly */ u32 mask =DRM_COLOR_FORMAT_YCBCR444 |DRM_COLOR_FORMAT_YCBCR422 ;if ((di->color_formats & mask)) { -DRM_DEBUG_KMS ("Swapping display color format from YUV to RGB\n" ); +drm_dbg_kms (dp->drm_dev,"Swapping display color format from YUV to RGB\n" ); di->color_formats &= ~mask; di->color_formats |=DRM_COLOR_FORMAT_RGB444 ; di->bpc =8 ;
@@ -201,17 +202,17 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,else val = dp->data->lcdsel_big; -DRM_DEV_DEBUG (dp->dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); +drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); ret =clk_prepare_enable (dp->grfclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable grfclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable grfclk %d\n" , ret);return ; } ret =regmap_write (dp->grf, dp->data->lcdsel_grf_reg, val);if (ret !=0 ) -DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);clk_disable_unprepare (dp->grfclk); }
@@ -236,7 +237,7 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder, ret =rockchip_drm_wait_vact_end (crtc,PSR_WAIT_LINE_FLAG_TIMEOUT_MS );if (ret) -DRM_DEV_ERROR (dp->dev,"line flag irq timed out\n" ); +drm_err (dp->drm_dev,"line flag irq timed out\n" ); } static int
@@ -277,7 +278,7 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) dp->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (dp->grf)) { -DRM_DEV_ERROR (dev,"failed to get rockchip,grf property\n" ); +dev_err (dev,"failed to get rockchip,grf property\n" );return PTR_ERR (dp->grf); }
@@ -287,19 +288,19 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) }else if (PTR_ERR (dp->grfclk) == -EPROBE_DEFER ) {return -EPROBE_DEFER ; }else if (IS_ERR (dp->grfclk)) { -DRM_DEV_ERROR (dev,"failed to get grf clock\n" ); +dev_err (dev,"failed to get grf clock\n" );return PTR_ERR (dp->grfclk); } dp->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (dp->pclk)) { -DRM_DEV_ERROR (dev,"failed to get pclk property\n" ); +dev_err (dev,"failed to get pclk property\n" );return PTR_ERR (dp->pclk); } dp->rst =devm_reset_control_get (dev,"dp" );if (IS_ERR (dp->rst)) { -DRM_DEV_ERROR (dev,"failed to get dp reset control\n" ); +dev_err (dev,"failed to get dp reset control\n" );return PTR_ERR (dp->rst); }
@@ -315,12 +316,12 @@ static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp) encoder->possible_crtcs =drm_of_find_possible_crtcs (drm_dev, dev->of_node); -DRM_DEBUG_KMS ("possible_crtcs = 0x%x\n" , encoder->possible_crtcs); +drm_dbg_kms (drm_dev,"possible_crtcs = 0x%x\n" , encoder->possible_crtcs); ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_TMDS );if (ret) { -DRM_ERROR ("failed to initialize encoder with drm\n" ); +drm_err (drm_dev,"failed to initialize encoder with drm\n" );return ret; }
@@ -340,7 +341,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, ret =rockchip_dp_drm_create_encoder (dp);if (ret) { -DRM_ERROR ("failed to create drm encoder\n" ); +drm_err (drm_dev,"failed to create drm encoder\n" );return ret; }
Signature · 1 line
2.34.1
Andy Yan
maintainerRe:[PATCH v5 05/20] drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...()
Hi Damon,
Quoted 18 lines · Damon Ding
According to the comments in
include/drm/drm_print.h, the DRM_...() functions are deprecated in favor of drm_...() or dev_...() functions.Use drm_err()/drm_dbg_core()/drm_dbg_kms() instead of DRM_DEV_ERROR()/DRM_ERROR()/DRM_DEV_DEBUG()/DRM_DEBUG_KMS() after
rockchip_dp_bind()is called, and replaceDRM_DEV_ERROR()withdev_err()before calling it.Signed-off-by Damon Ding <[email protected]>---
.../gpu/drm/rockchip/analogix_dp-rockchip.c| 29 ++++++++++---------1 file changed, 15 insertions(+), 14 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 103
Quoted 5 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1@@ -100,13 +100,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable pclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret);
You just need to pass dp here:
drm_err(dp, "failed to enable pclk %d\n", ret);
Quoted 114 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-6return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to dp pre init %d\n" , ret); +drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }@@ -126,12 +126,13 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)static int rockchip_dp_get_modes (struct analogix_dp_plat_data *plat_data,struct drm_connector *connector) { +struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data);struct drm_display_info *di = &connector->display_info;/* VOP couldn't output YUV video format for eDP rightly */ u32 mask =DRM_COLOR_FORMAT_YCBCR444 |DRM_COLOR_FORMAT_YCBCR422 ;if ((di->color_formats & mask)) { -DRM_DEBUG_KMS ("Swapping display color format from YUV to RGB\n" ); +drm_dbg_kms (dp->drm_dev,"Swapping display color format from YUV to RGB\n" ); di->color_formats &= ~mask; di->color_formats |=DRM_COLOR_FORMAT_RGB444 ; di->bpc =8 ;@@ -201,17 +202,17 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,else val = dp->data->lcdsel_big; -DRM_DEV_DEBUG (dp->dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); +drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); ret =clk_prepare_enable (dp->grfclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable grfclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable grfclk %d\n" , ret);return ; } ret =regmap_write (dp->grf, dp->data->lcdsel_grf_reg, val);if (ret !=0 ) -DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);clk_disable_unprepare (dp->grfclk); }@@ -236,7 +237,7 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder, ret =rockchip_drm_wait_vact_end (crtc,PSR_WAIT_LINE_FLAG_TIMEOUT_MS );if (ret) -DRM_DEV_ERROR (dp->dev,"line flag irq timed out\n" ); +drm_err (dp->drm_dev,"line flag irq timed out\n" ); }static int
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-7@@ -277,7 +278,7 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) dp->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (dp->grf)) { -DRM_DEV_ERROR (dev,"failed to get rockchip,grf property\n" ); +dev_err (dev,"failed to get rockchip,grf property\n" );return PTR_ERR (dp->grf); }@@ -287,19 +288,19 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) }else if (PTR_ERR (dp->grfclk) == -EPROBE_DEFER ) {return -EPROBE_DEFER ; }else if (IS_ERR (dp->grfclk)) { -DRM_DEV_ERROR (dev,"failed to get grf clock\n" ); +dev_err (dev,"failed to get grf clock\n" );return PTR_ERR (dp->grfclk); } dp->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (dp->pclk)) { -DRM_DEV_ERROR (dev,"failed to get pclk property\n" ); +dev_err (dev,"failed to get pclk property\n" );return PTR_ERR (dp->pclk); } dp->rst =devm_reset_control_get (dev,"dp" );if (IS_ERR (dp->rst)) { -DRM_DEV_ERROR (dev,"failed to get dp reset control\n" ); +dev_err (dev,"failed to get dp reset control\n" );return PTR_ERR (dp->rst); }@@ -315,12 +316,12 @@ static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp) encoder->possible_crtcs =drm_of_find_possible_crtcs (drm_dev, dev->of_node); -DRM_DEBUG_KMS ("possible_crtcs = 0x%x\n" , encoder->possible_crtcs); +drm_dbg_kms (drm_dev,"possible_crtcs = 0x%x\n" , encoder->possible_crtcs); ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_TMDS );if (ret) { -DRM_ERROR ("failed to initialize encoder with drm\n" ); +drm_err (drm_dev,"failed to initialize encoder with drm\n" );return ret; }@@ -340,7 +341,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, ret =rockchip_dp_drm_create_encoder (dp);if (ret) { -DRM_ERROR ("failed to create drm encoder\n" ); +drm_err (drm_dev,"failed to create drm encoder\n" );return ret; }Signature · 1 line
2.34.1
Re: [PATCH v5 05/20] drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...()
Hi Andy,
Quoted 23 lines · Andy Yan
Hi Damon,
Quoted 19 lines · Damon Ding
According to the comments in
include/drm/drm_print.h, the DRM_...() functions are deprecated in favor of drm_...() or dev_...() functions.Use drm_err()/drm_dbg_core()/drm_dbg_kms() instead of DRM_DEV_ERROR()/DRM_ERROR()/DRM_DEV_DEBUG()/DRM_DEBUG_KMS() after
rockchip_dp_bind()is called, and replaceDRM_DEV_ERROR()withdev_err()before calling it.Signed-off-by Damon Ding <[email protected]>---
.../gpu/drm/rockchip/analogix_dp-rockchip.c| 29 ++++++++++---------1 file changed, 15 insertions(+), 14 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0@@ -100,13 +100,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)
Quoted 8 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 103
Quoted 4 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable pclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret);You just need to pass dp here:
drm_err(dp, "failed to enable pclk %d\n", ret);
I see. It is really better to pass dp instead of dp->drm_dev. I will update all relevant logs in the next version.
Quoted 111 lines
Quoted 111 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-6return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to dp pre init %d\n" , ret); +drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }@@ -126,12 +126,13 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)static int rockchip_dp_get_modes (struct analogix_dp_plat_data *plat_data,struct drm_connector *connector) { +struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data);struct drm_display_info *di = &connector->display_info;/* VOP couldn't output YUV video format for eDP rightly */ u32 mask =DRM_COLOR_FORMAT_YCBCR444 |DRM_COLOR_FORMAT_YCBCR422 ;if ((di->color_formats & mask)) { -DRM_DEBUG_KMS ("Swapping display color format from YUV to RGB\n" ); +drm_dbg_kms (dp->drm_dev,"Swapping display color format from YUV to RGB\n" ); di->color_formats &= ~mask; di->color_formats |=DRM_COLOR_FORMAT_RGB444 ; di->bpc =8 ;@@ -201,17 +202,17 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,else val = dp->data->lcdsel_big; -DRM_DEV_DEBUG (dp->dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); +drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); ret =clk_prepare_enable (dp->grfclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable grfclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable grfclk %d\n" , ret);return ; } ret =regmap_write (dp->grf, dp->data->lcdsel_grf_reg, val);if (ret !=0 ) -DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);clk_disable_unprepare (dp->grfclk); }@@ -236,7 +237,7 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder, ret =rockchip_drm_wait_vact_end (crtc,PSR_WAIT_LINE_FLAG_TIMEOUT_MS );if (ret) -DRM_DEV_ERROR (dp->dev,"line flag irq timed out\n" ); +drm_err (dp->drm_dev,"line flag irq timed out\n" ); }static int
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-7@@ -277,7 +278,7 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) dp->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (dp->grf)) { -DRM_DEV_ERROR (dev,"failed to get rockchip,grf property\n" ); +dev_err (dev,"failed to get rockchip,grf property\n" );return PTR_ERR (dp->grf); }@@ -287,19 +288,19 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) }else if (PTR_ERR (dp->grfclk) == -EPROBE_DEFER ) {return -EPROBE_DEFER ; }else if (IS_ERR (dp->grfclk)) { -DRM_DEV_ERROR (dev,"failed to get grf clock\n" ); +dev_err (dev,"failed to get grf clock\n" );return PTR_ERR (dp->grfclk); } dp->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (dp->pclk)) { -DRM_DEV_ERROR (dev,"failed to get pclk property\n" ); +dev_err (dev,"failed to get pclk property\n" );return PTR_ERR (dp->pclk); } dp->rst =devm_reset_control_get (dev,"dp" );if (IS_ERR (dp->rst)) { -DRM_DEV_ERROR (dev,"failed to get dp reset control\n" ); +dev_err (dev,"failed to get dp reset control\n" );return PTR_ERR (dp->rst); }@@ -315,12 +316,12 @@ static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp) encoder->possible_crtcs =drm_of_find_possible_crtcs (drm_dev, dev->of_node); -DRM_DEBUG_KMS ("possible_crtcs = 0x%x\n" , encoder->possible_crtcs); +drm_dbg_kms (drm_dev,"possible_crtcs = 0x%x\n" , encoder->possible_crtcs); ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_TMDS );if (ret) { -DRM_ERROR ("failed to initialize encoder with drm\n" ); +drm_err (drm_dev,"failed to initialize encoder with drm\n" );return ret; }@@ -340,7 +341,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, ret =rockchip_dp_drm_create_encoder (dp);if (ret) { -DRM_ERROR ("failed to create drm encoder\n" ); +drm_err (drm_dev,"failed to create drm encoder\n" );return ret; }
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.34.1
Best regards,
Damon
Re: [PATCH v5 05/20] drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...()
Quoted 35 lines · Damon Ding
Hi Andy,
Quoted 23 lines · Andy Yan
Hi Damon,
Quoted 19 lines · Damon Ding
According to the comments in
include/drm/drm_print.h, the DRM_...() functions are deprecated in favor of drm_...() or dev_...() functions.Use drm_err()/drm_dbg_core()/drm_dbg_kms() instead of DRM_DEV_ERROR()/DRM_ERROR()/DRM_DEV_DEBUG()/DRM_DEBUG_KMS() after
rockchip_dp_bind()is called, and replaceDRM_DEV_ERROR()withdev_err()before calling it.Signed-off-by Damon Ding <[email protected]>---
.../gpu/drm/rockchip/analogix_dp-rockchip.c| 29 ++++++++++---------1 file changed, 15 insertions(+), 14 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0@@ -100,13 +100,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)Quoted 8 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 103
Quoted 4 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable pclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret);You just need to pass dp here:
drm_err(dp, "failed to enable pclk %d\n", ret);
Quoted 2 lines
I see. It is really better to pass dp instead of
dp->drm_dev. I will update all relevant logs in the next version.
No, this was bad review feedback. You're absolutely expected to pass struct drm_device to drm_err() and friends.
BR,
Jani.
Quoted 118 lines
Quoted 112 lines
Quoted 112 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-6return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to dp pre init %d\n" , ret); +drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }@@ -126,12 +126,13 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)static int rockchip_dp_get_modes (struct analogix_dp_plat_data *plat_data,struct drm_connector *connector) { +struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data);struct drm_display_info *di = &connector->display_info;/* VOP couldn't output YUV video format for eDP rightly */ u32 mask =DRM_COLOR_FORMAT_YCBCR444 |DRM_COLOR_FORMAT_YCBCR422 ;if ((di->color_formats & mask)) { -DRM_DEBUG_KMS ("Swapping display color format from YUV to RGB\n" ); +drm_dbg_kms (dp->drm_dev,"Swapping display color format from YUV to RGB\n" ); di->color_formats &= ~mask; di->color_formats |=DRM_COLOR_FORMAT_RGB444 ; di->bpc =8 ;@@ -201,17 +202,17 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,else val = dp->data->lcdsel_big; -DRM_DEV_DEBUG (dp->dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); +drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); ret =clk_prepare_enable (dp->grfclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable grfclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable grfclk %d\n" , ret);return ; } ret =regmap_write (dp->grf, dp->data->lcdsel_grf_reg, val);if (ret !=0 ) -DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);clk_disable_unprepare (dp->grfclk); }@@ -236,7 +237,7 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder, ret =rockchip_drm_wait_vact_end (crtc,PSR_WAIT_LINE_FLAG_TIMEOUT_MS );if (ret) -DRM_DEV_ERROR (dp->dev,"line flag irq timed out\n" ); +drm_err (dp->drm_dev,"line flag irq timed out\n" ); }static int
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-7@@ -277,7 +278,7 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) dp->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (dp->grf)) { -DRM_DEV_ERROR (dev,"failed to get rockchip,grf property\n" ); +dev_err (dev,"failed to get rockchip,grf property\n" );return PTR_ERR (dp->grf); }@@ -287,19 +288,19 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) }else if (PTR_ERR (dp->grfclk) == -EPROBE_DEFER ) {return -EPROBE_DEFER ; }else if (IS_ERR (dp->grfclk)) { -DRM_DEV_ERROR (dev,"failed to get grf clock\n" ); +dev_err (dev,"failed to get grf clock\n" );return PTR_ERR (dp->grfclk); } dp->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (dp->pclk)) { -DRM_DEV_ERROR (dev,"failed to get pclk property\n" ); +dev_err (dev,"failed to get pclk property\n" );return PTR_ERR (dp->pclk); } dp->rst =devm_reset_control_get (dev,"dp" );if (IS_ERR (dp->rst)) { -DRM_DEV_ERROR (dev,"failed to get dp reset control\n" ); +dev_err (dev,"failed to get dp reset control\n" );return PTR_ERR (dp->rst); }@@ -315,12 +316,12 @@ static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp) encoder->possible_crtcs =drm_of_find_possible_crtcs (drm_dev, dev->of_node); -DRM_DEBUG_KMS ("possible_crtcs = 0x%x\n" , encoder->possible_crtcs); +drm_dbg_kms (drm_dev,"possible_crtcs = 0x%x\n" , encoder->possible_crtcs); ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_TMDS );if (ret) { -DRM_ERROR ("failed to initialize encoder with drm\n" ); +drm_err (drm_dev,"failed to initialize encoder with drm\n" );return ret; }@@ -340,7 +341,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, ret =rockchip_dp_drm_create_encoder (dp);if (ret) { -DRM_ERROR ("failed to create drm encoder\n" ); +drm_err (drm_dev,"failed to create drm encoder\n" );return ret; }Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.34.1Best regards,
Damon
Signature · 1 line
Jani Nikula, Intel
Andy Yan
maintainerRe:Re: [PATCH v5 05/20] drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...()
Hi,
Quoted 36 lines · Jani Nikula
Quoted 35 lines · Damon Ding
Hi Andy,
Quoted 31 lines · Andy Yan
Hi Damon,
Quoted 18 lines · Damon Ding
According to the comments in
include/drm/drm_print.h, the DRM_...() functions are deprecated in favor of drm_...() or dev_...() functions.Use drm_err()/drm_dbg_core()/drm_dbg_kms() instead of DRM_DEV_ERROR()/DRM_ERROR()/DRM_DEV_DEBUG()/DRM_DEBUG_KMS() after
rockchip_dp_bind()is called, and replaceDRM_DEV_ERROR()withdev_err()before calling it.Signed-off-by Damon Ding <[email protected]>---
.../gpu/drm/rockchip/analogix_dp-rockchip.c| 29 ++++++++++---------1 file changed, 15 insertions(+), 14 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 103
Quoted 5 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1@@ -100,13 +100,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable pclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret);You just need to pass dp here:
drm_err(dp, "failed to enable pclk %d\n", ret);
Quoted 5 lines
Quoted 2 lines
I see. It is really better to pass dp instead of
dp->drm_dev. I will update all relevant logs in the next version.No, this was bad review feedback. You're absolutely expected to pass struct
drm_devicetodrm_err()and friends.
No, I didn't see how the drm_err macro and friends restrict/expect the passing of only the drm_device pointer. As for the platform device driver itself, we hope that when an error occurs, the log clearly indicates the specific device that the log corresponds to, rather than a generic drm_device.
The original code of this driver used the macro related to DRM_DEV_ERROR to do just that. And similar patches have been merged before
Please also refer to the discussion here.[0] [0]https://lore.kernel.org/linux-rockchip/[email protected]/T/#m54bd842be660031773834cedea6c73a5033ca973
Quoted 126 lines
BR,
Jani.Quoted 118 lines
Quoted 112 lines
Quoted 112 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-6return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to dp pre init %d\n" , ret); +drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }@@ -126,12 +126,13 @@ static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)static int rockchip_dp_get_modes (struct analogix_dp_plat_data *plat_data,struct drm_connector *connector) { +struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data);struct drm_display_info *di = &connector->display_info;/* VOP couldn't output YUV video format for eDP rightly */ u32 mask =DRM_COLOR_FORMAT_YCBCR444 |DRM_COLOR_FORMAT_YCBCR422 ;if ((di->color_formats & mask)) { -DRM_DEBUG_KMS ("Swapping display color format from YUV to RGB\n" ); +drm_dbg_kms (dp->drm_dev,"Swapping display color format from YUV to RGB\n" ); di->color_formats &= ~mask; di->color_formats |=DRM_COLOR_FORMAT_RGB444 ; di->bpc =8 ;@@ -201,17 +202,17 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,else val = dp->data->lcdsel_big; -DRM_DEV_DEBUG (dp->dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); +drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); ret =clk_prepare_enable (dp->grfclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable grfclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable grfclk %d\n" , ret);return ; } ret =regmap_write (dp->grf, dp->data->lcdsel_grf_reg, val);if (ret !=0 ) -DRM_DEV_ERROR (dp->dev,"Could not write to GRF: %d\n" , ret); +drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);clk_disable_unprepare (dp->grfclk); }@@ -236,7 +237,7 @@ static void rockchip_dp_drm_encoder_disable(struct drm_encoder *encoder, ret =rockchip_drm_wait_vact_end (crtc,PSR_WAIT_LINE_FLAG_TIMEOUT_MS );if (ret) -DRM_DEV_ERROR (dp->dev,"line flag irq timed out\n" ); +drm_err (dp->drm_dev,"line flag irq timed out\n" ); }static int
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +7
-7@@ -277,7 +278,7 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) dp->grf =syscon_regmap_lookup_by_phandle (np,"rockchip,grf" );if (IS_ERR (dp->grf)) { -DRM_DEV_ERROR (dev,"failed to get rockchip,grf property\n" ); +dev_err (dev,"failed to get rockchip,grf property\n" );return PTR_ERR (dp->grf); }@@ -287,19 +288,19 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp) }else if (PTR_ERR (dp->grfclk) == -EPROBE_DEFER ) {return -EPROBE_DEFER ; }else if (IS_ERR (dp->grfclk)) { -DRM_DEV_ERROR (dev,"failed to get grf clock\n" ); +dev_err (dev,"failed to get grf clock\n" );return PTR_ERR (dp->grfclk); } dp->pclk =devm_clk_get (dev,"pclk" );if (IS_ERR (dp->pclk)) { -DRM_DEV_ERROR (dev,"failed to get pclk property\n" ); +dev_err (dev,"failed to get pclk property\n" );return PTR_ERR (dp->pclk); } dp->rst =devm_reset_control_get (dev,"dp" );if (IS_ERR (dp->rst)) { -DRM_DEV_ERROR (dev,"failed to get dp reset control\n" ); +dev_err (dev,"failed to get dp reset control\n" );return PTR_ERR (dp->rst); }@@ -315,12 +316,12 @@ static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp) encoder->possible_crtcs =drm_of_find_possible_crtcs (drm_dev, dev->of_node); -DRM_DEBUG_KMS ("possible_crtcs = 0x%x\n" , encoder->possible_crtcs); +drm_dbg_kms (drm_dev,"possible_crtcs = 0x%x\n" , encoder->possible_crtcs); ret =drm_simple_encoder_init (drm_dev, encoder,DRM_MODE_ENCODER_TMDS );if (ret) { -DRM_ERROR ("failed to initialize encoder with drm\n" ); +drm_err (drm_dev,"failed to initialize encoder with drm\n" );return ret; }@@ -340,7 +341,7 @@ static int rockchip_dp_bind(struct device *dev, struct device *master, ret =rockchip_dp_drm_create_encoder (dp);if (ret) { -DRM_ERROR ("failed to create drm encoder\n" ); +drm_err (drm_dev,"failed to create drm encoder\n" );return ret; }Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.34.1Best regards,
DamonSignature · 1 line
Jani Nikula, Intel
Re: [PATCH v5 05/20] drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...()
Quoted 45 lines · Andy Yan
Hi,
Quoted 36 lines · Jani Nikula
Quoted 35 lines · Damon Ding
Hi Andy,
Quoted 31 lines · Andy Yan
Hi Damon,
Quoted 18 lines · Damon Ding
According to the comments in
include/drm/drm_print.h, the DRM_...() functions are deprecated in favor of drm_...() or dev_...() functions.Use drm_err()/drm_dbg_core()/drm_dbg_kms() instead of DRM_DEV_ERROR()/DRM_ERROR()/DRM_DEV_DEBUG()/DRM_DEBUG_KMS() after
rockchip_dp_bind()is called, and replaceDRM_DEV_ERROR()withdev_err()before calling it.Signed-off-by Damon Ding <[email protected]>---
.../gpu/drm/rockchip/analogix_dp-rockchip.c| 29 ++++++++++---------1 file changed, 15 insertions(+), 14 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 103
Quoted 5 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1@@ -100,13 +100,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -DRM_DEV_ERROR (dp->dev,"failed to enable pclk %d\n" , ret); +drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret);You just need to pass dp here:
drm_err(dp, "failed to enable pclk %d\n", ret);Quoted 5 lines
Quoted 2 lines
I see. It is really better to pass dp instead of
dp->drm_dev. I will update all relevant logs in the next version.No, this was bad review feedback. You're absolutely expected to pass struct
drm_devicetodrm_err()and friends.
Quoted 8 lines
No, I didn't see how the
drm_errmacro and friends restrict/expect the passing of only thedrm_devicepointer. As for the platform device driver itself, we hope that when an error occurs, the log clearly indicates the specific device that the log corresponds to, rather than a genericdrm_device.
The original code of this driver used the macro related toDRM_DEV_ERRORto do just that. And similar patches have been merged beforePlease also refer to the discussion here.[0] [0]https://lore.kernel.org/linux-rockchip/[email protected]/T/#m54bd842be660031773834cedea6c73a5033ca973
Reviewer's mistake (mine). I assumed that you wanted to pass drm device.
Quoted 2 lines
Signature · 2 lines
With best wishes Dmitry
PATCH v5 6/20 drm/rockchip: analogix_dp: Use formalized struct definition for grf field
In reply to Damon DingThe formalized struct definition will makes grf field operations more concise and easier to extend.
---
Changes in v2:
- Initialize struct rockchip_dp_chip_data rk3399_edp/rk3288_dp in order of its members
--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 77 +++++++++++-------- 1 file changed, 45 insertions(+), 32 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +45 -32
@@ -32,26 +32,29 @@#include "rockchip_drm_drv.h" -#define RK3288_GRF_SOC_CON6 0x25c -#define RK3288_EDP_LCDC_SEL BIT(5) -#define RK3399_GRF_SOC_CON20 0x6250 -#define RK3399_EDP_LCDC_SEL BIT(5) - -#define HIWORD_UPDATE (val, mask) (val | (mask) << 16) -#define PSR_WAIT_LINE_FLAG_TIMEOUT_MS 100 +#define GRF_REG_FIELD (_reg, _lsb, _msb) { \ + .reg = _reg, \ + .lsb = _lsb, \ + .msb = _msb, \ + .valid = true, \ + } + +struct rockchip_grf_reg_field { +u32 reg; +u32 lsb; +u32 msb; +bool valid; +}; +/** * struct rockchip_dp_chip_data - splite the grf setting of kind of chips -* @lcdsel_grf_reg: grf register offset of lcdc select -* @lcdsel_big: reg value of selecting vop big for eDP -* @lcdsel_lit: reg value of selecting vop little for eDP +* @lcdc_sel: grf register field of lcdc_sel * @chip_type: specific chip type */ struct rockchip_dp_chip_data { -u32 lcdsel_grf_reg; -u32 lcdsel_big; -u32 lcdsel_lit; +const struct rockchip_grf_reg_field lcdc_sel;u32 chip_type; };
@@ -84,6 +87,26 @@ static struct rockchip_dp_device *pdata_encoder_to_dp(struct analogix_dp_plat_da return container_of(plat_data, struct rockchip_dp_device, plat_data); } +static int rockchip_grf_write (struct regmap *grf,u32 reg,u32 mask,u32 val) +{ +return regmap_write (grf, reg, (mask <<16 ) | (val & mask)); +} + +static int rockchip_grf_field_write (struct regmap *grf, +const struct rockchip_grf_reg_field *field, +u32 val) +{ +u32 mask; + +if (!field->valid) +return 0 ; + + mask =GENMASK (field->msb, field->lsb); + val <<= field->lsb; + +return rockchip_grf_write (grf, field->reg, mask, val); +} +static int rockchip_dp_pre_init (struct rockchip_dp_device *dp) {reset_control_assert (dp->rst);
@@ -182,7 +205,6 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;int ret; -u32 val; crtc =rockchip_dp_drm_get_new_crtc (encoder, state);if (!crtc)
@@ -193,24 +215,19 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,if (old_crtc_state && old_crtc_state->self_refresh_active)return ; - ret =drm_of_encoder_active_endpoint_id (dp->dev->of_node, encoder); -if (ret <0 ) -return ; - -if (ret) - val = dp->data->lcdsel_lit; -else - val = dp->data->lcdsel_big; - -drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); - ret =clk_prepare_enable (dp->grfclk);if (ret <0 ) {drm_err (dp->drm_dev,"failed to enable grfclk %d\n" , ret);return ; } - ret =regmap_write (dp->grf, dp->data->lcdsel_grf_reg, val); + ret =drm_of_encoder_active_endpoint_id (dp->dev->of_node, encoder); +if (ret <0 ) +return ; + +drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); + + ret =rockchip_grf_field_write (dp->grf, &dp->data->lcdc_sel, ret);if (ret !=0 )drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);
@@ -449,16 +466,12 @@ static DEFINE_RUNTIME_DEV_PM_OPS(rockchip_dp_pm_ops, rockchip_dp_suspend, rockchip_dp_resume, NULL);static const struct rockchip_dp_chip_data rk3399_edp = { - .lcdsel_grf_reg =RK3399_GRF_SOC_CON20 , - .lcdsel_big =HIWORD_UPDATE (0 ,RK3399_EDP_LCDC_SEL ), - .lcdsel_lit =HIWORD_UPDATE (RK3399_EDP_LCDC_SEL ,RK3399_EDP_LCDC_SEL ), + .lcdc_sel =GRF_REG_FIELD (0x6250 ,5 ,5 ), .chip_type =RK3399_EDP , };static const struct rockchip_dp_chip_data rk3288_dp = { - .lcdsel_grf_reg =RK3288_GRF_SOC_CON6 , - .lcdsel_big =HIWORD_UPDATE (0 ,RK3288_EDP_LCDC_SEL ), - .lcdsel_lit =HIWORD_UPDATE (RK3288_EDP_LCDC_SEL ,RK3288_EDP_LCDC_SEL ), + .lcdc_sel =GRF_REG_FIELD (0x025c ,5 ,5 ), .chip_type =RK3288_DP , };
Signature · 1 line
2.34.1
PATCH v5 7/20 drm/rockchip: analogix_dp: Expand device data to support multiple edp display
In reply to Damon DingThere are two main modifications: one is expanding struct rockchip_dp_chip_data to an array, and the other is adding &rockchip_dp_chip_data.reg to separate different edp devices.
--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +34 -7
@@ -56,6 +56,7 @@ struct rockchip_grf_reg_field {struct rockchip_dp_chip_data {const struct rockchip_grf_reg_field lcdc_sel;u32 chip_type; +u32 reg; };struct rockchip_dp_device {
@@ -397,6 +398,8 @@ static int rockchip_dp_probe(struct platform_device *pdev)const struct rockchip_dp_chip_data *dp_data;struct drm_panel *panel =NULL ;struct rockchip_dp_device *dp; +struct resource *res; +int i;int ret; dp_data =of_device_get_match_data (dev);
@@ -411,9 +414,25 @@ static int rockchip_dp_probe(struct platform_device *pdev)if (!dp)return -ENOMEM ; + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + + i =0 ; +while (dp_data[i].reg) { +if (dp_data[i].reg == res->start) { + dp->data = &dp_data[i]; +break ; + } + + i++; + } + +if (!dp->data) { +dev_err (dev,"no chip-data for %s node\n" , dev->of_node->name); +return -ENODEV ; + } + dp->dev = dev; dp->adp =ERR_PTR (-ENODEV ); - dp->data = dp_data; dp->plat_data.panel = panel; dp->plat_data.dev_type = dp->data->chip_type; dp->plat_data.power_on = rockchip_dp_poweron;
@@ -465,14 +484,22 @@ static int rockchip_dp_resume(struct device *dev) static DEFINE_RUNTIME_DEV_PM_OPS(rockchip_dp_pm_ops, rockchip_dp_suspend, rockchip_dp_resume, NULL); -static const struct rockchip_dp_chip_data rk3399_edp = { - .lcdc_sel =GRF_REG_FIELD (0x6250 ,5 ,5 ), - .chip_type =RK3399_EDP , +static const struct rockchip_dp_chip_data rk3399_edp[] = { + { + .lcdc_sel =GRF_REG_FIELD (0x6250 ,5 ,5 ), + .chip_type =RK3399_EDP , + .reg =0xff970000 , + }, + {/* sentinel */ } }; -static const struct rockchip_dp_chip_data rk3288_dp = { - .lcdc_sel =GRF_REG_FIELD (0x025c ,5 ,5 ), - .chip_type =RK3288_DP , +static const struct rockchip_dp_chip_data rk3288_dp[] = { + { + .lcdc_sel =GRF_REG_FIELD (0x025c ,5 ,5 ), + .chip_type =RK3288_DP , + .reg =0xff970000 , + }, + {/* sentinel */ } };static const struct of_device_id rockchip_dp_dt_ids[] = {
Signature · 1 line
2.34.1
kernel test robot
build botRe: [PATCH v5 07/20] drm/rockchip: analogix_dp: Expand device data to support multiple edp display
kernel test robot noticed the following build warnings:
Hi Damon,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rockchip/for-next]
[also build test WARNING on robh/for-next drm/drm-next drm-exynos/exynos-drm-next linus/master v6.13-rc6 next-20250109] [cannot apply to drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Damon-Ding/phy-phy-rockchip-samsung-hdptx-Swap-the-definitions-of-LCPLL_REF-and-ROPLL_REF/20250109-113114 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next patch link: https://lore.kernel.org/r/20250109032725.1102465-8-damon.ding%40rock-chips.com patch subject: [PATCH v5 07/20] drm/rockchip: analogix_dp: Expand device data to support multiple edp display config: hexagon-randconfig-002-20250110 (https://download.01.org/0day-ci/archive/20250110/[email protected]/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project f5cd181ffbb7cb61d582fe130d46580d5969d47a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250110/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:60: warning: Function parameter or struct member 'reg' not described in 'rockchip_dp_chip_data'
vim +60 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
8f0ac5c4835291 Yakir Yang 2016-07-24 50
d9c900b0270a18 Yakir Yang 2016-06-29 51 /**
d9c900b0270a18 Yakir Yang 2016-06-29 52 * struct rockchip_dp_chip_data - splite the grf setting of kind of chips
bbb8c3102ebf3b Damon Ding 2025-01-09 53 * @lcdc_sel: grf register field of lcdc_sel
d9c900b0270a18 Yakir Yang 2016-06-29 54 * @chip_type: specific chip type
d9c900b0270a18 Yakir Yang 2016-06-29 55 */
d9c900b0270a18 Yakir Yang 2016-06-29 56 struct rockchip_dp_chip_data {
bbb8c3102ebf3b Damon Ding 2025-01-09 57 const struct rockchip_grf_reg_field lcdc_sel;
d9c900b0270a18 Yakir Yang 2016-06-29 58 u32 chip_type;
26f1f37804f0d4 Damon Ding 2025-01-09 59 u32 reg;d9c900b0270a18 Yakir Yang 2016-06-29 @60 };9e32e16e9e989f Yakir Yang 2016-03-29 61
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v5 8/20 drm/bridge: analogix_dp: Add support for phy configuration.
In reply to Damon DingAdd support to configurate link rate, lane count, voltage swing and pre-emphasis with phy_configure(). It is helpful in application scenarios where analogix controller is mixed with the phy of other vendors.
---
Changes in v2:
- remove needless assignments for phy_configure()
- remove unnecessary changes for phy_power_on()/phy_power_off()
Changes in v4:
- remove unnecessary &phy_configure_opts_dp.lanes assignments in analogix_dp_set_link_bandwidth()
- remove needless &phy_configure_opts_dp.lanes and &phy_configure_opts_dp.link_rate assignments in analogix_dp_set_lane_link_training()
Changes in v5:
- include <drm/drm_print.h> for dev_err()
- use drm_err() instead of dev_err()
--- .../drm/bridge/analogix/analogix_dp_core.c | 1 + .../drm/bridge/analogix/analogix_dp_core.h | 1 + .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 52 +++++++++++++++++++ 3 files changed, 54 insertions(+)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 -0
@@ -1692,6 +1692,7 @@ int analogix_dp_resume(struct analogix_dp_device *dp)if (dp->plat_data->power_on) dp->plat_data->power_on (dp->plat_data); +phy_set_mode (dp->phy,PHY_MODE_DP );phy_power_on (dp->phy);analogix_dp_init_dp (dp);
drivers/gpu/drm/bridge/analogix/analogix_dp_core.h +1 -0
@@ -11,6 +11,7 @@#include <drm/display/drm_dp_helper.h> #include <drm/drm_crtc.h> +#include <drm/drm_print.h> #define DP_TIMEOUT_LOOP_COUNT 100#define MAX_CR_LOOP 5
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +52 -0
87 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v5 08/20] drm/bridge: analogix_dp: Add support for phy configuration.
Quoted 19 lines · Damon Ding
Add support to configurate link rate, lane count, voltage swing and pre-emphasis with
phy_configure(). It is helpful in application scenarios where analogix controller is mixed with the phy of other vendors.Signed-off-by Damon Ding <[email protected]>---
Changes in v2:
- remove needless assignments forphy_configure()
- remove unnecessary changes for phy_power_on()/phy_power_off()Changes in v4:
- remove unnecessary &phy_configure_opts_dp.lanes assignments inanalogix_dp_set_link_bandwidth()
- remove needless &phy_configure_opts_dp.lanes and &phy_configure_opts_dp.link_rate assignments inanalogix_dp_set_lane_link_training()
Quoted 9 lines
Changes in v5:
- include <drm/drm_print.h> fordev_err()
- usedrm_err()instead ofdev_err()--- .../drm/bridge/analogix/analogix_dp_core.c | 1 + .../drm/bridge/analogix/analogix_dp_core.h | 1 + .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 52 +++++++++++++++++++ 3 files changed, 54 insertions(+)
Signature · 2 lines
With best wishes Dmitry
PATCH v5 9/20 dt-bindings: display: rockchip: analogix-dp: Add support to get panel from the DP AUX bus
In reply to Damon DingAccording to Documentation/devicetree/bindings/display/dp-aux-bus.yaml, it is a good way to get panel through the DP AUX bus.
---
Changes in v4:
- Move the dt-bindings commit before related driver commits
Changes in v5:
- Remove the unexpected change logs in commit message
--- .../bindings/display/rockchip/rockchip,analogix-dp.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +3 -0
@@ -41,6 +41,9 @@ properties: description: This SoC makes use of GRF regs. + aux-bus: + $ref: /schemas/display/dp-aux-bus.yaml# + required: - compatible - clocks
Signature · 1 line
2.34.1
PATCH v5 10/20 drm/bridge: analogix_dp: support to get &analogix_dp_device.plat_data and &analogix_dp_device.aux
In reply to Damon DingAdd two new functions: one to find &analogix_dp_device.plat_data via &drm_dp_aux, and the other to get &analogix_dp_device.aux. Both of them serve for the function of getting panel from DP AUX bus, which is why they are included in a single commit.
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 14 ++++++++++++++ include/drm/bridge/analogix_dp.h | 4 ++++ 2 files changed, 18 insertions(+)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +14 -0
@@ -1794,6 +1794,20 @@ int analogix_dp_stop_crc(struct drm_connector *connector) }EXPORT_SYMBOL_GPL (analogix_dp_stop_crc); +struct analogix_dp_plat_data *analogix_dp_aux_to_plat_data (struct drm_dp_aux *aux) +{ +struct analogix_dp_device *dp =to_dp (aux); + +return dp->plat_data; +} +EXPORT_SYMBOL_GPL (analogix_dp_aux_to_plat_data); + +struct drm_dp_aux *analogix_dp_get_aux (struct analogix_dp_device *dp) +{ +return &dp->aux; +} +EXPORT_SYMBOL_GPL (analogix_dp_get_aux); +MODULE_AUTHOR ("Jingoo Han <[email protected]>" );MODULE_DESCRIPTION ("Analogix DP Core Driver" );MODULE_LICENSE ("GPL v2" );
include/drm/bridge/analogix_dp.h +4 -0
@@ -7,6 +7,7 @@#ifndef _ANALOGIX_DP_H_#define _ANALOGIX_DP_H_ +#include <drm/display/drm_dp_aux_bus.h> #include <drm/drm_crtc.h> struct analogix_dp_device ;
@@ -48,4 +49,7 @@ void analogix_dp_unbind(struct analogix_dp_device *dp);int analogix_dp_start_crc (struct drm_connector *connector);int analogix_dp_stop_crc (struct drm_connector *connector); +struct analogix_dp_plat_data *analogix_dp_aux_to_plat_data (struct drm_dp_aux *aux); +struct drm_dp_aux *analogix_dp_get_aux (struct analogix_dp_device *dp); +#endif /* _ANALOGIX_DP_H_ */
Signature · 1 line
2.34.1
Re: [PATCH v5 10/20] drm/bridge: analogix_dp: support to get &analogix_dp_device.plat_data and &analogix_dp_device.aux
Quoted 11 lines · Damon Ding
Add two new functions: one to find &analogix_dp_device.plat_data via
&drm_dp_aux, and the other to get &analogix_dp_device.aux. Both of them serve for the function of getting panel from DP AUX bus, which is why they are included in a single commit.Signed-off-by Damon Ding <[email protected]>--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 14 ++++++++++++++ include/drm/bridge/analogix_dp.h | 4 ++++ 2 files changed, 18 insertions(+)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 10/20] drm/bridge: analogix_dp: support to get &analogix_dp_device.plat_data and &analogix_dp_device.aux
In reply to Damon DingQuoted 41 lines · Damon Ding
Add two new functions: one to find &analogix_dp_device.plat_data via
&drm_dp_aux, and the other to get &analogix_dp_device.aux. Both of them serve for the function of getting panel from DP AUX bus, which is why they are included in a single commit.Signed-off-by Damon Ding <[email protected]>--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 14 ++++++++++++++ include/drm/bridge/analogix_dp.h | 4 ++++ 2 files changed, 18 insertions(+)drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +14
-0@@ -1794,6 +1794,20 @@ int analogix_dp_stop_crc(struct drm_connector *connector) }EXPORT_SYMBOL_GPL (analogix_dp_stop_crc); +struct analogix_dp_plat_data *analogix_dp_aux_to_plat_data (struct drm_dp_aux *aux) +{ +struct analogix_dp_device *dp =to_dp (aux); + +return dp->plat_data; +} +EXPORT_SYMBOL_GPL (analogix_dp_aux_to_plat_data); + +struct drm_dp_aux *analogix_dp_get_aux (struct analogix_dp_device *dp) +{ +return &dp->aux; +} +EXPORT_SYMBOL_GPL (analogix_dp_get_aux); +MODULE_AUTHOR ("Jingoo Han <[email protected]>" );MODULE_DESCRIPTION ("Analogix DP Core Driver" );MODULE_LICENSE ("GPL v2" );include/drm/bridge/analogix_dp.h +0
-0
include/drm/bridge/analogix_dp.h line 10
Quoted 4 lines
include/drm/bridge/analogix_dp.h +1
-0@@ -7,6 +7,7 @@#ifndef _ANALOGIX_DP_H_#define _ANALOGIX_DP_H_ +#include <drm/display/drm_dp_aux_bus.h>
Nit: it should be enough to fordward-declare struct drm_dp_aux here.
Nevertheless:
Quoted 14 lines
include/drm/bridge/analogix_dp.h +3
-0#include <drm/drm_crtc.h> struct analogix_dp_device ;@@ -48,4 +49,7 @@ void analogix_dp_unbind(struct analogix_dp_device *dp);int analogix_dp_start_crc (struct drm_connector *connector);int analogix_dp_stop_crc (struct drm_connector *connector); +struct analogix_dp_plat_data *analogix_dp_aux_to_plat_data (struct drm_dp_aux *aux); +struct drm_dp_aux *analogix_dp_get_aux (struct analogix_dp_device *dp); +#endif /* _ANALOGIX_DP_H_ */ Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
PATCH v5 11/20 drm/bridge: analogix_dp: Add support to get panel from the DP AUX bus
In reply to Damon DingThe main modification is moving the DP AUX initialization from function analogix_dp_bind() to analogix_dp_probe(). In order to get the EDID of eDP panel during probing, it is also needed to advance PM operaions to ensure that eDP controller and phy are prepared for AUX transmission.
---
Changes in v4:
- Use done_probing() to call drm_of_find_panel_or_bridge() and component_add() when getting panel from the DP AUX bus
Changes in v5:
- Advance PM operations to make eDP AUX work well
--- .../drm/bridge/analogix/analogix_dp_core.c | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +34 -28
@@ -1548,6 +1548,18 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux,return ret; } +static void analogix_dp_runtime_disable (void *data) +{ +struct analogix_dp_device *dp = (struct analogix_dp_device *)data; + +if (IS_ENABLED (CONFIG_PM )) { +pm_runtime_dont_use_autosuspend (dp->dev); +pm_runtime_disable (dp->dev); + }else { +analogix_dp_suspend (dp); + } +} +struct analogix_dp_device *analogix_dp_probe (struct device *dev,struct analogix_dp_plat_data *plat_data) {
@@ -1658,8 +1670,29 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) }disable_irq (dp->irq); + dp->aux.name ="DP-AUX" ; + dp->aux.transfer = analogix_dpaux_transfer; + dp->aux.dev = dp->dev; +drm_dp_aux_init (&dp->aux); + +if (IS_ENABLED (CONFIG_PM )) { +pm_runtime_use_autosuspend (dp->dev); +pm_runtime_set_autosuspend_delay (dp->dev,100 ); +pm_runtime_enable (dp->dev); + }else { + ret =analogix_dp_resume (dp); +if (ret) + goto err_disable_clk; + } + + ret =devm_add_action_or_reset (dev, analogix_dp_runtime_disable, dp); +if (ret) + goto err_disable_pm_runtime; +return dp; +err_disable_pm_runtime: +analogix_dp_runtime_disable ((void *)dp); err_disable_clk:clk_disable_unprepare (dp->clock);return ERR_PTR (ret);
@@ -1708,25 +1741,12 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) dp->drm_dev = drm_dev; dp->encoder = dp->plat_data->encoder; -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_use_autosuspend (dp->dev); -pm_runtime_set_autosuspend_delay (dp->dev,100 ); -pm_runtime_enable (dp->dev); - }else { - ret =analogix_dp_resume (dp); -if (ret) -return ret; - } - - dp->aux.name ="DP-AUX" ; - dp->aux.transfer = analogix_dpaux_transfer; - dp->aux.dev = dp->dev; dp->aux.drm_dev = drm_dev; ret =drm_dp_aux_register (&dp->aux);if (ret) {DRM_ERROR ("failed to register AUX (%d)\n" , ret); - goto err_disable_pm_runtime; +return ret; } ret =analogix_dp_create_bridge (drm_dev, dp);
@@ -1739,13 +1759,6 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) err_unregister_aux:drm_dp_aux_unregister (&dp->aux); -err_disable_pm_runtime: -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_dont_use_autosuspend (dp->dev); -pm_runtime_disable (dp->dev); - }else { -analogix_dp_suspend (dp); - }return ret; }
@@ -1762,13 +1775,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp) }drm_dp_aux_unregister (&dp->aux); - -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_dont_use_autosuspend (dp->dev); -pm_runtime_disable (dp->dev); - }else { -analogix_dp_suspend (dp); - } }EXPORT_SYMBOL_GPL (analogix_dp_unbind);
Signature · 1 line
2.34.1
Re: [PATCH v5 11/20] drm/bridge: analogix_dp: Add support to get panel from the DP AUX bus
Quoted 52 lines · Damon Ding
The main modification is moving the DP AUX initialization from function
analogix_dp_bind()toanalogix_dp_probe(). In order to get the EDID of eDP panel during probing, it is also needed to advance PM operaions to ensure that eDP controller and phy are prepared for AUX transmission.Signed-off-by Damon Ding <[email protected]>---
Changes in v4:
- Usedone_probing()to calldrm_of_find_panel_or_bridge()andcomponent_add()when getting panel from the DP AUX busChanges in v5:
- Advance PM operations to make eDP AUX work well--- .../drm/bridge/analogix/analogix_dp_core.c | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +18
-0@@ -1548,6 +1548,18 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux,return ret; } +static void analogix_dp_runtime_disable (void *data) +{ +struct analogix_dp_device *dp = (struct analogix_dp_device *)data; + +if (IS_ENABLED (CONFIG_PM )) { +pm_runtime_dont_use_autosuspend (dp->dev); +pm_runtime_disable (dp->dev); + }else { +analogix_dp_suspend (dp); + } +} +struct analogix_dp_device *analogix_dp_probe (struct device *dev,struct analogix_dp_plat_data *plat_data) {@@ -1658,8 +1670,29 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) }disable_irq (dp->irq); + dp->aux.name ="DP-AUX" ; + dp->aux.transfer = analogix_dpaux_transfer; + dp->aux.dev = dp->dev; +drm_dp_aux_init (&dp->aux); + +if (IS_ENABLED (CONFIG_PM )) {
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) · line 1688
Quoted 10 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +10
-0+pm_runtime_use_autosuspend (dp->dev); +pm_runtime_set_autosuspend_delay (dp->dev,100 ); +pm_runtime_enable (dp->dev); + }else { + ret =analogix_dp_resume (dp); +if (ret) + goto err_disable_clk; + } + + ret =devm_add_action_or_reset (dev, analogix_dp_runtime_disable, dp);
This looks like a local version of devm_pm_runtime_enable()
Quoted 68 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +6
-28+if (ret) + goto err_disable_pm_runtime; +return dp; +err_disable_pm_runtime: +analogix_dp_runtime_disable ((void *)dp); err_disable_clk:clk_disable_unprepare (dp->clock);return ERR_PTR (ret);@@ -1708,25 +1741,12 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) dp->drm_dev = drm_dev; dp->encoder = dp->plat_data->encoder; -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_use_autosuspend (dp->dev); -pm_runtime_set_autosuspend_delay (dp->dev,100 ); -pm_runtime_enable (dp->dev); - }else { - ret =analogix_dp_resume (dp); -if (ret) -return ret; - } - - dp->aux.name ="DP-AUX" ; - dp->aux.transfer = analogix_dpaux_transfer; - dp->aux.dev = dp->dev; dp->aux.drm_dev = drm_dev; ret =drm_dp_aux_register (&dp->aux);if (ret) {DRM_ERROR ("failed to register AUX (%d)\n" , ret); - goto err_disable_pm_runtime; +return ret; } ret =analogix_dp_create_bridge (drm_dev, dp);@@ -1739,13 +1759,6 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) err_unregister_aux:drm_dp_aux_unregister (&dp->aux); -err_disable_pm_runtime: -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_dont_use_autosuspend (dp->dev); -pm_runtime_disable (dp->dev); - }else { -analogix_dp_suspend (dp); - }return ret; }@@ -1762,13 +1775,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp) }drm_dp_aux_unregister (&dp->aux); - -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_dont_use_autosuspend (dp->dev); -pm_runtime_disable (dp->dev); - }else { -analogix_dp_suspend (dp); - } }EXPORT_SYMBOL_GPL (analogix_dp_unbind);Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 11/20] drm/bridge: analogix_dp: Add support to get panel from the DP AUX bus
Hi Dmitry,
Quoted 57 lines · Dmitry Baryshkov
Quoted 56 lines · Damon Ding
The main modification is moving the DP AUX initialization from function
analogix_dp_bind()toanalogix_dp_probe(). In order to get the EDID of eDP panel during probing, it is also needed to advance PM operaions to ensure that eDP controller and phy are prepared for AUX transmission.Signed-off-by Damon Ding <[email protected]>---
Changes in v4:
- Usedone_probing()to calldrm_of_find_panel_or_bridge()andcomponent_add()when getting panel from the DP AUX busChanges in v5:
- Advance PM operations to make eDP AUX work well--- .../drm/bridge/analogix/analogix_dp_core.c | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-)drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +22
-0@@ -1548,6 +1548,18 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux,return ret; } +static void analogix_dp_runtime_disable (void *data) +{ +struct analogix_dp_device *dp = (struct analogix_dp_device *)data; + +if (IS_ENABLED (CONFIG_PM )) { +pm_runtime_dont_use_autosuspend (dp->dev); +pm_runtime_disable (dp->dev); + }else { +analogix_dp_suspend (dp); + } +} +struct analogix_dp_device *analogix_dp_probe (struct device *dev,struct analogix_dp_plat_data *plat_data) {@@ -1658,8 +1670,29 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) }disable_irq (dp->irq); + dp->aux.name ="DP-AUX" ; + dp->aux.transfer = analogix_dpaux_transfer; + dp->aux.dev = dp->dev; +drm_dp_aux_init (&dp->aux); + +if (IS_ENABLED (CONFIG_PM )) { +pm_runtime_use_autosuspend (dp->dev); +pm_runtime_set_autosuspend_delay (dp->dev,100 ); +pm_runtime_enable (dp->dev); + }else {
Quoted 9 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) · line 1688
Quoted 6 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +6
-0+ ret =analogix_dp_resume (dp); +if (ret) + goto err_disable_clk; + } + + ret =devm_add_action_or_reset (dev, analogix_dp_runtime_disable, dp);This looks like a local version of
devm_pm_runtime_enable()
Indeed, it is better to use devm_pm_runtime_enable() instead.
Quoted 65 lines
Quoted 65 lines
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +6
-28+if (ret) + goto err_disable_pm_runtime; +return dp; +err_disable_pm_runtime: +analogix_dp_runtime_disable ((void *)dp); err_disable_clk:clk_disable_unprepare (dp->clock);return ERR_PTR (ret);@@ -1708,25 +1741,12 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) dp->drm_dev = drm_dev; dp->encoder = dp->plat_data->encoder; -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_use_autosuspend (dp->dev); -pm_runtime_set_autosuspend_delay (dp->dev,100 ); -pm_runtime_enable (dp->dev); - }else { - ret =analogix_dp_resume (dp); -if (ret) -return ret; - } - - dp->aux.name ="DP-AUX" ; - dp->aux.transfer = analogix_dpaux_transfer; - dp->aux.dev = dp->dev; dp->aux.drm_dev = drm_dev; ret =drm_dp_aux_register (&dp->aux);if (ret) {DRM_ERROR ("failed to register AUX (%d)\n" , ret); - goto err_disable_pm_runtime; +return ret; } ret =analogix_dp_create_bridge (drm_dev, dp);@@ -1739,13 +1759,6 @@ int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev) err_unregister_aux:drm_dp_aux_unregister (&dp->aux); -err_disable_pm_runtime: -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_dont_use_autosuspend (dp->dev); -pm_runtime_disable (dp->dev); - }else { -analogix_dp_suspend (dp); - }return ret; }@@ -1762,13 +1775,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp) }drm_dp_aux_unregister (&dp->aux); - -if (IS_ENABLED (CONFIG_PM )) { -pm_runtime_dont_use_autosuspend (dp->dev); -pm_runtime_disable (dp->dev); - }else { -analogix_dp_suspend (dp); - } }EXPORT_SYMBOL_GPL (analogix_dp_unbind);
Quoted 4 lines
Quoted 3 lines
Signature · 1 line
2.34.1
Best regards,
Damon
PATCH v5 12/20 drm/rockchip: analogix_dp: Add support to get panel from the DP AUX bus
In reply to Damon DingMove drm_of_find_panel_or_bridge() a little later and combine it with component_add() into a new function rockchip_dp_link_panel(). The function will serve as done_probing() callback of devm_of_dp_aux_populate_bus(), aiding to support for obtaining the eDP panel via the DP AUX bus.
If failed to get the panel from the DP AUX bus, it will then try the other way to get panel information through the platform bus.
In addition, use dev_err() instead of drm_err() in rockchip_dp_poweron() , which will be called before rockchip_dp_bind().
---
Changes in v4:
- Use done_probing() to call drm_of_find_panel_or_bridge() and component_add() when getting panel from the DP AUX bus
Changes in v5:
- Use the functions exported by the Analogix side to get the pointers of struct analogix_dp_plat_data and struct drm_dp_aux.
- Use dev_err() instead of drm_err() in rockchip_dp_poweron().
--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +30 -11
@@ -124,13 +124,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret); +dev_err (dp->dev,"failed to enable pclk %d\n" , ret);return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret); +dev_err (dp->dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }
@@ -392,11 +392,27 @@ static const struct component_ops rockchip_dp_component_ops = { .unbind = rockchip_dp_unbind, }; +static int rockchip_dp_link_panel (struct drm_dp_aux *aux) +{ +struct analogix_dp_plat_data *plat_data =analogix_dp_aux_to_plat_data (aux); +struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data); +int ret; + + ret =drm_of_find_panel_or_bridge (dp->dev->of_node,1 ,0 , &plat_data->panel,NULL ); +if (ret) +return ret; + + ret =component_add (dp->dev, &rockchip_dp_component_ops); +if (ret) +return ret; + +return ret; +} +static int rockchip_dp_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;const struct rockchip_dp_chip_data *dp_data; -struct drm_panel *panel =NULL ;struct rockchip_dp_device *dp;struct resource *res;int i;
@@ -406,10 +422,6 @@ static int rockchip_dp_probe(struct platform_device *pdev)if (!dp_data)return -ENODEV ; - ret =drm_of_find_panel_or_bridge (dev->of_node,1 ,0 , &panel,NULL ); -if (ret <0 ) -return ret; - dp =devm_kzalloc (dev,sizeof (*dp),GFP_KERNEL );if (!dp)return -ENOMEM ;
@@ -433,7 +445,6 @@ static int rockchip_dp_probe(struct platform_device *pdev) dp->dev = dev; dp->adp =ERR_PTR (-ENODEV ); - dp->plat_data.panel = panel; dp->plat_data.dev_type = dp->data->chip_type; dp->plat_data.power_on = rockchip_dp_poweron; dp->plat_data.power_off = rockchip_dp_powerdown;
@@ -449,9 +460,17 @@ static int rockchip_dp_probe(struct platform_device *pdev)if (IS_ERR (dp->adp))return PTR_ERR (dp->adp); - ret =component_add (dev, &rockchip_dp_component_ops); -if (ret) -return ret; + ret =devm_of_dp_aux_populate_bus (analogix_dp_get_aux (dp->adp), rockchip_dp_link_panel); +if (ret) { +if (ret != -ENODEV ) { +dev_err (dev,"failed to populate aux bus : %d\n" , ret); +return ret; + } + + ret =rockchip_dp_link_panel (analogix_dp_get_aux (dp->adp)); +if (ret) +return ret; + }return 0 ; }
Signature · 1 line
2.34.1
Re: [PATCH v5 12/20] drm/rockchip: analogix_dp: Add support to get panel from the DP AUX bus
Quoted 33 lines · Damon Ding
Move
drm_of_find_panel_or_bridge()a little later and combine it withcomponent_add()into a new functionrockchip_dp_link_panel(). The function will serve asdone_probing()callback ofdevm_of_dp_aux_populate_bus(), aiding to support for obtaining the eDP panel via the DP AUX bus.If failed to get the panel from the DP AUX bus, it will then try the other way to get panel information through the platform bus.
In addition, use
dev_err()instead ofdrm_err()inrockchip_dp_poweron(), which will be called beforerockchip_dp_bind().Signed-off-by Damon Ding <[email protected]>---
Changes in v4:
- Usedone_probing()to calldrm_of_find_panel_or_bridge()andcomponent_add()when getting panel from the DP AUX busChanges in v5:
- Use the functions exported by the Analogix side to get the pointers of structanalogix_dp_plat_dataand structdrm_dp_aux.
- Usedev_err()instead ofdrm_err()inrockchip_dp_poweron().--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 127
Quoted 5 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1@@ -124,13 +124,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret); +dev_err (dp->dev,"failed to enable pclk %d\n" , ret);
why?
Quoted 10 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret); +dev_err (dp->dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 12/20] drm/rockchip: analogix_dp: Add support to get panel from the DP AUX bus
Hi Dmitry,
Quoted 35 lines · Dmitry Baryshkov
Quoted 34 lines · Damon Ding
Move
drm_of_find_panel_or_bridge()a little later and combine it withcomponent_add()into a new functionrockchip_dp_link_panel(). The function will serve asdone_probing()callback ofdevm_of_dp_aux_populate_bus(), aiding to support for obtaining the eDP panel via the DP AUX bus.If failed to get the panel from the DP AUX bus, it will then try the other way to get panel information through the platform bus.
In addition, use
dev_err()instead ofdrm_err()inrockchip_dp_poweron(), which will be called beforerockchip_dp_bind().Signed-off-by Damon Ding <[email protected]>---
Changes in v4:
- Usedone_probing()to calldrm_of_find_panel_or_bridge()andcomponent_add()when getting panel from the DP AUX busChanges in v5:
- Use the functions exported by the Analogix side to get the pointers of structanalogix_dp_plat_dataand structdrm_dp_aux.
- Usedev_err()instead ofdrm_err()inrockchip_dp_poweron().--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-)drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0@@ -124,13 +124,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)
Quoted 8 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 127
Quoted 4 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1ret =clk_prepare_enable (dp->pclk);if (ret <0 ) { -drm_err (dp->drm_dev,"failed to enable pclk %d\n" , ret); +dev_err (dp->dev,"failed to enable pclk %d\n" , ret);why?
The &rockchip_dp_device.drm_dev will be assigned in rockchip_dp_bind(), which is called after probing process. The PM operations have been advanced to the probing for the AUX transmission, so the dev_err() may be better than drm_err().
Quoted 11 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 136
Quoted 10 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1return ret; } ret =rockchip_dp_pre_init (dp);if (ret <0 ) { -drm_err (dp->drm_dev,"failed to dp pre init %d\n" , ret); +dev_err (dp->dev,"failed to dp pre init %d\n" , ret);clk_disable_unprepare (dp->pclk);return ret; }
Best regards
Damon
Re: [PATCH v5 12/20] drm/rockchip: analogix_dp: Add support to get panel from the DP AUX bus
Hi Dmitry,
Quoted 47 lines · Damon Ding
Hi Dmitry,
Quoted 29 lines · Dmitry Baryshkov
Quoted 28 lines · Damon Ding
Move
drm_of_find_panel_or_bridge()a little later and combine it withcomponent_add()into a new functionrockchip_dp_link_panel(). The function will serve asdone_probing()callback ofdevm_of_dp_aux_populate_bus(), aiding to support for obtaining the eDP panel via the DP AUX bus.If failed to get the panel from the DP AUX bus, it will then try the other way to get panel information through the platform bus.
In addition, use
dev_err()instead ofdrm_err()inrockchip_dp_poweron(), which will be called beforerockchip_dp_bind().Signed-off-by Damon Ding <[email protected]>---
Changes in v4:
- Usedone_probing()to calldrm_of_find_panel_or_bridge()andcomponent_add()when getting panel from the DP AUX busChanges in v5:
- Use the functions exported by the Analogix side to get the pointers of structanalogix_dp_plat_dataand structdrm_dp_aux.
- Usedev_err()instead ofdrm_err()inrockchip_dp_poweron().---
.../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 ++++++++++++++-----1 file changed, 30 insertions(+), 11 deletions(-)Quoted 14 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct · line 127
Quoted 10 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1@@ -124,13 +124,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret = clk_prepare_enable(dp->pclk); if (ret < 0) { - drm_err(dp->drm_dev, "failed to enable pclk %d\n", ret); + dev_err(dp->dev, "failed to enable pclk %d\n", ret);why?
Quoted 2 lines
The &rockchip_dp_device.drm_dev will be assigned in
rockchip_dp_bind(), which is called after probing process. The PM operations have been advanced to the probing for the AUX transmission, so thedev_err()may be better thandrm_err().
Using drm_...() uniformly may be better [0].
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 136
Quoted 9 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1return ret; } ret = rockchip_dp_pre_init(dp); if (ret < 0) { - drm_err(dp->drm_dev, "failed to dp pre init %d\n", ret); + dev_err(dp->dev, "failed to dp pre init %d\n", ret); clk_disable_unprepare(dp->pclk); return ret; }
Best regards,
Damon
[0]https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/#26209891
Re: [PATCH v5 12/20] drm/rockchip: analogix_dp: Add support to get panel from the DP AUX bus
Quoted 53 lines · Damon Ding
Hi Dmitry,
Quoted 50 lines · Damon Ding
Hi Dmitry,
Quoted 46 lines · Dmitry Baryshkov
Quoted 36 lines · Damon Ding
Move
drm_of_find_panel_or_bridge()a little later and combine it withcomponent_add()into a new functionrockchip_dp_link_panel(). The function
will serve asdone_probing()callback ofdevm_of_dp_aux_populate_bus(), aiding to support for obtaining the eDP panel via the DP AUX bus.If failed to get the panel from the DP AUX bus, it will then try the other
way to get panel information through the platform bus.In addition, use
dev_err()instead ofdrm_err()inrockchip_dp_poweron(), which will be called beforerockchip_dp_bind().Signed-off-by Damon Ding <[email protected]>---
Changes in v4:
- Usedone_probing()to calldrm_of_find_panel_or_bridge()andcomponent_add()when getting panel from the DP AUX busChanges in v5:
- Use the functions exported by the Analogix side to get the pointers of structanalogix_dp_plat_dataand structdrm_dp_aux.
- Usedev_err()instead ofdrm_err()inrockchip_dp_poweron().---
.../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 ++++++++++++++-----1 file changed, 30 insertions(+), 11 deletions(-)(quoted diff) renamed from drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0
-0
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index0957d3c5d31d..3ae01b870f49100644drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct · line 127
Quoted 5 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1@@ -124,13 +124,13 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) ret = clk_prepare_enable(dp->pclk); if (ret < 0) { - drm_err(dp->drm_dev, "failed to enable pclk %d\n", ret); + dev_err(dp->dev, "failed to enable pclk %d\n", ret);why?
Quoted 7 lines
Quoted 5 lines
The &rockchip_dp_device.drm_dev will be assigned in
rockchip_dp_bind(), which is called after probing process. The PM operations have been advanced to the probing for the AUX transmission, so thedev_err()may be better thandrm_err().Using drm_...() uniformly may be better [0].
Yes
Quoted 17 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data) · line 136
Quoted 10 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +1
-1return ret; } ret = rockchip_dp_pre_init(dp); if (ret < 0) { - drm_err(dp->drm_dev, "failed to dp pre init %d\n", ret); + dev_err(dp->dev, "failed to dp pre init %d\n", ret); clk_disable_unprepare(dp->pclk); return ret; }Best regards,
Damon[0]https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/#26209891
Signature · 2 lines
With best wishes Dmitry
PATCH v5 13/20 dt-bindings: display: rockchip: analogix-dp: Add support for RK3588
In reply to Damon DingCompared with RK3288/RK3399, the HBR2 link rate support is the main improvement of RK3588 eDP TX controller, and there are also two independent eDP display interfaces on RK3588 Soc.
The newly added 'apb' reset is to ensure the APB bus of eDP controller works well on the RK3588 SoC.
---
Changes in v2:
- Add the main defferences of the RK3588 eDP and the previous versions in commit message
Changes in v3:
- Expand the property clock-names, resets and reset-names
Changes in v4:
- Remove 'spdif' clock which added in v3
- Add the comment of newly added 'apb' reset in commit message
Changes in v5:
- Put the differences between RK3288/RK3399 and RK3588 into 'allOf'
--- .../rockchip/rockchip,analogix-dp.yaml | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +31 -6
@@ -15,6 +15,7 @@ properties: enum: - rockchip,rk3288-dp - rockchip,rk3399-edp + - rockchip,rk3588-edp clocks: minItems: 2
@@ -30,12 +31,6 @@ properties: power-domains: maxItems: 1 - resets: - maxItems: 1 - - reset-names: - const: dp - rockchip,grf: $ref: /schemas/types.yaml#/definitions/phandle description:
@@ -55,6 +50,36 @@ required: allOf: - $ref: /schemas/display/bridge/analogix,dp.yaml# + - if: + properties: + compatible: + contains: + enum: + - rockchip,rk3288-dp + - rockchip,rk3399-edp + then: + properties: + resets: + maxItems: 1 + reset-names: + const: dp + + - if: + properties: + compatible: + contains: + enum: + - rockchip,rk3588-edp + then: + properties: + resets: + minItems: 2 + maxItems: 2 + reset-names: + items: + - const: dp + - const: apb + unevaluatedProperties: false examples:
Signature · 1 line
2.34.1
Re: [PATCH v5 13/20] dt-bindings: display: rockchip: analogix-dp: Add support for RK3588
Quoted 41 lines · Damon Ding
Compared with RK3288/RK3399, the HBR2 link rate support is the main improvement of RK3588 eDP TX controller, and there are also two independent eDP display interfaces on RK3588 Soc.
The newly added 'apb' reset is to ensure the APB bus of eDP controller works well on the RK3588 SoC.
Signed-off-by Damon Ding <[email protected]>---
Changes in v2:
- Add the main defferences of the RK3588 eDP and the previous versions in commit messageChanges in v3:
- Expand the property clock-names, resets and reset-namesChanges in v4:
- Remove 'spdif' clock which added in v3
- Add the comment of newly added 'apb' reset in commit messageChanges in v5:
- Put the differences between RK3288/RK3399 and RK3588 into 'allOf'--- .../rockchip/rockchip,analogix-dp.yaml | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-)Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +1
-0@@ -15,6 +15,7 @@ properties: enum: - rockchip,rk3288-dp - rockchip,rk3399-edp + - rockchip,rk3588-edp clocks: minItems: 2
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml properties: · line 37
Quoted 8 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +0
-5@@ -30,12 +31,6 @@ properties: power-domains: maxItems: 1 - resets: - maxItems: 1 - - reset-names: - const: dp
Widest constraints are always here. You only needed to add allOf.
Best regards,
Krzysztof
Re: [PATCH v5 13/20] dt-bindings: display: rockchip: analogix-dp: Add support for RK3588
Hi Krzysztof,
Quoted 53 lines · Krzysztof Kozlowski
Quoted 41 lines · Damon Ding
Compared with RK3288/RK3399, the HBR2 link rate support is the main improvement of RK3588 eDP TX controller, and there are also two independent eDP display interfaces on RK3588 Soc.
The newly added 'apb' reset is to ensure the APB bus of eDP controller works well on the RK3588 SoC.
Signed-off-by Damon Ding <[email protected]>---
Changes in v2:
- Add the main defferences of the RK3588 eDP and the previous versions in commit messageChanges in v3:
- Expand the property clock-names, resets and reset-namesChanges in v4:
- Remove 'spdif' clock which added in v3
- Add the comment of newly added 'apb' reset in commit messageChanges in v5:
- Put the differences between RK3288/RK3399 and RK3588 into 'allOf'--- .../rockchip/rockchip,analogix-dp.yaml | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-)Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +1
-0@@ -15,6 +15,7 @@ properties: enum: - rockchip,rk3288-dp - rockchip,rk3399-edp + - rockchip,rk3588-edp clocks: minItems: 2Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml properties: · line 37
Quoted 8 lines
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +0
-5@@ -30,12 +31,6 @@ properties: power-domains: maxItems: 1 - resets: - maxItems: 1 - - reset-names: - const: dpWidest constraints are always here. You only needed to add allOf.
Quoted 3 lines
I see. I will keep the widest constraints of 'resets' and 'reset-names', and only add RK3588 related constraints in allOf.
And I may also need to add the 'minItems' and 'maxItems' for 'resets' and 'reset-names' like the 'qcom,ufs.yaml':
Documentation/devicetree/bindings/display/rockchip/rockchip,analogix-dp.yaml +4 -1
@@ -32,9 +32,12 @@ properties: maxItems: 1 resets: - maxItems: 1 + minItems: 1 + maxItems: 2 reset-names: + minItems: 1 + maxItems: 2 const: dp rockchip,grf:
If not, the CHECK_DTBS will failed with the logs:
/linux/arch/arm64/boot/dts/rockchip/rk3588-evb1-v10.dtb: edp@fdec0000: resets: [[31, 469], [31, 468]] is too long
from schema $id:
http://devicetree.org/schemas/display/rockchip/rockchip,analogix-dp.yaml#
/linux/arch/arm64/boot/dts/rockchip/rk3588-evb1-v10.dtb: edp@fdec0000: reset-names: ['dp', 'apb'] is too long
from schema $id:
http://devicetree.org/schemas/display/rockchip/rockchip,analogix-dp.yaml#
Best regards
Damon
PATCH v5 14/20 drm/bridge: analogix_dp: Add support for RK3588
In reply to Damon DingExpand enum analogix_dp_devtype with RK3588_EDP, and add max_link_rate and max_lane_count configs for it.
---
Changes in v5:
- Add the RK3588_EDP related modification in analogix_dp.h
- Move this commit above related commit on the Rockchip side
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 4 ++++ include/drm/bridge/analogix_dp.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +4 -0
@@ -1513,6 +1513,10 @@ static int analogix_dp_dt_parse_pdata(struct analogix_dp_device *dp) video_info->max_link_rate =0x0A ; video_info->max_lane_count =0x04 ;break ; +case RK3588_EDP : + video_info->max_link_rate =0x14 ; + video_info->max_lane_count =0x04 ; +break ;case EXYNOS_DP :/* * NOTE: those property parseing code is used for
include/drm/bridge/analogix_dp.h +2 -1
@@ -16,11 +16,12 @@ enum analogix_dp_devtype {EXYNOS_DP ,RK3288_DP ,RK3399_EDP , + RK3588_EDP, };static inline bool is_rockchip (enum analogix_dp_devtype type) { -return type ==RK3288_DP || type ==RK3399_EDP ; +return type ==RK3288_DP || type ==RK3399_EDP || type ==RK3588_EDP ; } struct analogix_dp_plat_data {
Signature · 1 line
2.34.1
Re: [PATCH v5 14/20] drm/bridge: analogix_dp: Add support for RK3588
Quoted 7 lines · Damon Ding
Expand enum
analogix_dp_devtypewithRK3588_EDP, and addmax_link_rateandmax_lane_countconfigs for it.Signed-off-by Damon Ding <[email protected]>---
Quoted 8 lines
Changes in v5:
- Add theRK3588_EDPrelated modification inanalogix_dp.h
- Move this commit above related commit on the Rockchip side--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 4 ++++ include/drm/bridge/analogix_dp.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
PATCH v5 15/20 drm/rockchip: analogix_dp: Add support for RK3588
In reply to Damon DingRK3588 integrates the Analogix eDP 1.3 TX controller IP and the HDMI/eDP TX Combo PHY based on a Samsung IP block. There are also two independent eDP display interface with different address on RK3588 Soc.
The patch currently adds only the basic support, specifically RGB output up to 4K@60Hz, without the tests for audio, PSR and other eDP 1.3 specific features.
In additon, the above Analogix IP has always been utilized as eDP on Rockchip platform, despite its capability to also support the DP v1.2. Therefore, the newly added logs will contain the term 'edp' rather than 'dp'. And the newly added 'apb' reset control is to ensure the APB bus of eDP controller works well on the RK3588 SoC.
---
Changes in v2:
- Add support for the other eDP output edp1
Changes in v3:
- Fix the unexpected use of alias
- Add more details in commit message
Changes in v4:
- Add the 'apb' reset control
Changes in v5:
- Use drm_...()/dev_...() instead of DRM_...()
- Clean &rockchip_dp_chip_data.reg related comments in commit message
- Move the modifications in anlogix_dp.h to the Analogix side in order to avoid the warning:
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1506:10: warning:
enumeration value 'RK3588_EDP' not handled in switch [-Wswitch]
switch (dp->plat_data->dev_type) {--- .../gpu/drm/rockchip/analogix_dp-rockchip.c | 61 ++++++++++++++++++- 1 file changed, 58 insertions(+), 3 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +58 -3
@@ -51,10 +51,12 @@ struct rockchip_grf_reg_field {/** * struct rockchip_dp_chip_data - splite the grf setting of kind of chips * @lcdc_sel: grf register field of lcdc_sel +* @edp_mode: grf register field of edp_mode * @chip_type: specific chip type */ struct rockchip_dp_chip_data {const struct rockchip_grf_reg_field lcdc_sel; +const struct rockchip_grf_reg_field edp_mode;u32 chip_type;u32 reg; };
@@ -69,6 +71,7 @@ struct rockchip_dp_device {struct clk *grfclk;struct regmap *grf;struct reset_control *rst; +struct reset_control *apbrst;const struct rockchip_dp_chip_data *data;
@@ -114,6 +117,10 @@ static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)usleep_range (10 ,20 );reset_control_deassert (dp->rst); +reset_control_assert (dp->apbrst); +usleep_range (10 ,20 ); +reset_control_deassert (dp->apbrst); +return 0 ; }
@@ -135,12 +142,21 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)return ret; } + ret =rockchip_grf_field_write (dp->grf, &dp->data->edp_mode,1 ); +if (ret !=0 ) +dev_err (dp->dev,"failed to set edp mode %d\n" , ret); +return ret; }static int rockchip_dp_powerdown (struct analogix_dp_plat_data *plat_data) {struct rockchip_dp_device *dp =pdata_encoder_to_dp (plat_data); +int ret; + + ret =rockchip_grf_field_write (dp->grf, &dp->data->edp_mode,0 ); +if (ret !=0 ) +dev_err (dp->dev,"failed to set edp mode %d\n" , ret);clk_disable_unprepare (dp->pclk);
@@ -205,6 +221,10 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,struct rockchip_dp_device *dp =encoder_to_dp (encoder);struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state; +struct of_endpoint endpoint; +struct device_node *remote_port, *remote_port_parent; +char name[32 ]; +u32 port_id;int ret; crtc =rockchip_dp_drm_get_new_crtc (encoder, state);
@@ -222,13 +242,27 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,return ; } - ret =drm_of_encoder_active_endpoint_id (dp->dev->of_node, encoder); + ret =drm_of_encoder_active_endpoint (dp->dev->of_node, encoder, &endpoint);if (ret <0 )return ; -drm_dbg_core (dp->drm_dev,"vop %s output to dp\n" , (ret) ?"LIT" :"BIG" ); + remote_port_parent =of_graph_get_remote_port_parent (endpoint.local_node); +if (remote_port_parent) { +if (of_get_child_by_name (remote_port_parent,"ports" )) { + remote_port =of_graph_get_remote_port (endpoint.local_node); +of_property_read_u32 (remote_port,"reg" , &port_id); +of_node_put (remote_port); +sprintf (name,"%s vp%d" , remote_port_parent->full_name, port_id); + }else { +sprintf (name,"%s %s" , + remote_port_parent->full_name, endpoint.id ?"vopl" :"vopb" ); + } +of_node_put (remote_port_parent); + +drm_dbg_core (dp->drm_dev,"%s output to edp\n" , name); + } - ret =rockchip_grf_field_write (dp->grf, &dp->data->lcdc_sel, ret); + ret =rockchip_grf_field_write (dp->grf, &dp->data->lcdc_sel, endpoint.id);if (ret !=0 )drm_err (dp->drm_dev,"Could not write to GRF: %d\n" , ret);
@@ -322,6 +356,12 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)return PTR_ERR (dp->rst); } + dp->apbrst =devm_reset_control_get_optional (dev,"apb" ); +if (IS_ERR (dp->apbrst)) { +dev_err (dev,"failed to get apb reset control\n" ); +return PTR_ERR (dp->apbrst); + } +return 0 ; }
@@ -521,9 +561,24 @@ static const struct rockchip_dp_chip_data rk3288_dp[] = { {/* sentinel */ } }; +static const struct rockchip_dp_chip_data rk3588_edp[] = { + { + .edp_mode =GRF_REG_FIELD (0x0000 ,0 ,0 ), + .chip_type =RK3588_EDP , + .reg =0xfdec0000 , + }, + { + .edp_mode =GRF_REG_FIELD (0x0004 ,0 ,0 ), + .chip_type =RK3588_EDP , + .reg =0xfded0000 , + }, + {/* sentinel */ } +}; +static const struct of_device_id rockchip_dp_dt_ids[] = { {.compatible ="rockchip,rk3288-dp" , .data = &rk3288_dp }, {.compatible ="rockchip,rk3399-edp" , .data = &rk3399_edp }, + {.compatible ="rockchip,rk3588-edp" , .data = &rk3588_edp }, {} };MODULE_DEVICE_TABLE (of, rockchip_dp_dt_ids);
Signature · 1 line
2.34.1
PATCH v5 16/20 drm/edp-panel: Add LG Display panel model LP079QX1-SP0V
In reply to Damon DingThe raw edid for LP079QX1-SP0V panel model is:
00 ff ff ff ff ff ff 00 16 83 00 00 00 00 00 00 04 17 01 00 a5 10 0c 78 06 ef 05 a3 54 4c 99 26 0f 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 ea 4e 00 4c 60 00 14 80 0c 10 84 00 78 a0 00 00 00 18 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fe 00 4c 50 30 37 39 51 58 31 2d 53 50 30 56 00 00 00 fc 00 43 6f 6c 6f 72 20 4c 43 44 0a 20 20 20 00 3f
--- drivers/gpu/drm/panel/panel-edp.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/panel/panel-edp.c +8 -0
@@ -1802,6 +1802,12 @@ static const struct panel_delay delay_200_500_e50_po2e200 = { .powered_on_to_enable = 200, }; +static const struct panel_delay delay_50_500_e200 = { + .hpd_absent =50 , + .unprepare =500 , + .enable =200 , +}; +#define EDP_PANEL_ENTRY (vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name) \ { \ .ident = { \
@@ -1948,6 +1954,8 @@ static const struct edp_panel_entry edp_panels[] = {EDP_PANEL_ENTRY ('C' ,'S' ,'W' ,0x1100 , &delay_200_500_e80_d50,"MNB601LS1-1" ),EDP_PANEL_ENTRY ('C' ,'S' ,'W' ,0x1104 , &delay_200_500_e50,"MNB601LS1-4" ), +EDP_PANEL_ENTRY ('E' ,'T' ,'C' ,0x0000 , &delay_50_500_e200,"LP079QX1-SP0V" ), +EDP_PANEL_ENTRY ('H' ,'K' ,'C' ,0x2d51 , &delay_200_500_e200,"Unknown" ),EDP_PANEL_ENTRY ('H' ,'K' ,'C' ,0x2d5b , &delay_200_500_e200,"MB116AN01" ), EDP_PANEL_ENTRY('H', 'K', 'C', 0x2d5c, &delay_200_500_e200, "MB116AN01-2"),
Signature · 1 line
2.34.1
PATCH v5 17/20 dt-bindings: display: rockchip: Fix label name of hdptxphy for RK3588 HDMI TX Controller
In reply to Damon DingThe hdptxphy is a combo transmit-PHY for HDMI2.1 TMDS Link, FRL Link, DP and eDP Link. Therefore, it is better to name it hdptxphy0 other than hdptxphy_hdmi0, which will be referenced by both hdmi0 and edp0 nodes.
--- .../bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml +1 -1
@@ -156,7 +156,7 @@ examples: <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH 0>, <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH 0>; interrupt-names = "avp", "cec", "earc", "main", "hpd"; - phys = <&hdptxphy_hdmi0>; + phys = <&hdptxphy0>; power-domains = <&power RK3588_PD_VO1>; resets = <&cru SRST_HDMITX0_REF>, <&cru SRST_HDMIHDP0>; reset-names = "ref", "hdp";
Signature · 1 line
2.34.1
PATCH v5 18/20 arm64: dts: rockchip: Fix label name of hdptxphy for RK3588
In reply to Damon DingThe hdptxphy is a combo transmit-PHY for HDMI2.1 TMDS Link, FRL Link, DP and eDP Link. Therefore, it is better to name it hdptxphy0 other than hdptxphy_hdmi0, which will be referenced by both hdmi0 and edp0 nodes.
--- arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 4 ++-- arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-evb.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-genbook.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588-evb1-v10.dts | 2 +- .../boot/dts/rockchip/rk3588-friendlyelec-cm3588-nas.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588-tiger-haikou.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-odroid-m2.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts | 2 +- arch/arm64/boot/dts/rockchip/rk3588s-rock-5c.dts | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +2 -2
@@ -1386,7 +1386,7 @@ hdmi0: hdmi@fde80000 { <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH 0>, <GIC_SPI 360 IRQ_TYPE_LEVEL_HIGH 0>; interrupt-names = "avp", "cec", "earc", "main", "hpd"; - phys = <&hdptxphy_hdmi0>; + phys = <&hdptxphy0>; pinctrl-names = "default"; pinctrl-0 = <&hdmim0_tx0_cec &hdmim0_tx0_hpd &hdmim0_tx0_scl &hdmim0_tx0_sda>;
@@ -2806,7 +2806,7 @@ dmac2: dma-controller@fed10000 { #dma-cells = <1>; }; - hdptxphy_hdmi0: phy@fed60000 { + hdptxphy0: phy@fed60000 { compatible = "rockchip,rk3588-hdptx-phy"; reg = <0x0 0xfed60000 0x0 0x2000>; clocks = <&cru CLK_USB2PHY_HDPTXRXPHY_REF>, <&cru PCLK_HDPTX0>;
arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-evb.dts +1 -1
@@ -129,7 +129,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-coolpi-cm5-genbook.dts +1 -1
@@ -166,7 +166,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-evb1-v10.dts +1 -1
@@ -328,7 +328,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-friendlyelec-cm3588-nas.dts +1 -1
@@ -335,7 +335,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-jaguar.dts +1 -1
@@ -303,7 +303,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +1 -1
@@ -360,7 +360,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-orangepi-5-plus.dts +1 -1
@@ -296,7 +296,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts +1 -1
@@ -220,7 +220,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588-tiger-haikou.dts +1 -1
@@ -189,7 +189,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-coolpi-4b.dts +1 -1
@@ -236,7 +236,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-indiedroid-nova.dts +1 -1
@@ -278,7 +278,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-nanopi-r6.dtsi +1 -1
@@ -251,7 +251,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-odroid-m2.dts +1 -1
@@ -264,7 +264,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-orangepi-5.dtsi +1 -1
@@ -197,7 +197,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-rock-5a.dts +1 -1
@@ -334,7 +334,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
arch/arm64/boot/dts/rockchip/rk3588s-rock-5c.dts +1 -1
@@ -278,7 +278,7 @@ hdmi0_out_con: endpoint { }; }; -&hdptxphy_hdmi0 { +&hdptxphy0 { status = "okay"; };
Signature · 1 line
2.34.1
PATCH v5 19/20 arm64: dts: rockchip: Add eDP0 node for RK3588
In reply to Damon DingAdd support for the eDP0 output on RK3588 SoC.
---
Changes in v3:
- Remove currently unsupported property '#sound-dai-cells'
Changes in v4:
- Remove currently unsupported clock 'spdif'
--- arch/arm64/boot/dts/rockchip/rk3588-base.dtsi | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588-base.dtsi +28 -0
@@ -1411,6 +1411,34 @@ hdmi0_out: port@1 { }; }; + edp0: edp@fdec0000 { + compatible = "rockchip,rk3588-edp"; + reg = <0x0 0xfdec0000 0x0 0x1000>; + clocks = <&cru CLK_EDP0_24M>, <&cru PCLK_EDP0>; + clock-names = "dp", "pclk"; + interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH 0>; + phys = <&hdptxphy0>; + phy-names = "dp"; + power-domains = <&power RK3588_PD_VO1>; + resets = <&cru SRST_EDP0_24M>, <&cru SRST_P_EDP0>; + reset-names = "dp", "apb"; + rockchip,grf = <&vo1_grf>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + edp0_in: port@0 { + reg = <0>; + }; + + edp0_out: port@1 { + reg = <1>; + }; + }; + }; + qos_gpu_m0: qos@fdf35000 { compatible = "rockchip,rk3588-qos", "syscon"; reg = <0x0 0xfdf35000 0x0 0x20>;
Signature · 1 line
2.34.1
PATCH v5 20/20 arm64: dts: rockchip: Enable eDP0 display on RK3588S EVB1 board
In reply to Damon DingAdd the necessary DT changes to enable eDP0 on RK3588S EVB1 board:
- Set pinctrl of pwm12 for backlight
- Enable edp0/hdptxphy0/vp2
- Add aux-bus/panel nodes
---
Changes in v2:
- Remove brightness-levels and default-brightness-level properties in backlight node.
- Add the detail DT changes to commit message.
Changes in v3:
- Use aux-bus instead of platform bus for edp-panel.
Changes in v4:
- Add comments related to the use of panel compatible "lg,lp079qx1-sp0v" in the commit message.
Changes in v5:
- Use "edp-panel" instead of "lg,lp079qx1-sp0v"
- Remove unnecessary comments in commit message
- Assign the parent of DCLK_VOP2_SRC to PLL_V0PLL
--- .../boot/dts/rockchip/rk3588s-evb1-v10.dts | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+)
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +54 -0
@@ -9,6 +9,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> #include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/soc/rockchip,vop2.h> #include <dt-bindings/usb/pd.h> #include "rk3588s.dtsi"
@@ -238,6 +239,41 @@ &combphy2_psu { status = "okay"; }; +&edp0 { + force-hpd; + status = "okay"; + + aux-bus { + panel { + compatible = "edp-panel"; + backlight = <&backlight>; + power-supply = <&vcc3v3_lcd_edp>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&edp_out_panel>; + }; + }; + }; + }; +}; + +&edp0_in { + edp0_in_vp2: endpoint { + remote-endpoint = <&vp2_out_edp0>; + }; +}; + +&edp0_out { + edp_out_panel: endpoint { + remote-endpoint = <&panel_in_edp>; + }; +}; + +&hdptxphy0 { + status = "okay"; +}; + &i2c3 { status = "okay";
@@ -399,6 +435,7 @@ usbc0_int: usbc0-int { }; &pwm12 { + pinctrl-0 = <&pwm12m1_pins>; status = "okay"; };
@@ -1168,3 +1205,20 @@ usbdp_phy0_dp_altmode_mux: endpoint@1 { }; }; }; + +&vop_mmu { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP2_SRC>; + assigned-clock-parents = <&cru PLL_V0PLL>; + status = "okay"; +}; + +&vp2 { + vp2_out_edp0: endpoint@ROCKCHIP_VOP2_EP_EDP0 { + reg = <ROCKCHIP_VOP2_EP_EDP0>; + remote-endpoint = <&edp0_in_vp2>; + }; +};
Signature · 1 line
2.34.1
Andy Yan
maintainerRe:[PATCH v5 20/20] arm64: dts: rockchip: Enable eDP0 display on RK3588S EVB1 board
Hi Damon,
Quoted 93 lines · Damon Ding
Add the necessary DT changes to enable eDP0 on RK3588S EVB1 board:
- Set pinctrl of pwm12 for backlight
- Enable edp0/hdptxphy0/vp2
- Add aux-bus/panel nodesSigned-off-by Damon Ding <[email protected]>---
Changes in v2:
- Remove brightness-levels and default-brightness-level properties in backlight node.
- Add the detail DT changes to commit message.Changes in v3:
- Use aux-bus instead of platform bus for edp-panel.Changes in v4:
- Add comments related to the use of panel compatible "lg,lp079qx1-sp0v" in the commit message.Changes in v5:
- Use "edp-panel" instead of "lg,lp079qx1-sp0v"
- Remove unnecessary comments in commit message
- Assign the parent ofDCLK_VOP2_SRCtoPLL_V0PLL
---.../boot/dts/rockchip/rk3588s-evb1-v10.dts| 54 +++++++++++++++++++1 file changed, 54 insertions(+)arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +37
-0@@ -9,6 +9,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> #include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/soc/rockchip,vop2.h> #include <dt-bindings/usb/pd.h> #include "rk3588s.dtsi"@@ -238,6 +239,41 @@ &combphy2_psu { status = "okay"; }; +&edp0 { + force-hpd; + status = "okay"; + + aux-bus { + panel { + compatible = "edp-panel"; + backlight = <&backlight>; + power-supply = <&vcc3v3_lcd_edp>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&edp_out_panel>; + }; + }; + }; + }; +}; + +&edp0_in { + edp0_in_vp2: endpoint { + remote-endpoint = <&vp2_out_edp0>; + }; +}; + +&edp0_out { + edp_out_panel: endpoint { + remote-endpoint = <&panel_in_edp>; + }; +}; + +&hdptxphy0 { + status = "okay"; +}; + &i2c3 { status = "okay";@@ -399,6 +435,7 @@ usbc0_int: usbc0-int { }; &pwm12 { + pinctrl-0 = <&pwm12m1_pins>; status = "okay"; };@@ -1168,3 +1205,20 @@ usbdp_phy0_dp_altmode_mux: endpoint@1 { };
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts usbdp_phy0_dp_altmode_mux: endpoint@1 { · line 1215
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +8
-0}; }; + +&vop_mmu { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP2_SRC>; + assigned-clock-parents = <&cru PLL_V0PLL>;
It's necessary to explain why we need to assign V0PLL for DCLK_VOP2_SRC in commit message.
Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +9
-0+ status = "okay"; +}; + +&vp2 { + vp2_out_edp0: endpoint@ROCKCHIP_VOP2_EP_EDP0 { + reg = <ROCKCHIP_VOP2_EP_EDP0>; + remote-endpoint = <&edp0_in_vp2>; + }; +};Signature · 1 line
2.34.1
Re: [PATCH v5 20/20] arm64: dts: rockchip: Enable eDP0 display on RK3588S EVB1 board
Hi Andy,
Quoted 95 lines · Andy Yan
Hi Damon,
Quoted 91 lines · Damon Ding
Add the necessary DT changes to enable eDP0 on RK3588S EVB1 board:
- Set pinctrl of pwm12 for backlight
- Enable edp0/hdptxphy0/vp2
- Add aux-bus/panel nodesSigned-off-by Damon Ding <[email protected]>---
Changes in v2:
- Remove brightness-levels and default-brightness-level properties in backlight node.
- Add the detail DT changes to commit message.Changes in v3:
- Use aux-bus instead of platform bus for edp-panel.Changes in v4:
- Add comments related to the use of panel compatible "lg,lp079qx1-sp0v" in the commit message.Changes in v5:
- Use "edp-panel" instead of "lg,lp079qx1-sp0v"
- Remove unnecessary comments in commit message
- Assign the parent ofDCLK_VOP2_SRCtoPLL_V0PLL
---.../boot/dts/rockchip/rk3588s-evb1-v10.dts| 54 +++++++++++++++++++1 file changed, 54 insertions(+)arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +37
-0@@ -9,6 +9,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> #include <dt-bindings/pinctrl/rockchip.h> +#include <dt-bindings/soc/rockchip,vop2.h> #include <dt-bindings/usb/pd.h> #include "rk3588s.dtsi"@@ -238,6 +239,41 @@ &combphy2_psu { status = "okay"; }; +&edp0 { + force-hpd; + status = "okay"; + + aux-bus { + panel { + compatible = "edp-panel"; + backlight = <&backlight>; + power-supply = <&vcc3v3_lcd_edp>; + + port { + panel_in_edp: endpoint { + remote-endpoint = <&edp_out_panel>; + }; + }; + }; + }; +}; + +&edp0_in { + edp0_in_vp2: endpoint { + remote-endpoint = <&vp2_out_edp0>; + }; +}; + +&edp0_out { + edp_out_panel: endpoint { + remote-endpoint = <&panel_in_edp>; + }; +}; + +&hdptxphy0 { + status = "okay"; +}; + &i2c3 { status = "okay";@@ -399,6 +435,7 @@ usbc0_int: usbc0-int { }; &pwm12 { + pinctrl-0 = <&pwm12m1_pins>; status = "okay"; };
Quoted 16 lines
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts usbdp_phy0_dp_altmode_mux: endpoint@1 { · line 1215
Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +8
-0@@ -1168,3 +1205,20 @@ usbdp_phy0_dp_altmode_mux: endpoint@1 { }; }; }; + +&vop_mmu { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP2_SRC>; + assigned-clock-parents = <&cru PLL_V0PLL>;It's necessary to explain why we need to assign V0PLL for
DCLK_VOP2_SRCin commit message.
I will add relevant explainations in next version.
Quoted 4 lines
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +4
-0+ status = "okay"; +}; + +&vp2 {
Quoted 8 lines
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3588s-evb1-v10.dts +5
-0+ vp2_out_edp0: endpoint@ROCKCHIP_VOP2_EP_EDP0 { + reg = <ROCKCHIP_VOP2_EP_EDP0>; + remote-endpoint = <&edp0_in_vp2>; + }; +};Signature · 1 line
2.34.1
Best regards,
Damon