ssbi.h 726 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (C) 2010 Google, Inc.
  3. * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
  4. * Author: Dima Zavin <[email protected]>
  5. */
  6. #ifndef _LINUX_SSBI_H
  7. #define _LINUX_SSBI_H
  8. #include <linux/types.h>
  9. int ssbi_write(struct device *dev, u16 addr, const u8 *buf, int len);
  10. int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
  11. static inline int
  12. ssbi_reg_read(void *context, unsigned int reg, unsigned int *val)
  13. {
  14. int ret;
  15. u8 v;
  16. ret = ssbi_read(context, reg, &v, 1);
  17. if (!ret)
  18. *val = v;
  19. return ret;
  20. }
  21. static inline int
  22. ssbi_reg_write(void *context, unsigned int reg, unsigned int val)
  23. {
  24. u8 v = val;
  25. return ssbi_write(context, reg, &v, 1);
  26. }
  27. #endif