aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 20:36:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 20:36:12 -0400
commita7d7a143d0b4cb1914705884ca5c25e322dba693 (patch)
tree0ee5e9e43f0863b38a29e8abc293e80eab177d74 /include/drm
parent43c40df2c7fedce640a6c39fcdf58764f6bbac5c (diff)
parent7963e9db1b1f842fdc53309baa8714d38e9f5681 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull DRM updates from Dave Airlie: "Like all good pull reqs this ends with a revert, so it must mean we tested it, [ Ed. That's _one_ way of looking at it ] This pull is missing nouveau, Ben has been stuck trying to track down a very longstanding bug that revealed itself due to some other changes. I've asked him to send you a direct pull request for nouveau once he cleans things up. I'm away until Monday so don't want to delay things, you can make a decision on that when he sends it, I have my phone so I can ack things just not really merge much. It has one trivial conflict with your tree in armada_drv.c, and also the pull request contains some component changes that are already in your tree, the base tree from Russell went via Greg's tree already, but some stuff still shows up in here that doesn't when I merge my tree into yours. Otherwise all pretty standard graphics fare, one new driver and changes all over the place. New drivers: - sti kms driver for STMicroelectronics chipsets stih416 and stih407. core: - lots of cleanups to the drm core - DP MST helper code merged - universal cursor planes. - render nodes enabled by default panel: - better panel interfaces - new panel support - non-continuous cock advertising ability ttm: - shrinker fixes i915: - hopefully ditched UMS support - runtime pm fixes - psr tracking and locking - now enabled by default - userptr fixes - backlight brightness fixes - MST support merged - runtime PM for dpms - primary planes locking fixes - gen8 hw semaphore support - fbc fixes - runtime PM on SOix sleep state hw. - mmio base page flipping - lots of vlv/chv fixes. - universal cursor planes radeon: - Hawaii fixes - display scalar support for non-fixed mode displays - new firmware format support - dpm on more asics by default - GPUVM improvements - uncached and wc GTT buffers - BOs > visible VRAM exynos: - i80 interface support - module auto-loading - ipp driver consolidated. armada: - irq handling in crtc layer only - crtc renumbering - add component support - DT interaction changes. tegra: - load as module fixes - eDP bpp and sync polarity fixed - DSI non-continuous clock mode support - better support for importing buffers from nouveau msm: - mdp5/adq8084 v1.3 hw enablement - devicetree clk changse - ifc6410 board working tda998x: - component support - DT documentation update vmwgfx: - fix compat shader namespace" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (551 commits) Revert "drm: drop redundant drm_file->is_master" drm/panel: simple: Use devm_gpiod_get_optional() drm/dsi: Replace upcasting macro by function drm/panel: ld9040: Replace upcasting macro by function drm/exynos: dp: Modify driver to support drm_panel drm/exynos: Move DP setup into commit() drm/panel: simple: Add AUO B133HTN01 panel support drm/panel: simple: Support delays in panel functions drm/panel: simple: Add proper definition for prepare and unprepare drm/panel: s6e8aa0: Add proper definition for prepare and unprepare drm/panel: ld9040: Add proper definition for prepare and unprepare drm/tegra: Add support for panel prepare and unprepare routines drm/exynos: dsi: Add support for panel prepare and unprepare routines drm/exynos: dpi: Add support for panel prepare and unprepare routines drm/panel: simple: Add dummy prepare and unprepare routines drm/panel: s6e8aa0: Add dummy prepare and unprepare routines drm/panel: ld9040: Add dummy prepare and unprepare routines drm/panel: Provide convenience wrapper for .get_modes() drm/panel: add .prepare() and .unprepare() functions drm/panel: simple: Remove simple-panel compatible ...
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h89
-rw-r--r--include/drm/drm_crtc.h36
-rw-r--r--include/drm/drm_dp_mst_helper.h509
-rw-r--r--include/drm/drm_fb_helper.h8
-rw-r--r--include/drm/drm_mipi_dsi.h21
-rw-r--r--include/drm/drm_of.h18
-rw-r--r--include/drm/drm_panel.h58
-rw-r--r--include/drm/drm_rect.h6
-rw-r--r--include/drm/ttm/ttm_bo_driver.h14
9 files changed, 664 insertions, 95 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e41f17ea1f13..196890735367 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -152,8 +152,6 @@ int drm_err(const char *func, const char *format, ...);
152 also include looping detection. */ 152 also include looping detection. */
153 153
154#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ 154#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
155#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
156#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
157 155
158#define DRM_MAP_HASH_OFFSET 0x10000000 156#define DRM_MAP_HASH_OFFSET 0x10000000
159 157
@@ -347,18 +345,6 @@ struct drm_waitlist {
347 spinlock_t write_lock; 345 spinlock_t write_lock;
348}; 346};
349 347
350struct drm_freelist {
351 int initialized; /**< Freelist in use */
352 atomic_t count; /**< Number of free buffers */
353 struct drm_buf *next; /**< End pointer */
354
355 wait_queue_head_t waiting; /**< Processes waiting on free bufs */
356 int low_mark; /**< Low water mark */
357 int high_mark; /**< High water mark */
358 atomic_t wfh; /**< If waiting for high mark */
359 spinlock_t lock;
360};
361
362typedef struct drm_dma_handle { 348typedef struct drm_dma_handle {
363 dma_addr_t busaddr; 349 dma_addr_t busaddr;
364 void *vaddr; 350 void *vaddr;
@@ -376,7 +362,8 @@ struct drm_buf_entry {
376 int page_order; 362 int page_order;
377 struct drm_dma_handle **seglist; 363 struct drm_dma_handle **seglist;
378 364
379 struct drm_freelist freelist; 365 int low_mark; /**< Low water mark */
366 int high_mark; /**< High water mark */
380}; 367};
381 368
382/* Event queued up for userspace to read */ 369/* Event queued up for userspace to read */
@@ -397,7 +384,6 @@ struct drm_prime_file_private {
397 384
398/** File private data */ 385/** File private data */
399struct drm_file { 386struct drm_file {
400 unsigned always_authenticated :1;
401 unsigned authenticated :1; 387 unsigned authenticated :1;
402 /* Whether we're master for a minor. Protected by master_mutex */ 388 /* Whether we're master for a minor. Protected by master_mutex */
403 unsigned is_master :1; 389 unsigned is_master :1;
@@ -442,23 +428,6 @@ struct drm_file {
442 struct drm_prime_file_private prime; 428 struct drm_prime_file_private prime;
443}; 429};
444 430
445/** Wait queue */
446struct drm_queue {
447 atomic_t use_count; /**< Outstanding uses (+1) */
448 atomic_t finalization; /**< Finalization in progress */
449 atomic_t block_count; /**< Count of processes waiting */
450 atomic_t block_read; /**< Queue blocked for reads */
451 wait_queue_head_t read_queue; /**< Processes waiting on block_read */
452 atomic_t block_write; /**< Queue blocked for writes */
453 wait_queue_head_t write_queue; /**< Processes waiting on block_write */
454 atomic_t total_queued; /**< Total queued statistic */
455 atomic_t total_flushed; /**< Total flushes statistic */
456 atomic_t total_locks; /**< Total locks statistics */
457 enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
458 struct drm_waitlist waitlist; /**< Pending buffers */
459 wait_queue_head_t flush_queue; /**< Processes waiting until flush */
460};
461
462/** 431/**
463 * Lock data. 432 * Lock data.
464 */ 433 */
@@ -567,15 +536,6 @@ struct drm_map_list {
567 struct drm_master *master; 536 struct drm_master *master;
568}; 537};
569 538
570/**
571 * Context handle list
572 */
573struct drm_ctx_list {
574 struct list_head head; /**< list head */
575 drm_context_t handle; /**< context handle */
576 struct drm_file *tag; /**< associated fd private data */
577};
578
579/* location of GART table */ 539/* location of GART table */
580#define DRM_ATI_GART_MAIN 1 540#define DRM_ATI_GART_MAIN 1
581#define DRM_ATI_GART_FB 2 541#define DRM_ATI_GART_FB 2
@@ -1218,7 +1178,6 @@ extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
1218 /* Device support (drm_fops.h) */ 1178 /* Device support (drm_fops.h) */
1219extern struct mutex drm_global_mutex; 1179extern struct mutex drm_global_mutex;
1220extern int drm_open(struct inode *inode, struct file *filp); 1180extern int drm_open(struct inode *inode, struct file *filp);
1221extern int drm_stub_open(struct inode *inode, struct file *filp);
1222extern ssize_t drm_read(struct file *filp, char __user *buffer, 1181extern ssize_t drm_read(struct file *filp, char __user *buffer,
1223 size_t count, loff_t *offset); 1182 size_t count, loff_t *offset);
1224extern int drm_release(struct inode *inode, struct file *filp); 1183extern int drm_release(struct inode *inode, struct file *filp);
@@ -1256,29 +1215,6 @@ extern int drm_setversion(struct drm_device *dev, void *data,
1256extern int drm_noop(struct drm_device *dev, void *data, 1215extern int drm_noop(struct drm_device *dev, void *data,
1257 struct drm_file *file_priv); 1216 struct drm_file *file_priv);
1258 1217
1259 /* Context IOCTL support (drm_context.h) */
1260extern int drm_resctx(struct drm_device *dev, void *data,
1261 struct drm_file *file_priv);
1262extern int drm_addctx(struct drm_device *dev, void *data,
1263 struct drm_file *file_priv);
1264extern int drm_getctx(struct drm_device *dev, void *data,
1265 struct drm_file *file_priv);
1266extern int drm_switchctx(struct drm_device *dev, void *data,
1267 struct drm_file *file_priv);
1268extern int drm_newctx(struct drm_device *dev, void *data,
1269 struct drm_file *file_priv);
1270extern int drm_rmctx(struct drm_device *dev, void *data,
1271 struct drm_file *file_priv);
1272
1273extern int drm_ctxbitmap_init(struct drm_device *dev);
1274extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
1275extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
1276
1277extern int drm_setsareactx(struct drm_device *dev, void *data,
1278 struct drm_file *file_priv);
1279extern int drm_getsareactx(struct drm_device *dev, void *data,
1280 struct drm_file *file_priv);
1281
1282 /* Authentication IOCTL support (drm_auth.h) */ 1218 /* Authentication IOCTL support (drm_auth.h) */
1283extern int drm_getmagic(struct drm_device *dev, void *data, 1219extern int drm_getmagic(struct drm_device *dev, void *data,
1284 struct drm_file *file_priv); 1220 struct drm_file *file_priv);
@@ -1398,17 +1334,12 @@ extern void drm_master_put(struct drm_master **master);
1398extern void drm_put_dev(struct drm_device *dev); 1334extern void drm_put_dev(struct drm_device *dev);
1399extern void drm_unplug_dev(struct drm_device *dev); 1335extern void drm_unplug_dev(struct drm_device *dev);
1400extern unsigned int drm_debug; 1336extern unsigned int drm_debug;
1401extern unsigned int drm_rnodes;
1402extern unsigned int drm_universal_planes;
1403 1337
1404extern unsigned int drm_vblank_offdelay; 1338extern unsigned int drm_vblank_offdelay;
1405extern unsigned int drm_timestamp_precision; 1339extern unsigned int drm_timestamp_precision;
1406extern unsigned int drm_timestamp_monotonic; 1340extern unsigned int drm_timestamp_monotonic;
1407 1341
1408extern struct class *drm_class; 1342extern struct class *drm_class;
1409extern struct dentry *drm_debugfs_root;
1410
1411extern struct idr drm_minors_idr;
1412 1343
1413extern struct drm_local_map *drm_getsarea(struct drm_device *dev); 1344extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1414 1345
@@ -1422,6 +1353,8 @@ extern int drm_debugfs_create_files(const struct drm_info_list *files,
1422extern int drm_debugfs_remove_files(const struct drm_info_list *files, 1353extern int drm_debugfs_remove_files(const struct drm_info_list *files,
1423 int count, struct drm_minor *minor); 1354 int count, struct drm_minor *minor);
1424extern int drm_debugfs_cleanup(struct drm_minor *minor); 1355extern int drm_debugfs_cleanup(struct drm_minor *minor);
1356extern int drm_debugfs_connector_add(struct drm_connector *connector);
1357extern void drm_debugfs_connector_remove(struct drm_connector *connector);
1425#else 1358#else
1426static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, 1359static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1427 struct dentry *root) 1360 struct dentry *root)
@@ -1446,6 +1379,15 @@ static inline int drm_debugfs_cleanup(struct drm_minor *minor)
1446{ 1379{
1447 return 0; 1380 return 0;
1448} 1381}
1382
1383static inline int drm_debugfs_connector_add(struct drm_connector *connector)
1384{
1385 return 0;
1386}
1387static inline void drm_debugfs_connector_remove(struct drm_connector *connector)
1388{
1389}
1390
1449#endif 1391#endif
1450 1392
1451 /* Info file support */ 1393 /* Info file support */
@@ -1515,9 +1457,8 @@ extern int drm_pci_set_unique(struct drm_device *dev,
1515struct drm_sysfs_class; 1457struct drm_sysfs_class;
1516extern struct class *drm_sysfs_create(struct module *owner, char *name); 1458extern struct class *drm_sysfs_create(struct module *owner, char *name);
1517extern void drm_sysfs_destroy(void); 1459extern void drm_sysfs_destroy(void);
1518extern int drm_sysfs_device_add(struct drm_minor *minor); 1460extern struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
1519extern void drm_sysfs_hotplug_event(struct drm_device *dev); 1461extern void drm_sysfs_hotplug_event(struct drm_device *dev);
1520extern void drm_sysfs_device_remove(struct drm_minor *minor);
1521extern int drm_sysfs_connector_add(struct drm_connector *connector); 1462extern int drm_sysfs_connector_add(struct drm_connector *connector);
1522extern void drm_sysfs_connector_remove(struct drm_connector *connector); 1463extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1523 1464
@@ -1577,7 +1518,7 @@ void drm_gem_free_mmap_offset(struct drm_gem_object *obj);
1577int drm_gem_create_mmap_offset(struct drm_gem_object *obj); 1518int drm_gem_create_mmap_offset(struct drm_gem_object *obj);
1578int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size); 1519int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size);
1579 1520
1580struct page **drm_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); 1521struct page **drm_gem_get_pages(struct drm_gem_object *obj);
1581void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, 1522void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages,
1582 bool dirty, bool accessed); 1523 bool dirty, bool accessed);
1583 1524
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 251b75e6bf7a..f1105d0da059 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -41,6 +41,7 @@ struct drm_framebuffer;
41struct drm_object_properties; 41struct drm_object_properties;
42struct drm_file; 42struct drm_file;
43struct drm_clip_rect; 43struct drm_clip_rect;
44struct device_node;
44 45
45#define DRM_MODE_OBJECT_CRTC 0xcccccccc 46#define DRM_MODE_OBJECT_CRTC 0xcccccccc
46#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 47#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0
@@ -75,6 +76,14 @@ static inline uint64_t I642U64(int64_t val)
75 return (uint64_t)*((uint64_t *)&val); 76 return (uint64_t)*((uint64_t *)&val);
76} 77}
77 78
79/* rotation property bits */
80#define DRM_ROTATE_0 0
81#define DRM_ROTATE_90 1
82#define DRM_ROTATE_180 2
83#define DRM_ROTATE_270 3
84#define DRM_REFLECT_X 4
85#define DRM_REFLECT_Y 5
86
78enum drm_connector_force { 87enum drm_connector_force {
79 DRM_FORCE_UNSPECIFIED, 88 DRM_FORCE_UNSPECIFIED,
80 DRM_FORCE_OFF, 89 DRM_FORCE_OFF,
@@ -314,6 +323,7 @@ struct drm_crtc_funcs {
314 */ 323 */
315struct drm_crtc { 324struct drm_crtc {
316 struct drm_device *dev; 325 struct drm_device *dev;
326 struct device_node *port;
317 struct list_head head; 327 struct list_head head;
318 328
319 /** 329 /**
@@ -331,6 +341,10 @@ struct drm_crtc {
331 struct drm_plane *primary; 341 struct drm_plane *primary;
332 struct drm_plane *cursor; 342 struct drm_plane *cursor;
333 343
344 /* position of cursor plane on crtc */
345 int cursor_x;
346 int cursor_y;
347
334 /* Temporary tracking of the old fb while a modeset is ongoing. Used 348 /* Temporary tracking of the old fb while a modeset is ongoing. Used
335 * by drm_mode_set_config_internal to implement correct refcounting. */ 349 * by drm_mode_set_config_internal to implement correct refcounting. */
336 struct drm_framebuffer *old_fb; 350 struct drm_framebuffer *old_fb;
@@ -524,6 +538,8 @@ struct drm_connector {
524 struct drm_property_blob *edid_blob_ptr; 538 struct drm_property_blob *edid_blob_ptr;
525 struct drm_object_properties properties; 539 struct drm_object_properties properties;
526 540
541 struct drm_property_blob *path_blob_ptr;
542
527 uint8_t polled; /* DRM_CONNECTOR_POLL_* */ 543 uint8_t polled; /* DRM_CONNECTOR_POLL_* */
528 544
529 /* requested DPMS state */ 545 /* requested DPMS state */
@@ -533,6 +549,7 @@ struct drm_connector {
533 549
534 /* forced on connector */ 550 /* forced on connector */
535 enum drm_connector_force force; 551 enum drm_connector_force force;
552 bool override_edid;
536 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 553 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
537 struct drm_encoder *encoder; /* currently active encoder */ 554 struct drm_encoder *encoder; /* currently active encoder */
538 555
@@ -545,6 +562,8 @@ struct drm_connector {
545 int audio_latency[2]; 562 int audio_latency[2];
546 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */ 563 int null_edid_counter; /* needed to workaround some HW bugs where we get all 0s */
547 unsigned bad_edid_counter; 564 unsigned bad_edid_counter;
565
566 struct dentry *debugfs_entry;
548}; 567};
549 568
550/** 569/**
@@ -800,6 +819,7 @@ struct drm_mode_config {
800 struct list_head property_blob_list; 819 struct list_head property_blob_list;
801 struct drm_property *edid_property; 820 struct drm_property *edid_property;
802 struct drm_property *dpms_property; 821 struct drm_property *dpms_property;
822 struct drm_property *path_property;
803 struct drm_property *plane_type_property; 823 struct drm_property *plane_type_property;
804 824
805 /* DVI-I properties */ 825 /* DVI-I properties */
@@ -823,6 +843,7 @@ struct drm_mode_config {
823 843
824 /* Optional properties */ 844 /* Optional properties */
825 struct drm_property *scaling_mode_property; 845 struct drm_property *scaling_mode_property;
846 struct drm_property *aspect_ratio_property;
826 struct drm_property *dirty_info_property; 847 struct drm_property *dirty_info_property;
827 848
828 /* dumb ioctl parameters */ 849 /* dumb ioctl parameters */
@@ -852,7 +873,7 @@ struct drm_prop_enum_list {
852extern int drm_crtc_init_with_planes(struct drm_device *dev, 873extern int drm_crtc_init_with_planes(struct drm_device *dev,
853 struct drm_crtc *crtc, 874 struct drm_crtc *crtc,
854 struct drm_plane *primary, 875 struct drm_plane *primary,
855 void *cursor, 876 struct drm_plane *cursor,
856 const struct drm_crtc_funcs *funcs); 877 const struct drm_crtc_funcs *funcs);
857extern int drm_crtc_init(struct drm_device *dev, 878extern int drm_crtc_init(struct drm_device *dev,
858 struct drm_crtc *crtc, 879 struct drm_crtc *crtc,
@@ -878,6 +899,8 @@ extern int drm_connector_init(struct drm_device *dev,
878 struct drm_connector *connector, 899 struct drm_connector *connector,
879 const struct drm_connector_funcs *funcs, 900 const struct drm_connector_funcs *funcs,
880 int connector_type); 901 int connector_type);
902int drm_connector_register(struct drm_connector *connector);
903void drm_connector_unregister(struct drm_connector *connector);
881 904
882extern void drm_connector_cleanup(struct drm_connector *connector); 905extern void drm_connector_cleanup(struct drm_connector *connector);
883/* helper to unplug all connectors from sysfs for device */ 906/* helper to unplug all connectors from sysfs for device */
@@ -937,6 +960,7 @@ extern const char *drm_get_tv_select_name(int val);
937extern void drm_fb_release(struct drm_file *file_priv); 960extern void drm_fb_release(struct drm_file *file_priv);
938extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 961extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
939extern void drm_mode_group_destroy(struct drm_mode_group *group); 962extern void drm_mode_group_destroy(struct drm_mode_group *group);
963extern void drm_reinit_primary_mode_group(struct drm_device *dev);
940extern bool drm_probe_ddc(struct i2c_adapter *adapter); 964extern bool drm_probe_ddc(struct i2c_adapter *adapter);
941extern struct edid *drm_get_edid(struct drm_connector *connector, 965extern struct edid *drm_get_edid(struct drm_connector *connector,
942 struct i2c_adapter *adapter); 966 struct i2c_adapter *adapter);
@@ -946,6 +970,8 @@ extern void drm_mode_config_init(struct drm_device *dev);
946extern void drm_mode_config_reset(struct drm_device *dev); 970extern void drm_mode_config_reset(struct drm_device *dev);
947extern void drm_mode_config_cleanup(struct drm_device *dev); 971extern void drm_mode_config_cleanup(struct drm_device *dev);
948 972
973extern int drm_mode_connector_set_path_property(struct drm_connector *connector,
974 char *path);
949extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, 975extern int drm_mode_connector_update_edid_property(struct drm_connector *connector,
950 struct edid *edid); 976 struct edid *edid);
951 977
@@ -994,7 +1020,8 @@ extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int
994struct drm_property *drm_property_create_bitmask(struct drm_device *dev, 1020struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
995 int flags, const char *name, 1021 int flags, const char *name,
996 const struct drm_prop_enum_list *props, 1022 const struct drm_prop_enum_list *props,
997 int num_values); 1023 int num_props,
1024 uint64_t supported_bits);
998struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 1025struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
999 const char *name, 1026 const char *name,
1000 uint64_t min, uint64_t max); 1027 uint64_t min, uint64_t max);
@@ -1010,6 +1037,7 @@ extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
1010extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats, 1037extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
1011 char *formats[]); 1038 char *formats[]);
1012extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); 1039extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1040extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1013extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1041extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1014 1042
1015extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1043extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
@@ -1100,6 +1128,10 @@ extern int drm_format_plane_cpp(uint32_t format, int plane);
1100extern int drm_format_horz_chroma_subsampling(uint32_t format); 1128extern int drm_format_horz_chroma_subsampling(uint32_t format);
1101extern int drm_format_vert_chroma_subsampling(uint32_t format); 1129extern int drm_format_vert_chroma_subsampling(uint32_t format);
1102extern const char *drm_get_format_name(uint32_t format); 1130extern const char *drm_get_format_name(uint32_t format);
1131extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
1132 unsigned int supported_rotations);
1133extern unsigned int drm_rotation_simplify(unsigned int rotation,
1134 unsigned int supported_rotations);
1103 1135
1104/* Helpers */ 1136/* Helpers */
1105 1137
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h
new file mode 100644
index 000000000000..9b446ada2532
--- /dev/null
+++ b/include/drm/drm_dp_mst_helper.h
@@ -0,0 +1,509 @@
1/*
2 * Copyright © 2014 Red Hat.
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22#ifndef _DRM_DP_MST_HELPER_H_
23#define _DRM_DP_MST_HELPER_H_
24
25#include <linux/types.h>
26#include <drm/drm_dp_helper.h>
27
28struct drm_dp_mst_branch;
29
30/**
31 * struct drm_dp_vcpi - Virtual Channel Payload Identifer
32 * @vcpi: Virtual channel ID.
33 * @pbn: Payload Bandwidth Number for this channel
34 * @aligned_pbn: PBN aligned with slot size
35 * @num_slots: number of slots for this PBN
36 */
37struct drm_dp_vcpi {
38 int vcpi;
39 int pbn;
40 int aligned_pbn;
41 int num_slots;
42};
43
44/**
45 * struct drm_dp_mst_port - MST port
46 * @kref: reference count for this port.
47 * @guid_valid: for DP 1.2 devices if we have validated the GUID.
48 * @guid: guid for DP 1.2 device on this port.
49 * @port_num: port number
50 * @input: if this port is an input port.
51 * @mcs: message capability status - DP 1.2 spec.
52 * @ddps: DisplayPort Device Plug Status - DP 1.2
53 * @pdt: Peer Device Type
54 * @ldps: Legacy Device Plug Status
55 * @dpcd_rev: DPCD revision of device on this port
56 * @num_sdp_streams: Number of simultaneous streams
57 * @num_sdp_stream_sinks: Number of stream sinks
58 * @available_pbn: Available bandwidth for this port.
59 * @next: link to next port on this branch device
60 * @mstb: branch device attach below this port
61 * @aux: i2c aux transport to talk to device connected to this port.
62 * @parent: branch device parent of this port
63 * @vcpi: Virtual Channel Payload info for this port.
64 * @connector: DRM connector this port is connected to.
65 * @mgr: topology manager this port lives under.
66 *
67 * This structure represents an MST port endpoint on a device somewhere
68 * in the MST topology.
69 */
70struct drm_dp_mst_port {
71 struct kref kref;
72
73 /* if dpcd 1.2 device is on this port - its GUID info */
74 bool guid_valid;
75 u8 guid[16];
76
77 u8 port_num;
78 bool input;
79 bool mcs;
80 bool ddps;
81 u8 pdt;
82 bool ldps;
83 u8 dpcd_rev;
84 u8 num_sdp_streams;
85 u8 num_sdp_stream_sinks;
86 uint16_t available_pbn;
87 struct list_head next;
88 struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */
89 struct drm_dp_aux aux; /* i2c bus for this port? */
90 struct drm_dp_mst_branch *parent;
91
92 struct drm_dp_vcpi vcpi;
93 struct drm_connector *connector;
94 struct drm_dp_mst_topology_mgr *mgr;
95};
96
97/**
98 * struct drm_dp_mst_branch - MST branch device.
99 * @kref: reference count for this port.
100 * @rad: Relative Address to talk to this branch device.
101 * @lct: Link count total to talk to this branch device.
102 * @num_ports: number of ports on the branch.
103 * @msg_slots: one bit per transmitted msg slot.
104 * @ports: linked list of ports on this branch.
105 * @port_parent: pointer to the port parent, NULL if toplevel.
106 * @mgr: topology manager for this branch device.
107 * @tx_slots: transmission slots for this device.
108 * @last_seqno: last sequence number used to talk to this.
109 * @link_address_sent: if a link address message has been sent to this device yet.
110 *
111 * This structure represents an MST branch device, there is one
112 * primary branch device at the root, along with any others connected
113 * to downstream ports
114 */
115struct drm_dp_mst_branch {
116 struct kref kref;
117 u8 rad[8];
118 u8 lct;
119 int num_ports;
120
121 int msg_slots;
122 struct list_head ports;
123
124 /* list of tx ops queue for this port */
125 struct drm_dp_mst_port *port_parent;
126 struct drm_dp_mst_topology_mgr *mgr;
127
128 /* slots are protected by mstb->mgr->qlock */
129 struct drm_dp_sideband_msg_tx *tx_slots[2];
130 int last_seqno;
131 bool link_address_sent;
132};
133
134
135/* sideband msg header - not bit struct */
136struct drm_dp_sideband_msg_hdr {
137 u8 lct;
138 u8 lcr;
139 u8 rad[8];
140 bool broadcast;
141 bool path_msg;
142 u8 msg_len;
143 bool somt;
144 bool eomt;
145 bool seqno;
146};
147
148struct drm_dp_nak_reply {
149 u8 guid[16];
150 u8 reason;
151 u8 nak_data;
152};
153
154struct drm_dp_link_address_ack_reply {
155 u8 guid[16];
156 u8 nports;
157 struct drm_dp_link_addr_reply_port {
158 bool input_port;
159 u8 peer_device_type;
160 u8 port_number;
161 bool mcs;
162 bool ddps;
163 bool legacy_device_plug_status;
164 u8 dpcd_revision;
165 u8 peer_guid[16];
166 u8 num_sdp_streams;
167 u8 num_sdp_stream_sinks;
168 } ports[16];
169};
170
171struct drm_dp_remote_dpcd_read_ack_reply {
172 u8 port_number;
173 u8 num_bytes;
174 u8 bytes[255];
175};
176
177struct drm_dp_remote_dpcd_write_ack_reply {
178 u8 port_number;
179};
180
181struct drm_dp_remote_dpcd_write_nak_reply {
182 u8 port_number;
183 u8 reason;
184 u8 bytes_written_before_failure;
185};
186
187struct drm_dp_remote_i2c_read_ack_reply {
188 u8 port_number;
189 u8 num_bytes;
190 u8 bytes[255];
191};
192
193struct drm_dp_remote_i2c_read_nak_reply {
194 u8 port_number;
195 u8 nak_reason;
196 u8 i2c_nak_transaction;
197};
198
199struct drm_dp_remote_i2c_write_ack_reply {
200 u8 port_number;
201};
202
203
204struct drm_dp_sideband_msg_rx {
205 u8 chunk[48];
206 u8 msg[256];
207 u8 curchunk_len;
208 u8 curchunk_idx; /* chunk we are parsing now */
209 u8 curchunk_hdrlen;
210 u8 curlen; /* total length of the msg */
211 bool have_somt;
212 bool have_eomt;
213 struct drm_dp_sideband_msg_hdr initial_hdr;
214};
215
216
217struct drm_dp_allocate_payload {
218 u8 port_number;
219 u8 number_sdp_streams;
220 u8 vcpi;
221 u16 pbn;
222 u8 sdp_stream_sink[8];
223};
224
225struct drm_dp_allocate_payload_ack_reply {
226 u8 port_number;
227 u8 vcpi;
228 u16 allocated_pbn;
229};
230
231struct drm_dp_connection_status_notify {
232 u8 guid[16];
233 u8 port_number;
234 bool legacy_device_plug_status;
235 bool displayport_device_plug_status;
236 bool message_capability_status;
237 bool input_port;
238 u8 peer_device_type;
239};
240
241struct drm_dp_remote_dpcd_read {
242 u8 port_number;
243 u32 dpcd_address;
244 u8 num_bytes;
245};
246
247struct drm_dp_remote_dpcd_write {
248 u8 port_number;
249 u32 dpcd_address;
250 u8 num_bytes;
251 u8 *bytes;
252};
253
254struct drm_dp_remote_i2c_read {
255 u8 num_transactions;
256 u8 port_number;
257 struct {
258 u8 i2c_dev_id;
259 u8 num_bytes;
260 u8 *bytes;
261 u8 no_stop_bit;
262 u8 i2c_transaction_delay;
263 } transactions[4];
264 u8 read_i2c_device_id;
265 u8 num_bytes_read;
266};
267
268struct drm_dp_remote_i2c_write {
269 u8 port_number;
270 u8 write_i2c_device_id;
271 u8 num_bytes;
272 u8 *bytes;
273};
274
275/* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */
276struct drm_dp_port_number_req {
277 u8 port_number;
278};
279
280struct drm_dp_enum_path_resources_ack_reply {
281 u8 port_number;
282 u16 full_payload_bw_number;
283 u16 avail_payload_bw_number;
284};
285
286/* covers POWER_DOWN_PHY, POWER_UP_PHY */
287struct drm_dp_port_number_rep {
288 u8 port_number;
289};
290
291struct drm_dp_query_payload {
292 u8 port_number;
293 u8 vcpi;
294};
295
296struct drm_dp_resource_status_notify {
297 u8 port_number;
298 u8 guid[16];
299 u16 available_pbn;
300};
301
302struct drm_dp_query_payload_ack_reply {
303 u8 port_number;
304 u8 allocated_pbn;
305};
306
307struct drm_dp_sideband_msg_req_body {
308 u8 req_type;
309 union ack_req {
310 struct drm_dp_connection_status_notify conn_stat;
311 struct drm_dp_port_number_req port_num;
312 struct drm_dp_resource_status_notify resource_stat;
313
314 struct drm_dp_query_payload query_payload;
315 struct drm_dp_allocate_payload allocate_payload;
316
317 struct drm_dp_remote_dpcd_read dpcd_read;
318 struct drm_dp_remote_dpcd_write dpcd_write;
319
320 struct drm_dp_remote_i2c_read i2c_read;
321 struct drm_dp_remote_i2c_write i2c_write;
322 } u;
323};
324
325struct drm_dp_sideband_msg_reply_body {
326 u8 reply_type;
327 u8 req_type;
328 union ack_replies {
329 struct drm_dp_nak_reply nak;
330 struct drm_dp_link_address_ack_reply link_addr;
331 struct drm_dp_port_number_rep port_number;
332
333 struct drm_dp_enum_path_resources_ack_reply path_resources;
334 struct drm_dp_allocate_payload_ack_reply allocate_payload;
335 struct drm_dp_query_payload_ack_reply query_payload;
336
337 struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack;
338 struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack;
339 struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack;
340
341 struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack;
342 struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack;
343 struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack;
344 } u;
345};
346
347/* msg is queued to be put into a slot */
348#define DRM_DP_SIDEBAND_TX_QUEUED 0
349/* msg has started transmitting on a slot - still on msgq */
350#define DRM_DP_SIDEBAND_TX_START_SEND 1
351/* msg has finished transmitting on a slot - removed from msgq only in slot */
352#define DRM_DP_SIDEBAND_TX_SENT 2
353/* msg has received a response - removed from slot */
354#define DRM_DP_SIDEBAND_TX_RX 3
355#define DRM_DP_SIDEBAND_TX_TIMEOUT 4
356
357struct drm_dp_sideband_msg_tx {
358 u8 msg[256];
359 u8 chunk[48];
360 u8 cur_offset;
361 u8 cur_len;
362 struct drm_dp_mst_branch *dst;
363 struct list_head next;
364 int seqno;
365 int state;
366 bool path_msg;
367 struct drm_dp_sideband_msg_reply_body reply;
368};
369
370/* sideband msg handler */
371struct drm_dp_mst_topology_mgr;
372struct drm_dp_mst_topology_cbs {
373 /* create a connector for a port */
374 struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, char *path);
375 void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
376 struct drm_connector *connector);
377 void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr);
378
379};
380
381#define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8)
382
383#define DP_PAYLOAD_LOCAL 1
384#define DP_PAYLOAD_REMOTE 2
385#define DP_PAYLOAD_DELETE_LOCAL 3
386
387struct drm_dp_payload {
388 int payload_state;
389 int start_slot;
390 int num_slots;
391};
392
393/**
394 * struct drm_dp_mst_topology_mgr - DisplayPort MST manager
395 * @dev: device pointer for adding i2c devices etc.
396 * @cbs: callbacks for connector addition and destruction.
397 * @max_dpcd_transaction_bytes - maximum number of bytes to read/write in one go.
398 * @aux: aux channel for the DP connector.
399 * @max_payloads: maximum number of payloads the GPU can generate.
400 * @conn_base_id: DRM connector ID this mgr is connected to.
401 * @down_rep_recv: msg receiver state for down replies.
402 * @up_req_recv: msg receiver state for up requests.
403 * @lock: protects mst state, primary, guid, dpcd.
404 * @mst_state: if this manager is enabled for an MST capable port.
405 * @mst_primary: pointer to the primary branch device.
406 * @guid_valid: GUID valid for the primary branch device.
407 * @guid: GUID for primary port.
408 * @dpcd: cache of DPCD for primary port.
409 * @pbn_div: PBN to slots divisor.
410 *
411 * This struct represents the toplevel displayport MST topology manager.
412 * There should be one instance of this for every MST capable DP connector
413 * on the GPU.
414 */
415struct drm_dp_mst_topology_mgr {
416
417 struct device *dev;
418 struct drm_dp_mst_topology_cbs *cbs;
419 int max_dpcd_transaction_bytes;
420 struct drm_dp_aux *aux; /* auxch for this topology mgr to use */
421 int max_payloads;
422 int conn_base_id;
423
424 /* only ever accessed from the workqueue - which should be serialised */
425 struct drm_dp_sideband_msg_rx down_rep_recv;
426 struct drm_dp_sideband_msg_rx up_req_recv;
427
428 /* pointer to info about the initial MST device */
429 struct mutex lock; /* protects mst_state + primary + guid + dpcd */
430
431 bool mst_state;
432 struct drm_dp_mst_branch *mst_primary;
433 /* primary MST device GUID */
434 bool guid_valid;
435 u8 guid[16];
436 u8 dpcd[DP_RECEIVER_CAP_SIZE];
437 u8 sink_count;
438 int pbn_div;
439 int total_slots;
440 int avail_slots;
441 int total_pbn;
442
443 /* messages to be transmitted */
444 /* qlock protects the upq/downq and in_progress,
445 the mstb tx_slots and txmsg->state once they are queued */
446 struct mutex qlock;
447 struct list_head tx_msg_downq;
448 struct list_head tx_msg_upq;
449 bool tx_down_in_progress;
450 bool tx_up_in_progress;
451
452 /* payload info + lock for it */
453 struct mutex payload_lock;
454 struct drm_dp_vcpi **proposed_vcpis;
455 struct drm_dp_payload *payloads;
456 unsigned long payload_mask;
457
458 wait_queue_head_t tx_waitq;
459 struct work_struct work;
460
461 struct work_struct tx_work;
462};
463
464int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr, struct device *dev, struct drm_dp_aux *aux, int max_dpcd_transaction_bytes, int max_payloads, int conn_base_id);
465
466void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr);
467
468
469int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state);
470
471
472int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled);
473
474
475enum drm_connector_status drm_dp_mst_detect_port(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
476
477struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
478
479
480int drm_dp_calc_pbn_mode(int clock, int bpp);
481
482
483bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, int pbn, int *slots);
484
485
486void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
487
488
489void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
490 struct drm_dp_mst_port *port);
491
492
493int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
494 int pbn);
495
496
497int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
498
499
500int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr);
501
502int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr);
503
504void drm_dp_mst_dump_topology(struct seq_file *m,
505 struct drm_dp_mst_topology_mgr *mgr);
506
507void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
508int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
509#endif
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 7997246d4039..bfd329d613c4 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -86,8 +86,9 @@ struct drm_fb_helper {
86 int crtc_count; 86 int crtc_count;
87 struct drm_fb_helper_crtc *crtc_info; 87 struct drm_fb_helper_crtc *crtc_info;
88 int connector_count; 88 int connector_count;
89 int connector_info_alloc_count;
89 struct drm_fb_helper_connector **connector_info; 90 struct drm_fb_helper_connector **connector_info;
90 struct drm_fb_helper_funcs *funcs; 91 const struct drm_fb_helper_funcs *funcs;
91 struct fb_info *fbdev; 92 struct fb_info *fbdev;
92 u32 pseudo_palette[17]; 93 u32 pseudo_palette[17];
93 struct list_head kernel_fb_list; 94 struct list_head kernel_fb_list;
@@ -97,6 +98,8 @@ struct drm_fb_helper {
97 bool delayed_hotplug; 98 bool delayed_hotplug;
98}; 99};
99 100
101void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
102 const struct drm_fb_helper_funcs *funcs);
100int drm_fb_helper_init(struct drm_device *dev, 103int drm_fb_helper_init(struct drm_device *dev,
101 struct drm_fb_helper *helper, int crtc_count, 104 struct drm_fb_helper *helper, int crtc_count,
102 int max_conn); 105 int max_conn);
@@ -128,4 +131,7 @@ struct drm_display_mode *
128drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn, 131drm_pick_cmdline_mode(struct drm_fb_helper_connector *fb_helper_conn,
129 int width, int height); 132 int width, int height);
130 133
134int drm_fb_helper_add_one_connector(struct drm_fb_helper *fb_helper, struct drm_connector *connector);
135int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,
136 struct drm_connector *connector);
131#endif 137#endif
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 944f33f8ba38..2bb55b8b9031 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -94,6 +94,8 @@ void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
94#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8) 94#define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8)
95/* disable EoT packets in HS mode */ 95/* disable EoT packets in HS mode */
96#define MIPI_DSI_MODE_EOT_PACKET BIT(9) 96#define MIPI_DSI_MODE_EOT_PACKET BIT(9)
97/* device supports non-continuous clock behavior (DSI spec 5.6.1) */
98#define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10)
97 99
98enum mipi_dsi_pixel_format { 100enum mipi_dsi_pixel_format {
99 MIPI_DSI_FMT_RGB888, 101 MIPI_DSI_FMT_RGB888,
@@ -121,14 +123,17 @@ struct mipi_dsi_device {
121 unsigned long mode_flags; 123 unsigned long mode_flags;
122}; 124};
123 125
124#define to_mipi_dsi_device(d) container_of(d, struct mipi_dsi_device, dev) 126static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
127{
128 return container_of(dev, struct mipi_dsi_device, dev);
129}
125 130
126int mipi_dsi_attach(struct mipi_dsi_device *dsi); 131int mipi_dsi_attach(struct mipi_dsi_device *dsi);
127int mipi_dsi_detach(struct mipi_dsi_device *dsi); 132int mipi_dsi_detach(struct mipi_dsi_device *dsi);
128int mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, unsigned int channel, 133ssize_t mipi_dsi_dcs_write(struct mipi_dsi_device *dsi, const void *data,
129 const void *data, size_t len); 134 size_t len);
130ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel, 135ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, u8 cmd, void *data,
131 u8 cmd, void *data, size_t len); 136 size_t len);
132 137
133/** 138/**
134 * struct mipi_dsi_driver - DSI driver 139 * struct mipi_dsi_driver - DSI driver
@@ -144,7 +149,11 @@ struct mipi_dsi_driver {
144 void (*shutdown)(struct mipi_dsi_device *dsi); 149 void (*shutdown)(struct mipi_dsi_device *dsi);
145}; 150};
146 151
147#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 152static inline struct mipi_dsi_driver *
153to_mipi_dsi_driver(struct device_driver *driver)
154{
155 return container_of(driver, struct mipi_dsi_driver, driver);
156}
148 157
149static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi) 158static inline void *mipi_dsi_get_drvdata(const struct mipi_dsi_device *dsi)
150{ 159{
diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h
new file mode 100644
index 000000000000..2441f7112074
--- /dev/null
+++ b/include/drm/drm_of.h
@@ -0,0 +1,18 @@
1#ifndef __DRM_OF_H__
2#define __DRM_OF_H__
3
4struct drm_device;
5struct device_node;
6
7#ifdef CONFIG_OF
8extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
9 struct device_node *port);
10#else
11static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
12 struct device_node *port)
13{
14 return 0;
15}
16#endif
17
18#endif /* __DRM_OF_H__ */
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index c2ab77add67c..1fbcc96063a7 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -30,8 +30,42 @@ struct drm_connector;
30struct drm_device; 30struct drm_device;
31struct drm_panel; 31struct drm_panel;
32 32
33/**
34 * struct drm_panel_funcs - perform operations on a given panel
35 * @disable: disable panel (turn off back light, etc.)
36 * @unprepare: turn off panel
37 * @prepare: turn on panel and perform set up
38 * @enable: enable panel (turn on back light, etc.)
39 * @get_modes: add modes to the connector that the panel is attached to and
40 * return the number of modes added
41 *
42 * The .prepare() function is typically called before the display controller
43 * starts to transmit video data. Panel drivers can use this to turn the panel
44 * on and wait for it to become ready. If additional configuration is required
45 * (via a control bus such as I2C, SPI or DSI for example) this is a good time
46 * to do that.
47 *
48 * After the display controller has started transmitting video data, it's safe
49 * to call the .enable() function. This will typically enable the backlight to
50 * make the image on screen visible. Some panels require a certain amount of
51 * time or frames before the image is displayed. This function is responsible
52 * for taking this into account before enabling the backlight to avoid visual
53 * glitches.
54 *
55 * Before stopping video transmission from the display controller it can be
56 * necessary to turn off the panel to avoid visual glitches. This is done in
57 * the .disable() function. Analogously to .enable() this typically involves
58 * turning off the backlight and waiting for some time to make sure no image
59 * is visible on the panel. It is then safe for the display controller to
60 * cease transmission of video data.
61 *
62 * To save power when no video data is transmitted, a driver can power down
63 * the panel. This is the job of the .unprepare() function.
64 */
33struct drm_panel_funcs { 65struct drm_panel_funcs {
34 int (*disable)(struct drm_panel *panel); 66 int (*disable)(struct drm_panel *panel);
67 int (*unprepare)(struct drm_panel *panel);
68 int (*prepare)(struct drm_panel *panel);
35 int (*enable)(struct drm_panel *panel); 69 int (*enable)(struct drm_panel *panel);
36 int (*get_modes)(struct drm_panel *panel); 70 int (*get_modes)(struct drm_panel *panel);
37}; 71};
@@ -46,6 +80,14 @@ struct drm_panel {
46 struct list_head list; 80 struct list_head list;
47}; 81};
48 82
83static inline int drm_panel_unprepare(struct drm_panel *panel)
84{
85 if (panel && panel->funcs && panel->funcs->unprepare)
86 return panel->funcs->unprepare(panel);
87
88 return panel ? -ENOSYS : -EINVAL;
89}
90
49static inline int drm_panel_disable(struct drm_panel *panel) 91static inline int drm_panel_disable(struct drm_panel *panel)
50{ 92{
51 if (panel && panel->funcs && panel->funcs->disable) 93 if (panel && panel->funcs && panel->funcs->disable)
@@ -54,6 +96,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)
54 return panel ? -ENOSYS : -EINVAL; 96 return panel ? -ENOSYS : -EINVAL;
55} 97}
56 98
99static inline int drm_panel_prepare(struct drm_panel *panel)
100{
101 if (panel && panel->funcs && panel->funcs->prepare)
102 return panel->funcs->prepare(panel);
103
104 return panel ? -ENOSYS : -EINVAL;
105}
106
57static inline int drm_panel_enable(struct drm_panel *panel) 107static inline int drm_panel_enable(struct drm_panel *panel)
58{ 108{
59 if (panel && panel->funcs && panel->funcs->enable) 109 if (panel && panel->funcs && panel->funcs->enable)
@@ -62,6 +112,14 @@ static inline int drm_panel_enable(struct drm_panel *panel)
62 return panel ? -ENOSYS : -EINVAL; 112 return panel ? -ENOSYS : -EINVAL;
63} 113}
64 114
115static inline int drm_panel_get_modes(struct drm_panel *panel)
116{
117 if (panel && panel->funcs && panel->funcs->get_modes)
118 return panel->funcs->get_modes(panel);
119
120 return panel ? -ENOSYS : -EINVAL;
121}
122
65void drm_panel_init(struct drm_panel *panel); 123void drm_panel_init(struct drm_panel *panel);
66 124
67int drm_panel_add(struct drm_panel *panel); 125int drm_panel_add(struct drm_panel *panel);
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index d1286297567b..26bb55e9e8b6 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -163,5 +163,11 @@ int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
163 struct drm_rect *dst, 163 struct drm_rect *dst,
164 int min_vscale, int max_vscale); 164 int min_vscale, int max_vscale);
165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point); 165void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point);
166void drm_rect_rotate(struct drm_rect *r,
167 int width, int height,
168 unsigned int rotation);
169void drm_rect_rotate_inv(struct drm_rect *r,
170 int width, int height,
171 unsigned int rotation);
166 172
167#endif 173#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index a5183da3ef92..202f0a7171e8 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -182,6 +182,7 @@ struct ttm_mem_type_manager_func {
182 * @man: Pointer to a memory type manager. 182 * @man: Pointer to a memory type manager.
183 * @bo: Pointer to the buffer object we're allocating space for. 183 * @bo: Pointer to the buffer object we're allocating space for.
184 * @placement: Placement details. 184 * @placement: Placement details.
185 * @flags: Additional placement flags.
185 * @mem: Pointer to a struct ttm_mem_reg to be filled in. 186 * @mem: Pointer to a struct ttm_mem_reg to be filled in.
186 * 187 *
187 * This function should allocate space in the memory type managed 188 * This function should allocate space in the memory type managed
@@ -206,6 +207,7 @@ struct ttm_mem_type_manager_func {
206 int (*get_node)(struct ttm_mem_type_manager *man, 207 int (*get_node)(struct ttm_mem_type_manager *man,
207 struct ttm_buffer_object *bo, 208 struct ttm_buffer_object *bo,
208 struct ttm_placement *placement, 209 struct ttm_placement *placement,
210 uint32_t flags,
209 struct ttm_mem_reg *mem); 211 struct ttm_mem_reg *mem);
210 212
211 /** 213 /**
@@ -653,18 +655,6 @@ extern void ttm_tt_unbind(struct ttm_tt *ttm);
653extern int ttm_tt_swapin(struct ttm_tt *ttm); 655extern int ttm_tt_swapin(struct ttm_tt *ttm);
654 656
655/** 657/**
656 * ttm_tt_cache_flush:
657 *
658 * @pages: An array of pointers to struct page:s to flush.
659 * @num_pages: Number of pages to flush.
660 *
661 * Flush the data of the indicated pages from the cpu caches.
662 * This is used when changing caching attributes of the pages from
663 * cache-coherent.
664 */
665extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
666
667/**
668 * ttm_tt_set_placement_caching: 658 * ttm_tt_set_placement_caching:
669 * 659 *
670 * @ttm A struct ttm_tt the backing pages of which will change caching policy. 660 * @ttm A struct ttm_tt the backing pages of which will change caching policy.