mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Satya Priya Kakitapalli (Temp)" <quic_c_skakit@quicinc.com>
To: Stephen Boyd <swboyd@chromium.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, <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>
Subject: Re: [PATCH V10 5/9] mfd: pm8008: Use i2c_new_dummy_device() API
Date: Tue, 19 Apr 2022 11:34:32 +0530	[thread overview]
Message-ID: <2514f361-fdce-0b4d-0af7-24b3f16e2add@quicinc.com> (raw)
In-Reply-To: <CAE-0n51Bs=87+LpDFHBJXqM7VwR4nBtBkG5iasnCKKw4CRdRZg@mail.gmail.com>


On 4/19/2022 12:53 AM, Stephen Boyd wrote:
> Quoting Satya Priya Kakitapalli (Temp) (2022-04-18 08:08:33)
>> On 4/15/2022 5:51 AM, Stephen Boyd wrote:
>>> Quoting Satya Priya (2022-04-14 05:30:14)
>>>> Use i2c_new_dummy_device() to register clients along with
>>>> the main mfd device.
>>> Why?
>>
>> As discussed on V9 of this series, I've done these changes.
>>
>> By using this API we can register other clients at different address
>> space without having separate DT node.
>>
>> This avoids calling the probe twice for the same chip, once for each
>> address space 0x8 and 0x9. I'll add this description in commit text.
>>
> Perfect, thanks.
>
>>>> @@ -221,19 +236,38 @@ static int pm8008_probe_irq_peripherals(struct pm8008_data *chip,
>>>>
>>>>    static int pm8008_probe(struct i2c_client *client)
>>>>    {
>>>> -       int rc;
>>>> +       int rc, i;
>>>>           struct pm8008_data *chip;
>>>> +       struct device_node *node = client->dev.of_node;
>>>>
>>>>           chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
>>>>           if (!chip)
>>>>                   return -ENOMEM;
>>>>
>>>>           chip->dev = &client->dev;
>>>> -       chip->regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg);
>>>> -       if (!chip->regmap)
>>>> -               return -ENODEV;
>>>>
>>>> -       i2c_set_clientdata(client, chip);
>>>> +       for (i = 0; i < PM8008_NUM_CLIENTS; i++) {
>>> This is 2. Why do we have a loop? Just register the i2c client for
>>> pm8008_infra first and then make a dummy for the second address without
>>> the loop and the indentation. Are there going to be more i2c clients?
>>
>> There wont be more than 2 clients, I can remove the loop, but then we
>> will have repetitive code.. something like below
> Repetitive code can be refactored into a subroutine.
>
>>        chip->dev = &client->dev;
>>        i2c_set_clientdata(client, chip);
>>
>>        regmap = devm_regmap_init_i2c(client, &qcom_mfd_regmap_cfg[0]);
>>        if (!regmap)
>>            return -ENODEV;
>>
>>
>>        pm8008_client = i2c_new_dummy_device(client->adapter,
>>                                client->addr + 1);
>>        if (IS_ERR(pm8008_client)) {
>>            dev_err(&pm8008_client->dev, "can't attach client\n");
>>            return PTR_ERR(pm8008_client);
>>        }
>>        pm8008_client->dev.of_node = of_node_get(client->dev.of_node);
>>        i2c_set_clientdata(pm8008_client, chip);
>>
>>        regulators_regmap = devm_regmap_init_i2c(pm8008_client,
>> &qcom_mfd_regmap_cfg[1]);
>>        if (!regmap)
>>            return -ENODEV;
>>
>>>> diff --git a/include/linux/mfd/qcom_pm8008.h b/include/linux/mfd/qcom_pm8008.h
>>>> new file mode 100644
>>>> index 0000000..bc64f01
>>>> --- /dev/null
>>>> +++ b/include/linux/mfd/qcom_pm8008.h
>>>> @@ -0,0 +1,13 @@
>>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>>> +#ifndef __QCOM_PM8008_H__
>>>> +#define __QCOM_PM8008_H__
>>>> +
>>>> +#define PM8008_INFRA_SID       0
>>>> +#define PM8008_REGULATORS_SID  1
>>>> +
>>>> +#define PM8008_NUM_CLIENTS     2
>>>> +
>>>> +struct pm8008_data;
>>>> +struct regmap *pm8008_get_regmap(struct pm8008_data *chip, u8 sid);
>>> Could this be avoided if the regulator driver used
>>> dev_get_regmap(&pdev->dev.parent, "regulator") to find the regmap named
>>> "regulator" of the parent device, i.e. pm8008-infra.
>> I gave it a try, it didn't work. I could not get the regmap for
>> regulators using pm8008-infra i.e., 0x8 device pointer.
> Did it not work because the regmap config for the regulator config
> didn't have a name?


No I specified the name "regulators" in the regmap_config struct for 
regulator config.



  reply	other threads:[~2022-04-19  6:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 12:30 [PATCH V10 0/9] Add Qualcomm Technologies, Inc. PM8008 regulator driver Satya Priya
2022-04-14 12:30 ` [PATCH V10 1/9] dt-bindings: mfd: pm8008: Add reset-gpios Satya Priya
2022-04-14 12:30 ` [PATCH V10 2/9] dt-bindings: regulator: pm8008: Add pm8008 regulator bindings Satya Priya
2022-04-19 17:57   ` Rob Herring
2022-04-14 12:30 ` [PATCH V10 3/9] dt-bindings: mfd: pm8008: Add regulators Satya Priya
2022-04-19 17:57   ` Rob Herring
2022-04-14 12:30 ` [PATCH V10 4/9] mfd: pm8008: Add reset-gpios Satya Priya
2022-04-15  0:10   ` Stephen Boyd
2022-04-18  5:04     ` Satya Priya Kakitapalli (Temp)
     [not found]       ` <a4cbdb4c-dbba-75ee-202a-6b429c0eb390@quicinc.com>
2022-04-27  6:03         ` Satya Priya Kakitapalli (Temp)
2022-04-27  6:30           ` Stephen Boyd
2022-04-27 13:48             ` Satya Priya Kakitapalli (Temp)
2022-04-14 12:30 ` [PATCH V10 5/9] mfd: pm8008: Use i2c_new_dummy_device() API Satya Priya
2022-04-15  0:21   ` Stephen Boyd
2022-04-18 15:08     ` Satya Priya Kakitapalli (Temp)
2022-04-18 19:23       ` Stephen Boyd
2022-04-19  6:04         ` Satya Priya Kakitapalli (Temp) [this message]
2022-04-14 12:30 ` [PATCH V10 6/9] mfd: pm8008: Add mfd_cell struct to register LDOs Satya Priya
2022-04-15  0:23   ` Stephen Boyd
2022-04-18 15:09     ` Satya Priya Kakitapalli (Temp)
2022-04-14 12:30 ` [PATCH V10 7/9] regulator: Add a regulator driver for the PM8008 PMIC Satya Priya
2022-04-15  0:25   ` Stephen Boyd
2022-04-19 14:55     ` Mark Brown
2022-04-19 15:45       ` Stephen Boyd
2022-04-19 16:44         ` Mark Brown
2022-04-14 12:30 ` [PATCH V10 8/9] arm64: dts: qcom: pm8008: Add base dts file Satya Priya
2022-04-15  0:27   ` Stephen Boyd
2022-04-14 12:30 ` [PATCH V10 9/9] arm64: dts: qcom: sc7280: Add pm8008 support for sc7280-idp Satya Priya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2514f361-fdce-0b4d-0af7-24b3f16e2add@quicinc.com \
    --to=quic_c_skakit@quicinc.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_collinsd@quicinc.com \
    --cc=quic_jprakash@quicinc.com \
    --cc=quic_subbaram@quicinc.com \
    --cc=robh+dt@kernel.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®