Lines Matching +full:force +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
4 * drm_sysfs.c - Modifications to drm_sysfs_class.c to support
9 * Copyright (c) 2003-2004 Greg Kroah-Hartman <greg@kroah.com>
10 * Copyright (c) 2003-2004 IBM Corp.
48 * drm_connector_register() in case of hot-plugged connectors. Unregistration is
66 return dev->type == &drm_sysfs_device_connector; in drm_connector_acpi_bus_match()
73 return to_acpi_device_node(connector->fwnode); in drm_connector_acpi_find_companion()
96 static char *drm_devnode(const struct device *dev, umode_t *mode) in drm_devnode() argument
106 ret = sysfs_create_link(&dev->kobj, &typec_connector->kobj, "typec_connector"); in typec_connector_bind()
110 ret = sysfs_create_link(&typec_connector->kobj, &dev->kobj, "drm_connector"); in typec_connector_bind()
112 sysfs_remove_link(&dev->kobj, "typec_connector"); in typec_connector_bind()
120 sysfs_remove_link(&typec_connector->kobj, "drm_connector"); in typec_connector_unbind()
121 sysfs_remove_link(&dev->kobj, "typec_connector"); in typec_connector_unbind()
132 * drm_sysfs_init - initialize sysfs helpers
135 * other top-level DRM sysfs objects.
156 drm_class->devnode = drm_devnode; in drm_sysfs_init()
163 * drm_sysfs_destroy - destroys DRM class
190 struct drm_device *dev = connector->dev; in status_store()
194 ret = mutex_lock_interruptible(&dev->mode_config.mutex); in status_store()
198 old_force = connector->force; in status_store()
201 connector->force = 0; in status_store()
203 connector->force = DRM_FORCE_ON; in status_store()
204 else if (sysfs_streq(buf, "on-digital")) in status_store()
205 connector->force = DRM_FORCE_ON_DIGITAL; in status_store()
207 connector->force = DRM_FORCE_OFF; in status_store()
209 ret = -EINVAL; in status_store()
211 if (old_force != connector->force || !connector->force) { in status_store()
212 drm_dbg_kms(dev, "[CONNECTOR:%d:%s] force updated from %d to %d or reprobing\n", in status_store()
213 connector->base.id, connector->name, in status_store()
214 old_force, connector->force); in status_store()
216 connector->funcs->fill_modes(connector, in status_store()
217 dev->mode_config.max_width, in status_store()
218 dev->mode_config.max_height); in status_store()
221 mutex_unlock(&dev->mode_config.mutex); in status_store()
233 status = READ_ONCE(connector->status); in status_show()
246 dpms = READ_ONCE(connector->dpms); in dpms_show()
258 enabled = READ_ONCE(connector->encoder); in enabled_show()
281 struct drm_display_mode *mode; in modes_show() local
284 mutex_lock(&connector->dev->mode_config.mutex); in modes_show()
285 list_for_each_entry(mode, &connector->modes, head) { in modes_show()
286 written += scnprintf(buf + written, PAGE_SIZE - written, "%s\n", in modes_show()
287 mode->name); in modes_show()
289 mutex_unlock(&connector->dev->mode_config.mutex); in modes_show()
300 return sysfs_emit(buf, "%d\n", connector->base.id); in connector_id_show()
320 .attr.mode = 0444,
342 struct drm_device *dev = connector->dev; in drm_sysfs_connector_add()
346 if (connector->kdev) in drm_sysfs_connector_add()
351 return -ENOMEM; in drm_sysfs_connector_add()
354 kdev->class = drm_class; in drm_sysfs_connector_add()
355 kdev->type = &drm_sysfs_device_connector; in drm_sysfs_connector_add()
356 kdev->parent = dev->primary->kdev; in drm_sysfs_connector_add()
357 kdev->groups = connector_dev_groups; in drm_sysfs_connector_add()
358 kdev->release = drm_sysfs_release; in drm_sysfs_connector_add()
361 r = dev_set_name(kdev, "card%d-%s", dev->primary->index, connector->name); in drm_sysfs_connector_add()
366 connector->base.id, connector->name); in drm_sysfs_connector_add()
374 connector->kdev = kdev; in drm_sysfs_connector_add()
391 if (connector->ddc) in drm_sysfs_connector_add_late()
392 return sysfs_create_link(&connector->kdev->kobj, in drm_sysfs_connector_add_late()
393 &connector->ddc->dev.kobj, "ddc"); in drm_sysfs_connector_add_late()
400 if (connector->ddc) in drm_sysfs_connector_remove_early()
401 sysfs_remove_link(&connector->kdev->kobj, "ddc"); in drm_sysfs_connector_remove_early()
406 if (!connector->kdev) in drm_sysfs_connector_remove()
409 if (dev_fwnode(connector->kdev)) in drm_sysfs_connector_remove()
410 component_del(connector->kdev, &typec_connector_ops); in drm_sysfs_connector_remove()
412 drm_dbg_kms(connector->dev, in drm_sysfs_connector_remove()
414 connector->base.id, connector->name); in drm_sysfs_connector_remove()
416 device_unregister(connector->kdev); in drm_sysfs_connector_remove()
417 connector->kdev = NULL; in drm_sysfs_connector_remove()
427 kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); in drm_sysfs_lease_event()
431 * drm_sysfs_hotplug_event - generate a DRM uevent
448 kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); in drm_sysfs_hotplug_event()
453 * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any connector
462 struct drm_device *dev = connector->dev; in drm_sysfs_connector_hotplug_event()
467 "CONNECTOR=%u", connector->base.id); in drm_sysfs_connector_hotplug_event()
469 drm_dbg_kms(connector->dev, in drm_sysfs_connector_hotplug_event()
471 connector->base.id, connector->name); in drm_sysfs_connector_hotplug_event()
473 kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); in drm_sysfs_connector_hotplug_event()
478 * drm_sysfs_connector_property_event - generate a DRM uevent for connector
490 struct drm_device *dev = connector->dev; in drm_sysfs_connector_property_event()
494 WARN_ON(!drm_mode_obj_find_prop_id(&connector->base, in drm_sysfs_connector_property_event()
495 property->base.id)); in drm_sysfs_connector_property_event()
498 "CONNECTOR=%u", connector->base.id); in drm_sysfs_connector_property_event()
500 "PROPERTY=%u", property->base.id); in drm_sysfs_connector_property_event()
502 drm_dbg_kms(connector->dev, in drm_sysfs_connector_property_event()
504 connector->base.id, connector->name, in drm_sysfs_connector_property_event()
505 property->base.id, property->name); in drm_sysfs_connector_property_event()
507 kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp); in drm_sysfs_connector_property_event()
519 return ERR_PTR(-ENOMEM); in drm_sysfs_minor_alloc()
523 if (minor->type == DRM_MINOR_ACCEL) { in drm_sysfs_minor_alloc()
525 accel_set_device_instance_params(kdev, minor->index); in drm_sysfs_minor_alloc()
527 if (minor->type == DRM_MINOR_RENDER) in drm_sysfs_minor_alloc()
532 kdev->devt = MKDEV(DRM_MAJOR, minor->index); in drm_sysfs_minor_alloc()
533 kdev->class = drm_class; in drm_sysfs_minor_alloc()
534 kdev->type = &drm_sysfs_device_minor; in drm_sysfs_minor_alloc()
537 kdev->parent = minor->dev->dev; in drm_sysfs_minor_alloc()
538 kdev->release = drm_sysfs_release; in drm_sysfs_minor_alloc()
541 r = dev_set_name(kdev, minor_str, minor->index); in drm_sysfs_minor_alloc()
553 * drm_class_device_register - register new device with the DRM sysfs class
563 return -ENOENT; in drm_class_device_register()
565 dev->class = drm_class; in drm_class_device_register()
571 * drm_class_device_unregister - unregister device with the DRM sysfs class