Skip to content

Commit

Permalink
drm/i915: Rename intel_output to intel_encoder.
Browse files Browse the repository at this point in the history
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: Eric Anholt <eric@anholt.net>
  • Loading branch information
Eric Anholt committed Mar 25, 2010
1 parent 5e64499 commit 21d40d3
Show file tree
Hide file tree
Showing 11 changed files with 663 additions and 663 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,10 @@ static void i915_hotplug_work_func(struct work_struct *work)

if (mode_config->num_connector) {
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)
(*intel_output->hot_plug) (intel_output);
if (intel_encoder->hot_plug)
(*intel_encoder->hot_plug) (intel_encoder);
}
}
/* Just fire off a uevent and let userspace tell us what to do */
Expand Down
68 changes: 34 additions & 34 deletions drivers/gpu/drm/i915/intel_crt.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,19 +246,19 @@ static bool intel_crt_detect_hotplug(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 */
if (intel_output->type != INTEL_OUTPUT_ANALOG)
if (intel_encoder->type != INTEL_OUTPUT_ANALOG)
return false;

return intel_ddc_probe(intel_output);
return intel_ddc_probe(intel_encoder);
}

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_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
Expand Down Expand Up @@ -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)
{
struct drm_device *dev = connector->dev;
struct intel_output *intel_output = to_intel_output(connector);
struct drm_encoder *encoder = &intel_output->enc;
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
struct drm_encoder *encoder = &intel_encoder->enc;
struct drm_crtc *crtc;
int dpms_mode;
enum drm_connector_status status;
Expand All @@ -404,13 +404,13 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto

/* for pre-945g platforms use load detect */
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 {
crtc = intel_get_load_detect_pipe(intel_output,
crtc = intel_get_load_detect_pipe(intel_encoder,
NULL, &dpms_mode);
if (crtc) {
status = intel_crt_load_detect(crtc, intel_output);
intel_release_load_detect_pipe(intel_output, dpms_mode);
status = intel_crt_load_detect(crtc, intel_encoder);
intel_release_load_detect_pipe(intel_encoder, dpms_mode);
} else
status = connector_status_unknown;
}
Expand All @@ -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)
{
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_connector_cleanup(connector);
kfree(connector);
Expand All @@ -431,28 +431,28 @@ static void intel_crt_destroy(struct drm_connector *connector)
static int intel_crt_get_modes(struct drm_connector *connector)
{
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 drm_device *dev = connector->dev;


ret = intel_ddc_get_modes(intel_output);
ret = intel_ddc_get_modes(intel_encoder);
if (ret || !IS_G4X(dev))
goto end;

ddcbus = intel_output->ddc_bus;
ddcbus = intel_encoder->ddc_bus;
/* 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");

if (!intel_output->ddc_bus) {
intel_output->ddc_bus = ddcbus;
if (!intel_encoder->ddc_bus) {
intel_encoder->ddc_bus = ddcbus;
dev_printk(KERN_ERR, &connector->dev->pdev->dev,
"DDC bus registration failed for CRTDDC_D.\n");
goto end;
}
/* 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);

end:
Expand Down Expand Up @@ -505,23 +505,23 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = {
void intel_crt_init(struct drm_device *dev)
{
struct drm_connector *connector;
struct intel_output *intel_output;
struct intel_encoder *intel_encoder;
struct drm_i915_private *dev_priv = dev->dev_private;
u32 i2c_reg;

intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
if (!intel_output)
intel_encoder = kzalloc(sizeof(struct intel_encoder), GFP_KERNEL);
if (!intel_encoder)
return;

connector = &intel_output->base;
drm_connector_init(dev, &intel_output->base,
connector = &intel_encoder->base;
drm_connector_init(dev, &intel_encoder->base,
&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_connector_attach_encoder(&intel_output->base,
&intel_output->enc);
drm_mode_connector_attach_encoder(&intel_encoder->base,
&intel_encoder->enc);

/* Set up the DDC bus. */
if (HAS_PCH_SPLIT(dev))
Expand All @@ -532,22 +532,22 @@ void intel_crt_init(struct drm_device *dev)
if (dev_priv->crt_ddc_bus != 0)
i2c_reg = dev_priv->crt_ddc_bus;
}
intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A");
if (!intel_output->ddc_bus) {
intel_encoder->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A");
if (!intel_encoder->ddc_bus) {
dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
"failed.\n");
return;
}

intel_output->type = INTEL_OUTPUT_ANALOG;
intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
intel_encoder->type = INTEL_OUTPUT_ANALOG;
intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
(1 << INTEL_ANALOG_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->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_sysfs_connector_add(connector);
Expand Down
46 changes: 23 additions & 23 deletions drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
if (l_entry->encoder &&
l_entry->encoder->crtc == crtc) {
struct intel_output *intel_output = to_intel_output(l_entry);
if (intel_output->type == type)
struct intel_encoder *intel_encoder = to_intel_encoder(l_entry);
if (intel_encoder->type == type)
return true;
}
}
Expand Down Expand Up @@ -2942,19 +2942,19 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
drm_vblank_pre_modeset(dev, pipe);

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)
continue;

switch (intel_output->type) {
switch (intel_encoder->type) {
case INTEL_OUTPUT_LVDS:
is_lvds = true;
break;
case INTEL_OUTPUT_SDVO:
case INTEL_OUTPUT_HDMI:
is_sdvo = true;
if (intel_output->needs_tv_clock)
if (intel_encoder->needs_tv_clock)
is_tv = true;
break;
case INTEL_OUTPUT_DVO:
Expand Down Expand Up @@ -3049,7 +3049,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
struct drm_connector *edp;
target_clock = mode->clock;
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);
} else {
/* DP over FDI requires target mode clock
Expand Down Expand Up @@ -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),
};

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,
int *dpms_mode)
{
struct intel_crtc *intel_crtc;
struct drm_crtc *possible_crtc;
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_device *dev = encoder->dev;
struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
Expand Down Expand Up @@ -3728,8 +3728,8 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
}

encoder->crtc = crtc;
intel_output->base.encoder = encoder;
intel_output->load_detect_temp = true;
intel_encoder->base.encoder = encoder;
intel_encoder->load_detect_temp = true;

intel_crtc = to_intel_crtc(crtc);
*dpms_mode = intel_crtc->dpms_mode;
Expand All @@ -3754,18 +3754,18 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
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_crtc *crtc = encoder->crtc;
struct drm_encoder_helper_funcs *encoder_funcs = encoder->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;
intel_output->base.encoder = NULL;
intel_output->load_detect_temp = false;
intel_encoder->base.encoder = NULL;
intel_encoder->load_detect_temp = false;
crtc->enabled = drm_helper_crtc_in_use(crtc);
drm_helper_disable_unused_functions(dev);
}
Expand Down Expand Up @@ -4398,8 +4398,8 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask)
int entry = 0;

list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct intel_output *intel_output = to_intel_output(connector);
if (type_mask & intel_output->clone_mask)
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
if (type_mask & intel_encoder->clone_mask)
index_mask |= (1 << entry);
entry++;
}
Expand Down Expand Up @@ -4494,12 +4494,12 @@ static void intel_setup_outputs(struct drm_device *dev)
intel_tv_init(dev);

list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
struct intel_output *intel_output = to_intel_output(connector);
struct drm_encoder *encoder = &intel_output->enc;
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
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,
intel_output->clone_mask);
intel_encoder->clone_mask);
}
}

Expand Down Expand Up @@ -4977,9 +4977,9 @@ void intel_modeset_cleanup(struct drm_device *dev)
*/
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;
}

/*
Expand Down
Loading

0 comments on commit 21d40d3

Please sign in to comment.