sound/soc/pxa/spitz.c
Source file repositories/reference/linux-study-clean/sound/soc/pxa/spitz.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/pxa/spitz.c- Extension
.c- Size
- 9256 bytes
- Lines
- 326
- 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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/moduleparam.hlinux/timer.hlinux/interrupt.hlinux/platform_device.hlinux/gpio/consumer.hsound/core.hsound/pcm.hsound/soc.hasm/mach-types.h../codecs/wm8750.hpxa2xx-i2s.h
Detected Declarations
function spitz_ext_controlfunction spitz_startupfunction spitz_hw_paramsfunction spitz_get_jackfunction spitz_set_jackfunction spitz_get_spkfunction spitz_set_spkfunction spitz_mic_biasfunction spitz_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* spitz.c -- SoC audio for Sharp SL-Cxx00 models Spitz, Borzoi and Akita
*
* Copyright 2005 Wolfson Microelectronics PLC.
* Copyright 2005 Openedhand Ltd.
*
* Authors: Liam Girdwood <lrg@slimlogic.co.uk>
* Richard Purdie <richard@openedhand.com>
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/timer.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/gpio/consumer.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <asm/mach-types.h>
#include "../codecs/wm8750.h"
#include "pxa2xx-i2s.h"
#define SPITZ_HP 0
#define SPITZ_MIC 1
#define SPITZ_LINE 2
#define SPITZ_HEADSET 3
#define SPITZ_HP_OFF 4
#define SPITZ_SPK_ON 0
#define SPITZ_SPK_OFF 1
/* audio clock in Hz - rounded from 12.235MHz */
#define SPITZ_AUDIO_CLOCK 12288000
static int spitz_jack_func;
static int spitz_spk_func;
static struct gpio_desc *gpiod_mic, *gpiod_mute_l, *gpiod_mute_r;
static void spitz_ext_control(struct snd_soc_dapm_context *dapm)
{
snd_soc_dapm_mutex_lock(dapm);
if (spitz_spk_func == SPITZ_SPK_ON)
snd_soc_dapm_enable_pin_unlocked(dapm, "Ext Spk");
else
snd_soc_dapm_disable_pin_unlocked(dapm, "Ext Spk");
/* set up jack connection */
switch (spitz_jack_func) {
case SPITZ_HP:
/* enable and unmute hp jack, disable mic bias */
snd_soc_dapm_disable_pin_unlocked(dapm, "Headset Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Line Jack");
snd_soc_dapm_enable_pin_unlocked(dapm, "Headphone Jack");
gpiod_set_value(gpiod_mute_l, 1);
gpiod_set_value(gpiod_mute_r, 1);
break;
case SPITZ_MIC:
/* enable mic jack and bias, mute hp */
snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Headset Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Line Jack");
snd_soc_dapm_enable_pin_unlocked(dapm, "Mic Jack");
gpiod_set_value(gpiod_mute_l, 0);
gpiod_set_value(gpiod_mute_r, 0);
break;
case SPITZ_LINE:
/* enable line jack, disable mic bias and mute hp */
snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Headset Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Jack");
snd_soc_dapm_enable_pin_unlocked(dapm, "Line Jack");
gpiod_set_value(gpiod_mute_l, 0);
gpiod_set_value(gpiod_mute_r, 0);
break;
case SPITZ_HEADSET:
/* enable and unmute headset jack enable mic bias, mute L hp */
snd_soc_dapm_disable_pin_unlocked(dapm, "Headphone Jack");
snd_soc_dapm_enable_pin_unlocked(dapm, "Mic Jack");
snd_soc_dapm_disable_pin_unlocked(dapm, "Line Jack");
snd_soc_dapm_enable_pin_unlocked(dapm, "Headset Jack");
gpiod_set_value(gpiod_mute_l, 0);
gpiod_set_value(gpiod_mute_r, 1);
break;
case SPITZ_HP_OFF:
/* jack removed, everything off */
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/timer.h`, `linux/interrupt.h`, `linux/platform_device.h`, `linux/gpio/consumer.h`, `sound/core.h`, `sound/pcm.h`.
- Detected declarations: `function spitz_ext_control`, `function spitz_startup`, `function spitz_hw_params`, `function spitz_get_jack`, `function spitz_set_jack`, `function spitz_get_spk`, `function spitz_set_spk`, `function spitz_mic_bias`, `function spitz_probe`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.