Commit Graph

22 Commits

Author SHA1 Message Date
Vladimir Kondratyev
6f6e2de005 ig4(4): Add PCI IDs for Intel Bay Trail I2C controllers.
PR:		245654
Reported by:	<xspbe3ho3p5uac@protonmail.com>
MFC after:	1 week
2020-04-26 20:16:18 +00:00
Vladimir Kondratyev
fdae7d9496 [ig4] Remove unused methods from bus interface
bus_get/set_resource methods are implemented in child device (iicbus).
As their implementation with bus_generic_rl_get/set calls do not
recurse up the tree, the versions in ig4 are never called.

Suggested by:	jhb
2019-12-10 20:23:05 +00:00
Vladimir Kondratyev
81e8183814 [ig4] Add support for CannonLake controllers
They are clocked at 216MHz rate, much higher than previous models.

PR:		240485
Submitted by:	Neel Chauhan <neel@neelc.org>
2019-11-03 21:16:06 +00:00
Vladimir Kondratyev
fceaa2ec31 [ig4] Add generic resource methods to bus interface
That allows ig4 children to allocate IRQs
2019-11-03 21:15:01 +00:00
Vladimir Kondratyev
db7caa2ea7 [ig4] Add suspend/resume support
That is done with re-execution of controller initialization procedure
from resume handler.

PR:		238037
2019-11-03 21:00:55 +00:00
Vladimir Kondratyev
41b24e0917 [ig4] Allow enabling of polled mode from iicbus allocation callback
If controller is allocated with IIC_NOWAIT option ig4 enables polled mode
for a period of allocation that makes possible to start I2C transfers
from the contexts where sleeping is not allowed e.g. from ithreads or
callouts.
2019-11-03 20:53:13 +00:00
Vladimir Kondratyev
984ed3e493 [ig4] Give common name to PCI and ACPI device drivers
They share common device driver code with different bus attachments

This commit starts a bunch of changes which have following properties:

Reviewed by:		imp (previous version)
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D22016
2019-11-03 20:39:46 +00:00
Mark Johnston
e710f8caf5 Catch up with r338948.
MFC with:	r342178
2018-12-17 21:34:09 +00:00
Mark Johnston
c491ffc3fb Revert r336326.
In testing on a Dell Latitude 7480, having ig4.ko loaded during a
suspend caused the system to hang.  It turns out that ig4iic_intr() was
being called after the device entered D3, and entered an infinite loop
because a read of the I2C status register returned all ones, causing us
to attempt to read a byte from the data buffer until one of the status
bits clears.  This occured because ig4iic_pci0 shares an interrupt with
the VGA device on this laptop, so ig4iic_intr() gets called even when
there is no work to do.  This is exactly the problem fixed by r342170,
which resolves the hang for me and allows suspend/resume to work with
ig4.ko loaded.  So, re-enable autoloading of ig4.ko in the hope that
r342170 resolves the problem universally.

Reviewed by:	gonzo
MFC after:	1 month (pending an MFC of r342170)
Differential Revision:	https://reviews.freebsd.org/D18587
2018-12-17 21:13:05 +00:00
Oleksandr Tymoshenko
234afdb9cc [ig4] Fix device description for Kaby Lake systems
Kaby Lake I2C controller is Intel Sunrise Point-H not Intel Sunrise Point-LP.

Submitted by:	Dmitry Luhtionov
Approved by:	re (kib)
2018-09-16 21:44:36 +00:00
Oleksandr Tymoshenko
6fb3c89473 [ig4] Add PCI IDs for I2C controller on Intel Kaby Lake systems
PR:	221777
Approved by:	re (kib)
Submitted by:	marc.priggemeyer@gmail.com
2018-09-13 17:36:55 +00:00
Oleksandr Tymoshenko
158f9d1551 Remove MODULE_PNP_INFO for ig4(4) driver
ig4(4) does not support suspend/resume but present on the hardware where
such functionality is critical, like laptops. Remove PNP info to avoid
breaking suspend/resume on the systems where ig4(4) load is not explicitly
requested by the user.

PR:             229791
Reported by:    Ali Abdallah
2018-07-16 01:34:45 +00:00
Oleksandr Tymoshenko
00b5108bfb ig4(4): add devmatch(8) PNP info
Now that we have all devices ids in a table add MODULE_PNP_INFO macro
to let devmatch autoload module
2018-07-09 20:00:45 +00:00
Oleksandr Tymoshenko
0a043c12be ig4(4): Fix Apollo lake entries platform identifier
Identify Apollo Lake controllers as IG4_APL and not as a IG4_SKYLAKE

Reported by:	rpokala@
2018-07-06 22:01:00 +00:00
Oleksandr Tymoshenko
e6f7f1bce7 ig4(4): add support for Apollo Lake I2C controllers
Add PCI ids for I2C controllers on Apollo Lake platform. Also convert
switch/case probe logic into a table.

Reviewed by:	avg
Differential Revision:	https://reviews.freebsd.org/D16120
2018-07-06 21:22:50 +00:00
Oleksandr Tymoshenko
b3e8ee5d05 [ig4] Add support for i2c controllers on Skylake and Kaby Lake
This was tested by Ben on  HP Chromebook 13 G1 with a
Skylake CPU and Sunrise Point-LP I2C controller and by me on
Minnowboard Turbot with Atom E3826 (formerly Bay Trail)

Submitted by:	Ben Pye <ben@curlybracket.co.uk>
Reviewed by:	gonzo
Obtained from:	DragonflyBSD (a4549657 by Imre Vadász)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D13654
2018-03-06 23:39:43 +00:00
Oleksandr Tymoshenko
5c5bcb1d70 [ig4] Add ACPI platform support for ig4 driver
Add ACPI part for ig4 driver to make it work on Intel BayTrail SoC where
ig4 device is available only through ACPI

Reviewed by:	avg
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8742
2016-12-26 22:13:43 +00:00
Conrad Meyer
00eb880d20 Add Braswell PCI IDs for Intel Cherryview
Submitted by:	Johannes Lundberg <yohanesu75 at gmail.com>
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D8861
2016-12-20 22:08:36 +00:00
Andriy Gapon
e3d255499a ichiic/ig4: completely disengage from smbus
MFC after:	5 weeks
2016-11-02 17:04:00 +00:00
Andriy Gapon
448897d366 add iic interface to ig4 driver, move isl and cyapa to iicbus
Summary:
The hardware does not expose a classic SMBus interface.
Instead it has a lower level interface that can express a far richer
I2C protocol than what smbus offers.  However, the interface does not
provide a way to explicitly generate the I2C stop and start conditions.
It's only possible to request that the stop condition is generated
after transferring the next byte in either direction.  So, at least
one data byte must always be transferred.
Thus, some I2C sequences are impossible to generate, e.g., an equivalent
of smbus quick command (<start>-<slave addr>-<r/w bit>-<stop>).

At the same time isl(4) and cyapa(4) are moved to iicbus and now they use
iicbus_transfer for communication.  Previously they used smbus_trans()
interface that is not defined by the SMBus protocol and was implemented
only by ig4(4).  In fact, that interface was impossible to implement
for the typical SMBus controllers like intpm(4) or ichsmb(4) where
a type of the SMBus command must be programmed.

The plan is to remove smbus_trans() and all its uses.
As an aside, the smbus_trans() method deviates from the standard,
but perhaps backwards, FreeBSD convention of using 8-bit slave
addresses (shifted by 1 bit to the left).  The method expects
7-bit addresses.

There is a user facing consequence of this change.
A user must now provide device hints for isl and cyapa that specify an iicbus to use
and a slave address on it.
On Chromebook hardware where isl and cyapa devices are commonly found
it is also possible to use a new chromebook_platform(4) driver that
automatically configures isl and cyapa devices.  There is no need to
provide the device hints in that case,

Right now smbus(4) driver tries to discover all slaves on the bus.
That is very dangerous.  Fortunately, the probing code uses smbus_trans()
to do its job, so it is really enabled for ig4 only.
The plan is to remove that auto-probing code and smbus_trans().

Tested by:	grembo, Matthias Apitz <guru@unixarea.de> (w/o
		chromebook_platform)
Discussed with:	grembo, imp
Reviewed by:	wblock (docs)
MFC after:	1 month
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D8172
2016-10-30 12:15:33 +00:00
Michael Gmelin
4cd6abddcd Protect smbus ioctls in ig4 driver using a shared lock.
Document locking semantics.

Differential Revision:	https://reviews.freebsd.org/D2744
Reviewed by:	jah, kib
Approved by:	kib
2015-06-25 07:52:51 +00:00
Michael Gmelin
71d51719ea ig4 - Intel fourth gen integrated I2C SMBus driver.
Differential Revision:	https://reviews.freebsd.org/D2372
Reviewed by:	jhb, wblock, adrian
Approved by:	jhb, wblock
Relnotes:	yes
2015-05-30 12:17:18 +00:00