xref: /linux/sound/pci/ctxfi/ctmixer.h (revision 9611c0ce215a66770ccbe5c126bf57ba8c31bcad)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
4  *
5  * @File	ctmixer.h
6  *
7  * @Brief
8  * This file contains the definition of the mixer device functions.
9  *
10  * @Author	Liu Chun
11  * @Date 	Mar 28 2008
12  */
13 
14 #ifndef CTMIXER_H
15 #define CTMIXER_H
16 
17 #include "ctatc.h"
18 #include "ctresource.h"
19 
20 struct snd_kcontrol;
21 
22 #define INIT_VOL	0x1c00
23 
24 enum MIXER_PORT_T {
25 	MIX_WAVE_FRONT,
26 	MIX_WAVE_REAR,
27 	MIX_WAVE_CENTLFE,
28 	MIX_WAVE_SURROUND,
29 	MIX_SPDIF_OUT,
30 	MIX_PCMO_FRONT,
31 	MIX_MIC_IN,
32 	MIX_LINE_IN,
33 	MIX_SPDIF_IN,
34 	MIX_PCMI_FRONT,
35 	MIX_PCMI_REAR,
36 	MIX_PCMI_CENTLFE,
37 	MIX_PCMI_SURROUND,
38 
39 	NUM_MIX_PORTS
40 };
41 
42 /* alsa mixer descriptor */
43 struct ct_mixer {
44 	struct ct_atc *atc;
45 
46 	struct sum **sums;		/* sum resources for signal collection */
47 	struct snd_kcontrol *line_mic_kctls[2]; /* line/mic capture switch controls */
48 	unsigned int switch_state; /* A bit-map to indicate state of switches */
49 
50 	int (*get_output_ports)(struct ct_mixer *mixer, enum MIXER_PORT_T type,
51 				  struct rsc **rleft, struct rsc **rright);
52 
53 	int (*set_input_left)(struct ct_mixer *mixer,
54 			      enum MIXER_PORT_T type, struct rsc *rsc);
55 	int (*set_input_right)(struct ct_mixer *mixer,
56 			       enum MIXER_PORT_T type, struct rsc *rsc);
57 #ifdef CONFIG_PM_SLEEP
58 	int (*resume)(struct ct_mixer *mixer);
59 #endif
60 	struct amixer *amixers[];		/* amixer resources for volume control */
61 };
62 
63 int ct_alsa_mix_create(struct ct_atc *atc,
64 		       enum CTALSADEVS device,
65 		       const char *device_name);
66 int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer);
67 int ct_mixer_destroy(struct ct_mixer *mixer);
68 
69 #endif /* CTMIXER_H */
70