14 #include <linux/device.h>
15 #include <linux/module.h>
20 #define LM3533_MAX_CURRENT_MIN 5000
21 #define LM3533_MAX_CURRENT_MAX 29800
22 #define LM3533_MAX_CURRENT_STEP 800
24 #define LM3533_BRIGHTNESS_MAX 255
25 #define LM3533_PWM_MAX 0x3f
27 #define LM3533_REG_PWM_BASE 0x14
28 #define LM3533_REG_MAX_CURRENT_BASE 0x1f
29 #define LM3533_REG_CTRLBANK_ENABLE 0x27
30 #define LM3533_REG_BRIGHTNESS_BASE 0x40
49 dev_err(cb->
dev,
"failed to enable ctrlbank %d\n", cb->
id);
65 dev_err(cb->
dev,
"failed to disable ctrlbank %d\n", cb->
id);
90 dev_err(cb->
dev,
"failed to set max current\n");
96 #define lm3533_ctrlbank_set(_name, _NAME) \
97 int lm3533_ctrlbank_set_##_name(struct lm3533_ctrlbank *cb, u8 val) \
102 if (val > LM3533_##_NAME##_MAX) \
105 reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_##_NAME##_BASE); \
106 ret = lm3533_write(cb->lm3533, reg, val); \
108 dev_err(cb->dev, "failed to set " #_name "\n"); \
112 EXPORT_SYMBOL_GPL(lm3533_ctrlbank_set_##_name);
114 #define lm3533_ctrlbank_get(_name, _NAME) \
115 int lm3533_ctrlbank_get_##_name(struct lm3533_ctrlbank *cb, u8 *val) \
120 reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_##_NAME##_BASE); \
121 ret = lm3533_read(cb->lm3533, reg, val); \
123 dev_err(cb->dev, "failed to get " #_name "\n"); \
127 EXPORT_SYMBOL_GPL(lm3533_ctrlbank_get_##_name);