Skip to content

Commit efbf492

Browse files
jaewon02kimLee Jones
authored andcommitted
mfd: max77693: Initialize haptic register map
This patch add regmap_haptic initialization to use haptic register map in haptic device driver. Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 11d0d30 commit efbf492

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

‎drivers/mfd/max77693.c‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ static const struct regmap_irq_chip max77693_muic_irq_chip = {
147147
.num_irqs = ARRAY_SIZE(max77693_muic_irqs),
148148
};
149149

150+
static const struct regmap_config max77693_regmap_haptic_config = {
151+
.reg_bits = 8,
152+
.val_bits = 8,
153+
.max_register = MAX77693_HAPTIC_REG_END,
154+
};
155+
150156
static int max77693_i2c_probe(struct i2c_client *i2c,
151157
const struct i2c_device_id *id)
152158
{
@@ -196,6 +202,15 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
196202
}
197203
i2c_set_clientdata(max77693->haptic, max77693);
198204

205+
max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic,
206+
&max77693_regmap_haptic_config);
207+
if (IS_ERR(max77693->regmap_haptic)) {
208+
ret = PTR_ERR(max77693->regmap_haptic);
209+
dev_err(max77693->dev,
210+
"failed to initialize haptic register map: %d\n", ret);
211+
goto err_regmap;
212+
}
213+
199214
/*
200215
* Initialize register map for MUIC device because use regmap-muic
201216
* instance of MUIC device when irq of max77693 is initialized
@@ -207,7 +222,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
207222
ret = PTR_ERR(max77693->regmap_muic);
208223
dev_err(max77693->dev,
209224
"failed to allocate register map: %d\n", ret);
210-
goto err_regmap_muic;
225+
goto err_regmap;
211226
}
212227

213228
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
@@ -217,7 +232,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
217232
&max77693->irq_data_led);
218233
if (ret) {
219234
dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
220-
goto err_regmap_muic;
235+
goto err_regmap;
221236
}
222237

223238
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
@@ -268,7 +283,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
268283
regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
269284
err_irq_topsys:
270285
regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
271-
err_regmap_muic:
286+
err_regmap:
272287
i2c_unregister_device(max77693->haptic);
273288
err_i2c_haptic:
274289
i2c_unregister_device(max77693->muic);

0 commit comments

Comments
 (0)