4 * Copyright 2015 Texas Instruments
6 * Author: Milo Kim <milo.kim@ti.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #ifndef __MFD_LM3632_H__
15 #define __MFD_LM3632_H__
17 #include <linux/gpio.h>
18 #include <linux/pwm.h>
19 #include <linux/regmap.h>
20 #include <linux/regulator/machine.h>
23 #define LM3632_REG_CONFIG1 0x02
24 #define LM3632_OVP_MASK (BIT(5) | BIT(6) | BIT(7))
25 #define LM3632_OVP_25V BIT(6)
27 #define LM3632_REG_CONFIG2 0x03
28 #define LM3632_SWFREQ_MASK BIT(7)
29 #define LM3632_SWFREQ_1MHZ BIT(7)
31 #define LM3632_REG_BRT_LSB 0x04
32 #define LM3632_BRT_LSB_MASK (BIT(0) | BIT(1) | BIT(2))
33 #define LM3632_REG_BRT_MSB 0x05
34 #define LM3632_BRT_MSB_SHIFT 3
36 #define LM3632_REG_IO_CTRL 0x09
37 #define LM3632_PWM_MASK BIT(6)
38 #define LM3632_PWM_SHIFT 6
40 #define LM3632_REG_ENABLE 0x0A
41 #define LM3632_BL_EN_MASK BIT(0)
42 #define LM3632_BL_EN_SHIFT 0
43 #define LM3632_BL_STRING_MASK (BIT(3) | BIT(4))
44 #define LM3632_BL_ONE_STRING BIT(4)
45 #define LM3632_BL_TWO_STRINGS BIT(3)
47 #define LM3632_REG_BIAS_CONFIG 0x0C
48 #define LM3632_EXT_EN_MASK BIT(0)
49 #define LM3632_EN_VNEG_MASK BIT(1)
50 #define LM3632_EN_VPOS_MASK BIT(2)
52 #define LM3632_REG_VOUT_BOOST 0x0D
53 #define LM3632_REG_VOUT_POS 0x0E
54 #define LM3632_REG_VOUT_NEG 0x0F
55 #define LM3632_VOUT_MASK 0x3F
57 #define LM3632_MAX_REGISTERS 0x10
59 #define LM3632_NUM_REGULATORS 3
62 * struct lm3632_backlight_platform_data
63 * @name: Backlight driver name
64 * @is_full_strings: set true if two strings are used
65 * @pwm_period: Platform specific PWM period value. unit is nano
67 struct lm3632_backlight_platform_data {
71 /* Only valid in case of PWM mode */
72 unsigned int pwm_period;
76 * struct lm3632_platform_data
77 * @en_gpio: GPIO for chip enable pin
78 * @lcm_en1_gpio: GPIO for VPOS LDO
79 * @lcm_en2_gpio: GPIO for VNEG LDO
80 * @regulator_data: Regulator initial data for LCD bias
81 * @bl_pdata: Backlight platform data
83 struct lm3632_platform_data {
87 struct regulator_init_data *regulator_data[LM3632_NUM_REGULATORS];
88 struct lm3632_backlight_platform_data *bl_pdata;
93 * @dev: Parent device pointer
94 * @regmap: Used for i2c communcation on accessing registers
95 * @pdata: LMU platform specific data
99 struct regmap *regmap;
100 struct lm3632_platform_data *pdata;
103 int lm3632_read_byte(struct lm3632 *lm3632, u8 reg, u8 *read);
104 int lm3632_write_byte(struct lm3632 *lm3632, u8 reg, u8 data);
105 int lm3632_update_bits(struct lm3632 *lm3632, u8 reg, u8 mask, u8 data);