sound/soc/samsung/speyside.c

Source file repositories/reference/linux-study-clean/sound/soc/samsung/speyside.c

File Facts

System
Linux kernel
Corpus path
sound/soc/samsung/speyside.c
Extension
.c
Size
9853 bytes
Lines
389
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret < 0) {
			pr_err("Failed to stop FLL\n");
			return ret;
		}
		break;

	default:
		break;
	}

	return 0;
}

static int speyside_set_bias_level_post(struct snd_soc_card *card,
					struct snd_soc_dapm_context *dapm,
					enum snd_soc_bias_level level)
{
	struct snd_soc_pcm_runtime *rtd;
	struct snd_soc_dai *codec_dai;
	int ret;

	rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
	codec_dai = snd_soc_rtd_to_codec(rtd, 0);

	if (snd_soc_dapm_to_dev(dapm) != codec_dai->dev)
		return 0;

	switch (level) {
	case SND_SOC_BIAS_PREPARE:
		if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) {
			ret = snd_soc_dai_set_pll(codec_dai, 0,
						  WM8996_FLL_MCLK2,
						  32768, MCLK_AUDIO_RATE);
			if (ret < 0) {
				pr_err("Failed to start FLL\n");
				return ret;
			}

			ret = snd_soc_dai_set_sysclk(codec_dai,
						     WM8996_SYSCLK_FLL,
						     MCLK_AUDIO_RATE,
						     SND_SOC_CLOCK_IN);
			if (ret < 0)
				return ret;
		}
		break;

	default:
		break;
	}

	return 0;
}

static struct snd_soc_jack speyside_headset;

/* Headset jack detection DAPM pins */
static struct snd_soc_jack_pin speyside_headset_pins[] = {
	{
		.pin = "Headset Mic",
		.mask = SND_JACK_MICROPHONE,
	},
};

static struct gpio_desc *speyside_hpsel_gpio;
/* Default the headphone selection to active high */
static int speyside_jack_polarity;

static int speyside_get_micbias(struct snd_soc_dapm_widget *source,
				struct snd_soc_dapm_widget *sink)
{
	if (speyside_jack_polarity && (snd_soc_dapm_widget_name_cmp(source, "MICB1") == 0))
		return 1;
	if (!speyside_jack_polarity && (snd_soc_dapm_widget_name_cmp(source, "MICB2") == 0))
		return 1;

	return 0;
}

static void speyside_set_polarity(struct snd_soc_component *component,
				  int polarity)
{
	speyside_jack_polarity = !polarity;
	gpiod_direction_output(speyside_hpsel_gpio, speyside_jack_polarity);

	/* Re-run DAPM to make sure we're using the correct mic bias */
	snd_soc_dapm_sync(snd_soc_component_to_dapm(component));
}

static int speyside_wm0010_init(struct snd_soc_pcm_runtime *rtd)

Annotation

Implementation Notes