sound updates for 3.15-rc1
There have been lots of changes in ALSA core, HD-audio and ASoC, also most of PCI drivers touched by conversions of printks. All these resulted in a high volume and wide ranged patch sets in this release. Many changes are fairly trivial, but also lots of nice cleanups and refactors. There are a few new drivers, most notably, the Intel Haswell and Baytrail ASoC driver. Core changes: - A bit modernization; embed the device struct into snd_card struct, so that it may be referred from the beginning. A new snd_card_new() function is introduced for that, and all drivers have been converted. - Simplification in the device management code in ALSA core; now managed by a simple priority list instead - Converted many kernel messages to use the standard dev_err() & co; this would be the pretty visible difference, especially for HD-audio. HD-audio: - Conexant codecs use the auto-parser as default now; the old static code still remains in case of regressions. Some old quirks have been rewritten with the fixups for auto-parser. - C-Media codecs also use the auto-parser as default now, too. - A device struct is assigned to each HD-audio codec, and the formerly hwdep attributes are accessible over the codec sysfs, too. hwdep attributes still remain for compatibility. - Split the PCI-specific stuff for HD-audio controller into a separate module, ane make a helper module for the generic controller driver. This is a preliminary change for supporting Tegra HDMI controller in near future, which slipped from 3.15 merge. - Device-specific fixes: mute LED support for Lenovo Ideapad, mic LED fix for HP laptops, more ASUS subwoofer quirks, yet more Dell laptop headset quirks - Make the HD-audio codec response a bit more robust - A few improvements on Realtek ALC282 / 283 about the pop noises - A couple of Intel HDMI fixes ASoC: - Lots of cleanups for enumerations; refactored lots of error prone original codes to use more modern APIs - Elimination of the ASoC level wrappers for I2C and SPI moving us closer to converting to regmap completely and avoiding some randconfig hassle - Provide both manually and transparently locked DAPM APIs rather than a mix of the two fixing some concurrency issues - Start converting CODEC drivers to use separate bus interface drivers rather than having them all in one file helping avoid dependency issues - DPCM support for Intel Haswell and Bay Trail platforms, lots of fixes - Lots of work on improvements for simple-card, DaVinci and the Renesas rcar drivers. - New drivers for Analog Devices ADAU1977, TI PCM512x and parts of the CSR SiRF SoC, TLV320AIC31XXX, Armada 370 DB, Cirrus cs42xx8 - Fixes for the simple-card DAI format DT mess - DT support for a couple more devices. - Use of the tdm_slot mapping in a few drivers Others: - Support of reset_resume callback for improved S4 in USB-audio driver; the device with boot quirks have been little tested, which we need to watch out in this development cycle - Add PM support for ICE1712 driver (finally!); it's still pretty partial support, only for M-Audio devices -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJTOpQ/AAoJEGwxgFQ9KSmkTccP/RUxO1Coysvm+N+NUOtzvIgR O++rMDpsFhBSRtB4YvaxAGWRnI629QBc8YSpebxX+KqrGyDe856abgMHydzXJ6hd sM6//oaaZ8i0uXXzJza0/HXwIWHup9QcPVyFC4vAQq5mv6OCrH+Pvu7EXc0XbKh7 7B0ic28+AGPJTqV3sOx48AVzMvNnzPsKGriTWRUJ8Q6QnFqYrO0v6K9IH8/4pftg 2cihkA4JcIMNtoTSC/kSB3mXBvAX0ZFKQ2Juj1ukZxtXzaYmt9/ZLYPC+EM5OZrH Bo4pXrpja38QlFBXYBbxXYWqCXQp+B7CPl8sNXF2rDaRhX8qcFrOP05uqV4wR5HW AtCZjmhdvcYCbdUOv+Eck/HesRQMlIRKZN6/NAQBBN/WwrMMD1DmCODBke4uyg3+ Akb3yMQ0wXq/iSWRY0t5ejNGz9TV7V4NR1QoJS8+fgDnj1oP5sOAfr/BgZBcUIZ/ np8F77lTqqPqj9kPQnMRBEznvJvQxLRMAMxztCwgEr5520cxqNo02S3hNsOwF0xJ t1K1iURZCFxNolSz68eSJOaXo7e77HPwiSze+JCRSfG5qJcltOlvgqO7UC/6wYcZ 2Z6tv3nGHzrQPVYR0aeWJXZJG8xIrr1Awg0P+G0ky6gfWCAGd7KBP6kYfuFVlytS +ztGEe37SxgGGTisoMMh =Y476 -----END PGP SIGNATURE----- Merge tag 'sound-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound Pull sound updates from Takashi Iwai: "There have been lots of changes in ALSA core, HD-audio and ASoC, also most of PCI drivers touched by conversions of printks. All these resulted in a high volume and wide ranged patch sets in this release. Many changes are fairly trivial, but also lots of nice cleanups and refactors. There are a few new drivers, most notably, the Intel Haswell and Baytrail ASoC driver. Core changes: - A bit modernization; embed the device struct into snd_card struct, so that it may be referred from the beginning. A new snd_card_new() function is introduced for that, and all drivers have been converted. - Simplification in the device management code in ALSA core; now managed by a simple priority list instead - Converted many kernel messages to use the standard dev_err() & co; this would be the pretty visible difference, especially for HD-audio. HD-audio: - Conexant codecs use the auto-parser as default now; the old static code still remains in case of regressions. Some old quirks have been rewritten with the fixups for auto-parser. - C-Media codecs also use the auto-parser as default now, too. - A device struct is assigned to each HD-audio codec, and the formerly hwdep attributes are accessible over the codec sysfs, too. hwdep attributes still remain for compatibility. - Split the PCI-specific stuff for HD-audio controller into a separate module, ane make a helper module for the generic controller driver. This is a preliminary change for supporting Tegra HDMI controller in near future, which slipped from 3.15 merge. - Device-specific fixes: mute LED support for Lenovo Ideapad, mic LED fix for HP laptops, more ASUS subwoofer quirks, yet more Dell laptop headset quirks - Make the HD-audio codec response a bit more robust - A few improvements on Realtek ALC282 / 283 about the pop noises - A couple of Intel HDMI fixes ASoC: - Lots of cleanups for enumerations; refactored lots of error prone original codes to use more modern APIs - Elimination of the ASoC level wrappers for I2C and SPI moving us closer to converting to regmap completely and avoiding some randconfig hassle - Provide both manually and transparently locked DAPM APIs rather than a mix of the two fixing some concurrency issues - Start converting CODEC drivers to use separate bus interface drivers rather than having them all in one file helping avoid dependency issues - DPCM support for Intel Haswell and Bay Trail platforms, lots of fixes - Lots of work on improvements for simple-card, DaVinci and the Renesas rcar drivers. - New drivers for Analog Devices ADAU1977, TI PCM512x and parts of the CSR SiRF SoC, TLV320AIC31XXX, Armada 370 DB, Cirrus cs42xx8 - Fixes for the simple-card DAI format DT mess - DT support for a couple more devices. - Use of the tdm_slot mapping in a few drivers Others: - Support of reset_resume callback for improved S4 in USB-audio driver; the device with boot quirks have been little tested, which we need to watch out in this development cycle - Add PM support for ICE1712 driver (finally!); it's still pretty partial support, only for M-Audio devices" * tag 'sound-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (610 commits) ALSA: ice1712: Add suspend support for M-Audio ICE1712-based cards ALSA: ice1712: add suspend support for ICE1712 chip ALSA: hda - Enable beep for ASUS 1015E ALSA: asihpi: fix some indenting in snd_card_asihpi_pcm_new() ALSA: hda - add headset mic detect quirks for three Dell laptops ASoC: tegra: move AC97 clock handling to the machine driver ASoC: simple-card: Handle many DAI links ASoC: simple-card: Add DT documentation for multi-DAI links ASoC: simple-card: dynamically allocate the DAI link and properties ASoC: imx-ssi: Add .xlate_tdm_slot_mask() support. ASoC: fsl-esai: Add .xlate_tdm_slot_mask() support. ASoC: fsl-utils: Add fsl_asoc_xlate_tdm_slot_mask() support. ASoC: core: remove the 'of_' prefix of of_xlate_tdm_slot_mask. ASoC: rcar: subnode tidyup for renesas,rsnd.txt ASoC: Remove name_prefix unset during DAI link init hack ALSA: hda - Inform the unexpectedly ignored pins by auto-parser ASoC: rcar: bugfix: it cares about the non-src case ARM: bockw: fixup SND_SOC_DAIFMT_CBx_CFx flags ASoC: pcm: Drop incorrect double/extra frees ASoC: mfld_machine: Fix compile error ...
This commit is contained in:
commit
c70929147a
|
@ -468,8 +468,6 @@
|
|||
return err;
|
||||
}
|
||||
|
||||
snd_card_set_dev(card, &pci->dev);
|
||||
|
||||
*rchip = chip;
|
||||
return 0;
|
||||
}
|
||||
|
@ -492,7 +490,8 @@
|
|||
}
|
||||
|
||||
/* (2) */
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
0, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -591,7 +590,8 @@
|
|||
struct snd_card *card;
|
||||
int err;
|
||||
....
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
0, &card);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -809,28 +809,34 @@
|
|||
|
||||
<para>
|
||||
As mentioned above, to create a card instance, call
|
||||
<function>snd_card_create()</function>.
|
||||
<function>snd_card_new()</function>.
|
||||
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
struct snd_card *card;
|
||||
int err;
|
||||
err = snd_card_create(index, id, module, extra_size, &card);
|
||||
err = snd_card_new(&pci->dev, index, id, module, extra_size, &card);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The function takes five arguments, the card-index number, the
|
||||
id string, the module pointer (usually
|
||||
The function takes six arguments: the parent device pointer,
|
||||
the card-index number, the id string, the module pointer (usually
|
||||
<constant>THIS_MODULE</constant>),
|
||||
the size of extra-data space, and the pointer to return the
|
||||
card instance. The extra_size argument is used to
|
||||
allocate card->private_data for the
|
||||
chip-specific data. Note that these data
|
||||
are allocated by <function>snd_card_create()</function>.
|
||||
are allocated by <function>snd_card_new()</function>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The first argument, the pointer of struct
|
||||
<structname>device</structname>, specifies the parent device.
|
||||
For PCI devices, typically &pci-> is passed there.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
@ -916,16 +922,16 @@
|
|||
</para>
|
||||
|
||||
<section id="card-management-chip-specific-snd-card-new">
|
||||
<title>1. Allocating via <function>snd_card_create()</function>.</title>
|
||||
<title>1. Allocating via <function>snd_card_new()</function>.</title>
|
||||
<para>
|
||||
As mentioned above, you can pass the extra-data-length
|
||||
to the 4th argument of <function>snd_card_create()</function>, i.e.
|
||||
to the 5th argument of <function>snd_card_new()</function>, i.e.
|
||||
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
|
||||
sizeof(struct mychip), &card);
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
sizeof(struct mychip), &card);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -954,7 +960,7 @@
|
|||
|
||||
<para>
|
||||
After allocating a card instance via
|
||||
<function>snd_card_create()</function> (with
|
||||
<function>snd_card_new()</function> (with
|
||||
<constant>0</constant> on the 4th arg), call
|
||||
<function>kzalloc()</function>.
|
||||
|
||||
|
@ -963,7 +969,8 @@
|
|||
<![CDATA[
|
||||
struct snd_card *card;
|
||||
struct mychip *chip;
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
0, &card);
|
||||
.....
|
||||
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
|
||||
]]>
|
||||
|
@ -1170,8 +1177,6 @@
|
|||
return err;
|
||||
}
|
||||
|
||||
snd_card_set_dev(card, &pci->dev);
|
||||
|
||||
*rchip = chip;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1526,30 +1531,6 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="pci-resource-device-struct">
|
||||
<title>Registration of Device Struct</title>
|
||||
<para>
|
||||
At some point, typically after calling <function>snd_device_new()</function>,
|
||||
you need to register the struct <structname>device</structname> of the chip
|
||||
you're handling for udev and co. ALSA provides a macro for compatibility with
|
||||
older kernels. Simply call like the following:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
snd_card_set_dev(card, &pci->dev);
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
so that it stores the PCI's device pointer to the card. This will be
|
||||
referred by ALSA core functions later when the devices are registered.
|
||||
</para>
|
||||
<para>
|
||||
In the case of non-PCI, pass the proper device struct pointer of the BUS
|
||||
instead. (In the case of legacy ISA without PnP, you don't have to do
|
||||
anything.)
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="pci-resource-entries">
|
||||
<title>PCI Entries</title>
|
||||
<para>
|
||||
|
@ -5740,7 +5721,8 @@ struct _snd_pcm_runtime {
|
|||
struct mychip *chip;
|
||||
int err;
|
||||
....
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
0, &card);
|
||||
....
|
||||
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
|
||||
....
|
||||
|
@ -5752,7 +5734,7 @@ struct _snd_pcm_runtime {
|
|||
</informalexample>
|
||||
|
||||
When you created the chip data with
|
||||
<function>snd_card_create()</function>, it's anyway accessible
|
||||
<function>snd_card_new()</function>, it's anyway accessible
|
||||
via <structfield>private_data</structfield> field.
|
||||
|
||||
<informalexample>
|
||||
|
@ -5766,8 +5748,8 @@ struct _snd_pcm_runtime {
|
|||
struct mychip *chip;
|
||||
int err;
|
||||
....
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
|
||||
sizeof(struct mychip), &card);
|
||||
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||
sizeof(struct mychip), &card);
|
||||
....
|
||||
chip = card->private_data;
|
||||
....
|
||||
|
|
|
@ -18,6 +18,7 @@ atmel,24c02 i2c serial eeprom (24cxx)
|
|||
atmel,at97sc3204t i2c trusted platform module (TPM)
|
||||
capella,cm32181 CM32181: Ambient Light Sensor
|
||||
catalyst,24c32 i2c serial eeprom
|
||||
cirrus,cs42l51 Cirrus Logic CS42L51 audio codec
|
||||
dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock
|
||||
dallas,ds1338 I2C RTC with 56-Byte NV RAM
|
||||
dallas,ds1339 I2C Serial Real-Time Clock
|
||||
|
|
|
@ -17,6 +17,14 @@ Required properties for devices compatible with "atmel,at91sam9g45-ssc":
|
|||
See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
|
||||
- dma-names: Must be "tx", "rx".
|
||||
|
||||
Optional properties:
|
||||
- atmel,clk-from-rk-pin: bool property.
|
||||
- When SSC works in slave mode, according to the hardware design, the
|
||||
clock can get from TK pin, and also can get from RK pin. So, add
|
||||
this parameter to choose where the clock from.
|
||||
- By default the clock is from TK pin, if the clock from RK pin, this
|
||||
property is needed.
|
||||
|
||||
Examples:
|
||||
- PDC transfer:
|
||||
ssc0: ssc@fffbc000 {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
Device Tree bindings for the Armada 370 DB audio
|
||||
================================================
|
||||
|
||||
These Device Tree bindings are used to describe the audio complex
|
||||
found on the Armada 370 DB platform.
|
||||
|
||||
Mandatory properties:
|
||||
|
||||
* compatible: must be "marvell,a370db-audio"
|
||||
|
||||
* marvell,audio-controller: a phandle that points to the audio
|
||||
controller of the Armada 370 SoC.
|
||||
|
||||
* marvell,audio-codec: a set of three phandles that points to:
|
||||
|
||||
1/ the analog audio codec connected to the Armada 370 SoC
|
||||
2/ the S/PDIF transceiver
|
||||
3/ the S/PDIF receiver
|
||||
|
||||
Example:
|
||||
|
||||
sound {
|
||||
compatible = "marvell,a370db-audio";
|
||||
marvell,audio-controller = <&audio_controller>;
|
||||
marvell,audio-codec = <&audio_codec &spdif_out &spdif_in>;
|
||||
status = "okay";
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
CS42448/CS42888 audio CODEC
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : must contain one of "cirrus,cs42448" and "cirrus,cs42888"
|
||||
|
||||
- reg : the I2C address of the device for I2C
|
||||
|
||||
- clocks : a list of phandles + clock-specifiers, one for each entry in
|
||||
clock-names
|
||||
|
||||
- clock-names : must contain "mclk"
|
||||
|
||||
- VA-supply, VD-supply, VLS-supply, VLC-supply: power supplies for the device,
|
||||
as covered in Documentation/devicetree/bindings/regulator/regulator.txt
|
||||
|
||||
Example:
|
||||
|
||||
codec: cs42888@48 {
|
||||
compatible = "cirrus,cs42888";
|
||||
reg = <0x48>;
|
||||
clocks = <&codec_mclk 0>;
|
||||
clock-names = "mclk";
|
||||
VA-supply = <®_audio>;
|
||||
VD-supply = <®_audio>;
|
||||
VLS-supply = <®_audio>;
|
||||
VLC-supply = <®_audio>;
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
* Dialog DA9055 Audio CODEC
|
||||
|
||||
DA9055 provides Audio CODEC support (I2C only).
|
||||
|
||||
The Audio CODEC device in DA9055 has it's own I2C address which is configurable,
|
||||
so the device is instantiated separately from the PMIC (MFD) device.
|
||||
|
||||
For details on accompanying PMIC I2C device, see the following:
|
||||
Documentation/devicetree/bindings/mfd/da9055.txt
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: "dlg,da9055-codec"
|
||||
- reg: Specifies the I2C slave address
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
codec: da9055-codec@1a {
|
||||
compatible = "dlg,da9055-codec";
|
||||
reg = <0x1a>;
|
||||
};
|
|
@ -5,12 +5,19 @@ Required properties:
|
|||
- ti,model : The user-visible name of this sound complex.
|
||||
- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
|
||||
- ti,mcasp-controller : The phandle of the McASP controller
|
||||
- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec
|
||||
- ti,audio-routing : A list of the connections between audio components.
|
||||
Each entry is a pair of strings, the first being the connection's sink,
|
||||
the second being the connection's source. Valid names for sources and
|
||||
sinks are the codec's pins, and the jacks on the board:
|
||||
|
||||
Optional properties:
|
||||
- ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec.
|
||||
- clocks : Reference to the master clock
|
||||
- clock-names : The clock should be named "mclk"
|
||||
- Either codec-clock-rate or the codec-clock reference has to be defined. If
|
||||
the both are defined the driver attempts to set referenced clock to the
|
||||
defined rate and takes the rate from the clock reference.
|
||||
|
||||
Board connectors:
|
||||
|
||||
* Headphone Jack
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
Audio complex for Eukrea boards with tlv320aic23 codec.
|
||||
|
||||
Required properties:
|
||||
- compatible : "eukrea,asoc-tlv320"
|
||||
- eukrea,model : The user-visible name of this sound complex.
|
||||
- ssi-controller : The phandle of the SSI controller.
|
||||
- fsl,mux-int-port : The internal port of the i.MX audio muxer (AUDMUX).
|
||||
- fsl,mux-ext-port : The external port of the i.MX audio muxer.
|
||||
|
||||
Note: The AUDMUX port numbering should start at 1, which is consistent with
|
||||
hardware manual.
|
||||
|
||||
Example:
|
||||
|
||||
sound {
|
||||
compatible = "eukrea,asoc-tlv320";
|
||||
eukrea,model = "imx51-eukrea-tlv320aic23";
|
||||
ssi-controller = <&ssi2>;
|
||||
fsl,mux-int-port = <2>;
|
||||
fsl,mux-ext-port = <3>;
|
||||
};
|
|
@ -34,6 +34,10 @@ Required properties:
|
|||
that ESAI would work in the synchronous mode, which means all the settings
|
||||
for Receiving would be duplicated from Transmition related registers.
|
||||
|
||||
- big-endian : If this property is absent, the native endian mode will
|
||||
be in use as default, or the big endian mode will be in use for all the
|
||||
device registers.
|
||||
|
||||
Example:
|
||||
|
||||
esai: esai@02024000 {
|
||||
|
@ -46,5 +50,6 @@ esai: esai@02024000 {
|
|||
dma-names = "rx", "tx";
|
||||
fsl,fifo-depth = <128>;
|
||||
fsl,esai-synchronous;
|
||||
big-endian;
|
||||
status = "disabled";
|
||||
};
|
||||
|
|
|
@ -29,6 +29,10 @@ Required properties:
|
|||
can also be referred to TxClk_Source
|
||||
bit of register SPDIF_STC.
|
||||
|
||||
- big-endian : If this property is absent, the native endian mode will
|
||||
be in use as default, or the big endian mode will be in use for all the
|
||||
device registers.
|
||||
|
||||
Example:
|
||||
|
||||
spdif: spdif@02004000 {
|
||||
|
@ -50,5 +54,6 @@ spdif: spdif@02004000 {
|
|||
"rxtx5", "rxtx6",
|
||||
"rxtx7";
|
||||
|
||||
big-endian;
|
||||
status = "okay";
|
||||
};
|
||||
|
|
|
@ -5,6 +5,7 @@ Required properties:
|
|||
- compatible:
|
||||
"marvell,kirkwood-audio" for Kirkwood platforms
|
||||
"marvell,dove-audio" for Dove platforms
|
||||
"marvell,armada370-audio" for Armada 370 platforms
|
||||
|
||||
- reg: physical base address of the controller and length of memory mapped
|
||||
region.
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
PCM512x audio CODECs
|
||||
|
||||
These devices support both I2C and SPI (configured with pin strapping
|
||||
on the board).
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : One of "ti,pcm5121" or "ti,pcm5122"
|
||||
|
||||
- reg : the I2C address of the device for I2C, the chip select
|
||||
number for SPI.
|
||||
|
||||
- AVDD-supply, DVDD-supply, and CPVDD-supply : power supplies for the
|
||||
device, as covered in bindings/regulator/regulator.txt
|
||||
|
||||
Optional properties:
|
||||
|
||||
- clocks : A clock specifier for the clock connected as SCLK. If this
|
||||
is absent the device will be configured to clock from BCLK.
|
||||
|
||||
Example:
|
||||
|
||||
pcm5122: pcm5122@4c {
|
||||
compatible = "ti,pcm5122";
|
||||
reg = <0x4c>;
|
||||
|
||||
AVDD-supply = <®_3v3_analog>;
|
||||
DVDD-supply = <®_1v8>;
|
||||
CPVDD-supply = <®_3v3>;
|
||||
};
|
|
@ -0,0 +1,105 @@
|
|||
Renesas R-Car sound
|
||||
|
||||
Required properties:
|
||||
- compatible : "renesas,rcar_sound-gen1" if generation1
|
||||
"renesas,rcar_sound-gen2" if generation2
|
||||
- reg : Should contain the register physical address.
|
||||
required register is
|
||||
SRU/ADG/SSI if generation1
|
||||
SRU/ADG/SSIU/SSI if generation2
|
||||
- rcar_sound,ssi : Should contain SSI feature.
|
||||
The number of SSI subnode should be same as HW.
|
||||
see below for detail.
|
||||
- rcar_sound,src : Should contain SRC feature.
|
||||
The number of SRC subnode should be same as HW.
|
||||
see below for detail.
|
||||
- rcar_sound,dai : DAI contents.
|
||||
The number of DAI subnode should be same as HW.
|
||||
see below for detail.
|
||||
|
||||
SSI subnode properties:
|
||||
- interrupts : Should contain SSI interrupt for PIO transfer
|
||||
- shared-pin : if shared clock pin
|
||||
|
||||
SRC subnode properties:
|
||||
no properties at this point
|
||||
|
||||
DAI subnode properties:
|
||||
- playback : list of playback modules
|
||||
- capture : list of capture modules
|
||||
|
||||
Example:
|
||||
|
||||
rcar_sound: rcar_sound@0xffd90000 {
|
||||
#sound-dai-cells = <1>;
|
||||
compatible = "renesas,rcar_sound-gen2";
|
||||
reg = <0 0xec500000 0 0x1000>, /* SCU */
|
||||
<0 0xec5a0000 0 0x100>, /* ADG */
|
||||
<0 0xec540000 0 0x1000>, /* SSIU */
|
||||
<0 0xec541000 0 0x1280>; /* SSI */
|
||||
|
||||
rcar_sound,src {
|
||||
src0: src@0 { };
|
||||
src1: src@1 { };
|
||||
src2: src@2 { };
|
||||
src3: src@3 { };
|
||||
src4: src@4 { };
|
||||
src5: src@5 { };
|
||||
src6: src@6 { };
|
||||
src7: src@7 { };
|
||||
src8: src@8 { };
|
||||
src9: src@9 { };
|
||||
};
|
||||
|
||||
rcar_sound,ssi {
|
||||
ssi0: ssi@0 {
|
||||
interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi1: ssi@1 {
|
||||
interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi2: ssi@2 {
|
||||
interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi3: ssi@3 {
|
||||
interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi4: ssi@4 {
|
||||
interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi5: ssi@5 {
|
||||
interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi6: ssi@6 {
|
||||
interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi7: ssi@7 {
|
||||
interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi8: ssi@8 {
|
||||
interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
ssi9: ssi@9 {
|
||||
interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
rcar_sound,dai {
|
||||
dai0 {
|
||||
playback = <&ssi5 &src5>;
|
||||
capture = <&ssi6>;
|
||||
};
|
||||
dai1 {
|
||||
playback = <&ssi3>;
|
||||
};
|
||||
dai2 {
|
||||
capture = <&ssi4>;
|
||||
};
|
||||
dai3 {
|
||||
playback = <&ssi7>;
|
||||
};
|
||||
dai4 {
|
||||
capture = <&ssi8>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -8,16 +8,26 @@ Required properties:
|
|||
|
||||
Optional properties:
|
||||
|
||||
- simple-audio-card,name : User specified audio sound card name, one string
|
||||
property.
|
||||
- simple-audio-card,format : CPU/CODEC common audio format.
|
||||
"i2s", "right_j", "left_j" , "dsp_a"
|
||||
"dsp_b", "ac97", "pdm", "msb", "lsb"
|
||||
- simple-audio-card,widgets : Please refer to widgets.txt.
|
||||
- simple-audio-card,routing : A list of the connections between audio components.
|
||||
Each entry is a pair of strings, the first being the
|
||||
connection's sink, the second being the connection's
|
||||
source.
|
||||
- dai-tdm-slot-num : Please refer to tdm-slot.txt.
|
||||
- dai-tdm-slot-width : Please refer to tdm-slot.txt.
|
||||
|
||||
Required subnodes:
|
||||
|
||||
- simple-audio-card,dai-link : container for the CPU and CODEC sub-nodes
|
||||
This container may be omitted when the
|
||||
card has only one DAI link.
|
||||
See the examples.
|
||||
|
||||
- simple-audio-card,cpu : CPU sub-node
|
||||
- simple-audio-card,codec : CODEC sub-node
|
||||
|
||||
|
@ -38,15 +48,29 @@ Optional CPU/CODEC subnodes properties:
|
|||
clock node (= common clock), or "system-clock-frequency"
|
||||
(if system doens't support common clock)
|
||||
|
||||
Example:
|
||||
Note:
|
||||
* For 'format', 'frame-master', 'bitclock-master', 'bitclock-inversion' and
|
||||
'frame-inversion', the simple card will use the settings of CODEC for both
|
||||
CPU and CODEC sides as we need to keep the settings identical for both ends
|
||||
of the link.
|
||||
|
||||
Example 1 - single DAI link:
|
||||
|
||||
sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,name = "VF610-Tower-Sound-Card";
|
||||
simple-audio-card,format = "left_j";
|
||||
simple-audio-card,widgets =
|
||||
"Microphone", "Microphone Jack",
|
||||
"Headphone", "Headphone Jack",
|
||||
"Speaker", "External Speaker";
|
||||
simple-audio-card,routing =
|
||||
"MIC_IN", "Mic Jack",
|
||||
"MIC_IN", "Microphone Jack",
|
||||
"Headphone Jack", "HP_OUT",
|
||||
"Ext Spk", "LINE_OUT";
|
||||
"External Speaker", "LINE_OUT";
|
||||
|
||||
dai-tdm-slot-num = <2>;
|
||||
dai-tdm-slot-width = <8>;
|
||||
|
||||
simple-audio-card,cpu {
|
||||
sound-dai = <&sh_fsi2 0>;
|
||||
|
@ -75,3 +99,38 @@ sh_fsi2: sh_fsi2@ec230000 {
|
|||
interrupt-parent = <&gic>;
|
||||
interrupts = <0 146 0x4>;
|
||||
};
|
||||
|
||||
Example 2 - many DAI links:
|
||||
|
||||
sound {
|
||||
compatible = "simple-audio-card";
|
||||
simple-audio-card,name = "Cubox Audio";
|
||||
simple-audio-card,format = "i2s";
|
||||
|
||||
simple-audio-card,dai-link@0 { /* I2S - HDMI */
|
||||
simple-audio-card,cpu {
|
||||
sound-dai = <&audio1 0>;
|
||||
};
|
||||
simple-audio-card,codec {
|
||||
sound-dai = <&tda998x 0>;
|
||||
};
|
||||
};
|
||||
|
||||
simple-audio-card,dai-link@1 { /* S/PDIF - HDMI */
|
||||
simple-audio-card,cpu {
|
||||
sound-dai = <&audio1 1>;
|
||||
};
|
||||
simple-audio-card,codec {
|
||||
sound-dai = <&tda998x 1>;
|
||||
};
|
||||
};
|
||||
|
||||
simple-audio-card,dai-link@2 { /* S/PDIF - S/PDIF */
|
||||
simple-audio-card,cpu {
|
||||
sound-dai = <&audio1 1>;
|
||||
};
|
||||
simple-audio-card,codec {
|
||||
sound-dai = <&spdif_codec>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
SiRF internal audio CODEC
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : "sirf,atlas6-audio-codec" or "sirf,prima2-audio-codec"
|
||||
|
||||
- reg : the register address of the device.
|
||||
|
||||
- clocks: the clock of SiRF internal audio codec
|
||||
|
||||
Example:
|
||||
|
||||
audiocodec: audiocodec@b0040000 {
|
||||
compatible = "sirf,atlas6-audio-codec";
|
||||
reg = <0xb0040000 0x10000>;
|
||||
clocks = <&clks 27>;
|
||||
};
|
|
@ -0,0 +1,20 @@
|
|||
* SiRF SoC audio port
|
||||
|
||||
Required properties:
|
||||
- compatible: "sirf,audio-port"
|
||||
- reg: Base address and size entries:
|
||||
- dmas: List of DMA controller phandle and DMA request line ordered pairs.
|
||||
- dma-names: Identifier string for each DMA request line in the dmas property.
|
||||
These strings correspond 1:1 with the ordered pairs in dmas.
|
||||
|
||||
One of the DMA channels will be responsible for transmission (should be
|
||||
named "tx") and one for reception (should be named "rx").
|
||||
|
||||
Example:
|
||||
|
||||
audioport: audioport@b0040000 {
|
||||
compatible = "sirf,audio-port";
|
||||
reg = <0xb0040000 0x10000>;
|
||||
dmas = <&dmac1 3>, <&dmac1 8>;
|
||||
dma-names = "rx", "tx";
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
* SiRF atlas6 and prima2 internal audio codec and port based audio setups
|
||||
|
||||
Required properties:
|
||||
- compatible: "sirf,sirf-audio-card"
|
||||
- sirf,audio-platform: phandle for the platform node
|
||||
- sirf,audio-codec: phandle for the SiRF internal codec node
|
||||
|
||||
Optional properties:
|
||||
- hp-pa-gpios: Need to be present if the board need control external
|
||||
headphone amplifier.
|
||||
- spk-pa-gpios: Need to be present if the board need control external
|
||||
speaker amplifier.
|
||||
- hp-switch-gpios: Need to be present if the board capable to detect jack
|
||||
insertion, removal.
|
||||
|
||||
Available audio endpoints for the audio-routing table:
|
||||
|
||||
Board connectors:
|
||||
* Headset Stereophone
|
||||
* Ext Spk
|
||||
* Line In
|
||||
* Mic
|
||||
|
||||
SiRF internal audio codec pins:
|
||||
* HPOUTL
|
||||
* HPOUTR
|
||||
* SPKOUT
|
||||
* Ext Mic
|
||||
* Mic Bias
|
||||
|
||||
Example:
|
||||
|
||||
sound {
|
||||
compatible = "sirf,sirf-audio-card";
|
||||
sirf,audio-codec = <&audiocodec>;
|
||||
sirf,audio-platform = <&audioport>;
|
||||
hp-pa-gpios = <&gpio 44 0>;
|
||||
spk-pa-gpios = <&gpio 46 0>;
|
||||
hp-switch-gpios = <&gpio 45 0>;
|
||||
};
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
TDM slot:
|
||||
|
||||
This specifies audio DAI's TDM slot.
|
||||
|
||||
TDM slot properties:
|
||||
dai-tdm-slot-num : Number of slots in use.
|
||||
dai-tdm-slot-width : Width in bits for each slot.
|
||||
|
||||
For instance:
|
||||
dai-tdm-slot-num = <2>;
|
||||
dai-tdm-slot-width = <8>;
|
||||
|
||||
And for each spcified driver, there could be one .of_xlate_tdm_slot_mask()
|
||||
to specify a explicit mapping of the channels and the slots. If it's absent
|
||||
the default snd_soc_of_xlate_tdm_slot_mask() will be used to generating the
|
||||
tx and rx masks.
|
||||
|
||||
For snd_soc_of_xlate_tdm_slot_mask(), the tx and rx masks will use a 1 bit
|
||||
for an active slot as default, and the default active bits are at the LSB of
|
||||
the masks.
|
|
@ -0,0 +1,61 @@
|
|||
Texas Instruments - tlv320aic31xx Codec module
|
||||
|
||||
The tlv320aic31xx serial control bus communicates through I2C protocols
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible - "string" - One of:
|
||||
"ti,tlv320aic310x" - Generic TLV320AIC31xx with mono speaker amp
|
||||
"ti,tlv320aic311x" - Generic TLV320AIC31xx with stereo speaker amp
|
||||
"ti,tlv320aic3100" - TLV320AIC3100 (mono speaker amp, no MiniDSP)
|
||||
"ti,tlv320aic3110" - TLV320AIC3110 (stereo speaker amp, no MiniDSP)
|
||||
"ti,tlv320aic3120" - TLV320AIC3120 (mono speaker amp, MiniDSP)
|
||||
"ti,tlv320aic3111" - TLV320AIC3111 (stereo speaker amp, MiniDSP)
|
||||
|
||||
- reg - <int> - I2C slave address
|
||||
|
||||
|
||||
Optional properties:
|
||||
|
||||
- gpio-reset - gpio pin number used for codec reset
|
||||
- ai31xx-micbias-vg - MicBias Voltage setting
|
||||
1 or MICBIAS_2_0V - MICBIAS output is powered to 2.0V
|
||||
2 or MICBIAS_2_5V - MICBIAS output is powered to 2.5V
|
||||
3 or MICBIAS_AVDD - MICBIAS output is connected to AVDD
|
||||
If this node is not mentioned or if the value is unknown, then
|
||||
micbias is set to 2.0V.
|
||||
- HPVDD-supply, SPRVDD-supply, SPLVDD-supply, AVDD-supply, IOVDD-supply,
|
||||
DVDD-supply : power supplies for the device as covered in
|
||||
Documentation/devicetree/bindings/regulator/regulator.txt
|
||||
|
||||
CODEC output pins:
|
||||
* HPL
|
||||
* HPR
|
||||
* SPL, devices with stereo speaker amp
|
||||
* SPR, devices with stereo speaker amp
|
||||
* SPK, devices with mono speaker amp
|
||||
* MICBIAS
|
||||
|
||||
CODEC input pins:
|
||||
* MIC1LP
|
||||
* MIC1RP
|
||||
* MIC1LM
|
||||
|
||||
The pins can be used in referring sound node's audio-routing property.
|
||||
|
||||
Example:
|
||||
#include <dt-bindings/sound/tlv320aic31xx-micbias.h>
|
||||
|
||||
tlv320aic31xx: tlv320aic31xx@18 {
|
||||
compatible = "ti,tlv320aic311x";
|
||||
reg = <0x18>;
|
||||
|
||||
ai31xx-micbias-vg = <MICBIAS_OFF>;
|
||||
|
||||
HPVDD-supply = <®ulator>;
|
||||
SPRVDD-supply = <®ulator>;
|
||||
SPLVDD-supply = <®ulator>;
|
||||
AVDD-supply = <®ulator>;
|
||||
IOVDD-supply = <®ulator>;
|
||||
DVDD-supply = <®ulator>;
|
||||
};
|
|
@ -0,0 +1,30 @@
|
|||
Texas Instruments - tlv320aic32x4 Codec module
|
||||
|
||||
The tlv320aic32x4 serial control bus communicates through I2C protocols
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be "ti,tlv320aic32x4"
|
||||
- reg: I2C slave address
|
||||
- supply-*: Required supply regulators are:
|
||||
"iov" - digital IO power supply
|
||||
"ldoin" - LDO power supply
|
||||
"dv" - Digital core power supply
|
||||
"av" - Analog core power supply
|
||||
If you supply ldoin, dv and av are optional. Otherwise they are required
|
||||
See regulator/regulator.txt for more information about the detailed binding
|
||||
format.
|
||||
|
||||
Optional properties:
|
||||
- reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt
|
||||
- clocks/clock-names: Clock named 'mclk' for the master clock of the codec.
|
||||
See clock/clock-bindings.txt for information about the detailed format.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
codec: tlv320aic32x4@18 {
|
||||
compatible = "ti,tlv320aic32x4";
|
||||
reg = <0x18>;
|
||||
clocks = <&clks 201>;
|
||||
clock-names = "mclk";
|
||||
};
|
|
@ -6,7 +6,6 @@ Required properties:
|
|||
|
||||
- compatible - "string" - One of:
|
||||
"ti,tlv320aic3x" - Generic TLV320AIC3x device
|
||||
"ti,tlv320aic32x4" - TLV320AIC32x4
|
||||
"ti,tlv320aic33" - TLV320AIC33
|
||||
"ti,tlv320aic3007" - TLV320AIC3007
|
||||
"ti,tlv320aic3106" - TLV320AIC3106
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
Widgets:
|
||||
|
||||
This mainly specifies audio off-codec DAPM widgets.
|
||||
|
||||
Each entry is a pair of strings in DT:
|
||||
|
||||
"template-wname", "user-supplied-wname"
|
||||
|
||||
The "template-wname" being the template widget name and currently includes:
|
||||
"Microphone", "Line", "Headphone" and "Speaker".
|
||||
|
||||
The "user-supplied-wname" being the user specified widget name.
|
||||
|
||||
For instance:
|
||||
simple-audio-widgets =
|
||||
"Microphone", "Microphone Jack",
|
||||
"Line", "Line In Jack",
|
||||
"Line", "Line Out Jack",
|
||||
"Headphone", "Headphone Jack",
|
||||
"Speaker", "Speaker External";
|
|
@ -2204,6 +2204,13 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
|
|||
S: Odd Fixes
|
||||
F: sound/soc/codecs/cs4270*
|
||||
|
||||
CIRRUS LOGIC AUDIO CODEC DRIVERS
|
||||
M: Brian Austin <brian.austin@cirrus.com>
|
||||
M: Paul Handrigan <Paul.Handrigan@cirrus.com>
|
||||
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
|
||||
S: Maintained
|
||||
F: sound/soc/codecs/cs*
|
||||
|
||||
CLEANCACHE API
|
||||
M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
L: linux-kernel@vger.kernel.org
|
||||
|
|
|
@ -988,14 +988,12 @@ static struct asoc_simple_card_info fsi_wm8978_info = {
|
|||
.card = "FSI2A-WM8978",
|
||||
.codec = "wm8978.0-001a",
|
||||
.platform = "sh_fsi2",
|
||||
.daifmt = SND_SOC_DAIFMT_I2S,
|
||||
.daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
|
||||
.cpu_dai = {
|
||||
.name = "fsia-dai",
|
||||
.fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "wm8978-hifi",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
|
||||
.sysclk = 12288000,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -429,14 +429,12 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
|||
.card = "SSI56-AK4643",
|
||||
.codec = "ak4642-codec.0-0012",
|
||||
.platform = "rcar_sound",
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||
.cpu_dai = {
|
||||
.name = "rsnd-dai.0",
|
||||
.fmt = SND_SOC_DAIFMT_CBS_CFS,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4642-hifi",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
||||
.sysclk = 11289600,
|
||||
},
|
||||
},
|
||||
|
@ -446,10 +444,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
|||
.card = "SSI3-AK4554(playback)",
|
||||
.codec = "ak4554-adc-dac.0",
|
||||
.platform = "rcar_sound",
|
||||
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_RIGHT_J,
|
||||
.cpu_dai = {
|
||||
.name = "rsnd-dai.1",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
||||
SND_SOC_DAIFMT_RIGHT_J,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4554-hifi",
|
||||
|
@ -461,10 +458,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
|||
.card = "SSI4-AK4554(capture)",
|
||||
.codec = "ak4554-adc-dac.0",
|
||||
.platform = "rcar_sound",
|
||||
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_LEFT_J,
|
||||
.cpu_dai = {
|
||||
.name = "rsnd-dai.2",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
||||
SND_SOC_DAIFMT_LEFT_J,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4554-hifi",
|
||||
|
@ -476,10 +472,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
|||
.card = "SSI7-AK4554(playback)",
|
||||
.codec = "ak4554-adc-dac.1",
|
||||
.platform = "rcar_sound",
|
||||
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_RIGHT_J,
|
||||
.cpu_dai = {
|
||||
.name = "rsnd-dai.3",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
||||
SND_SOC_DAIFMT_RIGHT_J,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4554-hifi",
|
||||
|
@ -491,10 +486,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
|||
.card = "SSI8-AK4554(capture)",
|
||||
.codec = "ak4554-adc-dac.1",
|
||||
.platform = "rcar_sound",
|
||||
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_LEFT_J,
|
||||
.cpu_dai = {
|
||||
.name = "rsnd-dai.4",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
||||
SND_SOC_DAIFMT_LEFT_J,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4554-hifi",
|
||||
|
|
|
@ -589,14 +589,12 @@ static struct asoc_simple_card_info fsi2_ak4648_info = {
|
|||
.card = "FSI2A-AK4648",
|
||||
.codec = "ak4642-codec.0-0012",
|
||||
.platform = "sh_fsi2",
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||
.cpu_dai = {
|
||||
.name = "fsia-dai",
|
||||
.fmt = SND_SOC_DAIFMT_CBS_CFS,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4642-hifi",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
||||
.sysclk = 11289600,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -509,9 +509,9 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
|
|||
.card = "FSI2B-HDMI",
|
||||
.codec = "sh-mobile-hdmi",
|
||||
.platform = "sh_fsi2",
|
||||
.daifmt = SND_SOC_DAIFMT_CBS_CFS,
|
||||
.cpu_dai = {
|
||||
.name = "fsib-dai",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "sh_mobile_hdmi-hifi",
|
||||
|
@ -905,14 +905,12 @@ static struct asoc_simple_card_info fsi2_ak4643_info = {
|
|||
.card = "FSI2A-AK4643",
|
||||
.codec = "ak4642-codec.0-0013",
|
||||
.platform = "sh_fsi2",
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||
.cpu_dai = {
|
||||
.name = "fsia-dai",
|
||||
.fmt = SND_SOC_DAIFMT_CBS_CFS,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4642-hifi",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
||||
.sysclk = 11289600,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -861,14 +861,12 @@ static struct asoc_simple_card_info fsi_da7210_info = {
|
|||
.card = "FSIB-DA7210",
|
||||
.codec = "da7210.0-001a",
|
||||
.platform = "sh_fsi.0",
|
||||
.daifmt = SND_SOC_DAIFMT_I2S,
|
||||
.daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
|
||||
.cpu_dai = {
|
||||
.name = "fsib-dai",
|
||||
.fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "da7210-hifi",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -304,14 +304,12 @@ static struct asoc_simple_card_info fsi_ak4642_info = {
|
|||
.card = "FSIA-AK4642",
|
||||
.codec = "ak4642-codec.0-0012",
|
||||
.platform = "sh_fsi.0",
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
||||
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||
.cpu_dai = {
|
||||
.name = "fsia-dai",
|
||||
.fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
|
||||
},
|
||||
.codec_dai = {
|
||||
.name = "ak4642-hifi",
|
||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
||||
.sysclk = 11289600,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -624,7 +624,8 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
|
|||
|
||||
/* Setup sound card */
|
||||
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&pm->pk->hdev->dev, index[dev], id[dev],
|
||||
THIS_MODULE, 0, &card);
|
||||
if (err < 0) {
|
||||
pk_error("failed to create pc-midi sound card\n");
|
||||
err = -ENOMEM;
|
||||
|
@ -660,8 +661,6 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
|
|||
snd_rawmidi_set_ops(rwmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
||||
&pcmidi_in_ops);
|
||||
|
||||
snd_card_set_dev(card, &pm->pk->hdev->dev);
|
||||
|
||||
/* create sysfs variables */
|
||||
err = device_create_file(&pm->pk->hdev->dev,
|
||||
sysfs_device_attr_channel);
|
||||
|
|
|
@ -145,11 +145,12 @@ static int snd_cx18_init(struct v4l2_device *v4l2_dev)
|
|||
/* This is a no-op for us. We'll use the cx->instance */
|
||||
|
||||
/* (2) Create a card instance */
|
||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||
THIS_MODULE, 0, &sc);
|
||||
ret = snd_card_new(&cx->pci_dev->dev,
|
||||
SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||
THIS_MODULE, 0, &sc);
|
||||
if (ret) {
|
||||
CX18_ALSA_ERR("%s: snd_card_create() failed with err %d\n",
|
||||
CX18_ALSA_ERR("%s: snd_card_new() failed with err %d\n",
|
||||
__func__, ret);
|
||||
goto err_exit;
|
||||
}
|
||||
|
|
|
@ -489,7 +489,8 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
err = snd_card_new(&dev->pci->dev,
|
||||
SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
@ -500,8 +501,6 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
|
|||
chip->card = card;
|
||||
spin_lock_init(&chip->lock);
|
||||
|
||||
snd_card_set_dev(card, &dev->pci->dev);
|
||||
|
||||
err = snd_cx23885_pcm(chip, 0, "CX23885 Digital");
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
|
|
@ -645,8 +645,9 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
err = snd_card_create(index[devno], id[devno], THIS_MODULE,
|
||||
sizeof(struct cx25821_audio_dev), &card);
|
||||
err = snd_card_new(&dev->pci->dev, index[devno], id[devno],
|
||||
THIS_MODULE,
|
||||
sizeof(struct cx25821_audio_dev), &card);
|
||||
if (err < 0) {
|
||||
pr_info("DEBUG ERROR: cannot create snd_card_new in %s\n",
|
||||
__func__);
|
||||
|
@ -682,8 +683,6 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
|
|||
goto error;
|
||||
}
|
||||
|
||||
snd_card_set_dev(card, &chip->pci->dev);
|
||||
|
||||
strcpy(card->shortname, "cx25821");
|
||||
sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name,
|
||||
chip->iobase, chip->irq);
|
||||
|
|
|
@ -852,8 +852,6 @@ static int snd_cx88_create(struct snd_card *card, struct pci_dev *pci,
|
|||
chip->irq = pci->irq;
|
||||
synchronize_irq(chip->irq);
|
||||
|
||||
snd_card_set_dev(card, &pci->dev);
|
||||
|
||||
*rchip = chip;
|
||||
*core_ptr = core;
|
||||
|
||||
|
@ -876,8 +874,8 @@ static int cx88_audio_initdev(struct pci_dev *pci,
|
|||
return (-ENOENT);
|
||||
}
|
||||
|
||||
err = snd_card_create(index[devno], id[devno], THIS_MODULE,
|
||||
sizeof(snd_cx88_card_t), &card);
|
||||
err = snd_card_new(&pci->dev, index[devno], id[devno], THIS_MODULE,
|
||||
sizeof(snd_cx88_card_t), &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -145,11 +145,12 @@ static int snd_ivtv_init(struct v4l2_device *v4l2_dev)
|
|||
/* This is a no-op for us. We'll use the itv->instance */
|
||||
|
||||
/* (2) Create a card instance */
|
||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||
THIS_MODULE, 0, &sc);
|
||||
ret = snd_card_new(&itv->pdev->dev,
|
||||
SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||
THIS_MODULE, 0, &sc);
|
||||
if (ret) {
|
||||
IVTV_ALSA_ERR("%s: snd_card_create() failed with err %d\n",
|
||||
IVTV_ALSA_ERR("%s: snd_card_new() failed with err %d\n",
|
||||
__func__, ret);
|
||||
goto err_exit;
|
||||
}
|
||||
|
|
|
@ -1072,8 +1072,8 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
|
|||
if (!enable[devnum])
|
||||
return -ENODEV;
|
||||
|
||||
err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
|
||||
sizeof(snd_card_saa7134_t), &card);
|
||||
err = snd_card_new(&dev->pci->dev, index[devnum], id[devnum],
|
||||
THIS_MODULE, sizeof(snd_card_saa7134_t), &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -1115,8 +1115,6 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
|
|||
if ((err = snd_card_saa7134_pcm(chip, 0)) < 0)
|
||||
goto __nodev;
|
||||
|
||||
snd_card_set_dev(card, &chip->pci->dev);
|
||||
|
||||
/* End of "creation" */
|
||||
|
||||
strcpy(card->shortname, "SAA7134");
|
||||
|
|
|
@ -665,8 +665,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
|
|||
cx231xx_info("cx231xx-audio.c: probing for cx231xx "
|
||||
"non standard usbaudio\n");
|
||||
|
||||
err = snd_card_create(index[devnr], "Cx231xx Audio", THIS_MODULE,
|
||||
0, &card);
|
||||
err = snd_card_new(&dev->udev->dev, index[devnr], "Cx231xx Audio",
|
||||
THIS_MODULE, 0, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -682,7 +682,6 @@ static int cx231xx_audio_init(struct cx231xx *dev)
|
|||
pcm->info_flags = 0;
|
||||
pcm->private_data = dev;
|
||||
strcpy(pcm->name, "Conexant cx231xx Capture");
|
||||
snd_card_set_dev(card, &dev->udev->dev);
|
||||
strcpy(card->driver, "Cx231xx-Audio");
|
||||
strcpy(card->shortname, "Cx231xx Audio");
|
||||
strcpy(card->longname, "Conexant cx231xx Audio");
|
||||
|
|
|
@ -900,8 +900,8 @@ static int em28xx_audio_init(struct em28xx *dev)
|
|||
printk(KERN_INFO
|
||||
"em28xx-audio.c: Copyright (C) 2007-2014 Mauro Carvalho Chehab\n");
|
||||
|
||||
err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0,
|
||||
&card);
|
||||
err = snd_card_new(&dev->udev->dev, index[devnr], "Em28xx Audio",
|
||||
THIS_MODULE, 0, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -918,7 +918,6 @@ static int em28xx_audio_init(struct em28xx *dev)
|
|||
pcm->private_data = dev;
|
||||
strcpy(pcm->name, "Empia 28xx Capture");
|
||||
|
||||
snd_card_set_dev(card, &dev->udev->dev);
|
||||
strcpy(card->driver, "Em28xx-Audio");
|
||||
strcpy(card->shortname, "Em28xx Audio");
|
||||
strcpy(card->longname, "Empia Em28xx Audio");
|
||||
|
|
|
@ -98,13 +98,11 @@ int stk1160_ac97_register(struct stk1160 *dev)
|
|||
* Just want a card to access ac96 controls,
|
||||
* the actual capture interface will be handled by snd-usb-audio
|
||||
*/
|
||||
rc = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, 0, &card);
|
||||
rc = snd_card_new(dev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, 0, &card);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
snd_card_set_dev(card, dev->dev);
|
||||
|
||||
/* TODO: I'm not sure where should I get these names :-( */
|
||||
snprintf(card->shortname, sizeof(card->shortname),
|
||||
"stk1160-mixer");
|
||||
|
|
|
@ -300,7 +300,8 @@ int poseidon_audio_init(struct poseidon *p)
|
|||
struct snd_pcm *pcm;
|
||||
int ret;
|
||||
|
||||
ret = snd_card_create(-1, "Telegent", THIS_MODULE, 0, &card);
|
||||
ret = snd_card_new(&p->interface->dev, -1, "Telegent",
|
||||
THIS_MODULE, 0, &card);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -431,7 +431,8 @@ static int tm6000_audio_init(struct tm6000_core *dev)
|
|||
if (!enable[devnr])
|
||||
return -ENOENT;
|
||||
|
||||
rc = snd_card_create(index[devnr], "tm6000", THIS_MODULE, 0, &card);
|
||||
rc = snd_card_new(&dev->udev->dev, index[devnr], "tm6000",
|
||||
THIS_MODULE, 0, &card);
|
||||
if (rc < 0) {
|
||||
snd_printk(KERN_ERR "cannot create card instance %d\n", devnr);
|
||||
return rc;
|
||||
|
@ -445,7 +446,6 @@ static int tm6000_audio_init(struct tm6000_core *dev)
|
|||
le16_to_cpu(dev->udev->descriptor.idVendor),
|
||||
le16_to_cpu(dev->udev->descriptor.idProduct));
|
||||
snd_component_add(card, component);
|
||||
snd_card_set_dev(card, &dev->udev->dev);
|
||||
|
||||
chip = kzalloc(sizeof(struct snd_tm6000_card), GFP_KERNEL);
|
||||
if (!chip) {
|
||||
|
|
|
@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev)
|
|||
return -ENODEV;
|
||||
ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
ssc->clk_from_rk_pin =
|
||||
of_property_read_bool(np, "atmel,clk-from-rk-pin");
|
||||
}
|
||||
|
||||
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
|
||||
if (IS_ERR(ssc->regs))
|
||||
|
|
|
@ -6776,8 +6776,9 @@ static int __init volume_create_alsa_mixer(void)
|
|||
struct snd_kcontrol *ctl_mute;
|
||||
int rc;
|
||||
|
||||
rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,
|
||||
sizeof(struct tpacpi_alsa_data), &card);
|
||||
rc = snd_card_new(&tpacpi_pdev->dev,
|
||||
alsa_index, alsa_id, THIS_MODULE,
|
||||
sizeof(struct tpacpi_alsa_data), &card);
|
||||
if (rc < 0 || !card) {
|
||||
pr_err("Failed to create ALSA card structures: %d\n", rc);
|
||||
return 1;
|
||||
|
@ -6828,7 +6829,6 @@ static int __init volume_create_alsa_mixer(void)
|
|||
}
|
||||
data->ctl_mute_id = &ctl_mute->id;
|
||||
|
||||
snd_card_set_dev(card, &tpacpi_pdev->dev);
|
||||
rc = snd_card_register(card);
|
||||
if (rc < 0) {
|
||||
pr_err("Failed to register ALSA card: %d\n", rc);
|
||||
|
|
|
@ -24,8 +24,9 @@ int line6_init_audio(struct usb_line6 *line6)
|
|||
struct snd_card *card;
|
||||
int err;
|
||||
|
||||
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(line6->ifcdev,
|
||||
SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, 0, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
|
|
@ -307,8 +307,6 @@ int line6_init_midi(struct usb_line6 *line6)
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
snd_card_set_dev(line6->card, line6->ifcdev);
|
||||
|
||||
err = snd_line6_new_midi(line6midi);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
|
@ -501,8 +501,6 @@ int line6_init_pcm(struct usb_line6 *line6,
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
snd_card_set_dev(line6->card, line6->ifcdev);
|
||||
|
||||
err = snd_line6_new_pcm(line6pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
|
@ -245,8 +245,8 @@ int go7007_snd_init(struct go7007 *go)
|
|||
spin_lock_init(&gosnd->lock);
|
||||
gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
|
||||
gosnd->capturing = 0;
|
||||
ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0,
|
||||
&gosnd->card);
|
||||
ret = snd_card_new(go->dev, index[dev], id[dev], THIS_MODULE, 0,
|
||||
&gosnd->card);
|
||||
if (ret < 0) {
|
||||
kfree(gosnd);
|
||||
return ret;
|
||||
|
@ -257,7 +257,6 @@ int go7007_snd_init(struct go7007 *go)
|
|||
kfree(gosnd);
|
||||
return ret;
|
||||
}
|
||||
snd_card_set_dev(gosnd->card, go->dev);
|
||||
ret = snd_pcm_new(gosnd->card, "go7007", 0, 0, 1, &gosnd->pcm);
|
||||
if (ret < 0) {
|
||||
snd_card_free(gosnd->card);
|
||||
|
|
|
@ -366,8 +366,9 @@ int solo_g723_init(struct solo_dev *solo_dev)
|
|||
/* Allows for easier mapping between video and audio */
|
||||
sprintf(name, "Softlogic%d", solo_dev->vfd->num);
|
||||
|
||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, name, THIS_MODULE, 0,
|
||||
&solo_dev->snd_card);
|
||||
ret = snd_card_new(&solo_dev->pdev->dev,
|
||||
SNDRV_DEFAULT_IDX1, name, THIS_MODULE, 0,
|
||||
&solo_dev->snd_card);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
@ -377,7 +378,6 @@ int solo_g723_init(struct solo_dev *solo_dev)
|
|||
strcpy(card->shortname, "SOLO-6x10 Audio");
|
||||
sprintf(card->longname, "%s on %s IRQ %d", card->shortname,
|
||||
pci_name(solo_dev->pdev), solo_dev->pdev->irq);
|
||||
snd_card_set_dev(card, &solo_dev->pdev->dev);
|
||||
|
||||
ret = snd_device_new(card, SNDRV_DEV_LOWLEVEL, solo_dev, &ops);
|
||||
if (ret < 0)
|
||||
|
|
|
@ -664,9 +664,10 @@ static int f_midi_register_card(struct f_midi *midi)
|
|||
.dev_free = f_midi_snd_free,
|
||||
};
|
||||
|
||||
err = snd_card_create(midi->index, midi->id, THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&midi->gadget->dev, midi->index, midi->id,
|
||||
THIS_MODULE, 0, &card);
|
||||
if (err < 0) {
|
||||
ERROR(midi, "snd_card_create() failed\n");
|
||||
ERROR(midi, "snd_card_new() failed\n");
|
||||
goto fail;
|
||||
}
|
||||
midi->card = card;
|
||||
|
@ -703,8 +704,6 @@ static int f_midi_register_card(struct f_midi *midi)
|
|||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &gmidi_in_ops);
|
||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &gmidi_out_ops);
|
||||
|
||||
snd_card_set_dev(card, &midi->gadget->dev);
|
||||
|
||||
/* register it - we're ready to go */
|
||||
err = snd_card_register(card);
|
||||
if (err < 0) {
|
||||
|
|
|
@ -394,7 +394,7 @@ static int snd_uac2_probe(struct platform_device *pdev)
|
|||
int err;
|
||||
|
||||
/* Choose any slot, with no id */
|
||||
err = snd_card_create(-1, NULL, THIS_MODULE, 0, &card);
|
||||
err = snd_card_new(&pdev->dev, -1, NULL, THIS_MODULE, 0, &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
@ -421,8 +421,6 @@ static int snd_uac2_probe(struct platform_device *pdev)
|
|||
strcpy(card->shortname, "UAC2_Gadget");
|
||||
sprintf(card->longname, "UAC2_Gadget %i", pdev->id);
|
||||
|
||||
snd_card_set_dev(card, &pdev->dev);
|
||||
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
|
||||
snd_dma_continuous_data(GFP_KERNEL), 0, BUFF_SIZE_MAX);
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef __DT_TLV320AIC31XX_MICBIAS_H
|
||||
#define __DT_TLV320AIC31XX_MICBIAS_H
|
||||
|
||||
#define MICBIAS_2_0V 1
|
||||
#define MICBIAS_2_5V 2
|
||||
#define MICBIAS_AVDDV 3
|
||||
|
||||
#endif /* __DT_TLV320AIC31XX_MICBIAS_H */
|
|
@ -18,6 +18,7 @@ struct ssc_device {
|
|||
struct clk *clk;
|
||||
int user;
|
||||
int irq;
|
||||
bool clk_from_rk_pin;
|
||||
};
|
||||
|
||||
struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
|
||||
|
|
|
@ -1702,9 +1702,9 @@
|
|||
/*
|
||||
* R373 (0x175) - FLL1 Control 5
|
||||
*/
|
||||
#define ARIZONA_FLL1_FRATIO_MASK 0x0700 /* FLL1_FRATIO - [10:8] */
|
||||
#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [10:8] */
|
||||
#define ARIZONA_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [10:8] */
|
||||
#define ARIZONA_FLL1_FRATIO_MASK 0x0F00 /* FLL1_FRATIO - [11:8] */
|
||||
#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [11:8] */
|
||||
#define ARIZONA_FLL1_FRATIO_WIDTH 4 /* FLL1_FRATIO - [11:8] */
|
||||
#define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */
|
||||
#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */
|
||||
#define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* ADAU1977/ADAU1978/ADAU1979 driver
|
||||
*
|
||||
* Copyright 2014 Analog Devices Inc.
|
||||
* Author: Lars-Peter Clausen <lars@metafoo.de>
|
||||
*
|
||||
* Licensed under the GPL-2.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_PLATFORM_DATA_ADAU1977_H__
|
||||
#define __LINUX_PLATFORM_DATA_ADAU1977_H__
|
||||
|
||||
/**
|
||||
* enum adau1977_micbias - ADAU1977 MICBIAS pin voltage setting
|
||||
* @ADAU1977_MICBIAS_5V0: MICBIAS is set to 5.0 V
|
||||
* @ADAU1977_MICBIAS_5V5: MICBIAS is set to 5.5 V
|
||||
* @ADAU1977_MICBIAS_6V0: MICBIAS is set to 6.0 V
|
||||
* @ADAU1977_MICBIAS_6V5: MICBIAS is set to 6.5 V
|
||||
* @ADAU1977_MICBIAS_7V0: MICBIAS is set to 7.0 V
|
||||
* @ADAU1977_MICBIAS_7V5: MICBIAS is set to 7.5 V
|
||||
* @ADAU1977_MICBIAS_8V0: MICBIAS is set to 8.0 V
|
||||
* @ADAU1977_MICBIAS_8V5: MICBIAS is set to 8.5 V
|
||||
* @ADAU1977_MICBIAS_9V0: MICBIAS is set to 9.0 V
|
||||
*/
|
||||
enum adau1977_micbias {
|
||||
ADAU1977_MICBIAS_5V0 = 0x0,
|
||||
ADAU1977_MICBIAS_5V5 = 0x1,
|
||||
ADAU1977_MICBIAS_6V0 = 0x2,
|
||||
ADAU1977_MICBIAS_6V5 = 0x3,
|
||||
ADAU1977_MICBIAS_7V0 = 0x4,
|
||||
ADAU1977_MICBIAS_7V5 = 0x5,
|
||||
ADAU1977_MICBIAS_8V0 = 0x6,
|
||||
ADAU1977_MICBIAS_8V5 = 0x7,
|
||||
ADAU1977_MICBIAS_9V0 = 0x8,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct adau1977_platform_data - Platform configuration data for the ADAU1977
|
||||
* @micbias: Specifies the voltage for the MICBIAS pin
|
||||
*/
|
||||
struct adau1977_platform_data {
|
||||
enum adau1977_micbias micbias;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,5 +1,4 @@
|
|||
/* arch/arm/plat-samsung/include/plat/audio.h
|
||||
*
|
||||
/*
|
||||
* Copyright (c) 2009 Samsung Electronics Co. Ltd
|
||||
* Author: Jaswinder Singh <jassi.brar@samsung.com>
|
||||
*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/* arch/arm/plat-samsung/include/plat/audio-simtec.h
|
||||
*
|
||||
/*
|
||||
* Copyright 2008 Simtec Electronics
|
||||
* http://armlinux.simtec.co.uk/
|
||||
* Ben Dooks <ben@simtec.co.uk>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include <linux/genalloc.h>
|
||||
|
||||
struct snd_platform_data {
|
||||
struct davinci_mcasp_pdata {
|
||||
u32 tx_dma_offset;
|
||||
u32 rx_dma_offset;
|
||||
int asp_chan_q; /* event queue number for ASP channel */
|
||||
|
@ -87,6 +87,8 @@ struct snd_platform_data {
|
|||
int tx_dma_channel;
|
||||
int rx_dma_channel;
|
||||
};
|
||||
/* TODO: Fix arch/arm/mach-davinci/ users and remove this define */
|
||||
#define snd_platform_data davinci_mcasp_pdata
|
||||
|
||||
enum {
|
||||
MCASP_VERSION_1 = 0, /* DM646x */
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/sched.h> /* wake_up() */
|
||||
#include <linux/mutex.h> /* struct mutex */
|
||||
#include <linux/rwsem.h> /* struct rw_semaphore */
|
||||
|
@ -41,39 +42,33 @@
|
|||
/* forward declarations */
|
||||
struct pci_dev;
|
||||
struct module;
|
||||
struct device;
|
||||
struct device_attribute;
|
||||
struct completion;
|
||||
|
||||
/* device allocation stuff */
|
||||
|
||||
#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000
|
||||
/* type of the object used in snd_device_*()
|
||||
* this also defines the calling order
|
||||
*/
|
||||
enum snd_device_type {
|
||||
SNDRV_DEV_LOWLEVEL,
|
||||
SNDRV_DEV_CONTROL,
|
||||
SNDRV_DEV_INFO,
|
||||
SNDRV_DEV_BUS,
|
||||
SNDRV_DEV_CODEC,
|
||||
SNDRV_DEV_PCM,
|
||||
SNDRV_DEV_COMPRESS,
|
||||
SNDRV_DEV_RAWMIDI,
|
||||
SNDRV_DEV_TIMER,
|
||||
SNDRV_DEV_SEQUENCER,
|
||||
SNDRV_DEV_HWDEP,
|
||||
SNDRV_DEV_JACK,
|
||||
};
|
||||
|
||||
typedef int __bitwise snd_device_type_t;
|
||||
#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)
|
||||
#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1)
|
||||
#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2)
|
||||
#define SNDRV_DEV_LOWLEVEL_NORMAL ((__force snd_device_type_t) 0x1000)
|
||||
#define SNDRV_DEV_PCM ((__force snd_device_type_t) 0x1001)
|
||||
#define SNDRV_DEV_RAWMIDI ((__force snd_device_type_t) 0x1002)
|
||||
#define SNDRV_DEV_TIMER ((__force snd_device_type_t) 0x1003)
|
||||
#define SNDRV_DEV_SEQUENCER ((__force snd_device_type_t) 0x1004)
|
||||
#define SNDRV_DEV_HWDEP ((__force snd_device_type_t) 0x1005)
|
||||
#define SNDRV_DEV_INFO ((__force snd_device_type_t) 0x1006)
|
||||
#define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007)
|
||||
#define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008)
|
||||
#define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009)
|
||||
#define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A)
|
||||
#define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000)
|
||||
|
||||
typedef int __bitwise snd_device_state_t;
|
||||
#define SNDRV_DEV_BUILD ((__force snd_device_state_t) 0)
|
||||
#define SNDRV_DEV_REGISTERED ((__force snd_device_state_t) 1)
|
||||
#define SNDRV_DEV_DISCONNECTED ((__force snd_device_state_t) 2)
|
||||
|
||||
typedef int __bitwise snd_device_cmd_t;
|
||||
#define SNDRV_DEV_CMD_PRE ((__force snd_device_cmd_t) 0)
|
||||
#define SNDRV_DEV_CMD_NORMAL ((__force snd_device_cmd_t) 1)
|
||||
#define SNDRV_DEV_CMD_POST ((__force snd_device_cmd_t) 2)
|
||||
enum snd_device_state {
|
||||
SNDRV_DEV_BUILD,
|
||||
SNDRV_DEV_REGISTERED,
|
||||
SNDRV_DEV_DISCONNECTED,
|
||||
};
|
||||
|
||||
struct snd_device;
|
||||
|
||||
|
@ -86,8 +81,8 @@ struct snd_device_ops {
|
|||
struct snd_device {
|
||||
struct list_head list; /* list of registered devices */
|
||||
struct snd_card *card; /* card which holds this device */
|
||||
snd_device_state_t state; /* state of the device */
|
||||
snd_device_type_t type; /* device type */
|
||||
enum snd_device_state state; /* state of the device */
|
||||
enum snd_device_type type; /* device type */
|
||||
void *device_data; /* device structure */
|
||||
struct snd_device_ops *ops; /* operations */
|
||||
};
|
||||
|
@ -131,11 +126,10 @@ struct snd_card {
|
|||
state */
|
||||
spinlock_t files_lock; /* lock the files for this card */
|
||||
int shutdown; /* this card is going down */
|
||||
int free_on_last_close; /* free in context of file_release */
|
||||
wait_queue_head_t shutdown_sleep;
|
||||
atomic_t refcount; /* refcount for disconnection */
|
||||
struct completion *release_completion;
|
||||
struct device *dev; /* device assigned to this card */
|
||||
struct device *card_dev; /* cardX object for sysfs */
|
||||
struct device card_dev; /* cardX object for sysfs */
|
||||
bool registered; /* card_dev is registered? */
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
unsigned int power_state; /* power state */
|
||||
|
@ -149,6 +143,8 @@ struct snd_card {
|
|||
#endif
|
||||
};
|
||||
|
||||
#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev)
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static inline void snd_power_lock(struct snd_card *card)
|
||||
{
|
||||
|
@ -197,7 +193,7 @@ struct snd_minor {
|
|||
/* return a device pointer linked to each sound device as a parent */
|
||||
static inline struct device *snd_card_get_device_link(struct snd_card *card)
|
||||
{
|
||||
return card ? card->card_dev : NULL;
|
||||
return card ? &card->card_dev : NULL;
|
||||
}
|
||||
|
||||
/* sound.c */
|
||||
|
@ -244,13 +240,11 @@ static inline int snd_register_device(int type, struct snd_card *card, int dev,
|
|||
|
||||
int snd_unregister_device(int type, struct snd_card *card, int dev);
|
||||
void *snd_lookup_minor_data(unsigned int minor, int type);
|
||||
int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
|
||||
struct device_attribute *attr);
|
||||
struct device *snd_get_device(int type, struct snd_card *card, int dev);
|
||||
|
||||
#ifdef CONFIG_SND_OSSEMUL
|
||||
int snd_register_oss_device(int type, struct snd_card *card, int dev,
|
||||
const struct file_operations *f_ops, void *private_data,
|
||||
const char *name);
|
||||
const struct file_operations *f_ops, void *private_data);
|
||||
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
|
||||
void *snd_lookup_oss_minor_data(unsigned int minor, int type);
|
||||
#endif
|
||||
|
@ -284,9 +278,16 @@ int snd_card_locked(int card);
|
|||
extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
|
||||
#endif
|
||||
|
||||
int snd_card_create(int idx, const char *id,
|
||||
struct module *module, int extra_size,
|
||||
struct snd_card **card_ret);
|
||||
int snd_card_new(struct device *parent, int idx, const char *xid,
|
||||
struct module *module, int extra_size,
|
||||
struct snd_card **card_ret);
|
||||
|
||||
static inline int __deprecated
|
||||
snd_card_create(int idx, const char *id, struct module *module, int extra_size,
|
||||
struct snd_card **ret)
|
||||
{
|
||||
return snd_card_new(NULL, idx, id, module, extra_size, ret);
|
||||
}
|
||||
|
||||
int snd_card_disconnect(struct snd_card *card);
|
||||
int snd_card_free(struct snd_card *card);
|
||||
|
@ -298,20 +299,19 @@ int snd_card_info_done(void);
|
|||
int snd_component_add(struct snd_card *card, const char *component);
|
||||
int snd_card_file_add(struct snd_card *card, struct file *file);
|
||||
int snd_card_file_remove(struct snd_card *card, struct file *file);
|
||||
void snd_card_unref(struct snd_card *card);
|
||||
#define snd_card_unref(card) put_device(&(card)->card_dev)
|
||||
|
||||
#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
|
||||
|
||||
/* device.c */
|
||||
|
||||
int snd_device_new(struct snd_card *card, snd_device_type_t type,
|
||||
int snd_device_new(struct snd_card *card, enum snd_device_type type,
|
||||
void *device_data, struct snd_device_ops *ops);
|
||||
int snd_device_register(struct snd_card *card, void *device_data);
|
||||
int snd_device_register_all(struct snd_card *card);
|
||||
int snd_device_disconnect(struct snd_card *card, void *device_data);
|
||||
int snd_device_disconnect_all(struct snd_card *card);
|
||||
int snd_device_free(struct snd_card *card, void *device_data);
|
||||
int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd);
|
||||
void snd_device_free(struct snd_card *card, void *device_data);
|
||||
void snd_device_free_all(struct snd_card *card);
|
||||
|
||||
/* isadma.c */
|
||||
|
||||
|
@ -433,7 +433,6 @@ static inline void snd_printdd(const char *format, ...) {}
|
|||
#define gameport_get_port_data(gp) (gp)->port_data
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
/* PCI quirk list helper */
|
||||
struct snd_pci_quirk {
|
||||
unsigned short subvendor; /* PCI subvendor ID */
|
||||
|
@ -469,12 +468,26 @@ struct snd_pci_quirk {
|
|||
#define snd_pci_quirk_name(q) ""
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PCI
|
||||
const struct snd_pci_quirk *
|
||||
snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
|
||||
|
||||
const struct snd_pci_quirk *
|
||||
snd_pci_quirk_lookup_id(u16 vendor, u16 device,
|
||||
const struct snd_pci_quirk *list);
|
||||
#else
|
||||
static inline const struct snd_pci_quirk *
|
||||
snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline const struct snd_pci_quirk *
|
||||
snd_pci_quirk_lookup_id(u16 vendor, u16 device,
|
||||
const struct snd_pci_quirk *list)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SOUND_CORE_H */
|
||||
|
|
|
@ -436,8 +436,6 @@
|
|||
#define CCCA_CURRADDR_MASK 0x00ffffff /* Current address of the selected channel */
|
||||
#define CCCA_CURRADDR 0x18000008
|
||||
|
||||
/* undefine CCR to avoid conflict with the definition for SH */
|
||||
#undef CCR
|
||||
#define CCR 0x09 /* Cache control register */
|
||||
#define CCR_CACHEINVALIDSIZE 0x07190009
|
||||
#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000 /* Number of invalid samples cache for this channel */
|
||||
|
|
|
@ -60,7 +60,6 @@ struct snd_hwdep {
|
|||
int iface;
|
||||
|
||||
#ifdef CONFIG_SND_OSSEMUL
|
||||
char oss_dev[32];
|
||||
int oss_type;
|
||||
int ossreg;
|
||||
#endif
|
||||
|
@ -69,6 +68,8 @@ struct snd_hwdep {
|
|||
wait_queue_head_t open_wait;
|
||||
void *private_data;
|
||||
void (*private_free) (struct snd_hwdep *hwdep);
|
||||
struct device *dev;
|
||||
const struct attribute_group **groups;
|
||||
|
||||
struct mutex open_mutex;
|
||||
int used; /* reference counter */
|
||||
|
|
|
@ -1141,4 +1141,12 @@ static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
|
|||
return 1ULL << (__force int) pcm_format;
|
||||
}
|
||||
|
||||
/* printk helpers */
|
||||
#define pcm_err(pcm, fmt, args...) \
|
||||
dev_err((pcm)->card->dev, fmt, ##args)
|
||||
#define pcm_warn(pcm, fmt, args...) \
|
||||
dev_warn((pcm)->card->dev, fmt, ##args)
|
||||
#define pcm_dbg(pcm, fmt, args...) \
|
||||
dev_dbg((pcm)->card->dev, fmt, ##args)
|
||||
|
||||
#endif /* __SOUND_PCM_H */
|
||||
|
|
|
@ -157,10 +157,8 @@ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
|
|||
|
||||
/* callbacks */
|
||||
|
||||
void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
|
||||
int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
|
||||
const unsigned char *buffer, int count);
|
||||
void snd_rawmidi_transmit_reset(struct snd_rawmidi_substream *substream);
|
||||
int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream);
|
||||
int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
|
||||
unsigned char *buffer, int count);
|
||||
|
|
|
@ -34,17 +34,17 @@
|
|||
* B : SSI direction
|
||||
*/
|
||||
#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
|
||||
#define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */
|
||||
|
||||
#define RSND_SSI_PLAY (1 << 24)
|
||||
|
||||
#define RSND_SSI(_dma_id, _pio_irq, _flags) \
|
||||
{ .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
|
||||
#define RSND_SSI_SET(_dai_id, _dma_id, _pio_irq, _flags) \
|
||||
{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
|
||||
#define RSND_SSI_UNUSED \
|
||||
{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
|
||||
|
||||
struct rsnd_ssi_platform_info {
|
||||
int dai_id;
|
||||
int dai_id; /* will be removed */
|
||||
int dma_id;
|
||||
int pio_irq;
|
||||
u32 flags;
|
||||
|
@ -55,9 +55,31 @@ struct rsnd_ssi_platform_info {
|
|||
*/
|
||||
#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
|
||||
|
||||
struct rsnd_scu_platform_info {
|
||||
#define RSND_SRC(rate, _dma_id) \
|
||||
{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
|
||||
#define RSND_SRC_SET(rate, _dma_id) \
|
||||
{ .flags = RSND_SCU_USE_HPBIF, .convert_rate = rate, .dma_id = _dma_id, }
|
||||
#define RSND_SRC_UNUSED \
|
||||
{ .flags = 0, .convert_rate = 0, .dma_id = 0, }
|
||||
|
||||
#define rsnd_scu_platform_info rsnd_src_platform_info
|
||||
#define src_info scu_info
|
||||
#define src_info_nr scu_info_nr
|
||||
|
||||
struct rsnd_src_platform_info {
|
||||
u32 flags;
|
||||
u32 convert_rate; /* sampling rate convert */
|
||||
int dma_id; /* for Gen2 SCU */
|
||||
};
|
||||
|
||||
struct rsnd_dai_path_info {
|
||||
struct rsnd_ssi_platform_info *ssi;
|
||||
struct rsnd_src_platform_info *src;
|
||||
};
|
||||
|
||||
struct rsnd_dai_platform_info {
|
||||
struct rsnd_dai_path_info playback;
|
||||
struct rsnd_dai_path_info capture;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -75,8 +97,10 @@ struct rcar_snd_info {
|
|||
u32 flags;
|
||||
struct rsnd_ssi_platform_info *ssi_info;
|
||||
int ssi_info_nr;
|
||||
struct rsnd_scu_platform_info *scu_info;
|
||||
int scu_info_nr;
|
||||
struct rsnd_src_platform_info *src_info;
|
||||
int src_info_nr;
|
||||
struct rsnd_dai_platform_info *dai_info;
|
||||
int dai_info_nr;
|
||||
int (*start)(int id);
|
||||
int (*stop)(int id);
|
||||
};
|
||||
|
|
|
@ -18,6 +18,8 @@ struct asoc_simple_dai {
|
|||
const char *name;
|
||||
unsigned int fmt;
|
||||
unsigned int sysclk;
|
||||
int slots;
|
||||
int slot_width;
|
||||
};
|
||||
|
||||
struct asoc_simple_card_info {
|
||||
|
@ -29,10 +31,6 @@ struct asoc_simple_card_info {
|
|||
unsigned int daifmt;
|
||||
struct asoc_simple_dai cpu_dai;
|
||||
struct asoc_simple_dai codec_dai;
|
||||
|
||||
/* used in simple-card.c */
|
||||
struct snd_soc_dai_link snd_link;
|
||||
struct snd_soc_card snd_card;
|
||||
};
|
||||
|
||||
#endif /* __SIMPLE_CARD_H */
|
||||
|
|
|
@ -142,6 +142,8 @@ struct snd_soc_dai_ops {
|
|||
* Called by soc_card drivers, normally in their hw_params.
|
||||
*/
|
||||
int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
|
||||
int (*xlate_tdm_slot_mask)(unsigned int slots,
|
||||
unsigned int *tx_mask, unsigned int *rx_mask);
|
||||
int (*set_tdm_slot)(struct snd_soc_dai *dai,
|
||||
unsigned int tx_mask, unsigned int rx_mask,
|
||||
int slots, int slot_width);
|
||||
|
@ -270,6 +272,7 @@ struct snd_soc_dai {
|
|||
/* parent platform/codec */
|
||||
struct snd_soc_platform *platform;
|
||||
struct snd_soc_codec *codec;
|
||||
struct snd_soc_component *component;
|
||||
|
||||
struct snd_soc_card *card;
|
||||
|
||||
|
|
|
@ -108,13 +108,9 @@ struct device;
|
|||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
||||
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
||||
#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
|
||||
{ .id = snd_soc_dapm_virt_mux, .name = wname, \
|
||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
||||
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
||||
SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
|
||||
#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
|
||||
{ .id = snd_soc_dapm_value_mux, .name = wname, \
|
||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
||||
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
||||
SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
|
||||
|
||||
/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
|
||||
#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
|
||||
|
@ -172,10 +168,8 @@ struct device;
|
|||
.event = wevent, .event_flags = wflags}
|
||||
#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
|
||||
wevent, wflags) \
|
||||
{ .id = snd_soc_dapm_virt_mux, .name = wname, \
|
||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
||||
.kcontrol_news = wcontrols, .num_kcontrols = 1, \
|
||||
.event = wevent, .event_flags = wflags}
|
||||
SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, wevent, \
|
||||
wflags)
|
||||
|
||||
/* additional sequencing control within an event type */
|
||||
#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
|
||||
|
@ -311,12 +305,8 @@ struct device;
|
|||
.get = snd_soc_dapm_get_enum_double, \
|
||||
.put = snd_soc_dapm_put_enum_double, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.info = snd_soc_info_enum_double, \
|
||||
.get = snd_soc_dapm_get_enum_virt, \
|
||||
.put = snd_soc_dapm_put_enum_virt, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
|
||||
SOC_DAPM_ENUM(xname, xenum)
|
||||
#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.info = snd_soc_info_enum_double, \
|
||||
|
@ -324,11 +314,7 @@ struct device;
|
|||
.put = xput, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.info = snd_soc_info_enum_double, \
|
||||
.get = snd_soc_dapm_get_value_enum_double, \
|
||||
.put = snd_soc_dapm_put_value_enum_double, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
SOC_DAPM_ENUM(xname, xenum)
|
||||
#define SOC_DAPM_PIN_SWITCH(xname) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
|
||||
.info = snd_soc_dapm_info_pin_switch, \
|
||||
|
@ -392,14 +378,6 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
|
|||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_get_enum_virt(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_put_enum_virt(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo);
|
||||
int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
|
||||
|
@ -461,6 +439,7 @@ int snd_soc_dapm_nc_pin_unlocked(struct snd_soc_dapm_context *dapm,
|
|||
int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin);
|
||||
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
|
||||
int snd_soc_dapm_sync_unlocked(struct snd_soc_dapm_context *dapm);
|
||||
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
|
||||
const char *pin);
|
||||
int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
|
||||
|
@ -470,7 +449,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
|
|||
void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
|
||||
|
||||
/* Mostly internal - should not normally be used */
|
||||
void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
|
||||
void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
|
||||
|
||||
/* dapm path query */
|
||||
|
@ -484,8 +462,6 @@ enum snd_soc_dapm_type {
|
|||
snd_soc_dapm_input = 0, /* input pin */
|
||||
snd_soc_dapm_output, /* output pin */
|
||||
snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
|
||||
snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */
|
||||
snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
|
||||
snd_soc_dapm_mixer, /* mixes several analog signals together */
|
||||
snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
|
||||
snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
((unsigned long)&(struct soc_mixer_control) \
|
||||
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
||||
.max = xmax, .platform_max = xmax, .invert = xinvert})
|
||||
#define SOC_DOUBLE_R_S_VALUE(xlreg, xrreg, xshift, xmin, xmax, xsign_bit, xinvert) \
|
||||
((unsigned long)&(struct soc_mixer_control) \
|
||||
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
||||
.max = xmax, .min = xmin, .platform_max = xmax, .sign_bit = xsign_bit, \
|
||||
.invert = xinvert})
|
||||
#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
|
||||
((unsigned long)&(struct soc_mixer_control) \
|
||||
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
||||
|
@ -152,6 +157,15 @@
|
|||
{.reg = xreg, .rreg = xrreg, \
|
||||
.shift = xshift, .rshift = xshift, \
|
||||
.max = xmax, .min = xmin} }
|
||||
#define SOC_DOUBLE_R_S_TLV(xname, reg_left, reg_right, xshift, xmin, xmax, xsign_bit, xinvert, tlv_array) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
|
||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
|
||||
SNDRV_CTL_ELEM_ACCESS_READWRITE,\
|
||||
.tlv.p = (tlv_array), \
|
||||
.info = snd_soc_info_volsw, \
|
||||
.get = snd_soc_get_volsw, .put = snd_soc_put_volsw, \
|
||||
.private_value = SOC_DOUBLE_R_S_VALUE(reg_left, reg_right, xshift, \
|
||||
xmin, xmax, xsign_bit, xinvert) }
|
||||
#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
|
||||
|
@ -162,30 +176,28 @@
|
|||
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||
{.reg = xreg, .min = xmin, .max = xmax, \
|
||||
.platform_max = xmax} }
|
||||
#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
|
||||
#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xitems, xtexts) \
|
||||
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
||||
.max = xmax, .texts = xtexts, \
|
||||
.mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0}
|
||||
#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
|
||||
SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
|
||||
#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
|
||||
{ .max = xmax, .texts = xtexts }
|
||||
#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
|
||||
.items = xitems, .texts = xtexts, \
|
||||
.mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
|
||||
#define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \
|
||||
SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
|
||||
#define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \
|
||||
{ .items = xitems, .texts = xtexts }
|
||||
#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
|
||||
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
||||
.mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
|
||||
#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
|
||||
SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, xtexts, xvalues)
|
||||
.mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
|
||||
#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \
|
||||
SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues)
|
||||
#define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \
|
||||
SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts)
|
||||
#define SOC_ENUM(xname, xenum) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
|
||||
.info = snd_soc_info_enum_double, \
|
||||
.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
#define SOC_VALUE_ENUM(xname, xenum) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
|
||||
.info = snd_soc_info_enum_double, \
|
||||
.get = snd_soc_get_value_enum_double, \
|
||||
.put = snd_soc_put_value_enum_double, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
SOC_ENUM(xname, xenum)
|
||||
#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
|
||||
xhandler_get, xhandler_put) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
|
@ -272,17 +284,19 @@
|
|||
* ARRAY_SIZE internally
|
||||
*/
|
||||
#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
|
||||
struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
|
||||
const struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \
|
||||
ARRAY_SIZE(xtexts), xtexts)
|
||||
#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
|
||||
SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
|
||||
#define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \
|
||||
struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
|
||||
const struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts)
|
||||
#define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \
|
||||
struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
|
||||
const struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \
|
||||
ARRAY_SIZE(xtexts), xtexts, xvalues)
|
||||
#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
|
||||
SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
|
||||
#define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \
|
||||
const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
|
||||
|
||||
/*
|
||||
* Component probe and remove ordering levels for components with runtime
|
||||
|
@ -340,12 +354,6 @@ typedef int (*hw_write_t)(void *,const char* ,int);
|
|||
|
||||
extern struct snd_ac97_bus_ops *soc_ac97_ops;
|
||||
|
||||
enum snd_soc_control_type {
|
||||
SND_SOC_I2C = 1,
|
||||
SND_SOC_SPI,
|
||||
SND_SOC_REGMAP,
|
||||
};
|
||||
|
||||
enum snd_soc_pcm_subclass {
|
||||
SND_SOC_PCM_CLASS_PCM = 0,
|
||||
SND_SOC_PCM_CLASS_BE = 1,
|
||||
|
@ -392,8 +400,7 @@ int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
|
|||
int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
|
||||
unsigned int reg);
|
||||
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||
int addr_bits, int data_bits,
|
||||
enum snd_soc_control_type control);
|
||||
struct regmap *regmap);
|
||||
int snd_soc_cache_sync(struct snd_soc_codec *codec);
|
||||
int snd_soc_cache_init(struct snd_soc_codec *codec);
|
||||
int snd_soc_cache_exit(struct snd_soc_codec *codec);
|
||||
|
@ -413,6 +420,10 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
|
|||
struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
|
||||
const char *dai_link);
|
||||
|
||||
bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd);
|
||||
void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream);
|
||||
void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream);
|
||||
|
||||
/* Utility functions to get clock rates from various things */
|
||||
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
|
||||
int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
|
||||
|
@ -496,10 +507,6 @@ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
|
|||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_get_value_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_put_value_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_info *uinfo);
|
||||
#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
|
||||
|
@ -600,7 +607,8 @@ struct snd_soc_jack_gpio {
|
|||
struct snd_soc_jack *jack;
|
||||
struct delayed_work work;
|
||||
|
||||
int (*jack_status_check)(void);
|
||||
void *data;
|
||||
int (*jack_status_check)(void *data);
|
||||
};
|
||||
|
||||
struct snd_soc_jack {
|
||||
|
@ -656,12 +664,19 @@ struct snd_soc_component {
|
|||
const char *name;
|
||||
int id;
|
||||
struct device *dev;
|
||||
|
||||
unsigned int active;
|
||||
|
||||
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
|
||||
|
||||
struct list_head list;
|
||||
|
||||
struct snd_soc_dai_driver *dai_drv;
|
||||
int num_dai;
|
||||
|
||||
const struct snd_soc_component_driver *driver;
|
||||
|
||||
struct list_head dai_list;
|
||||
};
|
||||
|
||||
/* SoC Audio Codec device */
|
||||
|
@ -683,7 +698,6 @@ struct snd_soc_codec {
|
|||
|
||||
/* runtime */
|
||||
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
|
||||
unsigned int active;
|
||||
unsigned int cache_bypass:1; /* Suppress access to the cache */
|
||||
unsigned int suspended:1; /* Codec is in suspend PM state */
|
||||
unsigned int probed:1; /* Codec has been probed */
|
||||
|
@ -697,7 +711,6 @@ struct snd_soc_codec {
|
|||
/* codec IO */
|
||||
void *control_data; /* codec control (i2c/3wire) data */
|
||||
hw_write_t hw_write;
|
||||
unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
|
||||
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
|
||||
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
|
||||
void *reg_cache;
|
||||
|
@ -709,7 +722,6 @@ struct snd_soc_codec {
|
|||
|
||||
/* dapm */
|
||||
struct snd_soc_dapm_context dapm;
|
||||
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_codec_root;
|
||||
|
@ -1067,6 +1079,7 @@ struct soc_mixer_control {
|
|||
int min, max, platform_max;
|
||||
int reg, rreg;
|
||||
unsigned int shift, rshift;
|
||||
unsigned int sign_bit;
|
||||
unsigned int invert:1;
|
||||
unsigned int autodisable:1;
|
||||
};
|
||||
|
@ -1085,16 +1098,28 @@ struct soc_mreg_control {
|
|||
|
||||
/* enumerated kcontrol */
|
||||
struct soc_enum {
|
||||
unsigned short reg;
|
||||
unsigned short reg2;
|
||||
int reg;
|
||||
unsigned char shift_l;
|
||||
unsigned char shift_r;
|
||||
unsigned int max;
|
||||
unsigned int items;
|
||||
unsigned int mask;
|
||||
const char * const *texts;
|
||||
const unsigned int *values;
|
||||
};
|
||||
|
||||
/**
|
||||
* snd_soc_component_to_codec() - Casts a component to the CODEC it is embedded in
|
||||
* @component: The component to cast to a CODEC
|
||||
*
|
||||
* This function must only be used on components that are known to be CODECs.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_component_to_codec(
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return container_of(component, struct snd_soc_codec, component);
|
||||
}
|
||||
|
||||
/* codec IO */
|
||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
|
||||
unsigned int snd_soc_write(struct snd_soc_codec *codec,
|
||||
|
@ -1168,11 +1193,51 @@ static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline unsigned int snd_soc_enum_val_to_item(struct soc_enum *e,
|
||||
unsigned int val)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!e->values)
|
||||
return val;
|
||||
|
||||
for (i = 0; i < e->items; i++)
|
||||
if (val == e->values[i])
|
||||
return i;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline unsigned int snd_soc_enum_item_to_val(struct soc_enum *e,
|
||||
unsigned int item)
|
||||
{
|
||||
if (!e->values)
|
||||
return item;
|
||||
|
||||
return e->values[item];
|
||||
}
|
||||
|
||||
static inline bool snd_soc_component_is_active(
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return component->active != 0;
|
||||
}
|
||||
|
||||
static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
|
||||
{
|
||||
return snd_soc_component_is_active(&codec->component);
|
||||
}
|
||||
|
||||
int snd_soc_util_init(void);
|
||||
void snd_soc_util_exit(void);
|
||||
|
||||
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
|
||||
const char *propname);
|
||||
int snd_soc_of_parse_audio_simple_widgets(struct snd_soc_card *card,
|
||||
const char *propname);
|
||||
int snd_soc_of_parse_tdm_slot(struct device_node *np,
|
||||
unsigned int *slots,
|
||||
unsigned int *slot_width);
|
||||
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||
const char *propname);
|
||||
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
||||
|
@ -1188,4 +1253,15 @@ extern struct dentry *snd_soc_debugfs_root;
|
|||
|
||||
extern const struct dev_pm_ops snd_soc_pm_ops;
|
||||
|
||||
/* Helper functions */
|
||||
static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
mutex_lock(&dapm->card->dapm_mutex);
|
||||
}
|
||||
|
||||
static inline void snd_soc_dapm_mutex_unlock(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
mutex_unlock(&dapm->card->dapm_mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,384 @@
|
|||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM hswadsp
|
||||
|
||||
#if !defined(_TRACE_HSWADSP_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HSWADSP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
struct sst_hsw;
|
||||
struct sst_hsw_stream;
|
||||
struct sst_hsw_ipc_stream_free_req;
|
||||
struct sst_hsw_ipc_volume_req;
|
||||
struct sst_hsw_ipc_stream_alloc_req;
|
||||
struct sst_hsw_audio_data_format_ipc;
|
||||
struct sst_hsw_ipc_stream_info_reply;
|
||||
struct sst_hsw_ipc_device_config_req;
|
||||
|
||||
DECLARE_EVENT_CLASS(sst_irq,
|
||||
|
||||
TP_PROTO(uint32_t status, uint32_t mask),
|
||||
|
||||
TP_ARGS(status, mask),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, status )
|
||||
__field( unsigned int, mask )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->status = status;
|
||||
__entry->mask = mask;
|
||||
),
|
||||
|
||||
TP_printk("status 0x%8.8x mask 0x%8.8x",
|
||||
(unsigned int)__entry->status, (unsigned int)__entry->mask)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_irq, sst_irq_busy,
|
||||
|
||||
TP_PROTO(unsigned int status, unsigned int mask),
|
||||
|
||||
TP_ARGS(status, mask)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_irq, sst_irq_done,
|
||||
|
||||
TP_PROTO(unsigned int status, unsigned int mask),
|
||||
|
||||
TP_ARGS(status, mask)
|
||||
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(ipc,
|
||||
|
||||
TP_PROTO(const char *name, int val),
|
||||
|
||||
TP_ARGS(name, val),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string( name, name )
|
||||
__field( unsigned int, val )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, name);
|
||||
__entry->val = val;
|
||||
),
|
||||
|
||||
TP_printk("%s 0x%8.8x", __get_str(name), (unsigned int)__entry->val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(ipc, ipc_request,
|
||||
|
||||
TP_PROTO(const char *name, int val),
|
||||
|
||||
TP_ARGS(name, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(ipc, ipc_reply,
|
||||
|
||||
TP_PROTO(const char *name, int val),
|
||||
|
||||
TP_ARGS(name, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(ipc, ipc_pending_reply,
|
||||
|
||||
TP_PROTO(const char *name, int val),
|
||||
|
||||
TP_ARGS(name, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(ipc, ipc_notification,
|
||||
|
||||
TP_PROTO(const char *name, int val),
|
||||
|
||||
TP_ARGS(name, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(ipc, ipc_error,
|
||||
|
||||
TP_PROTO(const char *name, int val),
|
||||
|
||||
TP_ARGS(name, val)
|
||||
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(stream_position,
|
||||
|
||||
TP_PROTO(unsigned int id, unsigned int pos),
|
||||
|
||||
TP_ARGS(id, pos),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, id )
|
||||
__field( unsigned int, pos )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = id;
|
||||
__entry->pos = pos;
|
||||
),
|
||||
|
||||
TP_printk("id %d position 0x%x",
|
||||
(unsigned int)__entry->id, (unsigned int)__entry->pos)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(stream_position, stream_read_position,
|
||||
|
||||
TP_PROTO(unsigned int id, unsigned int pos),
|
||||
|
||||
TP_ARGS(id, pos)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(stream_position, stream_write_position,
|
||||
|
||||
TP_PROTO(unsigned int id, unsigned int pos),
|
||||
|
||||
TP_ARGS(id, pos)
|
||||
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_stream_buffer,
|
||||
|
||||
TP_PROTO(struct sst_hsw_stream *stream),
|
||||
|
||||
TP_ARGS(stream),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, id )
|
||||
__field( int, pt_addr )
|
||||
__field( int, num_pages )
|
||||
__field( int, ring_size )
|
||||
__field( int, ring_offset )
|
||||
__field( int, first_pfn )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = stream->host_id;
|
||||
__entry->pt_addr = stream->request.ringinfo.ring_pt_address;
|
||||
__entry->num_pages = stream->request.ringinfo.num_pages;
|
||||
__entry->ring_size = stream->request.ringinfo.ring_size;
|
||||
__entry->ring_offset = stream->request.ringinfo.ring_offset;
|
||||
__entry->first_pfn = stream->request.ringinfo.ring_first_pfn;
|
||||
),
|
||||
|
||||
TP_printk("stream %d ring addr 0x%x pages %d size 0x%x offset 0x%x PFN 0x%x",
|
||||
(int) __entry->id, (int)__entry->pt_addr,
|
||||
(int)__entry->num_pages, (int)__entry->ring_size,
|
||||
(int)__entry->ring_offset, (int)__entry->first_pfn)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_stream_alloc_reply,
|
||||
|
||||
TP_PROTO(struct sst_hsw_stream *stream),
|
||||
|
||||
TP_ARGS(stream),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, id )
|
||||
__field( int, stream_id )
|
||||
__field( int, mixer_id )
|
||||
__field( int, peak0 )
|
||||
__field( int, peak1 )
|
||||
__field( int, vol0 )
|
||||
__field( int, vol1 )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = stream->host_id;
|
||||
__entry->stream_id = stream->reply.stream_hw_id;
|
||||
__entry->mixer_id = stream->reply.mixer_hw_id;
|
||||
__entry->peak0 = stream->reply.peak_meter_register_address[0];
|
||||
__entry->peak1 = stream->reply.peak_meter_register_address[1];
|
||||
__entry->vol0 = stream->reply.volume_register_address[0];
|
||||
__entry->vol1 = stream->reply.volume_register_address[1];
|
||||
),
|
||||
|
||||
TP_printk("stream %d hw id %d mixer %d peak 0x%x:0x%x vol 0x%x,0x%x",
|
||||
(int) __entry->id, (int) __entry->stream_id, (int)__entry->mixer_id,
|
||||
(int)__entry->peak0, (int)__entry->peak1,
|
||||
(int)__entry->vol0, (int)__entry->vol1)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_mixer_info_reply,
|
||||
|
||||
TP_PROTO(struct sst_hsw_ipc_stream_info_reply *reply),
|
||||
|
||||
TP_ARGS(reply),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, mixer_id )
|
||||
__field( int, peak0 )
|
||||
__field( int, peak1 )
|
||||
__field( int, vol0 )
|
||||
__field( int, vol1 )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->mixer_id = reply->mixer_hw_id;
|
||||
__entry->peak0 = reply->peak_meter_register_address[0];
|
||||
__entry->peak1 = reply->peak_meter_register_address[1];
|
||||
__entry->vol0 = reply->volume_register_address[0];
|
||||
__entry->vol1 = reply->volume_register_address[1];
|
||||
),
|
||||
|
||||
TP_printk("mixer id %d peak 0x%x:0x%x vol 0x%x,0x%x",
|
||||
(int)__entry->mixer_id,
|
||||
(int)__entry->peak0, (int)__entry->peak1,
|
||||
(int)__entry->vol0, (int)__entry->vol1)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_stream_data_format,
|
||||
|
||||
TP_PROTO(struct sst_hsw_stream *stream,
|
||||
struct sst_hsw_audio_data_format_ipc *req),
|
||||
|
||||
TP_ARGS(stream, req),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( uint32_t, id )
|
||||
__field( uint32_t, frequency )
|
||||
__field( uint32_t, bitdepth )
|
||||
__field( uint32_t, map )
|
||||
__field( uint32_t, config )
|
||||
__field( uint32_t, style )
|
||||
__field( uint8_t, ch_num )
|
||||
__field( uint8_t, valid_bit )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = stream->host_id;
|
||||
__entry->frequency = req->frequency;
|
||||
__entry->bitdepth = req->bitdepth;
|
||||
__entry->map = req->map;
|
||||
__entry->config = req->config;
|
||||
__entry->style = req->style;
|
||||
__entry->ch_num = req->ch_num;
|
||||
__entry->valid_bit = req->valid_bit;
|
||||
),
|
||||
|
||||
TP_printk("stream %d freq %d depth %d map 0x%x config 0x%x style 0x%x ch %d bits %d",
|
||||
(int) __entry->id, (uint32_t)__entry->frequency,
|
||||
(uint32_t)__entry->bitdepth, (uint32_t)__entry->map,
|
||||
(uint32_t)__entry->config, (uint32_t)__entry->style,
|
||||
(uint8_t)__entry->ch_num, (uint8_t)__entry->valid_bit)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_stream_alloc_request,
|
||||
|
||||
TP_PROTO(struct sst_hsw_stream *stream,
|
||||
struct sst_hsw_ipc_stream_alloc_req *req),
|
||||
|
||||
TP_ARGS(stream, req),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( uint32_t, id )
|
||||
__field( uint8_t, path_id )
|
||||
__field( uint8_t, stream_type )
|
||||
__field( uint8_t, format_id )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = stream->host_id;
|
||||
__entry->path_id = req->path_id;
|
||||
__entry->stream_type = req->stream_type;
|
||||
__entry->format_id = req->format_id;
|
||||
),
|
||||
|
||||
TP_printk("stream %d path %d type %d format %d",
|
||||
(int) __entry->id, (uint8_t)__entry->path_id,
|
||||
(uint8_t)__entry->stream_type, (uint8_t)__entry->format_id)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_stream_free_req,
|
||||
|
||||
TP_PROTO(struct sst_hsw_stream *stream,
|
||||
struct sst_hsw_ipc_stream_free_req *req),
|
||||
|
||||
TP_ARGS(stream, req),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, id )
|
||||
__field( int, stream_id )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = stream->host_id;
|
||||
__entry->stream_id = req->stream_id;
|
||||
),
|
||||
|
||||
TP_printk("stream %d hw id %d",
|
||||
(int) __entry->id, (int) __entry->stream_id)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_volume_req,
|
||||
|
||||
TP_PROTO(struct sst_hsw_stream *stream,
|
||||
struct sst_hsw_ipc_volume_req *req),
|
||||
|
||||
TP_ARGS(stream, req),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( int, id )
|
||||
__field( uint32_t, channel )
|
||||
__field( uint32_t, target_volume )
|
||||
__field( uint64_t, curve_duration )
|
||||
__field( uint32_t, curve_type )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->id = stream->host_id;
|
||||
__entry->channel = req->channel;
|
||||
__entry->target_volume = req->target_volume;
|
||||
__entry->curve_duration = req->curve_duration;
|
||||
__entry->curve_type = req->curve_type;
|
||||
),
|
||||
|
||||
TP_printk("stream %d chan 0x%x vol %d duration %llu type %d",
|
||||
(int) __entry->id, (uint32_t) __entry->channel,
|
||||
(uint32_t)__entry->target_volume,
|
||||
(uint64_t)__entry->curve_duration,
|
||||
(uint32_t)__entry->curve_type)
|
||||
);
|
||||
|
||||
TRACE_EVENT(hsw_device_config_req,
|
||||
|
||||
TP_PROTO(struct sst_hsw_ipc_device_config_req *req),
|
||||
|
||||
TP_ARGS(req),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( uint32_t, ssp )
|
||||
__field( uint32_t, clock_freq )
|
||||
__field( uint32_t, mode )
|
||||
__field( uint16_t, clock_divider )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->ssp = req->ssp_interface;
|
||||
__entry->clock_freq = req->clock_frequency;
|
||||
__entry->mode = req->mode;
|
||||
__entry->clock_divider = req->clock_divider;
|
||||
),
|
||||
|
||||
TP_printk("SSP %d Freq %d mode %d div %d",
|
||||
(uint32_t)__entry->ssp,
|
||||
(uint32_t)__entry->clock_freq, (uint32_t)__entry->mode,
|
||||
(uint32_t)__entry->clock_divider)
|
||||
);
|
||||
|
||||
#endif /* _TRACE_HSWADSP_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
|
@ -0,0 +1,148 @@
|
|||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM intel-sst
|
||||
|
||||
#if !defined(_TRACE_INTEL_SST_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_INTEL_SST_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_EVENT_CLASS(sst_ipc_msg,
|
||||
|
||||
TP_PROTO(unsigned int val),
|
||||
|
||||
TP_ARGS(val),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, val )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->val = val;
|
||||
),
|
||||
|
||||
TP_printk("0x%8.8x", (unsigned int)__entry->val)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_msg, sst_ipc_msg_tx,
|
||||
|
||||
TP_PROTO(unsigned int val),
|
||||
|
||||
TP_ARGS(val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_msg, sst_ipc_msg_rx,
|
||||
|
||||
TP_PROTO(unsigned int val),
|
||||
|
||||
TP_ARGS(val)
|
||||
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(sst_ipc_mailbox,
|
||||
|
||||
TP_PROTO(unsigned int offset, unsigned int val),
|
||||
|
||||
TP_ARGS(offset, val),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, offset )
|
||||
__field( unsigned int, val )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->offset = offset;
|
||||
__entry->val = val;
|
||||
),
|
||||
|
||||
TP_printk(" 0x%4.4x = 0x%8.8x",
|
||||
(unsigned int)__entry->offset, (unsigned int)__entry->val)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_inbox_rdata,
|
||||
|
||||
TP_PROTO(unsigned int offset, unsigned int val),
|
||||
|
||||
TP_ARGS(offset, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_inbox_wdata,
|
||||
|
||||
TP_PROTO(unsigned int offset, unsigned int val),
|
||||
|
||||
TP_ARGS(offset, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_outbox_rdata,
|
||||
|
||||
TP_PROTO(unsigned int offset, unsigned int val),
|
||||
|
||||
TP_ARGS(offset, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox, sst_ipc_outbox_wdata,
|
||||
|
||||
TP_PROTO(unsigned int offset, unsigned int val),
|
||||
|
||||
TP_ARGS(offset, val)
|
||||
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(sst_ipc_mailbox_info,
|
||||
|
||||
TP_PROTO(unsigned int size),
|
||||
|
||||
TP_ARGS(size),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field( unsigned int, size )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->size = size;
|
||||
),
|
||||
|
||||
TP_printk("Mailbox bytes 0x%8.8x", (unsigned int)__entry->size)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_inbox_read,
|
||||
|
||||
TP_PROTO(unsigned int size),
|
||||
|
||||
TP_ARGS(size)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_inbox_write,
|
||||
|
||||
TP_PROTO(unsigned int size),
|
||||
|
||||
TP_ARGS(size)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_outbox_read,
|
||||
|
||||
TP_PROTO(unsigned int size),
|
||||
|
||||
TP_ARGS(size)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(sst_ipc_mailbox_info, sst_ipc_outbox_write,
|
||||
|
||||
TP_PROTO(unsigned int size),
|
||||
|
||||
TP_ARGS(size)
|
||||
|
||||
);
|
||||
|
||||
#endif /* _TRACE_SST_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
|
@ -116,7 +116,7 @@ struct aoa_card {
|
|||
struct snd_card *alsa_card;
|
||||
};
|
||||
|
||||
extern int aoa_snd_device_new(snd_device_type_t type,
|
||||
extern int aoa_snd_device_new(enum snd_device_type type,
|
||||
void * device_data, struct snd_device_ops * ops);
|
||||
extern struct snd_card *aoa_get_card(void);
|
||||
extern int aoa_snd_ctl_add(struct snd_kcontrol* control);
|
||||
|
|
|
@ -889,7 +889,7 @@ static int onyx_init_codec(struct aoa_codec *codec)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, onyx, &ops)) {
|
||||
if (aoa_snd_device_new(SNDRV_DEV_CODEC, onyx, &ops)) {
|
||||
printk(KERN_ERR PFX "failed to create onyx snd device!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -826,7 +826,7 @@ static int tas_init_codec(struct aoa_codec *codec)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, tas, &ops)) {
|
||||
if (aoa_snd_device_new(SNDRV_DEV_CODEC, tas, &ops)) {
|
||||
printk(KERN_ERR PFX "failed to create tas snd device!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ static int toonie_init_codec(struct aoa_codec *codec)
|
|||
if (toonie->codec.connected != 1)
|
||||
return -ENOTCONN;
|
||||
|
||||
if (aoa_snd_device_new(SNDRV_DEV_LOWLEVEL, toonie, &ops)) {
|
||||
if (aoa_snd_device_new(SNDRV_DEV_CODEC, toonie, &ops)) {
|
||||
printk(KERN_ERR PFX "failed to create toonie snd device!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
@ -23,13 +23,12 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
|
|||
/* cannot be EEXIST due to usage in aoa_fabric_register */
|
||||
return -EBUSY;
|
||||
|
||||
err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
|
||||
&alsa_card);
|
||||
err = snd_card_new(dev, index, name, mod, sizeof(struct aoa_card),
|
||||
&alsa_card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
aoa_card = alsa_card->private_data;
|
||||
aoa_card->alsa_card = alsa_card;
|
||||
alsa_card->dev = dev;
|
||||
strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
|
||||
strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
|
||||
strlcpy(alsa_card->longname, name, sizeof(alsa_card->longname));
|
||||
|
@ -60,7 +59,7 @@ void aoa_alsa_cleanup(void)
|
|||
}
|
||||
}
|
||||
|
||||
int aoa_snd_device_new(snd_device_type_t type,
|
||||
int aoa_snd_device_new(enum snd_device_type type,
|
||||
void * device_data, struct snd_device_ops * ops)
|
||||
{
|
||||
struct snd_card *card = aoa_get_card();
|
||||
|
|
|
@ -899,8 +899,8 @@ static struct aaci *aaci_init_card(struct amba_device *dev)
|
|||
struct snd_card *card;
|
||||
int err;
|
||||
|
||||
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, sizeof(struct aaci), &card);
|
||||
err = snd_card_new(&dev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, sizeof(struct aaci), &card);
|
||||
if (err < 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -1055,8 +1055,6 @@ static int aaci_probe(struct amba_device *dev,
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
snd_card_set_dev(aaci->card, &dev->dev);
|
||||
|
||||
ret = snd_card_register(aaci->card);
|
||||
if (ret == 0) {
|
||||
dev_info(&dev->dev, "%s\n", aaci->card->longname);
|
||||
|
|
|
@ -179,12 +179,11 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
|
|||
goto err_dev;
|
||||
}
|
||||
|
||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, 0, &card);
|
||||
ret = snd_card_new(&dev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, 0, &card);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
card->dev = &dev->dev;
|
||||
strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
|
||||
|
||||
ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
|
||||
|
@ -210,7 +209,6 @@ static int pxa2xx_ac97_probe(struct platform_device *dev)
|
|||
|
||||
if (pdata && pdata->codec_pdata[0])
|
||||
snd_ac97_dev_add_pdata(ac97_bus->codec[0], pdata->codec_pdata[0]);
|
||||
snd_card_set_dev(card, &dev->dev);
|
||||
ret = snd_card_register(card);
|
||||
if (ret == 0) {
|
||||
platform_set_drvdata(dev, card);
|
||||
|
|
|
@ -429,8 +429,9 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
|||
}
|
||||
clk_enable(pclk);
|
||||
|
||||
retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, sizeof(struct atmel_abdac), &card);
|
||||
retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1,
|
||||
SNDRV_DEFAULT_STR1, THIS_MODULE,
|
||||
sizeof(struct atmel_abdac), &card);
|
||||
if (retval) {
|
||||
dev_dbg(&pdev->dev, "could not create sound card device\n");
|
||||
goto out_put_sample_clk;
|
||||
|
@ -467,8 +468,6 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
|||
goto out_unmap_regs;
|
||||
}
|
||||
|
||||
snd_card_set_dev(card, &pdev->dev);
|
||||
|
||||
if (pdata->dws.dma_dev) {
|
||||
dma_cap_mask_t mask;
|
||||
|
||||
|
@ -492,7 +491,7 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
|||
if (!pdata->dws.dma_dev || !dac->dma.chan) {
|
||||
dev_dbg(&pdev->dev, "DMA not available\n");
|
||||
retval = -ENODEV;
|
||||
goto out_unset_card_dev;
|
||||
goto out_unmap_regs;
|
||||
}
|
||||
|
||||
strcpy(card->driver, "Atmel ABDAC");
|
||||
|
@ -521,9 +520,6 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
|||
out_release_dma:
|
||||
dma_release_channel(dac->dma.chan);
|
||||
dac->dma.chan = NULL;
|
||||
out_unset_card_dev:
|
||||
snd_card_set_dev(card, NULL);
|
||||
free_irq(irq, dac);
|
||||
out_unmap_regs:
|
||||
iounmap(dac->regs);
|
||||
out_free_card:
|
||||
|
@ -579,7 +575,6 @@ static int atmel_abdac_remove(struct platform_device *pdev)
|
|||
|
||||
dma_release_channel(dac->dma.chan);
|
||||
dac->dma.chan = NULL;
|
||||
snd_card_set_dev(card, NULL);
|
||||
iounmap(dac->regs);
|
||||
free_irq(dac->irq, dac);
|
||||
snd_card_free(card);
|
||||
|
|
|
@ -945,8 +945,9 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
|
|||
}
|
||||
clk_enable(pclk);
|
||||
|
||||
retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||
THIS_MODULE, sizeof(struct atmel_ac97c), &card);
|
||||
retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1,
|
||||
SNDRV_DEFAULT_STR1, THIS_MODULE,
|
||||
sizeof(struct atmel_ac97c), &card);
|
||||
if (retval) {
|
||||
dev_dbg(&pdev->dev, "could not create sound card device\n");
|
||||
goto err_snd_card_new;
|
||||
|
@ -990,8 +991,6 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
|
|||
chip->reset_pin = -EINVAL;
|
||||
}
|
||||
|
||||
snd_card_set_dev(card, &pdev->dev);
|
||||
|
||||
atmel_ac97c_reset(chip);
|
||||
|
||||
/* Enable overrun interrupt from codec channel */
|
||||
|
@ -1113,8 +1112,6 @@ err_dma:
|
|||
chip->dma.tx_chan = NULL;
|
||||
}
|
||||
err_ac97_bus:
|
||||
snd_card_set_dev(card, NULL);
|
||||
|
||||
if (gpio_is_valid(chip->reset_pin))
|
||||
gpio_free(chip->reset_pin);
|
||||
|
||||
|
@ -1195,7 +1192,6 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
|
|||
chip->dma.tx_chan = NULL;
|
||||
}
|
||||
|
||||
snd_card_set_dev(card, NULL);
|
||||
snd_card_free(card);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -151,7 +151,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
|
|||
if (snd_BUG_ON(!card || !id))
|
||||
return;
|
||||
read_lock(&card->ctl_files_rwlock);
|
||||
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
|
||||
card->mixer_oss_change_count++;
|
||||
#endif
|
||||
list_for_each_entry(ctl, &card->ctl_files, list) {
|
||||
|
@ -170,7 +170,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
|
|||
ev->mask = mask;
|
||||
list_add_tail(&ev->list, &ctl->events);
|
||||
} else {
|
||||
snd_printk(KERN_ERR "No memory available to allocate event\n");
|
||||
dev_err(card->dev, "No memory available to allocate event\n");
|
||||
}
|
||||
_found:
|
||||
wake_up(&ctl->change_sleep);
|
||||
|
@ -206,7 +206,7 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
|
|||
|
||||
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
|
||||
if (kctl == NULL) {
|
||||
snd_printk(KERN_ERR "Cannot allocate control instance\n");
|
||||
pr_err("ALSA: Cannot allocate control instance\n");
|
||||
return NULL;
|
||||
}
|
||||
*kctl = *control;
|
||||
|
@ -241,9 +241,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
|
|||
if (ncontrol->name) {
|
||||
strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
|
||||
if (strcmp(ncontrol->name, kctl.id.name) != 0)
|
||||
snd_printk(KERN_WARNING
|
||||
"Control name '%s' truncated to '%s'\n",
|
||||
ncontrol->name, kctl.id.name);
|
||||
pr_warn("ALSA: Control name '%s' truncated to '%s'\n",
|
||||
ncontrol->name, kctl.id.name);
|
||||
}
|
||||
kctl.id.index = ncontrol->index;
|
||||
kctl.count = ncontrol->count ? ncontrol->count : 1;
|
||||
|
@ -306,7 +305,7 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
|
|||
while (snd_ctl_remove_numid_conflict(card, count)) {
|
||||
if (--iter == 0) {
|
||||
/* this situation is very unlikely */
|
||||
snd_printk(KERN_ERR "unable to allocate new control numid\n");
|
||||
dev_err(card->dev, "unable to allocate new control numid\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +340,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
|
|||
down_write(&card->controls_rwsem);
|
||||
if (snd_ctl_find_id(card, &id)) {
|
||||
up_write(&card->controls_rwsem);
|
||||
snd_printd(KERN_ERR "control %i:%i:%i:%s:%i is already present\n",
|
||||
dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n",
|
||||
id.iface,
|
||||
id.device,
|
||||
id.subdevice,
|
||||
|
@ -1406,7 +1405,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg
|
|||
}
|
||||
}
|
||||
up_read(&snd_ioctl_rwsem);
|
||||
snd_printdd("unknown ioctl = 0x%x\n", cmd);
|
||||
dev_dbg(card->dev, "unknown ioctl = 0x%x\n", cmd);
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ static int copy_ctl_value_from_user(struct snd_card *card,
|
|||
} else {
|
||||
size = get_elem_size(type, count);
|
||||
if (size < 0) {
|
||||
printk(KERN_ERR "snd_ioctl32_ctl_elem_value: unknown type %d\n", type);
|
||||
dev_err(card->dev, "snd_ioctl32_ctl_elem_value: unknown type %d\n", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (copy_from_user(data->value.bytes.data,
|
||||
|
|
|
@ -41,28 +41,72 @@
|
|||
*
|
||||
* Return: Zero if successful, or a negative error code on failure.
|
||||
*/
|
||||
int snd_device_new(struct snd_card *card, snd_device_type_t type,
|
||||
int snd_device_new(struct snd_card *card, enum snd_device_type type,
|
||||
void *device_data, struct snd_device_ops *ops)
|
||||
{
|
||||
struct snd_device *dev;
|
||||
struct list_head *p;
|
||||
|
||||
if (snd_BUG_ON(!card || !device_data || !ops))
|
||||
return -ENXIO;
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (dev == NULL) {
|
||||
snd_printk(KERN_ERR "Cannot allocate device\n");
|
||||
dev_err(card->dev, "Cannot allocate device, type=%d\n", type);
|
||||
return -ENOMEM;
|
||||
}
|
||||
INIT_LIST_HEAD(&dev->list);
|
||||
dev->card = card;
|
||||
dev->type = type;
|
||||
dev->state = SNDRV_DEV_BUILD;
|
||||
dev->device_data = device_data;
|
||||
dev->ops = ops;
|
||||
list_add(&dev->list, &card->devices); /* add to the head of list */
|
||||
|
||||
/* insert the entry in an incrementally sorted list */
|
||||
list_for_each_prev(p, &card->devices) {
|
||||
struct snd_device *pdev = list_entry(p, struct snd_device, list);
|
||||
if ((unsigned int)pdev->type <= (unsigned int)type)
|
||||
break;
|
||||
}
|
||||
|
||||
list_add(&dev->list, p);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_device_new);
|
||||
|
||||
static int __snd_device_disconnect(struct snd_device *dev)
|
||||
{
|
||||
if (dev->state == SNDRV_DEV_REGISTERED) {
|
||||
if (dev->ops->dev_disconnect &&
|
||||
dev->ops->dev_disconnect(dev))
|
||||
dev_err(dev->card->dev, "device disconnect failure\n");
|
||||
dev->state = SNDRV_DEV_DISCONNECTED;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(snd_device_new);
|
||||
static void __snd_device_free(struct snd_device *dev)
|
||||
{
|
||||
/* unlink */
|
||||
list_del(&dev->list);
|
||||
|
||||
__snd_device_disconnect(dev);
|
||||
if (dev->ops->dev_free) {
|
||||
if (dev->ops->dev_free(dev))
|
||||
dev_err(dev->card->dev, "device free failure\n");
|
||||
}
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
static struct snd_device *look_for_dev(struct snd_card *card, void *device_data)
|
||||
{
|
||||
struct snd_device *dev;
|
||||
|
||||
list_for_each_entry(dev, &card->devices, list)
|
||||
if (dev->device_data == device_data)
|
||||
return dev;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_device_free - release the device from the card
|
||||
|
@ -72,73 +116,33 @@ EXPORT_SYMBOL(snd_device_new);
|
|||
* Removes the device from the list on the card and invokes the
|
||||
* callbacks, dev_disconnect and dev_free, corresponding to the state.
|
||||
* Then release the device.
|
||||
*
|
||||
* Return: Zero if successful, or a negative error code on failure or if the
|
||||
* device not found.
|
||||
*/
|
||||
int snd_device_free(struct snd_card *card, void *device_data)
|
||||
void snd_device_free(struct snd_card *card, void *device_data)
|
||||
{
|
||||
struct snd_device *dev;
|
||||
|
||||
if (snd_BUG_ON(!card || !device_data))
|
||||
return -ENXIO;
|
||||
list_for_each_entry(dev, &card->devices, list) {
|
||||
if (dev->device_data != device_data)
|
||||
continue;
|
||||
/* unlink */
|
||||
list_del(&dev->list);
|
||||
if (dev->state == SNDRV_DEV_REGISTERED &&
|
||||
dev->ops->dev_disconnect)
|
||||
if (dev->ops->dev_disconnect(dev))
|
||||
snd_printk(KERN_ERR
|
||||
"device disconnect failure\n");
|
||||
if (dev->ops->dev_free) {
|
||||
if (dev->ops->dev_free(dev))
|
||||
snd_printk(KERN_ERR "device free failure\n");
|
||||
}
|
||||
kfree(dev);
|
||||
return 0;
|
||||
}
|
||||
snd_printd("device free %p (from %pF), not found\n", device_data,
|
||||
__builtin_return_address(0));
|
||||
return -ENXIO;
|
||||
return;
|
||||
dev = look_for_dev(card, device_data);
|
||||
if (dev)
|
||||
__snd_device_free(dev);
|
||||
else
|
||||
dev_dbg(card->dev, "device free %p (from %pF), not found\n",
|
||||
device_data, __builtin_return_address(0));
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(snd_device_free);
|
||||
|
||||
/**
|
||||
* snd_device_disconnect - disconnect the device
|
||||
* @card: the card instance
|
||||
* @device_data: the data pointer to disconnect
|
||||
*
|
||||
* Turns the device into the disconnection state, invoking
|
||||
* dev_disconnect callback, if the device was already registered.
|
||||
*
|
||||
* Usually called from snd_card_disconnect().
|
||||
*
|
||||
* Return: Zero if successful, or a negative error code on failure or if the
|
||||
* device not found.
|
||||
*/
|
||||
int snd_device_disconnect(struct snd_card *card, void *device_data)
|
||||
static int __snd_device_register(struct snd_device *dev)
|
||||
{
|
||||
struct snd_device *dev;
|
||||
|
||||
if (snd_BUG_ON(!card || !device_data))
|
||||
return -ENXIO;
|
||||
list_for_each_entry(dev, &card->devices, list) {
|
||||
if (dev->device_data != device_data)
|
||||
continue;
|
||||
if (dev->state == SNDRV_DEV_REGISTERED &&
|
||||
dev->ops->dev_disconnect) {
|
||||
if (dev->ops->dev_disconnect(dev))
|
||||
snd_printk(KERN_ERR "device disconnect failure\n");
|
||||
dev->state = SNDRV_DEV_DISCONNECTED;
|
||||
if (dev->state == SNDRV_DEV_BUILD) {
|
||||
if (dev->ops->dev_register) {
|
||||
int err = dev->ops->dev_register(dev);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
dev->state = SNDRV_DEV_REGISTERED;
|
||||
}
|
||||
snd_printd("device disconnect %p (from %pF), not found\n", device_data,
|
||||
__builtin_return_address(0));
|
||||
return -ENXIO;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,26 +161,15 @@ int snd_device_disconnect(struct snd_card *card, void *device_data)
|
|||
int snd_device_register(struct snd_card *card, void *device_data)
|
||||
{
|
||||
struct snd_device *dev;
|
||||
int err;
|
||||
|
||||
if (snd_BUG_ON(!card || !device_data))
|
||||
return -ENXIO;
|
||||
list_for_each_entry(dev, &card->devices, list) {
|
||||
if (dev->device_data != device_data)
|
||||
continue;
|
||||
if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
|
||||
if ((err = dev->ops->dev_register(dev)) < 0)
|
||||
return err;
|
||||
dev->state = SNDRV_DEV_REGISTERED;
|
||||
return 0;
|
||||
}
|
||||
snd_printd("snd_device_register busy\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
dev = look_for_dev(card, device_data);
|
||||
if (dev)
|
||||
return __snd_device_register(dev);
|
||||
snd_BUG();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(snd_device_register);
|
||||
|
||||
/*
|
||||
|
@ -191,11 +184,9 @@ int snd_device_register_all(struct snd_card *card)
|
|||
if (snd_BUG_ON(!card))
|
||||
return -ENXIO;
|
||||
list_for_each_entry(dev, &card->devices, list) {
|
||||
if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
|
||||
if ((err = dev->ops->dev_register(dev)) < 0)
|
||||
return err;
|
||||
dev->state = SNDRV_DEV_REGISTERED;
|
||||
}
|
||||
err = __snd_device_register(dev);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -211,8 +202,8 @@ int snd_device_disconnect_all(struct snd_card *card)
|
|||
|
||||
if (snd_BUG_ON(!card))
|
||||
return -ENXIO;
|
||||
list_for_each_entry(dev, &card->devices, list) {
|
||||
if (snd_device_disconnect(card, dev->device_data) < 0)
|
||||
list_for_each_entry_reverse(dev, &card->devices, list) {
|
||||
if (__snd_device_disconnect(dev) < 0)
|
||||
err = -ENXIO;
|
||||
}
|
||||
return err;
|
||||
|
@ -222,24 +213,12 @@ int snd_device_disconnect_all(struct snd_card *card)
|
|||
* release all the devices on the card.
|
||||
* called from init.c
|
||||
*/
|
||||
int snd_device_free_all(struct snd_card *card, snd_device_cmd_t cmd)
|
||||
void snd_device_free_all(struct snd_card *card)
|
||||
{
|
||||
struct snd_device *dev;
|
||||
int err;
|
||||
unsigned int range_low, range_high, type;
|
||||
struct snd_device *dev, *next;
|
||||
|
||||
if (snd_BUG_ON(!card))
|
||||
return -ENXIO;
|
||||
range_low = (__force unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE;
|
||||
range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1;
|
||||
__again:
|
||||
list_for_each_entry(dev, &card->devices, list) {
|
||||
type = (__force unsigned int)dev->type;
|
||||
if (type >= range_low && type <= range_high) {
|
||||
if ((err = snd_device_free(card, dev->device_data)) < 0)
|
||||
return err;
|
||||
goto __again;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
list_for_each_entry_safe_reverse(dev, next, &card->devices, list)
|
||||
__snd_device_free(dev);
|
||||
}
|
||||
|
|
|
@ -126,8 +126,7 @@ static int __init snd_hrtimer_init(void)
|
|||
|
||||
hrtimer_get_res(CLOCK_MONOTONIC, &tp);
|
||||
if (tp.tv_sec > 0 || !tp.tv_nsec) {
|
||||
snd_printk(KERN_ERR
|
||||
"snd-hrtimer: Invalid resolution %u.%09u",
|
||||
pr_err("snd-hrtimer: Invalid resolution %u.%09u",
|
||||
(unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -375,7 +375,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
|
|||
*rhwdep = NULL;
|
||||
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
|
||||
if (hwdep == NULL) {
|
||||
snd_printk(KERN_ERR "hwdep: cannot allocate\n");
|
||||
dev_err(card->dev, "hwdep: cannot allocate\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
hwdep->card = card;
|
||||
|
@ -395,6 +395,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
|
|||
*rhwdep = hwdep;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_hwdep_new);
|
||||
|
||||
static int snd_hwdep_free(struct snd_hwdep *hwdep)
|
||||
{
|
||||
|
@ -415,37 +416,61 @@ static int snd_hwdep_dev_free(struct snd_device *device)
|
|||
static int snd_hwdep_dev_register(struct snd_device *device)
|
||||
{
|
||||
struct snd_hwdep *hwdep = device->device_data;
|
||||
struct snd_card *card = hwdep->card;
|
||||
struct device *dev;
|
||||
int err;
|
||||
char name[32];
|
||||
|
||||
mutex_lock(®ister_mutex);
|
||||
if (snd_hwdep_search(hwdep->card, hwdep->device)) {
|
||||
if (snd_hwdep_search(card, hwdep->device)) {
|
||||
mutex_unlock(®ister_mutex);
|
||||
return -EBUSY;
|
||||
}
|
||||
list_add_tail(&hwdep->list, &snd_hwdep_devices);
|
||||
sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device);
|
||||
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
|
||||
hwdep->card, hwdep->device,
|
||||
&snd_hwdep_f_ops, hwdep, name)) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
|
||||
hwdep->card->number, hwdep->device);
|
||||
dev = hwdep->dev;
|
||||
if (!dev)
|
||||
dev = snd_card_get_device_link(hwdep->card);
|
||||
err = snd_register_device_for_dev(SNDRV_DEVICE_TYPE_HWDEP,
|
||||
hwdep->card, hwdep->device,
|
||||
&snd_hwdep_f_ops, hwdep, name, dev);
|
||||
if (err < 0) {
|
||||
dev_err(dev,
|
||||
"unable to register hardware dependent device %i:%i\n",
|
||||
card->number, hwdep->device);
|
||||
list_del(&hwdep->list);
|
||||
mutex_unlock(®ister_mutex);
|
||||
return err;
|
||||
}
|
||||
|
||||
if (hwdep->groups) {
|
||||
struct device *d = snd_get_device(SNDRV_DEVICE_TYPE_HWDEP,
|
||||
hwdep->card, hwdep->device);
|
||||
if (d) {
|
||||
if (hwdep->private_data)
|
||||
dev_set_drvdata(d, hwdep->private_data);
|
||||
err = sysfs_create_groups(&d->kobj, hwdep->groups);
|
||||
if (err < 0)
|
||||
dev_warn(dev,
|
||||
"hwdep %d:%d: cannot create sysfs groups\n",
|
||||
card->number, hwdep->device);
|
||||
put_device(d);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SND_OSSEMUL
|
||||
hwdep->ossreg = 0;
|
||||
if (hwdep->oss_type >= 0) {
|
||||
if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 0)) {
|
||||
snd_printk (KERN_WARNING "only hwdep device 0 can be registered as OSS direct FM device!\n");
|
||||
dev_warn(dev,
|
||||
"only hwdep device 0 can be registered as OSS direct FM device!\n");
|
||||
} else {
|
||||
if (snd_register_oss_device(hwdep->oss_type,
|
||||
hwdep->card, hwdep->device,
|
||||
&snd_hwdep_f_ops, hwdep,
|
||||
hwdep->oss_dev) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n",
|
||||
hwdep->card->number, hwdep->device);
|
||||
card, hwdep->device,
|
||||
&snd_hwdep_f_ops, hwdep) < 0) {
|
||||
dev_err(dev,
|
||||
"unable to register OSS compatibility device %i:%i\n",
|
||||
card->number, hwdep->device);
|
||||
} else
|
||||
hwdep->ossreg = 1;
|
||||
}
|
||||
|
@ -543,5 +568,3 @@ static void __exit alsa_hwdep_exit(void)
|
|||
|
||||
module_init(alsa_hwdep_init)
|
||||
module_exit(alsa_hwdep_exit)
|
||||
|
||||
EXPORT_SYMBOL(snd_hwdep_new);
|
||||
|
|
|
@ -418,9 +418,14 @@ static int snd_info_entry_release(struct inode *inode, struct file *file)
|
|||
if (entry->c.text.write) {
|
||||
entry->c.text.write(entry, data->wbuffer);
|
||||
if (data->wbuffer->error) {
|
||||
snd_printk(KERN_WARNING "data write error to %s (%i)\n",
|
||||
entry->name,
|
||||
data->wbuffer->error);
|
||||
if (entry->card)
|
||||
dev_warn(entry->card->dev, "info: data write error to %s (%i)\n",
|
||||
entry->name,
|
||||
data->wbuffer->error);
|
||||
else
|
||||
pr_warn("ALSA: info: data write error to %s (%i)\n",
|
||||
entry->name,
|
||||
data->wbuffer->error);
|
||||
}
|
||||
}
|
||||
kfree(data->wbuffer->buffer);
|
||||
|
@ -540,7 +545,7 @@ int __init snd_info_init(void)
|
|||
snd_oss_root = entry;
|
||||
}
|
||||
#endif
|
||||
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
|
||||
{
|
||||
struct snd_info_entry *entry;
|
||||
if ((entry = snd_info_create_module_entry(THIS_MODULE, "seq", NULL)) == NULL)
|
||||
|
@ -567,7 +572,7 @@ int __exit snd_info_done(void)
|
|||
snd_minor_info_done();
|
||||
snd_info_version_done();
|
||||
if (snd_proc_root) {
|
||||
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
|
||||
snd_info_free_entry(snd_seq_root);
|
||||
#endif
|
||||
#ifdef CONFIG_SND_OSSEMUL
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <linux/time.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/completion.h>
|
||||
|
||||
#include <sound/core.h>
|
||||
#include <sound/control.h>
|
||||
|
@ -94,7 +95,7 @@ static int module_slot_match(struct module *module, int idx)
|
|||
return match;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
|
||||
int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
|
||||
EXPORT_SYMBOL(snd_mixer_oss_notify_callback);
|
||||
#endif
|
||||
|
@ -112,11 +113,11 @@ static inline int init_info_for_card(struct snd_card *card)
|
|||
struct snd_info_entry *entry;
|
||||
|
||||
if ((err = snd_info_card_register(card)) < 0) {
|
||||
snd_printd("unable to create card info\n");
|
||||
dev_dbg(card->dev, "unable to create card info\n");
|
||||
return err;
|
||||
}
|
||||
if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
|
||||
snd_printd("unable to create card entry\n");
|
||||
dev_dbg(card->dev, "unable to create card entry\n");
|
||||
return err;
|
||||
}
|
||||
entry->c.text.read = snd_card_id_read;
|
||||
|
@ -156,8 +157,17 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int),
|
|||
return mask; /* unchanged */
|
||||
}
|
||||
|
||||
static int snd_card_do_free(struct snd_card *card);
|
||||
static const struct attribute_group *card_dev_attr_groups[];
|
||||
|
||||
static void release_card_device(struct device *dev)
|
||||
{
|
||||
snd_card_do_free(dev_to_snd_card(dev));
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_card_create - create and initialize a soundcard structure
|
||||
* snd_card_new - create and initialize a soundcard structure
|
||||
* @parent: the parent device object
|
||||
* @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
|
||||
* @xid: card identification (ASCII string)
|
||||
* @module: top level module for locking
|
||||
|
@ -172,7 +182,7 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int),
|
|||
*
|
||||
* Return: Zero if successful or a negative error code.
|
||||
*/
|
||||
int snd_card_create(int idx, const char *xid,
|
||||
int snd_card_new(struct device *parent, int idx, const char *xid,
|
||||
struct module *module, int extra_size,
|
||||
struct snd_card **card_ret)
|
||||
{
|
||||
|
@ -188,6 +198,8 @@ int snd_card_create(int idx, const char *xid,
|
|||
card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
|
||||
if (!card)
|
||||
return -ENOMEM;
|
||||
if (extra_size > 0)
|
||||
card->private_data = (char *)card + sizeof(struct snd_card);
|
||||
if (xid)
|
||||
strlcpy(card->id, xid, sizeof(card->id));
|
||||
err = 0;
|
||||
|
@ -205,14 +217,16 @@ int snd_card_create(int idx, const char *xid,
|
|||
err = -ENODEV;
|
||||
if (err < 0) {
|
||||
mutex_unlock(&snd_card_mutex);
|
||||
snd_printk(KERN_ERR "cannot find the slot for index %d (range 0-%i), error: %d\n",
|
||||
dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n",
|
||||
idx, snd_ecards_limit - 1, err);
|
||||
goto __error;
|
||||
kfree(card);
|
||||
return err;
|
||||
}
|
||||
set_bit(idx, snd_cards_lock); /* lock it */
|
||||
if (idx >= snd_ecards_limit)
|
||||
snd_ecards_limit = idx + 1; /* increase the limit */
|
||||
mutex_unlock(&snd_card_mutex);
|
||||
card->dev = parent;
|
||||
card->number = idx;
|
||||
card->module = module;
|
||||
INIT_LIST_HEAD(&card->devices);
|
||||
|
@ -222,36 +236,42 @@ int snd_card_create(int idx, const char *xid,
|
|||
INIT_LIST_HEAD(&card->ctl_files);
|
||||
spin_lock_init(&card->files_lock);
|
||||
INIT_LIST_HEAD(&card->files_list);
|
||||
init_waitqueue_head(&card->shutdown_sleep);
|
||||
atomic_set(&card->refcount, 0);
|
||||
#ifdef CONFIG_PM
|
||||
mutex_init(&card->power_lock);
|
||||
init_waitqueue_head(&card->power_sleep);
|
||||
#endif
|
||||
|
||||
device_initialize(&card->card_dev);
|
||||
card->card_dev.parent = parent;
|
||||
card->card_dev.class = sound_class;
|
||||
card->card_dev.release = release_card_device;
|
||||
card->card_dev.groups = card_dev_attr_groups;
|
||||
err = kobject_set_name(&card->card_dev.kobj, "card%d", idx);
|
||||
if (err < 0)
|
||||
goto __error;
|
||||
|
||||
/* the control interface cannot be accessed from the user space until */
|
||||
/* snd_cards_bitmask and snd_cards are set with snd_card_register */
|
||||
err = snd_ctl_create(card);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "unable to register control minors\n");
|
||||
dev_err(parent, "unable to register control minors\n");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_info_card_create(card);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "unable to create card info\n");
|
||||
dev_err(parent, "unable to create card info\n");
|
||||
goto __error_ctl;
|
||||
}
|
||||
if (extra_size > 0)
|
||||
card->private_data = (char *)card + sizeof(struct snd_card);
|
||||
*card_ret = card;
|
||||
return 0;
|
||||
|
||||
__error_ctl:
|
||||
snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
|
||||
snd_device_free_all(card);
|
||||
__error:
|
||||
kfree(card);
|
||||
put_device(&card->card_dev);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_card_create);
|
||||
EXPORT_SYMBOL(snd_card_new);
|
||||
|
||||
/* return non-zero if a card is already locked */
|
||||
int snd_card_locked(int card)
|
||||
|
@ -394,7 +414,7 @@ int snd_card_disconnect(struct snd_card *card)
|
|||
/* phase 3: notify all connected devices about disconnection */
|
||||
/* at this point, they cannot respond to any calls except release() */
|
||||
|
||||
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
|
||||
if (snd_mixer_oss_notify_callback)
|
||||
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
|
||||
#endif
|
||||
|
@ -402,12 +422,12 @@ int snd_card_disconnect(struct snd_card *card)
|
|||
/* notify all devices that we are disconnected */
|
||||
err = snd_device_disconnect_all(card);
|
||||
if (err < 0)
|
||||
snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
|
||||
dev_err(card->dev, "not all devices for card %i can be disconnected\n", card->number);
|
||||
|
||||
snd_info_card_disconnect(card);
|
||||
if (card->card_dev) {
|
||||
device_unregister(card->card_dev);
|
||||
card->card_dev = NULL;
|
||||
if (card->registered) {
|
||||
device_del(&card->card_dev);
|
||||
card->registered = false;
|
||||
}
|
||||
#ifdef CONFIG_PM
|
||||
wake_up(&card->power_sleep);
|
||||
|
@ -430,81 +450,48 @@ EXPORT_SYMBOL(snd_card_disconnect);
|
|||
*/
|
||||
static int snd_card_do_free(struct snd_card *card)
|
||||
{
|
||||
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
|
||||
if (snd_mixer_oss_notify_callback)
|
||||
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
|
||||
#endif
|
||||
if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) {
|
||||
snd_printk(KERN_ERR "unable to free all devices (pre)\n");
|
||||
/* Fatal, but this situation should never occur */
|
||||
}
|
||||
if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) {
|
||||
snd_printk(KERN_ERR "unable to free all devices (normal)\n");
|
||||
/* Fatal, but this situation should never occur */
|
||||
}
|
||||
if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) {
|
||||
snd_printk(KERN_ERR "unable to free all devices (post)\n");
|
||||
/* Fatal, but this situation should never occur */
|
||||
}
|
||||
snd_device_free_all(card);
|
||||
if (card->private_free)
|
||||
card->private_free(card);
|
||||
snd_info_free_entry(card->proc_id);
|
||||
if (snd_info_card_free(card) < 0) {
|
||||
snd_printk(KERN_WARNING "unable to free card info\n");
|
||||
dev_warn(card->dev, "unable to free card info\n");
|
||||
/* Not fatal error */
|
||||
}
|
||||
if (card->release_completion)
|
||||
complete(card->release_completion);
|
||||
kfree(card);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_card_unref - release the reference counter
|
||||
* @card: the card instance
|
||||
*
|
||||
* Decrements the reference counter. When it reaches to zero, wake up
|
||||
* the sleeper and call the destructor if needed.
|
||||
*/
|
||||
void snd_card_unref(struct snd_card *card)
|
||||
{
|
||||
if (atomic_dec_and_test(&card->refcount)) {
|
||||
wake_up(&card->shutdown_sleep);
|
||||
if (card->free_on_last_close)
|
||||
snd_card_do_free(card);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(snd_card_unref);
|
||||
|
||||
int snd_card_free_when_closed(struct snd_card *card)
|
||||
{
|
||||
int ret;
|
||||
|
||||
atomic_inc(&card->refcount);
|
||||
ret = snd_card_disconnect(card);
|
||||
if (ret) {
|
||||
atomic_dec(&card->refcount);
|
||||
return ret;
|
||||
}
|
||||
|
||||
card->free_on_last_close = 1;
|
||||
if (atomic_dec_and_test(&card->refcount))
|
||||
snd_card_do_free(card);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(snd_card_free_when_closed);
|
||||
|
||||
int snd_card_free(struct snd_card *card)
|
||||
{
|
||||
int ret = snd_card_disconnect(card);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* wait, until all devices are ready for the free operation */
|
||||
wait_event(card->shutdown_sleep, !atomic_read(&card->refcount));
|
||||
snd_card_do_free(card);
|
||||
put_device(&card->card_dev);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_card_free_when_closed);
|
||||
|
||||
int snd_card_free(struct snd_card *card)
|
||||
{
|
||||
struct completion released;
|
||||
int ret;
|
||||
|
||||
init_completion(&released);
|
||||
card->release_completion = &released;
|
||||
ret = snd_card_free_when_closed(card);
|
||||
if (ret)
|
||||
return ret;
|
||||
/* wait, until all devices are ready for the free operation */
|
||||
wait_for_completion(&released);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_card_free);
|
||||
|
||||
/* retrieve the last word of shortname or longname */
|
||||
|
@ -598,7 +585,7 @@ static void snd_card_set_id_no_lock(struct snd_card *card, const char *src,
|
|||
goto again;
|
||||
}
|
||||
/* last resort... */
|
||||
snd_printk(KERN_ERR "unable to set card id (%s)\n", id);
|
||||
dev_err(card->dev, "unable to set card id (%s)\n", id);
|
||||
if (card->proc_root->name)
|
||||
strlcpy(card->id, card->proc_root->name, sizeof(card->id));
|
||||
}
|
||||
|
@ -626,15 +613,15 @@ static ssize_t
|
|||
card_id_show_attr(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", card ? card->id : "(null)");
|
||||
struct snd_card *card = container_of(dev, struct snd_card, card_dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%s\n", card->id);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
card_id_store_attr(struct device *dev, struct device_attribute *attr,
|
||||
const char *buf, size_t count)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
struct snd_card *card = container_of(dev, struct snd_card, card_dev);
|
||||
char buf1[sizeof(card->id)];
|
||||
size_t copy = count > sizeof(card->id) - 1 ?
|
||||
sizeof(card->id) - 1 : count;
|
||||
|
@ -660,19 +647,32 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
|
|||
return count;
|
||||
}
|
||||
|
||||
static struct device_attribute card_id_attrs =
|
||||
__ATTR(id, S_IRUGO | S_IWUSR, card_id_show_attr, card_id_store_attr);
|
||||
static DEVICE_ATTR(id, S_IRUGO | S_IWUSR, card_id_show_attr, card_id_store_attr);
|
||||
|
||||
static ssize_t
|
||||
card_number_show_attr(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n", card ? card->number : -1);
|
||||
struct snd_card *card = container_of(dev, struct snd_card, card_dev);
|
||||
return snprintf(buf, PAGE_SIZE, "%i\n", card->number);
|
||||
}
|
||||
|
||||
static struct device_attribute card_number_attrs =
|
||||
__ATTR(number, S_IRUGO, card_number_show_attr, NULL);
|
||||
static DEVICE_ATTR(number, S_IRUGO, card_number_show_attr, NULL);
|
||||
|
||||
static struct attribute *card_dev_attrs[] = {
|
||||
&dev_attr_id.attr,
|
||||
&dev_attr_number.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group card_dev_attr_group = {
|
||||
.attrs = card_dev_attrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *card_dev_attr_groups[] = {
|
||||
&card_dev_attr_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* snd_card_register - register the soundcard
|
||||
|
@ -692,12 +692,11 @@ int snd_card_register(struct snd_card *card)
|
|||
if (snd_BUG_ON(!card))
|
||||
return -EINVAL;
|
||||
|
||||
if (!card->card_dev) {
|
||||
card->card_dev = device_create(sound_class, card->dev,
|
||||
MKDEV(0, 0), card,
|
||||
"card%i", card->number);
|
||||
if (IS_ERR(card->card_dev))
|
||||
card->card_dev = NULL;
|
||||
if (!card->registered) {
|
||||
err = device_add(&card->card_dev);
|
||||
if (err < 0)
|
||||
return err;
|
||||
card->registered = true;
|
||||
}
|
||||
|
||||
if ((err = snd_device_register_all(card)) < 0)
|
||||
|
@ -723,19 +722,10 @@ int snd_card_register(struct snd_card *card)
|
|||
snd_cards[card->number] = card;
|
||||
mutex_unlock(&snd_card_mutex);
|
||||
init_info_for_card(card);
|
||||
#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
|
||||
if (snd_mixer_oss_notify_callback)
|
||||
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
|
||||
#endif
|
||||
if (card->card_dev) {
|
||||
err = device_create_file(card->card_dev, &card_id_attrs);
|
||||
if (err < 0)
|
||||
return err;
|
||||
err = device_create_file(card->card_dev, &card_number_attrs);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -908,7 +898,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
|
|||
return -ENODEV;
|
||||
}
|
||||
list_add(&mfile->list, &card->files_list);
|
||||
atomic_inc(&card->refcount);
|
||||
get_device(&card->card_dev);
|
||||
spin_unlock(&card->files_lock);
|
||||
return 0;
|
||||
}
|
||||
|
@ -947,11 +937,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
|
|||
}
|
||||
spin_unlock(&card->files_lock);
|
||||
if (!found) {
|
||||
snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
|
||||
dev_err(card->dev, "card file remove problem (%p)\n", file);
|
||||
return -ENOENT;
|
||||
}
|
||||
kfree(found);
|
||||
snd_card_unref(card);
|
||||
put_device(&card->card_dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size)
|
|||
result = result1;
|
||||
#ifdef CONFIG_SND_DEBUG
|
||||
if (result > size)
|
||||
snd_printk(KERN_ERR "pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size);
|
||||
pr_err("ALSA: pointer (0x%x) for DMA #%ld is greater than transfer size (0x%x)\n", result, dma, size);
|
||||
#endif
|
||||
if (result >= size || result == 0)
|
||||
return 0;
|
||||
|
|
|
@ -207,7 +207,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
printk(KERN_ERR "snd-malloc: invalid device type %d\n", type);
|
||||
pr_err("snd-malloc: invalid device type %d\n", type);
|
||||
dmab->area = NULL;
|
||||
dmab->addr = 0;
|
||||
return -ENXIO;
|
||||
|
@ -284,7 +284,7 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
printk(KERN_ERR "snd-malloc: invalid device type %d\n", dmab->dev.type);
|
||||
pr_err("snd-malloc: invalid device type %d\n", dmab->dev.type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1187,7 +1187,8 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry,
|
|||
if (oss_mixer_names[ch] && strcmp(oss_mixer_names[ch], str) == 0)
|
||||
break;
|
||||
if (ch >= SNDRV_OSS_MAX_MIXERS) {
|
||||
snd_printk(KERN_ERR "mixer_oss: invalid OSS volume '%s'\n", str);
|
||||
pr_err("ALSA: mixer_oss: invalid OSS volume '%s'\n",
|
||||
str);
|
||||
continue;
|
||||
}
|
||||
cptr = snd_info_get_str(str, cptr, sizeof(str));
|
||||
|
@ -1201,7 +1202,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry,
|
|||
snd_info_get_str(idxstr, cptr, sizeof(idxstr));
|
||||
idx = simple_strtoul(idxstr, NULL, 10);
|
||||
if (idx >= 0x4000) { /* too big */
|
||||
snd_printk(KERN_ERR "mixer_oss: invalid index %d\n", idx);
|
||||
pr_err("ALSA: mixer_oss: invalid index %d\n", idx);
|
||||
continue;
|
||||
}
|
||||
mutex_lock(&mixer->reg_mutex);
|
||||
|
@ -1212,7 +1213,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry,
|
|||
goto __unlock;
|
||||
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
||||
if (! tbl) {
|
||||
snd_printk(KERN_ERR "mixer_oss: no memory\n");
|
||||
pr_err("ALSA: mixer_oss: no memory\n");
|
||||
goto __unlock;
|
||||
}
|
||||
tbl->oss_id = ch;
|
||||
|
@ -1343,20 +1344,18 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
|
|||
struct snd_mixer_oss *mixer;
|
||||
|
||||
if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) {
|
||||
char name[128];
|
||||
int idx, err;
|
||||
|
||||
mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL);
|
||||
if (mixer == NULL)
|
||||
return -ENOMEM;
|
||||
mutex_init(&mixer->reg_mutex);
|
||||
sprintf(name, "mixer%i%i", card->number, 0);
|
||||
if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER,
|
||||
card, 0,
|
||||
&snd_mixer_oss_f_ops, card,
|
||||
name)) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n",
|
||||
card->number, 0);
|
||||
&snd_mixer_oss_f_ops, card)) < 0) {
|
||||
dev_err(card->dev,
|
||||
"unable to register OSS mixer device %i:%i\n",
|
||||
card->number, 0);
|
||||
kfree(mixer);
|
||||
return err;
|
||||
}
|
||||
|
@ -1365,7 +1364,8 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
|
|||
if (*card->mixername)
|
||||
strlcpy(mixer->name, card->mixername, sizeof(mixer->name));
|
||||
else
|
||||
strlcpy(mixer->name, name, sizeof(mixer->name));
|
||||
snprintf(mixer->name, sizeof(mixer->name),
|
||||
"mixer%i", card->number);
|
||||
#ifdef SNDRV_OSS_INFO_DEV_MIXERS
|
||||
snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIXERS,
|
||||
card->number,
|
||||
|
|
|
@ -854,7 +854,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|||
params = kmalloc(sizeof(*params), GFP_KERNEL);
|
||||
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
|
||||
if (!sw_params || !params || !sparams) {
|
||||
snd_printd("No memory\n");
|
||||
pcm_dbg(substream->pcm, "No memory\n");
|
||||
err = -ENOMEM;
|
||||
goto failure;
|
||||
}
|
||||
|
@ -877,7 +877,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|||
}
|
||||
err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask);
|
||||
if (err < 0) {
|
||||
snd_printd("No usable accesses\n");
|
||||
pcm_dbg(substream->pcm, "No usable accesses\n");
|
||||
err = -EINVAL;
|
||||
goto failure;
|
||||
}
|
||||
|
@ -902,7 +902,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|||
break;
|
||||
}
|
||||
if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) {
|
||||
snd_printd("Cannot find a format!!!\n");
|
||||
pcm_dbg(substream->pcm, "Cannot find a format!!!\n");
|
||||
err = -EINVAL;
|
||||
goto failure;
|
||||
}
|
||||
|
@ -942,14 +942,16 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|||
if ((err = snd_pcm_plug_format_plugins(substream,
|
||||
params,
|
||||
sparams)) < 0) {
|
||||
snd_printd("snd_pcm_plug_format_plugins failed: %i\n", err);
|
||||
pcm_dbg(substream->pcm,
|
||||
"snd_pcm_plug_format_plugins failed: %i\n", err);
|
||||
snd_pcm_oss_plugin_clear(substream);
|
||||
goto failure;
|
||||
}
|
||||
if (runtime->oss.plugin_first) {
|
||||
struct snd_pcm_plugin *plugin;
|
||||
if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) {
|
||||
snd_printd("snd_pcm_plugin_build_io failed: %i\n", err);
|
||||
pcm_dbg(substream->pcm,
|
||||
"snd_pcm_plugin_build_io failed: %i\n", err);
|
||||
snd_pcm_oss_plugin_clear(substream);
|
||||
goto failure;
|
||||
}
|
||||
|
@ -983,7 +985,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|||
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
|
||||
|
||||
if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) {
|
||||
snd_printd("HW_PARAMS failed: %i\n", err);
|
||||
pcm_dbg(substream->pcm, "HW_PARAMS failed: %i\n", err);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -1016,7 +1018,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
|||
}
|
||||
|
||||
if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params)) < 0) {
|
||||
snd_printd("SW_PARAMS failed: %i\n", err);
|
||||
pcm_dbg(substream->pcm, "SW_PARAMS failed: %i\n", err);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
|
@ -1110,7 +1112,8 @@ static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream)
|
|||
|
||||
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL);
|
||||
if (err < 0) {
|
||||
snd_printd("snd_pcm_oss_prepare: SNDRV_PCM_IOCTL_PREPARE failed\n");
|
||||
pcm_dbg(substream->pcm,
|
||||
"snd_pcm_oss_prepare: SNDRV_PCM_IOCTL_PREPARE failed\n");
|
||||
return err;
|
||||
}
|
||||
runtime->oss.prepare = 0;
|
||||
|
@ -1175,12 +1178,10 @@ snd_pcm_sframes_t snd_pcm_oss_write3(struct snd_pcm_substream *substream, const
|
|||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||
#ifdef OSS_DEBUG
|
||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
||||
printk(KERN_DEBUG "pcm_oss: write: "
|
||||
"recovering from XRUN\n");
|
||||
else
|
||||
printk(KERN_DEBUG "pcm_oss: write: "
|
||||
"recovering from SUSPEND\n");
|
||||
pcm_dbg(substream->pcm,
|
||||
"pcm_oss: write: recovering from %s\n",
|
||||
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||
"XRUN" : "SUSPEND");
|
||||
#endif
|
||||
ret = snd_pcm_oss_prepare(substream);
|
||||
if (ret < 0)
|
||||
|
@ -1213,12 +1214,10 @@ snd_pcm_sframes_t snd_pcm_oss_read3(struct snd_pcm_substream *substream, char *p
|
|||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||
#ifdef OSS_DEBUG
|
||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
||||
printk(KERN_DEBUG "pcm_oss: read: "
|
||||
"recovering from XRUN\n");
|
||||
else
|
||||
printk(KERN_DEBUG "pcm_oss: read: "
|
||||
"recovering from SUSPEND\n");
|
||||
pcm_dbg(substream->pcm,
|
||||
"pcm_oss: read: recovering from %s\n",
|
||||
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||
"XRUN" : "SUSPEND");
|
||||
#endif
|
||||
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
||||
if (ret < 0)
|
||||
|
@ -1261,12 +1260,10 @@ snd_pcm_sframes_t snd_pcm_oss_writev3(struct snd_pcm_substream *substream, void
|
|||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||
#ifdef OSS_DEBUG
|
||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
||||
printk(KERN_DEBUG "pcm_oss: writev: "
|
||||
"recovering from XRUN\n");
|
||||
else
|
||||
printk(KERN_DEBUG "pcm_oss: writev: "
|
||||
"recovering from SUSPEND\n");
|
||||
pcm_dbg(substream->pcm,
|
||||
"pcm_oss: writev: recovering from %s\n",
|
||||
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||
"XRUN" : "SUSPEND");
|
||||
#endif
|
||||
ret = snd_pcm_oss_prepare(substream);
|
||||
if (ret < 0)
|
||||
|
@ -1299,12 +1296,10 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(struct snd_pcm_substream *substream, void *
|
|||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||
#ifdef OSS_DEBUG
|
||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
||||
printk(KERN_DEBUG "pcm_oss: readv: "
|
||||
"recovering from XRUN\n");
|
||||
else
|
||||
printk(KERN_DEBUG "pcm_oss: readv: "
|
||||
"recovering from SUSPEND\n");
|
||||
pcm_dbg(substream->pcm,
|
||||
"pcm_oss: readv: recovering from %s\n",
|
||||
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||
"XRUN" : "SUSPEND");
|
||||
#endif
|
||||
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
||||
if (ret < 0)
|
||||
|
@ -1561,7 +1556,7 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
|
|||
init_waitqueue_entry(&wait, current);
|
||||
add_wait_queue(&runtime->sleep, &wait);
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "sync1: size = %li\n", size);
|
||||
pcm_dbg(substream->pcm, "sync1: size = %li\n", size);
|
||||
#endif
|
||||
while (1) {
|
||||
result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 1);
|
||||
|
@ -1587,7 +1582,8 @@ static int snd_pcm_oss_sync1(struct snd_pcm_substream *substream, size_t size)
|
|||
break;
|
||||
}
|
||||
if (res == 0) {
|
||||
snd_printk(KERN_ERR "OSS sync error - DMA timeout\n");
|
||||
pcm_err(substream->pcm,
|
||||
"OSS sync error - DMA timeout\n");
|
||||
result = -EIO;
|
||||
break;
|
||||
}
|
||||
|
@ -1618,7 +1614,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
|
|||
mutex_lock(&runtime->oss.params_lock);
|
||||
if (runtime->oss.buffer_used > 0) {
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "sync: buffer_used\n");
|
||||
pcm_dbg(substream->pcm, "sync: buffer_used\n");
|
||||
#endif
|
||||
size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width;
|
||||
snd_pcm_format_set_silence(format,
|
||||
|
@ -1631,7 +1627,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
|
|||
}
|
||||
} else if (runtime->oss.period_ptr > 0) {
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "sync: period_ptr\n");
|
||||
pcm_dbg(substream->pcm, "sync: period_ptr\n");
|
||||
#endif
|
||||
size = runtime->oss.period_bytes - runtime->oss.period_ptr;
|
||||
snd_pcm_format_set_silence(format,
|
||||
|
@ -1983,7 +1979,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
|
|||
int err, cmd;
|
||||
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "pcm_oss: trigger = 0x%x\n", trigger);
|
||||
pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger);
|
||||
#endif
|
||||
|
||||
psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
|
@ -2203,9 +2199,9 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
|
|||
}
|
||||
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "pcm_oss: space: bytes = %i, fragments = %i, "
|
||||
"fragstotal = %i, fragsize = %i\n",
|
||||
info.bytes, info.fragments, info.fragstotal, info.fragsize);
|
||||
pcm_dbg(substream->pcm,
|
||||
"pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize = %i\n",
|
||||
info.bytes, info.fragments, info.fragstotal, info.fragsize);
|
||||
#endif
|
||||
if (copy_to_user(_info, &info, sizeof(info)))
|
||||
return -EFAULT;
|
||||
|
@ -2215,7 +2211,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre
|
|||
static int snd_pcm_oss_get_mapbuf(struct snd_pcm_oss_file *pcm_oss_file, int stream, struct buffmem_desc __user * _info)
|
||||
{
|
||||
// it won't be probably implemented
|
||||
// snd_printd("TODO: snd_pcm_oss_get_mapbuf\n");
|
||||
// pr_debug("TODO: snd_pcm_oss_get_mapbuf\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -2519,7 +2515,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
|
|||
if (((cmd >> 8) & 0xff) != 'P')
|
||||
return -EINVAL;
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "pcm_oss: ioctl = 0x%x\n", cmd);
|
||||
pr_debug("pcm_oss: ioctl = 0x%x\n", cmd);
|
||||
#endif
|
||||
switch (cmd) {
|
||||
case SNDCTL_DSP_RESET:
|
||||
|
@ -2646,7 +2642,7 @@ static long snd_pcm_oss_ioctl(struct file *file, unsigned int cmd, unsigned long
|
|||
case SNDCTL_DSP_PROFILE:
|
||||
return 0; /* silently ignore */
|
||||
default:
|
||||
snd_printd("pcm_oss: unknown command = 0x%x\n", cmd);
|
||||
pr_debug("pcm_oss: unknown command = 0x%x\n", cmd);
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -2673,8 +2669,9 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun
|
|||
#else
|
||||
{
|
||||
ssize_t res = snd_pcm_oss_read1(substream, buf, count);
|
||||
printk(KERN_DEBUG "pcm_oss: read %li bytes "
|
||||
"(returned %li bytes)\n", (long)count, (long)res);
|
||||
pcm_dbg(substream->pcm,
|
||||
"pcm_oss: read %li bytes (returned %li bytes)\n",
|
||||
(long)count, (long)res);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
@ -2693,7 +2690,7 @@ static ssize_t snd_pcm_oss_write(struct file *file, const char __user *buf, size
|
|||
substream->f_flags = file->f_flags & O_NONBLOCK;
|
||||
result = snd_pcm_oss_write1(substream, buf, count);
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "pcm_oss: write %li bytes (wrote %li bytes)\n",
|
||||
pcm_dbg(substream->pcm, "pcm_oss: write %li bytes (wrote %li bytes)\n",
|
||||
(long)count, (long)result);
|
||||
#endif
|
||||
return result;
|
||||
|
@ -2772,7 +2769,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
|
|||
int err;
|
||||
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "pcm_oss: mmap begin\n");
|
||||
pr_debug("pcm_oss: mmap begin\n");
|
||||
#endif
|
||||
pcm_oss_file = file->private_data;
|
||||
switch ((area->vm_flags & (VM_READ | VM_WRITE))) {
|
||||
|
@ -2822,7 +2819,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
|
|||
runtime->silence_threshold = 0;
|
||||
runtime->silence_size = 0;
|
||||
#ifdef OSS_DEBUG
|
||||
printk(KERN_DEBUG "pcm_oss: mmap ok, bytes = 0x%x\n",
|
||||
pr_debug("pcm_oss: mmap ok, bytes = 0x%x\n",
|
||||
runtime->oss.mmap_bytes);
|
||||
#endif
|
||||
/* In mmap mode we never stop */
|
||||
|
@ -3007,12 +3004,10 @@ static const struct file_operations snd_pcm_oss_f_reg =
|
|||
|
||||
static void register_oss_dsp(struct snd_pcm *pcm, int index)
|
||||
{
|
||||
char name[128];
|
||||
sprintf(name, "dsp%i%i", pcm->card->number, pcm->device);
|
||||
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
|
||||
pcm->card, index, &snd_pcm_oss_f_reg,
|
||||
pcm, name) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n",
|
||||
pcm) < 0) {
|
||||
pcm_err(pcm, "unable to register OSS PCM device %i:%i\n",
|
||||
pcm->card->number, pcm->device);
|
||||
}
|
||||
}
|
||||
|
@ -3093,12 +3088,12 @@ static int __init alsa_pcm_oss_init(void)
|
|||
/* check device map table */
|
||||
for (i = 0; i < SNDRV_CARDS; i++) {
|
||||
if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) {
|
||||
snd_printk(KERN_ERR "invalid dsp_map[%d] = %d\n",
|
||||
pr_err("ALSA: pcm_oss: invalid dsp_map[%d] = %d\n",
|
||||
i, dsp_map[i]);
|
||||
dsp_map[i] = 0;
|
||||
}
|
||||
if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) {
|
||||
snd_printk(KERN_ERR "invalid adsp_map[%d] = %d\n",
|
||||
pr_err("ALSA: pcm_oss: invalid adsp_map[%d] = %d\n",
|
||||
i, adsp_map[i]);
|
||||
adsp_map[i] = 1;
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ static const char *snd_pcm_state_name(snd_pcm_state_t state)
|
|||
return snd_pcm_state_names[(__force int)state];
|
||||
}
|
||||
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
#include <linux/soundcard.h>
|
||||
|
||||
static const char *snd_pcm_oss_format_name(int format)
|
||||
|
@ -338,7 +338,8 @@ static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
|
|||
|
||||
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
||||
if (! info) {
|
||||
printk(KERN_DEBUG "snd_pcm_proc_info_read: cannot malloc\n");
|
||||
pcm_dbg(substream->pcm,
|
||||
"snd_pcm_proc_info_read: cannot malloc\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -398,7 +399,7 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
|
|||
snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den);
|
||||
snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size);
|
||||
snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size);
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
if (substream->oss.oss) {
|
||||
snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format));
|
||||
snd_iprintf(buffer, "OSS channels: %u\n", runtime->oss.channels);
|
||||
|
@ -651,7 +652,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
|
|||
struct snd_pcm_str *pstr = &pcm->streams[stream];
|
||||
struct snd_pcm_substream *substream, *prev;
|
||||
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
mutex_init(&pstr->oss.setup_mutex);
|
||||
#endif
|
||||
pstr->stream = stream;
|
||||
|
@ -660,7 +661,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
|
|||
if (substream_count > 0 && !pcm->internal) {
|
||||
err = snd_pcm_stream_proc_init(pstr);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
|
||||
pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +669,7 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
|
|||
for (idx = 0, prev = NULL; idx < substream_count; idx++) {
|
||||
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
||||
if (substream == NULL) {
|
||||
snd_printk(KERN_ERR "Cannot allocate PCM substream\n");
|
||||
pcm_err(pcm, "Cannot allocate PCM substream\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
substream->pcm = pcm;
|
||||
|
@ -685,7 +686,8 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
|
|||
if (!pcm->internal) {
|
||||
err = snd_pcm_substream_proc_init(substream);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
|
||||
pcm_err(pcm,
|
||||
"Error in snd_pcm_stream_proc_init\n");
|
||||
if (prev == NULL)
|
||||
pstr->substream = NULL;
|
||||
else
|
||||
|
@ -724,7 +726,7 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
|
|||
*rpcm = NULL;
|
||||
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
|
||||
if (pcm == NULL) {
|
||||
snd_printk(KERN_ERR "Cannot allocate PCM\n");
|
||||
dev_err(card->dev, "Cannot allocate PCM\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
pcm->card = card;
|
||||
|
@ -807,7 +809,7 @@ EXPORT_SYMBOL(snd_pcm_new_internal);
|
|||
static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
|
||||
{
|
||||
struct snd_pcm_substream *substream, *substream_next;
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
struct snd_pcm_oss_setup *setup, *setupn;
|
||||
#endif
|
||||
substream = pstr->substream;
|
||||
|
@ -819,7 +821,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
|
|||
substream = substream_next;
|
||||
}
|
||||
snd_pcm_stream_proc_done(pstr);
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
for (setup = pstr->oss.setup_list; setup; setup = setupn) {
|
||||
setupn = setup->next;
|
||||
kfree(setup->task_name);
|
||||
|
@ -1016,8 +1018,20 @@ static ssize_t show_pcm_class(struct device *dev,
|
|||
return snprintf(buf, PAGE_SIZE, "%s\n", str);
|
||||
}
|
||||
|
||||
static struct device_attribute pcm_attrs =
|
||||
__ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL);
|
||||
static DEVICE_ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL);
|
||||
static struct attribute *pcm_dev_attrs[] = {
|
||||
&dev_attr_pcm_class.attr,
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct attribute_group pcm_dev_attr_group = {
|
||||
.attrs = pcm_dev_attrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *pcm_dev_attr_groups[] = {
|
||||
&pcm_dev_attr_group,
|
||||
NULL
|
||||
};
|
||||
|
||||
static int snd_pcm_dev_register(struct snd_device *device)
|
||||
{
|
||||
|
@ -1067,8 +1081,18 @@ static int snd_pcm_dev_register(struct snd_device *device)
|
|||
mutex_unlock(®ister_mutex);
|
||||
return err;
|
||||
}
|
||||
snd_add_device_sysfs_file(devtype, pcm->card, pcm->device,
|
||||
&pcm_attrs);
|
||||
|
||||
dev = snd_get_device(devtype, pcm->card, pcm->device);
|
||||
if (dev) {
|
||||
err = sysfs_create_groups(&dev->kobj,
|
||||
pcm_dev_attr_groups);
|
||||
if (err < 0)
|
||||
dev_warn(dev,
|
||||
"pcm %d:%d: cannot create sysfs groups\n",
|
||||
pcm->card->number, pcm->device);
|
||||
put_device(dev);
|
||||
}
|
||||
|
||||
for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
|
||||
snd_pcm_timer_init(substream);
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ static void xrun(struct snd_pcm_substream *substream)
|
|||
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) {
|
||||
char name[16];
|
||||
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||
snd_printd(KERN_DEBUG "XRUN: %s\n", name);
|
||||
pcm_warn(substream->pcm, "XRUN: %s\n", name);
|
||||
dump_stack_on_xrun(substream);
|
||||
}
|
||||
}
|
||||
|
@ -184,9 +184,7 @@ static void xrun(struct snd_pcm_substream *substream)
|
|||
do { \
|
||||
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \
|
||||
xrun_log_show(substream); \
|
||||
if (snd_printd_ratelimit()) { \
|
||||
snd_printd("PCM: " fmt, ##args); \
|
||||
} \
|
||||
pr_err_ratelimited("ALSA: PCM: " fmt, ##args); \
|
||||
dump_stack_on_xrun(substream); \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -253,7 +251,7 @@ static void xrun_log_show(struct snd_pcm_substream *substream)
|
|||
entry = &log->entries[idx];
|
||||
if (entry->period_size == 0)
|
||||
break;
|
||||
snd_printd("hwptr log: %s: %sj=%lu, pos=%ld/%ld/%ld, "
|
||||
pr_info("hwptr log: %s: %sj=%lu, pos=%ld/%ld/%ld, "
|
||||
"hwptr=%ld/%ld\n",
|
||||
name, entry->in_interrupt ? "[Q] " : "",
|
||||
entry->jiffies,
|
||||
|
@ -342,14 +340,14 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
|
|||
return -EPIPE;
|
||||
}
|
||||
if (pos >= runtime->buffer_size) {
|
||||
if (snd_printd_ratelimit()) {
|
||||
if (printk_ratelimit()) {
|
||||
char name[16];
|
||||
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||
xrun_log_show(substream);
|
||||
snd_printd(KERN_ERR "BUG: %s, pos = %ld, "
|
||||
"buffer size = %ld, period size = %ld\n",
|
||||
name, pos, runtime->buffer_size,
|
||||
runtime->period_size);
|
||||
pcm_err(substream->pcm,
|
||||
"BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n",
|
||||
name, pos, runtime->buffer_size,
|
||||
runtime->period_size);
|
||||
}
|
||||
pos = 0;
|
||||
}
|
||||
|
@ -394,8 +392,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
|
|||
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
|
||||
char name[16];
|
||||
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||
snd_printd("%s_update: %s: pos=%u/%u/%u, "
|
||||
"hwptr=%ld/%ld/%ld/%ld\n",
|
||||
pcm_dbg(substream->pcm,
|
||||
"%s_update: %s: pos=%u/%u/%u, hwptr=%ld/%ld/%ld/%ld\n",
|
||||
in_interrupt ? "period" : "hwptr",
|
||||
name,
|
||||
(unsigned int)pos,
|
||||
|
@ -1242,6 +1240,7 @@ int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_par
|
|||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_pcm_hw_constraint_mask64);
|
||||
|
||||
/**
|
||||
* snd_pcm_hw_constraint_integer - apply an integer constraint to an interval
|
||||
|
@ -1941,8 +1940,9 @@ static int wait_for_avail(struct snd_pcm_substream *substream,
|
|||
continue;
|
||||
}
|
||||
if (!tout) {
|
||||
snd_printd("%s write error (DMA or IRQ trouble?)\n",
|
||||
is_playback ? "playback" : "capture");
|
||||
pcm_dbg(substream->pcm,
|
||||
"%s write error (DMA or IRQ trouble?)\n",
|
||||
is_playback ? "playback" : "capture");
|
||||
err = -EIO;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -190,12 +190,12 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
|||
if (!(params->rmask & (1 << k)))
|
||||
continue;
|
||||
#ifdef RULES_DEBUG
|
||||
printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]);
|
||||
printk("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
|
||||
pr_debug("%s = ", snd_pcm_hw_param_names[k]);
|
||||
pr_cont("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
|
||||
#endif
|
||||
changed = snd_mask_refine(m, constrs_mask(constrs, k));
|
||||
#ifdef RULES_DEBUG
|
||||
printk("%04x%04x%04x%04x\n", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
|
||||
pr_cont("%04x%04x%04x%04x\n", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
|
||||
#endif
|
||||
if (changed)
|
||||
params->cmask |= 1 << k;
|
||||
|
@ -210,21 +210,21 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
|||
if (!(params->rmask & (1 << k)))
|
||||
continue;
|
||||
#ifdef RULES_DEBUG
|
||||
printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]);
|
||||
pr_debug("%s = ", snd_pcm_hw_param_names[k]);
|
||||
if (i->empty)
|
||||
printk("empty");
|
||||
pr_cont("empty");
|
||||
else
|
||||
printk("%c%u %u%c",
|
||||
pr_cont("%c%u %u%c",
|
||||
i->openmin ? '(' : '[', i->min,
|
||||
i->max, i->openmax ? ')' : ']');
|
||||
printk(" -> ");
|
||||
pr_cont(" -> ");
|
||||
#endif
|
||||
changed = snd_interval_refine(i, constrs_interval(constrs, k));
|
||||
#ifdef RULES_DEBUG
|
||||
if (i->empty)
|
||||
printk("empty\n");
|
||||
pr_cont("empty\n");
|
||||
else
|
||||
printk("%c%u %u%c\n",
|
||||
pr_cont("%c%u %u%c\n",
|
||||
i->openmin ? '(' : '[', i->min,
|
||||
i->max, i->openmax ? ')' : ']');
|
||||
#endif
|
||||
|
@ -255,18 +255,18 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
|||
if (!doit)
|
||||
continue;
|
||||
#ifdef RULES_DEBUG
|
||||
printk(KERN_DEBUG "Rule %d [%p]: ", k, r->func);
|
||||
pr_debug("Rule %d [%p]: ", k, r->func);
|
||||
if (r->var >= 0) {
|
||||
printk("%s = ", snd_pcm_hw_param_names[r->var]);
|
||||
pr_cont("%s = ", snd_pcm_hw_param_names[r->var]);
|
||||
if (hw_is_mask(r->var)) {
|
||||
m = hw_param_mask(params, r->var);
|
||||
printk("%x", *m->bits);
|
||||
pr_cont("%x", *m->bits);
|
||||
} else {
|
||||
i = hw_param_interval(params, r->var);
|
||||
if (i->empty)
|
||||
printk("empty");
|
||||
pr_cont("empty");
|
||||
else
|
||||
printk("%c%u %u%c",
|
||||
pr_cont("%c%u %u%c",
|
||||
i->openmin ? '(' : '[', i->min,
|
||||
i->max, i->openmax ? ')' : ']');
|
||||
}
|
||||
|
@ -275,19 +275,19 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
|||
changed = r->func(params, r);
|
||||
#ifdef RULES_DEBUG
|
||||
if (r->var >= 0) {
|
||||
printk(" -> ");
|
||||
pr_cont(" -> ");
|
||||
if (hw_is_mask(r->var))
|
||||
printk("%x", *m->bits);
|
||||
pr_cont("%x", *m->bits);
|
||||
else {
|
||||
if (i->empty)
|
||||
printk("empty");
|
||||
pr_cont("empty");
|
||||
else
|
||||
printk("%c%u %u%c",
|
||||
pr_cont("%c%u %u%c",
|
||||
i->openmin ? '(' : '[', i->min,
|
||||
i->max, i->openmax ? ')' : ']');
|
||||
}
|
||||
}
|
||||
printk("\n");
|
||||
pr_cont("\n");
|
||||
#endif
|
||||
rstamps[k] = stamp;
|
||||
if (changed && r->var >= 0) {
|
||||
|
@ -399,7 +399,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
return -EBADFD;
|
||||
}
|
||||
snd_pcm_stream_unlock_irq(substream);
|
||||
#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
|
||||
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
|
||||
if (!substream->oss.oss)
|
||||
#endif
|
||||
if (atomic_read(&substream->mmap_count))
|
||||
|
@ -954,7 +954,7 @@ static struct action_ops snd_pcm_action_stop = {
|
|||
*
|
||||
* The state of each stream is then changed to the given state unconditionally.
|
||||
*
|
||||
* Return: Zero if succesful, or a negative error code.
|
||||
* Return: Zero if successful, or a negative error code.
|
||||
*/
|
||||
int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t state)
|
||||
{
|
||||
|
@ -1541,7 +1541,8 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
|
|||
if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
|
||||
result = -ESTRPIPE;
|
||||
else {
|
||||
snd_printd("playback drain error (DMA or IRQ trouble?)\n");
|
||||
dev_dbg(substream->pcm->card->dev,
|
||||
"playback drain error (DMA or IRQ trouble?)\n");
|
||||
snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
|
||||
result = -EIO;
|
||||
}
|
||||
|
@ -2066,7 +2067,7 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,
|
|||
|
||||
err = snd_pcm_hw_constraints_init(substream);
|
||||
if (err < 0) {
|
||||
snd_printd("snd_pcm_hw_constraints_init failed\n");
|
||||
pcm_dbg(pcm, "snd_pcm_hw_constraints_init failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -2077,7 +2078,7 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,
|
|||
|
||||
err = snd_pcm_hw_constraints_complete(substream);
|
||||
if (err < 0) {
|
||||
snd_printd("snd_pcm_hw_constraints_complete failed\n");
|
||||
pcm_dbg(pcm, "snd_pcm_hw_constraints_complete failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -2609,7 +2610,7 @@ static int snd_pcm_common_ioctl1(struct file *file,
|
|||
return res;
|
||||
}
|
||||
}
|
||||
snd_printd("unknown ioctl = 0x%x\n", cmd);
|
||||
pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd);
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,9 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
|
|||
post *= 2;
|
||||
}
|
||||
if (rate == 0) {
|
||||
snd_printk(KERN_ERR "pcm timer resolution out of range (rate = %u, period_size = %lu)\n", runtime->rate, runtime->period_size);
|
||||
pcm_err(substream->pcm,
|
||||
"pcm timer resolution out of range (rate = %u, period_size = %lu)\n",
|
||||
runtime->rate, runtime->period_size);
|
||||
runtime->timer_resolution = -1;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,13 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device);
|
|||
static LIST_HEAD(snd_rawmidi_devices);
|
||||
static DEFINE_MUTEX(register_mutex);
|
||||
|
||||
#define rmidi_err(rmidi, fmt, args...) \
|
||||
dev_err((rmidi)->card->dev, fmt, ##args)
|
||||
#define rmidi_warn(rmidi, fmt, args...) \
|
||||
dev_warn((rmidi)->card->dev, fmt, ##args)
|
||||
#define rmidi_dbg(rmidi, fmt, args...) \
|
||||
dev_dbg((rmidi)->card->dev, fmt, ##args)
|
||||
|
||||
static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device)
|
||||
{
|
||||
struct snd_rawmidi *rawmidi;
|
||||
|
@ -165,6 +172,7 @@ int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream)
|
|||
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_drop_output);
|
||||
|
||||
int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
|
||||
{
|
||||
|
@ -180,7 +188,9 @@ int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
|
|||
if (signal_pending(current))
|
||||
err = -ERESTARTSYS;
|
||||
if (runtime->avail < runtime->buffer_size && !timeout) {
|
||||
snd_printk(KERN_WARNING "rawmidi drain error (avail = %li, buffer_size = %li)\n", (long)runtime->avail, (long)runtime->buffer_size);
|
||||
rmidi_warn(substream->rmidi,
|
||||
"rawmidi drain error (avail = %li, buffer_size = %li)\n",
|
||||
(long)runtime->avail, (long)runtime->buffer_size);
|
||||
err = -EIO;
|
||||
}
|
||||
runtime->drain = 0;
|
||||
|
@ -194,6 +204,7 @@ int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
|
|||
}
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_drain_output);
|
||||
|
||||
int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream)
|
||||
{
|
||||
|
@ -208,6 +219,7 @@ int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream)
|
|||
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_drain_input);
|
||||
|
||||
/* look for an available substream for the given stream direction;
|
||||
* if a specific subdevice is given, try to assign it
|
||||
|
@ -345,6 +357,7 @@ int snd_rawmidi_kernel_open(struct snd_card *card, int device, int subdevice,
|
|||
module_put(rmidi->card->module);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_open);
|
||||
|
||||
static int snd_rawmidi_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
|
@ -523,6 +536,7 @@ int snd_rawmidi_kernel_release(struct snd_rawmidi_file *rfile)
|
|||
module_put(rmidi->card->module);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_release);
|
||||
|
||||
static int snd_rawmidi_release(struct inode *inode, struct file *file)
|
||||
{
|
||||
|
@ -599,6 +613,7 @@ int snd_rawmidi_info_select(struct snd_card *card, struct snd_rawmidi_info *info
|
|||
}
|
||||
return -ENXIO;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_info_select);
|
||||
|
||||
static int snd_rawmidi_info_select_user(struct snd_card *card,
|
||||
struct snd_rawmidi_info __user *_info)
|
||||
|
@ -646,6 +661,7 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,
|
|||
substream->active_sensing = !params->no_active_sensing;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_output_params);
|
||||
|
||||
int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
|
||||
struct snd_rawmidi_params * params)
|
||||
|
@ -671,6 +687,7 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
|
|||
runtime->avail_min = params->avail_min;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_input_params);
|
||||
|
||||
static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream,
|
||||
struct snd_rawmidi_status * status)
|
||||
|
@ -802,10 +819,9 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_SND_DEBUG
|
||||
default:
|
||||
snd_printk(KERN_WARNING "rawmidi: unknown command = 0x%x\n", cmd);
|
||||
#endif
|
||||
rmidi_dbg(rfile->rmidi,
|
||||
"rawmidi: unknown command = 0x%x\n", cmd);
|
||||
}
|
||||
return -ENOTTY;
|
||||
}
|
||||
|
@ -875,7 +891,8 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
|
|||
if (!substream->opened)
|
||||
return -EBADFD;
|
||||
if (runtime->buffer == NULL) {
|
||||
snd_printd("snd_rawmidi_receive: input is not active!!!\n");
|
||||
rmidi_dbg(substream->rmidi,
|
||||
"snd_rawmidi_receive: input is not active!!!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
spin_lock_irqsave(&runtime->lock, flags);
|
||||
|
@ -926,6 +943,7 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
|
|||
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_receive);
|
||||
|
||||
static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
|
||||
unsigned char __user *userbuf,
|
||||
|
@ -968,6 +986,7 @@ long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
|
|||
snd_rawmidi_input_trigger(substream, 1);
|
||||
return snd_rawmidi_kernel_read1(substream, NULL/*userbuf*/, buf, count);
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_read);
|
||||
|
||||
static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count,
|
||||
loff_t *offset)
|
||||
|
@ -1034,7 +1053,8 @@ int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
|
|||
unsigned long flags;
|
||||
|
||||
if (runtime->buffer == NULL) {
|
||||
snd_printd("snd_rawmidi_transmit_empty: output is not active!!!\n");
|
||||
rmidi_dbg(substream->rmidi,
|
||||
"snd_rawmidi_transmit_empty: output is not active!!!\n");
|
||||
return 1;
|
||||
}
|
||||
spin_lock_irqsave(&runtime->lock, flags);
|
||||
|
@ -1042,6 +1062,7 @@ int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
|
|||
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit_empty);
|
||||
|
||||
/**
|
||||
* snd_rawmidi_transmit_peek - copy data from the internal buffer
|
||||
|
@ -1065,7 +1086,8 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
|
|||
struct snd_rawmidi_runtime *runtime = substream->runtime;
|
||||
|
||||
if (runtime->buffer == NULL) {
|
||||
snd_printd("snd_rawmidi_transmit_peek: output is not active!!!\n");
|
||||
rmidi_dbg(substream->rmidi,
|
||||
"snd_rawmidi_transmit_peek: output is not active!!!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
result = 0;
|
||||
|
@ -1097,11 +1119,12 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
|
|||
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit_peek);
|
||||
|
||||
/**
|
||||
* snd_rawmidi_transmit_ack - acknowledge the transmission
|
||||
* @substream: the rawmidi substream
|
||||
* @count: the tranferred count
|
||||
* @count: the transferred count
|
||||
*
|
||||
* Advances the hardware pointer for the internal output buffer with
|
||||
* the given size and updates the condition.
|
||||
|
@ -1115,7 +1138,8 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
|
|||
struct snd_rawmidi_runtime *runtime = substream->runtime;
|
||||
|
||||
if (runtime->buffer == NULL) {
|
||||
snd_printd("snd_rawmidi_transmit_ack: output is not active!!!\n");
|
||||
rmidi_dbg(substream->rmidi,
|
||||
"snd_rawmidi_transmit_ack: output is not active!!!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
spin_lock_irqsave(&runtime->lock, flags);
|
||||
|
@ -1131,6 +1155,7 @@ int snd_rawmidi_transmit_ack(struct snd_rawmidi_substream *substream, int count)
|
|||
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||
return count;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit_ack);
|
||||
|
||||
/**
|
||||
* snd_rawmidi_transmit - copy from the buffer to the device
|
||||
|
@ -1152,6 +1177,7 @@ int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
|
|||
return count;
|
||||
return snd_rawmidi_transmit_ack(substream, count);
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit);
|
||||
|
||||
static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
|
||||
const unsigned char __user *userbuf,
|
||||
|
@ -1213,6 +1239,7 @@ long snd_rawmidi_kernel_write(struct snd_rawmidi_substream *substream,
|
|||
{
|
||||
return snd_rawmidi_kernel_write1(substream, NULL, buf, count);
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_write);
|
||||
|
||||
static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
|
||||
size_t count, loff_t *offset)
|
||||
|
@ -1413,7 +1440,7 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
|
|||
for (idx = 0; idx < count; idx++) {
|
||||
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
||||
if (substream == NULL) {
|
||||
snd_printk(KERN_ERR "rawmidi: cannot allocate substream\n");
|
||||
rmidi_err(rmidi, "rawmidi: cannot allocate substream\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
substream->stream = direction;
|
||||
|
@ -1458,7 +1485,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
|
|||
*rrawmidi = NULL;
|
||||
rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
|
||||
if (rmidi == NULL) {
|
||||
snd_printk(KERN_ERR "rawmidi: cannot allocate\n");
|
||||
dev_err(card->dev, "rawmidi: cannot allocate\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
rmidi->card = card;
|
||||
|
@ -1492,6 +1519,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
|
|||
*rrawmidi = rmidi;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_new);
|
||||
|
||||
static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream)
|
||||
{
|
||||
|
@ -1557,7 +1585,8 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
|
|||
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI,
|
||||
rmidi->card, rmidi->device,
|
||||
&snd_rawmidi_f_ops, rmidi, name)) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device);
|
||||
rmidi_err(rmidi, "unable to register rawmidi device %i:%i\n",
|
||||
rmidi->card->number, rmidi->device);
|
||||
list_del(&rmidi->list);
|
||||
mutex_unlock(®ister_mutex);
|
||||
return err;
|
||||
|
@ -1574,8 +1603,10 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
|
|||
if ((int)rmidi->device == midi_map[rmidi->card->number]) {
|
||||
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
|
||||
rmidi->card, 0, &snd_rawmidi_f_ops,
|
||||
rmidi, name) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
|
||||
rmidi) < 0) {
|
||||
rmidi_err(rmidi,
|
||||
"unable to register OSS rawmidi device %i:%i\n",
|
||||
rmidi->card->number, 0);
|
||||
} else {
|
||||
rmidi->ossreg++;
|
||||
#ifdef SNDRV_OSS_INFO_DEV_MIDI
|
||||
|
@ -1586,8 +1617,10 @@ static int snd_rawmidi_dev_register(struct snd_device *device)
|
|||
if ((int)rmidi->device == amidi_map[rmidi->card->number]) {
|
||||
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
|
||||
rmidi->card, 1, &snd_rawmidi_f_ops,
|
||||
rmidi, name) < 0) {
|
||||
snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
|
||||
rmidi) < 0) {
|
||||
rmidi_err(rmidi,
|
||||
"unable to register OSS rawmidi device %i:%i\n",
|
||||
rmidi->card->number, 1);
|
||||
} else {
|
||||
rmidi->ossreg++;
|
||||
}
|
||||
|
@ -1670,6 +1703,7 @@ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
|
|||
list_for_each_entry(substream, &rmidi->streams[stream].substreams, list)
|
||||
substream->ops = ops;
|
||||
}
|
||||
EXPORT_SYMBOL(snd_rawmidi_set_ops);
|
||||
|
||||
/*
|
||||
* ENTRY functions
|
||||
|
@ -1685,11 +1719,13 @@ static int __init alsa_rawmidi_init(void)
|
|||
/* check device map table */
|
||||
for (i = 0; i < SNDRV_CARDS; i++) {
|
||||
if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
|
||||
snd_printk(KERN_ERR "invalid midi_map[%d] = %d\n", i, midi_map[i]);
|
||||
pr_err("ALSA: rawmidi: invalid midi_map[%d] = %d\n",
|
||||
i, midi_map[i]);
|
||||
midi_map[i] = 0;
|
||||
}
|
||||
if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
|
||||
snd_printk(KERN_ERR "invalid amidi_map[%d] = %d\n", i, amidi_map[i]);
|
||||
pr_err("ALSA: rawmidi: invalid amidi_map[%d] = %d\n",
|
||||
i, amidi_map[i]);
|
||||
amidi_map[i] = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1706,21 +1742,3 @@ static void __exit alsa_rawmidi_exit(void)
|
|||
|
||||
module_init(alsa_rawmidi_init)
|
||||
module_exit(alsa_rawmidi_exit)
|
||||
|
||||
EXPORT_SYMBOL(snd_rawmidi_output_params);
|
||||
EXPORT_SYMBOL(snd_rawmidi_input_params);
|
||||
EXPORT_SYMBOL(snd_rawmidi_drop_output);
|
||||
EXPORT_SYMBOL(snd_rawmidi_drain_output);
|
||||
EXPORT_SYMBOL(snd_rawmidi_drain_input);
|
||||
EXPORT_SYMBOL(snd_rawmidi_receive);
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit_empty);
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit_peek);
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit_ack);
|
||||
EXPORT_SYMBOL(snd_rawmidi_transmit);
|
||||
EXPORT_SYMBOL(snd_rawmidi_new);
|
||||
EXPORT_SYMBOL(snd_rawmidi_set_ops);
|
||||
EXPORT_SYMBOL(snd_rawmidi_info_select);
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_open);
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_release);
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_read);
|
||||
EXPORT_SYMBOL(snd_rawmidi_kernel_write);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <sound/core.h>
|
||||
#include <sound/timer.h>
|
||||
|
||||
#if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE)
|
||||
#if IS_ENABLED(CONFIG_RTC)
|
||||
|
||||
#include <linux/mc146818rtc.h>
|
||||
|
||||
|
@ -132,8 +132,7 @@ static int __init rtctimer_init(void)
|
|||
|
||||
if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
|
||||
!is_power_of_2(rtctimer_freq)) {
|
||||
snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n",
|
||||
rtctimer_freq);
|
||||
pr_err("ALSA: rtctimer: invalid frequency %d\n", rtctimer_freq);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -185,4 +184,4 @@ MODULE_LICENSE("GPL");
|
|||
|
||||
MODULE_ALIAS("snd-timer-" __stringify(SNDRV_TIMER_GLOBAL_RTC));
|
||||
|
||||
#endif /* CONFIG_RTC || CONFIG_RTC_MODULE */
|
||||
#endif /* IS_ENABLED(CONFIG_RTC) */
|
||||
|
|
|
@ -39,12 +39,6 @@ MODULE_LICENSE("GPL");
|
|||
MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_SEQUENCER);
|
||||
MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC);
|
||||
|
||||
#ifdef SNDRV_SEQ_OSS_DEBUG
|
||||
module_param(seq_oss_debug, int, 0644);
|
||||
MODULE_PARM_DESC(seq_oss_debug, "debug option");
|
||||
int seq_oss_debug = 0;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* prototypes
|
||||
|
@ -231,22 +225,19 @@ register_device(void)
|
|||
mutex_lock(®ister_mutex);
|
||||
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,
|
||||
NULL, 0,
|
||||
&seq_oss_f_ops, NULL,
|
||||
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
|
||||
snd_printk(KERN_ERR "can't register device seq\n");
|
||||
&seq_oss_f_ops, NULL)) < 0) {
|
||||
pr_err("ALSA: seq_oss: can't register device seq\n");
|
||||
mutex_unlock(®ister_mutex);
|
||||
return rc;
|
||||
}
|
||||
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,
|
||||
NULL, 0,
|
||||
&seq_oss_f_ops, NULL,
|
||||
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
|
||||
snd_printk(KERN_ERR "can't register device music\n");
|
||||
&seq_oss_f_ops, NULL)) < 0) {
|
||||
pr_err("ALSA: seq_oss: can't register device music\n");
|
||||
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);
|
||||
mutex_unlock(®ister_mutex);
|
||||
return rc;
|
||||
}
|
||||
debug_printk(("device registered\n"));
|
||||
mutex_unlock(®ister_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
@ -255,11 +246,10 @@ static void
|
|||
unregister_device(void)
|
||||
{
|
||||
mutex_lock(®ister_mutex);
|
||||
debug_printk(("device unregistered\n"));
|
||||
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0)
|
||||
snd_printk(KERN_ERR "error unregister device music\n");
|
||||
pr_err("ALSA: seq_oss: error unregister device music\n");
|
||||
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0)
|
||||
snd_printk(KERN_ERR "error unregister device seq\n");
|
||||
pr_err("ALSA: seq_oss: error unregister device seq\n");
|
||||
mutex_unlock(®ister_mutex);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
#include <sound/seq_kernel.h>
|
||||
#include <sound/info.h>
|
||||
|
||||
/* enable debug print */
|
||||
#define SNDRV_SEQ_OSS_DEBUG
|
||||
|
||||
/* max. applications */
|
||||
#define SNDRV_SEQ_OSS_MAX_CLIENTS 16
|
||||
#define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16
|
||||
|
@ -46,7 +43,6 @@
|
|||
#define SNDRV_SEQ_OSS_VERSION_STR "0.1.8"
|
||||
|
||||
/* device and proc interface name */
|
||||
#define SNDRV_SEQ_OSS_DEVNAME "seq_oss"
|
||||
#define SNDRV_SEQ_OSS_PROCNAME "oss"
|
||||
|
||||
|
||||
|
@ -177,13 +173,4 @@ snd_seq_oss_fill_addr(struct seq_oss_devinfo *dp, struct snd_seq_event *ev,
|
|||
/* misc. functions for proc interface */
|
||||
char *enabled_str(int bool);
|
||||
|
||||
|
||||
/* for debug */
|
||||
#ifdef SNDRV_SEQ_OSS_DEBUG
|
||||
extern int seq_oss_debug;
|
||||
#define debug_printk(x) do { if (seq_oss_debug > 0) snd_printd x; } while (0)
|
||||
#else
|
||||
#define debug_printk(x) /**/
|
||||
#endif
|
||||
|
||||
#endif /* __SEQ_OSS_DEVICE_H */
|
||||
|
|
|
@ -92,7 +92,6 @@ snd_seq_oss_create_client(void)
|
|||
goto __error;
|
||||
|
||||
system_client = rc;
|
||||
debug_printk(("new client = %d\n", rc));
|
||||
|
||||
/* create annoucement receiver port */
|
||||
memset(port, 0, sizeof(*port));
|
||||
|
@ -190,10 +189,9 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
|
||||
dp = kzalloc(sizeof(*dp), GFP_KERNEL);
|
||||
if (!dp) {
|
||||
snd_printk(KERN_ERR "can't malloc device info\n");
|
||||
pr_err("ALSA: seq_oss: can't malloc device info\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
debug_printk(("oss_open: dp = %p\n", dp));
|
||||
|
||||
dp->cseq = system_client;
|
||||
dp->port = -1;
|
||||
|
@ -206,7 +204,7 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
|
||||
dp->index = i;
|
||||
if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) {
|
||||
snd_printk(KERN_ERR "too many applications\n");
|
||||
pr_err("ALSA: seq_oss: too many applications\n");
|
||||
rc = -ENOMEM;
|
||||
goto _error;
|
||||
}
|
||||
|
@ -216,21 +214,19 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
snd_seq_oss_midi_setup(dp);
|
||||
|
||||
if (dp->synth_opened == 0 && dp->max_mididev == 0) {
|
||||
/* snd_printk(KERN_ERR "no device found\n"); */
|
||||
/* pr_err("ALSA: seq_oss: no device found\n"); */
|
||||
rc = -ENODEV;
|
||||
goto _error;
|
||||
}
|
||||
|
||||
/* create port */
|
||||
debug_printk(("create new port\n"));
|
||||
rc = create_port(dp);
|
||||
if (rc < 0) {
|
||||
snd_printk(KERN_ERR "can't create port\n");
|
||||
pr_err("ALSA: seq_oss: can't create port\n");
|
||||
goto _error;
|
||||
}
|
||||
|
||||
/* allocate queue */
|
||||
debug_printk(("allocate queue\n"));
|
||||
rc = alloc_seq_queue(dp);
|
||||
if (rc < 0)
|
||||
goto _error;
|
||||
|
@ -247,7 +243,6 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
dp->file_mode = translate_mode(file);
|
||||
|
||||
/* initialize read queue */
|
||||
debug_printk(("initialize read queue\n"));
|
||||
if (is_read_mode(dp->file_mode)) {
|
||||
dp->readq = snd_seq_oss_readq_new(dp, maxqlen);
|
||||
if (!dp->readq) {
|
||||
|
@ -257,7 +252,6 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
}
|
||||
|
||||
/* initialize write queue */
|
||||
debug_printk(("initialize write queue\n"));
|
||||
if (is_write_mode(dp->file_mode)) {
|
||||
dp->writeq = snd_seq_oss_writeq_new(dp, maxqlen);
|
||||
if (!dp->writeq) {
|
||||
|
@ -267,14 +261,12 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
}
|
||||
|
||||
/* initialize timer */
|
||||
debug_printk(("initialize timer\n"));
|
||||
dp->timer = snd_seq_oss_timer_new(dp);
|
||||
if (!dp->timer) {
|
||||
snd_printk(KERN_ERR "can't alloc timer\n");
|
||||
pr_err("ALSA: seq_oss: can't alloc timer\n");
|
||||
rc = -ENOMEM;
|
||||
goto _error;
|
||||
}
|
||||
debug_printk(("timer initialized\n"));
|
||||
|
||||
/* set private data pointer */
|
||||
file->private_data = dp;
|
||||
|
@ -288,7 +280,6 @@ snd_seq_oss_open(struct file *file, int level)
|
|||
client_table[dp->index] = dp;
|
||||
num_clients++;
|
||||
|
||||
debug_printk(("open done\n"));
|
||||
return 0;
|
||||
|
||||
_error:
|
||||
|
@ -347,7 +338,6 @@ create_port(struct seq_oss_devinfo *dp)
|
|||
return rc;
|
||||
|
||||
dp->port = port.addr.port;
|
||||
debug_printk(("new port = %d\n", port.addr.port));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -363,7 +353,6 @@ delete_port(struct seq_oss_devinfo *dp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
debug_printk(("delete_port %i\n", dp->port));
|
||||
return snd_seq_event_port_detach(dp->cseq, dp->port);
|
||||
}
|
||||
|
||||
|
@ -401,7 +390,7 @@ delete_seq_queue(int queue)
|
|||
qinfo.queue = queue;
|
||||
rc = call_ctl(SNDRV_SEQ_IOCTL_DELETE_QUEUE, &qinfo);
|
||||
if (rc < 0)
|
||||
printk(KERN_ERR "seq-oss: unable to delete queue %d (%d)\n", queue, rc);
|
||||
pr_err("ALSA: seq_oss: unable to delete queue %d (%d)\n", queue, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -438,21 +427,16 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp)
|
|||
client_table[dp->index] = NULL;
|
||||
num_clients--;
|
||||
|
||||
debug_printk(("resetting..\n"));
|
||||
snd_seq_oss_reset(dp);
|
||||
|
||||
debug_printk(("cleaning up..\n"));
|
||||
snd_seq_oss_synth_cleanup(dp);
|
||||
snd_seq_oss_midi_cleanup(dp);
|
||||
|
||||
/* clear slot */
|
||||
debug_printk(("releasing resource..\n"));
|
||||
queue = dp->queue;
|
||||
if (dp->port >= 0)
|
||||
delete_port(dp);
|
||||
delete_seq_queue(queue);
|
||||
|
||||
debug_printk(("release done\n"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -466,7 +450,6 @@ snd_seq_oss_drain_write(struct seq_oss_devinfo *dp)
|
|||
return;
|
||||
if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) &&
|
||||
dp->writeq) {
|
||||
debug_printk(("syncing..\n"));
|
||||
while (snd_seq_oss_writeq_sync(dp->writeq))
|
||||
;
|
||||
}
|
||||
|
|
|
@ -90,12 +90,10 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca
|
|||
return snd_seq_oss_timer_ioctl(dp->timer, cmd, arg);
|
||||
|
||||
case SNDCTL_SEQ_PANIC:
|
||||
debug_printk(("panic\n"));
|
||||
snd_seq_oss_reset(dp);
|
||||
return -EINVAL;
|
||||
|
||||
case SNDCTL_SEQ_SYNC:
|
||||
debug_printk(("sync\n"));
|
||||
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
|
||||
return 0;
|
||||
while (snd_seq_oss_writeq_sync(dp->writeq))
|
||||
|
@ -105,55 +103,45 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca
|
|||
return 0;
|
||||
|
||||
case SNDCTL_SEQ_RESET:
|
||||
debug_printk(("reset\n"));
|
||||
snd_seq_oss_reset(dp);
|
||||
return 0;
|
||||
|
||||
case SNDCTL_SEQ_TESTMIDI:
|
||||
debug_printk(("test midi\n"));
|
||||
if (get_user(dev, p))
|
||||
return -EFAULT;
|
||||
return snd_seq_oss_midi_open(dp, dev, dp->file_mode);
|
||||
|
||||
case SNDCTL_SEQ_GETINCOUNT:
|
||||
debug_printk(("get in count\n"));
|
||||
if (dp->readq == NULL || ! is_read_mode(dp->file_mode))
|
||||
return 0;
|
||||
return put_user(dp->readq->qlen, p) ? -EFAULT : 0;
|
||||
|
||||
case SNDCTL_SEQ_GETOUTCOUNT:
|
||||
debug_printk(("get out count\n"));
|
||||
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
|
||||
return 0;
|
||||
return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0;
|
||||
|
||||
case SNDCTL_SEQ_GETTIME:
|
||||
debug_printk(("get time\n"));
|
||||
return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0;
|
||||
|
||||
case SNDCTL_SEQ_RESETSAMPLES:
|
||||
debug_printk(("reset samples\n"));
|
||||
if (get_user(dev, p))
|
||||
return -EFAULT;
|
||||
return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
||||
|
||||
case SNDCTL_SEQ_NRSYNTHS:
|
||||
debug_printk(("nr synths\n"));
|
||||
return put_user(dp->max_synthdev, p) ? -EFAULT : 0;
|
||||
|
||||
case SNDCTL_SEQ_NRMIDIS:
|
||||
debug_printk(("nr midis\n"));
|
||||
return put_user(dp->max_mididev, p) ? -EFAULT : 0;
|
||||
|
||||
case SNDCTL_SYNTH_MEMAVL:
|
||||
debug_printk(("mem avail\n"));
|
||||
if (get_user(dev, p))
|
||||
return -EFAULT;
|
||||
val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
||||
return put_user(val, p) ? -EFAULT : 0;
|
||||
|
||||
case SNDCTL_FM_4OP_ENABLE:
|
||||
debug_printk(("4op\n"));
|
||||
if (get_user(dev, p))
|
||||
return -EFAULT;
|
||||
snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
||||
|
@ -161,19 +149,15 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca
|
|||
|
||||
case SNDCTL_SYNTH_INFO:
|
||||
case SNDCTL_SYNTH_ID:
|
||||
debug_printk(("synth info\n"));
|
||||
return snd_seq_oss_synth_info_user(dp, arg);
|
||||
|
||||
case SNDCTL_SEQ_OUTOFBAND:
|
||||
debug_printk(("out of band\n"));
|
||||
return snd_seq_oss_oob_user(dp, arg);
|
||||
|
||||
case SNDCTL_MIDI_INFO:
|
||||
debug_printk(("midi info\n"));
|
||||
return snd_seq_oss_midi_info_user(dp, arg);
|
||||
|
||||
case SNDCTL_SEQ_THRESHOLD:
|
||||
debug_printk(("threshold\n"));
|
||||
if (! is_write_mode(dp->file_mode))
|
||||
return 0;
|
||||
if (get_user(val, p))
|
||||
|
@ -186,7 +170,6 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca
|
|||
return 0;
|
||||
|
||||
case SNDCTL_MIDI_PRETIME:
|
||||
debug_printk(("pretime\n"));
|
||||
if (dp->readq == NULL || !is_read_mode(dp->file_mode))
|
||||
return 0;
|
||||
if (get_user(val, p))
|
||||
|
@ -199,7 +182,6 @@ snd_seq_oss_ioctl(struct seq_oss_devinfo *dp, unsigned int cmd, unsigned long ca
|
|||
return put_user(val, p) ? -EFAULT : 0;
|
||||
|
||||
default:
|
||||
debug_printk(("others\n"));
|
||||
if (! is_write_mode(dp->file_mode))
|
||||
return -EIO;
|
||||
return snd_seq_oss_synth_ioctl(dp, 0, cmd, carg);
|
||||
|
|
|
@ -153,7 +153,6 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
|
|||
struct seq_oss_midi *mdev;
|
||||
unsigned long flags;
|
||||
|
||||
debug_printk(("check for MIDI client %d port %d\n", pinfo->addr.client, pinfo->addr.port));
|
||||
/* the port must include generic midi */
|
||||
if (! (pinfo->type & SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC))
|
||||
return 0;
|
||||
|
@ -175,7 +174,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
|
|||
* allocate midi info record
|
||||
*/
|
||||
if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) {
|
||||
snd_printk(KERN_ERR "can't malloc midi info\n");
|
||||
pr_err("ALSA: seq_oss: can't malloc midi info\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -191,7 +190,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
|
|||
|
||||
/* create MIDI coder */
|
||||
if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) {
|
||||
snd_printk(KERN_ERR "can't malloc midi coder\n");
|
||||
pr_err("ALSA: seq_oss: can't malloc midi coder\n");
|
||||
kfree(mdev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -406,7 +405,6 @@ snd_seq_oss_midi_close(struct seq_oss_devinfo *dp, int dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
debug_printk(("closing client %d port %d mode %d\n", mdev->client, mdev->port, mdev->opened));
|
||||
memset(&subs, 0, sizeof(subs));
|
||||
if (mdev->opened & PERM_WRITE) {
|
||||
subs.sender = dp->addr;
|
||||
|
@ -470,7 +468,6 @@ snd_seq_oss_midi_reset(struct seq_oss_devinfo *dp, int dev)
|
|||
struct snd_seq_event ev;
|
||||
int c;
|
||||
|
||||
debug_printk(("resetting client %d port %d\n", mdev->client, mdev->port));
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
ev.dest.client = mdev->client;
|
||||
ev.dest.port = mdev->port;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue