xref: /kernel/linux/linux-5.10/sound/aoa/codecs/onyx.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Apple Onboard Audio driver for Onyx codec (header)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci#ifndef __SND_AOA_CODEC_ONYX_H
88c2ecf20Sopenharmony_ci#define __SND_AOA_CODEC_ONYX_H
98c2ecf20Sopenharmony_ci#include <stddef.h>
108c2ecf20Sopenharmony_ci#include <linux/i2c.h>
118c2ecf20Sopenharmony_ci#include <asm/pmac_low_i2c.h>
128c2ecf20Sopenharmony_ci#include <asm/prom.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* PCM3052 register definitions */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* the attenuation registers take values from
178c2ecf20Sopenharmony_ci * -1 (0dB) to -127 (-63.0 dB) or others (muted) */
188c2ecf20Sopenharmony_ci#define ONYX_REG_DAC_ATTEN_LEFT		65
198c2ecf20Sopenharmony_ci#define FIRSTREGISTER			ONYX_REG_DAC_ATTEN_LEFT
208c2ecf20Sopenharmony_ci#define ONYX_REG_DAC_ATTEN_RIGHT	66
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define ONYX_REG_CONTROL		67
238c2ecf20Sopenharmony_ci#	define ONYX_MRST		(1<<7)
248c2ecf20Sopenharmony_ci#	define ONYX_SRST		(1<<6)
258c2ecf20Sopenharmony_ci#	define ONYX_ADPSV		(1<<5)
268c2ecf20Sopenharmony_ci#	define ONYX_DAPSV		(1<<4)
278c2ecf20Sopenharmony_ci#	define ONYX_SILICONVERSION	(1<<0)
288c2ecf20Sopenharmony_ci/* all others reserved */
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define ONYX_REG_DAC_CONTROL		68
318c2ecf20Sopenharmony_ci#	define ONYX_OVR1		(1<<6)
328c2ecf20Sopenharmony_ci#	define ONYX_MUTE_RIGHT		(1<<1)
338c2ecf20Sopenharmony_ci#	define ONYX_MUTE_LEFT		(1<<0)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define ONYX_REG_DAC_DEEMPH		69
368c2ecf20Sopenharmony_ci#	define ONYX_DIGDEEMPH_SHIFT	5
378c2ecf20Sopenharmony_ci#	define ONYX_DIGDEEMPH_MASK	(3<<ONYX_DIGDEEMPH_SHIFT)
388c2ecf20Sopenharmony_ci#	define ONYX_DIGDEEMPH_CTRL	(1<<4)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define ONYX_REG_DAC_FILTER		70
418c2ecf20Sopenharmony_ci#	define ONYX_ROLLOFF_FAST	(1<<5)
428c2ecf20Sopenharmony_ci#	define ONYX_DAC_FILTER_ALWAYS	(1<<2)
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define	ONYX_REG_DAC_OUTPHASE		71
458c2ecf20Sopenharmony_ci#	define ONYX_OUTPHASE_INVERTED	(1<<0)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define ONYX_REG_ADC_CONTROL		72
488c2ecf20Sopenharmony_ci#	define ONYX_ADC_INPUT_MIC	(1<<5)
498c2ecf20Sopenharmony_ci/* 8 + input gain in dB, valid range for input gain is -4 .. 20 dB */
508c2ecf20Sopenharmony_ci#	define ONYX_ADC_PGA_GAIN_MASK	0x1f
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define ONYX_REG_ADC_HPF_BYPASS		75
538c2ecf20Sopenharmony_ci#	define ONYX_HPF_DISABLE		(1<<3)
548c2ecf20Sopenharmony_ci#	define ONYX_ADC_HPF_ALWAYS	(1<<2)
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define ONYX_REG_DIG_INFO1		77
578c2ecf20Sopenharmony_ci#	define ONYX_MASK_DIN_TO_BPZ	(1<<7)
588c2ecf20Sopenharmony_ci/* bits 1-5 control channel bits 1-5 */
598c2ecf20Sopenharmony_ci#	define ONYX_DIGOUT_DISABLE	(1<<0)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define ONYX_REG_DIG_INFO2		78
628c2ecf20Sopenharmony_ci/* controls channel bits 8-15 */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define ONYX_REG_DIG_INFO3		79
658c2ecf20Sopenharmony_ci/* control channel bits 24-29, high 2 bits reserved */
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define ONYX_REG_DIG_INFO4		80
688c2ecf20Sopenharmony_ci#	define ONYX_VALIDL		(1<<7)
698c2ecf20Sopenharmony_ci#	define ONYX_VALIDR		(1<<6)
708c2ecf20Sopenharmony_ci#	define ONYX_SPDIF_ENABLE	(1<<5)
718c2ecf20Sopenharmony_ci/* lower 4 bits control bits 32-35 of channel control and word length */
728c2ecf20Sopenharmony_ci#	define ONYX_WORDLEN_MASK	(0xF)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#endif /* __SND_AOA_CODEC_ONYX_H */
75