Lines Matching +full:t +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0-only
10 static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy) in msm_hdmi_phy_resource_init() argument
12 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_init()
13 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_init()
16 phy->regs = devm_kcalloc(dev, cfg->num_regs, sizeof(phy->regs[0]), in msm_hdmi_phy_resource_init()
18 if (!phy->regs) in msm_hdmi_phy_resource_init()
19 return -ENOMEM; in msm_hdmi_phy_resource_init()
21 phy->clks = devm_kcalloc(dev, cfg->num_clks, sizeof(phy->clks[0]), in msm_hdmi_phy_resource_init()
23 if (!phy->clks) in msm_hdmi_phy_resource_init()
24 return -ENOMEM; in msm_hdmi_phy_resource_init()
26 for (i = 0; i < cfg->num_regs; i++) { in msm_hdmi_phy_resource_init()
29 reg = devm_regulator_get(dev, cfg->reg_names[i]); in msm_hdmi_phy_resource_init()
32 if (ret != -EPROBE_DEFER) { in msm_hdmi_phy_resource_init()
34 "failed to get phy regulator: %s (%d)\n", in msm_hdmi_phy_resource_init()
35 cfg->reg_names[i], ret); in msm_hdmi_phy_resource_init()
41 phy->regs[i] = reg; in msm_hdmi_phy_resource_init()
44 for (i = 0; i < cfg->num_clks; i++) { in msm_hdmi_phy_resource_init()
47 clk = msm_clk_get(phy->pdev, cfg->clk_names[i]); in msm_hdmi_phy_resource_init()
50 DRM_DEV_ERROR(dev, "failed to get phy clock: %s (%d)\n", in msm_hdmi_phy_resource_init()
51 cfg->clk_names[i], ret); in msm_hdmi_phy_resource_init()
55 phy->clks[i] = clk; in msm_hdmi_phy_resource_init()
61 int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy) in msm_hdmi_phy_resource_enable() argument
63 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_enable()
64 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_enable()
69 for (i = 0; i < cfg->num_regs; i++) { in msm_hdmi_phy_resource_enable()
70 ret = regulator_enable(phy->regs[i]); in msm_hdmi_phy_resource_enable()
73 cfg->reg_names[i], ret); in msm_hdmi_phy_resource_enable()
76 for (i = 0; i < cfg->num_clks; i++) { in msm_hdmi_phy_resource_enable()
77 ret = clk_prepare_enable(phy->clks[i]); in msm_hdmi_phy_resource_enable()
80 cfg->clk_names[i], ret); in msm_hdmi_phy_resource_enable()
86 void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy) in msm_hdmi_phy_resource_disable() argument
88 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_disable()
89 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_disable()
92 for (i = cfg->num_clks - 1; i >= 0; i--) in msm_hdmi_phy_resource_disable()
93 clk_disable_unprepare(phy->clks[i]); in msm_hdmi_phy_resource_disable()
95 for (i = cfg->num_regs - 1; i >= 0; i--) in msm_hdmi_phy_resource_disable()
96 regulator_disable(phy->regs[i]); in msm_hdmi_phy_resource_disable()
101 void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock) in msm_hdmi_phy_powerup() argument
103 if (!phy || !phy->cfg->powerup) in msm_hdmi_phy_powerup()
106 phy->cfg->powerup(phy, pixclock); in msm_hdmi_phy_powerup()
109 void msm_hdmi_phy_powerdown(struct hdmi_phy *phy) in msm_hdmi_phy_powerdown() argument
111 if (!phy || !phy->cfg->powerdown) in msm_hdmi_phy_powerdown()
114 phy->cfg->powerdown(phy); in msm_hdmi_phy_powerdown()
130 * we don't have PLL support for these, don't report an error for now in msm_hdmi_phy_pll_init()
144 struct device *dev = &pdev->dev; in msm_hdmi_phy_probe()
145 struct hdmi_phy *phy; in msm_hdmi_phy_probe() local
148 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); in msm_hdmi_phy_probe()
149 if (!phy) in msm_hdmi_phy_probe()
150 return -ENODEV; in msm_hdmi_phy_probe()
152 phy->cfg = (struct hdmi_phy_cfg *)of_device_get_match_data(dev); in msm_hdmi_phy_probe()
153 if (!phy->cfg) in msm_hdmi_phy_probe()
154 return -ENODEV; in msm_hdmi_phy_probe()
156 phy->mmio = msm_ioremap(pdev, "hdmi_phy", "HDMI_PHY"); in msm_hdmi_phy_probe()
157 if (IS_ERR(phy->mmio)) { in msm_hdmi_phy_probe()
158 DRM_DEV_ERROR(dev, "%s: failed to map phy base\n", __func__); in msm_hdmi_phy_probe()
159 return -ENOMEM; in msm_hdmi_phy_probe()
162 phy->pdev = pdev; in msm_hdmi_phy_probe()
164 ret = msm_hdmi_phy_resource_init(phy); in msm_hdmi_phy_probe()
168 pm_runtime_enable(&pdev->dev); in msm_hdmi_phy_probe()
170 ret = msm_hdmi_phy_resource_enable(phy); in msm_hdmi_phy_probe()
174 ret = msm_hdmi_phy_pll_init(pdev, phy->cfg->type); in msm_hdmi_phy_probe()
176 DRM_DEV_ERROR(dev, "couldn't init PLL\n"); in msm_hdmi_phy_probe()
177 msm_hdmi_phy_resource_disable(phy); in msm_hdmi_phy_probe()
181 msm_hdmi_phy_resource_disable(phy); in msm_hdmi_phy_probe()
183 platform_set_drvdata(pdev, phy); in msm_hdmi_phy_probe()
190 pm_runtime_disable(&pdev->dev); in msm_hdmi_phy_remove()
196 { .compatible = "qcom,hdmi-phy-8660",
198 { .compatible = "qcom,hdmi-phy-8960",
200 { .compatible = "qcom,hdmi-phy-8974",
202 { .compatible = "qcom,hdmi-phy-8084",
204 { .compatible = "qcom,hdmi-phy-8996",