Commit Graph

71 Commits (ef993ef8dcd4f3e4d058400c5bd2f7c547344e74)

Author SHA1 Message Date
Florian Tobias Schandinat f33f6f0ccc Merge branch 'viafb-pll' into viafb-next
Conflicts:
	drivers/video/via/viamode.c

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-04-24 13:18:48 +00:00
Florian Tobias Schandinat 75ec72f8c5 Merge branch 'viafb-cleanup' into viafb-next 2011-04-24 13:17:09 +00:00
Florian Tobias Schandinat 2946294f9a viafb: add X server compatibility mode
This patch adds a config option to be compatible with X servers like
OpenChrome. This is required as for example the X server does not
handle things like disabled IGAs/PLLs resulting in a potential
freeze on X startup. With this option disabled we can provide some
nice features like power management and not reinitializing the
hardware on every mode switch (taking long time, causing flickering).

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-04-23 23:52:45 +00:00
Florian Tobias Schandinat c5a4e6d725 viafb: reduce OLPC refresh a bit
When allowing some PLL calculation we get a frequency that seems to
be a bit higher than what the OLPC DCON likes resulting in a still
readable but not so good image. We don't really know whether this is
a problem with the calculation formula or the OLPC but as other
displays seem to be happy with the other modes adjusting the OLPC
refresh looks like the better thing. This patch prevents a
regression when dynamic PLL calculation is allowed.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-04-23 22:24:52 +00:00
Florian Tobias Schandinat 32fab7bcc7 viafb: fix OLPC XO 1.5 device connection
This patch fixes the devices connected on OLPC. The OLPC panel seems
to be connected to DVP1 and LVDS2 for some reasons and if not both
are handled correct the display does not work correct or not at all.
This patch prevents regressions on the OLPC where it worked by
accident but would break in future as the driver did not know the
correct devices connected. This might also fix hardware scaling.
Hopefully the OLPC is the only device with such a requirement but it
will be certainly better to actually know what devices are actually
connected and to not work by accident.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-04-23 22:06:18 +00:00
Florian Tobias Schandinat b4ce6a285b viafb: fix OLPC DCON refresh rate
This patch fixes a regression introduced by
	fd3cc69848b7e1873e5f12bbcdd572b20277ecf3a
	"viafb: remove duplicated clock storage"
caused by an incosistent mode which pretended to have a higher
refresh rate than it actually had. The wrong refresh rate resulted
in a calculated higher pixclock which the OLPC DCON could not handle.
By reducing the refresh rate to 50Hz we get close to the old
pixclock which makes the OLPC display usable again.
Minor other adjustments are needed as 60Hz is assumed to be a safe
value which is not true for OLPC DCON. This is no problem as we only
support 1200x900 on the OLPC.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Reported-by: Daniel Drake <dsd@laptop.org>
2011-04-15 21:35:25 +00:00
Florian Tobias Schandinat 95d517cfce viafb: gather common good, old VGA initialization in one place
This patch moves all unprotected VGA initialization in one table and
provides some documentation for those values.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-26 23:39:07 +00:00
Florian Tobias Schandinat bea02e4587 viafb: add engine clock support
This patch adds support for enabling and configuring the engine on
VIAs IGPs. This is the main clock used for everything but pixel
output.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-26 02:53:21 +00:00
Florian Tobias Schandinat b692a63af8 viafb: add VIA slapping capability
This patch introduces dummy functions to execute when we don't know
what we should do (due to missing documentation). They do nothing
but print a nice message in the log explaining the situation.
To trigger this message initial power management support is
activated which might save a bit energy by disabling PLL and clock
if no device is configured to use them.

Note: The message is only shown for the oldest IGPs CLE266 and K400
      as for the other platforms there are reasonable assumptions
      how it does (hopefully) work.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-24 21:17:52 +00:00
Florian Tobias Schandinat 2c536f84c1 viafb: split clock and PLL code to an extra file
This patch is a huge move operation with some rename and introduces
an interface to still use the functions. This should be a step in
the right direction to reuse the code whenever possible but cleanly
separate code that differs on different platform and keeping the
complexity as low as possible.
pll_config was renamed to via_pll_config to keep the naming scheme.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-24 13:30:09 +00:00
Florian Tobias Schandinat c5593d26ae viafb: add primary/secondary clock on/off switches
This patch adds functions to enable/disable the display clocks.
It also fixes a tiny bug that slipped in with a previous commit but
could not yet have caused any problems.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-24 02:03:42 +00:00
Florian Tobias Schandinat 6c1093af58 viafb: add clock source selection and PLL power management support
This patch adds some support for clock source selection as well as
PLL power management. The code is unused at the moment but was
successfully tested as far as possible.
The implementation is according to the documentation for VX700,
VX800, VX855, VX900. Probably the source selection works like this
starting with K800 and the power managemennt at least since VX700.
(guessed based on the initialization in viamode.c)

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-23 21:11:46 +00:00
Florian Tobias Schandinat 0f77d4a052 viafb: prepare for PLL separation
This patch splits some functionality to extra functions.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-23 17:14:26 +00:00
Florian Tobias Schandinat 1606f87e98 viafb: call viafb_get_clk_value only in viafb_set_vclock
As no caller is interested in the result call viafb_get_clk_value
directly from viafb_set_vclock to encapsulate the hardware dependend
stuff there.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-23 13:49:32 +00:00
Florian Tobias Schandinat eb0536c5e2 viafb: allow some pll calculations
This patch allows calculating the pll multiplier within limits based
on the previous table. All available information supports that it
should be possible/sane to choose the multiplier free within some
ranges.
Storing the multiplier ranges instead of lots of pll configurations
reduces the memory needed and may as well improve the performance.
It is also expected to provide better pll values resulting in better
frequencies for the connected devices.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-23 13:01:37 +00:00
Florian Tobias Schandinat 0523656eed viafb: kill crt_setting_information
As the iga path is the only remaining information which is also
handled by the active devices there is no reason to keep it.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-21 21:47:22 +00:00
Florian Tobias Schandinat 486d4c08dd viafb: no need to write CRTC values twice
Later the correct values will be written so there is no need to
write early some values which might be wrong.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-21 17:19:26 +00:00
Florian Tobias Schandinat 0f8132b743 viafb: move initialization code
This moves some mode independend initialization code to the function
where the other parts of the initialization are.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-21 17:19:22 +00:00
Florian Tobias Schandinat 726abbc795 viafb: refresh rate bug collection
This patch fixes multiple issues with the handling of refresh rates
especially for multi-display setups. If you experienced problems
with wrong refresh rates this patch might fix them.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-16 21:42:00 +00:00
Florian Tobias Schandinat 2563afa9ec Merge branch 'viafb-pll' into viafb-next 2011-03-12 21:54:56 +00:00
Florian Tobias Schandinat e4fcaeff4f viafb: split pll configs up
This patch splits the pll configs up on pll versions. This allows
easy adding of other known good pll values. Additionally it made it
possible to remove invalid configurations resulting in better
behaviour for such cases. The resulting clocks are no longer stored
resulting in some computing overhead on each mode change.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-12 10:26:33 +00:00
Florian Tobias Schandinat fd3cc69848 viafb: remove duplicated clock storage
The clocks can be easily recalculated by the timing and refresh value.
This brings us one step closer to removing VIAs modetable and use
generic ones and being easier extensible.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-12 10:22:06 +00:00
Florian Tobias Schandinat 97597a3977 viafb: always return the best possible clock
Before this patch only clocks that perfectly match were used and if
none existed this was not handled properly. This patch changes this
to always use the closest clock supported. This should behave like
before for clocks that have a perfect match but be much saner for
clocks which are slightly off.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-12 10:22:00 +00:00
Florian Tobias Schandinat f5b1c4b3b6 viafb: remove duplicated clock information
This patch removes the direct lookup table for resolution+refresh and
pixclock by calculating this information from the mode table. Removes a
lot of dupllication and error potential by just doing a little more
calculations on each mode change.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-12 10:21:54 +00:00
Florian Tobias Schandinat bf5ea02d90 viafb: factor lcd scaling parameters out
These parameters are the same for all currently known VIA IGPs so it
does not make any sense to store them with IGP specific data. This
saves a few bytes and helps a bit in dicovering the real differences.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-09 18:58:35 +00:00
Florian Tobias Schandinat d90108765b viafb: strip some structures
This patch removes some write-only variables from the device management
structures. Just a small cleanup.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-09 18:58:30 +00:00
Stephen Hemminger 23e5abd555 video via: make local variables static
Many local variables should be declared static.
Found by sparse, compile tested only.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-09 17:06:29 +00:00
Florian Tobias Schandinat 51f4332bb5 viafb: add initial VX900 support
This patch adds basic support for the new VX900 IGP. Almost everything
that was implemented for other IGPs is expected to work also on VX900
after this patch. The only known issue is that on the CRT output mode
setting does not always work.
It is clear that the possibility for regressions is zero.

A big thanks to VIA Technologies for making this possible and
supporting this work.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Jonathan Corbet <corbet@lwn.net>
2010-10-24 13:04:55 +00:00
Florian Tobias Schandinat a2aa9f9f5a viafb: rename output devices
Now it looks like we finally know enough about the output devices to give
them proper names. As VIA_96 is often referred to as DVP0 rename it to
VIA_DVP0. As VIA_6C and VIA_93 seem to exist only on CLE266 and "replace"
DVP0 and DVP1 there rename them to VIA_LDVP0 and VIA_LDVP1 (L as legacy).
The proc names were changed accordingly which should be harmless as they
were just introduced and not beyond RFC state.
This patch should make things a bit more comfortable and less scary.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-24 02:15:25 +00:00
Florian Tobias Schandinat 2e1abbdd1d viafb: set sync polarity for all output devices
This patch sets the sync polarity for all output devices, not only CRT.
This may give some people a working screen but only if lcd scaling and
centering are not used as it is currently too dificult to propagate a
different resolution (from what the application thinks) to the correct
output device. Hopefully this does not introduce regressions as the
polarity of non-CRT devices was completly ignored before.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:15:18 +00:00
Florian Tobias Schandinat 7f0e153e2c viafb: add function to change sync polarity per device
At the moment only the sync polarity for CRT is handled but there are
also bits for controlling the sync polarity for other output devices.
Add a function to change those similar to the other output device
functions.
There is no runtime change yet as the code still handles only CRT.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:15:16 +00:00
Florian Tobias Schandinat 6f9422d4e4 viafb: introduce per output device power management
This patch moves common parts of dvi.c, lcd.c and vt1636.c to hw.c to
start a per output device power management. There should be no runtime
changes aside that this patch enables the proc interface to enable/disable
devices when needed which greatly increases the chances that changes to
the output device configuration will work. However the power management is
not yet complete so it might fail on some configurations. As this area is
quite complex and touches undocumented things there is a slight chance of
regressions.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:15:03 +00:00
Florian Tobias Schandinat 2a9183923a viafb: add interface for output device configuration
This patch extends the proc entry to contain a possibility to view and
change the output devices for each IGA. This is useful for debugging
output problems as it provides a reliable way to query which low level
devices are active after VIAs output device configuration nightmare
happended. It's as well suitable for daily use as one can change the
output configuration on the fly for example to connect a projector.
At the moment it's still unstable. The reason is that we have to handle
a bunch of undocumented output devices (those without a proper name) and
that this patch is the first step to collect and verify the needed
information. Basically the only configuration change that is expected to
work at the moment is switching output devices between IGA1 and IGA2.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Cc: Joseph Chan <JosephChan@via.com.tw>
Cc: Andrew Morton <akpm@linux-foundation.org>
2010-09-24 02:14:59 +00:00
Florian Tobias Schandinat cd7e9103e9 viafb: merge the remaining output path with enable functions
This patch merges the remaining functionality of the output path
function in the associated enabling functions. This is very natural as
most of the remaining code does actually enable the device.
Just some more or less intelligent code merge. If no stupid mistakes
occured there should be no regressions.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:58 +00:00
Florian Tobias Schandinat bc68488751 viafb: use new device routing
This patch uses the iga{1,2}_devices variables to select which IGA
should be the source. Doing this is convinient, more powerfull
than the older scheme and easy extendable to support further output
devices. It is not yet completed as the device on/off selection needs
to be converted to the same scheme to take full advantage.
No visible changes yet as we want to complete the transition before
anouncing any unstabke interface.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:52 +00:00
Florian Tobias Schandinat 18d9dc08b2 viafb: add new output device management
This patch adds a new output device management that stores for each
IGA which output devices are routed to it and a compatiblity layer
that converts the old per-output device values in the new format.
Bounding the output devices to each IGA is a central idea of the
cleanup. Doing it this way should be easier and make much more sense
than the old format which happily mixed different output devices
together and did not even take into account that some devices are no
longer available on newer chipsets.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:50 +00:00
Florian Tobias Schandinat 661c65cd0c viafb: reduce viafb_set_iga_path usage
The result of viafb_set_iga_path can change after init only in the
hotplug ioctl. So we can move it there rather than doing it always
when a new mode is set. The setup during init is done via a call
from the init chip funtion.
This change enables a stable mapping between the old device scheme
and a new more powerfull one.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:48 +00:00
Florian Tobias Schandinat f4ab2f7a21 viafb: propagate __init and __devinit
There are a lot of init functions which are not marked as such.
Fix this.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:46 +00:00
Florian Tobias Schandinat a54be174e4 viafb: rework output device routing
This patch rips the device routing out of the 3 main functions to
separate functions to make them available for transition to a better
controlling scheme.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:44 +00:00
Florian Tobias Schandinat b002741d17 viafb: enable second display channel at central place
Move the enabling of the second display channel to the generic
output routing function and do it exactly if something is using it.
This unifies a zoo of variants how to do it and does no longer
disable it if LCD is not on the second display which is much saner
as there can be other users who need it. Probably this did not cause
any problems so far as we only recently started dual fb support and
otherwise there won't be other users and LCD is preferred assigned to
second display channel.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:38 +00:00
Florian Tobias Schandinat 414d3ce1b3 viafb: unify output path configuration
Move all output path routing directly in the viafb_setmode. This
gives a better overview and allows to factor similar parts out.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:36 +00:00
Florian Tobias Schandinat 646aafa649 viafb: remove stub
This is a nop so removing it is safe.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:30 +00:00
Florian Tobias Schandinat e3812ce4ee viafb: reset correct PLL
Looks like we did reset the PLL of the (whatever) engine instead of
the PLL of the secondary display (IGA2, LCDCK). This patch fixes it.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-09-24 02:14:26 +00:00
Florian Tobias Schandinat 1f84435090 viafb: PLL value cleanup
viafb: PLL value cleanup

This is a big change of how PLL values are handled on the road to
dynamic PLL value generation. The table was converted automatically in
the relevant parameters for frequency generation. Sadly there were some
bits set whose meaning is unknown. Those differences are documented
but ignored as the unichrome code implies that they are not important
(a big thanks to Luc for his amazing work).
The PLL values for 31490000 and 133308000 are deleted as they were more
than 5% off and not used anyway. The values for CX700@60466000 and
VX855@153920000 are corrected as they were wrong and easily correctable
as enough correct values was available because CX700 and VX855 support
the same values only with a little difference in hardware format.
All remaining values are not more than 2% off.
Additionally the surrounding code is changed as needed especially the
byte order of the values written to hardware to allow nicer conversion
functions.
This is mostly a change preparing for dynamic PLL generation and the two
corrected values aside no runtime change is expected.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-07-23 14:37:05 +00:00
Florian Tobias Schandinat cc3fd679a3 viafb: simplify lcd size "detection"
viafb: simplify lcd size "detection"

Remove all occurences of get_lcd_size_method as only the values
GET_LCD_SIZE_BY_VGA_BIOS and GET_LCD_SIZE_BY_USER_SETTING were used
which had the identical code so there is no need to make things look
more complicated than they actually are.
Just a bit of of cleanup, really no regressions expected.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Joseph Chan <JosephChan@via.com.tw>
2010-07-23 14:35:50 +00:00
Jonathan Corbet ec66841e49 viafb: move some include files to include/linux
These are the files which should be available to subdevices compiled
outside of drivers/video/via.

Cc: ScottFang@viatech.com.cn
Cc: JosephChan@via.com.tw
Cc: Harald Welte <laforge@gnumonks.org>
Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2010-05-11 16:07:59 -06:00
Florian Tobias Schandinat 162fc8c0c0 viafb: improve misc register handling
viafb: improve misc register handling

This patch improves the misc register handling by adding a modify
function for this to via_io.h and moving expanded definitions of the
relevant ports there. The code was changed to use those to improve
readability.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2010-05-07 17:17:39 -06:00
Florian Tobias Schandinat 384c3041ae viafb: replace inb/outb
viafb: replace inb/outb

This patch replaces occurences of inb/outb with via_write_reg and
via_write_reg_mask where this is possible to improve code
readability.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2010-05-07 17:17:39 -06:00
Florian Tobias Schandinat 100e74a150 viafb: move some modesetting functions to a seperate file
viafb: move some modesetting functions to a seperate file

This patch moves the modesetting functions which are already cleaned up
to a seperate file.
Just the beginning to bring some structure in this mess.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2010-05-07 17:17:38 -06:00
Florian Tobias Schandinat 2749413db1 viafb: unify modesetting functions
viafb: unify modesetting functions

This patch unifies some cleaned up modesetting functions to prepare for
moving them to an extra file. This includes make them use via_io and
changing there names to reflect that they do not depend on anything
framebuffer specific.

Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2010-05-07 17:17:38 -06:00