syscon.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * System Control Driver
  4. *
  5. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  6. * Copyright (C) 2012 Linaro Ltd.
  7. *
  8. * Author: Dong Aisheng <[email protected]>
  9. */
  10. #ifndef __LINUX_MFD_SYSCON_H__
  11. #define __LINUX_MFD_SYSCON_H__
  12. #include <linux/err.h>
  13. #include <linux/errno.h>
  14. struct device_node;
  15. #ifdef CONFIG_MFD_SYSCON
  16. extern struct regmap *device_node_to_regmap(struct device_node *np);
  17. extern struct regmap *syscon_node_to_regmap(struct device_node *np);
  18. extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
  19. extern struct regmap *syscon_regmap_lookup_by_phandle(
  20. struct device_node *np,
  21. const char *property);
  22. extern struct regmap *syscon_regmap_lookup_by_phandle_args(
  23. struct device_node *np,
  24. const char *property,
  25. int arg_count,
  26. unsigned int *out_args);
  27. extern struct regmap *syscon_regmap_lookup_by_phandle_optional(
  28. struct device_node *np,
  29. const char *property);
  30. #else
  31. static inline struct regmap *device_node_to_regmap(struct device_node *np)
  32. {
  33. return ERR_PTR(-ENOTSUPP);
  34. }
  35. static inline struct regmap *syscon_node_to_regmap(struct device_node *np)
  36. {
  37. return ERR_PTR(-ENOTSUPP);
  38. }
  39. static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s)
  40. {
  41. return ERR_PTR(-ENOTSUPP);
  42. }
  43. static inline struct regmap *syscon_regmap_lookup_by_phandle(
  44. struct device_node *np,
  45. const char *property)
  46. {
  47. return ERR_PTR(-ENOTSUPP);
  48. }
  49. static inline struct regmap *syscon_regmap_lookup_by_phandle_args(
  50. struct device_node *np,
  51. const char *property,
  52. int arg_count,
  53. unsigned int *out_args)
  54. {
  55. return ERR_PTR(-ENOTSUPP);
  56. }
  57. static inline struct regmap *syscon_regmap_lookup_by_phandle_optional(
  58. struct device_node *np,
  59. const char *property)
  60. {
  61. return NULL;
  62. }
  63. #endif
  64. #endif /* __LINUX_MFD_SYSCON_H__ */