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