diff options
Diffstat (limited to 'include/drm')
| -rw-r--r-- | include/drm/bridge/dw_hdmi.h | 61 | ||||
| -rw-r--r-- | include/drm/bridge/ptn3460.h | 8 | ||||
| -rw-r--r-- | include/drm/drmP.h | 8 | ||||
| -rw-r--r-- | include/drm/drm_atomic.h | 13 | ||||
| -rw-r--r-- | include/drm/drm_atomic_helper.h | 43 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 120 | ||||
| -rw-r--r-- | include/drm/drm_crtc_helper.h | 59 | ||||
| -rw-r--r-- | include/drm/drm_dp_helper.h | 1 | ||||
| -rw-r--r-- | include/drm/drm_fb_helper.h | 2 | ||||
| -rw-r--r-- | include/drm/drm_modes.h | 11 | ||||
| -rw-r--r-- | include/drm/drm_plane_helper.h | 5 | ||||
| -rw-r--r-- | include/drm/i915_component.h | 38 | ||||
| -rw-r--r-- | include/drm/i915_powerwell.h | 37 |
13 files changed, 334 insertions, 72 deletions
diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h new file mode 100644 index 000000000000..5a4f49005169 --- /dev/null +++ b/include/drm/bridge/dw_hdmi.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __DW_HDMI__ | ||
| 11 | #define __DW_HDMI__ | ||
| 12 | |||
| 13 | #include <drm/drmP.h> | ||
| 14 | |||
| 15 | enum { | ||
| 16 | DW_HDMI_RES_8, | ||
| 17 | DW_HDMI_RES_10, | ||
| 18 | DW_HDMI_RES_12, | ||
| 19 | DW_HDMI_RES_MAX, | ||
| 20 | }; | ||
| 21 | |||
| 22 | enum dw_hdmi_devtype { | ||
| 23 | IMX6Q_HDMI, | ||
| 24 | IMX6DL_HDMI, | ||
| 25 | RK3288_HDMI, | ||
| 26 | }; | ||
| 27 | |||
| 28 | struct dw_hdmi_mpll_config { | ||
| 29 | unsigned long mpixelclock; | ||
| 30 | struct { | ||
| 31 | u16 cpce; | ||
| 32 | u16 gmp; | ||
| 33 | } res[DW_HDMI_RES_MAX]; | ||
| 34 | }; | ||
| 35 | |||
| 36 | struct dw_hdmi_curr_ctrl { | ||
| 37 | unsigned long mpixelclock; | ||
| 38 | u16 curr[DW_HDMI_RES_MAX]; | ||
| 39 | }; | ||
| 40 | |||
| 41 | struct dw_hdmi_sym_term { | ||
| 42 | unsigned long mpixelclock; | ||
| 43 | u16 sym_ctr; /*clock symbol and transmitter control*/ | ||
| 44 | u16 term; /*transmission termination value*/ | ||
| 45 | }; | ||
| 46 | |||
| 47 | struct dw_hdmi_plat_data { | ||
| 48 | enum dw_hdmi_devtype dev_type; | ||
| 49 | const struct dw_hdmi_mpll_config *mpll_cfg; | ||
| 50 | const struct dw_hdmi_curr_ctrl *cur_ctr; | ||
| 51 | const struct dw_hdmi_sym_term *sym_term; | ||
| 52 | enum drm_mode_status (*mode_valid)(struct drm_connector *connector, | ||
| 53 | struct drm_display_mode *mode); | ||
| 54 | }; | ||
| 55 | |||
| 56 | void dw_hdmi_unbind(struct device *dev, struct device *master, void *data); | ||
| 57 | int dw_hdmi_bind(struct device *dev, struct device *master, | ||
| 58 | void *data, struct drm_encoder *encoder, | ||
| 59 | struct resource *iores, int irq, | ||
| 60 | const struct dw_hdmi_plat_data *plat_data); | ||
| 61 | #endif /* __IMX_HDMI_H__ */ | ||
diff --git a/include/drm/bridge/ptn3460.h b/include/drm/bridge/ptn3460.h index ff62344fec6c..b11f8e17e72f 100644 --- a/include/drm/bridge/ptn3460.h +++ b/include/drm/bridge/ptn3460.h | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #define _DRM_BRIDGE_PTN3460_H_ | 15 | #define _DRM_BRIDGE_PTN3460_H_ |
| 16 | 16 | ||
| 17 | struct drm_device; | 17 | struct drm_device; |
| 18 | struct drm_bridge; | ||
| 18 | struct drm_encoder; | 19 | struct drm_encoder; |
| 19 | struct i2c_client; | 20 | struct i2c_client; |
| 20 | struct device_node; | 21 | struct device_node; |
| @@ -23,6 +24,9 @@ struct device_node; | |||
| 23 | 24 | ||
| 24 | int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, | 25 | int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, |
| 25 | struct i2c_client *client, struct device_node *node); | 26 | struct i2c_client *client, struct device_node *node); |
| 27 | |||
| 28 | void ptn3460_destroy(struct drm_bridge *bridge); | ||
| 29 | |||
| 26 | #else | 30 | #else |
| 27 | 31 | ||
| 28 | static inline int ptn3460_init(struct drm_device *dev, | 32 | static inline int ptn3460_init(struct drm_device *dev, |
| @@ -32,6 +36,10 @@ static inline int ptn3460_init(struct drm_device *dev, | |||
| 32 | return 0; | 36 | return 0; |
| 33 | } | 37 | } |
| 34 | 38 | ||
| 39 | static inline void ptn3460_destroy(struct drm_bridge *bridge) | ||
| 40 | { | ||
| 41 | } | ||
| 42 | |||
| 35 | #endif | 43 | #endif |
| 36 | 44 | ||
| 37 | #endif | 45 | #endif |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index e1b2e8b98af7..e928625a9da0 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -143,6 +143,7 @@ void drm_err(const char *format, ...); | |||
| 143 | #define DRIVER_MODESET 0x2000 | 143 | #define DRIVER_MODESET 0x2000 |
| 144 | #define DRIVER_PRIME 0x4000 | 144 | #define DRIVER_PRIME 0x4000 |
| 145 | #define DRIVER_RENDER 0x8000 | 145 | #define DRIVER_RENDER 0x8000 |
| 146 | #define DRIVER_ATOMIC 0x10000 | ||
| 146 | 147 | ||
| 147 | /***********************************************************************/ | 148 | /***********************************************************************/ |
| 148 | /** \name Macros to make printk easier */ | 149 | /** \name Macros to make printk easier */ |
| @@ -283,6 +284,8 @@ struct drm_file { | |||
| 283 | * in the plane list | 284 | * in the plane list |
| 284 | */ | 285 | */ |
| 285 | unsigned universal_planes:1; | 286 | unsigned universal_planes:1; |
| 287 | /* true if client understands atomic properties */ | ||
| 288 | unsigned atomic:1; | ||
| 286 | 289 | ||
| 287 | struct pid *pid; | 290 | struct pid *pid; |
| 288 | kuid_t uid; | 291 | kuid_t uid; |
| @@ -744,8 +747,6 @@ struct drm_device { | |||
| 744 | 747 | ||
| 745 | /** \name Context support */ | 748 | /** \name Context support */ |
| 746 | /*@{ */ | 749 | /*@{ */ |
| 747 | bool irq_enabled; /**< True if irq handler is enabled */ | ||
| 748 | int irq; | ||
| 749 | 750 | ||
| 750 | __volatile__ long context_flag; /**< Context swapping flag */ | 751 | __volatile__ long context_flag; /**< Context swapping flag */ |
| 751 | int last_context; /**< Last current context */ | 752 | int last_context; /**< Last current context */ |
| @@ -753,6 +754,8 @@ struct drm_device { | |||
| 753 | 754 | ||
| 754 | /** \name VBLANK IRQ support */ | 755 | /** \name VBLANK IRQ support */ |
| 755 | /*@{ */ | 756 | /*@{ */ |
| 757 | bool irq_enabled; | ||
| 758 | int irq; | ||
| 756 | 759 | ||
| 757 | /* | 760 | /* |
| 758 | * At load time, disabling the vblank interrupt won't be allowed since | 761 | * At load time, disabling the vblank interrupt won't be allowed since |
| @@ -954,6 +957,7 @@ extern void drm_master_put(struct drm_master **master); | |||
| 954 | extern void drm_put_dev(struct drm_device *dev); | 957 | extern void drm_put_dev(struct drm_device *dev); |
| 955 | extern void drm_unplug_dev(struct drm_device *dev); | 958 | extern void drm_unplug_dev(struct drm_device *dev); |
| 956 | extern unsigned int drm_debug; | 959 | extern unsigned int drm_debug; |
| 960 | extern bool drm_atomic; | ||
| 957 | 961 | ||
| 958 | /* Debugfs support */ | 962 | /* Debugfs support */ |
| 959 | #if defined(CONFIG_DEBUG_FS) | 963 | #if defined(CONFIG_DEBUG_FS) |
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index ad2229574dd9..51168a8b723a 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
| @@ -38,16 +38,25 @@ void drm_atomic_state_free(struct drm_atomic_state *state); | |||
| 38 | struct drm_crtc_state * __must_check | 38 | struct drm_crtc_state * __must_check |
| 39 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, | 39 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, |
| 40 | struct drm_crtc *crtc); | 40 | struct drm_crtc *crtc); |
| 41 | int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
| 42 | struct drm_crtc_state *state, struct drm_property *property, | ||
| 43 | uint64_t val); | ||
| 41 | struct drm_plane_state * __must_check | 44 | struct drm_plane_state * __must_check |
| 42 | drm_atomic_get_plane_state(struct drm_atomic_state *state, | 45 | drm_atomic_get_plane_state(struct drm_atomic_state *state, |
| 43 | struct drm_plane *plane); | 46 | struct drm_plane *plane); |
| 47 | int drm_atomic_plane_set_property(struct drm_plane *plane, | ||
| 48 | struct drm_plane_state *state, struct drm_property *property, | ||
| 49 | uint64_t val); | ||
| 44 | struct drm_connector_state * __must_check | 50 | struct drm_connector_state * __must_check |
| 45 | drm_atomic_get_connector_state(struct drm_atomic_state *state, | 51 | drm_atomic_get_connector_state(struct drm_atomic_state *state, |
| 46 | struct drm_connector *connector); | 52 | struct drm_connector *connector); |
| 53 | int drm_atomic_connector_set_property(struct drm_connector *connector, | ||
| 54 | struct drm_connector_state *state, struct drm_property *property, | ||
| 55 | uint64_t val); | ||
| 47 | 56 | ||
| 48 | int __must_check | 57 | int __must_check |
| 49 | drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state, | 58 | drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, |
| 50 | struct drm_plane *plane, struct drm_crtc *crtc); | 59 | struct drm_crtc *crtc); |
| 51 | void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, | 60 | void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, |
| 52 | struct drm_framebuffer *fb); | 61 | struct drm_framebuffer *fb); |
| 53 | int __must_check | 62 | int __must_check |
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index f956b413311e..8039d54a7441 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h | |||
| @@ -30,6 +30,10 @@ | |||
| 30 | 30 | ||
| 31 | #include <drm/drm_crtc.h> | 31 | #include <drm/drm_crtc.h> |
| 32 | 32 | ||
| 33 | int drm_atomic_helper_check_modeset(struct drm_device *dev, | ||
| 34 | struct drm_atomic_state *state); | ||
| 35 | int drm_atomic_helper_check_planes(struct drm_device *dev, | ||
| 36 | struct drm_atomic_state *state); | ||
| 33 | int drm_atomic_helper_check(struct drm_device *dev, | 37 | int drm_atomic_helper_check(struct drm_device *dev, |
| 34 | struct drm_atomic_state *state); | 38 | struct drm_atomic_state *state); |
| 35 | int drm_atomic_helper_commit(struct drm_device *dev, | 39 | int drm_atomic_helper_commit(struct drm_device *dev, |
| @@ -78,6 +82,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, | |||
| 78 | struct drm_framebuffer *fb, | 82 | struct drm_framebuffer *fb, |
| 79 | struct drm_pending_vblank_event *event, | 83 | struct drm_pending_vblank_event *event, |
| 80 | uint32_t flags); | 84 | uint32_t flags); |
| 85 | void drm_atomic_helper_connector_dpms(struct drm_connector *connector, | ||
| 86 | int mode); | ||
| 81 | 87 | ||
| 82 | /* default implementations for state handling */ | 88 | /* default implementations for state handling */ |
| 83 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); | 89 | void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc); |
| @@ -123,4 +129,41 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, | |||
| 123 | #define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \ | 129 | #define drm_atomic_crtc_state_for_each_plane(plane, crtc_state) \ |
| 124 | drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) | 130 | drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) |
| 125 | 131 | ||
| 132 | /* | ||
| 133 | * drm_atomic_plane_disabling - check whether a plane is being disabled | ||
| 134 | * @plane: plane object | ||
| 135 | * @old_state: previous atomic state | ||
| 136 | * | ||
| 137 | * Checks the atomic state of a plane to determine whether it's being disabled | ||
| 138 | * or not. This also WARNs if it detects an invalid state (both CRTC and FB | ||
| 139 | * need to either both be NULL or both be non-NULL). | ||
| 140 | * | ||
| 141 | * RETURNS: | ||
| 142 | * True if the plane is being disabled, false otherwise. | ||
| 143 | */ | ||
| 144 | static inline bool | ||
| 145 | drm_atomic_plane_disabling(struct drm_plane *plane, | ||
| 146 | struct drm_plane_state *old_state) | ||
| 147 | { | ||
| 148 | /* | ||
| 149 | * When disabling a plane, CRTC and FB should always be NULL together. | ||
| 150 | * Anything else should be considered a bug in the atomic core, so we | ||
| 151 | * gently warn about it. | ||
| 152 | */ | ||
| 153 | WARN_ON((plane->state->crtc == NULL && plane->state->fb != NULL) || | ||
| 154 | (plane->state->crtc != NULL && plane->state->fb == NULL)); | ||
| 155 | |||
| 156 | /* | ||
| 157 | * When using the transitional helpers, old_state may be NULL. If so, | ||
| 158 | * we know nothing about the current state and have to assume that it | ||
| 159 | * might be enabled. | ||
| 160 | * | ||
| 161 | * When using the atomic helpers, old_state won't be NULL. Therefore | ||
| 162 | * this check assumes that either the driver will have reconstructed | ||
| 163 | * the correct state in ->reset() or that the driver will have taken | ||
| 164 | * appropriate measures to disable all planes. | ||
| 165 | */ | ||
| 166 | return (!old_state || old_state->crtc) && !plane->state->crtc; | ||
| 167 | } | ||
| 168 | |||
| 126 | #endif /* DRM_ATOMIC_HELPER_H_ */ | 169 | #endif /* DRM_ATOMIC_HELPER_H_ */ |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index b86329813ad3..920e21a8f3fd 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -31,6 +31,7 @@ | |||
| 31 | #include <linux/idr.h> | 31 | #include <linux/idr.h> |
| 32 | #include <linux/fb.h> | 32 | #include <linux/fb.h> |
| 33 | #include <linux/hdmi.h> | 33 | #include <linux/hdmi.h> |
| 34 | #include <linux/media-bus-format.h> | ||
| 34 | #include <uapi/drm/drm_mode.h> | 35 | #include <uapi/drm/drm_mode.h> |
| 35 | #include <uapi/drm/drm_fourcc.h> | 36 | #include <uapi/drm/drm_fourcc.h> |
| 36 | #include <drm/drm_modeset_lock.h> | 37 | #include <drm/drm_modeset_lock.h> |
| @@ -63,8 +64,16 @@ struct drm_mode_object { | |||
| 63 | 64 | ||
| 64 | #define DRM_OBJECT_MAX_PROPERTY 24 | 65 | #define DRM_OBJECT_MAX_PROPERTY 24 |
| 65 | struct drm_object_properties { | 66 | struct drm_object_properties { |
| 66 | int count; | 67 | int count, atomic_count; |
| 67 | uint32_t ids[DRM_OBJECT_MAX_PROPERTY]; | 68 | /* NOTE: if we ever start dynamically destroying properties (ie. |
| 69 | * not at drm_mode_config_cleanup() time), then we'd have to do | ||
| 70 | * a better job of detaching property from mode objects to avoid | ||
| 71 | * dangling property pointers: | ||
| 72 | */ | ||
| 73 | struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY]; | ||
| 74 | /* do not read/write values directly, but use drm_object_property_get_value() | ||
| 75 | * and drm_object_property_set_value(): | ||
| 76 | */ | ||
| 68 | uint64_t values[DRM_OBJECT_MAX_PROPERTY]; | 77 | uint64_t values[DRM_OBJECT_MAX_PROPERTY]; |
| 69 | }; | 78 | }; |
| 70 | 79 | ||
| @@ -131,6 +140,9 @@ struct drm_display_info { | |||
| 131 | enum subpixel_order subpixel_order; | 140 | enum subpixel_order subpixel_order; |
| 132 | u32 color_formats; | 141 | u32 color_formats; |
| 133 | 142 | ||
| 143 | const u32 *bus_formats; | ||
| 144 | unsigned int num_bus_formats; | ||
| 145 | |||
| 134 | /* Mask of supported hdmi deep color modes */ | 146 | /* Mask of supported hdmi deep color modes */ |
| 135 | u8 edid_hdmi_dc_modes; | 147 | u8 edid_hdmi_dc_modes; |
| 136 | 148 | ||
| @@ -237,8 +249,11 @@ struct drm_atomic_state; | |||
| 237 | 249 | ||
| 238 | /** | 250 | /** |
| 239 | * struct drm_crtc_state - mutable CRTC state | 251 | * struct drm_crtc_state - mutable CRTC state |
| 252 | * @crtc: backpointer to the CRTC | ||
| 240 | * @enable: whether the CRTC should be enabled, gates all other state | 253 | * @enable: whether the CRTC should be enabled, gates all other state |
| 254 | * @active: whether the CRTC is actively displaying (used for DPMS) | ||
| 241 | * @mode_changed: for use by helpers and drivers when computing state updates | 255 | * @mode_changed: for use by helpers and drivers when computing state updates |
| 256 | * @active_changed: for use by helpers and drivers when computing state updates | ||
| 242 | * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes | 257 | * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes |
| 243 | * @last_vblank_count: for helpers and drivers to capture the vblank of the | 258 | * @last_vblank_count: for helpers and drivers to capture the vblank of the |
| 244 | * update to ensure framebuffer cleanup isn't done too early | 259 | * update to ensure framebuffer cleanup isn't done too early |
| @@ -248,13 +263,23 @@ struct drm_atomic_state; | |||
| 248 | * @event: optional pointer to a DRM event to signal upon completion of the | 263 | * @event: optional pointer to a DRM event to signal upon completion of the |
| 249 | * state update | 264 | * state update |
| 250 | * @state: backpointer to global drm_atomic_state | 265 | * @state: backpointer to global drm_atomic_state |
| 266 | * | ||
| 267 | * Note that the distinction between @enable and @active is rather subtile: | ||
| 268 | * Flipping @active while @enable is set without changing anything else may | ||
| 269 | * never return in a failure from the ->atomic_check callback. Userspace assumes | ||
| 270 | * that a DPMS On will always succeed. In other words: @enable controls resource | ||
| 271 | * assignment, @active controls the actual hardware state. | ||
| 251 | */ | 272 | */ |
| 252 | struct drm_crtc_state { | 273 | struct drm_crtc_state { |
| 274 | struct drm_crtc *crtc; | ||
| 275 | |||
| 253 | bool enable; | 276 | bool enable; |
| 277 | bool active; | ||
| 254 | 278 | ||
| 255 | /* computed state bits used by helpers and drivers */ | 279 | /* computed state bits used by helpers and drivers */ |
| 256 | bool planes_changed : 1; | 280 | bool planes_changed : 1; |
| 257 | bool mode_changed : 1; | 281 | bool mode_changed : 1; |
| 282 | bool active_changed : 1; | ||
| 258 | 283 | ||
| 259 | /* attached planes bitmask: | 284 | /* attached planes bitmask: |
| 260 | * WARNING: transitional helpers do not maintain plane_mask so | 285 | * WARNING: transitional helpers do not maintain plane_mask so |
| @@ -292,6 +317,9 @@ struct drm_crtc_state { | |||
| 292 | * @atomic_duplicate_state: duplicate the atomic state for this CRTC | 317 | * @atomic_duplicate_state: duplicate the atomic state for this CRTC |
| 293 | * @atomic_destroy_state: destroy an atomic state for this CRTC | 318 | * @atomic_destroy_state: destroy an atomic state for this CRTC |
| 294 | * @atomic_set_property: set a property on an atomic state for this CRTC | 319 | * @atomic_set_property: set a property on an atomic state for this CRTC |
| 320 | * (do not call directly, use drm_atomic_crtc_set_property()) | ||
| 321 | * @atomic_get_property: get a property on an atomic state for this CRTC | ||
| 322 | * (do not call directly, use drm_atomic_crtc_get_property()) | ||
| 295 | * | 323 | * |
| 296 | * The drm_crtc_funcs structure is the central CRTC management structure | 324 | * The drm_crtc_funcs structure is the central CRTC management structure |
| 297 | * in the DRM. Each CRTC controls one or more connectors (note that the name | 325 | * in the DRM. Each CRTC controls one or more connectors (note that the name |
| @@ -351,6 +379,10 @@ struct drm_crtc_funcs { | |||
| 351 | struct drm_crtc_state *state, | 379 | struct drm_crtc_state *state, |
| 352 | struct drm_property *property, | 380 | struct drm_property *property, |
| 353 | uint64_t val); | 381 | uint64_t val); |
| 382 | int (*atomic_get_property)(struct drm_crtc *crtc, | ||
| 383 | const struct drm_crtc_state *state, | ||
| 384 | struct drm_property *property, | ||
| 385 | uint64_t *val); | ||
| 354 | }; | 386 | }; |
| 355 | 387 | ||
| 356 | /** | 388 | /** |
| @@ -449,11 +481,14 @@ struct drm_crtc { | |||
| 449 | 481 | ||
| 450 | /** | 482 | /** |
| 451 | * struct drm_connector_state - mutable connector state | 483 | * struct drm_connector_state - mutable connector state |
| 484 | * @connector: backpointer to the connector | ||
| 452 | * @crtc: CRTC to connect connector to, NULL if disabled | 485 | * @crtc: CRTC to connect connector to, NULL if disabled |
| 453 | * @best_encoder: can be used by helpers and drivers to select the encoder | 486 | * @best_encoder: can be used by helpers and drivers to select the encoder |
| 454 | * @state: backpointer to global drm_atomic_state | 487 | * @state: backpointer to global drm_atomic_state |
| 455 | */ | 488 | */ |
| 456 | struct drm_connector_state { | 489 | struct drm_connector_state { |
| 490 | struct drm_connector *connector; | ||
| 491 | |||
| 457 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */ | 492 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */ |
| 458 | 493 | ||
| 459 | struct drm_encoder *best_encoder; | 494 | struct drm_encoder *best_encoder; |
| @@ -463,7 +498,7 @@ struct drm_connector_state { | |||
| 463 | 498 | ||
| 464 | /** | 499 | /** |
| 465 | * struct drm_connector_funcs - control connectors on a given device | 500 | * struct drm_connector_funcs - control connectors on a given device |
| 466 | * @dpms: set power state (see drm_crtc_funcs above) | 501 | * @dpms: set power state |
| 467 | * @save: save connector state | 502 | * @save: save connector state |
| 468 | * @restore: restore connector state | 503 | * @restore: restore connector state |
| 469 | * @reset: reset connector after state has been invalidated (e.g. resume) | 504 | * @reset: reset connector after state has been invalidated (e.g. resume) |
| @@ -475,6 +510,9 @@ struct drm_connector_state { | |||
| 475 | * @atomic_duplicate_state: duplicate the atomic state for this connector | 510 | * @atomic_duplicate_state: duplicate the atomic state for this connector |
| 476 | * @atomic_destroy_state: destroy an atomic state for this connector | 511 | * @atomic_destroy_state: destroy an atomic state for this connector |
| 477 | * @atomic_set_property: set a property on an atomic state for this connector | 512 | * @atomic_set_property: set a property on an atomic state for this connector |
| 513 | * (do not call directly, use drm_atomic_connector_set_property()) | ||
| 514 | * @atomic_get_property: get a property on an atomic state for this connector | ||
| 515 | * (do not call directly, use drm_atomic_connector_get_property()) | ||
| 478 | * | 516 | * |
| 479 | * Each CRTC may have one or more connectors attached to it. The functions | 517 | * Each CRTC may have one or more connectors attached to it. The functions |
| 480 | * below allow the core DRM code to control connectors, enumerate available modes, | 518 | * below allow the core DRM code to control connectors, enumerate available modes, |
| @@ -508,6 +546,10 @@ struct drm_connector_funcs { | |||
| 508 | struct drm_connector_state *state, | 546 | struct drm_connector_state *state, |
| 509 | struct drm_property *property, | 547 | struct drm_property *property, |
| 510 | uint64_t val); | 548 | uint64_t val); |
| 549 | int (*atomic_get_property)(struct drm_connector *connector, | ||
| 550 | const struct drm_connector_state *state, | ||
| 551 | struct drm_property *property, | ||
| 552 | uint64_t *val); | ||
| 511 | }; | 553 | }; |
| 512 | 554 | ||
| 513 | /** | 555 | /** |
| @@ -693,6 +735,7 @@ struct drm_connector { | |||
| 693 | 735 | ||
| 694 | /** | 736 | /** |
| 695 | * struct drm_plane_state - mutable plane state | 737 | * struct drm_plane_state - mutable plane state |
| 738 | * @plane: backpointer to the plane | ||
| 696 | * @crtc: currently bound CRTC, NULL if disabled | 739 | * @crtc: currently bound CRTC, NULL if disabled |
| 697 | * @fb: currently bound framebuffer | 740 | * @fb: currently bound framebuffer |
| 698 | * @fence: optional fence to wait for before scanning out @fb | 741 | * @fence: optional fence to wait for before scanning out @fb |
| @@ -709,6 +752,8 @@ struct drm_connector { | |||
| 709 | * @state: backpointer to global drm_atomic_state | 752 | * @state: backpointer to global drm_atomic_state |
| 710 | */ | 753 | */ |
| 711 | struct drm_plane_state { | 754 | struct drm_plane_state { |
| 755 | struct drm_plane *plane; | ||
| 756 | |||
| 712 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ | 757 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ |
| 713 | struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ | 758 | struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ |
| 714 | struct fence *fence; | 759 | struct fence *fence; |
| @@ -721,6 +766,9 @@ struct drm_plane_state { | |||
| 721 | uint32_t src_x, src_y; | 766 | uint32_t src_x, src_y; |
| 722 | uint32_t src_h, src_w; | 767 | uint32_t src_h, src_w; |
| 723 | 768 | ||
| 769 | /* Plane rotation */ | ||
| 770 | unsigned int rotation; | ||
| 771 | |||
| 724 | struct drm_atomic_state *state; | 772 | struct drm_atomic_state *state; |
| 725 | }; | 773 | }; |
| 726 | 774 | ||
| @@ -735,6 +783,9 @@ struct drm_plane_state { | |||
| 735 | * @atomic_duplicate_state: duplicate the atomic state for this plane | 783 | * @atomic_duplicate_state: duplicate the atomic state for this plane |
| 736 | * @atomic_destroy_state: destroy an atomic state for this plane | 784 | * @atomic_destroy_state: destroy an atomic state for this plane |
| 737 | * @atomic_set_property: set a property on an atomic state for this plane | 785 | * @atomic_set_property: set a property on an atomic state for this plane |
| 786 | * (do not call directly, use drm_atomic_plane_set_property()) | ||
| 787 | * @atomic_get_property: get a property on an atomic state for this plane | ||
| 788 | * (do not call directly, use drm_atomic_plane_get_property()) | ||
| 738 | */ | 789 | */ |
| 739 | struct drm_plane_funcs { | 790 | struct drm_plane_funcs { |
| 740 | int (*update_plane)(struct drm_plane *plane, | 791 | int (*update_plane)(struct drm_plane *plane, |
| @@ -758,6 +809,10 @@ struct drm_plane_funcs { | |||
| 758 | struct drm_plane_state *state, | 809 | struct drm_plane_state *state, |
| 759 | struct drm_property *property, | 810 | struct drm_property *property, |
| 760 | uint64_t val); | 811 | uint64_t val); |
| 812 | int (*atomic_get_property)(struct drm_plane *plane, | ||
| 813 | const struct drm_plane_state *state, | ||
| 814 | struct drm_property *property, | ||
| 815 | uint64_t *val); | ||
| 761 | }; | 816 | }; |
| 762 | 817 | ||
| 763 | enum drm_plane_type { | 818 | enum drm_plane_type { |
| @@ -813,15 +868,16 @@ struct drm_plane { | |||
| 813 | 868 | ||
| 814 | /** | 869 | /** |
| 815 | * struct drm_bridge_funcs - drm_bridge control functions | 870 | * struct drm_bridge_funcs - drm_bridge control functions |
| 871 | * @attach: Called during drm_bridge_attach | ||
| 816 | * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge | 872 | * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge |
| 817 | * @disable: Called right before encoder prepare, disables the bridge | 873 | * @disable: Called right before encoder prepare, disables the bridge |
| 818 | * @post_disable: Called right after encoder prepare, for lockstepped disable | 874 | * @post_disable: Called right after encoder prepare, for lockstepped disable |
| 819 | * @mode_set: Set this mode to the bridge | 875 | * @mode_set: Set this mode to the bridge |
| 820 | * @pre_enable: Called right before encoder commit, for lockstepped commit | 876 | * @pre_enable: Called right before encoder commit, for lockstepped commit |
| 821 | * @enable: Called right after encoder commit, enables the bridge | 877 | * @enable: Called right after encoder commit, enables the bridge |
| 822 | * @destroy: make object go away | ||
| 823 | */ | 878 | */ |
| 824 | struct drm_bridge_funcs { | 879 | struct drm_bridge_funcs { |
| 880 | int (*attach)(struct drm_bridge *bridge); | ||
| 825 | bool (*mode_fixup)(struct drm_bridge *bridge, | 881 | bool (*mode_fixup)(struct drm_bridge *bridge, |
| 826 | const struct drm_display_mode *mode, | 882 | const struct drm_display_mode *mode, |
| 827 | struct drm_display_mode *adjusted_mode); | 883 | struct drm_display_mode *adjusted_mode); |
| @@ -832,22 +888,24 @@ struct drm_bridge_funcs { | |||
| 832 | struct drm_display_mode *adjusted_mode); | 888 | struct drm_display_mode *adjusted_mode); |
| 833 | void (*pre_enable)(struct drm_bridge *bridge); | 889 | void (*pre_enable)(struct drm_bridge *bridge); |
| 834 | void (*enable)(struct drm_bridge *bridge); | 890 | void (*enable)(struct drm_bridge *bridge); |
| 835 | void (*destroy)(struct drm_bridge *bridge); | ||
| 836 | }; | 891 | }; |
| 837 | 892 | ||
| 838 | /** | 893 | /** |
| 839 | * struct drm_bridge - central DRM bridge control structure | 894 | * struct drm_bridge - central DRM bridge control structure |
| 840 | * @dev: DRM device this bridge belongs to | 895 | * @dev: DRM device this bridge belongs to |
| 841 | * @head: list management | 896 | * @of_node: device node pointer to the bridge |
| 897 | * @list: to keep track of all added bridges | ||
| 842 | * @base: base mode object | 898 | * @base: base mode object |
| 843 | * @funcs: control functions | 899 | * @funcs: control functions |
| 844 | * @driver_private: pointer to the bridge driver's internal context | 900 | * @driver_private: pointer to the bridge driver's internal context |
| 845 | */ | 901 | */ |
| 846 | struct drm_bridge { | 902 | struct drm_bridge { |
| 847 | struct drm_device *dev; | 903 | struct drm_device *dev; |
| 848 | struct list_head head; | 904 | struct drm_encoder *encoder; |
| 849 | 905 | #ifdef CONFIG_OF | |
| 850 | struct drm_mode_object base; | 906 | struct device_node *of_node; |
| 907 | #endif | ||
| 908 | struct list_head list; | ||
| 851 | 909 | ||
| 852 | const struct drm_bridge_funcs *funcs; | 910 | const struct drm_bridge_funcs *funcs; |
| 853 | void *driver_private; | 911 | void *driver_private; |
| @@ -856,7 +914,8 @@ struct drm_bridge { | |||
| 856 | /** | 914 | /** |
| 857 | * struct struct drm_atomic_state - the global state object for atomic updates | 915 | * struct struct drm_atomic_state - the global state object for atomic updates |
| 858 | * @dev: parent DRM device | 916 | * @dev: parent DRM device |
| 859 | * @flags: state flags like async update | 917 | * @allow_modeset: allow full modeset |
| 918 | * @legacy_cursor_update: hint to enforce legacy cursor ioctl semantics | ||
| 860 | * @planes: pointer to array of plane pointers | 919 | * @planes: pointer to array of plane pointers |
| 861 | * @plane_states: pointer to array of plane states pointers | 920 | * @plane_states: pointer to array of plane states pointers |
| 862 | * @crtcs: pointer to array of CRTC pointers | 921 | * @crtcs: pointer to array of CRTC pointers |
| @@ -868,7 +927,8 @@ struct drm_bridge { | |||
| 868 | */ | 927 | */ |
| 869 | struct drm_atomic_state { | 928 | struct drm_atomic_state { |
| 870 | struct drm_device *dev; | 929 | struct drm_device *dev; |
| 871 | uint32_t flags; | 930 | bool allow_modeset : 1; |
| 931 | bool legacy_cursor_update : 1; | ||
| 872 | struct drm_plane **planes; | 932 | struct drm_plane **planes; |
| 873 | struct drm_plane_state **plane_states; | 933 | struct drm_plane_state **plane_states; |
| 874 | struct drm_crtc **crtcs; | 934 | struct drm_crtc **crtcs; |
| @@ -950,7 +1010,6 @@ struct drm_mode_group { | |||
| 950 | uint32_t num_crtcs; | 1010 | uint32_t num_crtcs; |
| 951 | uint32_t num_encoders; | 1011 | uint32_t num_encoders; |
| 952 | uint32_t num_connectors; | 1012 | uint32_t num_connectors; |
| 953 | uint32_t num_bridges; | ||
| 954 | 1013 | ||
| 955 | /* list of object IDs for this group */ | 1014 | /* list of object IDs for this group */ |
| 956 | uint32_t *id_list; | 1015 | uint32_t *id_list; |
| @@ -969,8 +1028,6 @@ struct drm_mode_group { | |||
| 969 | * @fb_list: list of framebuffers available | 1028 | * @fb_list: list of framebuffers available |
| 970 | * @num_connector: number of connectors on this device | 1029 | * @num_connector: number of connectors on this device |
| 971 | * @connector_list: list of connector objects | 1030 | * @connector_list: list of connector objects |
| 972 | * @num_bridge: number of bridges on this device | ||
| 973 | * @bridge_list: list of bridge objects | ||
| 974 | * @num_encoder: number of encoders on this device | 1031 | * @num_encoder: number of encoders on this device |
| 975 | * @encoder_list: list of encoder objects | 1032 | * @encoder_list: list of encoder objects |
| 976 | * @num_overlay_plane: number of overlay planes on this device | 1033 | * @num_overlay_plane: number of overlay planes on this device |
| @@ -1015,8 +1072,6 @@ struct drm_mode_config { | |||
| 1015 | 1072 | ||
| 1016 | int num_connector; | 1073 | int num_connector; |
| 1017 | struct list_head connector_list; | 1074 | struct list_head connector_list; |
| 1018 | int num_bridge; | ||
| 1019 | struct list_head bridge_list; | ||
| 1020 | int num_encoder; | 1075 | int num_encoder; |
| 1021 | struct list_head encoder_list; | 1076 | struct list_head encoder_list; |
| 1022 | 1077 | ||
| @@ -1043,6 +1098,7 @@ struct drm_mode_config { | |||
| 1043 | /* output poll support */ | 1098 | /* output poll support */ |
| 1044 | bool poll_enabled; | 1099 | bool poll_enabled; |
| 1045 | bool poll_running; | 1100 | bool poll_running; |
| 1101 | bool delayed_event; | ||
| 1046 | struct delayed_work output_poll_work; | 1102 | struct delayed_work output_poll_work; |
| 1047 | 1103 | ||
| 1048 | /* pointers to standard properties */ | 1104 | /* pointers to standard properties */ |
| @@ -1053,6 +1109,17 @@ struct drm_mode_config { | |||
| 1053 | struct drm_property *tile_property; | 1109 | struct drm_property *tile_property; |
| 1054 | struct drm_property *plane_type_property; | 1110 | struct drm_property *plane_type_property; |
| 1055 | struct drm_property *rotation_property; | 1111 | struct drm_property *rotation_property; |
| 1112 | struct drm_property *prop_src_x; | ||
| 1113 | struct drm_property *prop_src_y; | ||
| 1114 | struct drm_property *prop_src_w; | ||
| 1115 | struct drm_property *prop_src_h; | ||
| 1116 | struct drm_property *prop_crtc_x; | ||
| 1117 | struct drm_property *prop_crtc_y; | ||
| 1118 | struct drm_property *prop_crtc_w; | ||
| 1119 | struct drm_property *prop_crtc_h; | ||
| 1120 | struct drm_property *prop_fb_id; | ||
| 1121 | struct drm_property *prop_crtc_id; | ||
| 1122 | struct drm_property *prop_active; | ||
| 1056 | 1123 | ||
| 1057 | /* DVI-I properties */ | 1124 | /* DVI-I properties */ |
| 1058 | struct drm_property *dvi_i_subconnector_property; | 1125 | struct drm_property *dvi_i_subconnector_property; |
| @@ -1153,9 +1220,10 @@ extern unsigned int drm_connector_index(struct drm_connector *connector); | |||
| 1153 | /* helper to unplug all connectors from sysfs for device */ | 1220 | /* helper to unplug all connectors from sysfs for device */ |
| 1154 | extern void drm_connector_unplug_all(struct drm_device *dev); | 1221 | extern void drm_connector_unplug_all(struct drm_device *dev); |
| 1155 | 1222 | ||
| 1156 | extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, | 1223 | extern int drm_bridge_add(struct drm_bridge *bridge); |
| 1157 | const struct drm_bridge_funcs *funcs); | 1224 | extern void drm_bridge_remove(struct drm_bridge *bridge); |
| 1158 | extern void drm_bridge_cleanup(struct drm_bridge *bridge); | 1225 | extern struct drm_bridge *of_drm_find_bridge(struct device_node *np); |
| 1226 | extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge); | ||
| 1159 | 1227 | ||
| 1160 | extern int drm_encoder_init(struct drm_device *dev, | 1228 | extern int drm_encoder_init(struct drm_device *dev, |
| 1161 | struct drm_encoder *encoder, | 1229 | struct drm_encoder *encoder, |
| @@ -1191,6 +1259,8 @@ extern int drm_plane_init(struct drm_device *dev, | |||
| 1191 | extern void drm_plane_cleanup(struct drm_plane *plane); | 1259 | extern void drm_plane_cleanup(struct drm_plane *plane); |
| 1192 | extern unsigned int drm_plane_index(struct drm_plane *plane); | 1260 | extern unsigned int drm_plane_index(struct drm_plane *plane); |
| 1193 | extern void drm_plane_force_disable(struct drm_plane *plane); | 1261 | extern void drm_plane_force_disable(struct drm_plane *plane); |
| 1262 | extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode, | ||
| 1263 | int *hdisplay, int *vdisplay); | ||
| 1194 | extern int drm_crtc_check_viewport(const struct drm_crtc *crtc, | 1264 | extern int drm_crtc_check_viewport(const struct drm_crtc *crtc, |
| 1195 | int x, int y, | 1265 | int x, int y, |
| 1196 | const struct drm_display_mode *mode, | 1266 | const struct drm_display_mode *mode, |
| @@ -1224,6 +1294,10 @@ int drm_mode_connector_set_tile_property(struct drm_connector *connector); | |||
| 1224 | extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, | 1294 | extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, |
| 1225 | const struct edid *edid); | 1295 | const struct edid *edid); |
| 1226 | 1296 | ||
| 1297 | extern int drm_display_info_set_bus_formats(struct drm_display_info *info, | ||
| 1298 | const u32 *formats, | ||
| 1299 | unsigned int num_formats); | ||
| 1300 | |||
| 1227 | static inline bool drm_property_type_is(struct drm_property *property, | 1301 | static inline bool drm_property_type_is(struct drm_property *property, |
| 1228 | uint32_t type) | 1302 | uint32_t type) |
| 1229 | { | 1303 | { |
| @@ -1279,6 +1353,8 @@ struct drm_property *drm_property_create_signed_range(struct drm_device *dev, | |||
| 1279 | int64_t min, int64_t max); | 1353 | int64_t min, int64_t max); |
| 1280 | struct drm_property *drm_property_create_object(struct drm_device *dev, | 1354 | struct drm_property *drm_property_create_object(struct drm_device *dev, |
| 1281 | int flags, const char *name, uint32_t type); | 1355 | int flags, const char *name, uint32_t type); |
| 1356 | struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags, | ||
| 1357 | const char *name); | ||
| 1282 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); | 1358 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); |
| 1283 | extern int drm_property_add_enum(struct drm_property *property, int index, | 1359 | extern int drm_property_add_enum(struct drm_property *property, int index, |
| 1284 | uint64_t value, const char *name); | 1360 | uint64_t value, const char *name); |
| @@ -1290,6 +1366,10 @@ extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | |||
| 1290 | extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); | 1366 | extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
| 1291 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); | 1367 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); |
| 1292 | extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev); | 1368 | extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev); |
| 1369 | extern bool drm_property_change_valid_get(struct drm_property *property, | ||
| 1370 | uint64_t value, struct drm_mode_object **ref); | ||
| 1371 | extern void drm_property_change_valid_put(struct drm_property *property, | ||
| 1372 | struct drm_mode_object *ref); | ||
| 1293 | 1373 | ||
| 1294 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | 1374 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
| 1295 | struct drm_encoder *encoder); | 1375 | struct drm_encoder *encoder); |
| @@ -1381,6 +1461,8 @@ extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, | |||
| 1381 | extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane, | 1461 | extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane, |
| 1382 | struct drm_property *property, | 1462 | struct drm_property *property, |
| 1383 | uint64_t value); | 1463 | uint64_t value); |
| 1464 | extern int drm_mode_atomic_ioctl(struct drm_device *dev, | ||
| 1465 | void *data, struct drm_file *file_priv); | ||
| 1384 | 1466 | ||
| 1385 | extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, | 1467 | extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, |
| 1386 | int *bpp); | 1468 | int *bpp); |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index 7adbb65ea8ae..c250a22b39ab 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
| @@ -39,17 +39,38 @@ | |||
| 39 | 39 | ||
| 40 | #include <linux/fb.h> | 40 | #include <linux/fb.h> |
| 41 | 41 | ||
| 42 | #include <drm/drm_crtc.h> | ||
| 43 | |||
| 42 | enum mode_set_atomic { | 44 | enum mode_set_atomic { |
| 43 | LEAVE_ATOMIC_MODE_SET, | 45 | LEAVE_ATOMIC_MODE_SET, |
| 44 | ENTER_ATOMIC_MODE_SET, | 46 | ENTER_ATOMIC_MODE_SET, |
| 45 | }; | 47 | }; |
| 46 | 48 | ||
| 47 | /** | 49 | /** |
| 48 | * drm_crtc_helper_funcs - helper operations for CRTCs | 50 | * struct drm_crtc_helper_funcs - helper operations for CRTCs |
| 49 | * @mode_fixup: try to fixup proposed mode for this connector | 51 | * @dpms: set power state |
| 52 | * @prepare: prepare the CRTC, called before @mode_set | ||
| 53 | * @commit: commit changes to CRTC, called after @mode_set | ||
| 54 | * @mode_fixup: try to fixup proposed mode for this CRTC | ||
| 50 | * @mode_set: set this mode | 55 | * @mode_set: set this mode |
| 56 | * @mode_set_nofb: set mode only (no scanout buffer attached) | ||
| 57 | * @mode_set_base: update the scanout buffer | ||
| 58 | * @mode_set_base_atomic: non-blocking mode set (used for kgdb support) | ||
| 59 | * @load_lut: load color palette | ||
| 60 | * @disable: disable CRTC when no longer in use | ||
| 61 | * @enable: enable CRTC | ||
| 62 | * @atomic_check: check for validity of an atomic state | ||
| 63 | * @atomic_begin: begin atomic update | ||
| 64 | * @atomic_flush: flush atomic update | ||
| 51 | * | 65 | * |
| 52 | * The helper operations are called by the mid-layer CRTC helper. | 66 | * The helper operations are called by the mid-layer CRTC helper. |
| 67 | * | ||
| 68 | * Note that with atomic helpers @dpms, @prepare and @commit hooks are | ||
| 69 | * deprecated. Used @enable and @disable instead exclusively. | ||
| 70 | * | ||
| 71 | * With legacy crtc helpers there's a big semantic difference between @disable | ||
| 72 | * and the other hooks: @disable also needs to release any resources acquired in | ||
| 73 | * @mode_set (like shared PLLs). | ||
| 53 | */ | 74 | */ |
| 54 | struct drm_crtc_helper_funcs { | 75 | struct drm_crtc_helper_funcs { |
| 55 | /* | 76 | /* |
| @@ -80,8 +101,8 @@ struct drm_crtc_helper_funcs { | |||
| 80 | /* reload the current crtc LUT */ | 101 | /* reload the current crtc LUT */ |
| 81 | void (*load_lut)(struct drm_crtc *crtc); | 102 | void (*load_lut)(struct drm_crtc *crtc); |
| 82 | 103 | ||
| 83 | /* disable crtc when not in use - more explicit than dpms off */ | ||
| 84 | void (*disable)(struct drm_crtc *crtc); | 104 | void (*disable)(struct drm_crtc *crtc); |
| 105 | void (*enable)(struct drm_crtc *crtc); | ||
| 85 | 106 | ||
| 86 | /* atomic helpers */ | 107 | /* atomic helpers */ |
| 87 | int (*atomic_check)(struct drm_crtc *crtc, | 108 | int (*atomic_check)(struct drm_crtc *crtc, |
| @@ -91,11 +112,28 @@ struct drm_crtc_helper_funcs { | |||
| 91 | }; | 112 | }; |
| 92 | 113 | ||
| 93 | /** | 114 | /** |
| 94 | * drm_encoder_helper_funcs - helper operations for encoders | 115 | * struct drm_encoder_helper_funcs - helper operations for encoders |
| 116 | * @dpms: set power state | ||
| 117 | * @save: save connector state | ||
| 118 | * @restore: restore connector state | ||
| 95 | * @mode_fixup: try to fixup proposed mode for this connector | 119 | * @mode_fixup: try to fixup proposed mode for this connector |
| 120 | * @prepare: part of the disable sequence, called before the CRTC modeset | ||
| 121 | * @commit: called after the CRTC modeset | ||
| 96 | * @mode_set: set this mode | 122 | * @mode_set: set this mode |
| 123 | * @get_crtc: return CRTC that the encoder is currently attached to | ||
| 124 | * @detect: connection status detection | ||
| 125 | * @disable: disable encoder when not in use (overrides DPMS off) | ||
| 126 | * @enable: enable encoder | ||
| 127 | * @atomic_check: check for validity of an atomic update | ||
| 97 | * | 128 | * |
| 98 | * The helper operations are called by the mid-layer CRTC helper. | 129 | * The helper operations are called by the mid-layer CRTC helper. |
| 130 | * | ||
| 131 | * Note that with atomic helpers @dpms, @prepare and @commit hooks are | ||
| 132 | * deprecated. Used @enable and @disable instead exclusively. | ||
| 133 | * | ||
| 134 | * With legacy crtc helpers there's a big semantic difference between @disable | ||
| 135 | * and the other hooks: @disable also needs to release any resources acquired in | ||
| 136 | * @mode_set (like shared PLLs). | ||
| 99 | */ | 137 | */ |
| 100 | struct drm_encoder_helper_funcs { | 138 | struct drm_encoder_helper_funcs { |
| 101 | void (*dpms)(struct drm_encoder *encoder, int mode); | 139 | void (*dpms)(struct drm_encoder *encoder, int mode); |
| @@ -114,14 +152,21 @@ struct drm_encoder_helper_funcs { | |||
| 114 | /* detect for DAC style encoders */ | 152 | /* detect for DAC style encoders */ |
| 115 | enum drm_connector_status (*detect)(struct drm_encoder *encoder, | 153 | enum drm_connector_status (*detect)(struct drm_encoder *encoder, |
| 116 | struct drm_connector *connector); | 154 | struct drm_connector *connector); |
| 117 | /* disable encoder when not in use - more explicit than dpms off */ | ||
| 118 | void (*disable)(struct drm_encoder *encoder); | 155 | void (*disable)(struct drm_encoder *encoder); |
| 156 | |||
| 157 | void (*enable)(struct drm_encoder *encoder); | ||
| 158 | |||
| 159 | /* atomic helpers */ | ||
| 160 | int (*atomic_check)(struct drm_encoder *encoder, | ||
| 161 | struct drm_crtc_state *crtc_state, | ||
| 162 | struct drm_connector_state *conn_state); | ||
| 119 | }; | 163 | }; |
| 120 | 164 | ||
| 121 | /** | 165 | /** |
| 122 | * drm_connector_helper_funcs - helper operations for connectors | 166 | * struct drm_connector_helper_funcs - helper operations for connectors |
| 123 | * @get_modes: get mode list for this connector | 167 | * @get_modes: get mode list for this connector |
| 124 | * @mode_valid (optional): is this mode valid on the given connector? | 168 | * @mode_valid: is this mode valid on the given connector? (optional) |
| 169 | * @best_encoder: return the preferred encoder for this connector | ||
| 125 | * | 170 | * |
| 126 | * The helper operations are called by the mid-layer CRTC helper. | 171 | * The helper operations are called by the mid-layer CRTC helper. |
| 127 | */ | 172 | */ |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index 11f8c84f98ce..7e25030a6aa2 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
| @@ -586,6 +586,7 @@ struct drm_dp_link { | |||
| 586 | 586 | ||
| 587 | int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); | 587 | int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link); |
| 588 | int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); | 588 | int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link); |
| 589 | int drm_dp_link_power_down(struct drm_dp_aux *aux, struct drm_dp_link *link); | ||
| 589 | int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); | 590 | int drm_dp_link_configure(struct drm_dp_aux *aux, struct drm_dp_link *link); |
| 590 | 591 | ||
| 591 | int drm_dp_aux_register(struct drm_dp_aux *aux); | 592 | int drm_dp_aux_register(struct drm_dp_aux *aux); |
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h index b597068103aa..21b944c456f6 100644 --- a/include/drm/drm_fb_helper.h +++ b/include/drm/drm_fb_helper.h | |||
| @@ -125,7 +125,7 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch, | |||
| 125 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); | 125 | int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); |
| 126 | 126 | ||
| 127 | int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); | 127 | int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); |
| 128 | bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); | 128 | int drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); |
| 129 | int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); | 129 | int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); |
| 130 | int drm_fb_helper_debug_enter(struct fb_info *info); | 130 | int drm_fb_helper_debug_enter(struct fb_info *info); |
| 131 | int drm_fb_helper_debug_leave(struct fb_info *info); | 131 | int drm_fb_helper_debug_leave(struct fb_info *info); |
diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index 91d0582f924e..d92f6dd1fb11 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h | |||
| @@ -90,6 +90,9 @@ enum drm_mode_status { | |||
| 90 | 90 | ||
| 91 | #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ | 91 | #define CRTC_INTERLACE_HALVE_V (1 << 0) /* halve V values for interlacing */ |
| 92 | #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ | 92 | #define CRTC_STEREO_DOUBLE (1 << 1) /* adjust timings for stereo modes */ |
| 93 | #define CRTC_NO_DBLSCAN (1 << 2) /* don't adjust doublescan */ | ||
| 94 | #define CRTC_NO_VSCAN (1 << 3) /* don't adjust doublescan */ | ||
| 95 | #define CRTC_STEREO_DOUBLE_ONLY (CRTC_NO_DBLSCAN | CRTC_NO_VSCAN) | ||
| 93 | 96 | ||
| 94 | #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF | 97 | #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF |
| 95 | 98 | ||
| @@ -197,6 +200,8 @@ struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, | |||
| 197 | int GTF_K, int GTF_2J); | 200 | int GTF_K, int GTF_2J); |
| 198 | void drm_display_mode_from_videomode(const struct videomode *vm, | 201 | void drm_display_mode_from_videomode(const struct videomode *vm, |
| 199 | struct drm_display_mode *dmode); | 202 | struct drm_display_mode *dmode); |
| 203 | void drm_display_mode_to_videomode(const struct drm_display_mode *dmode, | ||
| 204 | struct videomode *vm); | ||
| 200 | int of_get_drm_display_mode(struct device_node *np, | 205 | int of_get_drm_display_mode(struct device_node *np, |
| 201 | struct drm_display_mode *dmode, | 206 | struct drm_display_mode *dmode, |
| 202 | int index); | 207 | int index); |
| @@ -217,9 +222,9 @@ bool drm_mode_equal_no_clocks_no_stereo(const struct drm_display_mode *mode1, | |||
| 217 | const struct drm_display_mode *mode2); | 222 | const struct drm_display_mode *mode2); |
| 218 | 223 | ||
| 219 | /* for use by the crtc helper probe functions */ | 224 | /* for use by the crtc helper probe functions */ |
| 220 | void drm_mode_validate_size(struct drm_device *dev, | 225 | enum drm_mode_status drm_mode_validate_basic(const struct drm_display_mode *mode); |
| 221 | struct list_head *mode_list, | 226 | enum drm_mode_status drm_mode_validate_size(const struct drm_display_mode *mode, |
| 222 | int maxX, int maxY); | 227 | int maxX, int maxY); |
| 223 | void drm_mode_prune_invalid(struct drm_device *dev, | 228 | void drm_mode_prune_invalid(struct drm_device *dev, |
| 224 | struct list_head *mode_list, bool verbose); | 229 | struct list_head *mode_list, bool verbose); |
| 225 | void drm_mode_sort(struct list_head *mode_list); | 230 | void drm_mode_sort(struct list_head *mode_list); |
diff --git a/include/drm/drm_plane_helper.h b/include/drm/drm_plane_helper.h index a185392cafeb..31c11d36fae6 100644 --- a/include/drm/drm_plane_helper.h +++ b/include/drm/drm_plane_helper.h | |||
| @@ -52,7 +52,8 @@ extern int drm_crtc_init(struct drm_device *dev, | |||
| 52 | * @prepare_fb: prepare a framebuffer for use by the plane | 52 | * @prepare_fb: prepare a framebuffer for use by the plane |
| 53 | * @cleanup_fb: cleanup a framebuffer when it's no longer used by the plane | 53 | * @cleanup_fb: cleanup a framebuffer when it's no longer used by the plane |
| 54 | * @atomic_check: check that a given atomic state is valid and can be applied | 54 | * @atomic_check: check that a given atomic state is valid and can be applied |
| 55 | * @atomic_update: apply an atomic state to the plane | 55 | * @atomic_update: apply an atomic state to the plane (mandatory) |
| 56 | * @atomic_disable: disable the plane | ||
| 56 | * | 57 | * |
| 57 | * The helper operations are called by the mid-layer CRTC helper. | 58 | * The helper operations are called by the mid-layer CRTC helper. |
| 58 | */ | 59 | */ |
| @@ -66,6 +67,8 @@ struct drm_plane_helper_funcs { | |||
| 66 | struct drm_plane_state *state); | 67 | struct drm_plane_state *state); |
| 67 | void (*atomic_update)(struct drm_plane *plane, | 68 | void (*atomic_update)(struct drm_plane *plane, |
| 68 | struct drm_plane_state *old_state); | 69 | struct drm_plane_state *old_state); |
| 70 | void (*atomic_disable)(struct drm_plane *plane, | ||
| 71 | struct drm_plane_state *old_state); | ||
| 69 | }; | 72 | }; |
| 70 | 73 | ||
| 71 | static inline void drm_plane_helper_add(struct drm_plane *plane, | 74 | static inline void drm_plane_helper_add(struct drm_plane *plane, |
diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h new file mode 100644 index 000000000000..3e2f22e5bf3c --- /dev/null +++ b/include/drm/i915_component.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | /* | ||
| 2 | * Copyright © 2014 Intel Corporation | ||
| 3 | * | ||
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 5 | * copy of this software and associated documentation files (the "Software"), | ||
| 6 | * to deal in the Software without restriction, including without limitation | ||
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 9 | * Software is furnished to do so, subject to the following conditions: | ||
| 10 | * | ||
| 11 | * The above copyright notice and this permission notice (including the next | ||
| 12 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 13 | * Software. | ||
| 14 | * | ||
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
| 21 | * IN THE SOFTWARE. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #ifndef _I915_COMPONENT_H_ | ||
| 25 | #define _I915_COMPONENT_H_ | ||
| 26 | |||
| 27 | struct i915_audio_component { | ||
| 28 | struct device *dev; | ||
| 29 | |||
| 30 | const struct i915_audio_component_ops { | ||
| 31 | struct module *owner; | ||
| 32 | void (*get_power)(struct device *); | ||
| 33 | void (*put_power)(struct device *); | ||
| 34 | int (*get_cdclk_freq)(struct device *); | ||
| 35 | } *ops; | ||
| 36 | }; | ||
| 37 | |||
| 38 | #endif /* _I915_COMPONENT_H_ */ | ||
diff --git a/include/drm/i915_powerwell.h b/include/drm/i915_powerwell.h deleted file mode 100644 index baa6f11b1837..000000000000 --- a/include/drm/i915_powerwell.h +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | /************************************************************************** | ||
| 2 | * | ||
| 3 | * Copyright 2013 Intel Inc. | ||
| 4 | * All Rights Reserved. | ||
| 5 | * | ||
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 7 | * copy of this software and associated documentation files (the | ||
| 8 | * "Software"), to deal in the Software without restriction, including | ||
| 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
| 10 | * distribute, sub license, and/or sell copies of the Software, and to | ||
| 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
| 12 | * the following conditions: | ||
| 13 | * | ||
| 14 | * The above copyright notice and this permission notice (including the | ||
| 15 | * next paragraph) shall be included in all copies or substantial portions | ||
| 16 | * of the Software. | ||
| 17 | * | ||
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL | ||
| 21 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, | ||
| 22 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
| 23 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
| 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 25 | * | ||
| 26 | * | ||
| 27 | **************************************************************************/ | ||
| 28 | |||
| 29 | #ifndef _I915_POWERWELL_H_ | ||
| 30 | #define _I915_POWERWELL_H_ | ||
| 31 | |||
| 32 | /* For use by hda_i915 driver */ | ||
| 33 | extern int i915_request_power_well(void); | ||
| 34 | extern int i915_release_power_well(void); | ||
| 35 | extern int i915_get_cdclk_freq(void); | ||
| 36 | |||
| 37 | #endif /* _I915_POWERWELL_H_ */ | ||
