From patchwork Sat May 7 04:40:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 67309 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp637291qge; Fri, 6 May 2016 21:40:50 -0700 (PDT) X-Received: by 10.66.222.3 with SMTP id qi3mr33671701pac.24.1462596050665; Fri, 06 May 2016 21:40:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si22593447paz.87.2016.05.06.21.40.50; Fri, 06 May 2016 21:40:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbcEGEkc (ORCPT + 7 others); Sat, 7 May 2016 00:40:32 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36012 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbcEGEkO (ORCPT ); Sat, 7 May 2016 00:40:14 -0400 Received: by mail-pa0-f47.google.com with SMTP id bt5so53446454pac.3 for ; Fri, 06 May 2016 21:40:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LzQj0HGSZ3kSEZma3IIShq8cjhuacoRFdLRLpf9D1M0=; b=H0LmawlG5PQ0IIzzSXg+YHeEXqZ10hR2wZTwC9MI79eeLQoRW3ssG9x5dhSyTXzESk sIYks4frQVMAQjWPT2Hic5gDf4jURizA/8gE3glQzpFGrLg0Uabqk01foQ9eHcgmIWYw XqXlyR5PpsL4dy0YiZnUSaJU3KEnixVcsbI5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LzQj0HGSZ3kSEZma3IIShq8cjhuacoRFdLRLpf9D1M0=; b=PDarZ86Brtm31VVisx2oG0LAJTqyV9rDkmMgg2T6azAU/EPhjj6NrzEz1AUtE67lDJ DFq9SZ7W9BnlrYa6hMisYo4G/hKFbPKi6wiTEymDiI/rPgh/2Dgin4liJwxhMPDhPDgk WD9udTdsmCJKfpQ8APm8s4HsTWCRccvnP6SAIWW1aNgxAGevzVxPoaGAK79VkG42eb8K vmHV5Bs7uoBMPcAlf/NHo+l75jkco0KjfDWv54ZqGWk22U4uFeYnkHu3cKqAWCNKJ4xH eX6X/uagvEs9hUtAp6YPR7b2iJRZFTAWQHaSrB7gt5gg6C9UY9SWRedFktlnTMU4Tmto 7xDA== X-Gm-Message-State: AOPr4FXbM+mKoa5yqzbiQgFgKPjlV1jveTTHqZKPbA22YtAvrJjXKELI+mGdLZRAYAODjKLd X-Received: by 10.66.132.72 with SMTP id os8mr33937142pab.63.1462596013501; Fri, 06 May 2016 21:40:13 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id k78sm24443222pfk.70.2016.05.06.21.40.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 May 2016 21:40:12 -0700 (PDT) From: Bjorn Andersson To: Dmitry Torokhov , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Andrew Duggan , Christopher Heiny Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] input: rmi4: Acquire and enable VDD and VIO supplies Date: Fri, 6 May 2016 21:40:07 -0700 Message-Id: <1462596008-21381-3-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1462596008-21381-1-git-send-email-bjorn.andersson@linaro.org> References: <1462596008-21381-1-git-send-email-bjorn.andersson@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org For systems where the rmi4 device is not powered by always-on regulators we need to acquire handles to VDD and VIO and enable these. Signed-off-by: Bjorn Andersson --- Changes since v1: - Added patch 1 and 3 - Moved regulator handling to the core driver .../devicetree/bindings/input/rmi4/rmi_i2c.txt | 6 ++++++ .../devicetree/bindings/input/rmi4/rmi_spi.txt | 6 ++++++ drivers/input/rmi4/rmi_driver.c | 20 ++++++++++++++++++++ include/linux/rmi.h | 4 +++- 4 files changed, 35 insertions(+), 1 deletion(-) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt b/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt index 95fa715c6046..29aedd05cb81 100644 --- a/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt +++ b/Documentation/devicetree/bindings/input/rmi4/rmi_i2c.txt @@ -22,6 +22,12 @@ See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt - syna,reset-delay-ms: The number of milliseconds to wait after resetting the device. +- vdd-supply: VDD power supply. +See Documentation/devicetree/bindings/regulator/regulator.txt + +- vio-supply: VIO power supply +See Documentation/devicetree/bindings/regulator/regulator.txt + Function Parameters: Parameters specific to RMI functions are contained in child nodes of the rmi device node. Documentation for the parameters of each function can be found in: diff --git a/Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt b/Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt index a4ca7828f21d..71388bac4bc7 100644 --- a/Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt +++ b/Documentation/devicetree/bindings/input/rmi4/rmi_spi.txt @@ -22,6 +22,12 @@ See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt - spi-rx-delay-us: microsecond delay after a read transfer. - spi-tx-delay-us: microsecond delay after a write transfer. +- vdd-supply: VDD power supply. +See Documentation/devicetree/bindings/regulator/regulator.txt + +- vio-supply: VIO power supply +See Documentation/devicetree/bindings/regulator/regulator.txt + Function Parameters: Parameters specific to RMI functions are contained in child nodes of the rmi device node. Documentation for the parameters of each function can be found in: diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c index 48c7991c9898..7e73539719cb 100644 --- a/drivers/input/rmi4/rmi_driver.c +++ b/drivers/input/rmi4/rmi_driver.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "rmi_bus.h" #include "rmi_driver.h" @@ -875,6 +876,9 @@ static int rmi_driver_remove(struct device *dev) rmi_free_function_list(rmi_dev); + regulator_bulk_disable(ARRAY_SIZE(rmi_dev->supplies), + rmi_dev->supplies); + return 0; } @@ -938,6 +942,22 @@ static int rmi_driver_probe(struct device *dev) data->rmi_dev = rmi_dev; dev_set_drvdata(&rmi_dev->dev, data); + rmi_dev->supplies[0].supply = "vdd"; + rmi_dev->supplies[1].supply = "vio"; + retval = devm_regulator_bulk_get(rmi_dev->xport->dev, + ARRAY_SIZE(rmi_dev->supplies), + rmi_dev->supplies); + if (retval < 0) + return retval; + + retval = regulator_bulk_enable(ARRAY_SIZE(rmi_dev->supplies), + rmi_dev->supplies); + if (retval < 0) + return retval; + + /* Allow the firmware to get ready */ + msleep(10); + /* * Right before a warm boot, the sensor might be in some unusual state, * such as F54 diagnostics, or F34 bootloader mode after a firmware diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 5944e6c2470d..38ff4c1d31d4 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -16,6 +16,7 @@ #include #include #include +#include #define NAME_BUFFER_SIZE 256 @@ -315,7 +316,7 @@ struct rmi_driver { * @number: Unique number for the device on the bus. * @driver: Pointer to associated driver * @xport: Pointer to the transport interface - * + * @supplies: vdd and vdio regulator supplies */ struct rmi_device { struct device dev; @@ -324,6 +325,7 @@ struct rmi_device { struct rmi_driver *driver; struct rmi_transport_dev *xport; + struct regulator_bulk_data supplies[2]; }; struct rmi_driver_data {