Skip to content

Commit

Permalink
Merge branch 'i2c/for-5.6' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/git/wsa/linux

Pull i2c updates from Wolfram Sang:
 "i2c core:

   - huge improvements and refactorizations of the Linux I2C
     documentation (lots of thanks to Luca for doing it and Jean for the
     careful review)

   - subsystem wide API conversion to i2c_new_client_device()

   - remove obsolete parport-light driver

   - smaller core updates (removal of 'extern', enabling more compile
     testing, use more helper macros)

   - and quite a bunch of driver updates (new IDs, simplifications,
     better PM, support of atomic transfers and other improvements)

  i2c-mux:

   - The main feature is the idle-state rework of the pca954x driver
     from Biwen Li

  at24 driver:

   - minor maintenance: update the license tag, sort headers

   - move support for the write-protect pin into nvmem core

   - add a reference to the new wp-gpios property in nvmem to at25
     bindings

   - add support for regulator and pm_runtime control"

* 'i2c/for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (91 commits)
  i2c: cros-ec-tunnel: Fix ACPI identifier
  i2c: cros-ec-tunnel: Fix slave device enumeration
  i2c: stm32f7: add PM_SLEEP suspend/resume support
  i2c: cadence: Fix wording in i2c-cadence driver
  i2c: cadence: Fix power management order of operations
  i2c: cadence: Fix error printing in case of defer
  i2c: cadence: Handle transfer_size rollover
  i2c: i801: Add support for Intel Comet Lake PCH-V
  docs: i2c: writing-clients: properly name the stop condition
  docs: i2c: i2c-protocol: use same wording as smbus-protocol
  docs: i2c: rename sections so the overall picture is clearer
  docs: i2c: old-module-parameters: use monospace instead of ""
  docs: i2c: old-module-parameters: clarify this is for obsolete kernels
  docs: i2c: old-module-parameters: fix internal hyperlink
  docs: i2c: instantiating-devices: use monospace for sysfs attributes
  docs: i2c: instantiating-devices: rearrange static instatiation
  docs: i2c: instantiating-devices: fix internal hyperlink
  docs: i2c: smbus-protocol: improve I2C Block transactions description
  docs: i2c: smbus-protocol: fix punctuation
  docs: i2c: smbus-protocol: fix typo
  ...
  • Loading branch information
torvalds committed Feb 7, 2020
2 parents ed39ba0 + b49f8e0 commit 11777ee
Show file tree
Hide file tree
Showing 57 changed files with 2,576 additions and 1,106 deletions.
9 changes: 5 additions & 4 deletions Documentation/devicetree/bindings/eeprom/at24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ properties:
over reads to the next slave address. Please consult the manual of
your device.

wp-gpios:
description:
GPIO to which the write-protect pin of the chip is connected.
maxItems: 1
wp-gpios: true

address-width:
allOf:
Expand All @@ -167,6 +164,10 @@ properties:
minimum: 1
maximum: 8

vcc-supply:
description:
phandle of the regulator that provides the supply voltage.

required:
- compatible
- reg
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/eeprom/at25.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Optional properties:
- spi-cpha : SPI shifted clock phase, as per spi-bus bindings.
- spi-cpol : SPI inverse clock polarity, as per spi-bus bindings.
- read-only : this parameter-less property disables writes to the eeprom
- wp-gpios : GPIO to which the write-protect pin of the chip is connected

Obsolete legacy properties can be used in place of "size", "pagesize",
"address-width", and "read-only":
Expand All @@ -36,6 +37,7 @@ Example:
spi-max-frequency = <5000000>;
spi-cpha;
spi-cpol;
wp-gpios = <&gpio1 3 0>;

pagesize = <64>;
size = <32768>;
Expand Down
14 changes: 10 additions & 4 deletions Documentation/devicetree/bindings/i2c/i2c-at91.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
I2C for Atmel platforms

Required properties :
- compatible : Must be "atmel,at91rm9200-i2c", "atmel,at91sam9261-i2c",
"atmel,at91sam9260-i2c", "atmel,at91sam9g20-i2c", "atmel,at91sam9g10-i2c",
"atmel,at91sam9x5-i2c", "atmel,sama5d4-i2c", "atmel,sama5d2-i2c" or
"microchip,sam9x60-i2c"
- compatible : Must be one of:
"atmel,at91rm9200-i2c",
"atmel,at91sam9261-i2c",
"atmel,at91sam9260-i2c",
"atmel,at91sam9g20-i2c",
"atmel,at91sam9g10-i2c",
"atmel,at91sam9x5-i2c",
"atmel,sama5d4-i2c",
"atmel,sama5d2-i2c",
"microchip,sam9x60-i2c".
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: interrupt number to the cpu.
Expand Down
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/i2c/i2c-jz4780.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
* Ingenic JZ4780 I2C Bus controller

Required properties:
- compatible: should be "ingenic,jz4780-i2c"
- compatible: should be one of the following:
- "ingenic,jz4780-i2c" for the JZ4780
- "ingenic,x1000-i2c" for the X1000
- reg: Should contain the address & size of the I2C controller registers.
- interrupts: Should specify the interrupt provided by parent.
- clocks: Should contain a single clock specifier for the JZ4780 I2C clock.
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Required Properties:
Optional Properties:

- reset-gpios: Reference to the GPIO connected to the reset input.
- idle-state: if present, overrides i2c-mux-idle-disconnect,
Please refer to Documentation/devicetree/bindings/mux/mux-controller.txt
- i2c-mux-idle-disconnect: Boolean; if defined, forces mux to disconnect all
children in idle state. This is necessary for example, if there are several
multiplexers on the bus and the devices behind them use same I2C addresses.
Expand Down
3 changes: 2 additions & 1 deletion Documentation/devicetree/bindings/i2c/renesas,i2c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Required properties:
"renesas,i2c-r8a7793" if the device is a part of a R8A7793 SoC.
"renesas,i2c-r8a7794" if the device is a part of a R8A7794 SoC.
"renesas,i2c-r8a7795" if the device is a part of a R8A7795 SoC.
"renesas,i2c-r8a7796" if the device is a part of a R8A7796 SoC.
"renesas,i2c-r8a7796" if the device is a part of a R8A77960 SoC.
"renesas,i2c-r8a77961" if the device is a part of a R8A77961 SoC.
"renesas,i2c-r8a77965" if the device is a part of a R8A77965 SoC.
"renesas,i2c-r8a77970" if the device is a part of a R8A77970 SoC.
"renesas,i2c-r8a77980" if the device is a part of a R8A77980 SoC.
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/i2c/renesas,iic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Required properties:
- "renesas,iic-r8a7794" (R-Car E2)
- "renesas,iic-r8a7795" (R-Car H3)
- "renesas,iic-r8a7796" (R-Car M3-W)
- "renesas,iic-r8a77961" (R-Car M3-W+)
- "renesas,iic-r8a77965" (R-Car M3-N)
- "renesas,iic-r8a77990" (R-Car E3)
- "renesas,iic-sh73a0" (SH-Mobile AG5)
Expand Down
11 changes: 11 additions & 0 deletions Documentation/devicetree/bindings/nvmem/nvmem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ properties:
description:
Mark the provider as read only.

wp-gpios:
description:
GPIO to which the write-protect pin of the chip is connected.
The write-protect GPIO is asserted, when it's driven high
(logical '1') to block the write operation. It's deasserted,
when it's driven low (logical '0') to allow writing.
maxItems: 1

patternProperties:
"^.*@[0-9a-f]+$":
type: object
Expand Down Expand Up @@ -63,9 +71,12 @@ patternProperties:

examples:
- |
#include <dt-bindings/gpio/gpio.h>
qfprom: eeprom@700000 {
#address-cells = <1>;
#size-cells = <1>;
wp-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
/* ... */
Expand Down
24 changes: 0 additions & 24 deletions Documentation/i2c/busses/i2c-parport-light.rst

This file was deleted.

1 change: 0 additions & 1 deletion Documentation/i2c/busses/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ I2C Bus Drivers
i2c-nforce2
i2c-nvidia-gpu
i2c-ocores
i2c-parport-light
i2c-parport
i2c-pca-isa
i2c-piix4
Expand Down
24 changes: 12 additions & 12 deletions Documentation/i2c/dev-interface.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
====================
I2C Device Interface
====================
============================================
Implementing I2C device drivers in userspace
============================================

Usually, i2c devices are controlled by a kernel driver. But it is also
Usually, I2C devices are controlled by a kernel driver. But it is also
possible to access all devices on an adapter from userspace, through
the /dev interface. You need to load module i2c-dev for this.

Each registered i2c adapter gets a number, counting from 0. You can
Each registered I2C adapter gets a number, counting from 0. You can
examine /sys/class/i2c-dev/ to see what number corresponds to which adapter.
Alternatively, you can run "i2cdetect -l" to obtain a formatted list of all
i2c adapters present on your system at a given time. i2cdetect is part of
I2C adapters present on your system at a given time. i2cdetect is part of
the i2c-tools package.

I2C device files are character device files with major device number 89
and a minor device number corresponding to the number assigned as
explained above. They should be called "i2c-%d" (i2c-0, i2c-1, ...,
i2c-10, ...). All 256 minor device numbers are reserved for i2c.
i2c-10, ...). All 256 minor device numbers are reserved for I2C.


C example
=========

So let's say you want to access an i2c adapter from a C program.
So let's say you want to access an I2C adapter from a C program.
First, you need to include these two headers::

#include <linux/i2c-dev.h>
Expand Down Expand Up @@ -66,7 +66,7 @@ the device supports them. Both are illustrated below::
/* Using SMBus commands */
res = i2c_smbus_read_word_data(file, reg);
if (res < 0) {
/* ERROR HANDLING: i2c transaction failed */
/* ERROR HANDLING: I2C transaction failed */
} else {
/* res contains the read word */
}
Expand All @@ -79,12 +79,12 @@ the device supports them. Both are illustrated below::
buf[1] = 0x43;
buf[2] = 0x65;
if (write(file, buf, 3) != 3) {
/* ERROR HANDLING: i2c transaction failed */
/* ERROR HANDLING: I2C transaction failed */
}

/* Using I2C Read, equivalent of i2c_smbus_read_byte(file) */
if (read(file, buf, 1) != 1) {
/* ERROR HANDLING: i2c transaction failed */
/* ERROR HANDLING: I2C transaction failed */
} else {
/* buf[0] contains the read byte */
}
Expand Down Expand Up @@ -144,7 +144,7 @@ The following IOCTLs are defined:
If possible, use the provided ``i2c_smbus_*`` methods described below instead
of issuing direct ioctls.

You can do plain i2c transactions by using read(2) and write(2) calls.
You can do plain I2C transactions by using read(2) and write(2) calls.
You do not need to pass the address byte; instead, set it through
ioctl I2C_SLAVE before you try to access the device.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/i2c/dma-considerations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Linux I2C and DMA
=================

Given that i2c is a low-speed bus, over which the majority of messages
Given that I2C is a low-speed bus, over which the majority of messages
transferred are small, it is not considered a prime user of DMA access. At this
time of writing, only 10% of I2C bus master drivers have DMA support
implemented. And the vast majority of transactions are so small that setting up
Expand Down
45 changes: 23 additions & 22 deletions Documentation/i2c/i2c-protocol.rst
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
============
I2C Protocol
============
================
The I2C Protocol
================

This document describes the i2c protocol. Or will, when it is finished :-)
This document describes the I2C protocol. Or will, when it is finished :-)

Key to symbols
==============

=============== =============================================================
S (1 bit) : Start bit
P (1 bit) : Stop bit
Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) : Accept and reverse accept bit.
Addr (7 bits): I2C 7 bit address. Note that this can be expanded as usual to
S Start condition
P Stop condition
Rd/Wr (1 bit) Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) Acknowledge (ACK) and Not Acknowledge (NACK) bit
Addr (7 bits) I2C 7 bit address. Note that this can be expanded as usual to
get a 10 bit I2C address.
Comm (8 bits): Command byte, a data byte which often selects a register on
Comm (8 bits) Command byte, a data byte which often selects a register on
the device.
Data (8 bits): A plain data byte. Sometimes, I write DataLow, DataHigh
Data (8 bits) A plain data byte. Sometimes, I write DataLow, DataHigh
for 16 bit data.
Count (8 bits): A data byte containing the length of a block operation.
Count (8 bits) A data byte containing the length of a block operation.

[..]: Data sent by I2C device, as opposed to data sent by the
[..] Data sent by I2C device, as opposed to data sent by the
host adapter.
=============== =============================================================


Simple send transaction
=======================

This corresponds to i2c_master_send::
Implemented by i2c_master_send()::

S Addr Wr [A] Data [A] Data [A] ... [A] Data [A] P


Simple receive transaction
==========================

This corresponds to i2c_master_recv::
Implemented by i2c_master_recv()::

S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P


Combined transactions
=====================

This corresponds to i2c_transfer
Implemented by i2c_transfer().

They are just like the above transactions, but instead of a stop bit P
a start bit S is sent and the transaction continues. An example of
a byte read, followed by a byte write::
They are just like the above transactions, but instead of a stop
condition P a start condition S is sent and the transaction continues.
An example of a byte read, followed by a byte write::

S Addr Rd [A] [Data] NA S Addr Wr [A] Data [A] P

Expand All @@ -57,7 +57,7 @@ Modified transactions
=====================

The following modifications to the I2C protocol can also be generated by
setting these flags for i2c messages. With the exception of I2C_M_NOSTART, they
setting these flags for I2C messages. With the exception of I2C_M_NOSTART, they
are usually only needed to work around device issues:

I2C_M_IGNORE_NAK:
Expand All @@ -77,8 +77,9 @@ I2C_M_NOSTART:
S Addr Rd [A] [Data] NA Data [A] P

If you set the I2C_M_NOSTART variable for the first partial message,
we do not generate Addr, but we do generate the startbit S. This will
probably confuse all other clients on your bus, so don't try this.
we do not generate Addr, but we do generate the start condition S.
This will probably confuse all other clients on your bus, so don't
try this.

This is often used to gather transmits from multiple data buffers in
system memory into something that appears as a single transfer to the
Expand Down
Loading

0 comments on commit 11777ee

Please sign in to comment.