History log of /drivers/gpu/drm/i915/intel_tv.c
Revision Date Author Comments
46790988c91cc239152996c9ed4b4c3dcd2703d8 22-May-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: wait for a vblank to pass after tv detect

commit bf2125e2f7e931b50a6c76ba0435ba001409ccbf upstream.

Otherwise the hw will get confused and result in a black screen.

This regression has been most likely introduce in

commit 974b93315b2213b74a42a87e8a9d4fc8c0dbe90c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sun Sep 5 00:44:20 2010 +0100

drm/i915/tv: Poll for DAC state change

That commit replace the first msleep(20) with a busy-loop, but failed
to keep the 2nd msleep around. Later on we've replaced all these
msleep(20) by proper vblanks.

For reference also see the commit in xf86-video-intel:

commit 1142be53eb8d2ee8a9b60ace5d49f0ba27332275
Author: Jesse Barnes <jbarnes@hobbes.lan>
Date: Mon Jun 9 08:52:59 2008 -0700

Fix TV programming: add vblank wait after TV_CTL writes

Fxies FDO bug #14000; we need to wait for vblank after
writing TV_CTL or following "DPMS on" calls may not actually enable the output.

v2: As suggested by Chris Wilson, add a small comment to ensure that
no one accidentally removes this vblank wait again - there really
seems to be no sane explanation for why we need it, but it is
required.

Launchpad: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/763688
Reported-and-Tested-by: Robert Lowery <rglowery@exemail.com.au>
Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3baa3206a209b224d1265665d6f969fdbd99c08d 22-May-2012 Rodrigo Vivi <rodrigo.vivi@gmail.com> drm/i915: Adding TV Out Missing modes.

commit 9589919fb3d269d4202a112b197468c7db1f97a3 upstream.

These 2 modes were removed by mistake during a clean up.
So, now it is time to add them back. For further info about
supported mode and standard timing table please check:
VOL_3_display_registers_updated.pdf at intellinuxgraphics.org.

Note that this regression has been introduce in

commit 55a6713b3f30a5024056027e9dbf03ac8f13bfc9
Author: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Date: Thu Dec 15 14:47:33 2011 -0200

drm/i915: Removing TV Out modes.

and this commit partially reverts it by re-adding the wrongly removed
modes.

Reported-by: Robert Lowery <rglowery@exemail.com.au>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
[danvet: Pimped commit message to cite the commit that introduced this
regression.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ca9bfa7eed20ea34e862804e62aae10eb159edbb 28-Jan-2012 Daniel Vetter <daniel.vetter@ffwll.ch> drm/i915: fixup interlaced vertical timings confusion, part 1

We have a pretty decent confusion about vertical timings of interlaced
modes. Peter Ross has written a patch that makes interlace modes work
on a lot more platforms/output combinations by doubling the vertical
timings.

The issue with that patch is that core drm _does_ support specifying
whether we want these vertical timings in fields or frames, we just
haven't managed to consistently use this facility. The relavant
function is drm_mode_set_crtcinfo, which fills in the crtc timing
information.

The first thing to note is that the drm core keeps interlaced modes in
frames, but displays modelines in fields. So when the crtc modeset
helper copies over the mode into adjusted_mode it will already contain
vertical timings in half-frames. The result is that the fixup code in
intel_crtc_mode_fixup doesn't actually do anything (in most cases at
least).

Now gen3+ natively supports interlaced modes and wants the vertical
timings in frames. Which is what sdvo already fixes up, at least under
some conditions.

There are a few other place that demand vertical timings in fields
but never actually deal with interlaced modes, so use frame timings
for consistency, too. These are:
- lvds panel,
- dvo encoders - dvo is the only way gen2 could support interlaced
mode, but currently we don't support any encoders that do.
- tv out - despite that the tv dac sends out an interlaced signal it
expects a progressive mode pipe configuration.
All these encoders enforce progressive modes by resetting
interlace_allowed.

Hence we always want crtc vertical timings in frames. Enforce this in
our crtc mode_fixup function and rip out any redudant timing
computations from the encoders' mode_fixup function.

v2-4: Adjust the vertical timings a bit.

v5: Split out the 'subtract-one for interlaced' fixes.

v6: Clarify issues around tv-out and gen2.

Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Christopher Egert <cme3000@gmail.com>
Tested-by: Alfonso Fiore <alfonso.fiore@gmail.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
55a6713b3f30a5024056027e9dbf03ac8f13bfc9 15-Dec-2011 Rodrigo Vivi <rodrigo.vivi@gmail.com> drm/i915: Removing TV Out modes.

These modes are no longer needed or are not according to TV timing standards.

Intel PRM Vol 3 - Display Registers Updated -
Section 5 TV-Out Programming /
5.2.1 Television Standards /
5.2.1.1 Timing tables

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
23bd15ec662344dc10e9918fdd0dbc58bc71526d 15-Dec-2011 Rodrigo Vivi <rodrigo.vivi@gmail.com> drm/i915: Fix TV Out refresh rate.

TV Out refresh rate was half of the specification for almost all modes.
Due to this reason pixel clock was so low for some modes causing flickering screen.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
0206e353a0416ad63ce07f53c807c2c725633b87 16-Aug-2011 Akshay Joshi <me@akshayjoshi.com> Drivers: i915: Fix all space related issues.

Various issues involved with the space character were generating
warnings in the checkpatch.pl file. This patch removes most of those
warnings.

Signed-off-by: Akshay Joshi <me@akshayjoshi.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2bf71160f94270319eb965935045f825ec446e8a 13-May-2011 Keith Packard <keithp@keithp.com> drm/i915: TVDAC_STATE_CHG does not indicate successful load-detect

Do not use this bit to indicate that load detection has completed,
instead just wait for vblank, at which point the load registers will
have been updated.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Yi Sun <yi.sun@intel.com>
835bff7ef220f9d7df94970557a6a2296f74106f 13-May-2011 Keith Packard <keithp@keithp.com> drm/i915: Select correct pipe during TV detect

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Yi Sun <yi.sun@intel.com>
8261b19173b89d86cc3088483595e2879e4976d6 20-Apr-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Don't store temporary load-detect variables in the generic encoder

Keep all the state required for undoing and restoring the previous pipe
configuration together in a single struct passed from
intel_get_load_detect_pipe() to intel_release_load_detect_pipe() rather
than stuffing them inside the common encoder structure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
7173188d5d5e50b95c588dbae3b3bc78fde4138e 20-Apr-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Simplify return value from intel_get_load_detect_pipe

... and so remove the confusion as to whether to use the returned crtc
or intel_encoder->base.crtc with the subsequent load-detection. Even
though they were the same, the two instances of load-detection code
disagreed over which was the more correct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
ccacfec6cc22157971bd970486fd3fd4972b8e2e 12-Apr-2011 Sitsofe Wheeler <sitsofe@yahoo.com> drm/i915/tv: Fix modeset flickering introduced in 7f58aabc3

The tidy ups in 7f58aabc369014fda3a4a33604ba0a1b63b941ac ("drm/i915:
cleanup per-pipe reg usage") changed intel_crtc->plane to intel_crtc->pipe in
intel_tv_mode_set(). This caused the screen to quickly turn off before
returning whenever modesetting/mode probing took place on my 915GM EeePC
900 creating a flickering effect. This patch changes intel_crtc->pipe back
to intel_crtc->plane which solves the problem for me.

References: https://bugs.freedesktop.org/show_bug.cgi?id=35903
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Humbly-acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
89ea42d716e1ee94f643ecdc516d90a4111ec135 12-Apr-2011 Mathew McKernan <matmckernan@rauland.com.au> drm/i915/tv: Only poll for TV connections

As a probe for a TV connection modifies the TV_CTL register, it causes a
loss of sync and a regular glitch on the output. This is highly
undesirable when using the TV, so only poll for TV connections and wait
for an explicit query for detecting the disconnection event.

Reported-by: Mathew McKernan <matmckernan@rauland.com.au>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35977
Signed-off-by: Mathew McKernan <matmckernan@rauland.com.au>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Keith Packard <keithp@keithp.com>
d5627663f2088fa4be447fdcfd52bcb233448d85 12-Apr-2011 Mathew McKernan <matmckernan@rauland.com.au> drm/i915/tv: Remember the detected TV type

During detect() we would probe the connection bits to determine if
there was a TV attached, and what video input type (Component, S-Video,
Composite, etc) to use. However, we promptly discarded this vital bit of
information and never propagated it to where it was used to determine
the correct modes and setup the control registers. Fix it!

This fixes a regression from 7b334fcb45b757ffb093696ca3de1b0c8b4a33f1.

Reported-and-tested-by: Mathew McKernan <matmckernan@rauland.com.au>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35977
Signed-off-by: Mathew McKernan <matmckernan@rauland.com.au>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
8102e126c0827b5336065fd86d3d313b60fde23a 10-Feb-2011 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/tv: Use polling rather than interrupt-based hotplug

The documentation recommends that we should use a polling method for TV
detection as this is more power efficient than the interrupt based
mechanism (as the encoder can be completely switched off). A secondary
effect is that leaving the hotplug enabled seems to be causing pipe
underruns as reported by Hugh Dickins on his Crestline.

Tested-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[This is a candidate for stable, but needs minor porting to 2.6.37]
9db4a9c7b2a3bd5b4952846bc0c2f58daa80ddd7 07-Feb-2011 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: cleanup per-pipe reg usage

We had some conversions over to the _PIPE macros, but didn't get
everything. So hide the per-pipe regs with an _ (still used in a few
places for legacy) and add a few _PIPE based macros, then make sure
everyone uses them.

[update: remove usage of non-existent no-op macro]
[update 2: keep modesetting suspend/resume code, update to new reg names]
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
[ickle: stylistic cleanups for checkpatch and taste]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
1ec14ad3132702694f2e1a90b30641cf111183b9 04-Dec-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Implement GPU semaphores for inter-ring synchronisation on SNB

The bulk of the change is to convert the growing list of rings into an
array so that the relationship between the rings and the semaphore sync
registers can be easily computed.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
29e1316ab129f2d3a9ea874e7c9a4cb936f43542 22-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/tv: Sleep before checking for state changes.

We need to wait for the PLLs to settle prior to detecting the state
changes. The BIOS writers guide suggests waiting for the next vblank.

Reported-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
a6c45cf013a57e32ddae43dd4ac911eb4a3919fd 17-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: INTEL_INFO->gen supercedes i8xx, i9xx, i965g

Avoid confusion between i965g meaning broadwater and the gen4+ chipset
families.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
930a9e283516a3a3595c0c515113f1b78d07f695 14-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm: Use a nondestructive mode for output detect when polling (v2)

v2: Julien Cristau pointed out that @nondestructive results in
double-negatives and confusion when trying to interpret the parameter,
so use @force instead. Much easier to type as well. ;-)

And fix the miscompilation of vmgfx reported by Sedat Dilek.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
7b334fcb45b757ffb093696ca3de1b0c8b4a33f1 10-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm: Use a nondestructive mode for output detect when polling

Destructive load-detection is very expensive and due to failings
elsewhere can trigger system wide stalls of up to 600ms. A simple
first step to correcting this is not to invoke such an expensive
and destructive load-detection operation automatically.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29536
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=16265
Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
5eddb70ba2b8cdbbdd563f5cb04e26fdc9b017f7 11-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Use macros to switch between equivalent pipe registers

The purpose is to make the code much easier to read and therefore reduce
the possibility for bugs.

A side effect is that it also makes it much easier for the compiler,
reducing the object size by 4k -- from just a few functions!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
df0e924883d029a8651a2a0c7b8da67a07611ed2 09-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Make the connector->encoder relationship explicit

Currently we have a exact mapping of a connector onto an encoder for its
whole lifetime. Make this an explicit property of the structure and so
simplify the code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
4ef69c7a64b78d477d1666eba258ca049e8bac91 09-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Rename intel_encoder->enc to base for consistency

[Patch is slightly larger than is strictly necessary to fixup
surrounding checkpatch.pl errors.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
b7ac36dadafa69214faa75a34844d56bd0c14e89 24-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/tv: After disabling the pipe, use wait_for_vblank_off()

Hopefully this is a contributing factor to the spurious TV detection
repoted by Ivan Bulatovic and others.

References:

Bug 16871 - "TV1 connected" with no tv
https://bugzilla.kernel.org/show_bug.cgi?id=16871

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reported-by: Ivan Bulatovic <combuster@gmx.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
763a4a019105dccdcd44883f1712571ae8ea8f1f 05-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/tv: Mark the format names as constant and so avoid the memleak

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
974b93315b2213b74a42a87e8a9d4fc8c0dbe90c 05-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/tv: Poll for DAC state change

Instead of sleeping for an arbitrary length of time (the documentation
fails to specify how long to wait for) wait until the load detection has
changed state (or at most the 20ms as before).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
b8ed2a4f12870bf2ea9c07ff83ccd9d8b6abc2c6 05-Sep-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915/tv: Preserve reserved DAC bits during mode-setting

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
4f233eff6f32745f8894eb513bc59851213c7833 04-Sep-2010 Pekka Enberg <penberg@kernel.org> i915: Fix spurious TV detection after 9d0498a2bf + 9559fcdbff

Partial revert of 9d0498a2bf.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Tested-by: Hugh Dickins <hughd@google.com>
Tested-by: Sven Joachim <svenjoac@gmx.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
9d0498a2bf7455159b317f19531a3e5db2ecc9c4 18-Aug-2010 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: wait for actual vblank, not just 20ms

Waiting for a hard coded 20ms isn't always enough to make sure a vblank
period has actually occurred, so add code to make sure we really have
passed through a vblank period (or that the pipe is off when disabling).

This prevents problems with mode setting and link training, and seems to
fix a bug like https://bugs.freedesktop.org/show_bug.cgi?id=29278, but
on an HP 8440p instead. Hopefully also fixes
https://bugs.freedesktop.org/show_bug.cgi?id=29141.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
ea5b213ad4b161463e76b63dbb115ea20e2200f0 04-Aug-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Subclass intel_encoder.

Subclass intel_encoder to reduce the pointer dance through
intel_encoder->dev_priv.

10 files changed, 896 insertions(+), 997 deletions(-)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
2991196fbc19f68206eb81694e9ef338366ebc53 23-Jun-2010 Dan Carpenter <error27@gmail.com> drm/i915: cleanup: use ARRAY_SIZE()

NUM_TV_MODES is the same as ARRAY_SIZE(tv_modes). In the end, I
decided it was cleaner to remove NUM_TV_MODES and just use
ARRAY_SIZE(tv_modes) through out.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
3ca87e82831f040986f27aef44fc61c8ddf6ee79 06-Jun-2010 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Sparse warning about invalid value for burst_ena in tv_modes

drivers/gpu/drm/i915/intel_tv.c|479 col 16| warning: cast truncates bits
from constant value (8 becomes 0)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>
04ad327f277ec3bc3c05f5a5c19d58600882d38e 28-Jun-2010 Kulikov Vasiliy <segooon@gmail.com> drm: i915: use ARRAY_SIZE

Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
d4b74bf07873da2e94219a7b67a334fc1c3ce649 20-Apr-2010 Dave Airlie <airlied@redhat.com> Revert "drm/i915: Configure the TV sense state correctly on GM45 to make TV detection reliable"

Eric mentioned on irc this patch was bad, so revert it.

This reverts commit fb8b5a39b6310379d7b54c0c7113703a8eaf4a57.

Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
0c41ee2be6fff0fb3c933fc0ecfdfbce485620f0 29-Mar-2010 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: convert TV driver to new encoder/connector structure

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
6443170f6d862a1cc89e61e4bb2410b714b875f4 03-Apr-2010 Eric Anholt <eric@anholt.net> drm/i915: Remove dead KMS encoder save/restore code.

This was brought over from UMS, and used for a while until we decided
that drm_helper_resume_force_mode was easier and more reliable, since
it didn't require duplicating all the code deleted here. We just
forgot to delete all that junk for a while.
c1c43977e6fc789cbde094303fa9ace629a35aca 30-Mar-2010 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: passing drm connector param for load detection

In load detection, connector's encoder assignment must be kept
consistent for proper mode setting, and this makes connector as
explicit parameter for load detect function to not require single
data structure to hold both encoder and connector reference, ease
the transition for splitted encoder/connector model.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
fb8b5a39b6310379d7b54c0c7113703a8eaf4a57 07-Apr-2010 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Configure the TV sense state correctly on GM45 to make TV detection reliable

The TV detection logic is not reliable on the Cantiga platform.
Sometimes the TV will be misdetected as the following two cases:
- TV is misdetected on some laptops. e.g. There is no TV connector
port or no TV is attached. But the TV is shown as connected.
- TV connector type is misdetected. e.g. the component TV is
attached, but the TV is shown as S-video type.

According to the hardware requirement, the TV sense state bits of TV DAC
register should be cleared to zero on Cantiga platfrom.

https://bugzilla.kernel.org/show_bug.cgi?id=14792

Cc: Stable Team <stable@kernel.org>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Tested-by: Santi <santi@agolina.net>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
21d40d37eca86872f2bf0af995809ebdef25c9d9 25-Mar-2010 Eric Anholt <eric@anholt.net> drm/i915: Rename intel_output to intel_encoder.

The intel_output naming is inherited from the UMS code, which had a
structure of screen -> CRTC -> output. The DRM code has an additional
notion of encoder/connector, so the structure is screen -> CRTC ->
encoder -> connector. This is a useful structure for SDVO encoders
which can support multiple connectors (each of which requires
different programming in the one encoder and could be connected to
different CRTCs), or for DVI-I, where multiple encoders feed into the
connector for whether it's used for digital or analog. Most of our
code is encoder-related, so transition it to talking about encoders
before we start trying to distinguish connectors.

This patch is produced by sed s/intel_output/intel_encoder/ over the
driver.

Signed-off-by: Eric Anholt <eric@anholt.net>
8fcc501831aa5b37a4a5a8cd9dc965be3cacc599 28-Dec-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: disable TV hotplug status check

As we removed TV hotplug, don't check its status ever.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
b01f2c3a4a37d09a47ad73ccbb46d554d21cfeb0 11-Dec-2009 Jesse Barnes <jbarnes@virtuousgeek.org> drm/i915: only enable hotplug for detected outputs

This patch changes around our hotplug enable code a bit to only enable
it for ports we actually detect and initialize. This prevents problems
with stuck or spurious interrupts on outputs that aren't actually wired
up, and is generally more correct.

Fixes FDO bug #23183.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
6e36595a2131e7ed5ee2674be54b2713ba7f0490 02-Dec-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Declare the new VBT parsing functions as static

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
c35614380d5c956bfda20eab2755b2f5a7d6f1e7 24-Nov-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Don't set up the TV port if it isn't in the BIOS table.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
d271817baecbccb47da0d9f28c285a0dae8a06b7 27-Nov-2009 Chris Wilson <chris@chris-wilson.co.uk> drm/i915: Avoid NULL dereference with component_only tv_modes

In commit d2d9f2324, the guard for a valid video mode was removed. This
caused the regression:

kernel crash during kms graphic boot on Intel GM4500 platform
https://bugzilla.redhat.com/show_bug.cgi?id=540218

This patches changes the logic slightly not to rely on a coupled
variable, but to just check whether the video_modes is valid before
dereferencing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Zhenyu Wang <zhenyu.z.wang@intel.com>
[ickle: Actually reference the correct bug report]
Acked-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
28c97730c36e06d5ba0c442156eb2154347cc3fe 09-Oct-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Replace DRM_DEBUG with DRM_DEBUG_KMS

Replace the DRM_DEBUG with DRM_DEBUG_KMS in output device code.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
0d0884cee3099ec1271a5d379c39b66de1e31923 29-Sep-2009 Zhao Yakui <yakui.zhao@intel.com> drm/i915: Multiply the refresh by 1000 in TV mode validatiion

As of 559ee21d261a54c42594ef9405d27e9008eedf44 the actual refresh rate
is returned by the function of drm_mode_vrefresh, so multiply the refresh
rate by 1000 in TV mode validation.

At the same time the error is expanded from 10 to 1000.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
7c8460db30dfd085ef3837c8fb02ecf2e718b983 08-Sep-2009 Zhenyu Wang <zhenyuw@linux.intel.com> drm/i915: fix mask bits setting

eDP is exclusive connector too, and add missing crtc_mask
setting for TV.

This fixes

http://bugzilla.kernel.org/show_bug.cgi?id=14139

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Reported-and-tested-by: Carlos R. Mafra <crmafra2@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
213c2e643145fc7d8a67f2d5d54ee0f6d7193e2e 24-Aug-2009 Ma Ling <ling.ma@intel.com> drm/i915: select TV format according to connector type

For integrated TV there are 3 connector types: S-VIDEO, Composite and
Component(YprPb). Those tv formats whose component flag is true should
be assigned to Component connector, others are for S-VIDEO and Composite.
The patch intends to find appropriate tv format for each connector.
In such case it will return the correct modeline to user space. Otherwise
it will return the incorrect modeline when S-video/composite is connected.

Signed-off-by: Ma Ling <ling.ma@intel.com>
reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
f8aed700c6ec46ddade6570004ce25332283b306 24-Aug-2009 Ma Ling <ling.ma@intel.com> drm/i915: Set crtc/clone mask in different output devices

Based on Bspec each encoder has different sharing pipe property,
i.e. Integrated or SDVO TV both will occupy one pipe exclusively,
and sdvo-non-tv and crt are allowed to share one. The patch moves
sharing judgment into differnet output functions, and sets the right
clone bit.

This fixes both HDMI outputs choosing the same pipe.

https://bugs.freedesktop.org/show_bug.cgi?id=22247

Signed-off-by: Ma Ling <ling.ma@intel.com>
Reviewed-by : Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
bcae2ca81c4a085e3e0e8941b7c64f9aeb6fc05c 20-Jul-2009 ling.ma@intel.com <ling.ma@intel.com> drm/i915: Set preferred mode for integrated TV according to TV format

In order to get best possible quality image we chose 640x480 for
NTSC, PAL and 480p, 1280x720 for 720p, 1920x1080 for 1080i/p
TV format respectively.

Signed-off-by: Ma Ling <ling.ma@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
8ed9a5bc9c9425ef93a1b03b418300a5e18b2361 22-Jun-2009 ling.ma@intel.com <ling.ma@intel.com> drm/i915: set TV detection mode when tv is already connected

We used load_detect_temp flag to determine whether to set tv to the test
mode. However if the TV already has a mode set, we still need to set the
test mode to determine connection. This results in blinking, but there is
no other reliable way to determine TV connection.

freedesktop.org bug #22035

Signed-off-by: Ma Ling <ling.ma@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
9a298b2acd771d8a5c0004d8f8e4156c65b11f6b 24-Mar-2009 Eric Anholt <eric@anholt.net> drm: Remove memory debugging infrastructure.

It hasn't been used in ages, and having the user tell your how much
memory is being freed at free time is a recipe for disaster even if it
was ever used.

Signed-off-by: Eric Anholt <eric@anholt.net>
cb66c692d1ae257f32dc7f6085cf9cb9f2f6bab8 31-May-2009 Ma Ling <ling.ma@intel.com> drm/i915: Set correct TV detection voltage level override values

We detect TV connect status by setting DAC voltage level override
values as 0.7 voltage for DAC_A/B/C. The corresponding 2-bits shold be 0x2,
In order correctly to set last bit as 0, at first we must clean it.

It fixed freedesktop.org bug #21204

Signed-off-by: Ma Ling <ling.ma@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
c9fb15f60eb517c958dec64dca9357bf62bf2201 31-May-2009 Keith Packard <keithp@keithp.com> drm: Hook up DPMS property handling in drm_crtc.c. Add drm_helper_connector_dpms.

Making the drm_crtc.c code recognize the DPMS property and invoke the
connector->dpms function doesn't remove any capability from the driver while
reducing code duplication.

That just highlighted the problem with the existing DPMS functions which
could turn off the connector, but failed to turn off any relevant crtcs. The
new drm_helper_connector_dpms function manages all of that, using the
drm_helper-specific crtc and encoder dpms functions, automatically computing
the appropriate DPMS level for each object in the system.

This fixes the current troubles in the i915 driver which left PLLs, pipes
and planes running while in DPMS_OFF mode or even while they were unused.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7d6ff7851c23740c3813bdf457be638381774b69 23-Mar-2009 Zhenyu Wang <zhenyu.z.wang@intel.com> drm/i915: fix TV mode setting in property change

Only set TV DAC in property change seems doesn't work, we have to
setup whole crtc pipe which assigned to TV alone.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
[anholt: Note that this should also fix the oops at startup with new 2D]
Signed-off-by: Eric Anholt <eric@anholt.net>
ebcc8f2eade76946dbb5d5c545b91f8157051aa8 23-Mar-2009 Zhenyu Wang <zhenyu.z.wang@intel.com> drm/i915: only set TV mode when any property changed

If there's no real property change, don't need to set TV mode again.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
[anholt: checkpatch.pl fix]
Signed-off-by: Eric Anholt <eric@anholt.net>
bf5a269a4cc966f783b9faaf3fffd8fa31b53383 04-Mar-2009 Zhenyu Wang <zhenyu.z.wang@intel.com> drm/i915: TV detection fix

Check that the encoder has a real enabled crtc for TV detect, and fix
missing TV type setting after detect.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
d2d9f23240a7ec29a496ee072ffdf69c4f6cdc76 04-Mar-2009 Zhenyu Wang <zhenyu.z.wang@intel.com> drm/i915: TV mode_set sync up with 2D driver

Fix TV control save register for untouched bits, and color
knobs different definition for 945 and 965 chips.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
02c5dd985ddc5407aa9cc7e0f4456ca63b294f16 04-Mar-2009 Zhenyu Wang <zhenyu.z.wang@intel.com> drm/i915: Fix TV get_modes to return modes count

The get_modes hook must return the number of modes added. This also fixes
TV mode's clock calculation int overflow issue, and use 0.01 precision for
mode refresh validation.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
ba01079c71559304771f9d741c9bbe8b2eac22a2 04-Mar-2009 Zhenyu Wang <zhenyu.z.wang@intel.com> drm/i915: TV modes' parameters sync up with 2D driver

This covers at least:
TV: subcarrier fix for NTSC and PAL
TV: fix timing parameters for PAL, 480p, 1080i

Signed-off-by: Zhenyu Wang <zhenyu.z.wang@intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
005568be363b90c9333c3bcbc1e7a53922816322 09-Feb-2009 Tobias Klauser <tklauser@distanz.ch> drm/i915: Storage class should be before const qualifier

The C99 specification states in section 6.11.5:

The placement of a storage-class specifier other than at the beginning
of the declaration specifiers in a declaration is an obsolescent
feature.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
b358d0a6252d8ed16afb20caaec35b24c76074bb 18-Dec-2008 Hannes Eder <hannes@hanneseder.net> drm/i915: fix sparse warnings: make symbols static

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@linux.ie>
79e539453b34e35f39299a899d263b0a1f1670bd 07-Nov-2008 Jesse Barnes <jbarnes@virtuousgeek.org> DRM: i915: add mode setting support

This commit adds i915 driver support for the DRM mode setting APIs.
Currently, VGA, LVDS, SDVO DVI & VGA, TV and DVO LVDS outputs are
supported. HDMI, DisplayPort and additional SDVO output support will
follow.

Support for the mode setting code is controlled by the new 'modeset'
module option. A new config option, CONFIG_DRM_I915_KMS controls the
default behavior, and whether a PCI ID list is built into the module for
use by user level module utilities.

Note that if mode setting is enabled, user level drivers that access
display registers directly or that don't use the kernel graphics memory
manager will likely corrupt kernel graphics memory, disrupt output
configuration (possibly leading to hangs and/or blank displays), and
prevent panic/oops messages from appearing. So use caution when
enabling this code; be sure your user level code supports the new
interfaces.

A new SysRq key, 'g', provides emergency support for switching back to
the kernel's framebuffer console; which is useful for testing.

Co-authors: Dave Airlie <airlied@linux.ie>, Hong Liu <hong.liu@intel.com>

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>