From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, lgirdwood@gmail.com,
Vinod Koul <vinod.koul@intel.com>,
broonie@kernel.org, Jeeja KP <jeeja.kp@intel.com>,
"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: [PATCH v2 2/7] ALSA: hda - add generic functions to set hdac stream params
Date: Fri, 17 Apr 2015 14:43:15 +0530 [thread overview]
Message-ID: <1429262000-21517-3-git-send-email-vinod.koul@intel.com> (raw)
In-Reply-To: <1429262000-21517-1-git-send-email-vinod.koul@intel.com>
From: Jeeja KP <jeeja.kp@intel.com>
This will be used by hda controller driver to
setup stream params in prepare. This function will
setup the bdl and periods.
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
include/sound/hdaudio.h | 2 ++
sound/hda/hdac_stream.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index b871f00bb185..227e71956c35 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -417,6 +417,8 @@ void snd_hdac_stream_release(struct hdac_stream *azx_dev);
int snd_hdac_stream_setup(struct hdac_stream *azx_dev);
void snd_hdac_stream_cleanup(struct hdac_stream *azx_dev);
int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev);
+int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
+ unsigned int format_val);
void snd_hdac_stream_start(struct hdac_stream *azx_dev, bool fresh_start);
void snd_hdac_stream_clear(struct hdac_stream *azx_dev);
void snd_hdac_stream_stop(struct hdac_stream *azx_dev);
diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c
index 8bd67a824b5e..618e742f527f 100644
--- a/sound/hda/hdac_stream.c
+++ b/sound/hda/hdac_stream.c
@@ -393,6 +393,37 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
}
EXPORT_SYMBOL_GPL(snd_hdac_stream_setup_periods);
+int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
+ unsigned int format_val)
+{
+
+ unsigned int bufsize, period_bytes;
+ struct snd_pcm_substream *substream = azx_dev->substream;
+ struct snd_pcm_runtime *runtime;
+ int err;
+
+ if (!substream)
+ return -EINVAL;
+ runtime = substream->runtime;
+ bufsize = snd_pcm_lib_buffer_bytes(substream);
+ period_bytes = snd_pcm_lib_period_bytes(substream);
+
+ if (bufsize != azx_dev->bufsize ||
+ period_bytes != azx_dev->period_bytes ||
+ format_val != azx_dev->format_val ||
+ runtime->no_period_wakeup != azx_dev->no_period_wakeup) {
+ azx_dev->bufsize = bufsize;
+ azx_dev->period_bytes = period_bytes;
+ azx_dev->format_val = format_val;
+ azx_dev->no_period_wakeup = runtime->no_period_wakeup;
+ err = snd_hdac_stream_setup_periods(azx_dev);
+ if (err < 0)
+ return err;
+ }
+ return 0;
+}
+EXPORT_SYMBOL_GPL(snd_hdac_stream_set_params);
+
static cycle_t azx_cc_read(const struct cyclecounter *cc)
{
struct hdac_stream *azx_dev = container_of(cc, struct hdac_stream, cc);
--
1.7.9.5
next prev parent reply other threads:[~2015-04-17 9:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 9:13 [PATCH v2 0/7] ASoC: hda - add ASoC Skylake HD audio driver Vinod Koul
2015-04-17 9:13 ` [PATCH v2 1/7] ALSA: hda - add ASoC device type for hda core Vinod Koul
2015-04-17 9:13 ` Vinod Koul [this message]
2015-04-17 9:39 ` [PATCH v2 2/7] ALSA: hda - add generic functions to set hdac stream params Takashi Iwai
2015-04-17 11:33 ` Vinod Koul
2015-04-17 9:13 ` [PATCH v2 3/7] ASoC: hda - add soc hda codec driver wrapper Vinod Koul
2015-04-17 9:42 ` Takashi Iwai
2015-04-17 11:34 ` Vinod Koul
2015-04-17 9:13 ` [PATCH v2 4/7] ASoC: hda - add Skylake platform driver Vinod Koul
2015-04-17 9:57 ` Takashi Iwai
2015-04-17 11:47 ` Takashi Iwai
2015-04-17 11:51 ` Vinod Koul
2015-04-17 9:13 ` [PATCH v2 5/7] ASoC: hda - add Skylake HD audio driver Vinod Koul
2015-04-17 10:06 ` Takashi Iwai
2015-04-17 12:02 ` Vinod Koul
2015-04-19 7:27 ` Takashi Iwai
2015-04-22 3:01 ` Vinod Koul
2015-04-17 9:13 ` [PATCH v2 6/7] ASoC: hda - enable ASoC " Vinod Koul
2015-04-17 9:13 ` [PATCH v2 7/7] ASoC: hda - added Skylake I2S machine driver Vinod Koul
2015-04-17 9:44 ` Lars-Peter Clausen
2015-04-17 19:06 ` Vinod Koul
2015-04-17 19:14 ` Lars-Peter Clausen
2015-04-22 3:00 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429262000-21517-3-git-send-email-vinod.koul@intel.com \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jeeja.kp@intel.com \
--cc=lgirdwood@gmail.com \
--cc=subhransu.s.prusty@intel.com \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox