From: Akihiko Odaki <akihiko.odaki@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Jaroslav Kysela <perex@perex.cz>,
Oder Chiou <oder_chiou@realtek.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Akihiko Odaki <akihiko.odaki@gmail.com>
Subject: [PATCH] ASoC: rt5682: Add jack kcontrol
Date: Thu, 7 Apr 2022 23:13:16 +0900 [thread overview]
Message-ID: <20220407141316.5099-1-akihiko.odaki@gmail.com> (raw)
Create a jack kcontrol manually as rt5682 does not use DAPM pins
for jack and will not have kcontrols for them.
Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
include/sound/jack.h | 2 +-
sound/core/jack.c | 3 +--
sound/soc/codecs/rt5682.c | 5 +++++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/sound/jack.h b/include/sound/jack.h
index 1181f536557e..bb5fcbd70d7c 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -60,10 +60,10 @@ struct snd_jack {
struct list_head kctl_list;
struct snd_card *card;
const char *id;
+ int type;
#ifdef CONFIG_SND_JACK_INPUT_DEV
struct input_dev *input_dev;
int registered;
- int type;
char name[100];
unsigned int key[6]; /* Keep in sync with definitions above */
#endif /* CONFIG_SND_JACK_INPUT_DEV */
diff --git a/sound/core/jack.c b/sound/core/jack.c
index d1e3055f2b6a..967a9769ea24 100644
--- a/sound/core/jack.c
+++ b/sound/core/jack.c
@@ -530,8 +530,6 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
jack->input_dev->phys = "ALSA";
- jack->type = type;
-
for (i = 0; i < SND_JACK_SWITCH_TYPES; i++)
if (type & (1 << i))
input_set_capability(jack->input_dev, EV_SW,
@@ -545,6 +543,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
goto fail_input;
jack->card = card;
+ jack->type = type;
INIT_LIST_HEAD(&jack->kctl_list);
if (initial_kctl)
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index be68d573a490..583dc80f08d0 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -1012,6 +1012,7 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *hs_jack, void *data)
{
struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
+ int ret;
rt5682->hs_jack = hs_jack;
@@ -1025,6 +1026,10 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component,
return 0;
}
+ ret = snd_jack_add_new_kctl(hs_jack->jack, hs_jack->jack->id, hs_jack->jack->type);
+ if (ret)
+ dev_warn(component->dev, "Failed to create jack kcontrol - %d\n", ret);
+
if (!rt5682->is_sdw) {
switch (rt5682->pdata.jd_src) {
case RT5682_JD1:
--
2.35.1
next reply other threads:[~2022-04-07 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 14:13 Akihiko Odaki [this message]
2022-04-07 15:09 ` Mark Brown
2022-04-07 15:46 ` Akihiko Odaki
2022-04-07 16:00 ` Mark Brown
2022-04-07 16:11 ` Akihiko Odaki
2022-04-07 16:37 ` Mark Brown
2022-04-07 17:16 ` Akihiko Odaki
2022-04-07 17:27 ` Mark Brown
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=20220407141316.5099-1-akihiko.odaki@gmail.com \
--to=akihiko.odaki@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oder_chiou@realtek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®