summaryrefslogtreecommitdiffstats
path: root/drivers/video/via/via_i2c.c
Commit message (Collapse)AuthorAgeFilesLines
* viafb: fix I2C emulation on GPIO portsFlorian Tobias Schandinat2012-02-121-2/+8
| | | | | | | | This patch fixes the I2C emulation on GPIO ports by enabling it (software controlled) and disabling the output on a GPIO line before reading it. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
* video via: make local variables staticStephen Hemminger2011-03-091-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>
* video/via: drop deprecated (and unused) i2c_adapter.idPeter Huewe2011-03-021-1/+0Star
| | | | | | | | | | This patch removes an assignment to the deprecated i2c_adapter.id field. Since the field isn't used anywhere else in the driver it is save to remove it. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
* viafb: reduce I2C timeout and delayFlorian Tobias Schandinat2010-09-241-2/+2
| | | | | | | | | | | | | | | This patch reduces the value for I2C timeout and udelay. The udelay was reduced to 10 (old: 40) which is still very high as for standard-mode I2C even 5 should work. This gives a speedup of factor 4 when talking to I2C devices. The timeout was reduced to 2 (old: 20) which is taken from the radeon driver so it should work as well. This gives a speedup of factor 10 when detecting that there is no I2C device we want to talk to. This causes a huge improvement of device initialization time. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw>
* viafb: fix i2c_transfer error handlingFlorian Tobias Schandinat2010-09-241-3/+24
| | | | | | | | | | | | | | | | | | | i2c_transfer returns negative errno on error and number of messages processed on success. Just returning this value would give a poor interface as it is not obvious that you must compare with 2 after reading 1 or n bytes and with 1 after writing 1 byte to determine if it was successful. To avoid this error prone interface convert the error code of a successful read/write to zero and all other non-negative values to an negative error code. This fixes a regression introduced by via: Rationalize vt1636 detection which resulted in no longer detecting a VT1636 chip and therefore has broken the output in configurations which contain this chip. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Acked-by: Jonathan Corbet <corbet@lwn.net> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: stable@kernel.org
* viafb: move some include files to include/linuxJonathan Corbet2010-05-121-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: Eliminate some global.h referencesJonathan Corbet2010-05-121-1/+3
| | | | | | | | | | | The various subdev drivers (other than the framebuffer itself) no longer need this file. 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: get rid of i2c debug cruftJonathan Corbet2010-05-121-4/+2Star
| | | | | | | | | | It's ugly and adds a global.h dependency. 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: Introduce viafb_find_i2c_adapter()Jonathan Corbet2010-05-081-0/+13
| | | | | | | | | | The camera driver will need this to look up a specific adapter. 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>
* via: Do not attempt I/O on inactive I2C adaptersJonathan Corbet2010-05-081-4/+10
| | | | | | | | | | | If an adapter has been configured for GPIO (or off), we should not try to use it as an I2C port. 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: Turn GPIO and i2c into proper platform devicesJonathan Corbet2010-05-081-3/+26
| | | | | | | | | | Another step toward making this thing a real multifunction device driver. 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: Convert GPIO and i2c to the new indexed port opsJonathan Corbet2010-05-081-17/+29
| | | | | | Also add low-level locking to the i2c driver. Signed-off-by: Jonathan Corbet <corbet@lwn.net>
* viafb: Separate global and fb-specific dataJonathan Corbet2010-05-081-0/+2
| | | | | | | | | | | | | | | 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-081-43/+31Star
| | | | | | | | | | | | | 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: Only establish i2c busses on ports that always had themJonathan Corbet2010-04-271-6/+13
| | | | | | | | | ...otherwise it seems we run into conflicts with shadowy other users which don't expect to see i2c taking control of ports it never used to do anything with. Reported-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
* suppress verbose debug messages: change printk() to DEBUG_MSG()Paul Fox2010-04-271-2/+2
| | | | | | | | [jc: no signoff, added my own] 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: rework the I2C support in the VIA framebuffer driverHarald Welte2010-04-271-65/+106
| | | | | | | | | | | | | | | | | | | | 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: improve viafb_parFlorian Tobias Schandinat2009-09-231-32/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch introduces viafb_shared and is the beginning of a smooth transition to use it. viafb_shared should contain all general, non-surface specific data that should be shared along all viafb framebuffers while viafb_par should only contain things that are specific to each surface or in other words extend fb_info. This change is intended to clean the dual/multi framebuffer handling up. This removes the annoyance that viafbinfo1->par points to a different structure than viaparinfo1. As the last change is fundamental it is difficult to ensure that all parts of the driver do not depend on the previous brokenness but the chance of regressions is very low. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Scott Fang <ScottFang@viatech.com.cn> Cc: Joseph Chan <JosephChan@via.com.tw> Cc: Harald Welte <laforge@gnumonks.org> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* viafb: via_i2c.c, via_i2c.h, viamode.c, viamode.hJoseph Chan2008-10-161-0/+177
via_i2c.c, via_i2c.h: Implement i2c specification. viamode.c, viamode.c: all support modes information. Signed-off-by: Joseph Chan <josephchan@via.com.tw> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> 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>