aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_lvds.c
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2010-03-29 04:40:50 -0400
committerEric Anholt <eric@anholt.net>2010-04-12 12:23:49 -0400
commitbb8a356088db8a2a50365d417a71ac9e83b9b530 (patch)
treeec74f2fb657d832e9b4a45e373623ea8e3b968b0 /drivers/gpu/drm/i915/intel_lvds.c
parent454c1ca8be2f30cc4b21a20d1b6a69c442f2d8bd (diff)
drm/i915: convert LVDS driver to new encoder/connector structure
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com> Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_lvds.c')
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index a69de00320bc..a5d61d3273d0 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -565,7 +565,8 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
565static int intel_lvds_get_modes(struct drm_connector *connector) 565static int intel_lvds_get_modes(struct drm_connector *connector)
566{ 566{
567 struct drm_device *dev = connector->dev; 567 struct drm_device *dev = connector->dev;
568 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 568 struct drm_encoder *encoder = intel_attached_encoder(connector);
569 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
569 struct drm_i915_private *dev_priv = dev->dev_private; 570 struct drm_i915_private *dev_priv = dev->dev_private;
570 int ret = 0; 571 int ret = 0;
571 572
@@ -647,11 +648,8 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
647static void intel_lvds_destroy(struct drm_connector *connector) 648static void intel_lvds_destroy(struct drm_connector *connector)
648{ 649{
649 struct drm_device *dev = connector->dev; 650 struct drm_device *dev = connector->dev;
650 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
651 struct drm_i915_private *dev_priv = dev->dev_private; 651 struct drm_i915_private *dev_priv = dev->dev_private;
652 652
653 if (intel_encoder->ddc_bus)
654 intel_i2c_destroy(intel_encoder->ddc_bus);
655 if (dev_priv->lid_notifier.notifier_call) 653 if (dev_priv->lid_notifier.notifier_call)
656 acpi_lid_notifier_unregister(&dev_priv->lid_notifier); 654 acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
657 drm_sysfs_connector_remove(connector); 655 drm_sysfs_connector_remove(connector);
@@ -664,13 +662,14 @@ static int intel_lvds_set_property(struct drm_connector *connector,
664 uint64_t value) 662 uint64_t value)
665{ 663{
666 struct drm_device *dev = connector->dev; 664 struct drm_device *dev = connector->dev;
667 struct intel_encoder *intel_encoder =
668 to_intel_encoder(connector);
669 665
670 if (property == dev->mode_config.scaling_mode_property && 666 if (property == dev->mode_config.scaling_mode_property &&
671 connector->encoder) { 667 connector->encoder) {
672 struct drm_crtc *crtc = connector->encoder->crtc; 668 struct drm_crtc *crtc = connector->encoder->crtc;
669 struct drm_encoder *encoder = connector->encoder;
670 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
673 struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv; 671 struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
672
674 if (value == DRM_MODE_SCALE_NONE) { 673 if (value == DRM_MODE_SCALE_NONE) {
675 DRM_DEBUG_KMS("no scaling not supported\n"); 674 DRM_DEBUG_KMS("no scaling not supported\n");
676 return 0; 675 return 0;
@@ -704,7 +703,7 @@ static const struct drm_encoder_helper_funcs intel_lvds_helper_funcs = {
704static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs = { 703static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs = {
705 .get_modes = intel_lvds_get_modes, 704 .get_modes = intel_lvds_get_modes,
706 .mode_valid = intel_lvds_mode_valid, 705 .mode_valid = intel_lvds_mode_valid,
707 .best_encoder = intel_best_encoder, 706 .best_encoder = intel_attached_encoder,
708}; 707};
709 708
710static const struct drm_connector_funcs intel_lvds_connector_funcs = { 709static const struct drm_connector_funcs intel_lvds_connector_funcs = {
@@ -718,7 +717,12 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = {
718 717
719static void intel_lvds_enc_destroy(struct drm_encoder *encoder) 718static void intel_lvds_enc_destroy(struct drm_encoder *encoder)
720{ 719{
720 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
721
722 if (intel_encoder->ddc_bus)
723 intel_i2c_destroy(intel_encoder->ddc_bus);
721 drm_encoder_cleanup(encoder); 724 drm_encoder_cleanup(encoder);
725 kfree(intel_encoder);
722} 726}
723 727
724static const struct drm_encoder_funcs intel_lvds_enc_funcs = { 728static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
@@ -907,6 +911,7 @@ void intel_lvds_init(struct drm_device *dev)
907{ 911{
908 struct drm_i915_private *dev_priv = dev->dev_private; 912 struct drm_i915_private *dev_priv = dev->dev_private;
909 struct intel_encoder *intel_encoder; 913 struct intel_encoder *intel_encoder;
914 struct intel_connector *intel_connector;
910 struct drm_connector *connector; 915 struct drm_connector *connector;
911 struct drm_encoder *encoder; 916 struct drm_encoder *encoder;
912 struct drm_display_mode *scan; /* *modes, *bios_mode; */ 917 struct drm_display_mode *scan; /* *modes, *bios_mode; */
@@ -940,15 +945,21 @@ void intel_lvds_init(struct drm_device *dev)
940 return; 945 return;
941 } 946 }
942 947
943 connector = &intel_encoder->base; 948 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
949 if (!intel_connector) {
950 kfree(intel_encoder);
951 return;
952 }
953
954 connector = &intel_connector->base;
944 encoder = &intel_encoder->enc; 955 encoder = &intel_encoder->enc;
945 drm_connector_init(dev, &intel_encoder->base, &intel_lvds_connector_funcs, 956 drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs,
946 DRM_MODE_CONNECTOR_LVDS); 957 DRM_MODE_CONNECTOR_LVDS);
947 958
948 drm_encoder_init(dev, &intel_encoder->enc, &intel_lvds_enc_funcs, 959 drm_encoder_init(dev, &intel_encoder->enc, &intel_lvds_enc_funcs,
949 DRM_MODE_ENCODER_LVDS); 960 DRM_MODE_ENCODER_LVDS);
950 961
951 drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc); 962 drm_mode_connector_attach_encoder(&intel_connector->base, &intel_encoder->enc);
952 intel_encoder->type = INTEL_OUTPUT_LVDS; 963 intel_encoder->type = INTEL_OUTPUT_LVDS;
953 964
954 intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); 965 intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT);
@@ -969,7 +980,7 @@ void intel_lvds_init(struct drm_device *dev)
969 * the initial panel fitting mode will be FULL_SCREEN. 980 * the initial panel fitting mode will be FULL_SCREEN.
970 */ 981 */
971 982
972 drm_connector_attach_property(&intel_encoder->base, 983 drm_connector_attach_property(&intel_connector->base,
973 dev->mode_config.scaling_mode_property, 984 dev->mode_config.scaling_mode_property,
974 DRM_MODE_SCALE_FULLSCREEN); 985 DRM_MODE_SCALE_FULLSCREEN);
975 lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN; 986 lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN;
@@ -1081,4 +1092,5 @@ failed:
1081 drm_connector_cleanup(connector); 1092 drm_connector_cleanup(connector);
1082 drm_encoder_cleanup(encoder); 1093 drm_encoder_cleanup(encoder);
1083 kfree(intel_encoder); 1094 kfree(intel_encoder);
1095 kfree(intel_connector);
1084} 1096}