162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci#ifndef __SOUND_AK4531_CODEC_H
362306a36Sopenharmony_ci#define __SOUND_AK4531_CODEC_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
762306a36Sopenharmony_ci *  Universal interface for Audio Codec '97
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *  For more details look to AC '97 component specification revision 2.1
1062306a36Sopenharmony_ci *  by Intel Corporation (http://developer.intel.com).
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <sound/info.h>
1462306a36Sopenharmony_ci#include <sound/control.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci *  ASAHI KASEI - AK4531 codec
1862306a36Sopenharmony_ci *  - not really AC'97 codec, but it uses very similar interface as AC'97
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/*
2262306a36Sopenharmony_ci *  AK4531 codec registers
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define AK4531_LMASTER  0x00	/* master volume left */
2662306a36Sopenharmony_ci#define AK4531_RMASTER  0x01	/* master volume right */
2762306a36Sopenharmony_ci#define AK4531_LVOICE   0x02	/* channel volume left */
2862306a36Sopenharmony_ci#define AK4531_RVOICE   0x03	/* channel volume right */
2962306a36Sopenharmony_ci#define AK4531_LFM      0x04	/* FM volume left */
3062306a36Sopenharmony_ci#define AK4531_RFM      0x05	/* FM volume right */
3162306a36Sopenharmony_ci#define AK4531_LCD      0x06	/* CD volume left */
3262306a36Sopenharmony_ci#define AK4531_RCD      0x07	/* CD volume right */
3362306a36Sopenharmony_ci#define AK4531_LLINE    0x08	/* LINE volume left */
3462306a36Sopenharmony_ci#define AK4531_RLINE    0x09	/* LINE volume right */
3562306a36Sopenharmony_ci#define AK4531_LAUXA    0x0a	/* AUXA volume left */
3662306a36Sopenharmony_ci#define AK4531_RAUXA    0x0b	/* AUXA volume right */
3762306a36Sopenharmony_ci#define AK4531_MONO1    0x0c	/* MONO1 volume left */
3862306a36Sopenharmony_ci#define AK4531_MONO2    0x0d	/* MONO1 volume right */
3962306a36Sopenharmony_ci#define AK4531_MIC      0x0e	/* MIC volume */
4062306a36Sopenharmony_ci#define AK4531_MONO_OUT 0x0f	/* Mono-out volume */
4162306a36Sopenharmony_ci#define AK4531_OUT_SW1  0x10	/* Output mixer switch 1 */
4262306a36Sopenharmony_ci#define AK4531_OUT_SW2  0x11	/* Output mixer switch 2 */
4362306a36Sopenharmony_ci#define AK4531_LIN_SW1  0x12	/* Input left mixer switch 1 */
4462306a36Sopenharmony_ci#define AK4531_RIN_SW1  0x13	/* Input right mixer switch 1 */
4562306a36Sopenharmony_ci#define AK4531_LIN_SW2  0x14	/* Input left mixer switch 2 */
4662306a36Sopenharmony_ci#define AK4531_RIN_SW2  0x15	/* Input right mixer switch 2 */
4762306a36Sopenharmony_ci#define AK4531_RESET    0x16	/* Reset & power down */
4862306a36Sopenharmony_ci#define AK4531_CLOCK    0x17	/* Clock select */
4962306a36Sopenharmony_ci#define AK4531_AD_IN    0x18	/* AD input select */
5062306a36Sopenharmony_ci#define AK4531_MIC_GAIN 0x19	/* MIC amplified gain */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cistruct snd_ak4531 {
5362306a36Sopenharmony_ci	void (*write) (struct snd_ak4531 *ak4531, unsigned short reg,
5462306a36Sopenharmony_ci		       unsigned short val);
5562306a36Sopenharmony_ci	void *private_data;
5662306a36Sopenharmony_ci	void (*private_free) (struct snd_ak4531 *ak4531);
5762306a36Sopenharmony_ci	/* --- */
5862306a36Sopenharmony_ci	unsigned char regs[0x20];
5962306a36Sopenharmony_ci	struct mutex reg_mutex;
6062306a36Sopenharmony_ci};
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ciint snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
6362306a36Sopenharmony_ci		     struct snd_ak4531 **rak4531);
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci#ifdef CONFIG_PM
6662306a36Sopenharmony_civoid snd_ak4531_suspend(struct snd_ak4531 *ak4531);
6762306a36Sopenharmony_civoid snd_ak4531_resume(struct snd_ak4531 *ak4531);
6862306a36Sopenharmony_ci#endif
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#endif /* __SOUND_AK4531_CODEC_H */
71