All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] mx6qsabreauto: Add splash screen support
Date: Tue, 28 Jan 2014 11:36:52 +0100	[thread overview]
Message-ID: <52E78844.7020805@denx.de> (raw)
In-Reply-To: <1390838748-17779-2-git-send-email-fabio.estevam@freescale.com>

Hi Fabio,

On 27/01/2014 17:05, Fabio Estevam wrote:
> Allow the splash screen to work on LVDS or HDMI.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  board/freescale/mx6qsabreauto/mx6qsabreauto.c | 195 ++++++++++++++++++++++++++
>  include/configs/mx6qsabreauto.h               |  16 +++
>  2 files changed, 211 insertions(+)
> 
> diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
> index 928dadf..44fc71a 100644
> --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
> +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
> @@ -23,6 +23,10 @@
>  #include <netdev.h>
>  #include <asm/arch/sys_proto.h>
>  #include <i2c.h>
> +#include <asm/arch/mxc_hdmi.h>
> +#include <asm/arch/crm_regs.h>
> +#include <linux/fb.h>
> +#include <ipu_pixfmt.h>
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -43,6 +47,8 @@ DECLARE_GLOBAL_DATA_PTR;
>  
>  #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
>  
> +#define LVDS_BACKLIGHT		IMX_GPIO_NR(2, 9)
> +
>  int dram_init(void)
>  {
>  	gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
> @@ -132,6 +138,10 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
>  	MX6_PAD_NANDF_CS2__GPIO6_IO15   | MUX_PAD_CTRL(NO_PAD_CTRL),
>  };
>  
> +static iomux_v3_cfg_t const backlight[] = {
> +	MX6_PAD_SD4_DAT1__GPIO2_IO09 | MUX_PAD_CTRL(ENET_PAD_CTRL),
> +};
> +
>  static void setup_iomux_uart(void)
>  {
>  	imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
> @@ -190,6 +200,186 @@ int board_phy_config(struct phy_device *phydev)
>  	return 0;
>  }
>  
> +#if defined(CONFIG_VIDEO_IPUV3)
> +struct display_info_t {
> +	int	bus;
> +	int	addr;
> +	int	pixfmt;
> +	int	(*detect)(struct display_info_t const *dev);
> +	void	(*enable)(struct display_info_t const *dev);
> +	struct	fb_videomode mode;
> +};
> +
> +static int detect_hdmi(struct display_info_t const *dev)
> +{
> +	struct hdmi_regs *hdmi	= (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
> +	return readb(&hdmi->phy_stat0) & HDMI_DVI_STAT;
> +}
> +
> +static void disable_lvds(struct display_info_t const *dev)
> +{
> +	struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
> +	int reg = readl(&iomux->gpr[2]);
> +	reg &= ~IOMUXC_GPR2_LVDS_CH0_MODE_MASK;
> +	writel(reg, &iomux->gpr[2]);
> +}
> +
> +static void do_enable_hdmi(struct display_info_t const *dev)
> +{
> +	disable_lvds(dev);
> +	imx_enable_hdmi_phy();
> +}
> +
> +static void enable_lvds(struct display_info_t const *dev)
> +{
> +	struct iomuxc *iomux = (struct iomuxc *)
> +				IOMUXC_BASE_ADDR;
> +	u32 reg = readl(&iomux->gpr[2]);
> +	reg |= IOMUXC_GPR2_DATA_WIDTH_CH0_18BIT;
> +	writel(reg, &iomux->gpr[2]);
> +}
> +
> +static struct display_info_t const displays[] = {{
> +	.bus	= -1,
> +	.addr	= 0,
> +	.pixfmt	= IPU_PIX_FMT_RGB666,
> +	.detect	= NULL,
> +	.enable	= enable_lvds,
> +	.mode	= {
> +		.name           = "Hannstar-XGA",
> +		.refresh        = 60,
> +		.xres           = 1024,
> +		.yres           = 768,
> +		.pixclock       = 15385,
> +		.left_margin    = 220,
> +		.right_margin   = 40,
> +		.upper_margin   = 21,
> +		.lower_margin   = 7,
> +		.hsync_len      = 60,
> +		.vsync_len      = 10,
> +		.sync           = FB_SYNC_EXT,
> +		.vmode          = FB_VMODE_NONINTERLACED
> +} }, {
> +	.bus	= -1,
> +	.addr	= 0,
> +	.pixfmt	= IPU_PIX_FMT_RGB24,
> +	.detect	= detect_hdmi,
> +	.enable	= do_enable_hdmi,
> +	.mode	= {
> +		.name           = "HDMI",
> +		.refresh        = 60,
> +		.xres           = 1024,
> +		.yres           = 768,
> +		.pixclock       = 15385,
> +		.left_margin    = 220,
> +		.right_margin   = 40,
> +		.upper_margin   = 21,
> +		.lower_margin   = 7,
> +		.hsync_len      = 60,
> +		.vsync_len      = 10,
> +		.sync           = FB_SYNC_EXT,
> +		.vmode          = FB_VMODE_NONINTERLACED
> +} } };
> +
> +int board_video_skip(void)
> +{
> +	int i;
> +	int ret;
> +	char const *panel = getenv("panel");
> +	if (!panel) {
> +		for (i = 0; i < ARRAY_SIZE(displays); i++) {
> +			struct display_info_t const *dev = displays+i;
> +			if (dev->detect && dev->detect(dev)) {
> +				panel = dev->mode.name;
> +				printf("auto-detected panel %s\n", panel);
> +				break;
> +			}
> +		}
> +		if (!panel) {
> +			panel = displays[0].mode.name;
> +			printf("No panel detected: default to %s\n", panel);
> +			i = 0;
> +		}
> +	} else {
> +		for (i = 0; i < ARRAY_SIZE(displays); i++) {
> +			if (!strcmp(panel, displays[i].mode.name))
> +				break;
> +		}
> +	}
> +	if (i < ARRAY_SIZE(displays)) {
> +		ret = ipuv3_fb_init(&displays[i].mode, 0,
> +				    displays[i].pixfmt);
> +		if (!ret) {
> +			displays[i].enable(displays+i);
> +			printf("Display: %s (%ux%u)\n",
> +			       displays[i].mode.name,
> +			       displays[i].mode.xres,
> +			       displays[i].mode.yres);
> +		} else
> +			printf("LCD %s cannot be configured: %d\n",
> +			       displays[i].mode.name, ret);
> +	} else {
> +		printf("unsupported panel %s\n", panel);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}

I think this is the fourth copy of the same function. We need to move it
to a common place instead of copying.

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  reply	other threads:[~2014-01-28 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 16:05 [U-Boot] [PATCH] mx6qsabreauto: Update imximage.cfg Fabio Estevam
2014-01-27 16:05 ` [U-Boot] [PATCH 2/2] mx6qsabreauto: Add splash screen support Fabio Estevam
2014-01-28 10:36   ` Stefano Babic [this message]
2014-02-11 10:26 ` [U-Boot] [PATCH] mx6qsabreauto: Update imximage.cfg Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52E78844.7020805@denx.de \
    --to=sbabic@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.