freebsd-dev/share/man/man4/isl.4
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

126 lines
3.6 KiB
Groff

.\" Copyright (c) 2015 Michael Gmelin <freebsd@grem.de>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd October 03, 2016
.Dt ISL 4
.Os
.Sh NAME
.Nm isl
.Nd Intersil(TM) I2C ISL29018 sensor driver
.Sh SYNOPSIS
To compile this driver into the kernel, place the following lines into
the kernel configuration file:
.Bd -ragged -offset indent
.Cd "device isl"
.Cd "device ig4"
.Cd "device iicbus"
.Ed
.Pp
Alternatively, to load the driver as a module at boot time, place the following line in
.Xr loader.conf 5 :
.Bd -literal -offset indent
isl_load="YES"
ig4_load="YES"
.Ed
.Pp
In
.Pa /boot/device.hints :
.Cd hint.isl.0.at="iicbus0"
.Cd hint.isl.0.addr="0x88"
.Cd hint.isl.1.at="iicbus1"
.Cd hint.isl.1.addr="0x88"
.Sh DESCRIPTION
The
.Nm
driver provides access to sensor data provided by the Intersil(TM) I2C
ISL29018 Digital Ambient Light Sensor and Proximity Sensor with Interrupt
Function.
Functionality is basic and provided through the
.Xr sysctl 8
interface.
.Pp
On a system using
.Xr device.hints 5 ,
these values are configurable for
.Nm :
.Bl -tag -width "hint.isl.%d.addr"
.It Va hint.isl.%d.at
target
.Xr iicbus 4 .
.It Va hint.isl.%d.addr
.Nm
i2c address on the
.Xr iicbus 4 .
.El
.Sh SYSCTL VARIABLES
The following
.Xr sysctl 8
variables are available:
.Bl -tag -width "dev.isl.X.resolution"
.It Va dev.isl.X.als
Current ALS (Ambient Light Sensor) readout.
.It Va dev.isl.X.ir
Current IR (InfraRed) sensor readout.
.It Va dev.isl.X.prox
Current proximity sensor readout.
.It Va dev.isl.X.resolution
Current sensor resolution.
.It Va dev.isl.X.range
Current sensor range.
.El
.Sh EXAMPLES
.Ss Ambient light sensor read out
.Bd -literal
$ sysctl dev.isl.0.als
dev.isl.0.als: 64
.Ed
.Ss Automatically adjust brightness
This requires the port
.Pa graphics/intel-backlight
and only works with laptops using a supported Intel(R) GPU.
.Bd -literal
$ pkg install intel-backlight
$ sh /usr/local/share/examples/intel-backlight/isl_backlight.sh
.Ed
.Sh SEE ALSO
.Xr ig4 4 ,
.Xr iicbus 4
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Michael Gmelin Aq Mt freebsd@grem.de .
.Pp
This manual page was written by
.An Michael Gmelin Aq Mt freebsd@grem.de .
.Sh BUGS
The
.Nm
driver detects the device based from the I2C address.
This might have unforeseen consequences if the initialization sequence
is sent to an unknown device at that address.