Skip to content

Commit babb24f

Browse files
committed
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: Archit Taneja <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 2a92762 commit babb24f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

drivers/gpu/drm/drm_mipi_dsi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
6060
return 0;
6161
}
6262

63+
static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env)
64+
{
65+
struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
66+
int err;
67+
68+
err = of_device_uevent_modalias(dev, env);
69+
if (err != -ENODEV)
70+
return err;
71+
72+
add_uevent_var(env, "MODALIAS=%s%s", MIPI_DSI_MODULE_PREFIX,
73+
dsi->name);
74+
75+
return 0;
76+
}
77+
6378
static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
6479
.runtime_suspend = pm_generic_runtime_suspend,
6580
.runtime_resume = pm_generic_runtime_resume,
@@ -74,6 +89,7 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
7489
static struct bus_type mipi_dsi_bus_type = {
7590
.name = "mipi-dsi",
7691
.match = mipi_dsi_device_match,
92+
.uevent = mipi_dsi_uevent,
7793
.pm = &mipi_dsi_device_pm_ops,
7894
};
7995

include/drm/drm_mipi_dsi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ struct mipi_dsi_device {
180180
unsigned long mode_flags;
181181
};
182182

183+
#define MIPI_DSI_MODULE_PREFIX "mipi-dsi:"
184+
183185
static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev)
184186
{
185187
return container_of(dev, struct mipi_dsi_device, dev);

0 commit comments

Comments
 (0)