Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f43c48d authored by Chris Wilson's avatar Chris Wilson Committed by Keith Packard
Browse files

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: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
parent 4bce2da3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
+2 −13
Original line number Diff line number Diff line
@@ -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);
}

+1 −0
Original line number Diff line number Diff line
@@ -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);
+2 −12
Original line number Diff line number Diff line
@@ -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);
}

+30 −0
Original line number Diff line number Diff line
@@ -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",
Loading