Subversion Repositories Kolibri OS

Rev

Rev 2342 | Rev 3243 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2342 Rev 3031
Line 25... Line 25...
25
 
25
 
26
#include 
26
#include 
27
#include 
27
#include 
28
#include 
28
#include 
29
#include 
29
#include 
-
 
30
#include 
30
#include "drmP.h"
31
#include 
31
#include "intel_drv.h"
32
#include "intel_drv.h"
Line 32... Line 33...
32
#include "i915_drv.h"
33
#include "i915_drv.h"
-
 
34
 
33
 
35
/**
34
/**
-
 
-
 
36
 * intel_connector_update_modes - update connector from edid
35
 * intel_ddc_probe
37
 * @connector: DRM connector device to use
36
 *
38
 * @edid: previously read EDID information
-
 
39
 */
37
 */
40
int intel_connector_update_modes(struct drm_connector *connector,
38
bool intel_ddc_probe(struct intel_encoder *intel_encoder, int ddc_bus)
-
 
39
{
-
 
40
	struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
41
				struct edid *edid)
41
	u8 out_buf[] = { 0x0, 0x0};
-
 
42
	u8 buf[2];
-
 
43
	struct i2c_msg msgs[] = {
-
 
44
		{
-
 
45
			.addr = 0x50,
-
 
46
			.flags = 0,
-
 
47
			.len = 1,
-
 
48
			.buf = out_buf,
-
 
49
		},
-
 
50
		{
-
 
51
			.addr = 0x50,
-
 
52
			.flags = I2C_M_RD,
-
 
53
			.len = 1,
-
 
54
			.buf = buf,
-
 
Line -... Line 42...
-
 
42
{
55
		}
43
	int ret;
-
 
44
 
-
 
45
	drm_mode_connector_update_edid_property(connector, edid);
-
 
46
	ret = drm_add_edid_modes(connector, edid);
-
 
47
	drm_edid_to_eld(connector, edid);
56
	};
48
	kfree(edid);
Line 57... Line 49...
57
 
49
 
58
	return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 2) == 2;
50
	return ret;
59
}
51
}
Line 67... Line 59...
67
 */
59
 */
68
int intel_ddc_get_modes(struct drm_connector *connector,
60
int intel_ddc_get_modes(struct drm_connector *connector,
69
			struct i2c_adapter *adapter)
61
			struct i2c_adapter *adapter)
70
{
62
{
71
	struct edid *edid;
63
	struct edid *edid;
72
	int ret = 0;
-
 
Line 73... Line 64...
73
 
64
 
74
	edid = drm_get_edid(connector, adapter);
65
	edid = drm_get_edid(connector, adapter);
75
	if (edid) {
-
 
76
		drm_mode_connector_update_edid_property(connector, edid);
-
 
77
		ret = drm_add_edid_modes(connector, edid);
-
 
78
		drm_edid_to_eld(connector, edid);
-
 
79
		connector->display_info.raw_edid = NULL;
66
	if (!edid)
80
		kfree(edid);
-
 
Line 81... Line 67...
81
	}
67
		return 0;
82
 
68
 
Line 83... Line 69...
83
	return ret;
69
	return intel_connector_update_modes(connector, edid);
-
 
70
}
84
}
71
 
85
 
72
static const struct drm_prop_enum_list force_audio_names[] = {
86
static const char *force_audio_names[] = {
73
	{ HDMI_AUDIO_OFF_DVI, "force-dvi" },
87
	"off",
74
	{ HDMI_AUDIO_OFF, "off" },
Line 88... Line 75...
88
	"auto",
75
	{ HDMI_AUDIO_AUTO, "auto" },
89
	"on",
76
	{ HDMI_AUDIO_ON, "on" },
90
};
77
};
91
 
78
 
92
void
79
void
93
intel_attach_force_audio_property(struct drm_connector *connector)
80
intel_attach_force_audio_property(struct drm_connector *connector)
94
{
-
 
95
	struct drm_device *dev = connector->dev;
81
{
96
	struct drm_i915_private *dev_priv = dev->dev_private;
82
	struct drm_device *dev = connector->dev;
97
	struct drm_property *prop;
83
	struct drm_i915_private *dev_priv = dev->dev_private;
98
	int i;
84
	struct drm_property *prop;
99
#if 0
85
#if 0
-
 
86
	prop = dev_priv->force_audio_property;
100
	prop = dev_priv->force_audio_property;
87
	if (prop == NULL) {
101
	if (prop == NULL) {
88
		prop = drm_property_create_enum(dev, 0,
102
		prop = drm_property_create(dev, DRM_MODE_PROP_ENUM,
89
					   "audio",
Line 103... Line -...
103
					   "audio",
-
 
104
					   ARRAY_SIZE(force_audio_names));
-
 
105
		if (prop == NULL)
-
 
106
			return;
90
					   force_audio_names,
107
 
91
					   ARRAY_SIZE(force_audio_names));
108
		for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
92
		if (prop == NULL)
109
			drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
93
			return;
110
 
94
 
Line 111... Line 95...
111
		dev_priv->force_audio_property = prop;
95
		dev_priv->force_audio_property = prop;
112
	}
96
	}
113
	drm_connector_attach_property(connector, prop, 0);
97
	drm_connector_attach_property(connector, prop, 0);
114
#endif
98
#endif
Line 115... Line 99...
115
}
99
}
116
 
100
 
117
static const char *broadcast_rgb_names[] = {
101
static const struct drm_prop_enum_list broadcast_rgb_names[] = {
118
	"Full",
102
	{ 0, "Full" },
119
	"Limited 16:235",
103
	{ 1, "Limited 16:235" },
120
};
104
};
121
 
-
 
122
void
105
 
123
intel_attach_broadcast_rgb_property(struct drm_connector *connector)
106
void
124
{
107
intel_attach_broadcast_rgb_property(struct drm_connector *connector)
125
	struct drm_device *dev = connector->dev;
108
{
126
	struct drm_i915_private *dev_priv = dev->dev_private;
109
	struct drm_device *dev = connector->dev;
-
 
110
	struct drm_i915_private *dev_priv = dev->dev_private;
127
	struct drm_property *prop;
111
	struct drm_property *prop;
128
	int i;
112
#if 0
129
#if 0
113
	prop = dev_priv->broadcast_rgb_property;
Line 130... Line -...
130
	prop = dev_priv->broadcast_rgb_property;
-
 
131
	if (prop == NULL) {
-
 
132
		prop = drm_property_create(dev, DRM_MODE_PROP_ENUM,
-
 
133
					   "Broadcast RGB",
114
	if (prop == NULL) {
134
					   ARRAY_SIZE(broadcast_rgb_names));
115
		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
Line 135... Line 116...
135
		if (prop == NULL)
116
					   "Broadcast RGB",
136
			return;
117
					   broadcast_rgb_names,