Lines Matching +full:t +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0-only
11 static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy) in msm_hdmi_phy_resource_init() argument
13 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_init()
14 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_init()
17 phy->regs = devm_kcalloc(dev, cfg->num_regs, sizeof(phy->regs[0]), in msm_hdmi_phy_resource_init()
19 if (!phy->regs) in msm_hdmi_phy_resource_init()
20 return -ENOMEM; in msm_hdmi_phy_resource_init()
22 phy->clks = devm_kcalloc(dev, cfg->num_clks, sizeof(phy->clks[0]), in msm_hdmi_phy_resource_init()
24 if (!phy->clks) in msm_hdmi_phy_resource_init()
25 return -ENOMEM; in msm_hdmi_phy_resource_init()
27 for (i = 0; i < cfg->num_regs; i++) in msm_hdmi_phy_resource_init()
28 phy->regs[i].supply = cfg->reg_names[i]; in msm_hdmi_phy_resource_init()
30 ret = devm_regulator_bulk_get(dev, cfg->num_regs, phy->regs); in msm_hdmi_phy_resource_init()
32 if (ret != -EPROBE_DEFER) in msm_hdmi_phy_resource_init()
33 DRM_DEV_ERROR(dev, "failed to get phy regulators: %d\n", ret); in msm_hdmi_phy_resource_init()
38 for (i = 0; i < cfg->num_clks; i++) { in msm_hdmi_phy_resource_init()
41 clk = msm_clk_get(phy->pdev, cfg->clk_names[i]); in msm_hdmi_phy_resource_init()
44 DRM_DEV_ERROR(dev, "failed to get phy clock: %s (%d)\n", in msm_hdmi_phy_resource_init()
45 cfg->clk_names[i], ret); in msm_hdmi_phy_resource_init()
49 phy->clks[i] = clk; in msm_hdmi_phy_resource_init()
55 int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy) in msm_hdmi_phy_resource_enable() argument
57 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_enable()
58 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_enable()
63 ret = regulator_bulk_enable(cfg->num_regs, phy->regs); in msm_hdmi_phy_resource_enable()
69 for (i = 0; i < cfg->num_clks; i++) { in msm_hdmi_phy_resource_enable()
70 ret = clk_prepare_enable(phy->clks[i]); in msm_hdmi_phy_resource_enable()
73 cfg->clk_names[i], ret); in msm_hdmi_phy_resource_enable()
79 void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy) in msm_hdmi_phy_resource_disable() argument
81 struct hdmi_phy_cfg *cfg = phy->cfg; in msm_hdmi_phy_resource_disable()
82 struct device *dev = &phy->pdev->dev; in msm_hdmi_phy_resource_disable()
85 for (i = cfg->num_clks - 1; i >= 0; i--) in msm_hdmi_phy_resource_disable()
86 clk_disable_unprepare(phy->clks[i]); in msm_hdmi_phy_resource_disable()
88 regulator_bulk_disable(cfg->num_regs, phy->regs); in msm_hdmi_phy_resource_disable()
93 void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock) in msm_hdmi_phy_powerup() argument
95 if (!phy || !phy->cfg->powerup) in msm_hdmi_phy_powerup()
98 phy->cfg->powerup(phy, pixclock); in msm_hdmi_phy_powerup()
101 void msm_hdmi_phy_powerdown(struct hdmi_phy *phy) in msm_hdmi_phy_powerdown() argument
103 if (!phy || !phy->cfg->powerdown) in msm_hdmi_phy_powerdown()
106 phy->cfg->powerdown(phy); in msm_hdmi_phy_powerdown()
125 * we don't have PLL support for these, don't report an error for now in msm_hdmi_phy_pll_init()
139 struct device *dev = &pdev->dev; in msm_hdmi_phy_probe()
140 struct hdmi_phy *phy; in msm_hdmi_phy_probe() local
143 phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); in msm_hdmi_phy_probe()
144 if (!phy) in msm_hdmi_phy_probe()
145 return -ENODEV; in msm_hdmi_phy_probe()
147 phy->cfg = (struct hdmi_phy_cfg *)of_device_get_match_data(dev); in msm_hdmi_phy_probe()
148 if (!phy->cfg) in msm_hdmi_phy_probe()
149 return -ENODEV; in msm_hdmi_phy_probe()
151 phy->mmio = msm_ioremap(pdev, "hdmi_phy"); in msm_hdmi_phy_probe()
152 if (IS_ERR(phy->mmio)) { in msm_hdmi_phy_probe()
153 DRM_DEV_ERROR(dev, "%s: failed to map phy base\n", __func__); in msm_hdmi_phy_probe()
154 return -ENOMEM; in msm_hdmi_phy_probe()
157 phy->pdev = pdev; in msm_hdmi_phy_probe()
159 ret = msm_hdmi_phy_resource_init(phy); in msm_hdmi_phy_probe()
163 pm_runtime_enable(&pdev->dev); in msm_hdmi_phy_probe()
165 ret = msm_hdmi_phy_resource_enable(phy); in msm_hdmi_phy_probe()
169 ret = msm_hdmi_phy_pll_init(pdev, phy->cfg->type); in msm_hdmi_phy_probe()
171 DRM_DEV_ERROR(dev, "couldn't init PLL\n"); in msm_hdmi_phy_probe()
172 msm_hdmi_phy_resource_disable(phy); in msm_hdmi_phy_probe()
176 msm_hdmi_phy_resource_disable(phy); in msm_hdmi_phy_probe()
178 platform_set_drvdata(pdev, phy); in msm_hdmi_phy_probe()
185 pm_runtime_disable(&pdev->dev); in msm_hdmi_phy_remove()
189 { .compatible = "qcom,hdmi-phy-8660",
191 { .compatible = "qcom,hdmi-phy-8960",
193 { .compatible = "qcom,hdmi-phy-8974",
195 { .compatible = "qcom,hdmi-phy-8084",
197 { .compatible = "qcom,hdmi-phy-8996",
199 { .compatible = "qcom,hdmi-phy-8998",