Skip to content

Commit a8a6034

Browse files
Rahul Sharmasribconnect
authored andcommitted
CHROMIUM: drm/exynos: add support for hdmi audio through alsa soc
This patch adds provision for register hdmi-audio as a alsa component and controlled bu ALSA core. Change-Id: Ic69a718c281f2dfdf00df273f8687cc7e0cd5428 Signed-off-by: Rahul Sharma <[email protected]>
1 parent 6822951 commit a8a6034

File tree

1 file changed

+66
-10
lines changed

1 file changed

+66
-10
lines changed

drivers/gpu/drm/exynos/exynos_hdmi.c

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ struct hdmi_context {
158158
struct device *dev;
159159
struct drm_device *drm_dev;
160160
bool hpd;
161+
bool is_soc_exynos5;
161162
bool powered;
162163
bool dvi_mode;
163164
struct mutex hdmi_mutex;
@@ -1677,12 +1678,13 @@ static void hdmi_conf_apply(struct hdmi_context *hdata)
16771678
hdmi_conf_reset(hdata);
16781679
hdmi_conf_init(hdata);
16791680
mutex_unlock(&hdata->hdmi_mutex);
1680-
1681-
hdmi_audio_init(hdata);
1681+
if (!hdata->is_soc_exynos5)
1682+
hdmi_audio_init(hdata);
16821683

16831684
/* setting core registers */
16841685
hdmi_timing_apply(hdata);
1685-
hdmi_audio_control(hdata, true);
1686+
if (!hdata->is_soc_exynos5)
1687+
hdmi_audio_control(hdata, true);
16861688

16871689
hdmi_regs_dump(hdata, "start");
16881690
}
@@ -2151,6 +2153,54 @@ static struct of_device_id hdmi_match_types[] = {
21512153
};
21522154
#endif
21532155

2156+
struct platform_device *hdmi_audio_device;
2157+
2158+
int hdmi_register_audio_device(struct platform_device *pdev)
2159+
{
2160+
struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
2161+
struct hdmi_context *hdata = ctx->ctx;
2162+
struct platform_device *audio_dev;
2163+
int ret;
2164+
2165+
audio_dev = platform_device_alloc("exynos-hdmi-audio", -1);
2166+
if (!audio_dev) {
2167+
DRM_ERROR("hdmi audio device allocation failed.\n");
2168+
ret = -ENOMEM;
2169+
goto err;
2170+
}
2171+
2172+
ret = platform_device_add_resources(audio_dev, pdev->resource,
2173+
pdev->num_resources);
2174+
if (ret) {
2175+
ret = -ENOMEM;
2176+
goto err_device;
2177+
}
2178+
2179+
audio_dev->dev.of_node = of_get_next_child(pdev->dev.of_node, NULL);
2180+
audio_dev->dev.platform_data = (void *)hdata->hpd_gpio;
2181+
2182+
ret = platform_device_add(audio_dev);
2183+
if (ret) {
2184+
DRM_ERROR("hdmi audio device add failed.\n");
2185+
goto err_device;
2186+
}
2187+
2188+
hdmi_audio_device = audio_dev;
2189+
return 0;
2190+
2191+
err_device:
2192+
platform_device_put(audio_dev);
2193+
2194+
err:
2195+
return ret;
2196+
}
2197+
2198+
void hdmi_unregister_audio_device(void)
2199+
{
2200+
platform_device_unregister(hdmi_audio_device);
2201+
}
2202+
2203+
21542204
static int hdmi_probe(struct platform_device *pdev)
21552205
{
21562206
struct device *dev = &pdev->dev;
@@ -2212,6 +2262,8 @@ static int hdmi_probe(struct platform_device *pdev)
22122262

22132263
hdata->hpd_gpio = pdata->hpd_gpio;
22142264
hdata->dev = dev;
2265+
hdata->is_soc_exynos5 = of_device_is_compatible(dev->of_node,
2266+
"samsung,exynos5-hdmi");
22152267

22162268
ret = hdmi_resources_init(hdata);
22172269

@@ -2232,12 +2284,6 @@ static int hdmi_probe(struct platform_device *pdev)
22322284
return -ENXIO;
22332285
}
22342286

2235-
ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
2236-
if (ret) {
2237-
DRM_ERROR("failed to request HPD gpio\n");
2238-
return ret;
2239-
}
2240-
22412287
/* DDC i2c driver */
22422288
if (i2c_add_driver(&ddc_driver)) {
22432289
DRM_ERROR("failed to register ddc i2c driver\n");
@@ -2266,7 +2312,7 @@ static int hdmi_probe(struct platform_device *pdev)
22662312

22672313
ret = request_threaded_irq(hdata->irq, NULL,
22682314
hdmi_irq_thread, IRQF_TRIGGER_RISING |
2269-
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
2315+
IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED,
22702316
"hdmi", drm_hdmi_ctx);
22712317
if (ret) {
22722318
DRM_ERROR("failed to register hdmi interrupt\n");
@@ -2279,6 +2325,15 @@ static int hdmi_probe(struct platform_device *pdev)
22792325
/* register specific callbacks to common hdmi. */
22802326
exynos_hdmi_ops_register(&hdmi_ops);
22812327

2328+
if (of_device_is_compatible(dev->of_node,
2329+
"samsung,exynos5-hdmi")) {
2330+
ret = hdmi_register_audio_device(pdev);
2331+
if (ret) {
2332+
DRM_ERROR("hdmi-audio device registering failed.\n");
2333+
goto err_hdmiphy;
2334+
}
2335+
}
2336+
22822337
pm_runtime_enable(dev);
22832338

22842339
return 0;
@@ -2298,6 +2353,7 @@ static int hdmi_remove(struct platform_device *pdev)
22982353

22992354
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
23002355

2356+
hdmi_unregister_audio_device();
23012357
pm_runtime_disable(dev);
23022358

23032359
free_irq(hdata->irq, hdata);

0 commit comments

Comments
 (0)