Wai Yew CHAY | 8cc7236 | 2009-05-14 08:05:58 +0200 | [diff] [blame] | 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 | |
| 19 | #ifndef CTAMIXER_H |
| 20 | #define CTAMIXER_H |
| 21 | |
| 22 | #include "ctresource.h" |
| 23 | #include <linux/spinlock.h> |
Sudip Mukherjee | 3d0fdc8 | 2014-09-29 14:33:23 +0530 | [diff] [blame] | 24 | #include <sound/core.h> |
Wai Yew CHAY | 8cc7236 | 2009-05-14 08:05:58 +0200 | [diff] [blame] | 25 | |
| 26 | /* Define the descriptor of a summation node resource */ |
| 27 | struct sum { |
| 28 | struct rsc rsc; /* Basic resource info */ |
| 29 | unsigned char idx[8]; |
| 30 | }; |
| 31 | |
| 32 | /* Define sum resource request description info */ |
| 33 | struct sum_desc { |
| 34 | unsigned int msr; |
| 35 | }; |
| 36 | |
| 37 | struct sum_mgr { |
| 38 | struct rsc_mgr mgr; /* Basic resource manager info */ |
Sudip Mukherjee | 3d0fdc8 | 2014-09-29 14:33:23 +0530 | [diff] [blame] | 39 | struct snd_card *card; /* pointer to this card */ |
Wai Yew CHAY | 8cc7236 | 2009-05-14 08:05:58 +0200 | [diff] [blame] | 40 | spinlock_t mgr_lock; |
| 41 | |
| 42 | /* request one sum resource */ |
| 43 | int (*get_sum)(struct sum_mgr *mgr, |
| 44 | const struct sum_desc *desc, struct sum **rsum); |
| 45 | /* return one sum resource */ |
| 46 | int (*put_sum)(struct sum_mgr *mgr, struct sum *sum); |
| 47 | }; |
| 48 | |
| 49 | /* Constructor and destructor of daio resource manager */ |
Sudip Mukherjee | 6664089 | 2014-09-29 14:33:21 +0530 | [diff] [blame] | 50 | int sum_mgr_create(struct hw *hw, struct sum_mgr **rsum_mgr); |
Wai Yew CHAY | 8cc7236 | 2009-05-14 08:05:58 +0200 | [diff] [blame] | 51 | int sum_mgr_destroy(struct sum_mgr *sum_mgr); |
| 52 | |
| 53 | /* Define the descriptor of a amixer resource */ |
| 54 | struct amixer_rsc_ops; |
| 55 | |
| 56 | struct amixer { |
| 57 | struct rsc rsc; /* Basic resource info */ |
| 58 | unsigned char idx[8]; |
| 59 | struct rsc *input; /* pointer to a resource acting as source */ |
| 60 | struct sum *sum; /* Put amixer output to this summation node */ |
| 61 | struct amixer_rsc_ops *ops; /* AMixer specific operations */ |
| 62 | }; |
| 63 | |
| 64 | struct amixer_rsc_ops { |
| 65 | int (*set_input)(struct amixer *amixer, struct rsc *rsc); |
| 66 | int (*set_scale)(struct amixer *amixer, unsigned int scale); |
| 67 | int (*set_invalid_squash)(struct amixer *amixer, unsigned int iv); |
| 68 | int (*set_sum)(struct amixer *amixer, struct sum *sum); |
| 69 | int (*commit_write)(struct amixer *amixer); |
| 70 | /* Only for interleaved recording */ |
| 71 | int (*commit_raw_write)(struct amixer *amixer); |
| 72 | int (*setup)(struct amixer *amixer, struct rsc *input, |
| 73 | unsigned int scale, struct sum *sum); |
| 74 | int (*get_scale)(struct amixer *amixer); |
| 75 | }; |
| 76 | |
| 77 | /* Define amixer resource request description info */ |
| 78 | struct amixer_desc { |
| 79 | unsigned int msr; |
| 80 | }; |
| 81 | |
| 82 | struct amixer_mgr { |
| 83 | struct rsc_mgr mgr; /* Basic resource manager info */ |
Sudip Mukherjee | 3d0fdc8 | 2014-09-29 14:33:23 +0530 | [diff] [blame] | 84 | struct snd_card *card; /* pointer to this card */ |
Wai Yew CHAY | 8cc7236 | 2009-05-14 08:05:58 +0200 | [diff] [blame] | 85 | spinlock_t mgr_lock; |
| 86 | |
| 87 | /* request one amixer resource */ |
| 88 | int (*get_amixer)(struct amixer_mgr *mgr, |
| 89 | const struct amixer_desc *desc, |
| 90 | struct amixer **ramixer); |
| 91 | /* return one amixer resource */ |
| 92 | int (*put_amixer)(struct amixer_mgr *mgr, struct amixer *amixer); |
| 93 | }; |
| 94 | |
| 95 | /* Constructor and destructor of amixer resource manager */ |
Sudip Mukherjee | 6664089 | 2014-09-29 14:33:21 +0530 | [diff] [blame] | 96 | int amixer_mgr_create(struct hw *hw, struct amixer_mgr **ramixer_mgr); |
Wai Yew CHAY | 8cc7236 | 2009-05-14 08:05:58 +0200 | [diff] [blame] | 97 | int amixer_mgr_destroy(struct amixer_mgr *amixer_mgr); |
| 98 | |
| 99 | #endif /* CTAMIXER_H */ |