From: Vinod Koul <vinod.koul@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: liam.r.girdwood@linux.intel.com, tiwai@suse.de,
alsa-devel@alsa-project.org, Jeeja KP <jeeja.kp@intel.com>,
patches.audio@intel.com
Subject: Re: [RFC 5/7] ASOC: hda: add DSP platfrom controls widget event handlers
Date: Sun, 26 Apr 2015 19:44:52 +0530 [thread overview]
Message-ID: <20150426141452.GR2738@intel.com> (raw)
In-Reply-To: <20150424175115.GC22845@sirena.org.uk>
[-- Attachment #1.1: Type: text/plain, Size: 3589 bytes --]
On Fri, Apr 24, 2015 at 06:51:15PM +0100, Mark Brown wrote:
> On Sun, Apr 19, 2015 at 02:27:31AM +0530, Vinod Koul wrote:
>
> > +static int is_hda_widget_type(struct snd_soc_dapm_widget *w)
> > +{
> > + return ((w->id == snd_soc_dapm_dai_link) ||
> > + (w->id == snd_soc_dapm_dai_in) ||
> > + (w->id == snd_soc_dapm_aif_in) ||
> > + (w->id == snd_soc_dapm_aif_out) ||
> > + (w->id == snd_soc_dapm_dai_out)) ? 1 : 0;
>
> Please use switch statements, and again no need to convert logic values
> into logic values.
OK
>
> > +static int hda_sst_dapm_pre_pmu_event(struct snd_soc_dapm_widget *w,
> > + int w_type, struct ssth_lib *ctx, struct hda_platform_info *pinfo)
> > +{
> > + int ret = 0;
> > + struct ssth_module_config *mconfig = w->priv;
> > + struct ssth_pipe *s_pipe = mconfig->pipe;
> > +
> > + dev_dbg(ctx->dev, "%s: widget =%s type=%d\n", __func__, w->name, w_type);
> > +
> > + /*check resource available */
> > + if (!hda_sst_is_pipe_mcps_available(pinfo, ctx, mconfig))
> > + return -1;
>
> Proper error code please.
Sure
>
> > + if (w_type == SSTH_WIDGET_VMIXER ||
> > + w_type == SSTH_WIDGET_MIXER) {
>
> switch.
Since this is checking for these two types only, I think if maybe fine, but
dont mind swicth too.
> > +
> > + if (!hda_sst_is_pipe_mem_available(pinfo, ctx, mconfig))
> > + return -ENOMEM;
> > +
> > + ret = ssth_create_pipeline(ctx, mconfig->pipe);
> > + if (ret < 0)
> > + return ret;
> > + if (list_empty(&s_pipe->w_list)) {
> > + ret = hda_sst_get_pipe_widget(ctx->dev, w, s_pipe);
> > + if (ret < 0)
> > + return ret;
> > + }
> > + ret = hda_init_pipe_modules(ctx, s_pipe, pinfo);
> > + if (ret < 0)
> > + return ret;
>
> The error handling here appears to be a bit incomplete, we don't unwind
> anything we did.
Yes let me check that.
> > + switch (event) {
> > + case SND_SOC_DAPM_PRE_PMU:
> > + return hda_sst_dapm_pre_pmu_event(w, w_type, ctx, pinfo);
> > + break;
>
> Please follow the kernel coding style.
oops, will fix
> > +static int hda_sst_vmixer_event(struct snd_soc_dapm_widget *w,
> > + struct snd_kcontrol *k, int event)
> > +{
> > + struct snd_soc_dapm_context *dapm = w->dapm;
> > +
> > + dev_dbg(dapm->dev, "%s: widget = %s\n", __func__, w->name);
> > + return hda_sst_event_handler(w, event, SSTH_WIDGET_VMIXER);
> > +}
> > +
> > +static int hda_sst_mixer_event(struct snd_soc_dapm_widget *w,
> > + struct snd_kcontrol *k, int event)
> > +{
> > + struct snd_soc_dapm_context *dapm = w->dapm;
> > +
> > + dev_dbg(dapm->dev, "%s: widget = %s\n", __func__, w->name);
> > +
> > + return hda_sst_event_handler(w, event, SSTH_WIDGET_MIXER);
> > +}
>
> Lots of indirection and wrapping going on here which seems to make
> things more confusing. Can you try writing out the event handling
> directly and having it call common functions to perform the shared
> operations rather than having a single event handler with per type
> cases? Or alternatively use the DAPM widget type rather than your
> own ones.
Okay let me cleanup this code is next series
>
> > + /* if FE - Playback, then parse sink list , Capture then source list
> > + if BE - Playback, then parse source list , Capture then sink list
> > + */
>
> Coding style on comments too BTW.
will fix
>
> > + if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
> > + w = dai->playback_widget;
> > + (is_fe) ? (dir = 1) : (dir = 0);
>
> This looks like a very complicated way of writing dir = is_fe.
Yes for sure :)
--
~Vinod
--
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2015-04-26 14:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-18 20:57 [RFC 0/7] ASoC: hda - ASoC DSP widget event handlers Vinod Koul
2015-04-18 20:57 ` [RFC 1/7] ASoC: hda: Add skl dsp init and registering with SST IPC lib Vinod Koul
2015-04-24 17:36 ` Mark Brown
2015-04-26 13:53 ` Vinod Koul
2015-04-18 20:57 ` [RFC 2/7] ASoC: hda: add helper to configure module params Vinod Koul
2015-04-24 17:38 ` Mark Brown
2015-04-26 14:06 ` Vinod Koul
2015-04-18 20:57 ` [RFC 3/7] ASoC: hda: add FW module init/bind IPC Vinod Koul
2015-04-18 20:57 ` [RFC 4/7] ASoC: hda: add FW pipe create/delete/set_pipe_state IPC Vinod Koul
2015-04-18 20:57 ` [RFC 5/7] ASOC: hda: add DSP platfrom controls widget event handlers Vinod Koul
2015-04-24 17:51 ` Mark Brown
2015-04-26 14:14 ` Vinod Koul [this message]
2015-04-18 20:57 ` [RFC 6/7] ASoC: hda: Add support for SSP register settings Vinod Koul
2015-04-24 17:55 ` Mark Brown
2015-04-26 14:18 ` Vinod Koul
2015-04-27 14:15 ` Mark Brown
2015-04-29 23:45 ` Pierre-Louis Bossart
2015-04-29 23:50 ` Pierre-Louis Bossart
2015-04-30 4:39 ` Vinod Koul
2015-04-30 14:36 ` Mark Brown
2015-04-30 15:55 ` Pierre-Louis Bossart
2015-04-18 20:57 ` [RFC 7/7] ASoC: hda: Apply dai params_fixup for DSP widgets 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=20150426141452.GR2738@intel.com \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jeeja.kp@intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=patches.audio@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.