xref: /kernel/linux/linux-6.6/sound/aoa/codecs/onyx.h (revision 62306a36)
162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Apple Onboard Audio driver for Onyx codec (header)
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef __SND_AOA_CODEC_ONYX_H
862306a36Sopenharmony_ci#define __SND_AOA_CODEC_ONYX_H
962306a36Sopenharmony_ci#include <linux/i2c.h>
1062306a36Sopenharmony_ci#include <asm/pmac_low_i2c.h>
1162306a36Sopenharmony_ci#include <asm/prom.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci/* PCM3052 register definitions */
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* the attenuation registers take values from
1662306a36Sopenharmony_ci * -1 (0dB) to -127 (-63.0 dB) or others (muted) */
1762306a36Sopenharmony_ci#define ONYX_REG_DAC_ATTEN_LEFT		65
1862306a36Sopenharmony_ci#define FIRSTREGISTER			ONYX_REG_DAC_ATTEN_LEFT
1962306a36Sopenharmony_ci#define ONYX_REG_DAC_ATTEN_RIGHT	66
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define ONYX_REG_CONTROL		67
2262306a36Sopenharmony_ci#	define ONYX_MRST		(1<<7)
2362306a36Sopenharmony_ci#	define ONYX_SRST		(1<<6)
2462306a36Sopenharmony_ci#	define ONYX_ADPSV		(1<<5)
2562306a36Sopenharmony_ci#	define ONYX_DAPSV		(1<<4)
2662306a36Sopenharmony_ci#	define ONYX_SILICONVERSION	(1<<0)
2762306a36Sopenharmony_ci/* all others reserved */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define ONYX_REG_DAC_CONTROL		68
3062306a36Sopenharmony_ci#	define ONYX_OVR1		(1<<6)
3162306a36Sopenharmony_ci#	define ONYX_MUTE_RIGHT		(1<<1)
3262306a36Sopenharmony_ci#	define ONYX_MUTE_LEFT		(1<<0)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define ONYX_REG_DAC_DEEMPH		69
3562306a36Sopenharmony_ci#	define ONYX_DIGDEEMPH_SHIFT	5
3662306a36Sopenharmony_ci#	define ONYX_DIGDEEMPH_MASK	(3<<ONYX_DIGDEEMPH_SHIFT)
3762306a36Sopenharmony_ci#	define ONYX_DIGDEEMPH_CTRL	(1<<4)
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#define ONYX_REG_DAC_FILTER		70
4062306a36Sopenharmony_ci#	define ONYX_ROLLOFF_FAST	(1<<5)
4162306a36Sopenharmony_ci#	define ONYX_DAC_FILTER_ALWAYS	(1<<2)
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define	ONYX_REG_DAC_OUTPHASE		71
4462306a36Sopenharmony_ci#	define ONYX_OUTPHASE_INVERTED	(1<<0)
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#define ONYX_REG_ADC_CONTROL		72
4762306a36Sopenharmony_ci#	define ONYX_ADC_INPUT_MIC	(1<<5)
4862306a36Sopenharmony_ci/* 8 + input gain in dB, valid range for input gain is -4 .. 20 dB */
4962306a36Sopenharmony_ci#	define ONYX_ADC_PGA_GAIN_MASK	0x1f
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define ONYX_REG_ADC_HPF_BYPASS		75
5262306a36Sopenharmony_ci#	define ONYX_HPF_DISABLE		(1<<3)
5362306a36Sopenharmony_ci#	define ONYX_ADC_HPF_ALWAYS	(1<<2)
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci#define ONYX_REG_DIG_INFO1		77
5662306a36Sopenharmony_ci#	define ONYX_MASK_DIN_TO_BPZ	(1<<7)
5762306a36Sopenharmony_ci/* bits 1-5 control channel bits 1-5 */
5862306a36Sopenharmony_ci#	define ONYX_DIGOUT_DISABLE	(1<<0)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define ONYX_REG_DIG_INFO2		78
6162306a36Sopenharmony_ci/* controls channel bits 8-15 */
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define ONYX_REG_DIG_INFO3		79
6462306a36Sopenharmony_ci/* control channel bits 24-29, high 2 bits reserved */
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci#define ONYX_REG_DIG_INFO4		80
6762306a36Sopenharmony_ci#	define ONYX_VALIDL		(1<<7)
6862306a36Sopenharmony_ci#	define ONYX_VALIDR		(1<<6)
6962306a36Sopenharmony_ci#	define ONYX_SPDIF_ENABLE	(1<<5)
7062306a36Sopenharmony_ci/* lower 4 bits control bits 32-35 of channel control and word length */
7162306a36Sopenharmony_ci#	define ONYX_WORDLEN_MASK	(0xF)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#endif /* __SND_AOA_CODEC_ONYX_H */
74