Lines Matching full:atc260x
3 * Core support for ATC260x PMICs
10 #include <linux/mfd/atc260x/core.h>
126 { .name = "atc260x-regulator" },
127 { .name = "atc260x-pwrc" },
129 .name = "atc260x-onkey",
136 { .name = "atc260x-regulator" },
137 { .name = "atc260x-pwrc" },
139 .name = "atc260x-onkey",
161 static void atc260x_cmu_reset(struct atc260x *atc260x) in atc260x_cmu_reset() argument
163 const struct atc260x_init_regs *regs = atc260x->init_regs; in atc260x_cmu_reset()
166 regmap_update_bits(atc260x->regmap, regs->cmu_devrst, in atc260x_cmu_reset()
170 regmap_update_bits(atc260x->regmap, regs->cmu_devrst, in atc260x_cmu_reset()
174 static void atc260x_dev_init(struct atc260x *atc260x) in atc260x_dev_init() argument
176 const struct atc260x_init_regs *regs = atc260x->init_regs; in atc260x_dev_init()
179 atc260x_cmu_reset(atc260x); in atc260x_dev_init()
182 regmap_write(atc260x->regmap, regs->ints_msk, 0); in atc260x_dev_init()
185 regmap_update_bits(atc260x->regmap, regs->pad_en, in atc260x_dev_init()
190 * atc260x_match_device(): Setup ATC260x variant related fields
192 * @atc260x: ATC260x device to setup (.dev field must be set)
193 * @regmap_cfg: regmap config associated with this ATC260x device
195 * This lets the ATC260x core configure the MFD cells and register maps
198 int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg) in atc260x_match_device() argument
200 struct device *dev = atc260x->dev; in atc260x_match_device()
207 atc260x->ic_type = (unsigned long)of_data; in atc260x_match_device()
209 switch (atc260x->ic_type) { in atc260x_match_device()
212 atc260x->regmap_irq_chip = &atc2603c_regmap_irq_chip; in atc260x_match_device()
213 atc260x->cells = atc2603c_mfd_cells; in atc260x_match_device()
214 atc260x->nr_cells = ARRAY_SIZE(atc2603c_mfd_cells); in atc260x_match_device()
215 atc260x->type_name = "atc2603c"; in atc260x_match_device()
216 atc260x->rev_reg = ATC2603C_CHIP_VER; in atc260x_match_device()
217 atc260x->init_regs = &atc2603c_init_regs; in atc260x_match_device()
221 atc260x->regmap_irq_chip = &atc2609a_regmap_irq_chip; in atc260x_match_device()
222 atc260x->cells = atc2609a_mfd_cells; in atc260x_match_device()
223 atc260x->nr_cells = ARRAY_SIZE(atc2609a_mfd_cells); in atc260x_match_device()
224 atc260x->type_name = "atc2609a"; in atc260x_match_device()
225 atc260x->rev_reg = ATC2609A_CHIP_VER; in atc260x_match_device()
226 atc260x->init_regs = &atc2609a_init_regs; in atc260x_match_device()
229 dev_err(dev, "Unsupported ATC260x device type: %u\n", in atc260x_match_device()
230 atc260x->ic_type); in atc260x_match_device()
234 atc260x->regmap_mutex = devm_kzalloc(dev, sizeof(*atc260x->regmap_mutex), in atc260x_match_device()
236 if (!atc260x->regmap_mutex) in atc260x_match_device()
239 mutex_init(atc260x->regmap_mutex); in atc260x_match_device()
243 regmap_cfg->lock_arg = atc260x->regmap_mutex; in atc260x_match_device()
250 * atc260x_device_probe(): Probe a configured ATC260x device
252 * @atc260x: ATC260x device to probe (must be configured)
254 * This function lets the ATC260x core register the ATC260x MFD devices
255 * and IRQCHIP. The ATC260x device passed in must be fully configured
258 int atc260x_device_probe(struct atc260x *atc260x) in atc260x_device_probe() argument
260 struct device *dev = atc260x->dev; in atc260x_device_probe()
264 if (!atc260x->irq) { in atc260x_device_probe()
270 atc260x_dev_init(atc260x); in atc260x_device_probe()
272 ret = regmap_read(atc260x->regmap, atc260x->rev_reg, &chip_rev); in atc260x_device_probe()
283 atc260x->ic_ver = __ffs(chip_rev + 1U); in atc260x_device_probe()
286 atc260x->type_name, 'A' + atc260x->ic_ver); in atc260x_device_probe()
288 ret = devm_regmap_add_irq_chip(dev, atc260x->regmap, atc260x->irq, IRQF_ONESHOT, in atc260x_device_probe()
289 -1, atc260x->regmap_irq_chip, &atc260x->irq_data); in atc260x_device_probe()
296 atc260x->cells, atc260x->nr_cells, NULL, 0, in atc260x_device_probe()
297 regmap_irq_get_domain(atc260x->irq_data)); in atc260x_device_probe()
300 regmap_del_irq_chip(atc260x->irq, atc260x->irq_data); in atc260x_device_probe()
307 MODULE_DESCRIPTION("ATC260x PMICs Core support");