1

Is there a good example device-tree-aware i2c gpio driver for Linux?

I've been looking at gpio-pcf857x but it has a header file containing struct pcf857x_platform_data which is used in board files.

I am looking for a similar example, but where the i2c id is defined-in/retrieved-from the device tree.

fadedbee
  • 42,671
  • 44
  • 178
  • 308
  • Have you checked other drivers there? gpio-pca953x supports it at least. ID is retrived via compatible strings as far as I know. – 0andriy Apr 22 '17 at 08:44
  • 1
    Take a look at [max732x.c](http://stackoverflow.com/search?q=max732x.c) driver. Corresponding bindings documentation (for driver references you are looking for) is at [Documentation/devicetree/bindings/gpio/](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/gpio?id=refs/tags/v4.11-rc7). – Sam Protsenko Apr 22 '17 at 11:03
  • @SamProtsenko I used the max732.c as a base and it worked well. Make your comment an answer and I'll accept it. – fadedbee May 17 '17 at 09:51
  • 1
    @chrisdew Done. – Sam Protsenko May 17 '17 at 10:19

1 Answers1

1

Take a look at driver (code). As for I2C ID table usage -- see this answer.

Corresponding bindings documentation (for driver references you are looking for) is at Documentation/devicetree/bindings/gpio/.

Community
  • 1
  • 1
Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75