/* * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> * Copyright (c) 2007, 2010 Intel Corporation * Jesse Barnes <jesse.barnes@intel.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE.
*/
/* Grab the locks before changing connector property*/
mutex_lock(&display->drm->mode_config.mutex); /* Set connector link status to BAD and send a Uevent to notify * userspace to do a modeset.
*/
drm_connector_set_link_status_property(&connector->base,
DRM_MODE_LINK_STATUS_BAD);
mutex_unlock(&display->drm->mode_config.mutex); /* Send Hotplug uevent so userspace can reprobe */
drm_kms_helper_connector_hotplug_event(&connector->base);
drm_connector_get(&connector->base); if (!queue_work(display->wq.unordered, &connector->modeset_retry_work))
drm_connector_put(&connector->base);
}
void intel_connector_cancel_modeset_retry_work(struct intel_connector *connector)
{ if (cancel_work_sync(&connector->modeset_retry_work))
drm_connector_put(&connector->base);
}
int intel_connector_init(struct intel_connector *connector)
{ struct intel_digital_connector_state *conn_state;
/* * Allocate enough memory to hold intel_digital_connector_state, * This might be a few bytes too many, but for connectors that don't * need it we'll free the state and allocate a smaller one on the first * successful commit anyway.
*/
conn_state = kzalloc(sizeof(*conn_state), GFP_KERNEL); if (!conn_state) return -ENOMEM;
connector = kzalloc(sizeof(*connector), GFP_KERNEL); if (!connector) return NULL;
if (intel_connector_init(connector) < 0) {
kfree(connector); return NULL;
}
return connector;
}
/* * Free the bits allocated by intel_connector_alloc. * This should only be used after intel_connector_alloc has returned * successfully, and before drm_connector_init returns successfully. * Otherwise the destroy callbacks for the connector and the state should * take care of proper cleanup/free (see intel_connector_destroy).
*/ void intel_connector_free(struct intel_connector *connector)
{
kfree(to_intel_digital_connector_state(connector->base.state));
kfree(connector);
}
/* * Connector type independent destroy hook for drm_connector_funcs.
*/ void intel_connector_destroy(struct drm_connector *connector)
{ struct intel_connector *intel_connector = to_intel_connector(connector);
drm_edid_free(intel_connector->detect_edid);
intel_hdcp_cleanup(intel_connector);
intel_panel_fini(intel_connector);
drm_connector_cleanup(connector);
if (intel_connector->mst.port)
drm_dp_mst_put_port_malloc(intel_connector->mst.port);
kfree(connector);
}
int intel_connector_register(struct drm_connector *_connector)
{ struct intel_connector *connector = to_intel_connector(_connector); struct drm_i915_private *i915 = to_i915(_connector->dev); int ret;
ret = intel_panel_register(connector); if (ret) goto err;
if (i915_inject_probe_failure(i915)) {
ret = -EFAULT; goto err_panel;
}
/* * Simple connector->get_hw_state implementation for encoders that support only * one connector and no cloning and hence the encoder state determines the state * of the connector.
*/ bool intel_connector_get_hw_state(struct intel_connector *connector)
{ enum pipe pipe = 0; struct intel_encoder *encoder = intel_attached_encoder(connector);
/** * intel_connector_update_modes - update connector from edid * @connector: DRM connector device to use * @drm_edid: previously read EDID information
*/ int intel_connector_update_modes(struct drm_connector *connector, conststruct drm_edid *drm_edid)
{ int ret;
drm_edid_connector_update(connector, drm_edid);
ret = drm_edid_connector_add_modes(connector);
return ret;
}
/** * intel_ddc_get_modes - get modelist from monitor * @connector: DRM connector device to use * @ddc: DDC bus i2c adapter * * Fetch the EDID information from @connector using the DDC bus.
*/ int intel_ddc_get_modes(struct drm_connector *connector, struct i2c_adapter *ddc)
{ conststruct drm_edid *drm_edid; int ret;
drm_edid = drm_edid_read_ddc(connector, ddc); if (!drm_edid) return 0;
ret = intel_connector_update_modes(connector, drm_edid);
drm_edid_free(drm_edid);
/* On GMCH platforms borders are only possible on the LVDS port */ if (!HAS_GMCH(display) || connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
scaling_modes |= BIT(DRM_MODE_SCALE_CENTER);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.