10nm and 7nm already do not use these helpers, as they handle setting slave DSI clocks after enabling VCO. Modify the rest of PHY drivers to remove unnecessary indirection and drop enable_seq/disable_seq PLL callbacks. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org> Tested-by: Stephen Boyd <swboyd@chromium.org> # on sc7180 lazor Link: https://lore.kernel.org/r/20210331105735.3690009-17-dmitry.baryshkov@linaro.org Signed-off-by: Rob Clark <robdclark@chromium.org>
136 lines
3.5 KiB
C
136 lines
3.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#ifndef __DSI_PHY_H__
|
|
#define __DSI_PHY_H__
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/regulator/consumer.h>
|
|
|
|
#include "dsi.h"
|
|
|
|
#define dsi_phy_read(offset) msm_readl((offset))
|
|
#define dsi_phy_write(offset, data) msm_writel((data), (offset))
|
|
|
|
struct msm_dsi_pll {
|
|
struct clk_hw clk_hw;
|
|
bool pll_on;
|
|
bool state_saved;
|
|
|
|
const struct msm_dsi_phy_cfg *cfg;
|
|
};
|
|
|
|
#define hw_clk_to_pll(x) container_of(x, struct msm_dsi_pll, clk_hw)
|
|
|
|
struct msm_dsi_phy_ops {
|
|
int (*pll_init)(struct msm_dsi_phy *phy);
|
|
int (*enable)(struct msm_dsi_phy *phy, int src_pll_id,
|
|
struct msm_dsi_phy_clk_request *clk_req);
|
|
void (*disable)(struct msm_dsi_phy *phy);
|
|
};
|
|
|
|
struct msm_dsi_pll_ops {
|
|
void (*save_state)(struct msm_dsi_pll *pll);
|
|
int (*restore_state)(struct msm_dsi_pll *pll);
|
|
};
|
|
|
|
struct msm_dsi_phy_cfg {
|
|
struct dsi_reg_config reg_cfg;
|
|
struct msm_dsi_phy_ops ops;
|
|
const struct msm_dsi_pll_ops pll_ops;
|
|
|
|
unsigned long min_pll_rate;
|
|
unsigned long max_pll_rate;
|
|
|
|
/*
|
|
* Each cell {phy_id, pll_id} of the truth table indicates
|
|
* if the source PLL selection bit should be set for each PHY.
|
|
* Fill default H/W values in illegal cells, eg. cell {0, 1}.
|
|
*/
|
|
bool src_pll_truthtable[DSI_MAX][DSI_MAX];
|
|
const resource_size_t io_start[DSI_MAX];
|
|
const int num_dsi_phy;
|
|
const int quirks;
|
|
bool has_phy_regulator;
|
|
bool has_phy_lane;
|
|
};
|
|
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_14nm_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_14nm_660_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_10nm_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_10nm_8998_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_7nm_cfgs;
|
|
extern const struct msm_dsi_phy_cfg dsi_phy_7nm_8150_cfgs;
|
|
|
|
struct msm_dsi_dphy_timing {
|
|
u32 clk_zero;
|
|
u32 clk_trail;
|
|
u32 clk_prepare;
|
|
u32 hs_exit;
|
|
u32 hs_zero;
|
|
u32 hs_prepare;
|
|
u32 hs_trail;
|
|
u32 hs_rqst;
|
|
u32 ta_go;
|
|
u32 ta_sure;
|
|
u32 ta_get;
|
|
|
|
struct msm_dsi_phy_shared_timings shared_timings;
|
|
|
|
/* For PHY v2 only */
|
|
u32 hs_rqst_ckln;
|
|
u32 hs_prep_dly;
|
|
u32 hs_prep_dly_ckln;
|
|
u8 hs_halfbyte_en;
|
|
u8 hs_halfbyte_en_ckln;
|
|
};
|
|
|
|
#define DSI_BYTE_PLL_CLK 0
|
|
#define DSI_PIXEL_PLL_CLK 1
|
|
#define NUM_PROVIDED_CLKS 2
|
|
|
|
struct msm_dsi_phy {
|
|
struct platform_device *pdev;
|
|
void __iomem *base;
|
|
void __iomem *reg_base;
|
|
void __iomem *lane_base;
|
|
int id;
|
|
|
|
struct clk *ahb_clk;
|
|
struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX];
|
|
|
|
struct msm_dsi_dphy_timing timing;
|
|
const struct msm_dsi_phy_cfg *cfg;
|
|
|
|
enum msm_dsi_phy_usecase usecase;
|
|
bool regulator_ldo_mode;
|
|
|
|
struct msm_dsi_pll *pll;
|
|
|
|
struct clk_hw_onecell_data *provided_clocks;
|
|
};
|
|
|
|
/*
|
|
* PHY internal functions
|
|
*/
|
|
int msm_dsi_dphy_timing_calc(struct msm_dsi_dphy_timing *timing,
|
|
struct msm_dsi_phy_clk_request *clk_req);
|
|
int msm_dsi_dphy_timing_calc_v2(struct msm_dsi_dphy_timing *timing,
|
|
struct msm_dsi_phy_clk_request *clk_req);
|
|
int msm_dsi_dphy_timing_calc_v3(struct msm_dsi_dphy_timing *timing,
|
|
struct msm_dsi_phy_clk_request *clk_req);
|
|
int msm_dsi_dphy_timing_calc_v4(struct msm_dsi_dphy_timing *timing,
|
|
struct msm_dsi_phy_clk_request *clk_req);
|
|
void msm_dsi_phy_set_src_pll(struct msm_dsi_phy *phy, int pll_id, u32 reg,
|
|
u32 bit_mask);
|
|
|
|
#endif /* __DSI_PHY_H__ */
|
|
|