/* * Using regmap within an atomic context (e.g. accessing a PMIC when * powering system down) is normally allowed only if the regmap type * is MMIO and the regcache type is either REGCACHE_NONE or * REGCACHE_FLAT. For slow buses like I2C and SPI, the regmap is * internally protected by a mutex which is acquired non-atomically. * * Let's improve this by using a customized locking scheme inspired * from I2C atomic transfer. See i2c_in_atomic_xfer_mode() for a * starting point.
*/ if (system_state > SYSTEM_RUNNING && irqs_disabled())
mutex_trylock(mutex); else
mutex_lock(mutex);
}
/* Disable all interrupt sources */
regmap_write(atc260x->regmap, regs->ints_msk, 0);
/* Enable EXTIRQ pad */
regmap_update_bits(atc260x->regmap, regs->pad_en,
regs->pad_en_extirq, regs->pad_en_extirq);
}
/** * atc260x_match_device(): Setup ATC260x variant related fields * * @atc260x: ATC260x device to setup (.dev field must be set) * @regmap_cfg: regmap config associated with this ATC260x device * * This lets the ATC260x core configure the MFD cells and register maps * for later use.
*/ int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg)
{ struct device *dev = atc260x->dev; constvoid *of_data;
of_data = of_device_get_match_data(dev); if (!of_data) return -ENODEV;
/** * atc260x_device_probe(): Probe a configured ATC260x device * * @atc260x: ATC260x device to probe (must be configured) * * This function lets the ATC260x core register the ATC260x MFD devices * and IRQCHIP. The ATC260x device passed in must be fully configured * with atc260x_match_device, its IRQ set, and regmap created.
*/ int atc260x_device_probe(struct atc260x *atc260x)
{ struct device *dev = atc260x->dev; unsignedint chip_rev; int ret;
if (!atc260x->irq) {
dev_err(dev, "No interrupt support\n"); return -EINVAL;
}
/* Initialize the hardware */
atc260x_dev_init(atc260x);
ret = regmap_read(atc260x->regmap, atc260x->rev_reg, &chip_rev); if (ret) {
dev_err(dev, "Failed to get chip revision\n"); return ret;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.