drm/gma500: Add generic code for clock calculation

This patch aims to unify the bits and pieces that are common (or similar
enough) for pll clock calculations. Nothing makes use of this code yet
That will come in later patches.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 5ea75e0f05d03007369f155c6c67541bc4ec309f)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/cdv: Make use of the generic clock code

Add chip specific callbacks for the generic and non-generic clock
calculation code. Also remove as much dupilicated code as possible.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 2adb29ff61c97982addf702d7da106569e217329)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Make use of gma_pipe_has_type()

Replace any use of xxx_intel_pipe_has_type() with the generic
gma_pipe_has_type() function. Poulsbo still use it but that will be
removed when we rip out psb_intel_pipe_has_type().

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit fe477cc1b09ecd957c8c201b4f9c84e9d03621d4)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/psb: Make use of generic clock code

Add chip specific callbacks for the generic and non-generic clock
calculation code. Also remove as much dupilicated code as possible.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 7f67c06721641df12ed68249218d1c2118517f78)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Remove the unused psb_intel_display.h

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit f0e9d89b9b7f3c4b1d21ca2e0d25e3ebe5d2a1d2)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Add generic pipe/crtc functions

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 2eff0b3359c097bbcfe4850dfdf9c94e514ddfee)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/cdv: Use identical generic crtc funcs

This patch makes cdv use the gma_xxx counterparts that are identical. I
took them in one sweep as they should not cause any regressions.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit ad3c46eae3f51b34adea55e0625d255b21ec0a15)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Make all chips use gma_wait_for_vblank

Also remove the duplicated oaktrail function.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit d1fa08f3bacb6fc9a7642c85a4fa8976a3f1afac)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/psb: Use identical generic crtc funcs

This patch makes psb use the gma_xxx counterparts that are identical. I
took them in one sweep as they should not cause any regressions.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 4855177ed0d94621eaf1c6bec64f16318a8be5fe)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/cdv: Convert to gma_pipe_set_base()

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 3c447166536c80209f0dcb300cdffd76686187aa)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Add IS_CDV() macro

This macro is needed for Cedarview specific stuff in the generic gma
functions.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit b8e5ec9f306744e19357580a3cf47452fe64b27a)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/cdv: Convert to gma_crtc_dpms()

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 7ea03f069572fef5701b8be90aed1cfd0b64d76e)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/cdv: Convert to generic gamma funcs

There is a slight difference in how we pick the palette register in the
generic function but we should be ok as long as psb_intel_crtc->pipe and
the register map is sane.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit a1f4efe4416dbd8d58486e60752f3a8145aa84c9)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/psb: Convert to gma_pipe_set_base()

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 00b1fe7445d8a3cd81ba564fba5d15dcbe26f23b)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Convert to generic gamma funcs

This takes care of the remaining chips using the old generic code.
We don't check if the pipe number is valid but the old code peeked in
the register map before checking anyways so just ignore it.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 6443ea1aca56f011432b6ea66ec4cc21a813bb0d)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/psb: Convert to gma_crtc_dpms()

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 42568dd5d3b5bff18d9dbc6f2f2814ed28753ada)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/oak: Use identical generic crtc funcs

Use the generic gma functions instead of the oaktrail functions where
they are identical.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit fe5802957f2856b20a408b8933472a27d00e5f77)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/mdfld: Use identical generic crtc funcs

Use the generic gma functions instead of the medfield functions where
they are identical.

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit d903b610d3a319933caf6ca52c76933b11434ef6)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500/psb: Convert to generic crtc->destroy

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit b1255b884914920f4086448ec4930e814e97afde)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
drm/gma500: Add generic cursor functions

Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
(cherry picked from commit 38945be630a5848ffc75f2f9027cbb211dec3982)
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>