mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
regulator/mfd: bd718xx: rename bd71837/bd71847 common instances
Rename parts of code that support both BD71837 and BD71847 to BD718XX. Signed-off-by: Matti Vaittinen <[email protected]> Acked-by: Lee Jones <[email protected]> Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
parent
18e4b55fbd
commit
dd2be639f4
3 changed files with 94 additions and 94 deletions
|
|
@ -2,9 +2,9 @@
|
|||
//
|
||||
// Copyright (C) 2018 ROHM Semiconductors
|
||||
//
|
||||
// ROHM BD71837MWV PMIC driver
|
||||
// ROHM BD71837MWV and BD71847MWV PMIC driver
|
||||
//
|
||||
// Datasheet available from
|
||||
// Datasheet for BD71837MWV available from
|
||||
// https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
|
||||
|
||||
#include <linux/gpio_keys.h>
|
||||
|
|
@ -30,7 +30,7 @@ static struct gpio_keys_platform_data bd718xx_powerkey_data = {
|
|||
.name = "bd718xx-pwrkey",
|
||||
};
|
||||
|
||||
static struct mfd_cell bd71837_mfd_cells[] = {
|
||||
static struct mfd_cell bd718xx_mfd_cells[] = {
|
||||
{
|
||||
.name = "gpio-keys",
|
||||
.platform_data = &bd718xx_powerkey_data,
|
||||
|
|
@ -40,20 +40,20 @@ static struct mfd_cell bd71837_mfd_cells[] = {
|
|||
{ .name = "bd718xx-pmic", },
|
||||
};
|
||||
|
||||
static const struct regmap_irq bd71837_irqs[] = {
|
||||
REGMAP_IRQ_REG(BD71837_INT_SWRST, 0, BD71837_INT_SWRST_MASK),
|
||||
REGMAP_IRQ_REG(BD71837_INT_PWRBTN_S, 0, BD71837_INT_PWRBTN_S_MASK),
|
||||
REGMAP_IRQ_REG(BD71837_INT_PWRBTN_L, 0, BD71837_INT_PWRBTN_L_MASK),
|
||||
REGMAP_IRQ_REG(BD71837_INT_PWRBTN, 0, BD71837_INT_PWRBTN_MASK),
|
||||
REGMAP_IRQ_REG(BD71837_INT_WDOG, 0, BD71837_INT_WDOG_MASK),
|
||||
REGMAP_IRQ_REG(BD71837_INT_ON_REQ, 0, BD71837_INT_ON_REQ_MASK),
|
||||
REGMAP_IRQ_REG(BD71837_INT_STBY_REQ, 0, BD71837_INT_STBY_REQ_MASK),
|
||||
static const struct regmap_irq bd718xx_irqs[] = {
|
||||
REGMAP_IRQ_REG(BD718XX_INT_SWRST, 0, BD718XX_INT_SWRST_MASK),
|
||||
REGMAP_IRQ_REG(BD718XX_INT_PWRBTN_S, 0, BD718XX_INT_PWRBTN_S_MASK),
|
||||
REGMAP_IRQ_REG(BD718XX_INT_PWRBTN_L, 0, BD718XX_INT_PWRBTN_L_MASK),
|
||||
REGMAP_IRQ_REG(BD718XX_INT_PWRBTN, 0, BD718XX_INT_PWRBTN_MASK),
|
||||
REGMAP_IRQ_REG(BD718XX_INT_WDOG, 0, BD718XX_INT_WDOG_MASK),
|
||||
REGMAP_IRQ_REG(BD718XX_INT_ON_REQ, 0, BD718XX_INT_ON_REQ_MASK),
|
||||
REGMAP_IRQ_REG(BD718XX_INT_STBY_REQ, 0, BD718XX_INT_STBY_REQ_MASK),
|
||||
};
|
||||
|
||||
static struct regmap_irq_chip bd71837_irq_chip = {
|
||||
.name = "bd71837-irq",
|
||||
.irqs = bd71837_irqs,
|
||||
.num_irqs = ARRAY_SIZE(bd71837_irqs),
|
||||
static struct regmap_irq_chip bd718xx_irq_chip = {
|
||||
.name = "bd718xx-irq",
|
||||
.irqs = bd718xx_irqs,
|
||||
.num_irqs = ARRAY_SIZE(bd718xx_irqs),
|
||||
.num_regs = 1,
|
||||
.irq_reg_stride = 1,
|
||||
.status_base = BD718XX_REG_IRQ,
|
||||
|
|
@ -73,7 +73,7 @@ static const struct regmap_access_table volatile_regs = {
|
|||
.n_yes_ranges = 1,
|
||||
};
|
||||
|
||||
static const struct regmap_config bd71837_regmap_config = {
|
||||
static const struct regmap_config bd718xx_regmap_config = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.volatile_table = &volatile_regs,
|
||||
|
|
@ -81,10 +81,10 @@ static const struct regmap_config bd71837_regmap_config = {
|
|||
.cache_type = REGCACHE_RBTREE,
|
||||
};
|
||||
|
||||
static int bd71837_i2c_probe(struct i2c_client *i2c,
|
||||
static int bd718xx_i2c_probe(struct i2c_client *i2c,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct bd71837 *bd71837;
|
||||
struct bd718xx *bd718xx;
|
||||
int ret;
|
||||
|
||||
if (!i2c->irq) {
|
||||
|
|
@ -92,33 +92,33 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
bd71837 = devm_kzalloc(&i2c->dev, sizeof(struct bd71837), GFP_KERNEL);
|
||||
bd718xx = devm_kzalloc(&i2c->dev, sizeof(struct bd718xx), GFP_KERNEL);
|
||||
|
||||
if (!bd71837)
|
||||
if (!bd718xx)
|
||||
return -ENOMEM;
|
||||
|
||||
bd71837->chip_irq = i2c->irq;
|
||||
bd71837->chip_type = (unsigned int)(uintptr_t)
|
||||
bd718xx->chip_irq = i2c->irq;
|
||||
bd718xx->chip_type = (unsigned int)
|
||||
of_device_get_match_data(&i2c->dev);
|
||||
bd71837->dev = &i2c->dev;
|
||||
dev_set_drvdata(&i2c->dev, bd71837);
|
||||
bd718xx->dev = &i2c->dev;
|
||||
dev_set_drvdata(&i2c->dev, bd718xx);
|
||||
|
||||
bd71837->regmap = devm_regmap_init_i2c(i2c, &bd71837_regmap_config);
|
||||
if (IS_ERR(bd71837->regmap)) {
|
||||
bd718xx->regmap = devm_regmap_init_i2c(i2c, &bd718xx_regmap_config);
|
||||
if (IS_ERR(bd718xx->regmap)) {
|
||||
dev_err(&i2c->dev, "regmap initialization failed\n");
|
||||
return PTR_ERR(bd71837->regmap);
|
||||
return PTR_ERR(bd718xx->regmap);
|
||||
}
|
||||
|
||||
ret = devm_regmap_add_irq_chip(&i2c->dev, bd71837->regmap,
|
||||
bd71837->chip_irq, IRQF_ONESHOT, 0,
|
||||
&bd71837_irq_chip, &bd71837->irq_data);
|
||||
ret = devm_regmap_add_irq_chip(&i2c->dev, bd718xx->regmap,
|
||||
bd718xx->chip_irq, IRQF_ONESHOT, 0,
|
||||
&bd718xx_irq_chip, &bd718xx->irq_data);
|
||||
if (ret) {
|
||||
dev_err(&i2c->dev, "Failed to add irq_chip\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Configure short press to 10 milliseconds */
|
||||
ret = regmap_update_bits(bd71837->regmap,
|
||||
ret = regmap_update_bits(bd718xx->regmap,
|
||||
BD718XX_REG_PWRONCONFIG0,
|
||||
BD718XX_PWRBTN_PRESS_DURATION_MASK,
|
||||
BD718XX_PWRBTN_SHORT_PRESS_10MS);
|
||||
|
|
@ -129,7 +129,7 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
|
|||
}
|
||||
|
||||
/* Configure long press to 10 seconds */
|
||||
ret = regmap_update_bits(bd71837->regmap,
|
||||
ret = regmap_update_bits(bd718xx->regmap,
|
||||
BD718XX_REG_PWRONCONFIG1,
|
||||
BD718XX_PWRBTN_PRESS_DURATION_MASK,
|
||||
BD718XX_PWRBTN_LONG_PRESS_10S);
|
||||
|
|
@ -140,7 +140,7 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_irq_get_virq(bd71837->irq_data, BD71837_INT_PWRBTN_S);
|
||||
ret = regmap_irq_get_virq(bd718xx->irq_data, BD718XX_INT_PWRBTN_S);
|
||||
|
||||
if (ret < 0) {
|
||||
dev_err(&i2c->dev, "Failed to get the IRQ\n");
|
||||
|
|
@ -149,17 +149,17 @@ static int bd71837_i2c_probe(struct i2c_client *i2c,
|
|||
|
||||
button.irq = ret;
|
||||
|
||||
ret = devm_mfd_add_devices(bd71837->dev, PLATFORM_DEVID_AUTO,
|
||||
bd71837_mfd_cells,
|
||||
ARRAY_SIZE(bd71837_mfd_cells), NULL, 0,
|
||||
regmap_irq_get_domain(bd71837->irq_data));
|
||||
ret = devm_mfd_add_devices(bd718xx->dev, PLATFORM_DEVID_AUTO,
|
||||
bd718xx_mfd_cells,
|
||||
ARRAY_SIZE(bd718xx_mfd_cells), NULL, 0,
|
||||
regmap_irq_get_domain(bd718xx->irq_data));
|
||||
if (ret)
|
||||
dev_err(&i2c->dev, "Failed to create subdevices\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id bd71837_of_match[] = {
|
||||
static const struct of_device_id bd718xx_of_match[] = {
|
||||
{
|
||||
.compatible = "rohm,bd71837",
|
||||
.data = (void *)BD718XX_TYPE_BD71837,
|
||||
|
|
@ -170,30 +170,30 @@ static const struct of_device_id bd71837_of_match[] = {
|
|||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, bd71837_of_match);
|
||||
MODULE_DEVICE_TABLE(of, bd718xx_of_match);
|
||||
|
||||
static struct i2c_driver bd71837_i2c_driver = {
|
||||
static struct i2c_driver bd718xx_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "rohm-bd718x7",
|
||||
.of_match_table = bd71837_of_match,
|
||||
.of_match_table = bd718xx_of_match,
|
||||
},
|
||||
.probe = bd71837_i2c_probe,
|
||||
.probe = bd718xx_i2c_probe,
|
||||
};
|
||||
|
||||
static int __init bd71837_i2c_init(void)
|
||||
static int __init bd718xx_i2c_init(void)
|
||||
{
|
||||
return i2c_add_driver(&bd71837_i2c_driver);
|
||||
return i2c_add_driver(&bd718xx_i2c_driver);
|
||||
}
|
||||
|
||||
/* Initialise early so consumer devices can complete system boot */
|
||||
subsys_initcall(bd71837_i2c_init);
|
||||
subsys_initcall(bd718xx_i2c_init);
|
||||
|
||||
static void __exit bd71837_i2c_exit(void)
|
||||
static void __exit bd718xx_i2c_exit(void)
|
||||
{
|
||||
i2c_del_driver(&bd71837_i2c_driver);
|
||||
i2c_del_driver(&bd718xx_i2c_driver);
|
||||
}
|
||||
module_exit(bd71837_i2c_exit);
|
||||
module_exit(bd718xx_i2c_exit);
|
||||
|
||||
MODULE_AUTHOR("Matti Vaittinen <[email protected]>");
|
||||
MODULE_DESCRIPTION("ROHM BD71837 Power Management IC driver");
|
||||
MODULE_DESCRIPTION("ROHM BD71837/BD71847 Power Management IC driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
Loading…
Reference in a new issue