Lines Matching +full:hdmi +full:- +full:phy

1 // SPDX-License-Identifier: GPL-2.0-only
8 #include "hdmi.h"
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()
27 phy->regs[i].supply = cfg->reg_names[i]; in msm_hdmi_phy_resource_init()
29 ret = devm_regulator_bulk_get(dev, cfg->num_regs, phy->regs); in msm_hdmi_phy_resource_init()
31 if (ret != -EPROBE_DEFER) in msm_hdmi_phy_resource_init()
32 DRM_DEV_ERROR(dev, "failed to get phy regulators: %d\n", ret); in msm_hdmi_phy_resource_init()
37 for (i = 0; i < cfg->num_clks; i++) { in msm_hdmi_phy_resource_init()
40 clk = msm_clk_get(phy->pdev, cfg->clk_names[i]); in msm_hdmi_phy_resource_init()
43 DRM_DEV_ERROR(dev, "failed to get phy clock: %s (%d)\n", in msm_hdmi_phy_resource_init()
44 cfg->clk_names[i], ret); in msm_hdmi_phy_resource_init()
48 phy->clks[i] = clk; in msm_hdmi_phy_resource_init()
54 int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy) in msm_hdmi_phy_resource_enable() argument
56 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_enable()
57 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_enable()
62 ret = regulator_bulk_enable(cfg->num_regs, phy->regs); in msm_hdmi_phy_resource_enable()
68 for (i = 0; i < cfg->num_clks; i++) { in msm_hdmi_phy_resource_enable()
69 ret = clk_prepare_enable(phy->clks[i]); in msm_hdmi_phy_resource_enable()
72 cfg->clk_names[i], ret); in msm_hdmi_phy_resource_enable()
78 void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy) in msm_hdmi_phy_resource_disable() argument
80 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_disable()
81 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_disable()
84 for (i = cfg->num_clks - 1; i >= 0; i--) in msm_hdmi_phy_resource_disable()
85 clk_disable_unprepare(phy->clks[i]); in msm_hdmi_phy_resource_disable()
87 regulator_bulk_disable(cfg->num_regs, phy->regs); in msm_hdmi_phy_resource_disable()
92 void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock) in msm_hdmi_phy_powerup() argument
94 if (!phy || !phy->cfg->powerup) in msm_hdmi_phy_powerup()
97 phy->cfg->powerup(phy, pixclock); in msm_hdmi_phy_powerup()
100 void msm_hdmi_phy_powerdown(struct hdmi_phy *phy) in msm_hdmi_phy_powerdown() argument
102 if (!phy || !phy->cfg->powerdown) in msm_hdmi_phy_powerdown()
105 phy->cfg->powerdown(phy); in msm_hdmi_phy_powerdown()
135 struct device *dev = &pdev->dev; in msm_hdmi_phy_probe()
136 struct hdmi_phy *phy; in msm_hdmi_phy_probe() local
139 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); in msm_hdmi_phy_probe()
140 if (!phy) in msm_hdmi_phy_probe()
141 return -ENODEV; in msm_hdmi_phy_probe()
143 phy->cfg = (struct hdmi_phy_cfg *)of_device_get_match_data(dev); in msm_hdmi_phy_probe()
144 if (!phy->cfg) in msm_hdmi_phy_probe()
145 return -ENODEV; in msm_hdmi_phy_probe()
147 phy->mmio = msm_ioremap(pdev, "hdmi_phy"); in msm_hdmi_phy_probe()
148 if (IS_ERR(phy->mmio)) { in msm_hdmi_phy_probe()
149 DRM_DEV_ERROR(dev, "%s: failed to map phy base\n", __func__); in msm_hdmi_phy_probe()
150 return -ENOMEM; in msm_hdmi_phy_probe()
153 phy->pdev = pdev; in msm_hdmi_phy_probe()
155 ret = msm_hdmi_phy_resource_init(phy); in msm_hdmi_phy_probe()
159 pm_runtime_enable(&pdev->dev); in msm_hdmi_phy_probe()
161 ret = msm_hdmi_phy_resource_enable(phy); in msm_hdmi_phy_probe()
165 ret = msm_hdmi_phy_pll_init(pdev, phy->cfg->type); in msm_hdmi_phy_probe()
168 msm_hdmi_phy_resource_disable(phy); in msm_hdmi_phy_probe()
172 msm_hdmi_phy_resource_disable(phy); in msm_hdmi_phy_probe()
174 platform_set_drvdata(pdev, phy); in msm_hdmi_phy_probe()
181 pm_runtime_disable(&pdev->dev); in msm_hdmi_phy_remove()
187 { .compatible = "qcom,hdmi-phy-8660",
189 { .compatible = "qcom,hdmi-phy-8960",
191 { .compatible = "qcom,hdmi-phy-8974",
193 { .compatible = "qcom,hdmi-phy-8084",
195 { .compatible = "qcom,hdmi-phy-8996",