diff options
author | Sebastian Reichel <sebastian.reichel@collabora.co.uk> | 2017-08-21 16:54:02 +0200 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2017-08-22 08:44:55 +0100 |
commit | ebf555111bc11a5da9144e4af524260731a8b968 (patch) | |
tree | 8fa27eb5eff22f735789cd3638a8d62277b5b5fe /drivers/mfd | |
parent | 7fe9899ef4e4e6d152a3a54e262cda38e1e1a1d3 (diff) | |
download | linux-ebf555111bc11a5da9144e4af524260731a8b968.tar.gz linux-ebf555111bc11a5da9144e4af524260731a8b968.tar.bz2 linux-ebf555111bc11a5da9144e4af524260731a8b968.zip |
mfd: da9052: Make touchscreen registration optional
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/da9052-core.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index a88c2065d8ab..a23a3a1c7061 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c @@ -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> @@ -519,9 +520,6 @@ static const struct mfd_cell da9052_subdev_info[] = { .name = "da9052-wled3", }, { - .name = "da9052-tsi", - }, - { .name = "da9052-bat", }, { @@ -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, @@ -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; |