Re: [PATCH] board: rockchip: Add Support for RG353PS and Panel Auto Detection
On Mon, May 15, 2023 at 10:49:43AM +0800, Kever Yang wrote: > Hi Chris, > > Please split this patch into a series with: Thanks, sorry. I probably should have done it this way to begin with. > > - driver update > > - dts update > > - config update. > > > Thanks, > > - Kever > > On 2023/5/13 00:34, Chris Morgan wrote: > > From: Chris Morgan > > > > Add support for panel auto detection for the Anbernic RGxx3 series. > > This requires us to probe the DSI and DSI-DPHY controllers so that > > we may send a MIPI_DCS_GET_DISPLAY_ID command to the panel to find > > out which panel we are running. This requires creating a kind of > > "skeleton" driver for the panel so we have just enough information > > about it to issue the necessary command. > > > > Once the panel type is determined the panel type is saved as an > > environment variable, and additionally the panel compatible string > > is automatically fixed-up in the devicetree if it is found to be > > incompatible. There is a table of panel IDs and compatible strings, > > support for a new panel only requires knowing the ID and the string. > > > > Additionally, the device auto detection was changed so that it > > mimicks the panel auto detection, requiring only defining a few > > new values to add support for a new compatible board. This is done > > while also adding a new board, the RG353PS. > > > > Tested the auto detection on an RG353P, RG353PS (2nd revision panel), > > RG353V, RG353V (2nd revision panel), RG353M, and RG503. As long as > > the correct devicetrees were located in ${boot}/rockchip/. U-Boot > > was able to automatically detect the correct board and panel and > > boot each device correctly. > > > > Signed-off-by: Chris Morgan > > --- > > .../arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi | 10 + > > board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c| 322 +++--- > > configs/anbernic-rgxx3_defconfig | 15 + > > 3 files changed, 307 insertions(+), 40 deletions(-) > > > > diff --git a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi > > b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi > > index a18e5d1cf7..f986e1941e 100644 > > --- a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi > > +++ b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi > > @@ -46,7 +46,17 @@ > > < CLK_RTC32K_FRAC>; > > }; > > +_dphy0 { > > + status = "okay"; > > +}; > > + > > + { > > + status = "okay"; > > +}; > > + > >{ > > + pinctrl-0 = <_xfer>; > > + pinctrl-names = "default"; > > status = "okay"; > > }; > > diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c > > b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c > > index decc46db78..027f4872bb 100644 > > --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c > > +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c > > @@ -6,25 +6,37 @@ > > #include > > #include > > #include > > +#include > > #include > > +#include > > +#include > > +#include > > #include > > +#include > > +#include > > +#include > > #include > > #include > > #include > > -#include > > -#include > > +#include > > #define GPIO0_BASE0xfdd6 > > +#define GPIO4_BASE 0xfe77 > > +#define GPIO_SWPORT_DR_L 0x > > #define GPIO_SWPORT_DR_H 0x0004 > > +#define GPIO_SWPORT_DDR_L 0x0008 > > #define GPIO_SWPORT_DDR_H 0x000c > > -#define GPIO_A5BIT(5) > > -#define GPIO_A6BIT(6) > > +#define GPIO_A0BIT(0) > > +#define GPIO_C5BIT(5) > > +#define GPIO_C6BIT(6) > > +#define GPIO_C7BIT(7) > > #define GPIO_WRITEMASK(bits) ((bits) << 16) > > #define DTB_DIR "rockchip/" > > struct rg3xx_model { > > + const u16 adc_value; > > const char *board; > > const char *board_name; > > const char *fdtfile; > > @@ -34,49 +46,74 @@ enum rgxx3_device_id { > > RG353M, > > RG353P, > > RG353V, > > - RG353VS, > > RG503, > > + /* Devices with duplicate ADC value */ > > + RG353PS, > > + RG353VS, > > }; > > static const struct rg3xx_model rg3xx_model_details[] = { > > [RG353M] = { > > + 517, /* Observed average from device */ > > "rk3566-anbernic-rg353m", > > "RG353M", > > - DTB_DIR "rk3566-anbernic-rg353m.dtb", > > + DTB_DIR "rk3566-anbernic-rg353p.dtb", /* Identical devices */ > > }, > > [RG353P] = { > > + 860, /* Documented value of 860 */ > > "rk3566-anbernic-rg353p", > > "RG353P", > > DTB_DIR "rk3566-anbernic-rg353p.dtb", > > }, > > [RG353V] = { > > + 695, /* Observed average from device */ > > "rk3566-anbernic-rg353v", > > "RG353V", > > DTB_DIR "rk3566-anbernic-rg353v.dtb", > > }, > > - [RG353VS] = { > > - "rk3566-anbernic-rg353vs", > > - "RG353VS", > > - DTB_DIR
Re: [PATCH] board: rockchip: Add Support for RG353PS and Panel Auto Detection
Hi Chris, Please split this patch into a series with: - driver update - dts update - config update. Thanks, - Kever On 2023/5/13 00:34, Chris Morgan wrote: From: Chris Morgan Add support for panel auto detection for the Anbernic RGxx3 series. This requires us to probe the DSI and DSI-DPHY controllers so that we may send a MIPI_DCS_GET_DISPLAY_ID command to the panel to find out which panel we are running. This requires creating a kind of "skeleton" driver for the panel so we have just enough information about it to issue the necessary command. Once the panel type is determined the panel type is saved as an environment variable, and additionally the panel compatible string is automatically fixed-up in the devicetree if it is found to be incompatible. There is a table of panel IDs and compatible strings, support for a new panel only requires knowing the ID and the string. Additionally, the device auto detection was changed so that it mimicks the panel auto detection, requiring only defining a few new values to add support for a new compatible board. This is done while also adding a new board, the RG353PS. Tested the auto detection on an RG353P, RG353PS (2nd revision panel), RG353V, RG353V (2nd revision panel), RG353M, and RG503. As long as the correct devicetrees were located in ${boot}/rockchip/. U-Boot was able to automatically detect the correct board and panel and boot each device correctly. Signed-off-by: Chris Morgan --- .../arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi | 10 + board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c| 322 +++--- configs/anbernic-rgxx3_defconfig | 15 + 3 files changed, 307 insertions(+), 40 deletions(-) diff --git a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi index a18e5d1cf7..f986e1941e 100644 --- a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi +++ b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi @@ -46,7 +46,17 @@ < CLK_RTC32K_FRAC>; }; +_dphy0 { + status = "okay"; +}; + + { + status = "okay"; +}; + { + pinctrl-0 = <_xfer>; + pinctrl-names = "default"; status = "okay"; }; diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c index decc46db78..027f4872bb 100644 --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c @@ -6,25 +6,37 @@ #include #include #include +#include #include +#include +#include +#include #include +#include +#include +#include #include #include #include -#include -#include +#include #define GPIO0_BASE 0xfdd6 +#define GPIO4_BASE 0xfe77 +#define GPIO_SWPORT_DR_L 0x #define GPIO_SWPORT_DR_H 0x0004 +#define GPIO_SWPORT_DDR_L 0x0008 #define GPIO_SWPORT_DDR_H 0x000c -#define GPIO_A5BIT(5) -#define GPIO_A6BIT(6) +#define GPIO_A0BIT(0) +#define GPIO_C5BIT(5) +#define GPIO_C6BIT(6) +#define GPIO_C7BIT(7) #define GPIO_WRITEMASK(bits) ((bits) << 16) #define DTB_DIR "rockchip/" struct rg3xx_model { + const u16 adc_value; const char *board; const char *board_name; const char *fdtfile; @@ -34,49 +46,74 @@ enum rgxx3_device_id { RG353M, RG353P, RG353V, - RG353VS, RG503, + /* Devices with duplicate ADC value */ + RG353PS, + RG353VS, }; static const struct rg3xx_model rg3xx_model_details[] = { [RG353M] = { + 517, /* Observed average from device */ "rk3566-anbernic-rg353m", "RG353M", - DTB_DIR "rk3566-anbernic-rg353m.dtb", + DTB_DIR "rk3566-anbernic-rg353p.dtb", /* Identical devices */ }, [RG353P] = { + 860, /* Documented value of 860 */ "rk3566-anbernic-rg353p", "RG353P", DTB_DIR "rk3566-anbernic-rg353p.dtb", }, [RG353V] = { + 695, /* Observed average from device */ "rk3566-anbernic-rg353v", "RG353V", DTB_DIR "rk3566-anbernic-rg353v.dtb", }, - [RG353VS] = { - "rk3566-anbernic-rg353vs", - "RG353VS", - DTB_DIR "rk3566-anbernic-rg353vs.dtb", - }, [RG503] = { + 1023, /* Observed average from device */ "rk3566-anbernic-rg503", "RG503", DTB_DIR "rk3566-anbernic-rg503.dtb", }, + /* Devices with duplicate ADC value */ + [RG353PS] = { + 860, /* Gathered from second hand information */ + "rk3566-anbernic-rg353ps", + "RG353PS", + DTB_DIR
[PATCH] board: rockchip: Add Support for RG353PS and Panel Auto Detection
From: Chris Morgan Add support for panel auto detection for the Anbernic RGxx3 series. This requires us to probe the DSI and DSI-DPHY controllers so that we may send a MIPI_DCS_GET_DISPLAY_ID command to the panel to find out which panel we are running. This requires creating a kind of "skeleton" driver for the panel so we have just enough information about it to issue the necessary command. Once the panel type is determined the panel type is saved as an environment variable, and additionally the panel compatible string is automatically fixed-up in the devicetree if it is found to be incompatible. There is a table of panel IDs and compatible strings, support for a new panel only requires knowing the ID and the string. Additionally, the device auto detection was changed so that it mimicks the panel auto detection, requiring only defining a few new values to add support for a new compatible board. This is done while also adding a new board, the RG353PS. Tested the auto detection on an RG353P, RG353PS (2nd revision panel), RG353V, RG353V (2nd revision panel), RG353M, and RG503. As long as the correct devicetrees were located in ${boot}/rockchip/. U-Boot was able to automatically detect the correct board and panel and boot each device correctly. Signed-off-by: Chris Morgan --- .../arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi | 10 + board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c| 322 +++--- configs/anbernic-rgxx3_defconfig | 15 + 3 files changed, 307 insertions(+), 40 deletions(-) diff --git a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi index a18e5d1cf7..f986e1941e 100644 --- a/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi +++ b/arch/arm/dts/rk3566-anbernic-rgxx3-u-boot.dtsi @@ -46,7 +46,17 @@ < CLK_RTC32K_FRAC>; }; +_dphy0 { + status = "okay"; +}; + + { + status = "okay"; +}; + { + pinctrl-0 = <_xfer>; + pinctrl-names = "default"; status = "okay"; }; diff --git a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c index decc46db78..027f4872bb 100644 --- a/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c +++ b/board/anbernic/rgxx3_rk3566/rgxx3-rk3566.c @@ -6,25 +6,37 @@ #include #include #include +#include #include +#include +#include +#include #include +#include +#include +#include #include #include #include -#include -#include +#include #define GPIO0_BASE 0xfdd6 +#define GPIO4_BASE 0xfe77 +#define GPIO_SWPORT_DR_L 0x #define GPIO_SWPORT_DR_H 0x0004 +#define GPIO_SWPORT_DDR_L 0x0008 #define GPIO_SWPORT_DDR_H 0x000c -#define GPIO_A5BIT(5) -#define GPIO_A6BIT(6) +#define GPIO_A0BIT(0) +#define GPIO_C5BIT(5) +#define GPIO_C6BIT(6) +#define GPIO_C7BIT(7) #define GPIO_WRITEMASK(bits) ((bits) << 16) #define DTB_DIR"rockchip/" struct rg3xx_model { + const u16 adc_value; const char *board; const char *board_name; const char *fdtfile; @@ -34,49 +46,74 @@ enum rgxx3_device_id { RG353M, RG353P, RG353V, - RG353VS, RG503, + /* Devices with duplicate ADC value */ + RG353PS, + RG353VS, }; static const struct rg3xx_model rg3xx_model_details[] = { [RG353M] = { + 517, /* Observed average from device */ "rk3566-anbernic-rg353m", "RG353M", - DTB_DIR "rk3566-anbernic-rg353m.dtb", + DTB_DIR "rk3566-anbernic-rg353p.dtb", /* Identical devices */ }, [RG353P] = { + 860, /* Documented value of 860 */ "rk3566-anbernic-rg353p", "RG353P", DTB_DIR "rk3566-anbernic-rg353p.dtb", }, [RG353V] = { + 695, /* Observed average from device */ "rk3566-anbernic-rg353v", "RG353V", DTB_DIR "rk3566-anbernic-rg353v.dtb", }, - [RG353VS] = { - "rk3566-anbernic-rg353vs", - "RG353VS", - DTB_DIR "rk3566-anbernic-rg353vs.dtb", - }, [RG503] = { + 1023, /* Observed average from device */ "rk3566-anbernic-rg503", "RG503", DTB_DIR "rk3566-anbernic-rg503.dtb", }, + /* Devices with duplicate ADC value */ + [RG353PS] = { + 860, /* Gathered from second hand information */ + "rk3566-anbernic-rg353ps", + "RG353PS", + DTB_DIR "rk3566-anbernic-rg353ps.dtb", + }, + [RG353VS] = { + 695, /* Gathered from second hand information */ + "rk3566-anbernic-rg353vs", +