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);
23 static int mtk_hdmi_phy_power_on(struct phy *phy) in mtk_hdmi_phy_power_on() argument
25 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy); in mtk_hdmi_phy_power_on()
28 ret = clk_prepare_enable(hdmi_phy->pll); in mtk_hdmi_phy_power_on()
32 hdmi_phy->conf->hdmi_phy_enable_tmds(hdmi_phy); in mtk_hdmi_phy_power_on()
36 static int mtk_hdmi_phy_power_off(struct phy *phy) in mtk_hdmi_phy_power_off() argument
38 struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(phy); in mtk_hdmi_phy_power_off()
40 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); in mtk_hdmi_phy_power_off()
41 clk_disable_unprepare(hdmi_phy->pll); in mtk_hdmi_phy_power_off()
49 if (hdmi_phy && hdmi_phy->conf && in mtk_hdmi_phy_dev_get_ops()
50 hdmi_phy->conf->hdmi_phy_enable_tmds && in mtk_hdmi_phy_dev_get_ops()
51 hdmi_phy->conf->hdmi_phy_disable_tmds) in mtk_hdmi_phy_dev_get_ops()
55 dev_err(hdmi_phy->dev, "Failed to get dev ops of phy\n"); in mtk_hdmi_phy_dev_get_ops()
62 clk_init->flags = hdmi_phy->conf->flags; in mtk_hdmi_phy_clk_get_data()
63 clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops; in mtk_hdmi_phy_clk_get_data()
68 struct device *dev = &pdev->dev; in mtk_hdmi_phy_probe()
77 struct phy *phy; in mtk_hdmi_phy_probe() local
83 return -ENOMEM; in mtk_hdmi_phy_probe()
85 hdmi_phy->regs = devm_platform_ioremap_resource(pdev, 0); in mtk_hdmi_phy_probe()
86 if (IS_ERR(hdmi_phy->regs)) in mtk_hdmi_phy_probe()
87 return PTR_ERR(hdmi_phy->regs); in mtk_hdmi_phy_probe()
96 ret = of_property_read_string(dev->of_node, "clock-output-names", in mtk_hdmi_phy_probe()
99 return dev_err_probe(dev, ret, "Failed to read clock-output-names\n"); in mtk_hdmi_phy_probe()
101 hdmi_phy->dev = dev; in mtk_hdmi_phy_probe()
102 hdmi_phy->conf = in mtk_hdmi_phy_probe()
105 hdmi_phy->pll_hw.init = &clk_init; in mtk_hdmi_phy_probe()
106 hdmi_phy->pll = devm_clk_register(dev, &hdmi_phy->pll_hw); in mtk_hdmi_phy_probe()
107 if (IS_ERR(hdmi_phy->pll)) in mtk_hdmi_phy_probe()
108 return dev_err_probe(dev, PTR_ERR(hdmi_phy->pll), in mtk_hdmi_phy_probe()
111 ret = of_property_read_u32(dev->of_node, "mediatek,ibias", in mtk_hdmi_phy_probe()
112 &hdmi_phy->ibias); in mtk_hdmi_phy_probe()
116 ret = of_property_read_u32(dev->of_node, "mediatek,ibias_up", in mtk_hdmi_phy_probe()
117 &hdmi_phy->ibias_up); in mtk_hdmi_phy_probe()
122 hdmi_phy->drv_imp_clk = 0x30; in mtk_hdmi_phy_probe()
123 hdmi_phy->drv_imp_d2 = 0x30; in mtk_hdmi_phy_probe()
124 hdmi_phy->drv_imp_d1 = 0x30; in mtk_hdmi_phy_probe()
125 hdmi_phy->drv_imp_d0 = 0x30; in mtk_hdmi_phy_probe()
127 phy = devm_phy_create(dev, NULL, mtk_hdmi_phy_dev_get_ops(hdmi_phy)); in mtk_hdmi_phy_probe()
128 if (IS_ERR(phy)) in mtk_hdmi_phy_probe()
129 return dev_err_probe(dev, PTR_ERR(phy), "Cannot create HDMI PHY\n"); in mtk_hdmi_phy_probe()
131 phy_set_drvdata(phy, hdmi_phy); in mtk_hdmi_phy_probe()
136 "Failed to register HDMI PHY\n"); in mtk_hdmi_phy_probe()
138 if (hdmi_phy->conf->pll_default_off) in mtk_hdmi_phy_probe()
139 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); in mtk_hdmi_phy_probe()
141 return of_clk_add_provider(dev->of_node, of_clk_src_simple_get, in mtk_hdmi_phy_probe()
142 hdmi_phy->pll); in mtk_hdmi_phy_probe()
146 { .compatible = "mediatek,mt2701-hdmi-phy",
149 { .compatible = "mediatek,mt8173-hdmi-phy",
159 .name = "mediatek-hdmi-phy",
165 MODULE_DESCRIPTION("MediaTek HDMI PHY Driver");