diff mbox

[U-Boot,1/4] sunxi: video: Fix VIDEO_LCD_PANEL_I2C being enabled by default

Message ID 1425737102-930-1-git-send-email-hdegoede@redhat.com
State Accepted
Delegated to: Hans de Goede
Headers show

Commit Message

Hans de Goede March 7, 2015, 2:04 p.m. UTC
Fix a type in board/sunxi/Kconfig which caused VIDEO_LCD_PANEL_I2C to be
enabled on all sunxi boards. Also fix a compile error which shows up once
VIDEO_LCD_PANEL_I2C is actually disabled on most boards as it should be.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 board/sunxi/Kconfig            | 2 +-
 include/configs/sunxi-common.h | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Comments

Hans de Goede March 7, 2015, 7 p.m. UTC | #1
Hi,

On 07-03-15 15:05, Hans de Goede wrote:
> The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi,
> 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of
> IO connectors.
>
> Note there seem to be multiple sdcard slots on the board (4 in total), but
> other then mmc0 none of these are hooked up by default, there is a ton of
> dip-switches which likely allow hooking some of these up, but the documentation
> of the board only describes the use of a fraction of them, so for now we
> only support mmc0.
>
> Also see: http://www.merrii.com/en/pla_d.asp?id=163
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Ugh I forgot to update MAINTAINERS for this and the 2 other new boards
(will I ever learn?). I will fix this in my personal tree.

Regards,

Hans

> ---
>   configs/Wits_Pro_A20_DKT_defconfig | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
>   create mode 100644 configs/Wits_Pro_A20_DKT_defconfig
>
> diff --git a/configs/Wits_Pro_A20_DKT_defconfig b/configs/Wits_Pro_A20_DKT_defconfig
> new file mode 100644
> index 0000000..de42b3c
> --- /dev/null
> +++ b/configs/Wits_Pro_A20_DKT_defconfig
> @@ -0,0 +1,15 @@
> +CONFIG_SPL=y
> +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,AHCI,USB_EHCI"
> +CONFIG_FDTFILE="sun7i-a20-wits-pro-a20-dkt.dtb"
> +CONFIG_VIDEO_LCD_MODE="x:1024,y:768,depth:24,pclk_khz:65000,le:159,ri:160,up:22,lo:15,hs:1,vs:1,sync:3,vmode:0"
> +CONFIG_VIDEO_LCD_POWER="PH8"
> +CONFIG_VIDEO_LCD_BL_EN="PH7"
> +CONFIG_VIDEO_LCD_BL_PWM="PB2"
> +CONFIG_VIDEO_LCD_PANEL_LVDS=y
> +CONFIG_VIDEO_VGA=y
> ++S:CONFIG_ARM=y
> ++S:CONFIG_ARCH_SUNXI=y
> ++S:CONFIG_MACH_SUN7I=y
> ++S:CONFIG_DRAM_CLK=384
> ++S:CONFIG_DRAM_ZQ=127
> ++S:CONFIG_DRAM_EMR1=4
>
Ian Campbell March 8, 2015, 9:04 a.m. UTC | #2
On Sat, 2015-03-07 at 15:04 +0100, Hans de Goede wrote:
> Fix a type in board/sunxi/Kconfig which caused VIDEO_LCD_PANEL_I2C to be

"typo"

> +#define CONFIG_VIDEO_LCD_I2C_BUS	1 /* NA, but necessary to compile */

Hrm, should the usage sites not be either ifdef'd or excluded at the
Makefile level when VIDEO_LCD_PANEL_I2C is disabled?

The only use is in
                if (IS_ENABLED(CONFIG_VIDEO_LCD_TL059WV5C0)) {
                        unsigned int orig_i2c_bus = i2c_get_bus_num();
                        i2c_set_bus_num(CONFIG_VIDEO_LCD_I2C_BUS);
                        i2c_reg_write(0x5c, 0x04, 0x42); /* Turn on the LCD */
                        i2c_set_bus_num(orig_i2c_bus);
                }

Is the issue that the IS_ENABLED statically false but the compiler still
wants the contents to be valid?

How about a helper set_video_i2c_bus or some such which can be a nop if
CONFIG_VIDEO_LCD_I2C_BUS is not defined, which would keep the ifdef out
of this code?

Or at least #define it to some obviously bogus value (e.g. ~0UL).

Ian.
Ian Campbell March 8, 2015, 9:08 a.m. UTC | #3
On Sat, 2015-03-07 at 20:00 +0100, Hans de Goede wrote:
> Hi,
> 
> On 07-03-15 15:05, Hans de Goede wrote:
> > The Wits Pro A20 DKT is an A20 Development KiT with 1G RAM, 4G NAND, sdio wifi,
> > 1Gbit ethernet, 1024x768 lcd screen with ft5x_ts touchscreen and a ton of
> > IO connectors.
> >
> > Note there seem to be multiple sdcard slots on the board (4 in total), but
> > other then mmc0 none of these are hooked up by default, there is a ton of
> > dip-switches which likely allow hooking some of these up, but the documentation
> > of the board only describes the use of a fraction of them, so for now we
> > only support mmc0.
> >
> > Also see: http://www.merrii.com/en/pla_d.asp?id=163
> >
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Ugh I forgot to update MAINTAINERS for this and the 2 other new boards
> (will I ever learn?). I will fix this in my personal tree.

;-)

With the 3 MAINTAINERS entries in the right places you can add
        Acked-by: Ian Campbell <ijc@hellion.org.uk>
to all three of them too.

Sigh to YA$PKB (Yet Another $FRUIT Pi Knockoff Board), can no one think
of an original name any more!

Ian.
Hans de Goede March 10, 2015, 11:38 a.m. UTC | #4
Hi,

On 08-03-15 10:04, Ian Campbell wrote:
> On Sat, 2015-03-07 at 15:04 +0100, Hans de Goede wrote:
>> Fix a type in board/sunxi/Kconfig which caused VIDEO_LCD_PANEL_I2C to be
>
> "typo"

Heh, so I made a typo in the word typo, fixed :)

>> +#define CONFIG_VIDEO_LCD_I2C_BUS	1 /* NA, but necessary to compile */
>
> Hrm, should the usage sites not be either ifdef'd or excluded at the
> Makefile level when VIDEO_LCD_PANEL_I2C is disabled?
>
> The only use is in
>                  if (IS_ENABLED(CONFIG_VIDEO_LCD_TL059WV5C0)) {
>                          unsigned int orig_i2c_bus = i2c_get_bus_num();
>                          i2c_set_bus_num(CONFIG_VIDEO_LCD_I2C_BUS);
>                          i2c_reg_write(0x5c, 0x04, 0x42); /* Turn on the LCD */
>                          i2c_set_bus_num(orig_i2c_bus);
>                  }
>
> Is the issue that the IS_ENABLED statically false but the compiler still
> wants the contents to be valid?

Right.

> How about a helper set_video_i2c_bus or some such which can be a nop if
> CONFIG_VIDEO_LCD_I2C_BUS is not defined, which would keep the ifdef out
> of this code?

Not a fan of that, the whole purpose of using IS_ENABLED is to have easier
to read code, I do not believe that adding a wrapper helps there.

> Or at least #define it to some obviously bogus value (e.g. ~0UL).

That is a good idea, I've changed it to -1 in my personal tree.

Regards,

Hans
Ian Campbell March 10, 2015, 12:17 p.m. UTC | #5
On Tue, 2015-03-10 at 12:38 +0100, Hans de Goede wrote:
> > Or at least #define it to some obviously bogus value (e.g. ~0UL).
> 
> That is a good idea, I've changed it to -1 in my personal tree.

With that:

Acked-by: Ian Campbell <ijc@hellion.org.uk>
diff mbox

Patch

diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index ff61738..fe55217 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -360,7 +360,7 @@  config VIDEO_LCD_BL_PWM_ACTIVE_LOW
 config VIDEO_LCD_PANEL_I2C
 	bool "LCD panel needs to be configured via i2c"
 	depends on VIDEO
-	default m
+	default n
 	---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.
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 2c0118e..2022136 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -257,8 +257,6 @@ 
 #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
@@ -266,6 +264,11 @@ 
 extern int soft_i2c_gpio_sda;
 extern int soft_i2c_gpio_scl;
 #endif
+#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 */
+#else
+#define CONFIG_SYS_SPD_BUS_NUM		0 /* The axp209 i2c bus is bus 0 */
+#define CONFIG_VIDEO_LCD_I2C_BUS	1 /* NA, but necessary to compile */
 #endif
 
 #define CONFIG_CMD_I2C