diff options
author | Rob Clark <robdclark@gmail.com> | 2013-01-08 18:50:48 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2013-02-17 17:55:42 -0500 |
commit | a7c47d6dc4a201b811e847e5449c8cffdc556deb (patch) | |
tree | e05562b96177a385386df338e53e31eaf47b5d80 | |
parent | 6f646095ec2f5d38a6429dd896cb2d5cbbb776dc (diff) |
drm: i2c encoder helper wrappers
Simplify life for drivers using an encoder-slave, so that they can make
their drm_encoder_helper_funcs const, rather than needing to dynamically
allocate and populate them.
Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r-- | drivers/gpu/drm/drm_encoder_slave.c | 63 | ||||
-rw-r--r-- | include/drm/drm_encoder_slave.h | 20 |
2 files changed, 83 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c index 63e733408b6d..48c52f7df4e6 100644 --- a/drivers/gpu/drm/drm_encoder_slave.c +++ b/drivers/gpu/drm/drm_encoder_slave.c | |||
@@ -123,3 +123,66 @@ void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder) | |||
123 | module_put(module); | 123 | module_put(module); |
124 | } | 124 | } |
125 | EXPORT_SYMBOL(drm_i2c_encoder_destroy); | 125 | EXPORT_SYMBOL(drm_i2c_encoder_destroy); |
126 | |||
127 | /* | ||
128 | * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs: | ||
129 | */ | ||
130 | |||
131 | static inline struct drm_encoder_slave_funcs * | ||
132 | get_slave_funcs(struct drm_encoder *enc) | ||
133 | { | ||
134 | return to_encoder_slave(enc)->slave_funcs; | ||
135 | } | ||
136 | |||
137 | void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode) | ||
138 | { | ||
139 | get_slave_funcs(encoder)->dpms(encoder, mode); | ||
140 | } | ||
141 | EXPORT_SYMBOL(drm_i2c_encoder_dpms); | ||
142 | |||
143 | bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder, | ||
144 | const struct drm_display_mode *mode, | ||
145 | struct drm_display_mode *adjusted_mode) | ||
146 | { | ||
147 | return get_slave_funcs(encoder)->mode_fixup(encoder, mode, adjusted_mode); | ||
148 | } | ||
149 | EXPORT_SYMBOL(drm_i2c_encoder_mode_fixup); | ||
150 | |||
151 | void drm_i2c_encoder_prepare(struct drm_encoder *encoder) | ||
152 | { | ||
153 | drm_i2c_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); | ||
154 | } | ||
155 | EXPORT_SYMBOL(drm_i2c_encoder_prepare); | ||
156 | |||
157 | void drm_i2c_encoder_commit(struct drm_encoder *encoder) | ||
158 | { | ||
159 | drm_i2c_encoder_dpms(encoder, DRM_MODE_DPMS_ON); | ||
160 | } | ||
161 | EXPORT_SYMBOL(drm_i2c_encoder_commit); | ||
162 | |||
163 | void drm_i2c_encoder_mode_set(struct drm_encoder *encoder, | ||
164 | struct drm_display_mode *mode, | ||
165 | struct drm_display_mode *adjusted_mode) | ||
166 | { | ||
167 | get_slave_funcs(encoder)->mode_set(encoder, mode, adjusted_mode); | ||
168 | } | ||
169 | EXPORT_SYMBOL(drm_i2c_encoder_mode_set); | ||
170 | |||
171 | enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encoder, | ||
172 | struct drm_connector *connector) | ||
173 | { | ||
174 | return get_slave_funcs(encoder)->detect(encoder, connector); | ||
175 | } | ||
176 | EXPORT_SYMBOL(drm_i2c_encoder_detect); | ||
177 | |||
178 | void drm_i2c_encoder_save(struct drm_encoder *encoder) | ||
179 | { | ||
180 | get_slave_funcs(encoder)->save(encoder); | ||
181 | } | ||
182 | EXPORT_SYMBOL(drm_i2c_encoder_save); | ||
183 | |||
184 | void drm_i2c_encoder_restore(struct drm_encoder *encoder) | ||
185 | { | ||
186 | get_slave_funcs(encoder)->restore(encoder); | ||
187 | } | ||
188 | EXPORT_SYMBOL(drm_i2c_encoder_restore); | ||
diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h index b0c11a7809bb..8b9cc3671858 100644 --- a/include/drm/drm_encoder_slave.h +++ b/include/drm/drm_encoder_slave.h | |||
@@ -159,4 +159,24 @@ static inline void drm_i2c_encoder_unregister(struct drm_i2c_encoder_driver *dri | |||
159 | 159 | ||
160 | void drm_i2c_encoder_destroy(struct drm_encoder *encoder); | 160 | void drm_i2c_encoder_destroy(struct drm_encoder *encoder); |
161 | 161 | ||
162 | |||
163 | /* | ||
164 | * Wrapper fxns which can be plugged in to drm_encoder_helper_funcs: | ||
165 | */ | ||
166 | |||
167 | void drm_i2c_encoder_dpms(struct drm_encoder *encoder, int mode); | ||
168 | bool drm_i2c_encoder_mode_fixup(struct drm_encoder *encoder, | ||
169 | const struct drm_display_mode *mode, | ||
170 | struct drm_display_mode *adjusted_mode); | ||
171 | void drm_i2c_encoder_prepare(struct drm_encoder *encoder); | ||
172 | void drm_i2c_encoder_commit(struct drm_encoder *encoder); | ||
173 | void drm_i2c_encoder_mode_set(struct drm_encoder *encoder, | ||
174 | struct drm_display_mode *mode, | ||
175 | struct drm_display_mode *adjusted_mode); | ||
176 | enum drm_connector_status drm_i2c_encoder_detect(struct drm_encoder *encoder, | ||
177 | struct drm_connector *connector); | ||
178 | void drm_i2c_encoder_save(struct drm_encoder *encoder); | ||
179 | void drm_i2c_encoder_restore(struct drm_encoder *encoder); | ||
180 | |||
181 | |||
162 | #endif | 182 | #endif |