From patchwork Tue Feb 7 02:48:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13130907 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 378F2C636D6 for ; Tue, 7 Feb 2023 02:49:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbjBGCta (ORCPT ); Mon, 6 Feb 2023 21:49:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjBGCtY (ORCPT ); Mon, 6 Feb 2023 21:49:24 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5648836456 for ; Mon, 6 Feb 2023 18:48:56 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id u9so9988380plf.3 for ; Mon, 06 Feb 2023 18:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mHOxy0yjbuzT3CsBPRlqzRmrlyQ1Ah6MquxggTwVj5Y=; b=a5aCRZAFkj1OvRq3aqzQYp5C/iomdSqyPvH0qs3MIsi9GhYOKB1JCv8ovy4qRDbgFV PGEk4cw3cimKms0el816jGpQXBeI6qKZVKnPCX5ZatMXnvu9gpulLU3CUulpZZE8fwPd Yr1iSkY2FUYdtvnLvlTM1qr4Al/kx3d7Nj2z0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mHOxy0yjbuzT3CsBPRlqzRmrlyQ1Ah6MquxggTwVj5Y=; b=JmytdEvyRwBxk+CC2tWLgB1Bhg/b9iG4wx7+ZZmngyfnshwODcXOi8HhpE/KfW18Mh BlrN/swvLjpFQxpVpfS5hkuHp21CddICa6rbw4DAblMrcanb2q/+toeaD1KzLtLtD6R1 xvOF7o9Lewg95juM70K5PzCGEmCgEqhnvFUuvHtiZXbKI++QUqTEv8ZTV5SKI8BN5Xrc fapQVqmmOujLkdSlVuUkKGvyiflT2/aWm5GZz4CpK3j8SYUduynb0Vs2I9fg6NbxDcSP vRkcV1mKnNuaVL3KNa2vaoJp87is5djz+j51oqXuNJN3NKg65gKsHWFh45BLqVsYmg5d NNuA== X-Gm-Message-State: AO0yUKUx8y8HqoDkIXJJ890dnD4LeyMxsmllPpI141NEbpFpa84mrWew IBVzAfYfvvOx6dN2eK4UgWIIVg== X-Google-Smtp-Source: AK7set+8Sx7+L05dQMtdW2yFX45Ga3BJe5QCG6gLFIc5l5Bhsxug8kSss0eC4tBn0Yh5xUGdwZeSpA== X-Received: by 2002:a17:902:dac6:b0:196:59a0:bffe with SMTP id q6-20020a170902dac600b0019659a0bffemr1485572plx.17.1675738135842; Mon, 06 Feb 2023 18:48:55 -0800 (PST) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:29fb:a635:f0df:f45a]) by smtp.gmail.com with ESMTPSA id s17-20020a63a311000000b0045dc85c4a5fsm6882430pge.44.2023.02.06.18.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 18:48:55 -0800 (PST) From: Douglas Anderson To: Bjorn Andersson , Rob Herring , Krzysztof Kozlowski , Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, linux-arm-msm@vger.kernel.org, Dmitry Torokhov , devicetree@vger.kernel.org, Stephen Kitt , Konrad Dybcio , Douglas Anderson , linux-kernel@vger.kernel.org Subject: [PATCH 6/7] HID: i2c-hid: goodix: Add mainboard-vddio-supply Date: Mon, 6 Feb 2023 18:48:15 -0800 Message-Id: <20230206184744.6.Ic234b931025d1f920ce9e06fff294643943a65ad@changeid> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog In-Reply-To: <20230207024816.525938-1-dianders@chromium.org> References: <20230207024816.525938-1-dianders@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org As talked about in the patch ("dt-bindings: HID: i2c-hid: goodix: Add mainboard-vddio-supply") we may need to power up a 1.8V rail on the host associated with touchscreen IO. Let's add support in the driver for it. Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Torokhov Reviewed-by: Matthias Kaehlcke --- Unfortunately, I haven't been able to actually test this on real hardware yet. However, the change is very simple, I believe it is correct, and it doesn't break other boards I've tested it on. drivers/hid/i2c-hid/i2c-hid-of-goodix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c index 584d833dc0aa..0060e3dcd775 100644 --- a/drivers/hid/i2c-hid/i2c-hid-of-goodix.c +++ b/drivers/hid/i2c-hid/i2c-hid-of-goodix.c @@ -26,6 +26,7 @@ struct i2c_hid_of_goodix { struct i2chid_ops ops; struct regulator *vdd; + struct regulator *vddio; struct gpio_desc *reset_gpio; const struct goodix_i2c_hid_timing_data *timings; }; @@ -40,6 +41,10 @@ static int goodix_i2c_hid_power_up(struct i2chid_ops *ops) if (ret) return ret; + ret = regulator_enable(ihid_goodix->vddio); + if (ret) + return ret; + if (ihid_goodix->timings->post_power_delay_ms) msleep(ihid_goodix->timings->post_power_delay_ms); @@ -56,6 +61,7 @@ static void goodix_i2c_hid_power_down(struct i2chid_ops *ops) container_of(ops, struct i2c_hid_of_goodix, ops); gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1); + regulator_disable(ihid_goodix->vddio); regulator_disable(ihid_goodix->vdd); } @@ -81,6 +87,10 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client) if (IS_ERR(ihid_goodix->vdd)) return PTR_ERR(ihid_goodix->vdd); + ihid_goodix->vddio = devm_regulator_get(&client->dev, "mainboard-vddio"); + if (IS_ERR(ihid_goodix->vddio)) + return PTR_ERR(ihid_goodix->vddio); + ihid_goodix->timings = device_get_match_data(&client->dev); return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0);