sunxi: video: Improve monitor video-mode option handling

Add a sunxi_monitor enum and parse the monitor option string into this enum
once, rather then doing strcmp-s on it in various places. This also adds
checking for it being a valid value.

This also adds new "none" and "lcd" values in preparation for lcd support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: video: Prepare for lcd support

Refactor sunxi_mode_set into a bunch of helpers, and make it do a switch
case on sunxi_display.monitor to decide what to do.

Also rename sunxi_lcdc_mode_set to sunxi_lcdc_tcon1_mode_set, as it sets the
timings for tcon1, and for lcd support we need a similar function operating
on tcon0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: video: Modify sunxi_lcdc_pll_set to work with both tcon0 and tcon1

Modify sunxi_lcdc_pll_set to work with both tcon0 and tcon1, this is a
preparation patch for adding lcd support.

While at it also swap the divider search order, searching from low to
high, as the comment above the code says we should do. In cases where there
are multiple solutions this will result in picking a lower pll clock and
divider, which is more stable and saves power.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: video: Move sunxi_drc_init

Move sunxi_drc_init to directly above sunxi_engines_init, to avoid unnecessary

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: video: Add lcd output support

Add lcd output support, see the new Kconfig entries and doc/README.video for
how to enable / configure this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: video: Add suppport SoCs without HDMI, e.g. the A13 and A23

Some SoCs, specifically the A13 (sun5i variant) and the A23 (sun8i) only have
lcd output support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: video: Add support for VGA via external DACs connected to the LCD pins

Add support for external DACs connected to the parallel LCD interface driving
a VGA connector, such as found on the Olimex A13 boards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: sunxi-common.h: Reduce bootm_size to take the framebuffer into account

Before video output support can be enabled on the A13-OLinuXinoM, bootm_size
must first be reduced to take into account that the framebuffer is shaved of
the top of the DRAM. For other boards this is not an issue since bootm was set
to 256M and all boards have at least 512M except for the A13-OLinuXinoM.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: A13-OLinuXino defconfigs: Enable VGA output, add lcd-mode for 7" LCD

Enable VGA output on the A13-OLinuXino and A13-OLinuXinoM now that we've
support for it.

Also add LCD timing and gpio info for the Olimex 7" LCD module. We can safely
put this in the default config on this boards, since by default we will always
use VGA, and the LCD timing info will only get used if the user explicitly
sets monitor=lcd in the video-mode env. variable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Add 2 defconfigs for using the Olimex 7" lcd with olinuxino boards

Add defconfigs for using the Olimex 7" lcd with the A10s-OLinuXino-M and
the A20-OLinuXino_MICRO boards.

Note this cannot be added to the regular defconfigs, like with the A13 boards,
because the video code will automatically fallback to driving the LCD if
no HDMI cable is connected (this is the desired behavior on e.g. tablets),
but the LCD connector on the Olimex dev boards may be used for something
completely different, so we do not want to automatically enable it.

Note I do not intend to add defconfigs for all possible permutation of Olimex
boards and LCD displays, these 2 serve mostly as examples. In the long run
this should be solved by moving all the LCD info into dts files and using
devicetree overlays for add-on modules like the LCD displays.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi: Ippo_q8h defconfigs: Enable the LCD panel found on these tablets.

Enable the new LCD support on Ippo_q8h tablets.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>