Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp57366lfe; Fri, 15 Apr 2022 19:20:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpsukZTKcq7FX+JA0B/eVWkACuWONMOlkIg2tliRgCMtxfX6RNnlt94BhQUx5K5U7SyVaN X-Received: by 2002:a17:902:ce06:b0:156:8118:9e9a with SMTP id k6-20020a170902ce0600b0015681189e9amr1768744plg.169.1650075615731; Fri, 15 Apr 2022 19:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650075615; cv=none; d=google.com; s=arc-20160816; b=Oqo2q/dObfnnV7eB20+jpiC14F8YRs9IyHqWlk+IudiEnhbu/aQW8kFNuAJmm4mA8Z ric0xdyymBhbBwiX2xLQSpzwdh4HZ7OB44hqS3a3JnUdYiQ7jWY3L4lach/OlWgx6an1 hy+hxSKzGoz0rXgmFcf80MbSr30CA8AsD5ZHrnERo51+XtR9TriTLk6vrOtPplAq3joj fHplYSj6QNDGbOMB4qnlpPbM5MNfTciZFfozNl0sLaL6DTz/mvfpYRJ1GQi9NrmWlB3m z+QLB6r0LLDNsADf2BtSuOCGUXoBUhsQP1h+Hcl18z/EUM+nb/R41XDpxs7p3gYtmXgS /HDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ufxYIOwf0J693O+/j0nztdscn7O3zFr17OcsXCTFd2A=; b=02FvX7I5bpcsrgbW1La2S1RIuO9ytEyodmJzWmop1fpgvGIX0C39WgVxyysSO5qFtl f8yAPmBPFwmcfvculLMV4MswNjOw/WOIKMNpL8zen/UAsjUvYvCmVxt/+JAdsQJTqPni lVMi1rRKFSnzTVh5lzPBksIKntxK1zf+WsIRiBclrsSJIFjflr29FzNHqO9hNqjKEMKp DomuALjmAX/vVwA/R4Fq93b6D7ZSXExhT53fvdkSVczISI/dz6feL0nBid23kmzrpmtl y7Rzr7s0QEa4pxpPc/yZvTjsXHtFpsUPwrihclaG0jRLYgZu4ZyZfyOfsQvMsMLjaSgx BsEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zk6oHfUo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d13-20020a056a0024cd00b00505ad872920si3336081pfv.289.2022.04.15.19.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:20:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zk6oHfUo; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1A9A15AAD3; Fri, 15 Apr 2022 18:35:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346701AbiDNVVZ (ORCPT + 99 others); Thu, 14 Apr 2022 17:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345666AbiDNVVX (ORCPT ); Thu, 14 Apr 2022 17:21:23 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71AAFE6159 for ; Thu, 14 Apr 2022 14:18:56 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id c15so7575134ljr.9 for ; Thu, 14 Apr 2022 14:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=ufxYIOwf0J693O+/j0nztdscn7O3zFr17OcsXCTFd2A=; b=Zk6oHfUomwUd26LNJQK4KaU2ifbDnt/zijM3TxgAahrDWK010devX3SknCi4s/XrEH oy4r8mL84+4zTzAU8VSaWWH5qeRz42KVA783zXnCpTQOlFiG7JkiWfboSGbgaD/PbFuZ Iqv2z1Fwk5hdYim/ya0Pv56zidniWDo88+0xuGJThORubgRolgqNlJtvZxGgYY1N/6wC OjV7LoJiYUq5ZlAOO2jgRUu26sEDg4IWZNskZkc/sUyWFx7N9SSMGLTkfX5ZuSd5Wool pMjJh3Ky2x1xckyyh/zLmbO7BajES4LvZxc5GNrGI2BeQJcRpCYLctVdR+BicaFjigOw u95w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ufxYIOwf0J693O+/j0nztdscn7O3zFr17OcsXCTFd2A=; b=XjmpZPdO94tYxmMWnAaD+/UwMuKvSICmCdkbBky5+kzDqW/8MJ4PP2aSya9zKFVx1t DL3K3VhG4vB5viqHA7Za2+nPg2pH3lOxuw8trD/HUwaBNRIfHqNegzX5OMx9laW4AU4E +kZ02f2efoMy6huruznh6CQLGp6DKN23/rgX9uo1x9CHplJe57k1frqrgSWp6ohRi8Dp XLuOVNjBGxEr2FWICNVVyYoLoExf/c5EMT9Wez2ofbYQfqycGrBKBfswDGirW037zHnh WNWuI6k9jIPbUtBv041HKGuGW68dzYG6ka5TZkIhXdsmiRPdnwnCOJDAh7Gw5J+J+Jd6 ovqQ== X-Gm-Message-State: AOAM531eLRfOQqgMtwGInmvraAixO+R17EFRGvjcZ7E2jmwrQBq5BNYw N8yJdhw8jAYHyd4eZJrO/20I9A== X-Received: by 2002:a05:651c:893:b0:249:4023:3818 with SMTP id d19-20020a05651c089300b0024940233818mr2748589ljq.44.1649971134550; Thu, 14 Apr 2022 14:18:54 -0700 (PDT) Received: from [192.168.1.211] ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id s6-20020ac25fa6000000b0044313e88020sm111871lfe.202.2022.04.14.14.18.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Apr 2022 14:18:54 -0700 (PDT) Message-ID: Date: Fri, 15 Apr 2022 00:18:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v5 3/5] input: misc: pm8941-pwrkey: add support for PON GEN3 base addresses Content-Language: en-GB To: Anjelique Melendez , dmitry.torokhov@gmail.com, corbet@lwn.net, sre@kernel.org, robh+dt@kernel.org Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, collinsd@codeaurora.org, bjorn.andersson@linaro.org, swboyd@chromium.org, skakit@codeaurora.org, linux-doc@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org References: <20220411200506.22891-1-quic_amelende@quicinc.com> <20220411200506.22891-4-quic_amelende@quicinc.com> From: Dmitry Baryshkov In-Reply-To: <20220411200506.22891-4-quic_amelende@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/04/2022 23:05, Anjelique Melendez wrote: > Currently, PON address is read from the "reg" property. For PON GEN3, > which starts with PMK8350, the "reg" property will have both the PON > HLOS and PON PBS addesses defined. Add support so that all PON > generations can be configured. > > Signed-off-by: Anjelique Melendez > Reviewed-by: Stephen Boyd > --- > drivers/input/misc/pm8941-pwrkey.c | 31 +++++++++++++++++++++++------- > 1 file changed, 24 insertions(+), 7 deletions(-) > > diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c > index e0240db12d4f..43106e4cfd23 100644 > --- a/drivers/input/misc/pm8941-pwrkey.c > +++ b/drivers/input/misc/pm8941-pwrkey.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -44,6 +45,7 @@ struct pm8941_data { > unsigned int status_bit; > bool supports_ps_hold_poff_config; > bool supports_debounce_config; > + bool has_pon_pbs; > const char *name; > const char *phys; > }; > @@ -52,6 +54,7 @@ struct pm8941_pwrkey { > struct device *dev; > int irq; > u32 baseaddr; > + u32 pon_pbs_baseaddr; > struct regmap *regmap; > struct input_dev *input; > > @@ -167,6 +170,8 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev) > struct pm8941_pwrkey *pwrkey; > bool pull_up; > struct device *parent; > + struct device_node *regmap_node; > + const __be32 *addr; > u32 req_delay; > int error; > > @@ -188,8 +193,10 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev) > pwrkey->data = of_device_get_match_data(&pdev->dev); > > parent = pdev->dev.parent; > + regmap_node = pdev->dev.of_node; > pwrkey->regmap = dev_get_regmap(parent, NULL); > if (!pwrkey->regmap) { > + regmap_node = parent->of_node; > /* > * We failed to get regmap for parent. Let's see if we are > * a child of pon node and read regmap and reg from its > @@ -200,15 +207,21 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev) > dev_err(&pdev->dev, "failed to locate regmap\n"); > return -ENODEV; > } > + } > > - error = of_property_read_u32(parent->of_node, > - "reg", &pwrkey->baseaddr); > - } else { > - error = of_property_read_u32(pdev->dev.of_node, "reg", > - &pwrkey->baseaddr); > + addr = of_get_address(regmap_node, 0, NULL, NULL); > + if (!addr) { > + dev_err(&pdev->dev, "reg property missing\n"); > + return -EINVAL; > + } > + pwrkey->baseaddr = be32_to_cpup(addr); > + > + if (pwrkey->data->has_pon_pbs) { > + /* PON_PBS base address is optional */ > + addr = of_get_address(regmap_node, 1, NULL, NULL); > + if (addr) > + pwrkey->pon_pbs_baseaddr = be32_to_cpup(addr); > } > - if (error) > - return error; > > pwrkey->irq = platform_get_irq(pdev, 0); > if (pwrkey->irq < 0) > @@ -316,6 +329,7 @@ static const struct pm8941_data pwrkey_data = { > .phys = "pm8941_pwrkey/input0", > .supports_ps_hold_poff_config = true, > .supports_debounce_config = true, > + .has_pon_pbs = false, > }; > > static const struct pm8941_data resin_data = { > @@ -325,6 +339,7 @@ static const struct pm8941_data resin_data = { > .phys = "pm8941_resin/input0", > .supports_ps_hold_poff_config = true, > .supports_debounce_config = true, > + .has_pon_pbs = false, No need to declare that a field is false. Just skip this completely. > }; > > static const struct pm8941_data pon_gen3_pwrkey_data = { > @@ -333,6 +348,7 @@ static const struct pm8941_data pon_gen3_pwrkey_data = { > .phys = "pmic_pwrkey/input0", > .supports_ps_hold_poff_config = false, > .supports_debounce_config = false, > + .has_pon_pbs = true, > }; > > static const struct pm8941_data pon_gen3_resin_data = { > @@ -341,6 +357,7 @@ static const struct pm8941_data pon_gen3_resin_data = { > .phys = "pmic_resin/input0", > .supports_ps_hold_poff_config = false, > .supports_debounce_config = false, > + .has_pon_pbs = true, > }; > > static const struct of_device_id pm8941_pwr_key_id_table[] = { -- With best wishes Dmitry