From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: shumingf@realtek.com
Cc: broonie@kernel.org, lgirdwood@gmail.com,
linux-sound@vger.kernel.org, lars@metafoo.de, flove@realtek.com,
oder_chiou@realtek.com, jack.yu@realtek.com,
derek.fang@realtek.com, pierre-louis.bossart@linux.dev
Subject: Re: [PATCH v3] ASoC: rt766: add RT766/RT767 SDCA driver
Date: Fri, 31 Jul 2026 15:46:13 +0100 [thread overview]
Message-ID: <amy1NRAeDxB683hr@opensource.cirrus.com> (raw)
In-Reply-To: <20260731091037.4144022-1-shumingf@realtek.com>
On Fri, Jul 31, 2026 at 05:10:37PM +0800, shumingf@realtek.com wrote:
> +static int rt766_sdca_irq_ctl(struct rt766_sdca_priv *rt766,
> + struct sdca_function_data *function,
> + struct snd_soc_component *component,
> + struct sdca_interrupt_info *info,
> + bool enabled)
> +{
> + struct device *dev = &rt766->slave->dev;
> + struct sdca_interrupt *interrupt;
> + struct sdca_control *control;
> + struct sdca_entity *entity;
> + irq_handler_t handler;
> + int i, j, irq, ret;
> +
> + for (i = 0; i < function->num_entities; i++) {
> + entity = &function->entities[i];
> +
> + for (j = 0; j < entity->num_controls; j++) {
> + control = &entity->controls[j];
> + irq = control->interrupt_position;
> +
> + switch (SDCA_CTL_TYPE(entity->type, control->sel)) {
> + case SDCA_CTL_TYPE_S(GE, DETECTED_MODE):
> + handler = rt766_sdca_irq_jd_handler;
> + break;
> + case SDCA_CTL_TYPE_S(HIDE, HIDTX_CURRENTOWNER):
> + handler = rt766_sdca_irq_btn_handler;
> + break;
> + default:
> + continue;
> + }
> +
> + interrupt = &info->irqs[irq];
> +
> + if (enabled) {
> + ret = sdca_irq_data_populate(dev, rt766->regmap, component,
> + function, entity, control,
> + interrupt);
> + if (ret)
> + return ret;
> +
> + interrupt->priv = rt766;
> + ret = sdca_irq_request(dev, info, irq, interrupt->name,
> + handler, interrupt);
> + if (ret) {
> + dev_err(dev, "failed to request irq %s: %d\n",
> + interrupt->name, ret);
> + return ret;
> + }
> + dev_dbg(dev, "Requesting IRQ %d InterruptName=%s\n", irq, interrupt->name);
> + } else {
> + sdca_irq_free(dev, info, irq, interrupt->name, interrupt);
You need to also free the IRQ name allocated by
sdca_irq_data_populate() here or it will leak if the jack is
re-enabled.
> +static void rt766_sdca_remove(struct snd_soc_component *component)
> +{
> + struct rt766_sdca_priv *rt766 = snd_soc_component_get_drvdata(component);
> +
> + sdca_irq_cleanup(component->dev, rt766->uaj_func_data, rt766->irq_info);
> + sdca_irq_cleanup(component->dev, rt766->hid_func_data, rt766->irq_info);
> +}
These should be sdca_irq_cleanup_late(), to ensure they free
the names as well. Although, worth noting this only does anything
if rt766_sdca_set_jack_detect() didn't already clean everything
up, not sure if that is guaranteed or not.
Thanks,
Charles
prev parent reply other threads:[~2026-07-31 14:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 9:10 [PATCH v3] ASoC: rt766: add RT766/RT767 SDCA driver shumingf
2026-07-31 14:46 ` Charles Keepax [this message]
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=amy1NRAeDxB683hr@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=derek.fang@realtek.com \
--cc=flove@realtek.com \
--cc=jack.yu@realtek.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=shumingf@realtek.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.