All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
Cc: alsa-devel@alsa-project.org,
	Vitaly Rodionov <vitalyr@opensource.cirrus.com>,
	patches@opensource.cirrus.com, Takashi Iwai <tiwai@suse.com>,
	Stefan Binding <sbinding@opensource.cirrus.com>,
	Mark Brown <broonie@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 01/14] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls
Date: Wed, 22 Jun 2022 15:10:04 +0200	[thread overview]
Message-ID: <87y1xon8sz.wl-tiwai@suse.de> (raw)
In-Reply-To: <d05c292e-f955-48df-50e3-55e36a956775@linux.intel.com>

On Wed, 22 Jun 2022 10:40:20 +0200,
Amadeusz Sławiński wrote:
> 
> > +static int hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl)
> > +{
> > +	struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
> > +	struct snd_kcontrol_new *kcontrol;
> > +	struct snd_kcontrol *kctl;
> > +	int ret = 0;
> > +
> > +	if (cs_ctl->len > ADSP_MAX_STD_CTRL_SIZE) {
> > +		dev_err(cs_ctl->dsp->dev, "Control %s: length %zu exceeds maximum %d\n", ctl->name,
> > +			cs_ctl->len, ADSP_MAX_STD_CTRL_SIZE);
> > +		return -EINVAL;
> > +	}
> > +
> > +	kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL);
> > +	if (!kcontrol)
> > +		return -ENOMEM;
> > +
> > +	kcontrol->name = ctl->name;
> > +	kcontrol->info = hda_cs_dsp_coeff_info;
> > +	kcontrol->iface = SNDRV_CTL_ELEM_IFACE_MIXER;
> > +	kcontrol->private_value = (unsigned long)ctl;
> > +	kcontrol->access = wmfw_convert_flags(cs_ctl->flags);
> > +
> > +	kcontrol->get = hda_cs_dsp_coeff_get;
> > +	kcontrol->put = hda_cs_dsp_coeff_put;
> > +
> > +	kctl = snd_ctl_new1(kcontrol, NULL);
> 
> Wouldn't
> kctl = snd_ctl_new1(kcontrol, ctl);
> work instead of
> kcontrol->private_value = (unsigned long)ctl;
> ...
> kctl = snd_ctl_new1(kcontrol, NULL);
> ?

The second argument to snd_ctl_new1() is set to private_data field,
while private_value is taken from snd_kcontrol_new template.


Takashi

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
Cc: Vitaly Rodionov <vitalyr@opensource.cirrus.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Mark Brown <broonie@kernel.org>,
	patches@opensource.cirrus.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org,
	Stefan Binding <sbinding@opensource.cirrus.com>
Subject: Re: [PATCH v7 01/14] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls
Date: Wed, 22 Jun 2022 15:10:04 +0200	[thread overview]
Message-ID: <87y1xon8sz.wl-tiwai@suse.de> (raw)
In-Reply-To: <d05c292e-f955-48df-50e3-55e36a956775@linux.intel.com>

On Wed, 22 Jun 2022 10:40:20 +0200,
Amadeusz Sławiński wrote:
> 
> > +static int hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl)
> > +{
> > +	struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
> > +	struct snd_kcontrol_new *kcontrol;
> > +	struct snd_kcontrol *kctl;
> > +	int ret = 0;
> > +
> > +	if (cs_ctl->len > ADSP_MAX_STD_CTRL_SIZE) {
> > +		dev_err(cs_ctl->dsp->dev, "Control %s: length %zu exceeds maximum %d\n", ctl->name,
> > +			cs_ctl->len, ADSP_MAX_STD_CTRL_SIZE);
> > +		return -EINVAL;
> > +	}
> > +
> > +	kcontrol = kzalloc(sizeof(*kcontrol), GFP_KERNEL);
> > +	if (!kcontrol)
> > +		return -ENOMEM;
> > +
> > +	kcontrol->name = ctl->name;
> > +	kcontrol->info = hda_cs_dsp_coeff_info;
> > +	kcontrol->iface = SNDRV_CTL_ELEM_IFACE_MIXER;
> > +	kcontrol->private_value = (unsigned long)ctl;
> > +	kcontrol->access = wmfw_convert_flags(cs_ctl->flags);
> > +
> > +	kcontrol->get = hda_cs_dsp_coeff_get;
> > +	kcontrol->put = hda_cs_dsp_coeff_put;
> > +
> > +	kctl = snd_ctl_new1(kcontrol, NULL);
> 
> Wouldn't
> kctl = snd_ctl_new1(kcontrol, ctl);
> work instead of
> kcontrol->private_value = (unsigned long)ctl;
> ...
> kctl = snd_ctl_new1(kcontrol, NULL);
> ?

The second argument to snd_ctl_new1() is set to private_data field,
while private_value is taken from snd_kcontrol_new template.


Takashi

  reply	other threads:[~2022-06-22 13:11 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  7:46 [PATCH v7 00/14] ALSA: hda: cirrus: Add initial DSP support and firmware loading Vitaly Rodionov
2022-06-22  7:46 ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 01/14] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  8:40   ` Amadeusz Sławiński
2022-06-22 13:10     ` Takashi Iwai [this message]
2022-06-22 13:10       ` Takashi Iwai
2022-06-22 13:34   ` Takashi Iwai
2022-06-22 13:34     ` Takashi Iwai
2022-06-22  7:46 ` [PATCH v7 02/14] ALSA: hda: hda_cs_dsp_ctl: Add apis to write the controls directly Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 03/14] ALSA: hda: cs35l41: Save codec object inside component struct Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 04/14] ALSA: hda: cs35l41: Add initial DSP support and firmware loading Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 05/14] ALSA: hda: cs35l41: Save Subsystem ID inside CS35L41 Driver Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  8:40   ` Amadeusz Sławiński
2022-06-22  7:46 ` [PATCH v7 06/14] ALSA: hda: cs35l41: Support reading subsystem id from ACPI Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 07/14] ALSA: hda: cs35l41: Support multiple load paths for firmware Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  8:40   ` Amadeusz Sławiński
2022-06-22  7:46 ` [PATCH v7 08/14] ALSA: hda: cs35l41: Support Speaker ID for laptops Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 09/14] ALSA: hda: cs35l41: Support Hibernation during Suspend Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-07-25 15:34   ` kernel test robot
2022-06-22  7:46 ` [PATCH v7 10/14] ALSA: hda: cs35l41: Read Speaker Calibration data from UEFI variables Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 11/14] ALSA: hda: hda_cs_dsp_ctl: Add fw id strings Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 12/14] ALSA: hda: cs35l41: Add defaulted values into dsp bypass config sequence Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 13/14] ALSA: hda: cs35l41: Support Firmware switching and reloading Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov
2022-06-22  7:46 ` [PATCH v7 14/14] ALSA: hda: cs35l41: Add module parameter to control firmware load Vitaly Rodionov
2022-06-22  7:46   ` Vitaly Rodionov

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=87y1xon8sz.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=sbinding@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    --cc=vitalyr@opensource.cirrus.com \
    /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.