18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/***************************************************************************** 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and 58c2ecf20Sopenharmony_ci * Jean-Christian Hassler <jhassler@free.fr> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * This file is part of the Audiowerk2 ALSA driver 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci *****************************************************************************/ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* SAA7146 registers */ 128c2ecf20Sopenharmony_ci#define PCI_BT_A 0x4C 138c2ecf20Sopenharmony_ci#define IICTFR 0x8C 148c2ecf20Sopenharmony_ci#define IICSTA 0x90 158c2ecf20Sopenharmony_ci#define BaseA1_in 0x94 168c2ecf20Sopenharmony_ci#define ProtA1_in 0x98 178c2ecf20Sopenharmony_ci#define PageA1_in 0x9C 188c2ecf20Sopenharmony_ci#define BaseA1_out 0xA0 198c2ecf20Sopenharmony_ci#define ProtA1_out 0xA4 208c2ecf20Sopenharmony_ci#define PageA1_out 0xA8 218c2ecf20Sopenharmony_ci#define BaseA2_in 0xAC 228c2ecf20Sopenharmony_ci#define ProtA2_in 0xB0 238c2ecf20Sopenharmony_ci#define PageA2_in 0xB4 248c2ecf20Sopenharmony_ci#define BaseA2_out 0xB8 258c2ecf20Sopenharmony_ci#define ProtA2_out 0xBC 268c2ecf20Sopenharmony_ci#define PageA2_out 0xC0 278c2ecf20Sopenharmony_ci#define IER 0xDC 288c2ecf20Sopenharmony_ci#define GPIO_CTRL 0xE0 298c2ecf20Sopenharmony_ci#define ACON1 0xF4 308c2ecf20Sopenharmony_ci#define ACON2 0xF8 318c2ecf20Sopenharmony_ci#define MC1 0xFC 328c2ecf20Sopenharmony_ci#define MC2 0x100 338c2ecf20Sopenharmony_ci#define ISR 0x10C 348c2ecf20Sopenharmony_ci#define PSR 0x110 358c2ecf20Sopenharmony_ci#define SSR 0x114 368c2ecf20Sopenharmony_ci#define PCI_ADP1 0x12C 378c2ecf20Sopenharmony_ci#define PCI_ADP2 0x130 388c2ecf20Sopenharmony_ci#define PCI_ADP3 0x134 398c2ecf20Sopenharmony_ci#define PCI_ADP4 0x138 408c2ecf20Sopenharmony_ci#define LEVEL_REP 0x140 418c2ecf20Sopenharmony_ci#define FB_BUFFER1 0x144 428c2ecf20Sopenharmony_ci#define FB_BUFFER2 0x148 438c2ecf20Sopenharmony_ci#define TSL1 0x180 448c2ecf20Sopenharmony_ci#define TSL2 0x1C0 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define ME (1UL << 11) 478c2ecf20Sopenharmony_ci#define LIMIT (1UL << 4) 488c2ecf20Sopenharmony_ci#define PV (1UL << 3) 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/* PSR/ISR/IER */ 518c2ecf20Sopenharmony_ci#define PPEF (1UL << 31) 528c2ecf20Sopenharmony_ci#define PABO (1UL << 30) 538c2ecf20Sopenharmony_ci#define IIC_S (1UL << 17) 548c2ecf20Sopenharmony_ci#define IIC_E (1UL << 16) 558c2ecf20Sopenharmony_ci#define A2_in (1UL << 15) 568c2ecf20Sopenharmony_ci#define A2_out (1UL << 14) 578c2ecf20Sopenharmony_ci#define A1_in (1UL << 13) 588c2ecf20Sopenharmony_ci#define A1_out (1UL << 12) 598c2ecf20Sopenharmony_ci#define AFOU (1UL << 11) 608c2ecf20Sopenharmony_ci#define PIN3 (1UL << 6) 618c2ecf20Sopenharmony_ci#define PIN2 (1UL << 5) 628c2ecf20Sopenharmony_ci#define PIN1 (1UL << 4) 638c2ecf20Sopenharmony_ci#define PIN0 (1UL << 3) 648c2ecf20Sopenharmony_ci#define ECS (1UL << 2) 658c2ecf20Sopenharmony_ci#define EC3S (1UL << 1) 668c2ecf20Sopenharmony_ci#define EC0S (1UL << 0) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/* SSR */ 698c2ecf20Sopenharmony_ci#define PRQ (1UL << 31) 708c2ecf20Sopenharmony_ci#define PMA (1UL << 30) 718c2ecf20Sopenharmony_ci#define IIC_EA (1UL << 21) 728c2ecf20Sopenharmony_ci#define IIC_EW (1UL << 20) 738c2ecf20Sopenharmony_ci#define IIC_ER (1UL << 19) 748c2ecf20Sopenharmony_ci#define IIC_EL (1UL << 18) 758c2ecf20Sopenharmony_ci#define IIC_EF (1UL << 17) 768c2ecf20Sopenharmony_ci#define AF2_in (1UL << 10) 778c2ecf20Sopenharmony_ci#define AF2_out (1UL << 9) 788c2ecf20Sopenharmony_ci#define AF1_in (1UL << 8) 798c2ecf20Sopenharmony_ci#define AF1_out (1UL << 7) 808c2ecf20Sopenharmony_ci#define EC5S (1UL << 3) 818c2ecf20Sopenharmony_ci#define EC4S (1UL << 2) 828c2ecf20Sopenharmony_ci#define EC2S (1UL << 1) 838c2ecf20Sopenharmony_ci#define EC1S (1UL << 0) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci/* PCI_BT_A */ 868c2ecf20Sopenharmony_ci#define BurstA1_in (1UL << 26) 878c2ecf20Sopenharmony_ci#define ThreshA1_in (1UL << 24) 888c2ecf20Sopenharmony_ci#define BurstA1_out (1UL << 18) 898c2ecf20Sopenharmony_ci#define ThreshA1_out (1UL << 16) 908c2ecf20Sopenharmony_ci#define BurstA2_in (1UL << 10) 918c2ecf20Sopenharmony_ci#define ThreshA2_in (1UL << 8) 928c2ecf20Sopenharmony_ci#define BurstA2_out (1UL << 2) 938c2ecf20Sopenharmony_ci#define ThreshA2_out (1UL << 0) 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* MC1 */ 968c2ecf20Sopenharmony_ci#define MRST_N (1UL << 15) 978c2ecf20Sopenharmony_ci#define EAP (1UL << 9) 988c2ecf20Sopenharmony_ci#define EI2C (1UL << 8) 998c2ecf20Sopenharmony_ci#define TR_E_A2_OUT (1UL << 3) 1008c2ecf20Sopenharmony_ci#define TR_E_A2_IN (1UL << 2) 1018c2ecf20Sopenharmony_ci#define TR_E_A1_OUT (1UL << 1) 1028c2ecf20Sopenharmony_ci#define TR_E_A1_IN (1UL << 0) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci/* MC2 */ 1058c2ecf20Sopenharmony_ci#define UPLD_IIC (1UL << 0) 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci/* ACON1 */ 1088c2ecf20Sopenharmony_ci#define AUDIO_MODE (1UL << 29) 1098c2ecf20Sopenharmony_ci#define MAXLEVEL (1UL << 22) 1108c2ecf20Sopenharmony_ci#define A1_SWAP (1UL << 21) 1118c2ecf20Sopenharmony_ci#define A2_SWAP (1UL << 20) 1128c2ecf20Sopenharmony_ci#define WS0_CTRL (1UL << 18) 1138c2ecf20Sopenharmony_ci#define WS0_SYNC (1UL << 16) 1148c2ecf20Sopenharmony_ci#define WS1_CTRL (1UL << 14) 1158c2ecf20Sopenharmony_ci#define WS1_SYNC (1UL << 12) 1168c2ecf20Sopenharmony_ci#define WS2_CTRL (1UL << 10) 1178c2ecf20Sopenharmony_ci#define WS2_SYNC (1UL << 8) 1188c2ecf20Sopenharmony_ci#define WS3_CTRL (1UL << 6) 1198c2ecf20Sopenharmony_ci#define WS3_SYNC (1UL << 4) 1208c2ecf20Sopenharmony_ci#define WS4_CTRL (1UL << 2) 1218c2ecf20Sopenharmony_ci#define WS4_SYNC (1UL << 0) 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci/* ACON2 */ 1248c2ecf20Sopenharmony_ci#define A1_CLKSRC (1UL << 27) 1258c2ecf20Sopenharmony_ci#define A2_CLKSRC (1UL << 22) 1268c2ecf20Sopenharmony_ci#define INVERT_BCLK1 (1UL << 21) 1278c2ecf20Sopenharmony_ci#define INVERT_BCLK2 (1UL << 20) 1288c2ecf20Sopenharmony_ci#define BCLK1_OEN (1UL << 19) 1298c2ecf20Sopenharmony_ci#define BCLK2_OEN (1UL << 18) 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci/* IICSTA */ 1328c2ecf20Sopenharmony_ci#define IICCC (1UL << 8) 1338c2ecf20Sopenharmony_ci#define ABORT (1UL << 7) 1348c2ecf20Sopenharmony_ci#define SPERR (1UL << 6) 1358c2ecf20Sopenharmony_ci#define APERR (1UL << 5) 1368c2ecf20Sopenharmony_ci#define DTERR (1UL << 4) 1378c2ecf20Sopenharmony_ci#define DRERR (1UL << 3) 1388c2ecf20Sopenharmony_ci#define AL (1UL << 2) 1398c2ecf20Sopenharmony_ci#define ERR (1UL << 1) 1408c2ecf20Sopenharmony_ci#define BUSY (1UL << 0) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci/* IICTFR */ 1438c2ecf20Sopenharmony_ci#define BYTE2 (1UL << 24) 1448c2ecf20Sopenharmony_ci#define BYTE1 (1UL << 16) 1458c2ecf20Sopenharmony_ci#define BYTE0 (1UL << 8) 1468c2ecf20Sopenharmony_ci#define ATRR2 (1UL << 6) 1478c2ecf20Sopenharmony_ci#define ATRR1 (1UL << 4) 1488c2ecf20Sopenharmony_ci#define ATRR0 (1UL << 2) 1498c2ecf20Sopenharmony_ci#define ERR (1UL << 1) 1508c2ecf20Sopenharmony_ci#define BUSY (1UL << 0) 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci#define START 3 1538c2ecf20Sopenharmony_ci#define CONT 2 1548c2ecf20Sopenharmony_ci#define STOP 1 1558c2ecf20Sopenharmony_ci#define NOP 0 156