Commit 80b9882a authored by Hugh Cole-Baker's avatar Hugh Cole-Baker Committed by Kever Yang
Browse files

rockchip: boot_mode: find the saradc device name

adc_channel_single_shot() requires the full device name e.g.
"saradc@ff100000", which differs between Rockchip SoC's, but they all
share the prefix "saradc"; find the ADC device with this name prefix and
use its full name.
Signed-off-by: default avatarHugh Cole-Baker <>
Reviewed-by: Kever Yang's avatarKever Yang <>
parent a30c6894
......@@ -7,6 +7,8 @@
#include <adc.h>
#include <asm/io.h>
#include <asm/arch-rockchip/boot_mode.h>
#include <dm/device.h>
#include <dm/uclass.h>
......@@ -35,8 +37,26 @@ void set_back_to_bootrom_dnl_flag(void)
__weak int rockchip_dnl_key_pressed(void)
unsigned int val;
struct udevice *dev;
struct uclass *uc;
int ret;
if (adc_channel_single_shot("saradc", 1, &val)) {
ret = uclass_get(UCLASS_ADC, &uc);
if (ret)
return false;
ret = -ENODEV;
uclass_foreach_dev(dev, uc) {
if (!strncmp(dev->name, "saradc", 6)) {
ret = adc_channel_single_shot(dev->name, 1, &val);
if (ret == -ENODEV) {
pr_warn("%s: no saradc device found\n", __func__);
return false;
} else if (ret) {
pr_err("%s: adc_channel_single_shot fail!\n", __func__);
return false;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment