0447-drm-Emit-modalias-uevents-for-the-DSI-devices-we-cre.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From b948504b2bfdcb24e774c8801ee6d118e5e3ca90 Mon Sep 17 00:00:00 2001
  2. From: Eric Anholt <eric@anholt.net>
  3. Date: Tue, 9 Aug 2016 15:13:33 -0700
  4. Subject: [PATCH] drm: Emit modalias uevents for the DSI devices we create.
  5. This gets the Raspberry Pi panel module to automatically load at boot
  6. time.
  7. Signed-off-by: Eric Anholt <eric@anholt.net>
  8. ---
  9. drivers/gpu/drm/drm_mipi_dsi.c | 19 +++++++++++++++++++
  10. 1 file changed, 19 insertions(+)
  11. --- a/drivers/gpu/drm/drm_mipi_dsi.c
  12. +++ b/drivers/gpu/drm/drm_mipi_dsi.c
  13. @@ -50,6 +50,24 @@ static int mipi_dsi_device_match(struct
  14. return of_driver_match_device(dev, drv);
  15. }
  16. +/**
  17. + * Send modalias events when devices are created on the bus, so that
  18. + * modules can load automatically.
  19. + */
  20. +static int mipi_dsi_uevent(struct device *dev, struct kobj_uevent_env *env)
  21. +{
  22. + int rc;
  23. +
  24. + /* Just do the OF uevent, which emits the compatible string so
  25. + * that a MODULE_DEVICE_TABLE(of, ...) works.
  26. + */
  27. + rc = of_device_uevent_modalias(dev, env);
  28. + if (rc != -ENODEV)
  29. + return rc;
  30. +
  31. + return 0;
  32. +}
  33. +
  34. static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
  35. .runtime_suspend = pm_generic_runtime_suspend,
  36. .runtime_resume = pm_generic_runtime_resume,
  37. @@ -65,6 +83,7 @@ static struct bus_type mipi_dsi_bus_type
  38. .name = "mipi-dsi",
  39. .match = mipi_dsi_device_match,
  40. .pm = &mipi_dsi_device_pm_ops,
  41. + .uevent = mipi_dsi_uevent,
  42. };
  43. static int of_device_match(struct device *dev, void *data)