Source
wleds = devm_kzalloc(&pdev->dev, sizeof(struct da9052_bl), GFP_KERNEL);
/*
* Backlight Driver for Dialog DA9052 PMICs
*
* Copyright(c) 2012 Dialog Semiconductor Ltd.
*
* Author: David Dajun Chen <dchen@diasemi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
enum {
DA9052_WLEDS_OFF,
DA9052_WLEDS_ON,
};
enum {
DA9052_TYPE_WLED1,
DA9052_TYPE_WLED2,
DA9052_TYPE_WLED3,
};
static const unsigned char wled_bank[] = {
DA9052_LED1_CONF_REG,
DA9052_LED2_CONF_REG,
DA9052_LED3_CONF_REG,
};
struct da9052_bl {
struct da9052 *da9052;
uint brightness;
uint state;
uint led_reg;
};
static int da9052_adjust_wled_brightness(struct da9052_bl *wleds)
{
unsigned char boost_en;
unsigned char i_sink;
int ret;
boost_en = 0x3F;
i_sink = 0xFF;
if (wleds->state == DA9052_WLEDS_OFF) {
boost_en = 0x00;
i_sink = 0x00;
}
ret = da9052_reg_write(wleds->da9052, DA9052_BOOST_REG, boost_en);