2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 22:53:55 +08:00

drm/i915: Share the common force-audio property between connectors

Make the audio property creation routine common and share the single
property between the connectors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Chris Wilson 2011-05-12 22:17:24 +01:00 committed by Keith Packard
parent 4bce2da393
commit 3f43c48d33
6 changed files with 38 additions and 37 deletions

View File

@ -716,6 +716,7 @@ typedef struct drm_i915_private {
struct intel_fbdev *fbdev;
struct drm_property *broadcast_rgb_property;
struct drm_property *force_audio_property;
atomic_t forcewake_count;
} drm_i915_private_t;

View File

@ -59,8 +59,6 @@ struct intel_dp {
bool is_pch_edp;
uint8_t train_set[4];
uint8_t link_status[DP_LINK_STATUS_SIZE];
struct drm_property *force_audio_property;
};
/**
@ -1702,7 +1700,7 @@ intel_dp_set_property(struct drm_connector *connector,
if (ret)
return ret;
if (property == intel_dp->force_audio_property) {
if (property == dev_priv->force_audio_property) {
int i = val;
bool has_audio;
@ -1841,16 +1839,7 @@ bool intel_dpd_is_edp(struct drm_device *dev)
static void
intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
intel_dp->force_audio_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2);
if (intel_dp->force_audio_property) {
intel_dp->force_audio_property->values[0] = -1;
intel_dp->force_audio_property->values[1] = 1;
drm_connector_attach_property(connector, intel_dp->force_audio_property, 0);
}
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
}

View File

@ -236,6 +236,7 @@ struct intel_unpin_work {
int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
extern bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus);
extern void intel_attach_force_audio_property(struct drm_connector *connector);
extern void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
extern void intel_crt_init(struct drm_device *dev);

View File

@ -45,7 +45,6 @@ struct intel_hdmi {
bool has_hdmi_sink;
bool has_audio;
int force_audio;
struct drm_property *force_audio_property;
};
static struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder)
@ -287,7 +286,7 @@ intel_hdmi_set_property(struct drm_connector *connector,
if (ret)
return ret;
if (property == intel_hdmi->force_audio_property) {
if (property == dev_priv->force_audio_property) {
int i = val;
bool has_audio;
@ -365,16 +364,7 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = {
static void
intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
intel_hdmi->force_audio_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2);
if (intel_hdmi->force_audio_property) {
intel_hdmi->force_audio_property->values[0] = -1;
intel_hdmi->force_audio_property->values[1] = 1;
drm_connector_attach_property(connector, intel_hdmi->force_audio_property, 0);
}
intel_attach_force_audio_property(connector);
intel_attach_broadcast_rgb_property(connector);
}

View File

@ -81,6 +81,36 @@ int intel_ddc_get_modes(struct drm_connector *connector,
return ret;
}
static const char *force_audio_names[] = {
"off",
"auto",
"on",
};
void
intel_attach_force_audio_property(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_property *prop;
int i;
prop = dev_priv->force_audio_property;
if (prop == NULL) {
prop = drm_property_create(dev, DRM_MODE_PROP_ENUM,
"audio",
ARRAY_SIZE(force_audio_names));
if (prop == NULL)
return;
for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
dev_priv->force_audio_property = prop;
}
drm_connector_attach_property(connector, prop, 0);
}
static const char *broadcast_rgb_names[] = {
"Full",
"Limited 16:235",

View File

@ -148,8 +148,6 @@ struct intel_sdvo_connector {
int format_supported_num;
struct drm_property *tv_format;
struct drm_property *force_audio_property;
/* add the property for the SDVO-TV */
struct drm_property *left;
struct drm_property *right;
@ -1712,7 +1710,7 @@ intel_sdvo_set_property(struct drm_connector *connector,
if (ret)
return ret;
if (property == intel_sdvo_connector->force_audio_property) {
if (property == dev_priv->force_audio_property) {
int i = val;
bool has_audio;
@ -2037,15 +2035,7 @@ intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector)
{
struct drm_device *dev = connector->base.base.dev;
connector->force_audio_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE, "force_audio", 2);
if (connector->force_audio_property) {
connector->force_audio_property->values[0] = -1;
connector->force_audio_property->values[1] = 1;
drm_connector_attach_property(&connector->base.base,
connector->force_audio_property, 0);
}
intel_attach_force_audio_property(&connector->base.base);
if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev))
intel_attach_broadcast_rgb_property(&connector->base.base);
}