hdmi_phy
void (*powerup)(struct hdmi_phy *phy, unsigned long pixclock);
void (*powerdown)(struct hdmi_phy *phy);
static inline void hdmi_phy_write(struct hdmi_phy *phy, u32 reg, u32 data)
static inline u32 hdmi_phy_read(struct hdmi_phy *phy, u32 reg)
int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy);
void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy);
void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long pixclock);
void msm_hdmi_phy_powerdown(struct hdmi_phy *phy);
struct hdmi_phy;
struct hdmi_phy *phy;
struct hdmi_phy *phy = hdmi->phy;
struct hdmi_phy *phy = hdmi->phy;
void msm_hdmi_phy_powerdown(struct hdmi_phy *phy)
static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy)
struct hdmi_phy *phy;
int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy)
void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy)
void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long pixclock)
static void hdmi_phy_8960_powerdown(struct hdmi_phy *phy)
static void hdmi_phy_8960_powerup(struct hdmi_phy *phy,
struct hdmi_phy *phy = pll_get_phy(pll);
static int hdmi_8996_phy_ready_status(struct hdmi_phy *phy)
struct hdmi_phy *phy = pll_get_phy(pll);
struct hdmi_phy *phy = pll_get_phy(pll);
static inline struct hdmi_phy *pll_get_phy(struct hdmi_pll_8996 *pll)
struct hdmi_phy *phy = pll_get_phy(pll);
static int hdmi_8998_phy_ready_status(struct hdmi_phy *phy)
struct hdmi_phy *phy = pll_get_phy(pll);
struct hdmi_phy *phy = pll_get_phy(pll);
static inline struct hdmi_phy *pll_get_phy(struct hdmi_pll_8998 *pll)
static void hdmi_phy_8x60_powerup(struct hdmi_phy *phy,
static void hdmi_phy_8x60_powerdown(struct hdmi_phy *phy)
static void hdmi_phy_8x74_powerdown(struct hdmi_phy *phy)
static void hdmi_phy_8x74_powerup(struct hdmi_phy *phy,
static inline struct hdmi_phy *pll_get_phy(struct hdmi_pll_8960 *pll)
struct hdmi_phy *phy = pll_get_phy(pll);
struct hdmi_phy *phy = pll_get_phy(pll);
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *base = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
tmp = readl(hdmi_phy->regs + HDMI_CON6);
tmp = readl(hdmi_phy->regs + HDMI_CON2);
static void mtk_hdmi_phy_enable_tmds(struct mtk_hdmi_phy *hdmi_phy)
void __iomem *base = hdmi_phy->regs;
static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy)
void __iomem *base = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *base = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *base = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *base = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
hdmi_phy->pll_rate = req->rate;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *base = hdmi_phy->regs;
dev_dbg(hdmi_phy->dev, "%s: %lu Hz, parent: %lu Hz\n", __func__,
hdmi_ibias = hdmi_phy->ibias;
hdmi_ibias = hdmi_phy->ibias_up;
FIELD_PREP(RG_HDMITX_DRV_IMP_CLK, hdmi_phy->drv_imp_clk) |
FIELD_PREP(RG_HDMITX_DRV_IMP_D2, hdmi_phy->drv_imp_d2) |
FIELD_PREP(RG_HDMITX_DRV_IMP_D1, hdmi_phy->drv_imp_d1) |
FIELD_PREP(RG_HDMITX_DRV_IMP_D0, hdmi_phy->drv_imp_d0));
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
return hdmi_phy->pll_rate;
static void mtk_hdmi_phy_enable_tmds(struct mtk_hdmi_phy *hdmi_phy)
mtk_phy_set_bits(hdmi_phy->regs + HDMI_CON3,
static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy)
mtk_phy_clear_bits(hdmi_phy->regs + HDMI_CON3,
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *base = hdmi_phy->regs;
static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
static void mtk_hdmi_ana_fifo_en(struct mtk_hdmi_phy *hdmi_phy)
hdmi_phy->tmds_over_340M = true;
hdmi_phy->tmds_over_340M = false;
mtk_phy_set_bits(hdmi_phy->regs + HDMI_ANA_CTL, REG_ANA_HDMI20_FIFO_EN);
mtk_phy_tmds_clk_ratio(struct mtk_hdmi_phy *hdmi_phy, bool enable)
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *regs = hdmi_phy->regs;
u32 pixel_clk = hdmi_phy->pll_rate;
void __iomem *regs = hdmi_phy->regs;
mtk_hdmi_ana_fifo_en(hdmi_phy);
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *regs = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *regs = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
dev_dbg(hdmi_phy->dev, "%s: %lu Hz, parent: %lu Hz\n", __func__, rate,
return mtk_hdmi_pll_calc(hdmi_phy, hw, rate, parent_rate);
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
hdmi_phy->pll_rate = req->rate;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
return hdmi_phy->pll_rate;
static void vtx_signal_en(struct mtk_hdmi_phy *hdmi_phy, bool on)
void __iomem *regs = hdmi_phy->regs;
static void mtk_hdmi_phy_enable_tmds(struct mtk_hdmi_phy *hdmi_phy)
vtx_signal_en(hdmi_phy, true);
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy)
vtx_signal_en(hdmi_phy, false);
void __iomem *regs = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
ret = clk_set_rate(hdmi_phy->pll, dp_opts->link_rate);
mtk_phy_tmds_clk_ratio(hdmi_phy, hdmi_phy->tmds_over_340M);
struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev);
mtk_phy_set_bits(hdmi_phy->regs + HDMI_CTL_1, RG_HDMITX_PWR5V_O);
struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev);
mtk_phy_clear_bits(hdmi_phy->regs + HDMI_CTL_1, RG_HDMITX_PWR5V_O);
struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev);
return !!(readl(hdmi_phy->regs + HDMI_CTL_1) & RG_HDMITX_PWR5V_O);
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *regs = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);
void __iomem *regs = hdmi_phy->regs;
struct mtk_hdmi_phy *hdmi_phy;
hdmi_phy = devm_kzalloc(dev, sizeof(*hdmi_phy), GFP_KERNEL);
if (!hdmi_phy)
hdmi_phy->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(hdmi_phy->regs))
return PTR_ERR(hdmi_phy->regs);
hdmi_phy->dev = dev;
hdmi_phy->conf =
mtk_hdmi_phy_clk_get_data(hdmi_phy, &clk_init);
hdmi_phy->pll_hw.init = &clk_init;
hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw);
if (IS_ERR(hdmi_phy->pll))
return dev_err_probe(dev, PTR_ERR(hdmi_phy->pll),
&hdmi_phy->ibias);
&hdmi_phy->ibias_up);
hdmi_phy->drv_imp_clk = 0x30;
hdmi_phy->drv_imp_d2 = 0x30;
hdmi_phy->drv_imp_d1 = 0x30;
hdmi_phy->drv_imp_d0 = 0x30;
phy = devm_phy_create(dev, NULL, mtk_hdmi_phy_dev_get_ops(hdmi_phy));
phy_set_drvdata(phy, hdmi_phy);
if (hdmi_phy->conf->pll_default_off)
hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
if (hdmi_phy->conf->hdmi_phy_regulator_desc) {
ret = mtk_hdmi_phy_register_regulators(hdmi_phy);
hdmi_phy->pll);
struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
ret = clk_prepare_enable(hdmi_phy->pll);
hdmi_phy->conf->hdmi_phy_enable_tmds(hdmi_phy);
struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
clk_disable_unprepare(hdmi_phy->pll);
struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
if (hdmi_phy->conf->hdmi_phy_configure)
return hdmi_phy->conf->hdmi_phy_configure(phy, opts);
mtk_hdmi_phy_dev_get_ops(const struct mtk_hdmi_phy *hdmi_phy)
if (hdmi_phy && hdmi_phy->conf &&
hdmi_phy->conf->hdmi_phy_enable_tmds &&
hdmi_phy->conf->hdmi_phy_disable_tmds)
if (hdmi_phy)
dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n");
static void mtk_hdmi_phy_clk_get_data(struct mtk_hdmi_phy *hdmi_phy,
clk_init->flags = hdmi_phy->conf->flags;
clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops;
static int mtk_hdmi_phy_register_regulators(struct mtk_hdmi_phy *hdmi_phy)
const struct regulator_desc *vreg_desc = hdmi_phy->conf->hdmi_phy_regulator_desc;
.dev = hdmi_phy->dev,
.driver_data = hdmi_phy,
.of_node = hdmi_phy->dev->of_node
hdmi_phy->rdev = devm_regulator_register(hdmi_phy->dev, vreg_desc, &vreg_config);
if (IS_ERR(hdmi_phy->rdev))
return PTR_ERR(hdmi_phy->rdev);
void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);