From patchwork Thu May 31 20:42:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10441949 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 2AD13602BC for ; Thu, 31 May 2018 20:42:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18DCE291D2 for ; Thu, 31 May 2018 20:42:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ADF7291E4; Thu, 31 May 2018 20:42:56 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham 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 8877B291D2 for ; Thu, 31 May 2018 20:42:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754461AbeEaUmy (ORCPT ); Thu, 31 May 2018 16:42:54 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:42730 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754379AbeEaUmx (ORCPT ); Thu, 31 May 2018 16:42:53 -0400 Received: by mail-pl0-f67.google.com with SMTP id u6-v6so13916688pls.9 for ; Thu, 31 May 2018 13:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=8lELRfsVVs6Lax8PGlyUr7WZ1BCFTcHS3mq3j2B406g=; b=hsfMKbdc24YSmGhGKpBh518v0QNCi0cJMlKNjH9hxmwRG2a/xyAuARrWL/7QXD4dVZ B9Du+inhQq+F39hNTq55PHh3LIPvW6ps0a0/YPgDvqAj+8mFChBS5EVLp3cWm6sZcHa6 6NoirZNOZg3l/AIXa0ARosZdtF+A46/6kTxpU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8lELRfsVVs6Lax8PGlyUr7WZ1BCFTcHS3mq3j2B406g=; b=eDn5MtzDNE14DvhrX9BxQlYdxKxl0CnkR0BtI5u71gSXbC8HpqVrfpVftKQCso5Loz X6b3wZGRkwBUUUP7bpYVFpIXJQTUXzPoIFc1TAsXil1/UiqxX5dUVGW1NHdSNioQYnaP 0c6teMeVMYAf/x+kxtsDMYKrVfgrXvgSw1NSfvnm/uAX4dOfrd3KptVp4+5sGh8xgYMA g4nA4FFEMRhRfyAKU+qK+L3TE8cAZgMVEPAEdN2IzGMtN4SGY1SVEY2D225rKHLnnE5+ p0Od8yIz95EiSS/TVVPfGchR+8Nsfn01nOelY3wVT2PFY+h7Fx9iq1uZMupKNvoboeA+ RjyQ== X-Gm-Message-State: ALKqPwdWRLJZYSV5kKYvvFeO8tvy7dF8LbDvDKiGi6izS6aQrbyN1PRh uPEhzaAhFHtMFIR5G2CSFbI39w== X-Google-Smtp-Source: ADUXVKJYUPKvpexKMe5lPKFxnThPSuwKbrtr/wPSnL1LdTkOc4g+NvNcDeRJg6qOa+4S7rYGhAbh5g== X-Received: by 2002:a17:902:2006:: with SMTP id n6-v6mr8478839pla.125.1527799373118; Thu, 31 May 2018 13:42:53 -0700 (PDT) Received: from swboyd.mtv.corp.google.com ([2620:0:1000:1511:d30e:62c6:f82c:ff40]) by smtp.gmail.com with ESMTPSA id t67-v6sm8352814pfg.51.2018.05.31.13.42.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 13:42:52 -0700 (PDT) From: Stephen Boyd To: Jiri Kosina Cc: linux-input@vger.kernel.org, Benjamin Tissoires , Hans de Goede , Andy Shevchenko , Dmitry Torokhov , Doug Anderson , devicetree@vger.kernel.org Subject: [PATCH] HID: i2c-hid: Add vddl regulator control Date: Thu, 31 May 2018 13:42:50 -0700 Message-Id: <20180531204250.209216-1-swboyd@chromium.org> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog 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 Some wacom w9013 devices have a vddl supply for "low voltage" requirements. Add support in this driver to turn on this low voltage supply. Cc: Benjamin Tissoires Cc: Hans de Goede Cc: Andy Shevchenko Cc: Dmitry Torokhov Cc: Doug Anderson Cc: Signed-off-by: Stephen Boyd Acked-by: Rob Herring --- .../bindings/input/hid-over-i2c.txt | 3 ++- drivers/hid/i2c-hid/i2c-hid.c | 19 +++++++++++++++++++ include/linux/platform_data/i2c-hid.h | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/hid-over-i2c.txt b/Documentation/devicetree/bindings/input/hid-over-i2c.txt index 4d3da9d91de4..89e6ab89ba38 100644 --- a/Documentation/devicetree/bindings/input/hid-over-i2c.txt +++ b/Documentation/devicetree/bindings/input/hid-over-i2c.txt @@ -26,7 +26,8 @@ device-specific compatible properties, which should be used in addition to the - compatible: * "wacom,w9013" (Wacom W9013 digitizer). Supports: - - vdd-supply + - vdd-supply (3.3V) + - vddl-supply (1.8V) - post-power-on-delay-ms - vdd-supply: phandle of the regulator that provides the supply voltage. diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index 6e803f361249..b6f02f98fec6 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c @@ -1032,12 +1032,29 @@ static int i2c_hid_probe(struct i2c_client *client, goto err; } + ihid->pdata.supply_l = devm_regulator_get(&client->dev, "vddl"); + if (IS_ERR(ihid->pdata.supply_l)) { + ret = PTR_ERR(ihid->pdata.supply_l); + if (ret != -EPROBE_DEFER) + dev_err(&client->dev, "Failed to get regulator: %d\n", + ret); + goto err; + } + ret = regulator_enable(ihid->pdata.supply); if (ret < 0) { dev_err(&client->dev, "Failed to enable regulator: %d\n", ret); goto err; } + + ret = regulator_enable(ihid->pdata.supply_l); + if (ret < 0) { + dev_err(&client->dev, "Failed to enable low regulator: %d\n", + ret); + goto err_regulator_l; + } + if (ihid->pdata.post_power_delay_ms) msleep(ihid->pdata.post_power_delay_ms); @@ -1124,6 +1141,8 @@ static int i2c_hid_probe(struct i2c_client *client, pm_runtime_disable(&client->dev); err_regulator: + regulator_disable(ihid->pdata.supply_l); +err_regulator_l: regulator_disable(ihid->pdata.supply); err: diff --git a/include/linux/platform_data/i2c-hid.h b/include/linux/platform_data/i2c-hid.h index 1fb088239d12..1e4612751adf 100644 --- a/include/linux/platform_data/i2c-hid.h +++ b/include/linux/platform_data/i2c-hid.h @@ -20,6 +20,7 @@ struct regulator; * struct i2chid_platform_data - used by hid over i2c implementation. * @hid_descriptor_address: i2c register where the HID descriptor is stored. * @supply: regulator for powering on the device. + * @supply_l: regulator for powering on the low voltage supply for device. * @post_power_delay_ms: delay after powering on before device is usable. * * Note that it is the responsibility of the platform driver (or the acpi 5.0 @@ -36,6 +37,7 @@ struct regulator; struct i2c_hid_platform_data { u16 hid_descriptor_address; struct regulator *supply; + struct regulator *supply_l; int post_power_delay_ms; };