ARM: mach-shmobile: ap4evb: modify tsc2007 platform settings

This patch modify x_plate_ohms to correct value for tsc2007,
and removed un-necessary ts_get_pendown_state().
gpio_pull_up() was removed also.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh-mobile_hdmi: remove un-necessity settings

Current gamut, acp, isrc1, isrc2 settings are wrong,
and not necessary for now.

Tested-by: Takanari Hayama <taki@igel.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
ARM: mach-shmobile: Extend AP4EVB LCD comments

Extend dip switch comments for QHD and WVGA LCD panels
on AP4EVB. Similar to the Ecovec comments.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
ARM: mach-shmobile: Use evt2irq() for sh7372 DMAC

Use evt2irq() for DMAC resources on sh7372.

This makes the code easier to read and also
allows adjusting the INTC base offset without
breaking platform data.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
ARM: mach-shmobile: pfc-sh7372: modify wrong comment

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
ARM: mach-shmobile: sh7372: modify INTCS table

Add ignored device name by comment-out in INTCS.
And MSIOF which has been forgotten is added

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: use fb_videomode_to_var() instead of open-coding

Use the standard fb_videomode_to_var() instead of filling fb_var_screeninfo
fields manually in, also remove a redundant memset(0).

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: simplify the EDID reading procedure

The present SH-Mobile HDMI driver reads and parses the EDID block into a
variable screeninfo object, but since it is still unable to dynamically
reconfigure the framebuffer, it overwrites the EDID information with preset
values again. This patch just uses a temporary variable to store the EDID
timing information instead.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: fix more error paths

This patch fixes the following two erroneous error paths:

hw_usecnt is allocated with a value of 0, therefore in an early error case,
calling sh_mobile_lcdc_clk_off() will wrongly conclude, that hw_usecnt has
already been incremented. Then sh_mobile_lcdc_runtime_suspend() will be called,
which will access uninitialised data fields and crash the kernel.

sh_mobile_lcdc_stop() can be called before framebuffer has been allocated, then
ch->info is NULL and dereferencing it will Oops too.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: minor simplifications and clean up

Remove an unused variable and simplify several pointer dereferences.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: Support multiple video modes in platform data

This is a preparation for HDMI hotplug support. This patch just moves all
platform defined video modes for the sh_mobile_lcdcfb driver to separate
arrays and switches all users to use element 0 of that array, so, this patch
doesn't introduce any functional changes and as such should not cause any
regressions.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: fix notifier callback return codes

Notifier callbacks have to return either one of NOTIFY_* codes or a negative
errno, converted to a suitable value by the notifier_from_errno() inline, if
the notifier chain shall not be continued.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: allocate memory, sufficient for the biggest mode

Now, that we add support for multiple modes to the sh_mobile_lcdcfb driver, it
has to allocate memory, sufficient for the biggest of them.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: add initial support for modes, other than 720p

To support standard video modes, other than 720p, the HDMI PHY configuration
has to be adjusted and the VIC has to be sent to the display.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: enable "external" mode

The SH-Mobile HDMI controller supports two configuration modes: using
pre-programmed VICs and the "external" mode - specifying video parameters
explicitly. The driver already contains code, necessary to configure HDMI
manually, this patch actually enables it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: implement locking

The SH-Mobile HDMI driver runs in several contexts: ISR, delayed work-queue,
task context, when called from the sh_mobile_lcdc framebuffer driver. This
creates ample race possibilities. Even though most these races are purely
theoretical, it is better to close them. To trace fb_info validity we install a
notification callback in the HDMI driver, and the only way for it to get to
driver internal data is by using struct sh_mobile_lcdc_chan, therefore it had
to be extracted into a separate common header.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_lcdcfb: separate display variable data from framebuffer data

This is a preparation for a patch, that shall allow displaying of a smaller
framebuffer on a bigger display and of a part of a bigger framebuffer on a
smaller display.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: cosmetic improvements

Improve comments, unify function names, replace pr_debug with dev_dbg.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: improve HDMI PHY parameters for high resolutions

High monitor resolutions also require higher clock frequencies, current HDMI
PHY parameters do not work well for resolutions higher than 720p.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
fbdev: sh_mobile_hdmi: support hot-plugging of different HDMI / DVI displays

With this patch hot-plugging of an HDMI or a DVI monitor can select a different
video mode and reconfigure the LCDC and HDMI controllers accordingly. Due to a
lack of a standard API to inform framebuffer users of a changed video mode, the
framebuffer configuration is preserved regardless of a specific mode, selected
for the monitor. As described in a previous patch, this leads to smaller
framebuffers being displayed on larger monitors or a part of a larger
framebuffer being displayed on a smaller resolution monitor.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>