atc260x
ret = regmap_read(onkey->atc260x->regmap,
dev_err(onkey->atc260x->dev,
regmap_update_bits(onkey->atc260x->regmap, onkey->params->reg_int_ctl,
ret = regmap_update_bits(onkey->atc260x->regmap,
dev_err(onkey->atc260x->dev,
struct atc260x *atc260x = dev_get_drvdata(pdev->dev.parent);
switch (atc260x->ic_type) {
atc260x->ic_type);
onkey->atc260x = atc260x;
struct atc260x *atc260x;
return regmap_update_bits(onkey->atc260x->regmap,
static void atc260x_cmu_reset(struct atc260x *atc260x)
const struct atc260x_init_regs *regs = atc260x->init_regs;
regmap_update_bits(atc260x->regmap, regs->cmu_devrst,
regmap_update_bits(atc260x->regmap, regs->cmu_devrst,
static void atc260x_dev_init(struct atc260x *atc260x)
const struct atc260x_init_regs *regs = atc260x->init_regs;
atc260x_cmu_reset(atc260x);
regmap_write(atc260x->regmap, regs->ints_msk, 0);
regmap_update_bits(atc260x->regmap, regs->pad_en,
int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg)
struct device *dev = atc260x->dev;
atc260x->ic_type = (unsigned long)of_data;
switch (atc260x->ic_type) {
atc260x->regmap_irq_chip = &atc2603c_regmap_irq_chip;
atc260x->cells = atc2603c_mfd_cells;
atc260x->nr_cells = ARRAY_SIZE(atc2603c_mfd_cells);
atc260x->type_name = "atc2603c";
atc260x->rev_reg = ATC2603C_CHIP_VER;
atc260x->init_regs = &atc2603c_init_regs;
atc260x->regmap_irq_chip = &atc2609a_regmap_irq_chip;
atc260x->cells = atc2609a_mfd_cells;
atc260x->nr_cells = ARRAY_SIZE(atc2609a_mfd_cells);
atc260x->type_name = "atc2609a";
atc260x->rev_reg = ATC2609A_CHIP_VER;
atc260x->init_regs = &atc2609a_init_regs;
atc260x->ic_type);
atc260x->regmap_mutex = devm_kzalloc(dev, sizeof(*atc260x->regmap_mutex),
if (!atc260x->regmap_mutex)
mutex_init(atc260x->regmap_mutex);
regmap_cfg->lock_arg = atc260x->regmap_mutex;
int atc260x_device_probe(struct atc260x *atc260x)
struct device *dev = atc260x->dev;
if (!atc260x->irq) {
atc260x_dev_init(atc260x);
ret = regmap_read(atc260x->regmap, atc260x->rev_reg, &chip_rev);
atc260x->ic_ver = __ffs(chip_rev + 1U);
atc260x->type_name, 'A' + atc260x->ic_ver);
ret = devm_regmap_add_irq_chip(dev, atc260x->regmap, atc260x->irq, IRQF_ONESHOT,
-1, atc260x->regmap_irq_chip, &atc260x->irq_data);
atc260x->cells, atc260x->nr_cells, NULL, 0,
regmap_irq_get_domain(atc260x->irq_data));
regmap_del_irq_chip(atc260x->irq, atc260x->irq_data);
struct atc260x *atc260x;
atc260x = devm_kzalloc(&client->dev, sizeof(*atc260x), GFP_KERNEL);
if (!atc260x)
atc260x->dev = &client->dev;
atc260x->irq = client->irq;
ret = atc260x_match_device(atc260x, ®map_cfg);
i2c_set_clientdata(client, atc260x);
atc260x->regmap = devm_regmap_init_i2c(client, ®map_cfg);
if (IS_ERR(atc260x->regmap)) {
ret = PTR_ERR(atc260x->regmap);
return atc260x_device_probe(atc260x);
struct atc260x *atc260x = dev_get_drvdata(pdev->dev.parent);
priv->regmap = atc260x->regmap;
switch (atc260x->ic_type) {
atc260x->ic_type);
struct atc260x *atc260x = dev_get_drvdata(pdev->dev.parent);
struct device *dev = atc260x->dev;
switch (atc260x->ic_type) {
atc2603c_ver_b = atc260x->ic_ver == ATC260X_B;
dev_err(dev, "unsupported ATC260X ID %d\n", atc260x->ic_type);
config.regmap = atc260x->regmap;
int atc260x_match_device(struct atc260x *atc260x, struct regmap_config *regmap_cfg);
int atc260x_device_probe(struct atc260x *atc260x);