Re: [PATCH 2/7] hte: Add Tegra234 provider
From: Dipen Patel
Date: Tue Dec 27 2022 - 19:44:07 EST
On 11/29/22 7:00 PM, Dipen Patel wrote:
> On 11/11/22 8:01 AM, Thierry Reding wrote:
>> On Thu, Nov 03, 2022 at 10:45:18AM -0700, Dipen Patel wrote:
>>> The Tegra234 AON GPIO instance and LIC IRQ support HTE. For the GPIO
>>> HTE support, it requires to add mapping between GPIO and HTE framework.
>>>
>>> Signed-off-by: Dipen Patel <dipenp@xxxxxxxxxx>
>>> ---
>>> drivers/hte/hte-tegra194-test.c | 2 +-
>>> drivers/hte/hte-tegra194.c | 124 ++++++++++++++++++++++++++++++--
>>> 2 files changed, 121 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra194-test.c
>>> index 5d776a185bd6..d79c28a80517 100644
>>> --- a/drivers/hte/hte-tegra194-test.c
>>> +++ b/drivers/hte/hte-tegra194-test.c
>>> @@ -16,7 +16,7 @@
>>> #include <linux/hte.h>
>>>
<snip>
>>> MODULE_DEVICE_TABLE(of, tegra_hte_of_match);
>>> @@ -635,8 +742,17 @@ static int tegra_hte_probe(struct platform_device *pdev)
>>>
>>> gc->match_from_linedata = tegra_hte_match_from_linedata;
>>>
>>> - hte_dev->c = gpiochip_find("tegra194-gpio-aon",
>>> - tegra_get_gpiochip_from_name);
>>> + if (of_device_is_compatible(dev->of_node,
>>> + "nvidia,tegra194-gte-aon"))
>>> + hte_dev->c = gpiochip_find("tegra194-gpio-aon",
>>> + tegra_get_gpiochip_from_name);
>>> + else if (of_device_is_compatible(dev->of_node,
>>> + "nvidia,tegra234-gte-aon"))
>>> + hte_dev->c = gpiochip_find("tegra234-gpio-aon",
>>> + tegra_get_gpiochip_from_name);
>>> + else
>>> + return -ENODEV;
>>
>> I'm wondering: instead of doing this cumbersome lookup, perhaps it would
>> be easier to create a direct link to the right GPIO controller with a
>> phandle?
> Possible, need to see if gpiod framework has API exposed to get the gpiochip from
> the phandle.
Thierry, I can not find any API which can help retrieve gpio_chip from the GPIO controller
phandle. I need gpio_chip->base to map GPIO line to GTE mapping.
>>
>> Thierry
>