Re: [PATCH 1/7] dt-bindings: soc: qcom: Add qcom-pbs bindings

From: Krzysztof Kozlowski
Date: Wed Jul 12 2023 - 10:22:52 EST


On 11/07/2023 22:12, Anjelique Melendez wrote:

>>>
>>> On PMI632, peripherals are partitioned over 2 different SIDs
>>> (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/pmi632.dtsi?h=v6.5-rc1#n42
>>> and https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/pmi632.dtsi?h=v6.5-rc1#n149).
>>> Unfortunately, the pbs peripheral and the lpg peripherals are on different
>>> PMI632 devices and therefore have different regmaps.
>>>
>>> If we get rid of the pbs node we need to get a handle to the proper regmap.
>>> I see two possible options, we could either introduce a new client property
>>> which points to a peripheral on the same device as pbs.
>>>
>>> i.e.
>>> led-controller {
>>> compatible = "qcom,pmi632-lpg";
>>> #address-cells = <1>;
>>> #size-cells = <0>;
>>> #pwm-cells = <2>;
>>> nvmem-names = "lpg_chan_sdam";
>>> nvmem = <&pmi632_sdam7>;
>>> qcom,pbs-phandle = <&pmi632_gpios>;
>>> .....
>>> };
>>> Then when client is probing could do something like the following to get the regmap
>>>
>>> dn = of_parse_phandle(node, "qcom,pbs-phandle", 0);
>>> pdev = of_find_device_by_node(dn);
>>> pbs_regmap = dev_get_regmap(&pdev->dev->parent, NULL);
>>>
>>>
>>>
>>> Or we could use the nvmem phandle and just have something like this in client's probe
>>>
>>> dn = of_parse_phandle(node, "nvmem", 0);
>>> pdev = of_find_device_by_node(dn);
>>> pbs_regmap = dev_get_regmap(&pdev->dev->parent, NULL);
>>>
>>>
>>>
>>> Let me know what your thoughts are on this.
>>
>> Rob asked you - "Is there more than 1 instance in a PMIC?" - and you did
>> not answer positively, just mentioned something about drivers in
>> downstream, which do not matter. So is the answer for that question:
>> yes, you have two instances of the same PMIC differing by presence of
>> PBS and other features"?
>>
> Sorry that was a misunderstanding on my part.
> Yes, answer to Rob's question should have been "We have two instances of PMI632,
> where one instance holds the pbs peripheral and the other holds the lpg
> peripherals. The child node for pbs is needed so lpg client can access
> the PMI632 regmap which contains the pbs peripheral."

I guess I miss here something. What is "LPG client"? I don't understand
why this LPG client needs existence of PBS node, to be able to get the
regmap.

PBS is a child of PMIC, so it can get regmap from the parent. What's
more, which DT property passes the regmap from PMIC to LPG client?

Best regards,
Krzysztof