Skip to content

Commit

Permalink
mfd: da9052: Make touchscreen registration optional
Browse files Browse the repository at this point in the history
If the touchscreen pins are used as general purpose analogue
input, the touchscreen driver should not be used. The pins
will be handled by the existing hwmon driver instead.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
sre authored and Lee Jones committed Aug 22, 2017
1 parent 7fe9899 commit ebf5551
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions drivers/mfd/da9052-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/mfd/core.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/property.h>

#include <linux/mfd/da9052/da9052.h>
#include <linux/mfd/da9052/pdata.h>
Expand Down Expand Up @@ -518,9 +519,6 @@ static const struct mfd_cell da9052_subdev_info[] = {
{
.name = "da9052-wled3",
},
{
.name = "da9052-tsi",
},
{
.name = "da9052-bat",
},
Expand All @@ -529,6 +527,10 @@ static const struct mfd_cell da9052_subdev_info[] = {
},
};

static const struct mfd_cell da9052_tsi_subdev_info[] = {
{ .name = "da9052-tsi" },
};

const struct regmap_config da9052_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
Expand Down Expand Up @@ -619,9 +621,27 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id)
goto err;
}

/*
* Check if touchscreen pins are used are analogue input instead
* of having a touchscreen connected to them. The analogue input
* functionality will be provided by hwmon driver (if enabled).
*/
if (!device_property_read_bool(da9052->dev, "dlg,tsi-as-adc")) {
ret = mfd_add_devices(da9052->dev, PLATFORM_DEVID_AUTO,
da9052_tsi_subdev_info,
ARRAY_SIZE(da9052_tsi_subdev_info),
NULL, 0, NULL);
if (ret) {
dev_err(da9052->dev, "failed to add TSI subdev: %d\n",
ret);
goto err;
}
}

return 0;

err:
mfd_remove_devices(da9052->dev);
da9052_irq_exit(da9052);

return ret;
Expand Down

0 comments on commit ebf5551

Please sign in to comment.