From f6b794af955bdda36f7911a771b9ac666e266d07 Mon Sep 17 00:00:00 2001 From: Greg Hackmann Date: Thu, 15 Aug 2013 12:51:22 -0700 Subject: [PATCH] video: adf: make dpms_state sysfs attribute writable Change-Id: I04e7785cbddac160003e6c9edaf62d20b367fdc9 Signed-off-by: Greg Hackmann --- drivers/video/adf/adf_sysfs.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/video/adf/adf_sysfs.c b/drivers/video/adf/adf_sysfs.c index 567c5599793b..076ccbd0cd88 100644 --- a/drivers/video/adf/adf_sysfs.c +++ b/drivers/video/adf/adf_sysfs.c @@ -33,6 +33,24 @@ static ssize_t dpms_state_show(struct device *dev, adf_interface_dpms_state(intf)); } +static ssize_t dpms_state_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) +{ + struct adf_interface *intf = dev_to_adf_interface(dev); + u8 dpms_state; + int err; + + err = kstrtou8(buf, 0, &dpms_state); + if (err < 0) + return err; + + err = adf_interface_blank(intf, dpms_state); + if (err < 0) + return err; + + return count; +} + static ssize_t current_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -80,7 +98,7 @@ static ssize_t hotplug_detect_show(struct device *dev, } static struct device_attribute adf_interface_attrs[] = { - __ATTR_RO(dpms_state), + __ATTR(dpms_state, S_IRUGO|S_IWUSR, dpms_state_show, dpms_state_store), __ATTR_RO(current_mode), __ATTR_RO(hotplug_detect), __ATTR_RO(type), -- 2.34.1