Subversion Repositories Kolibri OS

Rev

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

Rev 3031 Rev 4104
Line 30... Line 30...
30
 
30
 
31
#define CH7xxx_REG_VID		0x4a
31
#define CH7xxx_REG_VID		0x4a
Line 32... Line 32...
32
#define CH7xxx_REG_DID		0x4b
32
#define CH7xxx_REG_DID		0x4b
-
 
33
 
33
 
34
#define CH7011_VID		0x83 /* 7010 as well */
34
#define CH7011_VID		0x83 /* 7010 as well */
35
#define CH7010B_VID		0x05
35
#define CH7009A_VID		0x84
36
#define CH7009A_VID		0x84
Line 36... Line 37...
36
#define CH7009B_VID		0x85
37
#define CH7009B_VID		0x85
37
#define CH7301_VID		0x95
38
#define CH7301_VID		0x95
-
 
39
 
Line 38... Line 40...
38
 
40
#define CH7xxx_VID		0x84
Line 39... Line 41...
39
#define CH7xxx_VID		0x84
41
#define CH7xxx_DID		0x17
40
#define CH7xxx_DID		0x17
42
#define CH7010_DID		0x16
Line 85... Line 87...
85
static struct ch7xxx_id_struct {
87
static struct ch7xxx_id_struct {
86
	uint8_t vid;
88
	uint8_t vid;
87
	char *name;
89
	char *name;
88
} ch7xxx_ids[] = {
90
} ch7xxx_ids[] = {
89
	{ CH7011_VID, "CH7011" },
91
	{ CH7011_VID, "CH7011" },
-
 
92
	{ CH7010B_VID, "CH7010B" },
90
	{ CH7009A_VID, "CH7009A" },
93
	{ CH7009A_VID, "CH7009A" },
91
	{ CH7009B_VID, "CH7009B" },
94
	{ CH7009B_VID, "CH7009B" },
92
	{ CH7301_VID, "CH7301" },
95
	{ CH7301_VID, "CH7301" },
93
};
96
};
Line -... Line 97...
-
 
97
 
-
 
98
static struct ch7xxx_did_struct {
-
 
99
	uint8_t did;
-
 
100
	char *name;
-
 
101
} ch7xxx_dids[] = {
-
 
102
	{ CH7xxx_DID, "CH7XXX" },
-
 
103
	{ CH7010_DID, "CH7010B" },
-
 
104
};
94
 
105
 
95
struct ch7xxx_priv {
106
struct ch7xxx_priv {
96
	bool quiet;
107
	bool quiet;
Line 97... Line 108...
97
};
108
};
Line 106... Line 117...
106
	}
117
	}
Line 107... Line 118...
107
 
118
 
108
	return NULL;
119
	return NULL;
Line -... Line 120...
-
 
120
}
-
 
121
 
-
 
122
static char *ch7xxx_get_did(uint8_t did)
-
 
123
{
-
 
124
	int i;
-
 
125
 
-
 
126
	for (i = 0; i < ARRAY_SIZE(ch7xxx_dids); i++) {
-
 
127
		if (ch7xxx_dids[i].did == did)
-
 
128
			return ch7xxx_dids[i].name;
-
 
129
	}
-
 
130
 
-
 
131
	return NULL;
109
}
132
}
110
 
133
 
111
/** Reads an 8 bit register */
134
/** Reads an 8 bit register */
112
static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
135
static bool ch7xxx_readb(struct intel_dvo_device *dvo, int addr, uint8_t *ch)
113
{
136
{
Line 177... Line 200...
177
			struct i2c_adapter *adapter)
200
			struct i2c_adapter *adapter)
178
{
201
{
179
	/* this will detect the CH7xxx chip on the specified i2c bus */
202
	/* this will detect the CH7xxx chip on the specified i2c bus */
180
	struct ch7xxx_priv *ch7xxx;
203
	struct ch7xxx_priv *ch7xxx;
181
	uint8_t vendor, device;
204
	uint8_t vendor, device;
182
	char *name;
205
	char *name, *devid;
Line 183... Line 206...
183
 
206
 
184
	ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL);
207
	ch7xxx = kzalloc(sizeof(struct ch7xxx_priv), GFP_KERNEL);
185
	if (ch7xxx == NULL)
208
	if (ch7xxx == NULL)
Line 202... Line 225...
202
 
225
 
203
 
226
 
Line -... Line 227...
-
 
227
	if (!ch7xxx_readb(dvo, CH7xxx_REG_DID, &device))
204
	if (!ch7xxx_readb(dvo, CH7xxx_REG_DID, &device))
228
		goto out;
205
		goto out;
229
 
206
 
230
	devid = ch7xxx_get_did(device);
207
	if (device != CH7xxx_DID) {
231
	if (!devid) {
208
		DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s "
232
		DRM_DEBUG_KMS("ch7xxx not detected; got 0x%02x from %s "
209
				"slave %d.\n",
233
				"slave %d.\n",
Line 281... Line 305...
281
	idf &= ~(CH7xxx_IDF_HSP | CH7xxx_IDF_VSP);
305
	idf &= ~(CH7xxx_IDF_HSP | CH7xxx_IDF_VSP);
282
	if (mode->flags & DRM_MODE_FLAG_PHSYNC)
306
	if (mode->flags & DRM_MODE_FLAG_PHSYNC)
283
		idf |= CH7xxx_IDF_HSP;
307
		idf |= CH7xxx_IDF_HSP;
Line 284... Line 308...
284
 
308
 
285
	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
309
	if (mode->flags & DRM_MODE_FLAG_PVSYNC)
Line 286... Line 310...
286
		idf |= CH7xxx_IDF_HSP;
310
		idf |= CH7xxx_IDF_VSP;
287
 
311
 
Line 288... Line 312...
288
	ch7xxx_writeb(dvo, CH7xxx_IDF, idf);
312
	ch7xxx_writeb(dvo, CH7xxx_IDF, idf);