wcd9xxx-regmap.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _WCD9XXX_REGMAP_
  6. #define _WCD9XXX_REGMAP_
  7. #include <linux/regmap.h>
  8. #include "core.h"
  9. typedef int (*regmap_patch_fptr)(struct regmap *regmap, int version);
  10. extern struct regmap_config wcd934x_regmap_config;
  11. extern int wcd934x_regmap_register_patch(struct regmap *regmap,
  12. int version);
  13. extern struct regmap_config wcd9335_regmap_config;
  14. extern int wcd9335_regmap_register_patch(struct regmap *regmap,
  15. int version);
  16. static inline struct regmap_config *wcd9xxx_get_regmap_config(int type)
  17. {
  18. struct regmap_config *regmap_config;
  19. switch (type) {
  20. case WCD934X:
  21. regmap_config = &wcd934x_regmap_config;
  22. break;
  23. case WCD9335:
  24. regmap_config = &wcd9335_regmap_config;
  25. break;
  26. default:
  27. regmap_config = NULL;
  28. break;
  29. };
  30. return regmap_config;
  31. }
  32. static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type)
  33. {
  34. regmap_patch_fptr apply_patch;
  35. switch (type) {
  36. case WCD9335:
  37. apply_patch = wcd9335_regmap_register_patch;
  38. break;
  39. case WCD934X:
  40. apply_patch = wcd934x_regmap_register_patch;
  41. break;
  42. default:
  43. apply_patch = NULL;
  44. break;
  45. }
  46. return apply_patch;
  47. }
  48. #endif