diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2012-03-16 05:47:09 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-03-20 05:40:24 -0400 |
commit | 9084f7b8a57706fc6b6f117f60143dad16a43ff6 (patch) | |
tree | 69cefb63c72edc5bf3dd19167b2b63dfbdd0c5fa /drivers | |
parent | 132a5b915f41f88356662c14c6866550ce2a08b6 (diff) |
drm/exynos: add subdrv open/close functions
Some subdrv need open and close functions call when open and close drm.
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_core.c | 35 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 9 |
3 files changed, 54 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 937b0597c8b3..4e29c7174ac5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -175,3 +175,38 @@ int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv) | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_unregister); | 177 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_unregister); |
178 | |||
179 | int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | ||
180 | { | ||
181 | struct exynos_drm_subdrv *subdrv; | ||
182 | int ret; | ||
183 | |||
184 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | ||
185 | if (subdrv->open) { | ||
186 | ret = subdrv->open(dev, subdrv->manager.dev, file); | ||
187 | if (ret) | ||
188 | goto err; | ||
189 | } | ||
190 | } | ||
191 | |||
192 | return 0; | ||
193 | |||
194 | err: | ||
195 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { | ||
196 | if (subdrv->close) | ||
197 | subdrv->close(dev, subdrv->manager.dev, file); | ||
198 | } | ||
199 | return ret; | ||
200 | } | ||
201 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_open); | ||
202 | |||
203 | void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) | ||
204 | { | ||
205 | struct exynos_drm_subdrv *subdrv; | ||
206 | |||
207 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | ||
208 | if (subdrv->close) | ||
209 | subdrv->close(dev, subdrv->manager.dev, file); | ||
210 | } | ||
211 | } | ||
212 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 903fcf0f05c7..1d78e039643b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -144,6 +144,13 @@ static int exynos_drm_unload(struct drm_device *dev) | |||
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) | ||
148 | { | ||
149 | DRM_DEBUG_DRIVER("%s\n", __FILE__); | ||
150 | |||
151 | return exynos_drm_subdrv_open(dev, file); | ||
152 | } | ||
153 | |||
147 | static void exynos_drm_preclose(struct drm_device *dev, | 154 | static void exynos_drm_preclose(struct drm_device *dev, |
148 | struct drm_file *file) | 155 | struct drm_file *file) |
149 | { | 156 | { |
@@ -163,6 +170,8 @@ static void exynos_drm_preclose(struct drm_device *dev, | |||
163 | } | 170 | } |
164 | } | 171 | } |
165 | spin_unlock_irqrestore(&dev->event_lock, flags); | 172 | spin_unlock_irqrestore(&dev->event_lock, flags); |
173 | |||
174 | exynos_drm_subdrv_close(dev, file); | ||
166 | } | 175 | } |
167 | 176 | ||
168 | static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) | 177 | static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) |
@@ -216,6 +225,7 @@ static struct drm_driver exynos_drm_driver = { | |||
216 | DRIVER_MODESET | DRIVER_GEM, | 225 | DRIVER_MODESET | DRIVER_GEM, |
217 | .load = exynos_drm_load, | 226 | .load = exynos_drm_load, |
218 | .unload = exynos_drm_unload, | 227 | .unload = exynos_drm_unload, |
228 | .open = exynos_drm_open, | ||
219 | .preclose = exynos_drm_preclose, | 229 | .preclose = exynos_drm_preclose, |
220 | .lastclose = exynos_drm_lastclose, | 230 | .lastclose = exynos_drm_lastclose, |
221 | .postclose = exynos_drm_postclose, | 231 | .postclose = exynos_drm_postclose, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index f8bac0eb2cb2..a41245402ce4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -229,6 +229,8 @@ struct exynos_drm_private { | |||
229 | * subdrv is registered to it. | 229 | * subdrv is registered to it. |
230 | * @remove: this callback is used to release resources created | 230 | * @remove: this callback is used to release resources created |
231 | * by probe callback. | 231 | * by probe callback. |
232 | * @open: this would be called with drm device file open. | ||
233 | * @close: this would be called with drm device file close. | ||
232 | * @manager: subdrv has its own manager to control a hardware appropriately | 234 | * @manager: subdrv has its own manager to control a hardware appropriately |
233 | * and we can access a hardware drawing on this manager. | 235 | * and we can access a hardware drawing on this manager. |
234 | * @encoder: encoder object owned by this sub driver. | 236 | * @encoder: encoder object owned by this sub driver. |
@@ -240,6 +242,10 @@ struct exynos_drm_subdrv { | |||
240 | 242 | ||
241 | int (*probe)(struct drm_device *drm_dev, struct device *dev); | 243 | int (*probe)(struct drm_device *drm_dev, struct device *dev); |
242 | void (*remove)(struct drm_device *dev); | 244 | void (*remove)(struct drm_device *dev); |
245 | int (*open)(struct drm_device *drm_dev, struct device *dev, | ||
246 | struct drm_file *file); | ||
247 | void (*close)(struct drm_device *drm_dev, struct device *dev, | ||
248 | struct drm_file *file); | ||
243 | 249 | ||
244 | struct exynos_drm_manager manager; | 250 | struct exynos_drm_manager manager; |
245 | struct drm_encoder *encoder; | 251 | struct drm_encoder *encoder; |
@@ -269,6 +275,9 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *drm_subdrv); | |||
269 | /* this function removes subdrv list from exynos drm driver */ | 275 | /* this function removes subdrv list from exynos drm driver */ |
270 | int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv); | 276 | int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv); |
271 | 277 | ||
278 | int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file); | ||
279 | void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file); | ||
280 | |||
272 | extern struct platform_driver fimd_driver; | 281 | extern struct platform_driver fimd_driver; |
273 | extern struct platform_driver hdmi_driver; | 282 | extern struct platform_driver hdmi_driver; |
274 | extern struct platform_driver mixer_driver; | 283 | extern struct platform_driver mixer_driver; |