drm/msm/dsi: Split different types of PHY drivers
cover drm/msm/dsi: Split different types of PHY drivers
The DSI PHY driver currently includes the implementation of all PHY types. To support more types in the future, this patch series is moving each PHY code into a separate file and making them compile independent. Some clean up patches for DSI PHY are also included.
Hai Li (5):
drm/msm/dsi: Update generated header file for DSI PHY drm/msm/dsi: Specify bitmask to set source PLL drm/msm/dsi: Return void from msm_dsi_phy_disable() drm/msm/dsi: Split PHY drivers to separate files drm/msm/dsi: Make each PHY type compilation independent
drivers/gpu/drm/msm/Kconfig | 14 + drivers/gpu/drm/msm/Makefile | 13 +- drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi.xml.h | 5 + drivers/gpu/drm/msm/dsi/dsi_phy.c | 756 ----------------------------- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 452 +++++++++++++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy.h | 89 ++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 150 ++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 166 +++++++ drivers/gpu/drm/msm/dsi/pll/dsi_pll.h | 8 + 10 files changed, 894 insertions(+), 761 deletions(-) delete mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy.c create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH 1/5 drm/msm/dsi: Update generated header file for DSI PHY
This change is to update DSI register definition changes introduced by the following change:
rnndb/dsi: Add more bits for DSI PHY
More registers and bit fields are added for PHY timings and bitclk source selection.
--- drivers/gpu/drm/msm/dsi/dsi.xml.h | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/dsi/dsi.xml.h +5 -0
@@ -440,6 +440,9 @@ static inline uint32_t DSI_LANE_SWAP_CTRL_DLN_SWAP_SEL(enum dsi_lane_swap val)#define REG_DSI_PHY_RESET 0x00000128#define DSI_PHY_RESET_RESET 0x00000001 +#define REG_DSI_T_CLK_PRE_EXTEND 0x0000017c +#define DSI_T_CLK_PRE_EXTEND_INC_BY_2_BYTECLK 0x00000001 +#define REG_DSI_RDBK_DATA_CTRL 0x000001d0#define DSI_RDBK_DATA_CTRL_COUNT__MASK 0x00ff0000#define DSI_RDBK_DATA_CTRL_COUNT__SHIFT 16
@@ -835,6 +838,7 @@ static inline uint32_t DSI_28nm_PHY_TIMING_CTRL_11_TRIG3_CMD(uint32_t val)#define REG_DSI_28nm_PHY_BIST_CTRL_5 0x000001c8#define REG_DSI_28nm_PHY_GLBL_TEST_CTRL 0x000001d4 +#define DSI_28nm_PHY_GLBL_TEST_CTRL_BITCLK_HS_SEL 0x00000001#define REG_DSI_28nm_PHY_LDO_CNTRL 0x000001dc
@@ -1161,6 +1165,7 @@ static inline uint32_t DSI_20nm_PHY_TIMING_CTRL_11_TRIG3_CMD(uint32_t val)#define REG_DSI_20nm_PHY_BIST_CTRL_5 0x000001c8#define REG_DSI_20nm_PHY_GLBL_TEST_CTRL 0x000001d4 +#define DSI_20nm_PHY_GLBL_TEST_CTRL_BITCLK_HS_SEL 0x00000001#define REG_DSI_20nm_PHY_LDO_CNTRL 0x000001dc
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm/msm/dsi: Specify bitmask to set source PLL
In reply to Hai LiThe bit position to configure source PLL will change on new types of PHYs. The caller should pass down this information.
--- drivers/gpu/drm/msm/dsi/dsi_phy.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_phy.c +11 -5
@@ -157,17 +157,21 @@ fail:return ret; } -static void dsi_phy_set_src_pll (struct msm_dsi_phy *phy,int pll_id,u32 reg) +static void dsi_phy_set_src_pll (struct msm_dsi_phy *phy,int pll_id,u32 reg, +u32 bit_mask) {int phy_id = phy->id; +u32 val;if ((phy_id >=DSI_MAX ) || (pll_id >=DSI_MAX ))return ; + val =dsi_phy_read (phy->base + reg); +if (phy->cfg->src_pll_truthtable[phy_id][pll_id]) -dsi_phy_write (phy->base + reg,0x01 ); +dsi_phy_write (phy->base + reg, val | bit_mask);else -dsi_phy_write (phy->base + reg,0x00 ); +dsi_phy_write (phy->base + reg, val & (~bit_mask)); }#define S_DIV_ROUND_UP (n, d) \
@@ -389,7 +393,8 @@ static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,dsi_phy_write (base + REG_DSI_28nm_PHY_CTRL_0,0x5f ); -dsi_phy_set_src_pll (phy, src_pll_id, REG_DSI_28nm_PHY_GLBL_TEST_CTRL); +dsi_phy_set_src_pll (phy, src_pll_id, REG_DSI_28nm_PHY_GLBL_TEST_CTRL, + DSI_28nm_PHY_GLBL_TEST_CTRL_BITCLK_HS_SEL);return 0 ; }
@@ -451,7 +456,8 @@ static int dsi_20nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,dsi_phy_write (base + REG_DSI_20nm_PHY_STRENGTH_0,0xff ); -dsi_phy_set_src_pll (phy, src_pll_id, REG_DSI_20nm_PHY_GLBL_TEST_CTRL); +dsi_phy_set_src_pll (phy, src_pll_id, REG_DSI_20nm_PHY_GLBL_TEST_CTRL, + DSI_20nm_PHY_GLBL_TEST_CTRL_BITCLK_HS_SEL);for (i =0 ; i <4 ; i++) { dsi_phy_write(base + REG_DSI_20nm_PHY_LN_CFG_3(i),
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 drm/msm/dsi: Return void from msm_dsi_phy_disable()
In reply to Hai LiWe are not checking the return value from msm_dsi_phy_disable(). Change the return type to void.
--- drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_phy.c | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-)
drivers/gpu/drm/msm/dsi/dsi.h +1 -1
@@ -168,7 +168,7 @@ void msm_dsi_phy_driver_register(void);void msm_dsi_phy_driver_unregister (void );int msm_dsi_phy_enable (struct msm_dsi_phy *phy,int src_pll_id,const unsigned long bit_rate,const unsigned long esc_rate); -int msm_dsi_phy_disable (struct msm_dsi_phy *phy); +void msm_dsi_phy_disable (struct msm_dsi_phy *phy);void msm_dsi_phy_get_clk_pre_post (struct msm_dsi_phy *phy,u32 *clk_pre,u32 *clk_post);struct msm_dsi_pll *msm_dsi_phy_get_pll (struct msm_dsi_phy *phy);
drivers/gpu/drm/msm/dsi/dsi_phy.c +5 -11
@@ -23,7 +23,7 @@struct dsi_phy_ops {int (*enable)(struct msm_dsi_phy *phy,int src_pll_id,const unsigned long bit_rate,const unsigned long esc_rate); -int (*disable)(struct msm_dsi_phy *phy); +void (*disable)(struct msm_dsi_phy *phy); };struct dsi_phy_cfg {
@@ -399,7 +399,7 @@ static int dsi_28nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,return 0 ; } -static int dsi_28nm_phy_disable (struct msm_dsi_phy *phy) +static void dsi_28nm_phy_disable (struct msm_dsi_phy *phy) {dsi_phy_write (phy->base + REG_DSI_28nm_PHY_CTRL_0,0 );dsi_28nm_phy_regulator_ctrl (phy, false);
@@ -409,8 +409,6 @@ static int dsi_28nm_phy_disable(struct msm_dsi_phy *phy)* ensure that the phy is completely disabled */ wmb (); - -return 0 ; }static void dsi_20nm_phy_regulator_ctrl (struct msm_dsi_phy *phy,bool enable)
@@ -515,12 +513,10 @@ static int dsi_20nm_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,return 0 ; } -static int dsi_20nm_phy_disable (struct msm_dsi_phy *phy) +static void dsi_20nm_phy_disable (struct msm_dsi_phy *phy) {dsi_phy_write (phy->base + REG_DSI_20nm_PHY_CTRL_0,0 );dsi_20nm_phy_regulator_ctrl (phy, false); - -return 0 ; }static int dsi_phy_enable_resource (struct msm_dsi_phy *phy)
@@ -730,15 +726,13 @@ int msm_dsi_phy_enable(struct msm_dsi_phy *phy, int src_pll_id,return phy->cfg->ops.enable (phy, src_pll_id, bit_rate, esc_rate); } -int msm_dsi_phy_disable (struct msm_dsi_phy *phy) +void msm_dsi_phy_disable (struct msm_dsi_phy *phy) {if (!phy || !phy->cfg->ops.disable) -return -EINVAL ; +return ; phy->cfg->ops.disable (phy);dsi_phy_regulator_disable (phy); - -return 0 ; } void msm_dsi_phy_get_clk_pre_post(struct msm_dsi_phy *phy,
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/msm/dsi: Split PHY drivers to separate files
In reply to Hai LiThis change moves each PHY type specific code into separate files.
--- drivers/gpu/drm/msm/Makefile | 6 +- drivers/gpu/drm/msm/dsi/dsi_phy.c | 756 ----------------------------- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 448 +++++++++++++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy.h | 89 ++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 150 ++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 166 +++++++ 6 files changed, 857 insertions(+), 758 deletions(-) delete mode 100644 drivers/gpu/drm/msm/dsi/dsi_phy.c create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c create mode 100644 drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c
drivers/gpu/drm/msm/Makefile +4 -2
@@ -1,5 +1,5 @@ ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/msm -ccflags-$(CONFIG_DRM_MSM_DSI_PLL) += -Idrivers/gpu/drm/msm/dsi +ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi msm-y := \ adreno/adreno_device.o \
@@ -56,7 +56,9 @@ msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \ dsi/dsi_host.o \ dsi/dsi_manager.o \ - dsi/dsi_phy.o \ + dsi/phy/dsi_phy.o \ + dsi/phy/dsi_phy_20nm.o \ + dsi/phy/dsi_phy_28nm.o \ mdp/mdp5/mdp5_cmd_encoder.o msm-$(CONFIG_DRM_MSM_DSI_PLL) += dsi/pll/dsi_pll.o \
drivers/gpu/drm/msm/dsi/dsi_phy.c deleted +0 -756
756 lines not on this page · raw message
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c new file +448 -0
448 lines not on this page · raw message
drivers/gpu/drm/msm/dsi/phy/dsi_phy.h new file +89 -0
89 lines not on this page · raw message
drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c new file +150 -0
150 lines not on this page · raw message
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c new file +166 -0
166 lines not on this page · raw message
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/msm/dsi: Make each PHY type compilation independent
In reply to Hai LiOn a certain platform, only one type of DSI PHY is used. This change allows the user to only compile the PHY type which is being used.
--- drivers/gpu/drm/msm/Kconfig | 14 ++++++++++++++ drivers/gpu/drm/msm/Makefile | 11 +++++++---- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 ++++ drivers/gpu/drm/msm/dsi/pll/dsi_pll.h | 8 ++++++++ 4 files changed, 33 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/Kconfig +14 -0
@@ -54,3 +54,17 @@ config DRM_MSM_DSI_PLL help Choose this option to enable DSI PLL driver which provides DSI source clocks under common clock framework. + +config DRM_MSM_DSI_28NM_PHY + bool "Enable DSI 28nm PHY driver in MSM DRM" + depends on DRM_MSM_DSI + default y + help + Choose this option if the 28nm DSI PHY is used on the platform. + +config DRM_MSM_DSI_20NM_PHY + bool "Enable DSI 20nm PHY driver in MSM DRM" + depends on DRM_MSM_DSI + default y + help + Choose this option if the 20nm DSI PHY is used on the platform.
drivers/gpu/drm/msm/Makefile +7 -4
@@ -57,11 +57,14 @@ msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \ dsi/dsi_host.o \ dsi/dsi_manager.o \ dsi/phy/dsi_phy.o \ - dsi/phy/dsi_phy_20nm.o \ - dsi/phy/dsi_phy_28nm.o \ mdp/mdp5/mdp5_cmd_encoder.o -msm-$(CONFIG_DRM_MSM_DSI_PLL) += dsi/pll/dsi_pll.o \ - dsi/pll/dsi_pll_28nm.o +msm-$(CONFIG_DRM_MSM_DSI_28NM_PHY) += dsi/phy/dsi_phy_28nm.o +msm-$(CONFIG_DRM_MSM_DSI_20NM_PHY) += dsi/phy/dsi_phy_20nm.o + +ifeq ($(CONFIG_DRM_MSM_DSI_PLL),y) +msm-y += dsi/pll/dsi_pll.o +msm-$(CONFIG_DRM_MSM_DSI_28NM_PHY) += dsi/pll/dsi_pll_28nm.o +endif obj-$(CONFIG_DRM_MSM) += msm.o
drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +4 -0
@@ -267,12 +267,16 @@ static void dsi_phy_disable_resource(struct msm_dsi_phy *phy) }static const struct of_device_id dsi_phy_dt_match[] = { +#ifdef CONFIG_DRM_MSM_DSI_28NM_PHY { .compatible ="qcom,dsi-phy-28nm-hpm" , .data = &dsi_phy_28nm_hpm_cfgs }, { .compatible ="qcom,dsi-phy-28nm-lp" , .data = &dsi_phy_28nm_lp_cfgs }, +#endif +#ifdef CONFIG_DRM_MSM_DSI_20NM_PHY { .compatible ="qcom,dsi-phy-20nm" , .data = &dsi_phy_20nm_cfgs }, +#endif {} };
drivers/gpu/drm/msm/dsi/pll/dsi_pll.h +8 -0
@@ -83,8 +83,16 @@ void msm_dsi_pll_helper_unregister_clks(struct platform_device *pdev,/* * Initialization for Each PLL Type */ +#ifdef CONFIG_DRM_MSM_DSI_28NM_PHY struct msm_dsi_pll *msm_dsi_pll_28nm_init (struct platform_device *pdev,enum msm_dsi_phy_type type,int id); +#else +static inline struct msm_dsi_pll *msm_dsi_pll_28nm_init ( +struct platform_device *pdev,enum msm_dsi_phy_type type,int id) +{ +return ERR_PTR (-ENODEV ); +} +#endif #endif /* __DSI_PLL_H__ */
Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel