Commit efbf4922 authored by Jaewon Kim's avatar Jaewon Kim Committed by Lee Jones

mfd: max77693: Initialize haptic register map

This patch add regmap_haptic initialization to use haptic register map
in haptic device driver.
Signed-off-by: default avatarJaewon Kim <jaewon02.kim@samsung.com>
Acked-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 11d0d300
...@@ -147,6 +147,12 @@ static const struct regmap_irq_chip max77693_muic_irq_chip = { ...@@ -147,6 +147,12 @@ static const struct regmap_irq_chip max77693_muic_irq_chip = {
.num_irqs = ARRAY_SIZE(max77693_muic_irqs), .num_irqs = ARRAY_SIZE(max77693_muic_irqs),
}; };
static const struct regmap_config max77693_regmap_haptic_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX77693_HAPTIC_REG_END,
};
static int max77693_i2c_probe(struct i2c_client *i2c, static int max77693_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -196,6 +202,15 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -196,6 +202,15 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
} }
i2c_set_clientdata(max77693->haptic, max77693); i2c_set_clientdata(max77693->haptic, max77693);
max77693->regmap_haptic = devm_regmap_init_i2c(max77693->haptic,
&max77693_regmap_haptic_config);
if (IS_ERR(max77693->regmap_haptic)) {
ret = PTR_ERR(max77693->regmap_haptic);
dev_err(max77693->dev,
"failed to initialize haptic register map: %d\n", ret);
goto err_regmap;
}
/* /*
* Initialize register map for MUIC device because use regmap-muic * Initialize register map for MUIC device because use regmap-muic
* instance of MUIC device when irq of max77693 is initialized * instance of MUIC device when irq of max77693 is initialized
...@@ -207,7 +222,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -207,7 +222,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
ret = PTR_ERR(max77693->regmap_muic); ret = PTR_ERR(max77693->regmap_muic);
dev_err(max77693->dev, dev_err(max77693->dev,
"failed to allocate register map: %d\n", ret); "failed to allocate register map: %d\n", ret);
goto err_regmap_muic; goto err_regmap;
} }
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
...@@ -217,7 +232,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -217,7 +232,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
&max77693->irq_data_led); &max77693->irq_data_led);
if (ret) { if (ret) {
dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
goto err_regmap_muic; goto err_regmap;
} }
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
...@@ -268,7 +283,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -268,7 +283,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
err_irq_topsys: err_irq_topsys:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
err_regmap_muic: err_regmap:
i2c_unregister_device(max77693->haptic); i2c_unregister_device(max77693->haptic);
err_i2c_haptic: err_i2c_haptic:
i2c_unregister_device(max77693->muic); i2c_unregister_device(max77693->muic);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment