summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_sysfs.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2015-05-12 11:14:53 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-05-12 19:15:52 +0200
commitfe6fcdd61d31eec8aad8cea66a4e826d5c5561b1 (patch)
treea7abe245cf8e3079d8594150b417cc0ac8728c1e /drivers/gpu/drm/drm_sysfs.c
parentdrm/sysfs: add a helper for extracting connector type from kobject (diff)
downloadlinux-fe6fcdd61d31eec8aad8cea66a4e826d5c5561b1.tar.xz
linux-fe6fcdd61d31eec8aad8cea66a4e826d5c5561b1.zip
drm/sysfs: make optional attribute groups per connector type
Split DVI-I and TV-out (which remains a group of types). As an intermediate step, still share the attributes themselves between the two. No user visible changes. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_sysfs.c')
-rw-r--r--drivers/gpu/drm/drm_sysfs.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 33466999b59a..674c3df56ea0 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -401,7 +401,7 @@ static struct attribute *connector_dev_attrs[] = {
static DEVICE_ATTR_RO(subconnector);
static DEVICE_ATTR_RO(select_subconnector);
-static struct attribute *connector_opt_dev_attrs[] = {
+static struct attribute *connector_tv_dev_attrs[] = {
&dev_attr_subconnector.attr,
&dev_attr_select_subconnector.attr,
NULL
@@ -416,15 +416,17 @@ static int kobj_connector_type(struct kobject *kobj)
return connector->connector_type;
}
-static umode_t connector_opt_dev_is_visible(struct kobject *kobj,
- struct attribute *attr, int idx)
+static umode_t connector_is_dvii(struct kobject *kobj,
+ struct attribute *attr, int idx)
+{
+ return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
+ attr->mode : 0;
+}
+
+static umode_t connector_is_tv(struct kobject *kobj,
+ struct attribute *attr, int idx)
{
- /*
- * In the long run it maybe a good idea to make one set of
- * optionals per connector type.
- */
switch (kobj_connector_type(kobj)) {
- case DRM_MODE_CONNECTOR_DVII:
case DRM_MODE_CONNECTOR_Composite:
case DRM_MODE_CONNECTOR_SVIDEO:
case DRM_MODE_CONNECTOR_Component:
@@ -452,14 +454,20 @@ static const struct attribute_group connector_dev_group = {
.bin_attrs = connector_bin_attrs,
};
-static const struct attribute_group connector_opt_dev_group = {
- .attrs = connector_opt_dev_attrs,
- .is_visible = connector_opt_dev_is_visible,
+static const struct attribute_group connector_tv_dev_group = {
+ .attrs = connector_tv_dev_attrs,
+ .is_visible = connector_is_tv,
+};
+
+static const struct attribute_group connector_dvii_dev_group = {
+ .attrs = connector_tv_dev_attrs, /* same as tv */
+ .is_visible = connector_is_dvii,
};
static const struct attribute_group *connector_dev_groups[] = {
&connector_dev_group,
- &connector_opt_dev_group,
+ &connector_tv_dev_group,
+ &connector_dvii_dev_group,
NULL
};