maxim_dsm_cal.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * maxim_dsm_cal.c -- Module for Rdc calibration
  3. *
  4. * Copyright 2014 Maxim Integrated Products
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __SOUND_MAXIM_DSM_CAL_H__
  11. #define __SOUND_MAXIM_DSM_CAL_H__
  12. #define DRIVER_AUTHOR "Kyounghun Jeon<hun.jeon@maximintegrated.com>"
  13. #define DRIVER_DESC "For Rdc calibration of MAX98xxx"
  14. #define DRIVER_SUPPORTED "MAX98xxx"
  15. #define WQ_NAME "maxdsm_wq"
  16. #define FILEPATH_TEMP_CAL "/efs/maxim/temp_cal"
  17. #define FILEPATH_RDC_CAL "/efs/maxim/rdc_cal"
  18. #define CLASS_NAME "maxdsm_cal"
  19. #define DSM_NAME "dsm"
  20. #define ADDR_RDC 0x2A0050
  21. #define ADDR_FEATURE_ENABLE 0x2A006A
  22. struct maxim_dsm_cal_info {
  23. uint32_t min;
  24. uint32_t max;
  25. uint32_t feature_en;
  26. int interval;
  27. int duration;
  28. int remaining;
  29. int ignored_t;
  30. unsigned long previous_jiffies;
  31. };
  32. struct maxim_dsm_cal_values {
  33. uint32_t status;
  34. int rdc;
  35. int temp;
  36. uint64_t avg;
  37. int count;
  38. };
  39. struct maxim_dsm_cal {
  40. struct device *dev;
  41. struct class *class;
  42. struct mutex mutex;
  43. struct workqueue_struct *wq;
  44. struct delayed_work work;
  45. struct maxim_dsm_cal_values values;
  46. struct maxim_dsm_cal_info info;
  47. struct regmap *regmap;
  48. uint32_t platform_type;
  49. };
  50. extern struct regmap *maxdsm_cal_set_regmap(
  51. struct regmap *regmap);
  52. extern int maxdsm_cal_get_temp(uint32_t *temp);
  53. extern int maxdsm_cal_set_temp(uint32_t temp);
  54. extern int maxdsm_cal_get_rdc(uint32_t *rdc);
  55. extern int maxdsm_cal_set_rdc(uint32_t rdc);
  56. #endif /* __SOUND_MAXIM_DSM_CAL_H__ */