static struct marubl *marubl_device;
/* ============================================================================== */
+static int min_brightness = 1;
static int max_brightness = 24;
static int marubl_get_intensity(struct backlight_device *bd)
* 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);
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",
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)
{
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,
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