rt5677.h 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795
  1. /*
  2. * rt5677.h -- RT5677 ALSA SoC audio driver
  3. *
  4. * Copyright 2013 Realtek Semiconductor Corp.
  5. * Author: Oder Chiou <oder_chiou@realtek.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef __RT5677_H__
  12. #define __RT5677_H__
  13. #include <sound/rt5677.h>
  14. #include <linux/gpio/driver.h>
  15. #include <linux/gpio/consumer.h>
  16. /* Info */
  17. #define RT5677_RESET 0x00
  18. #define RT5677_VENDOR_ID 0xfd
  19. #define RT5677_VENDOR_ID1 0xfe
  20. #define RT5677_VENDOR_ID2 0xff
  21. /* I/O - Output */
  22. #define RT5677_LOUT1 0x01
  23. /* I/O - Input */
  24. #define RT5677_IN1 0x03
  25. #define RT5677_MICBIAS 0x04
  26. /* I/O - SLIMBus */
  27. #define RT5677_SLIMBUS_PARAM 0x07
  28. #define RT5677_SLIMBUS_RX 0x08
  29. #define RT5677_SLIMBUS_CTRL 0x09
  30. /* I/O */
  31. #define RT5677_SIDETONE_CTRL 0x13
  32. /* I/O - ADC/DAC */
  33. #define RT5677_ANA_DAC1_2_3_SRC 0x15
  34. #define RT5677_IF_DSP_DAC3_4_MIXER 0x16
  35. #define RT5677_DAC4_DIG_VOL 0x17
  36. #define RT5677_DAC3_DIG_VOL 0x18
  37. #define RT5677_DAC1_DIG_VOL 0x19
  38. #define RT5677_DAC2_DIG_VOL 0x1a
  39. #define RT5677_IF_DSP_DAC2_MIXER 0x1b
  40. #define RT5677_STO1_ADC_DIG_VOL 0x1c
  41. #define RT5677_MONO_ADC_DIG_VOL 0x1d
  42. #define RT5677_STO1_2_ADC_BST 0x1e
  43. #define RT5677_STO2_ADC_DIG_VOL 0x1f
  44. /* Mixer - D-D */
  45. #define RT5677_ADC_BST_CTRL2 0x20
  46. #define RT5677_STO3_4_ADC_BST 0x21
  47. #define RT5677_STO3_ADC_DIG_VOL 0x22
  48. #define RT5677_STO4_ADC_DIG_VOL 0x23
  49. #define RT5677_STO4_ADC_MIXER 0x24
  50. #define RT5677_STO3_ADC_MIXER 0x25
  51. #define RT5677_STO2_ADC_MIXER 0x26
  52. #define RT5677_STO1_ADC_MIXER 0x27
  53. #define RT5677_MONO_ADC_MIXER 0x28
  54. #define RT5677_ADC_IF_DSP_DAC1_MIXER 0x29
  55. #define RT5677_STO1_DAC_MIXER 0x2a
  56. #define RT5677_MONO_DAC_MIXER 0x2b
  57. #define RT5677_DD1_MIXER 0x2c
  58. #define RT5677_DD2_MIXER 0x2d
  59. #define RT5677_IF3_DATA 0x2f
  60. #define RT5677_IF4_DATA 0x30
  61. /* Mixer - PDM */
  62. #define RT5677_PDM_OUT_CTRL 0x31
  63. #define RT5677_PDM_DATA_CTRL1 0x32
  64. #define RT5677_PDM_DATA_CTRL2 0x33
  65. #define RT5677_PDM1_DATA_CTRL2 0x34
  66. #define RT5677_PDM1_DATA_CTRL3 0x35
  67. #define RT5677_PDM1_DATA_CTRL4 0x36
  68. #define RT5677_PDM2_DATA_CTRL2 0x37
  69. #define RT5677_PDM2_DATA_CTRL3 0x38
  70. #define RT5677_PDM2_DATA_CTRL4 0x39
  71. /* TDM */
  72. #define RT5677_TDM1_CTRL1 0x3b
  73. #define RT5677_TDM1_CTRL2 0x3c
  74. #define RT5677_TDM1_CTRL3 0x3d
  75. #define RT5677_TDM1_CTRL4 0x3e
  76. #define RT5677_TDM1_CTRL5 0x3f
  77. #define RT5677_TDM2_CTRL1 0x40
  78. #define RT5677_TDM2_CTRL2 0x41
  79. #define RT5677_TDM2_CTRL3 0x42
  80. #define RT5677_TDM2_CTRL4 0x43
  81. #define RT5677_TDM2_CTRL5 0x44
  82. /* I2C_MASTER_CTRL */
  83. #define RT5677_I2C_MASTER_CTRL1 0x47
  84. #define RT5677_I2C_MASTER_CTRL2 0x48
  85. #define RT5677_I2C_MASTER_CTRL3 0x49
  86. #define RT5677_I2C_MASTER_CTRL4 0x4a
  87. #define RT5677_I2C_MASTER_CTRL5 0x4b
  88. #define RT5677_I2C_MASTER_CTRL6 0x4c
  89. #define RT5677_I2C_MASTER_CTRL7 0x4d
  90. #define RT5677_I2C_MASTER_CTRL8 0x4e
  91. /* DMIC */
  92. #define RT5677_DMIC_CTRL1 0x50
  93. #define RT5677_DMIC_CTRL2 0x51
  94. /* Haptic Generator */
  95. #define RT5677_HAP_GENE_CTRL1 0x56
  96. #define RT5677_HAP_GENE_CTRL2 0x57
  97. #define RT5677_HAP_GENE_CTRL3 0x58
  98. #define RT5677_HAP_GENE_CTRL4 0x59
  99. #define RT5677_HAP_GENE_CTRL5 0x5a
  100. #define RT5677_HAP_GENE_CTRL6 0x5b
  101. #define RT5677_HAP_GENE_CTRL7 0x5c
  102. #define RT5677_HAP_GENE_CTRL8 0x5d
  103. #define RT5677_HAP_GENE_CTRL9 0x5e
  104. #define RT5677_HAP_GENE_CTRL10 0x5f
  105. /* Power */
  106. #define RT5677_PWR_DIG1 0x61
  107. #define RT5677_PWR_DIG2 0x62
  108. #define RT5677_PWR_ANLG1 0x63
  109. #define RT5677_PWR_ANLG2 0x64
  110. #define RT5677_PWR_DSP1 0x65
  111. #define RT5677_PWR_DSP_ST 0x66
  112. #define RT5677_PWR_DSP2 0x67
  113. #define RT5677_ADC_DAC_HPF_CTRL1 0x68
  114. /* Private Register Control */
  115. #define RT5677_PRIV_INDEX 0x6a
  116. #define RT5677_PRIV_DATA 0x6c
  117. /* Format - ADC/DAC */
  118. #define RT5677_I2S4_SDP 0x6f
  119. #define RT5677_I2S1_SDP 0x70
  120. #define RT5677_I2S2_SDP 0x71
  121. #define RT5677_I2S3_SDP 0x72
  122. #define RT5677_CLK_TREE_CTRL1 0x73
  123. #define RT5677_CLK_TREE_CTRL2 0x74
  124. #define RT5677_CLK_TREE_CTRL3 0x75
  125. /* Function - Analog */
  126. #define RT5677_PLL1_CTRL1 0x7a
  127. #define RT5677_PLL1_CTRL2 0x7b
  128. #define RT5677_PLL2_CTRL1 0x7c
  129. #define RT5677_PLL2_CTRL2 0x7d
  130. #define RT5677_GLB_CLK1 0x80
  131. #define RT5677_GLB_CLK2 0x81
  132. #define RT5677_ASRC_1 0x83
  133. #define RT5677_ASRC_2 0x84
  134. #define RT5677_ASRC_3 0x85
  135. #define RT5677_ASRC_4 0x86
  136. #define RT5677_ASRC_5 0x87
  137. #define RT5677_ASRC_6 0x88
  138. #define RT5677_ASRC_7 0x89
  139. #define RT5677_ASRC_8 0x8a
  140. #define RT5677_ASRC_9 0x8b
  141. #define RT5677_ASRC_10 0x8c
  142. #define RT5677_ASRC_11 0x8d
  143. #define RT5677_ASRC_12 0x8e
  144. #define RT5677_ASRC_13 0x8f
  145. #define RT5677_ASRC_14 0x90
  146. #define RT5677_ASRC_15 0x91
  147. #define RT5677_ASRC_16 0x92
  148. #define RT5677_ASRC_17 0x93
  149. #define RT5677_ASRC_18 0x94
  150. #define RT5677_ASRC_19 0x95
  151. #define RT5677_ASRC_20 0x97
  152. #define RT5677_ASRC_21 0x98
  153. #define RT5677_ASRC_22 0x99
  154. #define RT5677_ASRC_23 0x9a
  155. #define RT5677_VAD_CTRL1 0x9c
  156. #define RT5677_VAD_CTRL2 0x9d
  157. #define RT5677_VAD_CTRL3 0x9e
  158. #define RT5677_VAD_CTRL4 0x9f
  159. #define RT5677_VAD_CTRL5 0xa0
  160. /* Function - Digital */
  161. #define RT5677_DSP_INB_CTRL1 0xa3
  162. #define RT5677_DSP_INB_CTRL2 0xa4
  163. #define RT5677_DSP_IN_OUTB_CTRL 0xa5
  164. #define RT5677_DSP_OUTB0_1_DIG_VOL 0xa6
  165. #define RT5677_DSP_OUTB2_3_DIG_VOL 0xa7
  166. #define RT5677_DSP_OUTB4_5_DIG_VOL 0xa8
  167. #define RT5677_DSP_OUTB6_7_DIG_VOL 0xa9
  168. #define RT5677_ADC_EQ_CTRL1 0xae
  169. #define RT5677_ADC_EQ_CTRL2 0xaf
  170. #define RT5677_EQ_CTRL1 0xb0
  171. #define RT5677_EQ_CTRL2 0xb1
  172. #define RT5677_EQ_CTRL3 0xb2
  173. #define RT5677_SOFT_VOL_ZERO_CROSS1 0xb3
  174. #define RT5677_JD_CTRL1 0xb5
  175. #define RT5677_JD_CTRL2 0xb6
  176. #define RT5677_JD_CTRL3 0xb8
  177. #define RT5677_IRQ_CTRL1 0xbd
  178. #define RT5677_IRQ_CTRL2 0xbe
  179. #define RT5677_GPIO_ST 0xbf
  180. #define RT5677_GPIO_CTRL1 0xc0
  181. #define RT5677_GPIO_CTRL2 0xc1
  182. #define RT5677_GPIO_CTRL3 0xc2
  183. #define RT5677_STO1_ADC_HI_FILTER1 0xc5
  184. #define RT5677_STO1_ADC_HI_FILTER2 0xc6
  185. #define RT5677_MONO_ADC_HI_FILTER1 0xc7
  186. #define RT5677_MONO_ADC_HI_FILTER2 0xc8
  187. #define RT5677_STO2_ADC_HI_FILTER1 0xc9
  188. #define RT5677_STO2_ADC_HI_FILTER2 0xca
  189. #define RT5677_STO3_ADC_HI_FILTER1 0xcb
  190. #define RT5677_STO3_ADC_HI_FILTER2 0xcc
  191. #define RT5677_STO4_ADC_HI_FILTER1 0xcd
  192. #define RT5677_STO4_ADC_HI_FILTER2 0xce
  193. #define RT5677_MB_DRC_CTRL1 0xd0
  194. #define RT5677_DRC1_CTRL1 0xd2
  195. #define RT5677_DRC1_CTRL2 0xd3
  196. #define RT5677_DRC1_CTRL3 0xd4
  197. #define RT5677_DRC1_CTRL4 0xd5
  198. #define RT5677_DRC1_CTRL5 0xd6
  199. #define RT5677_DRC1_CTRL6 0xd7
  200. #define RT5677_DRC2_CTRL1 0xd8
  201. #define RT5677_DRC2_CTRL2 0xd9
  202. #define RT5677_DRC2_CTRL3 0xda
  203. #define RT5677_DRC2_CTRL4 0xdb
  204. #define RT5677_DRC2_CTRL5 0xdc
  205. #define RT5677_DRC2_CTRL6 0xdd
  206. #define RT5677_DRC1_HL_CTRL1 0xde
  207. #define RT5677_DRC1_HL_CTRL2 0xdf
  208. #define RT5677_DRC2_HL_CTRL1 0xe0
  209. #define RT5677_DRC2_HL_CTRL2 0xe1
  210. #define RT5677_DSP_INB1_SRC_CTRL1 0xe3
  211. #define RT5677_DSP_INB1_SRC_CTRL2 0xe4
  212. #define RT5677_DSP_INB1_SRC_CTRL3 0xe5
  213. #define RT5677_DSP_INB1_SRC_CTRL4 0xe6
  214. #define RT5677_DSP_INB2_SRC_CTRL1 0xe7
  215. #define RT5677_DSP_INB2_SRC_CTRL2 0xe8
  216. #define RT5677_DSP_INB2_SRC_CTRL3 0xe9
  217. #define RT5677_DSP_INB2_SRC_CTRL4 0xea
  218. #define RT5677_DSP_INB3_SRC_CTRL1 0xeb
  219. #define RT5677_DSP_INB3_SRC_CTRL2 0xec
  220. #define RT5677_DSP_INB3_SRC_CTRL3 0xed
  221. #define RT5677_DSP_INB3_SRC_CTRL4 0xee
  222. #define RT5677_DSP_OUTB1_SRC_CTRL1 0xef
  223. #define RT5677_DSP_OUTB1_SRC_CTRL2 0xf0
  224. #define RT5677_DSP_OUTB1_SRC_CTRL3 0xf1
  225. #define RT5677_DSP_OUTB1_SRC_CTRL4 0xf2
  226. #define RT5677_DSP_OUTB2_SRC_CTRL1 0xf3
  227. #define RT5677_DSP_OUTB2_SRC_CTRL2 0xf4
  228. #define RT5677_DSP_OUTB2_SRC_CTRL3 0xf5
  229. #define RT5677_DSP_OUTB2_SRC_CTRL4 0xf6
  230. /* Virtual DSP Mixer Control */
  231. #define RT5677_DSP_OUTB_0123_MIXER_CTRL 0xf7
  232. #define RT5677_DSP_OUTB_45_MIXER_CTRL 0xf8
  233. #define RT5677_DSP_OUTB_67_MIXER_CTRL 0xf9
  234. /* General Control */
  235. #define RT5677_DIG_MISC 0xfa
  236. #define RT5677_GEN_CTRL1 0xfb
  237. #define RT5677_GEN_CTRL2 0xfc
  238. /* DSP Mode I2C Control*/
  239. #define RT5677_DSP_I2C_OP_CODE 0x00
  240. #define RT5677_DSP_I2C_ADDR_LSB 0x01
  241. #define RT5677_DSP_I2C_ADDR_MSB 0x02
  242. #define RT5677_DSP_I2C_DATA_LSB 0x03
  243. #define RT5677_DSP_I2C_DATA_MSB 0x04
  244. /* Index of Codec Private Register definition */
  245. #define RT5677_PR_DRC1_CTRL_1 0x01
  246. #define RT5677_PR_DRC1_CTRL_2 0x02
  247. #define RT5677_PR_DRC1_CTRL_3 0x03
  248. #define RT5677_PR_DRC1_CTRL_4 0x04
  249. #define RT5677_PR_DRC1_CTRL_5 0x05
  250. #define RT5677_PR_DRC1_CTRL_6 0x06
  251. #define RT5677_PR_DRC1_CTRL_7 0x07
  252. #define RT5677_PR_DRC2_CTRL_1 0x08
  253. #define RT5677_PR_DRC2_CTRL_2 0x09
  254. #define RT5677_PR_DRC2_CTRL_3 0x0a
  255. #define RT5677_PR_DRC2_CTRL_4 0x0b
  256. #define RT5677_PR_DRC2_CTRL_5 0x0c
  257. #define RT5677_PR_DRC2_CTRL_6 0x0d
  258. #define RT5677_PR_DRC2_CTRL_7 0x0e
  259. #define RT5677_BIAS_CUR1 0x10
  260. #define RT5677_BIAS_CUR2 0x12
  261. #define RT5677_BIAS_CUR3 0x13
  262. #define RT5677_BIAS_CUR4 0x14
  263. #define RT5677_BIAS_CUR5 0x15
  264. #define RT5677_VREF_LOUT_CTRL 0x17
  265. #define RT5677_DIG_VOL_CTRL1 0x1a
  266. #define RT5677_DIG_VOL_CTRL2 0x1b
  267. #define RT5677_ANA_ADC_GAIN_CTRL 0x1e
  268. #define RT5677_VAD_SRAM_TEST1 0x20
  269. #define RT5677_VAD_SRAM_TEST2 0x21
  270. #define RT5677_VAD_SRAM_TEST3 0x22
  271. #define RT5677_VAD_SRAM_TEST4 0x23
  272. #define RT5677_PAD_DRV_CTRL 0x26
  273. #define RT5677_DIG_IN_PIN_ST_CTRL1 0x29
  274. #define RT5677_DIG_IN_PIN_ST_CTRL2 0x2a
  275. #define RT5677_DIG_IN_PIN_ST_CTRL3 0x2b
  276. #define RT5677_PLL1_INT 0x38
  277. #define RT5677_PLL2_INT 0x39
  278. #define RT5677_TEST_CTRL1 0x3a
  279. #define RT5677_TEST_CTRL2 0x3b
  280. #define RT5677_TEST_CTRL3 0x3c
  281. #define RT5677_CHOP_DAC_ADC 0x3d
  282. #define RT5677_SOFT_DEPOP_DAC_CLK_CTRL 0x3e
  283. #define RT5677_CROSS_OVER_FILTER1 0x90
  284. #define RT5677_CROSS_OVER_FILTER2 0x91
  285. #define RT5677_CROSS_OVER_FILTER3 0x92
  286. #define RT5677_CROSS_OVER_FILTER4 0x93
  287. #define RT5677_CROSS_OVER_FILTER5 0x94
  288. #define RT5677_CROSS_OVER_FILTER6 0x95
  289. #define RT5677_CROSS_OVER_FILTER7 0x96
  290. #define RT5677_CROSS_OVER_FILTER8 0x97
  291. #define RT5677_CROSS_OVER_FILTER9 0x98
  292. #define RT5677_CROSS_OVER_FILTER10 0x99
  293. /* global definition */
  294. #define RT5677_L_MUTE (0x1 << 15)
  295. #define RT5677_L_MUTE_SFT 15
  296. #define RT5677_VOL_L_MUTE (0x1 << 14)
  297. #define RT5677_VOL_L_SFT 14
  298. #define RT5677_R_MUTE (0x1 << 7)
  299. #define RT5677_R_MUTE_SFT 7
  300. #define RT5677_VOL_R_MUTE (0x1 << 6)
  301. #define RT5677_VOL_R_SFT 6
  302. #define RT5677_L_VOL_MASK (0x7f << 9)
  303. #define RT5677_L_VOL_SFT 9
  304. #define RT5677_R_VOL_MASK (0x7f << 1)
  305. #define RT5677_R_VOL_SFT 1
  306. /* LOUT1 Control (0x01) */
  307. #define RT5677_LOUT1_L_MUTE (0x1 << 15)
  308. #define RT5677_LOUT1_L_MUTE_SFT (15)
  309. #define RT5677_LOUT1_L_DF (0x1 << 14)
  310. #define RT5677_LOUT1_L_DF_SFT (14)
  311. #define RT5677_LOUT2_L_MUTE (0x1 << 13)
  312. #define RT5677_LOUT2_L_MUTE_SFT (13)
  313. #define RT5677_LOUT2_L_DF (0x1 << 12)
  314. #define RT5677_LOUT2_L_DF_SFT (12)
  315. #define RT5677_LOUT3_L_MUTE (0x1 << 11)
  316. #define RT5677_LOUT3_L_MUTE_SFT (11)
  317. #define RT5677_LOUT3_L_DF (0x1 << 10)
  318. #define RT5677_LOUT3_L_DF_SFT (10)
  319. #define RT5677_LOUT1_ENH_DRV (0x1 << 9)
  320. #define RT5677_LOUT1_ENH_DRV_SFT (9)
  321. #define RT5677_LOUT2_ENH_DRV (0x1 << 8)
  322. #define RT5677_LOUT2_ENH_DRV_SFT (8)
  323. #define RT5677_LOUT3_ENH_DRV (0x1 << 7)
  324. #define RT5677_LOUT3_ENH_DRV_SFT (7)
  325. /* IN1 Control (0x03) */
  326. #define RT5677_BST_MASK1 (0xf << 12)
  327. #define RT5677_BST_SFT1 12
  328. #define RT5677_BST_MASK2 (0xf << 8)
  329. #define RT5677_BST_SFT2 8
  330. #define RT5677_IN_DF1 (0x1 << 7)
  331. #define RT5677_IN_DF1_SFT 7
  332. #define RT5677_IN_DF2 (0x1 << 6)
  333. #define RT5677_IN_DF2_SFT 6
  334. /* Micbias Control (0x04) */
  335. #define RT5677_MICBIAS1_OUTVOLT_MASK (0x1 << 15)
  336. #define RT5677_MICBIAS1_OUTVOLT_SFT (15)
  337. #define RT5677_MICBIAS1_OUTVOLT_2_7V (0x0 << 15)
  338. #define RT5677_MICBIAS1_OUTVOLT_2_25V (0x1 << 15)
  339. #define RT5677_MICBIAS1_CTRL_VDD_MASK (0x1 << 14)
  340. #define RT5677_MICBIAS1_CTRL_VDD_SFT (14)
  341. #define RT5677_MICBIAS1_CTRL_VDD_1_8V (0x0 << 14)
  342. #define RT5677_MICBIAS1_CTRL_VDD_3_3V (0x1 << 14)
  343. #define RT5677_MICBIAS1_OVCD_MASK (0x1 << 11)
  344. #define RT5677_MICBIAS1_OVCD_SHIFT (11)
  345. #define RT5677_MICBIAS1_OVCD_DIS (0x0 << 11)
  346. #define RT5677_MICBIAS1_OVCD_EN (0x1 << 11)
  347. #define RT5677_MICBIAS1_OVTH_MASK (0x3 << 9)
  348. #define RT5677_MICBIAS1_OVTH_SFT 9
  349. #define RT5677_MICBIAS1_OVTH_640UA (0x0 << 9)
  350. #define RT5677_MICBIAS1_OVTH_1280UA (0x1 << 9)
  351. #define RT5677_MICBIAS1_OVTH_1920UA (0x2 << 9)
  352. /* SLIMbus Parameter (0x07) */
  353. /* SLIMbus Rx (0x08) */
  354. #define RT5677_SLB_ADC4_MASK (0x3 << 6)
  355. #define RT5677_SLB_ADC4_SFT 6
  356. #define RT5677_SLB_ADC3_MASK (0x3 << 4)
  357. #define RT5677_SLB_ADC3_SFT 4
  358. #define RT5677_SLB_ADC2_MASK (0x3 << 2)
  359. #define RT5677_SLB_ADC2_SFT 2
  360. #define RT5677_SLB_ADC1_MASK (0x3 << 0)
  361. #define RT5677_SLB_ADC1_SFT 0
  362. /* SLIMBus control (0x09) */
  363. /* Sidetone Control (0x13) */
  364. #define RT5677_ST_HPF_SEL_MASK (0x7 << 13)
  365. #define RT5677_ST_HPF_SEL_SFT 13
  366. #define RT5677_ST_HPF_PATH (0x1 << 12)
  367. #define RT5677_ST_HPF_PATH_SFT 12
  368. #define RT5677_ST_SEL_MASK (0x7 << 9)
  369. #define RT5677_ST_SEL_SFT 9
  370. #define RT5677_ST_EN (0x1 << 6)
  371. #define RT5677_ST_EN_SFT 6
  372. #define RT5677_ST_GAIN (0x1 << 5)
  373. #define RT5677_ST_GAIN_SFT 5
  374. #define RT5677_ST_VOL_MASK (0x1f << 0)
  375. #define RT5677_ST_VOL_SFT 0
  376. /* Analog DAC1/2/3 Source Control (0x15) */
  377. #define RT5677_ANA_DAC3_SRC_SEL_MASK (0x3 << 4)
  378. #define RT5677_ANA_DAC3_SRC_SEL_SFT 4
  379. #define RT5677_ANA_DAC1_2_SRC_SEL_MASK (0x3 << 0)
  380. #define RT5677_ANA_DAC1_2_SRC_SEL_SFT 0
  381. /* IF/DSP to DAC3/4 Mixer Control (0x16) */
  382. #define RT5677_M_DAC4_L_VOL (0x1 << 15)
  383. #define RT5677_M_DAC4_L_VOL_SFT 15
  384. #define RT5677_SEL_DAC4_L_SRC_MASK (0x7 << 12)
  385. #define RT5677_SEL_DAC4_L_SRC_SFT 12
  386. #define RT5677_M_DAC4_R_VOL (0x1 << 11)
  387. #define RT5677_M_DAC4_R_VOL_SFT 11
  388. #define RT5677_SEL_DAC4_R_SRC_MASK (0x7 << 8)
  389. #define RT5677_SEL_DAC4_R_SRC_SFT 8
  390. #define RT5677_M_DAC3_L_VOL (0x1 << 7)
  391. #define RT5677_M_DAC3_L_VOL_SFT 7
  392. #define RT5677_SEL_DAC3_L_SRC_MASK (0x7 << 4)
  393. #define RT5677_SEL_DAC3_L_SRC_SFT 4
  394. #define RT5677_M_DAC3_R_VOL (0x1 << 3)
  395. #define RT5677_M_DAC3_R_VOL_SFT 3
  396. #define RT5677_SEL_DAC3_R_SRC_MASK (0x7 << 0)
  397. #define RT5677_SEL_DAC3_R_SRC_SFT 0
  398. /* DAC4 Digital Volume (0x17) */
  399. #define RT5677_DAC4_L_VOL_MASK (0xff << 8)
  400. #define RT5677_DAC4_L_VOL_SFT 8
  401. #define RT5677_DAC4_R_VOL_MASK (0xff)
  402. #define RT5677_DAC4_R_VOL_SFT 0
  403. /* DAC3 Digital Volume (0x18) */
  404. #define RT5677_DAC3_L_VOL_MASK (0xff << 8)
  405. #define RT5677_DAC3_L_VOL_SFT 8
  406. #define RT5677_DAC3_R_VOL_MASK (0xff)
  407. #define RT5677_DAC3_R_VOL_SFT 0
  408. /* DAC3 Digital Volume (0x19) */
  409. #define RT5677_DAC1_L_VOL_MASK (0xff << 8)
  410. #define RT5677_DAC1_L_VOL_SFT 8
  411. #define RT5677_DAC1_R_VOL_MASK (0xff)
  412. #define RT5677_DAC1_R_VOL_SFT 0
  413. /* DAC2 Digital Volume (0x1a) */
  414. #define RT5677_DAC2_L_VOL_MASK (0xff << 8)
  415. #define RT5677_DAC2_L_VOL_SFT 8
  416. #define RT5677_DAC2_R_VOL_MASK (0xff)
  417. #define RT5677_DAC2_R_VOL_SFT 0
  418. /* IF/DSP to DAC2 Mixer Control (0x1b) */
  419. #define RT5677_M_DAC2_L_VOL (0x1 << 7)
  420. #define RT5677_M_DAC2_L_VOL_SFT 7
  421. #define RT5677_SEL_DAC2_L_SRC_MASK (0x7 << 4)
  422. #define RT5677_SEL_DAC2_L_SRC_SFT 4
  423. #define RT5677_M_DAC2_R_VOL (0x1 << 3)
  424. #define RT5677_M_DAC2_R_VOL_SFT 3
  425. #define RT5677_SEL_DAC2_R_SRC_MASK (0x7 << 0)
  426. #define RT5677_SEL_DAC2_R_SRC_SFT 0
  427. /* Stereo1 ADC Digital Volume Control (0x1c) */
  428. #define RT5677_STO1_ADC_L_VOL_MASK (0x3f << 9)
  429. #define RT5677_STO1_ADC_L_VOL_SFT 9
  430. #define RT5677_STO1_ADC_R_VOL_MASK (0x3f << 1)
  431. #define RT5677_STO1_ADC_R_VOL_SFT 1
  432. /* Mono ADC Digital Volume Control (0x1d) */
  433. #define RT5677_MONO_ADC_L_VOL_MASK (0x3f << 9)
  434. #define RT5677_MONO_ADC_L_VOL_SFT 9
  435. #define RT5677_MONO_ADC_R_VOL_MASK (0x3f << 1)
  436. #define RT5677_MONO_ADC_R_VOL_SFT 1
  437. /* Stereo 1/2 ADC Boost Gain Control (0x1e) */
  438. #define RT5677_STO1_ADC_L_BST_MASK (0x3 << 14)
  439. #define RT5677_STO1_ADC_L_BST_SFT 14
  440. #define RT5677_STO1_ADC_R_BST_MASK (0x3 << 12)
  441. #define RT5677_STO1_ADC_R_BST_SFT 12
  442. #define RT5677_STO1_ADC_COMP_MASK (0x3 << 10)
  443. #define RT5677_STO1_ADC_COMP_SFT 10
  444. #define RT5677_STO2_ADC_L_BST_MASK (0x3 << 8)
  445. #define RT5677_STO2_ADC_L_BST_SFT 8
  446. #define RT5677_STO2_ADC_R_BST_MASK (0x3 << 6)
  447. #define RT5677_STO2_ADC_R_BST_SFT 6
  448. #define RT5677_STO2_ADC_COMP_MASK (0x3 << 4)
  449. #define RT5677_STO2_ADC_COMP_SFT 4
  450. /* Stereo2 ADC Digital Volume Control (0x1f) */
  451. #define RT5677_STO2_ADC_L_VOL_MASK (0x7f << 8)
  452. #define RT5677_STO2_ADC_L_VOL_SFT 8
  453. #define RT5677_STO2_ADC_R_VOL_MASK (0x7f)
  454. #define RT5677_STO2_ADC_R_VOL_SFT 0
  455. /* ADC Boost Gain Control 2 (0x20) */
  456. #define RT5677_MONO_ADC_L_BST_MASK (0x3 << 14)
  457. #define RT5677_MONO_ADC_L_BST_SFT 14
  458. #define RT5677_MONO_ADC_R_BST_MASK (0x3 << 12)
  459. #define RT5677_MONO_ADC_R_BST_SFT 12
  460. #define RT5677_MONO_ADC_COMP_MASK (0x3 << 10)
  461. #define RT5677_MONO_ADC_COMP_SFT 10
  462. /* Stereo 3/4 ADC Boost Gain Control (0x21) */
  463. #define RT5677_STO3_ADC_L_BST_MASK (0x3 << 14)
  464. #define RT5677_STO3_ADC_L_BST_SFT 14
  465. #define RT5677_STO3_ADC_R_BST_MASK (0x3 << 12)
  466. #define RT5677_STO3_ADC_R_BST_SFT 12
  467. #define RT5677_STO3_ADC_COMP_MASK (0x3 << 10)
  468. #define RT5677_STO3_ADC_COMP_SFT 10
  469. #define RT5677_STO4_ADC_L_BST_MASK (0x3 << 8)
  470. #define RT5677_STO4_ADC_L_BST_SFT 8
  471. #define RT5677_STO4_ADC_R_BST_MASK (0x3 << 6)
  472. #define RT5677_STO4_ADC_R_BST_SFT 6
  473. #define RT5677_STO4_ADC_COMP_MASK (0x3 << 4)
  474. #define RT5677_STO4_ADC_COMP_SFT 4
  475. /* Stereo3 ADC Digital Volume Control (0x22) */
  476. #define RT5677_STO3_ADC_L_VOL_MASK (0x7f << 8)
  477. #define RT5677_STO3_ADC_L_VOL_SFT 8
  478. #define RT5677_STO3_ADC_R_VOL_MASK (0x7f)
  479. #define RT5677_STO3_ADC_R_VOL_SFT 0
  480. /* Stereo4 ADC Digital Volume Control (0x23) */
  481. #define RT5677_STO4_ADC_L_VOL_MASK (0x7f << 8)
  482. #define RT5677_STO4_ADC_L_VOL_SFT 8
  483. #define RT5677_STO4_ADC_R_VOL_MASK (0x7f)
  484. #define RT5677_STO4_ADC_R_VOL_SFT 0
  485. /* Stereo4 ADC Mixer control (0x24) */
  486. #define RT5677_M_STO4_ADC_L2 (0x1 << 15)
  487. #define RT5677_M_STO4_ADC_L2_SFT 15
  488. #define RT5677_M_STO4_ADC_L1 (0x1 << 14)
  489. #define RT5677_M_STO4_ADC_L1_SFT 14
  490. #define RT5677_SEL_STO4_ADC1_MASK (0x3 << 12)
  491. #define RT5677_SEL_STO4_ADC1_SFT 12
  492. #define RT5677_SEL_STO4_ADC2_MASK (0x3 << 10)
  493. #define RT5677_SEL_STO4_ADC2_SFT 10
  494. #define RT5677_SEL_STO4_DMIC_MASK (0x3 << 8)
  495. #define RT5677_SEL_STO4_DMIC_SFT 8
  496. #define RT5677_M_STO4_ADC_R1 (0x1 << 7)
  497. #define RT5677_M_STO4_ADC_R1_SFT 7
  498. #define RT5677_M_STO4_ADC_R2 (0x1 << 6)
  499. #define RT5677_M_STO4_ADC_R2_SFT 6
  500. /* Stereo3 ADC Mixer control (0x25) */
  501. #define RT5677_M_STO3_ADC_L2 (0x1 << 15)
  502. #define RT5677_M_STO3_ADC_L2_SFT 15
  503. #define RT5677_M_STO3_ADC_L1 (0x1 << 14)
  504. #define RT5677_M_STO3_ADC_L1_SFT 14
  505. #define RT5677_SEL_STO3_ADC1_MASK (0x3 << 12)
  506. #define RT5677_SEL_STO3_ADC1_SFT 12
  507. #define RT5677_SEL_STO3_ADC2_MASK (0x3 << 10)
  508. #define RT5677_SEL_STO3_ADC2_SFT 10
  509. #define RT5677_SEL_STO3_DMIC_MASK (0x3 << 8)
  510. #define RT5677_SEL_STO3_DMIC_SFT 8
  511. #define RT5677_M_STO3_ADC_R1 (0x1 << 7)
  512. #define RT5677_M_STO3_ADC_R1_SFT 7
  513. #define RT5677_M_STO3_ADC_R2 (0x1 << 6)
  514. #define RT5677_M_STO3_ADC_R2_SFT 6
  515. /* Stereo2 ADC Mixer Control (0x26) */
  516. #define RT5677_M_STO2_ADC_L2 (0x1 << 15)
  517. #define RT5677_M_STO2_ADC_L2_SFT 15
  518. #define RT5677_M_STO2_ADC_L1 (0x1 << 14)
  519. #define RT5677_M_STO2_ADC_L1_SFT 14
  520. #define RT5677_SEL_STO2_ADC1_MASK (0x3 << 12)
  521. #define RT5677_SEL_STO2_ADC1_SFT 12
  522. #define RT5677_SEL_STO2_ADC2_MASK (0x3 << 10)
  523. #define RT5677_SEL_STO2_ADC2_SFT 10
  524. #define RT5677_SEL_STO2_DMIC_MASK (0x3 << 8)
  525. #define RT5677_SEL_STO2_DMIC_SFT 8
  526. #define RT5677_M_STO2_ADC_R1 (0x1 << 7)
  527. #define RT5677_M_STO2_ADC_R1_SFT 7
  528. #define RT5677_M_STO2_ADC_R2 (0x1 << 6)
  529. #define RT5677_M_STO2_ADC_R2_SFT 6
  530. #define RT5677_SEL_STO2_LR_MIX_MASK (0x1 << 0)
  531. #define RT5677_SEL_STO2_LR_MIX_SFT 0
  532. #define RT5677_SEL_STO2_LR_MIX_L (0x0 << 0)
  533. #define RT5677_SEL_STO2_LR_MIX_LR (0x1 << 0)
  534. /* Stereo1 ADC Mixer control (0x27) */
  535. #define RT5677_M_STO1_ADC_L2 (0x1 << 15)
  536. #define RT5677_M_STO1_ADC_L2_SFT 15
  537. #define RT5677_M_STO1_ADC_L1 (0x1 << 14)
  538. #define RT5677_M_STO1_ADC_L1_SFT 14
  539. #define RT5677_SEL_STO1_ADC1_MASK (0x3 << 12)
  540. #define RT5677_SEL_STO1_ADC1_SFT 12
  541. #define RT5677_SEL_STO1_ADC2_MASK (0x3 << 10)
  542. #define RT5677_SEL_STO1_ADC2_SFT 10
  543. #define RT5677_SEL_STO1_DMIC_MASK (0x3 << 8)
  544. #define RT5677_SEL_STO1_DMIC_SFT 8
  545. #define RT5677_M_STO1_ADC_R1 (0x1 << 7)
  546. #define RT5677_M_STO1_ADC_R1_SFT 7
  547. #define RT5677_M_STO1_ADC_R2 (0x1 << 6)
  548. #define RT5677_M_STO1_ADC_R2_SFT 6
  549. /* Mono ADC Mixer control (0x28) */
  550. #define RT5677_M_MONO_ADC_L2 (0x1 << 15)
  551. #define RT5677_M_MONO_ADC_L2_SFT 15
  552. #define RT5677_M_MONO_ADC_L1 (0x1 << 14)
  553. #define RT5677_M_MONO_ADC_L1_SFT 14
  554. #define RT5677_SEL_MONO_ADC_L1_MASK (0x3 << 12)
  555. #define RT5677_SEL_MONO_ADC_L1_SFT 12
  556. #define RT5677_SEL_MONO_ADC_L2_MASK (0x3 << 10)
  557. #define RT5677_SEL_MONO_ADC_L2_SFT 10
  558. #define RT5677_SEL_MONO_DMIC_L_MASK (0x3 << 8)
  559. #define RT5677_SEL_MONO_DMIC_L_SFT 8
  560. #define RT5677_M_MONO_ADC_R1 (0x1 << 7)
  561. #define RT5677_M_MONO_ADC_R1_SFT 7
  562. #define RT5677_M_MONO_ADC_R2 (0x1 << 6)
  563. #define RT5677_M_MONO_ADC_R2_SFT 6
  564. #define RT5677_SEL_MONO_ADC_R1_MASK (0x3 << 4)
  565. #define RT5677_SEL_MONO_ADC_R1_SFT 4
  566. #define RT5677_SEL_MONO_ADC_R2_MASK (0x3 << 2)
  567. #define RT5677_SEL_MONO_ADC_R2_SFT 2
  568. #define RT5677_SEL_MONO_DMIC_R_MASK (0x3 << 0)
  569. #define RT5677_SEL_MONO_DMIC_R_SFT 0
  570. /* ADC/IF/DSP to DAC1 Mixer control (0x29) */
  571. #define RT5677_M_ADDA_MIXER1_L (0x1 << 15)
  572. #define RT5677_M_ADDA_MIXER1_L_SFT 15
  573. #define RT5677_M_DAC1_L (0x1 << 14)
  574. #define RT5677_M_DAC1_L_SFT 14
  575. #define RT5677_DAC1_L_SEL_MASK (0x7 << 8)
  576. #define RT5677_DAC1_L_SEL_SFT 8
  577. #define RT5677_M_ADDA_MIXER1_R (0x1 << 7)
  578. #define RT5677_M_ADDA_MIXER1_R_SFT 7
  579. #define RT5677_M_DAC1_R (0x1 << 6)
  580. #define RT5677_M_DAC1_R_SFT 6
  581. #define RT5677_ADDA1_SEL_MASK (0x3 << 0)
  582. #define RT5677_ADDA1_SEL_SFT 0
  583. /* Stereo1 DAC Mixer L/R Control (0x2a) */
  584. #define RT5677_M_ST_DAC1_L (0x1 << 15)
  585. #define RT5677_M_ST_DAC1_L_SFT 15
  586. #define RT5677_M_DAC1_L_STO_L (0x1 << 13)
  587. #define RT5677_M_DAC1_L_STO_L_SFT 13
  588. #define RT5677_DAC1_L_STO_L_VOL_MASK (0x1 << 12)
  589. #define RT5677_DAC1_L_STO_L_VOL_SFT 12
  590. #define RT5677_M_DAC2_L_STO_L (0x1 << 11)
  591. #define RT5677_M_DAC2_L_STO_L_SFT 11
  592. #define RT5677_DAC2_L_STO_L_VOL_MASK (0x1 << 10)
  593. #define RT5677_DAC2_L_STO_L_VOL_SFT 10
  594. #define RT5677_M_DAC1_R_STO_L (0x1 << 9)
  595. #define RT5677_M_DAC1_R_STO_L_SFT 9
  596. #define RT5677_DAC1_R_STO_L_VOL_MASK (0x1 << 8)
  597. #define RT5677_DAC1_R_STO_L_VOL_SFT 8
  598. #define RT5677_M_ST_DAC1_R (0x1 << 7)
  599. #define RT5677_M_ST_DAC1_R_SFT 7
  600. #define RT5677_M_DAC1_R_STO_R (0x1 << 5)
  601. #define RT5677_M_DAC1_R_STO_R_SFT 5
  602. #define RT5677_DAC1_R_STO_R_VOL_MASK (0x1 << 4)
  603. #define RT5677_DAC1_R_STO_R_VOL_SFT 4
  604. #define RT5677_M_DAC2_R_STO_R (0x1 << 3)
  605. #define RT5677_M_DAC2_R_STO_R_SFT 3
  606. #define RT5677_DAC2_R_STO_R_VOL_MASK (0x1 << 2)
  607. #define RT5677_DAC2_R_STO_R_VOL_SFT 2
  608. #define RT5677_M_DAC1_L_STO_R (0x1 << 1)
  609. #define RT5677_M_DAC1_L_STO_R_SFT 1
  610. #define RT5677_DAC1_L_STO_R_VOL_MASK (0x1 << 0)
  611. #define RT5677_DAC1_L_STO_R_VOL_SFT 0
  612. /* Mono DAC Mixer L/R Control (0x2b) */
  613. #define RT5677_M_ST_DAC2_L (0x1 << 15)
  614. #define RT5677_M_ST_DAC2_L_SFT 15
  615. #define RT5677_M_DAC2_L_MONO_L (0x1 << 13)
  616. #define RT5677_M_DAC2_L_MONO_L_SFT 13
  617. #define RT5677_DAC2_L_MONO_L_VOL_MASK (0x1 << 12)
  618. #define RT5677_DAC2_L_MONO_L_VOL_SFT 12
  619. #define RT5677_M_DAC2_R_MONO_L (0x1 << 11)
  620. #define RT5677_M_DAC2_R_MONO_L_SFT 11
  621. #define RT5677_DAC2_R_MONO_L_VOL_MASK (0x1 << 10)
  622. #define RT5677_DAC2_R_MONO_L_VOL_SFT 10
  623. #define RT5677_M_DAC1_L_MONO_L (0x1 << 9)
  624. #define RT5677_M_DAC1_L_MONO_L_SFT 9
  625. #define RT5677_DAC1_L_MONO_L_VOL_MASK (0x1 << 8)
  626. #define RT5677_DAC1_L_MONO_L_VOL_SFT 8
  627. #define RT5677_M_ST_DAC2_R (0x1 << 7)
  628. #define RT5677_M_ST_DAC2_R_SFT 7
  629. #define RT5677_M_DAC2_R_MONO_R (0x1 << 5)
  630. #define RT5677_M_DAC2_R_MONO_R_SFT 5
  631. #define RT5677_DAC2_R_MONO_R_VOL_MASK (0x1 << 4)
  632. #define RT5677_DAC2_R_MONO_R_VOL_SFT 4
  633. #define RT5677_M_DAC1_R_MONO_R (0x1 << 3)
  634. #define RT5677_M_DAC1_R_MONO_R_SFT 3
  635. #define RT5677_DAC1_R_MONO_R_VOL_MASK (0x1 << 2)
  636. #define RT5677_DAC1_R_MONO_R_VOL_SFT 2
  637. #define RT5677_M_DAC2_L_MONO_R (0x1 << 1)
  638. #define RT5677_M_DAC2_L_MONO_R_SFT 1
  639. #define RT5677_DAC2_L_MONO_R_VOL_MASK (0x1 << 0)
  640. #define RT5677_DAC2_L_MONO_R_VOL_SFT 0
  641. /* DD Mixer 1 Control (0x2c) */
  642. #define RT5677_M_STO_L_DD1_L (0x1 << 15)
  643. #define RT5677_M_STO_L_DD1_L_SFT 15
  644. #define RT5677_STO_L_DD1_L_VOL_MASK (0x1 << 14)
  645. #define RT5677_STO_L_DD1_L_VOL_SFT 14
  646. #define RT5677_M_MONO_L_DD1_L (0x1 << 13)
  647. #define RT5677_M_MONO_L_DD1_L_SFT 13
  648. #define RT5677_MONO_L_DD1_L_VOL_MASK (0x1 << 12)
  649. #define RT5677_MONO_L_DD1_L_VOL_SFT 12
  650. #define RT5677_M_DAC3_L_DD1_L (0x1 << 11)
  651. #define RT5677_M_DAC3_L_DD1_L_SFT 11
  652. #define RT5677_DAC3_L_DD1_L_VOL_MASK (0x1 << 10)
  653. #define RT5677_DAC3_L_DD1_L_VOL_SFT 10
  654. #define RT5677_M_DAC3_R_DD1_L (0x1 << 9)
  655. #define RT5677_M_DAC3_R_DD1_L_SFT 9
  656. #define RT5677_DAC3_R_DD1_L_VOL_MASK (0x1 << 8)
  657. #define RT5677_DAC3_R_DD1_L_VOL_SFT 8
  658. #define RT5677_M_STO_R_DD1_R (0x1 << 7)
  659. #define RT5677_M_STO_R_DD1_R_SFT 7
  660. #define RT5677_STO_R_DD1_R_VOL_MASK (0x1 << 6)
  661. #define RT5677_STO_R_DD1_R_VOL_SFT 6
  662. #define RT5677_M_MONO_R_DD1_R (0x1 << 5)
  663. #define RT5677_M_MONO_R_DD1_R_SFT 5
  664. #define RT5677_MONO_R_DD1_R_VOL_MASK (0x1 << 4)
  665. #define RT5677_MONO_R_DD1_R_VOL_SFT 4
  666. #define RT5677_M_DAC3_R_DD1_R (0x1 << 3)
  667. #define RT5677_M_DAC3_R_DD1_R_SFT 3
  668. #define RT5677_DAC3_R_DD1_R_VOL_MASK (0x1 << 2)
  669. #define RT5677_DAC3_R_DD1_R_VOL_SFT 2
  670. #define RT5677_M_DAC3_L_DD1_R (0x1 << 1)
  671. #define RT5677_M_DAC3_L_DD1_R_SFT 1
  672. #define RT5677_DAC3_L_DD1_R_VOL_MASK (0x1 << 0)
  673. #define RT5677_DAC3_L_DD1_R_VOL_SFT 0
  674. /* DD Mixer 2 Control (0x2d) */
  675. #define RT5677_M_STO_L_DD2_L (0x1 << 15)
  676. #define RT5677_M_STO_L_DD2_L_SFT 15
  677. #define RT5677_STO_L_DD2_L_VOL_MASK (0x1 << 14)
  678. #define RT5677_STO_L_DD2_L_VOL_SFT 14
  679. #define RT5677_M_MONO_L_DD2_L (0x1 << 13)
  680. #define RT5677_M_MONO_L_DD2_L_SFT 13
  681. #define RT5677_MONO_L_DD2_L_VOL_MASK (0x1 << 12)
  682. #define RT5677_MONO_L_DD2_L_VOL_SFT 12
  683. #define RT5677_M_DAC4_L_DD2_L (0x1 << 11)
  684. #define RT5677_M_DAC4_L_DD2_L_SFT 11
  685. #define RT5677_DAC4_L_DD2_L_VOL_MASK (0x1 << 10)
  686. #define RT5677_DAC4_L_DD2_L_VOL_SFT 10
  687. #define RT5677_M_DAC4_R_DD2_L (0x1 << 9)
  688. #define RT5677_M_DAC4_R_DD2_L_SFT 9
  689. #define RT5677_DAC4_R_DD2_L_VOL_MASK (0x1 << 8)
  690. #define RT5677_DAC4_R_DD2_L_VOL_SFT 8
  691. #define RT5677_M_STO_R_DD2_R (0x1 << 7)
  692. #define RT5677_M_STO_R_DD2_R_SFT 7
  693. #define RT5677_STO_R_DD2_R_VOL_MASK (0x1 << 6)
  694. #define RT5677_STO_R_DD2_R_VOL_SFT 6
  695. #define RT5677_M_MONO_R_DD2_R (0x1 << 5)
  696. #define RT5677_M_MONO_R_DD2_R_SFT 5
  697. #define RT5677_MONO_R_DD2_R_VOL_MASK (0x1 << 4)
  698. #define RT5677_MONO_R_DD2_R_VOL_SFT 4
  699. #define RT5677_M_DAC4_R_DD2_R (0x1 << 3)
  700. #define RT5677_M_DAC4_R_DD2_R_SFT 3
  701. #define RT5677_DAC4_R_DD2_R_VOL_MASK (0x1 << 2)
  702. #define RT5677_DAC4_R_DD2_R_VOL_SFT 2
  703. #define RT5677_M_DAC4_L_DD2_R (0x1 << 1)
  704. #define RT5677_M_DAC4_L_DD2_R_SFT 1
  705. #define RT5677_DAC4_L_DD2_R_VOL_MASK (0x1 << 0)
  706. #define RT5677_DAC4_L_DD2_R_VOL_SFT 0
  707. /* IF3 data control (0x2f) */
  708. #define RT5677_IF3_DAC_SEL_MASK (0x3 << 6)
  709. #define RT5677_IF3_DAC_SEL_SFT 6
  710. #define RT5677_IF3_ADC_SEL_MASK (0x3 << 4)
  711. #define RT5677_IF3_ADC_SEL_SFT 4
  712. #define RT5677_IF3_ADC_IN_MASK (0xf << 0)
  713. #define RT5677_IF3_ADC_IN_SFT 0
  714. /* IF4 data control (0x30) */
  715. #define RT5677_IF4_ADC_IN_MASK (0xf << 4)
  716. #define RT5677_IF4_ADC_IN_SFT 4
  717. #define RT5677_IF4_DAC_SEL_MASK (0x3 << 2)
  718. #define RT5677_IF4_DAC_SEL_SFT 2
  719. #define RT5677_IF4_ADC_SEL_MASK (0x3 << 0)
  720. #define RT5677_IF4_ADC_SEL_SFT 0
  721. /* PDM Output Control (0x31) */
  722. #define RT5677_M_PDM1_L (0x1 << 15)
  723. #define RT5677_M_PDM1_L_SFT 15
  724. #define RT5677_SEL_PDM1_L_MASK (0x3 << 12)
  725. #define RT5677_SEL_PDM1_L_SFT 12
  726. #define RT5677_M_PDM1_R (0x1 << 11)
  727. #define RT5677_M_PDM1_R_SFT 11
  728. #define RT5677_SEL_PDM1_R_MASK (0x3 << 8)
  729. #define RT5677_SEL_PDM1_R_SFT 8
  730. #define RT5677_M_PDM2_L (0x1 << 7)
  731. #define RT5677_M_PDM2_L_SFT 7
  732. #define RT5677_SEL_PDM2_L_MASK (0x3 << 4)
  733. #define RT5677_SEL_PDM2_L_SFT 4
  734. #define RT5677_M_PDM2_R (0x1 << 3)
  735. #define RT5677_M_PDM2_R_SFT 3
  736. #define RT5677_SEL_PDM2_R_MASK (0x3 << 0)
  737. #define RT5677_SEL_PDM2_R_SFT 0
  738. /* PDM I2C / Data Control 1 (0x32) */
  739. #define RT5677_PDM2_PW_DOWN (0x1 << 7)
  740. #define RT5677_PDM1_PW_DOWN (0x1 << 6)
  741. #define RT5677_PDM2_BUSY (0x1 << 5)
  742. #define RT5677_PDM1_BUSY (0x1 << 4)
  743. #define RT5677_PDM_PATTERN (0x1 << 3)
  744. #define RT5677_PDM_GAIN (0x1 << 2)
  745. #define RT5677_PDM_DIV_MASK (0x3 << 0)
  746. /* PDM I2C / Data Control 2 (0x33) */
  747. #define RT5677_PDM1_I2C_ID (0xf << 12)
  748. #define RT5677_PDM1_EXE (0x1 << 11)
  749. #define RT5677_PDM1_I2C_CMD (0x1 << 10)
  750. #define RT5677_PDM1_I2C_EXE (0x1 << 9)
  751. #define RT5677_PDM1_I2C_BUSY (0x1 << 8)
  752. #define RT5677_PDM2_I2C_ID (0xf << 4)
  753. #define RT5677_PDM2_EXE (0x1 << 3)
  754. #define RT5677_PDM2_I2C_CMD (0x1 << 2)
  755. #define RT5677_PDM2_I2C_EXE (0x1 << 1)
  756. #define RT5677_PDM2_I2C_BUSY (0x1 << 0)
  757. /* TDM1 control 1 (0x3b) */
  758. #define RT5677_IF1_ADC_MODE_MASK (0x1 << 12)
  759. #define RT5677_IF1_ADC_MODE_SFT 12
  760. #define RT5677_IF1_ADC_MODE_I2S (0x0 << 12)
  761. #define RT5677_IF1_ADC_MODE_TDM (0x1 << 12)
  762. #define RT5677_IF1_ADC1_SWAP_MASK (0x3 << 6)
  763. #define RT5677_IF1_ADC1_SWAP_SFT 6
  764. #define RT5677_IF1_ADC2_SWAP_MASK (0x3 << 4)
  765. #define RT5677_IF1_ADC2_SWAP_SFT 4
  766. #define RT5677_IF1_ADC3_SWAP_MASK (0x3 << 2)
  767. #define RT5677_IF1_ADC3_SWAP_SFT 2
  768. #define RT5677_IF1_ADC4_SWAP_MASK (0x3 << 0)
  769. #define RT5677_IF1_ADC4_SWAP_SFT 0
  770. /* TDM1 control 2 (0x3c) */
  771. #define RT5677_IF1_ADC4_MASK (0x3 << 10)
  772. #define RT5677_IF1_ADC4_SFT 10
  773. #define RT5677_IF1_ADC3_MASK (0x3 << 8)
  774. #define RT5677_IF1_ADC3_SFT 8
  775. #define RT5677_IF1_ADC2_MASK (0x3 << 6)
  776. #define RT5677_IF1_ADC2_SFT 6
  777. #define RT5677_IF1_ADC1_MASK (0x3 << 4)
  778. #define RT5677_IF1_ADC1_SFT 4
  779. #define RT5677_IF1_ADC_CTRL_MASK (0x7 << 0)
  780. #define RT5677_IF1_ADC_CTRL_SFT 0
  781. /* TDM1 control 4 (0x3e) */
  782. #define RT5677_IF1_DAC0_MASK (0x7 << 12)
  783. #define RT5677_IF1_DAC0_SFT 12
  784. #define RT5677_IF1_DAC1_MASK (0x7 << 8)
  785. #define RT5677_IF1_DAC1_SFT 8
  786. #define RT5677_IF1_DAC2_MASK (0x7 << 4)
  787. #define RT5677_IF1_DAC2_SFT 4
  788. #define RT5677_IF1_DAC3_MASK (0x7 << 0)
  789. #define RT5677_IF1_DAC3_SFT 0
  790. /* TDM1 control 5 (0x3f) */
  791. #define RT5677_IF1_DAC4_MASK (0x7 << 12)
  792. #define RT5677_IF1_DAC4_SFT 12
  793. #define RT5677_IF1_DAC5_MASK (0x7 << 8)
  794. #define RT5677_IF1_DAC5_SFT 8
  795. #define RT5677_IF1_DAC6_MASK (0x7 << 4)
  796. #define RT5677_IF1_DAC6_SFT 4
  797. #define RT5677_IF1_DAC7_MASK (0x7 << 0)
  798. #define RT5677_IF1_DAC7_SFT 0
  799. /* TDM2 control 1 (0x40) */
  800. #define RT5677_IF2_ADC_MODE_MASK (0x1 << 12)
  801. #define RT5677_IF2_ADC_MODE_SFT 12
  802. #define RT5677_IF2_ADC_MODE_I2S (0x0 << 12)
  803. #define RT5677_IF2_ADC_MODE_TDM (0x1 << 12)
  804. #define RT5677_IF2_ADC1_SWAP_MASK (0x3 << 6)
  805. #define RT5677_IF2_ADC1_SWAP_SFT 6
  806. #define RT5677_IF2_ADC2_SWAP_MASK (0x3 << 4)
  807. #define RT5677_IF2_ADC2_SWAP_SFT 4
  808. #define RT5677_IF2_ADC3_SWAP_MASK (0x3 << 2)
  809. #define RT5677_IF2_ADC3_SWAP_SFT 2
  810. #define RT5677_IF2_ADC4_SWAP_MASK (0x3 << 0)
  811. #define RT5677_IF2_ADC4_SWAP_SFT 0
  812. /* TDM2 control 2 (0x41) */
  813. #define RT5677_IF2_ADC4_MASK (0x3 << 10)
  814. #define RT5677_IF2_ADC4_SFT 10
  815. #define RT5677_IF2_ADC3_MASK (0x3 << 8)
  816. #define RT5677_IF2_ADC3_SFT 8
  817. #define RT5677_IF2_ADC2_MASK (0x3 << 6)
  818. #define RT5677_IF2_ADC2_SFT 6
  819. #define RT5677_IF2_ADC1_MASK (0x3 << 4)
  820. #define RT5677_IF2_ADC1_SFT 4
  821. #define RT5677_IF2_ADC_CTRL_MASK (0x7 << 0)
  822. #define RT5677_IF2_ADC_CTRL_SFT 0
  823. /* TDM2 control 4 (0x43) */
  824. #define RT5677_IF2_DAC0_MASK (0x7 << 12)
  825. #define RT5677_IF2_DAC0_SFT 12
  826. #define RT5677_IF2_DAC1_MASK (0x7 << 8)
  827. #define RT5677_IF2_DAC1_SFT 8
  828. #define RT5677_IF2_DAC2_MASK (0x7 << 4)
  829. #define RT5677_IF2_DAC2_SFT 4
  830. #define RT5677_IF2_DAC3_MASK (0x7 << 0)
  831. #define RT5677_IF2_DAC3_SFT 0
  832. /* TDM2 control 5 (0x44) */
  833. #define RT5677_IF2_DAC4_MASK (0x7 << 12)
  834. #define RT5677_IF2_DAC4_SFT 12
  835. #define RT5677_IF2_DAC5_MASK (0x7 << 8)
  836. #define RT5677_IF2_DAC5_SFT 8
  837. #define RT5677_IF2_DAC6_MASK (0x7 << 4)
  838. #define RT5677_IF2_DAC6_SFT 4
  839. #define RT5677_IF2_DAC7_MASK (0x7 << 0)
  840. #define RT5677_IF2_DAC7_SFT 0
  841. /* Digital Microphone Control 1 (0x50) */
  842. #define RT5677_DMIC_1_EN_MASK (0x1 << 15)
  843. #define RT5677_DMIC_1_EN_SFT 15
  844. #define RT5677_DMIC_1_DIS (0x0 << 15)
  845. #define RT5677_DMIC_1_EN (0x1 << 15)
  846. #define RT5677_DMIC_2_EN_MASK (0x1 << 14)
  847. #define RT5677_DMIC_2_EN_SFT 14
  848. #define RT5677_DMIC_2_DIS (0x0 << 14)
  849. #define RT5677_DMIC_2_EN (0x1 << 14)
  850. #define RT5677_DMIC_L_STO1_LH_MASK (0x1 << 13)
  851. #define RT5677_DMIC_L_STO1_LH_SFT 13
  852. #define RT5677_DMIC_L_STO1_LH_FALLING (0x0 << 13)
  853. #define RT5677_DMIC_L_STO1_LH_RISING (0x1 << 13)
  854. #define RT5677_DMIC_R_STO1_LH_MASK (0x1 << 12)
  855. #define RT5677_DMIC_R_STO1_LH_SFT 12
  856. #define RT5677_DMIC_R_STO1_LH_FALLING (0x0 << 12)
  857. #define RT5677_DMIC_R_STO1_LH_RISING (0x1 << 12)
  858. #define RT5677_DMIC_L_STO3_LH_MASK (0x1 << 11)
  859. #define RT5677_DMIC_L_STO3_LH_SFT 11
  860. #define RT5677_DMIC_L_STO3_LH_FALLING (0x0 << 11)
  861. #define RT5677_DMIC_L_STO3_LH_RISING (0x1 << 11)
  862. #define RT5677_DMIC_R_STO3_LH_MASK (0x1 << 10)
  863. #define RT5677_DMIC_R_STO3_LH_SFT 10
  864. #define RT5677_DMIC_R_STO3_LH_FALLING (0x0 << 10)
  865. #define RT5677_DMIC_R_STO3_LH_RISING (0x1 << 10)
  866. #define RT5677_DMIC_L_STO2_LH_MASK (0x1 << 9)
  867. #define RT5677_DMIC_L_STO2_LH_SFT 9
  868. #define RT5677_DMIC_L_STO2_LH_FALLING (0x0 << 9)
  869. #define RT5677_DMIC_L_STO2_LH_RISING (0x1 << 9)
  870. #define RT5677_DMIC_R_STO2_LH_MASK (0x1 << 8)
  871. #define RT5677_DMIC_R_STO2_LH_SFT 8
  872. #define RT5677_DMIC_R_STO2_LH_FALLING (0x0 << 8)
  873. #define RT5677_DMIC_R_STO2_LH_RISING (0x1 << 8)
  874. #define RT5677_DMIC_CLK_MASK (0x7 << 5)
  875. #define RT5677_DMIC_CLK_SFT 5
  876. #define RT5677_DMIC_3_EN_MASK (0x1 << 4)
  877. #define RT5677_DMIC_3_EN_SFT 4
  878. #define RT5677_DMIC_3_DIS (0x0 << 4)
  879. #define RT5677_DMIC_3_EN (0x1 << 4)
  880. #define RT5677_DMIC_R_MONO_LH_MASK (0x1 << 2)
  881. #define RT5677_DMIC_R_MONO_LH_SFT 2
  882. #define RT5677_DMIC_R_MONO_LH_FALLING (0x0 << 2)
  883. #define RT5677_DMIC_R_MONO_LH_RISING (0x1 << 2)
  884. #define RT5677_DMIC_L_STO4_LH_MASK (0x1 << 1)
  885. #define RT5677_DMIC_L_STO4_LH_SFT 1
  886. #define RT5677_DMIC_L_STO4_LH_FALLING (0x0 << 1)
  887. #define RT5677_DMIC_L_STO4_LH_RISING (0x1 << 1)
  888. #define RT5677_DMIC_R_STO4_LH_MASK (0x1 << 0)
  889. #define RT5677_DMIC_R_STO4_LH_SFT 0
  890. #define RT5677_DMIC_R_STO4_LH_FALLING (0x0 << 0)
  891. #define RT5677_DMIC_R_STO4_LH_RISING (0x1 << 0)
  892. /* Digital Microphone Control 2 (0x51) */
  893. #define RT5677_DMIC_4_EN_MASK (0x1 << 15)
  894. #define RT5677_DMIC_4_EN_SFT 15
  895. #define RT5677_DMIC_4_DIS (0x0 << 15)
  896. #define RT5677_DMIC_4_EN (0x1 << 15)
  897. #define RT5677_DMIC_4L_LH_MASK (0x1 << 7)
  898. #define RT5677_DMIC_4L_LH_SFT 7
  899. #define RT5677_DMIC_4L_LH_FALLING (0x0 << 7)
  900. #define RT5677_DMIC_4L_LH_RISING (0x1 << 7)
  901. #define RT5677_DMIC_4R_LH_MASK (0x1 << 6)
  902. #define RT5677_DMIC_4R_LH_SFT 6
  903. #define RT5677_DMIC_4R_LH_FALLING (0x0 << 6)
  904. #define RT5677_DMIC_4R_LH_RISING (0x1 << 6)
  905. #define RT5677_DMIC_3L_LH_MASK (0x1 << 5)
  906. #define RT5677_DMIC_3L_LH_SFT 5
  907. #define RT5677_DMIC_3L_LH_FALLING (0x0 << 5)
  908. #define RT5677_DMIC_3L_LH_RISING (0x1 << 5)
  909. #define RT5677_DMIC_3R_LH_MASK (0x1 << 4)
  910. #define RT5677_DMIC_3R_LH_SFT 4
  911. #define RT5677_DMIC_3R_LH_FALLING (0x0 << 4)
  912. #define RT5677_DMIC_3R_LH_RISING (0x1 << 4)
  913. #define RT5677_DMIC_2L_LH_MASK (0x1 << 3)
  914. #define RT5677_DMIC_2L_LH_SFT 3
  915. #define RT5677_DMIC_2L_LH_FALLING (0x0 << 3)
  916. #define RT5677_DMIC_2L_LH_RISING (0x1 << 3)
  917. #define RT5677_DMIC_2R_LH_MASK (0x1 << 2)
  918. #define RT5677_DMIC_2R_LH_SFT 2
  919. #define RT5677_DMIC_2R_LH_FALLING (0x0 << 2)
  920. #define RT5677_DMIC_2R_LH_RISING (0x1 << 2)
  921. #define RT5677_DMIC_1L_LH_MASK (0x1 << 1)
  922. #define RT5677_DMIC_1L_LH_SFT 1
  923. #define RT5677_DMIC_1L_LH_FALLING (0x0 << 1)
  924. #define RT5677_DMIC_1L_LH_RISING (0x1 << 1)
  925. #define RT5677_DMIC_1R_LH_MASK (0x1 << 0)
  926. #define RT5677_DMIC_1R_LH_SFT 0
  927. #define RT5677_DMIC_1R_LH_FALLING (0x0 << 0)
  928. #define RT5677_DMIC_1R_LH_RISING (0x1 << 0)
  929. /* Power Management for Digital 1 (0x61) */
  930. #define RT5677_PWR_I2S1 (0x1 << 15)
  931. #define RT5677_PWR_I2S1_BIT 15
  932. #define RT5677_PWR_I2S2 (0x1 << 14)
  933. #define RT5677_PWR_I2S2_BIT 14
  934. #define RT5677_PWR_I2S3 (0x1 << 13)
  935. #define RT5677_PWR_I2S3_BIT 13
  936. #define RT5677_PWR_DAC1 (0x1 << 12)
  937. #define RT5677_PWR_DAC1_BIT 12
  938. #define RT5677_PWR_DAC2 (0x1 << 11)
  939. #define RT5677_PWR_DAC2_BIT 11
  940. #define RT5677_PWR_I2S4 (0x1 << 10)
  941. #define RT5677_PWR_I2S4_BIT 10
  942. #define RT5677_PWR_SLB (0x1 << 9)
  943. #define RT5677_PWR_SLB_BIT 9
  944. #define RT5677_PWR_DAC3 (0x1 << 7)
  945. #define RT5677_PWR_DAC3_BIT 7
  946. #define RT5677_PWR_ADCFED2 (0x1 << 4)
  947. #define RT5677_PWR_ADCFED2_BIT 4
  948. #define RT5677_PWR_ADCFED1 (0x1 << 3)
  949. #define RT5677_PWR_ADCFED1_BIT 3
  950. #define RT5677_PWR_ADC_L (0x1 << 2)
  951. #define RT5677_PWR_ADC_L_BIT 2
  952. #define RT5677_PWR_ADC_R (0x1 << 1)
  953. #define RT5677_PWR_ADC_R_BIT 1
  954. #define RT5677_PWR_I2C_MASTER (0x1 << 0)
  955. #define RT5677_PWR_I2C_MASTER_BIT 0
  956. /* Power Management for Digital 2 (0x62) */
  957. #define RT5677_PWR_ADC_S1F (0x1 << 15)
  958. #define RT5677_PWR_ADC_S1F_BIT 15
  959. #define RT5677_PWR_ADC_MF_L (0x1 << 14)
  960. #define RT5677_PWR_ADC_MF_L_BIT 14
  961. #define RT5677_PWR_ADC_MF_R (0x1 << 13)
  962. #define RT5677_PWR_ADC_MF_R_BIT 13
  963. #define RT5677_PWR_DAC_S1F (0x1 << 12)
  964. #define RT5677_PWR_DAC_S1F_BIT 12
  965. #define RT5677_PWR_DAC_M2F_L (0x1 << 11)
  966. #define RT5677_PWR_DAC_M2F_L_BIT 11
  967. #define RT5677_PWR_DAC_M2F_R (0x1 << 10)
  968. #define RT5677_PWR_DAC_M2F_R_BIT 10
  969. #define RT5677_PWR_DAC_M3F_L (0x1 << 9)
  970. #define RT5677_PWR_DAC_M3F_L_BIT 9
  971. #define RT5677_PWR_DAC_M3F_R (0x1 << 8)
  972. #define RT5677_PWR_DAC_M3F_R_BIT 8
  973. #define RT5677_PWR_DAC_M4F_L (0x1 << 7)
  974. #define RT5677_PWR_DAC_M4F_L_BIT 7
  975. #define RT5677_PWR_DAC_M4F_R (0x1 << 6)
  976. #define RT5677_PWR_DAC_M4F_R_BIT 6
  977. #define RT5677_PWR_ADC_S2F (0x1 << 5)
  978. #define RT5677_PWR_ADC_S2F_BIT 5
  979. #define RT5677_PWR_ADC_S3F (0x1 << 4)
  980. #define RT5677_PWR_ADC_S3F_BIT 4
  981. #define RT5677_PWR_ADC_S4F (0x1 << 3)
  982. #define RT5677_PWR_ADC_S4F_BIT 3
  983. #define RT5677_PWR_PDM1 (0x1 << 2)
  984. #define RT5677_PWR_PDM1_BIT 2
  985. #define RT5677_PWR_PDM2 (0x1 << 1)
  986. #define RT5677_PWR_PDM2_BIT 1
  987. /* Power Management for Analog 1 (0x63) */
  988. #define RT5677_PWR_VREF1 (0x1 << 15)
  989. #define RT5677_PWR_VREF1_BIT 15
  990. #define RT5677_PWR_FV1 (0x1 << 14)
  991. #define RT5677_PWR_FV1_BIT 14
  992. #define RT5677_PWR_MB (0x1 << 13)
  993. #define RT5677_PWR_MB_BIT 13
  994. #define RT5677_PWR_LO1 (0x1 << 12)
  995. #define RT5677_PWR_LO1_BIT 12
  996. #define RT5677_PWR_BG (0x1 << 11)
  997. #define RT5677_PWR_BG_BIT 11
  998. #define RT5677_PWR_LO2 (0x1 << 10)
  999. #define RT5677_PWR_LO2_BIT 10
  1000. #define RT5677_PWR_LO3 (0x1 << 9)
  1001. #define RT5677_PWR_LO3_BIT 9
  1002. #define RT5677_PWR_VREF2 (0x1 << 8)
  1003. #define RT5677_PWR_VREF2_BIT 8
  1004. #define RT5677_PWR_FV2 (0x1 << 7)
  1005. #define RT5677_PWR_FV2_BIT 7
  1006. #define RT5677_LDO2_SEL_MASK (0x7 << 4)
  1007. #define RT5677_LDO2_SEL_SFT 4
  1008. #define RT5677_LDO1_SEL_MASK (0x7 << 0)
  1009. #define RT5677_LDO1_SEL_SFT 0
  1010. /* Power Management for Analog 2 (0x64) */
  1011. #define RT5677_PWR_BST1 (0x1 << 15)
  1012. #define RT5677_PWR_BST1_BIT 15
  1013. #define RT5677_PWR_BST2 (0x1 << 14)
  1014. #define RT5677_PWR_BST2_BIT 14
  1015. #define RT5677_PWR_CLK_MB1 (0x1 << 13)
  1016. #define RT5677_PWR_CLK_MB1_BIT 13
  1017. #define RT5677_PWR_SLIM (0x1 << 12)
  1018. #define RT5677_PWR_SLIM_BIT 12
  1019. #define RT5677_PWR_MB1 (0x1 << 11)
  1020. #define RT5677_PWR_MB1_BIT 11
  1021. #define RT5677_PWR_PP_MB1 (0x1 << 10)
  1022. #define RT5677_PWR_PP_MB1_BIT 10
  1023. #define RT5677_PWR_PLL1 (0x1 << 9)
  1024. #define RT5677_PWR_PLL1_BIT 9
  1025. #define RT5677_PWR_PLL2 (0x1 << 8)
  1026. #define RT5677_PWR_PLL2_BIT 8
  1027. #define RT5677_PWR_CORE (0x1 << 7)
  1028. #define RT5677_PWR_CORE_BIT 7
  1029. #define RT5677_PWR_CLK_MB (0x1 << 6)
  1030. #define RT5677_PWR_CLK_MB_BIT 6
  1031. #define RT5677_PWR_BST1_P (0x1 << 5)
  1032. #define RT5677_PWR_BST1_P_BIT 5
  1033. #define RT5677_PWR_BST2_P (0x1 << 4)
  1034. #define RT5677_PWR_BST2_P_BIT 4
  1035. #define RT5677_PWR_IPTV (0x1 << 3)
  1036. #define RT5677_PWR_IPTV_BIT 3
  1037. #define RT5677_PWR_25M_CLK (0x1 << 1)
  1038. #define RT5677_PWR_25M_CLK_BIT 1
  1039. #define RT5677_PWR_LDO1 (0x1 << 0)
  1040. #define RT5677_PWR_LDO1_BIT 0
  1041. /* Power Management for DSP (0x65) */
  1042. #define RT5677_PWR_SR7 (0x1 << 10)
  1043. #define RT5677_PWR_SR7_BIT 10
  1044. #define RT5677_PWR_SR6 (0x1 << 9)
  1045. #define RT5677_PWR_SR6_BIT 9
  1046. #define RT5677_PWR_SR5 (0x1 << 8)
  1047. #define RT5677_PWR_SR5_BIT 8
  1048. #define RT5677_PWR_SR4 (0x1 << 7)
  1049. #define RT5677_PWR_SR4_BIT 7
  1050. #define RT5677_PWR_SR3 (0x1 << 6)
  1051. #define RT5677_PWR_SR3_BIT 6
  1052. #define RT5677_PWR_SR2 (0x1 << 5)
  1053. #define RT5677_PWR_SR2_BIT 5
  1054. #define RT5677_PWR_SR1 (0x1 << 4)
  1055. #define RT5677_PWR_SR1_BIT 4
  1056. #define RT5677_PWR_SR0 (0x1 << 3)
  1057. #define RT5677_PWR_SR0_BIT 3
  1058. #define RT5677_PWR_MLT (0x1 << 2)
  1059. #define RT5677_PWR_MLT_BIT 2
  1060. #define RT5677_PWR_DSP (0x1 << 1)
  1061. #define RT5677_PWR_DSP_BIT 1
  1062. #define RT5677_PWR_DSP_CPU (0x1 << 0)
  1063. #define RT5677_PWR_DSP_CPU_BIT 0
  1064. /* Power Status for DSP (0x66) */
  1065. #define RT5677_PWR_SR7_RDY (0x1 << 9)
  1066. #define RT5677_PWR_SR7_RDY_BIT 9
  1067. #define RT5677_PWR_SR6_RDY (0x1 << 8)
  1068. #define RT5677_PWR_SR6_RDY_BIT 8
  1069. #define RT5677_PWR_SR5_RDY (0x1 << 7)
  1070. #define RT5677_PWR_SR5_RDY_BIT 7
  1071. #define RT5677_PWR_SR4_RDY (0x1 << 6)
  1072. #define RT5677_PWR_SR4_RDY_BIT 6
  1073. #define RT5677_PWR_SR3_RDY (0x1 << 5)
  1074. #define RT5677_PWR_SR3_RDY_BIT 5
  1075. #define RT5677_PWR_SR2_RDY (0x1 << 4)
  1076. #define RT5677_PWR_SR2_RDY_BIT 4
  1077. #define RT5677_PWR_SR1_RDY (0x1 << 3)
  1078. #define RT5677_PWR_SR1_RDY_BIT 3
  1079. #define RT5677_PWR_SR0_RDY (0x1 << 2)
  1080. #define RT5677_PWR_SR0_RDY_BIT 2
  1081. #define RT5677_PWR_MLT_RDY (0x1 << 1)
  1082. #define RT5677_PWR_MLT_RDY_BIT 1
  1083. #define RT5677_PWR_DSP_RDY (0x1 << 0)
  1084. #define RT5677_PWR_DSP_RDY_BIT 0
  1085. /* Power Management for DSP (0x67) */
  1086. #define RT5677_PWR_SLIM_ISO (0x1 << 11)
  1087. #define RT5677_PWR_SLIM_ISO_BIT 11
  1088. #define RT5677_PWR_CORE_ISO (0x1 << 10)
  1089. #define RT5677_PWR_CORE_ISO_BIT 10
  1090. #define RT5677_PWR_DSP_ISO (0x1 << 9)
  1091. #define RT5677_PWR_DSP_ISO_BIT 9
  1092. #define RT5677_PWR_SR7_ISO (0x1 << 8)
  1093. #define RT5677_PWR_SR7_ISO_BIT 8
  1094. #define RT5677_PWR_SR6_ISO (0x1 << 7)
  1095. #define RT5677_PWR_SR6_ISO_BIT 7
  1096. #define RT5677_PWR_SR5_ISO (0x1 << 6)
  1097. #define RT5677_PWR_SR5_ISO_BIT 6
  1098. #define RT5677_PWR_SR4_ISO (0x1 << 5)
  1099. #define RT5677_PWR_SR4_ISO_BIT 5
  1100. #define RT5677_PWR_SR3_ISO (0x1 << 4)
  1101. #define RT5677_PWR_SR3_ISO_BIT 4
  1102. #define RT5677_PWR_SR2_ISO (0x1 << 3)
  1103. #define RT5677_PWR_SR2_ISO_BIT 3
  1104. #define RT5677_PWR_SR1_ISO (0x1 << 2)
  1105. #define RT5677_PWR_SR1_ISO_BIT 2
  1106. #define RT5677_PWR_SR0_ISO (0x1 << 1)
  1107. #define RT5677_PWR_SR0_ISO_BIT 1
  1108. #define RT5677_PWR_MLT_ISO (0x1 << 0)
  1109. #define RT5677_PWR_MLT_ISO_BIT 0
  1110. /* I2S1/2/3/4 Audio Serial Data Port Control (0x6f 0x70 0x71 0x72) */
  1111. #define RT5677_I2S_MS_MASK (0x1 << 15)
  1112. #define RT5677_I2S_MS_SFT 15
  1113. #define RT5677_I2S_MS_M (0x0 << 15)
  1114. #define RT5677_I2S_MS_S (0x1 << 15)
  1115. #define RT5677_I2S_O_CP_MASK (0x3 << 10)
  1116. #define RT5677_I2S_O_CP_SFT 10
  1117. #define RT5677_I2S_O_CP_OFF (0x0 << 10)
  1118. #define RT5677_I2S_O_CP_U_LAW (0x1 << 10)
  1119. #define RT5677_I2S_O_CP_A_LAW (0x2 << 10)
  1120. #define RT5677_I2S_I_CP_MASK (0x3 << 8)
  1121. #define RT5677_I2S_I_CP_SFT 8
  1122. #define RT5677_I2S_I_CP_OFF (0x0 << 8)
  1123. #define RT5677_I2S_I_CP_U_LAW (0x1 << 8)
  1124. #define RT5677_I2S_I_CP_A_LAW (0x2 << 8)
  1125. #define RT5677_I2S_BP_MASK (0x1 << 7)
  1126. #define RT5677_I2S_BP_SFT 7
  1127. #define RT5677_I2S_BP_NOR (0x0 << 7)
  1128. #define RT5677_I2S_BP_INV (0x1 << 7)
  1129. #define RT5677_I2S_DL_MASK (0x3 << 2)
  1130. #define RT5677_I2S_DL_SFT 2
  1131. #define RT5677_I2S_DL_16 (0x0 << 2)
  1132. #define RT5677_I2S_DL_20 (0x1 << 2)
  1133. #define RT5677_I2S_DL_24 (0x2 << 2)
  1134. #define RT5677_I2S_DL_8 (0x3 << 2)
  1135. #define RT5677_I2S_DF_MASK (0x3 << 0)
  1136. #define RT5677_I2S_DF_SFT 0
  1137. #define RT5677_I2S_DF_I2S (0x0 << 0)
  1138. #define RT5677_I2S_DF_LEFT (0x1 << 0)
  1139. #define RT5677_I2S_DF_PCM_A (0x2 << 0)
  1140. #define RT5677_I2S_DF_PCM_B (0x3 << 0)
  1141. /* Clock Tree Control 1 (0x73) */
  1142. #define RT5677_I2S_PD1_MASK (0x7 << 12)
  1143. #define RT5677_I2S_PD1_SFT 12
  1144. #define RT5677_I2S_PD1_1 (0x0 << 12)
  1145. #define RT5677_I2S_PD1_2 (0x1 << 12)
  1146. #define RT5677_I2S_PD1_3 (0x2 << 12)
  1147. #define RT5677_I2S_PD1_4 (0x3 << 12)
  1148. #define RT5677_I2S_PD1_6 (0x4 << 12)
  1149. #define RT5677_I2S_PD1_8 (0x5 << 12)
  1150. #define RT5677_I2S_PD1_12 (0x6 << 12)
  1151. #define RT5677_I2S_PD1_16 (0x7 << 12)
  1152. #define RT5677_I2S_BCLK_MS2_MASK (0x1 << 11)
  1153. #define RT5677_I2S_BCLK_MS2_SFT 11
  1154. #define RT5677_I2S_BCLK_MS2_32 (0x0 << 11)
  1155. #define RT5677_I2S_BCLK_MS2_64 (0x1 << 11)
  1156. #define RT5677_I2S_PD2_MASK (0x7 << 8)
  1157. #define RT5677_I2S_PD2_SFT 8
  1158. #define RT5677_I2S_PD2_1 (0x0 << 8)
  1159. #define RT5677_I2S_PD2_2 (0x1 << 8)
  1160. #define RT5677_I2S_PD2_3 (0x2 << 8)
  1161. #define RT5677_I2S_PD2_4 (0x3 << 8)
  1162. #define RT5677_I2S_PD2_6 (0x4 << 8)
  1163. #define RT5677_I2S_PD2_8 (0x5 << 8)
  1164. #define RT5677_I2S_PD2_12 (0x6 << 8)
  1165. #define RT5677_I2S_PD2_16 (0x7 << 8)
  1166. #define RT5677_I2S_BCLK_MS3_MASK (0x1 << 7)
  1167. #define RT5677_I2S_BCLK_MS3_SFT 7
  1168. #define RT5677_I2S_BCLK_MS3_32 (0x0 << 7)
  1169. #define RT5677_I2S_BCLK_MS3_64 (0x1 << 7)
  1170. #define RT5677_I2S_PD3_MASK (0x7 << 4)
  1171. #define RT5677_I2S_PD3_SFT 4
  1172. #define RT5677_I2S_PD3_1 (0x0 << 4)
  1173. #define RT5677_I2S_PD3_2 (0x1 << 4)
  1174. #define RT5677_I2S_PD3_3 (0x2 << 4)
  1175. #define RT5677_I2S_PD3_4 (0x3 << 4)
  1176. #define RT5677_I2S_PD3_6 (0x4 << 4)
  1177. #define RT5677_I2S_PD3_8 (0x5 << 4)
  1178. #define RT5677_I2S_PD3_12 (0x6 << 4)
  1179. #define RT5677_I2S_PD3_16 (0x7 << 4)
  1180. #define RT5677_I2S_BCLK_MS4_MASK (0x1 << 3)
  1181. #define RT5677_I2S_BCLK_MS4_SFT 3
  1182. #define RT5677_I2S_BCLK_MS4_32 (0x0 << 3)
  1183. #define RT5677_I2S_BCLK_MS4_64 (0x1 << 3)
  1184. #define RT5677_I2S_PD4_MASK (0x7 << 0)
  1185. #define RT5677_I2S_PD4_SFT 0
  1186. #define RT5677_I2S_PD4_1 (0x0 << 0)
  1187. #define RT5677_I2S_PD4_2 (0x1 << 0)
  1188. #define RT5677_I2S_PD4_3 (0x2 << 0)
  1189. #define RT5677_I2S_PD4_4 (0x3 << 0)
  1190. #define RT5677_I2S_PD4_6 (0x4 << 0)
  1191. #define RT5677_I2S_PD4_8 (0x5 << 0)
  1192. #define RT5677_I2S_PD4_12 (0x6 << 0)
  1193. #define RT5677_I2S_PD4_16 (0x7 << 0)
  1194. /* Clock Tree Control 2 (0x74) */
  1195. #define RT5677_I2S_PD5_MASK (0x7 << 12)
  1196. #define RT5677_I2S_PD5_SFT 12
  1197. #define RT5677_I2S_PD5_1 (0x0 << 12)
  1198. #define RT5677_I2S_PD5_2 (0x1 << 12)
  1199. #define RT5677_I2S_PD5_3 (0x2 << 12)
  1200. #define RT5677_I2S_PD5_4 (0x3 << 12)
  1201. #define RT5677_I2S_PD5_6 (0x4 << 12)
  1202. #define RT5677_I2S_PD5_8 (0x5 << 12)
  1203. #define RT5677_I2S_PD5_12 (0x6 << 12)
  1204. #define RT5677_I2S_PD5_16 (0x7 << 12)
  1205. #define RT5677_I2S_PD6_MASK (0x7 << 8)
  1206. #define RT5677_I2S_PD6_SFT 8
  1207. #define RT5677_I2S_PD6_1 (0x0 << 8)
  1208. #define RT5677_I2S_PD6_2 (0x1 << 8)
  1209. #define RT5677_I2S_PD6_3 (0x2 << 8)
  1210. #define RT5677_I2S_PD6_4 (0x3 << 8)
  1211. #define RT5677_I2S_PD6_6 (0x4 << 8)
  1212. #define RT5677_I2S_PD6_8 (0x5 << 8)
  1213. #define RT5677_I2S_PD6_12 (0x6 << 8)
  1214. #define RT5677_I2S_PD6_16 (0x7 << 8)
  1215. #define RT5677_I2S_PD7_MASK (0x7 << 4)
  1216. #define RT5677_I2S_PD7_SFT 4
  1217. #define RT5677_I2S_PD7_1 (0x0 << 4)
  1218. #define RT5677_I2S_PD7_2 (0x1 << 4)
  1219. #define RT5677_I2S_PD7_3 (0x2 << 4)
  1220. #define RT5677_I2S_PD7_4 (0x3 << 4)
  1221. #define RT5677_I2S_PD7_6 (0x4 << 4)
  1222. #define RT5677_I2S_PD7_8 (0x5 << 4)
  1223. #define RT5677_I2S_PD7_12 (0x6 << 4)
  1224. #define RT5677_I2S_PD7_16 (0x7 << 4)
  1225. #define RT5677_I2S_PD8_MASK (0x7 << 0)
  1226. #define RT5677_I2S_PD8_SFT 0
  1227. #define RT5677_I2S_PD8_1 (0x0 << 0)
  1228. #define RT5677_I2S_PD8_2 (0x1 << 0)
  1229. #define RT5677_I2S_PD8_3 (0x2 << 0)
  1230. #define RT5677_I2S_PD8_4 (0x3 << 0)
  1231. #define RT5677_I2S_PD8_6 (0x4 << 0)
  1232. #define RT5677_I2S_PD8_8 (0x5 << 0)
  1233. #define RT5677_I2S_PD8_12 (0x6 << 0)
  1234. #define RT5677_I2S_PD8_16 (0x7 << 0)
  1235. /* Clock Tree Control 3 (0x75) */
  1236. #define RT5677_DSP_ASRC_O_MASK (0x3 << 6)
  1237. #define RT5677_DSP_ASRC_O_SFT 6
  1238. #define RT5677_DSP_ASRC_O_1_0 (0x0 << 6)
  1239. #define RT5677_DSP_ASRC_O_1_5 (0x1 << 6)
  1240. #define RT5677_DSP_ASRC_O_2_0 (0x2 << 6)
  1241. #define RT5677_DSP_ASRC_O_3_0 (0x3 << 6)
  1242. #define RT5677_DSP_ASRC_I_MASK (0x3 << 4)
  1243. #define RT5677_DSP_ASRC_I_SFT 4
  1244. #define RT5677_DSP_ASRC_I_1_0 (0x0 << 4)
  1245. #define RT5677_DSP_ASRC_I_1_5 (0x1 << 4)
  1246. #define RT5677_DSP_ASRC_I_2_0 (0x2 << 4)
  1247. #define RT5677_DSP_ASRC_I_3_0 (0x3 << 4)
  1248. #define RT5677_DSP_BUS_PD_MASK (0x7 << 0)
  1249. #define RT5677_DSP_BUS_PD_SFT 0
  1250. #define RT5677_DSP_BUS_PD_1 (0x0 << 0)
  1251. #define RT5677_DSP_BUS_PD_2 (0x1 << 0)
  1252. #define RT5677_DSP_BUS_PD_3 (0x2 << 0)
  1253. #define RT5677_DSP_BUS_PD_4 (0x3 << 0)
  1254. #define RT5677_DSP_BUS_PD_6 (0x4 << 0)
  1255. #define RT5677_DSP_BUS_PD_8 (0x5 << 0)
  1256. #define RT5677_DSP_BUS_PD_12 (0x6 << 0)
  1257. #define RT5677_DSP_BUS_PD_16 (0x7 << 0)
  1258. #define RT5677_PLL_INP_MAX 40000000
  1259. #define RT5677_PLL_INP_MIN 2048000
  1260. /* PLL M/N/K Code Control 1 (0x7a 0x7c) */
  1261. #define RT5677_PLL_N_MAX 0x1ff
  1262. #define RT5677_PLL_N_MASK (RT5677_PLL_N_MAX << 7)
  1263. #define RT5677_PLL_N_SFT 7
  1264. #define RT5677_PLL_K_BP (0x1 << 5)
  1265. #define RT5677_PLL_K_BP_SFT 5
  1266. #define RT5677_PLL_K_MAX 0x1f
  1267. #define RT5677_PLL_K_MASK (RT5677_PLL_K_MAX)
  1268. #define RT5677_PLL_K_SFT 0
  1269. /* PLL M/N/K Code Control 2 (0x7b 0x7d) */
  1270. #define RT5677_PLL_M_MAX 0xf
  1271. #define RT5677_PLL_M_MASK (RT5677_PLL_M_MAX << 12)
  1272. #define RT5677_PLL_M_SFT 12
  1273. #define RT5677_PLL_M_BP (0x1 << 11)
  1274. #define RT5677_PLL_M_BP_SFT 11
  1275. /* Global Clock Control 1 (0x80) */
  1276. #define RT5677_SCLK_SRC_MASK (0x3 << 14)
  1277. #define RT5677_SCLK_SRC_SFT 14
  1278. #define RT5677_SCLK_SRC_MCLK (0x0 << 14)
  1279. #define RT5677_SCLK_SRC_PLL1 (0x1 << 14)
  1280. #define RT5677_SCLK_SRC_RCCLK (0x2 << 14) /* 25MHz */
  1281. #define RT5677_SCLK_SRC_SLIM (0x3 << 14)
  1282. #define RT5677_PLL1_SRC_MASK (0x7 << 11)
  1283. #define RT5677_PLL1_SRC_SFT 11
  1284. #define RT5677_PLL1_SRC_MCLK (0x0 << 11)
  1285. #define RT5677_PLL1_SRC_BCLK1 (0x1 << 11)
  1286. #define RT5677_PLL1_SRC_BCLK2 (0x2 << 11)
  1287. #define RT5677_PLL1_SRC_BCLK3 (0x3 << 11)
  1288. #define RT5677_PLL1_SRC_BCLK4 (0x4 << 11)
  1289. #define RT5677_PLL1_SRC_RCCLK (0x5 << 11)
  1290. #define RT5677_PLL1_SRC_SLIM (0x6 << 11)
  1291. #define RT5677_MCLK_SRC_MASK (0x1 << 10)
  1292. #define RT5677_MCLK_SRC_SFT 10
  1293. #define RT5677_MCLK1_SRC (0x0 << 10)
  1294. #define RT5677_MCLK2_SRC (0x1 << 10)
  1295. #define RT5677_PLL1_PD_MASK (0x1 << 8)
  1296. #define RT5677_PLL1_PD_SFT 8
  1297. #define RT5677_PLL1_PD_1 (0x0 << 8)
  1298. #define RT5677_PLL1_PD_2 (0x1 << 8)
  1299. #define RT5677_DAC_OSR_MASK (0x3 << 6)
  1300. #define RT5677_DAC_OSR_SFT 6
  1301. #define RT5677_DAC_OSR_128 (0x0 << 6)
  1302. #define RT5677_DAC_OSR_64 (0x1 << 6)
  1303. #define RT5677_DAC_OSR_32 (0x2 << 6)
  1304. #define RT5677_ADC_OSR_MASK (0x3 << 4)
  1305. #define RT5677_ADC_OSR_SFT 4
  1306. #define RT5677_ADC_OSR_128 (0x0 << 4)
  1307. #define RT5677_ADC_OSR_64 (0x1 << 4)
  1308. #define RT5677_ADC_OSR_32 (0x2 << 4)
  1309. /* Global Clock Control 2 (0x81) */
  1310. #define RT5677_PLL2_PR_SRC_MASK (0x1 << 15)
  1311. #define RT5677_PLL2_PR_SRC_SFT 15
  1312. #define RT5677_PLL2_PR_SRC_MCLK1 (0x0 << 15)
  1313. #define RT5677_PLL2_PR_SRC_MCLK2 (0x1 << 15)
  1314. #define RT5677_PLL2_SRC_MASK (0x7 << 12)
  1315. #define RT5677_PLL2_SRC_SFT 12
  1316. #define RT5677_PLL2_SRC_MCLK (0x0 << 12)
  1317. #define RT5677_PLL2_SRC_BCLK1 (0x1 << 12)
  1318. #define RT5677_PLL2_SRC_BCLK2 (0x2 << 12)
  1319. #define RT5677_PLL2_SRC_BCLK3 (0x3 << 12)
  1320. #define RT5677_PLL2_SRC_BCLK4 (0x4 << 12)
  1321. #define RT5677_PLL2_SRC_RCCLK (0x5 << 12)
  1322. #define RT5677_PLL2_SRC_SLIM (0x6 << 12)
  1323. #define RT5677_DSP_ASRC_O_SRC (0x3 << 10)
  1324. #define RT5677_DSP_ASRC_O_SRC_SFT 10
  1325. #define RT5677_DSP_ASRC_O_MCLK (0x0 << 10)
  1326. #define RT5677_DSP_ASRC_O_PLL1 (0x1 << 10)
  1327. #define RT5677_DSP_ASRC_O_SLIM (0x2 << 10)
  1328. #define RT5677_DSP_ASRC_O_RCCLK (0x3 << 10)
  1329. #define RT5677_DSP_ASRC_I_SRC (0x3 << 8)
  1330. #define RT5677_DSP_ASRC_I_SRC_SFT 8
  1331. #define RT5677_DSP_ASRC_I_MCLK (0x0 << 8)
  1332. #define RT5677_DSP_ASRC_I_PLL1 (0x1 << 8)
  1333. #define RT5677_DSP_ASRC_I_SLIM (0x2 << 8)
  1334. #define RT5677_DSP_ASRC_I_RCCLK (0x3 << 8)
  1335. #define RT5677_DSP_CLK_SRC_MASK (0x1 << 7)
  1336. #define RT5677_DSP_CLK_SRC_SFT 7
  1337. #define RT5677_DSP_CLK_SRC_PLL2 (0x0 << 7)
  1338. #define RT5677_DSP_CLK_SRC_BYPASS (0x1 << 7)
  1339. /* ASRC Control 3 (0x85) */
  1340. #define RT5677_DA_STO_CLK_SEL_MASK (0xf << 12)
  1341. #define RT5677_DA_STO_CLK_SEL_SFT 12
  1342. #define RT5677_DA_MONO2L_CLK_SEL_MASK (0xf << 4)
  1343. #define RT5677_DA_MONO2L_CLK_SEL_SFT 4
  1344. #define RT5677_DA_MONO2R_CLK_SEL_MASK (0xf << 0)
  1345. #define RT5677_DA_MONO2R_CLK_SEL_SFT 0
  1346. /* ASRC Control 4 (0x86) */
  1347. #define RT5677_DA_MONO3L_CLK_SEL_MASK (0xf << 12)
  1348. #define RT5677_DA_MONO3L_CLK_SEL_SFT 12
  1349. #define RT5677_DA_MONO3R_CLK_SEL_MASK (0xf << 8)
  1350. #define RT5677_DA_MONO3R_CLK_SEL_SFT 8
  1351. #define RT5677_DA_MONO4L_CLK_SEL_MASK (0xf << 4)
  1352. #define RT5677_DA_MONO4L_CLK_SEL_SFT 4
  1353. #define RT5677_DA_MONO4R_CLK_SEL_MASK (0xf << 0)
  1354. #define RT5677_DA_MONO4R_CLK_SEL_SFT 0
  1355. /* ASRC Control 5 (0x87) */
  1356. #define RT5677_AD_STO1_CLK_SEL_MASK (0xf << 12)
  1357. #define RT5677_AD_STO1_CLK_SEL_SFT 12
  1358. #define RT5677_AD_STO2_CLK_SEL_MASK (0xf << 8)
  1359. #define RT5677_AD_STO2_CLK_SEL_SFT 8
  1360. #define RT5677_AD_STO3_CLK_SEL_MASK (0xf << 4)
  1361. #define RT5677_AD_STO3_CLK_SEL_SFT 4
  1362. #define RT5677_AD_STO4_CLK_SEL_MASK (0xf << 0)
  1363. #define RT5677_AD_STO4_CLK_SEL_SFT 0
  1364. /* ASRC Control 6 (0x88) */
  1365. #define RT5677_AD_MONOL_CLK_SEL_MASK (0xf << 12)
  1366. #define RT5677_AD_MONOL_CLK_SEL_SFT 12
  1367. #define RT5677_AD_MONOR_CLK_SEL_MASK (0xf << 8)
  1368. #define RT5677_AD_MONOR_CLK_SEL_SFT 8
  1369. /* ASRC Control 7 (0x89) */
  1370. #define RT5677_DSP_OB_0_3_CLK_SEL_MASK (0xf << 12)
  1371. #define RT5677_DSP_OB_0_3_CLK_SEL_SFT 12
  1372. #define RT5677_DSP_OB_4_7_CLK_SEL_MASK (0xf << 8)
  1373. #define RT5677_DSP_OB_4_7_CLK_SEL_SFT 8
  1374. /* ASRC Control 8 (0x8a) */
  1375. #define RT5677_I2S1_CLK_SEL_MASK (0xf << 12)
  1376. #define RT5677_I2S1_CLK_SEL_SFT 12
  1377. #define RT5677_I2S2_CLK_SEL_MASK (0xf << 8)
  1378. #define RT5677_I2S2_CLK_SEL_SFT 8
  1379. #define RT5677_I2S3_CLK_SEL_MASK (0xf << 4)
  1380. #define RT5677_I2S3_CLK_SEL_SFT 4
  1381. #define RT5677_I2S4_CLK_SEL_MASK (0xf)
  1382. #define RT5677_I2S4_CLK_SEL_SFT 0
  1383. /* VAD Function Control 4 (0x9f) */
  1384. #define RT5677_VAD_SRC_MASK (0x7 << 8)
  1385. #define RT5677_VAD_SRC_SFT 8
  1386. /* DSP InBound Control (0xa3) */
  1387. #define RT5677_IB01_SRC_MASK (0x7 << 12)
  1388. #define RT5677_IB01_SRC_SFT 12
  1389. #define RT5677_IB23_SRC_MASK (0x7 << 8)
  1390. #define RT5677_IB23_SRC_SFT 8
  1391. #define RT5677_IB45_SRC_MASK (0x7 << 4)
  1392. #define RT5677_IB45_SRC_SFT 4
  1393. #define RT5677_IB6_SRC_MASK (0x7 << 0)
  1394. #define RT5677_IB6_SRC_SFT 0
  1395. /* DSP InBound Control (0xa4) */
  1396. #define RT5677_IB7_SRC_MASK (0x7 << 12)
  1397. #define RT5677_IB7_SRC_SFT 12
  1398. #define RT5677_IB8_SRC_MASK (0x7 << 8)
  1399. #define RT5677_IB8_SRC_SFT 8
  1400. #define RT5677_IB9_SRC_MASK (0x7 << 4)
  1401. #define RT5677_IB9_SRC_SFT 4
  1402. /* DSP In/OutBound Control (0xa5) */
  1403. #define RT5677_SEL_SRC_OB23 (0x1 << 4)
  1404. #define RT5677_SEL_SRC_OB23_SFT 4
  1405. #define RT5677_SEL_SRC_OB01 (0x1 << 3)
  1406. #define RT5677_SEL_SRC_OB01_SFT 3
  1407. #define RT5677_SEL_SRC_IB45 (0x1 << 2)
  1408. #define RT5677_SEL_SRC_IB45_SFT 2
  1409. #define RT5677_SEL_SRC_IB23 (0x1 << 1)
  1410. #define RT5677_SEL_SRC_IB23_SFT 1
  1411. #define RT5677_SEL_SRC_IB01 (0x1 << 0)
  1412. #define RT5677_SEL_SRC_IB01_SFT 0
  1413. /* Jack Detect Control 1 (0xb5) */
  1414. #define RT5677_SEL_GPIO_JD1_MASK (0x3 << 14)
  1415. #define RT5677_SEL_GPIO_JD1_SFT 14
  1416. #define RT5677_SEL_GPIO_JD2_MASK (0x3 << 12)
  1417. #define RT5677_SEL_GPIO_JD2_SFT 12
  1418. #define RT5677_SEL_GPIO_JD3_MASK (0x3 << 10)
  1419. #define RT5677_SEL_GPIO_JD3_SFT 10
  1420. /* IRQ Control 1 (0xbd) */
  1421. #define RT5677_STA_GPIO_JD1 (0x1 << 15)
  1422. #define RT5677_STA_GPIO_JD1_SFT 15
  1423. #define RT5677_EN_IRQ_GPIO_JD1 (0x1 << 14)
  1424. #define RT5677_EN_IRQ_GPIO_JD1_SFT 14
  1425. #define RT5677_EN_GPIO_JD1_STICKY (0x1 << 13)
  1426. #define RT5677_EN_GPIO_JD1_STICKY_SFT 13
  1427. #define RT5677_INV_GPIO_JD1 (0x1 << 12)
  1428. #define RT5677_INV_GPIO_JD1_SFT 12
  1429. #define RT5677_STA_GPIO_JD2 (0x1 << 11)
  1430. #define RT5677_STA_GPIO_JD2_SFT 11
  1431. #define RT5677_EN_IRQ_GPIO_JD2 (0x1 << 10)
  1432. #define RT5677_EN_IRQ_GPIO_JD2_SFT 10
  1433. #define RT5677_EN_GPIO_JD2_STICKY (0x1 << 9)
  1434. #define RT5677_EN_GPIO_JD2_STICKY_SFT 9
  1435. #define RT5677_INV_GPIO_JD2 (0x1 << 8)
  1436. #define RT5677_INV_GPIO_JD2_SFT 8
  1437. #define RT5677_STA_MICBIAS1_OVCD (0x1 << 7)
  1438. #define RT5677_STA_MICBIAS1_OVCD_SFT 7
  1439. #define RT5677_EN_IRQ_MICBIAS1_OVCD (0x1 << 6)
  1440. #define RT5677_EN_IRQ_MICBIAS1_OVCD_SFT 6
  1441. #define RT5677_EN_MICBIAS1_OVCD_STICKY (0x1 << 5)
  1442. #define RT5677_EN_MICBIAS1_OVCD_STICKY_SFT 5
  1443. #define RT5677_INV_MICBIAS1_OVCD (0x1 << 4)
  1444. #define RT5677_INV_MICBIAS1_OVCD_SFT 4
  1445. #define RT5677_STA_GPIO_JD3 (0x1 << 3)
  1446. #define RT5677_STA_GPIO_JD3_SFT 3
  1447. #define RT5677_EN_IRQ_GPIO_JD3 (0x1 << 2)
  1448. #define RT5677_EN_IRQ_GPIO_JD3_SFT 2
  1449. #define RT5677_EN_GPIO_JD3_STICKY (0x1 << 1)
  1450. #define RT5677_EN_GPIO_JD3_STICKY_SFT 1
  1451. #define RT5677_INV_GPIO_JD3 (0x1 << 0)
  1452. #define RT5677_INV_GPIO_JD3_SFT 0
  1453. /* GPIO status (0xbf) */
  1454. #define RT5677_GPIO6_STATUS_MASK (0x1 << 5)
  1455. #define RT5677_GPIO6_STATUS_SFT 5
  1456. #define RT5677_GPIO5_STATUS_MASK (0x1 << 4)
  1457. #define RT5677_GPIO5_STATUS_SFT 4
  1458. #define RT5677_GPIO4_STATUS_MASK (0x1 << 3)
  1459. #define RT5677_GPIO4_STATUS_SFT 3
  1460. #define RT5677_GPIO3_STATUS_MASK (0x1 << 2)
  1461. #define RT5677_GPIO3_STATUS_SFT 2
  1462. #define RT5677_GPIO2_STATUS_MASK (0x1 << 1)
  1463. #define RT5677_GPIO2_STATUS_SFT 1
  1464. #define RT5677_GPIO1_STATUS_MASK (0x1 << 0)
  1465. #define RT5677_GPIO1_STATUS_SFT 0
  1466. /* GPIO Control 1 (0xc0) */
  1467. #define RT5677_GPIO1_PIN_MASK (0x1 << 15)
  1468. #define RT5677_GPIO1_PIN_SFT 15
  1469. #define RT5677_GPIO1_PIN_GPIO1 (0x0 << 15)
  1470. #define RT5677_GPIO1_PIN_IRQ (0x1 << 15)
  1471. #define RT5677_IPTV_MODE_MASK (0x1 << 14)
  1472. #define RT5677_IPTV_MODE_SFT 14
  1473. #define RT5677_IPTV_MODE_GPIO (0x0 << 14)
  1474. #define RT5677_IPTV_MODE_IPTV (0x1 << 14)
  1475. #define RT5677_FUNC_MODE_MASK (0x1 << 13)
  1476. #define RT5677_FUNC_MODE_SFT 13
  1477. #define RT5677_FUNC_MODE_DMIC_GPIO (0x0 << 13)
  1478. #define RT5677_FUNC_MODE_JTAG (0x1 << 13)
  1479. /* GPIO Control 2 (0xc1) */
  1480. #define RT5677_GPIO5_DIR_MASK (0x1 << 14)
  1481. #define RT5677_GPIO5_DIR_SFT 14
  1482. #define RT5677_GPIO5_DIR_IN (0x0 << 14)
  1483. #define RT5677_GPIO5_DIR_OUT (0x1 << 14)
  1484. #define RT5677_GPIO5_OUT_MASK (0x1 << 13)
  1485. #define RT5677_GPIO5_OUT_SFT 13
  1486. #define RT5677_GPIO5_OUT_LO (0x0 << 13)
  1487. #define RT5677_GPIO5_OUT_HI (0x1 << 13)
  1488. #define RT5677_GPIO5_P_MASK (0x1 << 12)
  1489. #define RT5677_GPIO5_P_SFT 12
  1490. #define RT5677_GPIO5_P_NOR (0x0 << 12)
  1491. #define RT5677_GPIO5_P_INV (0x1 << 12)
  1492. #define RT5677_GPIO4_DIR_MASK (0x1 << 11)
  1493. #define RT5677_GPIO4_DIR_SFT 11
  1494. #define RT5677_GPIO4_DIR_IN (0x0 << 11)
  1495. #define RT5677_GPIO4_DIR_OUT (0x1 << 11)
  1496. #define RT5677_GPIO4_OUT_MASK (0x1 << 10)
  1497. #define RT5677_GPIO4_OUT_SFT 10
  1498. #define RT5677_GPIO4_OUT_LO (0x0 << 10)
  1499. #define RT5677_GPIO4_OUT_HI (0x1 << 10)
  1500. #define RT5677_GPIO4_P_MASK (0x1 << 9)
  1501. #define RT5677_GPIO4_P_SFT 9
  1502. #define RT5677_GPIO4_P_NOR (0x0 << 9)
  1503. #define RT5677_GPIO4_P_INV (0x1 << 9)
  1504. #define RT5677_GPIO3_DIR_MASK (0x1 << 8)
  1505. #define RT5677_GPIO3_DIR_SFT 8
  1506. #define RT5677_GPIO3_DIR_IN (0x0 << 8)
  1507. #define RT5677_GPIO3_DIR_OUT (0x1 << 8)
  1508. #define RT5677_GPIO3_OUT_MASK (0x1 << 7)
  1509. #define RT5677_GPIO3_OUT_SFT 7
  1510. #define RT5677_GPIO3_OUT_LO (0x0 << 7)
  1511. #define RT5677_GPIO3_OUT_HI (0x1 << 7)
  1512. #define RT5677_GPIO3_P_MASK (0x1 << 6)
  1513. #define RT5677_GPIO3_P_SFT 6
  1514. #define RT5677_GPIO3_P_NOR (0x0 << 6)
  1515. #define RT5677_GPIO3_P_INV (0x1 << 6)
  1516. #define RT5677_GPIO2_DIR_MASK (0x1 << 5)
  1517. #define RT5677_GPIO2_DIR_SFT 5
  1518. #define RT5677_GPIO2_DIR_IN (0x0 << 5)
  1519. #define RT5677_GPIO2_DIR_OUT (0x1 << 5)
  1520. #define RT5677_GPIO2_OUT_MASK (0x1 << 4)
  1521. #define RT5677_GPIO2_OUT_SFT 4
  1522. #define RT5677_GPIO2_OUT_LO (0x0 << 4)
  1523. #define RT5677_GPIO2_OUT_HI (0x1 << 4)
  1524. #define RT5677_GPIO2_P_MASK (0x1 << 3)
  1525. #define RT5677_GPIO2_P_SFT 3
  1526. #define RT5677_GPIO2_P_NOR (0x0 << 3)
  1527. #define RT5677_GPIO2_P_INV (0x1 << 3)
  1528. #define RT5677_GPIO1_DIR_MASK (0x1 << 2)
  1529. #define RT5677_GPIO1_DIR_SFT 2
  1530. #define RT5677_GPIO1_DIR_IN (0x0 << 2)
  1531. #define RT5677_GPIO1_DIR_OUT (0x1 << 2)
  1532. #define RT5677_GPIO1_OUT_MASK (0x1 << 1)
  1533. #define RT5677_GPIO1_OUT_SFT 1
  1534. #define RT5677_GPIO1_OUT_LO (0x0 << 1)
  1535. #define RT5677_GPIO1_OUT_HI (0x1 << 1)
  1536. #define RT5677_GPIO1_P_MASK (0x1 << 0)
  1537. #define RT5677_GPIO1_P_SFT 0
  1538. #define RT5677_GPIO1_P_NOR (0x0 << 0)
  1539. #define RT5677_GPIO1_P_INV (0x1 << 0)
  1540. /* GPIO Control 3 (0xc2) */
  1541. #define RT5677_GPIO6_DIR_MASK (0x1 << 2)
  1542. #define RT5677_GPIO6_DIR_SFT 2
  1543. #define RT5677_GPIO6_DIR_IN (0x0 << 2)
  1544. #define RT5677_GPIO6_DIR_OUT (0x1 << 2)
  1545. #define RT5677_GPIO6_OUT_MASK (0x1 << 1)
  1546. #define RT5677_GPIO6_OUT_SFT 1
  1547. #define RT5677_GPIO6_OUT_LO (0x0 << 1)
  1548. #define RT5677_GPIO6_OUT_HI (0x1 << 1)
  1549. #define RT5677_GPIO6_P_MASK (0x1 << 0)
  1550. #define RT5677_GPIO6_P_SFT 0
  1551. #define RT5677_GPIO6_P_NOR (0x0 << 0)
  1552. #define RT5677_GPIO6_P_INV (0x1 << 0)
  1553. /* Virtual DSP Mixer Control (0xf7 0xf8 0xf9) */
  1554. #define RT5677_DSP_IB_01_H (0x1 << 15)
  1555. #define RT5677_DSP_IB_01_H_SFT 15
  1556. #define RT5677_DSP_IB_23_H (0x1 << 14)
  1557. #define RT5677_DSP_IB_23_H_SFT 14
  1558. #define RT5677_DSP_IB_45_H (0x1 << 13)
  1559. #define RT5677_DSP_IB_45_H_SFT 13
  1560. #define RT5677_DSP_IB_6_H (0x1 << 12)
  1561. #define RT5677_DSP_IB_6_H_SFT 12
  1562. #define RT5677_DSP_IB_7_H (0x1 << 11)
  1563. #define RT5677_DSP_IB_7_H_SFT 11
  1564. #define RT5677_DSP_IB_8_H (0x1 << 10)
  1565. #define RT5677_DSP_IB_8_H_SFT 10
  1566. #define RT5677_DSP_IB_9_H (0x1 << 9)
  1567. #define RT5677_DSP_IB_9_H_SFT 9
  1568. #define RT5677_DSP_IB_01_L (0x1 << 7)
  1569. #define RT5677_DSP_IB_01_L_SFT 7
  1570. #define RT5677_DSP_IB_23_L (0x1 << 6)
  1571. #define RT5677_DSP_IB_23_L_SFT 6
  1572. #define RT5677_DSP_IB_45_L (0x1 << 5)
  1573. #define RT5677_DSP_IB_45_L_SFT 5
  1574. #define RT5677_DSP_IB_6_L (0x1 << 4)
  1575. #define RT5677_DSP_IB_6_L_SFT 4
  1576. #define RT5677_DSP_IB_7_L (0x1 << 3)
  1577. #define RT5677_DSP_IB_7_L_SFT 3
  1578. #define RT5677_DSP_IB_8_L (0x1 << 2)
  1579. #define RT5677_DSP_IB_8_L_SFT 2
  1580. #define RT5677_DSP_IB_9_L (0x1 << 1)
  1581. #define RT5677_DSP_IB_9_L_SFT 1
  1582. /* General Control2 (0xfc)*/
  1583. #define RT5677_GPIO5_FUNC_MASK (0x1 << 9)
  1584. #define RT5677_GPIO5_FUNC_GPIO (0x0 << 9)
  1585. #define RT5677_GPIO5_FUNC_DMIC (0x1 << 9)
  1586. #define RT5677_FIRMWARE1 "/*(DEBLOBBED)*/"
  1587. #define RT5677_FIRMWARE2 "/*(DEBLOBBED)*/"
  1588. /* System Clock Source */
  1589. enum {
  1590. RT5677_SCLK_S_MCLK,
  1591. RT5677_SCLK_S_PLL1,
  1592. RT5677_SCLK_S_RCCLK,
  1593. };
  1594. /* PLL1 Source */
  1595. enum {
  1596. RT5677_PLL1_S_MCLK,
  1597. RT5677_PLL1_S_BCLK1,
  1598. RT5677_PLL1_S_BCLK2,
  1599. RT5677_PLL1_S_BCLK3,
  1600. RT5677_PLL1_S_BCLK4,
  1601. };
  1602. enum {
  1603. RT5677_AIF1,
  1604. RT5677_AIF2,
  1605. RT5677_AIF3,
  1606. RT5677_AIF4,
  1607. RT5677_AIF5,
  1608. RT5677_AIFS,
  1609. };
  1610. enum {
  1611. RT5677_GPIO1,
  1612. RT5677_GPIO2,
  1613. RT5677_GPIO3,
  1614. RT5677_GPIO4,
  1615. RT5677_GPIO5,
  1616. RT5677_GPIO6,
  1617. RT5677_GPIO_NUM,
  1618. };
  1619. enum {
  1620. RT5677_IRQ_JD1,
  1621. RT5677_IRQ_JD2,
  1622. RT5677_IRQ_JD3,
  1623. };
  1624. enum rt5677_type {
  1625. RT5677,
  1626. RT5676,
  1627. };
  1628. /* ASRC clock source selection */
  1629. enum {
  1630. RT5677_CLK_SEL_SYS,
  1631. RT5677_CLK_SEL_I2S1_ASRC,
  1632. RT5677_CLK_SEL_I2S2_ASRC,
  1633. RT5677_CLK_SEL_I2S3_ASRC,
  1634. RT5677_CLK_SEL_I2S4_ASRC,
  1635. RT5677_CLK_SEL_I2S5_ASRC,
  1636. RT5677_CLK_SEL_I2S6_ASRC,
  1637. RT5677_CLK_SEL_SYS2,
  1638. RT5677_CLK_SEL_SYS3,
  1639. RT5677_CLK_SEL_SYS4,
  1640. RT5677_CLK_SEL_SYS5,
  1641. RT5677_CLK_SEL_SYS6,
  1642. RT5677_CLK_SEL_SYS7,
  1643. };
  1644. /* filter mask */
  1645. enum {
  1646. RT5677_DA_STEREO_FILTER = 0x1,
  1647. RT5677_DA_MONO2_L_FILTER = (0x1 << 1),
  1648. RT5677_DA_MONO2_R_FILTER = (0x1 << 2),
  1649. RT5677_DA_MONO3_L_FILTER = (0x1 << 3),
  1650. RT5677_DA_MONO3_R_FILTER = (0x1 << 4),
  1651. RT5677_DA_MONO4_L_FILTER = (0x1 << 5),
  1652. RT5677_DA_MONO4_R_FILTER = (0x1 << 6),
  1653. RT5677_AD_STEREO1_FILTER = (0x1 << 7),
  1654. RT5677_AD_STEREO2_FILTER = (0x1 << 8),
  1655. RT5677_AD_STEREO3_FILTER = (0x1 << 9),
  1656. RT5677_AD_STEREO4_FILTER = (0x1 << 10),
  1657. RT5677_AD_MONO_L_FILTER = (0x1 << 11),
  1658. RT5677_AD_MONO_R_FILTER = (0x1 << 12),
  1659. RT5677_DSP_OB_0_3_FILTER = (0x1 << 13),
  1660. RT5677_DSP_OB_4_7_FILTER = (0x1 << 14),
  1661. RT5677_I2S1_SOURCE = (0x1 << 15),
  1662. RT5677_I2S2_SOURCE = (0x1 << 16),
  1663. RT5677_I2S3_SOURCE = (0x1 << 17),
  1664. RT5677_I2S4_SOURCE = (0x1 << 18),
  1665. };
  1666. struct rt5677_priv {
  1667. struct snd_soc_codec *codec;
  1668. struct rt5677_platform_data pdata;
  1669. struct regmap *regmap, *regmap_physical;
  1670. const struct firmware *fw1, *fw2;
  1671. struct mutex dsp_cmd_lock, dsp_pri_lock;
  1672. int sysclk;
  1673. int sysclk_src;
  1674. int lrck[RT5677_AIFS];
  1675. int bclk[RT5677_AIFS];
  1676. int master[RT5677_AIFS];
  1677. int pll_src;
  1678. int pll_in;
  1679. int pll_out;
  1680. struct gpio_desc *pow_ldo2; /* POW_LDO2 pin */
  1681. struct gpio_desc *reset_pin; /* RESET pin */
  1682. enum rt5677_type type;
  1683. #ifdef CONFIG_GPIOLIB
  1684. struct gpio_chip gpio_chip;
  1685. #endif
  1686. bool dsp_vad_en;
  1687. struct regmap_irq_chip_data *irq_data;
  1688. bool is_dsp_mode;
  1689. bool is_vref_slow;
  1690. };
  1691. int rt5677_sel_asrc_clk_src(struct snd_soc_codec *codec,
  1692. unsigned int filter_mask, unsigned int clk_src);
  1693. #endif /* __RT5677_H__ */