summaryrefslogtreecommitdiff
path: root/drivers/video/via/hw.c
AgeCommit message (Collapse)AuthorFilesLines
2013-01-24viafb: rename display_timing to via_display_timingSteffen Trumtrar1-3/+3
The struct display_timing is specific to the via subsystem. The naming leads to collisions with the new struct display_timing, which is supposed to be a shared struct between different subsystems. To clean this up, prepend the existing struct with the subsystem it is specific to. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
2013-01-03Drivers: video: remove __dev* attributes.Greg Kroah-Hartman1-8/+8
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-13Merge branch 'viafb-next' of git://github.com/schandinat/linux-2.6 into ↵Florian Tobias Schandinat1-75/+55
fbdev-next
2012-03-08viafb: modetable conversionFlorian Tobias Schandinat1-25/+16
This patch converts the modetables used in viafb to - remove the strange thing that sync_end and blanking_end contained the length and not the absolute value - remove hundreds of useless defines - use fb_videomode and not our own definition so modes defined in the subsystem and received via EDID are compatible with ours As the modes are now stored in a flat structure and no longer in a tree like thing the lookup time was increased but as it is a rare event anyway it shouldn't matter. Otherwise the behaviour should be the same as before. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2012-03-04viafb: LCD bpp cleanupFlorian Tobias Schandinat1-14/+2
This patch removes redundant bits per pixel information by using the one storged in var directly. Simplifies code without any functional changes. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2012-02-24viafb: fix IGA1 modesetting on VX900Florian Tobias Schandinat1-0/+3
Even if the documentation calls this bit "Reserved" it has to be set to 0 for correct modesetting on IGA1. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: stable@vger.kernel.org
2012-02-24viafb: select HW scaling on VX900 for IGA2Florian Tobias Schandinat1-0/+1
VX900 can do hardware scaling for both IGAs in contrast to previous hardware which could do it only for IGA2. This patch ensures that we set the parameter for IGA2 and not for IGA1. This fixes hardware scaling on VX900 until we have the infrastructure to support it for both IGAs. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: stable@vger.kernel.org
2012-02-21viafb: Fix bug in centering codeFlorian Tobias Schandinat1-1/+1
Obviously this is a typo and although there were no effects observed it's probably better to fix it. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2012-02-12viafb: make SAMM to also work on LCDFlorian Tobias Schandinat1-16/+11
This patch enables LCD to handle SAMM without dual fb. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2012-02-10viafb: make single framebuffer multiple adapter mode workFlorian Tobias Schandinat1-18/+23
This patch implementes this mode (viafb_SAMM_ON set and viafb_dual_fb not set) in a useful way for CRT and DVI devices. The same content is shown on both devices in different video modes. The first (primary) resolution must not be bigger than the secondary one and determines the visible region. The same content is shown centered on the secondary output. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2012-02-10viafb: fill xres and yresFlorian Tobias Schandinat1-1/+2
This patch fills xres and yres in var which is required when a temporary var is genereated when viafb_SAMM_ON is set and viafb_dual_fb is not set. It also removes an obsolete comment. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2012-02-10viafb: set correct polarity for second adapterFlorian Tobias Schandinat1-7/+7
This patch sets the correct polarity for the second adapter when viafb_SAMM_ON is set and viafb_dual_fb is not set. Just one step to make this mode useful. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-07viafb: get rid of the remaining modetable structure assumptionsFlorian Tobias Schandinat1-16/+7
This patch removes the remaining places where assumptions about the structure of the modetable were made. Aside from some places where assumptions are made that certain modes are in the modetable the only code dealing with the modetable and not just a single mode is in viamode. This will allow chaniging the modetable and use other sources for videomodes like the subsystem or EDID. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-07viafb: eliminate modetable dependancy of LCD modesettingFlorian Tobias Schandinat1-12/+8
This patch removes the need for knowing the modetable structure within the LCD modesetting function. The magic 60Hz refresh rate was already there as always the first entry for a resolution was choosen based on the ascending refresh rate ordering in the modetable. For all but one this is at least 60Hz, if only higher frequencies available we choose those like the code before did. The exception is OLPC but that resolution has only one frequency so we get the same behaviour there as well. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-07viafb: seperate hardware initializationFlorian Tobias Schandinat1-20/+28
This patch splits the hardware initialization out of the modesetting function which will make it easier to make it conditional and not require starting from scratch for every mode change, which is especially annoying in dual framebuffer mode. This required some minor reordering but it should not influence its functionality. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-07viafb: use information in var for modesettingFlorian Tobias Schandinat1-59/+48
This patch starts to use the information in var for modesetting for CRT and DVI devices. This is the right thing as it allows us to use more generic modes than the ones predefined by VIA. We do not yet allow more generic modes as check_var still limits them to the predefined ones but with this patch applied it would be really easy to do so. A problem was VIAs SAMM mode as it has 2 different modes but just one frame buffer device. This is solved by creating a pseudo var which contains enough information to use it for modesetting. Hopefully one day we can use information in var for all modes that do not involve hardware scaling. Well I'd like to say that the chance of regressions is low but it is quite likely that the behaviour in some cases changed especially when SAMM is involved. I hope we made it better than before in particular the DVI frequency check was probably broken before and hopefully works better now. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-07viafb: eliminate viafb_get_pixclockFlorian Tobias Schandinat1-14/+2
As there is only one user we can just insert the formula where needed. Avoids one lookup in the modetable and viafb_fill_var_timing_info does no longer depend on the modetable. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-06viafb: add new funcions to select a single modeFlorian Tobias Schandinat1-34/+11
This patch introduces 2 new functions for selecting a single mode based on hres, vres and refresh rate and changes some uses to use those. The advantage is that it is less error prone than doing the selection based on refresh rate everywhere and allows replacing the modetable structure. This includes a little change that users may notice: If a refresh rate was given as module parameters but does not exist in the modetable prior to this patch a refresh rate of 60 was assumed and after this patch the closest supported refresh rate to the one provided by the user is used. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-05viafb: remove 640x480-60 CRT special caseFlorian Tobias Schandinat1-14/+0
The timing for 640x480-60 was handled different than all others. This patch changes this by changing the blanking start and end. The reason for this is that I can't find any reason for the old behaviour and it was not consistent anyway as the special case for LCD did not always trigger as the LCD code does not use this function and it did trigger regardless of whether the display set is CRT or LCD but only based whether any DVI/LCD device exists. There are no negative effects observed for CRT or DVI devices. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-05viafb: simplify viafb_fill_crtc_timingFlorian Tobias Schandinat1-6/+6
As the first argument is just part of the structure passed as the second argument there is no need for it at all. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-05viafb: remove superfluous register unlocking/lockingFlorian Tobias Schandinat1-7/+0
The locking is done within the viafb_set_*_timing functions so there is no need to do it here. Move a missing hardware reset into the modesetting function. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-05viafb: kill viafb_load_crtc_timingFlorian Tobias Schandinat1-22/+8
This patch replaces calls to viafb_load_crtc_timing with the code. This should make it easier to fix the oddity that in the modetable the blank and sync end entries contain the length and we need to add the start values to get those to be written to the hardware. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-08-05viafb: use more compact modesetting functionsFlorian Tobias Schandinat1-288/+8
This patch replaces the old timing setup code with a redesigned one. The new code might be slightly faster as it has no conditinals and does not write the same register multiple times. Also it makes the comparison to the documentation easier. Regressions are unlikely but could happen as a lot of hardware is undocumented. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-04-24Merge branch 'viafb-pll' into viafb-nextFlorian Tobias Schandinat1-385/+144
Conflicts: drivers/video/via/viamode.c Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-04-24Merge branch 'viafb-cleanup' into viafb-nextFlorian Tobias Schandinat1-33/+55
2011-04-23viafb: add X server compatibility modeFlorian Tobias Schandinat1-0/+7
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-23viafb: reduce OLPC refresh a bitFlorian Tobias Schandinat1-1/+1
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-23viafb: fix OLPC XO 1.5 device connectionFlorian Tobias Schandinat1-0/+5
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-15viafb: fix OLPC DCON refresh rateFlorian Tobias Schandinat1-2/+6
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-03-26viafb: gather common good, old VGA initialization in one placeFlorian Tobias Schandinat1-12/+37
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-26viafb: add engine clock supportFlorian Tobias Schandinat1-0/+1
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-24viafb: add VIA slapping capabilityFlorian Tobias Schandinat1-0/+19
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-24viafb: split clock and PLL code to an extra fileFlorian Tobias Schandinat1-274/+14
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-24viafb: add primary/secondary clock on/off switchesFlorian Tobias Schandinat1-1/+37
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-23viafb: add clock source selection and PLL power management supportFlorian Tobias Schandinat1-0/+88
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-23viafb: prepare for PLL separationFlorian Tobias Schandinat1-43/+84
This patch splits some functionality to extra functions. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
2011-03-23viafb: call viafb_get_clk_value only in viafb_set_vclockFlorian Tobias Schandinat1-15/+17
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-23viafb: allow some pll calculationsFlorian Tobias Schandinat1-276/+101
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-21viafb: kill crt_setting_informationFlorian Tobias Schandinat1-15/+13
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-21viafb: no need to write CRTC values twiceFlorian Tobias Schandinat1-3/+0
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-21viafb: move initialization codeFlorian Tobias Schandinat1-5/+7
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-16viafb: refresh rate bug collectionFlorian Tobias Schandinat1-10/+7
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-12Merge branch 'viafb-pll' into viafb-nextFlorian Tobias Schandinat1-390/+350
2011-03-12viafb: split pll configs upFlorian Tobias Schandinat1-347/+301
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-12viafb: remove duplicated clock storageFlorian Tobias Schandinat1-2/+4
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-12viafb: always return the best possible clockFlorian Tobias Schandinat1-32/+28
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-12viafb: remove duplicated clock informationFlorian Tobias Schandinat1-21/+29
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-09viafb: factor lcd scaling parameters outFlorian Tobias Schandinat1-0/+19
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-09viafb: strip some structuresFlorian Tobias Schandinat1-11/+0
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-09video via: make local variables staticStephen Hemminger1-1/+1
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>