1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2014 The Linux Foundation. All rights reserved.
4 * Copyright (C) 2013 Red Hat
5 * Author: Rob Clark <robdclark@gmail.com>
6 */
7
8 #include <linux/of_irq.h>
9 #include <linux/of_gpio.h>
10
11 #include <sound/hdmi-codec.h>
12 #include "hdmi.h"
13
msm_hdmi_set_mode(struct hdmi * hdmi,bool power_on)14 void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on)
15 {
16 uint32_t ctrl = 0;
17 unsigned long flags;
18
19 spin_lock_irqsave(&hdmi->reg_lock, flags);
20 if (power_on) {
21 ctrl |= HDMI_CTRL_ENABLE;
22 if (!hdmi->hdmi_mode) {
23 ctrl |= HDMI_CTRL_HDMI;
24 hdmi_write(hdmi, REG_HDMI_CTRL, ctrl);
25 ctrl &= ~HDMI_CTRL_HDMI;
26 } else {
27 ctrl |= HDMI_CTRL_HDMI;
28 }
29 } else {
30 ctrl = HDMI_CTRL_HDMI;
31 }
32
33 hdmi_write(hdmi, REG_HDMI_CTRL, ctrl);
34 spin_unlock_irqrestore(&hdmi->reg_lock, flags);
35 DBG("HDMI Core: %s, HDMI_CTRL=0x%08x",
36 power_on ? "Enable" : "Disable", ctrl);
37 }
38
msm_hdmi_irq(int irq,void * dev_id)39 static irqreturn_t msm_hdmi_irq(int irq, void *dev_id)
40 {
41 struct hdmi *hdmi = dev_id;
42
43 /* Process HPD: */
44 msm_hdmi_connector_irq(hdmi->connector);
45
46 /* Process DDC: */
47 msm_hdmi_i2c_irq(hdmi->i2c);
48
49 /* Process HDCP: */
50 if (hdmi->hdcp_ctrl)
51 msm_hdmi_hdcp_irq(hdmi->hdcp_ctrl);
52
53 /* TODO audio.. */
54
55 return IRQ_HANDLED;
56 }
57
msm_hdmi_destroy(struct hdmi * hdmi)58 static void msm_hdmi_destroy(struct hdmi *hdmi)
59 {
60 /*
61 * at this point, hpd has been disabled,
62 * after flush workq, it's safe to deinit hdcp
63 */
64 if (hdmi->workq)
65 destroy_workqueue(hdmi->workq);
66 msm_hdmi_hdcp_destroy(hdmi);
67
68 if (hdmi->phy_dev) {
69 put_device(hdmi->phy_dev);
70 hdmi->phy = NULL;
71 hdmi->phy_dev = NULL;
72 }
73
74 if (hdmi->i2c)
75 msm_hdmi_i2c_destroy(hdmi->i2c);
76
77 platform_set_drvdata(hdmi->pdev, NULL);
78 }
79
msm_hdmi_get_phy(struct hdmi * hdmi)80 static int msm_hdmi_get_phy(struct hdmi *hdmi)
81 {
82 struct platform_device *pdev = hdmi->pdev;
83 struct platform_device *phy_pdev;
84 struct device_node *phy_node;
85
86 phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
87 if (!phy_node) {
88 DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
89 return -ENXIO;
90 }
91
92 phy_pdev = of_find_device_by_node(phy_node);
93 if (phy_pdev)
94 hdmi->phy = platform_get_drvdata(phy_pdev);
95
96 of_node_put(phy_node);
97
98 if (!phy_pdev || !hdmi->phy) {
99 DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n");
100 return -EPROBE_DEFER;
101 }
102
103 hdmi->phy_dev = get_device(&phy_pdev->dev);
104
105 return 0;
106 }
107
108 /* construct hdmi at bind/probe time, grab all the resources. If
109 * we are to EPROBE_DEFER we want to do it here, rather than later
110 * at modeset_init() time
111 */
msm_hdmi_init(struct platform_device * pdev)112 static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
113 {
114 struct hdmi_platform_config *config = pdev->dev.platform_data;
115 struct hdmi *hdmi = NULL;
116 struct resource *res;
117 int i, ret;
118
119 hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
120 if (!hdmi) {
121 ret = -ENOMEM;
122 goto fail;
123 }
124
125 hdmi->pdev = pdev;
126 hdmi->config = config;
127 spin_lock_init(&hdmi->reg_lock);
128
129 hdmi->mmio = msm_ioremap(pdev, config->mmio_name, "HDMI");
130 if (IS_ERR(hdmi->mmio)) {
131 ret = PTR_ERR(hdmi->mmio);
132 goto fail;
133 }
134
135 /* HDCP needs physical address of hdmi register */
136 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
137 config->mmio_name);
138 hdmi->mmio_phy_addr = res->start;
139
140 hdmi->qfprom_mmio = msm_ioremap(pdev,
141 config->qfprom_mmio_name, "HDMI_QFPROM");
142 if (IS_ERR(hdmi->qfprom_mmio)) {
143 DRM_DEV_INFO(&pdev->dev, "can't find qfprom resource\n");
144 hdmi->qfprom_mmio = NULL;
145 }
146
147 hdmi->hpd_regs = devm_kcalloc(&pdev->dev,
148 config->hpd_reg_cnt,
149 sizeof(hdmi->hpd_regs[0]),
150 GFP_KERNEL);
151 if (!hdmi->hpd_regs) {
152 ret = -ENOMEM;
153 goto fail;
154 }
155 for (i = 0; i < config->hpd_reg_cnt; i++)
156 hdmi->hpd_regs[i].supply = config->hpd_reg_names[i];
157
158 ret = devm_regulator_bulk_get(&pdev->dev, config->hpd_reg_cnt, hdmi->hpd_regs);
159 if (ret) {
160 DRM_DEV_ERROR(&pdev->dev, "failed to get hpd regulator: %d\n", ret);
161 goto fail;
162 }
163
164 hdmi->pwr_regs = devm_kcalloc(&pdev->dev,
165 config->pwr_reg_cnt,
166 sizeof(hdmi->pwr_regs[0]),
167 GFP_KERNEL);
168 if (!hdmi->pwr_regs) {
169 ret = -ENOMEM;
170 goto fail;
171 }
172
173 ret = devm_regulator_bulk_get(&pdev->dev, config->pwr_reg_cnt, hdmi->pwr_regs);
174 if (ret) {
175 DRM_DEV_ERROR(&pdev->dev, "failed to get pwr regulator: %d\n", ret);
176 goto fail;
177 }
178
179 hdmi->hpd_clks = devm_kcalloc(&pdev->dev,
180 config->hpd_clk_cnt,
181 sizeof(hdmi->hpd_clks[0]),
182 GFP_KERNEL);
183 if (!hdmi->hpd_clks) {
184 ret = -ENOMEM;
185 goto fail;
186 }
187 for (i = 0; i < config->hpd_clk_cnt; i++) {
188 struct clk *clk;
189
190 clk = msm_clk_get(pdev, config->hpd_clk_names[i]);
191 if (IS_ERR(clk)) {
192 ret = PTR_ERR(clk);
193 DRM_DEV_ERROR(&pdev->dev, "failed to get hpd clk: %s (%d)\n",
194 config->hpd_clk_names[i], ret);
195 goto fail;
196 }
197
198 hdmi->hpd_clks[i] = clk;
199 }
200
201 hdmi->pwr_clks = devm_kcalloc(&pdev->dev,
202 config->pwr_clk_cnt,
203 sizeof(hdmi->pwr_clks[0]),
204 GFP_KERNEL);
205 if (!hdmi->pwr_clks) {
206 ret = -ENOMEM;
207 goto fail;
208 }
209 for (i = 0; i < config->pwr_clk_cnt; i++) {
210 struct clk *clk;
211
212 clk = msm_clk_get(pdev, config->pwr_clk_names[i]);
213 if (IS_ERR(clk)) {
214 ret = PTR_ERR(clk);
215 DRM_DEV_ERROR(&pdev->dev, "failed to get pwr clk: %s (%d)\n",
216 config->pwr_clk_names[i], ret);
217 goto fail;
218 }
219
220 hdmi->pwr_clks[i] = clk;
221 }
222
223 pm_runtime_enable(&pdev->dev);
224
225 hdmi->workq = alloc_ordered_workqueue("msm_hdmi", 0);
226
227 hdmi->i2c = msm_hdmi_i2c_init(hdmi);
228 if (IS_ERR(hdmi->i2c)) {
229 ret = PTR_ERR(hdmi->i2c);
230 DRM_DEV_ERROR(&pdev->dev, "failed to get i2c: %d\n", ret);
231 hdmi->i2c = NULL;
232 goto fail;
233 }
234
235 ret = msm_hdmi_get_phy(hdmi);
236 if (ret) {
237 DRM_DEV_ERROR(&pdev->dev, "failed to get phy\n");
238 goto fail;
239 }
240
241 hdmi->hdcp_ctrl = msm_hdmi_hdcp_init(hdmi);
242 if (IS_ERR(hdmi->hdcp_ctrl)) {
243 dev_warn(&pdev->dev, "failed to init hdcp: disabled\n");
244 hdmi->hdcp_ctrl = NULL;
245 }
246
247 return hdmi;
248
249 fail:
250 if (hdmi)
251 msm_hdmi_destroy(hdmi);
252
253 return ERR_PTR(ret);
254 }
255
256 /* Second part of initialization, the drm/kms level modeset_init,
257 * constructs/initializes mode objects, etc, is called from master
258 * driver (not hdmi sub-device's probe/bind!)
259 *
260 * Any resource (regulator/clk/etc) which could be missing at boot
261 * should be handled in msm_hdmi_init() so that failure happens from
262 * hdmi sub-device's probe.
263 */
msm_hdmi_modeset_init(struct hdmi * hdmi,struct drm_device * dev,struct drm_encoder * encoder)264 int msm_hdmi_modeset_init(struct hdmi *hdmi,
265 struct drm_device *dev, struct drm_encoder *encoder)
266 {
267 struct msm_drm_private *priv = dev->dev_private;
268 struct platform_device *pdev = hdmi->pdev;
269 int ret;
270
271 hdmi->dev = dev;
272 hdmi->encoder = encoder;
273
274 hdmi_audio_infoframe_init(&hdmi->audio.infoframe);
275
276 hdmi->bridge = msm_hdmi_bridge_init(hdmi);
277 if (IS_ERR(hdmi->bridge)) {
278 ret = PTR_ERR(hdmi->bridge);
279 DRM_DEV_ERROR(dev->dev, "failed to create HDMI bridge: %d\n", ret);
280 hdmi->bridge = NULL;
281 goto fail;
282 }
283
284 hdmi->connector = msm_hdmi_connector_init(hdmi);
285 if (IS_ERR(hdmi->connector)) {
286 ret = PTR_ERR(hdmi->connector);
287 DRM_DEV_ERROR(dev->dev, "failed to create HDMI connector: %d\n", ret);
288 hdmi->connector = NULL;
289 goto fail;
290 }
291
292 hdmi->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
293 if (hdmi->irq < 0) {
294 ret = hdmi->irq;
295 DRM_DEV_ERROR(dev->dev, "failed to get irq: %d\n", ret);
296 goto fail;
297 }
298
299 ret = devm_request_irq(&pdev->dev, hdmi->irq,
300 msm_hdmi_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
301 "hdmi_isr", hdmi);
302 if (ret < 0) {
303 DRM_DEV_ERROR(dev->dev, "failed to request IRQ%u: %d\n",
304 hdmi->irq, ret);
305 goto fail;
306 }
307
308 ret = msm_hdmi_hpd_enable(hdmi->connector);
309 if (ret < 0) {
310 DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret);
311 goto fail;
312 }
313
314 priv->bridges[priv->num_bridges++] = hdmi->bridge;
315 priv->connectors[priv->num_connectors++] = hdmi->connector;
316
317 platform_set_drvdata(pdev, hdmi);
318
319 return 0;
320
321 fail:
322 /* bridge is normally destroyed by drm: */
323 if (hdmi->bridge) {
324 msm_hdmi_bridge_destroy(hdmi->bridge);
325 hdmi->bridge = NULL;
326 }
327 if (hdmi->connector) {
328 hdmi->connector->funcs->destroy(hdmi->connector);
329 hdmi->connector = NULL;
330 }
331
332 return ret;
333 }
334
335 /*
336 * The hdmi device:
337 */
338
339 #define HDMI_CFG(item, entry) \
340 .item ## _names = item ##_names_ ## entry, \
341 .item ## _cnt = ARRAY_SIZE(item ## _names_ ## entry)
342
343 static const char *pwr_reg_names_none[] = {};
344 static const char *hpd_reg_names_none[] = {};
345
346 static struct hdmi_platform_config hdmi_tx_8660_config;
347
348 static const char *hpd_reg_names_8960[] = {"core-vdda", "hdmi-mux"};
349 static const char *hpd_clk_names_8960[] = {"core", "master_iface", "slave_iface"};
350
351 static struct hdmi_platform_config hdmi_tx_8960_config = {
352 HDMI_CFG(hpd_reg, 8960),
353 HDMI_CFG(hpd_clk, 8960),
354 };
355
356 static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"};
357 static const char *hpd_reg_names_8x74[] = {"hpd-gdsc", "hpd-5v"};
358 static const char *pwr_clk_names_8x74[] = {"extp", "alt_iface"};
359 static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core"};
360 static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0};
361
362 static struct hdmi_platform_config hdmi_tx_8974_config = {
363 HDMI_CFG(pwr_reg, 8x74),
364 HDMI_CFG(hpd_reg, 8x74),
365 HDMI_CFG(pwr_clk, 8x74),
366 HDMI_CFG(hpd_clk, 8x74),
367 .hpd_freq = hpd_clk_freq_8x74,
368 };
369
370 static const char *hpd_reg_names_8084[] = {"hpd-gdsc", "hpd-5v", "hpd-5v-en"};
371
372 static struct hdmi_platform_config hdmi_tx_8084_config = {
373 HDMI_CFG(pwr_reg, 8x74),
374 HDMI_CFG(hpd_reg, 8084),
375 HDMI_CFG(pwr_clk, 8x74),
376 HDMI_CFG(hpd_clk, 8x74),
377 .hpd_freq = hpd_clk_freq_8x74,
378 };
379
380 static struct hdmi_platform_config hdmi_tx_8994_config = {
381 HDMI_CFG(pwr_reg, 8x74),
382 HDMI_CFG(hpd_reg, none),
383 HDMI_CFG(pwr_clk, 8x74),
384 HDMI_CFG(hpd_clk, 8x74),
385 .hpd_freq = hpd_clk_freq_8x74,
386 };
387
388 static struct hdmi_platform_config hdmi_tx_8996_config = {
389 HDMI_CFG(pwr_reg, none),
390 HDMI_CFG(hpd_reg, none),
391 HDMI_CFG(pwr_clk, 8x74),
392 HDMI_CFG(hpd_clk, 8x74),
393 .hpd_freq = hpd_clk_freq_8x74,
394 };
395
396 static const struct {
397 const char *name;
398 const bool output;
399 const int value;
400 const char *label;
401 } msm_hdmi_gpio_pdata[] = {
402 { "qcom,hdmi-tx-ddc-clk", true, 1, "HDMI_DDC_CLK" },
403 { "qcom,hdmi-tx-ddc-data", true, 1, "HDMI_DDC_DATA" },
404 { "qcom,hdmi-tx-hpd", false, 1, "HDMI_HPD" },
405 { "qcom,hdmi-tx-mux-en", true, 1, "HDMI_MUX_EN" },
406 { "qcom,hdmi-tx-mux-sel", true, 0, "HDMI_MUX_SEL" },
407 { "qcom,hdmi-tx-mux-lpm", true, 1, "HDMI_MUX_LPM" },
408 };
409
410 /*
411 * HDMI audio codec callbacks
412 */
msm_hdmi_audio_hw_params(struct device * dev,void * data,struct hdmi_codec_daifmt * daifmt,struct hdmi_codec_params * params)413 static int msm_hdmi_audio_hw_params(struct device *dev, void *data,
414 struct hdmi_codec_daifmt *daifmt,
415 struct hdmi_codec_params *params)
416 {
417 struct hdmi *hdmi = dev_get_drvdata(dev);
418 unsigned int chan;
419 unsigned int channel_allocation = 0;
420 unsigned int rate;
421 unsigned int level_shift = 0; /* 0dB */
422 bool down_mix = false;
423
424 DRM_DEV_DEBUG(dev, "%u Hz, %d bit, %d channels\n", params->sample_rate,
425 params->sample_width, params->cea.channels);
426
427 switch (params->cea.channels) {
428 case 2:
429 /* FR and FL speakers */
430 channel_allocation = 0;
431 chan = MSM_HDMI_AUDIO_CHANNEL_2;
432 break;
433 case 4:
434 /* FC, LFE, FR and FL speakers */
435 channel_allocation = 0x3;
436 chan = MSM_HDMI_AUDIO_CHANNEL_4;
437 break;
438 case 6:
439 /* RR, RL, FC, LFE, FR and FL speakers */
440 channel_allocation = 0x0B;
441 chan = MSM_HDMI_AUDIO_CHANNEL_6;
442 break;
443 case 8:
444 /* FRC, FLC, RR, RL, FC, LFE, FR and FL speakers */
445 channel_allocation = 0x1F;
446 chan = MSM_HDMI_AUDIO_CHANNEL_8;
447 break;
448 default:
449 return -EINVAL;
450 }
451
452 switch (params->sample_rate) {
453 case 32000:
454 rate = HDMI_SAMPLE_RATE_32KHZ;
455 break;
456 case 44100:
457 rate = HDMI_SAMPLE_RATE_44_1KHZ;
458 break;
459 case 48000:
460 rate = HDMI_SAMPLE_RATE_48KHZ;
461 break;
462 case 88200:
463 rate = HDMI_SAMPLE_RATE_88_2KHZ;
464 break;
465 case 96000:
466 rate = HDMI_SAMPLE_RATE_96KHZ;
467 break;
468 case 176400:
469 rate = HDMI_SAMPLE_RATE_176_4KHZ;
470 break;
471 case 192000:
472 rate = HDMI_SAMPLE_RATE_192KHZ;
473 break;
474 default:
475 DRM_DEV_ERROR(dev, "rate[%d] not supported!\n",
476 params->sample_rate);
477 return -EINVAL;
478 }
479
480 msm_hdmi_audio_set_sample_rate(hdmi, rate);
481 msm_hdmi_audio_info_setup(hdmi, 1, chan, channel_allocation,
482 level_shift, down_mix);
483
484 return 0;
485 }
486
msm_hdmi_audio_shutdown(struct device * dev,void * data)487 static void msm_hdmi_audio_shutdown(struct device *dev, void *data)
488 {
489 struct hdmi *hdmi = dev_get_drvdata(dev);
490
491 msm_hdmi_audio_info_setup(hdmi, 0, 0, 0, 0, 0);
492 }
493
494 static const struct hdmi_codec_ops msm_hdmi_audio_codec_ops = {
495 .hw_params = msm_hdmi_audio_hw_params,
496 .audio_shutdown = msm_hdmi_audio_shutdown,
497 };
498
499 static struct hdmi_codec_pdata codec_data = {
500 .ops = &msm_hdmi_audio_codec_ops,
501 .max_i2s_channels = 8,
502 .i2s = 1,
503 };
504
msm_hdmi_register_audio_driver(struct hdmi * hdmi,struct device * dev)505 static int msm_hdmi_register_audio_driver(struct hdmi *hdmi, struct device *dev)
506 {
507 hdmi->audio_pdev = platform_device_register_data(dev,
508 HDMI_CODEC_DRV_NAME,
509 PLATFORM_DEVID_AUTO,
510 &codec_data,
511 sizeof(codec_data));
512 return PTR_ERR_OR_ZERO(hdmi->audio_pdev);
513 }
514
msm_hdmi_bind(struct device * dev,struct device * master,void * data)515 static int msm_hdmi_bind(struct device *dev, struct device *master, void *data)
516 {
517 struct drm_device *drm = dev_get_drvdata(master);
518 struct msm_drm_private *priv = drm->dev_private;
519 struct hdmi_platform_config *hdmi_cfg;
520 struct hdmi *hdmi;
521 struct device_node *of_node = dev->of_node;
522 int i, err;
523
524 hdmi_cfg = (struct hdmi_platform_config *)
525 of_device_get_match_data(dev);
526 if (!hdmi_cfg) {
527 DRM_DEV_ERROR(dev, "unknown hdmi_cfg: %pOFn\n", of_node);
528 return -ENXIO;
529 }
530
531 hdmi_cfg->mmio_name = "core_physical";
532 hdmi_cfg->qfprom_mmio_name = "qfprom_physical";
533
534 for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) {
535 const char *name = msm_hdmi_gpio_pdata[i].name;
536 struct gpio_desc *gpiod;
537
538 /*
539 * We are fetching the GPIO lines "as is" since the connector
540 * code is enabling and disabling the lines. Until that point
541 * the power-on default value will be kept.
542 */
543 gpiod = devm_gpiod_get_optional(dev, name, GPIOD_ASIS);
544 /* This will catch e.g. -PROBE_DEFER */
545 if (IS_ERR(gpiod))
546 return PTR_ERR(gpiod);
547 if (!gpiod) {
548 /* Try a second time, stripping down the name */
549 char name3[32];
550
551 /*
552 * Try again after stripping out the "qcom,hdmi-tx"
553 * prefix. This is mainly to match "hpd-gpios" used
554 * in the upstream bindings.
555 */
556 if (sscanf(name, "qcom,hdmi-tx-%s", name3))
557 gpiod = devm_gpiod_get_optional(dev, name3, GPIOD_ASIS);
558 if (IS_ERR(gpiod))
559 return PTR_ERR(gpiod);
560 if (!gpiod)
561 DBG("failed to get gpio: %s", name);
562 }
563 hdmi_cfg->gpios[i].gpiod = gpiod;
564 if (gpiod)
565 gpiod_set_consumer_name(gpiod, msm_hdmi_gpio_pdata[i].label);
566 hdmi_cfg->gpios[i].output = msm_hdmi_gpio_pdata[i].output;
567 hdmi_cfg->gpios[i].value = msm_hdmi_gpio_pdata[i].value;
568 }
569
570 dev->platform_data = hdmi_cfg;
571
572 hdmi = msm_hdmi_init(to_platform_device(dev));
573 if (IS_ERR(hdmi))
574 return PTR_ERR(hdmi);
575 priv->hdmi = hdmi;
576
577 err = msm_hdmi_register_audio_driver(hdmi, dev);
578 if (err) {
579 DRM_ERROR("Failed to attach an audio codec %d\n", err);
580 hdmi->audio_pdev = NULL;
581 }
582
583 return 0;
584 }
585
msm_hdmi_unbind(struct device * dev,struct device * master,void * data)586 static void msm_hdmi_unbind(struct device *dev, struct device *master,
587 void *data)
588 {
589 struct drm_device *drm = dev_get_drvdata(master);
590 struct msm_drm_private *priv = drm->dev_private;
591 if (priv->hdmi) {
592 if (priv->hdmi->audio_pdev)
593 platform_device_unregister(priv->hdmi->audio_pdev);
594
595 msm_hdmi_destroy(priv->hdmi);
596 priv->hdmi = NULL;
597 }
598 }
599
600 static const struct component_ops msm_hdmi_ops = {
601 .bind = msm_hdmi_bind,
602 .unbind = msm_hdmi_unbind,
603 };
604
msm_hdmi_dev_probe(struct platform_device * pdev)605 static int msm_hdmi_dev_probe(struct platform_device *pdev)
606 {
607 return component_add(&pdev->dev, &msm_hdmi_ops);
608 }
609
msm_hdmi_dev_remove(struct platform_device * pdev)610 static int msm_hdmi_dev_remove(struct platform_device *pdev)
611 {
612 component_del(&pdev->dev, &msm_hdmi_ops);
613 return 0;
614 }
615
616 static const struct of_device_id msm_hdmi_dt_match[] = {
617 { .compatible = "qcom,hdmi-tx-8996", .data = &hdmi_tx_8996_config },
618 { .compatible = "qcom,hdmi-tx-8994", .data = &hdmi_tx_8994_config },
619 { .compatible = "qcom,hdmi-tx-8084", .data = &hdmi_tx_8084_config },
620 { .compatible = "qcom,hdmi-tx-8974", .data = &hdmi_tx_8974_config },
621 { .compatible = "qcom,hdmi-tx-8960", .data = &hdmi_tx_8960_config },
622 { .compatible = "qcom,hdmi-tx-8660", .data = &hdmi_tx_8660_config },
623 {}
624 };
625
626 static struct platform_driver msm_hdmi_driver = {
627 .probe = msm_hdmi_dev_probe,
628 .remove = msm_hdmi_dev_remove,
629 .driver = {
630 .name = "hdmi_msm",
631 .of_match_table = msm_hdmi_dt_match,
632 },
633 };
634
msm_hdmi_register(void)635 void __init msm_hdmi_register(void)
636 {
637 msm_hdmi_phy_driver_register();
638 platform_driver_register(&msm_hdmi_driver);
639 }
640
msm_hdmi_unregister(void)641 void __exit msm_hdmi_unregister(void)
642 {
643 platform_driver_unregister(&msm_hdmi_driver);
644 msm_hdmi_phy_driver_unregister();
645 }
646