Commit 291d284c authored by Dave Airlie's avatar Dave Airlie

Merge branch 'gma500-next' of git://github.com/patjak/drm-gma500 into drm-next

Here's some gma500 unifying and cleanups for drm-next. There is more stuff in
the pipe for 3.12 but I'd like to get these out of the way first.

* 'gma500-next' of git://github.com/patjak/drm-gma500: (35 commits)
  drm/gma500/cdv: Add and hook up chip op for disabling sr
  drm/gma500/cdv: Add and hook up chip op for watermarks
  drm/gma500: Rename psb_intel_encoder to gma_encoder
  drm/gma500: Rename psb_intel_connector to gma_connector
  drm/gma500: Rename psb_intel_crtc to gma_crtc
  drm/gma500/cdv: Convert to generic set_config()
  drm/gma500/psb: Convert to generic set_config()
  drm/gma500: Add generic set_config() function
  drm/gma500/cdv: Convert to generic save/restore
  drm/gma500/psb: Convert to generic save/restore
  drm/gma500: Add generic crtc save/restore funcs
  drm/gma500: Convert to generic encoder funcs
  drm/gma500: Add generic encoder functions
  drm/gma500/psb: Convert to generic cursor funcs
  drm/gma500/cdv: Convert to generic cursor funcs
  drm/gma500: Add generic cursor functions
  drm/gma500/psb: Convert to generic crtc->destroy
  drm/gma500/mdfld: Use identical generic crtc funcs
  drm/gma500/oak: Use identical generic crtc funcs
  drm/gma500/psb: Convert to gma_crtc_dpms()
  ...
parents d0b2c533 75346fe9
...@@ -15,6 +15,7 @@ gma500_gfx-y += \ ...@@ -15,6 +15,7 @@ gma500_gfx-y += \
mmu.o \ mmu.o \
power.o \ power.o \
psb_drv.o \ psb_drv.o \
gma_display.o \
psb_intel_display.o \ psb_intel_display.o \
psb_intel_lvds.o \ psb_intel_lvds.o \
psb_intel_modes.o \ psb_intel_modes.o \
......
...@@ -641,6 +641,7 @@ const struct psb_ops cdv_chip_ops = { ...@@ -641,6 +641,7 @@ const struct psb_ops cdv_chip_ops = {
.crtc_helper = &cdv_intel_helper_funcs, .crtc_helper = &cdv_intel_helper_funcs,
.crtc_funcs = &cdv_intel_crtc_funcs, .crtc_funcs = &cdv_intel_crtc_funcs,
.clock_funcs = &cdv_clock_funcs,
.output_init = cdv_output_init, .output_init = cdv_output_init,
.hotplug = cdv_hotplug_event, .hotplug = cdv_hotplug_event,
...@@ -655,4 +656,6 @@ const struct psb_ops cdv_chip_ops = { ...@@ -655,4 +656,6 @@ const struct psb_ops cdv_chip_ops = {
.restore_regs = cdv_restore_display_registers, .restore_regs = cdv_restore_display_registers,
.power_down = cdv_power_down, .power_down = cdv_power_down,
.power_up = cdv_power_up, .power_up = cdv_power_up,
.update_wm = cdv_update_wm,
.disable_sr = cdv_disable_sr,
}; };
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
extern const struct drm_crtc_helper_funcs cdv_intel_helper_funcs; extern const struct drm_crtc_helper_funcs cdv_intel_helper_funcs;
extern const struct drm_crtc_funcs cdv_intel_crtc_funcs; extern const struct drm_crtc_funcs cdv_intel_crtc_funcs;
extern const struct gma_clock_funcs cdv_clock_funcs;
extern void cdv_intel_crt_init(struct drm_device *dev, extern void cdv_intel_crt_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev); struct psb_intel_mode_device *mode_dev);
extern void cdv_intel_lvds_init(struct drm_device *dev, extern void cdv_intel_lvds_init(struct drm_device *dev,
...@@ -25,12 +26,5 @@ extern void cdv_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device * ...@@ -25,12 +26,5 @@ extern void cdv_hdmi_init(struct drm_device *dev, struct psb_intel_mode_device *
int reg); int reg);
extern struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev, extern struct drm_display_mode *cdv_intel_crtc_mode_get(struct drm_device *dev,
struct drm_crtc *crtc); struct drm_crtc *crtc);
extern void cdv_update_wm(struct drm_device *dev, struct drm_crtc *crtc);
static inline void cdv_intel_wait_for_vblank(struct drm_device *dev) extern void cdv_disable_sr(struct drm_device *dev);
{
/* Wait for 20ms, i.e. one cycle at 50hz. */
/* FIXME: msleep ?? */
mdelay(20);
}
...@@ -95,13 +95,12 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder, ...@@ -95,13 +95,12 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct psb_intel_crtc *psb_intel_crtc = struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
to_psb_intel_crtc(crtc);
int dpll_md_reg; int dpll_md_reg;
u32 adpa, dpll_md; u32 adpa, dpll_md;
u32 adpa_reg; u32 adpa_reg;
if (psb_intel_crtc->pipe == 0) if (gma_crtc->pipe == 0)
dpll_md_reg = DPLL_A_MD; dpll_md_reg = DPLL_A_MD;
else else
dpll_md_reg = DPLL_B_MD; dpll_md_reg = DPLL_B_MD;
...@@ -124,7 +123,7 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder, ...@@ -124,7 +123,7 @@ static void cdv_intel_crt_mode_set(struct drm_encoder *encoder,
if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
adpa |= ADPA_VSYNC_ACTIVE_HIGH; adpa |= ADPA_VSYNC_ACTIVE_HIGH;
if (psb_intel_crtc->pipe == 0) if (gma_crtc->pipe == 0)
adpa |= ADPA_PIPE_A_SELECT; adpa |= ADPA_PIPE_A_SELECT;
else else
adpa |= ADPA_PIPE_B_SELECT; adpa |= ADPA_PIPE_B_SELECT;
...@@ -197,10 +196,9 @@ static enum drm_connector_status cdv_intel_crt_detect( ...@@ -197,10 +196,9 @@ static enum drm_connector_status cdv_intel_crt_detect(
static void cdv_intel_crt_destroy(struct drm_connector *connector) static void cdv_intel_crt_destroy(struct drm_connector *connector)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus); psb_intel_i2c_destroy(gma_encoder->ddc_bus);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
...@@ -208,9 +206,9 @@ static void cdv_intel_crt_destroy(struct drm_connector *connector) ...@@ -208,9 +206,9 @@ static void cdv_intel_crt_destroy(struct drm_connector *connector)
static int cdv_intel_crt_get_modes(struct drm_connector *connector) static int cdv_intel_crt_get_modes(struct drm_connector *connector)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); return psb_intel_ddc_get_modes(connector,
return psb_intel_ddc_get_modes(connector, &psb_intel_encoder->ddc_bus->adapter); &gma_encoder->ddc_bus->adapter);
} }
static int cdv_intel_crt_set_property(struct drm_connector *connector, static int cdv_intel_crt_set_property(struct drm_connector *connector,
...@@ -227,8 +225,8 @@ static int cdv_intel_crt_set_property(struct drm_connector *connector, ...@@ -227,8 +225,8 @@ static int cdv_intel_crt_set_property(struct drm_connector *connector,
static const struct drm_encoder_helper_funcs cdv_intel_crt_helper_funcs = { static const struct drm_encoder_helper_funcs cdv_intel_crt_helper_funcs = {
.dpms = cdv_intel_crt_dpms, .dpms = cdv_intel_crt_dpms,
.mode_fixup = cdv_intel_crt_mode_fixup, .mode_fixup = cdv_intel_crt_mode_fixup,
.prepare = psb_intel_encoder_prepare, .prepare = gma_encoder_prepare,
.commit = psb_intel_encoder_commit, .commit = gma_encoder_commit,
.mode_set = cdv_intel_crt_mode_set, .mode_set = cdv_intel_crt_mode_set,
}; };
...@@ -244,7 +242,7 @@ static const struct drm_connector_helper_funcs ...@@ -244,7 +242,7 @@ static const struct drm_connector_helper_funcs
cdv_intel_crt_connector_helper_funcs = { cdv_intel_crt_connector_helper_funcs = {
.mode_valid = cdv_intel_crt_mode_valid, .mode_valid = cdv_intel_crt_mode_valid,
.get_modes = cdv_intel_crt_get_modes, .get_modes = cdv_intel_crt_get_modes,
.best_encoder = psb_intel_best_encoder, .best_encoder = gma_best_encoder,
}; };
static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder) static void cdv_intel_crt_enc_destroy(struct drm_encoder *encoder)
...@@ -260,32 +258,31 @@ void cdv_intel_crt_init(struct drm_device *dev, ...@@ -260,32 +258,31 @@ void cdv_intel_crt_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev) struct psb_intel_mode_device *mode_dev)
{ {
struct psb_intel_connector *psb_intel_connector; struct gma_connector *gma_connector;
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
u32 i2c_reg; u32 i2c_reg;
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL); gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
if (!psb_intel_encoder) if (!gma_encoder)
return; return;
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL); gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
if (!psb_intel_connector) if (!gma_connector)
goto failed_connector; goto failed_connector;
connector = &psb_intel_connector->base; connector = &gma_connector->base;
connector->polled = DRM_CONNECTOR_POLL_HPD; connector->polled = DRM_CONNECTOR_POLL_HPD;
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
&cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); &cdv_intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
encoder = &psb_intel_encoder->base; encoder = &gma_encoder->base;
drm_encoder_init(dev, encoder, drm_encoder_init(dev, encoder,
&cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC); &cdv_intel_crt_enc_funcs, DRM_MODE_ENCODER_DAC);
psb_intel_connector_attach_encoder(psb_intel_connector, gma_connector_attach_encoder(gma_connector, gma_encoder);
psb_intel_encoder);
/* Set up the DDC bus. */ /* Set up the DDC bus. */
i2c_reg = GPIOA; i2c_reg = GPIOA;
...@@ -294,15 +291,15 @@ void cdv_intel_crt_init(struct drm_device *dev, ...@@ -294,15 +291,15 @@ void cdv_intel_crt_init(struct drm_device *dev,
if (dev_priv->crt_ddc_bus != 0) if (dev_priv->crt_ddc_bus != 0)
i2c_reg = dev_priv->crt_ddc_bus; i2c_reg = dev_priv->crt_ddc_bus;
}*/ }*/
psb_intel_encoder->ddc_bus = psb_intel_i2c_create(dev, gma_encoder->ddc_bus = psb_intel_i2c_create(dev,
i2c_reg, "CRTDDC_A"); i2c_reg, "CRTDDC_A");
if (!psb_intel_encoder->ddc_bus) { if (!gma_encoder->ddc_bus) {
dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
"failed.\n"); "failed.\n");
goto failed_ddc; goto failed_ddc;
} }
psb_intel_encoder->type = INTEL_OUTPUT_ANALOG; gma_encoder->type = INTEL_OUTPUT_ANALOG;
/* /*
psb_intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT); psb_intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT);
psb_intel_output->crtc_mask = (1 << 0) | (1 << 1); psb_intel_output->crtc_mask = (1 << 0) | (1 << 1);
...@@ -318,10 +315,10 @@ void cdv_intel_crt_init(struct drm_device *dev, ...@@ -318,10 +315,10 @@ void cdv_intel_crt_init(struct drm_device *dev,
return; return;
failed_ddc: failed_ddc:
drm_encoder_cleanup(&psb_intel_encoder->base); drm_encoder_cleanup(&gma_encoder->base);
drm_connector_cleanup(&psb_intel_connector->base); drm_connector_cleanup(&gma_connector->base);
kfree(psb_intel_connector); kfree(gma_connector);
failed_connector: failed_connector:
kfree(psb_intel_encoder); kfree(gma_encoder);
return; return;
} }
This diff is collapsed.
This diff is collapsed.
...@@ -64,11 +64,11 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder, ...@@ -64,11 +64,11 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *adjusted_mode) struct drm_display_mode *adjusted_mode)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct psb_intel_encoder *psb_intel_encoder = to_psb_intel_encoder(encoder); struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv; struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
u32 hdmib; u32 hdmib;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
hdmib = (2 << 10); hdmib = (2 << 10);
...@@ -77,7 +77,7 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder, ...@@ -77,7 +77,7 @@ static void cdv_hdmi_mode_set(struct drm_encoder *encoder,
if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
hdmib |= HDMI_HSYNC_ACTIVE_HIGH; hdmib |= HDMI_HSYNC_ACTIVE_HIGH;
if (intel_crtc->pipe == 1) if (gma_crtc->pipe == 1)
hdmib |= HDMIB_PIPE_B_SELECT; hdmib |= HDMIB_PIPE_B_SELECT;
if (hdmi_priv->has_hdmi_audio) { if (hdmi_priv->has_hdmi_audio) {
...@@ -99,9 +99,8 @@ static bool cdv_hdmi_mode_fixup(struct drm_encoder *encoder, ...@@ -99,9 +99,8 @@ static bool cdv_hdmi_mode_fixup(struct drm_encoder *encoder,
static void cdv_hdmi_dpms(struct drm_encoder *encoder, int mode) static void cdv_hdmi_dpms(struct drm_encoder *encoder, int mode)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
to_psb_intel_encoder(encoder); struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
u32 hdmib; u32 hdmib;
hdmib = REG_READ(hdmi_priv->hdmi_reg); hdmib = REG_READ(hdmi_priv->hdmi_reg);
...@@ -116,9 +115,8 @@ static void cdv_hdmi_dpms(struct drm_encoder *encoder, int mode) ...@@ -116,9 +115,8 @@ static void cdv_hdmi_dpms(struct drm_encoder *encoder, int mode)
static void cdv_hdmi_save(struct drm_connector *connector) static void cdv_hdmi_save(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
hdmi_priv->save_HDMIB = REG_READ(hdmi_priv->hdmi_reg); hdmi_priv->save_HDMIB = REG_READ(hdmi_priv->hdmi_reg);
} }
...@@ -126,9 +124,8 @@ static void cdv_hdmi_save(struct drm_connector *connector) ...@@ -126,9 +124,8 @@ static void cdv_hdmi_save(struct drm_connector *connector)
static void cdv_hdmi_restore(struct drm_connector *connector) static void cdv_hdmi_restore(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
REG_WRITE(hdmi_priv->hdmi_reg, hdmi_priv->save_HDMIB); REG_WRITE(hdmi_priv->hdmi_reg, hdmi_priv->save_HDMIB);
REG_READ(hdmi_priv->hdmi_reg); REG_READ(hdmi_priv->hdmi_reg);
...@@ -137,13 +134,12 @@ static void cdv_hdmi_restore(struct drm_connector *connector) ...@@ -137,13 +134,12 @@ static void cdv_hdmi_restore(struct drm_connector *connector)
static enum drm_connector_status cdv_hdmi_detect( static enum drm_connector_status cdv_hdmi_detect(
struct drm_connector *connector, bool force) struct drm_connector *connector, bool force)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct mid_intel_hdmi_priv *hdmi_priv = gma_encoder->dev_priv;
struct mid_intel_hdmi_priv *hdmi_priv = psb_intel_encoder->dev_priv;
struct edid *edid = NULL; struct edid *edid = NULL;
enum drm_connector_status status = connector_status_disconnected; enum drm_connector_status status = connector_status_disconnected;
edid = drm_get_edid(connector, &psb_intel_encoder->i2c_bus->adapter); edid = drm_get_edid(connector, &gma_encoder->i2c_bus->adapter);
hdmi_priv->has_hdmi_sink = false; hdmi_priv->has_hdmi_sink = false;
hdmi_priv->has_hdmi_audio = false; hdmi_priv->has_hdmi_audio = false;
...@@ -167,7 +163,7 @@ static int cdv_hdmi_set_property(struct drm_connector *connector, ...@@ -167,7 +163,7 @@ static int cdv_hdmi_set_property(struct drm_connector *connector,
struct drm_encoder *encoder = connector->encoder; struct drm_encoder *encoder = connector->encoder;
if (!strcmp(property->name, "scaling mode") && encoder) { if (!strcmp(property->name, "scaling mode") && encoder) {
struct psb_intel_crtc *crtc = to_psb_intel_crtc(encoder->crtc); struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
bool centre; bool centre;
uint64_t curValue; uint64_t curValue;
...@@ -221,12 +217,11 @@ static int cdv_hdmi_set_property(struct drm_connector *connector, ...@@ -221,12 +217,11 @@ static int cdv_hdmi_set_property(struct drm_connector *connector,
*/ */
static int cdv_hdmi_get_modes(struct drm_connector *connector) static int cdv_hdmi_get_modes(struct drm_connector *connector)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
struct edid *edid = NULL; struct edid *edid = NULL;
int ret = 0; int ret = 0;
edid = drm_get_edid(connector, &psb_intel_encoder->i2c_bus->adapter); edid = drm_get_edid(connector, &gma_encoder->i2c_bus->adapter);
if (edid) { if (edid) {
drm_mode_connector_update_edid_property(connector, edid); drm_mode_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid); ret = drm_add_edid_modes(connector, edid);
...@@ -256,11 +251,10 @@ static int cdv_hdmi_mode_valid(struct drm_connector *connector, ...@@ -256,11 +251,10 @@ static int cdv_hdmi_mode_valid(struct drm_connector *connector,
static void cdv_hdmi_destroy(struct drm_connector *connector) static void cdv_hdmi_destroy(struct drm_connector *connector)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
if (psb_intel_encoder->i2c_bus) if (gma_encoder->i2c_bus)
psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus); psb_intel_i2c_destroy(gma_encoder->i2c_bus);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
...@@ -269,16 +263,16 @@ static void cdv_hdmi_destroy(struct drm_connector *connector) ...@@ -269,16 +263,16 @@ static void cdv_hdmi_destroy(struct drm_connector *connector)
static const struct drm_encoder_helper_funcs cdv_hdmi_helper_funcs = { static const struct drm_encoder_helper_funcs cdv_hdmi_helper_funcs = {
.dpms = cdv_hdmi_dpms, .dpms = cdv_hdmi_dpms,
.mode_fixup = cdv_hdmi_mode_fixup, .mode_fixup = cdv_hdmi_mode_fixup,
.prepare = psb_intel_encoder_prepare, .prepare = gma_encoder_prepare,
.mode_set = cdv_hdmi_mode_set, .mode_set = cdv_hdmi_mode_set,
.commit = psb_intel_encoder_commit, .commit = gma_encoder_commit,
}; };
static const struct drm_connector_helper_funcs static const struct drm_connector_helper_funcs
cdv_hdmi_connector_helper_funcs = { cdv_hdmi_connector_helper_funcs = {
.get_modes = cdv_hdmi_get_modes, .get_modes = cdv_hdmi_get_modes,
.mode_valid = cdv_hdmi_mode_valid, .mode_valid = cdv_hdmi_mode_valid,
.best_encoder = psb_intel_best_encoder, .best_encoder = gma_best_encoder,
}; };
static const struct drm_connector_funcs cdv_hdmi_connector_funcs = { static const struct drm_connector_funcs cdv_hdmi_connector_funcs = {
...@@ -294,23 +288,22 @@ static const struct drm_connector_funcs cdv_hdmi_connector_funcs = { ...@@ -294,23 +288,22 @@ static const struct drm_connector_funcs cdv_hdmi_connector_funcs = {
void cdv_hdmi_init(struct drm_device *dev, void cdv_hdmi_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev, int reg) struct psb_intel_mode_device *mode_dev, int reg)
{ {
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct psb_intel_connector *psb_intel_connector; struct gma_connector *gma_connector;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct mid_intel_hdmi_priv *hdmi_priv; struct mid_intel_hdmi_priv *hdmi_priv;
int ddc_bus; int ddc_bus;
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
GFP_KERNEL);
if (!psb_intel_encoder) if (!gma_encoder)
return; return;
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), gma_connector = kzalloc(sizeof(struct gma_connector),
GFP_KERNEL); GFP_KERNEL);
if (!psb_intel_connector) if (!gma_connector)
goto err_connector; goto err_connector;
hdmi_priv = kzalloc(sizeof(struct mid_intel_hdmi_priv), GFP_KERNEL); hdmi_priv = kzalloc(sizeof(struct mid_intel_hdmi_priv), GFP_KERNEL);
...@@ -318,9 +311,9 @@ void cdv_hdmi_init(struct drm_device *dev, ...@@ -318,9 +311,9 @@ void cdv_hdmi_init(struct drm_device *dev,
if (!hdmi_priv) if (!hdmi_priv)
goto err_priv; goto err_priv;
connector = &psb_intel_connector->base; connector = &gma_connector->base;
connector->polled = DRM_CONNECTOR_POLL_HPD; connector->polled = DRM_CONNECTOR_POLL_HPD;
encoder = &psb_intel_encoder->base; encoder = &gma_encoder->base;
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
&cdv_hdmi_connector_funcs, &cdv_hdmi_connector_funcs,
DRM_MODE_CONNECTOR_DVID); DRM_MODE_CONNECTOR_DVID);
...@@ -328,12 +321,11 @@ void cdv_hdmi_init(struct drm_device *dev, ...@@ -328,12 +321,11 @@ void cdv_hdmi_init(struct drm_device *dev,
drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs, drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
DRM_MODE_ENCODER_TMDS); DRM_MODE_ENCODER_TMDS);
psb_intel_connector_attach_encoder(psb_intel_connector, gma_connector_attach_encoder(gma_connector, gma_encoder);
psb_intel_encoder); gma_encoder->type = INTEL_OUTPUT_HDMI;
psb_intel_encoder->type = INTEL_OUTPUT_HDMI;
hdmi_priv->hdmi_reg = reg; hdmi_priv->hdmi_reg = reg;
hdmi_priv->has_hdmi_sink = false; hdmi_priv->has_hdmi_sink = false;
psb_intel_encoder->dev_priv = hdmi_priv; gma_encoder->dev_priv = hdmi_priv;
drm_encoder_helper_add(encoder, &cdv_hdmi_helper_funcs); drm_encoder_helper_add(encoder, &cdv_hdmi_helper_funcs);
drm_connector_helper_add(connector, drm_connector_helper_add(connector,
...@@ -349,11 +341,11 @@ void cdv_hdmi_init(struct drm_device *dev, ...@@ -349,11 +341,11 @@ void cdv_hdmi_init(struct drm_device *dev,
switch (reg) { switch (reg) {
case SDVOB: case SDVOB:
ddc_bus = GPIOE; ddc_bus = GPIOE;
psb_intel_encoder->ddi_select = DDI0_SELECT; gma_encoder->ddi_select = DDI0_SELECT;
break; break;
case SDVOC: case SDVOC:
ddc_bus = GPIOD; ddc_bus = GPIOD;
psb_intel_encoder->ddi_select = DDI1_SELECT; gma_encoder->ddi_select = DDI1_SELECT;
break; break;
default: default:
DRM_ERROR("unknown reg 0x%x for HDMI\n", reg); DRM_ERROR("unknown reg 0x%x for HDMI\n", reg);
...@@ -361,16 +353,15 @@ void cdv_hdmi_init(struct drm_device *dev, ...@@ -361,16 +353,15 @@ void cdv_hdmi_init(struct drm_device *dev,
break; break;
} }
psb_intel_encoder->i2c_bus = psb_intel_i2c_create(dev, gma_encoder->i2c_bus = psb_intel_i2c_create(dev,
ddc_bus, (reg == SDVOB) ? "HDMIB" : "HDMIC"); ddc_bus, (reg == SDVOB) ? "HDMIB" : "HDMIC");
if (!psb_intel_encoder->i2c_bus) { if (!gma_encoder->i2c_bus) {
dev_err(dev->dev, "No ddc adapter available!\n"); dev_err(dev->dev, "No ddc adapter available!\n");
goto failed_ddc; goto failed_ddc;
} }
hdmi_priv->hdmi_i2c_adapter = hdmi_priv->hdmi_i2c_adapter = &(gma_encoder->i2c_bus->adapter);
&(psb_intel_encoder->i2c_bus->adapter);
hdmi_priv->dev = dev; hdmi_priv->dev = dev;
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
return; return;
...@@ -379,7 +370,7 @@ void cdv_hdmi_init(struct drm_device *dev, ...@@ -379,7 +370,7 @@ void cdv_hdmi_init(struct drm_device *dev,
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
err_priv: err_priv:
kfree(psb_intel_connector); kfree(gma_connector);
err_connector: err_connector:
kfree(psb_intel_encoder); kfree(gma_encoder);
} }
...@@ -356,8 +356,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder, ...@@ -356,8 +356,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc( struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
encoder->crtc);
u32 pfit_control; u32 pfit_control;
/* /*
...@@ -379,7 +378,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder, ...@@ -379,7 +378,7 @@ static void cdv_intel_lvds_mode_set(struct drm_encoder *encoder,
else else
pfit_control = 0; pfit_control = 0;
pfit_control |= psb_intel_crtc->pipe << PFIT_PIPE_SHIFT; pfit_control |= gma_crtc->pipe << PFIT_PIPE_SHIFT;
if (dev_priv->lvds_dither) if (dev_priv->lvds_dither)
pfit_control |= PANEL_8TO6_DITHER_ENABLE; pfit_control |= PANEL_8TO6_DITHER_ENABLE;
...@@ -407,12 +406,11 @@ static int cdv_intel_lvds_get_modes(struct drm_connector *connector) ...@@ -407,12 +406,11 @@ static int cdv_intel_lvds_get_modes(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
int ret; int ret;
ret = psb_intel_ddc_get_modes(connector, &psb_intel_encoder->i2c_bus->adapter); ret = psb_intel_ddc_get_modes(connector, &gma_encoder->i2c_bus->adapter);
if (ret) if (ret)
return ret; return ret;
...@@ -444,11 +442,10 @@ static int cdv_intel_lvds_get_modes(struct drm_connector *connector) ...@@ -444,11 +442,10 @@ static int cdv_intel_lvds_get_modes(struct drm_connector *connector)
*/ */
static void cdv_intel_lvds_destroy(struct drm_connector *connector) static void cdv_intel_lvds_destroy(struct drm_connector *connector)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
if (psb_intel_encoder->i2c_bus) if (gma_encoder->i2c_bus)
psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus); psb_intel_i2c_destroy(gma_encoder->i2c_bus);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(connector); kfree(connector);
...@@ -461,8 +458,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector, ...@@ -461,8 +458,7 @@ static int cdv_intel_lvds_set_property(struct drm_connector *connector,
struct drm_encoder *encoder = connector->encoder; struct drm_encoder *encoder = connector->encoder;
if (!strcmp(property->name, "scaling mode") && encoder) { if (!strcmp(property->name, "scaling mode") && encoder) {
struct psb_intel_crtc *crtc = struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
to_psb_intel_crtc(encoder->crtc);
uint64_t curValue; uint64_t curValue;
if (!crtc) if (!crtc)
...@@ -529,7 +525,7 @@ static const struct drm_connector_helper_funcs ...@@ -529,7 +525,7 @@ static const struct drm_connector_helper_funcs
cdv_intel_lvds_connector_helper_funcs = { cdv_intel_lvds_connector_helper_funcs = {
.get_modes = cdv_intel_lvds_get_modes, .get_modes = cdv_intel_lvds_get_modes,
.mode_valid = cdv_intel_lvds_mode_valid, .mode_valid = cdv_intel_lvds_mode_valid,
.best_encoder = psb_intel_best_encoder, .best_encoder = gma_best_encoder,
}; };
static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = { static const struct drm_connector_funcs cdv_intel_lvds_connector_funcs = {
...@@ -612,8 +608,8 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev, ...@@ -612,8 +608,8 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
void cdv_intel_lvds_init(struct drm_device *dev, void cdv_intel_lvds_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev) struct psb_intel_mode_device *mode_dev)
{ {
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct psb_intel_connector *psb_intel_connector; struct gma_connector *gma_connector;
struct cdv_intel_lvds_priv *lvds_priv; struct cdv_intel_lvds_priv *lvds_priv;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
...@@ -630,24 +626,24 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -630,24 +626,24 @@ void cdv_intel_lvds_init(struct drm_device *dev,
return; return;
} }
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), gma_encoder = kzalloc(sizeof(struct gma_encoder),
GFP_KERNEL); GFP_KERNEL);
if (!psb_intel_encoder) if (!gma_encoder)
return; return;
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), gma_connector = kzalloc(sizeof(struct gma_connector),
GFP_KERNEL); GFP_KERNEL);
if (!psb_intel_connector) if (!gma_connector)
goto failed_connector; goto failed_connector;
lvds_priv = kzalloc(sizeof(struct cdv_intel_lvds_priv), GFP_KERNEL); lvds_priv = kzalloc(sizeof(struct cdv_intel_lvds_priv), GFP_KERNEL);
if (!lvds_priv) if (!lvds_priv)
goto failed_lvds_priv; goto failed_lvds_priv;
psb_intel_encoder->dev_priv = lvds_priv; gma_encoder->dev_priv = lvds_priv;
connector = &psb_intel_connector->base; connector = &gma_connector->base;
encoder = &psb_intel_encoder->base; encoder = &gma_encoder->base;
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
...@@ -659,9 +655,8 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -659,9 +655,8 @@ void cdv_intel_lvds_init(struct drm_device *dev,
DRM_MODE_ENCODER_LVDS); DRM_MODE_ENCODER_LVDS);
psb_intel_connector_attach_encoder(psb_intel_connector, gma_connector_attach_encoder(gma_connector, gma_encoder);
psb_intel_encoder); gma_encoder->type = INTEL_OUTPUT_LVDS;
psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
drm_encoder_helper_add(encoder, &cdv_intel_lvds_helper_funcs); drm_encoder_helper_add(encoder, &cdv_intel_lvds_helper_funcs);
drm_connector_helper_add(connector, drm_connector_helper_add(connector,
...@@ -682,16 +677,16 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -682,16 +677,16 @@ void cdv_intel_lvds_init(struct drm_device *dev,
* Set up I2C bus * Set up I2C bus
* FIXME: distroy i2c_bus when exit * FIXME: distroy i2c_bus when exit
*/ */
psb_intel_encoder->i2c_bus = psb_intel_i2c_create(dev, gma_encoder->i2c_bus = psb_intel_i2c_create(dev,
GPIOB, GPIOB,
"LVDSBLC_B"); "LVDSBLC_B");
if (!psb_intel_encoder->i2c_bus) { if (!gma_encoder->i2c_bus) {
dev_printk(KERN_ERR, dev_printk(KERN_ERR,
&dev->pdev->dev, "I2C bus registration failed.\n"); &dev->pdev->dev, "I2C bus registration failed.\n");
goto failed_blc_i2c; goto failed_blc_i2c;
} }
psb_intel_encoder->i2c_bus->slave_addr = 0x2C; gma_encoder->i2c_bus->slave_addr = 0x2C;
dev_priv->lvds_i2c_bus = psb_intel_encoder->i2c_bus; dev_priv->lvds_i2c_bus = gma_encoder->i2c_bus;
/* /*
* LVDS discovery: * LVDS discovery:
...@@ -704,10 +699,10 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -704,10 +699,10 @@ void cdv_intel_lvds_init(struct drm_device *dev,
*/ */
/* Set up the DDC bus. */ /* Set up the DDC bus. */
psb_intel_encoder->ddc_bus = psb_intel_i2c_create(dev, gma_encoder->ddc_bus = psb_intel_i2c_create(dev,
GPIOC, GPIOC,
"LVDSDDC_C"); "LVDSDDC_C");
if (!psb_intel_encoder->ddc_bus) { if (!gma_encoder->ddc_bus) {
dev_printk(KERN_ERR, &dev->pdev->dev, dev_printk(KERN_ERR, &dev->pdev->dev,
"DDC bus registration " "failed.\n"); "DDC bus registration " "failed.\n");
goto failed_ddc; goto failed_ddc;
...@@ -718,7 +713,7 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -718,7 +713,7 @@ void cdv_intel_lvds_init(struct drm_device *dev,
* preferred mode is the right one. * preferred mode is the right one.
*/ */
psb_intel_ddc_get_modes(connector, psb_intel_ddc_get_modes(connector,
&psb_intel_encoder->ddc_bus->adapter); &gma_encoder->ddc_bus->adapter);
list_for_each_entry(scan, &connector->probed_modes, head) { list_for_each_entry(scan, &connector->probed_modes, head) {
if (scan->type & DRM_MODE_TYPE_PREFERRED) { if (scan->type & DRM_MODE_TYPE_PREFERRED) {
mode_dev->panel_fixed_mode = mode_dev->panel_fixed_mode =
...@@ -782,19 +777,19 @@ void cdv_intel_lvds_init(struct drm_device *dev, ...@@ -782,19 +777,19 @@ void cdv_intel_lvds_init(struct drm_device *dev,
failed_find: failed_find:
printk(KERN_ERR "Failed find\n"); printk(KERN_ERR "Failed find\n");
if (psb_intel_encoder->ddc_bus) if (gma_encoder->ddc_bus)
psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus); psb_intel_i2c_destroy(gma_encoder->ddc_bus);
failed_ddc: failed_ddc:
printk(KERN_ERR "Failed DDC\n"); printk(KERN_ERR "Failed DDC\n");
if (psb_intel_encoder->i2c_bus) if (gma_encoder->i2c_bus)
psb_intel_i2c_destroy(psb_intel_encoder->i2c_bus); psb_intel_i2c_destroy(gma_encoder->i2c_bus);
failed_blc_i2c: failed_blc_i2c:
printk(KERN_ERR "Failed BLC\n"); printk(KERN_ERR "Failed BLC\n");
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(lvds_priv); kfree(lvds_priv);
failed_lvds_priv: failed_lvds_priv:
kfree(psb_intel_connector); kfree(gma_connector);
failed_connector: failed_connector:
kfree(psb_intel_encoder); kfree(gma_encoder);
} }
...@@ -520,21 +520,21 @@ static struct drm_framebuffer *psb_user_framebuffer_create ...@@ -520,21 +520,21 @@ static struct drm_framebuffer *psb_user_framebuffer_create
static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno) u16 blue, int regno)
{ {
struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
intel_crtc->lut_r[regno] = red >> 8; gma_crtc->lut_r[regno] = red >> 8;
intel_crtc->lut_g[regno] = green >> 8; gma_crtc->lut_g[regno] = green >> 8;
intel_crtc->lut_b[regno] = blue >> 8; gma_crtc->lut_b[regno] = blue >> 8;
} }
static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red, static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
u16 *green, u16 *blue, int regno) u16 *green, u16 *blue, int regno)
{ {
struct psb_intel_crtc *intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
*red = intel_crtc->lut_r[regno] << 8; *red = gma_crtc->lut_r[regno] << 8;
*green = intel_crtc->lut_g[regno] << 8; *green = gma_crtc->lut_g[regno] << 8;
*blue = intel_crtc->lut_b[regno] << 8; *blue = gma_crtc->lut_b[regno] << 8;
} }
static int psbfb_probe(struct drm_fb_helper *helper, static int psbfb_probe(struct drm_fb_helper *helper,
...@@ -703,13 +703,12 @@ static void psb_setup_outputs(struct drm_device *dev) ...@@ -703,13 +703,12 @@ static void psb_setup_outputs(struct drm_device *dev)
list_for_each_entry(connector, &dev->mode_config.connector_list, list_for_each_entry(connector, &dev->mode_config.connector_list,
head) { head) {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct drm_encoder *encoder = &gma_encoder->base;
struct drm_encoder *encoder = &psb_intel_encoder->base;
int crtc_mask = 0, clone_mask = 0; int crtc_mask = 0, clone_mask = 0;
/* valid crtcs */ /* valid crtcs */
switch (psb_intel_encoder->type) { switch (gma_encoder->type) {
case INTEL_OUTPUT_ANALOG: case INTEL_OUTPUT_ANALOG:
crtc_mask = (1 << 0); crtc_mask = (1 << 0);
clone_mask = (1 << INTEL_OUTPUT_ANALOG); clone_mask = (1 << INTEL_OUTPUT_ANALOG);
...@@ -744,7 +743,7 @@ static void psb_setup_outputs(struct drm_device *dev) ...@@ -744,7 +743,7 @@ static void psb_setup_outputs(struct drm_device *dev)
} }
encoder->possible_crtcs = crtc_mask; encoder->possible_crtcs = crtc_mask;
encoder->possible_clones = encoder->possible_clones =
psb_intel_connector_clones(dev, clone_mask); gma_connector_clones(dev, clone_mask);
} }
} }
......
...@@ -41,7 +41,7 @@ struct psb_fbdev { ...@@ -41,7 +41,7 @@ struct psb_fbdev {
#define to_psb_fb(x) container_of(x, struct psb_framebuffer, base) #define to_psb_fb(x) container_of(x, struct psb_framebuffer, base)
extern int psb_intel_connector_clones(struct drm_device *dev, int type_mask); extern int gma_connector_clones(struct drm_device *dev, int type_mask);
#endif #endif
This diff is collapsed.
/*
* Copyright © 2006-2011 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Authors:
* Eric Anholt <eric@anholt.net>
* Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
*/
#ifndef _GMA_DISPLAY_H_
#define _GMA_DISPLAY_H_
#include <linux/pm_runtime.h>
struct gma_clock_t {
/* given values */
int n;
int m1, m2;
int p1, p2;
/* derived values */
int dot;
int vco;
int m;
int p;
};
struct gma_range_t {
int min, max;
};
struct gma_p2_t {
int dot_limit;
int p2_slow, p2_fast;
};
struct gma_limit_t {
struct gma_range_t dot, vco, n, m, m1, m2, p, p1;
struct gma_p2_t p2;
bool (*find_pll)(const struct gma_limit_t *, struct drm_crtc *,
int target, int refclk,
struct gma_clock_t *best_clock);
};
struct gma_clock_funcs {
void (*clock)(int refclk, struct gma_clock_t *clock);
const struct gma_limit_t *(*limit)(struct drm_crtc *crtc, int refclk);
bool (*pll_is_valid)(struct drm_crtc *crtc,
const struct gma_limit_t *limit,
struct gma_clock_t *clock);
};
/* Common pipe related functions */
extern bool gma_pipe_has_type(struct drm_crtc *crtc, int type);
extern void gma_wait_for_vblank(struct drm_device *dev);
extern int gma_pipe_set_base(struct drm_crtc *crtc, int x, int y,
struct drm_framebuffer *old_fb);
extern int gma_crtc_cursor_set(struct drm_crtc *crtc,
struct drm_file *file_priv,
uint32_t handle,
uint32_t width, uint32_t height);
extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y);
extern void gma_crtc_load_lut(struct drm_crtc *crtc);
extern void gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
u16 *blue, u32 start, u32 size);
extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode);
extern bool gma_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
extern void gma_crtc_prepare(struct drm_crtc *crtc);
extern void gma_crtc_commit(struct drm_crtc *crtc);
extern void gma_crtc_disable(struct drm_crtc *crtc);
extern void gma_crtc_destroy(struct drm_crtc *crtc);
extern int gma_crtc_set_config(struct drm_mode_set *set);
extern void gma_crtc_save(struct drm_crtc *crtc);
extern void gma_crtc_restore(struct drm_crtc *crtc);
extern void gma_encoder_prepare(struct drm_encoder *encoder);
extern void gma_encoder_commit(struct drm_encoder *encoder);
extern void gma_encoder_destroy(struct drm_encoder *encoder);
/* Common clock related functions */
extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk);
extern void gma_clock(int refclk, struct gma_clock_t *clock);
extern bool gma_pll_is_valid(struct drm_crtc *crtc,
const struct gma_limit_t *limit,
struct gma_clock_t *clock);
extern bool gma_find_best_pll(const struct gma_limit_t *limit,
struct drm_crtc *crtc, int target, int refclk,
struct gma_clock_t *best_clock);
#endif
...@@ -249,12 +249,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector, ...@@ -249,12 +249,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
struct drm_encoder *encoder = connector->encoder; struct drm_encoder *encoder = connector->encoder;
if (!strcmp(property->name, "scaling mode") && encoder) { if (!strcmp(property->name, "scaling mode") && encoder) {
struct psb_intel_crtc *psb_crtc = struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
to_psb_intel_crtc(encoder->crtc);
bool centerechange; bool centerechange;
uint64_t val; uint64_t val;
if (!psb_crtc) if (!gma_crtc)
goto set_prop_error; goto set_prop_error;
switch (value) { switch (value) {
...@@ -281,11 +280,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector, ...@@ -281,11 +280,11 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
centerechange = (val == DRM_MODE_SCALE_NO_SCALE) || centerechange = (val == DRM_MODE_SCALE_NO_SCALE) ||
(value == DRM_MODE_SCALE_NO_SCALE); (value == DRM_MODE_SCALE_NO_SCALE);
if (psb_crtc->saved_mode.hdisplay != 0 && if (gma_crtc->saved_mode.hdisplay != 0 &&
psb_crtc->saved_mode.vdisplay != 0) { gma_crtc->saved_mode.vdisplay != 0) {
if (centerechange) { if (centerechange) {
if (!drm_crtc_helper_set_mode(encoder->crtc, if (!drm_crtc_helper_set_mode(encoder->crtc,
&psb_crtc->saved_mode, &gma_crtc->saved_mode,
encoder->crtc->x, encoder->crtc->x,
encoder->crtc->y, encoder->crtc->y,
encoder->crtc->fb)) encoder->crtc->fb))
...@@ -294,8 +293,8 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector, ...@@ -294,8 +293,8 @@ static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
struct drm_encoder_helper_funcs *funcs = struct drm_encoder_helper_funcs *funcs =
encoder->helper_private; encoder->helper_private;
funcs->mode_set(encoder, funcs->mode_set(encoder,
&psb_crtc->saved_mode, &gma_crtc->saved_mode,
&psb_crtc->saved_adjusted_mode); &gma_crtc->saved_adjusted_mode);
} }
} }
} else if (!strcmp(property->name, "backlight") && encoder) { } else if (!strcmp(property->name, "backlight") && encoder) {
......
...@@ -227,7 +227,7 @@ enum { ...@@ -227,7 +227,7 @@ enum {
#define DSI_DPI_DISABLE_BTA BIT(3) #define DSI_DPI_DISABLE_BTA BIT(3)
struct mdfld_dsi_connector { struct mdfld_dsi_connector {
struct psb_intel_connector base; struct gma_connector base;
int pipe; int pipe;
void *private; void *private;
...@@ -238,7 +238,7 @@ struct mdfld_dsi_connector { ...@@ -238,7 +238,7 @@ struct mdfld_dsi_connector {
}; };
struct mdfld_dsi_encoder { struct mdfld_dsi_encoder {
struct psb_intel_encoder base; struct gma_encoder base;
void *private; void *private;
}; };
...@@ -269,21 +269,21 @@ struct mdfld_dsi_config { ...@@ -269,21 +269,21 @@ struct mdfld_dsi_config {
static inline struct mdfld_dsi_connector *mdfld_dsi_connector( static inline struct mdfld_dsi_connector *mdfld_dsi_connector(
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct psb_intel_connector *psb_connector; struct gma_connector *gma_connector;
psb_connector = to_psb_intel_connector(connector); gma_connector = to_gma_connector(connector);
return container_of(psb_connector, struct mdfld_dsi_connector, base); return container_of(gma_connector, struct mdfld_dsi_connector, base);
} }
static inline struct mdfld_dsi_encoder *mdfld_dsi_encoder( static inline struct mdfld_dsi_encoder *mdfld_dsi_encoder(
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct psb_intel_encoder *psb_encoder; struct gma_encoder *gma_encoder;
psb_encoder = to_psb_intel_encoder(encoder); gma_encoder = to_gma_encoder(encoder);
return container_of(psb_encoder, struct mdfld_dsi_encoder, base); return container_of(gma_encoder, struct mdfld_dsi_encoder, base);
} }
static inline struct mdfld_dsi_config * static inline struct mdfld_dsi_config *
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <drm/drmP.h> #include <drm/drmP.h>
#include "psb_intel_reg.h" #include "psb_intel_reg.h"
#include "psb_intel_display.h" #include "gma_display.h"
#include "framebuffer.h" #include "framebuffer.h"
#include "mdfld_output.h" #include "mdfld_output.h"
#include "mdfld_dsi_output.h" #include "mdfld_dsi_output.h"
...@@ -65,7 +65,7 @@ void mdfldWaitForPipeDisable(struct drm_device *dev, int pipe) ...@@ -65,7 +65,7 @@ void mdfldWaitForPipeDisable(struct drm_device *dev, int pipe)
} }
/* FIXME JLIU7_PO */ /* FIXME JLIU7_PO */
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
return; return;
/* Wait for for the pipe disable to take effect. */ /* Wait for for the pipe disable to take effect. */
...@@ -93,7 +93,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe) ...@@ -93,7 +93,7 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe)
} }
/* FIXME JLIU7_PO */ /* FIXME JLIU7_PO */
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
return; return;
/* Wait for for the pipe enable to take effect. */ /* Wait for for the pipe enable to take effect. */
...@@ -104,25 +104,6 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe) ...@@ -104,25 +104,6 @@ void mdfldWaitForPipeEnable(struct drm_device *dev, int pipe)
} }
} }
static void psb_intel_crtc_prepare(struct drm_crtc *crtc)
{
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
}
static void psb_intel_crtc_commit(struct drm_crtc *crtc)
{
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
}
static bool psb_intel_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
/** /**
* Return the pipe currently connected to the panel fitter, * Return the pipe currently connected to the panel fitter,
* or -1 if the panel fitter is not present or not in use * or -1 if the panel fitter is not present or not in use
...@@ -184,9 +165,9 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, ...@@ -184,9 +165,9 @@ static int mdfld__intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
int pipe = psb_intel_crtc->pipe; int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe]; const struct psb_offset *map = &dev_priv->regmap[pipe];
unsigned long start, offset; unsigned long start, offset;
u32 dspcntr; u32 dspcntr;
...@@ -324,8 +305,8 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -324,8 +305,8 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
int pipe = psb_intel_crtc->pipe; int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe]; const struct psb_offset *map = &dev_priv->regmap[pipe];
u32 pipeconf = dev_priv->pipeconf[pipe]; u32 pipeconf = dev_priv->pipeconf[pipe];
u32 temp; u32 temp;
...@@ -436,7 +417,7 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -436,7 +417,7 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
} }
} }
psb_intel_crtc_load_lut(crtc); gma_crtc_load_lut(crtc);
/* Give the overlay scaler a chance to enable /* Give the overlay scaler a chance to enable
if it's on this pipe */ if it's on this pipe */
...@@ -611,8 +592,8 @@ static const struct mrst_limit_t *mdfld_limit(struct drm_crtc *crtc) ...@@ -611,8 +592,8 @@ static const struct mrst_limit_t *mdfld_limit(struct drm_crtc *crtc)
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI) if (gma_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)
|| psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI2)) { || gma_pipe_has_type(crtc, INTEL_OUTPUT_MIPI2)) {
if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19)) if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19))
limit = &mdfld_limits[MDFLD_LIMT_DSIPLL_19]; limit = &mdfld_limits[MDFLD_LIMT_DSIPLL_19];
else if (ksel == KSEL_BYPASS_25) else if (ksel == KSEL_BYPASS_25)
...@@ -624,7 +605,7 @@ static const struct mrst_limit_t *mdfld_limit(struct drm_crtc *crtc) ...@@ -624,7 +605,7 @@ static const struct mrst_limit_t *mdfld_limit(struct drm_crtc *crtc)
(dev_priv->core_freq == 100 || (dev_priv->core_freq == 100 ||
dev_priv->core_freq == 200)) dev_priv->core_freq == 200))
limit = &mdfld_limits[MDFLD_LIMT_DSIPLL_100]; limit = &mdfld_limits[MDFLD_LIMT_DSIPLL_100];
} else if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) { } else if (gma_pipe_has_type(crtc, INTEL_OUTPUT_HDMI)) {
if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19)) if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19))
limit = &mdfld_limits[MDFLD_LIMT_DPLL_19]; limit = &mdfld_limits[MDFLD_LIMT_DPLL_19];
else if (ksel == KSEL_BYPASS_25) else if (ksel == KSEL_BYPASS_25)
...@@ -688,9 +669,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -688,9 +669,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
struct drm_framebuffer *old_fb) struct drm_framebuffer *old_fb)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
int pipe = psb_intel_crtc->pipe; int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe]; const struct psb_offset *map = &dev_priv->regmap[pipe];
int refclk = 0; int refclk = 0;
int clk_n = 0, clk_p2 = 0, clk_byte = 1, clk = 0, m_conv = 0, int clk_n = 0, clk_p2 = 0, clk_byte = 1, clk = 0, m_conv = 0,
...@@ -700,7 +681,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -700,7 +681,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
u32 dpll = 0, fp = 0; u32 dpll = 0, fp = 0;
bool is_mipi = false, is_mipi2 = false, is_hdmi = false; bool is_mipi = false, is_mipi2 = false, is_hdmi = false;
struct drm_mode_config *mode_config = &dev->mode_config; struct drm_mode_config *mode_config = &dev->mode_config;
struct psb_intel_encoder *psb_intel_encoder = NULL; struct gma_encoder *gma_encoder = NULL;
uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN; uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_connector *connector; struct drm_connector *connector;
...@@ -749,9 +730,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -749,9 +730,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
if (!gma_power_begin(dev, true)) if (!gma_power_begin(dev, true))
return 0; return 0;
memcpy(&psb_intel_crtc->saved_mode, mode, memcpy(&gma_crtc->saved_mode, mode,
sizeof(struct drm_display_mode)); sizeof(struct drm_display_mode));
memcpy(&psb_intel_crtc->saved_adjusted_mode, adjusted_mode, memcpy(&gma_crtc->saved_adjusted_mode, adjusted_mode,
sizeof(struct drm_display_mode)); sizeof(struct drm_display_mode));
list_for_each_entry(connector, &mode_config->connector_list, head) { list_for_each_entry(connector, &mode_config->connector_list, head) {
...@@ -766,9 +747,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -766,9 +747,9 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
if (encoder->crtc != crtc) if (encoder->crtc != crtc)
continue; continue;
psb_intel_encoder = psb_intel_attached_encoder(connector); gma_encoder = gma_attached_encoder(connector);
switch (psb_intel_encoder->type) { switch (gma_encoder->type) {
case INTEL_OUTPUT_MIPI: case INTEL_OUTPUT_MIPI:
is_mipi = true; is_mipi = true;
break; break;
...@@ -819,7 +800,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -819,7 +800,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
REG_WRITE(map->pos, 0); REG_WRITE(map->pos, 0);
if (psb_intel_encoder) if (gma_encoder)
drm_object_property_get_value(&connector->base, drm_object_property_get_value(&connector->base,
dev->mode_config.scaling_mode_property, &scalingType); dev->mode_config.scaling_mode_property, &scalingType);
...@@ -1034,7 +1015,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -1034,7 +1015,7 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
/* Wait for for the pipe enable to take effect. */ /* Wait for for the pipe enable to take effect. */
REG_WRITE(map->cntr, dev_priv->dspcntr[pipe]); REG_WRITE(map->cntr, dev_priv->dspcntr[pipe]);
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
mrst_crtc_mode_set_exit: mrst_crtc_mode_set_exit:
...@@ -1045,10 +1026,10 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, ...@@ -1045,10 +1026,10 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,
const struct drm_crtc_helper_funcs mdfld_helper_funcs = { const struct drm_crtc_helper_funcs mdfld_helper_funcs = {
.dpms = mdfld_crtc_dpms, .dpms = mdfld_crtc_dpms,
.mode_fixup = psb_intel_crtc_mode_fixup, .mode_fixup = gma_crtc_mode_fixup,
.mode_set = mdfld_crtc_mode_set, .mode_set = mdfld_crtc_mode_set,
.mode_set_base = mdfld__intel_pipe_set_base, .mode_set_base = mdfld__intel_pipe_set_base,
.prepare = psb_intel_crtc_prepare, .prepare = gma_crtc_prepare,
.commit = psb_intel_crtc_commit, .commit = gma_crtc_commit,
}; };
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "psb_drv.h" #include "psb_drv.h"
#include "psb_intel_drv.h" #include "psb_intel_drv.h"
#include "psb_intel_reg.h" #include "psb_intel_reg.h"
#include "psb_intel_display.h" #include "gma_display.h"
#include "power.h" #include "power.h"
struct psb_intel_range_t { struct psb_intel_range_t {
...@@ -88,8 +88,8 @@ static const struct oaktrail_limit_t *oaktrail_limit(struct drm_crtc *crtc) ...@@ -88,8 +88,8 @@ static const struct oaktrail_limit_t *oaktrail_limit(struct drm_crtc *crtc)
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
if (psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) if (gma_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)
|| psb_intel_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)) { || gma_pipe_has_type(crtc, INTEL_OUTPUT_MIPI)) {
switch (dev_priv->core_freq) { switch (dev_priv->core_freq) {
case 100: case 100:
limit = &oaktrail_limits[MRST_LIMIT_LVDS_100L]; limit = &oaktrail_limits[MRST_LIMIT_LVDS_100L];
...@@ -163,8 +163,8 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -163,8 +163,8 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
int pipe = psb_intel_crtc->pipe; int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe]; const struct psb_offset *map = &dev_priv->regmap[pipe];
u32 temp; u32 temp;
...@@ -212,7 +212,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -212,7 +212,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
REG_WRITE(map->base, REG_READ(map->base)); REG_WRITE(map->base, REG_READ(map->base));
} }
psb_intel_crtc_load_lut(crtc); gma_crtc_load_lut(crtc);
/* Give the overlay scaler a chance to enable /* Give the overlay scaler a chance to enable
if it's on this pipe */ if it's on this pipe */
...@@ -242,7 +242,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -242,7 +242,7 @@ static void oaktrail_crtc_dpms(struct drm_crtc *crtc, int mode)
REG_READ(map->conf); REG_READ(map->conf);
} }
/* Wait for for the pipe disable to take effect. */ /* Wait for for the pipe disable to take effect. */
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
temp = REG_READ(map->dpll); temp = REG_READ(map->dpll);
if ((temp & DPLL_VCO_ENABLE) != 0) { if ((temp & DPLL_VCO_ENABLE) != 0) {
...@@ -292,9 +292,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ...@@ -292,9 +292,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
struct drm_framebuffer *old_fb) struct drm_framebuffer *old_fb)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
int pipe = psb_intel_crtc->pipe; int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe]; const struct psb_offset *map = &dev_priv->regmap[pipe];
int refclk = 0; int refclk = 0;
struct oaktrail_clock_t clock; struct oaktrail_clock_t clock;
...@@ -303,7 +303,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ...@@ -303,7 +303,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
bool is_lvds = false; bool is_lvds = false;
bool is_mipi = false; bool is_mipi = false;
struct drm_mode_config *mode_config = &dev->mode_config; struct drm_mode_config *mode_config = &dev->mode_config;
struct psb_intel_encoder *psb_intel_encoder = NULL; struct gma_encoder *gma_encoder = NULL;
uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN; uint64_t scalingType = DRM_MODE_SCALE_FULLSCREEN;
struct drm_connector *connector; struct drm_connector *connector;
...@@ -313,10 +313,10 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ...@@ -313,10 +313,10 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
if (!gma_power_begin(dev, true)) if (!gma_power_begin(dev, true))
return 0; return 0;
memcpy(&psb_intel_crtc->saved_mode, memcpy(&gma_crtc->saved_mode,
mode, mode,
sizeof(struct drm_display_mode)); sizeof(struct drm_display_mode));
memcpy(&psb_intel_crtc->saved_adjusted_mode, memcpy(&gma_crtc->saved_adjusted_mode,
adjusted_mode, adjusted_mode,
sizeof(struct drm_display_mode)); sizeof(struct drm_display_mode));
...@@ -324,9 +324,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ...@@ -324,9 +324,9 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
if (!connector->encoder || connector->encoder->crtc != crtc) if (!connector->encoder || connector->encoder->crtc != crtc)
continue; continue;
psb_intel_encoder = psb_intel_attached_encoder(connector); gma_encoder = gma_attached_encoder(connector);
switch (psb_intel_encoder->type) { switch (gma_encoder->type) {
case INTEL_OUTPUT_LVDS: case INTEL_OUTPUT_LVDS:
is_lvds = true; is_lvds = true;
break; break;
...@@ -350,7 +350,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ...@@ -350,7 +350,7 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
((mode->crtc_hdisplay - 1) << 16) | ((mode->crtc_hdisplay - 1) << 16) |
(mode->crtc_vdisplay - 1)); (mode->crtc_vdisplay - 1));
if (psb_intel_encoder) if (gma_encoder)
drm_object_property_get_value(&connector->base, drm_object_property_get_value(&connector->base,
dev->mode_config.scaling_mode_property, &scalingType); dev->mode_config.scaling_mode_property, &scalingType);
...@@ -484,31 +484,24 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc, ...@@ -484,31 +484,24 @@ static int oaktrail_crtc_mode_set(struct drm_crtc *crtc,
REG_WRITE(map->conf, pipeconf); REG_WRITE(map->conf, pipeconf);
REG_READ(map->conf); REG_READ(map->conf);
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
REG_WRITE(map->cntr, dspcntr); REG_WRITE(map->cntr, dspcntr);
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
oaktrail_crtc_mode_set_exit: oaktrail_crtc_mode_set_exit:
gma_power_end(dev); gma_power_end(dev);
return 0; return 0;
} }
static bool oaktrail_crtc_mode_fixup(struct drm_crtc *crtc,
const struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
return true;
}
static int oaktrail_pipe_set_base(struct drm_crtc *crtc, static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
int x, int y, struct drm_framebuffer *old_fb) int x, int y, struct drm_framebuffer *old_fb)
{ {
struct drm_device *dev = crtc->dev; struct drm_device *dev = crtc->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb); struct psb_framebuffer *psbfb = to_psb_fb(crtc->fb);
int pipe = psb_intel_crtc->pipe; int pipe = gma_crtc->pipe;
const struct psb_offset *map = &dev_priv->regmap[pipe]; const struct psb_offset *map = &dev_priv->regmap[pipe];
unsigned long start, offset; unsigned long start, offset;
...@@ -563,24 +556,12 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc, ...@@ -563,24 +556,12 @@ static int oaktrail_pipe_set_base(struct drm_crtc *crtc,
return ret; return ret;
} }
static void oaktrail_crtc_prepare(struct drm_crtc *crtc)
{
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
}
static void oaktrail_crtc_commit(struct drm_crtc *crtc)
{
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
}
const struct drm_crtc_helper_funcs oaktrail_helper_funcs = { const struct drm_crtc_helper_funcs oaktrail_helper_funcs = {
.dpms = oaktrail_crtc_dpms, .dpms = oaktrail_crtc_dpms,
.mode_fixup = oaktrail_crtc_mode_fixup, .mode_fixup = gma_crtc_mode_fixup,
.mode_set = oaktrail_crtc_mode_set, .mode_set = oaktrail_crtc_mode_set,
.mode_set_base = oaktrail_pipe_set_base, .mode_set_base = oaktrail_pipe_set_base,
.prepare = oaktrail_crtc_prepare, .prepare = gma_crtc_prepare,
.commit = oaktrail_crtc_commit, .commit = gma_crtc_commit,
}; };
...@@ -155,12 +155,6 @@ static void oaktrail_hdmi_audio_disable(struct drm_device *dev) ...@@ -155,12 +155,6 @@ static void oaktrail_hdmi_audio_disable(struct drm_device *dev)
HDMI_READ(HDMI_HCR); HDMI_READ(HDMI_HCR);
} }
static void wait_for_vblank(struct drm_device *dev)
{
/* Wait for 20ms, i.e. one cycle at 50hz. */
mdelay(20);
}
static unsigned int htotal_calculate(struct drm_display_mode *mode) static unsigned int htotal_calculate(struct drm_display_mode *mode)
{ {
u32 htotal, new_crtc_htotal; u32 htotal, new_crtc_htotal;
...@@ -372,10 +366,10 @@ int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc, ...@@ -372,10 +366,10 @@ int oaktrail_crtc_hdmi_mode_set(struct drm_crtc *crtc,
REG_WRITE(PCH_PIPEBCONF, pipeconf); REG_WRITE(PCH_PIPEBCONF, pipeconf);
REG_READ(PCH_PIPEBCONF); REG_READ(PCH_PIPEBCONF);
wait_for_vblank(dev); gma_wait_for_vblank(dev);
REG_WRITE(dspcntr_reg, dspcntr); REG_WRITE(dspcntr_reg, dspcntr);
wait_for_vblank(dev); gma_wait_for_vblank(dev);
gma_power_end(dev); gma_power_end(dev);
...@@ -459,7 +453,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode) ...@@ -459,7 +453,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode)
REG_READ(PCH_PIPEBCONF); REG_READ(PCH_PIPEBCONF);
} }
wait_for_vblank(dev); gma_wait_for_vblank(dev);
/* Enable plane */ /* Enable plane */
temp = REG_READ(DSPBCNTR); temp = REG_READ(DSPBCNTR);
...@@ -470,7 +464,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode) ...@@ -470,7 +464,7 @@ void oaktrail_crtc_hdmi_dpms(struct drm_crtc *crtc, int mode)
REG_READ(DSPBSURF); REG_READ(DSPBSURF);
} }
psb_intel_crtc_load_lut(crtc); gma_crtc_load_lut(crtc);
} }
/* DSPARB */ /* DSPARB */
...@@ -615,16 +609,16 @@ static void oaktrail_hdmi_destroy(struct drm_connector *connector) ...@@ -615,16 +609,16 @@ static void oaktrail_hdmi_destroy(struct drm_connector *connector)
static const struct drm_encoder_helper_funcs oaktrail_hdmi_helper_funcs = { static const struct drm_encoder_helper_funcs oaktrail_hdmi_helper_funcs = {
.dpms = oaktrail_hdmi_dpms, .dpms = oaktrail_hdmi_dpms,
.mode_fixup = oaktrail_hdmi_mode_fixup, .mode_fixup = oaktrail_hdmi_mode_fixup,
.prepare = psb_intel_encoder_prepare, .prepare = gma_encoder_prepare,
.mode_set = oaktrail_hdmi_mode_set, .mode_set = oaktrail_hdmi_mode_set,
.commit = psb_intel_encoder_commit, .commit = gma_encoder_commit,
}; };
static const struct drm_connector_helper_funcs static const struct drm_connector_helper_funcs
oaktrail_hdmi_connector_helper_funcs = { oaktrail_hdmi_connector_helper_funcs = {
.get_modes = oaktrail_hdmi_get_modes, .get_modes = oaktrail_hdmi_get_modes,
.mode_valid = oaktrail_hdmi_mode_valid, .mode_valid = oaktrail_hdmi_mode_valid,
.best_encoder = psb_intel_best_encoder, .best_encoder = gma_best_encoder,
}; };
static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = { static const struct drm_connector_funcs oaktrail_hdmi_connector_funcs = {
...@@ -646,21 +640,21 @@ static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = { ...@@ -646,21 +640,21 @@ static const struct drm_encoder_funcs oaktrail_hdmi_enc_funcs = {
void oaktrail_hdmi_init(struct drm_device *dev, void oaktrail_hdmi_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev) struct psb_intel_mode_device *mode_dev)
{ {
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct psb_intel_connector *psb_intel_connector; struct gma_connector *gma_connector;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL); gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
if (!psb_intel_encoder) if (!gma_encoder)
return; return;
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL); gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
if (!psb_intel_connector) if (!gma_connector)
goto failed_connector; goto failed_connector;
connector = &psb_intel_connector->base; connector = &gma_connector->base;
encoder = &psb_intel_encoder->base; encoder = &gma_encoder->base;
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
&oaktrail_hdmi_connector_funcs, &oaktrail_hdmi_connector_funcs,
DRM_MODE_CONNECTOR_DVID); DRM_MODE_CONNECTOR_DVID);
...@@ -669,10 +663,9 @@ void oaktrail_hdmi_init(struct drm_device *dev, ...@@ -669,10 +663,9 @@ void oaktrail_hdmi_init(struct drm_device *dev,
&oaktrail_hdmi_enc_funcs, &oaktrail_hdmi_enc_funcs,
DRM_MODE_ENCODER_TMDS); DRM_MODE_ENCODER_TMDS);
psb_intel_connector_attach_encoder(psb_intel_connector, gma_connector_attach_encoder(gma_connector, gma_encoder);
psb_intel_encoder);
psb_intel_encoder->type = INTEL_OUTPUT_HDMI; gma_encoder->type = INTEL_OUTPUT_HDMI;
drm_encoder_helper_add(encoder, &oaktrail_hdmi_helper_funcs); drm_encoder_helper_add(encoder, &oaktrail_hdmi_helper_funcs);
drm_connector_helper_add(connector, &oaktrail_hdmi_connector_helper_funcs); drm_connector_helper_add(connector, &oaktrail_hdmi_connector_helper_funcs);
...@@ -685,7 +678,7 @@ void oaktrail_hdmi_init(struct drm_device *dev, ...@@ -685,7 +678,7 @@ void oaktrail_hdmi_init(struct drm_device *dev,
return; return;
failed_connector: failed_connector:
kfree(psb_intel_encoder); kfree(gma_encoder);
} }
static DEFINE_PCI_DEVICE_TABLE(hdmi_ids) = { static DEFINE_PCI_DEVICE_TABLE(hdmi_ids) = {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* Sets the power state for the panel. * Sets the power state for the panel.
*/ */
static void oaktrail_lvds_set_power(struct drm_device *dev, static void oaktrail_lvds_set_power(struct drm_device *dev,
struct psb_intel_encoder *psb_intel_encoder, struct gma_encoder *gma_encoder,
bool on) bool on)
{ {
u32 pp_status; u32 pp_status;
...@@ -78,13 +78,12 @@ static void oaktrail_lvds_set_power(struct drm_device *dev, ...@@ -78,13 +78,12 @@ static void oaktrail_lvds_set_power(struct drm_device *dev,
static void oaktrail_lvds_dpms(struct drm_encoder *encoder, int mode) static void oaktrail_lvds_dpms(struct drm_encoder *encoder, int mode)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
to_psb_intel_encoder(encoder);
if (mode == DRM_MODE_DPMS_ON) if (mode == DRM_MODE_DPMS_ON)
oaktrail_lvds_set_power(dev, psb_intel_encoder, true); oaktrail_lvds_set_power(dev, gma_encoder, true);
else else
oaktrail_lvds_set_power(dev, psb_intel_encoder, false); oaktrail_lvds_set_power(dev, gma_encoder, false);
/* XXX: We never power down the LVDS pairs. */ /* XXX: We never power down the LVDS pairs. */
} }
...@@ -166,8 +165,7 @@ static void oaktrail_lvds_prepare(struct drm_encoder *encoder) ...@@ -166,8 +165,7 @@ static void oaktrail_lvds_prepare(struct drm_encoder *encoder)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
to_psb_intel_encoder(encoder);
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
if (!gma_power_begin(dev, true)) if (!gma_power_begin(dev, true))
...@@ -176,7 +174,7 @@ static void oaktrail_lvds_prepare(struct drm_encoder *encoder) ...@@ -176,7 +174,7 @@ static void oaktrail_lvds_prepare(struct drm_encoder *encoder)
mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL); mode_dev->saveBLC_PWM_CTL = REG_READ(BLC_PWM_CTL);
mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL & mode_dev->backlight_duty_cycle = (mode_dev->saveBLC_PWM_CTL &
BACKLIGHT_DUTY_CYCLE_MASK); BACKLIGHT_DUTY_CYCLE_MASK);
oaktrail_lvds_set_power(dev, psb_intel_encoder, false); oaktrail_lvds_set_power(dev, gma_encoder, false);
gma_power_end(dev); gma_power_end(dev);
} }
...@@ -203,14 +201,13 @@ static void oaktrail_lvds_commit(struct drm_encoder *encoder) ...@@ -203,14 +201,13 @@ static void oaktrail_lvds_commit(struct drm_encoder *encoder)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
to_psb_intel_encoder(encoder);
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
if (mode_dev->backlight_duty_cycle == 0) if (mode_dev->backlight_duty_cycle == 0)
mode_dev->backlight_duty_cycle = mode_dev->backlight_duty_cycle =
oaktrail_lvds_get_max_backlight(dev); oaktrail_lvds_get_max_backlight(dev);
oaktrail_lvds_set_power(dev, psb_intel_encoder, true); oaktrail_lvds_set_power(dev, gma_encoder, true);
} }
static const struct drm_encoder_helper_funcs oaktrail_lvds_helper_funcs = { static const struct drm_encoder_helper_funcs oaktrail_lvds_helper_funcs = {
...@@ -325,8 +322,8 @@ static void oaktrail_lvds_get_configuration_mode(struct drm_device *dev, ...@@ -325,8 +322,8 @@ static void oaktrail_lvds_get_configuration_mode(struct drm_device *dev,
void oaktrail_lvds_init(struct drm_device *dev, void oaktrail_lvds_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev) struct psb_intel_mode_device *mode_dev)
{ {
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct psb_intel_connector *psb_intel_connector; struct gma_connector *gma_connector;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
...@@ -334,16 +331,16 @@ void oaktrail_lvds_init(struct drm_device *dev, ...@@ -334,16 +331,16 @@ void oaktrail_lvds_init(struct drm_device *dev,
struct i2c_adapter *i2c_adap; struct i2c_adapter *i2c_adap;
struct drm_display_mode *scan; /* *modes, *bios_mode; */ struct drm_display_mode *scan; /* *modes, *bios_mode; */
psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL); gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
if (!psb_intel_encoder) if (!gma_encoder)
return; return;
psb_intel_connector = kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL); gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
if (!psb_intel_connector) if (!gma_connector)
goto failed_connector; goto failed_connector;
connector = &psb_intel_connector->base; connector = &gma_connector->base;
encoder = &psb_intel_encoder->base; encoder = &gma_encoder->base;
dev_priv->is_lvds_on = true; dev_priv->is_lvds_on = true;
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
&psb_intel_lvds_connector_funcs, &psb_intel_lvds_connector_funcs,
...@@ -352,9 +349,8 @@ void oaktrail_lvds_init(struct drm_device *dev, ...@@ -352,9 +349,8 @@ void oaktrail_lvds_init(struct drm_device *dev,
drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs, drm_encoder_init(dev, encoder, &psb_intel_lvds_enc_funcs,
DRM_MODE_ENCODER_LVDS); DRM_MODE_ENCODER_LVDS);
psb_intel_connector_attach_encoder(psb_intel_connector, gma_connector_attach_encoder(gma_connector, gma_encoder);
psb_intel_encoder); gma_encoder->type = INTEL_OUTPUT_LVDS;
psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
drm_encoder_helper_add(encoder, &oaktrail_lvds_helper_funcs); drm_encoder_helper_add(encoder, &oaktrail_lvds_helper_funcs);
drm_connector_helper_add(connector, drm_connector_helper_add(connector,
...@@ -434,15 +430,15 @@ void oaktrail_lvds_init(struct drm_device *dev, ...@@ -434,15 +430,15 @@ void oaktrail_lvds_init(struct drm_device *dev,
failed_find: failed_find:
dev_dbg(dev->dev, "No LVDS modes found, disabling.\n"); dev_dbg(dev->dev, "No LVDS modes found, disabling.\n");
if (psb_intel_encoder->ddc_bus) if (gma_encoder->ddc_bus)
psb_intel_i2c_destroy(psb_intel_encoder->ddc_bus); psb_intel_i2c_destroy(gma_encoder->ddc_bus);
/* failed_ddc: */ /* failed_ddc: */
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(psb_intel_connector); kfree(gma_connector);
failed_connector: failed_connector:
kfree(psb_intel_encoder); kfree(gma_encoder);
} }
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "psb_reg.h" #include "psb_reg.h"
#include "psb_intel_reg.h" #include "psb_intel_reg.h"
#include "intel_bios.h" #include "intel_bios.h"
#include "psb_device.h"
static int psb_output_init(struct drm_device *dev) static int psb_output_init(struct drm_device *dev)
{ {
...@@ -380,6 +380,7 @@ const struct psb_ops psb_chip_ops = { ...@@ -380,6 +380,7 @@ const struct psb_ops psb_chip_ops = {
.crtc_helper = &psb_intel_helper_funcs, .crtc_helper = &psb_intel_helper_funcs,
.crtc_funcs = &psb_intel_crtc_funcs, .crtc_funcs = &psb_intel_crtc_funcs,
.clock_funcs = &psb_clock_funcs,
.output_init = psb_output_init, .output_init = psb_output_init,
......
/* copyright (c) 2008, Intel Corporation /*
* Copyright © 2013 Patrik Jakobsson
* Copyright © 2011 Intel Corporation
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
...@@ -12,14 +14,11 @@ ...@@ -12,14 +14,11 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., * this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*
* Authors:
* Eric Anholt <eric@anholt.net>
*/ */
#ifndef _INTEL_DISPLAY_H_ #ifndef _PSB_DEVICE_H_
#define _INTEL_DISPLAY_H_ #define _PSB_DEVICE_H_
bool psb_intel_pipe_has_type(struct drm_crtc *crtc, int type); extern const struct gma_clock_funcs psb_clock_funcs;
#endif #endif
...@@ -270,7 +270,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -270,7 +270,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
unsigned long irqflags; unsigned long irqflags;
int ret = -ENOMEM; int ret = -ENOMEM;
struct drm_connector *connector; struct drm_connector *connector;
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL);
if (dev_priv == NULL) if (dev_priv == NULL)
...@@ -372,9 +372,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -372,9 +372,9 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset)
/* Only add backlight support if we have LVDS output */ /* Only add backlight support if we have LVDS output */
list_for_each_entry(connector, &dev->mode_config.connector_list, list_for_each_entry(connector, &dev->mode_config.connector_list,
head) { head) {
psb_intel_encoder = psb_intel_attached_encoder(connector); gma_encoder = gma_attached_encoder(connector);
switch (psb_intel_encoder->type) { switch (gma_encoder->type) {
case INTEL_OUTPUT_LVDS: case INTEL_OUTPUT_LVDS:
case INTEL_OUTPUT_MIPI: case INTEL_OUTPUT_MIPI:
ret = gma_backlight_init(dev); ret = gma_backlight_init(dev);
...@@ -441,7 +441,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data, ...@@ -441,7 +441,7 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
struct drm_mode_object *obj; struct drm_mode_object *obj;
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_connector *connector; struct drm_connector *connector;
struct psb_intel_crtc *psb_intel_crtc; struct gma_crtc *gma_crtc;
int i = 0; int i = 0;
int32_t obj_id; int32_t obj_id;
...@@ -454,12 +454,12 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data, ...@@ -454,12 +454,12 @@ static int psb_gamma_ioctl(struct drm_device *dev, void *data,
connector = obj_to_connector(obj); connector = obj_to_connector(obj);
crtc = connector->encoder->crtc; crtc = connector->encoder->crtc;
psb_intel_crtc = to_psb_intel_crtc(crtc); gma_crtc = to_gma_crtc(crtc);
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
psb_intel_crtc->lut_adj[i] = lut_arg->lut[i]; gma_crtc->lut_adj[i] = lut_arg->lut[i];
psb_intel_crtc_load_lut(crtc); gma_crtc_load_lut(crtc);
return 0; return 0;
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <drm/gma_drm.h> #include <drm/gma_drm.h>
#include "psb_reg.h" #include "psb_reg.h"
#include "psb_intel_drv.h" #include "psb_intel_drv.h"
#include "gma_display.h"
#include "intel_bios.h" #include "intel_bios.h"
#include "gtt.h" #include "gtt.h"
#include "power.h" #include "power.h"
...@@ -46,6 +47,7 @@ enum { ...@@ -46,6 +47,7 @@ enum {
#define IS_PSB(dev) (((dev)->pci_device & 0xfffe) == 0x8108) #define IS_PSB(dev) (((dev)->pci_device & 0xfffe) == 0x8108)
#define IS_MRST(dev) (((dev)->pci_device & 0xfffc) == 0x4100) #define IS_MRST(dev) (((dev)->pci_device & 0xfffc) == 0x4100)
#define IS_MFLD(dev) (((dev)->pci_device & 0xfff8) == 0x0130) #define IS_MFLD(dev) (((dev)->pci_device & 0xfff8) == 0x0130)
#define IS_CDV(dev) (((dev)->pci_device & 0xfff0) == 0x0be0)
/* /*
* Driver definitions * Driver definitions
...@@ -675,6 +677,7 @@ struct psb_ops { ...@@ -675,6 +677,7 @@ struct psb_ops {
/* Sub functions */ /* Sub functions */
struct drm_crtc_helper_funcs const *crtc_helper; struct drm_crtc_helper_funcs const *crtc_helper;
struct drm_crtc_funcs const *crtc_funcs; struct drm_crtc_funcs const *crtc_funcs;
const struct gma_clock_funcs *clock_funcs;
/* Setup hooks */ /* Setup hooks */
int (*chip_setup)(struct drm_device *dev); int (*chip_setup)(struct drm_device *dev);
...@@ -692,6 +695,8 @@ struct psb_ops { ...@@ -692,6 +695,8 @@ struct psb_ops {
int (*restore_regs)(struct drm_device *dev); int (*restore_regs)(struct drm_device *dev);
int (*power_up)(struct drm_device *dev); int (*power_up)(struct drm_device *dev);
int (*power_down)(struct drm_device *dev); int (*power_down)(struct drm_device *dev);
void (*update_wm)(struct drm_device *dev, struct drm_crtc *crtc);
void (*disable_sr)(struct drm_device *dev);
void (*lvds_bl_power)(struct drm_device *dev, bool on); void (*lvds_bl_power)(struct drm_device *dev, bool on);
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
......
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <drm/drm_crtc.h> #include <drm/drm_crtc.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include "gma_display.h"
/* /*
* Display related stuff * Display related stuff
...@@ -116,11 +117,11 @@ struct psb_intel_i2c_chan { ...@@ -116,11 +117,11 @@ struct psb_intel_i2c_chan {
u8 slave_addr; u8 slave_addr;
}; };
struct psb_intel_encoder { struct gma_encoder {
struct drm_encoder base; struct drm_encoder base;
int type; int type;
bool needs_tv_clock; bool needs_tv_clock;
void (*hot_plug)(struct psb_intel_encoder *); void (*hot_plug)(struct gma_encoder *);
int crtc_mask; int crtc_mask;
int clone_mask; int clone_mask;
u32 ddi_select; /* Channel info */ u32 ddi_select; /* Channel info */
...@@ -136,9 +137,9 @@ struct psb_intel_encoder { ...@@ -136,9 +137,9 @@ struct psb_intel_encoder {
struct psb_intel_i2c_chan *ddc_bus; struct psb_intel_i2c_chan *ddc_bus;
}; };
struct psb_intel_connector { struct gma_connector {
struct drm_connector base; struct drm_connector base;
struct psb_intel_encoder *encoder; struct gma_encoder *encoder;
}; };
struct psb_intel_crtc_state { struct psb_intel_crtc_state {
...@@ -161,7 +162,7 @@ struct psb_intel_crtc_state { ...@@ -161,7 +162,7 @@ struct psb_intel_crtc_state {
uint32_t savePalette[256]; uint32_t savePalette[256];
}; };
struct psb_intel_crtc { struct gma_crtc {
struct drm_crtc base; struct drm_crtc base;
int pipe; int pipe;
int plane; int plane;
...@@ -188,14 +189,16 @@ struct psb_intel_crtc { ...@@ -188,14 +189,16 @@ struct psb_intel_crtc {
/* Saved Crtc HW states */ /* Saved Crtc HW states */
struct psb_intel_crtc_state *crtc_state; struct psb_intel_crtc_state *crtc_state;
const struct gma_clock_funcs *clock_funcs;
}; };
#define to_psb_intel_crtc(x) \ #define to_gma_crtc(x) \
container_of(x, struct psb_intel_crtc, base) container_of(x, struct gma_crtc, base)
#define to_psb_intel_connector(x) \ #define to_gma_connector(x) \
container_of(x, struct psb_intel_connector, base) container_of(x, struct gma_connector, base)
#define to_psb_intel_encoder(x) \ #define to_gma_encoder(x) \
container_of(x, struct psb_intel_encoder, base) container_of(x, struct gma_encoder, base)
#define to_psb_intel_framebuffer(x) \ #define to_psb_intel_framebuffer(x) \
container_of(x, struct psb_intel_framebuffer, base) container_of(x, struct psb_intel_framebuffer, base)
...@@ -223,27 +226,18 @@ extern void oaktrail_dsi_init(struct drm_device *dev, ...@@ -223,27 +226,18 @@ extern void oaktrail_dsi_init(struct drm_device *dev,
extern void mid_dsi_init(struct drm_device *dev, extern void mid_dsi_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev, int dsi_num); struct psb_intel_mode_device *mode_dev, int dsi_num);
extern void psb_intel_crtc_load_lut(struct drm_crtc *crtc); extern struct drm_encoder *gma_best_encoder(struct drm_connector *connector);
extern void psb_intel_encoder_prepare(struct drm_encoder *encoder); extern void gma_connector_attach_encoder(struct gma_connector *connector,
extern void psb_intel_encoder_commit(struct drm_encoder *encoder); struct gma_encoder *encoder);
extern void psb_intel_encoder_destroy(struct drm_encoder *encoder);
static inline struct psb_intel_encoder *psb_intel_attached_encoder( static inline struct gma_encoder *gma_attached_encoder(
struct drm_connector *connector) struct drm_connector *connector)
{ {
return to_psb_intel_connector(connector)->encoder; return to_gma_connector(connector)->encoder;
} }
extern void psb_intel_connector_attach_encoder(
struct psb_intel_connector *connector,
struct psb_intel_encoder *encoder);
extern struct drm_encoder *psb_intel_best_encoder(struct drm_connector
*connector);
extern struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev, extern struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev,
struct drm_crtc *crtc); struct drm_crtc *crtc);
extern void psb_intel_wait_for_vblank(struct drm_device *dev);
extern int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, extern int psb_intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern struct drm_crtc *psb_intel_get_crtc_from_pipe(struct drm_device *dev, extern struct drm_crtc *psb_intel_get_crtc_from_pipe(struct drm_device *dev,
......
...@@ -267,10 +267,9 @@ static void psb_intel_lvds_save(struct drm_connector *connector) ...@@ -267,10 +267,9 @@ static void psb_intel_lvds_save(struct drm_connector *connector)
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_psb_private *dev_priv = struct drm_psb_private *dev_priv =
(struct drm_psb_private *)dev->dev_private; (struct drm_psb_private *)dev->dev_private;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
struct psb_intel_lvds_priv *lvds_priv = struct psb_intel_lvds_priv *lvds_priv =
(struct psb_intel_lvds_priv *)psb_intel_encoder->dev_priv; (struct psb_intel_lvds_priv *)gma_encoder->dev_priv;
lvds_priv->savePP_ON = REG_READ(LVDSPP_ON); lvds_priv->savePP_ON = REG_READ(LVDSPP_ON);
lvds_priv->savePP_OFF = REG_READ(LVDSPP_OFF); lvds_priv->savePP_OFF = REG_READ(LVDSPP_OFF);
...@@ -307,10 +306,9 @@ static void psb_intel_lvds_restore(struct drm_connector *connector) ...@@ -307,10 +306,9 @@ static void psb_intel_lvds_restore(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
u32 pp_status; u32 pp_status;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
struct psb_intel_lvds_priv *lvds_priv = struct psb_intel_lvds_priv *lvds_priv =
(struct psb_intel_lvds_priv *)psb_intel_encoder->dev_priv; (struct psb_intel_lvds_priv *)gma_encoder->dev_priv;
dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", dev_dbg(dev->dev, "(0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n",
lvds_priv->savePP_ON, lvds_priv->savePP_ON,
...@@ -349,12 +347,11 @@ int psb_intel_lvds_mode_valid(struct drm_connector *connector, ...@@ -349,12 +347,11 @@ int psb_intel_lvds_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct drm_psb_private *dev_priv = connector->dev->dev_private; struct drm_psb_private *dev_priv = connector->dev->dev_private;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector);
struct drm_display_mode *fixed_mode = struct drm_display_mode *fixed_mode =
dev_priv->mode_dev.panel_fixed_mode; dev_priv->mode_dev.panel_fixed_mode;
if (psb_intel_encoder->type == INTEL_OUTPUT_MIPI2) if (gma_encoder->type == INTEL_OUTPUT_MIPI2)
fixed_mode = dev_priv->mode_dev.panel_fixed_mode2; fixed_mode = dev_priv->mode_dev.panel_fixed_mode2;
/* just in case */ /* just in case */
...@@ -381,22 +378,20 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder, ...@@ -381,22 +378,20 @@ bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
struct psb_intel_crtc *psb_intel_crtc = struct gma_crtc *gma_crtc = to_gma_crtc(encoder->crtc);
to_psb_intel_crtc(encoder->crtc);
struct drm_encoder *tmp_encoder; struct drm_encoder *tmp_encoder;
struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode; struct drm_display_mode *panel_fixed_mode = mode_dev->panel_fixed_mode;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = to_gma_encoder(encoder);
to_psb_intel_encoder(encoder);
if (psb_intel_encoder->type == INTEL_OUTPUT_MIPI2) if (gma_encoder->type == INTEL_OUTPUT_MIPI2)
panel_fixed_mode = mode_dev->panel_fixed_mode2; panel_fixed_mode = mode_dev->panel_fixed_mode2;
/* PSB requires the LVDS is on pipe B, MRST has only one pipe anyway */ /* PSB requires the LVDS is on pipe B, MRST has only one pipe anyway */
if (!IS_MRST(dev) && psb_intel_crtc->pipe == 0) { if (!IS_MRST(dev) && gma_crtc->pipe == 0) {
printk(KERN_ERR "Can't support LVDS on pipe A\n"); printk(KERN_ERR "Can't support LVDS on pipe A\n");
return false; return false;
} }
if (IS_MRST(dev) && psb_intel_crtc->pipe != 0) { if (IS_MRST(dev) && gma_crtc->pipe != 0) {
printk(KERN_ERR "Must use PIPE A\n"); printk(KERN_ERR "Must use PIPE A\n");
return false; return false;
} }
...@@ -525,9 +520,8 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector) ...@@ -525,9 +520,8 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector)
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev; struct psb_intel_mode_device *mode_dev = &dev_priv->mode_dev;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
struct psb_intel_lvds_priv *lvds_priv = psb_intel_encoder->dev_priv;
int ret = 0; int ret = 0;
if (!IS_MRST(dev)) if (!IS_MRST(dev))
...@@ -564,9 +558,8 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector) ...@@ -564,9 +558,8 @@ static int psb_intel_lvds_get_modes(struct drm_connector *connector)
*/ */
void psb_intel_lvds_destroy(struct drm_connector *connector) void psb_intel_lvds_destroy(struct drm_connector *connector)
{ {
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct psb_intel_lvds_priv *lvds_priv = gma_encoder->dev_priv;
struct psb_intel_lvds_priv *lvds_priv = psb_intel_encoder->dev_priv;
if (lvds_priv->ddc_bus) if (lvds_priv->ddc_bus)
psb_intel_i2c_destroy(lvds_priv->ddc_bus); psb_intel_i2c_destroy(lvds_priv->ddc_bus);
...@@ -585,8 +578,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector, ...@@ -585,8 +578,7 @@ int psb_intel_lvds_set_property(struct drm_connector *connector,
return -1; return -1;
if (!strcmp(property->name, "scaling mode")) { if (!strcmp(property->name, "scaling mode")) {
struct psb_intel_crtc *crtc = struct gma_crtc *crtc = to_gma_crtc(encoder->crtc);
to_psb_intel_crtc(encoder->crtc);
uint64_t curval; uint64_t curval;
if (!crtc) if (!crtc)
...@@ -656,7 +648,7 @@ const struct drm_connector_helper_funcs ...@@ -656,7 +648,7 @@ const struct drm_connector_helper_funcs
psb_intel_lvds_connector_helper_funcs = { psb_intel_lvds_connector_helper_funcs = {
.get_modes = psb_intel_lvds_get_modes, .get_modes = psb_intel_lvds_get_modes,
.mode_valid = psb_intel_lvds_mode_valid, .mode_valid = psb_intel_lvds_mode_valid,
.best_encoder = psb_intel_best_encoder, .best_encoder = gma_best_encoder,
}; };
const struct drm_connector_funcs psb_intel_lvds_connector_funcs = { const struct drm_connector_funcs psb_intel_lvds_connector_funcs = {
...@@ -691,8 +683,8 @@ const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = { ...@@ -691,8 +683,8 @@ const struct drm_encoder_funcs psb_intel_lvds_enc_funcs = {
void psb_intel_lvds_init(struct drm_device *dev, void psb_intel_lvds_init(struct drm_device *dev,
struct psb_intel_mode_device *mode_dev) struct psb_intel_mode_device *mode_dev)
{ {
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct psb_intel_connector *psb_intel_connector; struct gma_connector *gma_connector;
struct psb_intel_lvds_priv *lvds_priv; struct psb_intel_lvds_priv *lvds_priv;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
...@@ -702,17 +694,15 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -702,17 +694,15 @@ void psb_intel_lvds_init(struct drm_device *dev,
u32 lvds; u32 lvds;
int pipe; int pipe;
psb_intel_encoder = gma_encoder = kzalloc(sizeof(struct gma_encoder), GFP_KERNEL);
kzalloc(sizeof(struct psb_intel_encoder), GFP_KERNEL); if (!gma_encoder) {
if (!psb_intel_encoder) { dev_err(dev->dev, "gma_encoder allocation error\n");
dev_err(dev->dev, "psb_intel_encoder allocation error\n");
return; return;
} }
psb_intel_connector = gma_connector = kzalloc(sizeof(struct gma_connector), GFP_KERNEL);
kzalloc(sizeof(struct psb_intel_connector), GFP_KERNEL); if (!gma_connector) {
if (!psb_intel_connector) { dev_err(dev->dev, "gma_connector allocation error\n");
dev_err(dev->dev, "psb_intel_connector allocation error\n");
goto failed_encoder; goto failed_encoder;
} }
...@@ -722,10 +712,10 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -722,10 +712,10 @@ void psb_intel_lvds_init(struct drm_device *dev,
goto failed_connector; goto failed_connector;
} }
psb_intel_encoder->dev_priv = lvds_priv; gma_encoder->dev_priv = lvds_priv;
connector = &psb_intel_connector->base; connector = &gma_connector->base;
encoder = &psb_intel_encoder->base; encoder = &gma_encoder->base;
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
&psb_intel_lvds_connector_funcs, &psb_intel_lvds_connector_funcs,
DRM_MODE_CONNECTOR_LVDS); DRM_MODE_CONNECTOR_LVDS);
...@@ -734,9 +724,8 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -734,9 +724,8 @@ void psb_intel_lvds_init(struct drm_device *dev,
&psb_intel_lvds_enc_funcs, &psb_intel_lvds_enc_funcs,
DRM_MODE_ENCODER_LVDS); DRM_MODE_ENCODER_LVDS);
psb_intel_connector_attach_encoder(psb_intel_connector, gma_connector_attach_encoder(gma_connector, gma_encoder);
psb_intel_encoder); gma_encoder->type = INTEL_OUTPUT_LVDS;
psb_intel_encoder->type = INTEL_OUTPUT_LVDS;
drm_encoder_helper_add(encoder, &psb_intel_lvds_helper_funcs); drm_encoder_helper_add(encoder, &psb_intel_lvds_helper_funcs);
drm_connector_helper_add(connector, drm_connector_helper_add(connector,
...@@ -851,8 +840,8 @@ void psb_intel_lvds_init(struct drm_device *dev, ...@@ -851,8 +840,8 @@ void psb_intel_lvds_init(struct drm_device *dev,
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
failed_connector: failed_connector:
kfree(psb_intel_connector); kfree(gma_connector);
failed_encoder: failed_encoder:
kfree(psb_intel_encoder); kfree(gma_encoder);
} }
...@@ -65,7 +65,7 @@ static const char *tv_format_names[] = { ...@@ -65,7 +65,7 @@ static const char *tv_format_names[] = {
#define TV_FORMAT_NUM (sizeof(tv_format_names) / sizeof(*tv_format_names)) #define TV_FORMAT_NUM (sizeof(tv_format_names) / sizeof(*tv_format_names))
struct psb_intel_sdvo { struct psb_intel_sdvo {
struct psb_intel_encoder base; struct gma_encoder base;
struct i2c_adapter *i2c; struct i2c_adapter *i2c;
u8 slave_addr; u8 slave_addr;
...@@ -140,7 +140,7 @@ struct psb_intel_sdvo { ...@@ -140,7 +140,7 @@ struct psb_intel_sdvo {
}; };
struct psb_intel_sdvo_connector { struct psb_intel_sdvo_connector {
struct psb_intel_connector base; struct gma_connector base;
/* Mark the type of connector */ /* Mark the type of connector */
uint16_t output_flag; uint16_t output_flag;
...@@ -200,13 +200,13 @@ static struct psb_intel_sdvo *to_psb_intel_sdvo(struct drm_encoder *encoder) ...@@ -200,13 +200,13 @@ static struct psb_intel_sdvo *to_psb_intel_sdvo(struct drm_encoder *encoder)
static struct psb_intel_sdvo *intel_attached_sdvo(struct drm_connector *connector) static struct psb_intel_sdvo *intel_attached_sdvo(struct drm_connector *connector)
{ {
return container_of(psb_intel_attached_encoder(connector), return container_of(gma_attached_encoder(connector),
struct psb_intel_sdvo, base); struct psb_intel_sdvo, base);
} }
static struct psb_intel_sdvo_connector *to_psb_intel_sdvo_connector(struct drm_connector *connector) static struct psb_intel_sdvo_connector *to_psb_intel_sdvo_connector(struct drm_connector *connector)
{ {
return container_of(to_psb_intel_connector(connector), struct psb_intel_sdvo_connector, base); return container_of(to_gma_connector(connector), struct psb_intel_sdvo_connector, base);
} }
static bool static bool
...@@ -987,7 +987,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder, ...@@ -987,7 +987,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct psb_intel_crtc *psb_intel_crtc = to_psb_intel_crtc(crtc); struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
struct psb_intel_sdvo *psb_intel_sdvo = to_psb_intel_sdvo(encoder); struct psb_intel_sdvo *psb_intel_sdvo = to_psb_intel_sdvo(encoder);
u32 sdvox; u32 sdvox;
struct psb_intel_sdvo_in_out_map in_out; struct psb_intel_sdvo_in_out_map in_out;
...@@ -1070,7 +1070,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder, ...@@ -1070,7 +1070,7 @@ static void psb_intel_sdvo_mode_set(struct drm_encoder *encoder,
} }
sdvox |= (9 << 19) | SDVO_BORDER_ENABLE; sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
if (psb_intel_crtc->pipe == 1) if (gma_crtc->pipe == 1)
sdvox |= SDVO_PIPE_B_SELECT; sdvox |= SDVO_PIPE_B_SELECT;
if (psb_intel_sdvo->has_hdmi_audio) if (psb_intel_sdvo->has_hdmi_audio)
sdvox |= SDVO_AUDIO_ENABLE; sdvox |= SDVO_AUDIO_ENABLE;
...@@ -1121,7 +1121,7 @@ static void psb_intel_sdvo_dpms(struct drm_encoder *encoder, int mode) ...@@ -1121,7 +1121,7 @@ static void psb_intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
if ((temp & SDVO_ENABLE) == 0) if ((temp & SDVO_ENABLE) == 0)
psb_intel_sdvo_write_sdvox(psb_intel_sdvo, temp | SDVO_ENABLE); psb_intel_sdvo_write_sdvox(psb_intel_sdvo, temp | SDVO_ENABLE);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
psb_intel_wait_for_vblank(dev); gma_wait_for_vblank(dev);
status = psb_intel_sdvo_get_trained_inputs(psb_intel_sdvo, &input1, &input2); status = psb_intel_sdvo_get_trained_inputs(psb_intel_sdvo, &input1, &input2);
/* Warn if the device reported failure to sync. /* Warn if the device reported failure to sync.
...@@ -1836,10 +1836,8 @@ psb_intel_sdvo_set_property(struct drm_connector *connector, ...@@ -1836,10 +1836,8 @@ psb_intel_sdvo_set_property(struct drm_connector *connector,
static void psb_intel_sdvo_save(struct drm_connector *connector) static void psb_intel_sdvo_save(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct psb_intel_encoder *psb_intel_encoder = struct gma_encoder *gma_encoder = gma_attached_encoder(connector);
psb_intel_attached_encoder(connector); struct psb_intel_sdvo *sdvo = to_psb_intel_sdvo(&gma_encoder->base);
struct psb_intel_sdvo *sdvo =
to_psb_intel_sdvo(&psb_intel_encoder->base);
sdvo->saveSDVO = REG_READ(sdvo->sdvo_reg); sdvo->saveSDVO = REG_READ(sdvo->sdvo_reg);
} }
...@@ -1847,8 +1845,7 @@ static void psb_intel_sdvo_save(struct drm_connector *connector) ...@@ -1847,8 +1845,7 @@ static void psb_intel_sdvo_save(struct drm_connector *connector)
static void psb_intel_sdvo_restore(struct drm_connector *connector) static void psb_intel_sdvo_restore(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_encoder *encoder = struct drm_encoder *encoder = &gma_attached_encoder(connector)->base;
&psb_intel_attached_encoder(connector)->base;
struct psb_intel_sdvo *sdvo = to_psb_intel_sdvo(encoder); struct psb_intel_sdvo *sdvo = to_psb_intel_sdvo(encoder);
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
...@@ -1864,9 +1861,9 @@ static void psb_intel_sdvo_restore(struct drm_connector *connector) ...@@ -1864,9 +1861,9 @@ static void psb_intel_sdvo_restore(struct drm_connector *connector)
static const struct drm_encoder_helper_funcs psb_intel_sdvo_helper_funcs = { static const struct drm_encoder_helper_funcs psb_intel_sdvo_helper_funcs = {
.dpms = psb_intel_sdvo_dpms, .dpms = psb_intel_sdvo_dpms,
.mode_fixup = psb_intel_sdvo_mode_fixup, .mode_fixup = psb_intel_sdvo_mode_fixup,
.prepare = psb_intel_encoder_prepare, .prepare = gma_encoder_prepare,
.mode_set = psb_intel_sdvo_mode_set, .mode_set = psb_intel_sdvo_mode_set,
.commit = psb_intel_encoder_commit, .commit = gma_encoder_commit,
}; };
static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = { static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = {
...@@ -1882,7 +1879,7 @@ static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = { ...@@ -1882,7 +1879,7 @@ static const struct drm_connector_funcs psb_intel_sdvo_connector_funcs = {
static const struct drm_connector_helper_funcs psb_intel_sdvo_connector_helper_funcs = { static const struct drm_connector_helper_funcs psb_intel_sdvo_connector_helper_funcs = {
.get_modes = psb_intel_sdvo_get_modes, .get_modes = psb_intel_sdvo_get_modes,
.mode_valid = psb_intel_sdvo_mode_valid, .mode_valid = psb_intel_sdvo_mode_valid,
.best_encoder = psb_intel_best_encoder, .best_encoder = gma_best_encoder,
}; };
static void psb_intel_sdvo_enc_destroy(struct drm_encoder *encoder) static void psb_intel_sdvo_enc_destroy(struct drm_encoder *encoder)
...@@ -1894,7 +1891,7 @@ static void psb_intel_sdvo_enc_destroy(struct drm_encoder *encoder) ...@@ -1894,7 +1891,7 @@ static void psb_intel_sdvo_enc_destroy(struct drm_encoder *encoder)
psb_intel_sdvo->sdvo_lvds_fixed_mode); psb_intel_sdvo->sdvo_lvds_fixed_mode);
i2c_del_adapter(&psb_intel_sdvo->ddc); i2c_del_adapter(&psb_intel_sdvo->ddc);
psb_intel_encoder_destroy(encoder); gma_encoder_destroy(encoder);
} }
static const struct drm_encoder_funcs psb_intel_sdvo_enc_funcs = { static const struct drm_encoder_funcs psb_intel_sdvo_enc_funcs = {
...@@ -2055,7 +2052,7 @@ psb_intel_sdvo_connector_init(struct psb_intel_sdvo_connector *connector, ...@@ -2055,7 +2052,7 @@ psb_intel_sdvo_connector_init(struct psb_intel_sdvo_connector *connector,
connector->base.base.doublescan_allowed = 0; connector->base.base.doublescan_allowed = 0;
connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB; connector->base.base.display_info.subpixel_order = SubPixelHorizontalRGB;
psb_intel_connector_attach_encoder(&connector->base, &encoder->base); gma_connector_attach_encoder(&connector->base, &encoder->base);
drm_sysfs_connector_add(&connector->base.base); drm_sysfs_connector_add(&connector->base.base);
} }
...@@ -2075,7 +2072,7 @@ psb_intel_sdvo_dvi_init(struct psb_intel_sdvo *psb_intel_sdvo, int device) ...@@ -2075,7 +2072,7 @@ psb_intel_sdvo_dvi_init(struct psb_intel_sdvo *psb_intel_sdvo, int device)
{ {
struct drm_encoder *encoder = &psb_intel_sdvo->base.base; struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
struct drm_connector *connector; struct drm_connector *connector;
struct psb_intel_connector *intel_connector; struct gma_connector *intel_connector;
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector; struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL); psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
...@@ -2115,7 +2112,7 @@ psb_intel_sdvo_tv_init(struct psb_intel_sdvo *psb_intel_sdvo, int type) ...@@ -2115,7 +2112,7 @@ psb_intel_sdvo_tv_init(struct psb_intel_sdvo *psb_intel_sdvo, int type)
{ {
struct drm_encoder *encoder = &psb_intel_sdvo->base.base; struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
struct drm_connector *connector; struct drm_connector *connector;
struct psb_intel_connector *intel_connector; struct gma_connector *intel_connector;
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector; struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL); psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
...@@ -2154,7 +2151,7 @@ psb_intel_sdvo_analog_init(struct psb_intel_sdvo *psb_intel_sdvo, int device) ...@@ -2154,7 +2151,7 @@ psb_intel_sdvo_analog_init(struct psb_intel_sdvo *psb_intel_sdvo, int device)
{ {
struct drm_encoder *encoder = &psb_intel_sdvo->base.base; struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
struct drm_connector *connector; struct drm_connector *connector;
struct psb_intel_connector *intel_connector; struct gma_connector *intel_connector;
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector; struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL); psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
...@@ -2188,7 +2185,7 @@ psb_intel_sdvo_lvds_init(struct psb_intel_sdvo *psb_intel_sdvo, int device) ...@@ -2188,7 +2185,7 @@ psb_intel_sdvo_lvds_init(struct psb_intel_sdvo *psb_intel_sdvo, int device)
{ {
struct drm_encoder *encoder = &psb_intel_sdvo->base.base; struct drm_encoder *encoder = &psb_intel_sdvo->base.base;
struct drm_connector *connector; struct drm_connector *connector;
struct psb_intel_connector *intel_connector; struct gma_connector *intel_connector;
struct psb_intel_sdvo_connector *psb_intel_sdvo_connector; struct psb_intel_sdvo_connector *psb_intel_sdvo_connector;
psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL); psb_intel_sdvo_connector = kzalloc(sizeof(struct psb_intel_sdvo_connector), GFP_KERNEL);
...@@ -2540,7 +2537,7 @@ psb_intel_sdvo_init_ddc_proxy(struct psb_intel_sdvo *sdvo, ...@@ -2540,7 +2537,7 @@ psb_intel_sdvo_init_ddc_proxy(struct psb_intel_sdvo *sdvo,
bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg) bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
{ {
struct drm_psb_private *dev_priv = dev->dev_private; struct drm_psb_private *dev_priv = dev->dev_private;
struct psb_intel_encoder *psb_intel_encoder; struct gma_encoder *gma_encoder;
struct psb_intel_sdvo *psb_intel_sdvo; struct psb_intel_sdvo *psb_intel_sdvo;
int i; int i;
...@@ -2557,9 +2554,9 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg) ...@@ -2557,9 +2554,9 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
} }
/* encoder type will be decided later */ /* encoder type will be decided later */
psb_intel_encoder = &psb_intel_sdvo->base; gma_encoder = &psb_intel_sdvo->base;
psb_intel_encoder->type = INTEL_OUTPUT_SDVO; gma_encoder->type = INTEL_OUTPUT_SDVO;
drm_encoder_init(dev, &psb_intel_encoder->base, &psb_intel_sdvo_enc_funcs, 0); drm_encoder_init(dev, &gma_encoder->base, &psb_intel_sdvo_enc_funcs, 0);
/* Read the regs to test if we can talk to the device */ /* Read the regs to test if we can talk to the device */
for (i = 0; i < 0x40; i++) { for (i = 0; i < 0x40; i++) {
...@@ -2577,7 +2574,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg) ...@@ -2577,7 +2574,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
else else
dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS; dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS;
drm_encoder_helper_add(&psb_intel_encoder->base, &psb_intel_sdvo_helper_funcs); drm_encoder_helper_add(&gma_encoder->base, &psb_intel_sdvo_helper_funcs);
/* In default case sdvo lvds is false */ /* In default case sdvo lvds is false */
if (!psb_intel_sdvo_get_capabilities(psb_intel_sdvo, &psb_intel_sdvo->caps)) if (!psb_intel_sdvo_get_capabilities(psb_intel_sdvo, &psb_intel_sdvo->caps))
...@@ -2620,7 +2617,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg) ...@@ -2620,7 +2617,7 @@ bool psb_intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
return true; return true;
err: err:
drm_encoder_cleanup(&psb_intel_encoder->base); drm_encoder_cleanup(&gma_encoder->base);
i2c_del_adapter(&psb_intel_sdvo->ddc); i2c_del_adapter(&psb_intel_sdvo->ddc);
kfree(psb_intel_sdvo); kfree(psb_intel_sdvo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment