aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-04-29 11:19:57 -0400
committerThierry Reding <treding@nvidia.com>2014-06-05 10:42:19 -0400
commitd16218030f7d5195fcf83a424d8e48b89b013a51 (patch)
treefd251ee2e4d91cd952560bdf736e3b8327025217
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
drm/dsi: Support device shutdown
Hook up the MIPI DSI bus's .shutdown() function to allow drivers to implement code that should be run when a device is shut down. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/drm/drm_mipi_dsi.c10
-rw-r--r--include/drm/drm_mipi_dsi.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 09821f46d768..e633df2f68d8 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -282,6 +282,14 @@ static int mipi_dsi_drv_remove(struct device *dev)
282 return drv->remove(dsi); 282 return drv->remove(dsi);
283} 283}
284 284
285static void mipi_dsi_drv_shutdown(struct device *dev)
286{
287 struct mipi_dsi_driver *drv = to_mipi_dsi_driver(dev->driver);
288 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
289
290 drv->shutdown(dsi);
291}
292
285/** 293/**
286 * mipi_dsi_driver_register - register a driver for DSI devices 294 * mipi_dsi_driver_register - register a driver for DSI devices
287 * @drv: DSI driver structure 295 * @drv: DSI driver structure
@@ -293,6 +301,8 @@ int mipi_dsi_driver_register(struct mipi_dsi_driver *drv)
293 drv->driver.probe = mipi_dsi_drv_probe; 301 drv->driver.probe = mipi_dsi_drv_probe;
294 if (drv->remove) 302 if (drv->remove)
295 drv->driver.remove = mipi_dsi_drv_remove; 303 drv->driver.remove = mipi_dsi_drv_remove;
304 if (drv->shutdown)
305 drv->driver.shutdown = mipi_dsi_drv_shutdown;
296 306
297 return driver_register(&drv->driver); 307 return driver_register(&drv->driver);
298} 308}
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 7209df15a3cd..944f33f8ba38 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -135,11 +135,13 @@ ssize_t mipi_dsi_dcs_read(struct mipi_dsi_device *dsi, unsigned int channel,
135 * @driver: device driver model driver 135 * @driver: device driver model driver
136 * @probe: callback for device binding 136 * @probe: callback for device binding
137 * @remove: callback for device unbinding 137 * @remove: callback for device unbinding
138 * @shutdown: called at shutdown time to quiesce the device
138 */ 139 */
139struct mipi_dsi_driver { 140struct mipi_dsi_driver {
140 struct device_driver driver; 141 struct device_driver driver;
141 int(*probe)(struct mipi_dsi_device *dsi); 142 int(*probe)(struct mipi_dsi_device *dsi);
142 int(*remove)(struct mipi_dsi_device *dsi); 143 int(*remove)(struct mipi_dsi_device *dsi);
144 void (*shutdown)(struct mipi_dsi_device *dsi);
143}; 145};
144 146
145#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver) 147#define to_mipi_dsi_driver(d) container_of(d, struct mipi_dsi_driver, driver)