From mboxrd@z Thu Jan 1 00:00:00 1970 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 562EBC433F5 for ; Fri, 27 May 2022 21:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354689AbiE0VCl (ORCPT ); Fri, 27 May 2022 17:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346060AbiE0VCk (ORCPT ); Fri, 27 May 2022 17:02:40 -0400 Received: from mail-oa1-x2c.google.com (mail-oa1-x2c.google.com [IPv6:2001:4860:4864:20::2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA128762A5 for ; Fri, 27 May 2022 14:02:39 -0700 (PDT) Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-f2a4c51c45so7154101fac.9 for ; Fri, 27 May 2022 14:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=nxF6He7HpWZ4GwGGzPoFQzOw/acvMLoNb90aVoiUal0=; b=X85jRBi4B1PcfrEmg5Y7ld9nwXNcZnmKbF37XCeKGUpRvf/UQ6Gaz1zscDH+ytBW9r le9wkLTLhcOe9wROcOiiDXIX20kOWPFSOHEhAJJbBLXl8SDC1PoYldNdewWJ+ttbmUqc 0k/3n06/Kuo4jPUyjyE5vv7EaHsDbrPNsnowc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=nxF6He7HpWZ4GwGGzPoFQzOw/acvMLoNb90aVoiUal0=; b=bbP7382B+MkwFjNC1VvAbUvqCzx3dHVCJZpYgaHWy4X2NtmpT34f9hu/0kBDRLVvfO vRm5Zt/Uoh4pyJV+QTA1JQzC12P+tSmo6tQAcdaVRCdXI6sx9FGhJe+mL3RpdPBFJwye EPuw1IDPSY/eQZS2zlzO8cIieEmfKObtBN1Ll3se/sNbEGYFBKx8Wau/6bpNIsm3OcFL 9VtwVBoR41y5d0mwUW8ilqQ11j2anDeIxu57Hpq9lcCoOby3M/cCxRMPbumeeKFf3X8R YwiwR+o2duhyy0ZeL0P+2YwAMxA0jmA98ydfj5A/wO0dJOqwDr4poa5IHY0cKPqgasJ/ RrNQ== X-Gm-Message-State: AOAM531GznXELvQya7sVqJABbaypvfttUWaWJeRjOp+3V0MmK7nAnD9B 9B/lu2p3JAiTA6o2QvXlmVw6cEsNbUQV8BJIfZgbCQ== X-Google-Smtp-Source: ABdhPJzlCImLhNtTcoiaIh7Pm2IzQ1VjLAL6O8LiIDHqy2sdZqfC1a4S7cVjHJafBiqfUudwpAWHMvGsG5VhwRkAh00= X-Received: by 2002:a05:6870:240d:b0:f1:b878:e97c with SMTP id n13-20020a056870240d00b000f1b878e97cmr4843766oap.193.1653685358485; Fri, 27 May 2022 14:02:38 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 27 May 2022 17:02:37 -0400 MIME-Version: 1.0 In-Reply-To: References: <1653043777-24003-1-git-send-email-quic_c_skakit@quicinc.com> <1653043777-24003-8-git-send-email-quic_c_skakit@quicinc.com> From: Stephen Boyd User-Agent: alot/0.10 Date: Fri, 27 May 2022 17:02:37 -0400 Message-ID: Subject: Re: [PATCH V13 7/9] regulator: Add a regulator driver for the PM8008 PMIC To: Bjorn Andersson , Rob Herring , Satya Priya Kakitapalli Cc: Lee Jones , Liam Girdwood , Mark Brown , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_collinsd@quicinc.com, quic_subbaram@quicinc.com, quic_jprakash@quicinc.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org HTML mail? Please send plaintext next time. Quoting Satya Priya Kakitapalli (Temp) (2022-05-27 01:24:19) > > On 5/21/2022 8:26 AM, Stephen Boyd wrote: > > Quoting Satya Priya (2022-05-20 03:49:35) > > diff --git a/drivers/regulator/qcom-pm8008-regulator.c b/drivers/regulator/qcom-pm8008-regulator.c > new file mode 100644 > index 0000000..6e815c6 > --- /dev/null > +++ b/drivers/regulator/qcom-pm8008-regulator.c > @@ -0,0 +1,225 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* Copyright (c) 2022, The Linux Foundation. All rights reserved. */ > + > +#include > +#include > +#include > +#include > +#include > +#include > > What in of_device.h is used? > > > struct of_device_id That struct is defined in mod_devicetable.h, not of_device.h > > > > +#include > +#include > +#include > + [...] > > > +}; > + > +static int pm8008_regulator_get_voltage(struct regulator_dev *rdev) > +{ > + struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); > + > + return pm8008_reg->voltage_selector; > > Can this read the hardware instead of caching the value from > pm8008_regulator_set_voltage()? > > > I can use the regmap_bulk_read like below (which was present in the earlier > versions) Please do > + } > + > + pm8008_reg->dev = dev; > + > + rc = of_property_read_string(dev->of_node, "regulator-name", &name); > + if (rc) > + return rc; > + > + /* get the required regulator data */ > + for (i = 0; i < ARRAY_SIZE(reg_data); i++) > + if (strstr(name, reg_data[i].name)) > > Why not find this via reg/address instead? It would save storing the > regulator name in the reg_data table. > > > You mean match this using base address? then we should add base address in the > reg_data table. We will need the name to be stored in reg_data table anyway for > the pm8008_reg->rdesc.of_match Why? Now that this driver binds to each node individually the usage of of_match doesn't make any sense to me. Can you set 'struct regulator_config::dev' instead and not set of_match?