1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
8 * This file contains the definition of the Audio Mixer
9 * resource management object.
18 #include "ctresource.h"
19 #include <linux/spinlock.h>
20 #include <sound/core.h>
22 /* Define the descriptor of a summation node resource */
24 struct rsc rsc
; /* Basic resource info */
28 /* Define sum resource request description info */
34 struct rsc_mgr mgr
; /* Basic resource manager info */
35 struct snd_card
*card
; /* pointer to this card */
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
);
45 /* Constructor and destructor of daio resource manager */
46 int sum_mgr_create(struct hw
*hw
, struct sum_mgr
**rsum_mgr
);
47 int sum_mgr_destroy(struct sum_mgr
*sum_mgr
);
49 /* Define the descriptor of a amixer resource */
50 struct amixer_rsc_ops
;
53 struct rsc rsc
; /* Basic resource info */
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 */
60 struct 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
);
73 /* Define amixer resource request description info */
79 struct rsc_mgr mgr
; /* Basic resource manager info */
80 struct snd_card
*card
; /* pointer to this card */
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
);
91 /* Constructor and destructor of amixer resource manager */
92 int amixer_mgr_create(struct hw
*hw
, struct amixer_mgr
**ramixer_mgr
);
93 int amixer_mgr_destroy(struct amixer_mgr
*amixer_mgr
);
95 #endif /* CTAMIXER_H */