Changeset 679 for GPL/trunk/alsa-kernel/include/sound
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (5 years ago)
- Location:
- GPL/trunk
- Files:
-
- 4 deleted
- 64 edited
- 109 copied
-
. (modified) (1 prop)
-
alsa-kernel/include/sound/ac97 (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/ac97 )
-
alsa-kernel/include/sound/ac97_codec.h (modified) (10 diffs)
-
alsa-kernel/include/sound/aci.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/aci.h )
-
alsa-kernel/include/sound/ad1816a.h (modified) (4 diffs)
-
alsa-kernel/include/sound/ad1843.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/ad1843.h )
-
alsa-kernel/include/sound/adau1373.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/adau1373.h )
-
alsa-kernel/include/sound/adriver.h (deleted)
-
alsa-kernel/include/sound/aess.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/aess.h )
-
alsa-kernel/include/sound/ak4113.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/ak4113.h )
-
alsa-kernel/include/sound/ak4114.h (modified) (6 diffs)
-
alsa-kernel/include/sound/ak4117.h (modified) (4 diffs)
-
alsa-kernel/include/sound/ak4531_codec.h (modified) (2 diffs)
-
alsa-kernel/include/sound/ak4641.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/ak4641.h )
-
alsa-kernel/include/sound/ak4xxx-adda.h (modified) (2 diffs)
-
alsa-kernel/include/sound/alc5623.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/alc5623.h )
-
alsa-kernel/include/sound/asequencer.h (modified) (2 diffs)
-
alsa-kernel/include/sound/asound.h (modified) (2 diffs)
-
alsa-kernel/include/sound/asoundef.h (modified) (3 diffs)
-
alsa-kernel/include/sound/atmel-abdac.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/atmel-abdac.h )
-
alsa-kernel/include/sound/atmel-ac97c.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/atmel-ac97c.h )
-
alsa-kernel/include/sound/compat_22.h (deleted)
-
alsa-kernel/include/sound/compress_driver.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/compress_driver.h )
-
alsa-kernel/include/sound/compress_offload.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/compress_offload.h )
-
alsa-kernel/include/sound/compress_params.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/compress_params.h )
-
alsa-kernel/include/sound/config.h (modified) (3 diffs)
-
alsa-kernel/include/sound/config.h.in (deleted)
-
alsa-kernel/include/sound/control.h (modified) (10 diffs)
-
alsa-kernel/include/sound/core.h (modified) (30 diffs)
-
alsa-kernel/include/sound/cs35l33.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs35l33.h )
-
alsa-kernel/include/sound/cs35l34.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs35l34.h )
-
alsa-kernel/include/sound/cs35l35.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs35l35.h )
-
alsa-kernel/include/sound/cs35l36.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs35l36.h )
-
alsa-kernel/include/sound/cs4231-regs.h (modified) (2 diffs)
-
alsa-kernel/include/sound/cs4271.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs4271.h )
-
alsa-kernel/include/sound/cs42l52.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs42l52.h )
-
alsa-kernel/include/sound/cs42l56.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs42l56.h )
-
alsa-kernel/include/sound/cs42l73.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/cs42l73.h )
-
alsa-kernel/include/sound/cs46xx_dsp_spos.h (modified) (1 diff)
-
alsa-kernel/include/sound/cs8403.h (modified) (2 diffs)
-
alsa-kernel/include/sound/cs8427.h (modified) (3 diffs)
-
alsa-kernel/include/sound/da7213.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/da7213.h )
-
alsa-kernel/include/sound/da7218.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/da7218.h )
-
alsa-kernel/include/sound/da7219-aad.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/da7219-aad.h )
-
alsa-kernel/include/sound/da7219.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/da7219.h )
-
alsa-kernel/include/sound/da9055.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/da9055.h )
-
alsa-kernel/include/sound/designware_i2s.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/designware_i2s.h )
-
alsa-kernel/include/sound/dmaengine_pcm.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/dmaengine_pcm.h )
-
alsa-kernel/include/sound/emu10k1.h (modified) (16 diffs)
-
alsa-kernel/include/sound/emu10k1_synth.h (modified) (2 diffs)
-
alsa-kernel/include/sound/emu8000.h (modified) (2 diffs)
-
alsa-kernel/include/sound/emu8000_reg.h (modified) (2 diffs)
-
alsa-kernel/include/sound/emux_legacy.h (modified) (2 diffs)
-
alsa-kernel/include/sound/emux_synth.h (modified) (5 diffs)
-
alsa-kernel/include/sound/es1688.h (modified) (4 diffs)
-
alsa-kernel/include/sound/gus.h (modified) (5 diffs)
-
alsa-kernel/include/sound/hda_chmap.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_chmap.h )
-
alsa-kernel/include/sound/hda_codec.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_codec.h )
-
alsa-kernel/include/sound/hda_component.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_component.h )
-
alsa-kernel/include/sound/hda_hwdep.h (modified) (1 diff)
-
alsa-kernel/include/sound/hda_i915.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_i915.h )
-
alsa-kernel/include/sound/hda_register.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_register.h )
-
alsa-kernel/include/sound/hda_regmap.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_regmap.h )
-
alsa-kernel/include/sound/hda_verbs.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_verbs.h )
-
alsa-kernel/include/sound/hdaudio.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hdaudio.h )
-
alsa-kernel/include/sound/hdaudio_ext.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hdaudio_ext.h )
-
alsa-kernel/include/sound/hdmi-codec.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hdmi-codec.h )
-
alsa-kernel/include/sound/hdspm.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/hdspm.h )
-
alsa-kernel/include/sound/hwdep.h (modified) (5 diffs)
-
alsa-kernel/include/sound/i2c.h (modified) (2 diffs)
-
alsa-kernel/include/sound/info.h (modified) (11 diffs)
-
alsa-kernel/include/sound/initval.h (modified) (6 diffs)
-
alsa-kernel/include/sound/intel-dsp-config.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/intel-dsp-config.h )
-
alsa-kernel/include/sound/intel-nhlt.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/intel-nhlt.h )
-
alsa-kernel/include/sound/jack.h (modified) (7 diffs)
-
alsa-kernel/include/sound/l3.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/l3.h )
-
alsa-kernel/include/sound/madera-pdata.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/madera-pdata.h )
-
alsa-kernel/include/sound/max9768.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/max9768.h )
-
alsa-kernel/include/sound/max98088.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/max98088.h )
-
alsa-kernel/include/sound/max98090.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/max98090.h )
-
alsa-kernel/include/sound/max98095.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/max98095.h )
-
alsa-kernel/include/sound/memalloc.h (modified) (8 diffs)
-
alsa-kernel/include/sound/minors.h (modified) (5 diffs)
-
alsa-kernel/include/sound/mixer_oss.h (modified) (3 diffs)
-
alsa-kernel/include/sound/mpu401.h (modified) (5 diffs)
-
alsa-kernel/include/sound/omap-hdmi-audio.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/omap-hdmi-audio.h )
-
alsa-kernel/include/sound/omap-pcm.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/omap-pcm.h )
-
alsa-kernel/include/sound/opl3.h (modified) (7 diffs)
-
alsa-kernel/include/sound/opl4.h (modified) (2 diffs)
-
alsa-kernel/include/sound/pcm-indirect.h (modified) (8 diffs)
-
alsa-kernel/include/sound/pcm.h (modified) (63 diffs)
-
alsa-kernel/include/sound/pcm_drm_eld.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/pcm_drm_eld.h )
-
alsa-kernel/include/sound/pcm_iec958.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/pcm_iec958.h )
-
alsa-kernel/include/sound/pcm_oss.h (modified) (3 diffs)
-
alsa-kernel/include/sound/pcm_params.h (modified) (9 diffs)
-
alsa-kernel/include/sound/pt2258.h (modified) (1 diff)
-
alsa-kernel/include/sound/pxa2xx-lib.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/pxa2xx-lib.h )
-
alsa-kernel/include/sound/rawmidi.h (modified) (12 diffs)
-
alsa-kernel/include/sound/rcar_snd.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rcar_snd.h )
-
alsa-kernel/include/sound/rt286.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt286.h )
-
alsa-kernel/include/sound/rt298.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt298.h )
-
alsa-kernel/include/sound/rt5514.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5514.h )
-
alsa-kernel/include/sound/rt5640.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5640.h )
-
alsa-kernel/include/sound/rt5645.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5645.h )
-
alsa-kernel/include/sound/rt5651.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5651.h )
-
alsa-kernel/include/sound/rt5659.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5659.h )
-
alsa-kernel/include/sound/rt5660.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5660.h )
-
alsa-kernel/include/sound/rt5663.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5663.h )
-
alsa-kernel/include/sound/rt5665.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5665.h )
-
alsa-kernel/include/sound/rt5668.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5668.h )
-
alsa-kernel/include/sound/rt5670.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5670.h )
-
alsa-kernel/include/sound/rt5677.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5677.h )
-
alsa-kernel/include/sound/rt5682.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/rt5682.h )
-
alsa-kernel/include/sound/s3c24xx_uda134x.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/s3c24xx_uda134x.h )
-
alsa-kernel/include/sound/saif.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/saif.h )
-
alsa-kernel/include/sound/sb.h (modified) (4 diffs)
-
alsa-kernel/include/sound/sb16_csp.h (modified) (4 diffs)
-
alsa-kernel/include/sound/seq_device.h (modified) (4 diffs)
-
alsa-kernel/include/sound/seq_kernel.h (modified) (7 diffs)
-
alsa-kernel/include/sound/seq_midi_emul.h (modified) (3 diffs)
-
alsa-kernel/include/sound/seq_midi_event.h (modified) (3 diffs)
-
alsa-kernel/include/sound/seq_oss.h (modified) (2 diffs)
-
alsa-kernel/include/sound/seq_oss_legacy.h (modified) (2 diffs)
-
alsa-kernel/include/sound/seq_virmidi.h (modified) (4 diffs)
-
alsa-kernel/include/sound/sh_dac_audio.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/sh_dac_audio.h )
-
alsa-kernel/include/sound/sh_fsi.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/sh_fsi.h )
-
alsa-kernel/include/sound/simple_card.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/simple_card.h )
-
alsa-kernel/include/sound/simple_card_utils.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/simple_card_utils.h )
-
alsa-kernel/include/sound/snd_wavefront.h (modified) (3 diffs)
-
alsa-kernel/include/sound/soc-acpi-intel-match.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-acpi-intel-match.h )
-
alsa-kernel/include/sound/soc-acpi.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-acpi.h )
-
alsa-kernel/include/sound/soc-component.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-component.h )
-
alsa-kernel/include/sound/soc-dai.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-dai.h )
-
alsa-kernel/include/sound/soc-dapm.h (modified) (18 diffs)
-
alsa-kernel/include/sound/soc-dpcm.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-dpcm.h )
-
alsa-kernel/include/sound/soc-topology.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-topology.h )
-
alsa-kernel/include/sound/soc.h (modified) (30 diffs)
-
alsa-kernel/include/sound/sof.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/sof.h )
-
alsa-kernel/include/sound/soundfont.h (modified) (3 diffs)
-
alsa-kernel/include/sound/spear_dma.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/spear_dma.h )
-
alsa-kernel/include/sound/spear_spdif.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/spear_spdif.h )
-
alsa-kernel/include/sound/sta32x.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/sta32x.h )
-
alsa-kernel/include/sound/sta350.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/sta350.h )
-
alsa-kernel/include/sound/tas2552-plat.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tas2552-plat.h )
-
alsa-kernel/include/sound/tas5086.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tas5086.h )
-
alsa-kernel/include/sound/tea575x-tuner.h (modified) (1 diff)
-
alsa-kernel/include/sound/tea6330t.h (modified) (2 diffs)
-
alsa-kernel/include/sound/tegra_wm8903.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tegra_wm8903.h )
-
alsa-kernel/include/sound/timer.h (modified) (7 diffs)
-
alsa-kernel/include/sound/tlv.h (modified) (2 diffs)
-
alsa-kernel/include/sound/tlv320aic32x4.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tlv320aic32x4.h )
-
alsa-kernel/include/sound/tlv320aic3x.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tlv320aic3x.h )
-
alsa-kernel/include/sound/tlv320dac33-plat.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tlv320dac33-plat.h )
-
alsa-kernel/include/sound/tpa6130a2-plat.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/tpa6130a2-plat.h )
-
alsa-kernel/include/sound/uda134x.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/uda134x.h )
-
alsa-kernel/include/sound/uda1380.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/uda1380.h )
-
alsa-kernel/include/sound/util_mem.h (modified) (2 diffs)
-
alsa-kernel/include/sound/version.h (modified) (1 diff)
-
alsa-kernel/include/sound/version.h.in (deleted)
-
alsa-kernel/include/sound/vx_core.h (modified) (8 diffs)
-
alsa-kernel/include/sound/wavefront.h (modified) (2 diffs)
-
alsa-kernel/include/sound/wm0010.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm0010.h )
-
alsa-kernel/include/sound/wm1250-ev1.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm1250-ev1.h )
-
alsa-kernel/include/sound/wm2000.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm2000.h )
-
alsa-kernel/include/sound/wm2200.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm2200.h )
-
alsa-kernel/include/sound/wm5100.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm5100.h )
-
alsa-kernel/include/sound/wm8903.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8903.h )
-
alsa-kernel/include/sound/wm8904.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8904.h )
-
alsa-kernel/include/sound/wm8915.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8915.h )
-
alsa-kernel/include/sound/wm8955.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8955.h )
-
alsa-kernel/include/sound/wm8960.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8960.h )
-
alsa-kernel/include/sound/wm8962.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8962.h )
-
alsa-kernel/include/sound/wm8993.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8993.h )
-
alsa-kernel/include/sound/wm8996.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm8996.h )
-
alsa-kernel/include/sound/wm9081.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm9081.h )
-
alsa-kernel/include/sound/wm9090.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wm9090.h )
-
alsa-kernel/include/sound/wss.h (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/include/sound/wss.h )
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/include/sound/ac97_codec.h
r598 r679 1 #ifndef __SOUND_AC97_CODEC_H 2 #define __SOUND_AC97_CODEC_H 3 4 /* 1 /* SPDX-License-Identifier: GPL-2.0+ 2 * 5 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 6 4 * Universal interface for Audio Codec '97 … … 8 6 * For more details look to AC '97 component specification revision 2.1 9 7 * by Intel Corporation (http://developer.intel.com). 10 *11 *12 * This program is free software; you can redistribute it and/or modify13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or15 * (at your option) any later version.16 *17 * This program is distributed in the hope that it will be useful,18 * but WITHOUT ANY WARRANTY; without even the implied warranty of19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20 * GNU General Public License for more details.21 *22 * You should have received a copy of the GNU General Public License23 * along with this program; if not, write to the Free Software24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA25 *26 8 */ 9 10 #ifndef __SOUND_AC97_CODEC_H 11 #define __SOUND_AC97_CODEC_H 27 12 28 13 #include <linux/bitops.h> 29 14 #include <linux/device.h> 30 15 #include <linux/workqueue.h> 31 #include "pcm.h" 32 #include "control.h" 33 #include "info.h" 16 #include <sound/ac97/regs.h> 17 #include <sound/pcm.h> 18 #include <sound/control.h> 19 #include <sound/info.h> 34 20 35 21 /* maximum number of devices on the AC97 bus */ 36 22 #define AC97_BUS_MAX_DEVICES 4 37 38 /*39 * AC'97 codec registers40 */41 42 #define AC97_RESET 0x00 /* Reset */43 #define AC97_MASTER 0x02 /* Master Volume */44 #define AC97_HEADPHONE 0x04 /* Headphone Volume (optional) */45 #define AC97_MASTER_MONO 0x06 /* Master Volume Mono (optional) */46 #define AC97_MASTER_TONE 0x08 /* Master Tone (Bass & Treble) (optional) */47 #define AC97_PC_BEEP 0x0a /* PC Beep Volume (optinal) */48 #define AC97_PHONE 0x0c /* Phone Volume (optional) */49 #define AC97_MIC 0x0e /* MIC Volume */50 #define AC97_LINE 0x10 /* Line In Volume */51 #define AC97_CD 0x12 /* CD Volume */52 #define AC97_VIDEO 0x14 /* Video Volume (optional) */53 #define AC97_AUX 0x16 /* AUX Volume (optional) */54 #define AC97_PCM 0x18 /* PCM Volume */55 #define AC97_REC_SEL 0x1a /* Record Select */56 #define AC97_REC_GAIN 0x1c /* Record Gain */57 #define AC97_REC_GAIN_MIC 0x1e /* Record Gain MIC (optional) */58 #define AC97_GENERAL_PURPOSE 0x20 /* General Purpose (optional) */59 #define AC97_3D_CONTROL 0x22 /* 3D Control (optional) */60 #define AC97_INT_PAGING 0x24 /* Audio Interrupt & Paging (AC'97 2.3) */61 #define AC97_POWERDOWN 0x26 /* Powerdown control / status */62 /* range 0x28-0x3a - AUDIO AC'97 2.0 extensions */63 #define AC97_EXTENDED_ID 0x28 /* Extended Audio ID */64 #define AC97_EXTENDED_STATUS 0x2a /* Extended Audio Status and Control */65 #define AC97_PCM_FRONT_DAC_RATE 0x2c /* PCM Front DAC Rate */66 #define AC97_PCM_SURR_DAC_RATE 0x2e /* PCM Surround DAC Rate */67 #define AC97_PCM_LFE_DAC_RATE 0x30 /* PCM LFE DAC Rate */68 #define AC97_PCM_LR_ADC_RATE 0x32 /* PCM LR ADC Rate */69 #define AC97_PCM_MIC_ADC_RATE 0x34 /* PCM MIC ADC Rate */70 #define AC97_CENTER_LFE_MASTER 0x36 /* Center + LFE Master Volume */71 #define AC97_SURROUND_MASTER 0x38 /* Surround (Rear) Master Volume */72 #define AC97_SPDIF 0x3a /* S/PDIF control */73 /* range 0x3c-0x58 - MODEM */74 #define AC97_EXTENDED_MID 0x3c /* Extended Modem ID */75 #define AC97_EXTENDED_MSTATUS 0x3e /* Extended Modem Status and Control */76 #define AC97_LINE1_RATE 0x40 /* Line1 DAC/ADC Rate */77 #define AC97_LINE2_RATE 0x42 /* Line2 DAC/ADC Rate */78 #define AC97_HANDSET_RATE 0x44 /* Handset DAC/ADC Rate */79 #define AC97_LINE1_LEVEL 0x46 /* Line1 DAC/ADC Level */80 #define AC97_LINE2_LEVEL 0x48 /* Line2 DAC/ADC Level */81 #define AC97_HANDSET_LEVEL 0x4a /* Handset DAC/ADC Level */82 #define AC97_GPIO_CFG 0x4c /* GPIO Configuration */83 #define AC97_GPIO_POLARITY 0x4e /* GPIO Pin Polarity/Type, 0=low, 1=high active */84 #define AC97_GPIO_STICKY 0x50 /* GPIO Pin Sticky, 0=not, 1=sticky */85 #define AC97_GPIO_WAKEUP 0x52 /* GPIO Pin Wakeup, 0=no int, 1=yes int */86 #define AC97_GPIO_STATUS 0x54 /* GPIO Pin Status, slot 12 */87 #define AC97_MISC_AFE 0x56 /* Miscellaneous Modem AFE Status and Control */88 /* range 0x5a-0x7b - Vendor Specific */89 #define AC97_VENDOR_ID1 0x7c /* Vendor ID1 */90 #define AC97_VENDOR_ID2 0x7e /* Vendor ID2 / revision */91 /* range 0x60-0x6f (page 1) - extended codec registers */92 #define AC97_CODEC_CLASS_REV 0x60 /* Codec Class/Revision */93 #define AC97_PCI_SVID 0x62 /* PCI Subsystem Vendor ID */94 #define AC97_PCI_SID 0x64 /* PCI Subsystem ID */95 #define AC97_FUNC_SELECT 0x66 /* Function Select */96 #define AC97_FUNC_INFO 0x68 /* Function Information */97 #define AC97_SENSE_INFO 0x6a /* Sense Details */98 99 /* slot allocation */100 #define AC97_SLOT_TAG 0101 #define AC97_SLOT_CMD_ADDR 1102 #define AC97_SLOT_CMD_DATA 2103 #define AC97_SLOT_PCM_LEFT 3104 #define AC97_SLOT_PCM_RIGHT 4105 #define AC97_SLOT_MODEM_LINE1 5106 #define AC97_SLOT_PCM_CENTER 6107 #define AC97_SLOT_MIC 6 /* input */108 #define AC97_SLOT_SPDIF_LEFT1 6109 #define AC97_SLOT_PCM_SLEFT 7 /* surround left */110 #define AC97_SLOT_PCM_LEFT_0 7 /* double rate operation */111 #define AC97_SLOT_SPDIF_LEFT 7112 #define AC97_SLOT_PCM_SRIGHT 8 /* surround right */113 #define AC97_SLOT_PCM_RIGHT_0 8 /* double rate operation */114 #define AC97_SLOT_SPDIF_RIGHT 8115 #define AC97_SLOT_LFE 9116 #define AC97_SLOT_SPDIF_RIGHT1 9117 #define AC97_SLOT_MODEM_LINE2 10118 #define AC97_SLOT_PCM_LEFT_1 10 /* double rate operation */119 #define AC97_SLOT_SPDIF_LEFT2 10120 #define AC97_SLOT_HANDSET 11 /* output */121 #define AC97_SLOT_PCM_RIGHT_1 11 /* double rate operation */122 #define AC97_SLOT_SPDIF_RIGHT2 11123 #define AC97_SLOT_MODEM_GPIO 12 /* modem GPIO */124 #define AC97_SLOT_PCM_CENTER_1 12 /* double rate operation */125 126 /* basic capabilities (reset register) */127 #define AC97_BC_DEDICATED_MIC 0x0001 /* Dedicated Mic PCM In Channel */128 #define AC97_BC_RESERVED1 0x0002 /* Reserved (was Modem Line Codec support) */129 #define AC97_BC_BASS_TREBLE 0x0004 /* Bass & Treble Control */130 #define AC97_BC_SIM_STEREO 0x0008 /* Simulated stereo */131 #define AC97_BC_HEADPHONE 0x0010 /* Headphone Out Support */132 #define AC97_BC_LOUDNESS 0x0020 /* Loudness (bass boost) Support */133 #define AC97_BC_16BIT_DAC 0x0000 /* 16-bit DAC resolution */134 #define AC97_BC_18BIT_DAC 0x0040 /* 18-bit DAC resolution */135 #define AC97_BC_20BIT_DAC 0x0080 /* 20-bit DAC resolution */136 #define AC97_BC_DAC_MASK 0x00c0137 #define AC97_BC_16BIT_ADC 0x0000 /* 16-bit ADC resolution */138 #define AC97_BC_18BIT_ADC 0x0100 /* 18-bit ADC resolution */139 #define AC97_BC_20BIT_ADC 0x0200 /* 20-bit ADC resolution */140 #define AC97_BC_ADC_MASK 0x0300141 142 /* general purpose */143 #define AC97_GP_DRSS_MASK 0x0c00 /* double rate slot select */144 #define AC97_GP_DRSS_1011 0x0000 /* LR(C) 10+11(+12) */145 #define AC97_GP_DRSS_78 0x0400 /* LR 7+8 */146 147 /* powerdown bits */148 #define AC97_PD_ADC_STATUS 0x0001 /* ADC status (RO) */149 #define AC97_PD_DAC_STATUS 0x0002 /* DAC status (RO) */150 #define AC97_PD_MIXER_STATUS 0x0004 /* Analog mixer status (RO) */151 #define AC97_PD_VREF_STATUS 0x0008 /* Vref status (RO) */152 #define AC97_PD_PR0 0x0100 /* Power down PCM ADCs and input MUX */153 #define AC97_PD_PR1 0x0200 /* Power down PCM front DAC */154 #define AC97_PD_PR2 0x0400 /* Power down Mixer (Vref still on) */155 #define AC97_PD_PR3 0x0800 /* Power down Mixer (Vref off) */156 #define AC97_PD_PR4 0x1000 /* Power down AC-Link */157 #define AC97_PD_PR5 0x2000 /* Disable internal clock usage */158 #define AC97_PD_PR6 0x4000 /* Headphone amplifier */159 #define AC97_PD_EAPD 0x8000 /* External Amplifer Power Down (EAPD) */160 161 /* extended audio ID bit defines */162 #define AC97_EI_VRA 0x0001 /* Variable bit rate supported */163 #define AC97_EI_DRA 0x0002 /* Double rate supported */164 #define AC97_EI_SPDIF 0x0004 /* S/PDIF out supported */165 #define AC97_EI_VRM 0x0008 /* Variable bit rate supported for MIC */166 #define AC97_EI_DACS_SLOT_MASK 0x0030 /* DACs slot assignment */167 #define AC97_EI_DACS_SLOT_SHIFT 4168 #define AC97_EI_CDAC 0x0040 /* PCM Center DAC available */169 #define AC97_EI_SDAC 0x0080 /* PCM Surround DACs available */170 #define AC97_EI_LDAC 0x0100 /* PCM LFE DAC available */171 #define AC97_EI_AMAP 0x0200 /* indicates optional slot/DAC mapping based on codec ID */172 #define AC97_EI_REV_MASK 0x0c00 /* AC'97 revision mask */173 #define AC97_EI_REV_22 0x0400 /* AC'97 revision 2.2 */174 #define AC97_EI_REV_23 0x0800 /* AC'97 revision 2.3 */175 #define AC97_EI_REV_SHIFT 10176 #define AC97_EI_ADDR_MASK 0xc000 /* physical codec ID (address) */177 #define AC97_EI_ADDR_SHIFT 14178 179 /* extended audio status and control bit defines */180 #define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */181 #define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */182 #define AC97_EA_SPDIF 0x0004 /* S/PDIF out enable bit */183 #define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */184 #define AC97_EA_SPSA_SLOT_MASK 0x0030 /* Mask for slot assignment bits */185 #define AC97_EA_SPSA_SLOT_SHIFT 4186 #define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */187 #define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */188 #define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */189 #define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */190 #define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */191 #define AC97_EA_SDAC 0x0080 /* PCM Surround DACs are ready (Read only) */192 #define AC97_EA_LDAC 0x0100 /* PCM LFE DAC is ready (Read only) */193 #define AC97_EA_MDAC 0x0200 /* MIC ADC is ready (Read only) */194 #define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */195 #define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */196 #define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */197 #define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */198 #define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */199 200 /* S/PDIF control bit defines */201 #define AC97_SC_PRO 0x0001 /* Professional status */202 #define AC97_SC_NAUDIO 0x0002 /* Non audio stream */203 #define AC97_SC_COPY 0x0004 /* Copyright status */204 #define AC97_SC_PRE 0x0008 /* Preemphasis status */205 #define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */206 #define AC97_SC_CC_SHIFT 4207 #define AC97_SC_L 0x0800 /* Generation Level status */208 #define AC97_SC_SPSR_MASK 0x3000 /* S/PDIF Sample Rate bits */209 #define AC97_SC_SPSR_SHIFT 12210 #define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */211 #define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */212 #define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */213 #define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */214 #define AC97_SC_V 0x8000 /* Validity status */215 216 /* Interrupt and Paging bit defines (AC'97 2.3) */217 #define AC97_PAGE_MASK 0x000f /* Page Selector */218 #define AC97_PAGE_VENDOR 0 /* Vendor-specific registers */219 #define AC97_PAGE_1 1 /* Extended Codec Registers page 1 */220 #define AC97_INT_ENABLE 0x0800 /* Interrupt Enable */221 #define AC97_INT_SENSE 0x1000 /* Sense Cycle */222 #define AC97_INT_CAUSE_SENSE 0x2000 /* Sense Cycle Completed (RO) */223 #define AC97_INT_CAUSE_GPIO 0x4000 /* GPIO bits changed (RO) */224 #define AC97_INT_STATUS 0x8000 /* Interrupt Status */225 226 /* extended modem ID bit defines */227 #define AC97_MEI_LINE1 0x0001 /* Line1 present */228 #define AC97_MEI_LINE2 0x0002 /* Line2 present */229 #define AC97_MEI_HANDSET 0x0004 /* Handset present */230 #define AC97_MEI_CID1 0x0008 /* caller ID decode for Line1 is supported */231 #define AC97_MEI_CID2 0x0010 /* caller ID decode for Line2 is supported */232 #define AC97_MEI_ADDR_MASK 0xc000 /* physical codec ID (address) */233 #define AC97_MEI_ADDR_SHIFT 14234 235 /* extended modem status and control bit defines */236 #define AC97_MEA_GPIO 0x0001 /* GPIO is ready (ro) */237 #define AC97_MEA_MREF 0x0002 /* Vref is up to nominal level (ro) */238 #define AC97_MEA_ADC1 0x0004 /* ADC1 operational (ro) */239 #define AC97_MEA_DAC1 0x0008 /* DAC1 operational (ro) */240 #define AC97_MEA_ADC2 0x0010 /* ADC2 operational (ro) */241 #define AC97_MEA_DAC2 0x0020 /* DAC2 operational (ro) */242 #define AC97_MEA_HADC 0x0040 /* HADC operational (ro) */243 #define AC97_MEA_HDAC 0x0080 /* HDAC operational (ro) */244 #define AC97_MEA_PRA 0x0100 /* GPIO power down (high) */245 #define AC97_MEA_PRB 0x0200 /* reserved */246 #define AC97_MEA_PRC 0x0400 /* ADC1 power down (high) */247 #define AC97_MEA_PRD 0x0800 /* DAC1 power down (high) */248 #define AC97_MEA_PRE 0x1000 /* ADC2 power down (high) */249 #define AC97_MEA_PRF 0x2000 /* DAC2 power down (high) */250 #define AC97_MEA_PRG 0x4000 /* HADC power down (high) */251 #define AC97_MEA_PRH 0x8000 /* HDAC power down (high) */252 253 /* modem gpio status defines */254 #define AC97_GPIO_LINE1_OH 0x0001 /* Off Hook Line1 */255 #define AC97_GPIO_LINE1_RI 0x0002 /* Ring Detect Line1 */256 #define AC97_GPIO_LINE1_CID 0x0004 /* Caller ID path enable Line1 */257 #define AC97_GPIO_LINE1_LCS 0x0008 /* Loop Current Sense Line1 */258 #define AC97_GPIO_LINE1_PULSE 0x0010 /* Opt./ Pulse Dial Line1 (out) */259 #define AC97_GPIO_LINE1_HL1R 0x0020 /* Opt./ Handset to Line1 relay control (out) */260 #define AC97_GPIO_LINE1_HOHD 0x0040 /* Opt./ Handset off hook detect Line1 (in) */261 #define AC97_GPIO_LINE12_AC 0x0080 /* Opt./ Int.bit 1 / Line1/2 AC (out) */262 #define AC97_GPIO_LINE12_DC 0x0100 /* Opt./ Int.bit 2 / Line1/2 DC (out) */263 #define AC97_GPIO_LINE12_RS 0x0200 /* Opt./ Int.bit 3 / Line1/2 RS (out) */264 #define AC97_GPIO_LINE2_OH 0x0400 /* Off Hook Line2 */265 #define AC97_GPIO_LINE2_RI 0x0800 /* Ring Detect Line2 */266 #define AC97_GPIO_LINE2_CID 0x1000 /* Caller ID path enable Line2 */267 #define AC97_GPIO_LINE2_LCS 0x2000 /* Loop Current Sense Line2 */268 #define AC97_GPIO_LINE2_PULSE 0x4000 /* Opt./ Pulse Dial Line2 (out) */269 #define AC97_GPIO_LINE2_HL1R 0x8000 /* Opt./ Handset to Line2 relay control (out) */270 23 271 24 /* specific - SigmaTel */ … … 381 134 #define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ 382 135 #define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */ 383 #define AC97_SCAP_POWER_SAVE (1<<11) /* capable for aggres ive power-saving */136 #define AC97_SCAP_POWER_SAVE (1<<11) /* capable for aggressive power-saving */ 384 137 385 138 /* ac97->flags */ … … 413 166 #define AC97_RATES_SPDIF 5 414 167 168 #define AC97_NUM_GPIOS 16 415 169 /* 416 170 * … … 418 172 419 173 struct snd_ac97; 174 struct snd_ac97_gpio_priv; 175 struct snd_pcm_chmap; 420 176 421 177 struct snd_ac97_build_ops { … … 442 198 struct snd_ac97_bus { 443 199 /* -- lowlevel (hardware) driver specific -- */ 444 struct snd_ac97_bus_ops *ops;200 const struct snd_ac97_bus_ops *ops; 445 201 void *private_data; 446 202 void (*private_free) (struct snd_ac97_bus *bus); … … 524 280 #endif 525 281 struct device dev; 282 struct snd_ac97_gpio_priv *gpio_priv; 283 284 struct snd_pcm_chmap *chmaps[2]; /* channel-maps (optional) */ 526 285 }; 527 286 … … 552 311 /* functions */ 553 312 /* create new AC97 bus */ 554 int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, 313 int snd_ac97_bus(struct snd_card *card, int num, 314 const struct snd_ac97_bus_ops *ops, 555 315 void *private_data, struct snd_ac97_bus **rbus); 556 316 /* create mixer controls */ … … 577 337 void snd_ac97_resume(struct snd_ac97 *ac97); 578 338 #endif 339 int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id, 340 unsigned int id_mask); 579 341 580 342 /* quirk types */ … … 601 363 }; 602 364 603 int snd_ac97_tune_hardware(struct snd_ac97 *ac97, struct ac97_quirk *quirk, const char *override); 365 int snd_ac97_tune_hardware(struct snd_ac97 *ac97, 366 const struct ac97_quirk *quirk, 367 const char *override); 604 368 int snd_ac97_set_rate(struct snd_ac97 *ac97, int reg, unsigned int rate); 605 369 -
GPL/trunk/alsa-kernel/include/sound/ad1816a.h
r426 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_AD1816A_H 2 3 #define __SOUND_AD1816A_H … … 6 7 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> 7 8 8 This program is free software; you can redistribute it and/or modify9 it under the terms of the GNU General Public License as published by10 the Free Software Foundation; either version 2 of the License, or11 (at your option) any later version.12 13 This program is distributed in the hope that it will be useful,14 but WITHOUT ANY WARRANTY; without even the implied warranty of15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 GNU General Public License for more details.17 18 You should have received a copy of the GNU General Public License19 along with this program; if not, write to the Free Software20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 9 */ 22 10 23 #include "control.h"24 #include "pcm.h"25 #include "timer.h"11 #include <sound/control.h> 12 #include <sound/pcm.h> 13 #include <sound/timer.h> 26 14 27 15 #define AD1816A_REG(r) (chip->port + r) … … 148 136 149 137 struct snd_timer *timer; 138 #ifdef CONFIG_PM 139 unsigned short image[48]; 140 #endif 150 141 }; 151 142 … … 166 157 extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, 167 158 int irq, int dma1, int dma2, 168 struct snd_ad1816a * *chip);159 struct snd_ad1816a *chip); 169 160 170 extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device , struct snd_pcm **rpcm);161 extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device); 171 162 extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); 172 extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device, 173 struct snd_timer **rtimer); 163 extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device); 164 #ifdef CONFIG_PM 165 extern void snd_ad1816a_suspend(struct snd_ad1816a *chip); 166 extern void snd_ad1816a_resume(struct snd_ad1816a *chip); 167 #endif 174 168 175 169 #endif /* __SOUND_AD1816A_H */ -
GPL/trunk/alsa-kernel/include/sound/ak4114.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_AK4114_H 2 3 #define __SOUND_AK4114_H … … 5 6 * Routines for Asahi Kasei AK4114 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 164 149 typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr); 165 150 151 enum { 152 AK4114_PARITY_ERRORS, 153 AK4114_V_BIT_ERRORS, 154 AK4114_QCRC_ERRORS, 155 AK4114_CCRC_ERRORS, 156 AK4114_NUM_ERRORS 157 }; 158 166 159 struct ak4114 { 167 160 struct snd_card *card; … … 169 162 ak4114_read_t * read; 170 163 void * private_data; 171 unsigned int init: 1; 164 atomic_t wq_processing; 165 struct mutex reinit_mutex; 172 166 spinlock_t lock; 173 unsigned char regmap[ 7];167 unsigned char regmap[6]; 174 168 unsigned char txcsb[5]; 175 169 struct snd_kcontrol *kctls[AK4114_CONTROLS]; 176 170 struct snd_pcm_substream *playback_substream; 177 171 struct snd_pcm_substream *capture_substream; 178 unsigned long parity_errors; 179 unsigned long v_bit_errors; 180 unsigned long qcrc_errors; 181 unsigned long ccrc_errors; 172 unsigned long errors[AK4114_NUM_ERRORS]; 182 173 unsigned char rcs0; 183 174 unsigned char rcs1; … … 190 181 int snd_ak4114_create(struct snd_card *card, 191 182 ak4114_read_t *read, ak4114_write_t *write, 192 const unsigned char pgm[ 7], const unsigned char txcsb[5],183 const unsigned char pgm[6], const unsigned char txcsb[5], 193 184 void *private_data, struct ak4114 **r_ak4114); 194 185 void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val); … … 200 191 int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags); 201 192 193 #ifdef CONFIG_PM 194 void snd_ak4114_suspend(struct ak4114 *chip); 195 void snd_ak4114_resume(struct ak4114 *chip); 196 #else 197 static inline void snd_ak4114_suspend(struct ak4114 *chip) {} 198 static inline void snd_ak4114_resume(struct ak4114 *chip) {} 199 #endif 200 202 201 #endif /* __SOUND_AK4114_H */ 203 202 -
GPL/trunk/alsa-kernel/include/sound/ak4117.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_AK4117_H 2 3 #define __SOUND_AK4117_H … … 5 6 * Routines for Asahi Kasei AK4117 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 156 141 typedef unsigned char (ak4117_read_t)(void *private_data, unsigned char addr); 157 142 143 enum { 144 AK4117_PARITY_ERRORS, 145 AK4117_V_BIT_ERRORS, 146 AK4117_QCRC_ERRORS, 147 AK4117_CCRC_ERRORS, 148 AK4117_NUM_ERRORS 149 }; 150 158 151 struct ak4117 { 159 152 struct snd_card *card; … … 166 159 struct snd_kcontrol *kctls[AK4117_CONTROLS]; 167 160 struct snd_pcm_substream *substream; 168 unsigned long parity_errors; 169 unsigned long v_bit_errors; 170 unsigned long qcrc_errors; 171 unsigned long ccrc_errors; 161 unsigned long errors[AK4117_NUM_ERRORS]; 172 162 unsigned char rcs0; 173 163 unsigned char rcs1; -
GPL/trunk/alsa-kernel/include/sound/ak4531_codec.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_AK4531_CODEC_H 2 3 #define __SOUND_AK4531_CODEC_H … … 8 9 * For more details look to AC '97 component specification revision 2.1 9 10 * by Intel Corporation (http://developer.intel.com). 10 *11 *12 * This program is free software; you can redistribute it and/or modify13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or15 * (at your option) any later version.16 *17 * This program is distributed in the hope that it will be useful,18 * but WITHOUT ANY WARRANTY; without even the implied warranty of19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20 * GNU General Public License for more details.21 *22 * You should have received a copy of the GNU General Public License23 * along with this program; if not, write to the Free Software24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA25 *26 11 */ 27 12 28 #include "info.h"29 #include "control.h"13 #include <sound/info.h> 14 #include <sound/control.h> 30 15 31 16 /* -
GPL/trunk/alsa-kernel/include/sound/ak4xxx-adda.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_AK4XXX_ADDA_H 2 3 #define __SOUND_AK4XXX_ADDA_H … … 7 8 * 8 9 * Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz> 9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 10 */ 25 11 -
GPL/trunk/alsa-kernel/include/sound/asequencer.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * Main header file for the ALSA sequencer 3 4 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl> 4 5 * (c) 1998-1999 by Jaroslav Kysela <perex@perex.cz> 5 *6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 *21 6 */ 22 7 #ifndef __SOUND_ASEQUENCER_H 23 8 #define __SOUND_ASEQUENCER_H 24 9 25 #ifdef __KERNEL__26 10 #include <linux/ioctl.h> 27 11 #include <sound/asound.h> 28 #endif 29 30 /** version of the sequencer */ 31 #define SNDRV_SEQ_VERSION SNDRV_PROTOCOL_VERSION (1, 0, 1) 32 33 /** 34 * definition of sequencer event types 35 */ 36 37 /** system messages 38 * event data type = #snd_seq_result 39 */ 40 #define SNDRV_SEQ_EVENT_SYSTEM 0 41 #define SNDRV_SEQ_EVENT_RESULT 1 42 43 /** note messages (channel specific) 44 * event data type = #snd_seq_ev_note 45 */ 46 #define SNDRV_SEQ_EVENT_NOTE 5 47 #define SNDRV_SEQ_EVENT_NOTEON 6 48 #define SNDRV_SEQ_EVENT_NOTEOFF 7 49 #define SNDRV_SEQ_EVENT_KEYPRESS 8 50 51 /** control messages (channel specific) 52 * event data type = #snd_seq_ev_ctrl 53 */ 54 #define SNDRV_SEQ_EVENT_CONTROLLER 10 55 #define SNDRV_SEQ_EVENT_PGMCHANGE 11 56 #define SNDRV_SEQ_EVENT_CHANPRESS 12 57 #define SNDRV_SEQ_EVENT_PITCHBEND 13 /**< from -8192 to 8191 */ 58 #define SNDRV_SEQ_EVENT_CONTROL14 14 /**< 14 bit controller value */ 59 #define SNDRV_SEQ_EVENT_NONREGPARAM 15 /**< 14 bit NRPN address + 14 bit unsigned value */ 60 #define SNDRV_SEQ_EVENT_REGPARAM 16 /**< 14 bit RPN address + 14 bit unsigned value */ 61 62 /** synchronisation messages 63 * event data type = #snd_seq_ev_ctrl 64 */ 65 #define SNDRV_SEQ_EVENT_SONGPOS 20 /* Song Position Pointer with LSB and MSB values */ 66 #define SNDRV_SEQ_EVENT_SONGSEL 21 /* Song Select with song ID number */ 67 #define SNDRV_SEQ_EVENT_QFRAME 22 /* midi time code quarter frame */ 68 #define SNDRV_SEQ_EVENT_TIMESIGN 23 /* SMF Time Signature event */ 69 #define SNDRV_SEQ_EVENT_KEYSIGN 24 /* SMF Key Signature event */ 70 71 /** timer messages 72 * event data type = snd_seq_ev_queue_control 73 */ 74 #define SNDRV_SEQ_EVENT_START 30 /* midi Real Time Start message */ 75 #define SNDRV_SEQ_EVENT_CONTINUE 31 /* midi Real Time Continue message */ 76 #define SNDRV_SEQ_EVENT_STOP 32 /* midi Real Time Stop message */ 77 #define SNDRV_SEQ_EVENT_SETPOS_TICK 33 /* set tick queue position */ 78 #define SNDRV_SEQ_EVENT_SETPOS_TIME 34 /* set realtime queue position */ 79 #define SNDRV_SEQ_EVENT_TEMPO 35 /* (SMF) Tempo event */ 80 #define SNDRV_SEQ_EVENT_CLOCK 36 /* midi Real Time Clock message */ 81 #define SNDRV_SEQ_EVENT_TICK 37 /* midi Real Time Tick message */ 82 #define SNDRV_SEQ_EVENT_QUEUE_SKEW 38 /* skew queue tempo */ 83 84 /** others 85 * event data type = none 86 */ 87 #define SNDRV_SEQ_EVENT_TUNE_REQUEST 40 /* tune request */ 88 #define SNDRV_SEQ_EVENT_RESET 41 /* reset to power-on state */ 89 #define SNDRV_SEQ_EVENT_SENSING 42 /* "active sensing" event */ 90 91 /** echo back, kernel private messages 92 * event data type = any type 93 */ 94 #define SNDRV_SEQ_EVENT_ECHO 50 /* echo event */ 95 #define SNDRV_SEQ_EVENT_OSS 51 /* OSS raw event */ 96 97 /** system status messages (broadcast for subscribers) 98 * event data type = snd_seq_addr 99 */ 100 #define SNDRV_SEQ_EVENT_CLIENT_START 60 /* new client has connected */ 101 #define SNDRV_SEQ_EVENT_CLIENT_EXIT 61 /* client has left the system */ 102 #define SNDRV_SEQ_EVENT_CLIENT_CHANGE 62 /* client status/info has changed */ 103 #define SNDRV_SEQ_EVENT_PORT_START 63 /* new port was created */ 104 #define SNDRV_SEQ_EVENT_PORT_EXIT 64 /* port was deleted from system */ 105 #define SNDRV_SEQ_EVENT_PORT_CHANGE 65 /* port status/info has changed */ 106 107 /** port connection changes 108 * event data type = snd_seq_connect 109 */ 110 #define SNDRV_SEQ_EVENT_PORT_SUBSCRIBED 66 /* ports connected */ 111 #define SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED 67 /* ports disconnected */ 112 113 /* 70-89: synthesizer events - obsoleted */ 114 115 /** user-defined events with fixed length 116 * event data type = any 117 */ 118 #define SNDRV_SEQ_EVENT_USR0 90 119 #define SNDRV_SEQ_EVENT_USR1 91 120 #define SNDRV_SEQ_EVENT_USR2 92 121 #define SNDRV_SEQ_EVENT_USR3 93 122 #define SNDRV_SEQ_EVENT_USR4 94 123 #define SNDRV_SEQ_EVENT_USR5 95 124 #define SNDRV_SEQ_EVENT_USR6 96 125 #define SNDRV_SEQ_EVENT_USR7 97 126 #define SNDRV_SEQ_EVENT_USR8 98 127 #define SNDRV_SEQ_EVENT_USR9 99 128 129 /* 100-118: instrument layer - obsoleted */ 130 /* 119-129: reserved */ 131 132 /* 130-139: variable length events 133 * event data type = snd_seq_ev_ext 134 * (SNDRV_SEQ_EVENT_LENGTH_VARIABLE must be set) 135 */ 136 #define SNDRV_SEQ_EVENT_SYSEX 130 /* system exclusive data (variable length) */ 137 #define SNDRV_SEQ_EVENT_BOUNCE 131 /* error event */ 138 /* 132-134: reserved */ 139 #define SNDRV_SEQ_EVENT_USR_VAR0 135 140 #define SNDRV_SEQ_EVENT_USR_VAR1 136 141 #define SNDRV_SEQ_EVENT_USR_VAR2 137 142 #define SNDRV_SEQ_EVENT_USR_VAR3 138 143 #define SNDRV_SEQ_EVENT_USR_VAR4 139 144 145 /* 150-151: kernel events with quote - DO NOT use in user clients */ 146 #define SNDRV_SEQ_EVENT_KERNEL_ERROR 150 147 #define SNDRV_SEQ_EVENT_KERNEL_QUOTE 151 /* obsolete */ 148 149 /* 152-191: reserved */ 150 151 /* 192-254: hardware specific events */ 152 153 /* 255: special event */ 154 #define SNDRV_SEQ_EVENT_NONE 255 155 156 157 typedef unsigned char snd_seq_event_type_t; 158 159 /** event address */ 160 struct snd_seq_addr { 161 unsigned char client; /**< Client number: 0..255, 255 = broadcast to all clients */ 162 unsigned char port; /**< Port within client: 0..255, 255 = broadcast to all ports */ 163 }; 164 165 /** port connection */ 166 struct snd_seq_connect { 167 struct snd_seq_addr sender; 168 struct snd_seq_addr dest; 169 }; 170 171 172 #define SNDRV_SEQ_ADDRESS_UNKNOWN 253 /* unknown source */ 173 #define SNDRV_SEQ_ADDRESS_SUBSCRIBERS 254 /* send event to all subscribed ports */ 174 #define SNDRV_SEQ_ADDRESS_BROADCAST 255 /* send event to all queues/clients/ports/channels */ 175 #define SNDRV_SEQ_QUEUE_DIRECT 253 /* direct dispatch */ 176 177 /* event mode flag - NOTE: only 8 bits available! */ 178 #define SNDRV_SEQ_TIME_STAMP_TICK (0<<0) /* timestamp in clock ticks */ 179 #define SNDRV_SEQ_TIME_STAMP_REAL (1<<0) /* timestamp in real time */ 180 #define SNDRV_SEQ_TIME_STAMP_MASK (1<<0) 181 182 #define SNDRV_SEQ_TIME_MODE_ABS (0<<1) /* absolute timestamp */ 183 #define SNDRV_SEQ_TIME_MODE_REL (1<<1) /* relative to current time */ 184 #define SNDRV_SEQ_TIME_MODE_MASK (1<<1) 185 186 #define SNDRV_SEQ_EVENT_LENGTH_FIXED (0<<2) /* fixed event size */ 187 #define SNDRV_SEQ_EVENT_LENGTH_VARIABLE (1<<2) /* variable event size */ 188 #define SNDRV_SEQ_EVENT_LENGTH_VARUSR (2<<2) /* variable event size - user memory space */ 189 #define SNDRV_SEQ_EVENT_LENGTH_MASK (3<<2) 190 191 #define SNDRV_SEQ_PRIORITY_NORMAL (0<<4) /* normal priority */ 192 #define SNDRV_SEQ_PRIORITY_HIGH (1<<4) /* event should be processed before others */ 193 #define SNDRV_SEQ_PRIORITY_MASK (1<<4) 194 195 196 /* note event */ 197 struct snd_seq_ev_note { 198 unsigned char channel; 199 unsigned char note; 200 unsigned char velocity; 201 unsigned char off_velocity; /* only for SNDRV_SEQ_EVENT_NOTE */ 202 unsigned int duration; /* only for SNDRV_SEQ_EVENT_NOTE */ 203 }; 204 205 /* controller event */ 206 struct snd_seq_ev_ctrl { 207 unsigned char channel; 208 unsigned char unused1, unused2, unused3; /* pad */ 209 unsigned int param; 210 signed int value; 211 }; 212 213 /* generic set of bytes (12x8 bit) */ 214 struct snd_seq_ev_raw8 { 215 unsigned char d[12]; /* 8 bit value */ 216 }; 217 218 /* generic set of integers (3x32 bit) */ 219 struct snd_seq_ev_raw32 { 220 unsigned int d[3]; /* 32 bit value */ 221 }; 222 223 /* external stored data */ 224 #ifndef TARGET_OS2 225 struct snd_seq_ev_ext { 226 unsigned int len; /* length of data */ 227 void *ptr; /* pointer to data (note: maybe 64-bit) */ 228 } __attribute__((packed)); 229 #else 230 #pragma pack(1) 231 struct snd_seq_ev_ext { 232 unsigned int len; /* length of data */ 233 void *ptr; /* pointer to data (note: maybe 64-bit) */ 234 }; 235 #pragma pack() 236 #endif 237 struct snd_seq_result { 238 int event; /* processed event type */ 239 int result; 240 }; 241 242 243 struct snd_seq_real_time { 244 unsigned int tv_sec; /* seconds */ 245 unsigned int tv_nsec; /* nanoseconds */ 246 }; 247 248 typedef unsigned int snd_seq_tick_time_t; /* midi ticks */ 249 250 union snd_seq_timestamp { 251 snd_seq_tick_time_t tick; 252 struct snd_seq_real_time time; 253 }; 254 255 struct snd_seq_queue_skew { 256 unsigned int value; 257 unsigned int base; 258 }; 259 260 /* queue timer control */ 261 struct snd_seq_ev_queue_control { 262 unsigned char queue; /* affected queue */ 263 unsigned char pad[3]; /* reserved */ 264 union { 265 signed int value; /* affected value (e.g. tempo) */ 266 union snd_seq_timestamp time; /* time */ 267 unsigned int position; /* sync position */ 268 struct snd_seq_queue_skew skew; 269 unsigned int d32[2]; 270 unsigned char d8[8]; 271 } param; 272 }; 273 274 /* quoted event - inside the kernel only */ 275 #ifndef TARGET_OS2 276 struct snd_seq_ev_quote { 277 struct snd_seq_addr origin; /* original sender */ 278 unsigned short value; /* optional data */ 279 struct snd_seq_event *event; /* quoted event */ 280 } __attribute__((packed)); 281 #else 282 #pragma pack(1) 283 struct snd_seq_ev_quote { 284 struct snd_seq_addr origin; /* original sender */ 285 unsigned short value; /* optional data */ 286 struct snd_seq_event *event; /* quoted event */ 287 }; 288 #pragma pack() 289 #endif 290 291 /* sequencer event */ 292 struct snd_seq_event { 293 snd_seq_event_type_t type; /* event type */ 294 unsigned char flags; /* event flags */ 295 char tag; 296 297 unsigned char queue; /* schedule queue */ 298 union snd_seq_timestamp time; /* schedule time */ 299 300 301 struct snd_seq_addr source; /* source address */ 302 struct snd_seq_addr dest; /* destination address */ 303 304 union { /* event data... */ 305 struct snd_seq_ev_note note; 306 struct snd_seq_ev_ctrl control; 307 struct snd_seq_ev_raw8 raw8; 308 struct snd_seq_ev_raw32 raw32; 309 struct snd_seq_ev_ext ext; 310 struct snd_seq_ev_queue_control queue; 311 union snd_seq_timestamp time; 312 struct snd_seq_addr addr; 313 struct snd_seq_connect connect; 314 struct snd_seq_result result; 315 struct snd_seq_ev_quote quote; 316 } data; 317 }; 318 319 320 /* 321 * bounce event - stored as variable size data 322 */ 323 struct snd_seq_event_bounce { 324 int err; 325 struct snd_seq_event event; 326 /* external data follows here. */ 327 }; 328 329 #ifdef __KERNEL__ 12 #include <uapi/sound/asequencer.h> 330 13 331 14 /* helper macro */ … … 386 69 #define snd_seq_queue_sync_port(q) ((q) + 16) 387 70 388 #endif /* __KERNEL__ */389 390 /* system information */391 struct snd_seq_system_info {392 int queues; /* maximum queues count */393 int clients; /* maximum clients count */394 int ports; /* maximum ports per client */395 int channels; /* maximum channels per port */396 int cur_clients; /* current clients */397 int cur_queues; /* current queues */398 char reserved[24];399 };400 401 402 /* system running information */403 struct snd_seq_running_info {404 unsigned char client; /* client id */405 unsigned char big_endian; /* 1 = big-endian */406 unsigned char cpu_mode; /* 4 = 32bit, 8 = 64bit */407 unsigned char pad; /* reserved */408 unsigned char reserved[12];409 };410 411 412 /* known client numbers */413 #define SNDRV_SEQ_CLIENT_SYSTEM 0414 /* internal client numbers */415 #define SNDRV_SEQ_CLIENT_DUMMY 14 /* midi through */416 #define SNDRV_SEQ_CLIENT_OSS 15 /* oss sequencer emulator */417 418 419 /* client types */420 typedef int __bitwise snd_seq_client_type_t;421 #define NO_CLIENT ((__force snd_seq_client_type_t) 0)422 #define USER_CLIENT ((__force snd_seq_client_type_t) 1)423 #define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)424 425 /* event filter flags */426 #define SNDRV_SEQ_FILTER_BROADCAST (1<<0) /* accept broadcast messages */427 #define SNDRV_SEQ_FILTER_MULTICAST (1<<1) /* accept multicast messages */428 #define SNDRV_SEQ_FILTER_BOUNCE (1<<2) /* accept bounce event in error */429 #define SNDRV_SEQ_FILTER_USE_EVENT (1<<31) /* use event filter */430 431 struct snd_seq_client_info {432 int client; /* client number to inquire */433 snd_seq_client_type_t type; /* client type */434 char name[64]; /* client name */435 unsigned int filter; /* filter flags */436 unsigned char multicast_filter[8]; /* multicast filter bitmap */437 unsigned char event_filter[32]; /* event filter bitmap */438 int num_ports; /* RO: number of ports */439 int event_lost; /* number of lost events */440 char reserved[64]; /* for future use */441 };442 443 444 /* client pool size */445 struct snd_seq_client_pool {446 int client; /* client number to inquire */447 int output_pool; /* outgoing (write) pool size */448 int input_pool; /* incoming (read) pool size */449 int output_room; /* minimum free pool size for select/blocking mode */450 int output_free; /* unused size */451 int input_free; /* unused size */452 char reserved[64];453 };454 455 456 /* Remove events by specified criteria */457 458 #define SNDRV_SEQ_REMOVE_INPUT (1<<0) /* Flush input queues */459 #define SNDRV_SEQ_REMOVE_OUTPUT (1<<1) /* Flush output queues */460 #define SNDRV_SEQ_REMOVE_DEST (1<<2) /* Restrict by destination q:client:port */461 #define SNDRV_SEQ_REMOVE_DEST_CHANNEL (1<<3) /* Restrict by channel */462 #define SNDRV_SEQ_REMOVE_TIME_BEFORE (1<<4) /* Restrict to before time */463 #define SNDRV_SEQ_REMOVE_TIME_AFTER (1<<5) /* Restrict to time or after */464 #define SNDRV_SEQ_REMOVE_TIME_TICK (1<<6) /* Time is in ticks */465 #define SNDRV_SEQ_REMOVE_EVENT_TYPE (1<<7) /* Restrict to event type */466 #define SNDRV_SEQ_REMOVE_IGNORE_OFF (1<<8) /* Do not flush off events */467 #define SNDRV_SEQ_REMOVE_TAG_MATCH (1<<9) /* Restrict to events with given tag */468 469 struct snd_seq_remove_events {470 unsigned int remove_mode; /* Flags that determine what gets removed */471 472 union snd_seq_timestamp time;473 474 unsigned char queue; /* Queue for REMOVE_DEST */475 struct snd_seq_addr dest; /* Address for REMOVE_DEST */476 unsigned char channel; /* Channel for REMOVE_DEST */477 478 int type; /* For REMOVE_EVENT_TYPE */479 char tag; /* Tag for REMOVE_TAG */480 481 int reserved[10]; /* To allow for future binary compatibility */482 483 };484 485 486 /* known port numbers */487 #define SNDRV_SEQ_PORT_SYSTEM_TIMER 0488 #define SNDRV_SEQ_PORT_SYSTEM_ANNOUNCE 1489 490 /* port capabilities (32 bits) */491 #define SNDRV_SEQ_PORT_CAP_READ (1<<0) /* readable from this port */492 #define SNDRV_SEQ_PORT_CAP_WRITE (1<<1) /* writable to this port */493 494 #define SNDRV_SEQ_PORT_CAP_SYNC_READ (1<<2)495 #define SNDRV_SEQ_PORT_CAP_SYNC_WRITE (1<<3)496 497 #define SNDRV_SEQ_PORT_CAP_DUPLEX (1<<4)498 499 #define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */500 #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */501 #define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */502 503 /* port type */504 #define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */505 #define SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC (1<<1) /* generic MIDI device */506 #define SNDRV_SEQ_PORT_TYPE_MIDI_GM (1<<2) /* General MIDI compatible device */507 #define SNDRV_SEQ_PORT_TYPE_MIDI_GS (1<<3) /* GS compatible device */508 #define SNDRV_SEQ_PORT_TYPE_MIDI_XG (1<<4) /* XG compatible device */509 #define SNDRV_SEQ_PORT_TYPE_MIDI_MT32 (1<<5) /* MT-32 compatible device */510 #define SNDRV_SEQ_PORT_TYPE_MIDI_GM2 (1<<6) /* General MIDI 2 compatible device */511 512 /* other standards...*/513 #define SNDRV_SEQ_PORT_TYPE_SYNTH (1<<10) /* Synth device (no MIDI compatible - direct wavetable) */514 #define SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE (1<<11) /* Sampling device (support sample download) */515 #define SNDRV_SEQ_PORT_TYPE_SAMPLE (1<<12) /* Sampling device (sample can be downloaded at any time) */516 /*...*/517 #define SNDRV_SEQ_PORT_TYPE_HARDWARE (1<<16) /* driver for a hardware device */518 #define SNDRV_SEQ_PORT_TYPE_SOFTWARE (1<<17) /* implemented in software */519 #define SNDRV_SEQ_PORT_TYPE_SYNTHESIZER (1<<18) /* generates sound */520 #define SNDRV_SEQ_PORT_TYPE_PORT (1<<19) /* connects to other device(s) */521 #define SNDRV_SEQ_PORT_TYPE_APPLICATION (1<<20) /* application (sequencer/editor) */522 523 /* misc. conditioning flags */524 #define SNDRV_SEQ_PORT_FLG_GIVEN_PORT (1<<0)525 #define SNDRV_SEQ_PORT_FLG_TIMESTAMP (1<<1)526 #define SNDRV_SEQ_PORT_FLG_TIME_REAL (1<<2)527 528 struct snd_seq_port_info {529 struct snd_seq_addr addr; /* client/port numbers */530 char name[64]; /* port name */531 532 unsigned int capability; /* port capability bits */533 unsigned int type; /* port type bits */534 int midi_channels; /* channels per MIDI port */535 int midi_voices; /* voices per MIDI port */536 int synth_voices; /* voices per SYNTH port */537 538 int read_use; /* R/O: subscribers for output (from this port) */539 int write_use; /* R/O: subscribers for input (to this port) */540 541 void *kernel; /* reserved for kernel use (must be NULL) */542 unsigned int flags; /* misc. conditioning */543 unsigned char time_queue; /* queue # for timestamping */544 char reserved[59]; /* for future use */545 };546 547 548 /* queue flags */549 #define SNDRV_SEQ_QUEUE_FLG_SYNC (1<<0) /* sync enabled */550 551 /* queue information */552 struct snd_seq_queue_info {553 int queue; /* queue id */554 555 /*556 * security settings, only owner of this queue can start/stop timer557 * etc. if the queue is locked for other clients558 */559 int owner; /* client id for owner of the queue */560 unsigned locked:1; /* timing queue locked for other queues */561 char name[64]; /* name of this queue */562 unsigned int flags; /* flags */563 char reserved[60]; /* for future use */564 565 };566 567 /* queue info/status */568 struct snd_seq_queue_status {569 int queue; /* queue id */570 int events; /* read-only - queue size */571 snd_seq_tick_time_t tick; /* current tick */572 struct snd_seq_real_time time; /* current time */573 int running; /* running state of queue */574 int flags; /* various flags */575 char reserved[64]; /* for the future */576 };577 578 579 /* queue tempo */580 struct snd_seq_queue_tempo {581 int queue; /* sequencer queue */582 unsigned int tempo; /* current tempo, us/tick */583 int ppq; /* time resolution, ticks/quarter */584 unsigned int skew_value; /* queue skew */585 unsigned int skew_base; /* queue skew base */586 char reserved[24]; /* for the future */587 };588 589 590 /* sequencer timer sources */591 #define SNDRV_SEQ_TIMER_ALSA 0 /* ALSA timer */592 #define SNDRV_SEQ_TIMER_MIDI_CLOCK 1 /* Midi Clock (CLOCK event) */593 #define SNDRV_SEQ_TIMER_MIDI_TICK 2 /* Midi Timer Tick (TICK event) */594 595 /* queue timer info */596 struct snd_seq_queue_timer {597 int queue; /* sequencer queue */598 int type; /* source timer type */599 union {600 struct {601 struct snd_timer_id id; /* ALSA's timer ID */602 unsigned int resolution; /* resolution in Hz */603 } alsa;604 } u;605 char reserved[64]; /* for the future use */606 };607 608 609 struct snd_seq_queue_client {610 int queue; /* sequencer queue */611 int client; /* sequencer client */612 int used; /* queue is used with this client613 (must be set for accepting events) */614 /* per client watermarks */615 char reserved[64]; /* for future use */616 };617 618 619 #define SNDRV_SEQ_PORT_SUBS_EXCLUSIVE (1<<0) /* exclusive connection */620 #define SNDRV_SEQ_PORT_SUBS_TIMESTAMP (1<<1)621 #define SNDRV_SEQ_PORT_SUBS_TIME_REAL (1<<2)622 623 struct snd_seq_port_subscribe {624 struct snd_seq_addr sender; /* sender address */625 struct snd_seq_addr dest; /* destination address */626 unsigned int voices; /* number of voices to be allocated (0 = don't care) */627 unsigned int flags; /* modes */628 unsigned char queue; /* input time-stamp queue (optional) */629 unsigned char pad[3]; /* reserved */630 char reserved[64];631 };632 633 /* type of query subscription */634 #define SNDRV_SEQ_QUERY_SUBS_READ 0635 #define SNDRV_SEQ_QUERY_SUBS_WRITE 1636 637 struct snd_seq_query_subs {638 struct snd_seq_addr root; /* client/port id to be searched */639 int type; /* READ or WRITE */640 int index; /* 0..N-1 */641 int num_subs; /* R/O: number of subscriptions on this port */642 struct snd_seq_addr addr; /* R/O: result */643 unsigned char queue; /* R/O: result */644 unsigned int flags; /* R/O: result */645 char reserved[64]; /* for future use */646 };647 648 649 /*650 * IOCTL commands651 */652 653 #define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)654 #define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)655 #define SNDRV_SEQ_IOCTL_SYSTEM_INFO _IOWR('S', 0x02, struct snd_seq_system_info)656 #define SNDRV_SEQ_IOCTL_RUNNING_MODE _IOWR('S', 0x03, struct snd_seq_running_info)657 658 #define SNDRV_SEQ_IOCTL_GET_CLIENT_INFO _IOWR('S', 0x10, struct snd_seq_client_info)659 #define SNDRV_SEQ_IOCTL_SET_CLIENT_INFO _IOW ('S', 0x11, struct snd_seq_client_info)660 661 #define SNDRV_SEQ_IOCTL_CREATE_PORT _IOWR('S', 0x20, struct snd_seq_port_info)662 #define SNDRV_SEQ_IOCTL_DELETE_PORT _IOW ('S', 0x21, struct snd_seq_port_info)663 #define SNDRV_SEQ_IOCTL_GET_PORT_INFO _IOWR('S', 0x22, struct snd_seq_port_info)664 #define SNDRV_SEQ_IOCTL_SET_PORT_INFO _IOW ('S', 0x23, struct snd_seq_port_info)665 666 #define SNDRV_SEQ_IOCTL_SUBSCRIBE_PORT _IOW ('S', 0x30, struct snd_seq_port_subscribe)667 #define SNDRV_SEQ_IOCTL_UNSUBSCRIBE_PORT _IOW ('S', 0x31, struct snd_seq_port_subscribe)668 669 #define SNDRV_SEQ_IOCTL_CREATE_QUEUE _IOWR('S', 0x32, struct snd_seq_queue_info)670 #define SNDRV_SEQ_IOCTL_DELETE_QUEUE _IOW ('S', 0x33, struct snd_seq_queue_info)671 #define SNDRV_SEQ_IOCTL_GET_QUEUE_INFO _IOWR('S', 0x34, struct snd_seq_queue_info)672 #define SNDRV_SEQ_IOCTL_SET_QUEUE_INFO _IOWR('S', 0x35, struct snd_seq_queue_info)673 #define SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE _IOWR('S', 0x36, struct snd_seq_queue_info)674 #define SNDRV_SEQ_IOCTL_GET_QUEUE_STATUS _IOWR('S', 0x40, struct snd_seq_queue_status)675 #define SNDRV_SEQ_IOCTL_GET_QUEUE_TEMPO _IOWR('S', 0x41, struct snd_seq_queue_tempo)676 #define SNDRV_SEQ_IOCTL_SET_QUEUE_TEMPO _IOW ('S', 0x42, struct snd_seq_queue_tempo)677 #define SNDRV_SEQ_IOCTL_GET_QUEUE_OWNER _IOWR('S', 0x43, struct snd_seq_queue_owner)678 #define SNDRV_SEQ_IOCTL_SET_QUEUE_OWNER _IOW ('S', 0x44, struct snd_seq_queue_owner)679 #define SNDRV_SEQ_IOCTL_GET_QUEUE_TIMER _IOWR('S', 0x45, struct snd_seq_queue_timer)680 #define SNDRV_SEQ_IOCTL_SET_QUEUE_TIMER _IOW ('S', 0x46, struct snd_seq_queue_timer)681 /* XXX682 #define SNDRV_SEQ_IOCTL_GET_QUEUE_SYNC _IOWR('S', 0x53, struct snd_seq_queue_sync)683 #define SNDRV_SEQ_IOCTL_SET_QUEUE_SYNC _IOW ('S', 0x54, struct snd_seq_queue_sync)684 */685 #define SNDRV_SEQ_IOCTL_GET_QUEUE_CLIENT _IOWR('S', 0x49, struct snd_seq_queue_client)686 #define SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT _IOW ('S', 0x4a, struct snd_seq_queue_client)687 #define SNDRV_SEQ_IOCTL_GET_CLIENT_POOL _IOWR('S', 0x4b, struct snd_seq_client_pool)688 #define SNDRV_SEQ_IOCTL_SET_CLIENT_POOL _IOW ('S', 0x4c, struct snd_seq_client_pool)689 #define SNDRV_SEQ_IOCTL_REMOVE_EVENTS _IOW ('S', 0x4e, struct snd_seq_remove_events)690 #define SNDRV_SEQ_IOCTL_QUERY_SUBS _IOWR('S', 0x4f, struct snd_seq_query_subs)691 #define SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION _IOWR('S', 0x50, struct snd_seq_port_subscribe)692 #define SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT _IOWR('S', 0x51, struct snd_seq_client_info)693 #define SNDRV_SEQ_IOCTL_QUERY_NEXT_PORT _IOWR('S', 0x52, struct snd_seq_port_info)694 695 71 #endif /* __SOUND_ASEQUENCER_H */ -
GPL/trunk/alsa-kernel/include/sound/asound.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * Advanced Linux Sound Architecture - ALSA - Driver 3 4 * Copyright (c) 1994-2003 by Jaroslav Kysela <perex@perex.cz>, 4 5 * Abramo Bagnara <abramo@alsa-project.org> 5 *6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 *21 6 */ 22 23 7 #ifndef __SOUND_ASOUND_H 24 8 #define __SOUND_ASOUND_H 25 9 26 #include <linux/types.h>27 28 #ifdef __KERNEL__29 10 #include <linux/ioctl.h> 30 11 #include <linux/time.h> 31 12 #include <asm/byteorder.h> 13 32 14 #ifdef __LITTLE_ENDIAN 33 15 #define SNDRV_LITTLE_ENDIAN … … 40 22 #endif 41 23 42 #endif /* __KERNEL__ **/ 43 44 #ifndef __force 45 #define __force 46 #endif 47 48 #ifndef __bitwise 49 #define __bitwise 50 #endif 51 52 #ifdef TARGET_OS2 53 #define SNDRV_PCM_VOL_FRONT_LEFT 0 54 #define SNDRV_PCM_VOL_FRONT_RIGHT 1 55 #define SNDRV_PCM_VOL_REAR_LEFT 2 56 #define SNDRV_PCM_VOL_REAR_RIGHT 3 57 #define SNDRV_PCM_VOL_CENTER 4 58 #define SNDRV_PCM_VOL_LFE 5 59 60 #define SNDRV_PCM_VOL_MAX 100 61 62 struct snd_pcm_volume { 63 int nrchannels; 64 int volume[6]; 65 }; 66 #endif 67 68 /* 69 * protocol version 70 */ 71 72 #define SNDRV_PROTOCOL_VERSION(major, minor, subminor) (((major)<<16)|((minor)<<8)|(subminor)) 73 #define SNDRV_PROTOCOL_MAJOR(version) (((version)>>16)&0xffff) 74 #define SNDRV_PROTOCOL_MINOR(version) (((version)>>8)&0xff) 75 #define SNDRV_PROTOCOL_MICRO(version) ((version)&0xff) 76 #define SNDRV_PROTOCOL_INCOMPATIBLE(kversion, uversion) \ 77 (SNDRV_PROTOCOL_MAJOR(kversion) != SNDRV_PROTOCOL_MAJOR(uversion) || \ 78 (SNDRV_PROTOCOL_MAJOR(kversion) == SNDRV_PROTOCOL_MAJOR(uversion) && \ 79 SNDRV_PROTOCOL_MINOR(kversion) != SNDRV_PROTOCOL_MINOR(uversion))) 80 81 /**************************************************************************** 82 * * 83 * Digital audio interface * 84 * * 85 ****************************************************************************/ 86 87 struct snd_aes_iec958 { 88 unsigned char status[24]; /* AES/IEC958 channel status bits */ 89 unsigned char subcode[147]; /* AES/IEC958 subcode bits */ 90 unsigned char pad; /* nothing */ 91 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */ 92 }; 93 94 /**************************************************************************** 95 * * 96 * Section for driver hardware dependent interface - /dev/snd/hw? * 97 * * 98 ****************************************************************************/ 99 100 #define SNDRV_HWDEP_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1) 101 102 enum { 103 SNDRV_HWDEP_IFACE_OPL2 = 0, 104 SNDRV_HWDEP_IFACE_OPL3, 105 SNDRV_HWDEP_IFACE_OPL4, 106 SNDRV_HWDEP_IFACE_SB16CSP, /* Creative Signal Processor */ 107 SNDRV_HWDEP_IFACE_EMU10K1, /* FX8010 processor in EMU10K1 chip */ 108 SNDRV_HWDEP_IFACE_YSS225, /* Yamaha FX processor */ 109 SNDRV_HWDEP_IFACE_ICS2115, /* Wavetable synth */ 110 SNDRV_HWDEP_IFACE_SSCAPE, /* Ensoniq SoundScape ISA card (MC68EC000) */ 111 SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */ 112 SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */ 113 SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */ 114 SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */ 115 SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */ 116 SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */ 117 SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */ 118 SNDRV_HWDEP_IFACE_SB_RC, /* SB Extigy/Audigy2NX remote control */ 119 SNDRV_HWDEP_IFACE_HDA, /* HD-audio */ 120 SNDRV_HWDEP_IFACE_USB_STREAM, /* direct access to usb stream */ 121 122 /* Don't forget to change the following: */ 123 SNDRV_HWDEP_IFACE_LAST = SNDRV_HWDEP_IFACE_USB_STREAM 124 }; 125 126 struct snd_hwdep_info { 127 unsigned int device; /* WR: device number */ 128 int card; /* R: card number */ 129 unsigned char id[64]; /* ID (user selectable) */ 130 unsigned char name[80]; /* hwdep name */ 131 int iface; /* hwdep interface */ 132 unsigned char reserved[64]; /* reserved for future */ 133 }; 134 135 /* generic DSP loader */ 136 struct snd_hwdep_dsp_status { 137 unsigned int version; /* R: driver-specific version */ 138 unsigned char id[32]; /* R: driver-specific ID string */ 139 unsigned int num_dsps; /* R: number of DSP images to transfer */ 140 unsigned int dsp_loaded; /* R: bit flags indicating the loaded DSPs */ 141 unsigned int chip_ready; /* R: 1 = initialization finished */ 142 unsigned char reserved[16]; /* reserved for future use */ 143 }; 144 145 struct snd_hwdep_dsp_image { 146 unsigned int index; /* W: DSP index */ 147 unsigned char name[64]; /* W: ID (e.g. file name) */ 148 unsigned char __user *image; /* W: binary image */ 149 size_t length; /* W: size of image in bytes */ 150 unsigned long driver_data; /* W: driver-specific data */ 151 }; 152 153 #define SNDRV_HWDEP_IOCTL_PVERSION _IOR ('H', 0x00, int) 154 #define SNDRV_HWDEP_IOCTL_INFO _IOR ('H', 0x01, struct snd_hwdep_info) 155 #define SNDRV_HWDEP_IOCTL_DSP_STATUS _IOR('H', 0x02, struct snd_hwdep_dsp_status) 156 #define SNDRV_HWDEP_IOCTL_DSP_LOAD _IOW('H', 0x03, struct snd_hwdep_dsp_image) 157 158 /***************************************************************************** 159 * * 160 * Digital Audio (PCM) interface - /dev/snd/pcm?? * 161 * * 162 *****************************************************************************/ 163 164 #define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 10) 165 166 typedef unsigned long snd_pcm_uframes_t; 167 typedef signed long snd_pcm_sframes_t; 168 169 enum { 170 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */ 171 SNDRV_PCM_CLASS_MULTI, /* multichannel device */ 172 SNDRV_PCM_CLASS_MODEM, /* software modem class */ 173 SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */ 174 /* Don't forget to change the following: */ 175 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER, 176 }; 177 178 enum { 179 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */ 180 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */ 181 /* Don't forget to change the following: */ 182 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX, 183 }; 184 185 enum { 186 SNDRV_PCM_STREAM_PLAYBACK = 0, 187 SNDRV_PCM_STREAM_CAPTURE, 188 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE, 189 }; 190 191 typedef int __bitwise snd_pcm_access_t; 192 #define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */ 193 #define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */ 194 #define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */ 195 #define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */ 196 #define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */ 197 #define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED 198 199 typedef int __bitwise snd_pcm_format_t; 200 #define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0) 201 #define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1) 202 #define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2) 203 #define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3) 204 #define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4) 205 #define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5) 206 #define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */ 207 #define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */ 208 #define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */ 209 #define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */ 210 #define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10) 211 #define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11) 212 #define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12) 213 #define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13) 214 #define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 215 #define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */ 216 #define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 217 #define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */ 218 #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */ 219 #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */ 220 #define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20) 221 #define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21) 222 #define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22) 223 #define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23) 224 #define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24) 225 #define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31) 226 #define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */ 227 #define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */ 228 #define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */ 229 #define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */ 230 #define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */ 231 #define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */ 232 #define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */ 233 #define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */ 234 #define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */ 235 #define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ 236 #define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ 237 #define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */ 238 #define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */ 239 #define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */ 240 #define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */ 241 #define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */ 242 #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B 243 244 #ifdef SNDRV_LITTLE_ENDIAN 245 #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE 246 #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_LE 247 #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_LE 248 #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_LE 249 #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_LE 250 #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_LE 251 #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_LE 252 #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_LE 253 #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE 254 #endif 255 #ifdef SNDRV_BIG_ENDIAN 256 #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_BE 257 #define SNDRV_PCM_FORMAT_U16 SNDRV_PCM_FORMAT_U16_BE 258 #define SNDRV_PCM_FORMAT_S24 SNDRV_PCM_FORMAT_S24_BE 259 #define SNDRV_PCM_FORMAT_U24 SNDRV_PCM_FORMAT_U24_BE 260 #define SNDRV_PCM_FORMAT_S32 SNDRV_PCM_FORMAT_S32_BE 261 #define SNDRV_PCM_FORMAT_U32 SNDRV_PCM_FORMAT_U32_BE 262 #define SNDRV_PCM_FORMAT_FLOAT SNDRV_PCM_FORMAT_FLOAT_BE 263 #define SNDRV_PCM_FORMAT_FLOAT64 SNDRV_PCM_FORMAT_FLOAT64_BE 264 #define SNDRV_PCM_FORMAT_IEC958_SUBFRAME SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE 265 #endif 266 267 typedef int __bitwise snd_pcm_subformat_t; 268 #define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0) 269 #define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_STD 270 271 #define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */ 272 #define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */ 273 #define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */ 274 #define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */ 275 #define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */ 276 #define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */ 277 #define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */ 278 #define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */ 279 #define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */ 280 #define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */ 281 #define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */ 282 #define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ 283 #define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 284 #define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 285 #define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000 /* period wakeup can be disabled */ 286 #define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */ 287 288 typedef int __bitwise snd_pcm_state_t; 289 #define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ 290 #define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */ 291 #define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */ 292 #define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */ 293 #define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */ 294 #define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */ 295 #define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */ 296 #define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */ 297 #define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */ 298 #define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED 299 300 enum { 301 SNDRV_PCM_MMAP_OFFSET_DATA = 0x00000000, 302 SNDRV_PCM_MMAP_OFFSET_STATUS = 0x80000000, 303 SNDRV_PCM_MMAP_OFFSET_CONTROL = 0x81000000, 304 }; 305 306 union snd_pcm_sync_id { 307 unsigned char id[16]; 308 unsigned short id16[8]; 309 unsigned int id32[4]; 310 }; 311 312 struct snd_pcm_info { 313 unsigned int device; /* RO/WR (control): device number */ 314 unsigned int subdevice; /* RO/WR (control): subdevice number */ 315 int stream; /* RO/WR (control): stream direction */ 316 int card; /* R: card number */ 317 unsigned char id[64]; /* ID (user selectable) */ 318 unsigned char name[80]; /* name of this device */ 319 unsigned char subname[32]; /* subdevice name */ 320 int dev_class; /* SNDRV_PCM_CLASS_* */ 321 int dev_subclass; /* SNDRV_PCM_SUBCLASS_* */ 322 unsigned int subdevices_count; 323 unsigned int subdevices_avail; 324 union snd_pcm_sync_id sync; /* hardware synchronization ID */ 325 unsigned char reserved[64]; /* reserved for future... */ 326 }; 327 328 typedef int snd_pcm_hw_param_t; 329 #define SNDRV_PCM_HW_PARAM_ACCESS 0 /* Access type */ 330 #ifdef TARGET_OS2 331 #define SNDRV_PCM_HW_PARAM_RATE_MASK 1 /* Format */ 332 #endif 333 #define SNDRV_PCM_HW_PARAM_FORMAT 2 /* Format */ 334 #define SNDRV_PCM_HW_PARAM_SUBFORMAT 3 /* Subformat */ 335 #define SNDRV_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_ACCESS 336 #define SNDRV_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_SUBFORMAT 337 338 #define SNDRV_PCM_HW_PARAM_SAMPLE_BITS 8 /* Bits per sample */ 339 #define SNDRV_PCM_HW_PARAM_FRAME_BITS 9 /* Bits per frame */ 340 #define SNDRV_PCM_HW_PARAM_CHANNELS 10 /* Channels */ 341 #define SNDRV_PCM_HW_PARAM_RATE 11 /* Approx rate */ 342 #define SNDRV_PCM_HW_PARAM_PERIOD_TIME 12 /* Approx distance between 343 * interrupts in us 344 */ 345 #define SNDRV_PCM_HW_PARAM_PERIOD_SIZE 13 /* Approx frames between 346 * interrupts 347 */ 348 #define SNDRV_PCM_HW_PARAM_PERIOD_BYTES 14 /* Approx bytes between 349 * interrupts 350 */ 351 #define SNDRV_PCM_HW_PARAM_PERIODS 15 /* Approx interrupts per 352 * buffer 353 */ 354 #define SNDRV_PCM_HW_PARAM_BUFFER_TIME 16 /* Approx duration of buffer 355 * in us 356 */ 357 #define SNDRV_PCM_HW_PARAM_BUFFER_SIZE 17 /* Size of buffer in frames */ 358 #define SNDRV_PCM_HW_PARAM_BUFFER_BYTES 18 /* Size of buffer in bytes */ 359 #define SNDRV_PCM_HW_PARAM_TICK_TIME 19 /* Approx tick duration in us */ 360 #define SNDRV_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_SAMPLE_BITS 361 #define SNDRV_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_TICK_TIME 362 363 #define SNDRV_PCM_HW_PARAMS_NORESAMPLE (1<<0) /* avoid rate resampling */ 364 #define SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER (1<<1) /* export buffer */ 365 #define SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP (1<<2) /* disable period wakeups */ 366 367 struct snd_interval { 368 unsigned int min, max; 369 unsigned int openmin:1, 370 openmax:1, 371 integer:1, 372 empty:1; 373 }; 374 375 #define SNDRV_MASK_MAX 256 376 377 struct snd_mask { 378 __u32 bits[(SNDRV_MASK_MAX+31)/32]; 379 }; 380 381 struct snd_pcm_hw_params { 382 unsigned int flags; 383 struct snd_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK - 384 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1]; 385 struct snd_mask mres[5]; /* reserved masks */ 386 struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL - 387 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1]; 388 struct snd_interval ires[9]; /* reserved intervals */ 389 unsigned int rmask; /* W: requested masks */ 390 unsigned int cmask; /* R: changed masks */ 391 unsigned int info; /* R: Info flags for returned setup */ 392 unsigned int msbits; /* R: used most significant bits */ 393 unsigned int rate_num; /* R: rate numerator */ 394 unsigned int rate_den; /* R: rate denominator */ 395 snd_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */ 396 unsigned char reserved[64]; /* reserved for future */ 397 }; 398 399 enum { 400 SNDRV_PCM_TSTAMP_NONE = 0, 401 SNDRV_PCM_TSTAMP_ENABLE, 402 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_ENABLE, 403 }; 404 405 struct snd_pcm_sw_params { 406 int tstamp_mode; /* timestamp mode */ 407 unsigned int period_step; 408 unsigned int sleep_min; /* min ticks to sleep */ 409 snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */ 410 snd_pcm_uframes_t xfer_align; /* obsolete: xfer size need to be a multiple */ 411 snd_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */ 412 snd_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */ 413 snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */ 414 snd_pcm_uframes_t silence_size; /* silence block size */ 415 snd_pcm_uframes_t boundary; /* pointers wrap point */ 416 unsigned char reserved[64]; /* reserved for future */ 417 }; 418 419 struct snd_pcm_channel_info { 420 unsigned int channel; 421 __kernel_off_t offset; /* mmap offset */ 422 unsigned int first; /* offset to first sample in bits */ 423 unsigned int step; /* samples distance in bits */ 424 }; 425 426 struct snd_pcm_status { 427 snd_pcm_state_t state; /* stream state */ 428 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */ 429 struct timespec tstamp; /* reference timestamp */ 430 snd_pcm_uframes_t appl_ptr; /* appl ptr */ 431 snd_pcm_uframes_t hw_ptr; /* hw ptr */ 432 snd_pcm_sframes_t delay; /* current delay in frames */ 433 snd_pcm_uframes_t avail; /* number of frames available */ 434 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 435 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 436 snd_pcm_state_t suspended_state; /* suspended stream state */ 437 unsigned char reserved[60]; /* must be filled with zero */ 438 }; 439 440 struct snd_pcm_mmap_status { 441 snd_pcm_state_t state; /* RO: state - SNDRV_PCM_STATE_XXXX */ 442 int pad1; /* Needed for 64 bit alignment */ 443 snd_pcm_uframes_t hw_ptr; /* RO: hw ptr (0...boundary-1) */ 444 struct timespec tstamp; /* Timestamp */ 445 snd_pcm_state_t suspended_state; /* RO: suspended stream state */ 446 }; 447 448 struct snd_pcm_mmap_control { 449 snd_pcm_uframes_t appl_ptr; /* RW: appl ptr (0...boundary-1) */ 450 snd_pcm_uframes_t avail_min; /* RW: min available frames for wakeup */ 451 }; 452 453 #define SNDRV_PCM_SYNC_PTR_HWSYNC (1<<0) /* execute hwsync */ 454 #define SNDRV_PCM_SYNC_PTR_APPL (1<<1) /* get appl_ptr from driver (r/w op) */ 455 #define SNDRV_PCM_SYNC_PTR_AVAIL_MIN (1<<2) /* get avail_min from driver */ 456 457 struct snd_pcm_sync_ptr { 458 unsigned int flags; 459 union { 460 struct snd_pcm_mmap_status status; 461 unsigned char reserved[64]; 462 } s; 463 union { 464 struct snd_pcm_mmap_control control; 465 unsigned char reserved[64]; 466 } c; 467 }; 468 469 struct snd_xferi { 470 snd_pcm_sframes_t result; 471 void __user *buf; 472 snd_pcm_uframes_t frames; 473 }; 474 475 struct snd_xfern { 476 snd_pcm_sframes_t result; 477 void __user * __user *bufs; 478 snd_pcm_uframes_t frames; 479 }; 480 481 enum { 482 SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ 483 SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ 484 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 485 }; 486 487 #define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) 488 #define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) 489 #define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) 490 #define SNDRV_PCM_IOCTL_TTSTAMP _IOW('A', 0x03, int) 491 #define SNDRV_PCM_IOCTL_HW_REFINE _IOWR('A', 0x10, struct snd_pcm_hw_params) 492 #define SNDRV_PCM_IOCTL_HW_PARAMS _IOWR('A', 0x11, struct snd_pcm_hw_params) 493 #define SNDRV_PCM_IOCTL_HW_FREE _IO('A', 0x12) 494 #define SNDRV_PCM_IOCTL_SW_PARAMS _IOWR('A', 0x13, struct snd_pcm_sw_params) 495 #define SNDRV_PCM_IOCTL_STATUS _IOR('A', 0x20, struct snd_pcm_status) 496 #define SNDRV_PCM_IOCTL_DELAY _IOR('A', 0x21, snd_pcm_sframes_t) 497 #define SNDRV_PCM_IOCTL_HWSYNC _IO('A', 0x22) 498 #define SNDRV_PCM_IOCTL_SYNC_PTR _IOWR('A', 0x23, struct snd_pcm_sync_ptr) 499 #define SNDRV_PCM_IOCTL_CHANNEL_INFO _IOR('A', 0x32, struct snd_pcm_channel_info) 500 #define SNDRV_PCM_IOCTL_PREPARE _IO('A', 0x40) 501 #define SNDRV_PCM_IOCTL_RESET _IO('A', 0x41) 502 #define SNDRV_PCM_IOCTL_START _IO('A', 0x42) 503 #define SNDRV_PCM_IOCTL_DROP _IO('A', 0x43) 504 #define SNDRV_PCM_IOCTL_DRAIN _IO('A', 0x44) 505 #define SNDRV_PCM_IOCTL_PAUSE _IOW('A', 0x45, int) 506 #define SNDRV_PCM_IOCTL_REWIND _IOW('A', 0x46, snd_pcm_uframes_t) 507 #define SNDRV_PCM_IOCTL_RESUME _IO('A', 0x47) 508 #define SNDRV_PCM_IOCTL_XRUN _IO('A', 0x48) 509 #define SNDRV_PCM_IOCTL_FORWARD _IOW('A', 0x49, snd_pcm_uframes_t) 510 #define SNDRV_PCM_IOCTL_WRITEI_FRAMES _IOW('A', 0x50, struct snd_xferi) 511 #define SNDRV_PCM_IOCTL_READI_FRAMES _IOR('A', 0x51, struct snd_xferi) 512 #define SNDRV_PCM_IOCTL_WRITEN_FRAMES _IOW('A', 0x52, struct snd_xfern) 513 #define SNDRV_PCM_IOCTL_READN_FRAMES _IOR('A', 0x53, struct snd_xfern) 514 #define SNDRV_PCM_IOCTL_LINK _IOW('A', 0x60, int) 515 #define SNDRV_PCM_IOCTL_UNLINK _IO('A', 0x61) 516 517 /***************************************************************************** 518 * * 519 * MIDI v1.0 interface * 520 * * 521 *****************************************************************************/ 522 523 /* 524 * Raw MIDI section - /dev/snd/midi?? 525 */ 526 527 #define SNDRV_RAWMIDI_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 0) 528 529 enum { 530 SNDRV_RAWMIDI_STREAM_OUTPUT = 0, 531 SNDRV_RAWMIDI_STREAM_INPUT, 532 SNDRV_RAWMIDI_STREAM_LAST = SNDRV_RAWMIDI_STREAM_INPUT, 533 }; 534 535 #define SNDRV_RAWMIDI_INFO_OUTPUT 0x00000001 536 #define SNDRV_RAWMIDI_INFO_INPUT 0x00000002 537 #define SNDRV_RAWMIDI_INFO_DUPLEX 0x00000004 538 539 struct snd_rawmidi_info { 540 unsigned int device; /* RO/WR (control): device number */ 541 unsigned int subdevice; /* RO/WR (control): subdevice number */ 542 int stream; /* WR: stream */ 543 int card; /* R: card number */ 544 unsigned int flags; /* SNDRV_RAWMIDI_INFO_XXXX */ 545 unsigned char id[64]; /* ID (user selectable) */ 546 unsigned char name[80]; /* name of device */ 547 unsigned char subname[32]; /* name of active or selected subdevice */ 548 unsigned int subdevices_count; 549 unsigned int subdevices_avail; 550 unsigned char reserved[64]; /* reserved for future use */ 551 }; 552 553 struct snd_rawmidi_params { 554 int stream; 555 size_t buffer_size; /* queue size in bytes */ 556 size_t avail_min; /* minimum avail bytes for wakeup */ 557 unsigned int no_active_sensing: 1; /* do not send active sensing byte in close() */ 558 unsigned char reserved[16]; /* reserved for future use */ 559 }; 560 561 struct snd_rawmidi_status { 562 int stream; 563 struct timespec tstamp; /* Timestamp */ 564 size_t avail; /* available bytes */ 565 size_t xruns; /* count of overruns since last status (in bytes) */ 566 unsigned char reserved[16]; /* reserved for future use */ 567 }; 568 569 #define SNDRV_RAWMIDI_IOCTL_PVERSION _IOR('W', 0x00, int) 570 #define SNDRV_RAWMIDI_IOCTL_INFO _IOR('W', 0x01, struct snd_rawmidi_info) 571 #define SNDRV_RAWMIDI_IOCTL_PARAMS _IOWR('W', 0x10, struct snd_rawmidi_params) 572 #define SNDRV_RAWMIDI_IOCTL_STATUS _IOWR('W', 0x20, struct snd_rawmidi_status) 573 #define SNDRV_RAWMIDI_IOCTL_DROP _IOW('W', 0x30, int) 574 #define SNDRV_RAWMIDI_IOCTL_DRAIN _IOW('W', 0x31, int) 575 576 /* 577 * Timer section - /dev/snd/timer 578 */ 579 580 #define SNDRV_TIMER_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) 581 582 enum { 583 SNDRV_TIMER_CLASS_NONE = -1, 584 SNDRV_TIMER_CLASS_SLAVE = 0, 585 SNDRV_TIMER_CLASS_GLOBAL, 586 SNDRV_TIMER_CLASS_CARD, 587 SNDRV_TIMER_CLASS_PCM, 588 SNDRV_TIMER_CLASS_LAST = SNDRV_TIMER_CLASS_PCM, 589 }; 590 591 /* slave timer classes */ 592 enum { 593 SNDRV_TIMER_SCLASS_NONE = 0, 594 SNDRV_TIMER_SCLASS_APPLICATION, 595 SNDRV_TIMER_SCLASS_SEQUENCER, /* alias */ 596 SNDRV_TIMER_SCLASS_OSS_SEQUENCER, /* alias */ 597 SNDRV_TIMER_SCLASS_LAST = SNDRV_TIMER_SCLASS_OSS_SEQUENCER, 598 }; 599 600 /* global timers (device member) */ 601 #define SNDRV_TIMER_GLOBAL_SYSTEM 0 602 #define SNDRV_TIMER_GLOBAL_RTC 1 603 #define SNDRV_TIMER_GLOBAL_HPET 2 604 #define SNDRV_TIMER_GLOBAL_HRTIMER 3 605 606 /* info flags */ 607 #define SNDRV_TIMER_FLG_SLAVE (1<<0) /* cannot be controlled */ 608 609 struct snd_timer_id { 610 int dev_class; 611 int dev_sclass; 612 int card; 613 int device; 614 int subdevice; 615 }; 616 617 struct snd_timer_ginfo { 618 struct snd_timer_id tid; /* requested timer ID */ 619 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 620 int card; /* card number */ 621 unsigned char id[64]; /* timer identification */ 622 unsigned char name[80]; /* timer name */ 623 unsigned long reserved0; /* reserved for future use */ 624 unsigned long resolution; /* average period resolution in ns */ 625 unsigned long resolution_min; /* minimal period resolution in ns */ 626 unsigned long resolution_max; /* maximal period resolution in ns */ 627 unsigned int clients; /* active timer clients */ 628 unsigned char reserved[32]; 629 }; 630 631 struct snd_timer_gparams { 632 struct snd_timer_id tid; /* requested timer ID */ 633 unsigned long period_num; /* requested precise period duration (in seconds) - numerator */ 634 unsigned long period_den; /* requested precise period duration (in seconds) - denominator */ 635 unsigned char reserved[32]; 636 }; 637 638 struct snd_timer_gstatus { 639 struct snd_timer_id tid; /* requested timer ID */ 640 unsigned long resolution; /* current period resolution in ns */ 641 unsigned long resolution_num; /* precise current period resolution (in seconds) - numerator */ 642 unsigned long resolution_den; /* precise current period resolution (in seconds) - denominator */ 643 unsigned char reserved[32]; 644 }; 645 646 struct snd_timer_select { 647 struct snd_timer_id id; /* bind to timer ID */ 648 unsigned char reserved[32]; /* reserved */ 649 }; 650 651 struct snd_timer_info { 652 unsigned int flags; /* timer flags - SNDRV_TIMER_FLG_* */ 653 int card; /* card number */ 654 unsigned char id[64]; /* timer identificator */ 655 unsigned char name[80]; /* timer name */ 656 unsigned long reserved0; /* reserved for future use */ 657 unsigned long resolution; /* average period resolution in ns */ 658 unsigned char reserved[64]; /* reserved */ 659 }; 660 661 #define SNDRV_TIMER_PSFLG_AUTO (1<<0) /* auto start, otherwise one-shot */ 662 #define SNDRV_TIMER_PSFLG_EXCLUSIVE (1<<1) /* exclusive use, precise start/stop/pause/continue */ 663 #define SNDRV_TIMER_PSFLG_EARLY_EVENT (1<<2) /* write early event to the poll queue */ 664 665 struct snd_timer_params { 666 unsigned int flags; /* flags - SNDRV_MIXER_PSFLG_* */ 667 unsigned int ticks; /* requested resolution in ticks */ 668 unsigned int queue_size; /* total size of queue (32-1024) */ 669 unsigned int reserved0; /* reserved, was: failure locations */ 670 unsigned int filter; /* event filter (bitmask of SNDRV_TIMER_EVENT_*) */ 671 unsigned char reserved[60]; /* reserved */ 672 }; 673 674 struct snd_timer_status { 675 struct timespec tstamp; /* Timestamp - last update */ 676 unsigned int resolution; /* current period resolution in ns */ 677 unsigned int lost; /* counter of master tick lost */ 678 unsigned int overrun; /* count of read queue overruns */ 679 unsigned int queue; /* used queue size */ 680 unsigned char reserved[64]; /* reserved */ 681 }; 682 683 #define SNDRV_TIMER_IOCTL_PVERSION _IOR('T', 0x00, int) 684 #define SNDRV_TIMER_IOCTL_NEXT_DEVICE _IOWR('T', 0x01, struct snd_timer_id) 685 #define SNDRV_TIMER_IOCTL_TREAD _IOW('T', 0x02, int) 686 #define SNDRV_TIMER_IOCTL_GINFO _IOWR('T', 0x03, struct snd_timer_ginfo) 687 #define SNDRV_TIMER_IOCTL_GPARAMS _IOW('T', 0x04, struct snd_timer_gparams) 688 #define SNDRV_TIMER_IOCTL_GSTATUS _IOWR('T', 0x05, struct snd_timer_gstatus) 689 #define SNDRV_TIMER_IOCTL_SELECT _IOW('T', 0x10, struct snd_timer_select) 690 #define SNDRV_TIMER_IOCTL_INFO _IOR('T', 0x11, struct snd_timer_info) 691 #define SNDRV_TIMER_IOCTL_PARAMS _IOW('T', 0x12, struct snd_timer_params) 692 #define SNDRV_TIMER_IOCTL_STATUS _IOR('T', 0x14, struct snd_timer_status) 693 /* The following four ioctls are changed since 1.0.9 due to confliction */ 694 #define SNDRV_TIMER_IOCTL_START _IO('T', 0xa0) 695 #define SNDRV_TIMER_IOCTL_STOP _IO('T', 0xa1) 696 #define SNDRV_TIMER_IOCTL_CONTINUE _IO('T', 0xa2) 697 #define SNDRV_TIMER_IOCTL_PAUSE _IO('T', 0xa3) 698 699 struct snd_timer_read { 700 unsigned int resolution; 701 unsigned int ticks; 702 }; 703 704 enum { 705 SNDRV_TIMER_EVENT_RESOLUTION = 0, /* val = resolution in ns */ 706 SNDRV_TIMER_EVENT_TICK, /* val = ticks */ 707 SNDRV_TIMER_EVENT_START, /* val = resolution in ns */ 708 SNDRV_TIMER_EVENT_STOP, /* val = 0 */ 709 SNDRV_TIMER_EVENT_CONTINUE, /* val = resolution in ns */ 710 SNDRV_TIMER_EVENT_PAUSE, /* val = 0 */ 711 SNDRV_TIMER_EVENT_EARLY, /* val = 0, early event */ 712 SNDRV_TIMER_EVENT_SUSPEND, /* val = 0 */ 713 SNDRV_TIMER_EVENT_RESUME, /* val = resolution in ns */ 714 /* master timer events for slave timer instances */ 715 SNDRV_TIMER_EVENT_MSTART = SNDRV_TIMER_EVENT_START + 10, 716 SNDRV_TIMER_EVENT_MSTOP = SNDRV_TIMER_EVENT_STOP + 10, 717 SNDRV_TIMER_EVENT_MCONTINUE = SNDRV_TIMER_EVENT_CONTINUE + 10, 718 SNDRV_TIMER_EVENT_MPAUSE = SNDRV_TIMER_EVENT_PAUSE + 10, 719 SNDRV_TIMER_EVENT_MSUSPEND = SNDRV_TIMER_EVENT_SUSPEND + 10, 720 SNDRV_TIMER_EVENT_MRESUME = SNDRV_TIMER_EVENT_RESUME + 10, 721 }; 722 723 struct snd_timer_tread { 724 int event; 725 struct timespec tstamp; 726 unsigned int val; 727 }; 728 729 /**************************************************************************** 730 * * 731 * Section for driver control interface - /dev/snd/control? * 732 * * 733 ****************************************************************************/ 734 735 #define SNDRV_CTL_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 6) 736 737 /******************** This section used in uniaud.dll interface *********************/ 738 struct snd_ctl_card_info { 739 int card; /* card number */ 740 int pad; /* reserved for future (was type) */ 741 unsigned char id[16]; /* ID of card (user selectable) */ 742 unsigned char driver[16]; /* Driver name */ 743 unsigned char name[32]; /* Short name of soundcard */ 744 unsigned char longname[80]; /* name + info text about soundcard */ 745 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */ 746 unsigned char mixername[80]; /* visual mixer identification */ 747 unsigned char components[128]; /* card components / fine identification, delimited with one space (AC97 etc..) */ 748 }; 749 750 typedef int __bitwise snd_ctl_elem_type_t; 751 #define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */ 752 #define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */ 753 #define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */ 754 #define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */ 755 #define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */ 756 #define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */ 757 #define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */ 758 #define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64 759 760 typedef int __bitwise snd_ctl_elem_iface_t; 761 #define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */ 762 #define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */ 763 #define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */ 764 #define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */ 765 #define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */ 766 #define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */ 767 #define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */ 768 #define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER 769 770 #define SNDRV_CTL_ELEM_ACCESS_READ (1<<0) 771 #define SNDRV_CTL_ELEM_ACCESS_WRITE (1<<1) 772 #define SNDRV_CTL_ELEM_ACCESS_READWRITE (SNDRV_CTL_ELEM_ACCESS_READ|SNDRV_CTL_ELEM_ACCESS_WRITE) 773 #define SNDRV_CTL_ELEM_ACCESS_VOLATILE (1<<2) /* control value may be changed without a notification */ 774 #define SNDRV_CTL_ELEM_ACCESS_TIMESTAMP (1<<3) /* when was control changed */ 775 #define SNDRV_CTL_ELEM_ACCESS_TLV_READ (1<<4) /* TLV read is possible */ 776 #define SNDRV_CTL_ELEM_ACCESS_TLV_WRITE (1<<5) /* TLV write is possible */ 777 #define SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE (SNDRV_CTL_ELEM_ACCESS_TLV_READ|SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) 778 #define SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND (1<<6) /* TLV command is possible */ 779 #define SNDRV_CTL_ELEM_ACCESS_INACTIVE (1<<8) /* control does actually nothing, but may be updated */ 780 #define SNDRV_CTL_ELEM_ACCESS_LOCK (1<<9) /* write lock */ 781 #define SNDRV_CTL_ELEM_ACCESS_OWNER (1<<10) /* write lock owner */ 782 #define SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK (1<<28) /* kernel use a TLV callback */ 783 #define SNDRV_CTL_ELEM_ACCESS_USER (1<<29) /* user space element */ 784 /* bits 30 and 31 are obsoleted (for indirect access) */ 785 786 /* for further details see the ACPI and PCI power management specification */ 787 #define SNDRV_CTL_POWER_D0 0x0000 /* full On */ 788 #define SNDRV_CTL_POWER_D1 0x0100 /* partial On */ 789 #define SNDRV_CTL_POWER_D2 0x0200 /* partial On */ 790 #define SNDRV_CTL_POWER_D3 0x0300 /* Off */ 791 #define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off, with power */ 792 #define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off, without power */ 793 794 struct snd_ctl_elem_id { 795 unsigned int numid; /* numeric identifier, zero = invalid */ 796 snd_ctl_elem_iface_t iface; /* interface identifier */ 797 unsigned int device; /* device/client number */ 798 unsigned int subdevice; /* subdevice (substream) number */ 799 unsigned char name[44]; /* ASCII name of item */ 800 unsigned int index; /* index of item */ 801 }; 802 803 struct snd_ctl_elem_list { 804 unsigned int offset; /* W: first element ID to get */ 805 unsigned int space; /* W: count of element IDs to get */ 806 unsigned int used; /* R: count of element IDs set */ 807 unsigned int count; /* R: count of all elements */ 808 struct snd_ctl_elem_id __user *pids; /* R: IDs */ 809 unsigned char reserved[50]; 810 }; 811 812 struct snd_ctl_elem_info { 813 struct snd_ctl_elem_id id; /* W: element ID */ 814 snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ 815 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ 816 unsigned int count; /* count of values */ 817 __kernel_pid_t owner; /* owner's PID of this control */ 818 union { 819 struct { 820 long min; /* R: minimum value */ 821 long max; /* R: maximum value */ 822 long step; /* R: step (0 variable) */ 823 } integer; 824 struct { 825 long long min; /* R: minimum value */ 826 long long max; /* R: maximum value */ 827 long long step; /* R: step (0 variable) */ 828 } integer64; 829 struct { 830 unsigned int items; /* R: number of items */ 831 unsigned int item; /* W: item number */ 832 char name[64]; /* R: value name */ 833 } enumerated; 834 unsigned char reserved[128]; 835 } value; 836 union { 837 unsigned short d[4]; /* dimensions */ 838 unsigned short *d_ptr; /* indirect - obsoleted */ 839 } dimen; 840 unsigned char reserved[64-4*sizeof(unsigned short)]; 841 }; 842 843 struct snd_ctl_elem_value { 844 struct snd_ctl_elem_id id; /* W: element ID */ 845 unsigned int indirect: 1; /* W: indirect access - obsoleted */ 846 union { 847 union { 848 long value[128]; 849 long *value_ptr; /* obsoleted */ 850 } integer; 851 union { 852 long long value[64]; 853 long long *value_ptr; /* obsoleted */ 854 } integer64; 855 union { 856 unsigned int item[128]; 857 unsigned int *item_ptr; /* obsoleted */ 858 } enumerated; 859 union { 860 unsigned char data[512]; 861 unsigned char *data_ptr; /* obsoleted */ 862 } bytes; 863 struct snd_aes_iec958 iec958; 864 } value; /* RO */ 865 struct timespec tstamp; 866 unsigned char reserved[128-sizeof(struct timespec)]; 867 }; 868 869 struct snd_ctl_tlv { 870 unsigned int numid; /* control element numeric identification */ 871 unsigned int length; /* in bytes aligned to 4 */ 872 #ifndef TARGET_OS2 873 unsigned int tlv[0]; /* first TLV */ 874 #else 875 unsigned int tlv[1]; /* first TLV */ 876 #endif 877 }; 878 879 #define SNDRV_CTL_IOCTL_PVERSION _IOR('U', 0x00, int) 880 #define SNDRV_CTL_IOCTL_CARD_INFO _IOR('U', 0x01, struct snd_ctl_card_info) 881 #define SNDRV_CTL_IOCTL_ELEM_LIST _IOWR('U', 0x10, struct snd_ctl_elem_list) 882 #define SNDRV_CTL_IOCTL_ELEM_INFO _IOWR('U', 0x11, struct snd_ctl_elem_info) 883 #define SNDRV_CTL_IOCTL_ELEM_READ _IOWR('U', 0x12, struct snd_ctl_elem_value) 884 #define SNDRV_CTL_IOCTL_ELEM_WRITE _IOWR('U', 0x13, struct snd_ctl_elem_value) 885 #define SNDRV_CTL_IOCTL_ELEM_LOCK _IOW('U', 0x14, struct snd_ctl_elem_id) 886 #define SNDRV_CTL_IOCTL_ELEM_UNLOCK _IOW('U', 0x15, struct snd_ctl_elem_id) 887 #define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int) 888 #define SNDRV_CTL_IOCTL_ELEM_ADD _IOWR('U', 0x17, struct snd_ctl_elem_info) 889 #define SNDRV_CTL_IOCTL_ELEM_REPLACE _IOWR('U', 0x18, struct snd_ctl_elem_info) 890 #define SNDRV_CTL_IOCTL_ELEM_REMOVE _IOWR('U', 0x19, struct snd_ctl_elem_id) 891 #define SNDRV_CTL_IOCTL_TLV_READ _IOWR('U', 0x1a, struct snd_ctl_tlv) 892 #define SNDRV_CTL_IOCTL_TLV_WRITE _IOWR('U', 0x1b, struct snd_ctl_tlv) 893 #define SNDRV_CTL_IOCTL_TLV_COMMAND _IOWR('U', 0x1c, struct snd_ctl_tlv) 894 #define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int) 895 #define SNDRV_CTL_IOCTL_HWDEP_INFO _IOR('U', 0x21, struct snd_hwdep_info) 896 #define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE _IOR('U', 0x30, int) 897 #define SNDRV_CTL_IOCTL_PCM_INFO _IOWR('U', 0x31, struct snd_pcm_info) 898 #define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int) 899 #define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int) 900 #define SNDRV_CTL_IOCTL_RAWMIDI_INFO _IOWR('U', 0x41, struct snd_rawmidi_info) 901 #define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int) 902 #define SNDRV_CTL_IOCTL_POWER _IOWR('U', 0xd0, int) 903 #define SNDRV_CTL_IOCTL_POWER_STATE _IOR('U', 0xd1, int) 904 #ifdef TARGET_OS2 905 #define SNDRV_PCM_IOCTL_SETVOLUME _IOW('A', 0x62, struct snd_pcm_volume) 906 #define SNDRV_PCM_IOCTL_GETVOLUME _IOR('A', 0x63, struct snd_pcm_volume) 907 #endif 908 909 /* 910 * Read interface. 911 */ 912 913 enum sndrv_ctl_event_type { 914 SNDRV_CTL_EVENT_ELEM = 0, 915 SNDRV_CTL_EVENT_LAST = SNDRV_CTL_EVENT_ELEM, 916 }; 917 918 #define SNDRV_CTL_EVENT_MASK_VALUE (1<<0) /* element value was changed */ 919 #define SNDRV_CTL_EVENT_MASK_INFO (1<<1) /* element info was changed */ 920 #define SNDRV_CTL_EVENT_MASK_ADD (1<<2) /* element was added */ 921 #define SNDRV_CTL_EVENT_MASK_TLV (1<<3) /* element TLV tree was changed */ 922 #define SNDRV_CTL_EVENT_MASK_REMOVE (~0U) /* element was removed */ 923 924 struct snd_ctl_event { 925 int type; /* event type - SNDRV_CTL_EVENT_* */ 926 union { 927 struct { 928 unsigned int mask; 929 struct snd_ctl_elem_id id; 930 } elem; 931 unsigned char data8[60]; 932 } data; 933 }; 934 935 /* 936 * Control names 937 */ 938 939 #define SNDRV_CTL_NAME_NONE "" 940 #define SNDRV_CTL_NAME_PLAYBACK "Playback " 941 #define SNDRV_CTL_NAME_CAPTURE "Capture " 942 943 #define SNDRV_CTL_NAME_IEC958_NONE "" 944 #define SNDRV_CTL_NAME_IEC958_SWITCH "Switch" 945 #define SNDRV_CTL_NAME_IEC958_VOLUME "Volume" 946 #define SNDRV_CTL_NAME_IEC958_DEFAULT "Default" 947 #define SNDRV_CTL_NAME_IEC958_MASK "Mask" 948 #define SNDRV_CTL_NAME_IEC958_CON_MASK "Con Mask" 949 #define SNDRV_CTL_NAME_IEC958_PRO_MASK "Pro Mask" 950 #define SNDRV_CTL_NAME_IEC958_PCM_STREAM "PCM Stream" 951 #define SNDRV_CTL_NAME_IEC958(expl,direction,what) "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what 952 24 #include <uapi/sound/asound.h> 953 25 #endif /* __SOUND_ASOUND_H */ -
GPL/trunk/alsa-kernel/include/sound/asoundef.h
r399 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_ASOUNDEF_H 2 3 #define __SOUND_ASOUNDEF_H … … 5 6 * Advanced Linux Sound Architecture - ALSA - Driver 6 7 * Copyright (c) 1994-2000 by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 171 156 #define IEC958_AES5_CON_CGMSA_COPYNEVER (3<<0) /* no copying is permitted */ 172 157 158 /**************************************************************************** 159 * * 160 * CEA-861 Audio InfoFrame. Used in HDMI and DisplayPort * 161 * * 162 ****************************************************************************/ 163 #define CEA861_AUDIO_INFOFRAME_DB1CC (7<<0) /* mask - channel count */ 164 #define CEA861_AUDIO_INFOFRAME_DB1CT (0xf<<4) /* mask - coding type */ 165 #define CEA861_AUDIO_INFOFRAME_DB1CT_FROM_STREAM (0<<4) /* refer to stream */ 166 #define CEA861_AUDIO_INFOFRAME_DB1CT_IEC60958 (1<<4) /* IEC-60958 L-PCM */ 167 #define CEA861_AUDIO_INFOFRAME_DB1CT_AC3 (2<<4) /* AC-3 */ 168 #define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG1 (3<<4) /* MPEG1 Layers 1 & 2 */ 169 #define CEA861_AUDIO_INFOFRAME_DB1CT_MP3 (4<<4) /* MPEG1 Layer 3 */ 170 #define CEA861_AUDIO_INFOFRAME_DB1CT_MPEG2_MULTICH (5<<4) /* MPEG2 Multichannel */ 171 #define CEA861_AUDIO_INFOFRAME_DB1CT_AAC (6<<4) /* AAC */ 172 #define CEA861_AUDIO_INFOFRAME_DB1CT_DTS (7<<4) /* DTS */ 173 #define CEA861_AUDIO_INFOFRAME_DB1CT_ATRAC (8<<4) /* ATRAC */ 174 #define CEA861_AUDIO_INFOFRAME_DB1CT_ONEBIT (9<<4) /* One Bit Audio */ 175 #define CEA861_AUDIO_INFOFRAME_DB1CT_DOLBY_DIG_PLUS (10<<4) /* Dolby Digital + */ 176 #define CEA861_AUDIO_INFOFRAME_DB1CT_DTS_HD (11<<4) /* DTS-HD */ 177 #define CEA861_AUDIO_INFOFRAME_DB1CT_MAT (12<<4) /* MAT (MLP) */ 178 #define CEA861_AUDIO_INFOFRAME_DB1CT_DST (13<<4) /* DST */ 179 #define CEA861_AUDIO_INFOFRAME_DB1CT_WMA_PRO (14<<4) /* WMA Pro */ 180 #define CEA861_AUDIO_INFOFRAME_DB2SF (7<<2) /* mask - sample frequency */ 181 #define CEA861_AUDIO_INFOFRAME_DB2SF_FROM_STREAM (0<<2) /* refer to stream */ 182 #define CEA861_AUDIO_INFOFRAME_DB2SF_32000 (1<<2) /* 32kHz */ 183 #define CEA861_AUDIO_INFOFRAME_DB2SF_44100 (2<<2) /* 44.1kHz */ 184 #define CEA861_AUDIO_INFOFRAME_DB2SF_48000 (3<<2) /* 48kHz */ 185 #define CEA861_AUDIO_INFOFRAME_DB2SF_88200 (4<<2) /* 88.2kHz */ 186 #define CEA861_AUDIO_INFOFRAME_DB2SF_96000 (5<<2) /* 96kHz */ 187 #define CEA861_AUDIO_INFOFRAME_DB2SF_176400 (6<<2) /* 176.4kHz */ 188 #define CEA861_AUDIO_INFOFRAME_DB2SF_192000 (7<<2) /* 192kHz */ 189 #define CEA861_AUDIO_INFOFRAME_DB2SS (3<<0) /* mask - sample size */ 190 #define CEA861_AUDIO_INFOFRAME_DB2SS_FROM_STREAM (0<<0) /* refer to stream */ 191 #define CEA861_AUDIO_INFOFRAME_DB2SS_16BIT (1<<0) /* 16 bits */ 192 #define CEA861_AUDIO_INFOFRAME_DB2SS_20BIT (2<<0) /* 20 bits */ 193 #define CEA861_AUDIO_INFOFRAME_DB2SS_24BIT (3<<0) /* 24 bits */ 194 #define CEA861_AUDIO_INFOFRAME_DB5_DM_INH (1<<7) /* mask - inhibit downmixing */ 195 #define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PERMITTED (0<<7) /* stereo downmix permitted */ 196 #define CEA861_AUDIO_INFOFRAME_DB5_DM_INH_PROHIBITED (1<<7) /* stereo downmis prohibited */ 197 #define CEA861_AUDIO_INFOFRAME_DB5_LSV (0xf<<3) /* mask - level-shift values */ 198 173 199 /***************************************************************************** 174 200 * * -
GPL/trunk/alsa-kernel/include/sound/config.h
r598 r679 8 8 9 9 #include <linux/version.h> 10 #include <linux/types.h>11 #include <linux/fcntl.h>12 #include <linux/signal.h>13 #include <linux/kdev_t.h>14 #include <linux/wait.h>15 #include <linux/list.h>16 #include <linux/init.h>17 #include <linux/dcache.h>18 #include <linux/vmalloc.h>19 #include <linux/tqueue.h>20 #include <linux/time.h>21 #include <linux/timer.h>22 #include <linux/stat.h>23 #include <linux/major.h>24 #include <linux/fs.h>25 #include <linux/pid.h>26 #include <linux/err.h>27 #include <linux/gfp.h>28 #include <linux/workqueue.h>29 #include <linux/byteorder/little_endian.h>30 #include <linux/lockdep.h>31 #include <linux/string.h>32 #include <asm/ioctl.h>33 #include <asm/hardirq.h>34 #include <asm/processor.h>35 #include <asm/siginfo.h>36 #include <dbgos2.h>37 #include <limits.h>38 #include <sys/cdefs.h>39 #include <stdio.h>40 #include <linux/config.h>41 #include <linux/module.h>42 #include <linux/utsname.h>43 #include <linux/errno.h>44 #include <linux/kernel.h>45 #include <linux/sched.h>46 #include <linux/malloc.h>47 #include <linux/delay.h>48 #include <linux/ioport.h>49 #include <asm/io.h>50 #include <asm/irq.h>51 #include <asm/segment.h>52 #include <asm/uaccess.h>53 #include <asm/system.h>54 #include <asm/string.h>55 #include <linux/pci.h>56 #include <linux/interrupt.h>57 #include <linux/pagemap.h>58 #include <linux/fs.h>59 #include <linux/fcntl.h>60 #include <linux/vmalloc.h>61 #include <linux/poll.h>62 #include <linux/reboot.h>63 #include <linux/init.h>64 #include <linux/lockdep.h>65 #include <linux/smp_lock.h>66 #include <linux/dma-mapping.h>67 #include "compat_22.h"68 69 #include <sound/asound.h>70 #include <sound/asoundef.h>71 10 72 11 /* … … 83 22 #define CONFIG_PCI 84 23 #define CONFIG_PM 85 #define CONFIG_P ROC_FS24 #define CONFIG_PM_SLEEP 86 25 #ifdef DEBUG 87 26 #define CONFIG_SND_DEBUG_DETECT 27 #endif 88 28 #define CONFIG_SND_DEBUG_VERBOSE 89 #endif90 29 #define CONFIG_SND_DMA_SGBUF 91 30 #define CONFIG_SND_HDA_CODEC_ANALOG … … 98 37 #define CONFIG_SND_HDA_GENERIC 99 38 #define CONFIG_SND_HDA_HWDEP 39 #define CONFIG_SND_HDA_PREALLOC_SIZE 64 100 40 #define CONFIG_SND_OSSEMUL 101 #define CONFIG_SND_PCM_OSS102 41 #define CONFIG_SND_SEQUENCER 103 42 #define CONFIG_SOUND 104 43 #define CONFIG_SYSFS_DEPRECATED 44 #define CONFIG_SND_PROC_FS 45 #define CONFIG_SND_JACK 46 //#define CONFIG_SND_DYNAMIC_MINORS //new 2020-12-26 47 //#define CONFIG_SND_MAX_CARDS 8 //new 2020-12-26 105 48 #define PCI_NEW_SUSPEND 106 49 #define SNDRV_LITTLE_ENDIAN 107 50 #define CONFIG_SND_HDA_POWER_SAVE_DEFAULT 1 51 #define CONFIG_SND_PCM_TIMER 1 52 #define CONFIG_PROC_FS 1 /* new oct 2020 */ 53 #define CONFIG_SND_PCM_OSS 1 108 54 109 55 /* Still need to work out where the following really belong */ 110 56 #undef interrupt 111 #define __builtin_return_address(a) 0112 #define __builtin_expect(x, expected_value) (x)113 #define BUG_ON(x) /* nothing */114 57 #define assert(a) 115 58 #define no_llseek NULL 116 59 #define noop_llseek NULL 117 118 struct class;119 struct class_device;120 struct class_device_attribute {int x; }; /* dummy */121 #define __ATTR(cls,perm,read,write) {0 } /* dummy */122 60 123 61 #define min_t(type, x, y) ({ \ -
GPL/trunk/alsa-kernel/include/sound/control.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_CONTROL_H 2 3 #define __SOUND_CONTROL_H … … 5 6 * Header file for control interface 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 * 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 23 */ 24 8 */ 9 10 #include <linux/wait.h> 11 #include <linux/nospec.h> 25 12 #include <sound/asound.h> 26 13 … … 32 19 typedef int (snd_kcontrol_put_t) (struct snd_kcontrol * kcontrol, struct snd_ctl_elem_value * ucontrol); 33 20 typedef int (snd_kcontrol_tlv_rw_t)(struct snd_kcontrol *kcontrol, 34 int op_flag, /* 0=read,1=write,-1=command*/21 int op_flag, /* SNDRV_CTL_TLV_OP_XXX */ 35 22 unsigned int size, 36 23 unsigned int __user *tlv); 37 24 25 /* internal flag for skipping validations */ 26 #ifdef CONFIG_SND_CTL_VALIDATION 27 #define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK (1 << 27) 28 #define snd_ctl_skip_validation(info) \ 29 ((info)->access & SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK) 30 #else 31 #define SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK 0 32 #define snd_ctl_skip_validation(info) true 33 #endif 34 35 enum { 36 SNDRV_CTL_TLV_OP_READ = 0, 37 SNDRV_CTL_TLV_OP_WRITE = 1, 38 SNDRV_CTL_TLV_OP_CMD = -1, 39 }; 38 40 39 41 struct snd_kcontrol_new { … … 41 43 unsigned int device; /* device/client number */ 42 44 unsigned int subdevice; /* subdevice (substream) number */ 43 unsignedchar *name; /* ASCII name of item */45 const char *name; /* ASCII name of item */ 44 46 unsigned int index; /* index of item */ 45 47 unsigned int access; /* access rights */ … … 72 74 } tlv; 73 75 unsigned long private_value; 74 #ifdef TARGET_OS275 void *private_ptr;76 #endif77 76 void *private_data; 78 77 void (*private_free)(struct snd_kcontrol *kcontrol); 79 #ifndef TARGET_OS2 80 struct snd_kcontrol_volatile vd[0]; /* volatile data */ 81 #else 82 struct snd_kcontrol_volatile vd[1]; /* volatile data */ 83 #endif 78 struct snd_kcontrol_volatile vd[]; /* volatile data */ 84 79 }; 85 80 … … 96 91 struct pid; 97 92 93 enum { 94 SND_CTL_SUBDEV_PCM, 95 SND_CTL_SUBDEV_RAWMIDI, 96 SND_CTL_SUBDEV_ITEMS, 97 }; 98 98 99 struct snd_ctl_file { 99 100 struct list_head list; /* list of all control files */ 100 101 struct snd_card *card; 101 102 struct pid *pid; 102 int prefer_pcm_subdevice; 103 int prefer_rawmidi_subdevice; 103 int preferred_subdevice[SND_CTL_SUBDEV_ITEMS]; 104 104 wait_queue_head_t change_sleep; 105 105 spinlock_t read_lock; … … 121 121 int snd_ctl_add(struct snd_card * card, struct snd_kcontrol * kcontrol); 122 122 int snd_ctl_remove(struct snd_card * card, struct snd_kcontrol * kcontrol); 123 int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol, bool add_on_replace); 123 124 int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id); 124 125 int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id); 126 int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id, 127 int active); 125 128 struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid); 126 129 struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id); … … 138 141 #endif 139 142 143 int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type); 144 140 145 static inline unsigned int snd_ctl_get_ioffnum(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) 141 146 { 142 return id->numid - kctl->id.numid; 147 unsigned int ioff = id->numid - kctl->id.numid; 148 return array_index_nospec(ioff, kctl->count); 143 149 } 144 150 145 151 static inline unsigned int snd_ctl_get_ioffidx(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id) 146 152 { 147 return id->index - kctl->id.index; 153 unsigned int ioff = id->index - kctl->id.index; 154 return array_index_nospec(ioff, kctl->count); 148 155 } 149 156 … … 182 189 struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, 183 190 const unsigned int *tlv); 184 int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave, 185 unsigned int flags); 186 /* optional flags for slave */ 187 #define SND_CTL_SLAVE_NEED_UPDATE (1 << 0) 191 int _snd_ctl_add_follower(struct snd_kcontrol *master, 192 struct snd_kcontrol *follower, 193 unsigned int flags); 194 /* optional flags for follower */ 195 #define SND_CTL_FOLLOWER_NEED_UPDATE (1 << 0) 188 196 189 197 /** 190 * snd_ctl_add_ slave - Add a virtual slavecontrol198 * snd_ctl_add_follower - Add a virtual follower control 191 199 * @master: vmaster element 192 * @ slave: slaveelement to add193 * 194 * Add a virtual slavecontrol to the given master element created via200 * @follower: follower element to add 201 * 202 * Add a virtual follower control to the given master element created via 195 203 * snd_ctl_create_virtual_master() beforehand. 196 * Returns zero if successful or a negative error code. 197 * 198 * All slaves must be the same type (returning the same information 199 * via info callback). The fucntion doesn't check it, so it's your 204 * 205 * All followers must be the same type (returning the same information 206 * via info callback). The function doesn't check it, so it's your 200 207 * responsibility. 201 208 * … … 204 211 * logarithmic volume control (dB level) thus no linear volume, 205 212 * master can only attenuate the volume without gain 213 * 214 * Return: Zero if successful or a negative error code. 206 215 */ 207 216 static inline int 208 snd_ctl_add_ slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)209 { 210 return _snd_ctl_add_ slave(master, slave, 0);217 snd_ctl_add_follower(struct snd_kcontrol *master, struct snd_kcontrol *follower) 218 { 219 return _snd_ctl_add_follower(master, follower, 0); 211 220 } 212 221 213 222 /** 214 * snd_ctl_add_ slave_uncached - Add a virtual slavecontrol223 * snd_ctl_add_follower_uncached - Add a virtual follower control 215 224 * @master: vmaster element 216 * @ slave: slaveelement to add217 * 218 * Add a virtual slavecontrol to the given master.219 * Unlike snd_ctl_add_ slave(), the element added via this function225 * @follower: follower element to add 226 * 227 * Add a virtual follower control to the given master. 228 * Unlike snd_ctl_add_follower(), the element added via this function 220 229 * is supposed to have volatile values, and get callback is called 221 * at each time qu ried from the master.230 * at each time queried from the master. 222 231 * 223 232 * When the control peeks the hardware values directly and the value 224 233 * can be changed by other means than the put callback of the element, 225 234 * this function should be used to keep the value always up-to-date. 235 * 236 * Return: Zero if successful or a negative error code. 226 237 */ 227 238 static inline int 228 snd_ctl_add_slave_uncached(struct snd_kcontrol *master, 229 struct snd_kcontrol *slave) 230 { 231 return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE); 232 } 239 snd_ctl_add_follower_uncached(struct snd_kcontrol *master, 240 struct snd_kcontrol *follower) 241 { 242 return _snd_ctl_add_follower(master, follower, SND_CTL_FOLLOWER_NEED_UPDATE); 243 } 244 245 int snd_ctl_add_vmaster_hook(struct snd_kcontrol *kctl, 246 void (*hook)(void *private_data, int), 247 void *private_data); 248 void snd_ctl_sync_vmaster(struct snd_kcontrol *kctl, bool hook_only); 249 #define snd_ctl_sync_vmaster_hook(kctl) snd_ctl_sync_vmaster(kctl, true) 250 int snd_ctl_apply_vmaster_followers(struct snd_kcontrol *kctl, 251 int (*func)(struct snd_kcontrol *vfollower, 252 struct snd_kcontrol *follower, 253 void *arg), 254 void *arg); 255 256 /* 257 * Helper functions for jack-detection controls 258 */ 259 struct snd_kcontrol * 260 snd_kctl_jack_new(const char *name, struct snd_card *card); 261 void snd_kctl_jack_report(struct snd_card *card, 262 struct snd_kcontrol *kctl, bool status); 233 263 234 264 #endif /* __SOUND_CONTROL_H */ -
GPL/trunk/alsa-kernel/include/sound/core.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_CORE_H 2 3 #define __SOUND_CORE_H … … 5 6 * Main header file for the ALSA driver 6 7 * Copyright (c) 1994-2001 by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 #ifdef TARGET_OS2 … … 26 11 #endif 27 12 28 #include <linux/ module.h>13 #include <linux/device.h> 29 14 #include <linux/sched.h> /* wake_up() */ 30 15 #include <linux/mutex.h> /* struct mutex */ 31 16 #include <linux/rwsem.h> /* struct rw_semaphore */ 32 17 #include <linux/pm.h> /* pm_message_t */ 33 #include <linux/device.h>34 18 #include <linux/stringify.h> 19 #include <linux/printk.h> 35 20 36 21 /* number of supported soundcards */ 37 22 #ifdef CONFIG_SND_DYNAMIC_MINORS 38 #define SNDRV_CARDS 3223 #define SNDRV_CARDS CONFIG_SND_MAX_CARDS 39 24 #else 40 25 #define SNDRV_CARDS 8 /* don't change - minor numbers */ … … 44 29 45 30 /* forward declarations */ 46 #ifdef CONFIG_PCI47 31 struct pci_dev; 48 #endif 32 struct module; 33 struct completion; 49 34 50 35 /* device allocation stuff */ 51 36 52 #define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 53 54 typedef int __bitwise snd_device_type_t; 55 #define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0) 56 #define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1) 57 #define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2) 58 #define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000) 59 #define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001) 60 #define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002) 61 #define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003) 62 #define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004) 63 #define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005) 64 #define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006) 65 #define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 66 #define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 67 #define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009) 68 #define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 69 70 typedef int __bitwise snd_device_state_t; 71 #define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0) 72 #define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1) 73 #define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2) 74 75 typedef int __bitwise snd_device_cmd_t; 76 #define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0) 77 #define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1) 78 #define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2) 37 /* type of the object used in snd_device_*() 38 * this also defines the calling order 39 */ 40 enum snd_device_type { 41 SNDRV_DEV_LOWLEVEL, 42 SNDRV_DEV_INFO, 43 SNDRV_DEV_BUS, 44 SNDRV_DEV_CODEC, 45 SNDRV_DEV_PCM, 46 SNDRV_DEV_COMPRESS, 47 SNDRV_DEV_RAWMIDI, 48 SNDRV_DEV_TIMER, 49 SNDRV_DEV_SEQUENCER, 50 SNDRV_DEV_HWDEP, 51 SNDRV_DEV_JACK, 52 SNDRV_DEV_CONTROL, /* NOTE: this must be the last one */ 53 }; 54 55 enum snd_device_state { 56 SNDRV_DEV_BUILD, 57 SNDRV_DEV_REGISTERED, 58 SNDRV_DEV_DISCONNECTED, 59 }; 79 60 80 61 struct snd_device; … … 89 70 struct list_head list; /* list of registered devices */ 90 71 struct snd_card *card; /* card which holds this device */ 91 snd_device_state_tstate; /* state of the device */92 snd_device_type_t type;/* device type */72 enum snd_device_state state; /* state of the device */ 73 enum snd_device_type type; /* device type */ 93 74 void *device_data; /* device structure */ 94 struct snd_device_ops *ops; /* operations */75 const struct snd_device_ops *ops; /* operations */ 95 76 }; 96 77 … … 107 88 char shortname[32]; /* short name of this soundcard */ 108 89 char longname[80]; /* name of this soundcard */ 90 char irq_descr[32]; /* Interrupt description */ 109 91 char mixername[80]; /* mixer name */ 110 92 char components[128]; /* card components delimited with … … 117 99 struct list_head devices; /* devices */ 118 100 101 struct device ctl_dev; /* control device */ 119 102 unsigned int last_numid; /* last used numeric ID */ 120 103 struct rw_semaphore controls_rwsem; /* controls list lock */ … … 126 109 127 110 struct snd_info_entry *proc_root; /* root for soundcard specific files */ 128 struct snd_info_entry *proc_id; /* the card id */129 111 struct proc_dir_entry *proc_root_link; /* number link to real id */ 130 112 … … 134 116 spinlock_t files_lock; /* lock the files for this card */ 135 117 int shutdown; /* this card is going down */ 136 int free_on_last_close; /* free in context of file_release */ 137 wait_queue_head_t shutdown_sleep; 118 struct completion *release_completion; 138 119 struct device *dev; /* device assigned to this card */ 139 struct device *card_dev; /* cardX object for sysfs */ 120 struct device card_dev; /* cardX object for sysfs */ 121 const struct attribute_group *dev_groups[4]; /* assigned sysfs attr */ 122 bool registered; /* card_dev is registered? */ 123 int sync_irq; /* assigned irq, used for PCM sync */ 124 wait_queue_head_t remove_sleep; 125 126 size_t total_pcm_alloc_bytes; /* total amount of allocated buffers */ 127 struct mutex memory_mutex; /* protection for the above */ 140 128 141 129 #ifdef CONFIG_PM 142 130 unsigned int power_state; /* power state */ 143 struct mutex power_lock; /* power lock */144 131 wait_queue_head_t power_sleep; 145 132 #endif 146 133 147 #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)134 #if IS_ENABLED(CONFIG_SND_MIXER_OSS) 148 135 struct snd_mixer_oss *mixer_oss; 149 136 int mixer_oss_change_count; … … 151 138 }; 152 139 140 #define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev) 141 153 142 #ifdef CONFIG_PM 154 static inline void snd_power_lock(struct snd_card *card)155 {156 mutex_lock(&card->power_lock);157 }158 159 static inline void snd_power_unlock(struct snd_card *card)160 {161 mutex_unlock(&card->power_lock);162 }163 164 143 static inline unsigned int snd_power_get_state(struct snd_card *card) 165 144 { … … 178 157 #else /* ! CONFIG_PM */ 179 158 180 #define snd_power_lock(card) do { (void)(card); } while (0)181 #define snd_power_unlock(card) do { (void)(card); } while (0)182 159 static inline int snd_power_wait(struct snd_card *card, unsigned int state) { return 0; } 183 160 #define snd_power_get_state(card) ({ (void)(card); SNDRV_CTL_POWER_D0; }) … … 190 167 int card; /* card number */ 191 168 int device; /* device number */ 192 #ifndef TARGET_OS2193 169 const struct file_operations *f_ops; /* file operations */ 194 #else195 struct file_operations *f_ops; /* file operations */196 #endif197 170 void *private_data; /* private data for f_ops->open */ 198 171 struct device *dev; /* device for sysfs */ 172 struct snd_card *card_ptr; /* assigned card instance */ 199 173 }; 200 174 … … 202 176 static inline struct device *snd_card_get_device_link(struct snd_card *card) 203 177 { 204 return card ? card->card_dev : NULL;178 return card ? &card->card_dev : NULL; 205 179 } 206 180 … … 213 187 void snd_request_card(int card); 214 188 215 int snd_register_device_for_dev(int type, struct snd_card *card, 216 int dev, 217 #ifndef TARGET_OS2 218 const struct file_operations *f_ops, 219 #else 220 struct file_operations *f_ops, 221 #endif 222 void *private_data, 223 const char *name, 224 struct device *device); 225 226 /** 227 * snd_register_device - Register the ALSA device file for the card 228 * @type: the device type, SNDRV_DEVICE_TYPE_XXX 229 * @card: the card instance 230 * @dev: the device index 231 * @f_ops: the file operations 232 * @private_data: user pointer for f_ops->open() 233 * @name: the device file name 234 * 235 * Registers an ALSA device file for the given card. 236 * The operators have to be set in reg parameter. 237 * 238 * This function uses the card's device pointer to link to the 239 * correct &struct device. 240 * 241 * Returns zero if successful, or a negative error code on failure. 242 */ 243 static inline int snd_register_device(int type, struct snd_card *card, int dev, 244 #ifndef TARGET_OS2 245 const struct file_operations *f_ops, 246 #else 247 struct file_operations *f_ops, 248 #endif 249 void *private_data, 250 const char *name) 251 { 252 return snd_register_device_for_dev(type, card, dev, f_ops, 253 private_data, name, 254 snd_card_get_device_link(card)); 255 } 256 257 int snd_unregister_device(int type, struct snd_card *card, int dev); 189 void snd_device_initialize(struct device *dev, struct snd_card *card); 190 191 int snd_register_device(int type, struct snd_card *card, int dev, 192 const struct file_operations *f_ops, 193 void *private_data, struct device *device); 194 int snd_unregister_device(struct device *dev); 258 195 void *snd_lookup_minor_data(unsigned int minor, int type); 259 int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,260 struct device_attribute *attr);261 196 262 197 #ifdef CONFIG_SND_OSSEMUL 263 198 int snd_register_oss_device(int type, struct snd_card *card, int dev, 264 #ifndef TARGET_OS2 265 const struct file_operations *f_ops, void *private_data, 266 #else 267 struct file_operations *f_ops, void *private_data, 268 #endif 269 const char *name); 199 const struct file_operations *f_ops, void *private_data); 270 200 int snd_unregister_oss_device(int type, struct snd_card *card, int dev); 271 201 void *snd_lookup_oss_minor_data(unsigned int minor, int type); … … 273 203 274 204 int snd_minor_info_init(void); 275 int snd_minor_info_done(void);276 205 277 206 /* sound_oss.c */ … … 279 208 #ifdef CONFIG_SND_OSSEMUL 280 209 int snd_minor_info_oss_init(void); 281 int snd_minor_info_oss_done(void);282 210 #else 283 211 static inline int snd_minor_info_oss_init(void) { return 0; } 284 static inline int snd_minor_info_oss_done(void) { return 0; }285 212 #endif 286 213 … … 292 219 /* init.c */ 293 220 294 extern struct snd_card *snd_cards[SNDRV_CARDS];295 221 int snd_card_locked(int card); 296 #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)222 #if IS_ENABLED(CONFIG_SND_MIXER_OSS) 297 223 #define SND_MIXER_OSS_NOTIFY_REGISTER 0 298 224 #define SND_MIXER_OSS_NOTIFY_DISCONNECT 1 … … 301 227 #endif 302 228 303 int snd_card_ create(int idx, const char *id,304 struct module *module, int extra_size,305 struct snd_card **card_ret);229 int snd_card_new(struct device *parent, int idx, const char *xid, 230 struct module *module, int extra_size, 231 struct snd_card **card_ret); 306 232 307 233 int snd_card_disconnect(struct snd_card *card); 234 void snd_card_disconnect_sync(struct snd_card *card); 308 235 int snd_card_free(struct snd_card *card); 309 236 int snd_card_free_when_closed(struct snd_card *card); … … 311 238 int snd_card_register(struct snd_card *card); 312 239 int snd_card_info_init(void); 313 int snd_card_info_done(void); 240 int snd_card_add_dev_attr(struct snd_card *card, 241 const struct attribute_group *group); 314 242 int snd_component_add(struct snd_card *card, const char *component); 315 243 int snd_card_file_add(struct snd_card *card, struct file *file); 316 244 int snd_card_file_remove(struct snd_card *card, struct file *file); 317 245 246 struct snd_card *snd_card_ref(int card); 247 248 /** 249 * snd_card_unref - Unreference the card object 250 * @card: the card object to unreference 251 * 252 * Call this function for the card object that was obtained via snd_card_ref() 253 * or snd_lookup_minor_data(). 254 */ 255 static inline void snd_card_unref(struct snd_card *card) 256 { 257 put_device(&card->card_dev); 258 } 259 318 260 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) 319 261 320 262 /* device.c */ 321 263 322 int snd_device_new(struct snd_card *card, snd_device_type_ttype,323 void *device_data, struct snd_device_ops *ops);264 int snd_device_new(struct snd_card *card, enum snd_device_type type, 265 void *device_data, const struct snd_device_ops *ops); 324 266 int snd_device_register(struct snd_card *card, void *device_data); 325 267 int snd_device_register_all(struct snd_card *card); 326 int snd_device_disconnect(struct snd_card *card, void *device_data); 327 int snd_device_disconnect_all(struct snd_card *card); 328 int snd_device_free(struct snd_card *card, void *device_data); 329 int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd); 268 void snd_device_disconnect(struct snd_card *card, void *device_data); 269 void snd_device_disconnect_all(struct snd_card *card); 270 void snd_device_free(struct snd_card *card, void *device_data); 271 void snd_device_free_all(struct snd_card *card); 272 int snd_device_get_state(struct snd_card *card, void *device_data); 330 273 331 274 /* isadma.c */ … … 345 288 /* --- */ 346 289 290 /* sound printk debug levels */ 291 enum { 292 SND_PR_ALWAYS, 293 SND_PR_DEBUG, 294 SND_PR_VERBOSE, 295 }; 296 347 297 #if defined(CONFIG_SND_DEBUG) || defined(CONFIG_SND_VERBOSE_PRINTK) 348 void __snd_printk(unsigned int level, const char *file, int line, 349 const char *format, ...)350 __attribute__ ((format (printf, 4, 5)));351 #else 352 #ifndef TARGET_OS2 353 #define __snd_printk(level, file, line, format, args...) \354 printk(format, ##args)298 #error "Not valid for OS/2" 299 __printf(4, 5) 300 void __snd_printk(unsigned int level, const char *file, int line, const char *format, ...); 301 #else 302 #ifndef TARGET_OS2 303 #define __snd_printk(level, file, line, format, ...) \ 304 printk(format, ##__VA_ARGS__) 355 305 #else 356 306 #define __snd_printk printk 357 #endif /* nothing*/358 #endif 307 #endif /* TARGET_OS2 */ 308 #endif /* defined(...) */ 359 309 360 310 /** … … 366 316 */ 367 317 #ifndef TARGET_OS2 368 #define snd_printk(fmt, args...) \369 __snd_printk(0, __FILE__, __LINE__, fmt, ## args)370 #else 371 #define snd_printk printk372 #endif 318 #define snd_printk(fmt, ...) \ 319 __snd_printk(0, __FILE__, __LINE__, fmt, ##__VA_ARGS__) 320 #else 321 #define snd_printk __snd_printk 322 #endif 373 323 374 324 #ifdef CONFIG_SND_DEBUG … … 380 330 * Ignored when CONFIG_SND_DEBUG is not set. 381 331 */ 382 #define snd_printd(fmt, args...) \ 383 __snd_printk(1, __FILE__, __LINE__, fmt, ##args) 332 #ifndef TARGET_OS2 333 #define snd_printd(fmt, ...) \ 334 __snd_printk(1, __FILE__, __LINE__, fmt, ##__VA_ARGS__) 335 #define _snd_printd(level, fmt, ...) \ 336 __snd_printk(level, __FILE__, __LINE__, fmt, ##__VA_ARGS__) 337 #else /* TARGET_OS2 */ 338 #define snd_printd printk 339 #endif /* TARGET_OS2 */ 384 340 385 341 /** … … 389 345 * Ignored when CONFIG_SND_DEBUG is not set. 390 346 */ 347 #ifndef TARGET_OS2 391 348 #define snd_BUG() WARN(1, "BUG?\n") 349 #else 350 #define snd_BUG() 351 #endif 352 353 /** 354 * snd_printd_ratelimit - Suppress high rates of output when 355 * CONFIG_SND_DEBUG is enabled. 356 */ 357 #define snd_printd_ratelimit() printk_ratelimit() 392 358 393 359 /** … … 395 361 * @cond: condition to evaluate 396 362 * 397 * When CONFIG_SND_DEBUG is set, this macro evaluates the given condition, 398 * and call WARN() and returns the value if it's non-zero. 399 * 400 * When CONFIG_SND_DEBUG is not set, this just returns zero, and the given 401 * condition is ignored. 402 * 403 * NOTE: the argument won't be evaluated at all when CONFIG_SND_DEBUG=n. 404 * Thus, don't put any statement that influences on the code behavior, 405 * such as pre/post increment, to the argument of this macro. 406 * If you want to evaluate and give a warning, use standard WARN_ON(). 407 */ 408 409 #define snd_BUG_ON(cond) WARN((cond), "BUG? (%s)\n", __stringify(cond)) 363 * Has the same behavior as WARN_ON when CONFIG_SND_DEBUG is set, 364 * otherwise just evaluates the conditional and returns the value. 365 */ 366 #ifndef TARGET_OS2 367 #define snd_BUG_ON(cond) WARN_ON((cond)) 368 #else 369 #define snd_BUG_ON(cond) 370 #endif 410 371 411 372 #else /* !CONFIG_SND_DEBUG */ 412 373 413 374 #ifndef TARGET_OS2 414 #define snd_printd(fmt, args...) do { } while (0) 375 __printf(1, 2) 376 static inline void snd_printd(const char *format, ...) {} 377 __printf(2, 3) 378 static inline void _snd_printd(int level, const char *format, ...) {} 379 415 380 #define snd_BUG() do { } while (0) 416 static inline int __snd_bug_on(int cond) 417 { 418 return 0;419 } 420 #define snd_BUG_ON(cond) __snd_bug_on(0 && (cond)) /* always false */ 381 382 #define snd_BUG_ON(condition) ({ \ 383 int __ret_warn_on = !!(condition); \ 384 unlikely(__ret_warn_on); \ 385 }) 421 386 #else 422 387 #define snd_printd snd_printk … … 429 394 #endif 430 395 396 static inline bool snd_printd_ratelimit(void) { return false; } 431 397 432 398 #endif /* CONFIG_SND_DEBUG */ … … 441 407 */ 442 408 #ifndef TARGET_OS2 443 #define snd_printdd(format, args...) \444 __snd_printk(2, __FILE__, __LINE__, format, ##args)409 #define snd_printdd(format, ...) \ 410 __snd_printk(2, __FILE__, __LINE__, format, ##__VA_ARGS__) 445 411 #else 446 412 #define snd_printdd snd_printk 447 #endif 448 #else 449 #ifndef TARGET_OS2 450 #define snd_printdd(format, args...) do { } while (0) 451 #else 452 #define snd_printdd 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL) 453 #endif 454 #endif 413 #endif /* TARGET_OS2 */ 414 #else /* CONFIG_SND_DEBUG_VERBIOSE */ 415 #ifndef TARGET_OS2 416 __printf(1, 2) 417 static inline void snd_printdd(const char *format, ...) {} 418 #else 419 #define snd_printdd snd_printk 420 #endif /* TARGET_OS2 */ 421 #endif /* CONFIG_SND_DEBUG_VERBIOSE */ 455 422 456 423 … … 458 425 459 426 /* for easier backward-porting */ 460 #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)427 #if IS_ENABLED(CONFIG_GAMEPORT) 461 428 #define gameport_set_dev_parent(gp,xdev) ((gp)->dev.parent = (xdev)) 462 429 #define gameport_set_port_data(gp,r) ((gp)->port_data = (r)) … … 488 455 {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), \ 489 456 .value = (val), .name = (xname)} 457 #define snd_pci_quirk_name(q) ((q)->name) 490 458 #else 491 459 #define SND_PCI_QUIRK(vend,dev,xname,val) \ … … 495 463 #define SND_PCI_QUIRK_VENDOR(vend, xname, val) \ 496 464 {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)} 497 #endif 498 465 #define snd_pci_quirk_name(q) "" 466 #endif 467 468 #ifdef CONFIG_PCI 499 469 const struct snd_pci_quirk * 500 470 snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); … … 503 473 snd_pci_quirk_lookup_id(u16 vendor, u16 device, 504 474 const struct snd_pci_quirk *list); 475 #else 476 static inline const struct snd_pci_quirk * 477 snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) 478 { 479 return NULL; 480 } 481 482 static inline const struct snd_pci_quirk * 483 snd_pci_quirk_lookup_id(u16 vendor, u16 device, 484 const struct snd_pci_quirk *list) 485 { 486 return NULL; 487 } 488 #endif 505 489 506 490 #endif /* __SOUND_CORE_H */ -
GPL/trunk/alsa-kernel/include/sound/cs4231-regs.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_CS4231_REGS_H 2 3 #define __SOUND_CS4231_REGS_H … … 5 6 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 6 7 * Definitions for CS4231 & InterWave chips & compatible chips registers 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 -
GPL/trunk/alsa-kernel/include/sound/cs46xx_dsp_spos.h
r598 r679 148 148 149 149 struct dsp_spos_instance { 150 struct dsp_symbol_desc symbol_table; /* currently avail ble loaded symbols in SP */150 struct dsp_symbol_desc symbol_table; /* currently available loaded symbols in SP */ 151 151 152 152 int nmodules; -
GPL/trunk/alsa-kernel/include/sound/cs8403.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_CS8403_H 2 3 #define __SOUND_CS8403_H … … 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 8 * Takashi Iwai <tiwai@suse.de> 8 *9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 9 */ 25 10 -
GPL/trunk/alsa-kernel/include/sound/cs8427.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_CS8427_H 2 3 #define __SOUND_CS8427_H … … 5 6 * Routines for Cirrus Logic CS8427 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 189 174 struct snd_pcm_substream; 190 175 176 int snd_cs8427_init(struct snd_i2c_bus *bus, struct snd_i2c_device *device); 191 177 int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr, 192 178 unsigned int reset_timeout, struct snd_i2c_device **r_cs8427); -
GPL/trunk/alsa-kernel/include/sound/emu10k1.h
r598 r679 1 #ifndef __SOUND_EMU10K1_H 2 #define __SOUND_EMU10K1_H 3 4 #include <linux/types.h> 5 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 6 2 /* 7 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 8 4 * Creative Labs, Inc. 9 5 * Definitions for EMU10K1 (SB Live!) chips 10 *11 *12 * This program is free software; you can redistribute it and/or modify13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or15 * (at your option) any later version.16 *17 * This program is distributed in the hope that it will be useful,18 * but WITHOUT ANY WARRANTY; without even the implied warranty of19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20 * GNU General Public License for more details.21 *22 * You should have received a copy of the GNU General Public License23 * along with this program; if not, write to the Free Software24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA25 *26 6 */ 27 28 #ifdef __KERNEL__ 7 #ifndef __SOUND_EMU10K1_H 8 #define __SOUND_EMU10K1_H 9 29 10 30 11 #include <sound/pcm.h> … … 37 18 #include <linux/interrupt.h> 38 19 #include <linux/mutex.h> 39 40 #include <asm/io.h> 20 #include <linux/firmware.h> 21 #include <linux/io.h> 22 23 #include <uapi/sound/emu10k1.h> 41 24 42 25 /* ------------------- DEFINES -------------------- */ … … 44 27 #define EMUPAGESIZE 4096 45 28 #define MAXREQVOICES 8 46 #define MAXPAGES 8192 29 #define MAXPAGES0 4096 /* 32 bit mode */ 30 #define MAXPAGES1 8192 /* 31 bit mode */ 47 31 #define RESERVED 0 48 32 #define NUM_MIDI 16 … … 53 37 /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ 54 38 #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ 55 #define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */ 56 /* See ALSA bug #1276 - rlrevell */ 39 #define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit mode */ 57 40 58 41 #define TMEMSIZE 256*1024 … … 439 422 #define CCCA_CURRADDR 0x18000008 440 423 441 /* undefine CCR to avoid conflict with the definition for SH */442 #undef CCR443 424 #define CCR 0x09 /* Cache control register */ 444 425 #define CCR_CACHEINVALIDSIZE 0x07190009 … … 471 452 #define MAPB 0x0d /* Cache map B */ 472 453 473 #define MAP_PTE_MASK 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ 474 #define MAP_PTI_MASK 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ 454 #define MAP_PTE_MASK0 0xfffff000 /* The 20 MSBs of the PTE indexed by the PTI */ 455 #define MAP_PTI_MASK0 0x00000fff /* The 12 bit index to one of the 4096 PTE dwords */ 456 457 #define MAP_PTE_MASK1 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ 458 #define MAP_PTI_MASK1 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ 475 459 476 460 /* 0x0e, 0x0f: Not used */ … … 1612 1596 unsigned int tram_pos; 1613 1597 unsigned int tram_shift; 1614 struct snd_emu10k1_fx8010_irq *irq;1598 struct snd_emu10k1_fx8010_irq irq; 1615 1599 }; 1616 1600 … … 1690 1674 unsigned int optical_in; /* 0:SPDIF, 1:ADAT */ 1691 1675 unsigned int optical_out; /* 0:SPDIF, 1:ADAT */ 1692 struct task_struct *firmware_thread; 1676 struct delayed_work firmware_work; 1677 u32 last_reg; 1693 1678 }; 1694 1679 … … 1709 1694 unsigned int card_type; /* EMU10K1_CARD_* */ 1710 1695 unsigned int ecard_ctrl; /* ecard control bits */ 1696 unsigned int address_mode; /* address mode */ 1711 1697 unsigned long dma_mask; /* PCI DMA mask */ 1698 bool iommu_workaround; /* IOMMU workaround needed */ 1712 1699 unsigned int delay_pcm_irq; /* in samples */ 1713 1700 int max_cache_pages; /* max memory size / PAGE_SIZE */ … … 1718 1705 1719 1706 struct snd_util_memhdr *memhdr; /* page allocation list */ 1720 struct snd_emu10k1_memblk *reserved_page; /* reserved page */1721 1707 1722 1708 struct list_head mapped_link_head; … … 1789 1775 unsigned int next_free_voice; 1790 1776 1791 #ifdef CONFIG_PM 1777 const struct firmware *firmware; 1778 const struct firmware *dock_fw; 1779 1780 #ifdef CONFIG_PM_SLEEP 1792 1781 unsigned int *saved_ptr; 1793 1782 unsigned int *saved_gpr; … … 1797 1786 unsigned int *p16v_saved; 1798 1787 unsigned int saved_a_iocfg, saved_hcfg; 1788 bool suspend; 1799 1789 #endif 1800 1790 … … 1810 1800 struct snd_emu10k1 ** remu); 1811 1801 1812 int snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);1813 int snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);1814 int snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);1815 int snd_p16v_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);1802 int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device); 1803 int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device); 1804 int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device); 1805 int snd_p16v_pcm(struct snd_emu10k1 *emu, int device); 1816 1806 int snd_p16v_free(struct snd_emu10k1 * emu); 1817 1807 int snd_p16v_mixer(struct snd_emu10k1 * emu); 1818 int snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);1819 int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm);1808 int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device); 1809 int snd_emu10k1_fx8010_pcm(struct snd_emu10k1 *emu, int device); 1820 1810 int snd_emu10k1_mixer(struct snd_emu10k1 * emu, int pcm_device, int multi_device); 1821 1811 int snd_emu10k1_timer(struct snd_emu10k1 * emu, int device); 1822 int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device , struct snd_hwdep ** rhwdep);1812 int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device); 1823 1813 1824 1814 irqreturn_t snd_emu10k1_interrupt(int irq, void *dev_id); … … 1857 1847 unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1858 1848 1859 #ifdef CONFIG_PM 1849 #ifdef CONFIG_PM_SLEEP 1860 1850 void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu); 1861 1851 void snd_emu10k1_resume_init(struct snd_emu10k1 *emu); … … 1874 1864 struct snd_util_memblk *snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream); 1875 1865 int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk); 1866 int snd_emu10k1_alloc_pages_maybe_wider(struct snd_emu10k1 *emu, size_t size, 1867 struct snd_dma_buffer *dmab); 1876 1868 struct snd_util_memblk *snd_emu10k1_synth_alloc(struct snd_emu10k1 *emu, unsigned int size); 1877 1869 int snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *blk); … … 1896 1888 unsigned char gpr_running, 1897 1889 void *private_data, 1898 struct snd_emu10k1_fx8010_irq * *r_irq);1890 struct snd_emu10k1_fx8010_irq *irq); 1899 1891 int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu, 1900 1892 struct snd_emu10k1_fx8010_irq *irq); 1901 1893 1902 #endif /* __KERNEL__ */1903 1904 /*1905 * ---- FX8010 ----1906 */1907 1908 #define EMU10K1_CARD_CREATIVE 0x000000001909 #define EMU10K1_CARD_EMUAPS 0x000000011910 1911 #define EMU10K1_FX8010_PCM_COUNT 81912 1913 /* instruction set */1914 #define iMAC0 0x00 /* R = A + (X * Y >> 31) ; saturation */1915 #define iMAC1 0x01 /* R = A + (-X * Y >> 31) ; saturation */1916 #define iMAC2 0x02 /* R = A + (X * Y >> 31) ; wraparound */1917 #define iMAC3 0x03 /* R = A + (-X * Y >> 31) ; wraparound */1918 #define iMACINT0 0x04 /* R = A + X * Y ; saturation */1919 #define iMACINT1 0x05 /* R = A + X * Y ; wraparound (31-bit) */1920 #define iACC3 0x06 /* R = A + X + Y ; saturation */1921 #define iMACMV 0x07 /* R = A, acc += X * Y >> 31 */1922 #define iANDXOR 0x08 /* R = (A & X) ^ Y */1923 #define iTSTNEG 0x09 /* R = (A >= Y) ? X : ~X */1924 #define iLIMITGE 0x0a /* R = (A >= Y) ? X : Y */1925 #define iLIMITLT 0x0b /* R = (A < Y) ? X : Y */1926 #define iLOG 0x0c /* R = linear_data, A (log_data), X (max_exp), Y (format_word) */1927 #define iEXP 0x0d /* R = log_data, A (linear_data), X (max_exp), Y (format_word) */1928 #define iINTERP 0x0e /* R = A + (X * (Y - A) >> 31) ; saturation */1929 #define iSKIP 0x0f /* R = A (cc_reg), X (count), Y (cc_test) */1930 1931 /* GPRs */1932 #define FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x0f */1933 #define EXTIN(x) (0x10 + (x)) /* x = 0x00 - 0x0f */1934 #define EXTOUT(x) (0x20 + (x)) /* x = 0x00 - 0x0f physical outs -> FXWC low 16 bits */1935 #define FXBUS2(x) (0x30 + (x)) /* x = 0x00 - 0x0f copies of fx buses for capture -> FXWC high 16 bits */1936 /* NB: 0x31 and 0x32 are shared with Center/LFE on SB live 5.1 */1937 1938 #define C_00000000 0x401939 #define C_00000001 0x411940 #define C_00000002 0x421941 #define C_00000003 0x431942 #define C_00000004 0x441943 #define C_00000008 0x451944 #define C_00000010 0x461945 #define C_00000020 0x471946 #define C_00000100 0x481947 #define C_00010000 0x491948 #define C_00080000 0x4a1949 #define C_10000000 0x4b1950 #define C_20000000 0x4c1951 #define C_40000000 0x4d1952 #define C_80000000 0x4e1953 #define C_7fffffff 0x4f1954 #define C_ffffffff 0x501955 #define C_fffffffe 0x511956 #define C_c0000000 0x521957 #define C_4f1bbcdc 0x531958 #define C_5a7ef9db 0x541959 #define C_00100000 0x55 /* ?? */1960 #define GPR_ACCU 0x56 /* ACCUM, accumulator */1961 #define GPR_COND 0x57 /* CCR, condition register */1962 #define GPR_NOISE0 0x58 /* noise source */1963 #define GPR_NOISE1 0x59 /* noise source */1964 #define GPR_IRQ 0x5a /* IRQ register */1965 #define GPR_DBAC 0x5b /* TRAM Delay Base Address Counter */1966 #define GPR(x) (FXGPREGBASE + (x)) /* free GPRs: x = 0x00 - 0xff */1967 #define ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */1968 #define ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */1969 #define ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0x7f */1970 #define ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x80 + (x)) /* x = 0x00 - 0x1f */1971 1972 #define A_ITRAM_DATA(x) (TANKMEMDATAREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */1973 #define A_ETRAM_DATA(x) (TANKMEMDATAREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */1974 #define A_ITRAM_ADDR(x) (TANKMEMADDRREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */1975 #define A_ETRAM_ADDR(x) (TANKMEMADDRREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */1976 #define A_ITRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0x00 + (x)) /* x = 0x00 - 0xbf */1977 #define A_ETRAM_CTL(x) (A_TANKMEMCTLREGBASE + 0xc0 + (x)) /* x = 0x00 - 0x3f */1978 1979 #define A_FXBUS(x) (0x00 + (x)) /* x = 0x00 - 0x3f FX buses */1980 #define A_EXTIN(x) (0x40 + (x)) /* x = 0x00 - 0x0f physical ins */1981 #define A_P16VIN(x) (0x50 + (x)) /* x = 0x00 - 0x0f p16v ins (A2 only) "EMU32 inputs" */1982 #define A_EXTOUT(x) (0x60 + (x)) /* x = 0x00 - 0x1f physical outs -> A_FXWC1 0x79-7f unknown */1983 #define A_FXBUS2(x) (0x80 + (x)) /* x = 0x00 - 0x1f extra outs used for EFX capture -> A_FXWC2 */1984 #define A_EMU32OUTH(x) (0xa0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_10 - _1F" - ??? */1985 #define A_EMU32OUTL(x) (0xb0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_1 - _F" - ??? */1986 #define A3_EMU32IN(x) (0x160 + (x)) /* x = 0x00 - 0x3f "EMU32_IN_00 - _3F" - Only when .device = 0x0008 */1987 #define A3_EMU32OUT(x) (0x1E0 + (x)) /* x = 0x00 - 0x0f "EMU32_OUT_00 - _3F" - Only when .device = 0x0008 */1988 #define A_GPR(x) (A_FXGPREGBASE + (x))1989 1990 /* cc_reg constants */1991 #define CC_REG_NORMALIZED C_000000011992 #define CC_REG_BORROW C_000000021993 #define CC_REG_MINUS C_000000041994 #define CC_REG_ZERO C_000000081995 #define CC_REG_SATURATE C_000000101996 #define CC_REG_NONZERO C_000001001997 1998 /* FX buses */1999 #define FXBUS_PCM_LEFT 0x002000 #define FXBUS_PCM_RIGHT 0x012001 #define FXBUS_PCM_LEFT_REAR 0x022002 #define FXBUS_PCM_RIGHT_REAR 0x032003 #define FXBUS_MIDI_LEFT 0x042004 #define FXBUS_MIDI_RIGHT 0x052005 #define FXBUS_PCM_CENTER 0x062006 #define FXBUS_PCM_LFE 0x072007 #define FXBUS_PCM_LEFT_FRONT 0x082008 #define FXBUS_PCM_RIGHT_FRONT 0x092009 #define FXBUS_MIDI_REVERB 0x0c2010 #define FXBUS_MIDI_CHORUS 0x0d2011 #define FXBUS_PCM_LEFT_SIDE 0x0e2012 #define FXBUS_PCM_RIGHT_SIDE 0x0f2013 #define FXBUS_PT_LEFT 0x142014 #define FXBUS_PT_RIGHT 0x152015 2016 /* Inputs */2017 #define EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */2018 #define EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */2019 #define EXTIN_SPDIF_CD_L 0x02 /* internal S/PDIF CD - onboard - left */2020 #define EXTIN_SPDIF_CD_R 0x03 /* internal S/PDIF CD - onboard - right */2021 #define EXTIN_ZOOM_L 0x04 /* Zoom Video I2S - left */2022 #define EXTIN_ZOOM_R 0x05 /* Zoom Video I2S - right */2023 #define EXTIN_TOSLINK_L 0x06 /* LiveDrive - TOSLink Optical - left */2024 #define EXTIN_TOSLINK_R 0x07 /* LiveDrive - TOSLink Optical - right */2025 #define EXTIN_LINE1_L 0x08 /* LiveDrive - Line/Mic 1 - left */2026 #define EXTIN_LINE1_R 0x09 /* LiveDrive - Line/Mic 1 - right */2027 #define EXTIN_COAX_SPDIF_L 0x0a /* LiveDrive - Coaxial S/PDIF - left */2028 #define EXTIN_COAX_SPDIF_R 0x0b /* LiveDrive - Coaxial S/PDIF - right */2029 #define EXTIN_LINE2_L 0x0c /* LiveDrive - Line/Mic 2 - left */2030 #define EXTIN_LINE2_R 0x0d /* LiveDrive - Line/Mic 2 - right */2031 2032 /* Outputs */2033 #define EXTOUT_AC97_L 0x00 /* AC'97 playback channel - left */2034 #define EXTOUT_AC97_R 0x01 /* AC'97 playback channel - right */2035 #define EXTOUT_TOSLINK_L 0x02 /* LiveDrive - TOSLink Optical - left */2036 #define EXTOUT_TOSLINK_R 0x03 /* LiveDrive - TOSLink Optical - right */2037 #define EXTOUT_AC97_CENTER 0x04 /* SB Live 5.1 - center */2038 #define EXTOUT_AC97_LFE 0x05 /* SB Live 5.1 - LFE */2039 #define EXTOUT_HEADPHONE_L 0x06 /* LiveDrive - Headphone - left */2040 #define EXTOUT_HEADPHONE_R 0x07 /* LiveDrive - Headphone - right */2041 #define EXTOUT_REAR_L 0x08 /* Rear channel - left */2042 #define EXTOUT_REAR_R 0x09 /* Rear channel - right */2043 #define EXTOUT_ADC_CAP_L 0x0a /* ADC Capture buffer - left */2044 #define EXTOUT_ADC_CAP_R 0x0b /* ADC Capture buffer - right */2045 #define EXTOUT_MIC_CAP 0x0c /* MIC Capture buffer */2046 #define EXTOUT_AC97_REAR_L 0x0d /* SB Live 5.1 (c) 2003 - Rear Left */2047 #define EXTOUT_AC97_REAR_R 0x0e /* SB Live 5.1 (c) 2003 - Rear Right */2048 #define EXTOUT_ACENTER 0x11 /* Analog Center */2049 #define EXTOUT_ALFE 0x12 /* Analog LFE */2050 2051 /* Audigy Inputs */2052 #define A_EXTIN_AC97_L 0x00 /* AC'97 capture channel - left */2053 #define A_EXTIN_AC97_R 0x01 /* AC'97 capture channel - right */2054 #define A_EXTIN_SPDIF_CD_L 0x02 /* digital CD left */2055 #define A_EXTIN_SPDIF_CD_R 0x03 /* digital CD left */2056 #define A_EXTIN_OPT_SPDIF_L 0x04 /* audigy drive Optical SPDIF - left */2057 #define A_EXTIN_OPT_SPDIF_R 0x05 /* right */2058 #define A_EXTIN_LINE2_L 0x08 /* audigy drive line2/mic2 - left */2059 #define A_EXTIN_LINE2_R 0x09 /* right */2060 #define A_EXTIN_ADC_L 0x0a /* Philips ADC - left */2061 #define A_EXTIN_ADC_R 0x0b /* right */2062 #define A_EXTIN_AUX2_L 0x0c /* audigy drive aux2 - left */2063 #define A_EXTIN_AUX2_R 0x0d /* - right */2064 2065 /* Audigiy Outputs */2066 #define A_EXTOUT_FRONT_L 0x00 /* digital front left */2067 #define A_EXTOUT_FRONT_R 0x01 /* right */2068 #define A_EXTOUT_CENTER 0x02 /* digital front center */2069 #define A_EXTOUT_LFE 0x03 /* digital front lfe */2070 #define A_EXTOUT_HEADPHONE_L 0x04 /* headphone audigy drive left */2071 #define A_EXTOUT_HEADPHONE_R 0x05 /* right */2072 #define A_EXTOUT_REAR_L 0x06 /* digital rear left */2073 #define A_EXTOUT_REAR_R 0x07 /* right */2074 #define A_EXTOUT_AFRONT_L 0x08 /* analog front left */2075 #define A_EXTOUT_AFRONT_R 0x09 /* right */2076 #define A_EXTOUT_ACENTER 0x0a /* analog center */2077 #define A_EXTOUT_ALFE 0x0b /* analog LFE */2078 #define A_EXTOUT_ASIDE_L 0x0c /* analog side left - Audigy 2 ZS */2079 #define A_EXTOUT_ASIDE_R 0x0d /* right - Audigy 2 ZS */2080 #define A_EXTOUT_AREAR_L 0x0e /* analog rear left */2081 #define A_EXTOUT_AREAR_R 0x0f /* right */2082 #define A_EXTOUT_AC97_L 0x10 /* AC97 left (front) */2083 #define A_EXTOUT_AC97_R 0x11 /* right */2084 #define A_EXTOUT_ADC_CAP_L 0x16 /* ADC capture buffer left */2085 #define A_EXTOUT_ADC_CAP_R 0x17 /* right */2086 #define A_EXTOUT_MIC_CAP 0x18 /* Mic capture buffer */2087 2088 /* Audigy constants */2089 #define A_C_00000000 0xc02090 #define A_C_00000001 0xc12091 #define A_C_00000002 0xc22092 #define A_C_00000003 0xc32093 #define A_C_00000004 0xc42094 #define A_C_00000008 0xc52095 #define A_C_00000010 0xc62096 #define A_C_00000020 0xc72097 #define A_C_00000100 0xc82098 #define A_C_00010000 0xc92099 #define A_C_00000800 0xca2100 #define A_C_10000000 0xcb2101 #define A_C_20000000 0xcc2102 #define A_C_40000000 0xcd2103 #define A_C_80000000 0xce2104 #define A_C_7fffffff 0xcf2105 #define A_C_ffffffff 0xd02106 #define A_C_fffffffe 0xd12107 #define A_C_c0000000 0xd22108 #define A_C_4f1bbcdc 0xd32109 #define A_C_5a7ef9db 0xd42110 #define A_C_00100000 0xd52111 #define A_GPR_ACCU 0xd6 /* ACCUM, accumulator */2112 #define A_GPR_COND 0xd7 /* CCR, condition register */2113 #define A_GPR_NOISE0 0xd8 /* noise source */2114 #define A_GPR_NOISE1 0xd9 /* noise source */2115 #define A_GPR_IRQ 0xda /* IRQ register */2116 #define A_GPR_DBAC 0xdb /* TRAM Delay Base Address Counter - internal */2117 #define A_GPR_DBACE 0xde /* TRAM Delay Base Address Counter - external */2118 2119 /* definitions for debug register */2120 #define EMU10K1_DBG_ZC 0x80000000 /* zero tram counter */2121 #define EMU10K1_DBG_SATURATION_OCCURED 0x02000000 /* saturation control */2122 #define EMU10K1_DBG_SATURATION_ADDR 0x01ff0000 /* saturation address */2123 #define EMU10K1_DBG_SINGLE_STEP 0x00008000 /* single step mode */2124 #define EMU10K1_DBG_STEP 0x00004000 /* start single step */2125 #define EMU10K1_DBG_CONDITION_CODE 0x00003e00 /* condition code */2126 #define EMU10K1_DBG_SINGLE_STEP_ADDR 0x000001ff /* single step address */2127 2128 /* tank memory address line */2129 #ifndef __KERNEL__2130 #define TANKMEMADDRREG_ADDR_MASK 0x000fffff /* 20 bit tank address field */2131 #define TANKMEMADDRREG_CLEAR 0x00800000 /* Clear tank memory */2132 #define TANKMEMADDRREG_ALIGN 0x00400000 /* Align read or write relative to tank access */2133 #define TANKMEMADDRREG_WRITE 0x00200000 /* Write to tank memory */2134 #define TANKMEMADDRREG_READ 0x00100000 /* Read from tank memory */2135 #endif2136 2137 struct snd_emu10k1_fx8010_info {2138 unsigned int internal_tram_size; /* in samples */2139 unsigned int external_tram_size; /* in samples */2140 char fxbus_names[16][32]; /* names of FXBUSes */2141 char extin_names[16][32]; /* names of external inputs */2142 char extout_names[32][32]; /* names of external outputs */2143 unsigned int gpr_controls; /* count of GPR controls */2144 };2145 2146 #define EMU10K1_GPR_TRANSLATION_NONE 02147 #define EMU10K1_GPR_TRANSLATION_TABLE100 12148 #define EMU10K1_GPR_TRANSLATION_BASS 22149 #define EMU10K1_GPR_TRANSLATION_TREBLE 32150 #define EMU10K1_GPR_TRANSLATION_ONOFF 42151 2152 struct snd_emu10k1_fx8010_control_gpr {2153 struct snd_ctl_elem_id id; /* full control ID definition */2154 unsigned int vcount; /* visible count */2155 unsigned int count; /* count of GPR (1..16) */2156 unsigned short gpr[32]; /* GPR number(s) */2157 unsigned int value[32]; /* initial values */2158 unsigned int min; /* minimum range */2159 unsigned int max; /* maximum range */2160 unsigned int translation; /* translation type (EMU10K1_GPR_TRANSLATION*) */2161 const unsigned int *tlv;2162 };2163 2164 /* old ABI without TLV support */2165 struct snd_emu10k1_fx8010_control_old_gpr {2166 struct snd_ctl_elem_id id;2167 unsigned int vcount;2168 unsigned int count;2169 unsigned short gpr[32];2170 unsigned int value[32];2171 unsigned int min;2172 unsigned int max;2173 unsigned int translation;2174 };2175 2176 struct snd_emu10k1_fx8010_code {2177 char name[128];2178 2179 DECLARE_BITMAP(gpr_valid, 0x200); /* bitmask of valid initializers */2180 __u32 __user *gpr_map; /* initializers */2181 2182 unsigned int gpr_add_control_count; /* count of GPR controls to add/replace */2183 struct snd_emu10k1_fx8010_control_gpr __user *gpr_add_controls; /* GPR controls to add/replace */2184 2185 unsigned int gpr_del_control_count; /* count of GPR controls to remove */2186 struct snd_ctl_elem_id __user *gpr_del_controls; /* IDs of GPR controls to remove */2187 2188 unsigned int gpr_list_control_count; /* count of GPR controls to list */2189 unsigned int gpr_list_control_total; /* total count of GPR controls */2190 struct snd_emu10k1_fx8010_control_gpr __user *gpr_list_controls; /* listed GPR controls */2191 2192 DECLARE_BITMAP(tram_valid, 0x100); /* bitmask of valid initializers */2193 __u32 __user *tram_data_map; /* data initializers */2194 __u32 __user *tram_addr_map; /* map initializers */2195 2196 DECLARE_BITMAP(code_valid, 1024); /* bitmask of valid instructions */2197 __u32 __user *code; /* one instruction - 64 bits */2198 };2199 2200 struct snd_emu10k1_fx8010_tram {2201 unsigned int address; /* 31.bit == 1 -> external TRAM */2202 unsigned int size; /* size in samples (4 bytes) */2203 unsigned int *samples; /* pointer to samples (20-bit) */2204 /* NULL->clear memory */2205 };2206 2207 struct snd_emu10k1_fx8010_pcm_rec {2208 unsigned int substream; /* substream number */2209 unsigned int res1; /* reserved */2210 unsigned int channels; /* 16-bit channels count, zero = remove this substream */2211 unsigned int tram_start; /* ring buffer position in TRAM (in samples) */2212 unsigned int buffer_size; /* count of buffered samples */2213 unsigned short gpr_size; /* GPR containing size of ringbuffer in samples (host) */2214 unsigned short gpr_ptr; /* GPR containing current pointer in the ring buffer (host = reset, FX8010) */2215 unsigned short gpr_count; /* GPR containing count of samples between two interrupts (host) */2216 unsigned short gpr_tmpcount; /* GPR containing current count of samples to interrupt (host = set, FX8010) */2217 unsigned short gpr_trigger; /* GPR containing trigger (activate) information (host) */2218 unsigned short gpr_running; /* GPR containing info if PCM is running (FX8010) */2219 unsigned char pad; /* reserved */2220 unsigned char etram[32]; /* external TRAM address & data (one per channel) */2221 unsigned int res2; /* reserved */2222 };2223 2224 #define SNDRV_EMU10K1_VERSION SNDRV_PROTOCOL_VERSION(1, 0, 1)2225 2226 #define SNDRV_EMU10K1_IOCTL_INFO _IOR ('H', 0x10, struct snd_emu10k1_fx8010_info)2227 #define SNDRV_EMU10K1_IOCTL_CODE_POKE _IOW ('H', 0x11, struct snd_emu10k1_fx8010_code)2228 #define SNDRV_EMU10K1_IOCTL_CODE_PEEK _IOWR('H', 0x12, struct snd_emu10k1_fx8010_code)2229 #define SNDRV_EMU10K1_IOCTL_TRAM_SETUP _IOW ('H', 0x20, int)2230 #define SNDRV_EMU10K1_IOCTL_TRAM_POKE _IOW ('H', 0x21, struct snd_emu10k1_fx8010_tram)2231 #define SNDRV_EMU10K1_IOCTL_TRAM_PEEK _IOWR('H', 0x22, struct snd_emu10k1_fx8010_tram)2232 #define SNDRV_EMU10K1_IOCTL_PCM_POKE _IOW ('H', 0x30, struct snd_emu10k1_fx8010_pcm_rec)2233 #define SNDRV_EMU10K1_IOCTL_PCM_PEEK _IOWR('H', 0x31, struct snd_emu10k1_fx8010_pcm_rec)2234 #define SNDRV_EMU10K1_IOCTL_PVERSION _IOR ('H', 0x40, int)2235 #define SNDRV_EMU10K1_IOCTL_STOP _IO ('H', 0x80)2236 #define SNDRV_EMU10K1_IOCTL_CONTINUE _IO ('H', 0x81)2237 #define SNDRV_EMU10K1_IOCTL_ZERO_TRAM_COUNTER _IO ('H', 0x82)2238 #define SNDRV_EMU10K1_IOCTL_SINGLE_STEP _IOW ('H', 0x83, int)2239 #define SNDRV_EMU10K1_IOCTL_DBG_READ _IOR ('H', 0x84, int)2240 2241 /* typedefs for compatibility to user-space */2242 typedef struct snd_emu10k1_fx8010_info emu10k1_fx8010_info_t;2243 typedef struct snd_emu10k1_fx8010_control_gpr emu10k1_fx8010_control_gpr_t;2244 typedef struct snd_emu10k1_fx8010_code emu10k1_fx8010_code_t;2245 typedef struct snd_emu10k1_fx8010_tram emu10k1_fx8010_tram_t;2246 typedef struct snd_emu10k1_fx8010_pcm_rec emu10k1_fx8010_pcm_t;2247 2248 1894 #endif /* __SOUND_EMU10K1_H */ -
GPL/trunk/alsa-kernel/include/sound/emu10k1_synth.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __EMU10K1_SYNTH_H 2 3 #define __EMU10K1_SYNTH_H … … 5 6 * 6 7 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de> 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 */ 22 9 23 #include "emu10k1.h"24 #include "emux_synth.h"10 #include <sound/emu10k1.h> 11 #include <sound/emux_synth.h> 25 12 26 13 /* sequencer device id */ -
GPL/trunk/alsa-kernel/include/sound/emu8000.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_EMU8000_H 2 3 #define __SOUND_EMU8000_H … … 6 7 * Copyright (C) 1999 Steve Ratcliffe 7 8 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de> 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 9 */ 23 10 24 #include "emux_synth.h"25 #include "seq_kernel.h"11 #include <sound/emux_synth.h> 12 #include <sound/seq_kernel.h> 26 13 27 14 /* -
GPL/trunk/alsa-kernel/include/sound/emu8000_reg.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_EMU8000_REG_H 2 3 #define __SOUND_EMU8000_REG_H … … 7 8 * 8 9 * Based on awe_wave.c by Takashi Iwai 9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 10 */ 25 11 -
GPL/trunk/alsa-kernel/include/sound/emux_legacy.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_EMUX_LEGACY_H 2 3 #define __SOUND_EMUX_LEGACY_H … … 6 7 * 7 8 * Definitions of OSS compatible headers for Emu8000 device informations 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 9 */ 24 10 25 #include "seq_oss_legacy.h"11 #include <sound/seq_oss_legacy.h> 26 12 27 13 /* -
GPL/trunk/alsa-kernel/include/sound/emux_synth.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_EMUX_SYNTH_H 2 3 #define __SOUND_EMUX_SYNTH_H … … 6 7 * 7 8 * Copyright (C) 2000 Takashi Iwai <tiwai@suse.de> 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #include "seq_kernel.h" 25 #include "seq_device.h" 26 #include "soundfont.h" 27 #include "seq_midi_emul.h" 28 #ifdef CONFIG_SND_SEQUENCER_OSS 29 #include "seq_oss.h" 30 #endif 31 #include "emux_legacy.h" 32 #include "seq_virmidi.h" 9 */ 10 11 #include <sound/seq_kernel.h> 12 #include <sound/seq_device.h> 13 #include <sound/soundfont.h> 14 #include <sound/seq_midi_emul.h> 15 #include <sound/seq_oss.h> 16 #include <sound/emux_legacy.h> 17 #include <sound/seq_virmidi.h> 33 18 34 19 /* … … 67 52 void (*sysex)(struct snd_emux *emu, char *buf, int len, int parsed, 68 53 struct snd_midi_channel_set *chset); 69 #if def CONFIG_SND_SEQUENCER_OSS54 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 70 55 int (*oss_ioctl)(struct snd_emux *emu, int cmd, int p1, int p2); 71 56 #endif … … 126 111 struct snd_util_memhdr *memhdr; /* memory chunk information */ 127 112 128 #ifdef CONFIG_ PROC_FS113 #ifdef CONFIG_SND_PROC_FS 129 114 struct snd_info_entry *proc; 130 115 #endif 131 116 132 #if def CONFIG_SND_SEQUENCER_OSS117 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 133 118 struct snd_seq_device *oss_synth; 134 119 #endif … … 151 136 struct snd_emux_effect_table *effect; 152 137 #endif 153 #if def CONFIG_SND_SEQUENCER_OSS138 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 154 139 struct snd_seq_oss_arg *oss_arg; 155 140 #endif -
GPL/trunk/alsa-kernel/include/sound/es1688.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_ES1688_H 2 3 #define __SOUND_ES1688_H … … 5 6 * Header file for ES488/ES1688 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 25 #include "control.h"26 #include "pcm.h"10 #include <sound/control.h> 11 #include <sound/pcm.h> 27 12 #include <linux/interrupt.h> 28 13 … … 30 15 #define ES1688_HW_688 0x0001 31 16 #define ES1688_HW_1688 0x0002 17 #define ES1688_HW_UNDEF 0x0003 32 18 33 19 struct snd_es1688 { … … 115 101 int dma8, 116 102 unsigned short hardware); 117 int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device, 118 struct snd_pcm **rpcm); 103 int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device); 119 104 int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip); 120 105 int snd_es1688_reset(struct snd_es1688 *chip); -
GPL/trunk/alsa-kernel/include/sound/gus.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_GUS_H 2 3 #define __SOUND_GUS_H … … 5 6 * Global structures used for GUS part of ALSA driver 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 25 #include "pcm.h"26 #include "rawmidi.h"27 #include "timer.h"28 #include "seq_midi_emul.h"29 #include "seq_device.h"30 #include < asm/io.h>10 #include <sound/pcm.h> 11 #include <sound/rawmidi.h> 12 #include <sound/timer.h> 13 #include <sound/seq_midi_emul.h> 14 #include <sound/seq_device.h> 15 #include <linux/io.h> 31 16 32 17 /* IO ports */ … … 592 577 /* gus_pcm.c */ 593 578 594 int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm);579 int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index); 595 580 596 581 #ifdef CONFIG_SND_DEBUG … … 621 606 /* gus_uart.c */ 622 607 623 int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi **rrawmidi);608 int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device); 624 609 625 610 /* gus_dram.c */ … … 629 614 unsigned int addr, unsigned int size, int rom); 630 615 616 /* gus_timer.c */ 617 void snd_gf1_timers_init(struct snd_gus_card *gus); 618 void snd_gf1_timers_done(struct snd_gus_card *gus); 619 631 620 #endif /* __SOUND_GUS_H */ -
GPL/trunk/alsa-kernel/include/sound/hda_hwdep.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * HWDEP Interface for HD-audio codec 3 4 * 4 5 * Copyright (c) 2007 Takashi Iwai <tiwai@suse.de> 5 *6 * This driver is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (at your option) any later version.10 *11 * This driver is distributed in the hope that it will be useful,12 * but WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 6 */ 20 7 -
GPL/trunk/alsa-kernel/include/sound/hwdep.h
r426 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_HWDEP_H 2 3 #define __SOUND_HWDEP_H … … 5 6 * Hardware dependent layer 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 38 23 int (*open)(struct snd_hwdep *hw, struct file * file); 39 24 int (*release)(struct snd_hwdep *hw, struct file * file); 40 unsigned int (*poll)(struct snd_hwdep *hw, struct file *file,25 __poll_t (*poll)(struct snd_hwdep *hw, struct file *file, 41 26 poll_table *wait); 42 27 int (*ioctl)(struct snd_hwdep *hw, struct file *file, … … 61 46 62 47 #ifdef CONFIG_SND_OSSEMUL 63 char oss_dev[32];64 48 int oss_type; 65 49 int ossreg; … … 70 54 void *private_data; 71 55 void (*private_free) (struct snd_hwdep *hwdep); 56 struct device dev; 72 57 73 58 struct mutex open_mutex; -
GPL/trunk/alsa-kernel/include/sound/i2c.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_I2C_H 2 3 #define __SOUND_I2C_H 3 4 4 5 /* 5 *6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 *21 *22 6 */ 23 7 … … 67 51 void *ops; 68 52 } hw_ops; /* lowlevel operations */ 69 struct snd_i2c_ops *ops; /* midlevel operations */53 const struct snd_i2c_ops *ops; /* midlevel operations */ 70 54 71 55 unsigned long private_value; -
GPL/trunk/alsa-kernel/include/sound/info.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_INFO_H 2 3 #define __SOUND_INFO_H … … 5 6 * Header file for info interface 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 25 10 #include <linux/poll.h> 11 #include <linux/seq_file.h> 12 #include <sound/core.h> 26 13 27 14 /* buffer for information */ … … 61 48 void *file_private_data, struct file *file, 62 49 loff_t offset, int orig); 63 unsigned int (*poll)(struct snd_info_entry *entry,50 __poll_t (*poll)(struct snd_info_entry *entry, 64 51 void *file_private_data, struct file *file, 65 52 poll_table *wait); … … 73 60 struct snd_info_entry { 74 61 const char *name; 75 mode_t mode;62 umode_t mode; 76 63 long size; 77 64 unsigned short content; 78 65 union { 79 66 struct snd_info_entry_text text; 80 struct snd_info_entry_ops *ops;67 const struct snd_info_entry_ops *ops; 81 68 } c; 82 69 struct snd_info_entry *parent; 83 struct snd_card *card;84 70 struct module *module; 85 71 void *private_data; … … 91 77 }; 92 78 93 #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)79 #if (defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_SND_PROC_FS)) || defined(TARGET_OS2) 94 80 int snd_info_minor_register(void); 95 int snd_info_minor_unregister(void); 96 #else 97 #define snd_info_minor_register() /* NOP */ 98 #define snd_info_minor_unregister() /* NOP */ 99 #endif 100 101 102 #ifdef CONFIG_PROC_FS 81 #else 82 #define snd_info_minor_register() 0 83 #endif 84 85 86 #if defined(CONFIG_SND_PROC_FS) 103 87 104 88 extern struct snd_info_entry *snd_seq_root; … … 111 95 #endif 112 96 97 /** 98 * snd_iprintf - printf on the procfs buffer 99 * @buf: the procfs buffer 100 * @fmt: the printf format 101 * 102 * Outputs the string on the procfs buffer just like printf(). 103 * 104 * Return: zero for success, or a negative error code. 105 */ 113 106 #ifndef TARGET_OS2 114 int snd_iprintf(struct snd_info_buffer *buffer, const char *fmt, ...) \ 115 __attribute__ ((format (printf, 2, 3))); 116 #else 117 int snd_iprintf(struct snd_info_buffer * buffer, char *fmt,...); 118 #endif 107 #define snd_iprintf(buf, fmt, args...) \ 108 seq_printf((struct seq_file *)(buf)->buffer, fmt, ##args) 109 #else 110 static inline int snd_iprintf(struct snd_info_buffer *buffer, char *fmt, ...) { return 0; } 111 #endif 112 119 113 int snd_info_init(void); 120 114 int snd_info_done(void); … … 140 134 141 135 /* for card drivers */ 142 int snd_card_proc_new(struct snd_card *card, const char *name, 143 struct snd_info_entry **entryp); 136 static inline int snd_card_proc_new(struct snd_card *card, const char *name, 137 struct snd_info_entry **entryp) 138 { 139 *entryp = snd_info_create_card_entry(card, name, card->proc_root); 140 return *entryp ? 0 : -ENOMEM; 141 } 144 142 145 143 static inline void snd_info_set_text_ops(struct snd_info_entry *entry, … … 150 148 entry->c.text.read = read; 151 149 } 150 151 int snd_card_rw_proc_new(struct snd_card *card, const char *name, 152 void *private_data, 153 void (*read)(struct snd_info_entry *, 154 struct snd_info_buffer *), 155 void (*write)(struct snd_info_entry *entry, 156 struct snd_info_buffer *buffer)); 152 157 153 158 int snd_info_check_reserved_words(const char *str); … … 177 182 static inline int snd_card_proc_new(struct snd_card *card, const char *name, 178 183 struct snd_info_entry **entryp) { return -EINVAL; } 179 static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)),184 static inline void snd_info_set_text_ops(struct snd_info_entry *entry /*__attribute__((unused))*/, 180 185 void *private_data, 181 186 void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {} 182 187 static inline int snd_card_rw_proc_new(struct snd_card *card, const char *name, 188 void *private_data, 189 void (*read)(struct snd_info_entry *, 190 struct snd_info_buffer *), 191 void (*write)(struct snd_info_entry *entry, 192 struct snd_info_buffer *buffer)) 193 { 194 return 0; 195 } 183 196 static inline int snd_info_check_reserved_words(const char *str) { return 1; } 184 197 185 198 #endif 199 200 /** 201 * snd_card_ro_proc_new - Create a read-only text proc file entry for the card 202 * @card: the card instance 203 * @name: the file name 204 * @private_data: the arbitrary private data 205 * @read: the read callback 206 * 207 * This proc file entry will be registered via snd_card_register() call, and 208 * it will be removed automatically at the card removal, too. 209 */ 210 static inline int 211 snd_card_ro_proc_new(struct snd_card *card, const char *name, 212 void *private_data, 213 void (*read)(struct snd_info_entry *, 214 struct snd_info_buffer *)) 215 { 216 return snd_card_rw_proc_new(card, name, private_data, read, NULL); 217 } 186 218 187 219 /* … … 189 221 */ 190 222 191 #if defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_PROC_FS)223 #if (defined(CONFIG_SND_OSSEMUL) && defined(CONFIG_SND_PROC_FS)) || defined(TARGET_OS2) 192 224 193 225 #define SNDRV_OSS_INFO_DEV_AUDIO 0 … … 202 234 #define snd_oss_info_unregister(dev, num) snd_oss_info_register(dev, num, NULL) 203 235 204 #endif /* CONFIG_SND_OSSEMUL && CONFIG_ PROC_FS */236 #endif /* CONFIG_SND_OSSEMUL && CONFIG_SND_PROC_FS */ 205 237 206 238 #endif /* __SOUND_INFO_H */ -
GPL/trunk/alsa-kernel/include/sound/initval.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_INITVAL_H 2 3 #define __SOUND_INITVAL_H … … 5 6 * Init values for soundcard modules 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 8 */ 23 9 … … 36 22 #define MODULE_DEVICES(val) 37 23 #define MODULE_PARM_SYNTAX(id, val) 38 #define module_param_array(name, type, nump, perm)39 #define module_param(name, type, perm)40 24 #else 41 25 #define MODULE_CLASSES(val) MODULE_GENERIC_STRING(info_classes, val) … … 120 104 #define SNDRV_PORT_DESC SNDRV_ENABLED ",allows:{{0,0xffff}},base:16" 121 105 106 #ifdef SNDRV_LEGACY_FIND_FREE_IOPORT 107 static long snd_legacy_find_free_ioport(const long *port_table, long size) 108 { 109 while (*port_table != -1) { 110 if (request_region(*port_table, size, "ALSA test")) { 111 release_region(*port_table, size); 112 return *port_table; 113 } 114 port_table++; 115 } 116 return -1; 117 } 118 #endif 119 122 120 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ 123 121 #include <linux/interrupt.h> … … 128 126 } 129 127 130 static int snd_legacy_find_free_irq( int *irq_table)128 static int snd_legacy_find_free_irq(const int *irq_table) 131 129 { 132 130 while (*irq_table != -1) { 133 131 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler, 134 IRQF_ DISABLED | IRQF_PROBE_SHARED, "ALSA Test IRQ",132 IRQF_PROBE_SHARED, "ALSA Test IRQ", 135 133 (void *) irq_table)) { 136 134 free_irq(*irq_table, (void *) irq_table); … … 144 142 145 143 #ifdef SNDRV_LEGACY_FIND_FREE_DMA 146 static int snd_legacy_find_free_dma( int *dma_table)144 static int snd_legacy_find_free_dma(const int *dma_table) 147 145 { 148 146 while (*dma_table != -1) { -
GPL/trunk/alsa-kernel/include/sound/jack.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_JACK_H 2 3 #define __SOUND_JACK_H … … 6 7 * 7 8 * Copyright 2008 Wolfson Microelectronics plc 8 *9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 9 */ 25 10 … … 29 14 30 15 /** 31 * Jack types which can be reported. These values are used as a 32 * bitmask. 16 * enum snd_jack_types - Jack types which can be reported 17 * @SND_JACK_HEADPHONE: Headphone 18 * @SND_JACK_MICROPHONE: Microphone 19 * @SND_JACK_HEADSET: Headset 20 * @SND_JACK_LINEOUT: Line out 21 * @SND_JACK_MECHANICAL: Mechanical switch 22 * @SND_JACK_VIDEOOUT: Video out 23 * @SND_JACK_AVOUT: AV (Audio Video) out 24 * @SND_JACK_LINEIN: Line in 25 * @SND_JACK_BTN_0: Button 0 26 * @SND_JACK_BTN_1: Button 1 27 * @SND_JACK_BTN_2: Button 2 28 * @SND_JACK_BTN_3: Button 3 29 * @SND_JACK_BTN_4: Button 4 30 * @SND_JACK_BTN_5: Button 5 31 * 32 * These values are used as a bitmask. 33 33 * 34 34 * Note that this must be kept in sync with the lookup table in … … 43 43 SND_JACK_VIDEOOUT = 0x0010, 44 44 SND_JACK_AVOUT = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT, 45 SND_JACK_LINEIN = 0x0020, 45 46 46 47 /* Kept separate from switches to facilitate implementation */ … … 53 54 }; 54 55 56 /* Keep in sync with definitions above */ 57 #define SND_JACK_SWITCH_TYPES 6 58 55 59 struct snd_jack { 60 struct list_head kctl_list; 61 struct snd_card *card; 62 const char *id; 63 #ifdef CONFIG_SND_JACK_INPUT_DEV 56 64 struct input_dev *input_dev; 57 65 int registered; 58 66 int type; 59 const char *id;60 67 char name[100]; 61 68 unsigned int key[6]; /* Keep in sync with definitions above */ 69 #endif /* CONFIG_SND_JACK_INPUT_DEV */ 62 70 void *private_data; 63 71 void (*private_free)(struct snd_jack *); … … 67 75 68 76 int snd_jack_new(struct snd_card *card, const char *id, int type, 69 struct snd_jack **jack); 77 struct snd_jack **jack, bool initial_kctl, bool phantom_jack); 78 int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask); 79 #ifdef CONFIG_SND_JACK_INPUT_DEV 70 80 void snd_jack_set_parent(struct snd_jack *jack, struct device *parent); 71 81 int snd_jack_set_key(struct snd_jack *jack, enum snd_jack_types type, 72 82 int keytype); 73 83 #endif 74 84 void snd_jack_report(struct snd_jack *jack, int status); 75 85 76 86 #else 77 78 87 static inline int snd_jack_new(struct snd_card *card, const char *id, int type, 79 struct snd_jack **jack )88 struct snd_jack **jack, bool initial_kctl, bool phantom_jack) 80 89 { 81 90 return 0; 82 91 } 83 92 84 static inline void snd_jack_set_parent(struct snd_jack *jack, 85 struct device *parent) 93 static inline int snd_jack_add_new_kctl(struct snd_jack *jack, const char * name, int mask) 86 94 { 95 return 0; 87 96 } 88 97 … … 93 102 #endif 94 103 104 #if !defined(CONFIG_SND_JACK) || !defined(CONFIG_SND_JACK_INPUT_DEV) 105 static inline void snd_jack_set_parent(struct snd_jack *jack, 106 struct device *parent) 107 { 108 } 109 110 static inline int snd_jack_set_key(struct snd_jack *jack, 111 enum snd_jack_types type, 112 int keytype) 113 { 114 return 0; 115 } 116 #endif /* !CONFIG_SND_JACK || !CONFIG_SND_JACK_INPUT_DEV */ 117 95 118 #endif -
GPL/trunk/alsa-kernel/include/sound/memalloc.h
r464 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 4 5 * 5 6 * Generic memory allocators 6 *7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 7 */ 23 8 24 9 #ifndef __SOUND_MEMALLOC_H 25 10 #define __SOUND_MEMALLOC_H 11 12 #include <asm/page.h> 26 13 27 14 struct device; … … 35 22 }; 36 23 37 #ifndef snd_dma_pci_data 38 #define snd_dma_pci_data(pci) (&(pci)->dev) 39 #define snd_dma_isa_data() NULL 40 #define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x)) 41 #endif 24 #define snd_dma_continuous_data(x) ((struct device *)(__force unsigned long)(x)) 42 25 43 26 … … 48 31 #define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ 49 32 #define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ 33 #define SNDRV_DMA_TYPE_DEV_UC 5 /* continuous non-cahced */ 50 34 #ifdef CONFIG_SND_DMA_SGBUF 51 35 #define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ 36 #define SNDRV_DMA_TYPE_DEV_UC_SG 6 /* SG non-cached */ 52 37 #else 53 38 #define SNDRV_DMA_TYPE_DEV_SG SNDRV_DMA_TYPE_DEV /* no SG-buf support */ 39 #define SNDRV_DMA_TYPE_DEV_UC_SG SNDRV_DMA_TYPE_DEV_UC 54 40 #endif 41 #ifdef CONFIG_GENERIC_ALLOCATOR 42 #define SNDRV_DMA_TYPE_DEV_IRAM 4 /* generic device iram-buffer */ 43 #else 44 #define SNDRV_DMA_TYPE_DEV_IRAM SNDRV_DMA_TYPE_DEV 45 #endif 46 #define SNDRV_DMA_TYPE_VMALLOC 7 /* vmalloc'ed buffer */ 55 47 56 48 /* … … 64 56 void *private_data; /* private for allocator; don't touch */ 65 57 }; 58 59 /* 60 * return the pages matching with the given byte size 61 */ 62 static inline unsigned int snd_sgbuf_aligned_pages(size_t size) 63 { 64 return (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 65 } 66 66 67 67 #ifdef CONFIG_SND_DMA_SGBUF … … 89 89 90 90 /* 91 * return the pages matching with the given byte size92 */93 static inline unsigned int snd_sgbuf_aligned_pages(size_t size)94 {95 return (size + PAGE_SIZE - 1) >> PAGE_SHIFT;96 }97 98 /*99 91 * return the physical address at the corresponding offset 100 92 */ 101 static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 93 static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, 94 size_t offset) 102 95 { 103 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; 104 addr &= PAGE_MASK; 96 struct snd_sg_buf *sgbuf = dmab->private_data; 97 dma_addr_t addr; 98 99 if (!sgbuf) 100 return dmab->addr + offset; 101 addr = sgbuf->table[offset >> PAGE_SHIFT].addr; 102 addr &= ~((dma_addr_t)PAGE_SIZE - 1); 105 103 return addr + offset % PAGE_SIZE; 106 104 } … … 109 107 * return the virtual address at the corresponding offset 110 108 */ 111 static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) 109 static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab, 110 size_t offset) 112 111 { 112 struct snd_sg_buf *sgbuf = dmab->private_data; 113 114 if (!sgbuf) 115 return dmab->area + offset; 113 116 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; 114 117 } 118 119 unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab, 120 unsigned int ofs, unsigned int size); 121 #else 122 /* non-SG versions */ 123 static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab, 124 size_t offset) 125 { 126 return dmab->addr + offset; 127 } 128 129 static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab, 130 size_t offset) 131 { 132 return dmab->area + offset; 133 } 134 135 #define snd_sgbuf_get_chunk_size(dmab, ofs, size) (size) 136 115 137 #endif /* CONFIG_SND_DMA_SGBUF */ 116 138 … … 122 144 void snd_dma_free_pages(struct snd_dma_buffer *dmab); 123 145 124 /* buffer-preservation managements */125 126 #define snd_dma_pci_buf_id(pci) (((unsigned int)(pci)->vendor << 16) | (pci)->device)127 128 size_t snd_dma_get_reserved_buf(struct snd_dma_buffer *dmab, unsigned int id);129 int snd_dma_reserve_buf(struct snd_dma_buffer *dmab, unsigned int id);130 131 /* basic memory allocation functions */132 void *snd_malloc_pages(size_t size, gfp_t gfp_flags);133 void snd_free_pages(void *ptr, size_t size);134 135 146 #endif /* __SOUND_MEMALLOC_H */ 136 147 -
GPL/trunk/alsa-kernel/include/sound/minors.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_MINORS_H 2 3 #define __SOUND_MINORS_H … … 4 5 /* 5 6 * MINOR numbers 6 *7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 7 */ 23 8 … … 36 21 37 22 #ifndef CONFIG_SND_DYNAMIC_MINORS 38 /* 2 - 3 (reserved)*/23 #define SNDRV_MINOR_COMPRESS 2 /* 2 - 3 */ 39 24 #define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 40 25 #define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ … … 50 35 #define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 51 36 #define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 37 #define SNDRV_DEVICE_TYPE_COMPRESS SNDRV_MINOR_COMPRESS 52 38 53 39 #else /* CONFIG_SND_DYNAMIC_MINORS */ … … 61 47 SNDRV_DEVICE_TYPE_PCM_PLAYBACK, 62 48 SNDRV_DEVICE_TYPE_PCM_CAPTURE, 49 SNDRV_DEVICE_TYPE_COMPRESS, 63 50 }; 64 51 -
GPL/trunk/alsa-kernel/include/sound/mixer_oss.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_MIXER_OSS_H 2 3 #define __SOUND_MIXER_OSS_H … … 5 6 * OSS MIXER API 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 25 #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)10 #if IS_ENABLED(CONFIG_SND_MIXER_OSS) 26 11 27 12 #define SNDRV_OSS_MAX_MIXERS 32 … … 74 59 }; 75 60 61 int snd_mixer_oss_ioctl_card(struct snd_card *card, 62 unsigned int cmd, unsigned long arg); 63 76 64 #endif /* CONFIG_SND_MIXER_OSS */ 77 65 -
GPL/trunk/alsa-kernel/include/sound/mpu401.h
r399 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_MPU401_H 2 3 #define __SOUND_MPU401_H … … 5 6 * Header file for MPU-401 and compatible cards 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 25 #include "rawmidi.h"10 #include <sound/rawmidi.h> 26 11 #include <linux/interrupt.h> 27 12 … … 51 36 #define MPU401_INFO_MMIO (1 << 3) /* MMIO access */ 52 37 #define MPU401_INFO_TX_IRQ (1 << 4) /* independent TX irq */ 38 #define MPU401_INFO_IRQ_HOOK (1 << 5) /* mpu401 irq handler is called 39 from driver irq handler */ 53 40 #define MPU401_INFO_NO_ACK (1 << 6) /* No ACK cmd needed */ 41 #define MPU401_INFO_USE_TIMER (1 << 15) /* internal */ 54 42 55 43 #define MPU401_MODE_BIT_INPUT 0 … … 74 62 unsigned long cport; /* port + 1 (usually) */ 75 63 struct resource *res; /* port resource */ 76 int irq; /* IRQ number of MPU-401 chip (-1 = poll) */ 77 int irq_flags; 64 int irq; /* IRQ number of MPU-401 chip */ 78 65 79 66 unsigned long mode; /* MPU401_MODE_XXXX */ … … 132 119 unsigned int info_flags, 133 120 int irq, 134 int irq_flags,135 121 struct snd_rawmidi ** rrawmidi); 136 122 -
GPL/trunk/alsa-kernel/include/sound/opl3.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_OPL3_H 2 3 #define __SOUND_OPL3_H … … 7 8 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 8 9 * Hannu Savolainen 1993-1996 9 *10 10 * 11 11 * The OPL-3 mode is switched on by writing 0x01, to the offset 5 … … 34 34 * register of the voice (0xC0-0xC8). In 4 OP voices these bits are 35 35 * in the second half of the voice. 36 *37 *38 * This program is free software; you can redistribute it and/or modify39 * it under the terms of the GNU General Public License as published by40 * the Free Software Foundation; either version 2 of the License, or41 * (at your option) any later version.42 *43 * This program is distributed in the hope that it will be useful,44 * but WITHOUT ANY WARRANTY; without even the implied warranty of45 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the46 * GNU General Public License for more details.47 *48 * You should have received a copy of the GNU General Public License49 * along with this program; if not, write to the Free Software50 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA51 *52 36 */ 53 37 … … 56 40 #include <sound/timer.h> 57 41 #include <sound/seq_midi_emul.h> 58 #ifdef CONFIG_SND_SEQUENCER_OSS59 42 #include <sound/seq_oss.h> 60 43 #include <sound/seq_oss_legacy.h> 61 #endif62 44 #include <sound/seq_device.h> 63 45 #include <sound/asound_fm.h> … … 330 312 unsigned char rhythm; /* percussion mode flag */ 331 313 unsigned char max_voices; /* max number of voices */ 332 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)314 #if IS_ENABLED(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER) 333 315 #define SNDRV_OPL3_MODE_SYNTH 0 /* OSS - voices allocated by application */ 334 316 #define SNDRV_OPL3_MODE_SEQ 1 /* ALSA - driver handles voice allocation */ … … 339 321 struct snd_midi_channel_set * chset; 340 322 341 #if def CONFIG_SND_SEQUENCER_OSS323 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) || defined(CONFIG_SND_SEQUENCER) 342 324 struct snd_seq_device *oss_seq_dev; /* OSS sequencer device */ 343 325 struct snd_midi_channel_set * oss_chset; … … 383 365 void snd_opl3_reset(struct snd_opl3 * opl3); 384 366 385 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)367 #if IS_ENABLED(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER) 386 368 long snd_opl3_write(struct snd_hwdep *hw, const char __user *buf, long count, 387 369 loff_t *offset); -
GPL/trunk/alsa-kernel/include/sound/opl4.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_OPL4_H 2 3 #define __SOUND_OPL4_H … … 5 6 * Global definitions for the OPL4 driver 6 7 * Copyright (c) 2003 by Clemens Ladisch <clemens@ladisch.de> 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 */ 22 9 -
GPL/trunk/alsa-kernel/include/sound/pcm-indirect.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * Helper functions for indirect PCM data transfer … … 4 5 * Copyright (c) by Takashi Iwai <tiwai@suse.de> 5 6 * Jaroslav Kysela <perex@perex.cz> 6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.20 7 */ 21 8 … … 44 31 * helper function for playback ack callback 45 32 */ 46 static inline void33 static inline int 47 34 snd_pcm_indirect_playback_transfer(struct snd_pcm_substream *substream, 48 35 struct snd_pcm_indirect *rec, … … 57 44 if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2)) 58 45 diff += runtime->boundary; 46 if (diff < 0) 47 return -EINVAL; 59 48 rec->sw_ready += (int)frames_to_bytes(runtime, diff); 60 49 rec->appl_ptr = appl_ptr; … … 83 72 rec->sw_ready -= bytes; 84 73 } 74 return 0; 85 75 } 86 76 … … 110 100 * helper function for capture ack callback 111 101 */ 112 static inline void102 static inline int 113 103 snd_pcm_indirect_capture_transfer(struct snd_pcm_substream *substream, 114 104 struct snd_pcm_indirect *rec, … … 122 112 if (diff < -(snd_pcm_sframes_t) (runtime->boundary / 2)) 123 113 diff += runtime->boundary; 114 if (diff < 0) 115 return -EINVAL; 124 116 rec->sw_ready -= frames_to_bytes(runtime, diff); 125 117 rec->appl_ptr = appl_ptr; … … 148 140 rec->sw_ready += bytes; 149 141 } 142 return 0; 150 143 } 151 144 -
GPL/trunk/alsa-kernel/include/sound/pcm.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_PCM_H 2 3 #define __SOUND_PCM_H … … 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 8 * Abramo Bagnara <abramo@alsa-project.org> 8 *9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 9 */ 25 10 … … 30 15 #include <linux/mm.h> 31 16 #include <linux/bitops.h> 32 #include <linux/pm_qos_params.h> 17 #include <linux/pm_qos.h> 18 #include <linux/refcount.h> 33 19 34 20 #define snd_pcm_substream_chip(substream) ((substream)->private_data) 35 21 #define snd_pcm_chip(pcm) ((pcm)->private_data) 36 22 37 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)38 #include "pcm_oss.h"23 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 24 #include <sound/pcm_oss.h> 39 25 #endif 40 26 … … 59 45 }; 60 46 47 struct snd_pcm_status64; 61 48 struct snd_pcm_substream; 49 50 struct snd_pcm_audio_tstamp_config; /* definitions further down */ 51 struct snd_pcm_audio_tstamp_report; 62 52 63 53 struct snd_pcm_ops { … … 71 61 int (*prepare)(struct snd_pcm_substream *substream); 72 62 int (*trigger)(struct snd_pcm_substream *substream, int cmd); 63 int (*sync_stop)(struct snd_pcm_substream *substream); 73 64 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); 74 int (*copy)(struct snd_pcm_substream *substream, int channel, 75 snd_pcm_uframes_t pos, 76 void __user *buf, snd_pcm_uframes_t count); 77 int (*silence)(struct snd_pcm_substream *substream, int channel, 78 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 65 int (*get_time_info)(struct snd_pcm_substream *substream, 66 struct timespec64 *system_ts, struct timespec64 *audio_ts, 67 struct snd_pcm_audio_tstamp_config *audio_tstamp_config, 68 struct snd_pcm_audio_tstamp_report *audio_tstamp_report); 69 int (*fill_silence)(struct snd_pcm_substream *substream, int channel, 70 unsigned long pos, unsigned long bytes); 71 int (*copy_user)(struct snd_pcm_substream *substream, int channel, 72 unsigned long pos, void __user *buf, 73 unsigned long bytes); 74 int (*copy_kernel)(struct snd_pcm_substream *substream, int channel, 75 unsigned long pos, void *buf, unsigned long bytes); 79 76 struct page *(*page)(struct snd_pcm_substream *substream, 80 77 unsigned long offset); … … 93 90 #endif 94 91 95 #define SNDRV_PCM_IOCTL1_FALSE ((void *)0)96 #define SNDRV_PCM_IOCTL1_TRUE ((void *)1)97 98 92 #define SNDRV_PCM_IOCTL1_RESET 0 99 #define SNDRV_PCM_IOCTL1_INFO 1 93 /* 1 is absent slot. */ 100 94 #define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2 101 #define SNDRV_PCM_IOCTL1_GSTATE 3 95 /* 3 is absent slot. */ 102 96 #define SNDRV_PCM_IOCTL1_FIFO_SIZE 4 103 97 … … 108 102 #define SNDRV_PCM_TRIGGER_SUSPEND 5 109 103 #define SNDRV_PCM_TRIGGER_RESUME 6 104 #define SNDRV_PCM_TRIGGER_DRAIN 7 110 105 111 106 #define SNDRV_PCM_POS_XRUN ((snd_pcm_uframes_t)-1) … … 125 120 #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */ 126 121 #define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */ 122 #define SNDRV_PCM_RATE_352800 (1<<13) /* 352800Hz */ 123 #define SNDRV_PCM_RATE_384000 (1<<14) /* 384000Hz */ 127 124 128 125 #define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */ … … 137 134 #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ 138 135 SNDRV_PCM_RATE_192000) 139 #define SNDRV_PCM_FMTBIT_S8 (1ULL << SNDRV_PCM_FORMAT_S8) 140 #define SNDRV_PCM_FMTBIT_U8 (1ULL << SNDRV_PCM_FORMAT_U8) 141 #define SNDRV_PCM_FMTBIT_S16_LE (1ULL << SNDRV_PCM_FORMAT_S16_LE) 142 #define SNDRV_PCM_FMTBIT_S16_BE (1ULL << SNDRV_PCM_FORMAT_S16_BE) 143 #define SNDRV_PCM_FMTBIT_U16_LE (1ULL << SNDRV_PCM_FORMAT_U16_LE) 144 #define SNDRV_PCM_FMTBIT_U16_BE (1ULL << SNDRV_PCM_FORMAT_U16_BE) 145 #define SNDRV_PCM_FMTBIT_S24_LE (1ULL << SNDRV_PCM_FORMAT_S24_LE) 146 #define SNDRV_PCM_FMTBIT_S24_BE (1ULL << SNDRV_PCM_FORMAT_S24_BE) 147 #define SNDRV_PCM_FMTBIT_U24_LE (1ULL << SNDRV_PCM_FORMAT_U24_LE) 148 #define SNDRV_PCM_FMTBIT_U24_BE (1ULL << SNDRV_PCM_FORMAT_U24_BE) 149 #define SNDRV_PCM_FMTBIT_S32_LE (1ULL << SNDRV_PCM_FORMAT_S32_LE) 150 #define SNDRV_PCM_FMTBIT_S32_BE (1ULL << SNDRV_PCM_FORMAT_S32_BE) 151 #define SNDRV_PCM_FMTBIT_U32_LE (1ULL << SNDRV_PCM_FORMAT_U32_LE) 152 #define SNDRV_PCM_FMTBIT_U32_BE (1ULL << SNDRV_PCM_FORMAT_U32_BE) 153 #define SNDRV_PCM_FMTBIT_FLOAT_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT_LE) 154 #define SNDRV_PCM_FMTBIT_FLOAT_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT_BE) 155 #define SNDRV_PCM_FMTBIT_FLOAT64_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_LE) 156 #define SNDRV_PCM_FMTBIT_FLOAT64_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_BE) 157 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE) 158 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE) 159 #define SNDRV_PCM_FMTBIT_MU_LAW (1ULL << SNDRV_PCM_FORMAT_MU_LAW) 160 #define SNDRV_PCM_FMTBIT_A_LAW (1ULL << SNDRV_PCM_FORMAT_A_LAW) 161 #define SNDRV_PCM_FMTBIT_IMA_ADPCM (1ULL << SNDRV_PCM_FORMAT_IMA_ADPCM) 162 #define SNDRV_PCM_FMTBIT_MPEG (1ULL << SNDRV_PCM_FORMAT_MPEG) 163 #define SNDRV_PCM_FMTBIT_GSM (1ULL << SNDRV_PCM_FORMAT_GSM) 164 #define SNDRV_PCM_FMTBIT_SPECIAL (1ULL << SNDRV_PCM_FORMAT_SPECIAL) 165 #define SNDRV_PCM_FMTBIT_S24_3LE (1ULL << SNDRV_PCM_FORMAT_S24_3LE) 166 #define SNDRV_PCM_FMTBIT_U24_3LE (1ULL << SNDRV_PCM_FORMAT_U24_3LE) 167 #define SNDRV_PCM_FMTBIT_S24_3BE (1ULL << SNDRV_PCM_FORMAT_S24_3BE) 168 #define SNDRV_PCM_FMTBIT_U24_3BE (1ULL << SNDRV_PCM_FORMAT_U24_3BE) 169 #define SNDRV_PCM_FMTBIT_S20_3LE (1ULL << SNDRV_PCM_FORMAT_S20_3LE) 170 #define SNDRV_PCM_FMTBIT_U20_3LE (1ULL << SNDRV_PCM_FORMAT_U20_3LE) 171 #define SNDRV_PCM_FMTBIT_S20_3BE (1ULL << SNDRV_PCM_FORMAT_S20_3BE) 172 #define SNDRV_PCM_FMTBIT_U20_3BE (1ULL << SNDRV_PCM_FORMAT_U20_3BE) 173 #define SNDRV_PCM_FMTBIT_S18_3LE (1ULL << SNDRV_PCM_FORMAT_S18_3LE) 174 #define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) 175 #define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) 176 #define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) 177 #define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24) 178 #define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B) 179 #define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40) 180 #define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B) 136 #define SNDRV_PCM_RATE_8000_384000 (SNDRV_PCM_RATE_8000_192000|\ 137 SNDRV_PCM_RATE_352800|\ 138 SNDRV_PCM_RATE_384000) 139 #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt) 140 #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8) 141 #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8) 142 #define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE) 143 #define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE) 144 #define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE) 145 #define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE) 146 #define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE) 147 #define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE) 148 #define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE) 149 #define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE) 150 #define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE) 151 #define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE) 152 #define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE) 153 #define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE) 154 #define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE) 155 #define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE) 156 #define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE) 157 #define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE) 158 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE) 159 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE) 160 #define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW) 161 #define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW) 162 #define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM) 163 #define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG) 164 #define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM) 165 #define SNDRV_PCM_FMTBIT_S20_LE _SNDRV_PCM_FMTBIT(S20_LE) 166 #define SNDRV_PCM_FMTBIT_U20_LE _SNDRV_PCM_FMTBIT(U20_LE) 167 #define SNDRV_PCM_FMTBIT_S20_BE _SNDRV_PCM_FMTBIT(S20_BE) 168 #define SNDRV_PCM_FMTBIT_U20_BE _SNDRV_PCM_FMTBIT(U20_BE) 169 #define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL) 170 #define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE) 171 #define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE) 172 #define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE) 173 #define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE) 174 #define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE) 175 #define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE) 176 #define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE) 177 #define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE) 178 #define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE) 179 #define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE) 180 #define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE) 181 #define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE) 182 #define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24) 183 #define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B) 184 #define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40) 185 #define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) 186 #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 187 #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 188 #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) 189 #define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE) 190 #define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE) 181 191 182 192 #ifdef SNDRV_LITTLE_ENDIAN … … 190 200 #define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_LE 191 201 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE 202 #define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_LE 203 #define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_LE 192 204 #endif 193 205 #ifdef SNDRV_BIG_ENDIAN … … 201 213 #define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_BE 202 214 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE 215 #define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_BE 216 #define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_BE 203 217 #endif 204 218 … … 206 220 struct snd_pcm_substream *substream; 207 221 int no_compat_mmap; 222 unsigned int user_pversion; /* supported protocol version */ 208 223 }; 209 224 … … 214 229 struct snd_pcm_hw_rule { 215 230 unsigned int cond; 216 snd_pcm_hw_rule_func_t func;217 231 int var; 218 232 int deps[4]; 233 234 snd_pcm_hw_rule_func_t func; 219 235 void *private; 220 236 }; … … 254 270 struct snd_pcm_hw_constraint_ratnums { 255 271 int nrats; 256 struct snd_ratnum *rats;272 const struct snd_ratnum *rats; 257 273 }; 258 274 259 275 struct snd_pcm_hw_constraint_ratdens { 260 276 int nrats; 261 struct snd_ratden *rats;277 const struct snd_ratden *rats; 262 278 }; 263 279 264 280 struct snd_pcm_hw_constraint_list { 281 const unsigned int *list; 265 282 unsigned int count; 266 unsigned int *list;267 283 unsigned int mask; 268 284 }; 269 285 270 struct snd_pcm_hwptr_log; 286 struct snd_pcm_hw_constraint_ranges { 287 unsigned int count; 288 const struct snd_interval *ranges; 289 unsigned int mask; 290 }; 291 292 /* 293 * userspace-provided audio timestamp config to kernel, 294 * structure is for internal use only and filled with dedicated unpack routine 295 */ 296 struct snd_pcm_audio_tstamp_config { 297 /* 5 of max 16 bits used */ 298 u32 type_requested:4; 299 u32 report_delay:1; /* add total delay to A/D or D/A */ 300 }; 301 302 static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data, 303 struct snd_pcm_audio_tstamp_config *config) 304 { 305 config->type_requested = data & 0xF; 306 config->report_delay = (data >> 4) & 1; 307 } 308 309 /* 310 * kernel-provided audio timestamp report to user-space 311 * structure is for internal use only and read by dedicated pack routine 312 */ 313 struct snd_pcm_audio_tstamp_report { 314 /* 6 of max 16 bits used for bit-fields */ 315 316 /* for backwards compatibility */ 317 u32 valid:1; 318 319 /* actual type if hardware could not support requested timestamp */ 320 u32 actual_type:4; 321 322 /* accuracy represented in ns units */ 323 u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */ 324 u32 accuracy; /* up to 4.29s, will be packed in separate field */ 325 }; 326 327 static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy, 328 const struct snd_pcm_audio_tstamp_report *report) 329 { 330 u32 tmp; 331 332 tmp = report->accuracy_report; 333 tmp <<= 4; 334 tmp |= report->actual_type; 335 tmp <<= 1; 336 tmp |= report->valid; 337 338 *data &= 0xffff; /* zero-clear MSBs */ 339 *data |= (tmp << 16); 340 *accuracy = report->accuracy; 341 } 342 271 343 272 344 struct snd_pcm_runtime { 273 345 /* -- Status -- */ 274 346 struct snd_pcm_substream *trigger_master; 275 struct timespec trigger_tstamp; /* trigger timestamp */ 347 struct timespec64 trigger_tstamp; /* trigger timestamp */ 348 bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */ 276 349 int overrange; 277 350 snd_pcm_uframes_t avail_max; … … 281 354 unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */ 282 355 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */ 356 u64 hw_ptr_wrap; /* offset for hw_ptr due to boundary wrap-around */ 283 357 284 358 /* -- HW params -- */ … … 324 398 wait_queue_head_t tsleep; /* transfer sleep */ 325 399 struct fasync_struct *fasync; 400 bool stop_operating; /* sync_stop will be called */ 326 401 327 402 /* -- private section -- */ … … 332 407 struct snd_pcm_hardware hw; 333 408 struct snd_pcm_hw_constraints hw_constraints; 334 335 /* -- interrupt callbacks -- */336 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);337 void (*transfer_ack_end)(struct snd_pcm_substream *substream);338 409 339 410 /* -- timer -- */ … … 347 418 348 419 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ 349 350 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 420 unsigned int buffer_changed:1; /* buffer allocation changed; set only in managed mode */ 421 422 /* -- audio timestamp config -- */ 423 struct snd_pcm_audio_tstamp_config audio_tstamp_config; 424 struct snd_pcm_audio_tstamp_report audio_tstamp_report; 425 struct timespec64 driver_tstamp; 426 427 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 351 428 /* -- OSS things -- */ 352 429 struct snd_pcm_oss_runtime oss; 353 430 #endif 354 355 #ifdef CONFIG_SND_PCM_XRUN_DEBUG356 struct snd_pcm_hwptr_log *hwptr_log;357 #endif358 431 }; 359 432 360 433 struct snd_pcm_group { /* keep linked substreams */ 361 434 spinlock_t lock; 435 struct mutex mutex; 362 436 struct list_head substreams; 363 int count;437 refcount_t refs; 364 438 }; 365 439 … … 373 447 char name[32]; /* substream name */ 374 448 int stream; /* stream (direction) */ 375 #ifndef TARGET_OS2 376 struct pm_qos_request_list latency_pm_qos_req; /* pm_qos request */ 377 #else 378 char latency_id[20]; 379 #endif 449 struct pm_qos_request latency_pm_qos_req; /* pm_qos request */ 380 450 size_t buffer_bytes_max; /* limit ring buffer size */ 381 451 struct snd_dma_buffer dma_buffer; 382 unsigned int dma_buf_id;383 452 size_t dma_max; 384 453 /* -- hardware operations -- */ 385 struct snd_pcm_ops *ops;454 const struct snd_pcm_ops *ops; 386 455 /* -- runtime information -- */ 387 456 struct snd_pcm_runtime *runtime; … … 389 458 struct snd_timer *timer; /* timer */ 390 459 unsigned timer_running: 1; /* time is running */ 460 long wait_time; /* time in ms for R/W to wait for avail */ 391 461 /* -- next substream -- */ 392 462 struct snd_pcm_substream *next; … … 396 466 struct snd_pcm_group *group; /* pointer to current group */ 397 467 /* -- assigned files -- */ 398 void *file;399 468 int ref_count; 400 469 atomic_t mmap_count; … … 402 471 void (*pcm_release)(struct snd_pcm_substream *); 403 472 struct pid *pid; 404 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)473 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 405 474 /* -- OSS things -- */ 406 475 struct snd_pcm_oss_substream oss; … … 408 477 #ifdef CONFIG_SND_VERBOSE_PROCFS 409 478 struct snd_info_entry *proc_root; 410 struct snd_info_entry *proc_info_entry; 411 struct snd_info_entry *proc_hw_params_entry; 412 struct snd_info_entry *proc_sw_params_entry; 413 struct snd_info_entry *proc_status_entry; 414 struct snd_info_entry *proc_prealloc_entry; 415 struct snd_info_entry *proc_prealloc_max_entry; 416 #endif 479 #endif /* CONFIG_SND_VERBOSE_PROCFS */ 417 480 /* misc flags */ 418 481 unsigned int hw_opened: 1; 482 unsigned int managed_buffer_alloc:1; 419 483 }; 420 484 … … 429 493 unsigned int substream_opened; 430 494 struct snd_pcm_substream *substream; 431 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)495 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 432 496 /* -- OSS things -- */ 433 497 struct snd_pcm_oss_stream oss; … … 435 499 #ifdef CONFIG_SND_VERBOSE_PROCFS 436 500 struct snd_info_entry *proc_root; 437 struct snd_info_entry *proc_info_entry;438 501 #ifdef CONFIG_SND_PCM_XRUN_DEBUG 439 502 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ 440 struct snd_info_entry *proc_xrun_debug_entry; 441 #endif 442 #endif 503 #endif 504 #endif 505 struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ 506 struct device dev; 443 507 }; 444 508 … … 457 521 void *private_data; 458 522 void (*private_free) (struct snd_pcm *pcm); 459 struct device *dev; /* actual hw device this belongs to */ 460 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 523 bool internal; /* pcm is for internal use only */ 524 bool nonatomic; /* whole PCM operations are in non-atomic context */ 525 bool no_device_suspend; /* don't invoke device PM suspend */ 526 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 461 527 struct snd_pcm_oss oss; 462 528 #endif 463 529 }; 464 530 531 /* 532 * Registering 533 */ 534 535 extern const struct file_operations snd_pcm_f_ops[2]; 536 537 int snd_pcm_new(struct snd_card *card, const char *id, int device, 538 int playback_count, int capture_count, 539 struct snd_pcm **rpcm); 540 int snd_pcm_new_internal(struct snd_card *card, const char *id, int device, 541 int playback_count, int capture_count, 542 struct snd_pcm **rpcm); 543 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); 544 545 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 465 546 struct snd_pcm_notify { 466 547 int (*n_register) (struct snd_pcm * pcm); … … 469 550 struct list_head list; 470 551 }; 471 472 /*473 * Registering474 */475 476 #ifndef TARGET_OS2477 extern const struct file_operations snd_pcm_f_ops[2];478 #else479 extern struct file_operations snd_pcm_f_ops[2];480 #endif481 482 int snd_pcm_new(struct snd_card *card, const char *id, int device,483 int playback_count, int capture_count,484 struct snd_pcm **rpcm);485 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);486 487 552 int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); 553 #endif 488 554 489 555 /* 490 556 * Native I/O 491 557 */ 492 493 extern rwlock_t snd_pcm_link_rwlock;494 558 495 559 int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); 496 560 int snd_pcm_info_user(struct snd_pcm_substream *substream, 497 561 struct snd_pcm_info __user *info); 498 int snd_pcm_status (struct snd_pcm_substream *substream,499 struct snd_pcm_status*status);562 int snd_pcm_status64(struct snd_pcm_substream *substream, 563 struct snd_pcm_status64 *status); 500 564 int snd_pcm_start(struct snd_pcm_substream *substream); 501 int snd_pcm_stop(struct snd_pcm_substream *substream, int status);565 int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); 502 566 int snd_pcm_drain_done(struct snd_pcm_substream *substream); 567 int snd_pcm_stop_xrun(struct snd_pcm_substream *substream); 503 568 #ifdef CONFIG_PM 504 int snd_pcm_suspend(struct snd_pcm_substream *substream);505 569 int snd_pcm_suspend_all(struct snd_pcm *pcm); 570 #else 571 static inline int snd_pcm_suspend_all(struct snd_pcm *pcm) 572 { 573 return 0; 574 } 506 575 #endif 507 576 int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); … … 512 581 struct snd_pcm_substream **rsubstream); 513 582 void snd_pcm_detach_substream(struct snd_pcm_substream *substream); 514 void snd_pcm_vma_notify_data(void *client, void *data);515 583 int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); 584 585 586 #ifdef CONFIG_SND_DEBUG 587 void snd_pcm_debug_name(struct snd_pcm_substream *substream, 588 char *name, size_t len); 589 #else 590 static inline void 591 snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) 592 { 593 *buf = 0; 594 } 595 #endif 516 596 517 597 /* … … 519 599 */ 520 600 601 /** 602 * snd_pcm_stream_linked - Check whether the substream is linked with others 603 * @substream: substream to check 604 * 605 * Returns true if the given substream is being linked with others. 606 */ 521 607 static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) 522 608 { … … 524 610 } 525 611 526 static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream) 527 { 528 read_lock(&snd_pcm_link_rwlock); 529 spin_lock(&substream->self_group.lock); 530 } 531 532 static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) 533 { 534 spin_unlock(&substream->self_group.lock); 535 read_unlock(&snd_pcm_link_rwlock); 536 } 537 538 static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) 539 { 540 read_lock_irq(&snd_pcm_link_rwlock); 541 spin_lock(&substream->self_group.lock); 542 } 543 544 static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) 545 { 546 spin_unlock(&substream->self_group.lock); 547 read_unlock_irq(&snd_pcm_link_rwlock); 548 } 549 550 #define snd_pcm_stream_lock_irqsave(substream, flags) \ 551 do { \ 552 read_lock_irqsave(&snd_pcm_link_rwlock, (flags)); \ 553 spin_lock(&substream->self_group.lock); \ 554 } while (0) 555 556 #define snd_pcm_stream_unlock_irqrestore(substream, flags) \ 557 do { \ 558 spin_unlock(&substream->self_group.lock); \ 559 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \ 560 } while (0) 561 612 void snd_pcm_stream_lock(struct snd_pcm_substream *substream); 613 void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); 614 void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); 615 void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); 616 unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); 617 618 /** 619 * snd_pcm_stream_lock_irqsave - Lock the PCM stream 620 * @substream: PCM substream 621 * @flags: irq flags 622 * 623 * This locks the PCM stream like snd_pcm_stream_lock() but with the local 624 * IRQ (only when nonatomic is false). In nonatomic case, this is identical 625 * as snd_pcm_stream_lock(). 626 */ 627 #ifndef TARGET_OS2 628 #define snd_pcm_stream_lock_irqsave(substream, flags) \ 629 do { \ 630 typecheck(unsigned long, flags); \ 631 flags = _snd_pcm_stream_lock_irqsave(substream); \ 632 } while (0) 633 #else 634 #define snd_pcm_stream_lock_irqsave(substream, flags) \ 635 do { \ 636 flags = _snd_pcm_stream_lock_irqsave(substream); \ 637 } while (0) 638 #endif 639 void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, 640 unsigned long flags); 641 642 /** 643 * snd_pcm_group_for_each_entry - iterate over the linked substreams 644 * @s: the iterator 645 * @substream: the substream 646 * 647 * Iterate over the all linked substreams to the given @substream. 648 * When @substream isn't linked with any others, this gives returns @substream 649 * itself once. 650 */ 562 651 #define snd_pcm_group_for_each_entry(s, substream) \ 563 652 list_for_each_entry(s, &substream->group->substreams, link_list, struct snd_pcm_substream) 564 653 654 #define for_each_pcm_streams(stream) \ 655 for (stream = SNDRV_PCM_STREAM_PLAYBACK; \ 656 stream <= SNDRV_PCM_STREAM_LAST; \ 657 stream++) 658 659 /** 660 * snd_pcm_running - Check whether the substream is in a running state 661 * @substream: substream to check 662 * 663 * Returns true if the given substream is in the state RUNNING, or in the 664 * state DRAINING for playback. 665 */ 565 666 static inline int snd_pcm_running(struct snd_pcm_substream *substream) 566 667 { … … 570 671 } 571 672 673 /** 674 * bytes_to_samples - Unit conversion of the size from bytes to samples 675 * @runtime: PCM runtime instance 676 * @size: size in bytes 677 */ 572 678 static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) 573 679 { … … 575 681 } 576 682 683 /** 684 * bytes_to_frames - Unit conversion of the size from bytes to frames 685 * @runtime: PCM runtime instance 686 * @size: size in bytes 687 */ 577 688 static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) 578 689 { … … 580 691 } 581 692 693 /** 694 * samples_to_bytes - Unit conversion of the size from samples to bytes 695 * @runtime: PCM runtime instance 696 * @size: size in samples 697 */ 582 698 static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) 583 699 { … … 585 701 } 586 702 703 /** 704 * frames_to_bytes - Unit conversion of the size from frames to bytes 705 * @runtime: PCM runtime instance 706 * @size: size in frames 707 */ 587 708 static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) 588 709 { … … 590 711 } 591 712 713 /** 714 * frame_aligned - Check whether the byte size is aligned to frames 715 * @runtime: PCM runtime instance 716 * @bytes: size in bytes 717 */ 592 718 static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) 593 719 { … … 595 721 } 596 722 723 /** 724 * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes 725 * @substream: PCM substream 726 */ 597 727 static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) 598 728 { … … 601 731 } 602 732 733 /** 734 * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes 735 * @substream: PCM substream 736 */ 603 737 static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) 604 738 { … … 607 741 } 608 742 609 /* 610 * result is: 0 ... (boundary - 1) 743 /** 744 * snd_pcm_playback_avail - Get the available (writable) space for playback 745 * @runtime: PCM runtime instance 746 * 747 * Result is between 0 ... (boundary - 1) 611 748 */ 612 749 static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) … … 633 770 } 634 771 635 /* 636 * result is: 0 ... (boundary - 1) 772 /** 773 * snd_pcm_capture_avail - Get the available (readable) space for capture 774 * @runtime: PCM runtime instance 775 * 776 * Result is between 0 ... (boundary - 1) 637 777 */ 638 778 static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) … … 644 784 } 645 785 786 /** 787 * snd_pcm_playback_hw_avail - Get the queued space for playback 788 * @runtime: PCM runtime instance 789 */ 646 790 static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) 647 791 { … … 649 793 } 650 794 795 /** 796 * snd_pcm_capture_hw_avail - Get the free space for capture 797 * @runtime: PCM runtime instance 798 */ 651 799 static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) 652 800 { … … 660 808 * Checks whether enough free space is available on the playback buffer. 661 809 * 662 * Return s non-zero if available, or zero if not.810 * Return: Non-zero if available, or zero if not. 663 811 */ 664 812 static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream) … … 674 822 * Checks whether enough capture data is available on the capture buffer. 675 823 * 676 * Return s non-zero if available, or zero if not.824 * Return: Non-zero if available, or zero if not. 677 825 */ 678 826 static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream) … … 686 834 * @substream: the pcm substream instance 687 835 * 688 * Checks whether any data exists on the playback buffer. If stop_threshold 836 * Checks whether any data exists on the playback buffer. 837 * 838 * Return: Non-zero if any data exists, or zero if not. If stop_threshold 689 839 * is bigger or equal to boundary, then this function returns always non-zero. 690 *691 * Returns non-zero if exists, or zero if not.692 840 */ 693 841 static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream) … … 706 854 * Checks whether the playback buffer is empty. 707 855 * 708 * Return s non-zero if empty, or zero if not.856 * Return: Non-zero if empty, or zero if not. 709 857 */ 710 858 static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream) … … 720 868 * Checks whether the capture buffer is empty. 721 869 * 722 * Return s non-zero if empty, or zero if not.870 * Return: Non-zero if empty, or zero if not. 723 871 */ 724 872 static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) … … 728 876 } 729 877 878 /** 879 * snd_pcm_trigger_done - Mark the master substream 880 * @substream: the pcm substream instance 881 * @master: the linked master substream 882 * 883 * When multiple substreams of the same card are linked and the hardware 884 * supports the single-shot operation, the driver calls this in the loop 885 * in snd_pcm_group_for_each_entry() for marking the substream as "done". 886 * Then most of trigger operations are performed only to the given master 887 * substream. 888 * 889 * The trigger_master mark is cleared at timestamp updates at the end 890 * of trigger operations. 891 */ 730 892 static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, 731 893 struct snd_pcm_substream *master) … … 770 932 } 771 933 772 #define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 773 #define params_format(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)) 774 #define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) 775 #define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min 776 #define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min 777 #define params_period_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min 778 #define params_period_bytes(p) ((params_period_size(p)*snd_pcm_format_physical_width(params_format(p))*params_channels(p))/8) 779 #define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min 780 #define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min 781 #define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min 782 934 /** 935 * params_channels - Get the number of channels from the hw params 936 * @p: hw params 937 */ 938 static inline unsigned int params_channels(const struct snd_pcm_hw_params *p) 939 { 940 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min; 941 } 942 943 /** 944 * params_rate - Get the sample rate from the hw params 945 * @p: hw params 946 */ 947 static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) 948 { 949 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min; 950 } 951 952 /** 953 * params_period_size - Get the period size (in frames) from the hw params 954 * @p: hw params 955 */ 956 static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) 957 { 958 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min; 959 } 960 961 /** 962 * params_periods - Get the number of periods from the hw params 963 * @p: hw params 964 */ 965 static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) 966 { 967 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min; 968 } 969 970 /** 971 * params_buffer_size - Get the buffer size (in frames) from the hw params 972 * @p: hw params 973 */ 974 static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) 975 { 976 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min; 977 } 978 979 /** 980 * params_buffer_bytes - Get the buffer size (in bytes) from the hw params 981 * @p: hw params 982 */ 983 static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) 984 { 985 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min; 986 } 783 987 784 988 int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); 785 void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); 786 void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); 787 void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b, 788 unsigned int k, struct snd_interval *c); 789 void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, 790 const struct snd_interval *b, struct snd_interval *c); 791 int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask); 989 int snd_interval_list(struct snd_interval *i, unsigned int count, 990 const unsigned int *list, unsigned int mask); 991 int snd_interval_ranges(struct snd_interval *i, unsigned int count, 992 const struct snd_interval *list, unsigned int mask); 792 993 int snd_interval_ratnum(struct snd_interval *i, 793 unsigned int rats_count, struct snd_ratnum *rats,994 unsigned int rats_count, const struct snd_ratnum *rats, 794 995 unsigned int *nump, unsigned int *denp); 795 996 796 997 void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); 797 998 void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); 798 int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);799 999 800 1000 int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); 801 1001 802 int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);803 int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);804 805 int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,806 u_int32_t mask);807 1002 int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 808 1003 u_int64_t mask); … … 813 1008 unsigned int cond, 814 1009 snd_pcm_hw_param_t var, 815 struct snd_pcm_hw_constraint_list *l); 1010 const struct snd_pcm_hw_constraint_list *l); 1011 int snd_pcm_hw_constraint_ranges(struct snd_pcm_runtime *runtime, 1012 unsigned int cond, 1013 snd_pcm_hw_param_t var, 1014 const struct snd_pcm_hw_constraint_ranges *r); 816 1015 int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, 817 1016 unsigned int cond, 818 1017 snd_pcm_hw_param_t var, 819 struct snd_pcm_hw_constraint_ratnums *r);1018 const struct snd_pcm_hw_constraint_ratnums *r); 820 1019 int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, 821 1020 unsigned int cond, 822 1021 snd_pcm_hw_param_t var, 823 struct snd_pcm_hw_constraint_ratdens *r);1022 const struct snd_pcm_hw_constraint_ratdens *r); 824 1023 int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, 825 1024 unsigned int cond, … … 833 1032 unsigned int cond, 834 1033 snd_pcm_hw_param_t var); 1034 int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime, 1035 unsigned int base_rate); 835 1036 int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, 836 1037 unsigned int cond, … … 839 1040 int dep, ...); 840 1041 1042 /** 1043 * snd_pcm_hw_constraint_single() - Constrain parameter to a single value 1044 * @runtime: PCM runtime instance 1045 * @var: The hw_params variable to constrain 1046 * @val: The value to constrain to 1047 * 1048 * Return: Positive if the value is changed, zero if it's not changed, or a 1049 * negative error code. 1050 */ 1051 static inline int snd_pcm_hw_constraint_single( 1052 struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 1053 unsigned int val) 1054 { 1055 return snd_pcm_hw_constraint_minmax(runtime, var, val, val); 1056 } 1057 841 1058 int snd_pcm_format_signed(snd_pcm_format_t format); 842 1059 int snd_pcm_format_unsigned(snd_pcm_format_t format); … … 844 1061 int snd_pcm_format_little_endian(snd_pcm_format_t format); 845 1062 int snd_pcm_format_big_endian(snd_pcm_format_t format); 846 #if 0 /* just for DocBook*/1063 #if 0 /* just for kernel-doc */ 847 1064 /** 848 1065 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian 849 1066 * @format: the format to check 850 1067 * 851 * Return s1 if the given PCM format is CPU-endian, 0 if1068 * Return: 1 if the given PCM format is CPU-endian, 0 if 852 1069 * opposite, or a negative error code if endian not specified. 853 1070 */ … … 864 1081 const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); 865 1082 int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 866 snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 867 868 void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,struct snd_pcm_ops *ops);1083 1084 void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, 1085 const struct snd_pcm_ops *ops); 869 1086 void snd_pcm_set_sync(struct snd_pcm_substream *substream); 870 int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);871 1087 int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 872 1088 unsigned int cmd, void *arg); 873 int snd_pcm_update_state(struct snd_pcm_substream *substream,874 struct snd_pcm_runtime *runtime);875 int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);876 int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);877 int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);878 int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);879 int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);880 void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);881 1089 void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); 882 snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, 883 const void __user *buf, 884 snd_pcm_uframes_t frames); 885 snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, 886 void __user *buf, snd_pcm_uframes_t frames); 887 snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, 888 void __user **bufs, snd_pcm_uframes_t frames); 889 snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, 890 void __user **bufs, snd_pcm_uframes_t frames); 891 892 extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; 893 894 int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); 1090 snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, 1091 void *buf, bool interleaved, 1092 snd_pcm_uframes_t frames, bool in_kernel); 1093 1094 static inline snd_pcm_sframes_t 1095 snd_pcm_lib_write(struct snd_pcm_substream *substream, 1096 const void __user *buf, snd_pcm_uframes_t frames) 1097 { 1098 return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); 1099 } 1100 1101 static inline snd_pcm_sframes_t 1102 snd_pcm_lib_read(struct snd_pcm_substream *substream, 1103 void __user *buf, snd_pcm_uframes_t frames) 1104 { 1105 return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); 1106 } 1107 1108 static inline snd_pcm_sframes_t 1109 snd_pcm_lib_writev(struct snd_pcm_substream *substream, 1110 void __user **bufs, snd_pcm_uframes_t frames) 1111 { 1112 return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false); 1113 } 1114 1115 static inline snd_pcm_sframes_t 1116 snd_pcm_lib_readv(struct snd_pcm_substream *substream, 1117 void __user **bufs, snd_pcm_uframes_t frames) 1118 { 1119 return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false); 1120 } 1121 1122 static inline snd_pcm_sframes_t 1123 snd_pcm_kernel_write(struct snd_pcm_substream *substream, 1124 const void *buf, snd_pcm_uframes_t frames) 1125 { 1126 return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames, true); 1127 } 1128 1129 static inline snd_pcm_sframes_t 1130 snd_pcm_kernel_read(struct snd_pcm_substream *substream, 1131 void *buf, snd_pcm_uframes_t frames) 1132 { 1133 return __snd_pcm_lib_xfer(substream, buf, true, frames, true); 1134 } 1135 1136 static inline snd_pcm_sframes_t 1137 snd_pcm_kernel_writev(struct snd_pcm_substream *substream, 1138 void **bufs, snd_pcm_uframes_t frames) 1139 { 1140 return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); 1141 } 1142 1143 static inline snd_pcm_sframes_t 1144 snd_pcm_kernel_readv(struct snd_pcm_substream *substream, 1145 void **bufs, snd_pcm_uframes_t frames) 1146 { 1147 return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); 1148 } 1149 1150 int snd_pcm_hw_limit_rates(struct snd_pcm_hardware *hw); 1151 1152 static inline int 1153 snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime) 1154 { 1155 return snd_pcm_hw_limit_rates(&runtime->hw); 1156 } 1157 895 1158 unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); 896 1159 unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); 1160 unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, 1161 unsigned int rates_b); 1162 unsigned int snd_pcm_rate_range_to_bits(unsigned int rate_min, 1163 unsigned int rate_max); 1164 1165 /** 1166 * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer 1167 * @substream: PCM substream to set 1168 * @bufp: the buffer information, NULL to clear 1169 * 1170 * Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL. 1171 * Otherwise it clears the current buffer information. 1172 */ 897 1173 static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, 898 1174 struct snd_dma_buffer *bufp) … … 912 1188 } 913 1189 914 /* 915 * Timer interface 916 */ 917 918 void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); 919 void snd_pcm_timer_init(struct snd_pcm_substream *substream); 920 void snd_pcm_timer_done(struct snd_pcm_substream *substream); 921 1190 /** 1191 * snd_pcm_gettime - Fill the timespec64 depending on the timestamp mode 1192 * @runtime: PCM runtime instance 1193 * @tv: timespec64 to fill 1194 */ 922 1195 static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, 923 struct timespec *tv) 924 { 925 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) 926 do_posix_clock_monotonic_gettime(tv); 927 else 928 getnstimeofday(tv); 1196 struct timespec64 *tv) 1197 { 1198 switch (runtime->tstamp_type) { 1199 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC: 1200 ktime_get_ts64(tv); 1201 break; 1202 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW: 1203 ktime_get_raw_ts64(tv); 1204 break; 1205 default: 1206 ktime_get_real_ts64(tv); 1207 break; 1208 } 929 1209 } 930 1210 … … 933 1213 */ 934 1214 935 intsnd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);936 intsnd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);937 intsnd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,1215 void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); 1216 void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); 1217 void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, 938 1218 int type, struct device *data, 939 1219 size_t size, size_t max); 940 intsnd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,1220 void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, 941 1221 int type, void *data, 942 1222 size_t size, size_t max); 943 1223 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); 944 1224 int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); 1225 1226 void snd_pcm_set_managed_buffer(struct snd_pcm_substream *substream, int type, 1227 struct device *data, size_t size, size_t max); 1228 void snd_pcm_set_managed_buffer_all(struct snd_pcm *pcm, int type, 1229 struct device *data, 1230 size_t size, size_t max); 945 1231 946 1232 int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, … … 949 1235 struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, 950 1236 unsigned long offset); 951 #if 0 /* for kernel-doc */952 1237 /** 953 1238 * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer … … 959 1244 * if the buffer is accessed by kernel code but not by device DMA. 960 1245 * 961 * Return s1 if the buffer was changed, 0 if not changed, or a negative error1246 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error 962 1247 * code. 963 1248 */ 964 static int snd_pcm_lib_alloc_vmalloc_buffer 965 (struct snd_pcm_substream *substream, size_t size); 1249 static inline int snd_pcm_lib_alloc_vmalloc_buffer 1250 (struct snd_pcm_substream *substream, size_t size) 1251 { 1252 return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, 1253 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); 1254 } 1255 966 1256 /** 967 1257 * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer … … 971 1261 * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses 972 1262 * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. 973 */ 974 static int snd_pcm_lib_alloc_vmalloc_32_buffer 975 (struct snd_pcm_substream *substream, size_t size); 976 #endif 977 #define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \ 978 _snd_pcm_lib_alloc_vmalloc_buffer \ 979 (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO) 980 #define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \ 981 _snd_pcm_lib_alloc_vmalloc_buffer \ 982 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) 1263 * 1264 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error 1265 * code. 1266 */ 1267 static inline int snd_pcm_lib_alloc_vmalloc_32_buffer 1268 (struct snd_pcm_substream *substream, size_t size) 1269 { 1270 return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, 1271 GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); 1272 } 1273 1274 #define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) 983 1275 984 1276 #ifdef CONFIG_SND_DMA_SGBUF … … 987 1279 */ 988 1280 #define snd_pcm_substream_sgbuf(substream) \ 989 ((substream)->runtime->dma_buffer_p->private_data) 990 1281 snd_pcm_get_dma_buf(substream)->private_data 1282 #endif /* SND_DMA_SGBUF */ 1283 1284 /** 1285 * snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset 1286 * @substream: PCM substream 1287 * @ofs: byte offset 1288 */ 991 1289 static inline dma_addr_t 992 1290 snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 993 1291 { 994 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); 995 return snd_sgbuf_get_addr(sg, ofs); 996 } 997 1292 return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); 1293 } 1294 1295 /** 1296 * snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset 1297 * @substream: PCM substream 1298 * @ofs: byte offset 1299 */ 998 1300 static inline void * 999 1301 snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1000 1302 { 1001 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); 1002 return snd_sgbuf_get_ptr(sg, ofs); 1003 } 1004 1005 struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, 1006 unsigned long offset); 1007 unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, 1008 unsigned int ofs, unsigned int size); 1009 1010 #else /* !SND_DMA_SGBUF */ 1011 /* 1012 * fake using a continuous buffer 1013 */ 1014 static inline dma_addr_t 1015 snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 1016 { 1017 return substream->runtime->dma_addr + ofs; 1018 } 1019 1020 static inline void * 1021 snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1022 { 1023 return substream->runtime->dma_area + ofs; 1024 } 1025 1026 #define snd_pcm_sgbuf_ops_page NULL 1027 1028 #define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size) 1029 1030 #endif /* SND_DMA_SGBUF */ 1031 1032 /* handle mmap counter - PCM mmap callback should handle this counter properly */ 1303 return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); 1304 } 1305 1306 /** 1307 * snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the 1308 * contig. page from the given size 1309 * @substream: PCM substream 1310 * @ofs: byte offset 1311 * @size: byte size to examine 1312 */ 1313 static inline unsigned int 1314 snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, 1315 unsigned int ofs, unsigned int size) 1316 { 1317 return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); 1318 } 1319 1320 /** 1321 * snd_pcm_mmap_data_open - increase the mmap counter 1322 * @area: VMA 1323 * 1324 * PCM mmap callback should handle this counter properly 1325 */ 1033 1326 static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1034 1327 { … … 1037 1330 } 1038 1331 1332 /** 1333 * snd_pcm_mmap_data_close - decrease the mmap counter 1334 * @area: VMA 1335 * 1336 * PCM mmap callback should handle this counter properly 1337 */ 1039 1338 static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 1040 1339 { … … 1043 1342 } 1044 1343 1344 int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, 1345 struct vm_area_struct *area); 1045 1346 /* mmap for io-memory area */ 1046 1347 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) … … 1052 1353 #endif 1053 1354 1054 int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream, 1055 struct vm_area_struct *area); 1056 #define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached 1057 1355 /** 1356 * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer 1357 * @dma: DMA number 1358 * @max: pointer to store the max size 1359 */ 1058 1360 static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) 1059 1361 { … … 1070 1372 (IEC958_AES3_CON_FS_48000<<24)) 1071 1373 1072 #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)1073 1074 1374 const char *snd_pcm_format_name(snd_pcm_format_t format); 1075 1375 1376 /** 1377 * snd_pcm_stream_str - Get a string naming the direction of a stream 1378 * @substream: the pcm substream instance 1379 * 1380 * Return: A string naming the direction of the stream. 1381 */ 1382 static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream) 1383 { 1384 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1385 return "Playback"; 1386 else 1387 return "Capture"; 1388 } 1389 1390 /* 1391 * PCM channel-mapping control API 1392 */ 1393 /* array element of channel maps */ 1394 struct snd_pcm_chmap_elem { 1395 unsigned char channels; 1396 unsigned char map[15]; 1397 }; 1398 1399 /* channel map information; retrieved via snd_kcontrol_chip() */ 1400 struct snd_pcm_chmap { 1401 struct snd_pcm *pcm; /* assigned PCM instance */ 1402 int stream; /* PLAYBACK or CAPTURE */ 1403 struct snd_kcontrol *kctl; 1404 const struct snd_pcm_chmap_elem *chmap; 1405 unsigned int max_channels; 1406 unsigned int channel_mask; /* optional: active channels bitmask */ 1407 void *private_data; /* optional: private data pointer */ 1408 }; 1409 1410 /** 1411 * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info 1412 * @info: chmap information 1413 * @idx: the substream number index 1414 */ 1415 static inline struct snd_pcm_substream * 1416 snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) 1417 { 1418 struct snd_pcm_substream *s; 1419 for (s = info->pcm->streams[info->stream].substream; s; s = s->next) 1420 if (s->number == idx) 1421 return s; 1422 return NULL; 1423 } 1424 1425 /* ALSA-standard channel maps (RL/RR prior to C/LFE) */ 1426 extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[]; 1427 /* Other world's standard channel maps (C/LFE prior to RL/RR) */ 1428 extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[]; 1429 1430 /* bit masks to be passed to snd_pcm_chmap.channel_mask field */ 1431 #define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4)) 1432 #define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6)) 1433 #define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8)) 1434 1435 int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, 1436 const struct snd_pcm_chmap_elem *chmap, 1437 int max_channels, 1438 unsigned long private_value, 1439 struct snd_pcm_chmap **info_ret); 1440 1441 /** 1442 * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise 1443 * @pcm_format: PCM format 1444 */ 1445 static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) 1446 { 1447 return 1ULL << (__force int) pcm_format; 1448 } 1449 1450 /** 1451 * pcm_for_each_format - helper to iterate for each format type 1452 * @f: the iterator variable in snd_pcm_format_t type 1453 */ 1454 #define pcm_for_each_format(f) \ 1455 for ((f) = SNDRV_PCM_FORMAT_FIRST; \ 1456 (__force int)(f) <= (__force int)SNDRV_PCM_FORMAT_LAST; \ 1457 (f) = (__force snd_pcm_format_t)((__force int)(f) + 1)) 1458 1459 /* printk helpers */ 1460 #ifndef TARGET_OS2 1461 #define pcm_err(pcm, fmt, args...) \ 1462 dev_err((pcm)->card->dev, fmt, ##args) 1463 #define pcm_warn(pcm, fmt, args...) \ 1464 dev_warn((pcm)->card->dev, fmt, ##args) 1465 #define pcm_dbg(pcm, fmt, args...) \ 1466 dev_dbg((pcm)->card->dev, fmt, ##args) 1467 #else 1468 #define pcm_err pcm_dbg 1469 #define pcm_warn pcm_dbg 1470 int pcm_dbg(struct snd_pcm *dev, const char *fmt, ...); 1471 #endif 1472 1473 struct snd_pcm_status64 { 1474 snd_pcm_state_t state; /* stream state */ 1475 u8 rsvd[4]; 1476 s64 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ 1477 s64 trigger_tstamp_nsec; 1478 s64 tstamp_sec; /* reference timestamp */ 1479 s64 tstamp_nsec; 1480 snd_pcm_uframes_t appl_ptr; /* appl ptr */ 1481 snd_pcm_uframes_t hw_ptr; /* hw ptr */ 1482 snd_pcm_sframes_t delay; /* current delay in frames */ 1483 snd_pcm_uframes_t avail; /* number of frames available */ 1484 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 1485 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 1486 snd_pcm_state_t suspended_state; /* suspended stream state */ 1487 __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ 1488 s64 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ 1489 s64 audio_tstamp_nsec; 1490 s64 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */ 1491 s64 driver_tstamp_nsec; 1492 __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ 1493 unsigned char reserved[52-4*sizeof(s64)]; /* must be filled with zero */ 1494 }; 1495 1496 #define SNDRV_PCM_IOCTL_STATUS64 _IOR('A', 0x20, struct snd_pcm_status64) 1497 #define SNDRV_PCM_IOCTL_STATUS_EXT64 _IOWR('A', 0x24, struct snd_pcm_status64) 1498 1499 struct snd_pcm_status32 { 1500 snd_pcm_state_t state; /* stream state */ 1501 s32 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ 1502 s32 trigger_tstamp_nsec; 1503 s32 tstamp_sec; /* reference timestamp */ 1504 s32 tstamp_nsec; 1505 u32 appl_ptr; /* appl ptr */ 1506 u32 hw_ptr; /* hw ptr */ 1507 s32 delay; /* current delay in frames */ 1508 u32 avail; /* number of frames available */ 1509 u32 avail_max; /* max frames available on hw since last status */ 1510 u32 overrange; /* count of ADC (capture) overrange detections from last status */ 1511 snd_pcm_state_t suspended_state; /* suspended stream state */ 1512 u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ 1513 s32 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ 1514 s32 audio_tstamp_nsec; 1515 s32 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */ 1516 s32 driver_tstamp_nsec; 1517 u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ 1518 unsigned char reserved[52-4*sizeof(s32)]; /* must be filled with zero */ 1519 }; 1520 1521 #define SNDRV_PCM_IOCTL_STATUS32 _IOR('A', 0x20, struct snd_pcm_status32) 1522 #define SNDRV_PCM_IOCTL_STATUS_EXT32 _IOWR('A', 0x24, struct snd_pcm_status32) 1523 1076 1524 #endif /* __SOUND_PCM_H */ -
GPL/trunk/alsa-kernel/include/sound/pcm_oss.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_PCM_OSS_H 2 3 #define __SOUND_PCM_OSS_H … … 5 6 * Digital Audio (PCM) - OSS compatibility abstract layer 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 58 43 size_t buffer_used; /* used length from period buffer */ 59 44 struct mutex params_lock; 45 atomic_t rw_ref; /* concurrent read/write accesses */ 60 46 #ifdef CONFIG_SND_PCM_OSS_PLUGINS 61 47 struct snd_pcm_plugin *plugin_first; -
GPL/trunk/alsa-kernel/include/sound/pcm_params.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_PCM_PARAMS_H 2 3 #define __SOUND_PCM_PARAMS_H … … 5 6 * PCM params helpers 6 7 * Copyright (c) by Abramo Bagnara <abramo@alsa-project.org> 7 * 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * 23 */ 8 */ 9 10 #include <sound/pcm.h> 24 11 25 12 int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, … … 37 24 #define MASK_BIT(i) (1U << ((i) & 31)) 38 25 39 static inline unsigned int ld2(u_int32_t v)40 {41 unsigned r = 0;42 43 if (v >= 0x10000) {44 v >>= 16;45 r += 16;46 }47 if (v >= 0x100) {48 v >>= 8;49 r += 8;50 }51 if (v >= 0x10) {52 v >>= 4;53 r += 4;54 }55 if (v >= 4) {56 v >>= 2;57 r += 2;58 }59 if (v >= 2)60 r++;61 return r;62 }63 64 static inline size_t snd_mask_sizeof(void)65 {66 return sizeof(struct snd_mask);67 }68 69 26 static inline void snd_mask_none(struct snd_mask *mask) 70 27 { … … 91 48 for (i = 0; i < SNDRV_MASK_SIZE; i++) { 92 49 if (mask->bits[i]) 93 return ffs(mask->bits[i]) - 1+ (i << 5);50 return __ffs(mask->bits[i]) + (i << 5); 94 51 } 95 52 return 0; … … 101 58 for (i = SNDRV_MASK_SIZE - 1; i >= 0; i--) { 102 59 if (mask->bits[i]) 103 return ld2(mask->bits[i]) + (i << 5);60 return __fls(mask->bits[i]) + (i << 5); 104 61 } 105 62 return 0; … … 109 66 { 110 67 mask->bits[MASK_OFS(val)] |= MASK_BIT(val); 68 } 69 70 /* Most of drivers need only this one */ 71 static inline void snd_mask_set_format(struct snd_mask *mask, 72 snd_pcm_format_t format) 73 { 74 snd_mask_set(mask, (__force unsigned int)format); 111 75 } 112 76 … … 163 127 { 164 128 return mask->bits[MASK_OFS(val)] & MASK_BIT(val); 129 } 130 131 /* Most of drivers need only this one */ 132 static inline int snd_mask_test_format(const struct snd_mask *mask, 133 snd_pcm_format_t format) 134 { 135 return snd_mask_test(mask, (__force unsigned int)format); 165 136 } 166 137 … … 271 242 { 272 243 return (i->min == i->max || 273 (i->min + 1 == i->max && i->openmax));244 (i->min + 1 == i->max && (i->openmin || i->openmax))); 274 245 } 275 246 276 247 static inline int snd_interval_value(const struct snd_interval *i) 277 248 { 249 if (i->openmin && !i->openmax) 250 return i->max; 278 251 return i->min; 279 252 } … … 324 297 } 325 298 326 static inline unsigned int add(unsigned int a, unsigned int b) 327 { 328 if (a >= UINT_MAX - b) 329 return UINT_MAX; 330 return a + b; 331 } 332 333 static inline unsigned int sub(unsigned int a, unsigned int b) 334 { 335 if (a > b) 336 return a - b; 337 return 0; 299 /** 300 * params_access - get the access type from the hw params 301 * @p: hw params 302 */ 303 static inline snd_pcm_access_t params_access(const struct snd_pcm_hw_params *p) 304 { 305 return (__force snd_pcm_access_t)snd_mask_min(hw_param_mask_c(p, 306 SNDRV_PCM_HW_PARAM_ACCESS)); 307 } 308 309 /** 310 * params_format - get the sample format from the hw params 311 * @p: hw params 312 */ 313 static inline snd_pcm_format_t params_format(const struct snd_pcm_hw_params *p) 314 { 315 return (__force snd_pcm_format_t)snd_mask_min(hw_param_mask_c(p, 316 SNDRV_PCM_HW_PARAM_FORMAT)); 317 } 318 319 /** 320 * params_subformat - get the sample subformat from the hw params 321 * @p: hw params 322 */ 323 static inline snd_pcm_subformat_t 324 params_subformat(const struct snd_pcm_hw_params *p) 325 { 326 return (__force snd_pcm_subformat_t)snd_mask_min(hw_param_mask_c(p, 327 SNDRV_PCM_HW_PARAM_SUBFORMAT)); 328 } 329 330 /** 331 * params_period_bytes - get the period size (in bytes) from the hw params 332 * @p: hw params 333 */ 334 static inline unsigned int 335 params_period_bytes(const struct snd_pcm_hw_params *p) 336 { 337 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_BYTES)->min; 338 } 339 340 /** 341 * params_width - get the number of bits of the sample format from the hw params 342 * @p: hw params 343 * 344 * This function returns the number of bits per sample that the selected sample 345 * format of the hw params has. 346 */ 347 static inline int params_width(const struct snd_pcm_hw_params *p) 348 { 349 return snd_pcm_format_width(params_format(p)); 350 } 351 352 /* 353 * params_physical_width - get the storage size of the sample format from the hw params 354 * @p: hw params 355 * 356 * This functions returns the number of bits per sample that the selected sample 357 * format of the hw params takes up in memory. This will be equal or larger than 358 * params_width(). 359 */ 360 static inline int params_physical_width(const struct snd_pcm_hw_params *p) 361 { 362 return snd_pcm_format_physical_width(params_format(p)); 363 } 364 365 static inline void 366 params_set_format(struct snd_pcm_hw_params *p, snd_pcm_format_t fmt) 367 { 368 snd_mask_set_format(hw_param_mask(p, SNDRV_PCM_HW_PARAM_FORMAT), fmt); 338 369 } 339 370 340 371 #endif /* __SOUND_PCM_PARAMS_H */ 341 -
GPL/trunk/alsa-kernel/include/sound/pt2258.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * ALSA Driver for the PT2258 volume controller. 3 4 * 4 5 * Copyright (c) 2006 Jochen Voss <voss@seehuhn.de> 5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (at your option) any later version.10 *11 * This program is distributed in the hope that it will be useful,12 * but WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 *20 6 */ 21 7 -
GPL/trunk/alsa-kernel/include/sound/rawmidi.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_RAWMIDI_H 2 3 #define __SOUND_RAWMIDI_H … … 5 6 * Abstract layer for MIDI v1.0 stream 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 … … 28 13 #include <linux/wait.h> 29 14 #include <linux/mutex.h> 15 #include <linux/workqueue.h> 16 #include <linux/device.h> 30 17 31 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)32 #include "seq_device.h"18 #if IS_ENABLED(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER) 19 #include <sound/seq_device.h> 33 20 #endif 34 21 … … 64 51 65 52 struct snd_rawmidi_runtime { 53 struct snd_rawmidi_substream *substream; 66 54 unsigned int drain: 1, /* drain stage */ 67 55 oss: 1; /* OSS compatible mode */ … … 74 62 size_t avail; /* max used buffer for wakeup */ 75 63 size_t xruns; /* over/underruns counter */ 64 int buffer_ref; /* buffer reference count */ 76 65 /* misc */ 77 66 spinlock_t lock; … … 80 69 void (*event)(struct snd_rawmidi_substream *substream); 81 70 /* defers calls to event [input] or ops->trigger [output] */ 82 struct tasklet_struct tasklet;71 struct work_struct event_work; 83 72 /* private data */ 84 73 void *private_data; … … 90 79 int stream; /* direction */ 91 80 int number; /* substream number */ 92 unsigned int opened: 1,/* open flag */93 append: 1,/* append flag (merge more streams) */94 active_sensing: 1;/* send active sensing when close */81 bool opened; /* open flag */ 82 bool append; /* append flag (merge more streams) */ 83 bool active_sensing; /* send active sensing when close */ 95 84 int use_count; /* use counter (for output) */ 96 85 size_t bytes; … … 101 90 struct pid *pid; 102 91 /* hardware layer */ 103 struct snd_rawmidi_ops *ops;92 const struct snd_rawmidi_ops *ops; 104 93 }; 105 94 … … 128 117 #endif 129 118 130 struct snd_rawmidi_global_ops *ops;119 const struct snd_rawmidi_global_ops *ops; 131 120 132 121 struct snd_rawmidi_str streams[2]; … … 138 127 wait_queue_head_t open_wait; 139 128 140 struct snd_info_entry *dev; 129 struct device dev; 130 141 131 struct snd_info_entry *proc_entry; 142 132 143 #if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)133 #if IS_ENABLED(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER) 144 134 struct snd_seq_device *seq_dev; 145 135 #endif … … 152 142 struct snd_rawmidi **rmidi); 153 143 void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream, 154 struct snd_rawmidi_ops *ops);144 const struct snd_rawmidi_ops *ops); 155 145 156 146 /* callbacks */ 157 147 158 void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);159 148 int snd_rawmidi_receive(struct snd_rawmidi_substream *substream, 160 149 const unsigned char *buffer, int count); 161 void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);162 150 int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream); 163 151 int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, … … 166 154 int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream, 167 155 unsigned char *buffer, int count); 156 int __snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream, 157 unsigned char *buffer, int count); 158 int __snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, 159 int count); 160 int snd_rawmidi_proceed(struct snd_rawmidi_substream *substream); 168 161 169 162 /* main midi functions */ -
GPL/trunk/alsa-kernel/include/sound/sb.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SB_H 2 3 #define __SOUND_SB_H … … 5 6 * Header file for SoundBlaster cards 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 25 #include "pcm.h"26 #include "rawmidi.h"10 #include <sound/pcm.h> 11 #include <sound/rawmidi.h> 27 12 #include <linux/interrupt.h> 28 #include < asm/io.h>13 #include <linux/io.h> 29 14 30 15 enum sb_hw_type { … … 309 294 310 295 /* sb8_init.c */ 311 int snd_sb8dsp_pcm(struct snd_sb *chip, int device , struct snd_pcm ** rpcm);296 int snd_sb8dsp_pcm(struct snd_sb *chip, int device); 312 297 /* sb8.c */ 313 298 irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip); … … 318 303 /* midi8.c */ 319 304 irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip); 320 int snd_sb8dsp_midi(struct snd_sb *chip, int device , struct snd_rawmidi ** rrawmidi);305 int snd_sb8dsp_midi(struct snd_sb *chip, int device); 321 306 322 307 /* sb16_init.c */ 323 int snd_sb16dsp_pcm(struct snd_sb *chip, int device , struct snd_pcm ** rpcm);308 int snd_sb16dsp_pcm(struct snd_sb *chip, int device); 324 309 const struct snd_pcm_ops *snd_sb16dsp_get_pcm_ops(int direction); 325 310 int snd_sb16dsp_configure(struct snd_sb *chip); -
GPL/trunk/alsa-kernel/include/sound/sb16_csp.h
r398 r679 1 #ifndef __SOUND_SB16_CSP_H 2 #define __SOUND_SB16_CSP_H 3 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 4 2 /* 5 3 * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si> … … 7 5 * 8 6 * SB16ASP/AWE32 CSP control 9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 7 */ 8 #ifndef __SOUND_SB16_CSP_H 9 #define __SOUND_SB16_CSP_H 25 10 26 /* CSP modes */ 27 #define SNDRV_SB_CSP_MODE_NONE 0x00 28 #define SNDRV_SB_CSP_MODE_DSP_READ 0x01 /* Record from DSP */ 29 #define SNDRV_SB_CSP_MODE_DSP_WRITE 0x02 /* Play to DSP */ 30 #define SNDRV_SB_CSP_MODE_QSOUND 0x04 /* QSound */ 31 32 /* CSP load flags */ 33 #define SNDRV_SB_CSP_LOAD_FROMUSER 0x01 34 #define SNDRV_SB_CSP_LOAD_INITBLOCK 0x02 35 36 /* CSP sample width */ 37 #define SNDRV_SB_CSP_SAMPLE_8BIT 0x01 38 #define SNDRV_SB_CSP_SAMPLE_16BIT 0x02 39 40 /* CSP channels */ 41 #define SNDRV_SB_CSP_MONO 0x01 42 #define SNDRV_SB_CSP_STEREO 0x02 43 44 /* CSP rates */ 45 #define SNDRV_SB_CSP_RATE_8000 0x01 46 #define SNDRV_SB_CSP_RATE_11025 0x02 47 #define SNDRV_SB_CSP_RATE_22050 0x04 48 #define SNDRV_SB_CSP_RATE_44100 0x08 49 #define SNDRV_SB_CSP_RATE_ALL 0x0f 50 51 /* CSP running state */ 52 #define SNDRV_SB_CSP_ST_IDLE 0x00 53 #define SNDRV_SB_CSP_ST_LOADED 0x01 54 #define SNDRV_SB_CSP_ST_RUNNING 0x02 55 #define SNDRV_SB_CSP_ST_PAUSED 0x04 56 #define SNDRV_SB_CSP_ST_AUTO 0x08 57 #define SNDRV_SB_CSP_ST_QSOUND 0x10 58 59 /* maximum QSound value (180 degrees right) */ 60 #define SNDRV_SB_CSP_QSOUND_MAX_RIGHT 0x20 61 62 /* maximum microcode RIFF file size */ 63 #define SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE 0x3000 64 65 /* microcode header */ 66 struct snd_sb_csp_mc_header { 67 char codec_name[16]; /* id name of codec */ 68 unsigned short func_req; /* requested function */ 69 }; 70 71 /* microcode to be loaded */ 72 struct snd_sb_csp_microcode { 73 struct snd_sb_csp_mc_header info; 74 unsigned char data[SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE]; 75 }; 76 77 /* start CSP with sample_width in mono/stereo */ 78 struct snd_sb_csp_start { 79 int sample_width; /* sample width, look above */ 80 int channels; /* channels, look above */ 81 }; 82 83 /* CSP information */ 84 struct snd_sb_csp_info { 85 char codec_name[16]; /* id name of codec */ 86 unsigned short func_nr; /* function number */ 87 unsigned int acc_format; /* accepted PCM formats */ 88 unsigned short acc_channels; /* accepted channels */ 89 unsigned short acc_width; /* accepted sample width */ 90 unsigned short acc_rates; /* accepted sample rates */ 91 unsigned short csp_mode; /* CSP mode, see above */ 92 unsigned short run_channels; /* current channels */ 93 unsigned short run_width; /* current sample width */ 94 unsigned short version; /* version id: 0x10 - 0x1f */ 95 unsigned short state; /* state bits */ 96 }; 97 98 /* HWDEP controls */ 99 /* get CSP information */ 100 #define SNDRV_SB_CSP_IOCTL_INFO _IOR('H', 0x10, struct snd_sb_csp_info) 101 /* load microcode to CSP */ 102 #define SNDRV_SB_CSP_IOCTL_LOAD_CODE _IOW('H', 0x11, struct snd_sb_csp_microcode) 103 /* unload microcode from CSP */ 104 #define SNDRV_SB_CSP_IOCTL_UNLOAD_CODE _IO('H', 0x12) 105 /* start CSP */ 106 #define SNDRV_SB_CSP_IOCTL_START _IOW('H', 0x13, struct snd_sb_csp_start) 107 /* stop CSP */ 108 #define SNDRV_SB_CSP_IOCTL_STOP _IO('H', 0x14) 109 /* pause CSP and DMA transfer */ 110 #define SNDRV_SB_CSP_IOCTL_PAUSE _IO('H', 0x15) 111 /* restart CSP and DMA transfer */ 112 #define SNDRV_SB_CSP_IOCTL_RESTART _IO('H', 0x16) 113 114 #ifdef __KERNEL__ 115 #include "sb.h" 116 #include "hwdep.h" 11 #include <sound/sb.h> 12 #include <sound/hwdep.h> 117 13 #include <linux/firmware.h> 14 #include <uapi/sound/sb16_csp.h> 118 15 119 16 struct snd_sb_csp; … … 136 33 int (*csp_use) (struct snd_sb_csp * p); 137 34 int (*csp_unuse) (struct snd_sb_csp * p); 138 int (*csp_autoload) (struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);35 int (*csp_autoload) (struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode); 139 36 int (*csp_start) (struct snd_sb_csp * p, int sample_width, int channels); 140 37 int (*csp_stop) (struct snd_sb_csp * p); … … 177 74 178 75 int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep); 179 #endif180 181 76 #endif /* __SOUND_SB16_CSP */ -
GPL/trunk/alsa-kernel/include/sound/seq_device.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_DEVICE_H 2 3 #define __SOUND_SEQ_DEVICE_H … … 5 6 * ALSA sequencer device management 6 7 * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de> 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 8 */ 23 9 … … 26 12 */ 27 13 28 #define ID_LEN 3229 30 /* status flag */31 #define SNDRV_SEQ_DEVICE_FREE 032 #define SNDRV_SEQ_DEVICE_REGISTERED 133 34 14 struct snd_seq_device { 35 15 /* device info */ 36 16 struct snd_card *card; /* sound card */ 37 17 int device; /* device number */ 38 c har id[ID_LEN];/* driver id */18 const char *id; /* driver id */ 39 19 char name[80]; /* device name */ 40 20 int argsize; /* size of the argument */ 41 21 void *driver_data; /* private data for driver */ 42 int status; /* flag - read only */43 22 void *private_data; /* private data for the caller */ 44 23 void (*private_free)(struct snd_seq_device *device); 45 struct list_head list; /* link to next device */24 struct device dev; 46 25 }; 47 26 27 #define to_seq_dev(_dev) \ 28 container_of(_dev, struct snd_seq_device, dev) 29 30 /* sequencer driver */ 48 31 49 32 /* driver operators 50 * init_device:33 * probe: 51 34 * Initialize the device with given parameters. 52 35 * Typically, … … 56 39 * 4. store the instance to dev->driver_data pointer. 57 40 * 58 * free_device:41 * remove: 59 42 * Release the private data. 60 43 * Typically, call snd_device_free(dev->card, dev->driver_data) 61 44 */ 62 struct snd_seq_dev_ops { 63 int (*init_device)(struct snd_seq_device *dev); 64 int (*free_device)(struct snd_seq_device *dev); 45 struct snd_seq_driver { 46 struct device_driver driver; 47 char *id; 48 int argsize; 65 49 }; 50 51 #define to_seq_drv(_drv) \ 52 container_of(_drv, struct snd_seq_driver, driver) 66 53 67 54 /* 68 55 * prototypes 69 56 */ 57 #ifdef CONFIG_MODULES 70 58 void snd_seq_device_load_drivers(void); 71 int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); 72 int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); 73 int snd_seq_device_unregister_driver(char *id); 59 #else 60 #define snd_seq_device_load_drivers() 61 #endif 62 int snd_seq_device_new(struct snd_card *card, int device, const char *id, 63 int argsize, struct snd_seq_device **result); 74 64 75 65 #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) 76 66 67 int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv, 68 struct module *mod); 69 #define snd_seq_driver_register(drv) \ 70 __snd_seq_driver_register(drv, THIS_MODULE) 71 void snd_seq_driver_unregister(struct snd_seq_driver *drv); 72 73 #define module_snd_seq_driver(drv) \ 74 module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister) 77 75 78 76 /* -
GPL/trunk/alsa-kernel/include/sound/seq_kernel.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_KERNEL_H 2 3 #define __SOUND_SEQ_KERNEL_H … … 5 6 * Main kernel header file for the ALSA sequencer 6 7 * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 #include <linux/time.h> 25 #include "asequencer.h"10 #include <sound/asequencer.h> 26 11 27 12 typedef struct snd_seq_real_time snd_seq_real_time_t; 28 13 typedef union snd_seq_timestamp snd_seq_timestamp_t; 29 14 30 /* maximum number of events dequeued per schedule interval */31 #define SNDRV_SEQ_MAX_DEQUEUE 5032 33 15 /* maximum number of queues */ 34 #define SNDRV_SEQ_MAX_QUEUES 816 #define SNDRV_SEQ_MAX_QUEUES 32 35 17 36 18 /* max number of concurrent clients */ … … 42 24 /* max number of events in memory pool */ 43 25 #define SNDRV_SEQ_MAX_EVENTS 2000 44 45 /* default number of events in memory chunk */46 #define SNDRV_SEQ_DEFAULT_CHUNK_EVENTS 6447 26 48 27 /* default number of events in memory pool */ … … 56 35 57 36 /* max delivery path length */ 58 #define SNDRV_SEQ_MAX_HOPS 10 37 /* NOTE: this shouldn't be greater than MAX_LOCKDEP_SUBCLASSES */ 38 #define SNDRV_SEQ_MAX_HOPS 8 59 39 60 40 /* max size of event size */ … … 71 51 int (*event_input)(struct snd_seq_event *ev, int direct, void *private_data, int atomic, int hop); 72 52 void (*private_free)(void *private_data); 73 unsigned int callback_all; /* call subscribe callbacks at each connection/disconnection */74 53 /*...*/ 75 54 }; … … 77 56 /* interface for kernel client */ 78 57 #ifndef TARGET_OS2 79 int snd_seq_create_kernel_client(struct snd_card *card, int client_index, 80 const char *name_fmt, ...) 81 __attribute__ ((format (printf, 3, 4))); 82 #else 58 __printf(3, 4) 59 #endif 83 60 int snd_seq_create_kernel_client(struct snd_card *card, int client_index, 84 61 const char *name_fmt, ...); 85 #endif86 62 int snd_seq_delete_kernel_client(int client); 87 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); 63 int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, 64 struct file *file, bool blocking); 88 65 int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop); 89 66 int snd_seq_kernel_client_ctl(int client, unsigned int cmd, void *arg); … … 112 89 113 90 #ifdef CONFIG_MODULES 114 void snd_seq_autoload_ lock(void);115 void snd_seq_autoload_ unlock(void);91 void snd_seq_autoload_init(void); 92 void snd_seq_autoload_exit(void); 116 93 #else 117 #define snd_seq_autoload_ lock()118 #define snd_seq_autoload_ unlock()94 #define snd_seq_autoload_init() 95 #define snd_seq_autoload_exit() 119 96 #endif 120 97 -
GPL/trunk/alsa-kernel/include/sound/seq_midi_emul.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_MIDI_EMUL_H 2 3 #define __SOUND_SEQ_MIDI_EMUL_H … … 6 7 * 7 8 * Copyright (C) 1999 Steve Ratcliffe 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 9 */ 24 10 25 #include "seq_kernel.h"11 #include <sound/seq_kernel.h> 26 12 27 13 /* … … 189 175 190 176 /* Prototypes for midi_process.c */ 191 void snd_midi_process_event(struct snd_midi_op *ops, struct snd_seq_event *ev, 177 void snd_midi_process_event(const struct snd_midi_op *ops, 178 struct snd_seq_event *ev, 192 179 struct snd_midi_channel_set *chanset); 193 180 void snd_midi_channel_set_clear(struct snd_midi_channel_set *chset); -
GPL/trunk/alsa-kernel/include/sound/seq_midi_event.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_MIDI_EVENT_H 2 3 #define __SOUND_SEQ_MIDI_EVENT_H … … 7 8 * Copyright (C) 1998,99 Takashi Iwai <tiwai@suse.de>, 8 9 * Jaroslav Kysela <perex@perex.cz> 9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 10 */ 24 11 25 #include "asequencer.h"12 #include <sound/asequencer.h> 26 13 27 14 #define MAX_MIDI_EVENT_BUF 256 … … 44 31 void snd_midi_event_reset_decode(struct snd_midi_event *dev); 45 32 void snd_midi_event_no_status(struct snd_midi_event *dev, int on); 46 /* encode from byte stream - return number of written bytes if success */ 47 long snd_midi_event_encode(struct snd_midi_event *dev, unsigned char *buf, long count, 48 struct snd_seq_event *ev); 49 int snd_midi_event_encode_byte(struct snd_midi_event *dev, int c, struct snd_seq_event *ev); 33 bool snd_midi_event_encode_byte(struct snd_midi_event *dev, unsigned char c, 34 struct snd_seq_event *ev); 50 35 /* decode from event to bytes - return number of written bytes if success */ 51 36 long snd_midi_event_decode(struct snd_midi_event *dev, unsigned char *buf, long count, -
GPL/trunk/alsa-kernel/include/sound/seq_oss.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_OSS_H 2 3 #define __SOUND_SEQ_OSS_H … … 6 7 * 7 8 * Copyright (C) 1998,99 Takashi Iwai 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 9 */ 23 10 24 #include "asequencer.h"25 #include "seq_kernel.h"11 #include <sound/asequencer.h> 12 #include <sound/seq_kernel.h> 26 13 27 14 /* -
GPL/trunk/alsa-kernel/include/sound/seq_oss_legacy.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_OSS_LEGACY_H 2 3 #define __SOUND_SEQ_OSS_LEGACY_H … … 6 7 * 7 8 * Copyright (C) 2000 Abramo Bagnara <abramo@alsa-project.org> 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 9 */ 23 10 -
GPL/trunk/alsa-kernel/include/sound/seq_virmidi.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SEQ_VIRMIDI_H 2 3 #define __SOUND_SEQ_VIRMIDI_H … … 6 7 * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>, 7 8 * Jaroslav Kysela <perex@perex.cz> 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 9 */ 24 10 25 #include "rawmidi.h"26 #include "seq_midi_event.h"11 #include <sound/rawmidi.h> 12 #include <sound/seq_midi_event.h> 27 13 28 14 /* … … 37 23 int client; 38 24 int port; 39 unsigned int trigger: 1;25 bool trigger; 40 26 struct snd_midi_event *parser; 41 27 struct snd_seq_event event; 42 28 struct snd_virmidi_dev *rdev; 43 29 struct snd_rawmidi_substream *substream; 30 struct work_struct output_work; 44 31 }; 45 32 … … 61 48 unsigned int flags; /* SNDRV_VIRMIDI_* */ 62 49 rwlock_t filelist_lock; 50 struct rw_semaphore filelist_sem; 63 51 struct list_head filelist; 64 52 }; -
GPL/trunk/alsa-kernel/include/sound/snd_wavefront.h
r399 r679 1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 #ifndef __SOUND_SND_WAVEFRONT_H__ 2 3 #define __SOUND_SND_WAVEFRONT_H__ 3 4 4 #include "mpu401.h"5 #include "hwdep.h"6 #include "rawmidi.h"7 #include "wavefront.h"/* generic OSS/ALSA/user-level wavefront header */5 #include <sound/mpu401.h> 6 #include <sound/hwdep.h> 7 #include <sound/rawmidi.h> 8 #include <sound/wavefront.h> /* generic OSS/ALSA/user-level wavefront header */ 8 9 9 10 /* MIDI interface */ … … 29 30 struct snd_rawmidi_substream *substream_input[2]; 30 31 struct timer_list timer; 32 snd_wavefront_card_t *timer_card; 31 33 spinlock_t open; 32 34 spinlock_t virtual; /* protects isvirtual */ … … 38 40 #define UART_MODE_ON 0x3F 39 41 40 extern struct snd_rawmidi_ops snd_wavefront_midi_output;41 extern struct snd_rawmidi_ops snd_wavefront_midi_input;42 extern const struct snd_rawmidi_ops snd_wavefront_midi_output; 43 extern const struct snd_rawmidi_ops snd_wavefront_midi_input; 42 44 43 45 extern void snd_wavefront_midi_enable_virtual (snd_wavefront_card_t *); -
GPL/trunk/alsa-kernel/include/sound/soc-dapm.h
r598 r679 1 /* 1 /* SPDX-License-Identifier: GPL-2.0 2 * 2 3 * linux/sound/soc-dapm.h -- ALSA SoC Dynamic Audio Power Management 3 4 * 4 * Author: Liam Girdwood5 * Created: Aug 11th 20055 * Author: Liam Girdwood 6 * Created: Aug 11th 2005 6 7 * Copyright: Wolfson Microelectronics. PLC. 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License version 2 as10 * published by the Free Software Foundation.11 8 */ 12 9 … … 14 11 #define __LINUX_SND_SOC_DAPM_H 15 12 16 #include <linux/device.h>17 13 #include <linux/types.h> 18 14 #include <sound/control.h> 15 #include <sound/soc-topology.h> 16 #include <sound/asoc.h> 17 18 struct device; 19 struct snd_soc_pcm_runtime; 20 struct soc_enum; 19 21 20 22 /* widget has no PM register bit */ … … 24 26 * SoC dynamic audio power management 25 27 * 26 * We can have up to 4 power domains27 * 1. Codec domain - VREF, VMID28 * We can have up to 4 power domains 29 * 1. Codec domain - VREF, VMID 28 30 * Usually controlled at codec probe/remove, although can be set 29 31 * at stream time if power is not needed for sidetone, etc. … … 40 42 /* codec domain */ 41 43 #define SND_SOC_DAPM_VMID(wname) \ 42 { .id = snd_soc_dapm_vmid, .name = wname, .kcontrol s = NULL, \44 { .id = snd_soc_dapm_vmid, .name = wname, .kcontrol_news = NULL, \ 43 45 .num_kcontrols = 0} 44 46 45 47 /* platform domain */ 48 #define SND_SOC_DAPM_SIGGEN(wname) \ 49 { .id = snd_soc_dapm_siggen, .name = wname, .kcontrol_news = NULL, \ 50 .num_kcontrols = 0, .reg = SND_SOC_NOPM } 51 #define SND_SOC_DAPM_SINK(wname) \ 52 { .id = snd_soc_dapm_sink, .name = wname, .kcontrol_news = NULL, \ 53 .num_kcontrols = 0, .reg = SND_SOC_NOPM } 46 54 #define SND_SOC_DAPM_INPUT(wname) \ 47 { .id = snd_soc_dapm_input, .name = wname, .kcontrol s = NULL, \48 .num_kcontrols = 0 }55 { .id = snd_soc_dapm_input, .name = wname, .kcontrol_news = NULL, \ 56 .num_kcontrols = 0, .reg = SND_SOC_NOPM } 49 57 #define SND_SOC_DAPM_OUTPUT(wname) \ 50 { .id = snd_soc_dapm_output, .name = wname, .kcontrol s = NULL, \51 .num_kcontrols = 0 }58 { .id = snd_soc_dapm_output, .name = wname, .kcontrol_news = NULL, \ 59 .num_kcontrols = 0, .reg = SND_SOC_NOPM } 52 60 #define SND_SOC_DAPM_MIC(wname, wevent) \ 53 { .id = snd_soc_dapm_mic, .name = wname, .kcontrol s = NULL, \54 .num_kcontrols = 0, . event = wevent, \61 { .id = snd_soc_dapm_mic, .name = wname, .kcontrol_news = NULL, \ 62 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 55 63 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 56 64 #define SND_SOC_DAPM_HP(wname, wevent) \ 57 { .id = snd_soc_dapm_hp, .name = wname, .kcontrol s = NULL, \58 .num_kcontrols = 0, . event = wevent, \65 { .id = snd_soc_dapm_hp, .name = wname, .kcontrol_news = NULL, \ 66 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 59 67 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 60 68 #define SND_SOC_DAPM_SPK(wname, wevent) \ 61 { .id = snd_soc_dapm_spk, .name = wname, .kcontrol s = NULL, \62 .num_kcontrols = 0, . event = wevent, \69 { .id = snd_soc_dapm_spk, .name = wname, .kcontrol_news = NULL, \ 70 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 63 71 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 64 72 #define SND_SOC_DAPM_LINE(wname, wevent) \ 65 { .id = snd_soc_dapm_line, .name = wname, .kcontrol s = NULL, \66 .num_kcontrols = 0, . event = wevent, \73 { .id = snd_soc_dapm_line, .name = wname, .kcontrol_news = NULL, \ 74 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 67 75 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD} 76 77 #define SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert) \ 78 .reg = wreg, .mask = 1, .shift = wshift, \ 79 .on_val = winvert ? 0 : 1, .off_val = winvert ? 1 : 0 68 80 69 81 /* path domain */ 70 82 #define SND_SOC_DAPM_PGA(wname, wreg, wshift, winvert,\ 71 83 wcontrols, wncontrols) \ 72 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 73 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 84 { .id = snd_soc_dapm_pga, .name = wname, \ 85 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 86 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 74 87 #define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\ 75 88 wcontrols, wncontrols) \ 76 { .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \ 77 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 89 { .id = snd_soc_dapm_out_drv, .name = wname, \ 90 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 91 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 78 92 #define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \ 79 93 wcontrols, wncontrols)\ 80 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 81 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 94 { .id = snd_soc_dapm_mixer, .name = wname, \ 95 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 96 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 82 97 #define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \ 83 98 wcontrols, wncontrols)\ 84 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \ 85 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ 86 .num_kcontrols = wncontrols} 99 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \ 100 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 101 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols} 102 /* DEPRECATED: use SND_SOC_DAPM_SUPPLY */ 87 103 #define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \ 88 { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \ 89 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0} 104 { .id = snd_soc_dapm_micbias, .name = wname, \ 105 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 106 .kcontrol_news = NULL, .num_kcontrols = 0} 90 107 #define SND_SOC_DAPM_SWITCH(wname, wreg, wshift, winvert, wcontrols) \ 91 { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ 92 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} 108 { .id = snd_soc_dapm_switch, .name = wname, \ 109 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 110 .kcontrol_news = wcontrols, .num_kcontrols = 1} 93 111 #define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ 94 { .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 95 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} 96 #define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \ 97 { .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \ 98 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} 99 #define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ 100 { .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \ 101 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ 102 .num_kcontrols = 1} 112 { .id = snd_soc_dapm_mux, .name = wname, \ 113 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 114 .kcontrol_news = wcontrols, .num_kcontrols = 1} 115 #define SND_SOC_DAPM_DEMUX(wname, wreg, wshift, winvert, wcontrols) \ 116 { .id = snd_soc_dapm_demux, .name = wname, \ 117 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 118 .kcontrol_news = wcontrols, .num_kcontrols = 1} 103 119 104 120 /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 105 121 #define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\ 106 122 wcontrols) \ 107 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 108 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 123 { .id = snd_soc_dapm_pga, .name = wname, \ 124 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 125 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 109 126 #define SOC_MIXER_ARRAY(wname, wreg, wshift, winvert, \ 110 127 wcontrols)\ 111 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 112 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 128 { .id = snd_soc_dapm_mixer, .name = wname, \ 129 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 130 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 113 131 #define SOC_MIXER_NAMED_CTL_ARRAY(wname, wreg, wshift, winvert, \ 114 132 wcontrols)\ 115 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg,\116 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \117 . num_kcontrols = ARRAY_SIZE(wcontrols)}133 { .id = snd_soc_dapm_mixer_named_ctl, .name = wname, \ 134 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 135 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols)} 118 136 119 137 /* path domain with event - event handler must return 0 for success */ 120 138 #define SND_SOC_DAPM_PGA_E(wname, wreg, wshift, winvert, wcontrols, \ 121 139 wncontrols, wevent, wflags) \ 122 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 123 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 140 { .id = snd_soc_dapm_pga, .name = wname, \ 141 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 142 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \ 124 143 .event = wevent, .event_flags = wflags} 125 144 #define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \ 126 145 wncontrols, wevent, wflags) \ 127 { .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \ 128 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 146 { .id = snd_soc_dapm_out_drv, .name = wname, \ 147 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 148 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \ 129 149 .event = wevent, .event_flags = wflags} 130 150 #define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \ 131 151 wncontrols, wevent, wflags) \ 132 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 133 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 152 { .id = snd_soc_dapm_mixer, .name = wname, \ 153 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 154 .kcontrol_news = wcontrols, .num_kcontrols = wncontrols, \ 134 155 .event = wevent, .event_flags = wflags} 135 156 #define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \ 136 157 wcontrols, wncontrols, wevent, wflags) \ 137 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 138 .invert = winvert, .kcontrols = wcontrols, \ 158 { .id = snd_soc_dapm_mixer, .name = wname, \ 159 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 160 .kcontrol_news = wcontrols, \ 139 161 .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags} 140 #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \141 { .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \142 .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \143 .event = wevent, .event_flags = wflags}144 162 #define SND_SOC_DAPM_SWITCH_E(wname, wreg, wshift, winvert, wcontrols, \ 145 163 wevent, wflags) \ 146 { .id = snd_soc_dapm_switch, .name = wname, .reg = wreg, .shift = wshift, \ 147 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 164 { .id = snd_soc_dapm_switch, .name = wname, \ 165 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 166 .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 148 167 .event = wevent, .event_flags = wflags} 149 168 #define SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ 150 169 wevent, wflags) \ 151 { .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 152 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 153 .event = wevent, .event_flags = wflags} 154 #define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \ 170 { .id = snd_soc_dapm_mux, .name = wname, \ 171 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 172 .kcontrol_news = wcontrols, .num_kcontrols = 1, \ 173 .event = wevent, .event_flags = wflags} 174 175 /* additional sequencing control within an event type */ 176 #define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \ 155 177 wevent, wflags) \ 156 { .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \ 157 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 158 .event = wevent, .event_flags = wflags} 178 { .id = snd_soc_dapm_pga, .name = wname, \ 179 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 180 .event = wevent, .event_flags = wflags, \ 181 .subseq = wsubseq} 182 #define SND_SOC_DAPM_SUPPLY_S(wname, wsubseq, wreg, wshift, winvert, wevent, \ 183 wflags) \ 184 { .id = snd_soc_dapm_supply, .name = wname, \ 185 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 186 .event = wevent, .event_flags = wflags, .subseq = wsubseq} 159 187 160 188 /* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 161 189 #define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 162 190 wevent, wflags) \ 163 { .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 164 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 191 { .id = snd_soc_dapm_pga, .name = wname, \ 192 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 193 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 165 194 .event = wevent, .event_flags = wflags} 166 195 #define SOC_MIXER_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 167 196 wevent, wflags) \ 168 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 169 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 197 { .id = snd_soc_dapm_mixer, .name = wname, \ 198 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 199 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 170 200 .event = wevent, .event_flags = wflags} 171 201 #define SOC_MIXER_NAMED_CTL_E_ARRAY(wname, wreg, wshift, winvert, \ 172 202 wcontrols, wevent, wflags) \ 173 { .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 174 .invert = winvert, .kcontrols = wcontrols, \ 175 .num_kcontrols = ARRAY_SIZE(wcontrols), .event = wevent, .event_flags = wflags} 203 { .id = snd_soc_dapm_mixer, .name = wname, \ 204 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 205 .kcontrol_news = wcontrols, .num_kcontrols = ARRAY_SIZE(wcontrols), \ 206 .event = wevent, .event_flags = wflags} 176 207 177 208 /* events that are pre and post DAPM */ 178 209 #define SND_SOC_DAPM_PRE(wname, wevent) \ 179 { .id = snd_soc_dapm_pre, .name = wname, .kcontrol s = NULL, \180 .num_kcontrols = 0, . event = wevent, \210 { .id = snd_soc_dapm_pre, .name = wname, .kcontrol_news = NULL, \ 211 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 181 212 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD} 182 213 #define SND_SOC_DAPM_POST(wname, wevent) \ 183 { .id = snd_soc_dapm_post, .name = wname, .kcontrol s = NULL, \184 .num_kcontrols = 0, . event = wevent, \214 { .id = snd_soc_dapm_post, .name = wname, .kcontrol_news = NULL, \ 215 .num_kcontrols = 0, .reg = SND_SOC_NOPM, .event = wevent, \ 185 216 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} 186 217 187 218 /* stream domain */ 188 #define SND_SOC_DAPM_AIF_IN(wname, stname, w slot, wreg, wshift, winvert) \219 #define SND_SOC_DAPM_AIF_IN(wname, stname, wchan, wreg, wshift, winvert) \ 189 220 { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ 190 . reg = wreg, .shift = wshift, .invert = winvert}191 #define SND_SOC_DAPM_AIF_IN_E(wname, stname, w slot, wreg, wshift, winvert, \221 .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } 222 #define SND_SOC_DAPM_AIF_IN_E(wname, stname, wchan, wreg, wshift, winvert, \ 192 223 wevent, wflags) \ 193 224 { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ 194 . reg = wreg, .shift = wshift, .invert = winvert, \225 .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 195 226 .event = wevent, .event_flags = wflags } 196 #define SND_SOC_DAPM_AIF_OUT(wname, stname, w slot, wreg, wshift, winvert) \227 #define SND_SOC_DAPM_AIF_OUT(wname, stname, wchan, wreg, wshift, winvert) \ 197 228 { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ 198 . reg = wreg, .shift = wshift, .invert = winvert}199 #define SND_SOC_DAPM_AIF_OUT_E(wname, stname, w slot, wreg, wshift, winvert, \229 .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } 230 #define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wchan, wreg, wshift, winvert, \ 200 231 wevent, wflags) \ 201 232 { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ 202 . reg = wreg, .shift = wshift, .invert = winvert, \233 .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 203 234 .event = wevent, .event_flags = wflags } 204 235 #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ 205 { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg,\206 .shift = wshift, .invert = winvert}236 { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \ 237 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert) } 207 238 #define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \ 208 239 wevent, wflags) \ 209 { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 210 .shift = wshift, .invert = winvert, \ 211 .event = wevent, .event_flags = wflags} 240 { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \ 241 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 242 .event = wevent, .event_flags = wflags} 243 212 244 #define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \ 213 { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg,\214 .shift = wshift, .invert = winvert}245 { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \ 246 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } 215 247 #define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \ 216 248 wevent, wflags) \ 217 { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ 218 .shift = wshift, .invert = winvert, \ 219 .event = wevent, .event_flags = wflags} 249 { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, \ 250 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 251 .event = wevent, .event_flags = wflags} 252 #define SND_SOC_DAPM_CLOCK_SUPPLY(wname) \ 253 { .id = snd_soc_dapm_clock_supply, .name = wname, \ 254 .reg = SND_SOC_NOPM, .event = dapm_clock_event, \ 255 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } 220 256 221 257 /* generic widgets */ 222 258 #define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ 223 { .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \ 224 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ 225 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 226 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 259 { .id = wid, .name = wname, .kcontrol_news = NULL, .num_kcontrols = 0, \ 260 .reg = wreg, .shift = wshift, .mask = wmask, \ 261 .on_val = won_val, .off_val = woff_val, } 227 262 #define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \ 228 { .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 229 .shift = wshift, .invert = winvert, .event = wevent, \ 230 .event_flags = wflags} 263 { .id = snd_soc_dapm_supply, .name = wname, \ 264 SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ 265 .event = wevent, .event_flags = wflags} 266 #define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay, wflags) \ 267 { .id = snd_soc_dapm_regulator_supply, .name = wname, \ 268 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ 269 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \ 270 .on_val = wflags} 271 #define SND_SOC_DAPM_PINCTRL(wname, active, sleep) \ 272 { .id = snd_soc_dapm_pinctrl, .name = wname, \ 273 .priv = (&(struct snd_soc_dapm_pinctrl_priv) \ 274 { .active_state = active, .sleep_state = sleep,}), \ 275 .reg = SND_SOC_NOPM, .event = dapm_pinctrl_event, \ 276 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } 277 278 231 279 232 280 /* dapm kcontrol types */ 281 #define SOC_DAPM_DOUBLE(xname, reg, lshift, rshift, max, invert) \ 282 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 283 .info = snd_soc_info_volsw, \ 284 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 285 .private_value = SOC_DOUBLE_VALUE(reg, lshift, rshift, max, invert, 0) } 286 #define SOC_DAPM_DOUBLE_R(xname, lreg, rreg, shift, max, invert) \ 287 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 288 .info = snd_soc_info_volsw, \ 289 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 290 .private_value = SOC_DOUBLE_R_VALUE(lreg, rreg, shift, max, invert) } 233 291 #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ 234 292 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 235 293 .info = snd_soc_info_volsw, \ 236 294 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 237 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 295 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 296 #define SOC_DAPM_SINGLE_AUTODISABLE(xname, reg, shift, max, invert) \ 297 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 298 .info = snd_soc_info_volsw, \ 299 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 300 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) } 301 #define SOC_DAPM_SINGLE_VIRT(xname, max) \ 302 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0) 238 303 #define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 239 304 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 242 307 .tlv.p = (tlv_array), \ 243 308 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 244 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 309 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 310 #define SOC_DAPM_SINGLE_TLV_AUTODISABLE(xname, reg, shift, max, invert, tlv_array) \ 311 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 312 .info = snd_soc_info_volsw, \ 313 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 314 .tlv.p = (tlv_array), \ 315 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 316 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 1) } 317 #define SOC_DAPM_SINGLE_TLV_VIRT(xname, max, tlv_array) \ 318 SOC_DAPM_SINGLE(xname, SND_SOC_NOPM, 0, max, 0, tlv_array) 245 319 #define SOC_DAPM_ENUM(xname, xenum) \ 246 320 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 249 323 .put = snd_soc_dapm_put_enum_double, \ 250 324 .private_value = (unsigned long)&xenum } 251 #define SOC_DAPM_ENUM_ VIRT(xname, xenum)\325 #define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \ 252 326 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 253 327 .info = snd_soc_info_enum_double, \ 254 .get = snd_soc_dapm_get_enum_virt, \ 255 .put = snd_soc_dapm_put_enum_virt, \ 256 .private_value = (unsigned long)&xenum } 257 #define SOC_DAPM_VALUE_ENUM(xname, xenum) \ 258 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 259 .info = snd_soc_info_enum_double, \ 260 .get = snd_soc_dapm_get_value_enum_double, \ 261 .put = snd_soc_dapm_put_value_enum_double, \ 328 .get = xget, \ 329 .put = xput, \ 262 330 .private_value = (unsigned long)&xenum } 263 331 #define SOC_DAPM_PIN_SWITCH(xname) \ … … 284 352 #define SND_SOC_DAPM_PRE_REG 0x10 /* before audio path setup */ 285 353 #define SND_SOC_DAPM_POST_REG 0x20 /* after audio path setup */ 354 #define SND_SOC_DAPM_WILL_PMU 0x40 /* called at start of sequence */ 355 #define SND_SOC_DAPM_WILL_PMD 0x80 /* called at start of sequence */ 286 356 #define SND_SOC_DAPM_PRE_POST_PMD \ 287 357 (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD) 358 #define SND_SOC_DAPM_PRE_POST_PMU \ 359 (SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU) 288 360 289 361 /* convenience event type detection */ … … 292 364 #define SND_SOC_DAPM_EVENT_OFF(e) \ 293 365 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)) 366 367 /* regulator widget flags */ 368 #define SND_SOC_DAPM_REGULATOR_BYPASS 0x1 /* bypass when disabled */ 294 369 295 370 struct snd_soc_dapm_widget; … … 299 374 struct snd_soc_dapm_route; 300 375 struct snd_soc_dapm_context; 301 302 int dapm_reg_event(struct snd_soc_dapm_widget *w, 303 struct snd_kcontrol *kcontrol, int event); 376 struct regulator; 377 struct snd_soc_dapm_widget_list; 378 struct snd_soc_dapm_update; 379 enum snd_soc_dapm_direction; 380 381 /* 382 * Bias levels 383 * 384 * @ON: Bias is fully on for audio playback and capture operations. 385 * @PREPARE: Prepare for audio operations. Called before DAPM switching for 386 * stream start and stop operations. 387 * @STANDBY: Low power standby state when no playback/capture operations are 388 * in progress. NOTE: The transition time between STANDBY and ON 389 * should be as fast as possible and no longer than 10ms. 390 * @OFF: Power Off. No restrictions on transition times. 391 */ 392 enum snd_soc_bias_level { 393 SND_SOC_BIAS_OFF = 0, 394 SND_SOC_BIAS_STANDBY = 1, 395 SND_SOC_BIAS_PREPARE = 2, 396 SND_SOC_BIAS_ON = 3, 397 }; 398 399 int dapm_regulator_event(struct snd_soc_dapm_widget *w, 400 struct snd_kcontrol *kcontrol, int event); 401 int dapm_clock_event(struct snd_soc_dapm_widget *w, 402 struct snd_kcontrol *kcontrol, int event); 403 int dapm_pinctrl_event(struct snd_soc_dapm_widget *w, 404 struct snd_kcontrol *kcontrol, int event); 304 405 305 406 /* dapm controls */ … … 312 413 int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, 313 414 struct snd_ctl_elem_value *ucontrol); 314 int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol,315 struct snd_ctl_elem_value *ucontrol);316 int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,317 struct snd_ctl_elem_value *ucontrol);318 int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,319 struct snd_ctl_elem_value *ucontrol);320 int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,321 struct snd_ctl_elem_value *ucontrol);322 415 int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol, 323 416 struct snd_ctl_elem_info *uinfo); … … 326 419 int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, 327 420 struct snd_ctl_elem_value *uncontrol); 328 int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,329 const struct snd_soc_dapm_widget *widget);330 421 int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, 331 422 const struct snd_soc_dapm_widget *widget, 332 423 int num); 424 struct snd_soc_dapm_widget *snd_soc_dapm_new_control( 425 struct snd_soc_dapm_context *dapm, 426 const struct snd_soc_dapm_widget *widget); 427 struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked( 428 struct snd_soc_dapm_context *dapm, 429 const struct snd_soc_dapm_widget *widget); 430 int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, 431 struct snd_soc_dai *dai); 432 int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); 433 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); 434 435 int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream, 436 struct snd_pcm_hw_params *params, 437 struct snd_soc_dai *dai); 333 438 334 439 /* dapm path setup */ 335 int snd_soc_dapm_new_widgets(struct snd_soc_ dapm_context *dapm);440 int snd_soc_dapm_new_widgets(struct snd_soc_card *card); 336 441 void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); 442 void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm, 443 struct snd_soc_card *card, 444 struct snd_soc_component *component); 337 445 int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, 338 446 const struct snd_soc_dapm_route *route, int num); 447 int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm, 448 const struct snd_soc_dapm_route *route, int num); 449 int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm, 450 const struct snd_soc_dapm_route *route, int num); 451 void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w); 452 void snd_soc_dapm_reset_cache(struct snd_soc_dapm_context *dapm); 339 453 340 454 /* dapm events */ 341 int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, 342 const char *stream, int event); 455 void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, 456 int event); 457 void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream); 343 458 void snd_soc_dapm_shutdown(struct snd_soc_card *card); 344 459 460 /* external DAPM widget events */ 461 int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, 462 struct snd_kcontrol *kcontrol, int connect, 463 struct snd_soc_dapm_update *update); 464 int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, 465 struct snd_kcontrol *kcontrol, int mux, struct soc_enum *e, 466 struct snd_soc_dapm_update *update); 467 345 468 /* dapm sys fs - used by the core */ 346 int snd_soc_dapm_sys_add(struct device *dev); 347 void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm); 469 extern struct attribute *soc_dapm_dev_attrs[]; 470 void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, 471 struct dentry *parent); 348 472 349 473 /* dapm audio pin control and status */ 350 474 int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, 351 475 const char *pin); 476 int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, 477 const char *pin); 352 478 int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, 353 479 const char *pin); 480 int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, 481 const char *pin); 354 482 int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin); 483 int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm, 484 const char *pin); 355 485 int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm, 356 486 const char *pin); 357 487 int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm); 488 int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm); 358 489 int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm, 359 490 const char *pin); 491 int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, 492 const char *pin); 360 493 int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 361 494 const char *pin); 495 unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol); 496 497 /* Mostly internal - should not normally be used */ 498 void dapm_mark_endpoints_dirty(struct snd_soc_card *card); 499 500 /* dapm path query */ 501 int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 502 struct snd_soc_dapm_widget_list **list, 503 bool (*custom_stop_condition)(struct snd_soc_dapm_widget *, 504 enum snd_soc_dapm_direction)); 505 void snd_soc_dapm_dai_free_widgets(struct snd_soc_dapm_widget_list **list); 506 507 struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( 508 struct snd_kcontrol *kcontrol); 509 510 struct snd_soc_dapm_widget *snd_soc_dapm_kcontrol_widget( 511 struct snd_kcontrol *kcontrol); 512 513 int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, 514 enum snd_soc_bias_level level); 362 515 363 516 /* dapm widget types */ … … 366 519 snd_soc_dapm_output, /* output pin */ 367 520 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 368 snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */ 369 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ 521 snd_soc_dapm_demux, /* connects the input to one of multiple outputs */ 370 522 snd_soc_dapm_mixer, /* mixes several analog signals together */ 371 523 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ … … 374 526 snd_soc_dapm_adc, /* analog to digital converter */ 375 527 snd_soc_dapm_dac, /* digital to analog converter */ 376 snd_soc_dapm_micbias, /* microphone bias (power) */528 snd_soc_dapm_micbias, /* microphone bias (power) - DEPRECATED: use snd_soc_dapm_supply */ 377 529 snd_soc_dapm_mic, /* microphone */ 378 530 snd_soc_dapm_hp, /* headphones */ … … 384 536 snd_soc_dapm_post, /* machine specific post widget - exec last */ 385 537 snd_soc_dapm_supply, /* power/clock supply */ 538 snd_soc_dapm_pinctrl, /* pinctrl */ 539 snd_soc_dapm_regulator_supply, /* external regulator */ 540 snd_soc_dapm_clock_supply, /* external clock */ 386 541 snd_soc_dapm_aif_in, /* audio interface input */ 387 542 snd_soc_dapm_aif_out, /* audio interface output */ 543 snd_soc_dapm_siggen, /* signal generator */ 544 snd_soc_dapm_sink, 545 snd_soc_dapm_dai_in, /* link to DAI structure */ 546 snd_soc_dapm_dai_out, 547 snd_soc_dapm_dai_link, /* link between two DAI structures */ 548 snd_soc_dapm_kcontrol, /* Auto-disabled kcontrol */ 549 snd_soc_dapm_buffer, /* DSP/CODEC internal buffer */ 550 snd_soc_dapm_scheduler, /* DSP/CODEC internal scheduler */ 551 snd_soc_dapm_effect, /* DSP/CODEC effect component */ 552 snd_soc_dapm_src, /* DSP/CODEC SRC component */ 553 snd_soc_dapm_asrc, /* DSP/CODEC ASRC component */ 554 snd_soc_dapm_encoder, /* FW/SW audio encoder component */ 555 snd_soc_dapm_decoder, /* FW/SW audio decoder component */ 556 557 /* Don't edit below this line */ 558 SND_SOC_DAPM_TYPE_COUNT 559 }; 560 561 enum snd_soc_dapm_subclass { 562 SND_SOC_DAPM_CLASS_INIT = 0, 563 SND_SOC_DAPM_CLASS_RUNTIME = 1, 388 564 }; 389 565 … … 402 578 int (*connected)(struct snd_soc_dapm_widget *source, 403 579 struct snd_soc_dapm_widget *sink); 580 581 struct snd_soc_dobj dobj; 404 582 }; 405 583 406 584 /* dapm audio path between two widgets */ 407 585 struct snd_soc_dapm_path { 408 char *name; 409 char *long_name; 410 411 /* source (input) and sink (output) widgets */ 412 struct snd_soc_dapm_widget *source; 413 struct snd_soc_dapm_widget *sink; 414 struct snd_kcontrol *kcontrol; 586 const char *name; 587 588 /* 589 * source (input) and sink (output) widgets 590 * The union is for convience, since it is a lot nicer to type 591 * p->source, rather than p->node[SND_SOC_DAPM_DIR_IN] 592 */ 593 union { 594 struct { 595 struct snd_soc_dapm_widget *source; 596 struct snd_soc_dapm_widget *sink; 597 }; 598 struct snd_soc_dapm_widget *node[2]; 599 }; 415 600 416 601 /* status */ 417 602 u32 connect:1; /* source and sink widgets are connected */ 418 u32 walked:1; /* path has been walked */ 603 u32 walking:1; /* path is in the process of being walked */ 604 u32 weak:1; /* path ignored for power management */ 605 u32 is_supply:1; /* At least one of the connected widgets is a supply */ 419 606 420 607 int (*connected)(struct snd_soc_dapm_widget *source, 421 608 struct snd_soc_dapm_widget *sink); 422 609 423 struct list_head list_ source;424 struct list_head list_ sink;610 struct list_head list_node[2]; 611 struct list_head list_kcontrol; 425 612 struct list_head list; 426 613 }; … … 429 616 struct snd_soc_dapm_widget { 430 617 enum snd_soc_dapm_type id; 431 char *name; /* widget name */ 432 char *sname; /* stream name */ 433 struct snd_soc_codec *codec; 618 const char *name; /* widget name */ 619 const char *sname; /* stream name */ 434 620 struct list_head list; 435 621 struct snd_soc_dapm_context *dapm; 436 622 623 void *priv; /* widget specific data */ 624 struct regulator *regulator; /* attached regulator */ 625 struct pinctrl *pinctrl; /* attached pinctrl */ 626 437 627 /* dapm control */ 438 short reg;/* negative reg = no direct dapm */628 int reg; /* negative reg = no direct dapm */ 439 629 unsigned char shift; /* bits to shift */ 440 unsigned int saved_value; /* widget saved value */441 unsigned int value; /* widget current value */442 630 unsigned int mask; /* non-shifted mask */ 443 631 unsigned int on_val; /* on state value */ 444 632 unsigned int off_val; /* off state value */ 445 633 unsigned char power:1; /* block power status */ 446 unsigned char invert:1; /* invert the power bit */447 634 unsigned char active:1; /* active stream on DAC, ADC's */ 448 635 unsigned char connected:1; /* connected codec pin */ 449 636 unsigned char new:1; /* cnew complete */ 450 unsigned char ext:1; /* has external widgets */451 637 unsigned char force:1; /* force state */ 452 638 unsigned char ignore_suspend:1; /* kept enabled over suspend */ 639 unsigned char new_power:1; /* power from this run */ 640 unsigned char power_checked:1; /* power checked this run */ 641 unsigned char is_supply:1; /* Widget is a supply type widget */ 642 unsigned char is_ep:2; /* Widget is a endpoint type widget */ 643 int subseq; /* sort within widget type */ 453 644 454 645 int (*power_check)(struct snd_soc_dapm_widget *w); … … 460 651 /* kcontrols that relate to this widget */ 461 652 int num_kcontrols; 462 const struct snd_kcontrol_new *kcontrols; 463 464 /* widget input and outputs */ 465 struct list_head sources; 466 struct list_head sinks; 653 const struct snd_kcontrol_new *kcontrol_news; 654 struct snd_kcontrol **kcontrols; 655 struct snd_soc_dobj dobj; 656 657 /* widget input and output edges */ 658 struct list_head edges[2]; 467 659 468 660 /* used during DAPM updates */ 661 struct list_head work_list; 469 662 struct list_head power_list; 663 struct list_head dirty; 664 int endpoints[2]; 665 666 struct clk *clk; 667 668 int channel; 470 669 }; 471 670 472 671 struct snd_soc_dapm_update { 473 struct snd_soc_dapm_widget *widget;474 672 struct snd_kcontrol *kcontrol; 475 673 int reg; 476 674 int mask; 477 675 int val; 676 int reg2; 677 int mask2; 678 int val2; 679 bool has_second_set; 680 }; 681 682 struct snd_soc_dapm_wcache { 683 struct snd_soc_dapm_widget *widget; 478 684 }; 479 685 480 686 /* DAPM context */ 481 687 struct snd_soc_dapm_context { 482 int n_widgets; /* number of widgets in this context */483 688 enum snd_soc_bias_level bias_level; 484 enum snd_soc_bias_level suspend_bias_level;485 struct delayed_work delayed_work;486 689 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ 487 488 struct snd_soc_dapm_update *update;690 /* Go to BIAS_OFF in suspend if the DAPM context is idle */ 691 unsigned int suspend_bias_off:1; 489 692 490 693 struct device *dev; /* from parent - for debug */ 491 struct snd_soc_co dec *codec; /* parent codec*/694 struct snd_soc_component *component; /* parent component */ 492 695 struct snd_soc_card *card; /* parent card */ 493 696 494 697 /* used during DAPM updates */ 495 int dev_power;698 enum snd_soc_bias_level target_bias_level; 496 699 struct list_head list; 700 701 struct snd_soc_dapm_wcache path_sink_cache; 702 struct snd_soc_dapm_wcache path_source_cache; 497 703 498 704 #ifdef CONFIG_DEBUG_FS … … 501 707 }; 502 708 709 /* A list of widgets associated with an object, typically a snd_kcontrol */ 710 struct snd_soc_dapm_widget_list { 711 int num_widgets; 712 struct snd_soc_dapm_widget *widgets[]; 713 }; 714 715 #define for_each_dapm_widgets(list, i, widget) \ 716 for ((i) = 0; \ 717 (i) < list->num_widgets && (widget = list->widgets[i]); \ 718 (i)++) 719 720 struct snd_soc_dapm_stats { 721 int power_checks; 722 int path_checks; 723 int neighbour_checks; 724 }; 725 726 struct snd_soc_dapm_pinctrl_priv { 727 const char *active_state; 728 const char *sleep_state; 729 }; 730 731 /** 732 * snd_soc_dapm_init_bias_level() - Initialize DAPM bias level 733 * @dapm: The DAPM context to initialize 734 * @level: The DAPM level to initialize to 735 * 736 * This function only sets the driver internal state of the DAPM level and will 737 * not modify the state of the device. Hence it should not be used during normal 738 * operation, but only to synchronize the internal state to the device state. 739 * E.g. during driver probe to set the DAPM level to the one corresponding with 740 * the power-on reset state of the device. 741 * 742 * To change the DAPM state of the device use snd_soc_dapm_set_bias_level(). 743 */ 744 static inline void snd_soc_dapm_init_bias_level( 745 struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) 746 { 747 dapm->bias_level = level; 748 } 749 750 /** 751 * snd_soc_dapm_get_bias_level() - Get current DAPM bias level 752 * @dapm: The context for which to get the bias level 753 * 754 * Returns: The current bias level of the passed DAPM context. 755 */ 756 static inline enum snd_soc_bias_level snd_soc_dapm_get_bias_level( 757 struct snd_soc_dapm_context *dapm) 758 { 759 return dapm->bias_level; 760 } 761 762 enum snd_soc_dapm_direction { 763 SND_SOC_DAPM_DIR_IN, 764 SND_SOC_DAPM_DIR_OUT 765 }; 766 767 #define SND_SOC_DAPM_DIR_TO_EP(x) BIT(x) 768 769 #define SND_SOC_DAPM_EP_SOURCE SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN) 770 #define SND_SOC_DAPM_EP_SINK SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT) 771 772 /** 773 * snd_soc_dapm_widget_for_each_sink_path - Iterates over all paths in the 774 * specified direction of a widget 775 * @w: The widget 776 * @dir: Whether to iterate over the paths where the specified widget is the 777 * incoming or outgoing widgets 778 * @p: The path iterator variable 779 */ 780 #define snd_soc_dapm_widget_for_each_path(w, dir, p) \ 781 list_for_each_entry(p, &w->edges[dir], list_node[dir]) 782 783 /** 784 * snd_soc_dapm_widget_for_each_sink_path_safe - Iterates over all paths in the 785 * specified direction of a widget 786 * @w: The widget 787 * @dir: Whether to iterate over the paths where the specified widget is the 788 * incoming or outgoing widgets 789 * @p: The path iterator variable 790 * @next_p: Temporary storage for the next path 791 * 792 * This function works like snd_soc_dapm_widget_for_each_sink_path, expect that 793 * it is safe to remove the current path from the list while iterating 794 */ 795 #define snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p) \ 796 list_for_each_entry_safe(p, next_p, &w->edges[dir], list_node[dir]) 797 798 /** 799 * snd_soc_dapm_widget_for_each_sink_path - Iterates over all paths leaving a 800 * widget 801 * @w: The widget 802 * @p: The path iterator variable 803 */ 804 #define snd_soc_dapm_widget_for_each_sink_path(w, p) \ 805 snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_IN, p) 806 807 /** 808 * snd_soc_dapm_widget_for_each_source_path - Iterates over all paths leading to 809 * a widget 810 * @w: The widget 811 * @p: The path iterator variable 812 */ 813 #define snd_soc_dapm_widget_for_each_source_path(w, p) \ 814 snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_OUT, p) 815 503 816 #endif -
GPL/trunk/alsa-kernel/include/sound/soc.h
r598 r679 1 /* 1 /* SPDX-License-Identifier: GPL-2.0 2 * 2 3 * linux/sound/soc.h -- ALSA SoC Layer 3 4 * 4 * Author: Liam Girdwood5 * Created: Aug 11th 20055 * Author: Liam Girdwood 6 * Created: Aug 11th 2005 6 7 * Copyright: Wolfson Microelectronics. PLC. 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License version 2 as10 * published by the Free Software Foundation.11 8 */ 12 9 … … 14 11 #define __LINUX_SND_SOC_H 15 12 13 #include <linux/of.h> 16 14 #include <linux/platform_device.h> 17 15 #include <linux/types.h> … … 20 18 #include <linux/interrupt.h> 21 19 #include <linux/kernel.h> 20 #include <linux/regmap.h> 21 #include <linux/log2.h> 22 22 #include <sound/core.h> 23 23 #include <sound/pcm.h> 24 #include <sound/compress_driver.h> 24 25 #include <sound/control.h> 25 26 #include <sound/ac97_codec.h> … … 28 29 * Convenience kcontrol builders 29 30 */ 30 #define SOC_ SINGLE_VALUE(xreg, xshift, xmax, xinvert) \31 #define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert, xautodisable) \ 31 32 ((unsigned long)&(struct soc_mixer_control) \ 32 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \ 33 .platform_max = xmax, .invert = xinvert}) 33 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 34 .rshift = shift_right, .max = xmax, .platform_max = xmax, \ 35 .invert = xinvert, .autodisable = xautodisable}) 36 #define SOC_DOUBLE_S_VALUE(xreg, shift_left, shift_right, xmin, xmax, xsign_bit, xinvert, xautodisable) \ 37 ((unsigned long)&(struct soc_mixer_control) \ 38 {.reg = xreg, .rreg = xreg, .shift = shift_left, \ 39 .rshift = shift_right, .min = xmin, .max = xmax, .platform_max = xmax, \ 40 .sign_bit = xsign_bit, .invert = xinvert, .autodisable = xautodisable}) 41 #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, xautodisable) \ 42 SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert, xautodisable) 34 43 #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 35 44 ((unsigned long)&(struct soc_mixer_control) \ 36 45 {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert}) 46 #define SOC_DOUBLE_R_VALUE(xlreg, xrreg, xshift, xmax, xinvert) \ 47 ((unsigned long)&(struct soc_mixer_control) \ 48 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 49 .max = xmax, .platform_max = xmax, .invert = xinvert}) 50 #define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \ 51 ((unsigned long)&(struct soc_mixer_control) \ 52 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 53 .max = xmax, .min = xmin, .platform_max = xmax, .sign_bit = xsign_bit, \ 54 .invert = xinvert}) 55 #define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \ 56 ((unsigned long)&(struct soc_mixer_control) \ 57 {.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \ 58 .min = xmin, .max = xmax, .platform_max = xmax, .invert = xinvert}) 37 59 #define SOC_SINGLE(xname, reg, shift, max, invert) \ 38 60 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 39 61 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 40 62 .put = snd_soc_put_volsw, \ 41 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 63 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 64 #define SOC_SINGLE_RANGE(xname, xreg, xshift, xmin, xmax, xinvert) \ 65 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 66 .info = snd_soc_info_volsw_range, .get = snd_soc_get_volsw_range, \ 67 .put = snd_soc_put_volsw_range, \ 68 .private_value = (unsigned long)&(struct soc_mixer_control) \ 69 {.reg = xreg, .rreg = xreg, .shift = xshift, \ 70 .rshift = xshift, .min = xmin, .max = xmax, \ 71 .platform_max = xmax, .invert = xinvert} } 42 72 #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 43 73 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 47 77 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 48 78 .put = snd_soc_put_volsw, \ 49 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 50 #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \ 79 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert, 0) } 80 #define SOC_SINGLE_SX_TLV(xname, xreg, xshift, xmin, xmax, tlv_array) \ 81 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 82 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 83 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 84 .tlv.p = (tlv_array),\ 85 .info = snd_soc_info_volsw_sx, \ 86 .get = snd_soc_get_volsw_sx,\ 87 .put = snd_soc_put_volsw_sx, \ 88 .private_value = (unsigned long)&(struct soc_mixer_control) \ 89 {.reg = xreg, .rreg = xreg, \ 90 .shift = xshift, .rshift = xshift, \ 91 .max = xmax, .min = xmin} } 92 #define SOC_SINGLE_RANGE_TLV(xname, xreg, xshift, xmin, xmax, xinvert, tlv_array) \ 93 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 94 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 95 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 96 .tlv.p = (tlv_array), \ 97 .info = snd_soc_info_volsw_range, \ 98 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ 99 .private_value = (unsigned long)&(struct soc_mixer_control) \ 100 {.reg = xreg, .rreg = xreg, .shift = xshift, \ 101 .rshift = xshift, .min = xmin, .max = xmax, \ 102 .platform_max = xmax, .invert = xinvert} } 103 #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ 51 104 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 52 105 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 53 106 .put = snd_soc_put_volsw, \ 54 .private_value = (unsigned long)&(struct soc_mixer_control) \ 55 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 56 .max = xmax, .platform_max = xmax, .invert = xinvert} } 107 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ 108 max, invert, 0) } 109 #define SOC_DOUBLE_STS(xname, reg, shift_left, shift_right, max, invert) \ 110 { \ 111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 112 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 113 .access = SNDRV_CTL_ELEM_ACCESS_READ | \ 114 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 115 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ 116 max, invert, 0) } 57 117 #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ 58 118 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 59 .info = snd_soc_info_volsw_2r, \ 60 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 61 .private_value = (unsigned long)&(struct soc_mixer_control) \ 62 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 63 .max = xmax, .platform_max = xmax, .invert = xinvert} } 64 #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \ 119 .info = snd_soc_info_volsw, \ 120 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 121 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 122 xmax, xinvert) } 123 #define SOC_DOUBLE_R_RANGE(xname, reg_left, reg_right, xshift, xmin, \ 124 xmax, xinvert) \ 125 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 126 .info = snd_soc_info_volsw_range, \ 127 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ 128 .private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \ 129 xshift, xmin, xmax, xinvert) } 130 #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ 65 131 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 66 132 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ … … 69 135 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 70 136 .put = snd_soc_put_volsw, \ 71 .private_value = (unsigned long)&(struct soc_mixer_control) \ 72 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ 73 .max = xmax, .platform_max = xmax, .invert = xinvert} } 137 .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ 138 max, invert, 0) } 74 139 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 75 140 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ … … 77 142 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 78 143 .tlv.p = (tlv_array), \ 79 .info = snd_soc_info_volsw_2r, \ 80 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 144 .info = snd_soc_info_volsw, \ 145 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 146 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 147 xmax, xinvert) } 148 #define SOC_DOUBLE_R_RANGE_TLV(xname, reg_left, reg_right, xshift, xmin, \ 149 xmax, xinvert, tlv_array) \ 150 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 151 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 152 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 153 .tlv.p = (tlv_array), \ 154 .info = snd_soc_info_volsw_range, \ 155 .get = snd_soc_get_volsw_range, .put = snd_soc_put_volsw_range, \ 156 .private_value = SOC_DOUBLE_R_RANGE_VALUE(reg_left, reg_right, \ 157 xshift, xmin, xmax, xinvert) } 158 #define SOC_DOUBLE_R_SX_TLV(xname, xreg, xrreg, xshift, xmin, xmax, tlv_array) \ 159 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 160 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 161 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 162 .tlv.p = (tlv_array), \ 163 .info = snd_soc_info_volsw_sx, \ 164 .get = snd_soc_get_volsw_sx, \ 165 .put = snd_soc_put_volsw_sx, \ 81 166 .private_value = (unsigned long)&(struct soc_mixer_control) \ 82 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 83 .max = xmax, .platform_max = xmax, .invert = xinvert} } 167 {.reg = xreg, .rreg = xrreg, \ 168 .shift = xshift, .rshift = xshift, \ 169 .max = xmax, .min = xmin} } 170 #define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \ 171 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 172 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 173 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 174 .tlv.p = (tlv_array), \ 175 .info = snd_soc_info_volsw, \ 176 .get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \ 177 .private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \ 178 xmin, xmax, xsign_bit, xinvert) } 179 #define SOC_SINGLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 180 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 181 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 182 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 183 .tlv.p = (tlv_array), \ 184 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 185 .put = snd_soc_put_volsw, \ 186 .private_value = (unsigned long)&(struct soc_mixer_control) \ 187 {.reg = xreg, .rreg = xreg, \ 188 .min = xmin, .max = xmax, .platform_max = xmax, \ 189 .sign_bit = 7,} } 84 190 #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 85 191 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ … … 87 193 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 88 194 .tlv.p = (tlv_array), \ 89 .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ 90 .put = snd_soc_put_volsw_s8, \ 91 .private_value = (unsigned long)&(struct soc_mixer_control) \ 92 {.reg = xreg, .min = xmin, .max = xmax, \ 93 .platform_max = xmax} } 94 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 195 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 196 .put = snd_soc_put_volsw, \ 197 .private_value = SOC_DOUBLE_S_VALUE(xreg, 0, 8, xmin, xmax, 7, 0, 0) } 198 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \ 95 199 { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 96 .max = xmax, .texts = xtexts } 97 #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \ 98 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 99 #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 100 { .max = xmax, .texts = xtexts } 101 #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \ 200 .items = xitems, .texts = xtexts, \ 201 .mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0} 202 #define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \ 203 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts) 204 #define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \ 205 { .items = xitems, .texts = xtexts } 206 #define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \ 102 207 { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 103 .mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues} 104 #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \ 105 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues) 208 .mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues} 209 #define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ 210 SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xitems, xtexts, xvalues) 211 #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, xshift, xmask, xitems, xtexts, xvalues) \ 212 { .reg = xreg, .shift_l = xshift, .shift_r = xshift, \ 213 .mask = xmask, .items = xitems, .texts = xtexts, \ 214 .values = xvalues, .autodisable = 1} 215 #define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \ 216 SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts) 106 217 #define SOC_ENUM(xname, xenum) \ 107 218 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\ 108 219 .info = snd_soc_info_enum_double, \ 109 220 .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \ 110 .private_value = (unsigned long)&xenum }111 #define SOC_VALUE_ENUM(xname, xenum) \112 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\113 .info = snd_soc_info_enum_double, \114 .get = snd_soc_get_value_enum_double, \115 .put = snd_soc_put_value_enum_double, \116 221 .private_value = (unsigned long)&xenum } 117 222 #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\ … … 120 225 .info = snd_soc_info_volsw, \ 121 226 .get = xhandler_get, .put = xhandler_put, \ 122 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert ) }123 #define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, xmax, xinvert,\227 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) } 228 #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\ 124 229 xhandler_get, xhandler_put) \ 125 230 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 126 231 .info = snd_soc_info_volsw, \ 127 232 .get = xhandler_get, .put = xhandler_put, \ 128 .private_value = (unsigned long)&(struct soc_mixer_control) \ 129 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 130 .max = xmax, .platform_max = xmax, .invert = xinvert} } 233 .private_value = \ 234 SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert, 0) } 235 #define SOC_DOUBLE_R_EXT(xname, reg_left, reg_right, xshift, xmax, xinvert,\ 236 xhandler_get, xhandler_put) \ 237 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 238 .info = snd_soc_info_volsw, \ 239 .get = xhandler_get, .put = xhandler_put, \ 240 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 241 xmax, xinvert) } 131 242 #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 132 243 xhandler_get, xhandler_put, tlv_array) \ … … 137 248 .info = snd_soc_info_volsw, \ 138 249 .get = xhandler_get, .put = xhandler_put, \ 139 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } 250 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert, 0) } 251 #define SOC_SINGLE_RANGE_EXT_TLV(xname, xreg, xshift, xmin, xmax, xinvert, \ 252 xhandler_get, xhandler_put, tlv_array) \ 253 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 254 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ 255 SNDRV_CTL_ELEM_ACCESS_READWRITE,\ 256 .tlv.p = (tlv_array), \ 257 .info = snd_soc_info_volsw_range, \ 258 .get = xhandler_get, .put = xhandler_put, \ 259 .private_value = (unsigned long)&(struct soc_mixer_control) \ 260 {.reg = xreg, .rreg = xreg, .shift = xshift, \ 261 .rshift = xshift, .min = xmin, .max = xmax, \ 262 .platform_max = xmax, .invert = xinvert} } 140 263 #define SOC_DOUBLE_EXT_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert,\ 141 264 xhandler_get, xhandler_put, tlv_array) \ … … 146 269 .info = snd_soc_info_volsw, \ 147 270 .get = xhandler_get, .put = xhandler_put, \ 148 .private_value = (unsigned long)&(struct soc_mixer_control) \ 149 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 150 .max = xmax, .platform_max = xmax, .invert = xinvert} } 271 .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \ 272 xmax, xinvert, 0) } 151 273 #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ 152 274 xhandler_get, xhandler_put, tlv_array) \ … … 155 277 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 156 278 .tlv.p = (tlv_array), \ 157 .info = snd_soc_info_volsw _2r, \279 .info = snd_soc_info_volsw, \ 158 280 .get = xhandler_get, .put = xhandler_put, \ 159 .private_value = (unsigned long)&(struct soc_mixer_control) \ 160 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 161 .max = xmax, .platform_max = xmax, .invert = xinvert} } 281 .private_value = SOC_DOUBLE_R_VALUE(reg_left, reg_right, xshift, \ 282 xmax, xinvert) } 162 283 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 163 284 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 167 288 #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \ 168 289 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 169 .info = snd_soc_info_enum_ ext, \290 .info = snd_soc_info_enum_double, \ 170 291 .get = xhandler_get, .put = xhandler_put, \ 171 292 .private_value = (unsigned long)&xenum } 172 173 #define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\ 174 xmin, xmax, tlv_array) \ 293 #define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \ 294 SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) 295 296 #define SND_SOC_BYTES(xname, xbase, xregs) \ 297 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 298 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ 299 .put = snd_soc_bytes_put, .private_value = \ 300 ((unsigned long)&(struct soc_bytes) \ 301 {.base = xbase, .num_regs = xregs }) } 302 #define SND_SOC_BYTES_E(xname, xbase, xregs, xhandler_get, xhandler_put) \ 303 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 304 .info = snd_soc_bytes_info, .get = xhandler_get, \ 305 .put = xhandler_put, .private_value = \ 306 ((unsigned long)&(struct soc_bytes) \ 307 {.base = xbase, .num_regs = xregs }) } 308 309 #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \ 310 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 311 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ 312 .put = snd_soc_bytes_put, .private_value = \ 313 ((unsigned long)&(struct soc_bytes) \ 314 {.base = xbase, .num_regs = xregs, \ 315 .mask = xmask }) } 316 317 /* 318 * SND_SOC_BYTES_EXT is deprecated, please USE SND_SOC_BYTES_TLV instead 319 */ 320 #define SND_SOC_BYTES_EXT(xname, xcount, xhandler_get, xhandler_put) \ 321 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 322 .info = snd_soc_bytes_info_ext, \ 323 .get = xhandler_get, .put = xhandler_put, \ 324 .private_value = (unsigned long)&(struct soc_bytes_ext) \ 325 {.max = xcount} } 326 #define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \ 327 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 328 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ 329 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ 330 .tlv.c = (snd_soc_bytes_tlv_callback), \ 331 .info = snd_soc_bytes_info_ext, \ 332 .private_value = (unsigned long)&(struct soc_bytes_ext) \ 333 {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } 334 #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ 335 xmin, xmax, xinvert) \ 175 336 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 176 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 177 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 178 .tlv.p = (tlv_array), \ 179 .info = snd_soc_info_volsw_2r_sx, \ 180 .get = snd_soc_get_volsw_2r_sx, \ 181 .put = snd_soc_put_volsw_2r_sx, \ 182 .private_value = (unsigned long)&(struct soc_mixer_control) \ 183 {.reg = xreg_left, \ 184 .rreg = xreg_right, .shift = xshift, \ 185 .min = xmin, .max = xmax} } 186 337 .info = snd_soc_info_xr_sx, .get = snd_soc_get_xr_sx, \ 338 .put = snd_soc_put_xr_sx, \ 339 .private_value = (unsigned long)&(struct soc_mreg_control) \ 340 {.regbase = xregbase, .regcount = xregcount, .nbits = xnbits, \ 341 .invert = xinvert, .min = xmin, .max = xmax} } 342 343 #define SOC_SINGLE_STROBE(xname, xreg, xshift, xinvert) \ 344 SOC_SINGLE_EXT(xname, xreg, xshift, 1, xinvert, \ 345 snd_soc_get_strobe, snd_soc_put_strobe) 187 346 188 347 /* … … 191 350 */ 192 351 #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ 193 struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \352 const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ 194 353 ARRAY_SIZE(xtexts), xtexts) 195 354 #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ 196 355 SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) 197 356 #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \ 198 struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)357 const struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts) 199 358 #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \ 200 struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \359 const struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \ 201 360 ARRAY_SIZE(xtexts), xtexts, xvalues) 202 361 #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ 203 362 SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) 204 363 205 /* 206 * Bias levels 207 * 208 * @ON: Bias is fully on for audio playback and capture operations. 209 * @PREPARE: Prepare for audio operations. Called before DAPM switching for 210 * stream start and stop operations. 211 * @STANDBY: Low power standby state when no playback/capture operations are 212 * in progress. NOTE: The transition time between STANDBY and ON 213 * should be as fast as possible and no longer than 10ms. 214 * @OFF: Power Off. No restrictions on transition times. 215 */ 216 enum snd_soc_bias_level { 217 SND_SOC_BIAS_OFF, 218 SND_SOC_BIAS_STANDBY, 219 SND_SOC_BIAS_PREPARE, 220 SND_SOC_BIAS_ON, 221 }; 222 364 #define SOC_VALUE_ENUM_SINGLE_AUTODISABLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ 365 const struct soc_enum name = SOC_VALUE_ENUM_SINGLE_AUTODISABLE(xreg, \ 366 xshift, xmask, ARRAY_SIZE(xtexts), xtexts, xvalues) 367 368 #define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \ 369 const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts) 370 371 struct device_node; 223 372 struct snd_jack; 224 373 struct snd_soc_card; … … 228 377 struct snd_soc_dai; 229 378 struct snd_soc_dai_driver; 230 struct snd_soc_platform;231 379 struct snd_soc_dai_link; 232 struct snd_soc_platform_driver; 233 struct snd_soc_codec; 234 struct snd_soc_codec_driver; 380 struct snd_soc_component; 381 struct snd_soc_component_driver; 235 382 struct soc_enum; 236 383 struct snd_soc_jack; 384 struct snd_soc_jack_zone; 237 385 struct snd_soc_jack_pin; 238 struct snd_soc_cache_ops;239 386 #include <sound/soc-dapm.h> 240 241 #ifdef CONFIG_GPIOLIB 387 #include <sound/soc-dpcm.h> 388 #include <sound/soc-topology.h> 389 242 390 struct snd_soc_jack_gpio; 243 #endif244 391 245 392 typedef int (*hw_write_t)(void *,const char* ,int); 246 393 247 extern struct snd_ac97_bus_ops soc_ac97_ops; 248 249 enum snd_soc_control_type { 250 SND_SOC_CUSTOM, 251 SND_SOC_I2C, 252 SND_SOC_SPI, 253 }; 254 255 enum snd_soc_compress_type { 256 SND_SOC_FLAT_COMPRESSION = 1, 257 SND_SOC_LZO_COMPRESSION, 258 SND_SOC_RBTREE_COMPRESSION 394 enum snd_soc_pcm_subclass { 395 SND_SOC_PCM_CLASS_PCM = 0, 396 SND_SOC_PCM_CLASS_BE = 1, 259 397 }; 260 398 261 399 int snd_soc_register_card(struct snd_soc_card *card); 262 400 int snd_soc_unregister_card(struct snd_soc_card *card); 263 int snd_soc_register_platform(struct device *dev, 264 struct snd_soc_platform_driver *platform_drv); 265 void snd_soc_unregister_platform(struct device *dev); 266 int snd_soc_register_codec(struct device *dev, 267 const struct snd_soc_codec_driver *codec_drv, 268 struct snd_soc_dai_driver *dai_drv, int num_dai); 269 void snd_soc_unregister_codec(struct device *dev); 270 int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); 271 int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 272 int addr_bits, int data_bits, 273 enum snd_soc_control_type control); 274 int snd_soc_cache_sync(struct snd_soc_codec *codec); 275 int snd_soc_cache_init(struct snd_soc_codec *codec); 276 int snd_soc_cache_exit(struct snd_soc_codec *codec); 277 int snd_soc_cache_write(struct snd_soc_codec *codec, 278 unsigned int reg, unsigned int value); 279 int snd_soc_cache_read(struct snd_soc_codec *codec, 280 unsigned int reg, unsigned int *value); 281 int snd_soc_default_volatile_register(struct snd_soc_codec *codec, 282 unsigned int reg); 283 int snd_soc_default_readable_register(struct snd_soc_codec *codec, 284 unsigned int reg); 401 int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card); 402 #ifdef CONFIG_PM_SLEEP 403 int snd_soc_suspend(struct device *dev); 404 int snd_soc_resume(struct device *dev); 405 #else 406 static inline int snd_soc_suspend(struct device *dev) 407 { 408 return 0; 409 } 410 411 static inline int snd_soc_resume(struct device *dev) 412 { 413 return 0; 414 } 415 #endif 416 int snd_soc_poweroff(struct device *dev); 417 int snd_soc_component_initialize(struct snd_soc_component *component, 418 const struct snd_soc_component_driver *driver, 419 struct device *dev); 420 int snd_soc_add_component(struct snd_soc_component *component, 421 struct snd_soc_dai_driver *dai_drv, 422 int num_dai); 423 int snd_soc_register_component(struct device *dev, 424 const struct snd_soc_component_driver *component_driver, 425 struct snd_soc_dai_driver *dai_drv, int num_dai); 426 int devm_snd_soc_register_component(struct device *dev, 427 const struct snd_soc_component_driver *component_driver, 428 struct snd_soc_dai_driver *dai_drv, int num_dai); 429 void snd_soc_unregister_component(struct device *dev); 430 void snd_soc_unregister_component_by_driver(struct device *dev, 431 const struct snd_soc_component_driver *component_driver); 432 struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev, 433 const char *driver_name); 434 struct snd_soc_component *snd_soc_lookup_component(struct device *dev, 435 const char *driver_name); 436 437 int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); 438 #ifdef CONFIG_SND_SOC_COMPRESS 439 int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num); 440 #else 441 static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) 442 { 443 return 0; 444 } 445 #endif 446 447 void snd_soc_disconnect_sync(struct device *dev); 448 449 struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, 450 struct snd_soc_dai_link *dai_link); 451 452 bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd); 453 454 void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd, 455 int stream, int action); 456 static inline void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, 457 int stream) 458 { 459 snd_soc_runtime_action(rtd, stream, 1); 460 } 461 static inline void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, 462 int stream) 463 { 464 snd_soc_runtime_action(rtd, stream, -1); 465 } 466 467 int snd_soc_runtime_calc_hw(struct snd_soc_pcm_runtime *rtd, 468 struct snd_pcm_hardware *hw, int stream); 469 470 int snd_soc_runtime_set_dai_fmt(struct snd_soc_pcm_runtime *rtd, 471 unsigned int dai_fmt); 472 473 #ifdef CONFIG_DMI 474 int snd_soc_set_dmi_name(struct snd_soc_card *card, const char *flavour); 475 #else 476 static inline int snd_soc_set_dmi_name(struct snd_soc_card *card, 477 const char *flavour) 478 { 479 return 0; 480 } 481 #endif 285 482 286 483 /* Utility functions to get clock rates from various things */ … … 295 492 296 493 /* Jack reporting */ 297 int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,298 struct snd_soc_jack *jack);299 494 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 300 495 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, … … 304 499 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, 305 500 struct notifier_block *nb); 501 int snd_soc_jack_add_zones(struct snd_soc_jack *jack, int count, 502 struct snd_soc_jack_zone *zones); 503 int snd_soc_jack_get_type(struct snd_soc_jack *jack, int micbias_voltage); 306 504 #ifdef CONFIG_GPIOLIB 307 505 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 308 506 struct snd_soc_jack_gpio *gpios); 507 int snd_soc_jack_add_gpiods(struct device *gpiod_dev, 508 struct snd_soc_jack *jack, 509 int count, struct snd_soc_jack_gpio *gpios); 309 510 void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, 310 511 struct snd_soc_jack_gpio *gpios); 512 #else 513 static inline int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, 514 struct snd_soc_jack_gpio *gpios) 515 { 516 return 0; 517 } 518 519 static inline int snd_soc_jack_add_gpiods(struct device *gpiod_dev, 520 struct snd_soc_jack *jack, 521 int count, 522 struct snd_soc_jack_gpio *gpios) 523 { 524 return 0; 525 } 526 527 static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count, 528 struct snd_soc_jack_gpio *gpios) 529 { 530 } 311 531 #endif 312 532 313 /* codec register bit access */ 314 int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 315 unsigned int mask, unsigned int value); 316 int snd_soc_update_bits_locked(struct snd_soc_codec *codec, 317 unsigned short reg, unsigned int mask, 318 unsigned int value); 319 int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 320 unsigned int mask, unsigned int value); 321 322 int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 323 struct snd_ac97_bus_ops *ops, int num); 324 void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 533 struct snd_ac97 *snd_soc_alloc_ac97_component(struct snd_soc_component *component); 534 struct snd_ac97 *snd_soc_new_ac97_component(struct snd_soc_component *component, 535 unsigned int id, unsigned int id_mask); 536 void snd_soc_free_ac97_component(struct snd_ac97 *ac97); 537 538 #ifdef CONFIG_SND_SOC_AC97_BUS 539 int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops); 540 int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, 541 struct platform_device *pdev); 542 543 extern struct snd_ac97_bus_ops *soc_ac97_ops; 544 #else 545 static inline int snd_soc_set_ac97_ops_of_reset(struct snd_ac97_bus_ops *ops, 546 struct platform_device *pdev) 547 { 548 return 0; 549 } 550 551 static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops) 552 { 553 return 0; 554 } 555 #endif 325 556 326 557 /* … … 328 559 */ 329 560 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 330 void *data, char *long_name); 331 int snd_soc_add_controls(struct snd_soc_codec *codec, 561 void *data, const char *long_name, 562 const char *prefix); 563 int snd_soc_add_component_controls(struct snd_soc_component *component, 564 const struct snd_kcontrol_new *controls, unsigned int num_controls); 565 int snd_soc_add_card_controls(struct snd_soc_card *soc_card, 566 const struct snd_kcontrol_new *controls, int num_controls); 567 int snd_soc_add_dai_controls(struct snd_soc_dai *dai, 332 568 const struct snd_kcontrol_new *controls, int num_controls); 333 569 int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 334 struct snd_ctl_elem_info *uinfo);335 int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,336 570 struct snd_ctl_elem_info *uinfo); 337 571 int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, … … 339 573 int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, 340 574 struct snd_ctl_elem_value *ucontrol); 341 int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,342 struct snd_ctl_elem_value *ucontrol);343 int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,344 struct snd_ctl_elem_value *ucontrol);345 575 int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, 346 576 struct snd_ctl_elem_info *uinfo); 347 int snd_soc_info_volsw_ ext(struct snd_kcontrol *kcontrol,348 struct snd_ctl_elem_info *uinfo);577 int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol, 578 struct snd_ctl_elem_info *uinfo); 349 579 #define snd_soc_info_bool_ext snd_ctl_boolean_mono_info 350 580 int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, … … 352 582 int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, 353 583 struct snd_ctl_elem_value *ucontrol); 354 int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol, 584 #define snd_soc_get_volsw_2r snd_soc_get_volsw 585 #define snd_soc_put_volsw_2r snd_soc_put_volsw 586 int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol, 587 struct snd_ctl_elem_value *ucontrol); 588 int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, 589 struct snd_ctl_elem_value *ucontrol); 590 int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol, 355 591 struct snd_ctl_elem_info *uinfo); 356 int snd_soc_ get_volsw_2r(struct snd_kcontrol *kcontrol,592 int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, 357 593 struct snd_ctl_elem_value *ucontrol); 358 int snd_soc_ put_volsw_2r(struct snd_kcontrol *kcontrol,594 int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, 359 595 struct snd_ctl_elem_value *ucontrol); 360 int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol, 596 int snd_soc_limit_volume(struct snd_soc_card *card, 597 const char *name, int max); 598 int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, 599 struct snd_ctl_elem_info *uinfo); 600 int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, 601 struct snd_ctl_elem_value *ucontrol); 602 int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, 603 struct snd_ctl_elem_value *ucontrol); 604 int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, 605 struct snd_ctl_elem_info *ucontrol); 606 int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, 607 unsigned int size, unsigned int __user *tlv); 608 int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, 361 609 struct snd_ctl_elem_info *uinfo); 362 int snd_soc_get_ volsw_s8(struct snd_kcontrol *kcontrol,610 int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, 363 611 struct snd_ctl_elem_value *ucontrol); 364 int snd_soc_put_ volsw_s8(struct snd_kcontrol *kcontrol,612 int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, 365 613 struct snd_ctl_elem_value *ucontrol); 366 int snd_soc_limit_volume(struct snd_soc_codec *codec, 367 const char *name, int max); 368 int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol, 369 struct snd_ctl_elem_info *uinfo); 370 int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol, 614 int snd_soc_get_strobe(struct snd_kcontrol *kcontrol, 371 615 struct snd_ctl_elem_value *ucontrol); 372 int snd_soc_put_ volsw_2r_sx(struct snd_kcontrol *kcontrol,616 int snd_soc_put_strobe(struct snd_kcontrol *kcontrol, 373 617 struct snd_ctl_elem_value *ucontrol); 374 375 /**376 * struct snd_soc_reg_access - Describes whether a given register is377 * readable, writable or volatile.378 *379 * @reg: the register number380 * @read: whether this register is readable381 * @write: whether this register is writable382 * @vol: whether this register is volatile383 */384 struct snd_soc_reg_access {385 u16 reg;386 u16 read;387 u16 write;388 u16 vol;389 };390 618 391 619 /** … … 395 623 * @mask: bits to check for in reported jack status 396 624 * @invert: if non-zero then pin is enabled when status is not reported 625 * @list: internal list entry 397 626 */ 398 627 struct snd_soc_jack_pin { … … 404 633 405 634 /** 635 * struct snd_soc_jack_zone - Describes voltage zones of jack detection 636 * 637 * @min_mv: start voltage in mv 638 * @max_mv: end voltage in mv 639 * @jack_type: type of jack that is expected for this voltage 640 * @debounce_time: debounce_time for jack, codec driver should wait for this 641 * duration before reading the adc for voltages 642 * @list: internal list entry 643 */ 644 struct snd_soc_jack_zone { 645 unsigned int min_mv; 646 unsigned int max_mv; 647 unsigned int jack_type; 648 unsigned int debounce_time; 649 struct list_head list; 650 }; 651 652 /** 406 653 * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection 407 654 * 408 * @gpio: gpio number 409 * @name: gpio name 655 * @gpio: legacy gpio number 656 * @idx: gpio descriptor index within the function of the GPIO 657 * consumer device 658 * @gpiod_dev: GPIO consumer device 659 * @name: gpio name. Also as connection ID for the GPIO consumer 660 * device function name lookup 410 661 * @report: value to report when jack detected 411 662 * @invert: report presence in low state 412 * @debouce_time: debouce time in ms 663 * @debounce_time: debounce time in ms 664 * @wake: enable as wake source 665 * @jack_status_check: callback function which overrides the detection 666 * to provide more complex checks (eg, reading an 667 * ADC). 413 668 */ 414 #ifdef CONFIG_GPIOLIB415 669 struct snd_soc_jack_gpio { 416 670 unsigned int gpio; 671 unsigned int idx; 672 struct device *gpiod_dev; 417 673 const char *name; 418 674 int report; 419 675 int invert; 420 676 int debounce_time; 677 bool wake; 678 679 /* private: */ 421 680 struct snd_soc_jack *jack; 422 681 struct delayed_work work; 423 424 int (*jack_status_check)(void); 425 }; 426 #endif 682 struct notifier_block pm_notifier; 683 struct gpio_desc *desc; 684 685 void *data; 686 /* public: */ 687 int (*jack_status_check)(void *data); 688 }; 427 689 428 690 struct snd_soc_jack { 691 struct mutex mutex; 429 692 struct snd_jack *jack; 430 struct snd_soc_c odec *codec;693 struct snd_soc_card *card; 431 694 struct list_head pins; 432 695 int status; 433 696 struct blocking_notifier_head notifier; 697 struct list_head jack_zones; 434 698 }; 435 699 … … 443 707 unsigned int channels_min; /* min channels */ 444 708 unsigned int channels_max; /* max channels */ 709 unsigned int sig_bits; /* number of bits of content */ 445 710 }; 446 711 … … 455 720 }; 456 721 457 /* SoC cache ops */ 458 struct snd_soc_cache_ops { 722 struct snd_soc_compr_ops { 723 int (*startup)(struct snd_compr_stream *); 724 void (*shutdown)(struct snd_compr_stream *); 725 int (*set_params)(struct snd_compr_stream *); 726 int (*trigger)(struct snd_compr_stream *); 727 }; 728 729 struct snd_soc_component* 730 snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd, 731 const char *driver_name); 732 733 struct snd_soc_dai_link_component { 459 734 const char *name; 460 enum snd_soc_compress_type id; 461 int (*init)(struct snd_soc_codec *codec); 462 int (*exit)(struct snd_soc_codec *codec); 463 int (*read)(struct snd_soc_codec *codec, unsigned int reg, 464 unsigned int *value); 465 int (*write)(struct snd_soc_codec *codec, unsigned int reg, 466 unsigned int value); 467 int (*sync)(struct snd_soc_codec *codec); 468 }; 469 470 /* SoC Audio Codec device */ 471 struct snd_soc_codec { 472 const char *name; 473 const char *name_prefix; 474 int id; 475 struct device *dev; 476 const struct snd_soc_codec_driver *driver; 477 478 struct mutex mutex; 479 struct snd_soc_card *card; 480 struct list_head list; 481 struct list_head card_list; 482 int num_dai; 483 enum snd_soc_compress_type compress_type; 484 size_t reg_size; /* reg_cache_size * reg_word_size */ 485 int (*volatile_register)(struct snd_soc_codec *, unsigned int); 486 int (*readable_register)(struct snd_soc_codec *, unsigned int); 487 488 /* runtime */ 489 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 490 unsigned int active; 491 unsigned int cache_only:1; /* Suppress writes to hardware */ 492 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */ 493 unsigned int suspended:1; /* Codec is in suspend PM state */ 494 unsigned int probed:1; /* Codec has been probed */ 495 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 496 unsigned int ac97_created:1; /* Codec has been created by SoC */ 497 unsigned int sysfs_registered:1; /* codec has been sysfs registered */ 498 unsigned int cache_init:1; /* codec cache has been initialized */ 499 500 /* codec IO */ 501 void *control_data; /* codec control (i2c/3wire) data */ 502 hw_write_t hw_write; 503 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 504 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 505 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 506 void *reg_cache; 507 const void *reg_def_copy; 508 const struct snd_soc_cache_ops *cache_ops; 509 struct mutex cache_rw_mutex; 510 511 /* dapm */ 512 struct snd_soc_dapm_context dapm; 513 514 #ifdef CONFIG_DEBUG_FS 515 struct dentry *debugfs_codec_root; 516 struct dentry *debugfs_reg; 517 struct dentry *debugfs_dapm; 518 #endif 519 }; 520 521 /* codec driver */ 522 struct snd_soc_codec_driver { 523 524 /* driver ops */ 525 int (*probe)(struct snd_soc_codec *); 526 int (*remove)(struct snd_soc_codec *); 527 int (*suspend)(struct snd_soc_codec *, 528 pm_message_t state); 529 int (*resume)(struct snd_soc_codec *); 530 531 /* codec IO */ 532 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 533 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 534 int (*display_register)(struct snd_soc_codec *, char *, 535 size_t, unsigned int); 536 int (*volatile_register)(struct snd_soc_codec *, unsigned int); 537 int (*readable_register)(struct snd_soc_codec *, unsigned int); 538 short reg_cache_size; 539 short reg_cache_step; 540 short reg_word_size; 541 const void *reg_cache_default; 542 short reg_access_size; 543 const struct snd_soc_reg_access *reg_access_default; 544 enum snd_soc_compress_type compress_type; 545 546 /* codec bias level */ 547 int (*set_bias_level)(struct snd_soc_codec *, 548 enum snd_soc_bias_level level); 549 }; 550 551 /* SoC platform interface */ 552 struct snd_soc_platform_driver { 553 554 int (*probe)(struct snd_soc_platform *); 555 int (*remove)(struct snd_soc_platform *); 556 int (*suspend)(struct snd_soc_dai *dai); 557 int (*resume)(struct snd_soc_dai *dai); 558 559 /* pcm creation and destruction */ 560 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 561 struct snd_pcm *); 562 void (*pcm_free)(struct snd_pcm *); 563 564 /* 565 * For platform caused delay reporting. 566 * Optional. 567 */ 568 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, 569 struct snd_soc_dai *); 570 571 /* platform stream ops */ 572 struct snd_pcm_ops *ops; 573 }; 574 575 struct snd_soc_platform { 576 const char *name; 577 int id; 578 struct device *dev; 579 struct snd_soc_platform_driver *driver; 580 581 unsigned int suspended:1; /* platform is suspended */ 582 unsigned int probed:1; 583 584 struct snd_soc_card *card; 585 struct list_head list; 586 struct list_head card_list; 735 struct device_node *of_node; 736 const char *dai_name; 587 737 }; 588 738 … … 591 741 const char *name; /* Codec name */ 592 742 const char *stream_name; /* Stream name */ 593 const char *codec_name; /* for multi-codec */ 594 const char *platform_name; /* for multi-platform */ 595 const char *cpu_dai_name; 596 const char *codec_dai_name; 743 744 /* 745 * You MAY specify the link's CPU-side device, either by device name, 746 * or by DT/OF node, but not both. If this information is omitted, 747 * the CPU-side DAI is matched using .cpu_dai_name only, which hence 748 * must be globally unique. These fields are currently typically used 749 * only for codec to codec links, or systems using device tree. 750 */ 751 /* 752 * You MAY specify the DAI name of the CPU DAI. If this information is 753 * omitted, the CPU-side DAI is matched using .cpu_name/.cpu_of_node 754 * only, which only works well when that device exposes a single DAI. 755 */ 756 struct snd_soc_dai_link_component *cpus; 757 unsigned int num_cpus; 758 759 /* 760 * You MUST specify the link's codec, either by device name, or by 761 * DT/OF node, but not both. 762 */ 763 /* You MUST specify the DAI name within the codec */ 764 struct snd_soc_dai_link_component *codecs; 765 unsigned int num_codecs; 766 767 /* 768 * You MAY specify the link's platform/PCM/DMA driver, either by 769 * device name, or by DT/OF node, but not both. Some forms of link 770 * do not need a platform. In such case, platforms are not mandatory. 771 */ 772 struct snd_soc_dai_link_component *platforms; 773 unsigned int num_platforms; 774 775 int id; /* optional ID for machine driver link identification */ 776 777 const struct snd_soc_pcm_stream *params; 778 unsigned int num_params; 779 780 unsigned int dai_fmt; /* format to set on init */ 781 782 enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */ 783 784 /* codec/machine specific init - e.g. add machine controls */ 785 int (*init)(struct snd_soc_pcm_runtime *rtd); 786 787 /* codec/machine specific exit - dual of init() */ 788 void (*exit)(struct snd_soc_pcm_runtime *rtd); 789 790 /* optional hw_params re-writing for BE and FE sync */ 791 int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd, 792 struct snd_pcm_hw_params *params); 793 794 /* machine stream operations */ 795 const struct snd_soc_ops *ops; 796 const struct snd_soc_compr_ops *compr_ops; 797 798 /* Mark this pcm with non atomic ops */ 799 unsigned int nonatomic:1; 800 801 /* For unidirectional dai links */ 802 unsigned int playback_only:1; 803 unsigned int capture_only:1; 597 804 598 805 /* Keep DAI active over suspend */ … … 601 808 /* Symmetry requirements */ 602 809 unsigned int symmetric_rates:1; 603 604 /* codec/machine specific init - e.g. add machine controls */ 605 int (*init)(struct snd_soc_pcm_runtime *rtd); 606 607 /* machine stream operations */ 608 struct snd_soc_ops *ops; 609 }; 810 unsigned int symmetric_channels:1; 811 unsigned int symmetric_samplebits:1; 812 813 /* Do not create a PCM for this DAI link (Backend link) */ 814 unsigned int no_pcm:1; 815 816 /* This DAI link can route to other DAI links at runtime (Frontend)*/ 817 unsigned int dynamic:1; 818 819 /* DPCM capture and Playback support */ 820 unsigned int dpcm_capture:1; 821 unsigned int dpcm_playback:1; 822 823 /* DPCM used FE & BE merged format */ 824 unsigned int dpcm_merged_format:1; 825 /* DPCM used FE & BE merged channel */ 826 unsigned int dpcm_merged_chan:1; 827 /* DPCM used FE & BE merged rate */ 828 unsigned int dpcm_merged_rate:1; 829 830 /* pmdown_time is ignored at stop */ 831 unsigned int ignore_pmdown_time:1; 832 833 /* Do not create a PCM for this DAI link (Backend link) */ 834 unsigned int ignore:1; 835 836 #ifdef CONFIG_SND_SOC_TOPOLOGY 837 struct snd_soc_dobj dobj; /* For topology */ 838 #endif 839 }; 840 #define for_each_link_codecs(link, i, codec) \ 841 for ((i) = 0; \ 842 ((i) < link->num_codecs) && ((codec) = &link->codecs[i]); \ 843 (i)++) 844 845 #define for_each_link_platforms(link, i, platform) \ 846 for ((i) = 0; \ 847 ((i) < link->num_platforms) && \ 848 ((platform) = &link->platforms[i]); \ 849 (i)++) 850 851 #define for_each_link_cpus(link, i, cpu) \ 852 for ((i) = 0; \ 853 ((i) < link->num_cpus) && ((cpu) = &link->cpus[i]); \ 854 (i)++) 855 856 /* 857 * Sample 1 : Single CPU/Codec/Platform 858 * 859 * SND_SOC_DAILINK_DEFS(test, 860 * DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai")), 861 * DAILINK_COMP_ARRAY(COMP_CODEC("codec", "codec_dai")), 862 * DAILINK_COMP_ARRAY(COMP_PLATFORM("platform"))); 863 * 864 * struct snd_soc_dai_link link = { 865 * ... 866 * SND_SOC_DAILINK_REG(test), 867 * }; 868 * 869 * Sample 2 : Multi CPU/Codec, no Platform 870 * 871 * SND_SOC_DAILINK_DEFS(test, 872 * DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai1"), 873 * COMP_CPU("cpu_dai2")), 874 * DAILINK_COMP_ARRAY(COMP_CODEC("codec1", "codec_dai1"), 875 * COMP_CODEC("codec2", "codec_dai2"))); 876 * 877 * struct snd_soc_dai_link link = { 878 * ... 879 * SND_SOC_DAILINK_REG(test), 880 * }; 881 * 882 * Sample 3 : Define each CPU/Codec/Platform manually 883 * 884 * SND_SOC_DAILINK_DEF(test_cpu, 885 * DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai1"), 886 * COMP_CPU("cpu_dai2"))); 887 * SND_SOC_DAILINK_DEF(test_codec, 888 * DAILINK_COMP_ARRAY(COMP_CODEC("codec1", "codec_dai1"), 889 * COMP_CODEC("codec2", "codec_dai2"))); 890 * SND_SOC_DAILINK_DEF(test_platform, 891 * DAILINK_COMP_ARRAY(COMP_PLATFORM("platform"))); 892 * 893 * struct snd_soc_dai_link link = { 894 * ... 895 * SND_SOC_DAILINK_REG(test_cpu, 896 * test_codec, 897 * test_platform), 898 * }; 899 * 900 * Sample 4 : Sample3 without platform 901 * 902 * struct snd_soc_dai_link link = { 903 * ... 904 * SND_SOC_DAILINK_REG(test_cpu, 905 * test_codec); 906 * }; 907 */ 908 909 #define SND_SOC_DAILINK_REG1(name) SND_SOC_DAILINK_REG3(name##_cpus, name##_codecs, name##_platforms) 910 #define SND_SOC_DAILINK_REG2(cpu, codec) SND_SOC_DAILINK_REG3(cpu, codec, null_dailink_component) 911 #define SND_SOC_DAILINK_REG3(cpu, codec, platform) \ 912 .cpus = cpu, \ 913 .num_cpus = ARRAY_SIZE(cpu), \ 914 .codecs = codec, \ 915 .num_codecs = ARRAY_SIZE(codec), \ 916 .platforms = platform, \ 917 .num_platforms = ARRAY_SIZE(platform) 918 919 #define SND_SOC_DAILINK_REGx(_1, _2, _3, func, ...) func 920 #define SND_SOC_DAILINK_REG(...) \ 921 SND_SOC_DAILINK_REGx(__VA_ARGS__, \ 922 SND_SOC_DAILINK_REG3, \ 923 SND_SOC_DAILINK_REG2, \ 924 SND_SOC_DAILINK_REG1)(__VA_ARGS__) 925 926 #define SND_SOC_DAILINK_DEF(name, def...) \ 927 static struct snd_soc_dai_link_component name[] = { def } 928 929 #define SND_SOC_DAILINK_DEFS(name, cpu, codec, platform...) \ 930 SND_SOC_DAILINK_DEF(name##_cpus, cpu); \ 931 SND_SOC_DAILINK_DEF(name##_codecs, codec); \ 932 SND_SOC_DAILINK_DEF(name##_platforms, platform) 933 934 #define DAILINK_COMP_ARRAY(param...) param 935 #define COMP_EMPTY() { } 936 #define COMP_CPU(_dai) { .dai_name = _dai, } 937 #define COMP_CODEC(_name, _dai) { .name = _name, .dai_name = _dai, } 938 #define COMP_PLATFORM(_name) { .name = _name } 939 #define COMP_AUX(_name) { .name = _name } 940 #define COMP_CODEC_CONF(_name) { .name = _name } 941 #define COMP_DUMMY() { .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", } 942 943 extern struct snd_soc_dai_link_component null_dailink_component[0]; 944 610 945 611 946 struct snd_soc_codec_conf { 612 const char *dev_name; 947 /* 948 * specify device either by device name, or by 949 * DT/OF node, but not both. 950 */ 951 struct snd_soc_dai_link_component dlc; 613 952 614 953 /* … … 617 956 */ 618 957 const char *name_prefix; 619 958 }; 959 960 struct snd_soc_aux_dev { 620 961 /* 621 * s et this to the desired compression type if you want to622 * override the one supplied in codec->driver->compress_type962 * specify multi-codec either by device name, or by 963 * DT/OF node, but not both. 623 964 */ 624 enum snd_soc_compress_type compress_type; 625 }; 626 627 struct snd_soc_aux_dev { 628 const char *name; /* Codec name */ 629 const char *codec_name; /* for multi-codec */ 965 struct snd_soc_dai_link_component dlc; 630 966 631 967 /* codec/machine specific init - e.g. add machine controls */ 632 int (*init)(struct snd_soc_ dapm_context *dapm);968 int (*init)(struct snd_soc_component *component); 633 969 }; 634 970 … … 636 972 struct snd_soc_card { 637 973 const char *name; 974 const char *long_name; 975 const char *driver_name; 976 const char *components; 977 #ifdef CONFIG_DMI 978 char dmi_longname[80]; 979 #endif /* CONFIG_DMI */ 980 char topology_shortname[32]; 981 638 982 struct device *dev; 639 983 struct snd_card *snd_card; 640 984 struct module *owner; 641 985 642 struct list_head list;643 986 struct mutex mutex; 644 645 bool instantiated; 646 647 int (*probe)(struct platform_device *pdev); 648 int (*remove)(struct platform_device *pdev); 987 struct mutex dapm_mutex; 988 989 /* Mutex for PCM operations */ 990 struct mutex pcm_mutex; 991 enum snd_soc_pcm_subclass pcm_subclass; 992 993 spinlock_t dpcm_lock; 994 995 int (*probe)(struct snd_soc_card *card); 996 int (*late_probe)(struct snd_soc_card *card); 997 int (*remove)(struct snd_soc_card *card); 649 998 650 999 /* the pre and post PM functions are used to do any PM work before and 651 1000 * after the codec and DAI's do any PM work. */ 652 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);653 int (*suspend_post)(struct platform_device *pdev, pm_message_t state);654 int (*resume_pre)(struct platform_device *pdev);655 int (*resume_post)(struct platform_device *pdev);1001 int (*suspend_pre)(struct snd_soc_card *card); 1002 int (*suspend_post)(struct snd_soc_card *card); 1003 int (*resume_pre)(struct snd_soc_card *card); 1004 int (*resume_post)(struct snd_soc_card *card); 656 1005 657 1006 /* callbacks */ 658 1007 int (*set_bias_level)(struct snd_soc_card *, 1008 struct snd_soc_dapm_context *dapm, 659 1009 enum snd_soc_bias_level level); 660 1010 int (*set_bias_level_post)(struct snd_soc_card *, 1011 struct snd_soc_dapm_context *dapm, 661 1012 enum snd_soc_bias_level level); 662 1013 1014 int (*add_dai_link)(struct snd_soc_card *, 1015 struct snd_soc_dai_link *link); 1016 void (*remove_dai_link)(struct snd_soc_card *, 1017 struct snd_soc_dai_link *link); 1018 663 1019 long pmdown_time; 664 1020 665 1021 /* CPU <--> Codec DAI links */ 666 struct snd_soc_dai_link *dai_link; 667 int num_links; 668 struct snd_soc_pcm_runtime *rtd; 1022 struct snd_soc_dai_link *dai_link; /* predefined links only */ 1023 int num_links; /* predefined links only */ 1024 1025 struct list_head rtd_list; 669 1026 int num_rtd; 670 1027 … … 679 1036 struct snd_soc_aux_dev *aux_dev; 680 1037 int num_aux_devs; 681 struct snd_soc_pcm_runtime *rtd_aux; 682 int num_aux_rtd; 683 684 struct work_struct deferred_resume_work; 1038 struct list_head aux_comp_list; 1039 1040 const struct snd_kcontrol_new *controls; 1041 int num_controls; 1042 1043 /* 1044 * Card-specific routes and widgets. 1045 * Note: of_dapm_xxx for Device Tree; Otherwise for driver build-in. 1046 */ 1047 const struct snd_soc_dapm_widget *dapm_widgets; 1048 int num_dapm_widgets; 1049 const struct snd_soc_dapm_route *dapm_routes; 1050 int num_dapm_routes; 1051 const struct snd_soc_dapm_widget *of_dapm_widgets; 1052 int num_of_dapm_widgets; 1053 const struct snd_soc_dapm_route *of_dapm_routes; 1054 int num_of_dapm_routes; 685 1055 686 1056 /* lists of probed devices belonging to this card */ 687 struct list_head codec_dev_list; 688 struct list_head platform_dev_list; 689 struct list_head dai_dev_list; 1057 struct list_head component_dev_list; 1058 struct list_head list; 690 1059 691 1060 struct list_head widgets; 692 1061 struct list_head paths; 693 1062 struct list_head dapm_list; 1063 struct list_head dapm_dirty; 1064 1065 /* attached dynamic objects */ 1066 struct list_head dobj_list; 1067 1068 /* Generic DAPM context for the card */ 1069 struct snd_soc_dapm_context dapm; 1070 struct snd_soc_dapm_stats dapm_stats; 1071 struct snd_soc_dapm_update *update; 694 1072 695 1073 #ifdef CONFIG_DEBUG_FS 696 1074 struct dentry *debugfs_card_root; 697 struct dentry *debugfs_pop_time; 1075 #endif 1076 #ifdef CONFIG_PM_SLEEP 1077 struct work_struct deferred_resume_work; 698 1078 #endif 699 1079 u32 pop_time; 700 }; 1080 1081 /* bit field */ 1082 unsigned int instantiated:1; 1083 unsigned int topology_shortname_created:1; 1084 unsigned int fully_routed:1; 1085 unsigned int disable_route_checks:1; 1086 unsigned int probed:1; 1087 1088 void *drvdata; 1089 }; 1090 #define for_each_card_prelinks(card, i, link) \ 1091 for ((i) = 0; \ 1092 ((i) < (card)->num_links) && ((link) = &(card)->dai_link[i]); \ 1093 (i)++) 1094 #define for_each_card_pre_auxs(card, i, aux) \ 1095 for ((i) = 0; \ 1096 ((i) < (card)->num_aux_devs) && ((aux) = &(card)->aux_dev[i]); \ 1097 (i)++) 1098 1099 #define for_each_card_rtds(card, rtd) \ 1100 list_for_each_entry(rtd, &(card)->rtd_list, list) 1101 #define for_each_card_rtds_safe(card, rtd, _rtd) \ 1102 list_for_each_entry_safe(rtd, _rtd, &(card)->rtd_list, list) 1103 1104 #define for_each_card_auxs(card, component) \ 1105 list_for_each_entry(component, &card->aux_comp_list, card_aux_list) 1106 #define for_each_card_auxs_safe(card, component, _comp) \ 1107 list_for_each_entry_safe(component, _comp, \ 1108 &card->aux_comp_list, card_aux_list) 1109 1110 #define for_each_card_components(card, component) \ 1111 list_for_each_entry(component, &(card)->component_dev_list, card_list) 1112 1113 #define for_each_card_dapms(card, dapm) \ 1114 list_for_each_entry(dapm, &card->dapm_list, list) 1115 1116 #define for_each_card_widgets(card, w)\ 1117 list_for_each_entry(w, &card->widgets, list) 1118 #define for_each_card_widgets_safe(card, w, _w) \ 1119 list_for_each_entry_safe(w, _w, &card->widgets, list) 701 1120 702 1121 /* SoC machine DAI configuration, glues a codec and cpu DAI together */ 703 struct snd_soc_pcm_runtime {704 struct device dev;1122 struct snd_soc_pcm_runtime { 1123 struct device *dev; 705 1124 struct snd_soc_card *card; 706 1125 struct snd_soc_dai_link *dai_link; 707 708 unsigned int complete:1; 709 unsigned int dev_registered:1; 710 711 /* Symmetry data - only valid if symmetry is being enforced */ 712 unsigned int rate; 1126 struct snd_pcm_ops ops; 1127 1128 unsigned int params_select; /* currently selected param for dai link */ 1129 1130 /* Dynamic PCM BE runtime data */ 1131 struct snd_soc_dpcm_runtime dpcm[2]; 1132 713 1133 long pmdown_time; 714 1134 715 1135 /* runtime devices */ 716 1136 struct snd_pcm *pcm; 717 struct snd_soc_codec *codec; 718 struct snd_soc_platform *platform; 719 struct snd_soc_dai *codec_dai; 720 struct snd_soc_dai *cpu_dai; 1137 struct snd_compr *compr; 1138 1139 /* 1140 * dais = cpu_dai + codec_dai 1141 * see 1142 * soc_new_pcm_runtime() 1143 * asoc_rtd_to_cpu() 1144 * asoc_rtd_to_codec() 1145 */ 1146 struct snd_soc_dai **dais; 1147 unsigned int num_codecs; 1148 unsigned int num_cpus; 1149 1150 struct snd_soc_dapm_widget *playback_widget; 1151 struct snd_soc_dapm_widget *capture_widget; 721 1152 722 1153 struct delayed_work delayed_work; 723 }; 1154 void (*close_delayed_work_func)(struct snd_soc_pcm_runtime *rtd); 1155 #ifdef CONFIG_DEBUG_FS 1156 struct dentry *debugfs_dpcm_root; 1157 #endif 1158 1159 unsigned int num; /* 0-based and monotonic increasing */ 1160 struct list_head list; /* rtd list of the soc card */ 1161 1162 /* function mark */ 1163 struct snd_pcm_substream *mark_startup; 1164 1165 /* bit field */ 1166 unsigned int pop_wait:1; 1167 unsigned int fe_compr:1; /* for Dynamic PCM */ 1168 1169 int num_components; 1170 struct snd_soc_component *components[]; /* CPU/Codec/Platform */ 1171 }; 1172 /* see soc_new_pcm_runtime() */ 1173 #define asoc_rtd_to_cpu(rtd, n) (rtd)->dais[n] 1174 #define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus] 1175 #define asoc_substream_to_rtd(substream) \ 1176 (struct snd_soc_pcm_runtime *)snd_pcm_substream_chip(substream) 1177 1178 #define for_each_rtd_components(rtd, i, component) \ 1179 for ((i) = 0, component = NULL; \ 1180 ((i) < rtd->num_components) && ((component) = rtd->components[i]);\ 1181 (i)++) 1182 #define for_each_rtd_cpu_dais(rtd, i, dai) \ 1183 for ((i) = 0; \ 1184 ((i) < rtd->num_cpus) && ((dai) = asoc_rtd_to_cpu(rtd, i)); \ 1185 (i)++) 1186 #define for_each_rtd_cpu_dais_rollback(rtd, i, dai) \ 1187 for (; (--(i) >= 0) && ((dai) = asoc_rtd_to_cpu(rtd, i));) 1188 #define for_each_rtd_codec_dais(rtd, i, dai) \ 1189 for ((i) = 0; \ 1190 ((i) < rtd->num_codecs) && ((dai) = asoc_rtd_to_codec(rtd, i)); \ 1191 (i)++) 1192 #define for_each_rtd_codec_dais_rollback(rtd, i, dai) \ 1193 for (; (--(i) >= 0) && ((dai) = asoc_rtd_to_codec(rtd, i));) 1194 #define for_each_rtd_dais(rtd, i, dai) \ 1195 for ((i) = 0; \ 1196 ((i) < (rtd)->num_cpus + (rtd)->num_codecs) && \ 1197 ((dai) = (rtd)->dais[i]); \ 1198 (i)++) 1199 #define for_each_rtd_dais_rollback(rtd, i, dai) \ 1200 for (; (--(i) >= 0) && ((dai) = (rtd)->dais[i]);) 1201 1202 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); 724 1203 725 1204 /* mixer control */ 726 1205 struct soc_mixer_control { 727 1206 int min, max, platform_max; 728 unsigned int reg, rreg, shift, rshift, invert; 1207 int reg, rreg; 1208 unsigned int shift, rshift; 1209 unsigned int sign_bit; 1210 unsigned int invert:1; 1211 unsigned int autodisable:1; 1212 #ifdef CONFIG_SND_SOC_TOPOLOGY 1213 struct snd_soc_dobj dobj; 1214 #endif 1215 }; 1216 1217 struct soc_bytes { 1218 int base; 1219 int num_regs; 1220 u32 mask; 1221 }; 1222 1223 struct soc_bytes_ext { 1224 int max; 1225 #ifdef CONFIG_SND_SOC_TOPOLOGY 1226 struct snd_soc_dobj dobj; 1227 #endif 1228 /* used for TLV byte control */ 1229 int (*get)(struct snd_kcontrol *kcontrol, unsigned int __user *bytes, 1230 unsigned int size); 1231 int (*put)(struct snd_kcontrol *kcontrol, const unsigned int __user *bytes, 1232 unsigned int size); 1233 }; 1234 1235 /* multi register control */ 1236 struct soc_mreg_control { 1237 long min, max; 1238 unsigned int regbase, regcount, nbits, invert; 729 1239 }; 730 1240 731 1241 /* enumerated kcontrol */ 732 1242 struct soc_enum { 733 unsigned short reg; 734 unsigned short reg2; 1243 int reg; 735 1244 unsigned char shift_l; 736 1245 unsigned char shift_r; 737 unsigned int max;1246 unsigned int items; 738 1247 unsigned int mask; 739 const char * *texts;1248 const char * const *texts; 740 1249 const unsigned int *values; 741 void *dapm; 742 }; 743 744 /* codec IO */ 745 unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 746 unsigned int snd_soc_write(struct snd_soc_codec *codec, 747 unsigned int reg, unsigned int val); 748 749 /* device driver data */ 750 751 static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec, 752 void *data) 753 { 754 dev_set_drvdata(codec->dev, data); 755 } 756 757 static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec) 758 { 759 return dev_get_drvdata(codec->dev); 760 } 761 762 static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform, 763 void *data) 764 { 765 dev_set_drvdata(platform->dev, data); 766 } 767 768 static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform) 769 { 770 return dev_get_drvdata(platform->dev); 771 } 772 773 static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 774 void *data) 775 { 776 dev_set_drvdata(&rtd->dev, data); 777 } 778 779 static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) 780 { 781 return dev_get_drvdata(&rtd->dev); 782 } 783 784 static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 785 { 786 INIT_LIST_HEAD(&card->dai_dev_list); 787 INIT_LIST_HEAD(&card->codec_dev_list); 788 INIT_LIST_HEAD(&card->platform_dev_list); 789 INIT_LIST_HEAD(&card->widgets); 790 INIT_LIST_HEAD(&card->paths); 791 INIT_LIST_HEAD(&card->dapm_list); 792 } 1250 unsigned int autodisable:1; 1251 #ifdef CONFIG_SND_SOC_TOPOLOGY 1252 struct snd_soc_dobj dobj; 1253 #endif 1254 }; 1255 1256 static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) 1257 { 1258 if (mc->reg == mc->rreg && mc->shift == mc->rshift) 1259 return false; 1260 /* 1261 * mc->reg == mc->rreg && mc->shift != mc->rshift, or 1262 * mc->reg != mc->rreg means that the control is 1263 * stereo (bits in one register or in two registers) 1264 */ 1265 return true; 1266 } 1267 1268 static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e, 1269 unsigned int val) 1270 { 1271 unsigned int i; 1272 1273 if (!e->values) 1274 return val; 1275 1276 for (i = 0; i < e->items; i++) 1277 if (val == e->values[i]) 1278 return i; 1279 1280 return 0; 1281 } 1282 1283 static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e, 1284 unsigned int item) 1285 { 1286 if (!e->values) 1287 return item; 1288 1289 return e->values[item]; 1290 } 1291 1292 /** 1293 * snd_soc_kcontrol_component() - Returns the component that registered the 1294 * control 1295 * @kcontrol: The control for which to get the component 1296 * 1297 * Note: This function will work correctly if the control has been registered 1298 * for a component. With snd_soc_add_codec_controls() or via table based 1299 * setup for either a CODEC or component driver. Otherwise the behavior is 1300 * undefined. 1301 */ 1302 static inline struct snd_soc_component *snd_soc_kcontrol_component( 1303 struct snd_kcontrol *kcontrol) 1304 { 1305 return snd_kcontrol_chip(kcontrol); 1306 } 1307 1308 int snd_soc_util_init(void); 1309 void snd_soc_util_exit(void); 1310 1311 int snd_soc_of_parse_card_name(struct snd_soc_card *card, 1312 const char *propname); 1313 int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card, 1314 const char *propname); 1315 int snd_soc_of_get_slot_mask(struct device_node *np, 1316 const char *prop_name, 1317 unsigned int *mask); 1318 int snd_soc_of_parse_tdm_slot(struct device_node *np, 1319 unsigned int *tx_mask, 1320 unsigned int *rx_mask, 1321 unsigned int *slots, 1322 unsigned int *slot_width); 1323 void snd_soc_of_parse_node_prefix(struct device_node *np, 1324 struct snd_soc_codec_conf *codec_conf, 1325 struct device_node *of_node, 1326 const char *propname); 1327 static inline 1328 void snd_soc_of_parse_audio_prefix(struct snd_soc_card *card, 1329 struct snd_soc_codec_conf *codec_conf, 1330 struct device_node *of_node, 1331 const char *propname) 1332 { 1333 snd_soc_of_parse_node_prefix(card->dev->of_node, 1334 codec_conf, of_node, propname); 1335 } 1336 1337 int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, 1338 const char *propname); 1339 int snd_soc_of_parse_aux_devs(struct snd_soc_card *card, const char *propname); 1340 unsigned int snd_soc_of_parse_daifmt(struct device_node *np, 1341 const char *prefix, 1342 struct device_node **bitclkmaster, 1343 struct device_node **framemaster); 1344 int snd_soc_get_dai_id(struct device_node *ep); 1345 int snd_soc_get_dai_name(struct of_phandle_args *args, 1346 const char **dai_name); 1347 int snd_soc_of_get_dai_name(struct device_node *of_node, 1348 const char **dai_name); 1349 int snd_soc_of_get_dai_link_codecs(struct device *dev, 1350 struct device_node *of_node, 1351 struct snd_soc_dai_link *dai_link); 1352 void snd_soc_of_put_dai_link_codecs(struct snd_soc_dai_link *dai_link); 1353 1354 int snd_soc_add_pcm_runtime(struct snd_soc_card *card, 1355 struct snd_soc_dai_link *dai_link); 1356 void snd_soc_remove_pcm_runtime(struct snd_soc_card *card, 1357 struct snd_soc_pcm_runtime *rtd); 1358 1359 struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, 1360 struct snd_soc_dai_driver *dai_drv, 1361 bool legacy_dai_naming); 1362 struct snd_soc_dai *devm_snd_soc_register_dai(struct device *dev, 1363 struct snd_soc_component *component, 1364 struct snd_soc_dai_driver *dai_drv, 1365 bool legacy_dai_naming); 1366 void snd_soc_unregister_dai(struct snd_soc_dai *dai); 1367 1368 struct snd_soc_dai *snd_soc_find_dai( 1369 const struct snd_soc_dai_link_component *dlc); 1370 struct snd_soc_dai *snd_soc_find_dai_with_mutex( 1371 const struct snd_soc_dai_link_component *dlc); 793 1372 794 1373 #include <sound/soc-dai.h> 1374 1375 static inline 1376 int snd_soc_fixup_dai_links_platform_name(struct snd_soc_card *card, 1377 const char *platform_name) 1378 { 1379 struct snd_soc_dai_link *dai_link; 1380 const char *name; 1381 int i; 1382 1383 if (!platform_name) /* nothing to do */ 1384 return 0; 1385 1386 /* set platform name for each dailink */ 1387 for_each_card_prelinks(card, i, dai_link) { 1388 name = devm_kstrdup(card->dev, platform_name, GFP_KERNEL); 1389 if (!name) 1390 return -ENOMEM; 1391 1392 if (!dai_link->platforms) 1393 return -EINVAL; 1394 1395 /* only single platform is supported for now */ 1396 dai_link->platforms->name = name; 1397 } 1398 1399 return 0; 1400 } 795 1401 796 1402 #ifdef CONFIG_DEBUG_FS … … 798 1404 #endif 799 1405 1406 extern const struct dev_pm_ops snd_soc_pm_ops; 1407 1408 /* Helper functions */ 1409 static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm) 1410 { 1411 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME); 1412 } 1413 1414 static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm) 1415 { 1416 mutex_unlock(&dapm->card->dapm_mutex); 1417 } 1418 1419 #include <sound/soc-component.h> 1420 #include <sound/soc-card.h> 1421 800 1422 #endif -
GPL/trunk/alsa-kernel/include/sound/soundfont.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_SOUNDFONT_H 2 3 #define __SOUND_SOUNDFONT_H … … 7 8 * Copyright (C) 1999 Steve Ratcliffe 8 9 * Copyright (c) 1999-2000 Takashi iwai <tiwai@suse.de> 9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 10 */ 24 11 25 #include "sfnt_info.h"26 #include "util_mem.h"12 #include <sound/sfnt_info.h> 13 #include <sound/util_mem.h> 27 14 28 15 #define SF_MAX_INSTRUMENTS 128 /* maximum instrument number */ … … 122 109 int snd_sf_calc_parm_attack(int msec); 123 110 int snd_sf_calc_parm_decay(int msec); 124 #define snd_sf_calc_parm_delay(msec) (0x8000 - (msec) * 1000 / 725) ;111 #define snd_sf_calc_parm_delay(msec) (0x8000 - (msec) * 1000 / 725) 125 112 extern int snd_sf_vol_table[128]; 126 113 int snd_sf_linear_to_log(unsigned int amount, int offset, int ratio); -
GPL/trunk/alsa-kernel/include/sound/tea575x-tuner.h
r426 r679 24 24 25 25 #include <linux/videodev2.h> 26 #include <media/v4l2-ctrls.h> 26 27 #include <media/v4l2-dev.h> 27 #include <media/v4l2-ioctl.h> 28 #include <media/v4l2-device.h> 29 30 #define TEA575X_FMIF 10700 31 #define TEA575X_AMIF 450 32 33 #define TEA575X_DATA (1 << 0) 34 #define TEA575X_CLK (1 << 1) 35 #define TEA575X_WREN (1 << 2) 36 #define TEA575X_MOST (1 << 3) 28 37 29 38 struct snd_tea575x; 30 39 31 40 struct snd_tea575x_ops { 32 void (*write)(struct snd_tea575x *tea, unsigned int val); 33 unsigned int (*read)(struct snd_tea575x *tea); 34 void (*mute)(struct snd_tea575x *tea, unsigned int mute); 41 /* Drivers using snd_tea575x must either define read_ and write_val */ 42 void (*write_val)(struct snd_tea575x *tea, u32 val); 43 u32 (*read_val)(struct snd_tea575x *tea); 44 /* Or define the 3 pin functions */ 45 void (*set_pins)(struct snd_tea575x *tea, u8 pins); 46 u8 (*get_pins)(struct snd_tea575x *tea); 47 void (*set_direction)(struct snd_tea575x *tea, bool output); 35 48 }; 36 49 37 50 struct snd_tea575x { 38 struct snd_card *card; 39 struct video_device *vd; /* video device */ 40 int dev_nr; /* requested device number + 1 */ 41 int tea5759; /* 5759 chip is present */ 42 int mute; /* Device is muted? */ 43 unsigned int freq_fixup; /* crystal onboard */ 51 struct v4l2_device *v4l2_dev; 52 struct v4l2_file_operations fops; 53 struct video_device vd; /* video device */ 54 int radio_nr; /* radio_nr */ 55 bool tea5759; /* 5759 chip is present */ 56 bool has_am; /* Device can tune to AM freqs */ 57 bool cannot_read_data; /* Device cannot read the data pin */ 58 bool cannot_mute; /* Device cannot mute */ 59 bool mute; /* Device is muted? */ 60 bool stereo; /* receiving stereo */ 61 bool tuned; /* tuned to a station */ 44 62 unsigned int val; /* hw value */ 45 unsigned long freq; /* frequency */ 46 unsigned long in_use; /* set if the device is in use */ 63 u32 band; /* 0: FM, 1: FM-Japan, 2: AM */ 64 u32 freq; /* frequency */ 65 struct mutex mutex; 47 66 struct snd_tea575x_ops *ops; 48 67 void *private_data; 68 u8 card[32]; 69 u8 bus_info[32]; 70 struct v4l2_ctrl_handler ctrl_handler; 71 int (*ext_init)(struct snd_tea575x *tea); 49 72 }; 50 73 51 void snd_tea575x_init(struct snd_tea575x *tea);74 int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner); 52 75 void snd_tea575x_exit(struct snd_tea575x *tea); 76 void snd_tea575x_set_freq(struct snd_tea575x *tea); 53 77 54 78 #endif /* __SOUND_TEA575X_TUNER_H */ -
GPL/trunk/alsa-kernel/include/sound/tea6330t.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_TEA6330T_H 2 3 #define __SOUND_TEA6330T_H … … 5 6 * Routines for control of TEA6330T circuit. 6 7 * Sound fader control circuit for car radios. 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 *23 8 */ 24 9 25 #include "i2c.h"/* generic i2c support */10 #include <sound/i2c.h> /* generic i2c support */ 26 11 27 12 int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer); -
GPL/trunk/alsa-kernel/include/sound/timer.h
r399 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_TIMER_H 2 3 #define __SOUND_TIMER_H … … 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>, 7 8 * Abramo Bagnara <abramo@alsa-project.org> 8 *9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 9 */ 25 10 … … 37 22 #define SNDRV_TIMER_HW_SLAVE 0x00000004 /* only slave timer (variable resolution) */ 38 23 #define SNDRV_TIMER_HW_FIRST 0x00000008 /* first tick can be incomplete */ 39 #define SNDRV_TIMER_HW_ TASKLET 0x00000010 /* timer is called from tasklet*/24 #define SNDRV_TIMER_HW_WORK 0x00000010 /* timer is called from work */ 40 25 41 26 #define SNDRV_TIMER_IFLG_SLAVE 0x00000001 … … 43 28 #define SNDRV_TIMER_IFLG_START 0x00000004 44 29 #define SNDRV_TIMER_IFLG_AUTO 0x00000008 /* auto restart */ 45 #define SNDRV_TIMER_IFLG_FAST 0x00000010 /* fast callback (do not use tasklet) */30 #define SNDRV_TIMER_IFLG_FAST 0x00000010 /* fast callback (do not use work) */ 46 31 #define SNDRV_TIMER_IFLG_CALLBACK 0x00000020 /* timer callback is active */ 47 32 #define SNDRV_TIMER_IFLG_EXCLUSIVE 0x00000040 /* exclusive owner - no more instances */ … … 90 75 struct list_head ack_list_head; 91 76 struct list_head sack_list_head; /* slow ack list head */ 92 struct tasklet_struct task_queue; 77 struct work_struct task_work; 78 int max_instances; /* upper limit of timer instances */ 79 int num_instances; /* current number of timer instances */ 93 80 }; 94 81 … … 103 90 void (*ccallback) (struct snd_timer_instance * timeri, 104 91 int event, 105 struct timespec * tstamp,92 struct timespec64 * tstamp, 106 93 unsigned long resolution); 94 void (*disconnect)(struct snd_timer_instance *timeri); 107 95 void *callback_data; 108 96 unsigned long ticks; /* auto-load ticks when expired */ 109 97 unsigned long cticks; /* current ticks */ 110 98 unsigned long pticks; /* accumulated ticks for callback */ 111 unsigned long resolution; /* current resolution for tasklet*/99 unsigned long resolution; /* current resolution for work */ 112 100 unsigned long lost; /* lost ticks */ 113 101 int slave_class; … … 126 114 127 115 int snd_timer_new(struct snd_card *card, char *id, struct snd_timer_id *tid, struct snd_timer **rtimer); 128 void snd_timer_notify(struct snd_timer *timer, int event, struct timespec *tstamp);116 void snd_timer_notify(struct snd_timer *timer, int event, struct timespec64 *tstamp); 129 117 int snd_timer_global_new(char *id, int device, struct snd_timer **rtimer); 130 118 int snd_timer_global_free(struct snd_timer *timer); 131 119 int snd_timer_global_register(struct snd_timer *timer); 132 120 133 int snd_timer_open(struct snd_timer_instance **ti, char *owner, struct snd_timer_id *tid, unsigned int slave_id); 134 int snd_timer_close(struct snd_timer_instance *timeri); 121 struct snd_timer_instance *snd_timer_instance_new(const char *owner); 122 void snd_timer_instance_free(struct snd_timer_instance *timeri); 123 int snd_timer_open(struct snd_timer_instance *timeri, struct snd_timer_id *tid, unsigned int slave_id); 124 void snd_timer_close(struct snd_timer_instance *timeri); 135 125 unsigned long snd_timer_resolution(struct snd_timer_instance *timeri); 136 126 int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks); -
GPL/trunk/alsa-kernel/include/sound/tlv.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_TLV_H 2 3 #define __SOUND_TLV_H … … 5 6 * Advanced Linux Sound Architecture - ALSA - Driver 6 7 * Copyright (c) 2006 by Jaroslav Kysela <perex@perex.cz> 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 *23 8 */ 24 9 10 #include <uapi/sound/tlv.h> 11 12 /* For historical reasons, these macros are aliases to the ones in UAPI. */ 13 #define TLV_ITEM SNDRV_CTL_TLVD_ITEM 14 #define TLV_LENGTH SNDRV_CTL_TLVD_LENGTH 15 16 #define TLV_CONTAINER_ITEM SNDRV_CTL_TLVD_CONTAINER_ITEM 17 #define DECLARE_TLV_CONTAINER SNDRV_CTL_TLVD_DECLARE_CONTAINER 18 19 #define TLV_DB_SCALE_MASK SNDRV_CTL_TLVD_DB_SCALE_MASK 20 #define TLV_DB_SCALE_MUTE SNDRV_CTL_TLVD_DB_SCALE_MUTE 21 #define TLV_DB_SCALE_ITEM SNDRV_CTL_TLVD_DB_SCALE_ITEM 22 #define DECLARE_TLV_DB_SCALE SNDRV_CTL_TLVD_DECLARE_DB_SCALE 23 24 #define TLV_DB_MINMAX_ITEM SNDRV_CTL_TLVD_DB_MINMAX_ITEM 25 #define TLV_DB_MINMAX_MUTE_ITEM SNDRV_CTL_TLVD_DB_MINMAX_MUTE_ITEM 26 #define DECLARE_TLV_DB_MINMAX SNDRV_CTL_TLVD_DECLARE_DB_MINMAX 27 #define DECLARE_TLV_DB_MINMAX_MUTE SNDRV_CTL_TLVD_DECLARE_DB_MINMAX_MUTE 28 29 #define TLV_DB_LINEAR_ITEM SNDRV_CTL_TLVD_DB_LINEAR_ITEM 30 #define DECLARE_TLV_DB_LINEAR SNDRV_CTL_TLVD_DECLARE_DB_LINEAR 31 32 #define TLV_DB_RANGE_ITEM SNDRV_CTL_TLVD_DB_RANGE_ITEM 33 #define DECLARE_TLV_DB_RANGE SNDRV_CTL_TLVD_DECLARE_DB_RANGE 34 35 #define TLV_DB_GAIN_MUTE SNDRV_CTL_TLVD_DB_GAIN_MUTE 36 25 37 /* 26 * TLV structure is right behind the struct snd_ctl_tlv: 27 * unsigned int type - see SNDRV_CTL_TLVT_* 28 * unsigned int length 29 * .... data aligned to sizeof(unsigned int), use 30 * block_length = (length + (sizeof(unsigned int) - 1)) & 31 * ~(sizeof(unsigned int) - 1)) .... 38 * The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR. 39 * This is an old fasion and obsoleted by commit bf1d1c9b6179("ALSA: tlv: add 40 * DECLARE_TLV_DB_RANGE()"). 32 41 */ 33 34 #define SNDRV_CTL_TLVT_CONTAINER 0 /* one level down - group of TLVs */ 35 #define SNDRV_CTL_TLVT_DB_SCALE 1 /* dB scale */ 36 #define SNDRV_CTL_TLVT_DB_LINEAR 2 /* linear volume */ 37 #define SNDRV_CTL_TLVT_DB_RANGE 3 /* dB range container */ 38 #define SNDRV_CTL_TLVT_DB_MINMAX 4 /* dB scale with min/max */ 39 #define SNDRV_CTL_TLVT_DB_MINMAX_MUTE 5 /* dB scale with min/max with mute */ 40 41 #define TLV_DB_SCALE_MASK 0xffff 42 #define TLV_DB_SCALE_MUTE 0x10000 43 #define TLV_DB_SCALE_ITEM(min, step, mute) \ 44 SNDRV_CTL_TLVT_DB_SCALE, 2 * sizeof(unsigned int), \ 45 (min), ((step) & TLV_DB_SCALE_MASK) | ((mute) ? TLV_DB_SCALE_MUTE : 0) 46 #define DECLARE_TLV_DB_SCALE(name, min, step, mute) \ 47 unsigned int name[] = { TLV_DB_SCALE_ITEM(min, step, mute) } 48 49 /* dB scale specified with min/max values instead of step */ 50 #define TLV_DB_MINMAX_ITEM(min_dB, max_dB) \ 51 SNDRV_CTL_TLVT_DB_MINMAX, 2 * sizeof(unsigned int), \ 52 (min_dB), (max_dB) 53 #define TLV_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) \ 54 SNDRV_CTL_TLVT_DB_MINMAX_MUTE, 2 * sizeof(unsigned int), \ 55 (min_dB), (max_dB) 56 #define DECLARE_TLV_DB_MINMAX(name, min_dB, max_dB) \ 57 unsigned int name[] = { TLV_DB_MINMAX_ITEM(min_dB, max_dB) } 58 #define DECLARE_TLV_DB_MINMAX_MUTE(name, min_dB, max_dB) \ 59 unsigned int name[] = { TLV_DB_MINMAX_MUTE_ITEM(min_dB, max_dB) } 60 61 /* linear volume between min_dB and max_dB (.01dB unit) */ 62 #define TLV_DB_LINEAR_ITEM(min_dB, max_dB) \ 63 SNDRV_CTL_TLVT_DB_LINEAR, 2 * sizeof(unsigned int), \ 64 (min_dB), (max_dB) 65 #define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \ 66 unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) } 67 68 /* dB range container */ 69 /* Each item is: <min> <max> <TLV> */ 70 /* The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR */ 71 #define TLV_DB_RANGE_HEAD(num) \ 42 #define TLV_DB_RANGE_HEAD(num) \ 72 43 SNDRV_CTL_TLVT_DB_RANGE, 6 * (num) * sizeof(unsigned int) 73 44 74 #define TLV_DB_GAIN_MUTE -999999975 76 45 #endif /* __SOUND_TLV_H */ -
GPL/trunk/alsa-kernel/include/sound/util_mem.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_UTIL_MEM_H 2 3 #define __SOUND_UTIL_MEM_H … … 7 8 * 8 9 * Generic memory management routines for soundcard memory allocation 9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 10 */ 24 11 -
GPL/trunk/alsa-kernel/include/sound/version.h
r598 r679 1 1 /* include/version.h */ 2 #define CONFIG_SND_VERSION " 1.0.24"2 #define CONFIG_SND_VERSION "5.10.20" 3 3 #define CONFIG_SND_DATE "" -
GPL/trunk/alsa-kernel/include/sound/vx_core.h
r399 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * Driver for Digigram VX soundcards … … 5 6 * 6 7 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de> 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 */ 22 9 … … 27 14 #include <sound/hwdep.h> 28 15 #include <linux/interrupt.h> 29 30 #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)31 #if !defined(CONFIG_USE_VXLOADER) && !defined(CONFIG_SND_VX_LIB) /* built-in kernel */32 #define SND_VX_FW_LOADER /* use the standard firmware loader */33 #endif34 #endif35 16 36 17 struct firmware; … … 87 68 unsigned int references; /* an output pipe may be used for monitoring and/or playback */ 88 69 struct vx_pipe *monitoring_pipe; /* pointer to the monitoring pipe (capture pipe only)*/ 89 90 struct tasklet_struct start_tq;91 70 }; 92 71 … … 169 148 170 149 /* low-level functions */ 171 struct snd_vx_hardware *hw; 172 struct snd_vx_ops *ops; 173 174 spinlock_t lock; 175 spinlock_t irq_lock; 176 struct tasklet_struct tq; 150 const struct snd_vx_hardware *hw; 151 const struct snd_vx_ops *ops; 152 153 struct mutex lock; 177 154 178 155 unsigned int chip_status; … … 217 194 * constructor 218 195 */ 219 struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, 220 struct snd_vx_ops *ops, int extra_size); 196 struct vx_core *snd_vx_create(struct snd_card *card, 197 const struct snd_vx_hardware *hw, 198 const struct snd_vx_ops *ops, int extra_size); 221 199 int snd_vx_setup_firmware(struct vx_core *chip); 222 200 int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp); … … 230 208 */ 231 209 irqreturn_t snd_vx_irq_handler(int irq, void *dev); 210 irqreturn_t snd_vx_threaded_irq_handler(int irq, void *dev); 232 211 233 212 /* … … 342 321 * PM 343 322 */ 344 int snd_vx_suspend(struct vx_core *card , pm_message_t state);323 int snd_vx_suspend(struct vx_core *card); 345 324 int snd_vx_resume(struct vx_core *card); 346 325 -
GPL/trunk/alsa-kernel/include/sound/wavefront.h
r398 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_WAVEFRONT_H__ 2 3 #define __SOUND_WAVEFRONT_H__ … … 6 7 * 7 8 * Copyright (c) by Paul Barton-Davis <pbd@op.net> 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 9 */ 23 10
Note:
See TracChangeset
for help on using the changeset viewer.
