Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 632032dd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "SoC: msm: add machine driver for SDM855"

parents 89e0000f ac5bb48a
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -3132,7 +3132,7 @@ static snd_pcm_uframes_t msm_cpe_lsm_pointer(
}

static int msm_cpe_lsm_copy(struct snd_pcm_substream *substream, int a,
	 snd_pcm_uframes_t hwoff, void __user *buf, snd_pcm_uframes_t frames)
	 unsigned long hwoff, void __user *buf, unsigned long fbytes)
{
	struct cpe_lsm_data *lsm_d = cpe_get_lsm_data(substream);
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -3140,10 +3140,8 @@ static int msm_cpe_lsm_copy(struct snd_pcm_substream *substream, int a,
	struct cpe_lsm_session *session;
	struct cpe_lsm_lab *lab_d = &lsm_d->lab;
	char *pcm_buf;
	int fbytes = 0;
	int rc = 0;

	fbytes = frames_to_bytes(runtime, frames);
	if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
	   runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
		pr_err("%s: XRUN ignore for now\n", __func__);
@@ -3286,7 +3284,7 @@ static const struct snd_pcm_ops msm_cpe_lsm_ops = {
	.prepare = msm_cpe_lsm_prepare,
	.trigger = msm_cpe_lsm_trigger,
	.pointer = msm_cpe_lsm_pointer,
	.copy = msm_cpe_lsm_copy,
	.copy_user = msm_cpe_lsm_copy,
	.hw_params = msm_cpe_lsm_hwparams,
	.compat_ioctl = msm_cpe_lsm_ioctl_compat,
};
+6 −7
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -2176,12 +2176,12 @@ static snd_pcm_uframes_t msm_lsm_pcm_pointer(
}

static int msm_lsm_pcm_copy(struct snd_pcm_substream *substream, int ch,
	snd_pcm_uframes_t hwoff, void __user *buf, snd_pcm_uframes_t frames)
	unsigned long hwoff, void __user *buf, unsigned long fbytes)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct lsm_priv *prtd = runtime->private_data;
	char *pcm_buf = NULL;
	int fbytes = 0, rc = 0;
	int rc = 0;
	struct snd_soc_pcm_runtime *rtd;

	if (!substream->private_data) {
@@ -2196,7 +2196,6 @@ static int msm_lsm_pcm_copy(struct snd_pcm_substream *substream, int ch,
		return -EINVAL;
	}

	fbytes = frames_to_bytes(runtime, frames);
	if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
	    runtime->status->state == SNDRV_PCM_STATE_PREPARED) {
		dev_err(rtd->dev,
@@ -2221,12 +2220,12 @@ static int msm_lsm_pcm_copy(struct snd_pcm_substream *substream, int ch,
		prtd->lsm_client->hw_params.period_count;
	pcm_buf = prtd->lsm_client->lab_buffer[prtd->appl_cnt].data;
	dev_dbg(rtd->dev,
		"%s: copy the pcm data size %d\n",
		"%s: copy the pcm data size %lu\n",
		__func__, fbytes);
	if (pcm_buf) {
		if (copy_to_user(buf, pcm_buf, fbytes)) {
			dev_err(rtd->dev,
				"%s: failed to copy bytes %d\n",
				"%s: failed to copy bytes %lu\n",
				__func__, fbytes);
			return -EINVAL;
		}
@@ -2341,7 +2340,7 @@ static const struct snd_pcm_ops msm_lsm_ops = {
	.prepare	= msm_lsm_prepare,
	.compat_ioctl   = msm_lsm_ioctl_compat,
	.hw_params      = msm_lsm_hw_params,
	.copy           = msm_lsm_pcm_copy,
	.copy_user      = msm_lsm_pcm_copy,
	.pointer        = msm_lsm_pcm_pointer,
};

+14 −14
Original line number Diff line number Diff line
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -489,20 +489,20 @@ static int msm_afe_open(struct snd_pcm_substream *substream)
}

static int msm_afe_playback_copy(struct snd_pcm_substream *substream,
				int channel, snd_pcm_uframes_t hwoff,
				void __user *buf, snd_pcm_uframes_t frames)
				int channel, unsigned long hwoff,
				void __user *buf, unsigned long fbytes)
{
	int ret = 0;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pcm_afe_info *prtd = runtime->private_data;
	char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff);
	char *hwbuf = runtime->dma_area + hwoff;
	u32 mem_map_handle = 0;

	pr_debug("%s : appl_ptr 0x%lx hw_ptr 0x%lx dest_to_copy 0x%pK\n",
		__func__,
		runtime->control->appl_ptr, runtime->status->hw_ptr, hwbuf);

	if (copy_from_user(hwbuf, buf, frames_to_bytes(runtime, frames))) {
	if (copy_from_user(hwbuf, buf, fbytes)) {
		pr_err("%s :Failed to copy audio from user buffer\n",
			__func__);

@@ -542,13 +542,13 @@ static int msm_afe_playback_copy(struct snd_pcm_substream *substream,
}

static int msm_afe_capture_copy(struct snd_pcm_substream *substream,
				int channel, snd_pcm_uframes_t hwoff,
				void __user *buf, snd_pcm_uframes_t frames)
				int channel, unsigned long hwoff,
				void __user *buf, unsigned long fbytes)
{
	int ret = 0;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pcm_afe_info *prtd = runtime->private_data;
	char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff);
	char *hwbuf = runtime->dma_area + hwoff;
	u32 mem_map_handle = 0;

	if (!prtd->mmap_flag) {
@@ -590,7 +590,7 @@ static int msm_afe_capture_copy(struct snd_pcm_substream *substream,
			__func__, runtime->control->appl_ptr,
			runtime->status->hw_ptr, hwbuf);

	if (copy_to_user(buf, hwbuf, frames_to_bytes(runtime, frames))) {
	if (copy_to_user(buf, hwbuf, fbytes)) {
		pr_err("%s: copy to user failed\n", __func__);

		goto fail;
@@ -602,8 +602,8 @@ static int msm_afe_capture_copy(struct snd_pcm_substream *substream,
}

static int msm_afe_copy(struct snd_pcm_substream *substream, int channel,
			snd_pcm_uframes_t hwoff, void __user *buf,
			snd_pcm_uframes_t frames)
			unsigned long hwoff, void __user *buf,
			unsigned long fbytes)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pcm_afe_info *prtd = runtime->private_data;
@@ -618,10 +618,10 @@ static int msm_afe_copy(struct snd_pcm_substream *substream, int channel,

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
		ret = msm_afe_playback_copy(substream, channel, hwoff,
					buf, frames);
					buf, fbytes);
	else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
		ret = msm_afe_capture_copy(substream, channel, hwoff,
					buf, frames);
					buf, fbytes);
	return ret;
}

@@ -841,7 +841,7 @@ static snd_pcm_uframes_t msm_afe_pointer(struct snd_pcm_substream *substream)

static const struct snd_pcm_ops msm_afe_ops = {
	.open           = msm_afe_open,
	.copy           = msm_afe_copy,
	.copy_user      = msm_afe_copy,
	.hw_params	= msm_afe_hw_params,
	.trigger	= msm_afe_trigger,
	.close          = msm_afe_close,
+10 −13
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, 2017 The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, 2017-2018 The Linux Foundation. All rights reserved.
 *
 * 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
@@ -217,24 +217,21 @@ static void dtmf_rx_detected_cb(uint8_t *pkt,
}

static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
				int channel, snd_pcm_uframes_t hwoff,
				void __user *buf, snd_pcm_uframes_t frames)
				int channel, unsigned long hwoff,
				void __user *buf, unsigned long fbytes)
{
	int ret = 0;
	int count = 0;
	struct dtmf_buf_node *buf_node = NULL;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct dtmf_drv_info *prtd = runtime->private_data;
	unsigned long dsp_flags;

	count = frames_to_bytes(runtime, frames);

	ret = wait_event_interruptible_timeout(prtd->out_wait,
				(!list_empty(&prtd->out_queue)),
				1 * HZ);

	if (ret > 0) {
		if (count <= DTMF_PKT_SIZE) {
		if (fbytes <= DTMF_PKT_SIZE) {
			spin_lock_irqsave(&prtd->dsp_lock, dsp_flags);
			buf_node = list_first_entry(&prtd->out_queue,
					struct dtmf_buf_node, list);
@@ -242,7 +239,7 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
			spin_unlock_irqrestore(&prtd->dsp_lock, dsp_flags);
			ret = copy_to_user(buf,
					   &buf_node->dtmf_det_pkt,
					   count);
					   fbytes);
			if (ret) {
				pr_err("%s: Copy to user returned %d\n",
					__func__, ret);
@@ -254,8 +251,8 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
			spin_unlock_irqrestore(&prtd->dsp_lock, dsp_flags);

		} else {
			pr_err("%s: Read count %d > DTMF_PKT_SIZE\n",
				__func__, count);
			pr_err("%s: Read count %lu > DTMF_PKT_SIZE\n",
				__func__, fbytes);
			ret = -ENOMEM;
		}
	} else if (ret == 0) {
@@ -269,14 +266,14 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
}

static int msm_pcm_copy(struct snd_pcm_substream *substream, int a,
	 snd_pcm_uframes_t hwoff, void __user *buf, snd_pcm_uframes_t frames)
	 unsigned long hwoff, void __user *buf, unsigned long fbytes)
{
	int ret = 0;

	pr_debug("%s() DTMF\n", __func__);

	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
		ret = msm_pcm_capture_copy(substream, a, hwoff, buf, frames);
		ret = msm_pcm_capture_copy(substream, a, hwoff, buf, fbytes);

	return ret;
}
@@ -524,7 +521,7 @@ static snd_pcm_uframes_t msm_pcm_pointer(struct snd_pcm_substream *substream)

static const struct snd_pcm_ops msm_pcm_ops = {
	.open           = msm_pcm_open,
	.copy		= msm_pcm_copy,
	.copy_user	= msm_pcm_copy,
	.hw_params	= msm_pcm_hw_params,
	.close          = msm_pcm_close,
	.prepare        = msm_pcm_prepare,
+18 −23
Original line number Diff line number Diff line
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
 *
 * 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
@@ -1088,8 +1088,8 @@ static int msm_pcm_close(struct snd_pcm_substream *substream)
}

static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
				 snd_pcm_uframes_t hwoff, void __user *buf,
				 snd_pcm_uframes_t frames)
				 unsigned long hwoff, void __user *buf,
				 unsigned long fbytes)
{
	int ret = 0;
	struct hpcm_buf_node *buf_node = NULL;
@@ -1098,8 +1098,6 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
	struct dai_data *dai_data = hpcm_get_dai_data(substream->pcm->id, prtd);
	unsigned long dsp_flags;

	int count = frames_to_bytes(runtime, frames);

	if (dai_data == NULL) {
		pr_err("%s, dai_data is null\n", __func__);

@@ -1112,7 +1110,7 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
				dai_data->state == HPCM_STOPPED),
				1 * HZ);
	if (ret > 0) {
		if (count <= HPCM_MAX_VOC_PKT_SIZE) {
		if (fbytes <= HPCM_MAX_VOC_PKT_SIZE) {
			spin_lock_irqsave(&dai_data->dsp_lock, dsp_flags);
			buf_node =
				list_first_entry(&dai_data->free_queue,
@@ -1120,14 +1118,14 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
			list_del(&buf_node->list);
			spin_unlock_irqrestore(&dai_data->dsp_lock, dsp_flags);
			ret = copy_from_user(&buf_node->frame.voc_pkt, buf,
					     count);
			buf_node->frame.len = count;
					     fbytes);
			buf_node->frame.len = fbytes;
			spin_lock_irqsave(&dai_data->dsp_lock, dsp_flags);
			list_add_tail(&buf_node->list, &dai_data->filled_queue);
			spin_unlock_irqrestore(&dai_data->dsp_lock, dsp_flags);
		} else {
			pr_err("%s: Write cnt %d is > HPCM_MAX_VOC_PKT_SIZE\n",
				__func__, count);
			pr_err("%s: Write cnt %lu is > HPCM_MAX_VOC_PKT_SIZE\n",
				__func__, fbytes);
			ret = -ENOMEM;
		}
	} else if (ret == 0) {
@@ -1142,11 +1140,10 @@ static int msm_pcm_playback_copy(struct snd_pcm_substream *substream, int a,
}

static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
				int channel, snd_pcm_uframes_t hwoff,
				void __user *buf, snd_pcm_uframes_t frames)
				int channel, unsigned long hwoff,
				void __user *buf, unsigned long fbytes)
{
	int ret = 0;
	int count = 0;
	struct hpcm_buf_node *buf_node = NULL;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct hpcm_drv *prtd = runtime->private_data;
@@ -1160,15 +1157,13 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
		goto done;
	}

	count = frames_to_bytes(runtime, frames);

	ret = wait_event_interruptible_timeout(dai_data->queue_wait,
				(!list_empty(&dai_data->filled_queue) ||
				dai_data->state == HPCM_STOPPED),
				1 * HZ);

	if (ret > 0) {
		if (count <= HPCM_MAX_VOC_PKT_SIZE) {
		if (fbytes <= HPCM_MAX_VOC_PKT_SIZE) {
			spin_lock_irqsave(&dai_data->dsp_lock, dsp_flags);
			buf_node = list_first_entry(&dai_data->filled_queue,
					struct hpcm_buf_node, list);
@@ -1186,8 +1181,8 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
			spin_unlock_irqrestore(&dai_data->dsp_lock, dsp_flags);

		} else {
			pr_err("%s: Read count %d > HPCM_MAX_VOC_PKT_SIZE\n",
				__func__, count);
			pr_err("%s: Read count %lu > HPCM_MAX_VOC_PKT_SIZE\n",
				__func__, fbytes);
			ret = -ENOMEM;
		}

@@ -1204,17 +1199,17 @@ static int msm_pcm_capture_copy(struct snd_pcm_substream *substream,
}

static int msm_pcm_copy(struct snd_pcm_substream *substream, int channel,
			snd_pcm_uframes_t hwoff, void __user *buf,
			snd_pcm_uframes_t frames)
			unsigned long hwoff, void __user *buf,
			unsigned long fbytes)
{
	int ret = 0;

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
		ret = msm_pcm_playback_copy(substream, channel,
					    hwoff, buf, frames);
					    hwoff, buf, fbytes);
	else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
		ret = msm_pcm_capture_copy(substream, channel,
					   hwoff, buf, frames);
					   hwoff, buf, fbytes);

	return ret;
}
@@ -1446,7 +1441,7 @@ static const struct snd_pcm_ops msm_pcm_ops = {
	.prepare        = msm_pcm_prepare,
	.trigger        = msm_pcm_trigger,
	.pointer        = msm_pcm_pointer,
	.copy           = msm_pcm_copy,
	.copy_user      = msm_pcm_copy,
	.close          = msm_pcm_close,
};

Loading