Lines Matching full:atc260x
3 * Core support for ATC260x PMICs
10 #include <linux/mfd/atc260x/core.h>
123 { .name = "atc260x-regulator" },
124 { .name = "atc260x-pwrc" },
126 .name = "atc260x-onkey",
133 { .name = "atc260x-regulator" },
134 { .name = "atc260x-pwrc" },
136 .name = "atc260x-onkey",
158 static void atc260x_cmu_reset(struct atc260x *atc260x) in atc260x_cmu_reset() argument
160 const struct atc260x_init_regs *regs = atc260x->init_regs; in atc260x_cmu_reset()
163 regmap_update_bits(atc260x->regmap, regs->cmu_devrst, in atc260x_cmu_reset()
167 regmap_update_bits(atc260x->regmap, regs->cmu_devrst, in atc260x_cmu_reset()
171 static void atc260x_dev_init(struct atc260x *atc260x) in atc260x_dev_init() argument
173 const struct atc260x_init_regs *regs = atc260x->init_regs; in atc260x_dev_init()
176 atc260x_cmu_reset(atc260x); in atc260x_dev_init()
179 regmap_write(atc260x->regmap, regs->ints_msk, 0); in atc260x_dev_init()
182 regmap_update_bits(atc260x->regmap, regs->pad_en, in atc260x_dev_init()
187 * atc260x_match_device(): Setup ATC260x variant related fields
189 * @atc260x: ATC260x device to setup (.dev field must be set)
190 * @regmap_cfg: regmap config associated with this ATC260x device
192 * This lets the ATC260x core configure the MFD cells and register maps
195 int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg) in atc260x_match_device() argument
197 struct device *dev = atc260x->dev; in atc260x_match_device()
204 atc260x->ic_type = (unsigned long)of_data; in atc260x_match_device()
206 switch (atc260x->ic_type) { in atc260x_match_device()
209 atc260x->regmap_irq_chip = &atc2603c_regmap_irq_chip; in atc260x_match_device()
210 atc260x->cells = atc2603c_mfd_cells; in atc260x_match_device()
211 atc260x->nr_cells = ARRAY_SIZE(atc2603c_mfd_cells); in atc260x_match_device()
212 atc260x->type_name = "atc2603c"; in atc260x_match_device()
213 atc260x->rev_reg = ATC2603C_CHIP_VER; in atc260x_match_device()
214 atc260x->init_regs = &atc2603c_init_regs; in atc260x_match_device()
218 atc260x->regmap_irq_chip = &atc2609a_regmap_irq_chip; in atc260x_match_device()
219 atc260x->cells = atc2609a_mfd_cells; in atc260x_match_device()
220 atc260x->nr_cells = ARRAY_SIZE(atc2609a_mfd_cells); in atc260x_match_device()
221 atc260x->type_name = "atc2609a"; in atc260x_match_device()
222 atc260x->rev_reg = ATC2609A_CHIP_VER; in atc260x_match_device()
223 atc260x->init_regs = &atc2609a_init_regs; in atc260x_match_device()
226 dev_err(dev, "Unsupported ATC260x device type: %u\n", in atc260x_match_device()
227 atc260x->ic_type); in atc260x_match_device()
231 atc260x->regmap_mutex = devm_kzalloc(dev, sizeof(*atc260x->regmap_mutex), in atc260x_match_device()
233 if (!atc260x->regmap_mutex) in atc260x_match_device()
236 mutex_init(atc260x->regmap_mutex); in atc260x_match_device()
240 regmap_cfg->lock_arg = atc260x->regmap_mutex; in atc260x_match_device()
247 * atc260x_device_probe(): Probe a configured ATC260x device
249 * @atc260x: ATC260x device to probe (must be configured)
251 * This function lets the ATC260x core register the ATC260x MFD devices
252 * and IRQCHIP. The ATC260x device passed in must be fully configured
255 int atc260x_device_probe(struct atc260x *atc260x) in atc260x_device_probe() argument
257 struct device *dev = atc260x->dev; in atc260x_device_probe()
261 if (!atc260x->irq) { in atc260x_device_probe()
267 atc260x_dev_init(atc260x); in atc260x_device_probe()
269 ret = regmap_read(atc260x->regmap, atc260x->rev_reg, &chip_rev); in atc260x_device_probe()
280 atc260x->ic_ver = __ffs(chip_rev + 1U); in atc260x_device_probe()
283 atc260x->type_name, 'A' + atc260x->ic_ver); in atc260x_device_probe()
285 ret = devm_regmap_add_irq_chip(dev, atc260x->regmap, atc260x->irq, IRQF_ONESHOT, in atc260x_device_probe()
286 -1, atc260x->regmap_irq_chip, &atc260x->irq_data); in atc260x_device_probe()
293 atc260x->cells, atc260x->nr_cells, NULL, 0, in atc260x_device_probe()
294 regmap_irq_get_domain(atc260x->irq_data)); in atc260x_device_probe()
297 regmap_del_irq_chip(atc260x->irq, atc260x->irq_data); in atc260x_device_probe()
304 MODULE_DESCRIPTION("ATC260x PMICs Core support");