All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
To: Sebastian Reichel <sre@kernel.org>,
	Support Opensource <support.opensource@diasemi.com>,
	Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>
Cc: devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Subject: [RESEND] [PATCHv6 2/4] mfd: da9052: make touchscreen registration optional
Date: Mon, 21 Aug 2017 16:54:02 +0200	[thread overview]
Message-ID: <20170821145404.18902-3-sebastian.reichel@collabora.co.uk> (raw)
In-Reply-To: <20170821145404.18902-1-sebastian.reichel@collabora.co.uk>

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.

Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
---
 drivers/mfd/da9052-core.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index 977418ca9117..433add43a0a9 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>
@@ -520,9 +521,6 @@ static const struct mfd_cell da9052_subdev_info[] = {
 	{
 		.name = "da9052-wled3",
 	},
-	{
-		.name = "da9052-tsi",
-	},
 	{
 		.name = "da9052-bat",
 	},
@@ -531,6 +529,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,
@@ -621,9 +623,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;
-- 
2.14.1


  parent reply	other threads:[~2017-08-21 14:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 14:54 [RESEND] [PATCHv6 0/4] DA9052 hardware monitoring improvements Sebastian Reichel
2017-08-21 14:54 ` [RESEND] [PATCHv6 1/4] mfd: da9052: add register details for TSI Sebastian Reichel
2017-08-22  7:46   ` Lee Jones
2017-08-22  7:46     ` Lee Jones
2017-08-21 14:54 ` Sebastian Reichel [this message]
2017-08-22  7:46   ` [RESEND] [PATCHv6 2/4] mfd: da9052: make touchscreen registration optional Lee Jones
2017-08-21 14:54 ` [RESEND] [PATCHv6 3/4] hwmon: da9052: replace S_IRUGO with 0444 Sebastian Reichel
2017-08-22  7:46   ` Lee Jones
2017-08-21 14:54 ` [RESEND] [PATCHv6 4/4] hwmon: da9052: add support for TSI channel Sebastian Reichel
2017-08-22  7:47   ` Lee Jones
2017-08-22  7:47 ` [GIT PULL] Immutable branch between MFD and HWMON due for the v4.14 merge window Lee Jones
2017-08-29 12:51   ` Sebastian Reichel
2017-08-29 12:51     ` Sebastian Reichel
2017-08-29 13:34     ` Guenter Roeck
2017-08-29 14:19       ` Sebastian Reichel
2017-08-30  2:06         ` Guenter Roeck
2017-08-30  2:06           ` Guenter Roeck
2017-09-04  7:54           ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170821145404.18902-3-sebastian.reichel@collabora.co.uk \
    --to=sebastian.reichel@collabora.co.uk \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=support.opensource@diasemi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.