10 #include <linux/kernel.h>
13 #include <linux/adb.h>
14 #include <linux/pmu.h>
16 #include <linux/export.h>
20 #define OLD_BACKLIGHT_MAX 15
25 static DECLARE_WORK(pmac_backlight_key_work, pmac_backlight_key_worker);
26 static DECLARE_WORK(pmac_backlight_set_legacy_work, pmac_backlight_set_legacy_worker);
32 static int pmac_backlight_key_queued;
33 static int pmac_backlight_set_legacy_queued;
64 "backlight-control",
NULL);
77 int level = (FB_BACKLIGHT_LEVELS - 1);
79 if (info && info->bl_dev) {
83 for (i = 0; i < FB_BACKLIGHT_LEVELS; i++)
84 max =
max((
int)info->bl_curve[
i],
max);
87 for (i = 0; i < FB_BACKLIGHT_LEVELS; i++) {
88 int diff =
abs(info->bl_curve[i] - value);
106 if (pmac_backlight) {
110 props = &pmac_backlight->
props;
113 ((pmac_backlight_key_queued?-1:1) *
122 backlight_update_status(pmac_backlight);
140 static int __pmac_backlight_set_legacy_brightness(
int brightness)
145 if (pmac_backlight) {
148 props = &pmac_backlight->
props;
158 backlight_update_status(pmac_backlight);
167 static void pmac_backlight_set_legacy_worker(
struct work_struct *work)
172 __pmac_backlight_set_legacy_brightness(pmac_backlight_set_legacy_queued);
180 pmac_backlight_set_legacy_queued =
brightness;
186 return __pmac_backlight_set_legacy_brightness(brightness);
194 if (pmac_backlight) {
197 props = &pmac_backlight->
props;