sx150x.h 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Driver for the Semtech SX150x I2C GPIO Expanders
  3. *
  4. * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 and
  8. * only version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA.
  19. */
  20. #ifndef __LINUX_I2C_SX150X_H
  21. #define __LINUX_I2C_SX150X_H
  22. /**
  23. * struct sx150x_platform_data - config data for SX150x driver
  24. * @gpio_base: The index number of the first GPIO assigned to this
  25. * GPIO expander. The expander will create a block of
  26. * consecutively numbered gpios beginning at the given base,
  27. * with the size of the block depending on the model of the
  28. * expander chip.
  29. * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO
  30. * instead of as an oscillator, increasing the size of the
  31. * GP(I)O pool created by this expander by one. The
  32. * output-only GPO pin will be added at the end of the block.
  33. * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor
  34. * for each IO line in the expander. Setting the bit at
  35. * position n will enable the pull-up for the IO at
  36. * the corresponding offset. For chips with fewer than
  37. * 16 IO pins, high-end bits are ignored.
  38. * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down
  39. * resistor for each IO line in the expander. Setting the
  40. * bit at position n will enable the pull-down for the IO at
  41. * the corresponding offset. For chips with fewer than
  42. * 16 IO pins, high-end bits are ignored.
  43. * @io_open_drain_ena: A bit-mask which enables-or disables open-drain
  44. * operation for each IO line in the expander. Setting the
  45. * bit at position n enables open-drain operation for
  46. * the IO at the corresponding offset. Clearing the bit
  47. * enables regular push-pull operation for that IO.
  48. * For chips with fewer than 16 IO pins, high-end bits
  49. * are ignored.
  50. * @io_polarity: A bit-mask which enables polarity inversion for each IO line
  51. * in the expander. Setting the bit at position n inverts
  52. * the polarity of that IO line, while clearing it results
  53. * in normal polarity. For chips with fewer than 16 IO pins,
  54. * high-end bits are ignored.
  55. * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line
  56. * is connected, via which it reports interrupt events
  57. * across all GPIO lines. This must be a real,
  58. * pre-existing IRQ line.
  59. * Setting this value < 0 disables the irq_chip functionality
  60. * of the driver.
  61. * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based
  62. * IRQ lines will appear. Similarly to gpio_base, the expander
  63. * will create a block of irqs beginning at this number.
  64. * This value is ignored if irq_summary is < 0.
  65. * @reset_during_probe: If set to true, the driver will trigger a full
  66. * reset of the chip at the beginning of the probe
  67. * in order to place it in a known state.
  68. */
  69. struct sx150x_platform_data {
  70. unsigned gpio_base;
  71. bool oscio_is_gpo;
  72. u16 io_pullup_ena;
  73. u16 io_pulldn_ena;
  74. u16 io_open_drain_ena;
  75. u16 io_polarity;
  76. int irq_summary;
  77. unsigned irq_base;
  78. bool reset_during_probe;
  79. };
  80. #endif /* __LINUX_I2C_SX150X_H */