From e9cb21d0e891e95350da6ec3f8623018fd246187 Mon Sep 17 00:00:00 2001 From: Dirk Eibach Date: Wed, 16 Mar 2016 09:20:11 +0100 Subject: strider: Add DP501 support for cpu model Signed-off-by: Dirk Eibach Signed-off-by: Stefan Roese --- board/gdsys/common/dp501.c | 31 +++++++++++++++++++++++++++++++ board/gdsys/common/dp501.h | 1 + board/gdsys/common/osd.c | 22 +--------------------- 3 files changed, 33 insertions(+), 21 deletions(-) (limited to 'board/gdsys/common') diff --git a/board/gdsys/common/dp501.c b/board/gdsys/common/dp501.c index d35aee0879f..54e7f63f69b 100644 --- a/board/gdsys/common/dp501.c +++ b/board/gdsys/common/dp501.c @@ -12,6 +12,16 @@ #include #include +#define DP501_I2C_ADDR 0x08 + +#ifdef CONFIG_SYS_DP501_I2C +int dp501_i2c[] = CONFIG_SYS_DP501_I2C; +#endif + +#ifdef CONFIG_SYS_DP501_BASE +int dp501_base[] = CONFIG_SYS_DP501_BASE; +#endif + static void dp501_setbits(u8 addr, u8 reg, u8 mask) { u8 val; @@ -125,3 +135,24 @@ void dp501_powerdown(u8 addr) { dp501_setbits(addr, 0x0a, 0x30); /* power down encoder, standby mode */ } + + +int dp501_probe(unsigned screen, bool power) +{ +#ifdef CONFIG_SYS_DP501_BASE + uint8_t dp501_addr = dp501_base[screen]; +#else + uint8_t dp501_addr = DP501_I2C_ADDR; +#endif + +#ifdef CONFIG_SYS_DP501_I2C + i2c_set_bus_num(dp501_i2c[screen]); +#endif + + if (i2c_probe(dp501_addr)) + return -1; + + dp501_powerup(dp501_addr); + + return 0; +} diff --git a/board/gdsys/common/dp501.h b/board/gdsys/common/dp501.h index 8dc3215dcf0..b98b54edc52 100644 --- a/board/gdsys/common/dp501.h +++ b/board/gdsys/common/dp501.h @@ -26,5 +26,6 @@ void dp501_powerup(u8 addr); void dp501_powerdown(u8 addr); +int dp501_probe(unsigned screen, bool power); #endif diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c index 7444bee129f..4e292f56626 100644 --- a/board/gdsys/common/osd.c +++ b/board/gdsys/common/osd.c @@ -24,8 +24,6 @@ #define SIL1178_MASTER_I2C_ADDRESS 0x38 #define SIL1178_SLAVE_I2C_ADDRESS 0x39 -#define DP501_I2C_ADDR 0x08 - #define PIXCLK_640_480_60 25180000 #define MAX_X_CHARS 53 #define MAX_Y_CHARS 26 @@ -78,14 +76,6 @@ int ics8n3qv01_i2c[] = CONFIG_SYS_ICS8N3QV01_I2C; int sil1178_i2c[] = CONFIG_SYS_SIL1178_I2C; #endif -#ifdef CONFIG_SYS_DP501_I2C -int dp501_i2c[] = CONFIG_SYS_DP501_I2C; -#endif - -#ifdef CONFIG_SYS_DP501_BASE -int dp501_base[] = CONFIG_SYS_DP501_BASE; -#endif - #ifdef CONFIG_SYS_MPC92469AC static void mpc92469ac_calc_parameters(unsigned int fout, unsigned int *post_div, unsigned int *feedback_div) @@ -317,13 +307,6 @@ int osd_probe(unsigned screen) int old_bus = i2c_get_bus_num(); bool pixclock_present = false; bool output_driver_present = false; -#ifdef CONFIG_SYS_DP501_I2C -#ifdef CONFIG_SYS_DP501_BASE - uint8_t dp501_addr = dp501_base[screen]; -#else - uint8_t dp501_addr = DP501_I2C_ADDR; -#endif -#endif OSD_GET_REG(0, version, &version); OSD_GET_REG(0, features, &features); @@ -393,11 +376,8 @@ int osd_probe(unsigned screen) #endif #ifdef CONFIG_SYS_DP501_I2C - i2c_set_bus_num(dp501_i2c[screen]); - if (!i2c_probe(dp501_addr)) { - dp501_powerup(dp501_addr); + if (!dp501_probe(screen, true)) output_driver_present = true; - } #endif if (!output_driver_present) -- cgit v1.2.3