Subversion Repositories Kolibri OS

Rev

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

Rev 4559 Rev 5056
Line 35... Line 35...
35
 * Abbreviations, in chronological order:
35
 * Abbreviations, in chronological order:
36
 *
36
 *
37
 * eDP: Embedded DisplayPort version 1
37
 * eDP: Embedded DisplayPort version 1
38
 * DPI: DisplayPort Interoperability Guideline v1.1a
38
 * DPI: DisplayPort Interoperability Guideline v1.1a
39
 * 1.2: DisplayPort 1.2
39
 * 1.2: DisplayPort 1.2
-
 
40
 * MST: Multistream Transport - part of DP 1.2a
40
 *
41
 *
41
 * 1.2 formally includes both eDP and DPI definitions.
42
 * 1.2 formally includes both eDP and DPI definitions.
42
 */
43
 */
Line 43... Line 44...
43
 
44
 
Line 101... Line 102...
101
 
102
 
102
#define DP_EDP_CONFIGURATION_CAP            0x00d   /* XXX 1.2? */
103
#define DP_EDP_CONFIGURATION_CAP            0x00d   /* XXX 1.2? */
Line 103... Line 104...
103
#define DP_TRAINING_AUX_RD_INTERVAL         0x00e   /* XXX 1.2? */
104
#define DP_TRAINING_AUX_RD_INTERVAL         0x00e   /* XXX 1.2? */
-
 
105
 
-
 
106
/* Multiple stream transport */
-
 
107
#define DP_FAUX_CAP			    0x020   /* 1.2 */
104
 
108
# define DP_FAUX_CAP_1			    (1 << 0)
105
/* Multiple stream transport */
109
 
Line -... Line 110...
-
 
110
#define DP_MSTM_CAP			    0x021   /* 1.2 */
-
 
111
# define DP_MST_CAP			    (1 << 0)
106
#define DP_MSTM_CAP			    0x021   /* 1.2 */
112
 
107
# define DP_MST_CAP			    (1 << 0)
113
#define DP_GUID				    0x030   /* 1.2 */
108
 
114
 
109
#define DP_PSR_SUPPORT                      0x070   /* XXX 1.2? */
115
#define DP_PSR_SUPPORT                      0x070   /* XXX 1.2? */
110
# define DP_PSR_IS_SUPPORTED                1
116
# define DP_PSR_IS_SUPPORTED                1
Line 219... Line 225...
219
# define DP_PSR_ENABLE			    (1 << 0)
225
# define DP_PSR_ENABLE			    (1 << 0)
220
# define DP_PSR_MAIN_LINK_ACTIVE	    (1 << 1)
226
# define DP_PSR_MAIN_LINK_ACTIVE	    (1 << 1)
221
# define DP_PSR_CRC_VERIFICATION	    (1 << 2)
227
# define DP_PSR_CRC_VERIFICATION	    (1 << 2)
222
# define DP_PSR_FRAME_CAPTURE		    (1 << 3)
228
# define DP_PSR_FRAME_CAPTURE		    (1 << 3)
Line -... Line 229...
-
 
229
 
-
 
230
#define DP_ADAPTER_CTRL			    0x1a0
-
 
231
# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE   (1 << 0)
-
 
232
 
-
 
233
#define DP_BRANCH_DEVICE_CTRL		    0x1a1
-
 
234
# define DP_BRANCH_DEVICE_IRQ_HPD	    (1 << 0)
-
 
235
 
-
 
236
#define DP_PAYLOAD_ALLOCATE_SET		    0x1c0
-
 
237
#define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1
-
 
238
#define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2
223
 
239
 
224
#define DP_SINK_COUNT			    0x200
240
#define DP_SINK_COUNT			    0x200
225
/* prior to 1.2 bit 7 was reserved mbz */
241
/* prior to 1.2 bit 7 was reserved mbz */
226
# define DP_GET_SINK_COUNT(x)		    ((((x) & 0x80) >> 1) | ((x) & 0x3f))
242
# define DP_GET_SINK_COUNT(x)		    ((((x) & 0x80) >> 1) | ((x) & 0x3f))
Line 227... Line 243...
227
# define DP_SINK_CP_READY		    (1 << 6)
243
# define DP_SINK_CP_READY		    (1 << 6)
228
 
244
 
229
#define DP_DEVICE_SERVICE_IRQ_VECTOR	    0x201
245
#define DP_DEVICE_SERVICE_IRQ_VECTOR	    0x201
230
# define DP_REMOTE_CONTROL_COMMAND_PENDING  (1 << 0)
246
# define DP_REMOTE_CONTROL_COMMAND_PENDING  (1 << 0)
-
 
247
# define DP_AUTOMATED_TEST_REQUEST	    (1 << 1)
-
 
248
# define DP_CP_IRQ			    (1 << 2)
-
 
249
# define DP_MCCS_IRQ			    (1 << 3)
231
# define DP_AUTOMATED_TEST_REQUEST	    (1 << 1)
250
# define DP_DOWN_REP_MSG_RDY		    (1 << 4) /* 1.2 MST */
Line 232... Line 251...
232
# define DP_CP_IRQ			    (1 << 2)
251
# define DP_UP_REQ_MSG_RDY		    (1 << 5) /* 1.2 MST */
233
# define DP_SINK_SPECIFIC_IRQ		    (1 << 6)
252
# define DP_SINK_SPECIFIC_IRQ		    (1 << 6)
234
 
253
 
Line 277... Line 296...
277
 
296
 
Line 278... Line 297...
278
#define DP_TEST_LANE_COUNT		    0x220
297
#define DP_TEST_LANE_COUNT		    0x220
Line -... Line 298...
-
 
298
 
-
 
299
#define DP_TEST_PATTERN			    0x221
-
 
300
 
-
 
301
#define DP_TEST_CRC_R_CR		    0x240
-
 
302
#define DP_TEST_CRC_G_Y			    0x242
-
 
303
#define DP_TEST_CRC_B_CB		    0x244
-
 
304
 
279
 
305
#define DP_TEST_SINK_MISC		    0x246
280
#define DP_TEST_PATTERN			    0x221
306
#define DP_TEST_CRC_SUPPORTED		    (1 << 5)
281
 
307
 
282
#define DP_TEST_RESPONSE		    0x260
308
#define DP_TEST_RESPONSE		    0x260
Line -... Line 309...
-
 
309
# define DP_TEST_ACK			    (1 << 0)
-
 
310
# define DP_TEST_NAK			    (1 << 1)
-
 
311
# define DP_TEST_EDID_CHECKSUM_WRITE	    (1 << 2)
-
 
312
 
-
 
313
#define DP_TEST_EDID_CHECKSUM		    0x261
-
 
314
 
-
 
315
#define DP_TEST_SINK			    0x270
-
 
316
#define DP_TEST_SINK_START	    (1 << 0)
-
 
317
 
-
 
318
#define DP_PAYLOAD_TABLE_UPDATE_STATUS      0x2c0   /* 1.2 MST */
-
 
319
# define DP_PAYLOAD_TABLE_UPDATED           (1 << 0)
-
 
320
# define DP_PAYLOAD_ACT_HANDLED             (1 << 1)
283
# define DP_TEST_ACK			    (1 << 0)
321
 
284
# define DP_TEST_NAK			    (1 << 1)
322
#define DP_VC_PAYLOAD_ID_SLOT_1             0x2c1   /* 1.2 MST */
285
# define DP_TEST_EDID_CHECKSUM_WRITE	    (1 << 2)
323
/* up to ID_SLOT_63 at 0x2ff */
Line 286... Line 324...
286
 
324
 
287
#define DP_SOURCE_OUI			    0x300
325
#define DP_SOURCE_OUI			    0x300
288
#define DP_SINK_OUI			    0x400
326
#define DP_SINK_OUI			    0x400
-
 
327
#define DP_BRANCH_OUI			    0x500
-
 
328
 
-
 
329
#define DP_SET_POWER                        0x600
-
 
330
# define DP_SET_POWER_D0                    0x1
-
 
331
# define DP_SET_POWER_D3                    0x2
-
 
332
# define DP_SET_POWER_MASK                  0x3
-
 
333
 
-
 
334
#define DP_SIDEBAND_MSG_DOWN_REQ_BASE	    0x1000   /* 1.2 MST */
-
 
335
#define DP_SIDEBAND_MSG_UP_REP_BASE	    0x1200   /* 1.2 MST */
-
 
336
#define DP_SIDEBAND_MSG_DOWN_REP_BASE	    0x1400   /* 1.2 MST */
-
 
337
#define DP_SIDEBAND_MSG_UP_REQ_BASE	    0x1600   /* 1.2 MST */
-
 
338
 
-
 
339
#define DP_SINK_COUNT_ESI		    0x2002   /* 1.2 */
-
 
340
/* 0-5 sink count */
-
 
341
# define DP_SINK_COUNT_CP_READY             (1 << 6)
-
 
342
 
Line 289... Line 343...
289
#define DP_BRANCH_OUI			    0x500
343
#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0   0x2003   /* 1.2 */
290
 
344
 
291
#define DP_SET_POWER                        0x600
345
#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1   0x2004   /* 1.2 */
Line 306... Line 360...
306
# define DP_PSR_SINK_ACTIVE_SINK_SYNCED     3
360
# define DP_PSR_SINK_ACTIVE_SINK_SYNCED     3
307
# define DP_PSR_SINK_ACTIVE_RESYNC          4
361
# define DP_PSR_SINK_ACTIVE_RESYNC          4
308
# define DP_PSR_SINK_INTERNAL_ERROR         7
362
# define DP_PSR_SINK_INTERNAL_ERROR         7
309
# define DP_PSR_SINK_STATE_MASK             0x07
363
# define DP_PSR_SINK_STATE_MASK             0x07
Line -... Line 364...
-
 
364
 
-
 
365
/* DP 1.2 Sideband message defines */
-
 
366
/* peer device type - DP 1.2a Table 2-92 */
-
 
367
#define DP_PEER_DEVICE_NONE		0x0
-
 
368
#define DP_PEER_DEVICE_SOURCE_OR_SST	0x1
-
 
369
#define DP_PEER_DEVICE_MST_BRANCHING	0x2
-
 
370
#define DP_PEER_DEVICE_SST_SINK		0x3
-
 
371
#define DP_PEER_DEVICE_DP_LEGACY_CONV	0x4
-
 
372
 
-
 
373
/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */
-
 
374
#define DP_LINK_ADDRESS			0x01
-
 
375
#define DP_CONNECTION_STATUS_NOTIFY	0x02
-
 
376
#define DP_ENUM_PATH_RESOURCES		0x10
-
 
377
#define DP_ALLOCATE_PAYLOAD		0x11
-
 
378
#define DP_QUERY_PAYLOAD		0x12
-
 
379
#define DP_RESOURCE_STATUS_NOTIFY	0x13
-
 
380
#define DP_CLEAR_PAYLOAD_ID_TABLE	0x14
-
 
381
#define DP_REMOTE_DPCD_READ		0x20
-
 
382
#define DP_REMOTE_DPCD_WRITE		0x21
-
 
383
#define DP_REMOTE_I2C_READ		0x22
-
 
384
#define DP_REMOTE_I2C_WRITE		0x23
-
 
385
#define DP_POWER_UP_PHY			0x24
-
 
386
#define DP_POWER_DOWN_PHY		0x25
-
 
387
#define DP_SINK_EVENT_NOTIFY		0x30
-
 
388
#define DP_QUERY_STREAM_ENC_STATUS	0x38
-
 
389
 
-
 
390
/* DP 1.2 MST sideband nak reasons - table 2.84 */
-
 
391
#define DP_NAK_WRITE_FAILURE		0x01
-
 
392
#define DP_NAK_INVALID_READ		0x02
-
 
393
#define DP_NAK_CRC_FAILURE		0x03
-
 
394
#define DP_NAK_BAD_PARAM		0x04
-
 
395
#define DP_NAK_DEFER			0x05
-
 
396
#define DP_NAK_LINK_FAILURE		0x06
-
 
397
#define DP_NAK_NO_RESOURCES		0x07
-
 
398
#define DP_NAK_DPCD_FAIL		0x08
-
 
399
#define DP_NAK_I2C_NAK			0x09
-
 
400
#define DP_NAK_ALLOCATE_FAIL		0x0a
310
 
401
 
311
#define MODE_I2C_START	1
402
#define MODE_I2C_START	1
312
#define MODE_I2C_WRITE	2
403
#define MODE_I2C_WRITE	2
313
#define MODE_I2C_READ	4
404
#define MODE_I2C_READ	4
Line 396... Line 487...
396
{
487
{
397
	return dpcd[DP_DPCD_REV] >= 0x11 &&
488
	return dpcd[DP_DPCD_REV] >= 0x11 &&
398
		(dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP);
489
		(dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP);
399
}
490
}
Line -... Line 491...
-
 
491
 
-
 
492
/*
-
 
493
 * DisplayPort AUX channel
-
 
494
 */
-
 
495
 
-
 
496
/**
-
 
497
 * struct drm_dp_aux_msg - DisplayPort AUX channel transaction
-
 
498
 * @address: address of the (first) register to access
-
 
499
 * @request: contains the type of transaction (see DP_AUX_* macros)
-
 
500
 * @reply: upon completion, contains the reply type of the transaction
-
 
501
 * @buffer: pointer to a transmission or reception buffer
-
 
502
 * @size: size of @buffer
-
 
503
 */
-
 
504
struct drm_dp_aux_msg {
-
 
505
	unsigned int address;
-
 
506
	u8 request;
-
 
507
	u8 reply;
-
 
508
	void *buffer;
-
 
509
	size_t size;
-
 
510
};
-
 
511
 
-
 
512
/**
-
 
513
 * struct drm_dp_aux - DisplayPort AUX channel
-
 
514
 * @name: user-visible name of this AUX channel and the I2C-over-AUX adapter
-
 
515
 * @ddc: I2C adapter that can be used for I2C-over-AUX communication
-
 
516
 * @dev: pointer to struct device that is the parent for this AUX channel
-
 
517
 * @hw_mutex: internal mutex used for locking transfers
-
 
518
 * @transfer: transfers a message representing a single AUX transaction
-
 
519
 *
-
 
520
 * The .dev field should be set to a pointer to the device that implements
-
 
521
 * the AUX channel.
-
 
522
 *
-
 
523
 * The .name field may be used to specify the name of the I2C adapter. If set to
-
 
524
 * NULL, dev_name() of .dev will be used.
-
 
525
 *
-
 
526
 * Drivers provide a hardware-specific implementation of how transactions
-
 
527
 * are executed via the .transfer() function. A pointer to a drm_dp_aux_msg
-
 
528
 * structure describing the transaction is passed into this function. Upon
-
 
529
 * success, the implementation should return the number of payload bytes
-
 
530
 * that were transferred, or a negative error-code on failure. Helpers
-
 
531
 * propagate errors from the .transfer() function, with the exception of
-
 
532
 * the -EBUSY error, which causes a transaction to be retried. On a short,
-
 
533
 * helpers will return -EPROTO to make it simpler to check for failure.
-
 
534
 *
-
 
535
 * An AUX channel can also be used to transport I2C messages to a sink. A
-
 
536
 * typical application of that is to access an EDID that's present in the
-
 
537
 * sink device. The .transfer() function can also be used to execute such
-
 
538
 * transactions. The drm_dp_aux_register_i2c_bus() function registers an
-
 
539
 * I2C adapter that can be passed to drm_probe_ddc(). Upon removal, drivers
-
 
540
 * should call drm_dp_aux_unregister_i2c_bus() to remove the I2C adapter.
-
 
541
 *
-
 
542
 * Note that the aux helper code assumes that the .transfer() function
-
 
543
 * only modifies the reply field of the drm_dp_aux_msg structure.  The
-
 
544
 * retry logic and i2c helpers assume this is the case.
-
 
545
 */
-
 
546
struct drm_dp_aux {
-
 
547
	const char *name;
-
 
548
	struct i2c_adapter ddc;
-
 
549
	struct device *dev;
-
 
550
	struct mutex hw_mutex;
-
 
551
	ssize_t (*transfer)(struct drm_dp_aux *aux,
-
 
552
			    struct drm_dp_aux_msg *msg);
-
 
553
};
-
 
554
 
-
 
555
ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
-
 
556
			 void *buffer, size_t size);
-
 
557
ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
-
 
558
			  void *buffer, size_t size);
-
 
559
 
-
 
560
/**
-
 
561
 * drm_dp_dpcd_readb() - read a single byte from the DPCD
-
 
562
 * @aux: DisplayPort AUX channel
-
 
563
 * @offset: address of the register to read
-
 
564
 * @valuep: location where the value of the register will be stored
-
 
565
 *
-
 
566
 * Returns the number of bytes transferred (1) on success, or a negative
-
 
567
 * error code on failure.
-
 
568
 */
-
 
569
static inline ssize_t drm_dp_dpcd_readb(struct drm_dp_aux *aux,
-
 
570
					unsigned int offset, u8 *valuep)
-
 
571
{
-
 
572
	return drm_dp_dpcd_read(aux, offset, valuep, 1);
-
 
573
}
-
 
574
 
-
 
575
/**
-
 
576
 * drm_dp_dpcd_writeb() - write a single byte to the DPCD
-
 
577
 * @aux: DisplayPort AUX channel
-
 
578
 * @offset: address of the register to write
-
 
579
 * @value: value to write to the register
-
 
580
 *
-
 
581
 * Returns the number of bytes transferred (1) on success, or a negative
-
 
582
 * error code on failure.
-
 
583
 */
-
 
584
static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux,
-
 
585
					 unsigned int offset, u8 value)
-
 
586
{
-
 
587
	return drm_dp_dpcd_write(aux, offset, &value, 1);
-
 
588
}
-
 
589
 
-
 
590
int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
-
 
591
				 u8 status[DP_LINK_STATUS_SIZE]);
-
 
592
 
-
 
593
/*
-
 
594
 * DisplayPort link
-
 
595
 */
-
 
596
#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
-
 
597
 
-
 
598
struct drm_dp_link {
-
 
599
	unsigned char revision;
-
 
600
	unsigned int rate;
-
 
601
	unsigned int num_lanes;
-
 
602
	unsigned long capabilities;
-
 
603
};
-
 
604
 
-
 
605
int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
-
 
606
int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
-
 
607
int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link);
-
 
608
 
-
 
609
int drm_dp_aux_register(struct drm_dp_aux *aux);
-
 
610
void drm_dp_aux_unregister(struct drm_dp_aux *aux);
400
 
611