abx500.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2007-2009 ST-Ericsson AB
  4. *
  5. * ABX500 core access functions.
  6. * The abx500 interface is used for the Analog Baseband chips.
  7. *
  8. * Author: Mattias Wallin <[email protected]>
  9. * Author: Mattias Nilsson <[email protected]>
  10. * Author: Bengt Jonsson <[email protected]>
  11. * Author: Rickard Andersson <[email protected]>
  12. */
  13. #include <linux/regulator/machine.h>
  14. struct device;
  15. #ifndef MFD_ABX500_H
  16. #define MFD_ABX500_H
  17. /**
  18. * struct abx500_init_setting
  19. * Initial value of the registers for driver to use during setup.
  20. */
  21. struct abx500_init_settings {
  22. u8 bank;
  23. u8 reg;
  24. u8 setting;
  25. };
  26. int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
  27. u8 value);
  28. int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
  29. u8 *value);
  30. int abx500_get_register_page_interruptible(struct device *dev, u8 bank,
  31. u8 first_reg, u8 *regvals, u8 numregs);
  32. int abx500_set_register_page_interruptible(struct device *dev, u8 bank,
  33. u8 first_reg, u8 *regvals, u8 numregs);
  34. /**
  35. * abx500_mask_and_set_register_inerruptible() - Modifies selected bits of a
  36. * target register
  37. *
  38. * @dev: The AB sub device.
  39. * @bank: The i2c bank number.
  40. * @bitmask: The bit mask to use.
  41. * @bitvalues: The new bit values.
  42. *
  43. * Updates the value of an AB register:
  44. * value -> ((value & ~bitmask) | (bitvalues & bitmask))
  45. */
  46. int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
  47. u8 reg, u8 bitmask, u8 bitvalues);
  48. int abx500_get_chip_id(struct device *dev);
  49. int abx500_event_registers_startup_state_get(struct device *dev, u8 *event);
  50. int abx500_startup_irq_enabled(struct device *dev, unsigned int irq);
  51. struct abx500_ops {
  52. int (*get_chip_id) (struct device *);
  53. int (*get_register) (struct device *, u8, u8, u8 *);
  54. int (*set_register) (struct device *, u8, u8, u8);
  55. int (*get_register_page) (struct device *, u8, u8, u8 *, u8);
  56. int (*set_register_page) (struct device *, u8, u8, u8 *, u8);
  57. int (*mask_and_set_register) (struct device *, u8, u8, u8, u8);
  58. int (*event_registers_startup_state_get) (struct device *, u8 *);
  59. int (*startup_irq_enabled) (struct device *, unsigned int);
  60. void (*dump_all_banks) (struct device *);
  61. };
  62. int abx500_register_ops(struct device *core_dev, struct abx500_ops *ops);
  63. void abx500_remove_ops(struct device *dev);
  64. #endif