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

1 // SPDX-License-Identifier: GPL-2.0+
22 struct sun8i_dw_hdmi *hdmi = encoder_to_sun8i_dw_hdmi(encoder); in sun8i_dw_hdmi_encoder_mode_set() local
24 clk_set_rate(hdmi->clk_tmds, mode->crtc_clock * 1000); in sun8i_dw_hdmi_encoder_mode_set()
33 sun8i_dw_hdmi_mode_valid_a83t(struct dw_hdmi *hdmi, void *data, in sun8i_dw_hdmi_mode_valid_a83t() argument
37 if (mode->clock > 297000) in sun8i_dw_hdmi_mode_valid_a83t()
44 sun8i_dw_hdmi_mode_valid_h6(struct dw_hdmi *hdmi, void *data, in sun8i_dw_hdmi_mode_valid_h6() argument
52 if (mode->clock > 594000) in sun8i_dw_hdmi_mode_valid_h6()
70 remote = of_graph_get_remote_node(node, 0, -1); in sun8i_dw_hdmi_find_possible_crtcs()
104 struct sun8i_dw_hdmi *hdmi; in sun8i_dw_hdmi_bind() local
107 if (!pdev->dev.of_node) in sun8i_dw_hdmi_bind()
108 return -ENODEV; in sun8i_dw_hdmi_bind()
110 hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); in sun8i_dw_hdmi_bind()
111 if (!hdmi) in sun8i_dw_hdmi_bind()
112 return -ENOMEM; in sun8i_dw_hdmi_bind()
114 plat_data = &hdmi->plat_data; in sun8i_dw_hdmi_bind()
115 hdmi->dev = &pdev->dev; in sun8i_dw_hdmi_bind()
116 encoder = &hdmi->encoder; in sun8i_dw_hdmi_bind()
118 hdmi->quirks = of_device_get_match_data(dev); in sun8i_dw_hdmi_bind()
120 encoder->possible_crtcs = in sun8i_dw_hdmi_bind()
121 sun8i_dw_hdmi_find_possible_crtcs(drm, dev->of_node); in sun8i_dw_hdmi_bind()
128 if (encoder->possible_crtcs == 0) in sun8i_dw_hdmi_bind()
129 return -EPROBE_DEFER; in sun8i_dw_hdmi_bind()
131 hdmi->rst_ctrl = devm_reset_control_get(dev, "ctrl"); in sun8i_dw_hdmi_bind()
132 if (IS_ERR(hdmi->rst_ctrl)) in sun8i_dw_hdmi_bind()
133 return dev_err_probe(dev, PTR_ERR(hdmi->rst_ctrl), in sun8i_dw_hdmi_bind()
136 hdmi->clk_tmds = devm_clk_get(dev, "tmds"); in sun8i_dw_hdmi_bind()
137 if (IS_ERR(hdmi->clk_tmds)) in sun8i_dw_hdmi_bind()
138 return dev_err_probe(dev, PTR_ERR(hdmi->clk_tmds), in sun8i_dw_hdmi_bind()
141 hdmi->regulator = devm_regulator_get(dev, "hvcc"); in sun8i_dw_hdmi_bind()
142 if (IS_ERR(hdmi->regulator)) in sun8i_dw_hdmi_bind()
143 return dev_err_probe(dev, PTR_ERR(hdmi->regulator), in sun8i_dw_hdmi_bind()
146 ret = regulator_enable(hdmi->regulator); in sun8i_dw_hdmi_bind()
152 ret = reset_control_deassert(hdmi->rst_ctrl); in sun8i_dw_hdmi_bind()
158 ret = clk_prepare_enable(hdmi->clk_tmds); in sun8i_dw_hdmi_bind()
164 phy_node = of_parse_phandle(dev->of_node, "phys", 0); in sun8i_dw_hdmi_bind()
166 dev_err(dev, "Can't found PHY phandle\n"); in sun8i_dw_hdmi_bind()
167 ret = -EINVAL; in sun8i_dw_hdmi_bind()
171 ret = sun8i_hdmi_phy_get(hdmi, phy_node); in sun8i_dw_hdmi_bind()
174 dev_err(dev, "Couldn't get the HDMI PHY\n"); in sun8i_dw_hdmi_bind()
178 ret = sun8i_hdmi_phy_init(hdmi->phy); in sun8i_dw_hdmi_bind()
185 plat_data->mode_valid = hdmi->quirks->mode_valid; in sun8i_dw_hdmi_bind()
186 plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe; in sun8i_dw_hdmi_bind()
187 sun8i_hdmi_phy_set_ops(hdmi->phy, plat_data); in sun8i_dw_hdmi_bind()
189 platform_set_drvdata(pdev, hdmi); in sun8i_dw_hdmi_bind()
191 hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); in sun8i_dw_hdmi_bind()
197 if (IS_ERR(hdmi->hdmi)) { in sun8i_dw_hdmi_bind()
198 ret = PTR_ERR(hdmi->hdmi); in sun8i_dw_hdmi_bind()
207 clk_disable_unprepare(hdmi->clk_tmds); in sun8i_dw_hdmi_bind()
209 reset_control_assert(hdmi->rst_ctrl); in sun8i_dw_hdmi_bind()
211 regulator_disable(hdmi->regulator); in sun8i_dw_hdmi_bind()
219 struct sun8i_dw_hdmi *hdmi = dev_get_drvdata(dev); in sun8i_dw_hdmi_unbind() local
221 dw_hdmi_unbind(hdmi->hdmi); in sun8i_dw_hdmi_unbind()
222 sun8i_hdmi_phy_deinit(hdmi->phy); in sun8i_dw_hdmi_unbind()
223 clk_disable_unprepare(hdmi->clk_tmds); in sun8i_dw_hdmi_unbind()
224 reset_control_assert(hdmi->rst_ctrl); in sun8i_dw_hdmi_unbind()
225 regulator_disable(hdmi->regulator); in sun8i_dw_hdmi_unbind()
235 return component_add(&pdev->dev, &sun8i_dw_hdmi_ops); in sun8i_dw_hdmi_probe()
240 component_del(&pdev->dev, &sun8i_dw_hdmi_ops); in sun8i_dw_hdmi_remove()
254 .compatible = "allwinner,sun8i-a83t-dw-hdmi",
258 .compatible = "allwinner,sun50i-h6-dw-hdmi",
269 .name = "sun8i-dw-hdmi",
301 MODULE_DESCRIPTION("Allwinner DW HDMI bridge");