From patchwork Mon Aug 21 14:54:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 9912975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A9B3600C8 for ; Mon, 21 Aug 2017 14:56:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 657D1285F7 for ; Mon, 21 Aug 2017 14:56:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A240287A0; Mon, 21 Aug 2017 14:56:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AA2C2879D for ; Mon, 21 Aug 2017 14:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbdHUOzN (ORCPT ); Mon, 21 Aug 2017 10:55:13 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40281 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753684AbdHUOyX (ORCPT ); Mon, 21 Aug 2017 10:54:23 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 1A2B12602D0 From: Sebastian Reichel To: Sebastian Reichel , Support Opensource , Lee Jones , Rob Herring , Mark Rutland , Jean Delvare , Guenter Roeck Cc: devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Sebastian Reichel Subject: [RESEND] [PATCHv6 2/4] mfd: da9052: make touchscreen registration optional Date: Mon, 21 Aug 2017 16:54:02 +0200 Message-Id: <20170821145404.18902-3-sebastian.reichel@collabora.co.uk> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170821145404.18902-1-sebastian.reichel@collabora.co.uk> References: <20170821145404.18902-1-sebastian.reichel@collabora.co.uk> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Sebastian Reichel --- 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 #include #include +#include #include #include @@ -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;