mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
ASoC: move card->pop_time to soc-dapm
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> says: This is v3 to move card->pop_time to soc-dapm. card->pop_time is used only on TI, and Janusz posted patch which will stop using it. It was posted at 12 Apr 2026, and [1/2] is it as-is. [2/2] will move card->pop_time to soc-dapm. We can use it via debugfs. I have added [RFC] on Subject. Link: https://patch.msgid.link/87wlx9wj1h.wl-kuninori.morimoto.gx@renesas.com
This commit is contained in:
commit
1e50c7006d
|
|
@ -673,6 +673,7 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
|
|||
/* dapm sys fs - used by the core */
|
||||
extern struct attribute *snd_soc_dapm_dev_attrs[];
|
||||
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, struct dentry *parent);
|
||||
void snd_soc_dapm_debugfs_pop_time(struct dentry *parent);
|
||||
|
||||
/* dapm audio pin control and status */
|
||||
int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin);
|
||||
|
|
|
|||
|
|
@ -1081,8 +1081,6 @@ struct snd_soc_card {
|
|||
#ifdef CONFIG_PM_SLEEP
|
||||
struct work_struct deferred_resume_work;
|
||||
#endif
|
||||
u32 pop_time;
|
||||
|
||||
/* bit field */
|
||||
unsigned int instantiated:1;
|
||||
unsigned int topology_shortname_created:1;
|
||||
|
|
|
|||
|
|
@ -236,7 +236,8 @@ static int v253_open(struct tty_struct *tty)
|
|||
/* Line discipline .close() */
|
||||
static void v253_close(struct tty_struct *tty)
|
||||
{
|
||||
struct snd_soc_component *component = tty->disc_data;
|
||||
struct cx20442_codec *codec = tty->disc_data;
|
||||
struct snd_soc_component *component = codec->component;
|
||||
struct cx20442_priv *cx20442;
|
||||
|
||||
tty->disc_data = NULL;
|
||||
|
|
@ -248,7 +249,7 @@ static void v253_close(struct tty_struct *tty)
|
|||
|
||||
/* Prevent the codec driver from further accessing the modem */
|
||||
cx20442->tty = NULL;
|
||||
component->card->pop_time = 0;
|
||||
codec->ready = false;
|
||||
}
|
||||
|
||||
/* Line discipline .hangup() */
|
||||
|
|
@ -261,7 +262,8 @@ static void v253_hangup(struct tty_struct *tty)
|
|||
static void v253_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp,
|
||||
size_t count)
|
||||
{
|
||||
struct snd_soc_component *component = tty->disc_data;
|
||||
struct cx20442_codec *codec = tty->disc_data;
|
||||
struct snd_soc_component *component = codec->component;
|
||||
struct cx20442_priv *cx20442;
|
||||
|
||||
if (!component)
|
||||
|
|
@ -274,7 +276,7 @@ static void v253_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp,
|
|||
|
||||
/* Set up codec driver access to modem controls */
|
||||
cx20442->tty = tty;
|
||||
component->card->pop_time = 1;
|
||||
codec->ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -375,7 +377,6 @@ static int cx20442_component_probe(struct snd_soc_component *component)
|
|||
cx20442->tty = NULL;
|
||||
|
||||
snd_soc_component_set_drvdata(component, cx20442);
|
||||
component->card->pop_time = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@
|
|||
#ifndef _CX20442_CODEC_H
|
||||
#define _CX20442_CODEC_H
|
||||
|
||||
struct cx20442_codec {
|
||||
struct snd_soc_component *component;
|
||||
bool ready;
|
||||
};
|
||||
|
||||
extern struct tty_ldisc_ops v253_ops;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -194,9 +194,6 @@ static void soc_init_card_debugfs(struct snd_soc_card *card)
|
|||
card->debugfs_card_root = debugfs_create_dir(card->name,
|
||||
snd_soc_debugfs_root);
|
||||
|
||||
debugfs_create_u32("dapm_pop_time", 0644, card->debugfs_card_root,
|
||||
&card->pop_time);
|
||||
|
||||
snd_soc_dapm_debugfs_init(snd_soc_card_to_dapm(card), card->debugfs_card_root);
|
||||
}
|
||||
|
||||
|
|
@ -215,6 +212,8 @@ static void snd_soc_debugfs_init(void)
|
|||
|
||||
debugfs_create_file("components", 0444, snd_soc_debugfs_root, NULL,
|
||||
&component_list_fops);
|
||||
|
||||
snd_soc_dapm_debugfs_pop_time(snd_soc_debugfs_root);
|
||||
}
|
||||
|
||||
static void snd_soc_debugfs_exit(void)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
|
||||
#include <trace/events/asoc.h>
|
||||
|
||||
static u32 pop_time;
|
||||
|
||||
/* DAPM context */
|
||||
struct snd_soc_dapm_context {
|
||||
enum snd_soc_bias_level bias_level;
|
||||
|
|
@ -161,14 +163,14 @@ static void dapm_assert_locked(struct snd_soc_dapm_context *dapm)
|
|||
snd_soc_dapm_mutex_assert_held(dapm);
|
||||
}
|
||||
|
||||
static void dapm_pop_wait(u32 pop_time)
|
||||
static void dapm_pop_wait(void)
|
||||
{
|
||||
if (pop_time)
|
||||
schedule_timeout_uninterruptible(msecs_to_jiffies(pop_time));
|
||||
}
|
||||
|
||||
__printf(3, 4)
|
||||
static void dapm_pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...)
|
||||
__printf(2, 3)
|
||||
static void dapm_pop_dbg(struct device *dev, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
char *buf;
|
||||
|
|
@ -1872,8 +1874,7 @@ static void dapm_seq_check_event(struct snd_soc_card *card,
|
|||
if (w->event && (w->event_flags & event)) {
|
||||
int ret;
|
||||
|
||||
dapm_pop_dbg(dev, card->pop_time, "pop test : %s %s\n",
|
||||
w->name, ev_name);
|
||||
dapm_pop_dbg(dev, "pop test : %s %s\n", w->name, ev_name);
|
||||
dapm_async_complete(w->dapm);
|
||||
trace_snd_soc_dapm_widget_event_start(w, event);
|
||||
ret = w->event(w, NULL, event);
|
||||
|
|
@ -1909,7 +1910,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
|
|||
else
|
||||
value |= w->off_val << w->shift;
|
||||
|
||||
dapm_pop_dbg(dev, card->pop_time,
|
||||
dapm_pop_dbg(dev,
|
||||
"pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n",
|
||||
w->name, reg, value, mask);
|
||||
|
||||
|
|
@ -1923,10 +1924,10 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
|
|||
* same register.
|
||||
*/
|
||||
|
||||
dapm_pop_dbg(dev, card->pop_time,
|
||||
dapm_pop_dbg(dev,
|
||||
"pop test : Applying 0x%x/0x%x to %x in %dms\n",
|
||||
value, mask, reg, card->pop_time);
|
||||
dapm_pop_wait(card->pop_time);
|
||||
value, mask, reg, pop_time);
|
||||
dapm_pop_wait();
|
||||
dapm_update_bits(dapm, reg, mask, value);
|
||||
}
|
||||
|
||||
|
|
@ -2392,9 +2393,9 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event,
|
|||
return ret;
|
||||
}
|
||||
|
||||
dapm_pop_dbg(card->dev, card->pop_time,
|
||||
"DAPM sequencing finished, waiting %dms\n", card->pop_time);
|
||||
dapm_pop_wait(card->pop_time);
|
||||
dapm_pop_dbg(card->dev,
|
||||
"DAPM sequencing finished, waiting %dms\n", pop_time);
|
||||
dapm_pop_wait();
|
||||
|
||||
trace_snd_soc_dapm_done(card, event);
|
||||
|
||||
|
|
@ -2561,6 +2562,11 @@ static const struct file_operations dapm_bias_fops = {
|
|||
.llseek = default_llseek,
|
||||
};
|
||||
|
||||
void snd_soc_dapm_debugfs_pop_time(struct dentry *parent)
|
||||
{
|
||||
debugfs_create_u32("dapm_pop_time", 0644, parent, &pop_time);
|
||||
}
|
||||
|
||||
void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
|
||||
struct dentry *parent)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ static unsigned short ams_delta_audio_agc;
|
|||
* Used for passing a codec structure pointer
|
||||
* from the board initialization code to the tty line discipline.
|
||||
*/
|
||||
static struct snd_soc_component *cx20442_codec;
|
||||
static struct cx20442_codec cx20442_codec;
|
||||
|
||||
static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
|
|
@ -105,7 +105,7 @@ static int ams_delta_set_audio_mode(struct snd_kcontrol *kcontrol,
|
|||
int pin, changed = 0;
|
||||
|
||||
/* Refuse any mode changes if we are not able to control the codec. */
|
||||
if (!cx20442_codec->card->pop_time)
|
||||
if (!cx20442_codec.ready)
|
||||
return -EUNATCH;
|
||||
|
||||
if (ucontrol->value.enumerated.item[0] >= control->items)
|
||||
|
|
@ -280,14 +280,14 @@ static int cx81801_open(struct tty_struct *tty)
|
|||
{
|
||||
int ret;
|
||||
|
||||
if (!cx20442_codec)
|
||||
if (!cx20442_codec.component)
|
||||
return -ENODEV;
|
||||
|
||||
/*
|
||||
* Pass the codec structure pointer for use by other ldisc callbacks,
|
||||
* both the card and the codec specific parts.
|
||||
*/
|
||||
tty->disc_data = cx20442_codec;
|
||||
tty->disc_data = &cx20442_codec;
|
||||
|
||||
ret = v253_ops.open(tty);
|
||||
|
||||
|
|
@ -300,9 +300,12 @@ static int cx81801_open(struct tty_struct *tty)
|
|||
/* Line discipline .close() */
|
||||
static void cx81801_close(struct tty_struct *tty)
|
||||
{
|
||||
struct snd_soc_component *component = tty->disc_data;
|
||||
struct snd_soc_component *component = cx20442_codec.component;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
|
||||
if (WARN_ON(tty->disc_data != &cx20442_codec))
|
||||
return;
|
||||
|
||||
timer_delete_sync(&cx81801_timer);
|
||||
|
||||
/* Prevent the hook switch from further changing the DAPM pins */
|
||||
|
|
@ -339,14 +342,14 @@ static void cx81801_hangup(struct tty_struct *tty)
|
|||
static void cx81801_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp,
|
||||
size_t count)
|
||||
{
|
||||
struct snd_soc_component *component = tty->disc_data;
|
||||
struct snd_soc_component *component = cx20442_codec.component;
|
||||
const unsigned char *c;
|
||||
int apply, ret;
|
||||
|
||||
if (!component)
|
||||
if (WARN_ON(tty->disc_data != &cx20442_codec))
|
||||
return;
|
||||
|
||||
if (!component->card->pop_time) {
|
||||
if (!cx20442_codec.ready) {
|
||||
/* First modem response, complete setup procedure */
|
||||
|
||||
/* Initialize timer used for config pulse generation */
|
||||
|
|
@ -467,7 +470,7 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
|
|||
/* Codec is ready, now add/activate board specific controls */
|
||||
|
||||
/* Store a pointer to the codec structure for tty ldisc use */
|
||||
cx20442_codec = snd_soc_rtd_to_codec(rtd, 0)->component;
|
||||
cx20442_codec.component = snd_soc_rtd_to_codec(rtd, 0)->component;
|
||||
|
||||
/* Add hook switch - can be used to control the codec from userspace
|
||||
* even if line discipline fails */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user