Re: [PATCH 1/3] gpio: at91: Implement GPIOF_FUNC in get_function()

Eugen Hristev
2024-11-12T16:22:27Z

On 11/12/24 18:17, Zixun LI wrote:
> On Tue, Nov 12, 2024 at 4:59 PM Eugen Hristev <eugen.hristev@linaro.org> wrote:
>>
>>
>>
>> On 11/12/24 17:57, Zixun LI wrote:
>>> Hello,
>>>
>>>
>>> On Tue, Nov 12, 2024 at 2:13 PM Eugen Hristev <eugen.hristev@linaro.org> wrote:
>>>>
>>>>
>>>>> +static bool at91_get_port_pio(struct at91_port *at91_port, int offset)
>>>>
>>>> The name get_port_pio is a bit confusing, can you rename it to something
>>>> more meaningful, like maybe is_periph_func or something ?
>>>
>>> How about at91_is_port_pio_active, more inline to the datasheet.
>>
>>
>> I am not sure. It appears confusing to me.
>> The pin is either in GPIO or peripheral function mode.
>> Being 'PIO active' appears to be something different, or common to both
>> options.
>> What does the datasheet say exactly ?
>
> From SAM9G25 datasheet, 22.6.3 PIO Status Register
>
> 0: PIO is inactive on the corresponding I/O line (peripheral is active).
> 1: PIO is active on the corresponding I/O line (peripheral is inactive).
>
> "PIO" is the port controller itself but also means GPIO which is not very clear.
>
> Or at91_is_port_gpio ?

That sounds better (and have the binary logic reversed)

IIRC on SAM datasheets and naming, 'pio' is a general term for a pin,
and this pin can either work as a GPIO or it can be tied to a specific
hardware block (hence the function)