aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/viafbdev.c
Commit message (Collapse)AuthorAgeFilesLines
* viafb: improve pitch handlingFlorian Tobias Schandinat2011-11-111-3/+8
| | | | | | | | | | | | commit 936a3f770b8de7042d793272f008ef1bb08522e9 upstream. This patch adds checks for minimum and maximum pitch size to prevent invalid settings which could otherwise crash the machine. Also the alignment is done in a slightly more readable way. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* viafb: use display information in info not in var for panningFlorian Tobias Schandinat2011-11-111-2/+3
| | | | | | | | | | | | | | | commit d933990c57b498c092ceef591c7c5d69dbfe9f30 upstream. As Laurent pointed out we must not use any information in the passed var besides xoffset, yoffset and vmode as otherwise applications might abuse it. Also use the aligned fix.line_length and not the (possible) unaligned xres_virtual. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Merge branch 'viafb-next' of git://github.com/schandinat/linux-2.6Linus Torvalds2011-05-221-23/+39
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'viafb-next' of git://github.com/schandinat/linux-2.6: (24 commits) viafb: Automatic OLPC XO-1.5 configuration viafb: remove unused CEA mode viafb: try to map less memory in case of failure viafb: use write combining for video ram viafb: add X server compatibility mode viafb: reduce OLPC refresh a bit viafb: fix OLPC XO 1.5 device connection viafb: fix OLPC DCON refresh rate viafb: delete clock and PLL initialization viafb: replace custom return values viafb: some small cleanup for global variables viafb: gather common good, old VGA initialization in one place viafb: add engine clock support viafb: add VIA slapping capability viafb: split clock and PLL code to an extra file viafb: add primary/secondary clock on/off switches viafb: add clock source selection and PLL power management support viafb: prepare for PLL separation viafb: call viafb_get_clk_value only in viafb_set_vclock viafb: remove unused max_hres/vres ...
| * viafb: Automatic OLPC XO-1.5 configurationDaniel Drake2011-05-111-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, a long set of viafb options are needed to get the XO-1.5 laptop to output video (there is only 1 configuration that works, that can't really be autodetected). This patch automatically detects and configures viafb for the XO-1.5 laptop, meaning all that is required for working display is that viafb is loaded. Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
| * viafb: some small cleanup for global variablesFlorian Tobias Schandinat2011-03-271-9/+7
| | | | | | | | | | | | | | | | We do not need viafb_second{,_virtual}_{xres,yres} outside of viafbdev.c so move them there and eliminate the virtual ones where the only sane usage is done during initalization. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
| * viafb: kill crt_setting_informationFlorian Tobias Schandinat2011-03-211-5/+2
| | | | | | | | | | | | | | 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>
* | Merge branch 'fbdev-fixes-for-linus' of ↵Linus Torvalds2011-04-071-36/+38
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6 * 'fbdev-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6: efifb: Add override for 11" Macbook Air 3,1 efifb: Support overriding fields FW tells us with the DMI data. fb: Reduce priority of resource conflict message savagefb: Remove obsolete else clause in savage_setup_i2c_bus savagefb: Set up I2C based on chip family instead of card id savagefb: Replace magic register address with define drivers/video/bfin-lq035q1-fb.c: introduce missing kfree video: s3c-fb: fix checkpatch errors and warning efifb: support AMD Radeon HD 6490 s3fb: fix Virge/GX2 fbcon: Remove unused 'display *p' variable from fb_flashcursor() fbdev: sh_mobile_lcdcfb: fix module lock acquisition fbdev: sh_mobile_lcdcfb: add blanking support viafb: initialize margins correct viafb: refresh rate bug collection sh: mach-ap325rxa: move backlight control code sh: mach-ecovec24: support for main lcd backlight
| * viafb: initialize margins correctFlorian Tobias Schandinat2011-03-211-20/+11
| | | | | | | | | | | | | | | | This patch initializes the margins for the initial mode correct. This is required to get the desired initial refresh rate. Also do more verbose sanity checking to prevent misbehavior. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
| * viafb: refresh rate bug collectionFlorian Tobias Schandinat2011-03-161-17/+28
| | | | | | | | | | | | | | | | 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>
* | Fix common misspellingsLucas De Marchi2011-03-311-1/+1
|/ | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* video via: make local variables staticStephen Hemminger2011-03-091-3/+3
| | | | | | | | 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>
* console: rename acquire/release_console_sem() to console_lock/unlock()Torben Hohn2011-01-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The -rt patches change the console_semaphore to console_mutex. As a result, a quite large chunk of the patches changes all acquire/release_console_sem() to acquire/release_console_mutex() This commit makes things use more neutral function names which dont make implications about the underlying lock. The only real change is the return value of console_trylock which is inverted from try_acquire_console_sem() This patch also paves the way to switching console_sem from a semaphore to a mutex. [akpm@linux-foundation.org: coding-style fixes] [akpm@linux-foundation.org: make console_trylock return 1 on success, per Geert] Signed-off-by: Torben Hohn <torbenh@gmx.de> Cc: Thomas Gleixner <tglx@tglx.de> Cc: Greg KH <gregkh@suse.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: General power management infrastructureDaniel Drake2010-11-091-19/+15
| | | | | | | | | | | | | Multiple devices need S/R hooks (framebuffer, GPIO, camera). Add infrastructure and convert existing framebuffer code to the new model. This patch should create no functional change. Based on earlier work by Jonathan Corbet. Signed-off-by: Daniel Drake <dsd@laptop.org> Acked-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
* viafb: add initial VX900 supportFlorian Tobias Schandinat2010-10-241-2/+4
| | | | | | | | | | | | | | | 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>
* viafb: fix hardware acceleration for suspend & resumeFlorian Tobias Schandinat2010-10-241-1/+3
| | | | | | | | | | | | | This patch splits the acceleration initialization in two parts: The first is only called during probe and is used to allocate resources. The second part is also called on resume to reinitalize the 2D engine. This should fix all acceleration issues after resume most notable an "invisible" cursor and as we do nothing special it is reasonable to assume that it works on all supported IGPs. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: make suspend and resume work (on all machines?)Florian Tobias Schandinat2010-10-241-10/+0
| | | | | | | | | | | | | | This patch removes the dangerous suspend and resume code that was developed for VX855 only. After this the framebuffer is expected to cause no longer serious (freezing) issues on any machines. However the hardware acceleration is broken now so only doing resume with unaccelerated framebuffers is save. This did not work previously as the 2D engine is not mapped if the framebuffer is not accelerated. The acceleration issue will be addressed later. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: restore display on resumeFlorian Tobias Schandinat2010-10-241-0/+3
| | | | | | | | | | | | | This patch makes viafb restore the display on resume by calling viafb_set_par. Resumeing has still its issues: - will probably freeze most machines (for me on VX800 reliable on the second resume) - under some configurations the screen appears on the wrong output device (reason unknown) Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw>
* Minimal support for viafb suspend/resumeDeepak Saxena2010-10-241-0/+46
| | | | | | | | | | | | | | | | | This patch adds minimal support for suspend/resume of the VIA framebuffer device. It requires a version of OFW that restores the video mode. This patch is OLPC-specific as the proper upstream solution is to move the VIA video path to using the kernel modesetting infrastructure and doing a proper save/restore in the kernel. [jc: extensive changes for 2.6.34 merge] Signed-off-by: Deepak Saxena <dsaxena@laptop.org> [fts: viafb_driver moved from viafbdev.c to via-core.c] Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: rename output devicesFlorian Tobias Schandinat2010-09-241-5/+5
| | | | | | | | | | | | | | | 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>
* viafb: add a mapping of supported output devicesFlorian Tobias Schandinat2010-09-241-0/+48
| | | | | | | | | | | | This patch maps supported output devices to IGP versions. This list may contain errors as most of it is derived of the driver source but it should be correct enough to provide a good help. The devices are exported via a proc entry in the same format as those showing the output devices per IGA. 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>
* viafb: introduce per output device power managementFlorian Tobias Schandinat2010-09-241-6/+10
| | | | | | | | | | | | | | 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>
* viafb: add interface for output device configurationFlorian Tobias Schandinat2010-09-241-24/+151
| | | | | | | | | | | | | | | | | | | 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>
* viafb: propagate __init and __devinitFlorian Tobias Schandinat2010-09-241-4/+4
| | | | | | | | 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>
* viafb: fix accel_flags check_var bugFlorian Tobias Schandinat2010-07-231-2/+2
| | | | | | | | | | | | | viafb: fix accel_flags check_var bug In check_var we should check and modify the var given and not the one which is currently active. So this code was obviously wrong. Probably this was doing no harm because all acceleration functions also check whether acceleration is possible. (otherwise I would expect this to lead to a null pointer dereference) Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: probe cleanupsFlorian Tobias Schandinat2010-07-231-24/+3
| | | | | | | | | | viafb: probe cleanups Removal of strange special cases that must not exist as well as a useless check. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: remove ioctls which break the framebuffer interfaceFlorian Tobias Schandinat2010-07-231-251/+0
| | | | | | | | | | | | | | | viafb: remove ioctls which break the framebuffer interface The ioctls VIAFB_SET_DEVICE, VIAFB_SET_DEVICE_INFO and VIAFB_SET_SECOND_MODE are removed because they prevent a clean framebuffer driver because they modify the hardware and/or the internal structures. There are no known applications using these ioctls so no breakage is expected. Additionaly the main functionality was duplicating the framebuffer interface so there really should not exist any user. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: update fix before calculating depthFlorian Tobias Schandinat2010-07-231-1/+1
| | | | | | | | | | | | viafb: update fix before calculating depth As the depth calculation depends on information in fix it is saner to do the update first. No runtime change expected as the value visual in fix used never changes to MONO. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
* drivers/video/via: use memdup_userJulia Lawall2010-05-271-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use memdup_user when user data is immediately copied into the allocated region. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression from,to,size,flag; position p; identifier l1,l2; @@ - to = \(kmalloc@p\|kzalloc@p\)(size,flag); + to = memdup_user(from,size); if ( - to==NULL + IS_ERR(to) || ...) { <+... when != goto l1; - -ENOMEM + PTR_ERR(to) ...+> } - if (copy_from_user(to, from, size) != 0) { - <+... when != goto l2; - -EFAULT - ...+> - } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Merge branch 'viafb-next' of git://git.lwn.net/linux-2.6Linus Torvalds2010-05-201-94/+87
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'viafb-next' of git://git.lwn.net/linux-2.6: (35 commits) viafb: move some include files to include/linux viafb: Eliminate some global.h references viafb: get rid of i2c debug cruft viafb: fold via_io.h into via-core.h viafb: Fix initialization error paths viafb: Do not remove gpiochip under spinlock viafb: make procfs entries optional viafb: fix proc entry removal viafb: improve misc register handling viafb: replace inb/outb viafb: move some modesetting functions to a seperate file viafb: unify modesetting functions viafb: Reserve framebuffer memory for the upcoming camera driver viafb: Add a simple VX855 DMA engine driver viafb: Add a simple interrupt management infrastructure via: Rationalize vt1636 detection viafb: Introduce viafb_find_i2c_adapter() via: Do not attempt I/O on inactive I2C adapters viafb: Turn GPIO and i2c into proper platform devices viafb: Convert GPIO and i2c to the new indexed port ops ...
| * viafb: move some include files to include/linuxJonathan Corbet2010-05-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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>
| * viafb: make procfs entries optionalFlorian Tobias Schandinat2010-05-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | viafb: make procfs entries optional This patch adds a config option to enable procfs entries for direct hardware access. This was the old behaviour but the option defaults to no as this is really ugly and should not be needed if the driver works correct (and if it doesn't, it needs to be fixed). That stuff is really something that should - not be needed at all (the driver should be capable of doing it) - not be there (debugfs would be better for such things) So add this option just for backwards compatiblity. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
| * viafb: fix proc entry removalFlorian Tobias Schandinat2010-05-071-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | viafb: fix proc entry removal Trying to remove unregistered proc entries became painful and is useless anyway. So remove the removal of an entry that was never registered and duplicate the logic for one which is added conditionally. Additionally move the removal above releasing fb_info as we still need the information. This prevents tainting the kernel by the procfs warn on and avoiding access to already freed memory is probably also a good idea. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
| * viafb: unify modesetting functionsFlorian Tobias Schandinat2010-05-071-8/+9
| | | | | | | | | | | | | | | | | | | | | | 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>
| * viafb: Separate global and fb-specific dataJonathan Corbet2010-05-071-31/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves data of interest into a new viafb_dev structure which describes the device as a whole; the idea here is to create a separation between what all devices may need and what the framebuffer device in particular needs. I've also made some small steps toward thinning out the global.h mess. 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>
| * viafb: Move core stuff into via-core.cJonathan Corbet2010-05-071-55/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | The first step toward turning viafb into a multifunction driver. This patch creates a new via-core.c file which serves as the main PCI driver; everything else comes below that. Some work has been done to rationalize the i2c drivers in this new scheme. 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>
| * viafb: rework the I2C support in the VIA framebuffer driverHarald Welte2010-04-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the way how the various I2C busses are used internally inside the viafb driver: Previosuly, only a single i2c_adapter was created, even though two different hardware I2C busses are accessed: A structure member in a global variable was modified to indicate the bus to be used. Now, all existing hardware busses are registered with the i2c core, and the viafb_i2c_{read,write}byte[s]() function take the adapter number as function call parameter, rather than referring to the global structure member. [jc: even more painful merge with mainline changes ->2.6.34] [jc: painful merge with OLPC changes] Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Signed-off-by: Harald Welte <HaraldWelte@viatech.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
| * viafb: Unmap the frame buffer on initialization errorJonathan Corbet2010-04-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | This was part of Harald's "make viafb a first-class citizen using pci_driver" patch, but somehow got dropped when that patch went into mainline. Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Signed-off-by: Jonathan Corbet <corbet@lwn.net>
| * viafb: use proper pci config APIHarald Welte2010-04-201-0/+4
| | | | | | | | | | | | | | | | | | | | This patch alters viafb to use the proper Linux in-kernel API to access PCI configuration space, rather than poking at I/O ports by itself. Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
| * viafb: Fix various resource leaks during module_init()Harald Welte2010-04-201-13/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code executed from module_init() in viafb does not have proper error checking and [partial] resoure release paths in case an error happens half way through driver initialization. This patch adresses the most obvious of those issues, such as a leftover i2c bus if module_init (and thus module load) fails. [jc: fixed merge conflicts] [jc: also restored -ENOMEM return on ioremap() fail] Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: ScottFang@viatech.com.cn Cc: JosephChan@via.com.tw Signed-off-by: Harald Welte <HaraldWelte@viatech.com>
* | include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* viafb: support color depth 15 and 30Florian Tobias Schandinat2010-03-121-18/+25
| | | | | | | | | | | | | | | | | | | | | Add support for the color depth 15 on IGA1 and 30 on IGA1 and IGA2. To allow the usage of those the driver now refuses color depth that are totally off and otherwise the selection in viafb_check_var is used. Therefore the first call to this for the first framebuffer was delayed a bit. It only enables the new formats if they are requested exactly (viafb_bpp=15|30). As this is a new feature, no regressions are expected. The color depth 15 was successfully tested. Didn't get anything usable for 30 but that might be the programs fault. I would like to get some feedback whether it works as expected or not if somebody knows a program/configuration where it should. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: rework color settingFlorian Tobias Schandinat2010-03-121-212/+25
| | | | | | | | | | | | | | | | | | | | | This is a rewritten version of viafb_setcolreg. The hardware register writes were split up and moved to hw.c where they belong as this is really low level stuff. It was made dual fb aware. Furthermore viafb_setcmap was removed as the problem with 8bpp originated from a bug in writing multiple color registers at once. The removal of viafb_setcmap might introduce a small performance regression but its certainly better to receive the correct result a bit slower than a garbled picture fast. It should give us a working 8bpp mode and is more extensible than the old hardcoded code. No other regressions are expected but as the hardware might be a bit picky it might cause some regressions in 8bpp mode on some hardware although I doubt that. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: some virtual_xres handling fixesFlorian Tobias Schandinat2010-03-121-8/+4
| | | | | | | | | | | Do not require the virtual_xres to be aligned as line length is for such purposes. Calculate always the smallest line length required. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: rework color checkingFlorian Tobias Schandinat2010-03-121-5/+56
| | | | | | | | | | | | | | | | | Make color checking a bit more tolerant in what values it allows and more fine grained to later support 15 and 30 bits formats. It splits the filling of the color information in var to a seperate function and sets some color related values in var that where previously untouched. This could be a bug fix but at least I don't know any applications that was fooled by not correctly setting the fields in var. At least no regressions are expected. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Scott Fang <ScottFang@viatech.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: make some variables a bit less globalFlorian Tobias Schandinat2010-03-121-2/+7
| | | | | | | | | | Move some variables closer to their usage. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: introduce strict parameter checkingFlorian Tobias Schandinat2010-03-121-29/+38
| | | | | | | | | | | | Refuse to work if wrong parameters are given. This should improve the user experience as it will be clear that something is wrong and not silently ignored. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: make viafb_set_par more dual framebuffer compatibleFlorian Tobias Schandinat2010-03-121-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is an attempt to make viafb_set_par work correctly with more than one framebuffer. As modesetting is not (yet/easily) possible for each individual IGA it uses the (normally to be avoided) global variables viafbinfo{,1} to ensure that each function is called with the correct values. This patch (finally) allows usable dual framebuffer setups and should not affect non dual fb ones. It works in some (most?) configurations as sometimes the driver still gets device connections wrong. It can be worth to try the devices in reverse order (in viafb_active_dev). The user experience is still not very nice as: - on the second fb you'll normally have a garbled picture as long as no application draws to it goal: auto on/off devices depending on reference counting - as the whole machinery is always done you can see mode changes also in an unaffected framebuffer goal: split modesetting up for each individual IGA Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: video address setting revisitedFlorian Tobias Schandinat2010-03-121-8/+15
| | | | | | | | | | | | | | | | | | | | | Set always the correct video address. Especially do panning right on multiple IGAs. This should have no effect on single monitor mode (no SAMM, no dual fb). For SAMM without dual fb this might break something as I really cannot image what we are supposed to do for different resolutions with a single framebuffer as we can't get data out of nowhere (no, they are not set up in something one would call "expanded"). Previously I got for that funny colored pictures as the second IGA pointed to video memory that was never written to. After the patch it'll work as cloning if the first and second mode are identical (this was working already without SAMM). Finally for dual fb this should push us a step in the right direction. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: reorder initialization for dual framebuffer modeFlorian Tobias Schandinat2010-03-121-3/+3
| | | | | | | | | | | | | | | This patch reorders the initialization for dual framebuffer mode to not ignore the settings for the first mode. Previously they were overwritten with the settings for the second one before they were applied. This should have no effect on non dual framebuffer mode and do what the user intended (initalization to desired modes) in dual framebuffer mode. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: yet another dead code removalFlorian Tobias Schandinat2010-03-121-2/+0
| | | | | | | | | | | Remove some functions that were never executed and a related undocumented module parameter. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>