How to set GPIOs to pre-defined value

Samuel Jiang chyishian.jiang at gmail.com
Wed May 8 20:32:37 AEST 2019


Hi Brad,
On May 7, 2019, 4:52 PM +0800, Brad Chou <chou.brad at gmail.com>, wrote:
> Hi Samuel,
> Thanks for your reply, I am using AST2500.
> I tried add gpio-hog settings into my device tree, and yes, the GPIO works as it defined.
> But all GPIOs defined by gpio-hog can not be modified in user space by gpioset / gpioget utility.
> I need to set all GPIOs to pre-defined state and can change it at run time.
> Set GPIOs in Device tree is trying to lock it by a fixed direction and value.
>
> Thanks.

You could trace the gpioplus library how does it implement control pins, it seems direct modify by gpio chips.

> Now, I am using a shell script with gpioset utility to do the job.
> But I know using shell to do it is a bad idea.
> Does anyone have better ideas ?


In my situation, I still use shell script export pin which didn't pre-define output high or low and control GPIOs program by c++ at runtime.
But I think the previous shell script also could rewrite to c++.


Thanks,
Samuel Jiang



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20190508/fb725d05/attachment.htm>


More information about the openbmc mailing list