diff options
| author | Rob Clark <robdclark@gmail.com> | 2014-03-03 14:19:12 -0500 |
|---|---|---|
| committer | Rob Clark <robdclark@gmail.com> | 2014-03-31 10:27:46 -0400 |
| commit | 060530f1ea6740eb767085008d183f89ccdd289c (patch) | |
| tree | f1932745e12f401edcf7d57523197023a8ee5371 | |
| parent | 4e1cbaa3eb1c051d330f0586045bb719a8b9a8ae (diff) | |
drm/msm: use componentised device support
Signed-off-by: Rob Clark <robdclark@gmail.com>
| -rw-r--r-- | drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 49 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/hdmi/hdmi.c | 44 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 112 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm/msm_drv.h | 4 |
4 files changed, 176 insertions, 33 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c index e6cb2bc40ebe..f20fbde5dc49 100644 --- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c | |||
| @@ -41,8 +41,6 @@ MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow! | |||
| 41 | module_param_named(hang_debug, hang_debug, bool, 0600); | 41 | module_param_named(hang_debug, hang_debug, bool, 0600); |
| 42 | static void a3xx_dump(struct msm_gpu *gpu); | 42 | static void a3xx_dump(struct msm_gpu *gpu); |
| 43 | 43 | ||
| 44 | static struct platform_device *a3xx_pdev; | ||
| 45 | |||
| 46 | static void a3xx_me_init(struct msm_gpu *gpu) | 44 | static void a3xx_me_init(struct msm_gpu *gpu) |
| 47 | { | 45 | { |
| 48 | struct msm_ringbuffer *ring = gpu->rb; | 46 | struct msm_ringbuffer *ring = gpu->rb; |
| @@ -320,7 +318,6 @@ static void a3xx_destroy(struct msm_gpu *gpu) | |||
| 320 | ocmem_free(OCMEM_GRAPHICS, a3xx_gpu->ocmem_hdl); | 318 | ocmem_free(OCMEM_GRAPHICS, a3xx_gpu->ocmem_hdl); |
| 321 | #endif | 319 | #endif |
| 322 | 320 | ||
| 323 | put_device(&a3xx_gpu->pdev->dev); | ||
| 324 | kfree(a3xx_gpu); | 321 | kfree(a3xx_gpu); |
| 325 | } | 322 | } |
| 326 | 323 | ||
| @@ -473,7 +470,8 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev) | |||
| 473 | struct a3xx_gpu *a3xx_gpu = NULL; | 470 | struct a3xx_gpu *a3xx_gpu = NULL; |
| 474 | struct adreno_gpu *adreno_gpu; | 471 | struct adreno_gpu *adreno_gpu; |
| 475 | struct msm_gpu *gpu; | 472 | struct msm_gpu *gpu; |
| 476 | struct platform_device *pdev = a3xx_pdev; | 473 | struct msm_drm_private *priv = dev->dev_private; |
| 474 | struct platform_device *pdev = priv->gpu_pdev; | ||
| 477 | struct adreno_platform_config *config; | 475 | struct adreno_platform_config *config; |
| 478 | int ret; | 476 | int ret; |
| 479 | 477 | ||
| @@ -494,7 +492,6 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev) | |||
| 494 | adreno_gpu = &a3xx_gpu->base; | 492 | adreno_gpu = &a3xx_gpu->base; |
| 495 | gpu = &adreno_gpu->base; | 493 | gpu = &adreno_gpu->base; |
| 496 | 494 | ||
| 497 | get_device(&pdev->dev); | ||
| 498 | a3xx_gpu->pdev = pdev; | 495 | a3xx_gpu->pdev = pdev; |
| 499 | 496 | ||
| 500 | gpu->fast_rate = config->fast_rate; | 497 | gpu->fast_rate = config->fast_rate; |
| @@ -556,17 +553,24 @@ fail: | |||
| 556 | # include <mach/kgsl.h> | 553 | # include <mach/kgsl.h> |
| 557 | #endif | 554 | #endif |
| 558 | 555 | ||
| 559 | static int a3xx_probe(struct platform_device *pdev) | 556 | static void set_gpu_pdev(struct drm_device *dev, |
| 557 | struct platform_device *pdev) | ||
| 558 | { | ||
| 559 | struct msm_drm_private *priv = dev->dev_private; | ||
| 560 | priv->gpu_pdev = pdev; | ||
| 561 | } | ||
| 562 | |||
| 563 | static int a3xx_bind(struct device *dev, struct device *master, void *data) | ||
| 560 | { | 564 | { |
| 561 | static struct adreno_platform_config config = {}; | 565 | static struct adreno_platform_config config = {}; |
| 562 | #ifdef CONFIG_OF | 566 | #ifdef CONFIG_OF |
| 563 | struct device_node *child, *node = pdev->dev.of_node; | 567 | struct device_node *child, *node = dev->of_node; |
| 564 | u32 val; | 568 | u32 val; |
| 565 | int ret; | 569 | int ret; |
| 566 | 570 | ||
| 567 | ret = of_property_read_u32(node, "qcom,chipid", &val); | 571 | ret = of_property_read_u32(node, "qcom,chipid", &val); |
| 568 | if (ret) { | 572 | if (ret) { |
| 569 | dev_err(&pdev->dev, "could not find chipid: %d\n", ret); | 573 | dev_err(dev, "could not find chipid: %d\n", ret); |
| 570 | return ret; | 574 | return ret; |
| 571 | } | 575 | } |
| 572 | 576 | ||
| @@ -582,7 +586,7 @@ static int a3xx_probe(struct platform_device *pdev) | |||
| 582 | for_each_child_of_node(child, pwrlvl) { | 586 | for_each_child_of_node(child, pwrlvl) { |
| 583 | ret = of_property_read_u32(pwrlvl, "qcom,gpu-freq", &val); | 587 | ret = of_property_read_u32(pwrlvl, "qcom,gpu-freq", &val); |
| 584 | if (ret) { | 588 | if (ret) { |
| 585 | dev_err(&pdev->dev, "could not find gpu-freq: %d\n", ret); | 589 | dev_err(dev, "could not find gpu-freq: %d\n", ret); |
| 586 | return ret; | 590 | return ret; |
| 587 | } | 591 | } |
| 588 | config.fast_rate = max(config.fast_rate, val); | 592 | config.fast_rate = max(config.fast_rate, val); |
| @@ -592,12 +596,12 @@ static int a3xx_probe(struct platform_device *pdev) | |||
| 592 | } | 596 | } |
| 593 | 597 | ||
| 594 | if (!config.fast_rate) { | 598 | if (!config.fast_rate) { |
| 595 | dev_err(&pdev->dev, "could not find clk rates\n"); | 599 | dev_err(dev, "could not find clk rates\n"); |
| 596 | return -ENXIO; | 600 | return -ENXIO; |
| 597 | } | 601 | } |
| 598 | 602 | ||
| 599 | #else | 603 | #else |
| 600 | struct kgsl_device_platform_data *pdata = pdev->dev.platform_data; | 604 | struct kgsl_device_platform_data *pdata = dev->platform_data; |
| 601 | uint32_t version = socinfo_get_version(); | 605 | uint32_t version = socinfo_get_version(); |
| 602 | if (cpu_is_apq8064ab()) { | 606 | if (cpu_is_apq8064ab()) { |
| 603 | config.fast_rate = 450000000; | 607 | config.fast_rate = 450000000; |
| @@ -643,14 +647,30 @@ static int a3xx_probe(struct platform_device *pdev) | |||
| 643 | config.bus_scale_table = pdata->bus_scale_table; | 647 | config.bus_scale_table = pdata->bus_scale_table; |
| 644 | # endif | 648 | # endif |
| 645 | #endif | 649 | #endif |
| 646 | pdev->dev.platform_data = &config; | 650 | dev->platform_data = &config; |
| 647 | a3xx_pdev = pdev; | 651 | set_gpu_pdev(dev_get_drvdata(master), to_platform_device(dev)); |
| 648 | return 0; | 652 | return 0; |
| 649 | } | 653 | } |
| 650 | 654 | ||
| 655 | static void a3xx_unbind(struct device *dev, struct device *master, | ||
| 656 | void *data) | ||
| 657 | { | ||
| 658 | set_gpu_pdev(dev_get_drvdata(master), NULL); | ||
| 659 | } | ||
| 660 | |||
| 661 | static const struct component_ops a3xx_ops = { | ||
| 662 | .bind = a3xx_bind, | ||
| 663 | .unbind = a3xx_unbind, | ||
| 664 | }; | ||
| 665 | |||
| 666 | static int a3xx_probe(struct platform_device *pdev) | ||
| 667 | { | ||
| 668 | return component_add(&pdev->dev, &a3xx_ops); | ||
| 669 | } | ||
| 670 | |||
| 651 | static int a3xx_remove(struct platform_device *pdev) | 671 | static int a3xx_remove(struct platform_device *pdev) |
| 652 | { | 672 | { |
| 653 | a3xx_pdev = NULL; | 673 | component_del(&pdev->dev, &a3xx_ops); |
| 654 | return 0; | 674 | return 0; |
| 655 | } | 675 | } |
| 656 | 676 | ||
| @@ -658,7 +678,6 @@ static const struct of_device_id dt_match[] = { | |||
| 658 | { .compatible = "qcom,kgsl-3d0" }, | 678 | { .compatible = "qcom,kgsl-3d0" }, |
| 659 | {} | 679 | {} |
| 660 | }; | 680 | }; |
| 661 | MODULE_DEVICE_TABLE(of, dt_match); | ||
| 662 | 681 | ||
| 663 | static struct platform_driver a3xx_driver = { | 682 | static struct platform_driver a3xx_driver = { |
| 664 | .probe = a3xx_probe, | 683 | .probe = a3xx_probe, |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 6048b6b2a8c7..ae750f6928c1 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
| @@ -17,8 +17,6 @@ | |||
| 17 | 17 | ||
| 18 | #include "hdmi.h" | 18 | #include "hdmi.h" |
| 19 | 19 | ||
| 20 | static struct platform_device *hdmi_pdev; | ||
| 21 | |||
| 22 | void hdmi_set_mode(struct hdmi *hdmi, bool power_on) | 20 | void hdmi_set_mode(struct hdmi *hdmi, bool power_on) |
| 23 | { | 21 | { |
| 24 | uint32_t ctrl = 0; | 22 | uint32_t ctrl = 0; |
| @@ -68,8 +66,6 @@ void hdmi_destroy(struct kref *kref) | |||
| 68 | hdmi_i2c_destroy(hdmi->i2c); | 66 | hdmi_i2c_destroy(hdmi->i2c); |
| 69 | 67 | ||
| 70 | platform_set_drvdata(hdmi->pdev, NULL); | 68 | platform_set_drvdata(hdmi->pdev, NULL); |
| 71 | |||
| 72 | put_device(&hdmi->pdev->dev); | ||
| 73 | } | 69 | } |
| 74 | 70 | ||
| 75 | /* initialize connector */ | ||
