Commit babb24fe authored by Thierry Reding's avatar Thierry Reding

drm/dsi: Add uevent callback

Implement a uevent callback for devices on the MIPI DSI bus. This
callback will append MODALIAS information to the uevent and allow
modules to be loaded when devices are added to the bus.
Reviewed-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 2a927623
...@@ -60,6 +60,21 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv) ...@@ -60,6 +60,21 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
return 0; return 0;
} }
static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
int err;
err = of_device_uevent_modalias(dev, env);
if (err != -ENODEV)
return err;
add_uevent_var(env, "MODALIAS=%s%s", MIPI_DSI_MODULE_PREFIX,
dsi->name);
return 0;
}
static const struct dev_pm_ops mipi_dsi_device_pm_ops = { static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
.runtime_suspend = pm_generic_runtime_suspend, .runtime_suspend = pm_generic_runtime_suspend,
.runtime_resume = pm_generic_runtime_resume, .runtime_resume = pm_generic_runtime_resume,
...@@ -74,6 +89,7 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = { ...@@ -74,6 +89,7 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
static struct bus_type mipi_dsi_bus_type = { static struct bus_type mipi_dsi_bus_type = {
.name = "mipi-dsi", .name = "mipi-dsi",
.match = mipi_dsi_device_match, .match = mipi_dsi_device_match,
.uevent = mipi_dsi_uevent,
.pm = &mipi_dsi_device_pm_ops, .pm = &mipi_dsi_device_pm_ops,
}; };
......
...@@ -180,6 +180,8 @@ struct mipi_dsi_device { ...@@ -180,6 +180,8 @@ struct mipi_dsi_device {
unsigned long mode_flags; unsigned long mode_flags;
}; };
#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"
static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
{ {
return container_of(dev, struct mipi_dsi_device, dev); return container_of(dev, struct mipi_dsi_device, dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment