diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-05-10 08:11:29 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-20 11:27:01 -0400 |
commit | f4cf18ca5914bc1edb03c9049198738255fa4a23 (patch) | |
tree | c513a74062f6c9fb255b7618b5a82ce377b469fa /drivers/mfd/lm3533-core.c | |
parent | d9055dc501da6734e3cfea1ef236173bd8b645b1 (diff) |
mfd: Remove lm3533 boost attributes
Remove boost-frequency and ovp attributes, which can be set through
platform data, from sysfs.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/lm3533-core.c')
-rw-r--r-- | drivers/mfd/lm3533-core.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c index 053438cff10a..d6705431c897 100644 --- a/drivers/mfd/lm3533-core.c +++ b/drivers/mfd/lm3533-core.c | |||
@@ -26,11 +26,9 @@ | |||
26 | #include <linux/mfd/lm3533.h> | 26 | #include <linux/mfd/lm3533.h> |
27 | 27 | ||
28 | 28 | ||
29 | #define LM3533_BOOST_OVP_MAX 0x03 | ||
30 | #define LM3533_BOOST_OVP_MASK 0x06 | 29 | #define LM3533_BOOST_OVP_MASK 0x06 |
31 | #define LM3533_BOOST_OVP_SHIFT 1 | 30 | #define LM3533_BOOST_OVP_SHIFT 1 |
32 | 31 | ||
33 | #define LM3533_BOOST_FREQ_MAX 0x01 | ||
34 | #define LM3533_BOOST_FREQ_MASK 0x01 | 32 | #define LM3533_BOOST_FREQ_MASK 0x01 |
35 | #define LM3533_BOOST_FREQ_SHIFT 0 | 33 | #define LM3533_BOOST_FREQ_SHIFT 0 |
36 | 34 | ||
@@ -253,96 +251,12 @@ struct lm3533_device_attribute { | |||
253 | struct { | 251 | struct { |
254 | u8 id; | 252 | u8 id; |
255 | } output; | 253 | } output; |
256 | struct { | ||
257 | u8 reg; | ||
258 | u8 shift; | ||
259 | u8 mask; | ||
260 | u8 max; | ||
261 | } generic; | ||
262 | } u; | 254 | } u; |
263 | }; | 255 | }; |
264 | 256 | ||
265 | #define to_lm3533_dev_attr(_attr) \ | 257 | #define to_lm3533_dev_attr(_attr) \ |
266 | container_of(_attr, struct lm3533_device_attribute, dev_attr) | 258 | container_of(_attr, struct lm3533_device_attribute, dev_attr) |
267 | 259 | ||
268 | static ssize_t show_lm3533_reg(struct device *dev, | ||
269 | struct device_attribute *attr, char *buf) | ||
270 | { | ||
271 | struct lm3533 *lm3533 = dev_get_drvdata(dev); | ||
272 | struct lm3533_device_attribute *lattr = to_lm3533_dev_attr(attr); | ||
273 | u8 val; | ||
274 | int ret; | ||
275 | |||
276 | ret = lm3533_read(lm3533, lattr->u.generic.reg, &val); | ||
277 | if (ret) | ||
278 | return ret; | ||
279 | |||
280 | val = (val & lattr->u.generic.mask) >> lattr->u.generic.shift; | ||
281 | |||
282 | return scnprintf(buf, PAGE_SIZE, "%u\n", val); | ||
283 | } | ||
284 | |||
285 | static ssize_t store_lm3533_reg(struct device *dev, | ||
286 | struct device_attribute *attr, | ||
287 | const char *buf, size_t len) | ||
288 | { | ||
289 | struct lm3533 *lm3533 = dev_get_drvdata(dev); | ||
290 | struct lm3533_device_attribute *lattr = to_lm3533_dev_attr(attr); | ||
291 | u8 val; | ||
292 | int ret; | ||
293 | |||
294 | if (kstrtou8(buf, 0, &val) || val > lattr->u.generic.max) | ||
295 | return -EINVAL; | ||
296 | |||
297 | val = val << lattr->u.generic.shift; | ||
298 | ret = lm3533_update(lm3533, lattr->u.generic.reg, val, | ||
299 | lattr->u.generic.mask); | ||
300 | if (ret) | ||
301 | return ret; | ||
302 | |||
303 | return len; | ||
304 | } | ||
305 | |||
306 | #define GENERIC_ATTR(_reg, _max, _mask, _shift) \ | ||
307 | { .reg = _reg, \ | ||
308 | .max = _max, \ | ||
309 | .mask = _mask, \ | ||
310 | .shift = _shift } | ||
311 | |||
312 | #define LM3533_GENERIC_ATTR(_name, _mode, _show, _store, _type, \ | ||
313 | _reg, _max, _mask, _shift) \ | ||
314 | struct lm3533_device_attribute lm3533_dev_attr_##_name = { \ | ||
315 | .dev_attr = __ATTR(_name, _mode, _show, _store), \ | ||
316 | .type = _type, \ | ||
317 | .u.generic = GENERIC_ATTR(_reg, _max, _mask, _shift) } | ||
318 | |||
319 | #define LM3533_GENERIC_ATTR_RW(_name, _type, _reg, _max, _mask, _shift) \ | ||
320 | LM3533_GENERIC_ATTR(_name, S_IRUGO | S_IWUSR, \ | ||
321 | show_lm3533_reg, store_lm3533_reg, \ | ||
322 | _type, _reg, _max, _mask, _shift) | ||
323 | |||
324 | #define LM3533_BOOST_ATTR_RW(_name, _NAME) \ | ||
325 | LM3533_GENERIC_ATTR_RW(_name, LM3533_ATTR_TYPE_BACKLIGHT, \ | ||
326 | LM3533_REG_BOOST_PWM, LM3533_##_NAME##_MAX, \ | ||
327 | LM3533_##_NAME##_MASK, LM3533_##_NAME##_SHIFT) | ||
328 | /* | ||
329 | * Boost Over Voltage Protection Select | ||
330 | * | ||
331 | * 0 - 16 V (default) | ||
332 | * 1 - 24 V | ||
333 | * 2 - 32 V | ||
334 | * 3 - 40 V | ||
335 | */ | ||
336 | static LM3533_BOOST_ATTR_RW(boost_ovp, BOOST_OVP); | ||
337 | |||
338 | /* | ||
339 | * Boost Frequency Select | ||
340 | * | ||
341 | * 0 - 500 kHz (default) | ||
342 | * 1 - 1 MHz | ||
343 | */ | ||
344 | static LM3533_BOOST_ATTR_RW(boost_freq, BOOST_FREQ); | ||
345 | |||
346 | static ssize_t show_output(struct device *dev, | 260 | static ssize_t show_output(struct device *dev, |
347 | struct device_attribute *attr, char *buf) | 261 | struct device_attribute *attr, char *buf) |
348 | { | 262 | { |
@@ -432,8 +346,6 @@ static LM3533_OUTPUT_LVLED_ATTR_RW(4); | |||
432 | static LM3533_OUTPUT_LVLED_ATTR_RW(5); | 346 | static LM3533_OUTPUT_LVLED_ATTR_RW(5); |
433 | 347 | ||
434 | static struct attribute *lm3533_attributes[] = { | 348 | static struct attribute *lm3533_attributes[] = { |
435 | &lm3533_dev_attr_boost_freq.dev_attr.attr, | ||
436 | &lm3533_dev_attr_boost_ovp.dev_attr.attr, | ||
437 | &lm3533_dev_attr_output_hvled1.dev_attr.attr, | 349 | &lm3533_dev_attr_output_hvled1.dev_attr.attr, |
438 | &lm3533_dev_attr_output_hvled2.dev_attr.attr, | 350 | &lm3533_dev_attr_output_hvled2.dev_attr.attr, |
439 | &lm3533_dev_attr_output_lvled1.dev_attr.attr, | 351 | &lm3533_dev_attr_output_lvled1.dev_attr.attr, |