max14577.c (f89e0dd9d1a72fdf6b8958bcadfa6abf84f3cae0) max14577.c (575343d161d75dc1516f53436b9eb47d04eda938)
1/*
2 * max14577.c - mfd core driver for the Maxim 14577
3 *
4 * Copyright (C) 2013 Samsung Electrnoics
5 * Chanwoo Choi <cw00.choi@samsung.com>
6 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 23 unchanged lines hidden (view full) ---

32 },
33 {
34 .name = "max14577-regulator",
35 .of_compatible = "maxim,max14577-regulator",
36 },
37 { .name = "max14577-charger", },
38};
39
1/*
2 * max14577.c - mfd core driver for the Maxim 14577
3 *
4 * Copyright (C) 2013 Samsung Electrnoics
5 * Chanwoo Choi <cw00.choi@samsung.com>
6 * Krzysztof Kozlowski <k.kozlowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 23 unchanged lines hidden (view full) ---

32 },
33 {
34 .name = "max14577-regulator",
35 .of_compatible = "maxim,max14577-regulator",
36 },
37 { .name = "max14577-charger", },
38};
39
40static bool max14577_volatile_reg(struct device *dev, unsigned int reg)
40static bool max14577_muic_volatile_reg(struct device *dev, unsigned int reg)
41{
42 switch (reg) {
43 case MAX14577_REG_INT1 ... MAX14577_REG_STATUS3:
44 return true;
45 default:
46 break;
47 }
48 return false;
49}
50
41{
42 switch (reg) {
43 case MAX14577_REG_INT1 ... MAX14577_REG_STATUS3:
44 return true;
45 default:
46 break;
47 }
48 return false;
49}
50
51static const struct regmap_config max14577_regmap_config = {
51static const struct regmap_config max14577_muic_regmap_config = {
52 .reg_bits = 8,
53 .val_bits = 8,
52 .reg_bits = 8,
53 .val_bits = 8,
54 .volatile_reg = max14577_volatile_reg,
54 .volatile_reg = max14577_muic_volatile_reg,
55 .max_register = MAX14577_REG_END,
56};
57
58static const struct regmap_irq max14577_irqs[] = {
59 /* INT1 interrupts */
60 { .reg_offset = 0, .mask = INT1_ADC_MASK, },
61 { .reg_offset = 0, .mask = INT1_ADCLOW_MASK, },
62 { .reg_offset = 0, .mask = INT1_ADCERR_MASK, },

--- 45 unchanged lines hidden (view full) ---

108 if (!max14577)
109 return -ENOMEM;
110
111 i2c_set_clientdata(i2c, max14577);
112 max14577->dev = &i2c->dev;
113 max14577->i2c = i2c;
114 max14577->irq = i2c->irq;
115
55 .max_register = MAX14577_REG_END,
56};
57
58static const struct regmap_irq max14577_irqs[] = {
59 /* INT1 interrupts */
60 { .reg_offset = 0, .mask = INT1_ADC_MASK, },
61 { .reg_offset = 0, .mask = INT1_ADCLOW_MASK, },
62 { .reg_offset = 0, .mask = INT1_ADCERR_MASK, },

--- 45 unchanged lines hidden (view full) ---

108 if (!max14577)
109 return -ENOMEM;
110
111 i2c_set_clientdata(i2c, max14577);
112 max14577->dev = &i2c->dev;
113 max14577->i2c = i2c;
114 max14577->irq = i2c->irq;
115
116 max14577->regmap = devm_regmap_init_i2c(i2c, &max14577_regmap_config);
116 max14577->regmap = devm_regmap_init_i2c(i2c,
117 &max14577_muic_regmap_config);
117 if (IS_ERR(max14577->regmap)) {
118 ret = PTR_ERR(max14577->regmap);
119 dev_err(max14577->dev, "Failed to allocate register map: %d\n",
120 ret);
121 return ret;
122 }
123
124 ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID,

--- 127 unchanged lines hidden ---
118 if (IS_ERR(max14577->regmap)) {
119 ret = PTR_ERR(max14577->regmap);
120 dev_err(max14577->dev, "Failed to allocate register map: %d\n",
121 ret);
122 return ret;
123 }
124
125 ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID,

--- 127 unchanged lines hidden ---