-#ifdef CONFIG_FB_BACKLIGHT
-static ssize_t store_bl_curve(struct class_device *class_device,
- const char *buf, size_t count)
-{
- struct fb_info *fb_info = class_get_devdata(class_device);
- u8 tmp_curve[FB_BACKLIGHT_LEVELS];
- unsigned int i;
-
- /* Some drivers don't use framebuffer_alloc(), but those also
- * don't have backlights.
- */
- if (!fb_info || !fb_info->bl_dev)
- return -ENODEV;
-
- if (count != (FB_BACKLIGHT_LEVELS / 8 * 24))
- return -EINVAL;
-
- for (i = 0; i < (FB_BACKLIGHT_LEVELS / 8); ++i)
- if (sscanf(&buf[i * 24],
- "%2hhx %2hhx %2hhx %2hhx %2hhx %2hhx %2hhx %2hhx\n",
- &tmp_curve[i * 8 + 0],
- &tmp_curve[i * 8 + 1],
- &tmp_curve[i * 8 + 2],
- &tmp_curve[i * 8 + 3],
- &tmp_curve[i * 8 + 4],
- &tmp_curve[i * 8 + 5],
- &tmp_curve[i * 8 + 6],
- &tmp_curve[i * 8 + 7]) != 8)
- return -EINVAL;
-
- /* If there has been an error in the input data, we won't
- * reach this loop.
- */
- mutex_lock(&fb_info->bl_mutex);
- for (i = 0; i < FB_BACKLIGHT_LEVELS; ++i)
- fb_info->bl_curve[i] = tmp_curve[i];
- mutex_unlock(&fb_info->bl_mutex);
-
- return count;
-}
-
-static ssize_t show_bl_curve(struct class_device *class_device, char *buf)
-{
- struct fb_info *fb_info = class_get_devdata(class_device);
- ssize_t len = 0;
- unsigned int i;
-
- /* Some drivers don't use framebuffer_alloc(), but those also
- * don't have backlights.
- */
- if (!fb_info || !fb_info->bl_dev)
- return -ENODEV;
-
- mutex_lock(&fb_info->bl_mutex);
- for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8)
- len += snprintf(&buf[len], PAGE_SIZE,
- "%02x %02x %02x %02x %02x %02x %02x %02x\n",
- fb_info->bl_curve[i + 0],
- fb_info->bl_curve[i + 1],
- fb_info->bl_curve[i + 2],
- fb_info->bl_curve[i + 3],
- fb_info->bl_curve[i + 4],
- fb_info->bl_curve[i + 5],
- fb_info->bl_curve[i + 6],
- fb_info->bl_curve[i + 7]);
- mutex_unlock(&fb_info->bl_mutex);
-
- return len;
-}
-#endif
-