as3711_bl.c (4a9c8bb2aca5b5a2a15744333729745dd9903562) | as3711_bl.c (d5318d302e7cf6583ec85a2a8bfbb3a3910ae372) |
---|---|
1/* 2 * AS3711 PMIC backlight driver, using DCDC Step Up Converters 3 * 4 * Copyright (C) 2012 Renesas Electronics Corporation 5 * Author: Guennadi Liakhovetski, <g.liakhovetski@gmx.de> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the version 2 of the GNU General Public License as --- 14 unchanged lines hidden (view full) --- 23 24enum as3711_bl_type { 25 AS3711_BL_SU1, 26 AS3711_BL_SU2, 27}; 28 29struct as3711_bl_data { 30 bool powered; | 1/* 2 * AS3711 PMIC backlight driver, using DCDC Step Up Converters 3 * 4 * Copyright (C) 2012 Renesas Electronics Corporation 5 * Author: Guennadi Liakhovetski, <g.liakhovetski@gmx.de> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the version 2 of the GNU General Public License as --- 14 unchanged lines hidden (view full) --- 23 24enum as3711_bl_type { 25 AS3711_BL_SU1, 26 AS3711_BL_SU2, 27}; 28 29struct as3711_bl_data { 30 bool powered; |
31 const char *fb_name; 32 struct device *fb_dev; | |
33 enum as3711_bl_type type; 34 int brightness; 35 struct backlight_device *bl; 36}; 37 38struct as3711_bl_supply { 39 struct as3711_bl_data su1; 40 struct as3711_bl_data su2; --- 227 unchanged lines hidden (view full) --- 268 bl = of_get_child_by_name(dev->parent->of_node, "backlight"); 269 if (!bl) { 270 dev_dbg(dev, "backlight node not found\n"); 271 return -ENODEV; 272 } 273 274 fb = of_parse_phandle(bl, "su1-dev", 0); 275 if (fb) { | 31 enum as3711_bl_type type; 32 int brightness; 33 struct backlight_device *bl; 34}; 35 36struct as3711_bl_supply { 37 struct as3711_bl_data su1; 38 struct as3711_bl_data su2; --- 227 unchanged lines hidden (view full) --- 266 bl = of_get_child_by_name(dev->parent->of_node, "backlight"); 267 if (!bl) { 268 dev_dbg(dev, "backlight node not found\n"); 269 return -ENODEV; 270 } 271 272 fb = of_parse_phandle(bl, "su1-dev", 0); 273 if (fb) { |
276 pdata->su1_fb = fb->full_name; | 274 of_node_put(fb); |
277 | 275 |
276 pdata->su1_fb = true; 277 |
|
278 ret = of_property_read_u32(bl, "su1-max-uA", &pdata->su1_max_uA); 279 if (pdata->su1_max_uA <= 0) 280 ret = -EINVAL; 281 if (ret < 0) 282 goto err_put_bl; 283 } 284 285 fb = of_parse_phandle(bl, "su2-dev", 0); 286 if (fb) { 287 int count = 0; 288 | 278 ret = of_property_read_u32(bl, "su1-max-uA", &pdata->su1_max_uA); 279 if (pdata->su1_max_uA <= 0) 280 ret = -EINVAL; 281 if (ret < 0) 282 goto err_put_bl; 283 } 284 285 fb = of_parse_phandle(bl, "su2-dev", 0); 286 if (fb) { 287 int count = 0; 288 |
289 pdata->su2_fb = fb->full_name; | 289 of_node_put(fb); |
290 | 290 |
291 pdata->su2_fb = true; 292 |
|
291 ret = of_property_read_u32(bl, "su2-max-uA", &pdata->su2_max_uA); 292 if (pdata->su2_max_uA <= 0) 293 ret = -EINVAL; 294 if (ret < 0) 295 goto err_put_bl; 296 297 if (of_find_property(bl, "su2-feedback-voltage", NULL)) { 298 pdata->su2_feedback = AS3711_SU2_VOLTAGE; --- 121 unchanged lines hidden (view full) --- 420 if (!supply) 421 return -ENOMEM; 422 423 supply->as3711 = as3711; 424 supply->pdata = pdata; 425 426 if (pdata->su1_fb) { 427 su = &supply->su1; | 293 ret = of_property_read_u32(bl, "su2-max-uA", &pdata->su2_max_uA); 294 if (pdata->su2_max_uA <= 0) 295 ret = -EINVAL; 296 if (ret < 0) 297 goto err_put_bl; 298 299 if (of_find_property(bl, "su2-feedback-voltage", NULL)) { 300 pdata->su2_feedback = AS3711_SU2_VOLTAGE; --- 121 unchanged lines hidden (view full) --- 422 if (!supply) 423 return -ENOMEM; 424 425 supply->as3711 = as3711; 426 supply->pdata = pdata; 427 428 if (pdata->su1_fb) { 429 su = &supply->su1; |
428 su->fb_name = pdata->su1_fb; | |
429 su->type = AS3711_BL_SU1; 430 431 max_brightness = min(pdata->su1_max_uA, 31); 432 ret = as3711_bl_register(pdev, max_brightness, su); 433 if (ret < 0) 434 return ret; 435 } 436 437 if (pdata->su2_fb) { 438 su = &supply->su2; | 430 su->type = AS3711_BL_SU1; 431 432 max_brightness = min(pdata->su1_max_uA, 31); 433 ret = as3711_bl_register(pdev, max_brightness, su); 434 if (ret < 0) 435 return ret; 436 } 437 438 if (pdata->su2_fb) { 439 su = &supply->su2; |
439 su->fb_name = pdata->su2_fb; | |
440 su->type = AS3711_BL_SU2; 441 442 switch (pdata->su2_fbprot) { 443 case AS3711_SU2_GPIO2: 444 case AS3711_SU2_GPIO3: 445 case AS3711_SU2_GPIO4: 446 case AS3711_SU2_LX_SD4: 447 break; --- 45 unchanged lines hidden --- | 440 su->type = AS3711_BL_SU2; 441 442 switch (pdata->su2_fbprot) { 443 case AS3711_SU2_GPIO2: 444 case AS3711_SU2_GPIO3: 445 case AS3711_SU2_GPIO4: 446 case AS3711_SU2_LX_SD4: 447 break; --- 45 unchanged lines hidden --- |