diff options
| author | Yogish Kulkarni <yogishk@nvidia.com> | 2019-12-20 02:25:44 -0500 |
|---|---|---|
| committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2019-12-23 18:38:41 -0500 |
| commit | cda3f78dc40d0f21b1108a4087b6198fb53bde02 (patch) | |
| tree | 24e702ff136a1212c6b4413dc438b425c2041203 | |
| parent | a05d634d4fcf34797d9cc3234e8f1425a163e965 (diff) | |
tegra_udrm: add SEND_CONNECTOR_STATUS_EVENT ioctl
Add DRM_TEGRA_UDRM_SEND_CONNECTOR_STATUS_EVENT ioctl to generate
a uevent for connector status property change. user space calls
this ioctl with connector id and property id related to the
status change.
Bug 200577678
Change-Id: I079a7ebbc2c11ad6e6c7003df6eab57817161e26
Signed-off-by: Yogish Kulkarni <yogishk@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2266101
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sai Kiran K <skirank@nvidia.com>
Tested-by: Sai Kiran K <skirank@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
| -rw-r--r-- | drivers/gpu/drm/tegra_udrm/tegra_udrm_drv.c | 21 | ||||
| -rw-r--r-- | include/uapi/drm/tegra_udrm.h | 17 |
2 files changed, 38 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra_udrm/tegra_udrm_drv.c b/drivers/gpu/drm/tegra_udrm/tegra_udrm_drv.c index 28effb97c..18e61df6a 100644 --- a/drivers/gpu/drm/tegra_udrm/tegra_udrm_drv.c +++ b/drivers/gpu/drm/tegra_udrm/tegra_udrm_drv.c | |||
| @@ -334,6 +334,25 @@ static int tegra_udrm_send_vblank_event_ioctl(struct drm_device *drm, | |||
| 334 | return 0; | 334 | return 0; |
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | static int tegra_udrm_send_connector_status_event_ioctl(struct drm_device *drm, | ||
| 338 | void *data, struct drm_file *file) | ||
| 339 | { | ||
| 340 | struct drm_tegra_udrm_connector_status_event *args = | ||
| 341 | (struct drm_tegra_udrm_connector_status_event *)data; | ||
| 342 | char hotplug_str[] = "HOTPLUG=1", conn_id[30], prop_id[30]; | ||
| 343 | char *envp[4] = { hotplug_str, conn_id, prop_id, NULL }; | ||
| 344 | int ret = 0; | ||
| 345 | |||
| 346 | snprintf(conn_id, ARRAY_SIZE(conn_id), "CONNECTOR=%u", args->conn_id); | ||
| 347 | snprintf(prop_id, ARRAY_SIZE(prop_id), "PROPERTY=%u", args->prop_id); | ||
| 348 | |||
| 349 | ret = kobject_uevent_env(&drm->primary->kdev->kobj, KOBJ_CHANGE, envp); | ||
| 350 | if (ret < 0) | ||
| 351 | pr_err("%s: kobj_uevent error!\n", __func__); | ||
| 352 | |||
| 353 | return ret; | ||
| 354 | } | ||
| 355 | |||
| 337 | static const struct file_operations tegra_udrm_fops = { | 356 | static const struct file_operations tegra_udrm_fops = { |
| 338 | .owner = THIS_MODULE, | 357 | .owner = THIS_MODULE, |
| 339 | .open = drm_open, | 358 | .open = drm_open, |
| @@ -376,6 +395,8 @@ static const struct drm_ioctl_desc tegra_udrm_ioctls[] = { | |||
| 376 | tegra_udrm_drop_master_notify_ioctl, 0), | 395 | tegra_udrm_drop_master_notify_ioctl, 0), |
| 377 | DRM_IOCTL_DEF_DRV(TEGRA_UDRM_SET_MASTER_NOTIFY, | 396 | DRM_IOCTL_DEF_DRV(TEGRA_UDRM_SET_MASTER_NOTIFY, |
| 378 | tegra_udrm_set_master_notify_ioctl, 0), | 397 | tegra_udrm_set_master_notify_ioctl, 0), |
| 398 | DRM_IOCTL_DEF_DRV(TEGRA_UDRM_SEND_CONNECTOR_STATUS_EVENT, | ||
| 399 | tegra_udrm_send_connector_status_event_ioctl, 0), | ||
| 379 | }; | 400 | }; |
| 380 | 401 | ||
| 381 | static int tegra_udrm_open(struct drm_device *drm, struct drm_file *filp) | 402 | static int tegra_udrm_open(struct drm_device *drm, struct drm_file *filp) |
diff --git a/include/uapi/drm/tegra_udrm.h b/include/uapi/drm/tegra_udrm.h index 9ef02ffb7..2930bdfed 100644 --- a/include/uapi/drm/tegra_udrm.h +++ b/include/uapi/drm/tegra_udrm.h | |||
| @@ -29,6 +29,7 @@ extern "C" { | |||
| 29 | #define DRM_TEGRA_UDRM_SEND_VBLANK_EVENT 0x03 | 29 | #define DRM_TEGRA_UDRM_SEND_VBLANK_EVENT 0x03 |
| 30 | #define DRM_TEGRA_UDRM_DROP_MASTER_NOTIFY 0x04 | 30 | #define DRM_TEGRA_UDRM_DROP_MASTER_NOTIFY 0x04 |
| 31 | #define DRM_TEGRA_UDRM_SET_MASTER_NOTIFY 0x05 | 31 | #define DRM_TEGRA_UDRM_SET_MASTER_NOTIFY 0x05 |
| 32 | #define DRM_TEGRA_UDRM_SEND_CONNECTOR_STATUS_EVENT 0x06 | ||
| 32 | 33 | ||
| 33 | struct drm_tegra_udrm_dmabuf_mmap { | 34 | struct drm_tegra_udrm_dmabuf_mmap { |
| 34 | int fd; | 35 | int fd; |
| @@ -58,6 +59,11 @@ struct drm_tegra_udrm_set_master_notify { | |||
| 58 | int clear; | 59 | int clear; |
| 59 | }; | 60 | }; |
| 60 | 61 | ||
| 62 | struct drm_tegra_udrm_connector_status_event { | ||
| 63 | uint32_t conn_id; | ||
| 64 | uint32_t prop_id; | ||
| 65 | }; | ||
| 66 | |||
| 61 | #define TEGRA_UDRM_IOCTL(dir, name, str) \ | 67 | #define TEGRA_UDRM_IOCTL(dir, name, str) \ |
| 62 | DRM_##dir(DRM_COMMAND_BASE + DRM_TEGRA_UDRM_##name, \ | 68 | DRM_##dir(DRM_COMMAND_BASE + DRM_TEGRA_UDRM_##name, \ |
| 63 | struct drm_tegra_udrm_##str) | 69 | struct drm_tegra_udrm_##str) |
| @@ -121,6 +127,17 @@ struct drm_tegra_udrm_set_master_notify { | |||
| 121 | #define DRM_IOCTL_TEGRA_UDRM_SET_MASTER_NOTIFY \ | 127 | #define DRM_IOCTL_TEGRA_UDRM_SET_MASTER_NOTIFY \ |
| 122 | TEGRA_UDRM_IOCTL(IOW, SET_MASTER_NOTIFY, set_master_notify) | 128 | TEGRA_UDRM_IOCTL(IOW, SET_MASTER_NOTIFY, set_master_notify) |
| 123 | 129 | ||
| 130 | /* UMD issues this ioctl to generate a uevent for connector status | ||
| 131 | * property change. | ||
| 132 | * | ||
| 133 | * In parameters - | ||
| 134 | * conn_id: connector id related to the status change. | ||
| 135 | * prop_id: property id related to the status change. | ||
| 136 | */ | ||
| 137 | #define DRM_IOCTL_TEGRA_UDRM_SEND_CONNECTOR_STATUS_EVENT \ | ||
| 138 | TEGRA_UDRM_IOCTL(IOW, SEND_CONNECTOR_STATUS_EVENT, \ | ||
| 139 | connector_status_event) | ||
| 140 | |||
| 124 | #if defined(__cplusplus) | 141 | #if defined(__cplusplus) |
| 125 | } | 142 | } |
| 126 | #endif | 143 | #endif |
