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 B5E66C433EF for ; Mon, 20 Jun 2022 08:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238966AbiFTIVH (ORCPT ); Mon, 20 Jun 2022 04:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237302AbiFTIVG (ORCPT ); Mon, 20 Jun 2022 04:21:06 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B4E12082 for ; Mon, 20 Jun 2022 01:21:01 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id q15so5345796wmj.2 for ; Mon, 20 Jun 2022 01:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=EVFjsrsD8O/Ly8SBCICyHVMqSVwP/VMmIEwnMpqK/k4=; b=XvRRzz9TGuyO5Gwhoh33U+2+M+0cJdWaF5wsH8PELsfkMp8thOOwgvFusE/Xj+qXgQ QMGTNGhnpeNauNYkpWiG2PV+421B98d8O72D6Og6c69MG9/9YqvYo8pUae0IKjqWBvTj NdkTcwK1NGP8Qk1+45a5iLr9f63NWixuWA/rhCD7Ufpbv5efqoxg2A9tPATQc16w+MHb PTVtGWlgvmv7g9hpU+N2FxiS7wllG/edfV9sXwqf3srD92RW2pylpvtPUOebAXvO9548 fqX2wRHZ6renlBN44WY6WkVfY3QjMc1wnVpOICuoHlbTDsHQef2ztn5/jWDyItakhTWE YR9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=EVFjsrsD8O/Ly8SBCICyHVMqSVwP/VMmIEwnMpqK/k4=; b=4LVBDgnuOlxpcrUZAthsWbx+PFVh8QlLdFpTk6FSgxTUgKcVN2AAox7oVBGyqxl2Tn 4RHED+JxXFCD3VDvQxGGuklmNXfhmjrAPHlKBzqY4RYnY6VKwpBJif1TW2KTwoTi1Kut vRsaC2zdvojjnzmeXq1UM4NmSExaVp+7ZPIXD6umKg9U9TqJo+8vYeZkIDXDlBu6OKew tyvgbEuoix417lY55Dr8XhzwknK2iX81s6ZdloVWE6XyrNyMANosnX33HPmeJl5wQhOF ZHbn87XR0DnvDK8NCicOKBCyVEe9AHfwitqVNKiVJeJYwlXkFU5BEOsqFBBZWxIc4GiW QWEg== X-Gm-Message-State: AJIora8nxJQMmYp4MRTTr7o9R4eKX7ypiA6um9Veh8YYd9fipifshrC9 WAl7v6c+krnyYRav5dwRsIdeT5JdAiMUDA== X-Google-Smtp-Source: AGRyM1unkXgzjYWp7VyjReRJg1Ito996ylAaKPqwIvh9B1hNdEIM4OSDqV6AmMP+zsgse48mv10f3Q== X-Received: by 2002:a05:600c:3594:b0:39d:b7c2:dc21 with SMTP id p20-20020a05600c359400b0039db7c2dc21mr27755841wmq.76.1655713259965; Mon, 20 Jun 2022 01:20:59 -0700 (PDT) Received: from google.com (cpc155339-bagu17-2-0-cust87.1-3.cable.virginm.net. [86.27.177.88]) by smtp.gmail.com with ESMTPSA id d18-20020adfe852000000b002108ab90e5asm12457698wrn.58.2022.06.20.01.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 01:20:59 -0700 (PDT) Date: Mon, 20 Jun 2022 09:20:57 +0100 From: Lee Jones To: "Satya Priya Kakitapalli (Temp)" Cc: Bjorn Andersson , Rob Herring , Liam Girdwood , Mark Brown , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, swboyd@chromium.org, quic_collinsd@quicinc.com, quic_subbaram@quicinc.com, quic_jprakash@quicinc.com Subject: Re: [PATCH V15 6/9] mfd: pm8008: Use i2c_new_dummy_device() API Message-ID: References: <1655200111-18357-1-git-send-email-quic_c_skakit@quicinc.com> <1655200111-18357-7-git-send-email-quic_c_skakit@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Mon, 20 Jun 2022, Satya Priya Kakitapalli (Temp) wrote: > > On 6/17/2022 2:27 AM, Lee Jones wrote: > > On Tue, 14 Jun 2022, Satya Priya wrote: > > > > > Use i2c_new_dummy_device() to register pm8008-regulator > > > client present at a different address space, instead of > > > defining a separate DT node. This avoids calling the probe > > > twice for the same chip, once for each client pm8008-infra > > > and pm8008-regulator. > > > > > > As a part of this define pm8008_regmap_init() to do regmap > > > init for both the clients and define pm8008_get_regmap() to > > > pass the regmap to the regulator driver. > > > > > > Signed-off-by: Satya Priya > > > Reviewed-by: Stephen Boyd > > > --- > > > Changes in V15: > > > - None. > > > > > > Changes in V14: > > > - None. > > > > > > Changes in V13: > > > - None. > > > > > > drivers/mfd/qcom-pm8008.c | 34 ++++++++++++++++++++++++++++++++-- > > > include/linux/mfd/qcom_pm8008.h | 9 +++++++++ > > > 2 files changed, 41 insertions(+), 2 deletions(-) > > > create mode 100644 include/linux/mfd/qcom_pm8008.h > > > > > > diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c > > > index 569ffd50..55e2a8e 100644 > > > --- a/drivers/mfd/qcom-pm8008.c > > > +++ b/drivers/mfd/qcom-pm8008.c > > > @@ -9,6 +9,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -57,6 +58,7 @@ enum { > > > struct pm8008_data { > > > struct device *dev; > > > + struct regmap *regulators_regmap; > > > int irq; > > > struct regmap_irq_chip_data *irq_data; > > > }; > > > @@ -150,6 +152,12 @@ static struct regmap_config qcom_mfd_regmap_cfg = { > > > .max_register = 0xFFFF, > > > }; > > > +struct regmap *pm8008_get_regmap(const struct pm8008_data *chip) > > > +{ > > > + return chip->regulators_regmap; > > > +} > > > +EXPORT_SYMBOL_GPL(pm8008_get_regmap); > > Seems like abstraction for the sake of abstraction. > > > > Why not do the dereference inside the regulator driver? > > To derefer this in the regulator driver, we need to have the pm8008_data > struct definition in the qcom_pm8008 header file. > > I think it doesn't look great to have only that structure in header and all > other structs and enum in the mfd driver. Then why pass 'pm8008_data' at all? What's preventing you from passing 'regmap'? -- Lee Jones [李琼斯] Principal Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog