Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Jarzmik <robert.jarzmik@free.fr>
To: broonie@sirena.org.uk, lrg@kernel.org
Cc: alsa-devel@alsa-project.org
Subject: SoC scenarii API
Date: Tue, 13 Jan 2009 12:36:13 +0100	[thread overview]
Message-ID: <87iqojqvyq.fsf@free.fr> (raw)

Hi Liam and Mark,

As mioa701 submission was stopped due to the need of a generic scenarii API,
this a first attempt to design such an API in order to unblock mioa701
submission.

This is oversimplified, no convenience macros are provided, just external
data structures and namespace polution.

I'm expecting a lot of comments from both of you.

Cheers.

--
Robert

enum pin_change {
	SCEN_PIN_OFF = 0,	/* Disable the pin */
	SCEN_PIN_ON,		/* Enable the pin */
	SCEN_PIN_LEAVE		/* Leave the pin in previous state */
};

struct setup_mixmux {
	char *mixname;		/* Codec Mixer or Muxer name */
	int  val;		/* Codec Mixer or Muxer value to enforce */
};

/**
 * struct soc_scenario - describes one sound usecase
 * @name: Scenario name, value as will be seen in alsa "SoC Mode" alsa control
 * @pin_setup: Pin configuration to perform on scenario activation
 *	Table of all pins, as they should be configured. Each elements is a
 *	pin_change value, describing how to handle a specific pin.
 *      Table size must be the same as in snd_soc_scenario_init().
 * @mixer_cleanup: Mixers/muxes to set up in phase (b)
 *	Table of all mixers/muxes to modify, NULL terminated.
 * @mixer_setup: Mixers/muxers to set up in phase (c)
 *	Table of all mixers/muxes to modify, NULL terminated
 * @lvol_master: Left volume aliased to "SoC Volume"
 * @rvol_master: Right volume aliased to "SoC Volume"
 * @lvol_mute: Left volume mute aliased to "SoC Volume" mute control
 * @rvol_mute: Right volume mute aliased to "SoC Volume" mute control
 *
 * This structure describes what a scenario change implies. The behaviour is to :
 *  a) enable several pins, disable others, leave others in their state
 *     (understand here snd_soc_dapm_enable_pin)
 *  b) set up some mixers and muxers to prepare the change, and clean up.
 *     This should be normally used to restore a "default state" if need be, before
 *     activating the mixers/muxers into their final state.
 *     Note: table in NULL, or always terminated by NULL pointer
 *     Note: this cleanup may/should be shared amongst all scenarii
 *  c) set up some mixers and muxers to the final state
 *     This should be normally used to restore a "default state" if need be, before
 *     activating the mixers/muxers into their final state.
 *     Note: table in NULL, or always terminated by NULL pointer
 */
struct soc_scenario {
	const char *name;				/* scenario name */
	const unsigned char pin_setup[];		/* pin_change for pins */
	const struct setup_mixmux mixes_cleanup[];	/* mix cleanup */
	const struct setup_mixmux mixes_setup[];	/* mix setup */
	const char *lvol_master;			/* left volume master */
	const char *rvol_master;			/* right volume master */
	const char *lvol_mute;				/* left volume mute */
	const char *rvol_mute;				/* right volume mute */
};

/**
 * snd_soc_scenario_init - initialize soc scenarii
 * @codec: codec associated to the pins/mixers/muxes/volumes/mutes
 * @scenario: table of scenarii
 * @nb_scenarii: number of scenarii
 * @pin_names: table of pin names
 * @nb_pins: number of pins handled by scenario
 *
 * Initialise the soc scenarii engine. The first scenario (0) will be used.
 * By default, the user could leave this scenario as non intrusive (not a single
 * pin changed, no mixers/muxes changes, and volume master inactive).
 */
int snd_soc_scenario_init(struct snd_soc_codec *codec,
			  struct soc_scenario *scenario, int nb_scenarii,
			  char *pin_names[], int nb_pins);

/**
 * snd_soc_scenario_init - initialize soc scenarii
 * @codec: codec used for the init
 */
void snd_soc_scenario_release(struct snd_soc_codec *code);

             reply	other threads:[~2009-01-13 11:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-13 11:36 Robert Jarzmik [this message]
2009-01-13 15:56 ` SoC scenarii API Mark Brown
2009-01-13 22:31   ` Robert Jarzmik
2009-01-13 23:14     ` Mark Brown
2009-02-20 19:04     ` Robert Jarzmik
2009-03-08 19:17       ` 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=87iqojqvyq.fsf@free.fr \
    --to=robert.jarzmik@free.fr \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@sirena.org.uk \
    --cc=lrg@kernel.org \
    /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