Lines Matching +full:hdmi +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0
7 #include "phy-mtk-hdmi.h"
9 static int mtk_hdmi_phy_power_on(struct phy *phy);
10 static int mtk_hdmi_phy_power_off(struct phy *phy);
11 static int mtk_hdmi_phy_configure(struct phy *phy, union phy_configure_opts *opts);
25 static int mtk_hdmi_phy_power_on(struct phy *phy)
27 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
30 ret = clk_prepare_enable(hdmi_phy->pll);
34 hdmi_phy->conf->hdmi_phy_enable_tmds(hdmi_phy);
38 static int mtk_hdmi_phy_power_off(struct phy *phy)
40 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
42 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
43 clk_disable_unprepare(hdmi_phy->pll);
48 static int mtk_hdmi_phy_configure(struct phy *phy, union phy_configure_opts *opts)
50 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy);
52 if (hdmi_phy->conf->hdmi_phy_configure)
53 return hdmi_phy->conf->hdmi_phy_configure(phy, opts);
61 if (hdmi_phy && hdmi_phy->conf &&
62 hdmi_phy->conf->hdmi_phy_enable_tmds &&
63 hdmi_phy->conf->hdmi_phy_disable_tmds)
67 dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n");
74 clk_init->flags = hdmi_phy->conf->flags;
75 clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops;
80 const struct regulator_desc *vreg_desc = hdmi_phy->conf->hdmi_phy_regulator_desc;
87 .dev = hdmi_phy->dev,
90 .of_node = hdmi_phy->dev->of_node
93 hdmi_phy->rdev = devm_regulator_register(hdmi_phy->dev, vreg_desc, &vreg_config);
94 if (IS_ERR(hdmi_phy->rdev))
95 return PTR_ERR(hdmi_phy->rdev);
102 struct device *dev = &pdev->dev;
111 struct phy *phy;
117 return -ENOMEM;
119 hdmi_phy->regs = devm_platform_ioremap_resource(pdev, 0);
120 if (IS_ERR(hdmi_phy->regs))
121 return PTR_ERR(hdmi_phy->regs);
130 ret = of_property_read_string(dev->of_node, "clock-output-names",
133 return dev_err_probe(dev, ret, "Failed to read clock-output-names\n");
135 hdmi_phy->dev = dev;
136 hdmi_phy->conf =
139 hdmi_phy->pll_hw.init = &clk_init;
140 hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw);
141 if (IS_ERR(hdmi_phy->pll))
142 return dev_err_probe(dev, PTR_ERR(hdmi_phy->pll),
145 ret = of_property_read_u32(dev->of_node, "mediatek,ibias",
146 &hdmi_phy->ibias);
150 ret = of_property_read_u32(dev->of_node, "mediatek,ibias_up",
151 &hdmi_phy->ibias_up);
156 hdmi_phy->drv_imp_clk = 0x30;
157 hdmi_phy->drv_imp_d2 = 0x30;
158 hdmi_phy->drv_imp_d1 = 0x30;
159 hdmi_phy->drv_imp_d0 = 0x30;
161 phy = devm_phy_create(dev, NULL, mtk_hdmi_phy_dev_get_ops(hdmi_phy));
162 if (IS_ERR(phy))
163 return dev_err_probe(dev, PTR_ERR(phy), "Cannot create HDMI PHY\n");
165 phy_set_drvdata(phy, hdmi_phy);
170 "Failed to register HDMI PHY\n");
172 if (hdmi_phy->conf->pll_default_off)
173 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
175 if (hdmi_phy->conf->hdmi_phy_regulator_desc) {
181 return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
182 hdmi_phy->pll);
186 { .compatible = "mediatek,mt2701-hdmi-phy",
189 { .compatible = "mediatek,mt8173-hdmi-phy",
192 { .compatible = "mediatek,mt8195-hdmi-phy",
202 .name = "mediatek-hdmi-phy",
208 MODULE_DESCRIPTION("MediaTek HDMI PHY Driver");