Skip to content

Commit

Permalink
gma500: Replace SDVO code with slightly modified version from i915
Browse files Browse the repository at this point in the history
Our current SDVO implementation is not working properly, so replace it with
a modified version of the i915. Further testing and debugging is needed to make
sure we can handle the different SDVO setups and wiring.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Patrik Jakobsson authored and Dave Airlie committed Dec 20, 2011
1 parent 5c0c1d5 commit 5736995
Show file tree
Hide file tree
Showing 6 changed files with 2,745 additions and 976 deletions.
19 changes: 19 additions & 0 deletions drivers/gpu/drm/gma500/psb_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,16 @@ struct psb_intel_opregion {
int enabled;
};

struct sdvo_device_mapping {
u8 initialized;
u8 dvo_port;
u8 slave_addr;
u8 dvo_wiring;
u8 i2c_pin;
u8 i2c_speed;
u8 ddc_pin;
};

struct intel_gmbus {
struct i2c_adapter adapter;
struct i2c_adapter *force_bit;
Expand Down Expand Up @@ -345,6 +355,15 @@ struct drm_psb_private {
/* gmbus */
struct intel_gmbus *gmbus;

/* Used by SDVO */
int crt_ddc_pin;
/* FIXME: The mappings should be parsed from bios but for now we can
pretend there are no mappings available */
struct sdvo_device_mapping sdvo_mappings[2];
u32 hotplug_supported_mask;
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;

/*
* LVDS info
*/
Expand Down
8 changes: 8 additions & 0 deletions drivers/gpu/drm/gma500/psb_intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,14 @@ void psb_intel_encoder_commit(struct drm_encoder *encoder)
encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON);
}

void psb_intel_encoder_destroy(struct drm_encoder *encoder)
{
struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder);

drm_encoder_cleanup(encoder);
kfree(intel_encoder);
}

static bool psb_intel_crtc_mode_fixup(struct drm_crtc *crtc,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
Expand Down
41 changes: 40 additions & 1 deletion drivers/gpu/drm/gma500/psb_intel_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,25 @@
#define INTEL_I2C_BUS_DVO 1
#define INTEL_I2C_BUS_SDVO 2

/* Intel Pipe Clone Bit */
#define INTEL_HDMIB_CLONE_BIT 1
#define INTEL_HDMIC_CLONE_BIT 2
#define INTEL_HDMID_CLONE_BIT 3
#define INTEL_HDMIE_CLONE_BIT 4
#define INTEL_HDMIF_CLONE_BIT 5
#define INTEL_SDVO_NON_TV_CLONE_BIT 6
#define INTEL_SDVO_TV_CLONE_BIT 7
#define INTEL_SDVO_LVDS_CLONE_BIT 8
#define INTEL_ANALOG_CLONE_BIT 9
#define INTEL_TV_CLONE_BIT 10
#define INTEL_DP_B_CLONE_BIT 11
#define INTEL_DP_C_CLONE_BIT 12
#define INTEL_DP_D_CLONE_BIT 13
#define INTEL_LVDS_CLONE_BIT 14
#define INTEL_DVO_TMDS_CLONE_BIT 15
#define INTEL_DVO_LVDS_CLONE_BIT 16
#define INTEL_EDP_CLONE_BIT 17

/* these are outputs from the chip - integrated only
* external chips are via DVO or SDVO output */
#define INTEL_OUTPUT_UNUSED 0
Expand All @@ -56,6 +75,25 @@
#define INTEL_DVO_CHIP_TMDS 2
#define INTEL_DVO_CHIP_TVOUT 4

#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)

static inline void
psb_intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
int multiplier)
{
mode->clock *= multiplier;
mode->private_flags |= multiplier;
}

static inline int
psb_intel_mode_get_pixel_multiplier(const struct drm_display_mode *mode)
{
return (mode->private_flags & INTEL_MODE_PIXEL_MULTIPLIER_MASK)
>> INTEL_MODE_PIXEL_MULTIPLIER_SHIFT;
}


/*
* Hold information useally put on the device driver privates here,
* since it needs to be shared across multiple of devices drivers privates.
Expand Down Expand Up @@ -173,7 +211,7 @@ extern bool psb_intel_ddc_probe(struct i2c_adapter *adapter);
extern void psb_intel_crtc_init(struct drm_device *dev, int pipe,
struct psb_intel_mode_device *mode_dev);
extern void psb_intel_crt_init(struct drm_device *dev);
extern void psb_intel_sdvo_init(struct drm_device *dev, int output_device);
extern bool psb_intel_sdvo_init(struct drm_device *dev, int output_device);
extern void psb_intel_dvo_init(struct drm_device *dev);
extern void psb_intel_tv_init(struct drm_device *dev);
extern void psb_intel_lvds_init(struct drm_device *dev,
Expand All @@ -190,6 +228,7 @@ extern void mid_dsi_init(struct drm_device *dev,
extern void psb_intel_crtc_load_lut(struct drm_crtc *crtc);
extern void psb_intel_encoder_prepare(struct drm_encoder *encoder);
extern void psb_intel_encoder_commit(struct drm_encoder *encoder);
extern void psb_intel_encoder_destroy(struct drm_encoder *encoder);

static inline struct psb_intel_encoder *psb_intel_attached_encoder(
struct drm_connector *connector)
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/gma500/psb_intel_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@
#define SDVO_PIPE_B_SELECT (1 << 30)
#define SDVO_STALL_SELECT (1 << 29)
#define SDVO_INTERRUPT_ENABLE (1 << 26)
#define SDVO_COLOR_RANGE_16_235 (1 << 8)
#define SDVO_AUDIO_ENABLE (1 << 6)

/**
* 915G/GM SDVO pixel multiplier.
Expand Down
Loading

0 comments on commit 5736995

Please sign in to comment.