Skip to contentSkip to conversation

ASoC: Intel: mfld-pcm: Fix to remove ioctls

PATCH Applied Subhransu S. Prusty 2 participants 5 messages Aug 4, 2014 – Aug 7, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ASoC: Intel: mfld-pcm: Fix to remove ioctls

This patch series removes the ioctl type interface and uses dedicated ops.

Subhransu S. Prusty (2):
ASoC: Intel: mfld-pcm: Use function instead of ioctl
ASoC: Intel: mfld-pcm: Change sst_ops prototypes to take dev parameter

Vinod Koul (1):
ASoC: Intel: Fix to use byte control interface

 sound/soc/intel/sst-mfld-platform-pcm.c | 26 +++++++++++---------------
 sound/soc/intel/sst-mfld-platform.h     | 27 +++++++++------------------
 2 files changed, 20 insertions(+), 33 deletions(-)
Signature · 1 line
1.9.0
#1 lore raw

PATCH 1/3 ASoC: Intel: Fix to use byte control interface

From: Vinod Koul <[email protected]>

Using a byte control interface instead of generic_params ioctl.

---
 sound/soc/intel/sst-mfld-platform.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
sound/soc/intel/sst-mfld-platform.h +2 -4
index 6c6a42c08e24..cc3a088df7dd 100644
@@ -63,9 +63,7 @@ enum sst_controls {
 	SST_SND_BUFFER_POINTER =	0x05,
 	SST_SND_STREAM_INIT =		0x06,
 	SST_SND_START	 =		0x07,
-	SST_SET_BYTE_STREAM =           0x100A,
-	SST_GET_BYTE_STREAM =           0x100B,
-	SST_MAX_CONTROLS = SST_GET_BYTE_STREAM,
+	SST_MAX_CONTROLS = 		0x07,
 };
 
 enum sst_stream_ops {
@@ -129,7 +127,7 @@ struct compress_sst_ops {
 struct sst_ops {
 	int (*open) (struct snd_sst_params *str_param);
 	int (*device_control) (int cmd, void *arg);
-	int (*set_generic_params)(enum sst_controls cmd, void *arg);
+	int (*send_byte_stream)(struct snd_sst_bytes_v2 *bytes);
 	int (*close) (unsigned int str_id);
 };
 
Signature · 1 line
1.9.0
maintainer Applied
#2 lore raw

Re: [PATCH 1/3] ASoC: Intel: Fix to use byte control interface

Quoted 3 lines · Subhransu S. Prusty

From: Vinod Koul <[email protected]>

Using a byte control interface instead of generic_params ioctl.

Applied all, thanks. This is a bit confusing since it's called a fix but it's not actually a bug fix.

Quoted 3 lines

The signoffs should really be in the other order - if you're passing on someone else's code you need to add your signoff after theirs.

#3 lore raw

PATCH 2/3 ASoC: Intel: mfld-pcm: Use function instead of ioctl

In reply to Subhransu S. Prusty
---
 sound/soc/intel/sst-mfld-platform-pcm.c | 21 +++++++++------------
 sound/soc/intel/sst-mfld-platform.h     | 19 ++++++-------------
 2 files changed, 15 insertions(+), 25 deletions(-)
sound/soc/intel/sst-mfld-platform-pcm.c +9 -12
index 706212a6a68c..42766a51c17e 100644
@@ -314,8 +314,7 @@ static int sst_platform_init_stream(struct snd_pcm_substream *substream)
 	stream->stream_info.arg = substream;
 	stream->stream_info.buffer_ptr = 0;
 	stream->stream_info.sfreq = substream->runtime->rate;
-	ret_val = stream->ops->device_control(
-			SST_SND_STREAM_INIT, &stream->stream_info);
+	ret_val = stream->ops->stream_init(&stream->stream_info);
 	if (ret_val)
 		pr_err("control_set ret error %d\n", ret_val);
 	return ret_val;
@@ -403,8 +402,7 @@ static int sst_media_prepare(struct snd_pcm_substream *substream,
 	stream = substream->runtime->private_data;
 	str_id = stream->stream_info.str_id;
 	if (stream->stream_info.str_id) {
-		ret_val = stream->ops->device_control(
-				SST_SND_DROP, &str_id);
+		ret_val = stream->ops->stream_drop(str_id);
 		return ret_val;
 	}
 
@@ -461,7 +459,7 @@ static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
 {
 	int ret_val = 0, str_id;
 	struct sst_runtime_stream *stream;
-	int str_cmd, status;
+	int status;
 
 	pr_debug("sst_platform_pcm_trigger called\n");
 	stream = substream->runtime->private_data;
@@ -469,29 +467,29 @@ static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		pr_debug("sst: Trigger Start\n");
-		str_cmd = SST_SND_START;
 		status = SST_PLATFORM_RUNNING;
 		stream->stream_info.arg = substream;
+		ret_val = stream->ops->stream_start(str_id);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		pr_debug("sst: in stop\n");
-		str_cmd = SST_SND_DROP;
 		status = SST_PLATFORM_DROPPED;
+		ret_val = stream->ops->stream_drop(str_id);
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		pr_debug("sst: in pause\n");
-		str_cmd = SST_SND_PAUSE;
 		status = SST_PLATFORM_PAUSED;
+		ret_val = stream->ops->stream_pause(str_id);
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		pr_debug("sst: in pause release\n");
-		str_cmd = SST_SND_RESUME;
 		status = SST_PLATFORM_RUNNING;
+		ret_val = stream->ops->stream_pause_release(str_id);
 		break;
 	default:
 		return -EINVAL;
 	}
-	ret_val = stream->ops->device_control(str_cmd, &str_id);
+
 	if (!ret_val)
 		sst_set_stream_status(stream, status);
 
@@ -511,8 +509,7 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer
 	if (status == SST_PLATFORM_INIT)
 		return 0;
 	str_info = &stream->stream_info;
-	ret_val = stream->ops->device_control(
-				SST_SND_BUFFER_POINTER, str_info);
+	ret_val = stream->ops->stream_read_tstamp(str_info);
 	if (ret_val) {
 		pr_err("sst: error code = %d\n", ret_val);
 		return ret_val;
sound/soc/intel/sst-mfld-platform.h +6 -13
index cc3a088df7dd..2d6e65bbbc49 100644
@@ -54,18 +54,6 @@ enum sst_drv_status {
 	SST_PLATFORM_DROPPED,
 };
 
-enum sst_controls {
-	SST_SND_ALLOC =			0x00,
-	SST_SND_PAUSE =			0x01,
-	SST_SND_RESUME =		0x02,
-	SST_SND_DROP =			0x03,
-	SST_SND_FREE =			0x04,
-	SST_SND_BUFFER_POINTER =	0x05,
-	SST_SND_STREAM_INIT =		0x06,
-	SST_SND_START	 =		0x07,
-	SST_MAX_CONTROLS = 		0x07,
-};
-
 enum sst_stream_ops {
 	STREAM_OPS_PLAYBACK = 0,
 	STREAM_OPS_CAPTURE,
@@ -126,7 +114,12 @@ struct compress_sst_ops {
 
 struct sst_ops {
 	int (*open) (struct snd_sst_params *str_param);
-	int (*device_control) (int cmd, void *arg);
+	int (*stream_init) (struct pcm_stream_info *str_info);
+	int (*stream_start) (int str_id);
+	int (*stream_drop) (int str_id);
+	int (*stream_pause) (int str_id);
+	int (*stream_pause_release) (int str_id);
+	int (*stream_read_tstamp) (struct pcm_stream_info *str_info);
 	int (*send_byte_stream)(struct snd_sst_bytes_v2 *bytes);
 	int (*close) (unsigned int str_id);
 };
Signature · 1 line
1.9.0
#4 lore raw

PATCH 3/3 ASoC: Intel: mfld-pcm: Change sst_ops prototypes to take dev parameter

In reply to Subhransu S. Prusty

sst_ops need to use the sst driver context. So pass sst device as argument, which can be used to retrieve sst context.

---
 sound/soc/intel/sst-mfld-platform-pcm.c | 19 +++++++++----------
 sound/soc/intel/sst-mfld-platform.h     | 18 +++++++++---------
 2 files changed, 18 insertions(+), 19 deletions(-)
sound/soc/intel/sst-mfld-platform-pcm.c +9 -10
index 42766a51c17e..a89ff7e18e1a 100644
@@ -277,7 +277,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream,
 
 	stream->stream_info.str_id = str_params.stream_id;
 
-	ret_val = stream->ops->open(&str_params);
+	ret_val = stream->ops->open(sst->dev, &str_params);
 	if (ret_val <= 0)
 		return ret_val;
 
@@ -314,13 +314,12 @@ static int sst_platform_init_stream(struct snd_pcm_substream *substream)
 	stream->stream_info.arg = substream;
 	stream->stream_info.buffer_ptr = 0;
 	stream->stream_info.sfreq = substream->runtime->rate;
-	ret_val = stream->ops->stream_init(&stream->stream_info);
+	ret_val = stream->ops->stream_init(sst->dev, &stream->stream_info);
 	if (ret_val)
 		pr_err("control_set ret error %d\n", ret_val);
 	return ret_val;
 
 }
-/* end -- helper functions */
 
 static int sst_media_open(struct snd_pcm_substream *substream,
 		struct snd_soc_dai *dai)
@@ -372,7 +371,7 @@ static void sst_media_close(struct snd_pcm_substream *substream,
 	stream = substream->runtime->private_data;
 	str_id = stream->stream_info.str_id;
 	if (str_id)
-		ret_val = stream->ops->close(str_id);
+		ret_val = stream->ops->close(sst->dev, str_id);
 	module_put(sst->dev->driver->owner);
 	kfree(stream);
 }
@@ -402,7 +401,7 @@ static int sst_media_prepare(struct snd_pcm_substream *substream,
 	stream = substream->runtime->private_data;
 	str_id = stream->stream_info.str_id;
 	if (stream->stream_info.str_id) {
-		ret_val = stream->ops->stream_drop(str_id);
+		ret_val = stream->ops->stream_drop(sst->dev, str_id);
 		return ret_val;
 	}
 
@@ -469,22 +468,22 @@ static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
 		pr_debug("sst: Trigger Start\n");
 		status = SST_PLATFORM_RUNNING;
 		stream->stream_info.arg = substream;
-		ret_val = stream->ops->stream_start(str_id);
+		ret_val = stream->ops->stream_start(sst->dev, str_id);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 		pr_debug("sst: in stop\n");
 		status = SST_PLATFORM_DROPPED;
-		ret_val = stream->ops->stream_drop(str_id);
+		ret_val = stream->ops->stream_drop(sst->dev, str_id);
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		pr_debug("sst: in pause\n");
 		status = SST_PLATFORM_PAUSED;
-		ret_val = stream->ops->stream_pause(str_id);
+		ret_val = stream->ops->stream_pause(sst->dev, str_id);
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		pr_debug("sst: in pause release\n");
 		status = SST_PLATFORM_RUNNING;
-		ret_val = stream->ops->stream_pause_release(str_id);
+		ret_val = stream->ops->stream_pause_release(sst->dev, str_id);
 		break;
 	default:
 		return -EINVAL;
@@ -509,7 +508,7 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer
 	if (status == SST_PLATFORM_INIT)
 		return 0;
 	str_info = &stream->stream_info;
-	ret_val = stream->ops->stream_read_tstamp(str_info);
+	ret_val = stream->ops->stream_read_tstamp(sst->dev, str_info);
 	if (ret_val) {
 		pr_err("sst: error code = %d\n", ret_val);
 		return ret_val;
sound/soc/intel/sst-mfld-platform.h +9 -9
index 2d6e65bbbc49..d4c28b8fb471 100644
@@ -113,15 +113,15 @@ struct compress_sst_ops {
 };
 
 struct sst_ops {
-	int (*open) (struct snd_sst_params *str_param);
-	int (*stream_init) (struct pcm_stream_info *str_info);
-	int (*stream_start) (int str_id);
-	int (*stream_drop) (int str_id);
-	int (*stream_pause) (int str_id);
-	int (*stream_pause_release) (int str_id);
-	int (*stream_read_tstamp) (struct pcm_stream_info *str_info);
-	int (*send_byte_stream)(struct snd_sst_bytes_v2 *bytes);
-	int (*close) (unsigned int str_id);
+	int (*open) (struct device *dev, struct snd_sst_params *str_param);
+	int (*stream_init) (struct device *dev, struct pcm_stream_info *str_info);
+	int (*stream_start) (struct device *dev, int str_id);
+	int (*stream_drop) (struct device *dev, int str_id);
+	int (*stream_pause) (struct device *dev, int str_id);
+	int (*stream_pause_release) (struct device *dev, int str_id);
+	int (*stream_read_tstamp) (struct device *dev, struct pcm_stream_info *str_info);
+	int (*send_byte_stream)(struct device *dev, struct snd_sst_bytes_v2 *bytes);
+	int (*close) (struct device *dev, unsigned int str_id);
 };
 
 struct sst_runtime_stream {
Signature · 1 line
1.9.0