Commit 21d40d37 authored by Eric Anholt's avatar Eric Anholt

drm/i915: Rename intel_output to intel_encoder.

The intel_output naming is inherited from the UMS code, which had a
structure of screen -> CRTC -> output.  The DRM code has an additional
notion of encoder/connector, so the structure is screen -> CRTC ->
encoder -> connector.  This is a useful structure for SDVO encoders
which can support multiple connectors (each of which requires
different programming in the one encoder and could be connected to
different CRTCs), or for DVI-I, where multiple encoders feed into the
connector for whether it's used for digital or analog.  Most of our
code is encoder-related, so transition it to talking about encoders
before we start trying to distinguish connectors.

This patch is produced by sed s/intel_output/intel_encoder/ over the
driver.
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 5e64499f
...@@ -259,10 +259,10 @@ static void i915_hotplug_work_func(struct work_struct *work) ...@@ -259,10 +259,10 @@ static void i915_hotplug_work_func(struct work_struct *work)
if (mode_config->num_connector) { if (mode_config->num_connector) {
list_for_each_entry(connector, &mode_config->connector_list, head) { list_for_each_entry(connector, &mode_config->connector_list, head) {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
if (intel_output->hot_plug) if (intel_encoder->hot_plug)
(*intel_output->hot_plug) (intel_output); (*intel_encoder->hot_plug) (intel_encoder);
} }
} }
/* Just fire off a uevent and let userspace tell us what to do */ /* Just fire off a uevent and let userspace tell us what to do */
......
...@@ -246,19 +246,19 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) ...@@ -246,19 +246,19 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
static bool intel_crt_detect_ddc(struct drm_connector *connector) static bool intel_crt_detect_ddc(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
/* CRT should always be at 0, but check anyway */ /* CRT should always be at 0, but check anyway */
if (intel_output->type != INTEL_OUTPUT_ANALOG) if (intel_encoder->type != INTEL_OUTPUT_ANALOG)
return false; return false;
return intel_ddc_probe(intel_output); return intel_ddc_probe(intel_encoder);
} }
static enum drm_connector_status static enum drm_connector_status
intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output) intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder)
{ {
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
...@@ -386,8 +386,8 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output) ...@@ -386,8 +386,8 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output)
static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) static enum drm_connector_status intel_crt_detect(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
struct drm_crtc *crtc; struct drm_crtc *crtc;
int dpms_mode; int dpms_mode;
enum drm_connector_status status; enum drm_connector_status status;
...@@ -404,13 +404,13 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto ...@@ -404,13 +404,13 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto
/* for pre-945g platforms use load detect */ /* for pre-945g platforms use load detect */
if (encoder->crtc && encoder->crtc->enabled) { if (encoder->crtc && encoder->crtc->enabled) {
status = intel_crt_load_detect(encoder->crtc, intel_output); status = intel_crt_load_detect(encoder->crtc, intel_encoder);
} else { } else {
crtc = intel_get_load_detect_pipe(intel_output, crtc = intel_get_load_detect_pipe(intel_encoder,
NULL, &dpms_mode); NULL, &dpms_mode);
if (crtc) { if (crtc) {
status = intel_crt_load_detect(crtc, intel_output); status = intel_crt_load_detect(crtc, intel_encoder);
intel_release_load_detect_pipe(intel_output, dpms_mode); intel_release_load_detect_pipe(intel_encoder, dpms_mode);
} else } else
status = connector_status_unknown; status = connector_status_unknown;
} }
...@@ -420,9 +420,9 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto ...@@ -420,9 +420,9 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto
static void intel_crt_destroy(struct drm_connector *connector) static void intel_crt_destroy(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
intel_i2c_destroy(intel_output->ddc_bus); intel_i2c_destroy(intel_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);
...@@ -431,28 +431,28 @@ static void intel_crt_destroy(struct drm_connector *connector) ...@@ -431,28 +431,28 @@ static void intel_crt_destroy(struct drm_connector *connector)
static int intel_crt_get_modes(struct drm_connector *connector) static int intel_crt_get_modes(struct drm_connector *connector)
{ {
int ret; int ret;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct i2c_adapter *ddcbus; struct i2c_adapter *ddcbus;
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
ret = intel_ddc_get_modes(intel_output); ret = intel_ddc_get_modes(intel_encoder);
if (ret || !IS_G4X(dev)) if (ret || !IS_G4X(dev))
goto end; goto end;
ddcbus = intel_output->ddc_bus; ddcbus = intel_encoder->ddc_bus;
/* Try to probe digital port for output in DVI-I -> VGA mode. */ /* Try to probe digital port for output in DVI-I -> VGA mode. */
intel_output->ddc_bus = intel_encoder->ddc_bus =
intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D");
if (!intel_output->ddc_bus) { if (!intel_encoder->ddc_bus) {
intel_output->ddc_bus = ddcbus; intel_encoder->ddc_bus = ddcbus;
dev_printk(KERN_ERR, &connector->dev->pdev->dev, dev_printk(KERN_ERR, &connector->dev->pdev->dev,
"DDC bus registration failed for CRTDDC_D.\n"); "DDC bus registration failed for CRTDDC_D.\n");
goto end; goto end;
} }
/* Try to get modes by GPIOD port */ /* Try to get modes by GPIOD port */
ret = intel_ddc_get_modes(intel_output); ret = intel_ddc_get_modes(intel_encoder);
intel_i2c_destroy(ddcbus); intel_i2c_destroy(ddcbus);
end: end:
...@@ -505,23 +505,23 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { ...@@ -505,23 +505,23 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = {
void intel_crt_init(struct drm_device *dev) void intel_crt_init(struct drm_device *dev)
{ {
struct drm_connector *connector; struct drm_connector *connector;
struct intel_output *intel_output; struct intel_encoder *intel_encoder;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
u32 i2c_reg; u32 i2c_reg;
intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); intel_encoder = kzalloc(sizeof(struct intel_encoder), GFP_KERNEL);
if (!intel_output) if (!intel_encoder)
return; return;
connector = &intel_output->base; connector = &intel_encoder->base;
drm_connector_init(dev, &intel_output->base, drm_connector_init(dev, &intel_encoder->base,
&intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs, drm_encoder_init(dev, &intel_encoder->enc, &intel_crt_enc_funcs,
DRM_MODE_ENCODER_DAC); DRM_MODE_ENCODER_DAC);
drm_mode_connector_attach_encoder(&intel_output->base, drm_mode_connector_attach_encoder(&intel_encoder->base,
&intel_output->enc); &intel_encoder->enc);
/* Set up the DDC bus. */ /* Set up the DDC bus. */
if (HAS_PCH_SPLIT(dev)) if (HAS_PCH_SPLIT(dev))
...@@ -532,22 +532,22 @@ void intel_crt_init(struct drm_device *dev) ...@@ -532,22 +532,22 @@ void 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;
} }
intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A"); intel_encoder->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A");
if (!intel_output->ddc_bus) { if (!intel_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");
return; return;
} }
intel_output->type = INTEL_OUTPUT_ANALOG; intel_encoder->type = INTEL_OUTPUT_ANALOG;
intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
(1 << INTEL_ANALOG_CLONE_BIT) | (1 << INTEL_ANALOG_CLONE_BIT) |
(1 << INTEL_SDVO_LVDS_CLONE_BIT); (1 << INTEL_SDVO_LVDS_CLONE_BIT);
intel_output->crtc_mask = (1 << 0) | (1 << 1); intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
connector->interlace_allowed = 0; connector->interlace_allowed = 0;
connector->doublescan_allowed = 0; connector->doublescan_allowed = 0;
drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs); drm_encoder_helper_add(&intel_encoder->enc, &intel_crt_helper_funcs);
drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
......
...@@ -746,8 +746,8 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type) ...@@ -746,8 +746,8 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
list_for_each_entry(l_entry, &mode_config->connector_list, head) { list_for_each_entry(l_entry, &mode_config->connector_list, head) {
if (l_entry->encoder && if (l_entry->encoder &&
l_entry->encoder->crtc == crtc) { l_entry->encoder->crtc == crtc) {
struct intel_output *intel_output = to_intel_output(l_entry); struct intel_encoder *intel_encoder = to_intel_encoder(l_entry);
if (intel_output->type == type) if (intel_encoder->type == type)
return true; return true;
} }
} }
...@@ -2942,19 +2942,19 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, ...@@ -2942,19 +2942,19 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
drm_vblank_pre_modeset(dev, pipe); drm_vblank_pre_modeset(dev, pipe);
list_for_each_entry(connector, &mode_config->connector_list, head) { list_for_each_entry(connector, &mode_config->connector_list, head) {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
if (!connector->encoder || connector->encoder->crtc != crtc) if (!connector->encoder || connector->encoder->crtc != crtc)
continue; continue;
switch (intel_output->type) { switch (intel_encoder->type) {
case INTEL_OUTPUT_LVDS: case INTEL_OUTPUT_LVDS:
is_lvds = true; is_lvds = true;
break; break;
case INTEL_OUTPUT_SDVO: case INTEL_OUTPUT_SDVO:
case INTEL_OUTPUT_HDMI: case INTEL_OUTPUT_HDMI:
is_sdvo = true; is_sdvo = true;
if (intel_output->needs_tv_clock) if (intel_encoder->needs_tv_clock)
is_tv = true; is_tv = true;
break; break;
case INTEL_OUTPUT_DVO: case INTEL_OUTPUT_DVO:
...@@ -3049,7 +3049,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, ...@@ -3049,7 +3049,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
struct drm_connector *edp; struct drm_connector *edp;
target_clock = mode->clock; target_clock = mode->clock;
edp = intel_pipe_get_output(crtc); edp = intel_pipe_get_output(crtc);
intel_edp_link_config(to_intel_output(edp), intel_edp_link_config(to_intel_encoder(edp),
&lane, &link_bw); &lane, &link_bw);
} else { } else {
/* DP over FDI requires target mode clock /* DP over FDI requires target mode clock
...@@ -3669,14 +3669,14 @@ static struct drm_display_mode load_detect_mode = { ...@@ -3669,14 +3669,14 @@ static struct drm_display_mode load_detect_mode = {
704, 832, 0, 480, 489, 491, 520, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC), 704, 832, 0, 480, 489, 491, 520, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
}; };
struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
struct drm_display_mode *mode, struct drm_display_mode *mode,
int *dpms_mode) int *dpms_mode)
{ {
struct intel_crtc *intel_crtc; struct intel_crtc *intel_crtc;
struct drm_crtc *possible_crtc; struct drm_crtc *possible_crtc;
struct drm_crtc *supported_crtc =NULL; struct drm_crtc *supported_crtc =NULL;
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
struct drm_crtc *crtc = NULL; struct drm_crtc *crtc = NULL;
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
...@@ -3728,8 +3728,8 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, ...@@ -3728,8 +3728,8 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
} }
encoder->crtc = crtc; encoder->crtc = crtc;
intel_output->base.encoder = encoder; intel_encoder->base.encoder = encoder;
intel_output->load_detect_temp = true; intel_encoder->load_detect_temp = true;
intel_crtc = to_intel_crtc(crtc); intel_crtc = to_intel_crtc(crtc);
*dpms_mode = intel_crtc->dpms_mode; *dpms_mode = intel_crtc->dpms_mode;
...@@ -3754,18 +3754,18 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, ...@@ -3754,18 +3754,18 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
return crtc; return crtc;
} }
void intel_release_load_detect_pipe(struct intel_output *intel_output, int dpms_mode) void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder, int dpms_mode)
{ {
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
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 drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
if (intel_output->load_detect_temp) { if (intel_encoder->load_detect_temp) {
encoder->crtc = NULL; encoder->crtc = NULL;
intel_output->base.encoder = NULL; intel_encoder->base.encoder = NULL;
intel_output->load_detect_temp = false; intel_encoder->load_detect_temp = false;
crtc->enabled = drm_helper_crtc_in_use(crtc); crtc->enabled = drm_helper_crtc_in_use(crtc);
drm_helper_disable_unused_functions(dev); drm_helper_disable_unused_functions(dev);
} }
...@@ -4398,8 +4398,8 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask) ...@@ -4398,8 +4398,8 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask)
int entry = 0; int entry = 0;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) { list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
if (type_mask & intel_output->clone_mask) if (type_mask & intel_encoder->clone_mask)
index_mask |= (1 << entry); index_mask |= (1 << entry);
entry++; entry++;
} }
...@@ -4494,12 +4494,12 @@ static void intel_setup_outputs(struct drm_device *dev) ...@@ -4494,12 +4494,12 @@ static void intel_setup_outputs(struct drm_device *dev)
intel_tv_init(dev); intel_tv_init(dev);
list_for_each_entry(connector, &dev->mode_config.connector_list, head) { list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
encoder->possible_crtcs = intel_output->crtc_mask; encoder->possible_crtcs = intel_encoder->crtc_mask;
encoder->possible_clones = intel_connector_clones(dev, encoder->possible_clones = intel_connector_clones(dev,
intel_output->clone_mask); intel_encoder->clone_mask);
} }
} }
...@@ -4977,9 +4977,9 @@ void intel_modeset_cleanup(struct drm_device *dev) ...@@ -4977,9 +4977,9 @@ void intel_modeset_cleanup(struct drm_device *dev)
*/ */
struct drm_encoder *intel_best_encoder(struct drm_connector *connector) struct drm_encoder *intel_best_encoder(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
return &intel_output->enc; return &intel_encoder->enc;
} }
/* /*
......
This diff is collapsed.
...@@ -95,7 +95,7 @@ struct intel_framebuffer { ...@@ -95,7 +95,7 @@ struct intel_framebuffer {
}; };
struct intel_output { struct intel_encoder {
struct drm_connector base; struct drm_connector base;
struct drm_encoder enc; struct drm_encoder enc;
...@@ -105,7 +105,7 @@ struct intel_output { ...@@ -105,7 +105,7 @@ struct intel_output {
bool load_detect_temp; bool load_detect_temp;
bool needs_tv_clock; bool needs_tv_clock;
void *dev_priv; void *dev_priv;
void (*hot_plug)(struct intel_output *); void (*hot_plug)(struct intel_encoder *);
int crtc_mask; int crtc_mask;
int clone_mask; int clone_mask;
}; };
...@@ -152,15 +152,15 @@ struct intel_crtc { ...@@ -152,15 +152,15 @@ struct intel_crtc {
}; };
#define to_intel_crtc(x) container_of(x, struct intel_crtc, base) #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
#define to_intel_output(x) container_of(x, struct intel_output, base) #define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
#define enc_to_intel_output(x) container_of(x, struct intel_output, enc) #define enc_to_intel_encoder(x) container_of(x, struct intel_encoder, enc)
#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg, struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg,
const char *name); const char *name);
void intel_i2c_destroy(struct i2c_adapter *adapter); void intel_i2c_destroy(struct i2c_adapter *adapter);
int intel_ddc_get_modes(struct intel_output *intel_output); int intel_ddc_get_modes(struct intel_encoder *intel_encoder);
extern bool intel_ddc_probe(struct intel_output *intel_output); extern bool intel_ddc_probe(struct intel_encoder *intel_encoder);
void intel_i2c_quirk_set(struct drm_device *dev, bool enable); void intel_i2c_quirk_set(struct drm_device *dev, bool enable);
void intel_i2c_reset_gmbus(struct drm_device *dev); void intel_i2c_reset_gmbus(struct drm_device *dev);
...@@ -175,7 +175,7 @@ extern void intel_dp_init(struct drm_device *dev, int dp_reg); ...@@ -175,7 +175,7 @@ extern void intel_dp_init(struct drm_device *dev, int dp_reg);
void void
intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode); struct drm_display_mode *adjusted_mode);
extern void intel_edp_link_config (struct intel_output *, int *, int *); extern void intel_edp_link_config (struct intel_encoder *, int *, int *);
extern int intel_panel_fitter_pipe (struct drm_device *dev); extern int intel_panel_fitter_pipe (struct drm_device *dev);
...@@ -191,10 +191,10 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, ...@@ -191,10 +191,10 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern void intel_wait_for_vblank(struct drm_device *dev); extern void intel_wait_for_vblank(struct drm_device *dev);
extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
struct drm_display_mode *mode, struct drm_display_mode *mode,
int *dpms_mode); int *dpms_mode);
extern void intel_release_load_detect_pipe(struct intel_output *intel_output, extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,
int dpms_mode); int dpms_mode);
extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB); extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB);
......
...@@ -79,8 +79,8 @@ static struct intel_dvo_device intel_dvo_devices[] = { ...@@ -79,8 +79,8 @@ static struct intel_dvo_device intel_dvo_devices[] = {
static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
{ {
struct drm_i915_private *dev_priv = encoder->dev->dev_private; struct drm_i915_private *dev_priv = encoder->dev->dev_private;
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
u32 dvo_reg = dvo->dvo_reg; u32 dvo_reg = dvo->dvo_reg;
u32 temp = I915_READ(dvo_reg); u32 temp = I915_READ(dvo_reg);
...@@ -98,8 +98,8 @@ static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) ...@@ -98,8 +98,8 @@ static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
static void intel_dvo_save(struct drm_connector *connector) static void intel_dvo_save(struct drm_connector *connector)
{ {
struct drm_i915_private *dev_priv = connector->dev->dev_private; struct drm_i915_private *dev_priv = connector->dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
/* Each output should probably just save the registers it touches, /* Each output should probably just save the registers it touches,
* but for now, use more overkill. * but for now, use more overkill.
...@@ -114,8 +114,8 @@ static void intel_dvo_save(struct drm_connector *connector) ...@@ -114,8 +114,8 @@ static void intel_dvo_save(struct drm_connector *connector)
static void intel_dvo_restore(struct drm_connector *connector) static void intel_dvo_restore(struct drm_connector *connector)
{ {
struct drm_i915_private *dev_priv = connector->dev->dev_private; struct drm_i915_private *dev_priv = connector->dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
dvo->dev_ops->restore(dvo); dvo->dev_ops->restore(dvo);
...@@ -127,8 +127,8 @@ static void intel_dvo_restore(struct drm_connector *connector) ...@@ -127,8 +127,8 @@ static void intel_dvo_restore(struct drm_connector *connector)
static int intel_dvo_mode_valid(struct drm_connector *connector, static int intel_dvo_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN) if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN; return MODE_NO_DBLESCAN;
...@@ -149,8 +149,8 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, ...@@ -149,8 +149,8 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder,
struct drm_display_mode *mode, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode) struct drm_display_mode *adjusted_mode)
{ {
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
/* If we have timings from the BIOS for the panel, put them in /* If we have timings from the BIOS for the panel, put them in
* to the adjusted mode. The CRTC will be set up for this mode, * to the adjusted mode. The CRTC will be set up for this mode,
...@@ -185,8 +185,8 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder, ...@@ -185,8 +185,8 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
u32 dvo_val; u32 dvo_val;
u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg; u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg;
...@@ -240,23 +240,23 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder, ...@@ -240,23 +240,23 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
*/ */
static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector) static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
return dvo->dev_ops->detect(dvo); return dvo->dev_ops->detect(dvo);
} }
static int intel_dvo_get_modes(struct drm_connector *connector) static int intel_dvo_get_modes(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
/* We should probably have an i2c driver get_modes function for those /* We should probably have an i2c driver get_modes function for those
* devices which will have a fixed set of modes determined by the chip * devices which will have a fixed set of modes determined by the chip
* (TV-out, for example), but for now with just TMDS and LVDS, * (TV-out, for example), but for now with just TMDS and LVDS,
* that's not the case. * that's not the case.
*/ */
intel_ddc_get_modes(intel_output); intel_ddc_get_modes(intel_encoder);
if (!list_empty(&connector->probed_modes)) if (!list_empty(&connector->probed_modes))
return 1; return 1;
...@@ -274,8 +274,8 @@ static int intel_dvo_get_modes(struct drm_connector *connector) ...@@ -274,8 +274,8 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
static void intel_dvo_destroy (struct drm_connector *connector) static void intel_dvo_destroy (struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
if (dvo) { if (dvo) {
if (dvo->dev_ops->destroy) if (dvo->dev_ops->destroy)
...@@ -285,13 +285,13 @@ static void intel_dvo_destroy (struct drm_connector *connector) ...@@ -285,13 +285,13 @@ static void intel_dvo_destroy (struct drm_connector *connector)
/* no need, in i830_dvoices[] now */ /* no need, in i830_dvoices[] now */
//kfree(dvo); //kfree(dvo);
} }
if (intel_output->i2c_bus) if (intel_encoder->i2c_bus)
intel_i2c_destroy(intel_output->i2c_bus); intel_i2c_destroy(intel_encoder->i2c_bus);
if (intel_output->ddc_bus) if (intel_encoder->ddc_bus)
intel_i2c_destroy(intel_output->ddc_bus); intel_i2c_destroy(intel_encoder->ddc_bus);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(intel_output); kfree(intel_encoder);
} }
#ifdef RANDR_GET_CRTC_INTERFACE #ifdef RANDR_GET_CRTC_INTERFACE
...@@ -299,8 +299,8 @@ static struct drm_crtc *intel_dvo_get_crtc(struct drm_connector *connector) ...@@ -299,8 +299,8 @@ static struct drm_crtc *intel_dvo_get_crtc(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT); int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT);
return intel_pipe_to_crtc(pScrn, pipe); return intel_pipe_to_crtc(pScrn, pipe);
...@@ -351,8 +351,8 @@ intel_dvo_get_current_mode (struct drm_connector *connector) ...@@ -351,8 +351,8 @@ intel_dvo_get_current_mode (struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_dvo_device *dvo = intel_output->dev_priv; struct intel_dvo_device *dvo = intel_encoder->dev_priv;
uint32_t dvo_reg = dvo->dvo_reg; uint32_t dvo_reg = dvo->dvo_reg;
uint32_t dvo_val = I915_READ(dvo_reg); uint32_t dvo_val = I915_READ(dvo_reg);
struct drm_display_mode *mode = NULL; struct drm_display_mode *mode = NULL;
...@@ -382,24 +382,24 @@ intel_dvo_get_current_mode (struct drm_connector *connector) ...@@ -382,24 +382,24 @@ intel_dvo_get_current_mode (struct drm_connector *connector)
void intel_dvo_init(struct drm_device *dev) void intel_dvo_init(struct drm_device *dev)
{ {
struct intel_output *intel_output; struct intel_encoder *intel_encoder;
struct intel_dvo_device *dvo; struct intel_dvo_device *dvo;
struct i2c_adapter *i2cbus = NULL; struct i2c_adapter *i2cbus = NULL;
int ret = 0; int ret = 0;
int i; int i;
int encoder_type = DRM_MODE_ENCODER_NONE; int encoder_type = DRM_MODE_ENCODER_NONE;
intel_output = kzalloc (sizeof(struct intel_output), GFP_KERNEL); intel_encoder = kzalloc (sizeof(struct intel_encoder), GFP_KERNEL);
if (!intel_output) if (!intel_encoder)
return; return;
/* Set up the DDC bus */ /* Set up the DDC bus */
intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D"); intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D");
if (!intel_output->ddc_bus) if (!intel_encoder->ddc_bus)
goto free_intel; goto free_intel;
/* Now, try to find a controller */ /* Now, try to find a controller */
for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) {
struct drm_connector *connector = &intel_output->base; struct drm_connector *connector = &intel_encoder->base;
int gpio; int gpio;
dvo = &intel_dvo_devices[i]; dvo = &intel_dvo_devices[i];
...@@ -434,11 +434,11 @@ void intel_dvo_init(struct drm_device *dev) ...@@ -434,11 +434,11 @@ void intel_dvo_init(struct drm_device *dev)
if (!ret) if (!ret)
continue; continue;
intel_output->type = INTEL_OUTPUT_DVO; intel_encoder->type = INTEL_OUTPUT_DVO;
intel_output->crtc_mask = (1 << 0) | (1 << 1); intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
switch (dvo->type) { switch (dvo->type) {
case INTEL_DVO_CHIP_TMDS: case INTEL_DVO_CHIP_TMDS:
intel_output->clone_mask = intel_encoder->clone_mask =
(1 << INTEL_DVO_TMDS_CLONE_BIT) | (1 << INTEL_DVO_TMDS_CLONE_BIT) |
(1 << INTEL_ANALOG_CLONE_BIT); (1 << INTEL_ANALOG_CLONE_BIT);
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
...@@ -447,7 +447,7 @@ void intel_dvo_init(struct drm_device *dev) ...@@ -447,7 +447,7 @@ void intel_dvo_init(struct drm_device *dev)
encoder_type = DRM_MODE_ENCODER_TMDS; encoder_type = DRM_MODE_ENCODER_TMDS;
break; break;
case INTEL_DVO_CHIP_LVDS: case INTEL_DVO_CHIP_LVDS:
intel_output->clone_mask = intel_encoder->clone_mask =
(1 << INTEL_DVO_LVDS_CLONE_BIT); (1 << INTEL_DVO_LVDS_CLONE_BIT);
drm_connector_init(dev, connector, drm_connector_init(dev, connector,
&intel_dvo_connector_funcs, &intel_dvo_connector_funcs,
...@@ -462,16 +462,16 @@ void intel_dvo_init(struct drm_device *dev) ...@@ -462,16 +462,16 @@ void intel_dvo_init(struct drm_device *dev)
connector->interlace_allowed = false; connector->interlace_allowed = false;
connector->doublescan_allowed = false; connector->doublescan_allowed = false;
intel_output->dev_priv = dvo; intel_encoder->dev_priv = dvo;
intel_output->i2c_bus = i2cbus; intel_encoder->i2c_bus = i2cbus;
drm_encoder_init(dev, &intel_output->enc, drm_encoder_init(dev, &intel_encoder->enc,
&intel_dvo_enc_funcs, encoder_type); &intel_dvo_enc_funcs, encoder_type);
drm_encoder_helper_add(&intel_output->enc, drm_encoder_helper_add(&intel_encoder->enc,
&intel_dvo_helper_funcs); &intel_dvo_helper_funcs);
drm_mode_connector_attach_encoder(&intel_output->base, drm_mode_connector_attach_encoder(&intel_encoder->base,
&intel_output->enc); &intel_encoder->enc);
if (dvo->type == INTEL_DVO_CHIP_LVDS) { if (dvo->type == INTEL_DVO_CHIP_LVDS) {
/* For our LVDS chipsets, we should hopefully be able /* For our LVDS chipsets, we should hopefully be able
* to dig the fixed panel mode out of the BIOS data. * to dig the fixed panel mode out of the BIOS data.
...@@ -489,10 +489,10 @@ void intel_dvo_init(struct drm_device *dev) ...@@ -489,10 +489,10 @@ void intel_dvo_init(struct drm_device *dev)
return; return;
} }
intel_i2c_destroy(intel_output->ddc_bus); intel_i2c_destroy(intel_encoder->ddc_bus);
/* Didn't find a chip, so tear down. */ /* Didn't find a chip, so tear down. */
if (i2cbus != NULL) if (i2cbus != NULL)
intel_i2c_destroy(i2cbus); intel_i2c_destroy(i2cbus);
free_intel: free_intel:
kfree(intel_output); kfree(intel_encoder);
} }
...@@ -50,8 +50,8 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder, ...@@ -50,8 +50,8 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
u32 sdvox; u32 sdvox;
sdvox = SDVO_ENCODING_HDMI | sdvox = SDVO_ENCODING_HDMI |
...@@ -73,8 +73,8 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) ...@@ -73,8 +73,8 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
u32 temp; u32 temp;
temp = I915_READ(hdmi_priv->sdvox_reg); temp = I915_READ(hdmi_priv->sdvox_reg);
...@@ -109,8 +109,8 @@ static void intel_hdmi_save(struct drm_connector *connector) ...@@ -109,8 +109,8 @@ static void intel_hdmi_save(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
hdmi_priv->save_SDVOX = I915_READ(hdmi_priv->sdvox_reg); hdmi_priv->save_SDVOX = I915_READ(hdmi_priv->sdvox_reg);
} }
...@@ -119,8 +119,8 @@ static void intel_hdmi_restore(struct drm_connector *connector) ...@@ -119,8 +119,8 @@ static void intel_hdmi_restore(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
I915_WRITE(hdmi_priv->sdvox_reg, hdmi_priv->save_SDVOX); I915_WRITE(hdmi_priv->sdvox_reg, hdmi_priv->save_SDVOX);
POSTING_READ(hdmi_priv->sdvox_reg); POSTING_READ(hdmi_priv->sdvox_reg);
...@@ -150,21 +150,21 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, ...@@ -150,21 +150,21 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
static enum drm_connector_status static enum drm_connector_status
intel_hdmi_detect(struct drm_connector *connector) intel_hdmi_detect(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; struct intel_hdmi_priv *hdmi_priv = 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;
hdmi_priv->has_hdmi_sink = false; hdmi_priv->has_hdmi_sink = false;
edid = drm_get_edid(&intel_output->base, edid = drm_get_edid(&intel_encoder->base,
intel_output->ddc_bus); intel_encoder->ddc_bus);
if (edid) { if (edid) {
if (edid->input & DRM_EDID_INPUT_DIGITAL) { if (edid->input & DRM_EDID_INPUT_DIGITAL) {
status = connector_status_connected; status = connector_status_connected;
hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid); hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
} }
intel_output->base.display_info.raw_edid = NULL; intel_encoder->base.display_info.raw_edid = NULL;
kfree(edid); kfree(edid);
} }
...@@ -173,24 +173,24 @@ intel_hdmi_detect(struct drm_connector *connector) ...@@ -173,24 +173,24 @@ intel_hdmi_detect(struct drm_connector *connector)
static int intel_hdmi_get_modes(struct drm_connector *connector) static int intel_hdmi_get_modes(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
/* We should parse the EDID data and find out if it's an HDMI sink so /* We should parse the EDID data and find out if it's an HDMI sink so
* we can send audio to it. * we can send audio to it.
*/ */
return intel_ddc_get_modes(intel_output); return intel_ddc_get_modes(intel_encoder);
} }
static void intel_hdmi_destroy(struct drm_connector *connector) static void intel_hdmi_destroy(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
if (intel_output->i2c_bus) if (intel_encoder->i2c_bus)
intel_i2c_destroy(intel_output->i2c_bus); intel_i2c_destroy(intel_encoder->i2c_bus);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(intel_output); kfree(intel_encoder);
} }
static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = { static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
...@@ -229,63 +229,63 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) ...@@ -229,63 +229,63 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_connector *connector; struct drm_connector *connector;
struct intel_output *intel_output; struct intel_encoder *intel_encoder;
struct intel_hdmi_priv *hdmi_priv; struct intel_hdmi_priv *hdmi_priv;
intel_output = kcalloc(sizeof(struct intel_output) + intel_encoder = kcalloc(sizeof(struct intel_encoder) +
sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL); sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL);
if (!intel_output) if (!intel_encoder)
return; return;
hdmi_priv = (struct intel_hdmi_priv *)(intel_output + 1); hdmi_priv = (struct intel_hdmi_priv *)(intel_encoder + 1);
connector = &intel_output->base; connector = &intel_encoder->base;
drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA); DRM_MODE_CONNECTOR_HDMIA);
drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs); drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
intel_output->type = INTEL_OUTPUT_HDMI; intel_encoder->type = INTEL_OUTPUT_HDMI;
connector->interlace_allowed = 0; connector->interlace_allowed = 0;
connector->doublescan_allowed = 0; connector->doublescan_allowed = 0;
intel_output->crtc_mask = (1 << 0) | (1 << 1); intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
/* Set up the DDC bus. */ /* Set up the DDC bus. */
if (sdvox_reg == SDVOB) { if (sdvox_reg == SDVOB) {
intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT);
intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
} else if (sdvox_reg == SDVOC) { } else if (sdvox_reg == SDVOC) {
intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT);
intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
} else if (sdvox_reg == HDMIB) { } else if (sdvox_reg == HDMIB) {
intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_HDMID_CLONE_BIT);
intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
"HDMIB"); "HDMIB");
dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
} else if (sdvox_reg == HDMIC) { } else if (sdvox_reg == HDMIC) {
intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT);
intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
"HDMIC"); "HDMIC");
dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
} else if (sdvox_reg == HDMID) { } else if (sdvox_reg == HDMID) {
intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT);
intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
"HDMID"); "HDMID");
dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
} }
if (!intel_output->ddc_bus) if (!intel_encoder->ddc_bus)
goto err_connector; goto err_connector;
hdmi_priv->sdvox_reg = sdvox_reg; hdmi_priv->sdvox_reg = sdvox_reg;
intel_output->dev_priv = hdmi_priv; intel_encoder->dev_priv = hdmi_priv;
drm_encoder_init(dev, &intel_output->enc, &intel_hdmi_enc_funcs, drm_encoder_init(dev, &intel_encoder->enc, &intel_hdmi_enc_funcs,
DRM_MODE_ENCODER_TMDS); DRM_MODE_ENCODER_TMDS);
drm_encoder_helper_add(&intel_output->enc, &intel_hdmi_helper_funcs); drm_encoder_helper_add(&intel_encoder->enc, &intel_hdmi_helper_funcs);
drm_mode_connector_attach_encoder(&intel_output->base, drm_mode_connector_attach_encoder(&intel_encoder->base,
&intel_output->enc); &intel_encoder->enc);
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
/* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
...@@ -301,7 +301,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) ...@@ -301,7 +301,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
err_connector: err_connector:
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(intel_output); kfree(intel_encoder);
return; return;
} }
...@@ -238,8 +238,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, ...@@ -238,8 +238,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
struct drm_encoder *tmp_encoder; struct drm_encoder *tmp_encoder;
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_lvds_priv *lvds_priv = intel_output->dev_priv; struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
u32 pfit_control = 0, pfit_pgm_ratios = 0; u32 pfit_control = 0, pfit_pgm_ratios = 0;
int left_border = 0, right_border = 0, top_border = 0; int left_border = 0, right_border = 0, top_border = 0;
int bottom_border = 0; int bottom_border = 0;
...@@ -586,8 +586,8 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder, ...@@ -586,8 +586,8 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_lvds_priv *lvds_priv = intel_output->dev_priv; struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
/* /*
* The LVDS pin pair will already have been turned on in the * The LVDS pin pair will already have been turned on in the
...@@ -634,11 +634,11 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect ...@@ -634,11 +634,11 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
static int intel_lvds_get_modes(struct drm_connector *connector) static int intel_lvds_get_modes(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int ret = 0; int ret = 0;
ret = intel_ddc_get_modes(intel_output); ret = intel_ddc_get_modes(intel_encoder);
if (ret) if (ret)
return ret; return ret;
...@@ -714,11 +714,11 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, ...@@ -714,11 +714,11 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
static void intel_lvds_destroy(struct drm_connector *connector) static void intel_lvds_destroy(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (intel_output->ddc_bus) if (intel_encoder->ddc_bus)
intel_i2c_destroy(intel_output->ddc_bus); intel_i2c_destroy(intel_encoder->ddc_bus);
if (dev_priv->lid_notifier.notifier_call) if (dev_priv->lid_notifier.notifier_call)
acpi_lid_notifier_unregister(&dev_priv->lid_notifier); acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
...@@ -731,13 +731,13 @@ static int intel_lvds_set_property(struct drm_connector *connector, ...@@ -731,13 +731,13 @@ static int intel_lvds_set_property(struct drm_connector *connector,
uint64_t value) uint64_t value)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct intel_output *intel_output = struct intel_encoder *intel_encoder =
to_intel_output(connector); to_intel_encoder(connector);
if (property == dev->mode_config.scaling_mode_property && if (property == dev->mode_config.scaling_mode_property &&
connector->encoder) { connector->encoder) {
struct drm_crtc *crtc = connector->encoder->crtc; struct drm_crtc *crtc = connector->encoder->crtc;
struct intel_lvds_priv *lvds_priv = intel_output->dev_priv; struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
if (value == DRM_MODE_SCALE_NONE) { if (value == DRM_MODE_SCALE_NONE) {
DRM_DEBUG_KMS("no scaling not supported\n"); DRM_DEBUG_KMS("no scaling not supported\n");
return 0; return 0;
...@@ -967,7 +967,7 @@ static int lvds_is_present_in_vbt(struct drm_device *dev) ...@@ -967,7 +967,7 @@ static int lvds_is_present_in_vbt(struct drm_device *dev)
void intel_lvds_init(struct drm_device *dev) void intel_lvds_init(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output; struct intel_encoder *intel_encoder;
struct drm_connector *connector; struct drm_connector *connector;
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct drm_display_mode *scan; /* *modes, *bios_mode; */ struct drm_display_mode *scan; /* *modes, *bios_mode; */
...@@ -995,40 +995,40 @@ void intel_lvds_init(struct drm_device *dev) ...@@ -995,40 +995,40 @@ void intel_lvds_init(struct drm_device *dev)
gpio = PCH_GPIOC; gpio = PCH_GPIOC;
} }
intel_output = kzalloc(sizeof(struct intel_output) + intel_encoder = kzalloc(sizeof(struct intel_encoder) +
sizeof(struct intel_lvds_priv), GFP_KERNEL); sizeof(struct intel_lvds_priv), GFP_KERNEL);
if (!intel_output) { if (!intel_encoder) {
return; return;
} }
connector = &intel_output->base; connector = &intel_encoder->base;
encoder = &intel_output->enc; encoder = &intel_encoder->enc;
drm_connector_init(dev, &intel_output->base, &intel_lvds_connector_funcs, drm_connector_init(dev, &intel_encoder->base, &intel_lvds_connector_funcs,
DRM_MODE_CONNECTOR_LVDS); DRM_MODE_CONNECTOR_LVDS);
drm_encoder_init(dev, &intel_output->enc, &intel_lvds_enc_funcs, drm_encoder_init(dev, &intel_encoder->enc, &intel_lvds_enc_funcs,
DRM_MODE_ENCODER_LVDS); DRM_MODE_ENCODER_LVDS);
drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc);
intel_output->type = INTEL_OUTPUT_LVDS; intel_encoder->type = INTEL_OUTPUT_LVDS;
intel_output->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT);
intel_output->crtc_mask = (1 << 1); intel_encoder->crtc_mask = (1 << 1);
drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs); drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs);
drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs);
connector->display_info.subpixel_order = SubPixelHorizontalRGB; connector->display_info.subpixel_order = SubPixelHorizontalRGB;
connector->interlace_allowed = false; connector->interlace_allowed = false;
connector->doublescan_allowed = false; connector->doublescan_allowed = false;
lvds_priv = (struct intel_lvds_priv *)(intel_output + 1); lvds_priv = (struct intel_lvds_priv *)(intel_encoder + 1);
intel_output->dev_priv = lvds_priv; intel_encoder->dev_priv = lvds_priv;
/* create the scaling mode property */ /* create the scaling mode property */
drm_mode_create_scaling_mode_property(dev); drm_mode_create_scaling_mode_property(dev);
/* /*
* the initial panel fitting mode will be FULL_SCREEN. * the initial panel fitting mode will be FULL_SCREEN.
*/ */
drm_connector_attach_property(&intel_output->base, drm_connector_attach_property(&intel_encoder->base,
dev->mode_config.scaling_mode_property, dev->mode_config.scaling_mode_property,
DRM_MODE_SCALE_FULLSCREEN); DRM_MODE_SCALE_FULLSCREEN);
lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN; lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN;
...@@ -1043,8 +1043,8 @@ void intel_lvds_init(struct drm_device *dev) ...@@ -1043,8 +1043,8 @@ void intel_lvds_init(struct drm_device *dev)
*/ */
/* Set up the DDC bus. */ /* Set up the DDC bus. */
intel_output->ddc_bus = intel_i2c_create(dev, gpio, "LVDSDDC_C"); intel_encoder->ddc_bus = intel_i2c_create(dev, gpio, "LVDSDDC_C");
if (!intel_output->ddc_bus) { if (!intel_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; goto failed;
...@@ -1054,7 +1054,7 @@ void intel_lvds_init(struct drm_device *dev) ...@@ -1054,7 +1054,7 @@ void intel_lvds_init(struct drm_device *dev)
* Attempt to get the fixed panel mode from DDC. Assume that the * Attempt to get the fixed panel mode from DDC. Assume that the
* preferred mode is the right one. * preferred mode is the right one.
*/ */
intel_ddc_get_modes(intel_output); intel_ddc_get_modes(intel_encoder);
list_for_each_entry(scan, &connector->probed_modes, head) { list_for_each_entry(scan, &connector->probed_modes, head) {
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
...@@ -1132,9 +1132,9 @@ out: ...@@ -1132,9 +1132,9 @@ out:
failed: failed:
DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); DRM_DEBUG_KMS("No LVDS modes found, disabling.\n");
if (intel_output->ddc_bus) if (intel_encoder->ddc_bus)
intel_i2c_destroy(intel_output->ddc_bus); intel_i2c_destroy(intel_encoder->ddc_bus);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
kfree(intel_output); kfree(intel_encoder);
} }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* intel_ddc_probe * intel_ddc_probe
* *
*/ */
bool intel_ddc_probe(struct intel_output *intel_output) bool intel_ddc_probe(struct intel_encoder *intel_encoder)
{ {
u8 out_buf[] = { 0x0, 0x0}; u8 out_buf[] = { 0x0, 0x0};
u8 buf[2]; u8 buf[2];
...@@ -53,9 +53,9 @@ bool intel_ddc_probe(struct intel_output *intel_output) ...@@ -53,9 +53,9 @@ bool intel_ddc_probe(struct intel_output *intel_output)
} }
}; };
intel_i2c_quirk_set(intel_output->base.dev, true); intel_i2c_quirk_set(intel_encoder->base.dev, true);
ret = i2c_transfer(intel_output->ddc_bus, msgs, 2); ret = i2c_transfer(intel_encoder->ddc_bus, msgs, 2);
intel_i2c_quirk_set(intel_output->base.dev, false); intel_i2c_quirk_set(intel_encoder->base.dev, false);
if (ret == 2) if (ret == 2)
return true; return true;
...@@ -68,19 +68,19 @@ bool intel_ddc_probe(struct intel_output *intel_output) ...@@ -68,19 +68,19 @@ bool intel_ddc_probe(struct intel_output *intel_output)
* *
* Fetch the EDID information from @connector using the DDC bus. * Fetch the EDID information from @connector using the DDC bus.
*/ */
int intel_ddc_get_modes(struct intel_output *intel_output) int intel_ddc_get_modes(struct intel_encoder *intel_encoder)
{ {
struct edid *edid; struct edid *edid;
int ret = 0; int ret = 0;
intel_i2c_quirk_set(intel_output->base.dev, true); intel_i2c_quirk_set(intel_encoder->base.dev, true);
edid = drm_get_edid(&intel_output->base, intel_output->ddc_bus); edid = drm_get_edid(&intel_encoder->base, intel_encoder->ddc_bus);
intel_i2c_quirk_set(intel_output->base.dev, false); intel_i2c_quirk_set(intel_encoder->base.dev, false);
if (edid) { if (edid) {
drm_mode_connector_update_edid_property(&intel_output->base, drm_mode_connector_update_edid_property(&intel_encoder->base,
edid); edid);
ret = drm_add_edid_modes(&intel_output->base, edid); ret = drm_add_edid_modes(&intel_encoder->base, edid);
intel_output->base.display_info.raw_edid = NULL; intel_encoder->base.display_info.raw_edid = NULL;
kfree(edid); kfree(edid);
} }
......
This diff is collapsed.
...@@ -921,8 +921,8 @@ intel_tv_save(struct drm_connector *connector) ...@@ -921,8 +921,8 @@ intel_tv_save(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
int i; int i;
tv_priv->save_TV_H_CTL_1 = I915_READ(TV_H_CTL_1); tv_priv->save_TV_H_CTL_1 = I915_READ(TV_H_CTL_1);
...@@ -971,8 +971,8 @@ intel_tv_restore(struct drm_connector *connector) ...@@ -971,8 +971,8 @@ intel_tv_restore(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
struct drm_crtc *crtc = connector->encoder->crtc; struct drm_crtc *crtc = connector->encoder->crtc;
struct intel_crtc *intel_crtc; struct intel_crtc *intel_crtc;
int i; int i;
...@@ -1068,9 +1068,9 @@ intel_tv_mode_lookup (char *tv_format) ...@@ -1068,9 +1068,9 @@ intel_tv_mode_lookup (char *tv_format)
} }
static const struct tv_mode * static const struct tv_mode *
intel_tv_mode_find (struct intel_output *intel_output) intel_tv_mode_find (struct intel_encoder *intel_encoder)
{ {
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
return intel_tv_mode_lookup(tv_priv->tv_format); return intel_tv_mode_lookup(tv_priv->tv_format);
} }
...@@ -1078,8 +1078,8 @@ intel_tv_mode_find (struct intel_output *intel_output) ...@@ -1078,8 +1078,8 @@ intel_tv_mode_find (struct intel_output *intel_output)
static enum drm_mode_status static enum drm_mode_status
intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
/* Ensure TV refresh is close to desired refresh */ /* Ensure TV refresh is close to desired refresh */
if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000) if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000)
...@@ -1095,8 +1095,8 @@ intel_tv_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, ...@@ -1095,8 +1095,8 @@ intel_tv_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_mode_config *drm_config = &dev->mode_config; struct drm_mode_config *drm_config = &dev->mode_config;
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
const struct tv_mode *tv_mode = intel_tv_mode_find (intel_output); const struct tv_mode *tv_mode = intel_tv_mode_find (intel_encoder);
struct drm_encoder *other_encoder; struct drm_encoder *other_encoder;
if (!tv_mode) if (!tv_mode)
...@@ -1121,9 +1121,9 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ...@@ -1121,9 +1121,9 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
struct intel_output *intel_output = enc_to_intel_output(encoder); struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
u32 tv_ctl; u32 tv_ctl;
u32 hctl1, hctl2, hctl3; u32 hctl1, hctl2, hctl3;
u32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7; u32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7;
...@@ -1360,9 +1360,9 @@ static const struct drm_display_mode reported_modes[] = { ...@@ -1360,9 +1360,9 @@ static const struct drm_display_mode reported_modes[] = {
* \return false if TV is disconnected. * \return false if TV is disconnected.
*/ */
static int static int
intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output) intel_tv_detect_type (struct drm_crtc *crtc, struct intel_encoder *intel_encoder)
{ {
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long irqflags; unsigned long irqflags;
...@@ -1441,9 +1441,9 @@ intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output) ...@@ -1441,9 +1441,9 @@ intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output)
*/ */
static void intel_tv_find_better_format(struct drm_connector *connector) static void intel_tv_find_better_format(struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
int i; int i;
if ((tv_priv->type == DRM_MODE_CONNECTOR_Component) == if ((tv_priv->type == DRM_MODE_CONNECTOR_Component) ==
...@@ -1475,9 +1475,9 @@ intel_tv_detect(struct drm_connector *connector) ...@@ -1475,9 +1475,9 @@ intel_tv_detect(struct drm_connector *connector)
{ {
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_display_mode mode; struct drm_display_mode mode;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
int dpms_mode; int dpms_mode;
int type = tv_priv->type; int type = tv_priv->type;
...@@ -1485,12 +1485,12 @@ intel_tv_detect(struct drm_connector *connector) ...@@ -1485,12 +1485,12 @@ intel_tv_detect(struct drm_connector *connector)
drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V); drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V);
if (encoder->crtc && encoder->crtc->enabled) { if (encoder->crtc && encoder->crtc->enabled) {
type = intel_tv_detect_type(encoder->crtc, intel_output); type = intel_tv_detect_type(encoder->crtc, intel_encoder);
} else { } else {
crtc = intel_get_load_detect_pipe(intel_output, &mode, &dpms_mode); crtc = intel_get_load_detect_pipe(intel_encoder, &mode, &dpms_mode);
if (crtc) { if (crtc) {
type = intel_tv_detect_type(crtc, intel_output); type = intel_tv_detect_type(crtc, intel_encoder);
intel_release_load_detect_pipe(intel_output, dpms_mode); intel_release_load_detect_pipe(intel_encoder, dpms_mode);
} else } else
type = -1; type = -1;
} }
...@@ -1525,8 +1525,8 @@ static void ...@@ -1525,8 +1525,8 @@ static void
intel_tv_chose_preferred_modes(struct drm_connector *connector, intel_tv_chose_preferred_modes(struct drm_connector *connector,
struct drm_display_mode *mode_ptr) struct drm_display_mode *mode_ptr)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480) if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480)
mode_ptr->type |= DRM_MODE_TYPE_PREFERRED; mode_ptr->type |= DRM_MODE_TYPE_PREFERRED;
...@@ -1550,8 +1550,8 @@ static int ...@@ -1550,8 +1550,8 @@ static int
intel_tv_get_modes(struct drm_connector *connector) intel_tv_get_modes(struct drm_connector *connector)
{ {
struct drm_display_mode *mode_ptr; struct drm_display_mode *mode_ptr;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
int j, count = 0; int j, count = 0;
u64 tmp; u64 tmp;
...@@ -1604,11 +1604,11 @@ intel_tv_get_modes(struct drm_connector *connector) ...@@ -1604,11 +1604,11 @@ intel_tv_get_modes(struct drm_connector *connector)
static void static void
intel_tv_destroy (struct drm_connector *connector) intel_tv_destroy (struct drm_connector *connector)
{ {
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
drm_sysfs_connector_remove(connector); drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
kfree(intel_output); kfree(intel_encoder);
} }
...@@ -1617,9 +1617,9 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop ...@@ -1617,9 +1617,9 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop
uint64_t val) uint64_t val)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct intel_output *intel_output = to_intel_output(connector); struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct intel_tv_priv *tv_priv = intel_output->dev_priv; struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
struct drm_encoder *encoder = &intel_output->enc; struct drm_encoder *encoder = &intel_encoder->enc;
struct drm_crtc *crtc = encoder->crtc; struct drm_crtc *crtc = encoder->crtc;
int ret = 0; int ret = 0;
bool changed = false; bool changed = false;
...@@ -1740,7 +1740,7 @@ intel_tv_init(struct drm_device *dev) ...@@ -1740,7 +1740,7 @@ intel_tv_init(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_connector *connector; struct drm_connector *connector;
struct intel_output *intel_output; struct intel_encoder *intel_encoder;
struct intel_tv_priv *tv_priv; struct intel_tv_priv *tv_priv;
u32 tv_dac_on, tv_dac_off, save_tv_dac; u32 tv_dac_on, tv_dac_off, save_tv_dac;
char **tv_format_names; char **tv_format_names;
...@@ -1780,28 +1780,28 @@ intel_tv_init(struct drm_device *dev) ...@@ -1780,28 +1780,28 @@ intel_tv_init(struct drm_device *dev)
(tv_dac_off & TVDAC_STATE_CHG_EN) != 0) (tv_dac_off & TVDAC_STATE_CHG_EN) != 0)
return; return;
intel_output = kzalloc(sizeof(struct intel_output) + intel_encoder = kzalloc(sizeof(struct intel_encoder) +
sizeof(struct intel_tv_priv), GFP_KERNEL); sizeof(struct intel_tv_priv), GFP_KERNEL);
if (!intel_output) { if (!intel_encoder) {
return; return;
} }
connector = &intel_output->base; connector = &intel_encoder->base;
drm_connector_init(dev, connector, &intel_tv_connector_funcs, drm_connector_init(dev, connector, &intel_tv_connector_funcs,
DRM_MODE_CONNECTOR_SVIDEO); DRM_MODE_CONNECTOR_SVIDEO);
drm_encoder_init(dev, &intel_output->enc, &intel_tv_enc_funcs, drm_encoder_init(dev, &intel_encoder->enc, &intel_tv_enc_funcs,
DRM_MODE_ENCODER_TVDAC); DRM_MODE_ENCODER_TVDAC);
drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc);
tv_priv = (struct intel_tv_priv *)(intel_output + 1); tv_priv = (struct intel_tv_priv *)(intel_encoder + 1);
intel_output->type = INTEL_OUTPUT_TVOUT; intel_encoder->type = INTEL_OUTPUT_TVOUT;
intel_output->crtc_mask = (1 << 0) | (1 << 1); intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
intel_output->clone_mask = (1 << INTEL_TV_CLONE_BIT); intel_encoder->clone_mask = (1 << INTEL_TV_CLONE_BIT);
intel_output->enc.possible_crtcs = ((1 << 0) | (1 << 1)); intel_encoder->enc.possible_crtcs = ((1 << 0) | (1 << 1));
intel_output->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT); intel_encoder->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT);
intel_output->dev_priv = tv_priv; intel_encoder->dev_priv = tv_priv;
tv_priv->type = DRM_MODE_CONNECTOR_Unknown; tv_priv->type = DRM_MODE_CONNECTOR_Unknown;
/* BIOS margin values */ /* BIOS margin values */
...@@ -1812,7 +1812,7 @@ intel_tv_init(struct drm_device *dev) ...@@ -1812,7 +1812,7 @@ intel_tv_init(struct drm_device *dev)
tv_priv->tv_format = kstrdup(tv_modes[initial_mode].name, GFP_KERNEL); tv_priv->tv_format = kstrdup(tv_modes[initial_mode].name, GFP_KERNEL);
drm_encoder_helper_add(&intel_output->enc, &intel_tv_helper_funcs); drm_encoder_helper_add(&intel_encoder->enc, &intel_tv_helper_funcs);
drm_connector_helper_add(connector, &intel_tv_connector_helper_funcs); drm_connector_helper_add(connector, &intel_tv_connector_helper_funcs);
connector->interlace_allowed = false; connector->interlace_allowed = false;
connector->doublescan_allowed = false; connector->doublescan_allowed = false;
......
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