remove rgb30 detection, as it's not reliable.

My R1 unit get's falsely detected as R2
This commit is contained in:
sydarn 2024-04-10 00:42:34 +02:00
parent 93781d688c
commit 726122bdff

View file

@ -1,99 +0,0 @@
diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
index b44c0b63fe..9f30c3a6d0 100644
--- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
+++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c
@@ -21,6 +21,7 @@
#include <pwm.h>
#include <stdlib.h>
#include <video_bridge.h>
+#include <i2c.h>
#define BOOT_BROM_DOWNLOAD 0xef08a53c
@@ -46,6 +47,7 @@
#define SARADC_POWER_CTRL BIT(3)
#define DTB_DIR ""
+#define RGB30R2_VDD_CPU_REGULATOR_ADDR 0x40
struct rg3xx_model {
const u16 adc_value;
@@ -68,6 +70,7 @@ enum rgxx3_device_id {
RG353PS,
RG353VS,
RGARCS,
+ RGB30R2,
};
static const struct rg3xx_model rg3xx_model_details[] = {
@@ -150,6 +153,13 @@ static const struct rg3xx_model rg3xx_model_details[] = {
.fdtfile = DTB_DIR "rk3566-anbernic-rg-arc-s.dtb",
.detect_panel = 0,
},
+ [RGB30R2] = {
+ .adc_value = 383, /* Gathered from second hand information */
+ .board = "rk3566-powkiddy-rgb30",
+ .board_name = "RGB30R2",
+ .fdtfile = DTB_DIR "rk3566-powkiddy-rgb30r2.dtb",
+ .detect_panel = 0,
+ },
};
struct rg353_panel {
@@ -398,6 +408,29 @@ int rgxx3_detect_display(void)
return 0;
}
+/*
+ * Detect vdd_cpu regulator, RGB30 has two revisions where this differs.
+ */
+int probe_rgb30r2_detect_vdd_cpu_regulator(void)
+{
+ struct udevice *bus, *dev;
+ int ret;
+
+ ret = uclass_get_device(UCLASS_I2C, 0, &bus);
+ if (ret) {
+ printf("i2c0 bus not found, regulator probe attempt failed.\n");
+ return ret;
+ }
+
+ ret = dm_i2c_probe(bus, RGB30R2_VDD_CPU_REGULATOR_ADDR, 0, &dev);
+ if (ret) {
+ printf("Regulator not found found\n");
+ return ret;
+ }
+
+ return 0;
+}
+
/* Detect which Anbernic RGXX3 device we are using so as to load the
* correct devicetree for Linux. Set an environment variable once
* found. The detection depends on the value of ADC channel 1, the
@@ -452,6 +485,10 @@ int rgxx3_detect_device(void)
}
}
+ if (board_id == RGB30 && probe_rgb30r2_detect_vdd_cpu_regulator() == 0) {
+ board_id = RGB30R2;
+ }
+
if (board_id < 0)
return board_id;
diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig
index f26801f4eb..ff9a6bd81b 100644
--- a/configs/anbernic-rgxx3-rk3566_defconfig
+++ b/configs/anbernic-rgxx3-rk3566_defconfig
@@ -52,6 +52,11 @@ CONFIG_ARM_SMCCC_FEATURES=y
CONFIG_SCMI_FIRMWARE=y
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_DM=y
+CONFIG_DM_I2C=y
+CONFIG_DM_I2C_COMPAT=y
+CONFIG_SPL_I2C=y
+CONFIG_I2C0_ENABLE=y
CONFIG_MISC=y
CONFIG_SUPPORT_EMMC_RPMB=y
CONFIG_MMC_DW=y