sunxi: video: Add lvds support
Subsystems (3)
PATCH 1/3 sunxi: video: Add lvds support
Add support for lvds lcd panels
--- arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 2 ++ arch/arm/include/asm/arch-sunxi/display.h | 12 ++++++++++ arch/arm/include/asm/arch-sunxi/gpio.h | 1 + board/sunxi/Kconfig | 14 ++++++++++++ drivers/video/sunxi_display.c | 33 +++++++++++++++++++++++++-- 5 files changed, 60 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +2 -0
@@ -284,6 +284,8 @@ struct sunxi_ccm_reg {/* Enable / disable both ch1 sclk1 and sclk2 at the same time */ #define CCM_LCD_CH1_CTRL_GATE (0x1 << 31 | 0x1 << 15) +#define CCM_LVDS_CTRL_RST (1 << 0) +#define CCM_HDMI_CTRL_M (n) ((((n) - 1) & 0xf) << 0)#define CCM_HDMI_CTRL_PLL_MASK (3 << 24)#define CCM_HDMI_CTRL_PLL3 (0 << 24)
arch/arm/include/asm/arch-sunxi/display.h +12 -0
@@ -88,6 +88,9 @@ struct sunxi_lcdc_reg {u8 res3[0x44 ];/* 0xac */ u32 tcon1_io_polarity;/* 0xf0 */ u32 tcon1_io_tristate;/* 0xf4 */ +u8 res4[0x128 ];/* 0xf8 */ +u32 lvds_ana0;/* 0x220 */ +u32 lvds_ana1;/* 0x224 */ };struct sunxi_hdmi_reg {
@@ -241,12 +244,21 @@ struct sunxi_tve_reg {#define SUNXI_LCDC_TCON0_TIMING_H_TOTAL (n) (((n) - 1) << 16)#define SUNXI_LCDC_TCON0_TIMING_V_BP (n) (((n) - 1) << 0)#define SUNXI_LCDC_TCON0_TIMING_V_TOTAL (n) (((n) * 2) << 16) +#define SUNXI_LCDC_TCON0_LVDS_INTF_BITWIDTH (n) ((n) << 26) +#define SUNXI_LCDC_TCON0_LVDS_INTF_ENABLE (1 << 31) +#define SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE0 (0 << 28) +#define SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE60 (1 << 28) +#define SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE120 (2 << 28)#define SUNXI_LCDC_TCON1_CTRL_CLK_DELAY (n) (((n) & 0x1f) << 4)#define SUNXI_LCDC_TCON1_CTRL_ENABLE (1 << 31)#define SUNXI_LCDC_TCON1_TIMING_H_BP (n) (((n) - 1) << 0)#define SUNXI_LCDC_TCON1_TIMING_H_TOTAL (n) (((n) - 1) << 16)#define SUNXI_LCDC_TCON1_TIMING_V_BP (n) (((n) - 1) << 0)#define SUNXI_LCDC_TCON1_TIMING_V_TOTAL (n) (((n) * 2) << 16) +#define SUNXI_LCDC_LVDS_ANA0 0x3f310000 +#define SUNXI_LCDC_LVDS_ANA0_UPDATE (1 << 22) +#define SUNXI_LCDC_LVDS_ANA1_INIT1 (0x1f << 26 | 0x1f << 10) +#define SUNXI_LCDC_LVDS_ANA1_INIT2 (0x1f << 16 | 0x1f << 00)/* * HDMI register constants.
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
@@ -151,6 +151,7 @@ enum sunxi_gpio_number {#define SUNXI_GPC6_SDC2 3#define SUNXI_GPD0_LCD0 2 +#define SUNXI_GPD0_LVDS0 3#define SUNXI_GPF0_SDC0 2
board/sunxi/Kconfig +14 -0
@@ -345,6 +345,20 @@ config VIDEO_LCD_BL_PWM Set the backlight pwm pin for the LCD panel. This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. +choice + prompt "LCD panel support" + depends on VIDEO + ---help--- + Select which type of LCD panel to support. + +config VIDEO_LCD_PANEL_PARALLEL + bool "Generic parallel interface LCD panel" + +config VIDEO_LCD_PANEL_LVDS + bool "Generic lvds interface LCD panel" + +endchoice + config USB_KEYBOARD boolean "Enable USB keyboard support" default y
drivers/video/sunxi_display.c +31 -2
@@ -339,8 +339,12 @@ static void sunxi_lcdc_pll_set(int tcon, int dotclock,int best_double =0 ;if (tcon ==0 ) { +#ifdef CONFIG_VIDEO_LCD_PANEL_LVDS + min_m = max_m =7 ; +#else min_m =6 ; max_m =127 ; +#endif }else { min_m =1 ; max_m =15 ;
@@ -420,6 +424,9 @@ static void sunxi_lcdc_init(void)/* Clock on */ setbits_le32 (&ccm->ahb_gate1,1 <<AHB_GATE_OFFSET_LCD0 ); +#ifdef CONFIG_VIDEO_LCD_PANEL_LVDS +setbits_le32 (&ccm->lvds_clk_cfg,CCM_LVDS_CTRL_RST ); +#endif /* Init lcdc */ writel (0 , &lcdc->ctrl);/* Disable tcon */
@@ -439,6 +446,16 @@ static void sunxi_lcdc_enable(void) (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE ;setbits_le32 (&lcdc->ctrl,SUNXI_LCDC_CTRL_TCON_ENABLE ); +#ifdef CONFIG_VIDEO_LCD_PANEL_LVDS +setbits_le32 (&lcdc->tcon0_lvds_intf,SUNXI_LCDC_TCON0_LVDS_INTF_ENABLE ); +setbits_le32 (&lcdc->lvds_ana0,SUNXI_LCDC_LVDS_ANA0 ); +setbits_le32 (&lcdc->lvds_ana0,SUNXI_LCDC_LVDS_ANA0_UPDATE ); +udelay (2 );/* delay at least 1200 ns */ +setbits_le32 (&lcdc->lvds_ana1,SUNXI_LCDC_LVDS_ANA1_INIT1 ); +udelay (1 );/* delay at least 120 ns */ +setbits_le32 (&lcdc->lvds_ana1,SUNXI_LCDC_LVDS_ANA1_INIT2 ); +setbits_le32 (&lcdc->lvds_ana0,SUNXI_LCDC_LVDS_ANA0_UPDATE ); +#endif }static void sunxi_lcdc_panel_enable (void )
@@ -507,7 +524,11 @@ static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode)int bp, clk_delay, clk_div, clk_double, pin, total, val; for (pin = SUNXI_GPD(0); pin <= SUNXI_GPD(27); pin++) +#ifdef CONFIG_VIDEO_LCD_PANEL_LVDS +sunxi_gpio_set_cfgpin (pin,SUNXI_GPD0_LVDS0 ); +#else sunxi_gpio_set_cfgpin (pin,SUNXI_GPD0_LCD0 ); +#endif sunxi_lcdc_pll_set (0 , mode->pixclock_khz, &clk_div, &clk_double);
@@ -535,12 +556,16 @@ static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode)writel (SUNXI_LCDC_TCON0_TIMING_V_TOTAL (total) |SUNXI_LCDC_TCON0_TIMING_V_BP (bp), &lcdc->tcon0_timing_v); +#ifdef CONFIG_VIDEO_LCD_PANEL_LVDS + val = (sunxi_display.depth ==18 ) ?1 :0 ; +writel (SUNXI_LCDC_TCON0_LVDS_INTF_BITWIDTH (val), &lcdc->tcon0_lvds_intf); +#else writel (SUNXI_LCDC_X (mode->hsync_len) |SUNXI_LCDC_Y (mode->vsync_len), &lcdc->tcon0_timing_sync); -/* We only support hv-sync parallel lcd-s for now */ writel (0 , &lcdc->tcon0_hv_intf);writel (0 , &lcdc->tcon0_cpu_intf); +#endif if (sunxi_display.depth ==18 || sunxi_display.depth ==17 ) {writel (SUNXI_LCDC_FRAME_CTRL_DITHER0 , &lcdc->frame_ctrl[1 ]);
@@ -559,7 +584,11 @@ static void sunxi_lcdc_tcon0_mode_set(const struct ctfb_res_modes *mode) &lcdc->frame_ctrl[0]); } - val =0 ; +#ifdef CONFIG_VIDEO_LCD_PANEL_LVDS + val =SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE60 ; +#else + val =SUNXI_LCDC_TCON0_IO_POL_DCLK_PHASE0 ; +#endif if (!(mode->sync &FB_SYNC_HOR_HIGH_ACT )) val |=SUNXI_LCDC_TCON_HSYNC_MASK ;if (!(mode->sync &FB_SYNC_VERT_HIGH_ACT ))
Signature · 1 line
2.1.0
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
--- board/sunxi/Kconfig | 3 ++ drivers/video/Makefile | 2 +- drivers/video/sunxi_display.c | 9 ++++++ drivers/video/sunxi_lcd_panel.c | 68 +++++++++++++++++++++++++++++++++++++++++ drivers/video/sunxi_lcd_panel.h | 9 ++++++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 drivers/video/sunxi_lcd_panel.c create mode 100644 drivers/video/sunxi_lcd_panel.h
board/sunxi/Kconfig +3 -0
@@ -357,6 +357,9 @@ config VIDEO_LCD_PANEL_PARALLEL config VIDEO_LCD_PANEL_LVDS bool "Generic lvds interface LCD panel" +config VIDEO_LCD_PANEL_HITACHI_TX18D42VM + bool "Hitachi tx18d42vm LCD panel" + endchoice config USB_KEYBOARD
drivers/video/Makefile +1 -1
@@ -39,7 +39,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o obj-$(CONFIG_VIDEO_SED13806) += sed13806.o obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o -obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o sunxi_lcd_panel.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_X86) += x86_fb.o
drivers/video/sunxi_display.c +9 -0
@@ -19,8 +19,13 @@#include <fdtdec.h> #include <fdt_support.h> #include <video_fb.h> +#include "sunxi_lcd_panel.h" #include "videomodes.h" +#ifdef CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM +#define CONFIG_VIDEO_LCD_PANEL_LVDS +#endif +DECLARE_GLOBAL_DATA_PTR ;enum sunxi_monitor {
@@ -486,6 +491,10 @@ static void sunxi_lcdc_panel_enable(void)gpio_request (pin,"lcd_power" );gpio_direction_output (pin,1 ); } + +#ifdef CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM +sunxi_lcd_panel_hitachi_tx18d42vm_init (); +#endif }static void sunxi_lcdc_backlight_enable (void )
drivers/video/sunxi_lcd_panel.c new file +68 -0
68 lines not on this page · raw message
drivers/video/sunxi_lcd_panel.h new file +9 -0
@@ -0,0 +1,9 @@ +/* +* LCD panel driver for Allwinner SoCs. +* +* (C) Copyright 2015 Hans de Goede <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +void sunxi_lcd_panel_hitachi_tx18d42vm_init (void );
Signature · 1 line
2.1.0
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
Quoted 3 lines · Hans de Goede
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
This doesn't sound terribly sunxi specific, shouldn't sunxi_lcd_panel_hitachi_tx18d42vm_init be generic but making use of some sort of arch-provided interface for actually talking SPI to the device (which may or may not use the generic SPI infra, as your code comment talked about)?
Ian.
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
Hi,
Quoted 10 lines · Ian Campbell
Quoted 3 lines · Hans de Goede
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
This doesn't sound terribly sunxi specific, shouldn't
sunxi_lcd_panel_hitachi_tx18d42vm_initbe generic but making use of some sort of arch-provided interface for actually talking SPI to the device (which may or may not use the generic SPI infra, as your code comment talked about)?
You're right it is not sunxi specific, but for now sunxi is the only user (I've checked) so this seemed simplest, with the idea that it is always much easier to make something properly generic when there is more then one user.
I guess I should have put something about this in the commit message :)
Regards,
Hans
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
Quoted 14 lines · Hans de Goede
Hi,
Quoted 10 lines · Ian Campbell
Quoted 3 lines · Hans de Goede
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
This doesn't sound terribly sunxi specific, shouldn't
sunxi_lcd_panel_hitachi_tx18d42vm_initbe generic but making use of some sort of arch-provided interface for actually talking SPI to the device (which may or may not use the generic SPI infra, as your code comment talked about)?
Quoted 4 lines
You're right it is not sunxi specific, but for now sunxi is the only user (I've checked) so this seemed simplest, with the idea that it is always much easier to make something properly generic when there is more then one user.
I think we are more likely to simply end up with N versions of this code because no one notices that it already exists under some other name. If Anatolij is OK with it then I have no objections.
Quoted 7 lines
I guess I should have put something about this in the commit message :)
Regards,
Hans
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
In reply to Hans de GoedeQuoted 47 lines · Hans de Goede
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 3 ++ drivers/video/Makefile | 2 +- drivers/video/sunxi_display.c | 9 ++++++ drivers/video/sunxi_lcd_panel.c | 68 +++++++++++++++++++++++++++++++++++++++++ drivers/video/sunxi_lcd_panel.h | 9 ++++++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 drivers/video/sunxi_lcd_panel.c create mode 100644 drivers/video/sunxi_lcd_panel.hboard/sunxi/Kconfig +3
-0@@ -357,6 +357,9 @@ config VIDEO_LCD_PANEL_PARALLEL config VIDEO_LCD_PANEL_LVDS bool "Generic lvds interface LCD panel" +config VIDEO_LCD_PANEL_HITACHI_TX18D42VM + bool "Hitachi tx18d42vm LCD panel" + endchoice config USB_KEYBOARDdrivers/video/Makefile +1
-1@@ -39,7 +39,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o obj-$(CONFIG_VIDEO_SED13806) += sed13806.o obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o -obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o sunxi_lcd_panel.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_X86) += x86_fb.odrivers/video/sunxi_display.c +0
-0
drivers/video/sunxi_display.c line 27
Quoted 9 lines
drivers/video/sunxi_display.c +4
-0@@ -19,8 +19,13 @@#include <fdtdec.h> #include <fdt_support.h> #include <video_fb.h> +#include "sunxi_lcd_panel.h" #include "videomodes.h" +#ifdef CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM +#define CONFIG_VIDEO_LCD_PANEL_LVDS +#endif
Your reply to 1/3 made me notice this, which I somehow missed before, I don't think this is the right way to go about this.
It seems to me that LCD_PANEL_HITACHI does not belong under the PARALLEL vs LVDS Kconfig choice, rather it should be an independent bool option which depends on PANEL_LVDS.
Ian.
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
Hi,
Quoted 61 lines · Ian Campbell
Quoted 47 lines · Hans de Goede
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 3 ++ drivers/video/Makefile | 2 +- drivers/video/sunxi_display.c | 9 ++++++ drivers/video/sunxi_lcd_panel.c | 68 +++++++++++++++++++++++++++++++++++++++++ drivers/video/sunxi_lcd_panel.h | 9 ++++++ 5 files changed, 90 insertions(+), 1 deletion(-)create mode 100644
drivers/video/sunxi_lcd_panel.ccreate mode 100644drivers/video/sunxi_lcd_panel.hboard/sunxi/Kconfig +3
-0@@ -357,6 +357,9 @@ config VIDEO_LCD_PANEL_PARALLEL config VIDEO_LCD_PANEL_LVDS bool "Generic lvds interface LCD panel" +config VIDEO_LCD_PANEL_HITACHI_TX18D42VM + bool "Hitachi tx18d42vm LCD panel" + endchoice config USB_KEYBOARDdrivers/video/Makefile +1
-1@@ -39,7 +39,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o obj-$(CONFIG_VIDEO_SED13806) += sed13806.o obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o -obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o sunxi_lcd_panel.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_X86) += x86_fb.odrivers/video/sunxi_display.c +0
-0drivers/video/sunxi_display.c line 27
Quoted 9 lines
drivers/video/sunxi_display.c +4
-0@@ -19,8 +19,13 @@#include <fdtdec.h> #include <fdt_support.h> #include <video_fb.h> +#include "sunxi_lcd_panel.h" #include "videomodes.h" +#ifdef CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM +#define CONFIG_VIDEO_LCD_PANEL_LVDS +#endif Your reply to 1/3 made me notice this, which I somehow missed before, I don't think this is the right way to go about this.
Quoted 3 lines
It seems to me that
LCD_PANEL_HITACHIdoes not belong under the PARALLEL vs LVDSKconfigchoice, rather it should be an independent bool option which depends onPANEL_LVDS.
Technically you are correct, but from a user pov it seems easier to tell the user to select which panel he has, and then the user can chose between a bunch of generic ones (generic parallel, generic lvds) and a bunch of specific panels which need some extra setup.
If you insist I can live with doing things your way though, either way let me know how you want to handle this.
Regards,
Hans
PATCH 2/3 sunxi: video: Add support for Hitachi tx18d42vm LCD panels
Quoted 64 lines · Hans de Goede
Hi,
Quoted 61 lines · Ian Campbell
Quoted 47 lines · Hans de Goede
Hitachi tx18d42vm LCD panels have an onboard controller which needs some initialization via spi for the panel to become functional as a regular LVDS panel.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 3 ++ drivers/video/Makefile | 2 +- drivers/video/sunxi_display.c | 9 ++++++ drivers/video/sunxi_lcd_panel.c | 68 +++++++++++++++++++++++++++++++++++++++++ drivers/video/sunxi_lcd_panel.h | 9 ++++++ 5 files changed, 90 insertions(+), 1 deletion(-)create mode 100644
drivers/video/sunxi_lcd_panel.ccreate mode 100644drivers/video/sunxi_lcd_panel.hboard/sunxi/Kconfig +3
-0@@ -357,6 +357,9 @@ config VIDEO_LCD_PANEL_PARALLEL config VIDEO_LCD_PANEL_LVDS bool "Generic lvds interface LCD panel" +config VIDEO_LCD_PANEL_HITACHI_TX18D42VM + bool "Hitachi tx18d42vm LCD panel" + endchoice config USB_KEYBOARDdrivers/video/Makefile +1
-1@@ -39,7 +39,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o obj-$(CONFIG_VIDEO_SED13806) += sed13806.o obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o -obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o sunxi_lcd_panel.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_X86) += x86_fb.odrivers/video/sunxi_display.c +0
-0drivers/video/sunxi_display.c line 27
Quoted 9 lines
drivers/video/sunxi_display.c +4
-0@@ -19,8 +19,13 @@#include <fdtdec.h> #include <fdt_support.h> #include <video_fb.h> +#include "sunxi_lcd_panel.h" #include "videomodes.h" +#ifdef CONFIG_VIDEO_LCD_PANEL_HITACHI_TX18D42VM +#define CONFIG_VIDEO_LCD_PANEL_LVDS +#endif Your reply to 1/3 made me notice this, which I somehow missed before, I don't think this is the right way to go about this.
Quoted 8 lines
Quoted 3 lines
It seems to me that
LCD_PANEL_HITACHIdoes not belong under the PARALLEL vs LVDSKconfigchoice, rather it should be an independent bool option which depends onPANEL_LVDS.Technically you are correct, but from a user pov it seems easier to tell the user to select which panel he has, and then the user can chose between a bunch of generic ones (generic parallel, generic lvds) and a bunch of specific panels which need some extra setup.
Hrm, true.
Quoted 2 lines
If you insist I can live with doing things your way though, either way let me know how you want to handle this.
Perhaps have hidden Kconfig options for the baseline LVDS vs PARALLEL support and then a choice of GENERIC //, GENERIC LVDS, HITACHI TX.., OTHER MAGIC PANEL with appropriate selects on the hidden options?
Then the generic code would use the hidden options, no need for a weird #ifdef/#define pair for each non-standard panel (which depending on how many panels are normal vs. needing magic could get unwieldy).
Ian.
PATCH 3/3 sunxi: Add new Chuwi V7 CW0825 board / defconfig
In reply to Hans de GoedeThe Chuwi V7 is an A10 (sun4i) based tablet with 1G of RAM, 16G of nand flash, microsd slot, 7" 1024x768 lvds ips panel, mini hdmi out, headphones out, stereo speakers, front & back camera and usb wifi.
It is clearly marked "CHUWI", "V7" and "Model: CW0825" on the back of the tablet.
--- board/sunxi/Kconfig | 4 ++++ board/sunxi/MAINTAINERS | 1 + board/sunxi/Makefile | 1 + board/sunxi/dram_sun4i_408_1024_iow16.c | 31 +++++++++++++++++++++++++++++++ configs/Chuwi_V7_CW0825_defconfig | 13 +++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 board/sunxi/dram_sun4i_408_1024_iow16.c create mode 100644 configs/Chuwi_V7_CW0825_defconfig
board/sunxi/Kconfig +4 -0
@@ -101,6 +101,10 @@ config TARGET_BANANAPRO bool "BANANAPRO" depends on MACH_SUN7I +config TARGET_CHUWI_V7_CW0825 + bool "CHUWI_V7_CW0825" + depends on MACH_SUN4I + config TARGET_COLOMBUS bool "COLOMBUS" depends on MACH_SUN6I
board/sunxi/MAINTAINERS +1 -0
@@ -5,6 +5,7 @@ F: board/sunxi/ F: include/configs/sun4i.h F: configs/A10-OLinuXino-Lime_defconfig F: configs/ba10_tv_box_defconfig +F: configs/Chuwi_V7_CW0825_defconfig F: configs/Cubieboard_defconfig F: configs/Mele_A1000_defconfig F: configs/Mele_A1000G_defconfig
board/sunxi/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_TARGET_AUXTEK_T004) += dram_a10s_olinuxino_m.o obj-$(CONFIG_TARGET_BA10_TV_BOX) += dram_sun4i_384_1024_iow8.o obj-$(CONFIG_TARGET_BANANAPI) += dram_bananapi.o obj-$(CONFIG_TARGET_BANANAPRO) += dram_bananapi.o +obj-$(CONFIG_TARGET_CHUWI_V7_CW0825) += dram_sun4i_408_1024_iow16.o obj-$(CONFIG_TARGET_CUBIEBOARD) += dram_cubieboard.o obj-$(CONFIG_TARGET_CUBIEBOARD2) += dram_cubieboard2.o obj-$(CONFIG_TARGET_CUBIETRUCK) += dram_cubietruck.o
board/sunxi/dram_sun4i_408_1024_iow16.c new file +31 -0
@@ -0,0 +1,31 @@ +/* this file is generated, don't edit it yourself */ + +#include <common.h> +#include <asm/arch/dram.h> + +static struct dram_para dram_para = { + .clock =408 , + .type =3 , + .rank_num =1 , + .density =4096 , + .io_width =16 , + .bus_width =32 , + .cas =6 , + .zq =123 , + .odt_en =0 , + .size =1024 , + .tpr0 =0x30926692 , + .tpr1 =0x1090 , + .tpr2 =0x1a0c8 , + .tpr3 =0 , + .tpr4 =0 , + .tpr5 =0 , + .emr1 =0x4 , + .emr2 =0 , + .emr3 =0 , +}; + +unsigned long sunxi_dram_init (void ) +{ +return dramc_init (&dram_para); +}
configs/Chuwi_V7_CW0825_defconfig new file +13 -0
@@ -0,0 +1,13 @@ +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER" +CONFIG_FDTFILE="sun4i-a10-chuwi-v7-cw0825.dtb" +CONFIG_VIDEO_LCD_MODE="x:1024,y:768,depth:24,pclk_khz:51000,le:19,ri:300,up:6,lo:31,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_HITACHI_TX18D42VM=y +CONFIG_USB_KEYBOARD=n ++S:CONFIG_ARM=y ++S:CONFIG_ARCH_SUNXI=y ++S:CONFIG_MACH_SUN4I=y ++S:CONFIG_TARGET_CHUWI_V7_CW0825=y
Signature · 1 line
2.1.0
PATCH 3/3 sunxi: Add new Chuwi V7 CW0825 board / defconfig
Quoted 8 lines · Hans de Goede
The Chuwi V7 is an A10 (sun4i) based tablet with 1G of RAM, 16G of nand flash, microsd slot, 7" 1024x768 lvds ips panel, mini hdmi out, headphones out, stereo speakers, front & back camera and usb wifi.
It is clearly marked "CHUWI", "V7" and "Model: CW0825" on the back of the tablet.
Signed-off-by Hans de Goede <[email protected]>
PATCH 1/3 sunxi: video: Add lvds support
In reply to Hans de GoedeQuoted 6 lines · Hans de Goede
board/sunxi/Kconfig +0
-0@@ -345,6 +345,20 @@ config VIDEO_LCD_BL_PWM Set the backlight pwm pin for the LCD panel. This takes a string in the
board/sunxi/Kconfig config VIDEO_LCD_BL_PWM · line 355
Quoted 10 lines
board/sunxi/Kconfig +8
-0format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. +choice + prompt "LCD panel support" + depends on VIDEO + ---help--- + Select which type of LCD panel to support. + +config VIDEO_LCD_PANEL_PARALLEL + bool "Generic parallel interface LCD panel"
I don't see any use of this choice, I suppose it is the #else case?
Are there other (third) options for LCDs? Or could this be reworded as a boolean rather than a choice? If it's to remain a choice I think it'd be better to have explicit #ifdef ..._PARALLEL rather than #else. Maybe an #else /* ..._PARALLEL */ style would be an ok compromise though.
The code itself is fine by me, not that I know **** about graphics stuff ;-)
Ian.
PATCH 1/3 sunxi: video: Add lvds support
Hi,
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Hans de Goede
board/sunxi/Kconfig +0
-0@@ -345,6 +345,20 @@ config VIDEO_LCD_BL_PWM Set the backlight pwm pin for the LCD panel. This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
Quoted 10 lines
board/sunxi/Kconfig config VIDEO_LCD_BL_PWM · line 355
Quoted 8 lines
board/sunxi/Kconfig +8
-0+choice + prompt "LCD panel support" + depends on VIDEO + ---help--- + Select which type of LCD panel to support. + +config VIDEO_LCD_PANEL_PARALLEL + bool "Generic parallel interface LCD panel"I don't see any use of this choice, I suppose it is the #else case?
Right, it is the else case in the actual code (for now).
Quoted 1 line
Are there other (third) options for LCDs?
Yes, see the second patch in this series, and Sairhei has a tablet which needs something similar (but different) to the second patch.
Quoted 4 lines
Or could this be reworded as a
boolean rather than a choice? If it's to remain a choice I think it'd be better to have explicit #ifdef ..._PARALLEL rather than #else. Maybe an #else /* ..._PARALLEL */ style would be an ok compromise though.
I can make either change, looking at the original allwinner kernel code I guess doing the #ifdef variant makes most sense. I'll respin this when we know what to do wrt patch 2/3.
Regards,
Hans
PATCH 1/3 sunxi: video: Add lvds support
Quoted 23 lines · Hans de Goede
Hi,
Quoted 9 lines · Ian Campbell
Quoted 8 lines · Hans de Goede
board/sunxi/Kconfig +0
-0@@ -345,6 +345,20 @@ config VIDEO_LCD_BL_PWM Set the backlight pwm pin for the LCD panel. This takes a string in the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.Quoted 10 lines
board/sunxi/Kconfig config VIDEO_LCD_BL_PWM · line 355
Quoted 8 lines
board/sunxi/Kconfig +8
-0+choice + prompt "LCD panel support" + depends on VIDEO + ---help--- + Select which type of LCD panel to support. + +config VIDEO_LCD_PANEL_PARALLEL + bool "Generic parallel interface LCD panel"I don't see any use of this choice, I suppose it is the #else case?
Quoted 5 lines
Right, it is the else case in the actual code (for now).
Quoted 1 line
Are there other (third) options for LCDs?
Yes, see the second patch in this series,
I've replied to the second patch again because it doesn't seem right to put the specific choice of panel under the class of panel choice label.
Quoted 2 lines
and Sairhei has a tablet which
needs something similar (but different) to the second patch.
I can't find a reference for this, but I suppose it might imply that the choice of panel should be a Kconfig choice too, just not the same one as the general class of panel Kconfig choice (IYSWIM).
Ian.