diff options
author | Dave Airlie <airlied@linux.ie> | 2009-09-28 01:31:10 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-09-28 01:31:10 -0400 |
commit | 74bf2ad508efa93db4254c9da9c7238da44e2c58 (patch) | |
tree | f912544f1f916d0cadc5a832030164b9062d020a | |
parent | 210bed8f827471e271f894fb99ee879a5d27cf30 (diff) |
drm/kms: make fb helper work for all drivers.
This initialises the fb helper with the connector helper,
so that the fb cmdline code works for intel as well.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/drm_fb_helper.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_connectors.c | 64 | ||||
-rw-r--r-- | include/drm/drm_crtc_helper.h | 4 |
3 files changed, 43 insertions, 26 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 10d810ef8faa..83d7b7d03863 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -47,7 +47,6 @@ int drm_fb_helper_add_connector(struct drm_connector *connector) | |||
47 | return -ENOMEM; | 47 | return -ENOMEM; |
48 | 48 | ||
49 | return 0; | 49 | return 0; |
50 | |||
51 | } | 50 | } |
52 | EXPORT_SYMBOL(drm_fb_helper_add_connector); | 51 | EXPORT_SYMBOL(drm_fb_helper_add_connector); |
53 | 52 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index db155d5e60ce..e376be47a4a0 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -808,7 +808,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
808 | switch (connector_type) { | 808 | switch (connector_type) { |
809 | case DRM_MODE_CONNECTOR_VGA: | 809 | case DRM_MODE_CONNECTOR_VGA: |
810 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 810 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
811 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 811 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
812 | if (ret) | ||
813 | goto failed; | ||
812 | if (i2c_bus->valid) { | 814 | if (i2c_bus->valid) { |
813 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); | 815 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); |
814 | if (!radeon_connector->ddc_bus) | 816 | if (!radeon_connector->ddc_bus) |
@@ -821,7 +823,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
821 | break; | 823 | break; |
822 | case DRM_MODE_CONNECTOR_DVIA: | 824 | case DRM_MODE_CONNECTOR_DVIA: |
823 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 825 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
824 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 826 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
827 | if (ret) | ||
828 | goto failed; | ||
825 | if (i2c_bus->valid) { | 829 | if (i2c_bus->valid) { |
826 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 830 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
827 | if (!radeon_connector->ddc_bus) | 831 | if (!radeon_connector->ddc_bus) |
@@ -841,7 +845,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
841 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 845 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
842 | radeon_connector->con_priv = radeon_dig_connector; | 846 | radeon_connector->con_priv = radeon_dig_connector; |
843 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 847 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
844 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 848 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
849 | if (ret) | ||
850 | goto failed; | ||
845 | if (i2c_bus->valid) { | 851 | if (i2c_bus->valid) { |
846 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 852 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
847 | if (!radeon_connector->ddc_bus) | 853 | if (!radeon_connector->ddc_bus) |
@@ -865,7 +871,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
865 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 871 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
866 | radeon_connector->con_priv = radeon_dig_connector; | 872 | radeon_connector->con_priv = radeon_dig_connector; |
867 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 873 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
868 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 874 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
875 | if (ret) | ||
876 | goto failed; | ||
869 | if (i2c_bus->valid) { | 877 | if (i2c_bus->valid) { |
870 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "HDMI"); | 878 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "HDMI"); |
871 | if (!radeon_connector->ddc_bus) | 879 | if (!radeon_connector->ddc_bus) |
@@ -884,7 +892,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
884 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 892 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
885 | radeon_connector->con_priv = radeon_dig_connector; | 893 | radeon_connector->con_priv = radeon_dig_connector; |
886 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 894 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
887 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 895 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
896 | if (ret) | ||
897 | goto failed; | ||
888 | if (i2c_bus->valid) { | 898 | if (i2c_bus->valid) { |
889 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); | 899 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DP"); |
890 | if (!radeon_connector->ddc_bus) | 900 | if (!radeon_connector->ddc_bus) |
@@ -897,12 +907,14 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
897 | case DRM_MODE_CONNECTOR_9PinDIN: | 907 | case DRM_MODE_CONNECTOR_9PinDIN: |
898 | if (radeon_tv == 1) { | 908 | if (radeon_tv == 1) { |
899 | drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); | 909 | drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); |
900 | drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); | 910 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); |
911 | if (ret) | ||
912 | goto failed; | ||
913 | radeon_connector->dac_load_detect = true; | ||
914 | drm_connector_attach_property(&radeon_connector->base, | ||
915 | rdev->mode_info.load_detect_property, | ||
916 | 1); | ||
901 | } | 917 | } |
902 | radeon_connector->dac_load_detect = true; | ||
903 | drm_connector_attach_property(&radeon_connector->base, | ||
904 | rdev->mode_info.load_detect_property, | ||
905 | 1); | ||
906 | break; | 918 | break; |
907 | case DRM_MODE_CONNECTOR_LVDS: | 919 | case DRM_MODE_CONNECTOR_LVDS: |
908 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); | 920 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
@@ -912,7 +924,9 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
912 | radeon_dig_connector->igp_lane_info = igp_lane_info; | 924 | radeon_dig_connector->igp_lane_info = igp_lane_info; |
913 | radeon_connector->con_priv = radeon_dig_connector; | 925 | radeon_connector->con_priv = radeon_dig_connector; |
914 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); | 926 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
915 | drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); | 927 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); |
928 | if (ret) | ||
929 | goto failed; | ||
916 | if (i2c_bus->valid) { | 930 | if (i2c_bus->valid) { |
917 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); | 931 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); |
918 | if (!radeon_connector->ddc_bus) | 932 | if (!radeon_connector->ddc_bus) |
@@ -926,10 +940,6 @@ radeon_add_atom_connector(struct drm_device *dev, | |||
926 | break; | 940 | break; |
927 | } | 941 | } |
928 | 942 | ||
929 | ret = drm_fb_helper_add_connector(connector); | ||
930 | if (ret) | ||
931 | goto failed; | ||
932 | |||
933 | connector->display_info.subpixel_order = subpixel_order; | 943 | connector->display_info.subpixel_order = subpixel_order; |
934 | drm_sysfs_connector_add(connector); | 944 | drm_sysfs_connector_add(connector); |
935 | return; | 945 | return; |
@@ -978,7 +988,9 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
978 | switch (connector_type) { | 988 | switch (connector_type) { |
979 | case DRM_MODE_CONNECTOR_VGA: | 989 | case DRM_MODE_CONNECTOR_VGA: |
980 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 990 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
981 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 991 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
992 | if (ret) | ||
993 | goto failed; | ||
982 | if (i2c_bus->valid) { | 994 | if (i2c_bus->valid) { |
983 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); | 995 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "VGA"); |
984 | if (!radeon_connector->ddc_bus) | 996 | if (!radeon_connector->ddc_bus) |
@@ -991,7 +1003,9 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
991 | break; | 1003 | break; |
992 | case DRM_MODE_CONNECTOR_DVIA: | 1004 | case DRM_MODE_CONNECTOR_DVIA: |
993 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); | 1005 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
994 | drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); | 1006 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs); |
1007 | if (ret) | ||
1008 | goto failed; | ||
995 | if (i2c_bus->valid) { | 1009 | if (i2c_bus->valid) { |
996 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 1010 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
997 | if (!radeon_connector->ddc_bus) | 1011 | if (!radeon_connector->ddc_bus) |
@@ -1005,7 +1019,9 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1005 | case DRM_MODE_CONNECTOR_DVII: | 1019 | case DRM_MODE_CONNECTOR_DVII: |
1006 | case DRM_MODE_CONNECTOR_DVID: | 1020 | case DRM_MODE_CONNECTOR_DVID: |
1007 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); | 1021 | drm_connector_init(dev, &radeon_connector->base, &radeon_dvi_connector_funcs, connector_type); |
1008 | drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); | 1022 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_dvi_connector_helper_funcs); |
1023 | if (ret) | ||
1024 | goto failed; | ||
1009 | if (i2c_bus->valid) { | 1025 | if (i2c_bus->valid) { |
1010 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); | 1026 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "DVI"); |
1011 | if (!radeon_connector->ddc_bus) | 1027 | if (!radeon_connector->ddc_bus) |
@@ -1022,7 +1038,9 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1022 | case DRM_MODE_CONNECTOR_9PinDIN: | 1038 | case DRM_MODE_CONNECTOR_9PinDIN: |
1023 | if (radeon_tv == 1) { | 1039 | if (radeon_tv == 1) { |
1024 | drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); | 1040 | drm_connector_init(dev, &radeon_connector->base, &radeon_tv_connector_funcs, connector_type); |
1025 | drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); | 1041 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_tv_connector_helper_funcs); |
1042 | if (ret) | ||
1043 | goto failed; | ||
1026 | radeon_connector->dac_load_detect = true; | 1044 | radeon_connector->dac_load_detect = true; |
1027 | drm_connector_attach_property(&radeon_connector->base, | 1045 | drm_connector_attach_property(&radeon_connector->base, |
1028 | rdev->mode_info.load_detect_property, | 1046 | rdev->mode_info.load_detect_property, |
@@ -1031,7 +1049,9 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1031 | break; | 1049 | break; |
1032 | case DRM_MODE_CONNECTOR_LVDS: | 1050 | case DRM_MODE_CONNECTOR_LVDS: |
1033 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); | 1051 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
1034 | drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); | 1052 | ret = drm_connector_helper_add(&radeon_connector->base, &radeon_lvds_connector_helper_funcs); |
1053 | if (ret) | ||
1054 | goto failed; | ||
1035 | if (i2c_bus->valid) { | 1055 | if (i2c_bus->valid) { |
1036 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); | 1056 | radeon_connector->ddc_bus = radeon_i2c_create(dev, i2c_bus, "LVDS"); |
1037 | if (!radeon_connector->ddc_bus) | 1057 | if (!radeon_connector->ddc_bus) |
@@ -1044,10 +1064,6 @@ radeon_add_legacy_connector(struct drm_device *dev, | |||
1044 | break; | 1064 | break; |
1045 | } | 1065 | } |
1046 | 1066 | ||
1047 | ret = drm_fb_helper_add_connector(connector); | ||
1048 | if (ret) | ||
1049 | goto failed; | ||
1050 | |||
1051 | connector->display_info.subpixel_order = subpixel_order; | 1067 | connector->display_info.subpixel_order = subpixel_order; |
1052 | drm_sysfs_connector_add(connector); | 1068 | drm_sysfs_connector_add(connector); |
1053 | return; | 1069 | return; |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 4c8dacaf4f58..ef47dfd8e5e9 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include <linux/fb.h> | 40 | #include <linux/fb.h> |
41 | 41 | ||
42 | #include "drm_fb_helper.h" | ||
42 | struct drm_crtc_helper_funcs { | 43 | struct drm_crtc_helper_funcs { |
43 | /* | 44 | /* |
44 | * Control power levels on the CRTC. If the mode passed in is | 45 | * Control power levels on the CRTC. If the mode passed in is |
@@ -119,10 +120,11 @@ static inline void drm_encoder_helper_add(struct drm_encoder *encoder, | |||
119 | encoder->helper_private = (void *)funcs; | 120 | encoder->helper_private = (void *)funcs; |
120 | } | 121 | } |
121 | 122 | ||
122 | static inline void drm_connector_helper_add(struct drm_connector *connector, | 123 | static inline int drm_connector_helper_add(struct drm_connector *connector, |
123 | const struct drm_connector_helper_funcs *funcs) | 124 | const struct drm_connector_helper_funcs *funcs) |
124 | { | 125 | { |
125 | connector->helper_private = (void *)funcs; | 126 | connector->helper_private = (void *)funcs; |
127 | return drm_fb_helper_add_connector(connector); | ||
126 | } | 128 | } |
127 | 129 | ||
128 | extern int drm_helper_resume_force_mode(struct drm_device *dev); | 130 | extern int drm_helper_resume_force_mode(struct drm_device *dev); |