aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/max77686.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/max77686.c')
-rw-r--r--drivers/mfd/max77686.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 929795eae9fc..760d08d7923d 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -111,17 +111,17 @@ static bool max77802_is_volatile_reg(struct device *dev, unsigned int reg)
111 max77802_rtc_is_volatile_reg(dev, reg)); 111 max77802_rtc_is_volatile_reg(dev, reg));
112} 112}
113 113
114static struct regmap_config max77686_regmap_config = { 114static const struct regmap_config max77686_regmap_config = {
115 .reg_bits = 8, 115 .reg_bits = 8,
116 .val_bits = 8, 116 .val_bits = 8,
117}; 117};
118 118
119static struct regmap_config max77686_rtc_regmap_config = { 119static const struct regmap_config max77686_rtc_regmap_config = {
120 .reg_bits = 8, 120 .reg_bits = 8,
121 .val_bits = 8, 121 .val_bits = 8,
122}; 122};
123 123
124static struct regmap_config max77802_regmap_config = { 124static const struct regmap_config max77802_regmap_config = {
125 .reg_bits = 8, 125 .reg_bits = 8,
126 .val_bits = 8, 126 .val_bits = 8,
127 .writeable_reg = max77802_is_accessible_reg, 127 .writeable_reg = max77802_is_accessible_reg,
@@ -205,24 +205,10 @@ static const struct of_device_id max77686_pmic_dt_match[] = {
205 { }, 205 { },
206}; 206};
207 207
208static struct max77686_platform_data *max77686_i2c_parse_dt_pdata(struct device
209 *dev)
210{
211 struct max77686_platform_data *pd;
212
213 pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
214 if (!pd)
215 return NULL;
216
217 dev->platform_data = pd;
218 return pd;
219}
220
221static int max77686_i2c_probe(struct i2c_client *i2c, 208static int max77686_i2c_probe(struct i2c_client *i2c,
222 const struct i2c_device_id *id) 209 const struct i2c_device_id *id)
223{ 210{
224 struct max77686_dev *max77686 = NULL; 211 struct max77686_dev *max77686 = NULL;
225 struct max77686_platform_data *pdata = dev_get_platdata(&i2c->dev);
226 const struct of_device_id *match; 212 const struct of_device_id *match;
227 unsigned int data; 213 unsigned int data;
228 int ret = 0; 214 int ret = 0;
@@ -233,14 +219,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
233 const struct mfd_cell *cells; 219 const struct mfd_cell *cells;
234 int n_devs; 220 int n_devs;
235 221
236 if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node && !pdata)
237 pdata = max77686_i2c_parse_dt_pdata(&i2c->dev);
238
239 if (!pdata) {
240 dev_err(&i2c->dev, "No platform data found.\n");
241 return -EINVAL;
242 }
243
244 max77686 = devm_kzalloc(&i2c->dev, 222 max77686 = devm_kzalloc(&i2c->dev,
245 sizeof(struct max77686_dev), GFP_KERNEL); 223 sizeof(struct max77686_dev), GFP_KERNEL);
246 if (!max77686) 224 if (!max77686)
@@ -259,7 +237,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
259 max77686->dev = &i2c->dev; 237 max77686->dev = &i2c->dev;
260 max77686->i2c = i2c; 238 max77686->i2c = i2c;
261 239
262 max77686->wakeup = pdata->wakeup;
263 max77686->irq = i2c->irq; 240 max77686->irq = i2c->irq;
264 241
265 if (max77686->type == TYPE_MAX77686) { 242 if (max77686->type == TYPE_MAX77686) {