diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-11-03 06:23:34 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2014-02-24 07:07:33 -0500 |
commit | 17b5001b5143e3b7fce1c584bdcffd726dd8667c (patch) | |
tree | 02e097c57ffc94705c63fb541dd0bced4ba0482f | |
parent | f2d66aad1aade34df678177c5ccb58feaea72156 (diff) |
imx-drm: convert to componentised device support
Use the componentised device support for imx-drm. This requires all
the sub-components and the master device to register with the component
device support.
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/boot/dts/imx51-babbage.dts | 10 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx53-m53evk.dts | 8 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx53-mba53.dts | 6 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx53-qsb.dts | 8 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx6q-sabresd.dts | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 6 | ||||
-rw-r--r-- | drivers/staging/imx-drm/imx-drm-core.c | 105 | ||||
-rw-r--r-- | drivers/staging/imx-drm/imx-hdmi.c | 41 | ||||
-rw-r--r-- | drivers/staging/imx-drm/imx-ldb.c | 40 | ||||
-rw-r--r-- | drivers/staging/imx-drm/imx-tve.c | 63 | ||||
-rw-r--r-- | drivers/staging/imx-drm/ipuv3-crtc.c | 46 | ||||
-rw-r--r-- | drivers/staging/imx-drm/parallel-display.c | 30 |
12 files changed, 275 insertions, 92 deletions
diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts index be1407cf5abd..6ff15a0eacb3 100644 --- a/arch/arm/boot/dts/imx51-babbage.dts +++ b/arch/arm/boot/dts/imx51-babbage.dts | |||
@@ -21,7 +21,7 @@ | |||
21 | reg = <0x90000000 0x20000000>; | 21 | reg = <0x90000000 0x20000000>; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | display@di0 { | 24 | display0: display@di0 { |
25 | compatible = "fsl,imx-parallel-display"; | 25 | compatible = "fsl,imx-parallel-display"; |
26 | crtcs = <&ipu 0>; | 26 | crtcs = <&ipu 0>; |
27 | interface-pix-fmt = "rgb24"; | 27 | interface-pix-fmt = "rgb24"; |
@@ -43,7 +43,7 @@ | |||
43 | }; | 43 | }; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | display@di1 { | 46 | display1: display@di1 { |
47 | compatible = "fsl,imx-parallel-display"; | 47 | compatible = "fsl,imx-parallel-display"; |
48 | crtcs = <&ipu 1>; | 48 | crtcs = <&ipu 1>; |
49 | interface-pix-fmt = "rgb565"; | 49 | interface-pix-fmt = "rgb565"; |
@@ -81,6 +81,12 @@ | |||
81 | }; | 81 | }; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | imx-drm { | ||
85 | compatible = "fsl,imx-drm"; | ||
86 | crtcs = <&ipu 0>, <&ipu 1>; | ||
87 | connectors = <&display0>, <&display1>; | ||
88 | }; | ||
89 | |||
84 | sound { | 90 | sound { |
85 | compatible = "fsl,imx51-babbage-sgtl5000", | 91 | compatible = "fsl,imx51-babbage-sgtl5000", |
86 | "fsl,imx-audio-sgtl5000"; | 92 | "fsl,imx-audio-sgtl5000"; |
diff --git a/arch/arm/boot/dts/imx53-m53evk.dts b/arch/arm/boot/dts/imx53-m53evk.dts index 7d304d02ed38..ee6107b6484c 100644 --- a/arch/arm/boot/dts/imx53-m53evk.dts +++ b/arch/arm/boot/dts/imx53-m53evk.dts | |||
@@ -21,7 +21,7 @@ | |||
21 | }; | 21 | }; |
22 | 22 | ||
23 | soc { | 23 | soc { |
24 | display@di1 { | 24 | display1: display@di1 { |
25 | compatible = "fsl,imx-parallel-display"; | 25 | compatible = "fsl,imx-parallel-display"; |
26 | crtcs = <&ipu 1>; | 26 | crtcs = <&ipu 1>; |
27 | interface-pix-fmt = "bgr666"; | 27 | interface-pix-fmt = "bgr666"; |
@@ -53,6 +53,12 @@ | |||
53 | default-brightness-level = <6>; | 53 | default-brightness-level = <6>; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | imx-drm { | ||
57 | compatible = "fsl,imx-drm"; | ||
58 | crtcs = <&ipu 1>; | ||
59 | connectors = <&display1>; | ||
60 | }; | ||
61 | |||
56 | leds { | 62 | leds { |
57 | compatible = "gpio-leds"; | 63 | compatible = "gpio-leds"; |
58 | pinctrl-names = "default"; | 64 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/imx53-mba53.dts b/arch/arm/boot/dts/imx53-mba53.dts index a63090267941..9b6e76980a74 100644 --- a/arch/arm/boot/dts/imx53-mba53.dts +++ b/arch/arm/boot/dts/imx53-mba53.dts | |||
@@ -43,6 +43,12 @@ | |||
43 | status = "disabled"; | 43 | status = "disabled"; |
44 | }; | 44 | }; |
45 | 45 | ||
46 | imx-drm { | ||
47 | compatible = "fsl,imx-drm"; | ||
48 | crtcs = <&ipu 1>; | ||
49 | connectors = <&disp1>, <&tve>; | ||
50 | }; | ||
51 | |||
46 | reg_3p2v: 3p2v { | 52 | reg_3p2v: 3p2v { |
47 | compatible = "regulator-fixed"; | 53 | compatible = "regulator-fixed"; |
48 | regulator-name = "3P2V"; | 54 | regulator-name = "3P2V"; |
diff --git a/arch/arm/boot/dts/imx53-qsb.dts b/arch/arm/boot/dts/imx53-qsb.dts index 91a5935a4aac..3cb4f7791a91 100644 --- a/arch/arm/boot/dts/imx53-qsb.dts +++ b/arch/arm/boot/dts/imx53-qsb.dts | |||
@@ -21,7 +21,7 @@ | |||
21 | reg = <0x70000000 0x40000000>; | 21 | reg = <0x70000000 0x40000000>; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | display@di0 { | 24 | display0: display@di0 { |
25 | compatible = "fsl,imx-parallel-display"; | 25 | compatible = "fsl,imx-parallel-display"; |
26 | crtcs = <&ipu 0>; | 26 | crtcs = <&ipu 0>; |
27 | interface-pix-fmt = "rgb565"; | 27 | interface-pix-fmt = "rgb565"; |
@@ -72,6 +72,12 @@ | |||
72 | }; | 72 | }; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | imx-drm { | ||
76 | compatible = "fsl,imx-drm"; | ||
77 | crtcs = <&ipu 0>; | ||
78 | connectors = <&display0>; | ||
79 | }; | ||
80 | |||
75 | leds { | 81 | leds { |
76 | compatible = "gpio-leds"; | 82 | compatible = "gpio-leds"; |
77 | pinctrl-names = "default"; | 83 | pinctrl-names = "default"; |
diff --git a/arch/arm/boot/dts/imx6q-sabresd.dts b/arch/arm/boot/dts/imx6q-sabresd.dts index 9cbdfe7a0931..66f220a82e45 100644 --- a/arch/arm/boot/dts/imx6q-sabresd.dts +++ b/arch/arm/boot/dts/imx6q-sabresd.dts | |||
@@ -20,6 +20,10 @@ | |||
20 | compatible = "fsl,imx6q-sabresd", "fsl,imx6q"; | 20 | compatible = "fsl,imx6q-sabresd", "fsl,imx6q"; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | &imx_drm { | ||
24 | crtcs = <&ipu1 0>, <&ipu1 1>, <&ipu2 0>, <&ipu2 1>; | ||
25 | }; | ||
26 | |||
23 | &sata { | 27 | &sata { |
24 | status = "okay"; | 28 | status = "okay"; |
25 | }; | 29 | }; |
diff --git a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi index e75e11b36dff..dfca3e001398 100644 --- a/arch/arm/boot/dts/imx6qdl-sabresd.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sabresd.dtsi | |||
@@ -62,6 +62,12 @@ | |||
62 | }; | 62 | }; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | imx_drm: imx-drm { | ||
66 | compatible = "fsl,imx-drm"; | ||
67 | crtcs = <&ipu1 0>, <&ipu1 1>; | ||
68 | connectors = <&ldb>; | ||
69 | }; | ||
70 | |||
65 | sound { | 71 | sound { |
66 | compatible = "fsl,imx6q-sabresd-wm8962", | 72 | compatible = "fsl,imx6q-sabresd-wm8962", |
67 | "fsl,imx-audio-wm8962"; | 73 | "fsl,imx-audio-wm8962"; |
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index d9786eca3a36..82b0337096b0 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c | |||
@@ -13,7 +13,7 @@ | |||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | #include <linux/component.h> | |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <drm/drmP.h> | 19 | #include <drm/drmP.h> |
@@ -90,6 +90,8 @@ static int imx_drm_driver_unload(struct drm_device *drm) | |||
90 | { | 90 | { |
91 | struct imx_drm_device *imxdrm = drm->dev_private; | 91 | struct imx_drm_device *imxdrm = drm->dev_private; |
92 | 92 | ||
93 | component_unbind_all(drm->dev, drm); | ||
94 | |||
93 | imx_drm_device_put(); | 95 | imx_drm_device_put(); |
94 | 96 | ||
95 | drm_vblank_cleanup(drm); | 97 | drm_vblank_cleanup(drm); |
@@ -371,11 +373,8 @@ static void imx_drm_connector_unregister( | |||
371 | } | 373 | } |
372 | 374 | ||
373 | /* | 375 | /* |
374 | * Called by the CRTC driver when all CRTCs are registered. This | 376 | * Main DRM initialisation. This binds, initialises and registers |
375 | * puts all the pieces together and initializes the driver. | 377 | * with DRM the subcomponents of the driver. |
376 | * Once this is called no more CRTCs can be registered since | ||
377 | * the drm core has hardcoded the number of crtcs in several | ||
378 | * places. | ||
379 | */ | 378 | */ |
380 | static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) | 379 | static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) |
381 | { | 380 | { |
@@ -428,8 +427,15 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) | |||
428 | 427 | ||
429 | platform_set_drvdata(drm->platformdev, drm); | 428 | platform_set_drvdata(drm->platformdev, drm); |
430 | mutex_unlock(&imxdrm->mutex); | 429 | mutex_unlock(&imxdrm->mutex); |
430 | |||
431 | /* Now try and bind all our sub-components */ | ||
432 | ret = component_bind_all(drm->dev, drm); | ||
433 | if (ret) | ||
434 | goto err_relock; | ||
431 | return 0; | 435 | return 0; |
432 | 436 | ||
437 | err_relock: | ||
438 | mutex_lock(&imxdrm->mutex); | ||
433 | err_vblank: | 439 | err_vblank: |
434 | drm_vblank_cleanup(drm); | 440 | drm_vblank_cleanup(drm); |
435 | err_kms: | 441 | err_kms: |
@@ -809,6 +815,70 @@ static struct drm_driver imx_drm_driver = { | |||
809 | .patchlevel = 0, | 815 | .patchlevel = 0, |
810 | }; | 816 | }; |
811 | 817 | ||
818 | static int compare_parent_of(struct device *dev, void *data) | ||
819 | { | ||
820 | struct of_phandle_args *args = data; | ||
821 | return dev->parent && dev->parent->of_node == args->np; | ||
822 | } | ||
823 | |||
824 | static int compare_of(struct device *dev, void *data) | ||
825 | { | ||
826 | return dev->of_node == data; | ||
827 | } | ||
828 | |||
829 | static int imx_drm_add_components(struct device *master, struct master *m) | ||
830 | { | ||
831 | struct device_node *np = master->of_node; | ||
832 | unsigned i; | ||
833 | int ret; | ||
834 | |||
835 | for (i = 0; ; i++) { | ||
836 | struct of_phandle_args args; | ||
837 | |||
838 | ret = of_parse_phandle_with_fixed_args(np, "crtcs", 1, | ||
839 | i, &args); | ||
840 | if (ret) | ||
841 | break; | ||
842 | |||
843 | ret = component_master_add_child(m, compare_parent_of, &args); | ||
844 | of_node_put(args.np); | ||
845 | |||
846 | if (ret) | ||
847 | return ret; | ||
848 | } | ||
849 | |||
850 | for (i = 0; ; i++) { | ||
851 | struct device_node *node; | ||
852 | |||
853 | node = of_parse_phandle(np, "connectors", i); | ||
854 | if (!node) | ||
855 | break; | ||
856 | |||
857 | ret = component_master_add_child(m, compare_of, node); | ||
858 | of_node_put(node); | ||
859 | |||
860 | if (ret) | ||
861 | return ret; | ||
862 | } | ||
863 | return 0; | ||
864 | } | ||
865 | |||
866 | static int imx_drm_bind(struct device *dev) | ||
867 | { | ||
868 | return drm_platform_init(&imx_drm_driver, to_platform_device(dev)); | ||
869 | } | ||
870 | |||
871 | static void imx_drm_unbind(struct device *dev) | ||
872 | { | ||
873 | drm_put_dev(dev_get_drvdata(dev)); | ||
874 | } | ||
875 | |||
876 | static const struct component_master_ops imx_drm_ops = { | ||
877 | .add_components = imx_drm_add_components, | ||
878 | .bind = imx_drm_bind, | ||
879 | .unbind = imx_drm_unbind, | ||
880 | }; | ||
881 | |||
812 | static int imx_drm_platform_probe(struct platform_device *pdev) | 882 | static int imx_drm_platform_probe(struct platform_device *pdev) |
813 | { | 883 | { |
814 | int ret; | 884 | int ret; |
@@ -819,27 +889,31 @@ static int imx_drm_platform_probe(struct platform_device *pdev) | |||
819 | 889 | ||
820 | imx_drm_device->dev = &pdev->dev; | 890 | imx_drm_device->dev = &pdev->dev; |
821 | 891 | ||
822 | return drm_platform_init(&imx_drm_driver, pdev); | 892 | return component_master_add(&pdev->dev, &imx_drm_ops); |
823 | } | 893 | } |
824 | 894 | ||
825 | static int imx_drm_platform_remove(struct platform_device *pdev) | 895 | static int imx_drm_platform_remove(struct platform_device *pdev) |
826 | { | 896 | { |
827 | drm_put_dev(platform_get_drvdata(pdev)); | 897 | component_master_del(&pdev->dev, &imx_drm_ops); |
828 | |||
829 | return 0; | 898 | return 0; |
830 | } | 899 | } |
831 | 900 | ||
901 | static const struct of_device_id imx_drm_dt_ids[] = { | ||
902 | { .compatible = "fsl,imx-drm", }, | ||
903 | { /* sentinel */ }, | ||
904 | }; | ||
905 | MODULE_DEVICE_TABLE(of, imx_drm_dt_ids); | ||
906 | |||
832 | static struct platform_driver imx_drm_pdrv = { | 907 | static struct platform_driver imx_drm_pdrv = { |
833 | .probe = imx_drm_platform_probe, | 908 | .probe = imx_drm_platform_probe, |
834 | .remove = imx_drm_platform_remove, | 909 | .remove = imx_drm_platform_remove, |
835 | .driver = { | 910 | .driver = { |
836 | .owner = THIS_MODULE, | 911 | .owner = THIS_MODULE, |
837 | .name = "imx-drm", | 912 | .name = "imx-drm", |
913 | .of_match_table = imx_drm_dt_ids, | ||
838 | }, | 914 | }, |
839 | }; | 915 | }; |
840 | 916 | ||
841 | static struct platform_device *imx_drm_pdev; | ||
842 | |||
843 | static int __init imx_drm_init(void) | 917 | static int __init imx_drm_init(void) |
844 | { | 918 | { |
845 | int ret; | 919 | int ret; |
@@ -852,12 +926,6 @@ static int __init imx_drm_init(void) | |||
852 | INIT_LIST_HEAD(&imx_drm_device->connector_list); | 926 | INIT_LIST_HEAD(&imx_drm_device->connector_list); |
853 | INIT_LIST_HEAD(&imx_drm_device->encoder_list); | 927 | INIT_LIST_HEAD(&imx_drm_device->encoder_list); |
854 | 928 | ||
855 | imx_drm_pdev = platform_device_register_simple("imx-drm", -1, NULL, 0); | ||
856 | if (IS_ERR(imx_drm_pdev)) { | ||
857 | ret = PTR_ERR(imx_drm_pdev); | ||
858 | goto err_pdev; | ||
859 | } | ||
860 | |||
861 | ret = platform_driver_register(&imx_drm_pdrv); | 929 | ret = platform_driver_register(&imx_drm_pdrv); |
862 | if (ret) | 930 | if (ret) |
863 | goto err_pdrv; | 931 | goto err_pdrv; |
@@ -865,8 +933,6 @@ static int __init imx_drm_init(void) | |||
865 | return 0; | 933 | return 0; |
866 | 934 | ||
867 | err_pdrv: | 935 | err_pdrv: |
868 | platform_device_unregister(imx_drm_pdev); | ||
869 | err_pdev: | ||
870 | kfree(imx_drm_device); | 936 | kfree(imx_drm_device); |
871 | 937 | ||
872 | return ret; | 938 | return ret; |
@@ -874,7 +940,6 @@ err_pdev: | |||
874 | 940 | ||
875 | static void __exit imx_drm_exit(void) | 941 | static void __exit imx_drm_exit(void) |
876 | { | 942 | { |
877 | platform_device_unregister(imx_drm_pdev); | ||
878 | platform_driver_unregister(&imx_drm_pdrv); | 943 | platform_driver_unregister(&imx_drm_pdrv); |
879 | 944 | ||
880 | kfree(imx_drm_device); | 945 | kfree(imx_drm_device); |
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index 50475e606849..14b4a4b976b9 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 12 | * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/component.h> | ||
15 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
16 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
17 | #include <linux/err.h> | 18 | #include <linux/err.h> |
@@ -1582,21 +1583,22 @@ static const struct of_device_id imx_hdmi_dt_ids[] = { | |||
1582 | }; | 1583 | }; |
1583 | MODULE_DEVICE_TABLE(of, imx_hdmi_dt_ids); | 1584 | MODULE_DEVICE_TABLE(of, imx_hdmi_dt_ids); |
1584 | 1585 | ||
1585 | static int imx_hdmi_platform_probe(struct platform_device *pdev) | 1586 | static int imx_hdmi_bind(struct device *dev, struct device *master, void *data) |
1586 | { | 1587 | { |
1588 | struct platform_device *pdev = to_platform_device(dev); | ||
1587 | const struct of_device_id *of_id = | 1589 | const struct of_device_id *of_id = |
1588 | of_match_device(imx_hdmi_dt_ids, &pdev->dev); | 1590 | of_match_device(imx_hdmi_dt_ids, dev); |
1589 | struct device_node *np = pdev->dev.of_node; | 1591 | struct device_node *np = dev->of_node; |
1590 | struct device_node *ddc_node; | 1592 | struct device_node *ddc_node; |
1591 | struct imx_hdmi *hdmi; | 1593 | struct imx_hdmi *hdmi; |
1592 | struct resource *iores; | 1594 | struct resource *iores; |
1593 | int ret, irq; | 1595 | int ret, irq; |
1594 | 1596 | ||
1595 | hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); | 1597 | hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL); |
1596 | if (!hdmi) | 1598 | if (!hdmi) |
1597 | return -ENOMEM; | 1599 | return -ENOMEM; |
1598 | 1600 | ||
1599 | hdmi->dev = &pdev->dev; | 1601 | hdmi->dev = dev; |
1600 | hdmi->sample_rate = 48000; | 1602 | hdmi->sample_rate = 48000; |
1601 | hdmi->ratio = 100; | 1603 | hdmi->ratio = 100; |
1602 | 1604 | ||
@@ -1620,13 +1622,13 @@ static int imx_hdmi_platform_probe(struct platform_device *pdev) | |||
1620 | if (irq < 0) | 1622 | if (irq < 0) |
1621 | return -EINVAL; | 1623 | return -EINVAL; |
1622 | 1624 | ||
1623 | ret = devm_request_irq(&pdev->dev, irq, imx_hdmi_irq, 0, | 1625 | ret = devm_request_irq(dev, irq, imx_hdmi_irq, 0, |
1624 | dev_name(&pdev->dev), hdmi); | 1626 | dev_name(dev), hdmi); |
1625 | if (ret) | 1627 | if (ret) |
1626 | return ret; | 1628 | return ret; |
1627 | 1629 | ||
1628 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1630 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1629 | hdmi->regs = devm_ioremap_resource(&pdev->dev, iores); | 1631 | hdmi->regs = devm_ioremap_resource(dev, iores); |
1630 | if (IS_ERR(hdmi->regs)) | 1632 | if (IS_ERR(hdmi->regs)) |
1631 | return PTR_ERR(hdmi->regs); | 1633 | return PTR_ERR(hdmi->regs); |
1632 | 1634 | ||
@@ -1665,7 +1667,7 @@ static int imx_hdmi_platform_probe(struct platform_device *pdev) | |||
1665 | } | 1667 | } |
1666 | 1668 | ||
1667 | /* Product and revision IDs */ | 1669 | /* Product and revision IDs */ |
1668 | dev_info(&pdev->dev, | 1670 | dev_info(dev, |
1669 | "Detected HDMI controller 0x%x:0x%x:0x%x:0x%x\n", | 1671 | "Detected HDMI controller 0x%x:0x%x:0x%x:0x%x\n", |
1670 | hdmi_readb(hdmi, HDMI_DESIGN_ID), | 1672 | hdmi_readb(hdmi, HDMI_DESIGN_ID), |
1671 | hdmi_readb(hdmi, HDMI_REVISION_ID), | 1673 | hdmi_readb(hdmi, HDMI_REVISION_ID), |
@@ -1699,7 +1701,7 @@ static int imx_hdmi_platform_probe(struct platform_device *pdev) | |||
1699 | 1701 | ||
1700 | imx_drm_encoder_add_possible_crtcs(hdmi->imx_drm_encoder, np); | 1702 | imx_drm_encoder_add_possible_crtcs(hdmi->imx_drm_encoder, np); |
1701 | 1703 | ||
1702 | platform_set_drvdata(pdev, hdmi); | 1704 | dev_set_drvdata(dev, hdmi); |
1703 | 1705 | ||
1704 | return 0; | 1706 | return 0; |
1705 | 1707 | ||
@@ -1711,9 +1713,10 @@ err_isfr: | |||
1711 | return ret; | 1713 | return ret; |
1712 | } | 1714 | } |
1713 | 1715 | ||
1714 | static int imx_hdmi_platform_remove(struct platform_device *pdev) | 1716 | static void imx_hdmi_unbind(struct device *dev, struct device *master, |
1717 | void *data) | ||
1715 | { | 1718 | { |
1716 | struct imx_hdmi *hdmi = platform_get_drvdata(pdev); | 1719 | struct imx_hdmi *hdmi = dev_get_drvdata(dev); |
1717 | struct drm_connector *connector = &hdmi->connector; | 1720 | struct drm_connector *connector = &hdmi->connector; |
1718 | struct drm_encoder *encoder = &hdmi->encoder; | 1721 | struct drm_encoder *encoder = &hdmi->encoder; |
1719 | 1722 | ||
@@ -1724,7 +1727,21 @@ static int imx_hdmi_platform_remove(struct platform_device *pdev) | |||
1724 | clk_disable_unprepare(hdmi->iahb_clk); | 1727 | clk_disable_unprepare(hdmi->iahb_clk); |
1725 | clk_disable_unprepare(hdmi->isfr_clk); | 1728 | clk_disable_unprepare(hdmi->isfr_clk); |
1726 | i2c_put_adapter(hdmi->ddc); | 1729 | i2c_put_adapter(hdmi->ddc); |
1730 | } | ||
1727 | 1731 | ||
1732 | static const struct component_ops hdmi_ops = { | ||
1733 | .bind = imx_hdmi_bind, | ||
1734 | .unbind = imx_hdmi_unbind, | ||
1735 | }; | ||
1736 | |||
1737 | static int imx_hdmi_platform_probe(struct platform_device *pdev) | ||
1738 | { | ||
1739 | return component_add(&pdev->dev, &hdmi_ops); | ||
1740 | } | ||
1741 | |||
1742 | static int imx_hdmi_platform_remove(struct platform_device *pdev) | ||
1743 | { | ||
1744 | component_del(&pdev->dev, &hdmi_ops); | ||
1728 | return 0; | 1745 | return 0; |
1729 | } | 1746 | } |
1730 | 1747 | ||
diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index dd29a4aad376..d00f93f3440d 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/component.h> | ||
23 | #include <drm/drmP.h> | 24 | #include <drm/drmP.h> |
24 | #include <drm/drm_fb_helper.h> | 25 | #include <drm/drm_fb_helper.h> |
25 | #include <drm/drm_crtc_helper.h> | 26 | #include <drm/drm_crtc_helper.h> |
@@ -450,11 +451,11 @@ static const struct of_device_id imx_ldb_dt_ids[] = { | |||
450 | }; | 451 | }; |
451 | MODULE_DEVICE_TABLE(of, imx_ldb_dt_ids); | 452 | MODULE_DEVICE_TABLE(of, imx_ldb_dt_ids); |
452 | 453 | ||
453 | static int imx_ldb_probe(struct platform_device *pdev) | 454 | static int imx_ldb_bind(struct device *dev, struct device *master, void *data) |
454 | { | 455 | { |
455 | struct device_node *np = pdev->dev.of_node; | 456 | struct device_node *np = dev->of_node; |
456 | const struct of_device_id *of_id = | 457 | const struct of_device_id *of_id = |
457 | of_match_device(imx_ldb_dt_ids, &pdev->dev); | 458 | of_match_device(imx_ldb_dt_ids, dev); |
458 | struct device_node *child; | 459 | struct device_node *child; |
459 | const u8 *edidp; | 460 | const u8 *edidp; |
460 | struct imx_ldb *imx_ldb; | 461 | struct imx_ldb *imx_ldb; |
@@ -464,17 +465,17 @@ static int imx_ldb_probe(struct platform_device *pdev) | |||
464 | int ret; | 465 | int ret; |
465 | int i; | 466 | int i; |
466 | 467 | ||
467 | imx_ldb = devm_kzalloc(&pdev->dev, sizeof(*imx_ldb), GFP_KERNEL); | 468 | imx_ldb = devm_kzalloc(dev, sizeof(*imx_ldb), GFP_KERNEL); |
468 | if (!imx_ldb) | 469 | if (!imx_ldb) |
469 | return -ENOMEM; | 470 | return -ENOMEM; |
470 | 471 | ||
471 | imx_ldb->regmap = syscon_regmap_lookup_by_phandle(np, "gpr"); | 472 | imx_ldb->regmap = syscon_regmap_lookup_by_phandle(np, "gpr"); |
472 | if (IS_ERR(imx_ldb->regmap)) { | 473 | if (IS_ERR(imx_ldb->regmap)) { |
473 | dev_err(&pdev->dev, "failed to get parent regmap\n"); | 474 | dev_err(dev, "failed to get parent regmap\n"); |
474 | return PTR_ERR(imx_ldb->regmap); | 475 | return PTR_ERR(imx_ldb->regmap); |
475 | } | 476 | } |
476 | 477 | ||
477 | imx_ldb->dev = &pdev->dev; | 478 | imx_ldb->dev = dev; |
478 | 479 | ||
479 | if (of_id) | 480 | if (of_id) |
480 | imx_ldb->lvds_mux = of_id->data; | 481 | imx_ldb->lvds_mux = of_id->data; |
@@ -512,7 +513,7 @@ static int imx_ldb_probe(struct platform_device *pdev) | |||
512 | return -EINVAL; | 513 | return -EINVAL; |
513 | 514 | ||
514 | if (dual && i > 0) { | 515 | if (dual && i > 0) { |
515 | dev_warn(&pdev->dev, "dual-channel mode, ignoring second output\n"); | 516 | dev_warn(dev, "dual-channel mode, ignoring second output\n"); |
516 | continue; | 517 | continue; |
517 | } | 518 | } |
518 | 519 | ||
@@ -551,7 +552,7 @@ static int imx_ldb_probe(struct platform_device *pdev) | |||
551 | break; | 552 | break; |
552 | case LVDS_BIT_MAP_JEIDA: | 553 | case LVDS_BIT_MAP_JEIDA: |
553 | if (datawidth == 18) { | 554 | if (datawidth == 18) { |
554 | dev_err(&pdev->dev, "JEIDA standard only supported in 24 bit\n"); | 555 | dev_err(dev, "JEIDA standard only supported in 24 bit\n"); |
555 | return -EINVAL; | 556 | return -EINVAL; |
556 | } | 557 | } |
557 | if (i == 0 || dual) | 558 | if (i == 0 || dual) |
@@ -560,7 +561,7 @@ static int imx_ldb_probe(struct platform_device *pdev) | |||
560 | imx_ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | LDB_BIT_MAP_CH1_JEIDA; | 561 | imx_ldb->ldb_ctrl |= LDB_DATA_WIDTH_CH1_24 | LDB_BIT_MAP_CH1_JEIDA; |
561 | break; | 562 | break; |
562 | default: | 563 | default: |
563 | dev_err(&pdev->dev, "data mapping not specified or invalid\n"); | 564 | dev_err(dev, "data mapping not specified or invalid\n"); |
564 | return -EINVAL; | 565 | return -EINVAL; |
565 | } | 566 | } |
566 | 567 | ||
@@ -571,14 +572,15 @@ static int imx_ldb_probe(struct platform_device *pdev) | |||
571 | imx_drm_encoder_add_possible_crtcs(channel->imx_drm_encoder, child); | 572 | imx_drm_encoder_add_possible_crtcs(channel->imx_drm_encoder, child); |
572 | } | 573 | } |
573 | 574 | ||
574 | platform_set_drvdata(pdev, imx_ldb); | 575 | dev_set_drvdata(dev, imx_ldb); |
575 | 576 | ||
576 | return 0; | 577 | return 0; |
577 | } | 578 | } |
578 | 579 | ||
579 | static int imx_ldb_remove(struct platform_device *pdev) | 580 | static void imx_ldb_unbind(struct device *dev, struct device *master, |
581 | void *data) | ||
580 | { | 582 | { |
581 | struct imx_ldb *imx_ldb = platform_get_drvdata(pdev); | 583 | struct imx_ldb *imx_ldb = dev_get_drvdata(dev); |
582 | int i; | 584 | int i; |
583 | 585 | ||
584 | for (i = 0; i < 2; i++) { | 586 | for (i = 0; i < 2; i++) { |
@@ -591,7 +593,21 @@ static int imx_ldb_remove(struct platform_device *pdev) | |||
591 | imx_drm_remove_connector(channel->imx_drm_connector); | 593 | imx_drm_remove_connector(channel->imx_drm_connector); |
592 | imx_drm_remove_encoder(channel->imx_drm_encoder); | 594 | imx_drm_remove_encoder(channel->imx_drm_encoder); |
593 | } | 595 | } |
596 | } | ||
594 | 597 | ||
598 | static const struct component_ops imx_ldb_ops = { | ||
599 | .bind = imx_ldb_bind, | ||
600 | .unbind = imx_ldb_unbind, | ||
601 | }; | ||
602 | |||
603 | static int imx_ldb_probe(struct platform_device *pdev) | ||
604 | { | ||
605 | return component_add(&pdev->dev, &imx_ldb_ops); | ||
606 | } | ||
607 | |||
608 | static int imx_ldb_remove(struct platform_device *pdev) | ||
609 | { | ||
610 | component_del(&pdev->dev, &imx_ldb_ops); | ||
595 | return 0; | 611 | return 0; |
596 | } | 612 | } |
597 | 613 | ||
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c index 77131e5770f3..ad840d78a09a 100644 --- a/drivers/staging/imx-drm/imx-tve.c +++ b/drivers/staging/imx-drm/imx-tve.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/clk-provider.h> | 22 | #include <linux/clk-provider.h> |
23 | #include <linux/component.h> | ||
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
24 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
25 | #include <linux/regmap.h> | 26 | #include <linux/regmap.h> |
@@ -583,9 +584,10 @@ static const int of_get_tve_mode(struct device_node *np) | |||
583 | return -EINVAL; | 584 | return -EINVAL; |
584 | } | 585 | } |
585 | 586 | ||
586 | static int imx_tve_probe(struct platform_device *pdev) | 587 | static int imx_tve_bind(struct device *dev, struct device *master, void *data) |
587 | { | 588 | { |
588 | struct device_node *np = pdev->dev.of_node; | 589 | struct platform_device *pdev = to_platform_device(dev); |
590 | struct device_node *np = dev->of_node; | ||
589 | struct device_node *ddc_node; | 591 | struct device_node *ddc_node; |
590 | struct imx_tve *tve; | 592 | struct imx_tve *tve; |
591 | struct resource *res; | 593 | struct resource *res; |
@@ -594,11 +596,11 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
594 | int irq; | 596 | int irq; |
595 | int ret; | 597 | int ret; |
596 | 598 | ||
597 | tve = devm_kzalloc(&pdev->dev, sizeof(*tve), GFP_KERNEL); | 599 | tve = devm_kzalloc(dev, sizeof(*tve), GFP_KERNEL); |
598 | if (!tve) | 600 | if (!tve) |
599 | return -ENOMEM; | 601 | return -ENOMEM; |
600 | 602 | ||
601 | tve->dev = &pdev->dev; | 603 | tve->dev = dev; |
602 | spin_lock_init(&tve->lock); | 604 | spin_lock_init(&tve->lock); |
603 | 605 | ||
604 | ddc_node = of_parse_phandle(np, "ddc", 0); | 606 | ddc_node = of_parse_phandle(np, "ddc", 0); |
@@ -609,7 +611,7 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
609 | 611 | ||
610 | tve->mode = of_get_tve_mode(np); | 612 | tve->mode = of_get_tve_mode(np); |
611 | if (tve->mode != TVE_MODE_VGA) { | 613 | if (tve->mode != TVE_MODE_VGA) { |
612 | dev_err(&pdev->dev, "only VGA mode supported, currently\n"); | 614 | dev_err(dev, "only VGA mode supported, currently\n"); |
613 | return -EINVAL; | 615 | return -EINVAL; |
614 | } | 616 | } |
615 | 617 | ||
@@ -618,7 +620,7 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
618 | &tve->hsync_pin); | 620 | &tve->hsync_pin); |
619 | 621 | ||
620 | if (ret < 0) { | 622 | if (ret < 0) { |
621 | dev_err(&pdev->dev, "failed to get vsync pin\n"); | 623 | dev_err(dev, "failed to get vsync pin\n"); |
622 | return ret; | 624 | return ret; |
623 | } | 625 | } |
624 | 626 | ||
@@ -626,40 +628,40 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
626 | &tve->vsync_pin); | 628 | &tve->vsync_pin); |
627 | 629 | ||
628 | if (ret < 0) { | 630 | if (ret < 0) { |
629 | dev_err(&pdev->dev, "failed to get vsync pin\n"); | 631 | dev_err(dev, "failed to get vsync pin\n"); |
630 | return ret; | 632 | return ret; |
631 | } | 633 | } |
632 | } | 634 | } |
633 | 635 | ||
634 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 636 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
635 | base = devm_ioremap_resource(&pdev->dev, res); | 637 | base = devm_ioremap_resource(dev, res); |
636 | if (IS_ERR(base)) | 638 | if (IS_ERR(base)) |
637 | return PTR_ERR(base); | 639 | return PTR_ERR(base); |
638 | 640 | ||
639 | tve_regmap_config.lock_arg = tve; | 641 | tve_regmap_config.lock_arg = tve; |
640 | tve->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "tve", base, | 642 | tve->regmap = devm_regmap_init_mmio_clk(dev, "tve", base, |
641 | &tve_regmap_config); | 643 | &tve_regmap_config); |
642 | if (IS_ERR(tve->regmap)) { | 644 | if (IS_ERR(tve->regmap)) { |
643 | dev_err(&pdev->dev, "failed to init regmap: %ld\n", | 645 | dev_err(dev, "failed to init regmap: %ld\n", |
644 | PTR_ERR(tve->regmap)); | 646 | PTR_ERR(tve->regmap)); |
645 | return PTR_ERR(tve->regmap); | 647 | return PTR_ERR(tve->regmap); |
646 | } | 648 | } |
647 | 649 | ||
648 | irq = platform_get_irq(pdev, 0); | 650 | irq = platform_get_irq(pdev, 0); |
649 | if (irq < 0) { | 651 | if (irq < 0) { |
650 | dev_err(&pdev->dev, "failed to get irq\n"); | 652 | dev_err(dev, "failed to get irq\n"); |
651 | return irq; | 653 | return irq; |
652 | } | 654 | } |
653 | 655 | ||
654 | ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, | 656 | ret = devm_request_threaded_irq(dev, irq, NULL, |
655 | imx_tve_irq_handler, IRQF_ONESHOT, | 657 | imx_tve_irq_handler, IRQF_ONESHOT, |
656 | "imx-tve", tve); | 658 | "imx-tve", tve); |
657 | if (ret < 0) { | 659 | if (ret < 0) { |
658 | dev_err(&pdev->dev, "failed to request irq: %d\n", ret); | 660 | dev_err(dev, "failed to request irq: %d\n", ret); |
659 | return ret; | 661 | return ret; |
660 | } | 662 | } |
661 | 663 | ||
662 | tve->dac_reg = devm_regulator_get(&pdev->dev, "dac"); | 664 | tve->dac_reg = devm_regulator_get(dev, "dac"); |
663 | if (!IS_ERR(tve->dac_reg)) { | 665 | if (!IS_ERR(tve->dac_reg)) { |
664 | regulator_set_voltage(tve->dac_reg, 2750000, 2750000); | 666 | regulator_set_voltage(tve->dac_reg, 2750000, 2750000); |
665 | ret = regulator_enable(tve->dac_reg); | 667 | ret = regulator_enable(tve->dac_reg); |
@@ -667,17 +669,17 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
667 | return ret; | 669 | return ret; |
668 | } | 670 | } |
669 | 671 | ||
670 | tve->clk = devm_clk_get(&pdev->dev, "tve"); | 672 | tve->clk = devm_clk_get(dev, "tve"); |
671 | if (IS_ERR(tve->clk)) { | 673 | if (IS_ERR(tve->clk)) { |
672 | dev_err(&pdev->dev, "failed to get high speed tve clock: %ld\n", | 674 | dev_err(dev, "failed to get high speed tve clock: %ld\n", |
673 | PTR_ERR(tve->clk)); | 675 | PTR_ERR(tve->clk)); |
674 | return PTR_ERR(tve->clk); | 676 | return PTR_ERR(tve->clk); |
675 | } | 677 | } |
676 | 678 | ||
677 | /* this is the IPU DI clock input selector, can be parented to tve_di */ | 679 | /* this is the IPU DI clock input selector, can be parented to tve_di */ |
678 | tve->di_sel_clk = devm_clk_get(&pdev->dev, "di_sel"); | 680 | tve->di_sel_clk = devm_clk_get(dev, "di_sel"); |
679 | if (IS_ERR(tve->di_sel_clk)) { | 681 | if (IS_ERR(tve->di_sel_clk)) { |
680 | dev_err(&pdev->dev, "failed to get ipu di mux clock: %ld\n", | 682 | dev_err(dev, "failed to get ipu di mux clock: %ld\n", |
681 | PTR_ERR(tve->di_sel_clk)); | 683 | PTR_ERR(tve->di_sel_clk)); |
682 | return PTR_ERR(tve->di_sel_clk); | 684 | return PTR_ERR(tve->di_sel_clk); |
683 | } | 685 | } |
@@ -688,11 +690,11 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
688 | 690 | ||
689 | ret = regmap_read(tve->regmap, TVE_COM_CONF_REG, &val); | 691 | ret = regmap_read(tve->regmap, TVE_COM_CONF_REG, &val); |
690 | if (ret < 0) { | 692 | if (ret < 0) { |
691 | dev_err(&pdev->dev, "failed to read configuration register: %d\n", ret); | 693 | dev_err(dev, "failed to read configuration register: %d\n", ret); |
692 | return ret; | 694 | return ret; |
693 | } | 695 | } |
694 | if (val != 0x00100000) { | 696 | if (val != 0x00100000) { |
695 | dev_err(&pdev->dev, "configuration register default value indicates this is not a TVEv2\n"); | 697 | dev_err(dev, "configuration register default value indicates this is not a TVEv2\n"); |
696 | return -ENODEV; | 698 | return -ENODEV; |
697 | } | 699 | } |
698 | 700 | ||
@@ -705,14 +707,15 @@ static int imx_tve_probe(struct platform_device *pdev) | |||
705 | 707 | ||
706 | ret = imx_drm_encoder_add_possible_crtcs(tve->imx_drm_encoder, np); | 708 | ret = imx_drm_encoder_add_possible_crtcs(tve->imx_drm_encoder, np); |
707 | 709 | ||
708 | platform_set_drvdata(pdev, tve); | 710 | dev_set_drvdata(dev, tve); |
709 | 711 | ||
710 | return 0; | 712 | return 0; |
711 | } | 713 | } |
712 | 714 | ||
713 | static int imx_tve_remove(struct platform_device *pdev) | 715 | static void imx_tve_unbind(struct device *dev, struct device *master, |
716 | void *data) | ||
714 | { | 717 | { |
715 | struct imx_tve *tve = platform_get_drvdata(pdev); | 718 | struct imx_tve *tve = dev_get_drvdata(dev); |
716 | struct drm_connector *connector = &tve->connector; | 719 | struct drm_connector *connector = &tve->connector; |
717 | struct drm_encoder *encoder = &tve->encoder; | 720 | struct drm_encoder *encoder = &tve->encoder; |
718 | 721 | ||
@@ -723,7 +726,21 @@ static int imx_tve_remove(struct platform_device *pdev) | |||
723 | 726 | ||
724 | if (!IS_ERR(tve->dac_reg)) | 727 | if (!IS_ERR(tve->dac_reg)) |
725 | regulator_disable(tve->dac_reg); | 728 | regulator_disable(tve->dac_reg); |
729 | } | ||
726 | 730 | ||
731 | static const struct component_ops imx_tve_ops = { | ||
732 | .bind = imx_tve_bind, | ||
733 | .unbind = imx_tve_unbind, | ||
734 | }; | ||
735 | |||
736 | static int imx_tve_probe(struct platform_device *pdev) | ||
737 | { | ||
738 | return component_add(&pdev->dev, &imx_tve_ops); | ||
739 | } | ||
740 | |||
741 | static int imx_tve_remove(struct platform_device *pdev) | ||
742 | { | ||
743 | component_del(&pdev->dev, &imx_tve_ops); | ||
727 | return 0; | 744 | return 0; |
728 | } | 745 | } |
729 | 746 | ||
diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 08e0a3b29174..d779ad2d1f4e 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
18 | * MA 02110-1301, USA. | 18 | * MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | #include <linux/component.h> | ||
20 | #include <linux/module.h> | 21 | #include <linux/module.h> |
21 | #include <linux/export.h> | 22 | #include <linux/export.h> |
22 | #include <linux/device.h> | 23 | #include <linux/device.h> |
@@ -400,43 +401,60 @@ err_put_resources: | |||
400 | return ret; | 401 | return ret; |
401 | } | 402 | } |
402 | 403 | ||
403 | static int ipu_drm_probe(struct platform_device *pdev) | 404 | static int ipu_drm_bind(struct device *dev, struct device *master, void *data) |
404 | { | 405 | { |
405 | struct ipu_client_platformdata *pdata = pdev->dev.platform_data; | 406 | struct ipu_client_platformdata *pdata = dev->platform_data; |
406 | struct ipu_crtc *ipu_crtc; | 407 | struct ipu_crtc *ipu_crtc; |
407 | int ret; | 408 | int ret; |
408 | 409 | ||
409 | if (!pdata) | 410 | ipu_crtc = devm_kzalloc(dev, sizeof(*ipu_crtc), GFP_KERNEL); |
410 | return -EINVAL; | ||
411 | |||
412 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
413 | if (ret) | ||
414 | return ret; | ||
415 | |||
416 | ipu_crtc = devm_kzalloc(&pdev->dev, sizeof(*ipu_crtc), GFP_KERNEL); | ||
417 | if (!ipu_crtc) | 411 | if (!ipu_crtc) |
418 | return -ENOMEM; | 412 | return -ENOMEM; |
419 | 413 | ||
420 | ipu_crtc->dev = &pdev->dev; | 414 | ipu_crtc->dev = dev; |
421 | 415 | ||
422 | ret = ipu_crtc_init(ipu_crtc, pdata); | 416 | ret = ipu_crtc_init(ipu_crtc, pdata); |
423 | if (ret) | 417 | if (ret) |
424 | return ret; | 418 | return ret; |
425 | 419 | ||
426 | platform_set_drvdata(pdev, ipu_crtc); | 420 | dev_set_drvdata(dev, ipu_crtc); |
427 | 421 | ||
428 | return 0; | 422 | return 0; |
429 | } | 423 | } |
430 | 424 | ||
431 | static int ipu_drm_remove(struct platform_device *pdev) | 425 | static void ipu_drm_unbind(struct device *dev, struct device *master, |
426 | void *data) | ||
432 | { | 427 | { |
433 | struct ipu_crtc *ipu_crtc = platform_get_drvdata(pdev); | 428 | struct ipu_crtc *ipu_crtc = dev_get_drvdata(dev); |
434 | 429 | ||
435 | imx_drm_remove_crtc(ipu_crtc->imx_crtc); | 430 | imx_drm_remove_crtc(ipu_crtc->imx_crtc); |
436 | 431 | ||
437 | ipu_plane_put_resources(ipu_crtc->plane[0]); | 432 | ipu_plane_put_resources(ipu_crtc->plane[0]); |
438 | ipu_put_resources(ipu_crtc); | 433 | ipu_put_resources(ipu_crtc); |
434 | } | ||
435 | |||
436 | static const struct component_ops ipu_crtc_ops = { | ||
437 | .bind = ipu_drm_bind, | ||
438 | .unbind = ipu_drm_unbind, | ||
439 | }; | ||
439 | 440 | ||
441 | static int ipu_drm_probe(struct platform_device *pdev) | ||
442 | { | ||
443 | int ret; | ||
444 | |||
445 | if (!pdev->dev.platform_data) | ||
446 | return -EINVAL; | ||
447 | |||
448 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | ||
449 | if (ret) | ||
450 | return ret; | ||
451 | |||
452 | return component_add(&pdev->dev, &ipu_crtc_ops); | ||
453 | } | ||
454 | |||
455 | static int ipu_drm_remove(struct platform_device *pdev) | ||
456 | { | ||
457 | component_del(&pdev->dev, &ipu_crtc_ops); | ||
440 | return 0; | 458 | return 0; |
441 | } | 459 | } |
442 | 460 | ||
diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index 12bcf4f58bdf..4019cae35ff9 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c | |||
@@ -18,6 +18,7 @@ | |||
18 | * MA 02110-1301, USA. | 18 | * MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/component.h> | ||
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <drm/drmP.h> | 23 | #include <drm/drmP.h> |
23 | #include <drm/drm_fb_helper.h> | 24 | #include <drm/drm_fb_helper.h> |
@@ -192,15 +193,15 @@ static int imx_pd_register(struct imx_parallel_display *imxpd) | |||
192 | return 0; | 193 | return 0; |
193 | } | 194 | } |
194 | 195 | ||
195 | static int imx_pd_probe(struct platform_device *pdev) | 196 | static int imx_pd_bind(struct device *dev, struct device *master, void *data) |
196 | { | 197 | { |
197 | struct device_node *np = pdev->dev.of_node; | 198 | struct device_node *np = dev->of_node; |
198 | const u8 *edidp; | 199 | const u8 *edidp; |
199 | struct imx_parallel_display *imxpd; | 200 | struct imx_parallel_display *imxpd; |
200 | int ret; | 201 | int ret; |
201 | const char *fmt; | 202 | const char *fmt; |
202 | 203 | ||
203 | imxpd = devm_kzalloc(&pdev->dev, sizeof(*imxpd), GFP_KERNEL); | 204 | imxpd = devm_kzalloc(dev, sizeof(*imxpd), GFP_KERNEL); |
204 | if (!imxpd) | 205 | if (!imxpd) |
205 | return -ENOMEM; | 206 | return -ENOMEM; |
206 | 207 | ||
@@ -218,7 +219,7 @@ static int imx_pd_probe(struct platform_device *pdev) | |||
218 | imxpd->interface_pix_fmt = V4L2_PIX_FMT_BGR666; | 219 | imxpd->interface_pix_fmt = V4L2_PIX_FMT_BGR666; |
219 | } | 220 | } |
220 | 221 | ||
221 | imxpd->dev = &pdev->dev; | 222 | imxpd->dev = dev; |
222 | 223 | ||
223 | ret = imx_pd_register(imxpd); | 224 | ret = imx_pd_register(imxpd); |
224 | if (ret) | 225 | if (ret) |
@@ -226,14 +227,15 @@ static int imx_pd_probe(struct platform_device *pdev) | |||
226 | 227 | ||
227 | ret = imx_drm_encoder_add_possible_crtcs(imxpd->imx_drm_encoder, np); | 228 | ret = imx_drm_encoder_add_possible_crtcs(imxpd->imx_drm_encoder, np); |
228 | 229 | ||
229 | platform_set_drvdata(pdev, imxpd); | 230 | dev_set_drvdata(dev, imxpd); |
230 | 231 | ||
231 | return 0; | 232 | return 0; |
232 | } | 233 | } |
233 | 234 | ||
234 | static int imx_pd_remove(struct platform_device *pdev) | 235 | static void imx_pd_unbind(struct device *dev, struct device *master, |
236 | void *data) | ||
235 | { | 237 | { |
236 | struct imx_parallel_display *imxpd = platform_get_drvdata(pdev); | 238 | struct imx_parallel_display *imxpd = dev_get_drvdata(dev); |
237 | struct drm_connector *connector = &imxpd->connector; | 239 | struct drm_connector *connector = &imxpd->connector; |
238 | struct drm_encoder *encoder = &imxpd->encoder; | 240 | struct drm_encoder *encoder = &imxpd->encoder; |
239 | 241 | ||
@@ -241,7 +243,21 @@ static int imx_pd_remove(struct platform_device *pdev) | |||
241 | 243 | ||
242 | imx_drm_remove_connector(imxpd->imx_drm_connector); | 244 | imx_drm_remove_connector(imxpd->imx_drm_connector); |
243 | imx_drm_remove_encoder(imxpd->imx_drm_encoder); | 245 | imx_drm_remove_encoder(imxpd->imx_drm_encoder); |
246 | } | ||
244 | 247 | ||
248 | static const struct component_ops imx_pd_ops = { | ||
249 | .bind = imx_pd_bind, | ||
250 | .unbind = imx_pd_unbind, | ||
251 | }; | ||
252 | |||
253 | static int imx_pd_probe(struct platform_device *pdev) | ||
254 | { | ||
255 | return component_add(&pdev->dev, &imx_pd_ops); | ||
256 | } | ||
257 | |||
258 | static int imx_pd_remove(struct platform_device *pdev) | ||
259 | { | ||
260 | component_del(&pdev->dev, &imx_pd_ops); | ||
245 | return 0; | 261 | return 0; |
246 | } | 262 | } |
247 | 263 | ||