summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-01-10 10:17:45 +0100
committerThierry Reding <treding@nvidia.com>2014-01-10 10:17:45 +0100
commit408a79af00d8e772e6aa3e4ac5a14c1280e923a5 (patch)
treecbb874897635a7644308d849b5fc5246920f78e8 /include
parente393227426c8f6028d29444ec5fcaaeeae812690 (diff)
parented6cd9798c923ab784f2440f70ec611bd1376f53 (diff)
Merge branch 'next/drm'
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_dp_helper.h90
-rw-r--r--include/drm/drm_flip_work.h1
-rw-r--r--include/drm/drm_panel.h32
3 files changed, 123 insertions, 0 deletions
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 1d09050a8c00..179c91a7f7f5 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -291,6 +291,7 @@
#define DP_SET_POWER 0x600
# define DP_SET_POWER_D0 0x1
# define DP_SET_POWER_D3 0x2
+# define DP_SET_POWER_MASK 0x3
#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
# define DP_PSR_LINK_CRC_ERROR (1 << 0)
@@ -398,4 +399,93 @@ drm_dp_enhanced_frame_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
(dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP);
}
+/*
+ * DisplayPort AUX channel
+ */
+
+/**
+ * struct drm_dp_aux_msg - DisplayPort AUX channel transaction
+ * @address: address of the (first) register to access
+ * @request: contains the type of transaction (see DP_AUX_* macros)
+ * @reply: upon completion, contains the reply type of the transaction
+ * @buffer: pointer to a transmission or reception buffer
+ * @size: size of @buffer
+ */
+struct drm_dp_aux_msg {
+ unsigned int address;
+ u8 request;
+ u8 reply;
+ void *buffer;
+ size_t size;
+};
+
+/**
+ * struct drm_dp_aux - DisplayPort AUX channel
+ * @ddc: I2C adapter that can be used for I2C-over-AUX communication
+ * @dev: pointer to struct device that is the parent for this AUX channel
+ * @transfer: transfers a message representing a single AUX transaction
+ */
+struct drm_dp_aux {
+ struct i2c_adapter ddc;
+ struct device *dev;
+
+ ssize_t (*transfer)(struct drm_dp_aux *aux,
+ struct drm_dp_aux_msg *msg);
+};
+
+ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
+ void *buffer, size_t size);
+ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
+ void *buffer, size_t size);
+
+/**
+ * drm_dp_dpcd_readb() - read a single byte from the DPCD
+ * @aux: DisplayPort AUX channel
+ * @offset: address of the register to read
+ * @valuep: location where the value of the register will be stored
+ *
+ * Returns the number of bytes transferred (1) on success, or a negative
+ * error code on failure.
+ */
+static inline ssize_t drm_dp_dpcd_readb(struct drm_dp_aux *aux,
+ unsigned int offset, u8 *valuep)
+{
+ return drm_dp_dpcd_read(aux, offset, valuep, 1);
+}
+
+/**
+ * drm_dp_dpcd_writeb() - write a single byte to the DPCD
+ * @aux: DisplayPort AUX channel
+ * @value: value to write to the register
+ * @offset: address of the register to write
+ *
+ * Returns the number of bytes transferred (1) on success, or a negative
+ * error code on failure.
+ */
+static inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux, u8 value,
+ unsigned int offset)
+{
+ return drm_dp_dpcd_write(aux, offset, &value, 1);
+}
+
+int drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux,
+ u8 status[DP_LINK_STATUS_SIZE]);
+
+/*
+ * DisplayPort link
+ */
+#define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
+
+struct drm_dp_link {
+ unsigned int rate;
+ unsigned int num_lanes;
+ unsigned long capabilities;
+};
+
+int drm_dp_link_probe(struct drm_dp_aux *aux, struct drm_dp_link *link);
+int drm_dp_link_power_up(struct drm_dp_aux *aux, struct drm_dp_link *link);
+
+int drm_dp_aux_register_i2c_bus(struct drm_dp_aux *aux);
+void drm_dp_aux_unregister_i2c_bus(struct drm_dp_aux *aux);
+
#endif /* _DRM_DP_HELPER_H_ */
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h
index 35c776ae7d3b..9eed34dcd6af 100644
--- a/include/drm/drm_flip_work.h
+++ b/include/drm/drm_flip_work.h
@@ -57,6 +57,7 @@ typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val);
* @count: number of committed items
* @func: callback fxn called for each committed item
* @worker: worker which calls @func
+ * @fifo: queue of committed items
*/
struct drm_flip_work {
const char *name;
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index c2ab77add67c..898c4c4da552 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -34,6 +34,11 @@ struct drm_panel_funcs {
int (*disable)(struct drm_panel *panel);
int (*enable)(struct drm_panel *panel);
int (*get_modes)(struct drm_panel *panel);
+
+ int (*get_brightness_range)(struct drm_panel *panel, uint64_t *min,
+ uint64_t *max);
+ int (*get_brightness)(struct drm_panel *panel, uint64_t *value);
+ int (*set_brightness)(struct drm_panel *panel, uint64_t value);
};
struct drm_panel {
@@ -62,6 +67,33 @@ static inline int drm_panel_enable(struct drm_panel *panel)
return panel ? -ENOSYS : -EINVAL;
}
+static inline int drm_panel_get_brightness_range(struct drm_panel *panel,
+ uint64_t *min, uint64_t *max)
+{
+ if (panel && panel->funcs && panel->funcs->get_brightness_range)
+ return panel->funcs->get_brightness_range(panel, min, max);
+
+ return panel ? -ENOSYS : -EINVAL;
+}
+
+static inline int drm_panel_get_brightness(struct drm_panel *panel,
+ uint64_t *value)
+{
+ if (panel && panel->funcs && panel->funcs->get_brightness)
+ return panel->funcs->get_brightness(panel, value);
+
+ return panel ? -ENOSYS : -EINVAL;
+}
+
+static inline int drm_panel_set_brightness(struct drm_panel *panel,
+ uint64_t value)
+{
+ if (panel && panel->funcs && panel->funcs->set_brightness)
+ return panel->funcs->set_brightness(panel, value);
+
+ return panel ? -ENOSYS : -EINVAL;
+}
+
void drm_panel_init(struct drm_panel *panel);
int drm_panel_add(struct drm_panel *panel);