Hi there,
I am using custom i.MX8MM board. I have some issue regarding u-boot button press detection.
I have custom functionality that, I have 4 button (as gpio), when We press 4 buttons together, I want to jump to fastboot mode. I have found gpio library in uboot and tried to detect one gpio and reading its state, but I am unable to read gpio state it always gives me 0. Here is my basuc code which I tried,
ret = gpio_to_device(46, &desc);
if (ret)
{
printf("error in gpio_to_device\n");
return ret;
}
else
{
printf("\nsuccess gpio_to_device\n");
}
ret = dm_gpio_request(&desc, "MINUS");
if(ret)
{
printf("error in dm_gpio_request\n");
}
else
{
printf("success in dm_gpio_request ret=%d\n", ret);
}
value = dm_gpio_get_value(&desc);
if(ret)
{
printf("error in gpio_get_value ***** value=%d\n", value);
}
else
{
printf("success in gpio_get_value ***** value=%d\n", value);
}
Then I also tried with
ret = gpio_direction_input(46);
if (ret)
{
printf("error in gpio_direction_input\n");
}
else
{
printf("\nsuccess gpio_direction_input ret=%d\n", ret);
}
But adding above function gives me error like,
"gpio not reserved"
Can anyone help me, How can I detect button press at u-boot?
Thank you