From: sungmin ha Date: Mon, 27 Aug 2012 11:30:46 +0000 (+0900) Subject: [Title]add kernel node for min_brightness X-Git-Tag: 2.2.1_release^2~88^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3710cad0e9bc953ab7ece0a67fe43881009fbc9f;p=sdk%2Femulator%2Femulator-kernel.git [Title]add kernel node for min_brightness [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) --- diff --git a/drivers/maru/maru_bl.c b/drivers/maru/maru_bl.c index bc6839f88764..9aba75cbdfb4 100644 --- a/drivers/maru/maru_bl.c +++ b/drivers/maru/maru_bl.c @@ -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); diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index bf5b1ece7160..9354c7413cdc 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -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, diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 5ffc6dda4675..22edbe2a929e 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -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 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index ff5dcdace32e..db6727b8e698 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Package: emulator-kernel-x86 -Version: 1.3.9 +Version: 1.3.10 OS: ubuntu-32, ubuntu-64, windows-32, windows-64, macos-64 Build-host-os: ubuntu-32 Maintainer: Yeong-Kyoon, Lee