18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/**
38c2ecf20Sopenharmony_ci * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * @File	ctmixer.h
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * @Brief
88c2ecf20Sopenharmony_ci * This file contains the definition of the mixer device functions.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * @Author	Liu Chun
118c2ecf20Sopenharmony_ci * @Date 	Mar 28 2008
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifndef CTMIXER_H
158c2ecf20Sopenharmony_ci#define CTMIXER_H
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include "ctatc.h"
188c2ecf20Sopenharmony_ci#include "ctresource.h"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define INIT_VOL	0x1c00
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cienum MIXER_PORT_T {
238c2ecf20Sopenharmony_ci	MIX_WAVE_FRONT,
248c2ecf20Sopenharmony_ci	MIX_WAVE_REAR,
258c2ecf20Sopenharmony_ci	MIX_WAVE_CENTLFE,
268c2ecf20Sopenharmony_ci	MIX_WAVE_SURROUND,
278c2ecf20Sopenharmony_ci	MIX_SPDIF_OUT,
288c2ecf20Sopenharmony_ci	MIX_PCMO_FRONT,
298c2ecf20Sopenharmony_ci	MIX_MIC_IN,
308c2ecf20Sopenharmony_ci	MIX_LINE_IN,
318c2ecf20Sopenharmony_ci	MIX_SPDIF_IN,
328c2ecf20Sopenharmony_ci	MIX_PCMI_FRONT,
338c2ecf20Sopenharmony_ci	MIX_PCMI_REAR,
348c2ecf20Sopenharmony_ci	MIX_PCMI_CENTLFE,
358c2ecf20Sopenharmony_ci	MIX_PCMI_SURROUND,
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	NUM_MIX_PORTS
388c2ecf20Sopenharmony_ci};
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* alsa mixer descriptor */
418c2ecf20Sopenharmony_cistruct ct_mixer {
428c2ecf20Sopenharmony_ci	struct ct_atc *atc;
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci	void **amixers;		/* amixer resources for volume control */
458c2ecf20Sopenharmony_ci	void **sums;		/* sum resources for signal collection */
468c2ecf20Sopenharmony_ci	unsigned int switch_state; /* A bit-map to indicate state of switches */
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	int (*get_output_ports)(struct ct_mixer *mixer, enum MIXER_PORT_T type,
498c2ecf20Sopenharmony_ci				  struct rsc **rleft, struct rsc **rright);
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	int (*set_input_left)(struct ct_mixer *mixer,
528c2ecf20Sopenharmony_ci			      enum MIXER_PORT_T type, struct rsc *rsc);
538c2ecf20Sopenharmony_ci	int (*set_input_right)(struct ct_mixer *mixer,
548c2ecf20Sopenharmony_ci			       enum MIXER_PORT_T type, struct rsc *rsc);
558c2ecf20Sopenharmony_ci#ifdef CONFIG_PM_SLEEP
568c2ecf20Sopenharmony_ci	int (*resume)(struct ct_mixer *mixer);
578c2ecf20Sopenharmony_ci#endif
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciint ct_alsa_mix_create(struct ct_atc *atc,
618c2ecf20Sopenharmony_ci		       enum CTALSADEVS device,
628c2ecf20Sopenharmony_ci		       const char *device_name);
638c2ecf20Sopenharmony_ciint ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer);
648c2ecf20Sopenharmony_ciint ct_mixer_destroy(struct ct_mixer *mixer);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#endif /* CTMIXER_H */
67