9 #include <linux/kernel.h>
15 #include <linux/slab.h>
16 #include <linux/module.h>
33 if (data->
pdata->en_ambl_sens) {
69 int brightness = bl->
props.brightness;
76 return adp5520_bl_set(bl, brightness);
91 .update_status = adp5520_bl_update_status,
92 .get_brightness = adp5520_bl_get_brightness,
153 return sprintf(buf,
"%u\n", reg_val);
163 ret = kstrtoul(buf, 10, &val);
182 const char *buf,
size_t count)
186 static DEVICE_ATTR(dark_max, 0664, adp5520_bl_dark_max_show,
187 adp5520_bl_dark_max_store);
189 static ssize_t adp5520_bl_office_max_show(
struct device *dev,
195 static ssize_t adp5520_bl_office_max_store(
struct device *dev,
197 const char *buf,
size_t count)
201 static DEVICE_ATTR(office_max, 0664, adp5520_bl_office_max_show,
202 adp5520_bl_office_max_store);
204 static ssize_t adp5520_bl_daylight_max_show(
struct device *dev,
210 static ssize_t adp5520_bl_daylight_max_store(
struct device *dev,
212 const char *buf,
size_t count)
223 static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show,
224 adp5520_bl_daylight_max_store);
234 const char *buf,
size_t count)
238 static DEVICE_ATTR(dark_dim, 0664, adp5520_bl_dark_dim_show,
239 adp5520_bl_dark_dim_store);
241 static ssize_t adp5520_bl_office_dim_show(
struct device *dev,
247 static ssize_t adp5520_bl_office_dim_store(
struct device *dev,
249 const char *buf,
size_t count)
253 static DEVICE_ATTR(office_dim, 0664, adp5520_bl_office_dim_show,
254 adp5520_bl_office_dim_store);
256 static ssize_t adp5520_bl_daylight_dim_show(
struct device *dev,
262 static ssize_t adp5520_bl_daylight_dim_store(
struct device *dev,
264 const char *buf,
size_t count)
268 static DEVICE_ATTR(daylight_dim, 0664, adp5520_bl_daylight_dim_show,
269 adp5520_bl_daylight_dim_store);
271 static struct attribute *adp5520_bl_attributes[] = {
272 &dev_attr_dark_max.attr,
273 &dev_attr_dark_dim.attr,
274 &dev_attr_office_max.attr,
275 &dev_attr_office_dim.attr,
276 &dev_attr_daylight_max.attr,
277 &dev_attr_daylight_dim.attr,
282 .attrs = adp5520_bl_attributes,
297 data->
pdata = pdev->
dev.platform_data;
300 dev_err(&pdev->
dev,
"missing platform data\n");
313 &adp5520_bl_ops, &props);
315 dev_err(&pdev->
dev,
"failed to register backlight\n");
320 if (data->
pdata->en_ambl_sens)
322 &adp5520_bl_attr_group);
325 dev_err(&pdev->
dev,
"failed to register sysfs\n");
329 platform_set_drvdata(pdev, bl);
330 ret |= adp5520_bl_setup(bl);
331 backlight_update_status(bl);
343 if (data->
pdata->en_ambl_sens)
345 &adp5520_bl_attr_group);
357 return adp5520_bl_set(bl, 0);
364 backlight_update_status(bl);
368 #define adp5520_bl_suspend NULL
369 #define adp5520_bl_resume NULL
374 .name =
"adp5520-backlight",
377 .probe = adp5520_bl_probe,