Commit Graph

19 Commits (d9875690d9b89a866022ff49e3fcea892345ad92)

Author SHA1 Message Date
Florian Tobias Schandinat 2c4c8a8a73 viafb: fix I2C emulation on GPIO ports
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>
2012-02-12 22:15:16 +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
Peter Huewe a625e305ed video/via: drop deprecated (and unused) i2c_adapter.id
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>
2011-03-02 17:11:58 +00:00
Florian Tobias Schandinat e029ab0d02 viafb: reduce I2C timeout and delay
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>
2010-09-24 02:15:14 +00:00
Florian Tobias Schandinat 85c5702ac0 viafb: fix i2c_transfer error handling
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
2010-09-24 02:15:11 +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
Jonathan Corbet 9221fc6556 viafb: Eliminate some global.h references
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>
2010-05-11 16:07:33 -06:00
Jonathan Corbet 4a28ea9ced viafb: get rid of i2c debug cruft
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>
2010-05-11 16:07:06 -06:00
Jonathan Corbet b8f7e5d846 viafb: Introduce viafb_find_i2c_adapter()
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>
2010-05-07 17:17:37 -06:00
Jonathan Corbet b052d7f81f via: Do not attempt I/O on inactive I2C adapters
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>
2010-05-07 17:17:37 -06:00
Jonathan Corbet 7582eb9be8 viafb: Turn GPIO and i2c into proper platform devices
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>
2010-05-07 17:17:37 -06:00
Jonathan Corbet 75b035ace9 viafb: Convert GPIO and i2c to the new indexed port ops
Also add low-level locking to the i2c driver.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2010-05-07 17:16:03 -06:00
Jonathan Corbet 24b4d82e47 viafb: Separate global and fb-specific data
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>
2010-05-07 17:16:02 -06:00
Jonathan Corbet f045f77bc0 viafb: Move core stuff into via-core.c
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>
2010-05-07 17:15:47 -06:00
Jonathan Corbet 4da62e6c6e viafb: Only establish i2c busses on ports that always had them
...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>
2010-04-27 13:01:45 -06:00
Paul Fox c774c13dd2 suppress verbose debug messages: change printk() to DEBUG_MSG()
[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>
2010-04-27 13:01:45 -06:00
Harald Welte 277d32a36c viafb: rework the I2C support in the VIA framebuffer driver
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>
2010-04-27 13:01:45 -06:00
Florian Tobias Schandinat c4df5489e4 viafb: improve viafb_par
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>
2009-09-23 07:39:52 -07:00
Joseph Chan 9f291634aa viafb: via_i2c.c, via_i2c.h, viamode.c, viamode.h
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>
2008-10-16 11:21:42 -07:00