ctamixer.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /**
  2. * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
  3. *
  4. * This source file is released under GPL v2 license (no other versions).
  5. * See the COPYING file included in the main directory of this source
  6. * distribution for the license terms and conditions.
  7. *
  8. * @File ctamixer.h
  9. *
  10. * @Brief
  11. * This file contains the definition of the Audio Mixer
  12. * resource management object.
  13. *
  14. * @Author Liu Chun
  15. * @Date May 21 2008
  16. *
  17. */
  18. #ifndef CTAMIXER_H
  19. #define CTAMIXER_H
  20. #include "ctresource.h"
  21. #include <linux/spinlock.h>
  22. #include <sound/core.h>
  23. /* Define the descriptor of a summation node resource */
  24. struct sum {
  25. struct rsc rsc; /* Basic resource info */
  26. unsigned char idx[8];
  27. };
  28. /* Define sum resource request description info */
  29. struct sum_desc {
  30. unsigned int msr;
  31. };
  32. struct sum_mgr {
  33. struct rsc_mgr mgr; /* Basic resource manager info */
  34. struct snd_card *card; /* pointer to this card */
  35. spinlock_t mgr_lock;
  36. /* request one sum resource */
  37. int (*get_sum)(struct sum_mgr *mgr,
  38. const struct sum_desc *desc, struct sum **rsum);
  39. /* return one sum resource */
  40. int (*put_sum)(struct sum_mgr *mgr, struct sum *sum);
  41. };
  42. /* Constructor and destructor of daio resource manager */
  43. int sum_mgr_create(struct hw *hw, struct sum_mgr **rsum_mgr);
  44. int sum_mgr_destroy(struct sum_mgr *sum_mgr);
  45. /* Define the descriptor of a amixer resource */
  46. struct amixer_rsc_ops;
  47. struct amixer {
  48. struct rsc rsc; /* Basic resource info */
  49. unsigned char idx[8];
  50. struct rsc *input; /* pointer to a resource acting as source */
  51. struct sum *sum; /* Put amixer output to this summation node */
  52. const struct amixer_rsc_ops *ops; /* AMixer specific operations */
  53. };
  54. struct amixer_rsc_ops {
  55. int (*set_input)(struct amixer *amixer, struct rsc *rsc);
  56. int (*set_scale)(struct amixer *amixer, unsigned int scale);
  57. int (*set_invalid_squash)(struct amixer *amixer, unsigned int iv);
  58. int (*set_sum)(struct amixer *amixer, struct sum *sum);
  59. int (*commit_write)(struct amixer *amixer);
  60. /* Only for interleaved recording */
  61. int (*commit_raw_write)(struct amixer *amixer);
  62. int (*setup)(struct amixer *amixer, struct rsc *input,
  63. unsigned int scale, struct sum *sum);
  64. int (*get_scale)(struct amixer *amixer);
  65. };
  66. /* Define amixer resource request description info */
  67. struct amixer_desc {
  68. unsigned int msr;
  69. };
  70. struct amixer_mgr {
  71. struct rsc_mgr mgr; /* Basic resource manager info */
  72. struct snd_card *card; /* pointer to this card */
  73. spinlock_t mgr_lock;
  74. /* request one amixer resource */
  75. int (*get_amixer)(struct amixer_mgr *mgr,
  76. const struct amixer_desc *desc,
  77. struct amixer **ramixer);
  78. /* return one amixer resource */
  79. int (*put_amixer)(struct amixer_mgr *mgr, struct amixer *amixer);
  80. };
  81. /* Constructor and destructor of amixer resource manager */
  82. int amixer_mgr_create(struct hw *hw, struct amixer_mgr **ramixer_mgr);
  83. int amixer_mgr_destroy(struct amixer_mgr *amixer_mgr);
  84. #endif /* CTAMIXER_H */