Skip to contentSkip to conversation

Question about pin control configs

DISCUSSION Dan Carpenter 2 participants 3 messages Dec 11, 2024 – Jan 9, 2025 1 message not in the archive System control & power/management interface (SCPI/SCMI) Message Protocol drivers

lore
Share & tools
lore
#0 lore raw

I've implemented a mock pin controller in SCP. I just want to make sure I'm doing it correctly.

Each pin can have a bunch of config options set which are described in "Table 24 Pin Configuration Type and Enumerations". It's stuff like Bias-high-impedance and Low-power-mode etc.

Question 1: Should configs default to zero?

In my mock pin controller, the options default to zero. So each pin has an array with (SLEW_RATE + 1) configs. I had thought to default to an "unset" value and then if you tried to read the config you would get an error. But I think it should default to zero. There isn't a way "unset" a config, you can only set it to zero, one or the number of Microamperes etc. But there isn't a way to clear the settings.

Question 2: Getting all the configs

The operating system can either query the configs with PINCTRL_SETTINGS_SET/GET and you can read either all the configs or a specific config.
If I default to zero, and we read all the configs then most of them are going to be zero. That's fine?

Question 3: PINCTRL_SETTINGS_GET doesn't work for groups.

To me, it doesn't really make sense for groups to have configs like Bias-bus-hold. That should be associated with the pin. If you call PINCTRL_SETTINGS_SET with a group argument then you set the configs for each pin.

But if you get the settings for a group, the protocol doesn't have a way to associate a response with a specific pin. So PINCTRL_SETTINGS_GET doesn't really work for a group.

It might have been nice to read all the pins in a group in one command but there isn't really a way to do that.

regards,
dan carpenter

A message that is not in the archive (sent off-list or not yet received): GV2PR08MB7955B51D624D6B65DF27E2B5EB3F2@GV2PR08MB7955.eurprd08.prod.outlook.com

#2 lore raw
Quoted 4 lines · Khaled Ali Ahmed

Hello Dan,

Thank you so much for your Questions and here are the answers from my perspective:

Quoted 8 lines

Answer 1:
the pin controller is highly related to HW so the initial values given to pin configurations should match this HW status. For Example, let's say we have the following configs for PIN_6 as a "pin_id"
configs = {{PULL_MODE, 1}, {POWER_SOURCE, 3}}
so it means it is the same default configuration from HW side.

Answer 2:
solved by Answer 1

You're only setting 2 configs. If you read all the configs do you return 18 zeroes just for the two non-zero values?

Quoted 4 lines

Answer 3:
you are right, all pin configurations in the group are unified which means it has the same config so if I receive PINCTRL_SETTINGS_GET for the group, I will reply with the configs of the first pin in the group.

What about for INPUT_VALUE which is the value of the pin?

I haven't yet figured out how this works in the kernel but I feel like it would be nice to read all the pins in a group at once.

regards,
dan carpenter

#3 lore raw

Hello Dan,
Answer to Question 1:
when we configure the pins in the pinctrl module what we have currently are the allowed configurations, functions, and read-only configs without any value, which means the value of config_set/get is something related to the HW itself which means that for scmi_pinctrl and pinctrl we don't have any value values are only the responsibility of HW drivers so whatever the HW default configuration we should stick to it.

Answer to Question 2:
We have no choice here once we receive the request even if we have the same values for different configurations.

Answer to Question 3:
what I understood here is that if the group is a GPIO or a single-pin group it means that pinctrl shall respond with the group config which in this case has the same configuration for all contained pins, otherwise, it should return NOT_SUPPORTED where we are not sure if the whole pins in this group have the same configurations.

thanks, Dan so much.

________________________________________
From: Dan Carpenter <[email protected]>
Sent: Thursday, December 12, 2024 6:32 PM
To: Khaled Ali Ahmed <[email protected]>
Cc: [email protected] <[email protected]>; Girish Pathak <[email protected]>; Linus Walleij <[email protected]>
Subject: Re: Question about pin control configs

Quoted 4 lines · Khaled Ali Ahmed

Hello Dan,

Thank you so much for your Questions and here are the answers from my perspective:

Quoted 8 lines

Answer 1:
the pin controller is highly related to HW so the initial values given to pin configurations should match this HW status. For Example, let's say we have the following configs for PIN_6 as a "pin_id"
configs = {{PULL_MODE, 1}, {POWER_SOURCE, 3}}
so it means it is the same default configuration from HW side.

Answer 2:
solved by Answer 1

You're only setting 2 configs. If you read all the configs do you return 18 zeroes just for the two non-zero values?

Quoted 4 lines

Answer 3:
you are right, all pin configurations in the group are unified which means it has the same config so if I receive PINCTRL_SETTINGS_GET for the group, I will reply with the configs of the first pin in the group.

What about for INPUT_VALUE which is the value of the pin?

I haven't yet figured out how this works in the kernel but I feel like it would be nice to read all the pins in a group at once.

regards,
dan carpenter
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.