[Title]add kernel node for min_brightness
authorsungmin ha <sungmin82.ha@samsung.com>
Mon, 27 Aug 2012 11:30:46 +0000 (20:30 +0900)
committersungmin ha <sungmin82.ha@samsung.com>
Tue, 28 Aug 2012 04:22:34 +0000 (13:22 +0900)
[Type]Bugfix
[Module]emulator-kernel
[Priority]Critical
[Jira#]N_SE-5689
[Redmine#]  // Redmine Isuue Number
[Problem]  // Problem Description
[Cause]  // Cause Description
[Solution] // Solution Description
[TestCase]  // Executed the test-target (How to)

drivers/maru/maru_bl.c
drivers/video/backlight/backlight.c
include/linux/backlight.h

index bc6839f887645b360d48420a4c4099d6c8cf643c..9aba75cbdfb446f74e6deddfc68f2936b314986c 100644 (file)
@@ -63,6 +63,7 @@ struct marubl {
 static struct marubl *marubl_device;
 /* ============================================================================== */
 
+static int min_brightness = 1;
 static int max_brightness = 24;
 
 static int marubl_get_intensity(struct backlight_device *bd)
@@ -149,6 +150,7 @@ static int __devinit marubl_probe(struct pci_dev *pci_dev,
         * register backlight device
         */
        memset(&props, 0, sizeof(struct backlight_properties));
+       props.min_brightness = min_brightness;
        props.max_brightness = max_brightness;
        props.type = BACKLIGHT_PLATFORM;
        bd = backlight_device_register ("emulator",     &pci_dev->dev, NULL, &marubl_ops, &props);
index bf5b1ece71605d701516f599af7ef1ce18751a11..9354c7413cdcb8521dc25fdda8c7b5f360999abc 100644 (file)
@@ -158,7 +158,7 @@ static ssize_t backlight_store_brightness(struct device *dev,
 
        mutex_lock(&bd->ops_lock);
        if (bd->ops) {
-               if (brightness > bd->props.max_brightness)
+               if (brightness > bd->props.max_brightness || brightness < bd->props.min_brightness)
                        rc = -EINVAL;
                else {
                        pr_debug("backlight: set brightness to %lu\n",
@@ -183,6 +183,14 @@ static ssize_t backlight_show_type(struct device *dev,
        return sprintf(buf, "%s\n", backlight_types[bd->props.type]);
 }
 
+static ssize_t backlight_show_min_brightness(struct device *dev,
+                struct device_attribute *attr, char *buf)
+{
+        struct backlight_device *bd = to_backlight_device(dev);
+
+        return sprintf(buf, "%d\n", bd->props.min_brightness);
+}
+
 static ssize_t backlight_show_max_brightness(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
@@ -247,6 +255,7 @@ static struct device_attribute bl_device_attributes[] = {
                     backlight_store_brightness),
        __ATTR(actual_brightness, 0444, backlight_show_actual_brightness,
                     NULL),
+       __ATTR(min_brightness, 0444, backlight_show_min_brightness, NULL),
        __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL),
        __ATTR(type, 0444, backlight_show_type, NULL),
        __ATTR_NULL,
index 5ffc6dda46751a44681ee3f94808ceeb50fd0d38..22edbe2a929e0756943b867e2299671efb710eb7 100644 (file)
@@ -61,6 +61,8 @@ struct backlight_ops {
 struct backlight_properties {
        /* Current User requested brightness (0 - max_brightness) */
        int brightness;
+       /* Minimal value for brightness (read-only) */
+       int min_brightness;
        /* Maximal value for brightness (read-only) */
        int max_brightness;
        /* Current FB Power mode (0: full on, 1..3: power saving