pinctrl-mcp23s08.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* MCP23S08 SPI/I2C GPIO driver */
  3. #include <linux/gpio/driver.h>
  4. #include <linux/irq.h>
  5. #include <linux/mutex.h>
  6. #include <linux/pinctrl/pinctrl.h>
  7. #include <linux/types.h>
  8. /*
  9. * MCP types supported by driver
  10. */
  11. #define MCP_TYPE_S08 1
  12. #define MCP_TYPE_S17 2
  13. #define MCP_TYPE_008 3
  14. #define MCP_TYPE_017 4
  15. #define MCP_TYPE_S18 5
  16. #define MCP_TYPE_018 6
  17. struct device;
  18. struct regmap;
  19. struct pinctrl_dev;
  20. struct mcp23s08 {
  21. u8 addr;
  22. bool irq_active_high;
  23. bool reg_shift;
  24. u16 irq_rise;
  25. u16 irq_fall;
  26. int irq;
  27. bool irq_controller;
  28. int cached_gpio;
  29. /* lock protects regmap access with bypass/cache flags */
  30. struct mutex lock;
  31. struct gpio_chip chip;
  32. struct irq_chip irq_chip;
  33. struct regmap *regmap;
  34. struct device *dev;
  35. struct pinctrl_dev *pctldev;
  36. struct pinctrl_desc pinctrl_desc;
  37. };
  38. extern const struct regmap_config mcp23x08_regmap;
  39. extern const struct regmap_config mcp23x17_regmap;
  40. int mcp23s08_probe_one(struct mcp23s08 *mcp, struct device *dev,
  41. unsigned int addr, unsigned int type, unsigned int base);