Commit Graph

599 Commits

Author SHA1 Message Date
Simon Glass 1df9127628 x86: video: Fix typo in broadwell Kconfig
'enabled' should be 'enables'. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2016-10-11 11:55:33 +08:00
Marcel Ziswiler 28c694c86f simple panel: fix spelling of debug message
Fix spelling of debug message from cnnot to cannot.

Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-10-10 10:44:37 -07:00
Masahiro Yamada 5d97dff042 treewide: replace #include <asm-generic/errno.h> with <linux/errno.h>
Now, include/linux/errno.h is a wrapper of <asm-generic/errno.h>.
Replace all include directives for <asm-generic/errno.h> with
<linux/errno.h>.

<asm-generic/...> is supposed to be included from <asm/...> when
arch-headers fall back into generic implementation. Generally, they
should not be directly included from .c files.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Add drivers/usb/host/xhci-rockchip.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 22:25:27 -04:00
Masahiro Yamada 1221ce459d treewide: replace #include <asm/errno.h> with <linux/errno.h>
Now, arch/${ARCH}/include/asm/errno.h and include/linux/errno.h have
the same content.  (both just wrap <asm-generic/errno.h>)

Replace all include directives for <asm/errno.h> with <linux/errno.h>.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
[trini: Fixup include/clk.]
Signed-off-by: Tom Rini <trini@konsulko.com>
2016-09-23 17:55:42 -04:00
Masahiro Yamada 720873bf42 video: squash lines for immediate return
For vidconsole_post_probe(), it is common coding style to let a
probe method return the value of a register function.

The others will become simple wrapper functions.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
2016-09-23 17:53:45 -04:00
Hans de Goede 421c98d7d2 sunxi: display: Use PWM to drive backlight where applicable
When the backlight's pwm input is connected to a pwm output of the SoC,
actually use pwm to drive the backlight.

The mean reason for doing this is to fix the backlight turning off
for aprox. 1 second while the kernel is booting. This is caused by
the kernel actually using pwm to drive the backlight, so that it
can dim the backlight. First the pwm driver loads and switches the
pinmux for the pin driving the backlight's pwm input to the pwm
controller. Then about 1s later the actual backlight driver loads
and tells the pwm driver to actually update the pwm settings, which
have a power-on-reset value of "off".

An additional advantage is that this allows us to initatiate the
backlight at 80%, which is the kernel default, avoiding a brightness
change while the kernel loads.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed by: Peter Korsgaard <peter@korsgaard.com>
2016-08-26 16:58:37 +02:00
Tom Rini c6f086ddcb Merge branch 'master' of git://git.denx.de/u-boot-video 2016-07-27 15:22:21 -04:00
Simon Glass c3aad6f65b rockchip: Use rockchip_get_clk() to obtain the SoC clock
The current code picks the first available clock. In U-Boot proper this is
the oscillator device, not the SoC clock device. As a result the HDMI display
does not work.

Fix this by calling rockchip_get_clk() instead.

Fixes: 135aa950 (clk: convert API to match reset/mailbox style)
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
2016-07-25 20:46:45 -06:00
Robert P. J. Day 62a3b7dd08 Various, unrelated tree-wide typo fixes.
Fix a number of typos, including:

     * "compatble" -> "compatible"
     * "eanbeld" -> "enabled"
     * "envrionment" -> "environment"
     * "FTD" -> "FDT" (for "flattened device tree")
     * "ommitted" -> "omitted"
     * "overriden" -> "overridden"
     * "partiton" -> "partition"
     * "propogate" -> "propagate"
     * "resourse" -> "resource"
     * "rest in piece" -> "rest in peace"
     * "suport" -> "support"
     * "varible" -> "variable"

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2016-07-16 09:43:12 -04:00
Tim Harvey adde435fa7 video: allow version string to be optional when using LOGO
The CONFIG_HIDE_LOGO_VERSION config can be used to disable putting the
U-Boot version string on top of the logo.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2016-07-11 22:26:40 +02:00
Tom Rini 99b8275797 Merge branch 'master' of git://git.denx.de/u-boot-tegra 2016-07-06 15:55:36 -04:00
Simon Glass 8d37483e7c tegra: video: Always use write-through cache on LCD
This seems to give the best performance, so let's use it always.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-07-05 13:19:08 -07:00
Simon Glass ec5507707a video: tegra: Move to using simple-panel and pwm-backlight
We have standard drivers for panels and backlights which can do most of the
work for us. Move the tegra20 LCD driver over to use those instead of custom
code.

This patch includes device tree changes for the nvidia boards. I have only
been able to test seaboard. If this patch is applied, these boards will
also need to be synced with the kernel, and updated to use display-timings:

   - colibri
   - medcom-wide
   - paz00
   - tec

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-07-05 13:19:08 -07:00
Sjoerd Simons 70c440e5bd rockchip: video: Lower hpd wait time
Waiting 30 seconds for the hpd to go high seems a bit much, especially
on headless boots. Lowering the timeout to 300ms.

Sending as RFC because frankly i don't know what a sensible timeout is
here, but 30 seconds is clearly not it :)

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Dropped RFC tag:
Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-05 10:38:56 -06:00
Stephen Warren 135aa95002 clk: convert API to match reset/mailbox style
The following changes are made to the clock API:
* The concept of "clocks" and "peripheral clocks" are unified; each clock
  provider now implements a single set of clocks. This provides a simpler
  conceptual interface to clients, and better aligns with device tree
  clock bindings.
* Clocks are now identified with a single "struct clk", rather than
  requiring clients to store the clock provider device and clock identity
  values separately. For simple clock consumers, this isolates clients
  from internal details of the clock API.
* clk.h is split so it only contains the client/consumer API, whereas
  clk-uclass.h contains the provider API. This aligns with the recently
  added reset and mailbox APIs.
* clk_ops .of_xlate(), .request(), and .free() are added so providers
  can customize these operations if needed. This also aligns with the
  recently added reset and mailbox APIs.
* clk_disable() is added.
* All users of the current clock APIs are updated.
* Sandbox clock tests are updated to exercise clock lookup via DT, and
  clock enable/disable.
* rkclk_get_clk() is removed and replaced with standard APIs.

Buildman shows no clock-related errors for any board for which buildman
can download a toolchain.

test/py passes for sandbox (which invokes the dm clk test amongst
others).

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-06-19 17:05:55 -06:00
Simon Glass 9dc89a053d at91: video: Support driver-model for the LCD driver
Add driver-model support to this driver. Most features can be controlled
from the device tree.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
2016-06-12 23:49:38 +02:00
Simon Glass d63ec26a49 at91: video: Prepare for driver-model conversion
Adjust the driver to use struct display_timing for its display timing.
This is what is used by driver-model and allows the LCD init code to be
common.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
2016-06-12 23:49:38 +02:00
Tom Rini d77fa2ff76 Merge http://git.denx.de/u-boot-samsung
Signed-off-by: Tom Rini <trini@konsulko.com>

Conflicts:
	configs/peach-pi_defconfig
	configs/peach-pit_defconfig
2016-06-06 13:39:43 -04:00
Simon Glass b55e04a021 rockchip: video: Flush the cache when the display is updated
Enable this option to correct display artifacts when a write-back cache is
in use.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-27 10:23:08 -06:00
Simon Glass f4f2fce70c exynos: video: Drop old unused code
Now that we are using driver model, we can drop the weak functions and LCD
init in the board file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:19 +09:00
Simon Glass bb5930d5c9 exynos: video: Convert several boards to driver model for video
Update several boards to use driver model for video. This involves changes
to the EDP and FIMD (frame buffer) drivers. Existing PWM, simple-panel and
pwm-backlight drivers are used. These work without additional configuration
since they use the device tree settings in the same way as Linux.

Boards converted are:
- snow
- spring
- peach-pit
- peach-pi

All have been tested. Not converted:

- MIPI display driver
- s5pc210_universal
- smdk5420
- smdk5250
- trats
- trats2

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:19 +09:00
Simon Glass 8b449a6639 exynos: video: Rename variables for driver model
Use 'priv' for a private pointer and 'regs' for a register pointer.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:18 +09:00
Simon Glass 21f8f9bb08 exynos: video: Rename edp_device_info to exynos_dp_priv
Rename this function to better fit with driver model. It is the private data
for the exynos EDP driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:18 +09:00
Simon Glass 7eb860df13 exynos: Simplify calling of exynos_dp_phy_ctrl()
This function controls enabling the EDP PHY. Rename it and drop the existing
weak functions, which are confusing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:18 +09:00
Simon Glass 0c84358cb2 exynos: video: Combine LCD driver into one file
At present exynos_fimd.c is the controller and exynos_fb.c is the U-Boot
LCD interface. With driver model we want these in one file, so join them
in preparation.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:18 +09:00
Simon Glass 37ea446b9d exynos: video: Move mipi_lcd_device_dt into a function
In preparation for making this a parameter, move it into the function
that sets it up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass 652d15c06e exynos: video: Move struct exynos_platform_mipi_dsim into vidinfo
Put the pointer to this structure in struct vidinfo so that we can
reference it without it being global.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass b04135c998 exynos: video: Move dsim_config_dt into a function
In preparation for making this a parameter, move it into the function
that sets it up.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass 8c9b8dc05a exynos: video: Drop static variables in exynos_dp_lowlevel.c
Drop these and use parameters instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass 9c4d440e85 exynos: video: Drop static variables in exynos_fb.c
Drop these and use the existing variables instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass 162fa53c8d exynos: video: Drop static variables in exynos_fimd.c
Drop these and use parameters instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass 40d500212f exynos: video: Drop the static lcd_base_addr variable
Drop this and use parameters instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass aaca5b1902 exynos: video: Remove use of vidinfo_t typedef
Use 'struct vidinfo' instead so that we can change this to a struct with a
different name in future.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass b6feb2675b exynos: video: Drop dead code
We always use device tree with video, so can drop these #ifdefs. Some of the
hardware addresses are not needed either.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Simon Glass 08a7aa1e5b exynos: video: Move driver files into their own directory
Move all the exynos video drivers into one place for ease of maintenance.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2016-05-25 13:25:17 +09:00
Tom Rini 4b6e1fda10 Merge git://git.denx.de/u-boot-dm 2016-05-17 13:58:27 -04:00
Stephen Warren 54693cbdca video: tegra: refuse to bind to disabled dcs
This prevents the following boot-time message on any board where only the
first DC is in use, yet the DC's DT node is enabled:

stdio_add_devices: Video device failed (ret=-22)

(This happens on at least Harmony, Ventana, and likely any other Tegra20
board with display enabled other than Seaboard).

The Tegra DC's DT node represents a display controller. It may itself
drive an integrated RGB display output, or be used by some other display
controller such as HDMI. For this reason the DC node itself is not
enabled/disabled in DT; the DC itself is considered a shared resource, not
the final (board-specific) display output. The node should instantiate a
display output driver only if the rgb subnode is enabled. Other output
drivers are free to use the DC if they are enabled and their DT node
references the DC's DT node. Adapt the Tegra display drivers' bind()
routine to only bind to the DC's DT node if the RGB subnode is enabled.

Now that the display driver does the right thing, remove the workaround
for this issue from Seaboard's DT file.

Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-05-17 09:54:43 -06:00
Stefano Babic 52b1eaf93d Merge branch 'master' of git://git.denx.de/u-boot 2016-05-17 17:51:44 +02:00
Martin Pietryka 3d47b2d741 drivers/video/am335x-fb: Properly point framebuffer behind palette
The DMA was outputting the palette on the screen because the base
for the DMA was not after the palette. In addition to that, the ceiling was
also too high, this led that the output on the screen was shifted.

NOTE: According to the TRM, even in 16/24bit mode a palette is required
in the first 32 bytes of the framebuffer.

See also:
https://e2e.ti.com/support/arm/sitara_arm/f/791/p/234967/834483#834483

"In this mode, the LCDC will assume all information is data and thus you
need to ensure that the DMA points to the first pixel of data and not the
first entry in the frame buffer which is the beginning of the 512 byte
palette."

Signed-off-by: Martin Pietryka <martin.pietryka@chello.at>
Reviewed-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
2016-04-28 16:51:17 +02:00
Martin Pietryka 7d045170ac drivers/video/am335x-fb: Add support for 16bpp format
To support 16bpp we just need to change the raster_ctrl register
accordingly. Also 32bpp mode should work as well, but was not tested.
According to the TRM the uppermost byte will be ignored when
LCD_TFT_24BPP_UNPACK is set.

The switch logic is based on the Linux kernel tilcdc driver:
drivers/gpu/drm/tilcdc/tilcdc_crtc.c: lines 407 through 419
(kernel was checked out at commit: bcc981e9ed8)

Signed-off-by: Martin Pietryka <martin.pietryka@chello.at>
Reviewed-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
2016-04-28 16:50:52 +02:00
Peng Fan c510f2e436 video: ipu_common: fix build error
Some toolchains fail to build
"clk->rate = (u64)(clk->parent->rate * 16) / div;"
And the cast usage is wrong.

Use the following code to fix the issue,
"
  do_div(parent_rate, div);
  clk->rate = parent_rate;
"

Reported-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Peter Robinson <pbrobinson@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
2016-04-28 16:28:45 +02:00
Martin Pietryka ac5c61bfa6 drivers/video/am335x-fb: Fix bits for LCD_PALMODE_RAWDATA definition
According to the TRM you have to set bits [21:20] to 0b10 for RAW mode, so
(0x10 << 20) is obviously wrong here.

Signed-off-by: Martin Pietryka <martin.pietryka@chello.at>
2016-04-25 22:02:08 +02:00
Tom Rini f3c2cab878 Revert "pxa_lcd: make driver cache-aware"
This reverts commit 59deb7fe8d.

Signed-off-by: Tom Rini <trini@konsulko.com>
2016-03-27 20:58:08 -04:00
Tom Rini 09bffbf649 Revert "pxa_lcd: invert colors for Zipit Z2 to get white on black palette"
This reverts commit 3bc8ffd9cb.

Signed-off-by: Tom Rini <trini@konsulko.com>
2016-03-27 20:57:54 -04:00
Vasily Khoruzhick 59deb7fe8d pxa_lcd: make driver cache-aware
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2016-03-27 09:13:00 -04:00
Vasily Khoruzhick 3bc8ffd9cb pxa_lcd: invert colors for Zipit Z2 to get white on black palette
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2016-03-27 09:12:57 -04:00
Vasily Khoruzhick 59fa089b2b zipitz2: enable LCD rotation
z2's screen is rotated by 270 degrees

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
2016-03-27 09:12:56 -04:00
Alexander Graf 99de254e8d bcm2835 video: Map fb as cached
The bcm2835 frame buffer is in RAM, so we can easily map it as cached and gain
all the glorious performance boost that brings with it.

Signed-off-by: Alexander Graf <agraf@suse.de>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
2016-03-27 09:12:19 -04:00
Lawrence Yu cf6eca7ccd sunxi: Configure only LVDS pins instead of all LCD pins when LVDS interface selected
The behavior before this patch would attempt to configure the mux
setting for pins 0 to 27 on PORTD to all be setting 3 for LVDS.  The
LVDS interface actually only uses pins 18 to 27 and not pins 0 to 27
as in the parallel LCD interface.  This patch restricts the
configuration to only the relevant pins 18 to 27 on PORTD.

This was tested on a sun8i A33 tablet with an LVDS screen.  MMC1 has
the capability to use pins 2 to 7 on PORTD and the mux on those pins
was being inadvertently set to setting 3 for MMC functionality which
this patch corrects.

Signed-off-by: Lawrence Yu <lyu@micile.com>
[hdegoede@redhat.com: Only apply this change to A23 / A33]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-03-23 22:04:13 +01:00
Simon Glass 97cb092763 x86: broadwell: Add video support
Add a video driver for Intel's broadwell integrated graphics controller.
This uses a binary blob for most init, with the driver just performing a few
basic tasks.

This driver supports VESA as the mode-setting mechanism. Since most boards
don't support driver model yet with VESA, a special case is added to the
Kconfig for broadwell. Eventually all boards will use driver model and this
can be removed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Bin Meng <bmeng.cn@gmail.com>
2016-03-17 10:27:26 +08:00
Simon Glass e23c6c28b0 video: Allow simple-panel to be used without regulators
At present simple-panel requires regulator support and will not build
without it. But some panels do not have a power supply, or at least not one
that can be controlled. Update the implementation to cope with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
2016-03-17 10:27:22 +08:00
Bin Meng f1d6fda6d3 x86: Move asm/arch-coreboot/tables.h to a common place
Move asm/arch-coreboot/tables.h to asm/coreboot_tables.h so that
coreboot table definitions can be used by other x86 builds.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2016-03-17 10:27:21 +08:00
Tom Rini 4d339a9e8a Merge branch 'master' of git://git.denx.de/u-boot-video 2016-03-15 08:01:17 -04:00
Peng Fan 3cb4f25cc7 video: ipu: avoid overflow issue
Multiplication, as "clk->parent->rate * 16" may overflow. So use
do_div to avoid such issue.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Signed-off-by: Sandor Yu <sandor.yu@nxp.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
2016-03-14 22:47:41 +01:00
Simon Glass 3f603cbbb8 dm: Use uclass_first_device_err() where it is useful
Use this new function in places where it simplifies the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 15:34:50 -06:00
Jacob Chen 8530783594 rockchip: video: Add LVDS support in vop driver
LVDS have a different display out mode, add code to get right flag.

The vop_ip decide display device and the remote_vop_id decide which
vop was being used. So we should use the remote_vop_id to set DCLK_VOP.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-03-14 22:24:10 +01:00
Jacob Chen 35ac89dd8f rockchip: video: Add a display driver for rockchip LVDS
Some Rockchip SoCs support LVDS output. Add a display driver for this so
that these displays can be used on supported boards.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-03-14 22:06:33 +01:00
Jacob Chen eab314f590 dm: video: Add a operation to display uclass
The current display class only allow to get timing from edid.
So add a operation to get timing directly from driver.
In driver, I will use fdtdec_decode_display_timing to get timing.

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-03-14 22:01:26 +01:00
Marek Vasut 703c751169 video: Add S3C24xx framebuffer support
Add basic framebuffer driver for the S3C24xx family of CPUs.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>

V2: Keep the Makefile sorted.
Acked-by: Anatolij Gustschin <agust@denx.de>
2016-02-22 18:07:17 +01:00
Simon Glass d5b9d11cb6 video: freetype: Fix a memory leak with a bad parameter
Make sure to free memory used when the scale facture is incorrect.

Reported-by: Coverity (CID: 24068)
Signed-off-by: Simon Glass <sjg@chromium.org>
2016-02-22 14:41:22 +01:00
Simon Glass f6e75ba7fe video: truetype: Fix a memory leak on error
When the resolution is not supported we should free the memory we don't plan
to use.

Reported-by: Coverity (CID: 135127)

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-02-22 14:41:02 +01:00
Simon Glass 91c08afe66 tegra: video: Move LCD driver to use the DM PWM driver
Use the driver-model PWM driver in preference to the old code.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:53 -07:00
Simon Glass f5acf91f6f tegra: video: Move all fdt-decoding into a single function
Join the two functions which decode the device tree and put them in the
ofdata_to_platdata() method.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:53 -07:00
Simon Glass bfda03770c tegra: video: Move LCD enums into the driver
There is no need to have these in a separate file as they are not
referenced from anywhere else.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:53 -07:00
Simon Glass f20b2c0671 tegra: video: Remove the static variables
We can move the static variables into the driver-private data.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:52 -07:00
Simon Glass 9e6866d3b6 tegra: video: Convert tegra20 LCD driver to driver model
Move this driver over to use driver model. This involves rearranging the
code somewhat. The effect is that everything is run from the probe() method.

Boards which use this are fixed up, but only seaboard is tested.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:52 -07:00
Simon Glass ce0c474a72 tegra: video: Merge the two config structures together
We have a structure for the display panel and another for the controller.
There is some overlap between them. Merge them to simplify the driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:52 -07:00
Simon Glass 40d56a918c tegra: video: Move the check for CONFIG_OF_CONTROL to Kconfig
We can check this in Kconfig now.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:52 -07:00
Simon Glass 71cafc3fba tegra: video: Merge the display driver into one file
At present we have code in arch/arm and code in drivers/video. Move it all
into drivers/video since it is a display driver and our current approach is
to put all driver code in drivers/.

Make a few functions static now that they are not used outside the file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:52 -07:00
Simon Glass d2f906500e tegra: video: Rename CONFIG_VIDEO_TEGRA to CONFIG_VIDEO_TEGRA20
This option refers only to the tegra20 video driver, so name it as such
to avoid confusion with tegra124.

Also move this option to Kconfig.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:51 -07:00
Simon Glass d76592122b tegra: nyan-big: Move the LCD driver to driver model
Adjust the driver to use driver model. The SOR becomes a bridge device. We
use the normal simple_panel driver to handle the display itself. We also
need to enable some options such as regulators, PWMs and DM_VIDEO itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:51 -07:00
Simon Glass 4dd811581a tegra: lcd: Merge tegra124-lcd.c into display.c
There isn't a lot of benefit of have two separate files. With driver model
the code needs to be in the same driver, so it's better to have it in the
same file.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:51 -07:00
Simon Glass bbc8a8b4cc dm: video: Flush the cache after a puts()
This helps keep the display consistent. puts() is used when printing the
prompt, so is a useful way to make sure the current display contents is
visible.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Signed-off-by: Tom Warren <twarren@nvidia.com>
2016-02-16 09:17:50 -07:00
Tom Rini 9ef2835f26 Merge branch 'master' of git://git.denx.de/u-boot-video 2016-02-11 18:18:15 -05:00
Simon Glass a2931b30d2 dm: video: Add a temporary work-around for old stdout var
Boards with a saved environment may use 'lcd' in their stdout environment
variable, expecting that this will enable output to the LCD. When the board
moves to use driver model for video, this will no-longer work. Add a
work-around to fix this. A warning messages is printed, and we will remove
the work-around at the end of 2016.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-02-11 21:37:17 +01:00
Stephen Warren 1382648b6b video: bcm2835: use bus_to_phys() on FB address
The FB address is generated by the firmware running on the GPU/VideoCore
and is a "bus" address. This address is the other side of an IOMMU from
the ARM upon which U-Boot is running. Use bus_to_phys() to convert this
to an ARM physical address. Without this, U-Boot seems to work just fine,
but once the Linux kernel boots on an RPi2, accessing the FB memory often
causes a hard system hang.

This is related to:
122426d46e ARM: bcm2835: use phys_to_bus() for mbox
5c0beb5c58 usb: dwc2: use phys_to_bus/bus_to_phys
79340db7f1 ARM: bcm2835: implement phys_to_bus/bus_to_phys

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
2016-02-06 19:07:29 +01:00
Simon Glass 2b80b4e246 video: Use 'int' for loop variables instead of short
Using short doesn't save anything and is confusing when the width and height
variables are ulong.

This may fix Coverity CID134902 but I doubt it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-02-06 13:55:49 +01:00
Simon Glass 8de536c27c video: sandbox: Allow selection of font size and console name
For testing it is useful to be able to select the font size and the console
driver for sandbox. Add this information to platform data and copy it to
the video device when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:57:30 +01:00
Simon Glass 826f35f9b5 video: Allow selection of the driver and font size
Provide a way for the video console driver to be selected. This is
controlled by the video driver's private data. This can be set up when the
driver is probed so that it is ready for the video_post_probe() method.

The font size is provided as well. The console driver may or may not support
this depending on its capability.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-30 10:57:20 +01:00
Simon Glass c0603b98d4 video: Add the Cantoraone decorative font
This font is a little more ornate than normal. Example uses are on security
screens where a feeling of formality is required.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:56:34 +01:00
Simon Glass 7ad4e30dec video: Add the Rufscript handwriting font
This can be used when a a friendly 'hand-writing' font is needed. It helps
to make the device feel familiar.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:56:22 +01:00
Simon Glass c43c43cd48 video: Add the AnkaCoder mono-spaced font
This can be used when a mono-space font is needed, but the console font
is too small (such as with high-DPI displays).

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:56:09 +01:00
Simon Glass 84b4791ada video: Add the Nimbus sans font
This provides a good-looking font for user prompts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:55:57 +01:00
Simon Glass a29b012037 video: Add a console driver that uses TrueType fonts
The existing 8x16 font is adequate for most purposes. It is small and fast.
However for boot screens where information must be presented to the user,
the console font is not ideal. Common requirements are larger and
better-looking fonts.

This console driver can use TrueType fonts built into U-Boot, and render
them at any size. This can be used in scripts to place text as needed on
the display.

This driver is not really designed to operate with the command line. Much
of U-Boot expects a fixed-width font. But to keep things working correctly,
rudimentary support for the console is provided. The main missing feature is
support for command-line editing.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-30 10:55:47 +01:00
Simon Glass 7b9f7e445e video: Provide a backspace method
With proportional fonts the vidconsole uclass cannot itself erase the
previous character. Provide an optional method so that the driver can
handle this operation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:55:37 +01:00
Simon Glass 58c733a70f video: Provide a signal when a new console line is started
When we start a new line (due to the user pressing return), signal this to
the driver so that it can flush its buffer of character positions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:55:27 +01:00
Simon Glass c5b77d01d1 video: Provide a left margin for the text console
Allow the left margin to be set so that text does not have to be right up
against the left side. On some panels this makes it hard to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:55:15 +01:00
Simon Glass 5508f10ac9 video: Handle the 'bell' character
This can be sent when to many characters are entered. Make sure it is
ignored and does not cause a character to be displayed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:55:02 +01:00
Simon Glass f266178698 video: Use fractional units for X coordinates
With anti-aliased fonts we need a more fine-grained horizontal position
than a single pixel. Characters can be positioned to start part-way through
a pixel, with anti-aliasing (greyscale edges) taking care of the visual
effect.

To cope with this, use fractional units (1/256 pixel) for horizontal
positions in the text console.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-30 10:53:26 +01:00
Simon Glass 6e42e25196 video kconfig console_normal
Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased on current master]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-30 10:03:01 +01:00
Simon Glass 8340ef6278 video: Add stb TrueType font renderer
This is a header file which provides a fairly light-weight TrueType
rendering implementation. It is pulled from http://nothings.org/. The code
style does not comply with U-Boot but I think it is best to leave alone to
permit the source to be synced later if needed.

The only change is to fix a reference to fabs() which should route through
a macro to allow U-Boot to provide its own version.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 09:35:58 +01:00
Anatolij Gustschin 7588c31252 video: add CONFIG_I2C_EDID and disable CONFIG_DISPLAY by default
Enabling CONFIG_DISPLAY breaks building for some architectures
(microblaze-generic), so we disable CONFIG_DISPLAY in Kconfig
by default and enable this option in defconfigs. CONFIG_DISPLAY
depends on CONFIG_I2C_EDID, so add and enable it in defconfigs, too.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Bin Meng <bmeng.cn@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-26 08:06:13 +01:00
Stefan Roese 913d1be208 video: Add support for Armada XP LCD controller
This patch adds basic support for the LCD controller of the Marvell
Armada XP SoC.

An AXP based custom board port will be added later, to use this
driver to display a splash screen via the bmp command later.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Luka Perkov <luka.perkov@sartura.hr>
[agust: rebased]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-23 22:58:07 +01:00
Simon Glass 7b7ad5c31c rockchip: video: Add a video-output driver
Some rockchip SoCs include video output (VOP). Add a driver to support this.
It can output via a display driver (UCLASS_DISPLAY) and currently HDMI and
eDP are supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass 5852d539ea rockchip: video: Add a display driver for rockchip eDP
Some Rockchip SoCs support embedded DisplayPort output. Add a display driver
for this so that these displays can be used on supported boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass c253948341 rockchip: video: Add a display driver for rockchip HDMI
Some Rockchip SoCs support HDMI output. Add a display driver for this so
that these displays can be used on supported boards.

Unfortunately this driver is not fully functional. It cannot reliably read
EDID information over HDMI. This seems to be due to the clocks being
incorrect - the I2C bus speed appears to be up to 100x slower than the
clock settings indicate. The root cause may be in the clock logic.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass 2dcf143398 dm: video: Repurpose the 'displayport' uclass to 'display'
The current DisplayPort uclass is too specific. The operations it provides
are shared with other types of output devices, such as HDMI and LVDS LCD
displays.

Generalise the uclass so that it can be used with these devices as well.
Adjust the uclass to handle the EDID reading and conversion to
display_timing internally.

Also update nyan-big which is affected by this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass cd9c2070ea video: panel: Add a simple panel driver
Most panels are very simple - they just have a power supply and a backlight.
Add a driver which supports this and implements the enable_backlight()
method.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass f563dc1d19 dm: panel: Add a panel uclass
LCD panels can usefully be modelled as their own uclass. They can be probed
(which powers them up ready for use). If they have a backlight, this can be
enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00
Simon Glass 65fba5927c dm: backlight: Add a driver for a PWM backlight
Many backlights need to use a PWM to control the brightness. Add a driver
for this. It understands the standard device tree binding.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-21 20:42:36 -07:00