All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org,
	Jaska Uimonen <jaska.uimonen@linux.intel.com>
Subject: Re: [RFC PATCH 1/3] ALSA: control: add kcontrol_type to control
Date: Fri, 8 Jan 2021 23:06:59 +0900	[thread overview]
Message-ID: <20210108140659.GA44940@workstation> (raw)
In-Reply-To: <1272f71c-c736-d267-563e-c2bf43b740da@perex.cz>

Hi,

On Fri, Jan 08, 2021 at 12:40:28PM +0100, Jaroslav Kysela wrote:
> Dne 08. 01. 21 v 12:23 Jaska Uimonen napsal(a):
> > Current kcontrol structs don't have a member to describe the control
> > type. The type is present in the widget which contains the control. As
> > there can be many controls in one widget it is inherently presumed that
> > the control types are the same.
> > 
> > Lately there has been use cases where different types of controls would
> > be needed for single widget. Thus enable this by adding the control type
> > to kcontrol and kcontrol_new structs.
> 
> It looks like a SoC only extension. Use private_data to carry this
> information. It has no value for the toplevel code.
> 
> 				Jaroslav

In current design of ALSA control core, the type of control element is
firstly determined by driver in callback of snd_kcontrol.info(). The
callback is done when userspace applications call ioctl(2) with
SNDRV_CTL_IOCTL_ELEM_INFO request.

The patch doesn't touch to the above processing. It means that the type
information is just for kernel-land implementation and is not exposed to
userspace application.

Essentially, driver is dominant to determine the type of control element
in control element set which the driver adds. It's possible to achieve
your intension without changing ALSA control core itself, in my opinion.

As Jaroslav said, it's better to change core of ALSA SoC part according
to your intention. If you'd like to change ALSA control core, I'd like
to request for the check of mismatch between the value of added member
in snd_kcontrol and the value of type of control element returned from
driver, like:

```
diff --git a/sound/core/control.c b/sound/core/control.c
index 809b0a62e..c3ae70574 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -973,6 +973,7 @@ static int __snd_ctl_elem_info(struct snd_card *card,
        result = kctl->info(kctl, info);
        if (result >= 0) {
                snd_BUG_ON(info->access);
+               snd_BUG_ON(info->type == kctl->kcontrol_type);
                index_offset = snd_ctl_get_ioff(kctl, &info->id);
                vd = &kctl->vd[index_offset];
                snd_ctl_build_ioff(&info->id, kctl, index_offset);
```


Regards

Takashi Sakamoto

  reply	other threads:[~2021-01-08 14:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 11:23 [RFC PATCH 0/3] Enable using multiple kcontrol types in a widget Jaska Uimonen
2021-01-08 11:23 ` [RFC PATCH 1/3] ALSA: control: add kcontrol_type to control Jaska Uimonen
2021-01-08 11:40   ` Jaroslav Kysela
2021-01-08 14:06     ` Takashi Sakamoto [this message]
2021-01-13 14:53       ` Jaska Uimonen
2021-01-08 11:23 ` [RFC PATCH 2/3] ASoC: soc-topology: enable use of multiple control types Jaska Uimonen
2021-01-08 11:23 ` [RFC PATCH 3/3] ASoC: SOF: topology: use individual kcontrol types Jaska Uimonen

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=20210108140659.GA44940@workstation \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=jaska.uimonen@linux.intel.com \
    --cc=perex@perex.cz \
    /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.