OMAPDSS: Add a PLL library

The DSI, HDMI and the VIDEO PLLs(on DRA7x) are very similar in terms of register
programming model and PLL parameter calculations.

An overlay manager's pixel clock can be driven by DSI PLL on OMAP3, DSI and HDMI
PLLs on OMAP4/5, and VIDEO and HDMI PLL on DRA7x.

This can make the DPI driver quite messy if we want to use different PLL API for
differnt SoCs.

We create a pll library, which provides a way to register to a pll instance,
which an output driver(like DSI, DPI, HDMI) can use.

Currently done only for DSI/HDMI type PLLs.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: Wait for DSI PLL hsdividers in respective driver itself

Waiting for the PLL HSdivider to become active in dss.c makes dss.c code depend
on the type of PLL being used. It also requires us to extract the DSI platform
device which the PLL is a part of.

Simplify this by making the callers to the clk source selection function wait
for the HSdividers to become active. With this change, the functions
dss_select_dispc/lcd/dsi_clk_source just take care of setting the DSS bits for
switching the clock source.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DSI: Use PLL library

Make the DSI driver use the pll helper library to create PLL instances, and
register to those. We keep the existing dsi pll calculation stuff so that DPI
can still use it. This will be removed when DPI also stops using it.

There are some hacks which make sure that both the old DSI PLL code path and
the new PLL library work together. This is needed because DPI still uses dsi
functions to configure the DSI PLL. The old DSI PLL code will be removed once
DPI also uses the PLL library.

Signed-off-by: Archit Taneja <archit@ti.com>
omapdss: DPI: Use PLL library

Make the DPI driver use the pll helper library to use DSI PLLs to compute the
PLL parameters for the desired pixel clock, and to configure and lock the PLL.

DPI in itself doesn't create PLL instances, it retrieves pll_data from the DSI
platform device. The driver still relies on the dsi functions to enable/disable
the DSI PLLs. This would later be removed when we add PLL ops to hide this from
the DPI driver.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DISPC: Use PLL library functions to get clock rates

Use PLL library pll_data handle, and pll_get_hsdiv_rate to get the high speed
divider clock rate.

The hsdivider index is assumed to be 0, it may be better to later have a
function which tells which hsdiv output goes back as a clock source to DISPC.

Remove BUG() statements as they don't do much here.

Signed-off-by: Archit Taneja <archit@ti.com>
omapdss: DSI: Remove unneeded DSI PLL code

The DSI and DPI drivers now use the PLL library to compute and configure PLL
parameters. Remove the redundant code path which was used previously by DSI
and DPI.

The dsi_clock_info struct now contains a pll_params struct, and additional
clock information specific to DSI(LP clock info).

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: FEATURES: Remove DSI PLL related features and params

DSI PLL related features, register fields, and parameter ranges are now managed
by the PLL library internally. Remove the redundant code.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: PLL: Add pll ops

PLL parameter computation and configuration is generally independent of the IP
in which the PLL belongs to. But power and clock control of the PLL is managed
by the DSI protocol engine, and HDMI wrapper in DSI and HDMI respectively.

In order to make the DPI driver completely independent of DSI, we need to add
ops in the PLL library which the DSI(or HDMI) driver populates. These ops will
performs the power, clock and regulator management related operations managed
by the parent IP.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DSI: Add PLL ops

Add DSI PLL library ops which can enable and disable the DSI PLLs. These ops
abstract away integration specific details between DSI IP and DSI PLL. These
details involve: enabling/disabling vdda_dsi regulator, configuring PLL power
states through DSI_CLK_CTRL, enabling/disabling SCP clock.

Signed-off-by: Archit Taneja <archit@ti.com>
OMAPDSS: DPI: Simplify driver using PLL ops

The DPI driver currently relies on the DSI platform device to enable/disable the
PLL. With PLL ops, we now only require a pll_data pointer to configure the PLL.

This makes the DPI driver independent of DSI functions. dpi_get_dsidev() is
replaced by dpi_get_pll_data(). dpi_init_pll() is now independent of dsi
specific code. A few of the DSI functions used by DPI can now be made static.

Signed-off-by: Archit Taneja <archit@ti.com>