/* * mtk-afe-platform-driver.c -- Mediatek afe platform driver * * Copyright (c) 2016 MediaTek Inc. * Author: Garlic Tseng * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include #include #include #include "mtk-afe-platform-driver.h" #include "mtk-base-afe.h" static snd_pcm_uframes_t mtk_afe_pcm_pointer (struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; const struct mtk_base_memif_data *memif_data = memif->data; struct regmap *regmap = afe->regmap; struct device *dev = afe->dev; int reg_ofs_base = memif_data->reg_ofs_base; int reg_ofs_cur = memif_data->reg_ofs_cur; unsigned int hw_ptr = 0, hw_base = 0; int ret, pcm_ptr_bytes; ret = regmap_read(regmap, reg_ofs_cur, &hw_ptr); if (ret || hw_ptr == 0) { dev_err(dev, "%s hw_ptr err\n", __func__); pcm_ptr_bytes = 0; goto POINTER_RETURN_FRAMES; } ret = regmap_read(regmap, reg_ofs_base, &hw_base); if (ret || hw_base == 0) { dev_err(dev, "%s hw_ptr err\n", __func__); pcm_ptr_bytes = 0; goto POINTER_RETURN_FRAMES; } pcm_ptr_bytes = hw_ptr - hw_base; POINTER_RETURN_FRAMES: return bytes_to_frames(substream->runtime, pcm_ptr_bytes); } static const struct snd_pcm_ops mtk_afe_pcm_ops = { .ioctl = snd_pcm_lib_ioctl, .pointer = mtk_afe_pcm_pointer, }; static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd) { size_t size; struct snd_card *card = rtd->card->snd_card; struct snd_pcm *pcm = rtd->pcm; struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); size = afe->mtk_afe_hardware->buffer_bytes_max; return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, size, size); } static void mtk_afe_pcm_free(struct snd_pcm *pcm) { snd_pcm_lib_preallocate_free_for_all(pcm); } const struct snd_soc_platform_driver mtk_afe_pcm_platform = { .ops = &mtk_afe_pcm_ops, .pcm_new = mtk_afe_pcm_new, .pcm_free = mtk_afe_pcm_free, }; EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform); MODULE_DESCRIPTION("Mediatek simple platform driver"); MODULE_AUTHOR("Garlic Tseng "); MODULE_LICENSE("GPL v2"); td>
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 10:29:33 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 10:29:33 -0800
commit9d1d166f18f8f0f332573b8d2e28e5b3291f09c5 (patch)
tree364c81aaa0645ddfb817e4676744dea5b1b34255 /tools
parentb84f02795e3bcf197ae13a7e3ac6cc9d66d2feaa (diff)
parent0e0694ff1a7791274946b7f51bae692da0001a08 (diff)
Merge tag 'media/v4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media fixes from Mauro Carvalho Chehab: - fix a regression on tvp5150 causing failures at input selection and image glitches - CEC was moved out of staging for v4.10. Fix some bugs on it while not too late - fix a regression on pctv452e caused by VM stack changes - fix suspend issued with smiapp - fix a regression on cobalt driver - fix some warnings and Kconfig issues with some random configs. * tag 'media/v4.10-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: [media] s5k4ecgx: select CRC32 helper [media] dvb: avoid warning in dvb_net [media] v4l: tvp5150: Don't override output pinmuxing at stream on/off time [media] v4l: tvp5150: Fix comment regarding output pin muxing [media] v4l: tvp5150: Reset device at probe time, not in get/set format handlers [media] pctv452e: move buffer to heap, no mutex [media] media/cobalt: use pci_irq_allocate_vectors [media] cec: fix race between configuring and unconfiguring [media] cec: move cec_report_phys_addr into cec_config_thread_func [media] cec: replace cec_report_features by cec_fill_msg_report_features [media] cec: update log_addr[] before finishing configuration [media] cec: CEC_MSG_GIVE_FEATURES should abort for CEC version < 2 [media] cec: when canceling a message, don't overwrite old status info [media] cec: fix report_current_latency [media] smiapp: Make suspend and resume functions __maybe_unused [media] smiapp: Implement power-on and power-off sequences without runtime PM
Diffstat (limited to 'tools')