Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp894945pxb; Wed, 27 Oct 2021 14:39:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD++Wmg1YsXWT+sMvltQ24jlRRINYkXnEJZV3it75VN0/HEZRBoP7c+LdSHWeaymw+8AdM X-Received: by 2002:a05:6a00:244d:b0:44d:c279:5155 with SMTP id d13-20020a056a00244d00b0044dc2795155mr228983pfj.0.1635370386580; Wed, 27 Oct 2021 14:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635370386; cv=none; d=google.com; s=arc-20160816; b=gszKhYiwXMZNgg5AMyFmnLaPIcO6r7OghKL0PzIVnMJfE2KU2sVSKR+OhWPoo4oAR5 LADfSRuUekVOJeyVNG4w/OetkYAi7qpsMAnh668Xbz/zP3u3i0Mk8+62DVoEtHDqzdoN drAtasbNynpB3DCpjqWu/wRAOBiZaDNv6gkAyQKQwmJ4Rtn9J9veyidk6dpHkWiCRStV ywKDgoZK3Jt/ItbO+gUMLTjiHtv/dkJ4K8Ly5moXUZNUIAc5Uon0uyX/4HJcgDoII/Uq zGBifnIqarL6kSH8OMMiW4pEzUHYQyZls0RtWovnBrf96/IwnRGAszmshilYsu5OERhz eS9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F9VoRTGHjErj+jOxLHtaonK96PkdVidkt+63wc503Tc=; b=qjMldKdtXd14fCWAqjn/sI2MD/CFvQ8bx/8uypnyJgOWZ7iI4xLha2u1tcsdrB/Vs9 ccn6riOoUOkzuuN+/3uaIggwUNUidfHzp8mF/fyWcQ0exH9ORKMMs2n032Iix5two/Jr s6Se/1O/pO2TbDBxsouph4t0uC8IHORARsjG0c55D5u2VjBdmc3bVO0w2CTIesx1jNw4 tmYjwuBJMAU+k95S9g4X/9PdCvz6Y7YCCHH+oLKhqqfqeHr+7TIlCmiY7ex5dXC0YbHo gAiQwvwyd8SGPO2KjDJj6Xeio9ZfJ/9Y4OiiougTmifNuR/nmmbVQMcsd8leoO0cZmsX 9lRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@z3ntu.xyz header.s=z3ntu header.b=mDUy4pwO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=z3ntu.xyz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si88370pgj.430.2021.10.27.14.32.53; Wed, 27 Oct 2021 14:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@z3ntu.xyz header.s=z3ntu header.b=mDUy4pwO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=z3ntu.xyz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238534AbhJ0Sd2 (ORCPT + 97 others); Wed, 27 Oct 2021 14:33:28 -0400 Received: from mail.z3ntu.xyz ([128.199.32.197]:34868 "EHLO mail.z3ntu.xyz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243640AbhJ0Sd1 (ORCPT ); Wed, 27 Oct 2021 14:33:27 -0400 Received: from g550jk.localnet (ip-213-127-63-241.ip.prioritytelecom.net [213.127.63.241]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 5321AC6C79; Wed, 27 Oct 2021 18:30:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=z3ntu.xyz; s=z3ntu; t=1635359459; bh=eqfvrW3djl2rMckCdQ8iCPc9puV62AsaOk6nIabDaM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mDUy4pwOPLA4UjWHEhXHWYIIzEu5yyl263gERf8bRX1nOZXJLZpmh3ZU/DAGZxnLx oUm7MxSRqTe/rtX7VWQrzAZ9RIhwszZXSmqpAE9LK+5Y7rpAfWB6d5cayHAAbI+lXj +rimFcNGwwSj7J2+Pdzww8NBzh/CnXO7eZVeBa8s= From: Luca Weiss To: dmitry.torokhov@gmail.com, ~postmarketos/upstreaming@lists.sr.ht Cc: robh+dt@kernel.org, Michael.Srba@seznam.cz, linus.walleij@linaro.org, broonie@kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Nikita Travkin , Nikita Travkin Subject: Re: [PATCH 3/6] Input: zinitix - Handle proper supply names Date: Wed, 27 Oct 2021 20:30:58 +0200 Message-ID: <5507591.DvuYhMxLoT@g550jk> In-Reply-To: <20211027181350.91630-4-nikita@trvn.ru> References: <20211027181350.91630-1-nikita@trvn.ru> <20211027181350.91630-4-nikita@trvn.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nikita, On Mittwoch, 27. Oktober 2021 20:13:47 CEST Nikita Travkin wrote: > From: Linus Walleij > > The supply names of the Zinitix touchscreen were a bit confused, the new > bindings rectifies this. > > To deal with old and new devicetrees, first check if we have "vddo" and in > case that exists assume the old supply names. Else go and look for the new > ones. > > We cannot just get the regulators since we would get an OK and a dummy > regulator: we need to check explicitly for the old supply name. > > Use struct device *dev as a local variable instead of the I2C client since > the device is what we are actually obtaining the resources from. > > Cc: Mark Brown > Cc: Michael Srba > Cc: phone-devel@vger.kernel.org > Cc: devicetree@vger.kernel.org > Signed-off-by: Linus Walleij > [Slightly changed the legacy regulator detection] > Signed-off-by: Nikita Travkin > --- > This patch was previously submitted here: > https://lore.kernel.org/linux-input/20210625113435.2539282-2-linus.walleij@l > inaro.org/ > > Changes since the original patch: > - Adress the review comments by Dmitry: > Drop explict OF check and use of_find_property() > --- > drivers/input/touchscreen/zinitix.c | 21 ++++++++++++++++----- > 1 file changed, 16 insertions(+), 5 deletions(-) > > diff --git a/drivers/input/touchscreen/zinitix.c > b/drivers/input/touchscreen/zinitix.c index 1e70b8d2a8d7..d4e06a88a883 > 100644 > --- a/drivers/input/touchscreen/zinitix.c > +++ b/drivers/input/touchscreen/zinitix.c > @@ -252,16 +252,27 @@ static int zinitix_init_touch(struct bt541_ts_data > *bt541) > > static int zinitix_init_regulators(struct bt541_ts_data *bt541) > { > - struct i2c_client *client = bt541->client; > + struct device *dev = &bt541->client->dev; > int error; > > - bt541->supplies[0].supply = "vdd"; > - bt541->supplies[1].supply = "vddo"; > - error = devm_regulator_bulk_get(&client->dev, > + /* > + * Some older device trees have erroneous names for the regulators, > + * so check if "vddo" is present and in that case use these names > + * and warn. Else use the proper supply names on the component. > + */ Nitpick, but: "and in that case use these names and warn." I don't see any dev_warn or anything that would 'warn'. If you send a v2 it might be nice to fix that. Regards Luca > + if (of_find_property(dev->of_node, "vddo-supply", NULL)) { > + bt541->supplies[0].supply = "vdd"; > + bt541->supplies[1].supply = "vddo"; > + } else { > + /* Else use the proper supply names */ > + bt541->supplies[0].supply = "vcca"; > + bt541->supplies[1].supply = "vdd"; > + } > + error = devm_regulator_bulk_get(dev, > ARRAY_SIZE(bt541- >supplies), > bt541->supplies); > if (error < 0) { > - dev_err(&client->dev, "Failed to get regulators: %d\n", error); > + dev_err(dev, "Failed to get regulators: %d\n", error); > return error; > }