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: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -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_crtc *crtc = encoder->crtc;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
struct intel_output *intel_output = enc_to_intel_output(encoder);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
|
||||
struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
|
||||
u32 sdvox;
|
||||
|
||||
sdvox = SDVO_ENCODING_HDMI |
|
||||
@@ -73,8 +73,8 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
|
||||
{
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_output *intel_output = enc_to_intel_output(encoder);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
|
||||
struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
|
||||
u32 temp;
|
||||
|
||||
temp = I915_READ(hdmi_priv->sdvox_reg);
|
||||
@@ -109,8 +109,8 @@ static void intel_hdmi_save(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
|
||||
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
|
||||
|
||||
hdmi_priv->save_SDVOX = I915_READ(hdmi_priv->sdvox_reg);
|
||||
}
|
||||
@@ -119,8 +119,8 @@ static void intel_hdmi_restore(struct drm_connector *connector)
|
||||
{
|
||||
struct drm_device *dev = connector->dev;
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
|
||||
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
|
||||
|
||||
I915_WRITE(hdmi_priv->sdvox_reg, hdmi_priv->save_SDVOX);
|
||||
POSTING_READ(hdmi_priv->sdvox_reg);
|
||||
@@ -150,21 +150,21 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
|
||||
static enum drm_connector_status
|
||||
intel_hdmi_detect(struct drm_connector *connector)
|
||||
{
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
|
||||
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
|
||||
struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
|
||||
struct edid *edid = NULL;
|
||||
enum drm_connector_status status = connector_status_disconnected;
|
||||
|
||||
hdmi_priv->has_hdmi_sink = false;
|
||||
edid = drm_get_edid(&intel_output->base,
|
||||
intel_output->ddc_bus);
|
||||
edid = drm_get_edid(&intel_encoder->base,
|
||||
intel_encoder->ddc_bus);
|
||||
|
||||
if (edid) {
|
||||
if (edid->input & DRM_EDID_INPUT_DIGITAL) {
|
||||
status = connector_status_connected;
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -173,24 +173,24 @@ intel_hdmi_detect(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 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)
|
||||
{
|
||||
struct intel_output *intel_output = to_intel_output(connector);
|
||||
struct intel_encoder *intel_encoder = to_intel_encoder(connector);
|
||||
|
||||
if (intel_output->i2c_bus)
|
||||
intel_i2c_destroy(intel_output->i2c_bus);
|
||||
if (intel_encoder->i2c_bus)
|
||||
intel_i2c_destroy(intel_encoder->i2c_bus);
|
||||
drm_sysfs_connector_remove(connector);
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(intel_output);
|
||||
kfree(intel_encoder);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||
struct drm_connector *connector;
|
||||
struct intel_output *intel_output;
|
||||
struct intel_encoder *intel_encoder;
|
||||
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);
|
||||
if (!intel_output)
|
||||
if (!intel_encoder)
|
||||
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_MODE_CONNECTOR_HDMIA);
|
||||
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->doublescan_allowed = 0;
|
||||
intel_output->crtc_mask = (1 << 0) | (1 << 1);
|
||||
intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
|
||||
|
||||
/* Set up the DDC bus. */
|
||||
if (sdvox_reg == SDVOB) {
|
||||
intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT);
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
|
||||
intel_encoder->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT);
|
||||
intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
|
||||
dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
|
||||
} else if (sdvox_reg == SDVOC) {
|
||||
intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT);
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
|
||||
intel_encoder->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT);
|
||||
intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
|
||||
dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
|
||||
} else if (sdvox_reg == HDMIB) {
|
||||
intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT);
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
|
||||
intel_encoder->clone_mask = (1 << INTEL_HDMID_CLONE_BIT);
|
||||
intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
|
||||
"HDMIB");
|
||||
dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
|
||||
} else if (sdvox_reg == HDMIC) {
|
||||
intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT);
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
|
||||
intel_encoder->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT);
|
||||
intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
|
||||
"HDMIC");
|
||||
dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
|
||||
} else if (sdvox_reg == HDMID) {
|
||||
intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT);
|
||||
intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
|
||||
intel_encoder->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT);
|
||||
intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
|
||||
"HDMID");
|
||||
dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
|
||||
}
|
||||
if (!intel_output->ddc_bus)
|
||||
if (!intel_encoder->ddc_bus)
|
||||
goto err_connector;
|
||||
|
||||
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_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,
|
||||
&intel_output->enc);
|
||||
drm_mode_connector_attach_encoder(&intel_encoder->base,
|
||||
&intel_encoder->enc);
|
||||
drm_sysfs_connector_add(connector);
|
||||
|
||||
/* 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)
|
||||
|
||||
err_connector:
|
||||
drm_connector_cleanup(connector);
|
||||
kfree(intel_output);
|
||||
kfree(intel_encoder);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user