]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sunxi: video: Add support for LCD panels which need to be configured via i2c
authorHans de Goede <hdegoede@redhat.com>
Mon, 16 Feb 2015 16:23:25 +0000 (17:23 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 11:53:52 +0000 (13:53 +0200)
This commits adds support for configuring a a bitbang i2c controller, which
is used on some boards to configure the LCD panel (via i2c).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
board/sunxi/Kconfig
board/sunxi/board.c
include/configs/sunxi-common.h

index a170c561aab10344474c4fd7921cd302b4695b25..bbb4d1b1e5f7ce802d8cea492142722e4b144b91 100644 (file)
@@ -344,6 +344,30 @@ config VIDEO_LCD_BL_PWM_ACTIVE_LOW
        ---help---
        Set this if the backlight pwm output is active low.
 
+config VIDEO_LCD_PANEL_I2C
+       bool "LCD panel needs to be configured via i2c"
+       depends on VIDEO
+       default m
+       ---help---
+       Say y here if the LCD panel needs to be configured via i2c. This
+       will add a bitbang i2c controller using gpios to talk to the LCD.
+
+config VIDEO_LCD_PANEL_I2C_SDA
+       string "LCD panel i2c interface SDA pin"
+       depends on VIDEO_LCD_PANEL_I2C
+       default "PG12"
+       ---help---
+       Set the SDA pin for the LCD i2c interface. This takes a string in the
+       format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
+
+config VIDEO_LCD_PANEL_I2C_SCL
+       string "LCD panel i2c interface SCL pin"
+       depends on VIDEO_LCD_PANEL_I2C
+       default "PG10"
+       ---help---
+       Set the SCL pin for the LCD i2c interface. This takes a string in the
+       format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
+
 
 # Note only one of these may be selected at a time! But hidden choices are
 # not supported by Kconfig
index b70e00ce6bced72c405554e4951a076a48338069..e1891d198e4ae37635e2e8f970cbe77e460ca91a 100644 (file)
 #include <linux/usb/musb.h>
 #include <net.h>
 
+#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
+/* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */
+int soft_i2c_gpio_sda;
+int soft_i2c_gpio_scl;
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /* add board specific code here */
@@ -152,6 +158,10 @@ void i2c_init_board(void)
        sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUNXI_GPB0_TWI0);
        sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUNXI_GPB0_TWI0);
        clock_twi_onoff(0, 1);
+#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
+       soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA);
+       soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL);
+#endif
 }
 
 #ifdef CONFIG_SPL_BUILD
index 1238d821b36f85fcd4d0272f18a513f7a936494c..f5efebbf28273c825aa843bcbb8be349753e5994 100644 (file)
 #define CONFIG_SYS_I2C_MVTWSI
 #define CONFIG_SYS_I2C_SPEED           400000
 #define CONFIG_SYS_I2C_SLAVE           0x7f
+
+#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD)
+#define CONFIG_SYS_I2C_SOFT
+#define CONFIG_SYS_I2C_SOFT_SPEED      50000
+#define CONFIG_SYS_I2C_SOFT_SLAVE      0x00
+#define CONFIG_VIDEO_LCD_I2C_BUS       0 /* The lcd panel soft i2c is bus 0 */
+#define CONFIG_SYS_SPD_BUS_NUM         1 /* And the axp209 i2c bus is bus 1 */
+/* We use pin names in Kconfig and sunxi_name_to_gpio() */
+#define CONFIG_SOFT_I2C_GPIO_SDA       soft_i2c_gpio_sda
+#define CONFIG_SOFT_I2C_GPIO_SCL       soft_i2c_gpio_scl
+#ifndef __ASSEMBLY__
+extern int soft_i2c_gpio_sda;
+extern int soft_i2c_gpio_scl;
+#endif
+#endif
+
 #define CONFIG_CMD_I2C
 
 /* PMU */