Lines Matching refs:hdmi

13 #include <sound/hdmi-codec.h>
14 #include "hdmi.h"
16 void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on)
21 spin_lock_irqsave(&hdmi->reg_lock, flags);
24 if (!hdmi->hdmi_mode) {
26 hdmi_write(hdmi, REG_HDMI_CTRL, ctrl);
35 hdmi_write(hdmi, REG_HDMI_CTRL, ctrl);
36 spin_unlock_irqrestore(&hdmi->reg_lock, flags);
43 struct hdmi *hdmi = dev_id;
46 msm_hdmi_hpd_irq(hdmi->bridge);
49 msm_hdmi_i2c_irq(hdmi->i2c);
52 if (hdmi->hdcp_ctrl)
53 msm_hdmi_hdcp_irq(hdmi->hdcp_ctrl);
60 static void msm_hdmi_destroy(struct hdmi *hdmi)
66 if (hdmi->workq) {
67 flush_workqueue(hdmi->workq);
68 destroy_workqueue(hdmi->workq);
70 msm_hdmi_hdcp_destroy(hdmi);
72 if (hdmi->phy_dev) {
73 put_device(hdmi->phy_dev);
74 hdmi->phy = NULL;
75 hdmi->phy_dev = NULL;
78 if (hdmi->i2c)
79 msm_hdmi_i2c_destroy(hdmi->i2c);
81 platform_set_drvdata(hdmi->pdev, NULL);
84 static int msm_hdmi_get_phy(struct hdmi *hdmi)
86 struct platform_device *pdev = hdmi->pdev;
98 hdmi->phy = platform_get_drvdata(phy_pdev);
106 if (!hdmi->phy) {
112 hdmi->phy_dev = get_device(&phy_pdev->dev);
117 /* construct hdmi at bind/probe time, grab all the resources. If
121 static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
124 struct hdmi *hdmi = NULL;
128 hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
129 if (!hdmi) {
134 hdmi->pdev = pdev;
135 hdmi->config = config;
136 spin_lock_init(&hdmi->reg_lock);
138 hdmi->mmio = msm_ioremap(pdev, config->mmio_name, "HDMI");
139 if (IS_ERR(hdmi->mmio)) {
140 ret = PTR_ERR(hdmi->mmio);
144 /* HDCP needs physical address of hdmi register */
151 hdmi->mmio_phy_addr = res->start;
153 hdmi->qfprom_mmio = msm_ioremap(pdev,
155 if (IS_ERR(hdmi->qfprom_mmio)) {
157 hdmi->qfprom_mmio = NULL;
160 hdmi->hpd_regs = devm_kcalloc(&pdev->dev,
162 sizeof(hdmi->hpd_regs[0]),
164 if (!hdmi->hpd_regs) {
180 hdmi->hpd_regs[i] = reg;
183 hdmi->pwr_regs = devm_kcalloc(&pdev->dev,
185 sizeof(hdmi->pwr_regs[0]),
187 if (!hdmi->pwr_regs) {
203 hdmi->pwr_regs[i] = reg;
206 hdmi->hpd_clks = devm_kcalloc(&pdev->dev,
208 sizeof(hdmi->hpd_clks[0]),
210 if (!hdmi->hpd_clks) {
225 hdmi->hpd_clks[i] = clk;
228 hdmi->pwr_clks = devm_kcalloc(&pdev->dev,
230 sizeof(hdmi->pwr_clks[0]),
232 if (!hdmi->pwr_clks) {
247 hdmi->pwr_clks[i] = clk;
250 hdmi->hpd_gpiod = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN);
252 if (IS_ERR(hdmi->hpd_gpiod)) {
253 ret = PTR_ERR(hdmi->hpd_gpiod);
258 if (!hdmi->hpd_gpiod)
261 if (hdmi->hpd_gpiod)
262 gpiod_set_consumer_name(hdmi->hpd_gpiod, "HDMI_HPD");
266 hdmi->workq = alloc_ordered_workqueue("msm_hdmi", 0);
267 if (!hdmi->workq) {
272 hdmi->i2c = msm_hdmi_i2c_init(hdmi);
273 if (IS_ERR(hdmi->i2c)) {
274 ret = PTR_ERR(hdmi->i2c);
276 hdmi->i2c = NULL;
280 ret = msm_hdmi_get_phy(hdmi);
286 hdmi->hdcp_ctrl = msm_hdmi_hdcp_init(hdmi);
287 if (IS_ERR(hdmi->hdcp_ctrl)) {
289 hdmi->hdcp_ctrl = NULL;
292 return hdmi;
295 if (hdmi)
296 msm_hdmi_destroy(hdmi);
303 * driver (not hdmi sub-device's probe/bind!)
307 * hdmi sub-device's probe.
309 int msm_hdmi_modeset_init(struct hdmi *hdmi,
313 struct platform_device *pdev = hdmi->pdev;
321 hdmi->dev = dev;
322 hdmi->encoder = encoder;
324 hdmi_audio_infoframe_init(&hdmi->audio.infoframe);
326 hdmi->bridge = msm_hdmi_bridge_init(hdmi);
327 if (IS_ERR(hdmi->bridge)) {
328 ret = PTR_ERR(hdmi->bridge);
330 hdmi->bridge = NULL;
334 hdmi->connector = drm_bridge_connector_init(hdmi->dev, encoder);
335 if (IS_ERR(hdmi->connector)) {
336 ret = PTR_ERR(hdmi->connector);
338 hdmi->connector = NULL;
342 drm_connector_attach_encoder(hdmi->connector, hdmi->encoder);
344 hdmi->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
345 if (!hdmi->irq) {
351 ret = devm_request_irq(dev->dev, hdmi->irq,
353 "hdmi_isr", hdmi);
356 hdmi->irq, ret);
360 drm_bridge_connector_enable_hpd(hdmi->connector);
362 ret = msm_hdmi_hpd_enable(hdmi->bridge);
364 DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);
368 priv->bridges[priv->num_bridges++] = hdmi->bridge;
369 priv->connectors[priv->num_connectors++] = hdmi->connector;
371 platform_set_drvdata(pdev, hdmi);
377 if (hdmi->bridge) {
378 msm_hdmi_bridge_destroy(hdmi->bridge);
379 hdmi->bridge = NULL;
381 if (hdmi->connector) {
382 hdmi->connector->funcs->destroy(hdmi->connector);
383 hdmi->connector = NULL;
390 * The hdmi device:
402 static const char *hpd_reg_names_8960[] = {"core-vdda", "hdmi-mux"};
457 struct hdmi *hdmi = dev_get_drvdata(dev);
520 msm_hdmi_audio_set_sample_rate(hdmi, rate);
521 msm_hdmi_audio_info_setup(hdmi, 1, chan, channel_allocation,
529 struct hdmi *hdmi = dev_get_drvdata(dev);
531 msm_hdmi_audio_info_setup(hdmi, 0, 0, 0, 0, 0);
545 static int msm_hdmi_register_audio_driver(struct hdmi *hdmi, struct device *dev)
547 hdmi->audio_pdev = platform_device_register_data(dev,
552 return PTR_ERR_OR_ZERO(hdmi->audio_pdev);
560 struct hdmi *hdmi;
576 hdmi = msm_hdmi_init(to_platform_device(dev));
577 if (IS_ERR(hdmi))
578 return PTR_ERR(hdmi);
579 priv->hdmi = hdmi;
581 err = msm_hdmi_register_audio_driver(hdmi, dev);
584 hdmi->audio_pdev = NULL;
595 if (priv->hdmi) {
596 if (priv->hdmi->audio_pdev)
597 platform_device_unregister(priv->hdmi->audio_pdev);
599 msm_hdmi_destroy(priv->hdmi);
600 priv->hdmi = NULL;
621 { .compatible = "qcom,hdmi-tx-8996", .data = &hdmi_tx_8996_config },
622 { .compatible = "qcom,hdmi-tx-8994", .data = &hdmi_tx_8994_config },
623 { .compatible = "qcom,hdmi-tx-8084", .data = &hdmi_tx_8084_config },
624 { .compatible = "qcom,hdmi-tx-8974", .data = &hdmi_tx_8974_config },
625 { .compatible = "qcom,hdmi-tx-8960", .data = &hdmi_tx_8960_config },
626 { .compatible = "qcom,hdmi-tx-8660", .data = &hdmi_tx_8660_config },