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) in mtk_hdmi_phy_power_on() argument
27 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy); in mtk_hdmi_phy_power_on()
30 ret = clk_prepare_enable(hdmi_phy->pll); in mtk_hdmi_phy_power_on()
34 hdmi_phy->conf->hdmi_phy_enable_tmds(hdmi_phy); in mtk_hdmi_phy_power_on()
38 static int mtk_hdmi_phy_power_off(struct phy *phy) in mtk_hdmi_phy_power_off() argument
40 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy); in mtk_hdmi_phy_power_off()
42 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); in mtk_hdmi_phy_power_off()
43 clk_disable_unprepare(hdmi_phy->pll); in mtk_hdmi_phy_power_off()
48 static int mtk_hdmi_phy_configure(struct phy *phy, union phy_configure_opts *opts) in mtk_hdmi_phy_configure() argument
50 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy); in mtk_hdmi_phy_configure()
52 if (hdmi_phy->conf->hdmi_phy_configure) in mtk_hdmi_phy_configure()
53 return hdmi_phy->conf->hdmi_phy_configure(phy, opts); in mtk_hdmi_phy_configure()
61 if (hdmi_phy && hdmi_phy->conf && in mtk_hdmi_phy_dev_get_ops()
62 hdmi_phy->conf->hdmi_phy_enable_tmds && in mtk_hdmi_phy_dev_get_ops()
63 hdmi_phy->conf->hdmi_phy_disable_tmds) in mtk_hdmi_phy_dev_get_ops()
67 dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); in mtk_hdmi_phy_dev_get_ops()
74 clk_init->flags = hdmi_phy->conf->flags; in mtk_hdmi_phy_clk_get_data()
75 clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops; in mtk_hdmi_phy_clk_get_data()
80 struct device *dev = &pdev->dev; in mtk_hdmi_phy_probe()
89 struct phy *phy; in mtk_hdmi_phy_probe() local
95 return -ENOMEM; in mtk_hdmi_phy_probe()
97 hdmi_phy->regs = devm_platform_ioremap_resource(pdev, 0); in mtk_hdmi_phy_probe()
98 if (IS_ERR(hdmi_phy->regs)) in mtk_hdmi_phy_probe()
99 return PTR_ERR(hdmi_phy->regs); in mtk_hdmi_phy_probe()
108 ret = of_property_read_string(dev->of_node, "clock-output-names", in mtk_hdmi_phy_probe()
111 return dev_err_probe(dev, ret, "Failed to read clock-output-names\n"); in mtk_hdmi_phy_probe()
113 hdmi_phy->dev = dev; in mtk_hdmi_phy_probe()
114 hdmi_phy->conf = in mtk_hdmi_phy_probe()
117 hdmi_phy->pll_hw.init = &clk_init; in mtk_hdmi_phy_probe()
118 hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw); in mtk_hdmi_phy_probe()
119 if (IS_ERR(hdmi_phy->pll)) in mtk_hdmi_phy_probe()
120 return dev_err_probe(dev, PTR_ERR(hdmi_phy->pll), in mtk_hdmi_phy_probe()
123 ret = of_property_read_u32(dev->of_node, "mediatek,ibias", in mtk_hdmi_phy_probe()
124 &hdmi_phy->ibias); in mtk_hdmi_phy_probe()
128 ret = of_property_read_u32(dev->of_node, "mediatek,ibias_up", in mtk_hdmi_phy_probe()
129 &hdmi_phy->ibias_up); in mtk_hdmi_phy_probe()
134 hdmi_phy->drv_imp_clk = 0x30; in mtk_hdmi_phy_probe()
135 hdmi_phy->drv_imp_d2 = 0x30; in mtk_hdmi_phy_probe()
136 hdmi_phy->drv_imp_d1 = 0x30; in mtk_hdmi_phy_probe()
137 hdmi_phy->drv_imp_d0 = 0x30; in mtk_hdmi_phy_probe()
139 phy = devm_phy_create(dev, NULL, mtk_hdmi_phy_dev_get_ops(hdmi_phy)); in mtk_hdmi_phy_probe()
140 if (IS_ERR(phy)) in mtk_hdmi_phy_probe()
141 return dev_err_probe(dev, PTR_ERR(phy), "Cannot create HDMI PHY\n"); in mtk_hdmi_phy_probe()
143 phy_set_drvdata(phy, hdmi_phy); in mtk_hdmi_phy_probe()
148 "Failed to register HDMI PHY\n"); in mtk_hdmi_phy_probe()
150 if (hdmi_phy->conf->pll_default_off) in mtk_hdmi_phy_probe()
151 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); in mtk_hdmi_phy_probe()
153 return of_clk_add_provider(dev->of_node, of_clk_src_simple_get, in mtk_hdmi_phy_probe()
154 hdmi_phy->pll); in mtk_hdmi_phy_probe()
158 { .compatible = "mediatek,mt2701-hdmi-phy",
161 { .compatible = "mediatek,mt8173-hdmi-phy",
164 { .compatible = "mediatek,mt8195-hdmi-phy",
174 .name = "mediatek-hdmi-phy",
180 MODULE_DESCRIPTION("MediaTek HDMI PHY Driver");