wcd9xxx-regmap.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 and
  6. * only version 2 as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _WCD9XXX_REGMAP_
  14. #define _WCD9XXX_REGMAP_
  15. #include <linux/regmap.h>
  16. #include "core.h"
  17. typedef int (*regmap_patch_fptr)(struct regmap *, int);
  18. extern struct regmap_config wcd934x_regmap_config;
  19. extern int wcd934x_regmap_register_patch(struct regmap *regmap,
  20. int version);
  21. extern struct regmap_config wcd9335_regmap_config;
  22. extern int wcd9335_regmap_register_patch(struct regmap *regmap,
  23. int version);
  24. static inline struct regmap_config *wcd9xxx_get_regmap_config(int type)
  25. {
  26. struct regmap_config *regmap_config;
  27. switch (type) {
  28. case WCD934X:
  29. regmap_config = &wcd934x_regmap_config;
  30. break;
  31. case WCD9335:
  32. regmap_config = &wcd9335_regmap_config;
  33. break;
  34. default:
  35. regmap_config = NULL;
  36. break;
  37. };
  38. return regmap_config;
  39. }
  40. static inline regmap_patch_fptr wcd9xxx_get_regmap_reg_patch(int type)
  41. {
  42. regmap_patch_fptr apply_patch;
  43. switch (type) {
  44. case WCD9335:
  45. apply_patch = wcd9335_regmap_register_patch;
  46. break;
  47. case WCD934X:
  48. apply_patch = wcd934x_regmap_register_patch;
  49. break;
  50. default:
  51. apply_patch = NULL;
  52. break;
  53. }
  54. return apply_patch;
  55. }
  56. #endif