1*05aa6165SCosmin-Gabriel Samoila /* SPDX-License-Identifier: GPL-2.0 */ 208660086SCosmin-Gabriel Samoila /* 308660086SCosmin-Gabriel Samoila * Audio driver for AK4458 408660086SCosmin-Gabriel Samoila * 508660086SCosmin-Gabriel Samoila * Copyright (C) 2016 Asahi Kasei Microdevices Corporation 608660086SCosmin-Gabriel Samoila * Copyright 2018 NXP 708660086SCosmin-Gabriel Samoila */ 808660086SCosmin-Gabriel Samoila 908660086SCosmin-Gabriel Samoila #ifndef _AK4458_H 1008660086SCosmin-Gabriel Samoila #define _AK4458_H 1108660086SCosmin-Gabriel Samoila 1208660086SCosmin-Gabriel Samoila #include <linux/regmap.h> 1308660086SCosmin-Gabriel Samoila 1408660086SCosmin-Gabriel Samoila /* Settings */ 1508660086SCosmin-Gabriel Samoila 1608660086SCosmin-Gabriel Samoila #define AK4458_00_CONTROL1 0x00 1708660086SCosmin-Gabriel Samoila #define AK4458_01_CONTROL2 0x01 1808660086SCosmin-Gabriel Samoila #define AK4458_02_CONTROL3 0x02 1908660086SCosmin-Gabriel Samoila #define AK4458_03_LCHATT 0x03 2008660086SCosmin-Gabriel Samoila #define AK4458_04_RCHATT 0x04 2108660086SCosmin-Gabriel Samoila #define AK4458_05_CONTROL4 0x05 2208660086SCosmin-Gabriel Samoila #define AK4458_06_DSD1 0x06 2308660086SCosmin-Gabriel Samoila #define AK4458_07_CONTROL5 0x07 2408660086SCosmin-Gabriel Samoila #define AK4458_08_SOUND_CONTROL 0x08 2508660086SCosmin-Gabriel Samoila #define AK4458_09_DSD2 0x09 2608660086SCosmin-Gabriel Samoila #define AK4458_0A_CONTROL6 0x0A 2708660086SCosmin-Gabriel Samoila #define AK4458_0B_CONTROL7 0x0B 2808660086SCosmin-Gabriel Samoila #define AK4458_0C_CONTROL8 0x0C 2908660086SCosmin-Gabriel Samoila #define AK4458_0D_CONTROL9 0x0D 3008660086SCosmin-Gabriel Samoila #define AK4458_0E_CONTROL10 0x0E 3108660086SCosmin-Gabriel Samoila #define AK4458_0F_L2CHATT 0x0F 3208660086SCosmin-Gabriel Samoila #define AK4458_10_R2CHATT 0x10 3308660086SCosmin-Gabriel Samoila #define AK4458_11_L3CHATT 0x11 3408660086SCosmin-Gabriel Samoila #define AK4458_12_R3CHATT 0x12 3508660086SCosmin-Gabriel Samoila #define AK4458_13_L4CHATT 0x13 3608660086SCosmin-Gabriel Samoila #define AK4458_14_R4CHATT 0x14 3708660086SCosmin-Gabriel Samoila 3808660086SCosmin-Gabriel Samoila /* Bitfield Definitions */ 3908660086SCosmin-Gabriel Samoila 4008660086SCosmin-Gabriel Samoila /* AK4458_00_CONTROL1 (0x00) Fields 4108660086SCosmin-Gabriel Samoila * Addr Register Name D7 D6 D5 D4 D3 D2 D1 D0 4208660086SCosmin-Gabriel Samoila * 00H Control 1 ACKS 0 0 0 DIF2 DIF1 DIF0 RSTN 4308660086SCosmin-Gabriel Samoila */ 4408660086SCosmin-Gabriel Samoila 4508660086SCosmin-Gabriel Samoila /* Digital Filter (SD, SLOW, SSLOW) */ 4608660086SCosmin-Gabriel Samoila #define AK4458_SD_MASK GENMASK(5, 5) 4708660086SCosmin-Gabriel Samoila #define AK4458_SLOW_MASK GENMASK(0, 0) 4808660086SCosmin-Gabriel Samoila #define AK4458_SSLOW_MASK GENMASK(0, 0) 4908660086SCosmin-Gabriel Samoila 5008660086SCosmin-Gabriel Samoila /* DIF2 1 0 5108660086SCosmin-Gabriel Samoila * x 1 0 MSB justified Figure 3 (default) 5208660086SCosmin-Gabriel Samoila * x 1 1 I2S Compliment Figure 4 5308660086SCosmin-Gabriel Samoila */ 5408660086SCosmin-Gabriel Samoila #define AK4458_DIF_SHIFT 1 5508660086SCosmin-Gabriel Samoila #define AK4458_DIF_MASK GENMASK(3, 1) 5608660086SCosmin-Gabriel Samoila 5708660086SCosmin-Gabriel Samoila #define AK4458_DIF_16BIT_LSB (0 << 1) 5808660086SCosmin-Gabriel Samoila #define AK4458_DIF_24BIT_I2S (3 << 1) 5908660086SCosmin-Gabriel Samoila #define AK4458_DIF_32BIT_LSB (5 << 1) 6008660086SCosmin-Gabriel Samoila #define AK4458_DIF_32BIT_MSB (6 << 1) 6108660086SCosmin-Gabriel Samoila #define AK4458_DIF_32BIT_I2S (7 << 1) 6208660086SCosmin-Gabriel Samoila 6308660086SCosmin-Gabriel Samoila /* AK4458_00_CONTROL1 (0x00) D0 bit */ 6408660086SCosmin-Gabriel Samoila #define AK4458_RSTN_MASK GENMASK(0, 0) 6508660086SCosmin-Gabriel Samoila #define AK4458_RSTN (0x1 << 0) 6608660086SCosmin-Gabriel Samoila 6708660086SCosmin-Gabriel Samoila /* AK4458_0A_CONTROL6 Mode bits */ 6808660086SCosmin-Gabriel Samoila #define AK4458_MODE_SHIFT 6 6908660086SCosmin-Gabriel Samoila #define AK4458_MODE_MASK GENMASK(7, 6) 7008660086SCosmin-Gabriel Samoila #define AK4458_MODE_NORMAL (0 << AK4458_MODE_SHIFT) 7108660086SCosmin-Gabriel Samoila #define AK4458_MODE_TDM128 (1 << AK4458_MODE_SHIFT) 7208660086SCosmin-Gabriel Samoila #define AK4458_MODE_TDM256 (2 << AK4458_MODE_SHIFT) 7308660086SCosmin-Gabriel Samoila #define AK4458_MODE_TDM512 (3 << AK4458_MODE_SHIFT) 7408660086SCosmin-Gabriel Samoila 7508660086SCosmin-Gabriel Samoila /* DAC Digital attenuator transition time setting 7608660086SCosmin-Gabriel Samoila * Table 19 7708660086SCosmin-Gabriel Samoila * Mode ATS1 ATS2 ATT speed 7808660086SCosmin-Gabriel Samoila * 0 0 0 4080/fs 7908660086SCosmin-Gabriel Samoila * 1 0 1 2040/fs 8008660086SCosmin-Gabriel Samoila * 2 1 0 510/fs 8108660086SCosmin-Gabriel Samoila * 3 1 1 255/fs 8208660086SCosmin-Gabriel Samoila * */ 8308660086SCosmin-Gabriel Samoila #define AK4458_ATS_SHIFT 6 8408660086SCosmin-Gabriel Samoila #define AK4458_ATS_MASK GENMASK(7, 6) 8508660086SCosmin-Gabriel Samoila 8608660086SCosmin-Gabriel Samoila #endif /* _AK4458_H */ 87