summaryrefslogtreecommitdiffstats
path: root/sound/soc/rockchip/rockchip_i2s.c
AgeCommit message (Collapse)AuthorFilesLines
2018-06-18ASoC: rockchip: add config for rockchip dmaengine pcm registerJianqun Xu1-1/+2
This patch makes the rockchip i2s pcm configurable by adding rockchip pcm config for devm_snd_dmaengine_pcm_register. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-01-12Merge remote-tracking branch 'asoc/topic/rockchip' into asoc-nextMark Brown1-2/+3
2018-01-08ASoC: rockchip: i2s: fix playback after runtime resumeJohn Keeping1-0/+6
When restoring registers during runtime resume, we must not write to I2S_TXDR which is the transmit FIFO as this queues up a sample to be output and pushes all of the output channels down by one. This can be demonstrated with the speaker-test utility: for i in a b c; do speaker-test -c 2 -s 1; done which should play a test through the left speaker three times but if the I2S hardware starts runtime suspended the first sample will be played through the right speaker. Fix this by marking I2S_TXDR as volatile (which also requires marking it as readble, even though it technically isn't). This seems to be the most robust fix, the alternative of giving I2S_TXDR a default value is more fragile since it does not prevent regcache writing to the register in all circumstances. While here, also fix the configuration of I2S_RXDR and I2S_FIFOLR; these are not writable so they do not suffer from the same problem as I2S_TXDR but reading from I2S_RXDR does suffer from a similar problem. Fixes: f0447f6cbb20 ("ASoC: rockchip: i2s: restore register during runtime_suspend/resume cycle", 2016-09-07) Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2018-01-08ASoC: rockchip: i2s: Support mono captureMatthias Kaehlcke1-2/+3
The Rockchip I2S controller only allows to configure even numbers of capture channels. It is still possible to capture monophonic audio by using dual-channel mode and ignoring the 'data' from the second channel. Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-10-26Merge remote-tracking branch 'asoc/fix/rockchip' into asoc-linusMark Brown1-1/+0
2017-09-14ASoC: rockchip: i2s: fix unbalanced clk_disableJohn Keeping1-1/+0
mclk is enabled and disabled only in i2s_runtime_{resume,suspend}() and we ensure that the device is runtime suspended before reaching this clk_disable_unprepare() call, so it is wrong to call it again here. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-14ASoC: rockchip: Delete an error message for a failed memory allocation in ↵Markus Elfring1-3/+1
rockchip_i2s_probe() Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-07-03Merge remote-tracking branches 'asoc/topic/omap', 'asoc/topic/pxa', ↵Mark Brown1-6/+33
'asoc/topic/rockchip' and 'asoc/topic/rt5514' into asoc-next
2017-06-16ASoC: rockchip: Fix buildMark Brown1-2/+2
Reported-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-15ASoC: rockchip: Fix an error handling in 'rockchip_i2s_probe'Christophe Jaillet1-4/+5
If this memory allocation fail, we must disable what has been enabled. Do not return immediately but go thrue the error handling path instead. Also use 'devm_kmemdup' instead of 'devm_kzalloc+memcpy' to simplify code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-13ASoC: rockchip: i2s: add a delay before i2s clearSugar Zhang1-0/+2
in order to guarantee i2s lrck signal integrity, when i2s stop, need at least one lrck cycle to ensure signal integrity. the max delay time is when lrck is 8khz, the delay time is 125us(1/8khz), using udelay(150) with a 25us margin. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-13ASoC: rockchip: i2s: add other configurable formatszhangjun1-2/+28
simple-audio-card,bitclock-inversion = <1> : bclk falling edge taken simple-audio-card,format = "dsp_a" : pcm no delay mode simple-audio-card,format = "dsp_b" : pcm late 1 mode Signed-off-by: zhangjun <zhangjun@rock-chips.com> Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-12ASoC: rockchip: i2s: restore register during runtime_suspend/resume cycleSugar Zhang1-1/+9
when step into runtime_suspend, i2s pd will be disabled and loss state. so need to restore register when runtime_resume. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30ASoC: rockchip: i2s: rename I2S_CKR_TRCM_TX/RXSHARE to I2S_CKR_TRCM_TX/RXONLYSugar Zhang1-2/+2
this patch make it more reasonable and readable, because when we chose I2S_CKR_TRCM_TXONLY, we only output clk_lrck_tx, and hardware need to confirm this signal is wired to external codec lrck_tx/rx at the same time. for convenience, we just handle lrck_txonly if we enable symmetric_rates in driver and dai_link. otherwise, we use the separate lrck_tx/rx. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-30ASoC: rockchip: i2s: configure the sdio pins' iomux modeSugar Zhang1-9/+58
There are 3 i2s sdio pins, which iomux mode is as follows: - sdi3_sdo1 - sdi2_sdo2 - sdi1_sdo3 we need to configure these pins' iomux mode via the GRF register when use multi channel playback/capture. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-04ASoC: rockchip: Revert "ASoC: rockchip: i2s: separate capture and playback"John Keeping1-32/+40
This reverts commit eba65d179c1149cf79e68608d452631f33d7f017. This broke audio on Veyron Jerry Chromebooks and I now cannot reproduce the problem I was trying to fix even with this commit reverted, so it seems that this was completely the wrong thing to do. Reported-by: Enric Balletbo Serra <eballetbo@gmail.com> Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-05-04ASoC: rockchip: Revert "ASoC: rockchip: i2s: remove unused variables"John Keeping1-0/+15
This reverts commit 5938448b99275cba95167c3f9d39ca9225fdad38. It turns out that the commit that made these variables unused is wrong so we're about to revert it. Bring back the variables in prepration. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-22ASoC: rockchip: i2s: add default values for registersSugar Zhang1-0/+10
this patch add default values for registers according description from TRM. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-22ASoC: rockchip: add bindings for rk3399 i2sJianqun Xu1-0/+3
Add devicetree bindings for i2s controller found on rk3399 processors from rockchip. It's helpful to add full set of compatible strings for serials of Rockchip SoCs (rk3066, rk3188, rk3288, rk3399). Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-10ASoC: rockchip: i2s: Add SNDRV_PCM_FMTBIT_S32_LE supportMichael Trimarchi1-2/+7
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-09ASoC: rockchip: i2s: remove unused variablesJohn Keeping1-15/+0
The previous commit removed the only use of these variables. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-09ASoC: rockchip: i2s: separate capture and playbackJohn Keeping1-40/+32
If we only clear the tx/rx state when both are disabled it is not possible to start/stop one multiple times while the other is running. Since the two are independently controlled, treat them as such and remove the false dependency between capture and playback. Signed-off-by: John Keeping <john@metanate.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-16ASoC: rockchip: i2s: compatible with different chipsSugar Zhang1-5/+15
there maybe more than one i2s module inside chip, and these i2s modules have different channels features. for example: there are 3 i2s in rk3066, one support 8 channels playback and 2 channels capture, but the others only support 2 channels playback and 2 channels capture. in order to compatible with these various chips, we add playback and capture property to specify these values. there are default channels configuration in driver: 8 channels playback and 2 channels capture. if not add property, we use the default values. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-16ASoC: rockchip: i2s: change bclk and lrck according to sample ratesCaesar Wang1-0/+23
This patch sets the dividers autonomously. when i2s works on master mode, and sample rates changed. We need to change bclk and lrck at the same time for cpu internal side. As the input source clock to the module is MCLK_I2S, and by the divider of the module, the clock generator generates SCLK and LRCK to transmitter and receiver. Signed-off-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23ASoC: rockchip: i2s: share tx/rx lrck when symmetric_rates enabledSugar Zhang1-0/+8
share lrck_tx to lrck_rx when symmetric_rates enabled. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-23ASoC: rockchip: i2s: add 8 channels capture supportSugar Zhang1-2/+38
support max 8 channels capture, please add property 'rockchip,capture-channels' in dts to enable this, if not, support 2 channels capture default. Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-19ASoC: rockchip: i2s: Adjust devm usageVaishali Thakkar1-6/+2
Remove use of snd_soc_unregister_component in remove function as devm_snd_soc_register_component in probe function automatically handles it. Also, convert call of snd_dmaengine_pcm_register to managed resource function devm_snd_dmaengine_pcm_register and remove usage of snd_dmaengine_pcm_unregister in probe and remove functions. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-26Merge branch 'for-linus' into for-nextTakashi Iwai1-0/+1
Sync with the latest 3.19-rc state for applying other ALSA sequencer core fixes.
2015-01-26Merge remote-tracking branches 'asoc/fix/adi', 'asoc/fix/compress', ↵Mark Brown1-0/+1
'asoc/fix/fsl-ssi', 'asoc/fix/imx', 'asoc/fix/intel', 'asoc/fix/omap', 'asoc/fix/rockchip' and 'asoc/fix/rt286' into asoc-linus
2015-01-08ASoC: rockchip: i2s: applys rate symmetry for CPU DAIJianqun Xu1-0/+1
This patch applys rate symmetry for rockchip i2s DAI. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-24Merge remote-tracking branches 'asoc/topic/pxa', 'asoc/topic/rockchip', ↵Mark Brown1-0/+4
'asoc/topic/rt5670' and 'asoc/topic/rt5677' into asoc-next
2014-12-24ASoC: rockchip: i2s: set TDL and RDL to 16 samplesJianqun Xu1-0/+4
Set Transmit Data Level(TDL) and Receive Data Level(RDL) to 16 samples. Without this setting, the TDL is default to be 0x00 (means 0 sample), and the RDL is default to be 0x1f (means 32 samples). Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-24ASoC: rockchip: i2s: fix maxburst of dma data to 4Jianqun Xu1-2/+2
Since RK3288 DMAC's burst length only support max to 4, here set maxburst of playback and capture dma data to 4. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-14Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds1-1/+0
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
2014-10-29ASoC: rockchip-i2s: fix infinite loop in rockchip_snd_rxctrlJianqun1-1/+3
We can get into an infinite loop if the I2S_CLR register fails to clear due to a missing break statement, so add that. Signed-off-by: Jianqun <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2014-10-20ASoC: rockchip: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-08ASoC: rockchip-i2s: fix infinite loop in rockchip_snd_txctrlSonny Rao1-1/+3
We can get into an infinite loop if the I2S_CLR register fails to clear due to a missing break statement, so add that. Signed-off-by: Sonny Rao <sonnyrao@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-06Merge remote-tracking branches 'asoc/topic/max98090', 'asoc/topic/rockchip', ↵Mark Brown1-10/+18
'asoc/topic/rsnd' and 'asoc/topic/rt286' into asoc-next
2014-09-13ASoC: rockchip-i2s: add dma data to snd_soc_daiJianqun1-10/+13
Add playback/capture dma data to snd_soc_dai. Test on RK3288 with max98090. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-13ASoC: rockchip-i2s: enable "hclk" for rockchip I2S controllerJianqun1-0/+5
As "hclk" is used for rockchip I2S controller, driver must to enable it in probe. Tested on RK3288 with max98090. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-13ASoC: rockchip-i2s: fix registers' property of rockchip i2s controllerJianqun1-3/+3
Reference rockchip I2S controller TRM, modify some registers' property I2S_FIFOLR: read / write, but not volatile, not precious I2S_INTSR: read / write I2S_CLR: volatile, register value will be cleared by read Test on RK3288 with max98090. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-13ASoC: rockchip-i2s: fix master mode set bit errorJianqun1-3/+4
Fix error format set to I2S master or slave mode. Test on RK3288 board with max98090. Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-07-28ASoC: rockchip: remove redundant dev_err call in rockchip_i2s_probe()Wei Yongjun1-3/+1
There is a error message within devm_ioremap_resource already, so remove the dev_err call to avoid redundant error message. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-14ASoC: rockchip: fix duplicated argument to && or ||xujianqun1-5/+5
This resulted from an unfortunate copy/paste to similar DEFINE name. Detected automagically by kbuild. Signed-off-by: xujianqun <xjq@rock-chips.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-11ASoC: rockchip: add missing module.h includexujianqun1-0/+1
Missing module.h in linux directory will cause compile error with randconfig, like as: sound/soc/rockchip/rockchip_i2s.c:526:20: error: expected declaration specifiers or ‘...’ before string constant MODULE_DESCRIPTION("ROCKCHIP IIS ASoC Interface"); Signed-off-by: xujianqun <xjq@rock-chips.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-09ASoC: add driver for Rockchip RK3xxx I2S controllerJianqun Xu1-0/+530
Add driver for i2s controller found on rk3066, rk3168 and rk3288 processors from rockchip. Tested on the RK3288 SDK board. Signed-off-by: Jianqun Xu <xjq@rock-chips.com> Signed-off-by: Mark Brown <broonie@linaro.org>