12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229 |
- /*
- * Copyright (C) STMicroelectronics SA 2015
- * Authors: Arnaud Pouliquen <arnaud.pouliquen@st.com>
- * for STMicroelectronics.
- * License terms: GNU General Public License (GPL), version 2
- */
- #ifndef __SND_ST_AUD_UNIPERIF_H
- #define __SND_ST_AUD_UNIPERIF_H
- #include <linux/regmap.h>
- #include <sound/dmaengine_pcm.h>
- /*
- * Register access macros
- */
- #define GET_UNIPERIF_REG(ip, offset, shift, mask) \
- ((readl_relaxed(ip->base + offset) >> shift) & mask)
- #define SET_UNIPERIF_REG(ip, offset, shift, mask, value) \
- writel_relaxed(((readl_relaxed(ip->base + offset) & \
- ~(mask << shift)) | (((value) & mask) << shift)), ip->base + offset)
- #define SET_UNIPERIF_BIT_REG(ip, offset, shift, mask, value) \
- writel_relaxed((((value) & mask) << shift), ip->base + offset)
- /*
- * AUD_UNIPERIF_SOFT_RST reg
- */
- #define UNIPERIF_SOFT_RST_OFFSET(ip) 0x0000
- #define GET_UNIPERIF_SOFT_RST(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- readl_relaxed(ip->base + UNIPERIF_SOFT_RST_OFFSET(ip)) : 0)
- #define SET_UNIPERIF_SOFT_RST(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_SOFT_RST_OFFSET(ip))
- /* SOFT_RST */
- #define UNIPERIF_SOFT_RST_SOFT_RST_SHIFT(ip) 0x0
- #define UNIPERIF_SOFT_RST_SOFT_RST_MASK(ip) 0x1
- #define SET_UNIPERIF_SOFT_RST_SOFT_RST(ip) \
- SET_UNIPERIF_BIT_REG(ip, \
- UNIPERIF_SOFT_RST_OFFSET(ip), \
- UNIPERIF_SOFT_RST_SOFT_RST_SHIFT(ip), \
- UNIPERIF_SOFT_RST_SOFT_RST_MASK(ip), 1)
- #define GET_UNIPERIF_SOFT_RST_SOFT_RST(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_SOFT_RST_OFFSET(ip), \
- UNIPERIF_SOFT_RST_SOFT_RST_SHIFT(ip), \
- UNIPERIF_SOFT_RST_SOFT_RST_MASK(ip))
- /*
- * AUD_UNIPERIF_FIFO_DATA reg
- */
- #define UNIPERIF_FIFO_DATA_OFFSET(ip) 0x0004
- #define SET_UNIPERIF_DATA(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_FIFO_DATA_OFFSET(ip))
- /*
- * AUD_UNIPERIF_CHANNEL_STA_REGN reg
- */
- #define UNIPERIF_CHANNEL_STA_REGN(ip, n) (0x0060 + (4 * n))
- #define GET_UNIPERIF_CHANNEL_STA_REGN(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REGN(ip, n))
- #define SET_UNIPERIF_CHANNEL_STA_REGN(ip, n, value) \
- writel_relaxed(value, ip->base + \
- UNIPERIF_CHANNEL_STA_REGN(ip, n))
- #define UNIPERIF_CHANNEL_STA_REG0_OFFSET(ip) 0x0060
- #define GET_UNIPERIF_CHANNEL_STA_REG0(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REG0_OFFSET(ip))
- #define SET_UNIPERIF_CHANNEL_STA_REG0(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CHANNEL_STA_REG0_OFFSET(ip))
- #define UNIPERIF_CHANNEL_STA_REG1_OFFSET(ip) 0x0064
- #define GET_UNIPERIF_CHANNEL_STA_REG1(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REG1_OFFSET(ip))
- #define SET_UNIPERIF_CHANNEL_STA_REG1(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CHANNEL_STA_REG1_OFFSET(ip))
- #define UNIPERIF_CHANNEL_STA_REG2_OFFSET(ip) 0x0068
- #define GET_UNIPERIF_CHANNEL_STA_REG2(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REG2_OFFSET(ip))
- #define SET_UNIPERIF_CHANNEL_STA_REG2(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CHANNEL_STA_REG2_OFFSET(ip))
- #define UNIPERIF_CHANNEL_STA_REG3_OFFSET(ip) 0x006C
- #define GET_UNIPERIF_CHANNEL_STA_REG3(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REG3_OFFSET(ip))
- #define SET_UNIPERIF_CHANNEL_STA_REG3(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CHANNEL_STA_REG3_OFFSET(ip))
- #define UNIPERIF_CHANNEL_STA_REG4_OFFSET(ip) 0x0070
- #define GET_UNIPERIF_CHANNEL_STA_REG4(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REG4_OFFSET(ip))
- #define SET_UNIPERIF_CHANNEL_STA_REG4(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CHANNEL_STA_REG4_OFFSET(ip))
- #define UNIPERIF_CHANNEL_STA_REG5_OFFSET(ip) 0x0074
- #define GET_UNIPERIF_CHANNEL_STA_REG5(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REG5_OFFSET(ip))
- #define SET_UNIPERIF_CHANNEL_STA_REG5(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CHANNEL_STA_REG5_OFFSET(ip))
- /*
- * AUD_UNIPERIF_ITS reg
- */
- #define UNIPERIF_ITS_OFFSET(ip) 0x000C
- #define GET_UNIPERIF_ITS(ip) \
- readl_relaxed(ip->base + UNIPERIF_ITS_OFFSET(ip))
- /* MEM_BLK_READ */
- #define UNIPERIF_ITS_MEM_BLK_READ_SHIFT(ip) 5
- #define UNIPERIF_ITS_MEM_BLK_READ_MASK(ip) \
- (BIT(UNIPERIF_ITS_MEM_BLK_READ_SHIFT(ip)))
- /* FIFO_ERROR */
- #define UNIPERIF_ITS_FIFO_ERROR_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 0 : 8)
- #define UNIPERIF_ITS_FIFO_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITS_FIFO_ERROR_SHIFT(ip)))
- /* DMA_ERROR */
- #define UNIPERIF_ITS_DMA_ERROR_SHIFT(ip) 9
- #define UNIPERIF_ITS_DMA_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITS_DMA_ERROR_SHIFT(ip)))
- /* UNDERFLOW_REC_DONE */
- #define UNIPERIF_ITS_UNDERFLOW_REC_DONE_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 12)
- #define UNIPERIF_ITS_UNDERFLOW_REC_DONE_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- 0 : (BIT(UNIPERIF_ITS_UNDERFLOW_REC_DONE_SHIFT(ip))))
- /* UNDERFLOW_REC_FAILED */
- #define UNIPERIF_ITS_UNDERFLOW_REC_FAILED_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 13)
- #define UNIPERIF_ITS_UNDERFLOW_REC_FAILED_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- 0 : (BIT(UNIPERIF_ITS_UNDERFLOW_REC_FAILED_SHIFT(ip))))
- /*
- * AUD_UNIPERIF_ITS_BCLR reg
- */
- /* FIFO_ERROR */
- #define UNIPERIF_ITS_BCLR_FIFO_ERROR_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 0 : 8)
- #define UNIPERIF_ITS_BCLR_FIFO_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITS_BCLR_FIFO_ERROR_SHIFT(ip)))
- #define SET_UNIPERIF_ITS_BCLR_FIFO_ERROR(ip) \
- SET_UNIPERIF_ITS_BCLR(ip, \
- UNIPERIF_ITS_BCLR_FIFO_ERROR_MASK(ip))
- #define UNIPERIF_ITS_BCLR_OFFSET(ip) 0x0010
- #define SET_UNIPERIF_ITS_BCLR(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_ITS_BCLR_OFFSET(ip))
- /*
- * AUD_UNIPERIF_ITM reg
- */
- #define UNIPERIF_ITM_OFFSET(ip) 0x0018
- #define GET_UNIPERIF_ITM(ip) \
- readl_relaxed(ip->base + UNIPERIF_ITM_OFFSET(ip))
- /* FIFO_ERROR */
- #define UNIPERIF_ITM_FIFO_ERROR_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 0 : 8)
- #define UNIPERIF_ITM_FIFO_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITM_FIFO_ERROR_SHIFT(ip)))
- /* UNDERFLOW_REC_DONE */
- #define UNIPERIF_ITM_UNDERFLOW_REC_DONE_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 12)
- #define UNIPERIF_ITM_UNDERFLOW_REC_DONE_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- 0 : (BIT(UNIPERIF_ITM_UNDERFLOW_REC_DONE_SHIFT(ip))))
- /* UNDERFLOW_REC_FAILED */
- #define UNIPERIF_ITM_UNDERFLOW_REC_FAILED_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 13)
- #define UNIPERIF_ITM_UNDERFLOW_REC_FAILED_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- 0 : (BIT(UNIPERIF_ITM_UNDERFLOW_REC_FAILED_SHIFT(ip))))
- /*
- * AUD_UNIPERIF_ITM_BCLR reg
- */
- #define UNIPERIF_ITM_BCLR_OFFSET(ip) 0x001c
- #define SET_UNIPERIF_ITM_BCLR(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_ITM_BCLR_OFFSET(ip))
- /* FIFO_ERROR */
- #define UNIPERIF_ITM_BCLR_FIFO_ERROR_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 0 : 8)
- #define UNIPERIF_ITM_BCLR_FIFO_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITM_BCLR_FIFO_ERROR_SHIFT(ip)))
- #define SET_UNIPERIF_ITM_BCLR_FIFO_ERROR(ip) \
- SET_UNIPERIF_ITM_BCLR(ip, \
- UNIPERIF_ITM_BCLR_FIFO_ERROR_MASK(ip))
- /* DMA_ERROR */
- #define UNIPERIF_ITM_BCLR_DMA_ERROR_SHIFT(ip) 9
- #define UNIPERIF_ITM_BCLR_DMA_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITM_BCLR_DMA_ERROR_SHIFT(ip)))
- #define SET_UNIPERIF_ITM_BCLR_DMA_ERROR(ip) \
- SET_UNIPERIF_ITM_BCLR(ip, \
- UNIPERIF_ITM_BCLR_DMA_ERROR_MASK(ip))
- /*
- * AUD_UNIPERIF_ITM_BSET reg
- */
- #define UNIPERIF_ITM_BSET_OFFSET(ip) 0x0020
- #define SET_UNIPERIF_ITM_BSET(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_ITM_BSET_OFFSET(ip))
- /* FIFO_ERROR */
- #define UNIPERIF_ITM_BSET_FIFO_ERROR_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 0 : 8)
- #define UNIPERIF_ITM_BSET_FIFO_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITM_BSET_FIFO_ERROR_SHIFT(ip)))
- #define SET_UNIPERIF_ITM_BSET_FIFO_ERROR(ip) \
- SET_UNIPERIF_ITM_BSET(ip, \
- UNIPERIF_ITM_BSET_FIFO_ERROR_MASK(ip))
- /* MEM_BLK_READ */
- #define UNIPERIF_ITM_BSET_MEM_BLK_READ_SHIFT(ip) 5
- #define UNIPERIF_ITM_BSET_MEM_BLK_READ_MASK(ip) \
- (BIT(UNIPERIF_ITM_BSET_MEM_BLK_READ_SHIFT(ip)))
- #define SET_UNIPERIF_ITM_BSET_MEM_BLK_READ(ip) \
- SET_UNIPERIF_ITM_BSET(ip, \
- UNIPERIF_ITM_BSET_MEM_BLK_READ_MASK(ip))
- /* DMA_ERROR */
- #define UNIPERIF_ITM_BSET_DMA_ERROR_SHIFT(ip) 9
- #define UNIPERIF_ITM_BSET_DMA_ERROR_MASK(ip) \
- (BIT(UNIPERIF_ITM_BSET_DMA_ERROR_SHIFT(ip)))
- #define SET_UNIPERIF_ITM_BSET_DMA_ERROR(ip) \
- SET_UNIPERIF_ITM_BSET(ip, \
- UNIPERIF_ITM_BSET_DMA_ERROR_MASK(ip))
- /* UNDERFLOW_REC_DONE */
- #define UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 12)
- #define UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- 0 : (BIT(UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE_SHIFT(ip))))
- #define SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE(ip) \
- SET_UNIPERIF_ITM_BSET(ip, \
- UNIPERIF_ITM_BSET_UNDERFLOW_REC_DONE_MASK(ip))
- /* UNDERFLOW_REC_FAILED */
- #define UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 13)
- #define UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? \
- 0 : (BIT(UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED_SHIFT(ip))))
- #define SET_UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED(ip) \
- SET_UNIPERIF_ITM_BSET(ip, \
- UNIPERIF_ITM_BSET_UNDERFLOW_REC_FAILED_MASK(ip))
- /*
- * UNIPERIF_CONFIG reg
- */
- #define UNIPERIF_CONFIG_OFFSET(ip) 0x0040
- #define GET_UNIPERIF_CONFIG(ip) \
- readl_relaxed(ip->base + UNIPERIF_CONFIG_OFFSET(ip))
- #define SET_UNIPERIF_CONFIG(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CONFIG_OFFSET(ip))
- /* PARITY_CNTR */
- #define UNIPERIF_CONFIG_PARITY_CNTR_SHIFT(ip) 0
- #define UNIPERIF_CONFIG_PARITY_CNTR_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_PARITY_CNTR(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_PARITY_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_PARITY_CNTR_MASK(ip))
- #define SET_UNIPERIF_CONFIG_PARITY_CNTR_BY_HW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_PARITY_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_PARITY_CNTR_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_PARITY_CNTR_BY_SW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_PARITY_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_PARITY_CNTR_MASK(ip), 1)
- /* CHANNEL_STA_CNTR */
- #define UNIPERIF_CONFIG_CHANNEL_STA_CNTR_SHIFT(ip) 1
- #define UNIPERIF_CONFIG_CHANNEL_STA_CNTR_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_CHANNEL_STA_CNTR(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_CHANNEL_STA_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_CHANNEL_STA_CNTR_MASK(ip))
- #define SET_UNIPERIF_CONFIG_CHANNEL_STA_CNTR_BY_SW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_CHANNEL_STA_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_CHANNEL_STA_CNTR_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_CHANNEL_STA_CNTR_BY_HW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_CHANNEL_STA_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_CHANNEL_STA_CNTR_MASK(ip), 1)
- /* USER_DAT_CNTR */
- #define UNIPERIF_CONFIG_USER_DAT_CNTR_SHIFT(ip) 2
- #define UNIPERIF_CONFIG_USER_DAT_CNTR_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_USER_DAT_CNTR(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_USER_DAT_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_USER_DAT_CNTR_MASK(ip))
- #define SET_UNIPERIF_CONFIG_USER_DAT_CNTR_BY_HW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_USER_DAT_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_USER_DAT_CNTR_MASK(ip), 1)
- #define SET_UNIPERIF_CONFIG_USER_DAT_CNTR_BY_SW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_USER_DAT_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_USER_DAT_CNTR_MASK(ip), 0)
- /* VALIDITY_DAT_CNTR */
- #define UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_SHIFT(ip) 3
- #define UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_VALIDITY_DAT_CNTR(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_MASK(ip))
- #define SET_UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_BY_SW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_BY_HW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_SHIFT(ip), \
- UNIPERIF_CONFIG_VALIDITY_DAT_CNTR_MASK(ip), 1)
- /* ONE_BIT_AUD_SUPPORT */
- #define UNIPERIF_CONFIG_ONE_BIT_AUD_SHIFT(ip) 4
- #define UNIPERIF_CONFIG_ONE_BIT_AUD_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_ONE_BIT_AUD(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_ONE_BIT_AUD_SHIFT(ip), \
- UNIPERIF_CONFIG_ONE_BIT_AUD_MASK(ip))
- #define SET_UNIPERIF_CONFIG_ONE_BIT_AUD_DISABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_ONE_BIT_AUD_SHIFT(ip), \
- UNIPERIF_CONFIG_ONE_BIT_AUD_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_ONE_BIT_AUD_ENABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_ONE_BIT_AUD_SHIFT(ip), \
- UNIPERIF_CONFIG_ONE_BIT_AUD_MASK(ip), 1)
- /* MEMORY_FMT */
- #define UNIPERIF_CONFIG_MEM_FMT_SHIFT(ip) 5
- #define UNIPERIF_CONFIG_MEM_FMT_MASK(ip) 0x1
- #define VALUE_UNIPERIF_CONFIG_MEM_FMT_16_0(ip) 0
- #define VALUE_UNIPERIF_CONFIG_MEM_FMT_16_16(ip) 1
- #define GET_UNIPERIF_CONFIG_MEM_FMT(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_MEM_FMT_SHIFT(ip), \
- UNIPERIF_CONFIG_MEM_FMT_MASK(ip))
- #define SET_UNIPERIF_CONFIG_MEM_FMT(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_MEM_FMT_SHIFT(ip), \
- UNIPERIF_CONFIG_MEM_FMT_MASK(ip), value)
- #define SET_UNIPERIF_CONFIG_MEM_FMT_16_0(ip) \
- SET_UNIPERIF_CONFIG_MEM_FMT(ip, \
- VALUE_UNIPERIF_CONFIG_MEM_FMT_16_0(ip))
- #define SET_UNIPERIF_CONFIG_MEM_FMT_16_16(ip) \
- SET_UNIPERIF_CONFIG_MEM_FMT(ip, \
- VALUE_UNIPERIF_CONFIG_MEM_FMT_16_16(ip))
- /* REPEAT_CHL_STS */
- #define UNIPERIF_CONFIG_REPEAT_CHL_STS_SHIFT(ip) 6
- #define UNIPERIF_CONFIG_REPEAT_CHL_STS_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_REPEAT_CHL_STS(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_REPEAT_CHL_STS_SHIFT(ip), \
- UNIPERIF_CONFIG_REPEAT_CHL_STS_MASK(ip))
- #define SET_UNIPERIF_CONFIG_REPEAT_CHL_STS_ENABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_REPEAT_CHL_STS_SHIFT(ip), \
- UNIPERIF_CONFIG_REPEAT_CHL_STS_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_REPEAT_CHL_STS_DISABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_REPEAT_CHL_STS_SHIFT(ip), \
- UNIPERIF_CONFIG_REPEAT_CHL_STS_MASK(ip), 1)
- /* BACK_STALL_REQ */
- #define UNIPERIF_CONFIG_BACK_STALL_REQ_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 7 : -1)
- #define UNIPERIF_CONFIG_BACK_STALL_REQ_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_BACK_STALL_REQ(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_BACK_STALL_REQ_SHIFT(ip), \
- UNIPERIF_CONFIG_BACK_STALL_REQ_MASK(ip))
- #define SET_UNIPERIF_CONFIG_BACK_STALL_REQ_DISABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_BACK_STALL_REQ_SHIFT(ip), \
- UNIPERIF_CONFIG_BACK_STALL_REQ_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_BACK_STALL_REQ_ENABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_BACK_STALL_REQ_SHIFT(ip), \
- UNIPERIF_CONFIG_BACK_STALL_REQ_MASK(ip), 1)
- /* FDMA_TRIGGER_LIMIT */
- #define UNIPERIF_CONFIG_DMA_TRIG_LIMIT_SHIFT(ip) 8
- #define UNIPERIF_CONFIG_DMA_TRIG_LIMIT_MASK(ip) 0x7F
- #define GET_UNIPERIF_CONFIG_DMA_TRIG_LIMIT(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_DMA_TRIG_LIMIT_SHIFT(ip), \
- UNIPERIF_CONFIG_DMA_TRIG_LIMIT_MASK(ip))
- #define SET_UNIPERIF_CONFIG_DMA_TRIG_LIMIT(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_DMA_TRIG_LIMIT_SHIFT(ip), \
- UNIPERIF_CONFIG_DMA_TRIG_LIMIT_MASK(ip), value)
- /* CHL_STS_UPDATE */
- #define UNIPERIF_CONFIG_CHL_STS_UPDATE_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 16 : -1)
- #define UNIPERIF_CONFIG_CHL_STS_UPDATE_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_CHL_STS_UPDATE(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_CHL_STS_UPDATE_SHIFT(ip), \
- UNIPERIF_CONFIG_CHL_STS_UPDATE_MASK(ip))
- #define SET_UNIPERIF_CONFIG_CHL_STS_UPDATE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_CHL_STS_UPDATE_SHIFT(ip), \
- UNIPERIF_CONFIG_CHL_STS_UPDATE_MASK(ip), 1)
- /* IDLE_MOD */
- #define UNIPERIF_CONFIG_IDLE_MOD_SHIFT(ip) 18
- #define UNIPERIF_CONFIG_IDLE_MOD_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_IDLE_MOD(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_IDLE_MOD_SHIFT(ip), \
- UNIPERIF_CONFIG_IDLE_MOD_MASK(ip))
- #define SET_UNIPERIF_CONFIG_IDLE_MOD_DISABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_IDLE_MOD_SHIFT(ip), \
- UNIPERIF_CONFIG_IDLE_MOD_MASK(ip), 0)
- #define SET_UNIPERIF_CONFIG_IDLE_MOD_ENABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_IDLE_MOD_SHIFT(ip), \
- UNIPERIF_CONFIG_IDLE_MOD_MASK(ip), 1)
- /* SUBFRAME_SELECTION */
- #define UNIPERIF_CONFIG_SUBFRAME_SEL_SHIFT(ip) 19
- #define UNIPERIF_CONFIG_SUBFRAME_SEL_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_SUBFRAME_SEL(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_SUBFRAME_SEL_SHIFT(ip), \
- UNIPERIF_CONFIG_SUBFRAME_SEL_MASK(ip))
- #define SET_UNIPERIF_CONFIG_SUBFRAME_SEL_SUBF1_SUBF0(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_SUBFRAME_SEL_SHIFT(ip), \
- UNIPERIF_CONFIG_SUBFRAME_SEL_MASK(ip), 1)
- #define SET_UNIPERIF_CONFIG_SUBFRAME_SEL_SUBF0_SUBF1(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_SUBFRAME_SEL_SHIFT(ip), \
- UNIPERIF_CONFIG_SUBFRAME_SEL_MASK(ip), 0)
- /* FULL_SW_CONTROL */
- #define UNIPERIF_CONFIG_SPDIF_SW_CTRL_SHIFT(ip) 20
- #define UNIPERIF_CONFIG_SPDIF_SW_CTRL_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_SPDIF_SW_CTRL(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_SPDIF_SW_CTRL_SHIFT(ip), \
- UNIPERIF_CONFIG_SPDIF_SW_CTRL_MASK(ip))
- #define SET_UNIPERIF_CONFIG_SPDIF_SW_CTRL_ENABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_SPDIF_SW_CTRL_SHIFT(ip), \
- UNIPERIF_CONFIG_SPDIF_SW_CTRL_MASK(ip), 1)
- #define SET_UNIPERIF_CONFIG_SPDIF_SW_CTRL_DISABLE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_SPDIF_SW_CTRL_SHIFT(ip), \
- UNIPERIF_CONFIG_SPDIF_SW_CTRL_MASK(ip), 0)
- /* MASTER_CLKEDGE */
- #define UNIPERIF_CONFIG_MSTR_CLKEDGE_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 24 : -1)
- #define UNIPERIF_CONFIG_MSTR_CLKEDGE_MASK(ip) 0x1
- #define GET_UNIPERIF_CONFIG_MSTR_CLKEDGE(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_MSTR_CLKEDGE_SHIFT(ip), \
- UNIPERIF_CONFIG_MSTR_CLKEDGE_MASK(ip))
- #define SET_UNIPERIF_CONFIG_MSTR_CLKEDGE_FALLING(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_MSTR_CLKEDGE_SHIFT(ip), \
- UNIPERIF_CONFIG_MSTR_CLKEDGE_MASK(ip), 1)
- #define SET_UNIPERIF_CONFIG_MSTR_CLKEDGE_RISING(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CONFIG_OFFSET(ip), \
- UNIPERIF_CONFIG_MSTR_CLKEDGE_SHIFT(ip), \
- UNIPERIF_CONFIG_MSTR_CLKEDGE_MASK(ip), 0)
- /*
- * UNIPERIF_CTRL reg
- */
- #define UNIPERIF_CTRL_OFFSET(ip) 0x0044
- #define GET_UNIPERIF_CTRL(ip) \
- readl_relaxed(ip->base + UNIPERIF_CTRL_OFFSET(ip))
- #define SET_UNIPERIF_CTRL(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_CTRL_OFFSET(ip))
- /* OPERATION */
- #define UNIPERIF_CTRL_OPERATION_SHIFT(ip) 0
- #define UNIPERIF_CTRL_OPERATION_MASK(ip) 0x7
- #define GET_UNIPERIF_CTRL_OPERATION(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_OFF(ip) 0
- #define SET_UNIPERIF_CTRL_OPERATION_OFF(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_OFF(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_MUTE_PCM_NULL(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 1 : -1)
- #define SET_UNIPERIF_CTRL_OPERATION_MUTE_PCM_NULL(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_MUTE_PCM_NULL(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_MUTE_PAUSE_BURST(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 2 : -1)
- #define SET_UNIPERIF_CTRL_OPERATION_MUTE_PAUSE_BURST(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_MUTE_PAUSE_BURST(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_PCM_DATA(ip) 3
- #define SET_UNIPERIF_CTRL_OPERATION_PCM_DATA(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_PCM_DATA(ip))
- /* This is the same as above! */
- #define VALUE_UNIPERIF_CTRL_OPERATION_AUDIO_DATA(ip) 3
- #define SET_UNIPERIF_CTRL_OPERATION_AUDIO_DATA(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_AUDIO_DATA(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_ENC_DATA(ip) 4
- #define SET_UNIPERIF_CTRL_OPERATION_ENC_DATA(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_ENC_DATA(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_CD_DATA(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 5 : -1)
- #define SET_UNIPERIF_CTRL_OPERATION_CD_DATA(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_CD_DATA(ip))
- #define VALUE_UNIPERIF_CTRL_OPERATION_STANDBY(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 7)
- #define SET_UNIPERIF_CTRL_OPERATION_STANDBY(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_OPERATION_SHIFT(ip), \
- UNIPERIF_CTRL_OPERATION_MASK(ip), \
- VALUE_UNIPERIF_CTRL_OPERATION_STANDBY(ip))
- /* EXIT_STBY_ON_EOBLOCK */
- #define UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 3)
- #define UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_SHIFT(ip), \
- UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_MASK(ip))
- #define SET_UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_OFF(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_SHIFT(ip), \
- UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_MASK(ip), 0)
- #define SET_UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_ON(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_SHIFT(ip), \
- UNIPERIF_CTRL_EXIT_STBY_ON_EOBLOCK_MASK(ip), 1)
- /* ROUNDING */
- #define UNIPERIF_CTRL_ROUNDING_SHIFT(ip) 4
- #define UNIPERIF_CTRL_ROUNDING_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_ROUNDING(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_ROUNDING_SHIFT(ip), \
- UNIPERIF_CTRL_ROUNDING_MASK(ip))
- #define SET_UNIPERIF_CTRL_ROUNDING_OFF(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_ROUNDING_SHIFT(ip), \
- UNIPERIF_CTRL_ROUNDING_MASK(ip), 0)
- #define SET_UNIPERIF_CTRL_ROUNDING_ON(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_ROUNDING_SHIFT(ip), \
- UNIPERIF_CTRL_ROUNDING_MASK(ip), 1)
- /* DIVIDER */
- #define UNIPERIF_CTRL_DIVIDER_SHIFT(ip) 5
- #define UNIPERIF_CTRL_DIVIDER_MASK(ip) 0xff
- #define GET_UNIPERIF_CTRL_DIVIDER(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_DIVIDER_SHIFT(ip), \
- UNIPERIF_CTRL_DIVIDER_MASK(ip))
- #define SET_UNIPERIF_CTRL_DIVIDER(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_DIVIDER_SHIFT(ip), \
- UNIPERIF_CTRL_DIVIDER_MASK(ip), value)
- /* BYTE_SWAP */
- #define UNIPERIF_CTRL_BYTE_SWP_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 13 : -1)
- #define UNIPERIF_CTRL_BYTE_SWP_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_BYTE_SWP(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_BYTE_SWP_SHIFT(ip), \
- UNIPERIF_CTRL_BYTE_SWP_MASK(ip))
- #define SET_UNIPERIF_CTRL_BYTE_SWP_OFF(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_BYTE_SWP_SHIFT(ip), \
- UNIPERIF_CTRL_BYTE_SWP_MASK(ip), 0)
- #define SET_UNIPERIF_CTRL_BYTE_SWP_ON(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_BYTE_SWP_SHIFT(ip), \
- UNIPERIF_CTRL_BYTE_SWP_MASK(ip), 1)
- /* ZERO_STUFFING_HW_SW */
- #define UNIPERIF_CTRL_ZERO_STUFF_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 14 : -1)
- #define UNIPERIF_CTRL_ZERO_STUFF_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_ZERO_STUFF(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_ZERO_STUFF_SHIFT(ip), \
- UNIPERIF_CTRL_ZERO_STUFF_MASK(ip))
- #define SET_UNIPERIF_CTRL_ZERO_STUFF_HW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_ZERO_STUFF_SHIFT(ip), \
- UNIPERIF_CTRL_ZERO_STUFF_MASK(ip), 1)
- #define SET_UNIPERIF_CTRL_ZERO_STUFF_SW(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_ZERO_STUFF_SHIFT(ip), \
- UNIPERIF_CTRL_ZERO_STUFF_MASK(ip), 0)
- /* SPDIF_LAT */
- #define UNIPERIF_CTRL_SPDIF_LAT_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 16 : -1)
- #define UNIPERIF_CTRL_SPDIF_LAT_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_SPDIF_LAT(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_SPDIF_LAT_SHIFT(ip), \
- UNIPERIF_CTRL_SPDIF_LAT_MASK(ip))
- #define SET_UNIPERIF_CTRL_SPDIF_LAT_ON(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_SPDIF_LAT_SHIFT(ip), \
- UNIPERIF_CTRL_SPDIF_LAT_MASK(ip), 1)
- #define SET_UNIPERIF_CTRL_SPDIF_LAT_OFF(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_SPDIF_LAT_SHIFT(ip), \
- UNIPERIF_CTRL_SPDIF_LAT_MASK(ip), 0)
- /* EN_SPDIF_FORMATTING */
- #define UNIPERIF_CTRL_SPDIF_FMT_SHIFT(ip) 17
- #define UNIPERIF_CTRL_SPDIF_FMT_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_SPDIF_FMT(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_SPDIF_FMT_SHIFT(ip), \
- UNIPERIF_CTRL_SPDIF_FMT_MASK(ip))
- #define SET_UNIPERIF_CTRL_SPDIF_FMT_ON(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_SPDIF_FMT_SHIFT(ip), \
- UNIPERIF_CTRL_SPDIF_FMT_MASK(ip), 1)
- #define SET_UNIPERIF_CTRL_SPDIF_FMT_OFF(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_SPDIF_FMT_SHIFT(ip), \
- UNIPERIF_CTRL_SPDIF_FMT_MASK(ip), 0)
- /* READER_OUT_SELECT */
- #define UNIPERIF_CTRL_READER_OUT_SEL_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 18 : -1)
- #define UNIPERIF_CTRL_READER_OUT_SEL_MASK(ip) 0x1
- #define GET_UNIPERIF_CTRL_READER_OUT_SEL(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_READER_OUT_SEL_SHIFT(ip), \
- UNIPERIF_CTRL_READER_OUT_SEL_MASK(ip))
- #define SET_UNIPERIF_CTRL_READER_OUT_SEL_IN_MEM(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_READER_OUT_SEL_SHIFT(ip), \
- UNIPERIF_CTRL_READER_OUT_SEL_MASK(ip), 0)
- #define SET_UNIPERIF_CTRL_READER_OUT_SEL_ON_I2S_LINE(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_READER_OUT_SEL_SHIFT(ip), \
- CORAUD_UNIPERIF_CTRL_READER_OUT_SEL_MASK(ip), 1)
- /* UNDERFLOW_REC_WINDOW */
- #define UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW_SHIFT(ip) 20
- #define UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW_MASK(ip) 0xff
- #define GET_UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW_SHIFT(ip), \
- UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW_MASK(ip))
- #define SET_UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_CTRL_OFFSET(ip), \
- UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW_SHIFT(ip), \
- UNIPERIF_CTRL_UNDERFLOW_REC_WINDOW_MASK(ip), value)
- /*
- * UNIPERIF_I2S_FMT a.k.a UNIPERIF_FORMAT reg
- */
- #define UNIPERIF_I2S_FMT_OFFSET(ip) 0x0048
- #define GET_UNIPERIF_I2S_FMT(ip) \
- readl_relaxed(ip->base + UNIPERIF_I2S_FMT_OFFSET(ip))
- #define SET_UNIPERIF_I2S_FMT(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_I2S_FMT_OFFSET(ip))
- /* NBIT */
- #define UNIPERIF_I2S_FMT_NBIT_SHIFT(ip) 0
- #define UNIPERIF_I2S_FMT_NBIT_MASK(ip) 0x1
- #define GET_UNIPERIF_I2S_FMT_NBIT(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NBIT_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NBIT_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_NBIT_32(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NBIT_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NBIT_MASK(ip), 0)
- #define SET_UNIPERIF_I2S_FMT_NBIT_16(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NBIT_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NBIT_MASK(ip), 1)
- /* DATA_SIZE */
- #define UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip) 1
- #define UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip) 0x7
- #define GET_UNIPERIF_I2S_FMT_DATA_SIZE(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_DATA_SIZE_16(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip), 0)
- #define SET_UNIPERIF_I2S_FMT_DATA_SIZE_18(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip), 1)
- #define SET_UNIPERIF_I2S_FMT_DATA_SIZE_20(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip), 2)
- #define SET_UNIPERIF_I2S_FMT_DATA_SIZE_24(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip), 3)
- #define SET_UNIPERIF_I2S_FMTL_DATA_SIZE_28(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip), 4)
- #define SET_UNIPERIF_I2S_FMT_DATA_SIZE_32(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_DATA_SIZE_MASK(ip), 5)
- /* LR_POL */
- #define UNIPERIF_I2S_FMT_LR_POL_SHIFT(ip) 4
- #define UNIPERIF_I2S_FMT_LR_POL_MASK(ip) 0x1
- #define VALUE_UNIPERIF_I2S_FMT_LR_POL_LOW(ip) 0x0
- #define VALUE_UNIPERIF_I2S_FMT_LR_POL_HIG(ip) 0x1
- #define GET_UNIPERIF_I2S_FMT_LR_POL(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_LR_POL_SHIFT(ip), \
- UNIPERIF_I2S_FMT_LR_POL_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_LR_POL(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_LR_POL_SHIFT(ip), \
- UNIPERIF_I2S_FMT_LR_POL_MASK(ip), value)
- #define SET_UNIPERIF_I2S_FMT_LR_POL_LOW(ip) \
- SET_UNIPERIF_I2S_FMT_LR_POL(ip, \
- VALUE_UNIPERIF_I2S_FMT_LR_POL_LOW(ip))
- #define SET_UNIPERIF_I2S_FMT_LR_POL_HIG(ip) \
- SET_UNIPERIF_I2S_FMT_LR_POL(ip, \
- VALUE_UNIPERIF_I2S_FMT_LR_POL_HIG(ip))
- /* SCLK_EDGE */
- #define UNIPERIF_I2S_FMT_SCLK_EDGE_SHIFT(ip) 5
- #define UNIPERIF_I2S_FMT_SCLK_EDGE_MASK(ip) 0x1
- #define GET_UNIPERIF_I2S_FMT_SCLK_EDGE(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_SCLK_EDGE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_SCLK_EDGE_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_SCLK_EDGE_RISING(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_SCLK_EDGE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_SCLK_EDGE_MASK(ip), 0)
- #define SET_UNIPERIF_I2S_FMT_SCLK_EDGE_FALLING(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_SCLK_EDGE_SHIFT(ip), \
- UNIPERIF_I2S_FMT_SCLK_EDGE_MASK(ip), 1)
- /* PADDING */
- #define UNIPERIF_I2S_FMT_PADDING_SHIFT(ip) 6
- #define UNIPERIF_I2S_FMT_PADDING_MASK(ip) 0x1
- #define UNIPERIF_I2S_FMT_PADDING_MASK(ip) 0x1
- #define VALUE_UNIPERIF_I2S_FMT_PADDING_I2S_MODE(ip) 0x0
- #define VALUE_UNIPERIF_I2S_FMT_PADDING_SONY_MODE(ip) 0x1
- #define GET_UNIPERIF_I2S_FMT_PADDING(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_PADDING_SHIFT(ip), \
- UNIPERIF_I2S_FMT_PADDING_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_PADDING(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_PADDING_SHIFT(ip), \
- UNIPERIF_I2S_FMT_PADDING_MASK(ip), value)
- #define SET_UNIPERIF_I2S_FMT_PADDING_I2S_MODE(ip) \
- SET_UNIPERIF_I2S_FMT_PADDING(ip, \
- VALUE_UNIPERIF_I2S_FMT_PADDING_I2S_MODE(ip))
- #define SET_UNIPERIF_I2S_FMT_PADDING_SONY_MODE(ip) \
- SET_UNIPERIF_I2S_FMT_PADDING(ip, \
- VALUE_UNIPERIF_I2S_FMT_PADDING_SONY_MODE(ip))
- /* ALIGN */
- #define UNIPERIF_I2S_FMT_ALIGN_SHIFT(ip) 7
- #define UNIPERIF_I2S_FMT_ALIGN_MASK(ip) 0x1
- #define GET_UNIPERIF_I2S_FMT_ALIGN(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_ALIGN_SHIFT(ip), \
- UNIPERIF_I2S_FMT_ALIGN_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_ALIGN_LEFT(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_ALIGN_SHIFT(ip), \
- UNIPERIF_I2S_FMT_ALIGN_MASK(ip), 0)
- #define SET_UNIPERIF_I2S_FMT_ALIGN_RIGHT(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_ALIGN_SHIFT(ip), \
- UNIPERIF_I2S_FMT_ALIGN_MASK(ip), 1)
- /* ORDER */
- #define UNIPERIF_I2S_FMT_ORDER_SHIFT(ip) 8
- #define UNIPERIF_I2S_FMT_ORDER_MASK(ip) 0x1
- #define GET_UNIPERIF_I2S_FMT_ORDER(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_ORDER_SHIFT(ip), \
- UNIPERIF_I2S_FMT_ORDER_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_ORDER_LSB(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_ORDER_SHIFT(ip), \
- UNIPERIF_I2S_FMT_ORDER_MASK(ip), 0)
- #define SET_UNIPERIF_I2S_FMT_ORDER_MSB(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_ORDER_SHIFT(ip), \
- UNIPERIF_I2S_FMT_ORDER_MASK(ip), 1)
- /* NUM_CH */
- #define UNIPERIF_I2S_FMT_NUM_CH_SHIFT(ip) 9
- #define UNIPERIF_I2S_FMT_NUM_CH_MASK(ip) 0x7
- #define GET_UNIPERIF_I2S_FMT_NUM_CH(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NUM_CH_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NUM_CH_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_NUM_CH(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NUM_CH_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NUM_CH_MASK(ip), value)
- /* NO_OF_SAMPLES_TO_READ */
- #define UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ_SHIFT(ip) 12
- #define UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ_MASK(ip) 0xfffff
- #define GET_UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ_MASK(ip))
- #define SET_UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_I2S_FMT_OFFSET(ip), \
- UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ_SHIFT(ip), \
- UNIPERIF_I2S_FMT_NO_OF_SAMPLES_TO_READ_MASK(ip), value)
- /*
- * UNIPERIF_BIT_CONTROL reg
- */
- #define UNIPERIF_BIT_CONTROL_OFFSET(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 0x004c)
- #define GET_UNIPERIF_BIT_CONTROL(ip) \
- readl_relaxed(ip->base + UNIPERIF_BIT_CONTROL_OFFSET(ip))
- #define SET_UNIPERIF_BIT_CONTROL(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_BIT_CONTROL_OFFSET(ip))
- /* CLR_UNDERFLOW_DURATION */
- #define UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION_SHIFT(ip) 0
- #define UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION_MASK(ip) 0x1
- #define GET_UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_BIT_CONTROL_OFFSET(ip), \
- UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION_SHIFT(ip), \
- UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION_MASK(ip))
- #define SET_UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION(ip) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_BIT_CONTROL_OFFSET(ip), \
- UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION_SHIFT(ip), \
- UNIPERIF_BIT_CONTROL_CLR_UNDERFLOW_DURATION_MASK(ip), 1)
- /* CHL_STS_UPDATE */
- #define UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE_SHIFT(ip) 1
- #define UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE_MASK(ip) 0x1
- #define GET_UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_BIT_CONTROL_OFFSET(ip), \
- UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE_SHIFT(ip), \
- UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE_MASK(ip))
- #define SET_UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE(ip) \
- SET_UNIPERIF_BIT_REG(ip, \
- UNIPERIF_BIT_CONTROL_OFFSET(ip), \
- UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE_SHIFT(ip), \
- UNIPERIF_BIT_CONTROL_CHL_STS_UPDATE_MASK(ip), 1)
- /*
- * UNIPERIF_STATUS_1 reg
- */
- #define UNIPERIF_STATUS_1_OFFSET(ip) 0x0050
- #define GET_UNIPERIF_STATUS_1(ip) \
- readl_relaxed(ip->base + UNIPERIF_STATUS_1_OFFSET(ip))
- #define SET_UNIPERIF_STATUS_1(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_STATUS_1_OFFSET(ip))
- /* UNDERFLOW_DURATION */
- #define UNIPERIF_STATUS_1_UNDERFLOW_DURATION_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 0)
- #define UNIPERIF_STATUS_1_UNDERFLOW_DURATION_MASK(ip) 0xff
- #define GET_UNIPERIF_STATUS_1_UNDERFLOW_DURATION(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_STATUS_1_OFFSET(ip), \
- UNIPERIF_STATUS_1_UNDERFLOW_DURATION_SHIFT(ip), \
- UNIPERIF_STATUS_1_UNDERFLOW_DURATION_MASK(ip))
- #define SET_UNIPERIF_STATUS_1_UNDERFLOW_DURATION(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_STATUS_1_OFFSET(ip), \
- UNIPERIF_STATUS_1_UNDERFLOW_DURATION_SHIFT(ip), \
- UNIPERIF_STATUS_1_UNDERFLOW_DURATION_MASK(ip), value)
- /*
- * AUD_UNIPERIF_CHANNEL_STA_REGN reg
- */
- #define UNIPERIF_CHANNEL_STA_REGN(ip, n) (0x0060 + (4 * n))
- #define GET_UNIPERIF_CHANNEL_STA_REGN(ip) \
- readl_relaxed(ip->base + UNIPERIF_CHANNEL_STA_REGN(ip, n))
- #define SET_UNIPERIF_CHANNEL_STA_REGN(ip, n, value) \
- writel_relaxed(value, ip->base + \
- UNIPERIF_CHANNEL_STA_REGN(ip, n))
- /*
- * AUD_UNIPERIF_USER_VALIDITY reg
- */
- #define UNIPERIF_USER_VALIDITY_OFFSET(ip) 0x0090
- #define GET_UNIPERIF_USER_VALIDITY(ip) \
- readl_relaxed(ip->base + UNIPERIF_USER_VALIDITY_OFFSET(ip))
- #define SET_UNIPERIF_USER_VALIDITY(ip, value) \
- writel_relaxed(value, ip->base + UNIPERIF_USER_VALIDITY_OFFSET(ip))
- /* VALIDITY_LEFT_AND_RIGHT */
- #define UNIPERIF_USER_VALIDITY_VALIDITY_LR_SHIFT(ip) 0
- #define UNIPERIF_USER_VALIDITY_VALIDITY_LR_MASK(ip) 0x3
- #define GET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_USER_VALIDITY_OFFSET(ip), \
- UNIPERIF_USER_VALIDITY_VALIDITY_LR_SHIFT(ip), \
- UNIPERIF_USER_VALIDITY_VALIDITY_LR_MASK(ip))
- #define SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_USER_VALIDITY_OFFSET(ip), \
- UNIPERIF_USER_VALIDITY_VALIDITY_LR_SHIFT(ip), \
- UNIPERIF_USER_VALIDITY_VALIDITY_LR_MASK(ip), \
- value ? 0x3 : 0)
- /*
- * UNIPERIF_DBG_STANDBY_LEFT_SP reg
- */
- #define UNIPERIF_DBG_STANDBY_LEFT_SP_OFFSET(ip) 0x0150
- #define UNIPERIF_DBG_STANDBY_LEFT_SP_SHIFT(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? -1 : 0)
- #define UNIPERIF_DBG_STANDBY_LEFT_SP_MASK(ip) \
- ((ip)->ver < SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 ? 0 : 0xFFFFFF)
- #define GET_UNIPERIF_DBG_STANDBY_LEFT_SP(ip) \
- GET_UNIPERIF_REG(ip, \
- UNIPERIF_DBG_STANDBY_LEFT_SP_OFFSET(ip), \
- UNIPERIF_DBG_STANDBY_LEFT_SP_SHIFT(ip), \
- UNIPERIF_DBG_STANDBY_LEFT_SP_MASK(ip))
- #define SET_UNIPERIF_DBG_STANDBY_LEFT_SP(ip, value) \
- SET_UNIPERIF_REG(ip, \
- UNIPERIF_DBG_STANDBY_LEFT_SP_OFFSET(ip), \
- UNIPERIF_DBG_STANDBY_LEFT_SP_SHIFT(ip), \
- UNIPERIF_DBG_STANDBY_LEFT_SP_MASK(ip), value)
- /*
- * uniperipheral IP capabilities
- */
- #define UNIPERIF_FIFO_SIZE 70 /* FIFO is 70 cells deep */
- #define UNIPERIF_FIFO_FRAMES 4 /* FDMA trigger limit in frames */
- /*
- * Uniperipheral IP revisions
- */
- enum uniperif_version {
- SND_ST_UNIPERIF_VERSION_UNKNOWN,
- /* SASG1 (Orly), Newman */
- SND_ST_UNIPERIF_VERSION_C6AUD0_UNI_1_0,
- /* SASC1, SASG2 (Orly2) */
- SND_ST_UNIPERIF_VERSION_UNI_PLR_1_0,
- /* SASC1, SASG2 (Orly2), TELSS, Cannes */
- SND_ST_UNIPERIF_VERSION_UNI_RDR_1_0,
- /* TELSS (SASC1) */
- SND_ST_UNIPERIF_VERSION_TDM_PLR_1_0,
- /* Cannes/Monaco */
- SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0
- };
- enum uniperif_type {
- SND_ST_UNIPERIF_PLAYER_TYPE_NONE,
- SND_ST_UNIPERIF_PLAYER_TYPE_HDMI,
- SND_ST_UNIPERIF_PLAYER_TYPE_PCM,
- SND_ST_UNIPERIF_PLAYER_TYPE_SPDIF
- };
- enum uniperif_state {
- UNIPERIF_STATE_STOPPED,
- UNIPERIF_STATE_STARTED,
- UNIPERIF_STATE_STANDBY,
- UNIPERIF_STATE_UNDERFLOW,
- UNIPERIF_STATE_OVERFLOW = UNIPERIF_STATE_UNDERFLOW,
- UNIPERIF_STATE_XRUN
- };
- enum uniperif_iec958_encoding_mode {
- UNIPERIF_IEC958_ENCODING_MODE_PCM,
- UNIPERIF_IEC958_ENCODING_MODE_ENCODED
- };
- struct uniperif_info {
- int id; /* instance value of the uniperipheral IP */
- enum uniperif_type player_type;
- int underflow_enabled; /* Underflow recovery mode */
- };
- struct uniperif_iec958_settings {
- enum uniperif_iec958_encoding_mode encoding_mode;
- struct snd_aes_iec958 iec958;
- };
- struct uniperif {
- /* System information */
- struct uniperif_info *info;
- struct device *dev;
- int ver; /* IP version, used by register access macros */
- struct regmap_field *clk_sel;
- /* capabilities */
- const struct snd_pcm_hardware *hw;
- /* Resources */
- struct resource *mem_region;
- void __iomem *base;
- unsigned long fifo_phys_address;
- int irq;
- /* Clocks */
- struct clk *clk;
- int mclk;
- int clk_adj;
- /* Runtime data */
- enum uniperif_state state;
- struct snd_pcm_substream *substream;
- /* Specific to IEC958 player */
- struct uniperif_iec958_settings stream_settings;
- struct mutex ctrl_lock; /* For resource updated by stream and controls*/
- /*alsa ctrl*/
- struct snd_kcontrol_new *snd_ctrls;
- int num_ctrls;
- /* dai properties */
- unsigned int daifmt;
- /* DAI callbacks */
- const struct snd_soc_dai_ops *dai_ops;
- };
- struct sti_uniperiph_dai {
- int stream;
- struct uniperif *uni;
- struct snd_dmaengine_dai_dma_data dma_data;
- };
- struct sti_uniperiph_data {
- struct platform_device *pdev;
- struct snd_soc_dai_driver *dai;
- struct sti_uniperiph_dai dai_data;
- };
- /* uniperiph player*/
- int uni_player_init(struct platform_device *pdev,
- struct uniperif *uni_player);
- int uni_player_resume(struct uniperif *player);
- /* uniperiph reader */
- int uni_reader_init(struct platform_device *pdev,
- struct uniperif *uni_reader);
- /* common */
- int sti_uniperiph_dai_set_fmt(struct snd_soc_dai *dai,
- unsigned int fmt);
- int sti_uniperiph_dai_hw_params(struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params,
- struct snd_soc_dai *dai);
- #endif
|