cs42l42.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * cs42l42.h -- CS42L42 ALSA SoC audio driver header
  4. *
  5. * Copyright 2016-2022 Cirrus Logic, Inc.
  6. *
  7. * Author: James Schulman <[email protected]>
  8. * Author: Brian Austin <[email protected]>
  9. * Author: Michael White <[email protected]>
  10. */
  11. #ifndef __CS42L42_H__
  12. #define __CS42L42_H__
  13. #include <dt-bindings/sound/cs42l42.h>
  14. #include <linux/device.h>
  15. #include <linux/gpio.h>
  16. #include <linux/mutex.h>
  17. #include <linux/regmap.h>
  18. #include <linux/regulator/consumer.h>
  19. #include <sound/jack.h>
  20. #include <sound/cs42l42.h>
  21. #include <sound/soc-component.h>
  22. #include <sound/soc-dai.h>
  23. struct cs42l42_private {
  24. struct regmap *regmap;
  25. struct device *dev;
  26. struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES];
  27. struct gpio_desc *reset_gpio;
  28. struct completion pdn_done;
  29. struct snd_soc_jack *jack;
  30. struct mutex irq_lock;
  31. int devid;
  32. int irq;
  33. int pll_config;
  34. u32 sclk;
  35. u32 bclk_ratio;
  36. u32 srate;
  37. u8 plug_state;
  38. u8 hs_type;
  39. u8 ts_inv;
  40. u8 ts_dbnc_rise;
  41. u8 ts_dbnc_fall;
  42. u8 btn_det_init_dbnce;
  43. u8 btn_det_event_dbnce;
  44. u8 bias_thresholds[CS42L42_NUM_BIASES];
  45. u8 hs_bias_ramp_rate;
  46. u8 hs_bias_ramp_time;
  47. u8 hs_bias_sense_en;
  48. u8 stream_use;
  49. bool hp_adc_up_pending;
  50. bool suspended;
  51. bool init_done;
  52. };
  53. extern const struct regmap_range_cfg cs42l42_page_range;
  54. extern const struct regmap_config cs42l42_regmap;
  55. extern const struct snd_soc_component_driver cs42l42_soc_component;
  56. extern struct snd_soc_dai_driver cs42l42_dai;
  57. bool cs42l42_readable_register(struct device *dev, unsigned int reg);
  58. bool cs42l42_volatile_register(struct device *dev, unsigned int reg);
  59. int cs42l42_suspend(struct device *dev);
  60. int cs42l42_resume(struct device *dev);
  61. void cs42l42_resume_restore(struct device *dev);
  62. int cs42l42_common_probe(struct cs42l42_private *cs42l42,
  63. const struct snd_soc_component_driver *component_drv,
  64. struct snd_soc_dai_driver *dai);
  65. int cs42l42_init(struct cs42l42_private *cs42l42);
  66. void cs42l42_common_remove(struct cs42l42_private *cs42l42);
  67. #endif /* __CS42L42_H__ */