// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2024 ROHM Semiconductors * * ROHM BD96801 PMIC driver * * This version of the "BD86801 scalable PMIC"'s driver supports only very * basic set of the PMIC features. Most notably, there is no support for * the ERRB interrupt and the configurations which should be done when the * PMIC is in STBY mode. * * Supporting the ERRB interrupt would require dropping the regmap-IRQ * usage or working around (or accepting a presense of) a naming conflict * in debugFS IRQs. * * Being able to reliably do the configurations like changing the * regulator safety limits (like limits for the over/under -voltages, over * current, thermal protection) would require the configuring driver to be * synchronized with entity causing the PMIC state transitions. Eg, one * should be able to ensure the PMIC is in STBY state when the * configurations are applied to the hardware. How and when the PMIC state * transitions are to be done is likely to be very system specific, as will * be the need to configure these safety limits. Hence it's not simple to * come up with a generic solution. * * Users who require the ERRB handling and STBY state configurations can * have a look at the original RFC: * https://lore.kernel.org/all/[email protected]/ * which implements a workaround to debugFS naming conflict and some of * the safety limit configurations - but leaves the state change handling * and synchronization to be implemented. * * It would be great to hear (and receive a patch!) if you implement the * STBY configuration support or a proper fix to the debugFS naming * conflict in your downstream driver ;) */ #include <linux/i2c.h> #include <linux/interrupt.h> #include <linux/mfd/core.h> #include <linux/module.h> #include <linux/property.h> #include <linux/regmap.h> #include <linux/types.h> #include <linux/mfd/rohm-bd96801.h> #include <linux/mfd/rohm-generic.h> static const struct resource regulator_intb_irqs[] = …; static const struct resource wdg_intb_irqs[] = …; static struct mfd_cell bd96801_cells[] = …; static const struct regmap_range bd96801_volatile_ranges[] = …; static const struct regmap_access_table volatile_regs = …; static const struct regmap_irq bd96801_intb_irqs[] = …; static struct regmap_irq_chip bd96801_irq_chip_intb = …; static const struct regmap_config bd96801_regmap_config = …; static int bd96801_i2c_probe(struct i2c_client *i2c) { … } static const struct of_device_id bd96801_of_match[] = …; MODULE_DEVICE_TABLE(of, bd96801_of_match); static struct i2c_driver bd96801_i2c_driver = …; static int __init bd96801_i2c_init(void) { … } /* Initialise early so consumer devices can complete system boot */ subsys_initcall(bd96801_i2c_init); static void __exit bd96801_i2c_exit(void) { … } module_exit(bd96801_i2c_exit); MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;