From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH v2 2/7] ALSA: hda - add generic functions to set hdac stream params Date: Fri, 17 Apr 2015 11:39:37 +0200 Message-ID: References: <1429262000-21517-1-git-send-email-vinod.koul@intel.com> <1429262000-21517-3-git-send-email-vinod.koul@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 9F23D260537 for ; Fri, 17 Apr 2015 11:39:39 +0200 (CEST) In-Reply-To: <1429262000-21517-3-git-send-email-vinod.koul@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Vinod Koul Cc: Jeeja KP , alsa-devel@alsa-project.org, broonie@kernel.org, "Subhransu S. Prusty" , lgirdwood@gmail.com List-Id: alsa-devel@alsa-project.org At Fri, 17 Apr 2015 14:43:15 +0530, Vinod Koul wrote: > > From: Jeeja KP > > This will be used by hda controller driver to > setup stream params in prepare. This function will > setup the bdl and periods. OK, it's fine to add this function if soc-hda driver needs it too. But please put the kerneldoc comment to the function, too. Then I can apply this patch even before other patches. thanks, Takashi > > Signed-off-by: Jeeja KP > Signed-off-by: Subhransu S. Prusty > Signed-off-by: Vinod Koul > --- > 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 >