@@ -212,6 +212,27 @@ static const struct mfd_cell da9061_devs[] = {
},
};
+static const struct mfd_cell da9061_devs_without_irq[] = {
+ {
+ .name = "da9061-core",
+ },
+ {
+ .name = "da9062-regulators",
+ },
+ {
+ .name = "da9061-watchdog",
+ .of_compatible = "dlg,da9061-watchdog",
+ },
+ {
+ .name = "da9061-thermal",
+ .of_compatible = "dlg,da9061-thermal",
+ },
+ {
+ .name = "da9061-onkey",
+ .of_compatible = "dlg,da9061-onkey",
+ },
+};
+
static const struct resource da9062_core_resources[] = {
DEFINE_RES_NAMED(DA9062_IRQ_VDD_WARN, 1, "VDD_WARN", IORESOURCE_IRQ),
};
@@ -288,6 +309,35 @@ static const struct mfd_cell da9062_devs[] = {
},
};
+static const struct mfd_cell da9062_devs_without_irq[] = {
+ {
+ .name = "da9062-core",
+ },
+ {
+ .name = "da9062-regulators",
+ },
+ {
+ .name = "da9062-watchdog",
+ .of_compatible = "dlg,da9062-watchdog",
+ },
+ {
+ .name = "da9062-thermal",
+ .of_compatible = "dlg,da9062-thermal",
+ },
+ {
+ .name = "da9062-rtc",
+ .of_compatible = "dlg,da9062-rtc",
+ },
+ {
+ .name = "da9062-onkey",
+ .of_compatible = "dlg,da9062-onkey",
+ },
+ {
+ .name = "da9062-gpio",
+ .of_compatible = "dlg,da9062-gpio",
+ },
+};
+
static int da9062_clear_fault_log(struct da9062 *chip)
{
int ret;
@@ -625,7 +675,7 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct da9062 *chip;
- unsigned int irq_base;
+ unsigned int irq_base = 0;
const struct mfd_cell *cell;
const struct regmap_irq_chip *irq_chip;
const struct regmap_config *config;
@@ -645,21 +695,16 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, chip);
chip->dev = &i2c->dev;
- if (!i2c->irq) {
- dev_err(chip->dev, "No IRQ configured\n");
- return -EINVAL;
- }
-
switch (chip->chip_type) {
case COMPAT_TYPE_DA9061:
- cell = da9061_devs;
- cell_num = ARRAY_SIZE(da9061_devs);
+ cell = i2c->irq ? da9061_devs : da9061_devs_without_irq;
+ cell_num = i2c->irq ? ARRAY_SIZE(da9061_devs) : ARRAY_SIZE(da9061_devs_without_irq);
irq_chip = &da9061_irq_chip;
config = &da9061_regmap_config;
break;
case COMPAT_TYPE_DA9062:
- cell = da9062_devs;
- cell_num = ARRAY_SIZE(da9062_devs);
+ cell = i2c->irq ? da9062_devs : da9062_devs_without_irq;
+ cell_num = i2c->irq ? ARRAY_SIZE(da9062_devs) : ARRAY_SIZE(da9062_devs_without_irq);
irq_chip = &da9062_irq_chip;
config = &da9062_regmap_config;
break;
@@ -695,29 +740,32 @@ static int da9062_i2c_probe(struct i2c_client *i2c,
if (ret)
return ret;
- ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
- if (ret < 0) {
- dev_err(chip->dev, "Failed to configure IRQ type\n");
- return ret;
- }
+ if (i2c->irq) {
+ ret = da9062_configure_irq_type(chip, i2c->irq, &trigger_type);
+ if (ret < 0) {
+ dev_err(chip->dev, "Failed to configure IRQ type\n");
+ return ret;
+ }
- ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
- trigger_type | IRQF_SHARED | IRQF_ONESHOT,
- -1, irq_chip, &chip->regmap_irq);
- if (ret) {
- dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
- i2c->irq, ret);
- return ret;
- }
+ ret = regmap_add_irq_chip(chip->regmap, i2c->irq,
+ trigger_type | IRQF_SHARED | IRQF_ONESHOT,
+ -1, irq_chip, &chip->regmap_irq);
+ if (ret) {
+ dev_err(chip->dev, "Failed to request IRQ %d: %d\n",
+ i2c->irq, ret);
+ return ret;
+ }
- irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+ irq_base = regmap_irq_chip_get_base(chip->regmap_irq);
+ }
ret = mfd_add_devices(chip->dev, PLATFORM_DEVID_NONE, cell,
cell_num, NULL, irq_base,
NULL);
if (ret) {
dev_err(chip->dev, "Cannot register child devices\n");
- regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
+ if (i2c->irq)
+ regmap_del_irq_chip(i2c->irq, chip->regmap_irq);
return ret;
}