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:
Коммит
c70929147a
|
@ -468,8 +468,6 @@
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_set_dev(card, &pci->dev);
|
|
||||||
|
|
||||||
*rchip = chip;
|
*rchip = chip;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +490,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (2) */
|
/* (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)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -591,7 +590,8 @@
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
int err;
|
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>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
|
@ -809,28 +809,34 @@
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
As mentioned above, to create a card instance, call
|
As mentioned above, to create a card instance, call
|
||||||
<function>snd_card_create()</function>.
|
<function>snd_card_new()</function>.
|
||||||
|
|
||||||
<informalexample>
|
<informalexample>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
int err;
|
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>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The function takes five arguments, the card-index number, the
|
The function takes six arguments: the parent device pointer,
|
||||||
id string, the module pointer (usually
|
the card-index number, the id string, the module pointer (usually
|
||||||
<constant>THIS_MODULE</constant>),
|
<constant>THIS_MODULE</constant>),
|
||||||
the size of extra-data space, and the pointer to return the
|
the size of extra-data space, and the pointer to return the
|
||||||
card instance. The extra_size argument is used to
|
card instance. The extra_size argument is used to
|
||||||
allocate card->private_data for the
|
allocate card->private_data for the
|
||||||
chip-specific data. Note that these data
|
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>
|
</para>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@ -916,16 +922,16 @@
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<section id="card-management-chip-specific-snd-card-new">
|
<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>
|
<para>
|
||||||
As mentioned above, you can pass the extra-data-length
|
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>
|
<informalexample>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
|
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||||
sizeof(struct mychip), &card);
|
sizeof(struct mychip), &card);
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</informalexample>
|
</informalexample>
|
||||||
|
@ -954,7 +960,7 @@
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
After allocating a card instance via
|
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
|
<constant>0</constant> on the 4th arg), call
|
||||||
<function>kzalloc()</function>.
|
<function>kzalloc()</function>.
|
||||||
|
|
||||||
|
@ -963,7 +969,8 @@
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
struct snd_card *card;
|
struct snd_card *card;
|
||||||
struct mychip *chip;
|
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);
|
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
|
||||||
]]>
|
]]>
|
||||||
|
@ -1170,8 +1177,6 @@
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_set_dev(card, &pci->dev);
|
|
||||||
|
|
||||||
*rchip = chip;
|
*rchip = chip;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1526,30 +1531,6 @@
|
||||||
|
|
||||||
</section>
|
</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">
|
<section id="pci-resource-entries">
|
||||||
<title>PCI Entries</title>
|
<title>PCI Entries</title>
|
||||||
<para>
|
<para>
|
||||||
|
@ -5740,7 +5721,8 @@ struct _snd_pcm_runtime {
|
||||||
struct mychip *chip;
|
struct mychip *chip;
|
||||||
int err;
|
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);
|
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
|
||||||
....
|
....
|
||||||
|
@ -5752,7 +5734,7 @@ struct _snd_pcm_runtime {
|
||||||
</informalexample>
|
</informalexample>
|
||||||
|
|
||||||
When you created the chip data with
|
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.
|
via <structfield>private_data</structfield> field.
|
||||||
|
|
||||||
<informalexample>
|
<informalexample>
|
||||||
|
@ -5766,8 +5748,8 @@ struct _snd_pcm_runtime {
|
||||||
struct mychip *chip;
|
struct mychip *chip;
|
||||||
int err;
|
int err;
|
||||||
....
|
....
|
||||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
|
err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
||||||
sizeof(struct mychip), &card);
|
sizeof(struct mychip), &card);
|
||||||
....
|
....
|
||||||
chip = card->private_data;
|
chip = card->private_data;
|
||||||
....
|
....
|
||||||
|
|
|
@ -18,6 +18,7 @@ atmel,24c02 i2c serial eeprom (24cxx)
|
||||||
atmel,at97sc3204t i2c trusted platform module (TPM)
|
atmel,at97sc3204t i2c trusted platform module (TPM)
|
||||||
capella,cm32181 CM32181: Ambient Light Sensor
|
capella,cm32181 CM32181: Ambient Light Sensor
|
||||||
catalyst,24c32 i2c serial eeprom
|
catalyst,24c32 i2c serial eeprom
|
||||||
|
cirrus,cs42l51 Cirrus Logic CS42L51 audio codec
|
||||||
dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock
|
dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock
|
||||||
dallas,ds1338 I2C RTC with 56-Byte NV RAM
|
dallas,ds1338 I2C RTC with 56-Byte NV RAM
|
||||||
dallas,ds1339 I2C Serial Real-Time Clock
|
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.
|
See Documentation/devicetree/bindings/dma/atmel-dma.txt for details.
|
||||||
- dma-names: Must be "tx", "rx".
|
- 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:
|
Examples:
|
||||||
- PDC transfer:
|
- PDC transfer:
|
||||||
ssc0: ssc@fffbc000 {
|
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,model : The user-visible name of this sound complex.
|
||||||
- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
|
- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
|
||||||
- ti,mcasp-controller : The phandle of the McASP controller
|
- 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.
|
- 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,
|
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
|
the second being the connection's source. Valid names for sources and
|
||||||
sinks are the codec's pins, and the jacks on the board:
|
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:
|
Board connectors:
|
||||||
|
|
||||||
* Headphone Jack
|
* 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
|
that ESAI would work in the synchronous mode, which means all the settings
|
||||||
for Receiving would be duplicated from Transmition related registers.
|
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:
|
Example:
|
||||||
|
|
||||||
esai: esai@02024000 {
|
esai: esai@02024000 {
|
||||||
|
@ -46,5 +50,6 @@ esai: esai@02024000 {
|
||||||
dma-names = "rx", "tx";
|
dma-names = "rx", "tx";
|
||||||
fsl,fifo-depth = <128>;
|
fsl,fifo-depth = <128>;
|
||||||
fsl,esai-synchronous;
|
fsl,esai-synchronous;
|
||||||
|
big-endian;
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,6 +29,10 @@ Required properties:
|
||||||
can also be referred to TxClk_Source
|
can also be referred to TxClk_Source
|
||||||
bit of register SPDIF_STC.
|
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:
|
Example:
|
||||||
|
|
||||||
spdif: spdif@02004000 {
|
spdif: spdif@02004000 {
|
||||||
|
@ -50,5 +54,6 @@ spdif: spdif@02004000 {
|
||||||
"rxtx5", "rxtx6",
|
"rxtx5", "rxtx6",
|
||||||
"rxtx7";
|
"rxtx7";
|
||||||
|
|
||||||
|
big-endian;
|
||||||
status = "okay";
|
status = "okay";
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@ Required properties:
|
||||||
- compatible:
|
- compatible:
|
||||||
"marvell,kirkwood-audio" for Kirkwood platforms
|
"marvell,kirkwood-audio" for Kirkwood platforms
|
||||||
"marvell,dove-audio" for Dove 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
|
- reg: physical base address of the controller and length of memory mapped
|
||||||
region.
|
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:
|
Optional properties:
|
||||||
|
|
||||||
|
- simple-audio-card,name : User specified audio sound card name, one string
|
||||||
|
property.
|
||||||
- simple-audio-card,format : CPU/CODEC common audio format.
|
- simple-audio-card,format : CPU/CODEC common audio format.
|
||||||
"i2s", "right_j", "left_j" , "dsp_a"
|
"i2s", "right_j", "left_j" , "dsp_a"
|
||||||
"dsp_b", "ac97", "pdm", "msb", "lsb"
|
"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.
|
- simple-audio-card,routing : A list of the connections between audio components.
|
||||||
Each entry is a pair of strings, the first being the
|
Each entry is a pair of strings, the first being the
|
||||||
connection's sink, the second being the connection's
|
connection's sink, the second being the connection's
|
||||||
source.
|
source.
|
||||||
|
- dai-tdm-slot-num : Please refer to tdm-slot.txt.
|
||||||
|
- dai-tdm-slot-width : Please refer to tdm-slot.txt.
|
||||||
|
|
||||||
Required subnodes:
|
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,cpu : CPU sub-node
|
||||||
- simple-audio-card,codec : CODEC 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"
|
clock node (= common clock), or "system-clock-frequency"
|
||||||
(if system doens't support common clock)
|
(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 {
|
sound {
|
||||||
compatible = "simple-audio-card";
|
compatible = "simple-audio-card";
|
||||||
|
simple-audio-card,name = "VF610-Tower-Sound-Card";
|
||||||
simple-audio-card,format = "left_j";
|
simple-audio-card,format = "left_j";
|
||||||
|
simple-audio-card,widgets =
|
||||||
|
"Microphone", "Microphone Jack",
|
||||||
|
"Headphone", "Headphone Jack",
|
||||||
|
"Speaker", "External Speaker";
|
||||||
simple-audio-card,routing =
|
simple-audio-card,routing =
|
||||||
"MIC_IN", "Mic Jack",
|
"MIC_IN", "Microphone Jack",
|
||||||
"Headphone Jack", "HP_OUT",
|
"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 {
|
simple-audio-card,cpu {
|
||||||
sound-dai = <&sh_fsi2 0>;
|
sound-dai = <&sh_fsi2 0>;
|
||||||
|
@ -75,3 +99,38 @@ sh_fsi2: sh_fsi2@ec230000 {
|
||||||
interrupt-parent = <&gic>;
|
interrupt-parent = <&gic>;
|
||||||
interrupts = <0 146 0x4>;
|
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:
|
- compatible - "string" - One of:
|
||||||
"ti,tlv320aic3x" - Generic TLV320AIC3x device
|
"ti,tlv320aic3x" - Generic TLV320AIC3x device
|
||||||
"ti,tlv320aic32x4" - TLV320AIC32x4
|
|
||||||
"ti,tlv320aic33" - TLV320AIC33
|
"ti,tlv320aic33" - TLV320AIC33
|
||||||
"ti,tlv320aic3007" - TLV320AIC3007
|
"ti,tlv320aic3007" - TLV320AIC3007
|
||||||
"ti,tlv320aic3106" - TLV320AIC3106
|
"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
|
S: Odd Fixes
|
||||||
F: sound/soc/codecs/cs4270*
|
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
|
CLEANCACHE API
|
||||||
M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||||
L: linux-kernel@vger.kernel.org
|
L: linux-kernel@vger.kernel.org
|
||||||
|
|
|
@ -988,14 +988,12 @@ static struct asoc_simple_card_info fsi_wm8978_info = {
|
||||||
.card = "FSI2A-WM8978",
|
.card = "FSI2A-WM8978",
|
||||||
.codec = "wm8978.0-001a",
|
.codec = "wm8978.0-001a",
|
||||||
.platform = "sh_fsi2",
|
.platform = "sh_fsi2",
|
||||||
.daifmt = SND_SOC_DAIFMT_I2S,
|
.daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "fsia-dai",
|
.name = "fsia-dai",
|
||||||
.fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "wm8978-hifi",
|
.name = "wm8978-hifi",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
|
|
||||||
.sysclk = 12288000,
|
.sysclk = 12288000,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -429,14 +429,12 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
||||||
.card = "SSI56-AK4643",
|
.card = "SSI56-AK4643",
|
||||||
.codec = "ak4642-codec.0-0012",
|
.codec = "ak4642-codec.0-0012",
|
||||||
.platform = "rcar_sound",
|
.platform = "rcar_sound",
|
||||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "rsnd-dai.0",
|
.name = "rsnd-dai.0",
|
||||||
.fmt = SND_SOC_DAIFMT_CBS_CFS,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4642-hifi",
|
.name = "ak4642-hifi",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
|
||||||
.sysclk = 11289600,
|
.sysclk = 11289600,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -446,10 +444,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
||||||
.card = "SSI3-AK4554(playback)",
|
.card = "SSI3-AK4554(playback)",
|
||||||
.codec = "ak4554-adc-dac.0",
|
.codec = "ak4554-adc-dac.0",
|
||||||
.platform = "rcar_sound",
|
.platform = "rcar_sound",
|
||||||
|
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_RIGHT_J,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "rsnd-dai.1",
|
.name = "rsnd-dai.1",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
|
||||||
SND_SOC_DAIFMT_RIGHT_J,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4554-hifi",
|
.name = "ak4554-hifi",
|
||||||
|
@ -461,10 +458,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
||||||
.card = "SSI4-AK4554(capture)",
|
.card = "SSI4-AK4554(capture)",
|
||||||
.codec = "ak4554-adc-dac.0",
|
.codec = "ak4554-adc-dac.0",
|
||||||
.platform = "rcar_sound",
|
.platform = "rcar_sound",
|
||||||
|
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_LEFT_J,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "rsnd-dai.2",
|
.name = "rsnd-dai.2",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
|
||||||
SND_SOC_DAIFMT_LEFT_J,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4554-hifi",
|
.name = "ak4554-hifi",
|
||||||
|
@ -476,10 +472,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
||||||
.card = "SSI7-AK4554(playback)",
|
.card = "SSI7-AK4554(playback)",
|
||||||
.codec = "ak4554-adc-dac.1",
|
.codec = "ak4554-adc-dac.1",
|
||||||
.platform = "rcar_sound",
|
.platform = "rcar_sound",
|
||||||
|
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_RIGHT_J,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "rsnd-dai.3",
|
.name = "rsnd-dai.3",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
|
||||||
SND_SOC_DAIFMT_RIGHT_J,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4554-hifi",
|
.name = "ak4554-hifi",
|
||||||
|
@ -491,10 +486,9 @@ static struct asoc_simple_card_info rsnd_card_info[] = {
|
||||||
.card = "SSI8-AK4554(capture)",
|
.card = "SSI8-AK4554(capture)",
|
||||||
.codec = "ak4554-adc-dac.1",
|
.codec = "ak4554-adc-dac.1",
|
||||||
.platform = "rcar_sound",
|
.platform = "rcar_sound",
|
||||||
|
.daifmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_LEFT_J,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "rsnd-dai.4",
|
.name = "rsnd-dai.4",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM |
|
|
||||||
SND_SOC_DAIFMT_LEFT_J,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4554-hifi",
|
.name = "ak4554-hifi",
|
||||||
|
|
|
@ -589,14 +589,12 @@ static struct asoc_simple_card_info fsi2_ak4648_info = {
|
||||||
.card = "FSI2A-AK4648",
|
.card = "FSI2A-AK4648",
|
||||||
.codec = "ak4642-codec.0-0012",
|
.codec = "ak4642-codec.0-0012",
|
||||||
.platform = "sh_fsi2",
|
.platform = "sh_fsi2",
|
||||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "fsia-dai",
|
.name = "fsia-dai",
|
||||||
.fmt = SND_SOC_DAIFMT_CBS_CFS,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4642-hifi",
|
.name = "ak4642-hifi",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
|
||||||
.sysclk = 11289600,
|
.sysclk = 11289600,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -509,9 +509,9 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
|
||||||
.card = "FSI2B-HDMI",
|
.card = "FSI2B-HDMI",
|
||||||
.codec = "sh-mobile-hdmi",
|
.codec = "sh-mobile-hdmi",
|
||||||
.platform = "sh_fsi2",
|
.platform = "sh_fsi2",
|
||||||
|
.daifmt = SND_SOC_DAIFMT_CBS_CFS,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "fsib-dai",
|
.name = "fsib-dai",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "sh_mobile_hdmi-hifi",
|
.name = "sh_mobile_hdmi-hifi",
|
||||||
|
@ -905,14 +905,12 @@ static struct asoc_simple_card_info fsi2_ak4643_info = {
|
||||||
.card = "FSI2A-AK4643",
|
.card = "FSI2A-AK4643",
|
||||||
.codec = "ak4642-codec.0-0013",
|
.codec = "ak4642-codec.0-0013",
|
||||||
.platform = "sh_fsi2",
|
.platform = "sh_fsi2",
|
||||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "fsia-dai",
|
.name = "fsia-dai",
|
||||||
.fmt = SND_SOC_DAIFMT_CBS_CFS,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4642-hifi",
|
.name = "ak4642-hifi",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
|
||||||
.sysclk = 11289600,
|
.sysclk = 11289600,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -861,14 +861,12 @@ static struct asoc_simple_card_info fsi_da7210_info = {
|
||||||
.card = "FSIB-DA7210",
|
.card = "FSIB-DA7210",
|
||||||
.codec = "da7210.0-001a",
|
.codec = "da7210.0-001a",
|
||||||
.platform = "sh_fsi.0",
|
.platform = "sh_fsi.0",
|
||||||
.daifmt = SND_SOC_DAIFMT_I2S,
|
.daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "fsib-dai",
|
.name = "fsib-dai",
|
||||||
.fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "da7210-hifi",
|
.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",
|
.card = "FSIA-AK4642",
|
||||||
.codec = "ak4642-codec.0-0012",
|
.codec = "ak4642-codec.0-0012",
|
||||||
.platform = "sh_fsi.0",
|
.platform = "sh_fsi.0",
|
||||||
.daifmt = SND_SOC_DAIFMT_LEFT_J,
|
.daifmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM,
|
||||||
.cpu_dai = {
|
.cpu_dai = {
|
||||||
.name = "fsia-dai",
|
.name = "fsia-dai",
|
||||||
.fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
|
|
||||||
},
|
},
|
||||||
.codec_dai = {
|
.codec_dai = {
|
||||||
.name = "ak4642-hifi",
|
.name = "ak4642-hifi",
|
||||||
.fmt = SND_SOC_DAIFMT_CBM_CFM,
|
|
||||||
.sysclk = 11289600,
|
.sysclk = 11289600,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -624,7 +624,8 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
|
||||||
|
|
||||||
/* Setup sound card */
|
/* 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) {
|
if (err < 0) {
|
||||||
pk_error("failed to create pc-midi sound card\n");
|
pk_error("failed to create pc-midi sound card\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
@ -660,8 +661,6 @@ static int pcmidi_snd_initialise(struct pcmidi_snd *pm)
|
||||||
snd_rawmidi_set_ops(rwmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
snd_rawmidi_set_ops(rwmidi, SNDRV_RAWMIDI_STREAM_INPUT,
|
||||||
&pcmidi_in_ops);
|
&pcmidi_in_ops);
|
||||||
|
|
||||||
snd_card_set_dev(card, &pm->pk->hdev->dev);
|
|
||||||
|
|
||||||
/* create sysfs variables */
|
/* create sysfs variables */
|
||||||
err = device_create_file(&pm->pk->hdev->dev,
|
err = device_create_file(&pm->pk->hdev->dev,
|
||||||
sysfs_device_attr_channel);
|
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 */
|
/* This is a no-op for us. We'll use the cx->instance */
|
||||||
|
|
||||||
/* (2) Create a card instance */
|
/* (2) Create a card instance */
|
||||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, /* use first available id */
|
ret = snd_card_new(&cx->pci_dev->dev,
|
||||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||||
THIS_MODULE, 0, &sc);
|
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||||
|
THIS_MODULE, 0, &sc);
|
||||||
if (ret) {
|
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);
|
__func__, ret);
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,8 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
|
||||||
return NULL;
|
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);
|
THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -500,8 +501,6 @@ struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
|
||||||
chip->card = card;
|
chip->card = card;
|
||||||
spin_lock_init(&chip->lock);
|
spin_lock_init(&chip->lock);
|
||||||
|
|
||||||
snd_card_set_dev(card, &dev->pci->dev);
|
|
||||||
|
|
||||||
err = snd_cx23885_pcm(chip, 0, "CX23885 Digital");
|
err = snd_cx23885_pcm(chip, 0, "CX23885 Digital");
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -645,8 +645,9 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_card_create(index[devno], id[devno], THIS_MODULE,
|
err = snd_card_new(&dev->pci->dev, index[devno], id[devno],
|
||||||
sizeof(struct cx25821_audio_dev), &card);
|
THIS_MODULE,
|
||||||
|
sizeof(struct cx25821_audio_dev), &card);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
pr_info("DEBUG ERROR: cannot create snd_card_new in %s\n",
|
pr_info("DEBUG ERROR: cannot create snd_card_new in %s\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
@ -682,8 +683,6 @@ static int cx25821_audio_initdev(struct cx25821_dev *dev)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_set_dev(card, &chip->pci->dev);
|
|
||||||
|
|
||||||
strcpy(card->shortname, "cx25821");
|
strcpy(card->shortname, "cx25821");
|
||||||
sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name,
|
sprintf(card->longname, "%s at 0x%lx irq %d", chip->dev->name,
|
||||||
chip->iobase, chip->irq);
|
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;
|
chip->irq = pci->irq;
|
||||||
synchronize_irq(chip->irq);
|
synchronize_irq(chip->irq);
|
||||||
|
|
||||||
snd_card_set_dev(card, &pci->dev);
|
|
||||||
|
|
||||||
*rchip = chip;
|
*rchip = chip;
|
||||||
*core_ptr = core;
|
*core_ptr = core;
|
||||||
|
|
||||||
|
@ -876,8 +874,8 @@ static int cx88_audio_initdev(struct pci_dev *pci,
|
||||||
return (-ENOENT);
|
return (-ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = snd_card_create(index[devno], id[devno], THIS_MODULE,
|
err = snd_card_new(&pci->dev, index[devno], id[devno], THIS_MODULE,
|
||||||
sizeof(snd_cx88_card_t), &card);
|
sizeof(snd_cx88_card_t), &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
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 */
|
/* This is a no-op for us. We'll use the itv->instance */
|
||||||
|
|
||||||
/* (2) Create a card instance */
|
/* (2) Create a card instance */
|
||||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, /* use first available id */
|
ret = snd_card_new(&itv->pdev->dev,
|
||||||
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
SNDRV_DEFAULT_IDX1, /* use first available id */
|
||||||
THIS_MODULE, 0, &sc);
|
SNDRV_DEFAULT_STR1, /* xid from end of shortname*/
|
||||||
|
THIS_MODULE, 0, &sc);
|
||||||
if (ret) {
|
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);
|
__func__, ret);
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1072,8 +1072,8 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
|
||||||
if (!enable[devnum])
|
if (!enable[devnum])
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
|
err = snd_card_new(&dev->pci->dev, index[devnum], id[devnum],
|
||||||
sizeof(snd_card_saa7134_t), &card);
|
THIS_MODULE, sizeof(snd_card_saa7134_t), &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
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)
|
if ((err = snd_card_saa7134_pcm(chip, 0)) < 0)
|
||||||
goto __nodev;
|
goto __nodev;
|
||||||
|
|
||||||
snd_card_set_dev(card, &chip->pci->dev);
|
|
||||||
|
|
||||||
/* End of "creation" */
|
/* End of "creation" */
|
||||||
|
|
||||||
strcpy(card->shortname, "SAA7134");
|
strcpy(card->shortname, "SAA7134");
|
||||||
|
|
|
@ -665,8 +665,8 @@ static int cx231xx_audio_init(struct cx231xx *dev)
|
||||||
cx231xx_info("cx231xx-audio.c: probing for cx231xx "
|
cx231xx_info("cx231xx-audio.c: probing for cx231xx "
|
||||||
"non standard usbaudio\n");
|
"non standard usbaudio\n");
|
||||||
|
|
||||||
err = snd_card_create(index[devnr], "Cx231xx Audio", THIS_MODULE,
|
err = snd_card_new(&dev->udev->dev, index[devnr], "Cx231xx Audio",
|
||||||
0, &card);
|
THIS_MODULE, 0, &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -682,7 +682,6 @@ static int cx231xx_audio_init(struct cx231xx *dev)
|
||||||
pcm->info_flags = 0;
|
pcm->info_flags = 0;
|
||||||
pcm->private_data = dev;
|
pcm->private_data = dev;
|
||||||
strcpy(pcm->name, "Conexant cx231xx Capture");
|
strcpy(pcm->name, "Conexant cx231xx Capture");
|
||||||
snd_card_set_dev(card, &dev->udev->dev);
|
|
||||||
strcpy(card->driver, "Cx231xx-Audio");
|
strcpy(card->driver, "Cx231xx-Audio");
|
||||||
strcpy(card->shortname, "Cx231xx Audio");
|
strcpy(card->shortname, "Cx231xx Audio");
|
||||||
strcpy(card->longname, "Conexant cx231xx Audio");
|
strcpy(card->longname, "Conexant cx231xx Audio");
|
||||||
|
|
|
@ -900,8 +900,8 @@ static int em28xx_audio_init(struct em28xx *dev)
|
||||||
printk(KERN_INFO
|
printk(KERN_INFO
|
||||||
"em28xx-audio.c: Copyright (C) 2007-2014 Mauro Carvalho Chehab\n");
|
"em28xx-audio.c: Copyright (C) 2007-2014 Mauro Carvalho Chehab\n");
|
||||||
|
|
||||||
err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0,
|
err = snd_card_new(&dev->udev->dev, index[devnr], "Em28xx Audio",
|
||||||
&card);
|
THIS_MODULE, 0, &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -918,7 +918,6 @@ static int em28xx_audio_init(struct em28xx *dev)
|
||||||
pcm->private_data = dev;
|
pcm->private_data = dev;
|
||||||
strcpy(pcm->name, "Empia 28xx Capture");
|
strcpy(pcm->name, "Empia 28xx Capture");
|
||||||
|
|
||||||
snd_card_set_dev(card, &dev->udev->dev);
|
|
||||||
strcpy(card->driver, "Em28xx-Audio");
|
strcpy(card->driver, "Em28xx-Audio");
|
||||||
strcpy(card->shortname, "Em28xx Audio");
|
strcpy(card->shortname, "Em28xx Audio");
|
||||||
strcpy(card->longname, "Empia 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,
|
* Just want a card to access ac96 controls,
|
||||||
* the actual capture interface will be handled by snd-usb-audio
|
* the actual capture interface will be handled by snd-usb-audio
|
||||||
*/
|
*/
|
||||||
rc = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
rc = snd_card_new(dev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||||
THIS_MODULE, 0, &card);
|
THIS_MODULE, 0, &card);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
snd_card_set_dev(card, dev->dev);
|
|
||||||
|
|
||||||
/* TODO: I'm not sure where should I get these names :-( */
|
/* TODO: I'm not sure where should I get these names :-( */
|
||||||
snprintf(card->shortname, sizeof(card->shortname),
|
snprintf(card->shortname, sizeof(card->shortname),
|
||||||
"stk1160-mixer");
|
"stk1160-mixer");
|
||||||
|
|
|
@ -300,7 +300,8 @@ int poseidon_audio_init(struct poseidon *p)
|
||||||
struct snd_pcm *pcm;
|
struct snd_pcm *pcm;
|
||||||
int ret;
|
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)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -431,7 +431,8 @@ static int tm6000_audio_init(struct tm6000_core *dev)
|
||||||
if (!enable[devnr])
|
if (!enable[devnr])
|
||||||
return -ENOENT;
|
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) {
|
if (rc < 0) {
|
||||||
snd_printk(KERN_ERR "cannot create card instance %d\n", devnr);
|
snd_printk(KERN_ERR "cannot create card instance %d\n", devnr);
|
||||||
return rc;
|
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.idVendor),
|
||||||
le16_to_cpu(dev->udev->descriptor.idProduct));
|
le16_to_cpu(dev->udev->descriptor.idProduct));
|
||||||
snd_component_add(card, component);
|
snd_component_add(card, component);
|
||||||
snd_card_set_dev(card, &dev->udev->dev);
|
|
||||||
|
|
||||||
chip = kzalloc(sizeof(struct snd_tm6000_card), GFP_KERNEL);
|
chip = kzalloc(sizeof(struct snd_tm6000_card), GFP_KERNEL);
|
||||||
if (!chip) {
|
if (!chip) {
|
||||||
|
|
|
@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat;
|
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);
|
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
|
ssc->regs = devm_ioremap_resource(&pdev->dev, regs);
|
||||||
if (IS_ERR(ssc->regs))
|
if (IS_ERR(ssc->regs))
|
||||||
|
|
|
@ -6776,8 +6776,9 @@ static int __init volume_create_alsa_mixer(void)
|
||||||
struct snd_kcontrol *ctl_mute;
|
struct snd_kcontrol *ctl_mute;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,
|
rc = snd_card_new(&tpacpi_pdev->dev,
|
||||||
sizeof(struct tpacpi_alsa_data), &card);
|
alsa_index, alsa_id, THIS_MODULE,
|
||||||
|
sizeof(struct tpacpi_alsa_data), &card);
|
||||||
if (rc < 0 || !card) {
|
if (rc < 0 || !card) {
|
||||||
pr_err("Failed to create ALSA card structures: %d\n", rc);
|
pr_err("Failed to create ALSA card structures: %d\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -6828,7 +6829,6 @@ static int __init volume_create_alsa_mixer(void)
|
||||||
}
|
}
|
||||||
data->ctl_mute_id = &ctl_mute->id;
|
data->ctl_mute_id = &ctl_mute->id;
|
||||||
|
|
||||||
snd_card_set_dev(card, &tpacpi_pdev->dev);
|
|
||||||
rc = snd_card_register(card);
|
rc = snd_card_register(card);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
pr_err("Failed to register ALSA card: %d\n", rc);
|
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;
|
struct snd_card *card;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
err = snd_card_new(line6->ifcdev,
|
||||||
THIS_MODULE, 0, &card);
|
SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||||
|
THIS_MODULE, 0, &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
|
@ -307,8 +307,6 @@ int line6_init_midi(struct usb_line6 *line6)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
snd_card_set_dev(line6->card, line6->ifcdev);
|
|
||||||
|
|
||||||
err = snd_line6_new_midi(line6midi);
|
err = snd_line6_new_midi(line6midi);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -501,8 +501,6 @@ int line6_init_pcm(struct usb_line6 *line6,
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
snd_card_set_dev(line6->card, line6->ifcdev);
|
|
||||||
|
|
||||||
err = snd_line6_new_pcm(line6pcm);
|
err = snd_line6_new_pcm(line6pcm);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -245,8 +245,8 @@ int go7007_snd_init(struct go7007 *go)
|
||||||
spin_lock_init(&gosnd->lock);
|
spin_lock_init(&gosnd->lock);
|
||||||
gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
|
gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
|
||||||
gosnd->capturing = 0;
|
gosnd->capturing = 0;
|
||||||
ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0,
|
ret = snd_card_new(go->dev, index[dev], id[dev], THIS_MODULE, 0,
|
||||||
&gosnd->card);
|
&gosnd->card);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
kfree(gosnd);
|
kfree(gosnd);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -257,7 +257,6 @@ int go7007_snd_init(struct go7007 *go)
|
||||||
kfree(gosnd);
|
kfree(gosnd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
snd_card_set_dev(gosnd->card, go->dev);
|
|
||||||
ret = snd_pcm_new(gosnd->card, "go7007", 0, 0, 1, &gosnd->pcm);
|
ret = snd_pcm_new(gosnd->card, "go7007", 0, 0, 1, &gosnd->pcm);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
snd_card_free(gosnd->card);
|
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 */
|
/* Allows for easier mapping between video and audio */
|
||||||
sprintf(name, "Softlogic%d", solo_dev->vfd->num);
|
sprintf(name, "Softlogic%d", solo_dev->vfd->num);
|
||||||
|
|
||||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, name, THIS_MODULE, 0,
|
ret = snd_card_new(&solo_dev->pdev->dev,
|
||||||
&solo_dev->snd_card);
|
SNDRV_DEFAULT_IDX1, name, THIS_MODULE, 0,
|
||||||
|
&solo_dev->snd_card);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -377,7 +378,6 @@ int solo_g723_init(struct solo_dev *solo_dev)
|
||||||
strcpy(card->shortname, "SOLO-6x10 Audio");
|
strcpy(card->shortname, "SOLO-6x10 Audio");
|
||||||
sprintf(card->longname, "%s on %s IRQ %d", card->shortname,
|
sprintf(card->longname, "%s on %s IRQ %d", card->shortname,
|
||||||
pci_name(solo_dev->pdev), solo_dev->pdev->irq);
|
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);
|
ret = snd_device_new(card, SNDRV_DEV_LOWLEVEL, solo_dev, &ops);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
@ -664,9 +664,10 @@ static int f_midi_register_card(struct f_midi *midi)
|
||||||
.dev_free = f_midi_snd_free,
|
.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) {
|
if (err < 0) {
|
||||||
ERROR(midi, "snd_card_create() failed\n");
|
ERROR(midi, "snd_card_new() failed\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
midi->card = card;
|
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_OUTPUT, &gmidi_in_ops);
|
||||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &gmidi_out_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 */
|
/* register it - we're ready to go */
|
||||||
err = snd_card_register(card);
|
err = snd_card_register(card);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
|
|
|
@ -394,7 +394,7 @@ static int snd_uac2_probe(struct platform_device *pdev)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* Choose any slot, with no id */
|
/* 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)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -421,8 +421,6 @@ static int snd_uac2_probe(struct platform_device *pdev)
|
||||||
strcpy(card->shortname, "UAC2_Gadget");
|
strcpy(card->shortname, "UAC2_Gadget");
|
||||||
sprintf(card->longname, "UAC2_Gadget %i", pdev->id);
|
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_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
|
||||||
snd_dma_continuous_data(GFP_KERNEL), 0, BUFF_SIZE_MAX);
|
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;
|
struct clk *clk;
|
||||||
int user;
|
int user;
|
||||||
int irq;
|
int irq;
|
||||||
|
bool clk_from_rk_pin;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
|
struct ssc_device * __must_check ssc_request(unsigned int ssc_num);
|
||||||
|
|
|
@ -1702,9 +1702,9 @@
|
||||||
/*
|
/*
|
||||||
* R373 (0x175) - FLL1 Control 5
|
* R373 (0x175) - FLL1 Control 5
|
||||||
*/
|
*/
|
||||||
#define ARIZONA_FLL1_FRATIO_MASK 0x0700 /* FLL1_FRATIO - [10:8] */
|
#define ARIZONA_FLL1_FRATIO_MASK 0x0F00 /* FLL1_FRATIO - [11:8] */
|
||||||
#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [10:8] */
|
#define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [11:8] */
|
||||||
#define ARIZONA_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [10: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_MASK 0x000E /* FLL1_OUTDIV - [3:1] */
|
||||||
#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */
|
#define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */
|
||||||
#define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* 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
|
* Copyright (c) 2009 Samsung Electronics Co. Ltd
|
||||||
* Author: Jaswinder Singh <jassi.brar@samsung.com>
|
* Author: Jaswinder Singh <jassi.brar@samsung.com>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/* arch/arm/plat-samsung/include/plat/audio-simtec.h
|
/*
|
||||||
*
|
|
||||||
* Copyright 2008 Simtec Electronics
|
* Copyright 2008 Simtec Electronics
|
||||||
* http://armlinux.simtec.co.uk/
|
* http://armlinux.simtec.co.uk/
|
||||||
* Ben Dooks <ben@simtec.co.uk>
|
* Ben Dooks <ben@simtec.co.uk>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <linux/genalloc.h>
|
#include <linux/genalloc.h>
|
||||||
|
|
||||||
struct snd_platform_data {
|
struct davinci_mcasp_pdata {
|
||||||
u32 tx_dma_offset;
|
u32 tx_dma_offset;
|
||||||
u32 rx_dma_offset;
|
u32 rx_dma_offset;
|
||||||
int asp_chan_q; /* event queue number for ASP channel */
|
int asp_chan_q; /* event queue number for ASP channel */
|
||||||
|
@ -87,6 +87,8 @@ struct snd_platform_data {
|
||||||
int tx_dma_channel;
|
int tx_dma_channel;
|
||||||
int rx_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 {
|
enum {
|
||||||
MCASP_VERSION_1 = 0, /* DM646x */
|
MCASP_VERSION_1 = 0, /* DM646x */
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/device.h>
|
||||||
#include <linux/sched.h> /* wake_up() */
|
#include <linux/sched.h> /* wake_up() */
|
||||||
#include <linux/mutex.h> /* struct mutex */
|
#include <linux/mutex.h> /* struct mutex */
|
||||||
#include <linux/rwsem.h> /* struct rw_semaphore */
|
#include <linux/rwsem.h> /* struct rw_semaphore */
|
||||||
|
@ -41,39 +42,33 @@
|
||||||
/* forward declarations */
|
/* forward declarations */
|
||||||
struct pci_dev;
|
struct pci_dev;
|
||||||
struct module;
|
struct module;
|
||||||
struct device;
|
struct completion;
|
||||||
struct device_attribute;
|
|
||||||
|
|
||||||
/* device allocation stuff */
|
/* 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;
|
enum snd_device_state {
|
||||||
#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)
|
SNDRV_DEV_BUILD,
|
||||||
#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1)
|
SNDRV_DEV_REGISTERED,
|
||||||
#define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_device_type_t) 2)
|
SNDRV_DEV_DISCONNECTED,
|
||||||
#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)
|
|
||||||
|
|
||||||
struct snd_device;
|
struct snd_device;
|
||||||
|
|
||||||
|
@ -86,8 +81,8 @@ struct snd_device_ops {
|
||||||
struct snd_device {
|
struct snd_device {
|
||||||
struct list_head list; /* list of registered devices */
|
struct list_head list; /* list of registered devices */
|
||||||
struct snd_card *card; /* card which holds this device */
|
struct snd_card *card; /* card which holds this device */
|
||||||
snd_device_state_t state; /* state of the device */
|
enum snd_device_state state; /* state of the device */
|
||||||
snd_device_type_t type; /* device type */
|
enum snd_device_type type; /* device type */
|
||||||
void *device_data; /* device structure */
|
void *device_data; /* device structure */
|
||||||
struct snd_device_ops *ops; /* operations */
|
struct snd_device_ops *ops; /* operations */
|
||||||
};
|
};
|
||||||
|
@ -131,11 +126,10 @@ struct snd_card {
|
||||||
state */
|
state */
|
||||||
spinlock_t files_lock; /* lock the files for this card */
|
spinlock_t files_lock; /* lock the files for this card */
|
||||||
int shutdown; /* this card is going down */
|
int shutdown; /* this card is going down */
|
||||||
int free_on_last_close; /* free in context of file_release */
|
struct completion *release_completion;
|
||||||
wait_queue_head_t shutdown_sleep;
|
|
||||||
atomic_t refcount; /* refcount for disconnection */
|
|
||||||
struct device *dev; /* device assigned to this card */
|
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
|
#ifdef CONFIG_PM
|
||||||
unsigned int power_state; /* power state */
|
unsigned int power_state; /* power state */
|
||||||
|
@ -149,6 +143,8 @@ struct snd_card {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev)
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
static inline void snd_power_lock(struct snd_card *card)
|
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 */
|
/* 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)
|
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 */
|
/* 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);
|
int snd_unregister_device(int type, struct snd_card *card, int dev);
|
||||||
void *snd_lookup_minor_data(unsigned int minor, int type);
|
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 *snd_get_device(int type, struct snd_card *card, int dev);
|
||||||
struct device_attribute *attr);
|
|
||||||
|
|
||||||
#ifdef CONFIG_SND_OSSEMUL
|
#ifdef CONFIG_SND_OSSEMUL
|
||||||
int snd_register_oss_device(int type, struct snd_card *card, int dev,
|
int snd_register_oss_device(int type, struct snd_card *card, int dev,
|
||||||
const struct file_operations *f_ops, void *private_data,
|
const struct file_operations *f_ops, void *private_data);
|
||||||
const char *name);
|
|
||||||
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
|
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
|
||||||
void *snd_lookup_oss_minor_data(unsigned int minor, int type);
|
void *snd_lookup_oss_minor_data(unsigned int minor, int type);
|
||||||
#endif
|
#endif
|
||||||
|
@ -284,9 +278,16 @@ int snd_card_locked(int card);
|
||||||
extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
|
extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int snd_card_create(int idx, const char *id,
|
int snd_card_new(struct device *parent, int idx, const char *xid,
|
||||||
struct module *module, int extra_size,
|
struct module *module, int extra_size,
|
||||||
struct snd_card **card_ret);
|
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_disconnect(struct snd_card *card);
|
||||||
int snd_card_free(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_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_add(struct snd_card *card, struct file *file);
|
||||||
int snd_card_file_remove(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))
|
#define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
|
||||||
|
|
||||||
/* device.c */
|
/* 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);
|
void *device_data, struct snd_device_ops *ops);
|
||||||
int snd_device_register(struct snd_card *card, void *device_data);
|
int snd_device_register(struct snd_card *card, void *device_data);
|
||||||
int snd_device_register_all(struct snd_card *card);
|
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_disconnect_all(struct snd_card *card);
|
||||||
int snd_device_free(struct snd_card *card, void *device_data);
|
void 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_all(struct snd_card *card);
|
||||||
|
|
||||||
/* isadma.c */
|
/* isadma.c */
|
||||||
|
|
||||||
|
@ -433,7 +433,6 @@ static inline void snd_printdd(const char *format, ...) {}
|
||||||
#define gameport_get_port_data(gp) (gp)->port_data
|
#define gameport_get_port_data(gp) (gp)->port_data
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PCI
|
|
||||||
/* PCI quirk list helper */
|
/* PCI quirk list helper */
|
||||||
struct snd_pci_quirk {
|
struct snd_pci_quirk {
|
||||||
unsigned short subvendor; /* PCI subvendor ID */
|
unsigned short subvendor; /* PCI subvendor ID */
|
||||||
|
@ -469,12 +468,26 @@ struct snd_pci_quirk {
|
||||||
#define snd_pci_quirk_name(q) ""
|
#define snd_pci_quirk_name(q) ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PCI
|
||||||
const struct snd_pci_quirk *
|
const struct snd_pci_quirk *
|
||||||
snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
|
snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list);
|
||||||
|
|
||||||
const struct snd_pci_quirk *
|
const struct snd_pci_quirk *
|
||||||
snd_pci_quirk_lookup_id(u16 vendor, u16 device,
|
snd_pci_quirk_lookup_id(u16 vendor, u16 device,
|
||||||
const struct snd_pci_quirk *list);
|
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
|
||||||
|
|
||||||
#endif /* __SOUND_CORE_H */
|
#endif /* __SOUND_CORE_H */
|
||||||
|
|
|
@ -436,8 +436,6 @@
|
||||||
#define CCCA_CURRADDR_MASK 0x00ffffff /* Current address of the selected channel */
|
#define CCCA_CURRADDR_MASK 0x00ffffff /* Current address of the selected channel */
|
||||||
#define CCCA_CURRADDR 0x18000008
|
#define CCCA_CURRADDR 0x18000008
|
||||||
|
|
||||||
/* undefine CCR to avoid conflict with the definition for SH */
|
|
||||||
#undef CCR
|
|
||||||
#define CCR 0x09 /* Cache control register */
|
#define CCR 0x09 /* Cache control register */
|
||||||
#define CCR_CACHEINVALIDSIZE 0x07190009
|
#define CCR_CACHEINVALIDSIZE 0x07190009
|
||||||
#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000 /* Number of invalid samples cache for this channel */
|
#define CCR_CACHEINVALIDSIZE_MASK 0xfe000000 /* Number of invalid samples cache for this channel */
|
||||||
|
|
|
@ -60,7 +60,6 @@ struct snd_hwdep {
|
||||||
int iface;
|
int iface;
|
||||||
|
|
||||||
#ifdef CONFIG_SND_OSSEMUL
|
#ifdef CONFIG_SND_OSSEMUL
|
||||||
char oss_dev[32];
|
|
||||||
int oss_type;
|
int oss_type;
|
||||||
int ossreg;
|
int ossreg;
|
||||||
#endif
|
#endif
|
||||||
|
@ -69,6 +68,8 @@ struct snd_hwdep {
|
||||||
wait_queue_head_t open_wait;
|
wait_queue_head_t open_wait;
|
||||||
void *private_data;
|
void *private_data;
|
||||||
void (*private_free) (struct snd_hwdep *hwdep);
|
void (*private_free) (struct snd_hwdep *hwdep);
|
||||||
|
struct device *dev;
|
||||||
|
const struct attribute_group **groups;
|
||||||
|
|
||||||
struct mutex open_mutex;
|
struct mutex open_mutex;
|
||||||
int used; /* reference counter */
|
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;
|
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 */
|
#endif /* __SOUND_PCM_H */
|
||||||
|
|
|
@ -157,10 +157,8 @@ void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
|
||||||
|
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
|
|
||||||
void snd_rawmidi_receive_reset(struct snd_rawmidi_substream *substream);
|
|
||||||
int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
|
int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
|
||||||
const unsigned char *buffer, int count);
|
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_empty(struct snd_rawmidi_substream *substream);
|
||||||
int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
|
int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
|
||||||
unsigned char *buffer, int count);
|
unsigned char *buffer, int count);
|
||||||
|
|
|
@ -34,17 +34,17 @@
|
||||||
* B : SSI direction
|
* B : SSI direction
|
||||||
*/
|
*/
|
||||||
#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
|
#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_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) \
|
#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 }
|
{ .dai_id = _dai_id, .dma_id = _dma_id, .pio_irq = _pio_irq, .flags = _flags }
|
||||||
#define RSND_SSI_UNUSED \
|
#define RSND_SSI_UNUSED \
|
||||||
{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
|
{ .dai_id = -1, .dma_id = -1, .pio_irq = -1, .flags = 0 }
|
||||||
|
|
||||||
struct rsnd_ssi_platform_info {
|
struct rsnd_ssi_platform_info {
|
||||||
int dai_id;
|
int dai_id; /* will be removed */
|
||||||
int dma_id;
|
int dma_id;
|
||||||
int pio_irq;
|
int pio_irq;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
@ -55,9 +55,31 @@ struct rsnd_ssi_platform_info {
|
||||||
*/
|
*/
|
||||||
#define RSND_SCU_USE_HPBIF (1 << 31) /* it needs RSND_SSI_DEPENDENT */
|
#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 flags;
|
||||||
u32 convert_rate; /* sampling rate convert */
|
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;
|
u32 flags;
|
||||||
struct rsnd_ssi_platform_info *ssi_info;
|
struct rsnd_ssi_platform_info *ssi_info;
|
||||||
int ssi_info_nr;
|
int ssi_info_nr;
|
||||||
struct rsnd_scu_platform_info *scu_info;
|
struct rsnd_src_platform_info *src_info;
|
||||||
int scu_info_nr;
|
int src_info_nr;
|
||||||
|
struct rsnd_dai_platform_info *dai_info;
|
||||||
|
int dai_info_nr;
|
||||||
int (*start)(int id);
|
int (*start)(int id);
|
||||||
int (*stop)(int id);
|
int (*stop)(int id);
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,8 @@ struct asoc_simple_dai {
|
||||||
const char *name;
|
const char *name;
|
||||||
unsigned int fmt;
|
unsigned int fmt;
|
||||||
unsigned int sysclk;
|
unsigned int sysclk;
|
||||||
|
int slots;
|
||||||
|
int slot_width;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct asoc_simple_card_info {
|
struct asoc_simple_card_info {
|
||||||
|
@ -29,10 +31,6 @@ struct asoc_simple_card_info {
|
||||||
unsigned int daifmt;
|
unsigned int daifmt;
|
||||||
struct asoc_simple_dai cpu_dai;
|
struct asoc_simple_dai cpu_dai;
|
||||||
struct asoc_simple_dai codec_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 */
|
#endif /* __SIMPLE_CARD_H */
|
||||||
|
|
|
@ -142,6 +142,8 @@ struct snd_soc_dai_ops {
|
||||||
* Called by soc_card drivers, normally in their hw_params.
|
* Called by soc_card drivers, normally in their hw_params.
|
||||||
*/
|
*/
|
||||||
int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
|
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,
|
int (*set_tdm_slot)(struct snd_soc_dai *dai,
|
||||||
unsigned int tx_mask, unsigned int rx_mask,
|
unsigned int tx_mask, unsigned int rx_mask,
|
||||||
int slots, int slot_width);
|
int slots, int slot_width);
|
||||||
|
@ -270,6 +272,7 @@ struct snd_soc_dai {
|
||||||
/* parent platform/codec */
|
/* parent platform/codec */
|
||||||
struct snd_soc_platform *platform;
|
struct snd_soc_platform *platform;
|
||||||
struct snd_soc_codec *codec;
|
struct snd_soc_codec *codec;
|
||||||
|
struct snd_soc_component *component;
|
||||||
|
|
||||||
struct snd_soc_card *card;
|
struct snd_soc_card *card;
|
||||||
|
|
||||||
|
|
|
@ -108,13 +108,9 @@ struct device;
|
||||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
||||||
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
||||||
#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
|
#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
|
||||||
{ .id = snd_soc_dapm_virt_mux, .name = wname, \
|
SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols)
|
||||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
|
||||||
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
|
||||||
#define SND_SOC_DAPM_VALUE_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_MUX(wname, wreg, wshift, winvert, wcontrols)
|
||||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
|
||||||
.kcontrol_news = wcontrols, .num_kcontrols = 1}
|
|
||||||
|
|
||||||
/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
|
/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
|
||||||
#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
|
#define SOC_PGA_ARRAY(wname, wreg, wshift, winvert,\
|
||||||
|
@ -172,10 +168,8 @@ struct device;
|
||||||
.event = wevent, .event_flags = wflags}
|
.event = wevent, .event_flags = wflags}
|
||||||
#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
|
#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
|
||||||
wevent, wflags) \
|
wevent, wflags) \
|
||||||
{ .id = snd_soc_dapm_virt_mux, .name = wname, \
|
SND_SOC_DAPM_MUX_E(wname, wreg, wshift, winvert, wcontrols, wevent, \
|
||||||
SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \
|
wflags)
|
||||||
.kcontrol_news = wcontrols, .num_kcontrols = 1, \
|
|
||||||
.event = wevent, .event_flags = wflags}
|
|
||||||
|
|
||||||
/* additional sequencing control within an event type */
|
/* additional sequencing control within an event type */
|
||||||
#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
|
#define SND_SOC_DAPM_PGA_S(wname, wsubseq, wreg, wshift, winvert, \
|
||||||
|
@ -311,12 +305,8 @@ struct device;
|
||||||
.get = snd_soc_dapm_get_enum_double, \
|
.get = snd_soc_dapm_get_enum_double, \
|
||||||
.put = snd_soc_dapm_put_enum_double, \
|
.put = snd_soc_dapm_put_enum_double, \
|
||||||
.private_value = (unsigned long)&xenum }
|
.private_value = (unsigned long)&xenum }
|
||||||
#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
|
#define SOC_DAPM_ENUM_VIRT(xname, xenum) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
SOC_DAPM_ENUM(xname, xenum)
|
||||||
.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_EXT(xname, xenum, xget, xput) \
|
#define SOC_DAPM_ENUM_EXT(xname, xenum, xget, xput) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||||
.info = snd_soc_info_enum_double, \
|
.info = snd_soc_info_enum_double, \
|
||||||
|
@ -324,11 +314,7 @@ struct device;
|
||||||
.put = xput, \
|
.put = xput, \
|
||||||
.private_value = (unsigned long)&xenum }
|
.private_value = (unsigned long)&xenum }
|
||||||
#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
|
#define SOC_DAPM_VALUE_ENUM(xname, xenum) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
SOC_DAPM_ENUM(xname, xenum)
|
||||||
.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 }
|
|
||||||
#define SOC_DAPM_PIN_SWITCH(xname) \
|
#define SOC_DAPM_PIN_SWITCH(xname) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
|
||||||
.info = snd_soc_dapm_info_pin_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);
|
struct snd_ctl_elem_value *ucontrol);
|
||||||
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol);
|
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,
|
int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo);
|
struct snd_ctl_elem_info *uinfo);
|
||||||
int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
|
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,
|
int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
|
||||||
const char *pin);
|
const char *pin);
|
||||||
int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
|
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,
|
int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
|
||||||
const char *pin);
|
const char *pin);
|
||||||
int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
|
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);
|
void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
|
||||||
|
|
||||||
/* Mostly internal - should not normally be used */
|
/* 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);
|
void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
|
||||||
|
|
||||||
/* dapm path query */
|
/* dapm path query */
|
||||||
|
@ -484,8 +462,6 @@ enum snd_soc_dapm_type {
|
||||||
snd_soc_dapm_input = 0, /* input pin */
|
snd_soc_dapm_input = 0, /* input pin */
|
||||||
snd_soc_dapm_output, /* output pin */
|
snd_soc_dapm_output, /* output pin */
|
||||||
snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
|
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, /* mixes several analog signals together */
|
||||||
snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
|
snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
|
||||||
snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
|
snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
|
||||||
|
|
|
@ -45,6 +45,11 @@
|
||||||
((unsigned long)&(struct soc_mixer_control) \
|
((unsigned long)&(struct soc_mixer_control) \
|
||||||
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
||||||
.max = xmax, .platform_max = xmax, .invert = xinvert})
|
.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) \
|
#define SOC_DOUBLE_R_RANGE_VALUE(xlreg, xrreg, xshift, xmin, xmax, xinvert) \
|
||||||
((unsigned long)&(struct soc_mixer_control) \
|
((unsigned long)&(struct soc_mixer_control) \
|
||||||
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
{.reg = xlreg, .rreg = xrreg, .shift = xshift, .rshift = xshift, \
|
||||||
|
@ -152,6 +157,15 @@
|
||||||
{.reg = xreg, .rreg = xrreg, \
|
{.reg = xreg, .rreg = xrreg, \
|
||||||
.shift = xshift, .rshift = xshift, \
|
.shift = xshift, .rshift = xshift, \
|
||||||
.max = xmax, .min = xmin} }
|
.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) \
|
#define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
|
||||||
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
|
.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
|
||||||
|
@ -162,30 +176,28 @@
|
||||||
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
.private_value = (unsigned long)&(struct soc_mixer_control) \
|
||||||
{.reg = xreg, .min = xmin, .max = xmax, \
|
{.reg = xreg, .min = xmin, .max = xmax, \
|
||||||
.platform_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, \
|
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
||||||
.max = xmax, .texts = xtexts, \
|
.items = xitems, .texts = xtexts, \
|
||||||
.mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0}
|
.mask = xitems ? roundup_pow_of_two(xitems) - 1 : 0}
|
||||||
#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
|
#define SOC_ENUM_SINGLE(xreg, xshift, xitems, xtexts) \
|
||||||
SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
|
SOC_ENUM_DOUBLE(xreg, xshift, xshift, xitems, xtexts)
|
||||||
#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
|
#define SOC_ENUM_SINGLE_EXT(xitems, xtexts) \
|
||||||
{ .max = xmax, .texts = xtexts }
|
{ .items = xitems, .texts = xtexts }
|
||||||
#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xmax, xtexts, xvalues) \
|
#define SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xitems, xtexts, xvalues) \
|
||||||
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
|
||||||
.mask = xmask, .max = xmax, .texts = xtexts, .values = xvalues}
|
.mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
|
||||||
#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xmax, xtexts, xvalues) \
|
#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \
|
||||||
SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xmax, 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) \
|
#define SOC_ENUM(xname, xenum) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
|
||||||
.info = snd_soc_info_enum_double, \
|
.info = snd_soc_info_enum_double, \
|
||||||
.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
|
.get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
|
||||||
.private_value = (unsigned long)&xenum }
|
.private_value = (unsigned long)&xenum }
|
||||||
#define SOC_VALUE_ENUM(xname, xenum) \
|
#define SOC_VALUE_ENUM(xname, xenum) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
|
SOC_ENUM(xname, xenum)
|
||||||
.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 }
|
|
||||||
#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
|
#define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
|
||||||
xhandler_get, xhandler_put) \
|
xhandler_get, xhandler_put) \
|
||||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||||
|
@ -272,17 +284,19 @@
|
||||||
* ARRAY_SIZE internally
|
* ARRAY_SIZE internally
|
||||||
*/
|
*/
|
||||||
#define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \
|
#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)
|
ARRAY_SIZE(xtexts), xtexts)
|
||||||
#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
|
#define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \
|
||||||
SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
|
SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts)
|
||||||
#define SOC_ENUM_SINGLE_EXT_DECL(name, 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) \
|
#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)
|
ARRAY_SIZE(xtexts), xtexts, xvalues)
|
||||||
#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, 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)
|
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
|
* 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;
|
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 {
|
enum snd_soc_pcm_subclass {
|
||||||
SND_SOC_PCM_CLASS_PCM = 0,
|
SND_SOC_PCM_CLASS_PCM = 0,
|
||||||
SND_SOC_PCM_CLASS_BE = 1,
|
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,
|
int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
|
||||||
unsigned int reg);
|
unsigned int reg);
|
||||||
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||||
int addr_bits, int data_bits,
|
struct regmap *regmap);
|
||||||
enum snd_soc_control_type control);
|
|
||||||
int snd_soc_cache_sync(struct snd_soc_codec *codec);
|
int snd_soc_cache_sync(struct snd_soc_codec *codec);
|
||||||
int snd_soc_cache_init(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);
|
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,
|
struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
|
||||||
const char *dai_link);
|
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 */
|
/* 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_calc_frame_size(int sample_size, int channels, int tdm_slots);
|
||||||
int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
|
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);
|
struct snd_ctl_elem_value *ucontrol);
|
||||||
int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
|
int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol);
|
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,
|
int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo);
|
struct snd_ctl_elem_info *uinfo);
|
||||||
#define snd_soc_info_bool_ext snd_ctl_boolean_mono_info
|
#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 snd_soc_jack *jack;
|
||||||
struct delayed_work work;
|
struct delayed_work work;
|
||||||
|
|
||||||
int (*jack_status_check)(void);
|
void *data;
|
||||||
|
int (*jack_status_check)(void *data);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct snd_soc_jack {
|
struct snd_soc_jack {
|
||||||
|
@ -656,12 +664,19 @@ struct snd_soc_component {
|
||||||
const char *name;
|
const char *name;
|
||||||
int id;
|
int id;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
||||||
|
unsigned int active;
|
||||||
|
|
||||||
|
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
|
||||||
|
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
|
||||||
struct snd_soc_dai_driver *dai_drv;
|
struct snd_soc_dai_driver *dai_drv;
|
||||||
int num_dai;
|
int num_dai;
|
||||||
|
|
||||||
const struct snd_soc_component_driver *driver;
|
const struct snd_soc_component_driver *driver;
|
||||||
|
|
||||||
|
struct list_head dai_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SoC Audio Codec device */
|
/* SoC Audio Codec device */
|
||||||
|
@ -683,7 +698,6 @@ struct snd_soc_codec {
|
||||||
|
|
||||||
/* runtime */
|
/* runtime */
|
||||||
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
|
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
|
||||||
unsigned int active;
|
|
||||||
unsigned int cache_bypass:1; /* Suppress access to the cache */
|
unsigned int cache_bypass:1; /* Suppress access to the cache */
|
||||||
unsigned int suspended:1; /* Codec is in suspend PM state */
|
unsigned int suspended:1; /* Codec is in suspend PM state */
|
||||||
unsigned int probed:1; /* Codec has been probed */
|
unsigned int probed:1; /* Codec has been probed */
|
||||||
|
@ -697,7 +711,6 @@ struct snd_soc_codec {
|
||||||
/* codec IO */
|
/* codec IO */
|
||||||
void *control_data; /* codec control (i2c/3wire) data */
|
void *control_data; /* codec control (i2c/3wire) data */
|
||||||
hw_write_t hw_write;
|
hw_write_t hw_write;
|
||||||
unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
|
|
||||||
unsigned int (*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);
|
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
|
||||||
void *reg_cache;
|
void *reg_cache;
|
||||||
|
@ -709,7 +722,6 @@ struct snd_soc_codec {
|
||||||
|
|
||||||
/* dapm */
|
/* dapm */
|
||||||
struct snd_soc_dapm_context dapm;
|
struct snd_soc_dapm_context dapm;
|
||||||
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
struct dentry *debugfs_codec_root;
|
struct dentry *debugfs_codec_root;
|
||||||
|
@ -1067,6 +1079,7 @@ struct soc_mixer_control {
|
||||||
int min, max, platform_max;
|
int min, max, platform_max;
|
||||||
int reg, rreg;
|
int reg, rreg;
|
||||||
unsigned int shift, rshift;
|
unsigned int shift, rshift;
|
||||||
|
unsigned int sign_bit;
|
||||||
unsigned int invert:1;
|
unsigned int invert:1;
|
||||||
unsigned int autodisable:1;
|
unsigned int autodisable:1;
|
||||||
};
|
};
|
||||||
|
@ -1085,16 +1098,28 @@ struct soc_mreg_control {
|
||||||
|
|
||||||
/* enumerated kcontrol */
|
/* enumerated kcontrol */
|
||||||
struct soc_enum {
|
struct soc_enum {
|
||||||
unsigned short reg;
|
int reg;
|
||||||
unsigned short reg2;
|
|
||||||
unsigned char shift_l;
|
unsigned char shift_l;
|
||||||
unsigned char shift_r;
|
unsigned char shift_r;
|
||||||
unsigned int max;
|
unsigned int items;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
const char * const *texts;
|
const char * const *texts;
|
||||||
const unsigned int *values;
|
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 */
|
/* codec IO */
|
||||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
|
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
|
||||||
unsigned int snd_soc_write(struct snd_soc_codec *codec,
|
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;
|
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);
|
int snd_soc_util_init(void);
|
||||||
void snd_soc_util_exit(void);
|
void snd_soc_util_exit(void);
|
||||||
|
|
||||||
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
|
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
|
||||||
const char *propname);
|
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,
|
int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
|
||||||
const char *propname);
|
const char *propname);
|
||||||
unsigned int snd_soc_of_parse_daifmt(struct device_node *np,
|
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;
|
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
|
#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;
|
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);
|
void * device_data, struct snd_device_ops * ops);
|
||||||
extern struct snd_card *aoa_get_card(void);
|
extern struct snd_card *aoa_get_card(void);
|
||||||
extern int aoa_snd_ctl_add(struct snd_kcontrol* control);
|
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;
|
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");
|
printk(KERN_ERR PFX "failed to create onyx snd device!\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -826,7 +826,7 @@ static int tas_init_codec(struct aoa_codec *codec)
|
||||||
return -ENODEV;
|
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");
|
printk(KERN_ERR PFX "failed to create tas snd device!\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ static int toonie_init_codec(struct aoa_codec *codec)
|
||||||
if (toonie->codec.connected != 1)
|
if (toonie->codec.connected != 1)
|
||||||
return -ENOTCONN;
|
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");
|
printk(KERN_ERR PFX "failed to create toonie snd device!\n");
|
||||||
return -ENODEV;
|
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 */
|
/* cannot be EEXIST due to usage in aoa_fabric_register */
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
|
err = snd_card_new(dev, index, name, mod, sizeof(struct aoa_card),
|
||||||
&alsa_card);
|
&alsa_card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
aoa_card = alsa_card->private_data;
|
aoa_card = alsa_card->private_data;
|
||||||
aoa_card->alsa_card = alsa_card;
|
aoa_card->alsa_card = alsa_card;
|
||||||
alsa_card->dev = dev;
|
|
||||||
strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
|
strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
|
||||||
strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
|
strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
|
||||||
strlcpy(alsa_card->longname, name, sizeof(alsa_card->longname));
|
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)
|
void * device_data, struct snd_device_ops * ops)
|
||||||
{
|
{
|
||||||
struct snd_card *card = aoa_get_card();
|
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;
|
struct snd_card *card;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
err = snd_card_new(&dev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||||
THIS_MODULE, sizeof(struct aaci), &card);
|
THIS_MODULE, sizeof(struct aaci), &card);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -1055,8 +1055,6 @@ static int aaci_probe(struct amba_device *dev,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
snd_card_set_dev(aaci->card, &dev->dev);
|
|
||||||
|
|
||||||
ret = snd_card_register(aaci->card);
|
ret = snd_card_register(aaci->card);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
dev_info(&dev->dev, "%s\n", aaci->card->longname);
|
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;
|
goto err_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
ret = snd_card_new(&dev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
||||||
THIS_MODULE, 0, &card);
|
THIS_MODULE, 0, &card);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
card->dev = &dev->dev;
|
|
||||||
strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
|
strlcpy(card->driver, dev->dev.driver->name, sizeof(card->driver));
|
||||||
|
|
||||||
ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
|
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])
|
if (pdata && pdata->codec_pdata[0])
|
||||||
snd_ac97_dev_add_pdata(ac97_bus->codec[0], 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);
|
ret = snd_card_register(card);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
platform_set_drvdata(dev, card);
|
platform_set_drvdata(dev, card);
|
||||||
|
|
|
@ -429,8 +429,9 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
clk_enable(pclk);
|
clk_enable(pclk);
|
||||||
|
|
||||||
retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1,
|
||||||
THIS_MODULE, sizeof(struct atmel_abdac), &card);
|
SNDRV_DEFAULT_STR1, THIS_MODULE,
|
||||||
|
sizeof(struct atmel_abdac), &card);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
dev_dbg(&pdev->dev, "could not create sound card device\n");
|
dev_dbg(&pdev->dev, "could not create sound card device\n");
|
||||||
goto out_put_sample_clk;
|
goto out_put_sample_clk;
|
||||||
|
@ -467,8 +468,6 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
||||||
goto out_unmap_regs;
|
goto out_unmap_regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_set_dev(card, &pdev->dev);
|
|
||||||
|
|
||||||
if (pdata->dws.dma_dev) {
|
if (pdata->dws.dma_dev) {
|
||||||
dma_cap_mask_t mask;
|
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) {
|
if (!pdata->dws.dma_dev || !dac->dma.chan) {
|
||||||
dev_dbg(&pdev->dev, "DMA not available\n");
|
dev_dbg(&pdev->dev, "DMA not available\n");
|
||||||
retval = -ENODEV;
|
retval = -ENODEV;
|
||||||
goto out_unset_card_dev;
|
goto out_unmap_regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(card->driver, "Atmel ABDAC");
|
strcpy(card->driver, "Atmel ABDAC");
|
||||||
|
@ -521,9 +520,6 @@ static int atmel_abdac_probe(struct platform_device *pdev)
|
||||||
out_release_dma:
|
out_release_dma:
|
||||||
dma_release_channel(dac->dma.chan);
|
dma_release_channel(dac->dma.chan);
|
||||||
dac->dma.chan = NULL;
|
dac->dma.chan = NULL;
|
||||||
out_unset_card_dev:
|
|
||||||
snd_card_set_dev(card, NULL);
|
|
||||||
free_irq(irq, dac);
|
|
||||||
out_unmap_regs:
|
out_unmap_regs:
|
||||||
iounmap(dac->regs);
|
iounmap(dac->regs);
|
||||||
out_free_card:
|
out_free_card:
|
||||||
|
@ -579,7 +575,6 @@ static int atmel_abdac_remove(struct platform_device *pdev)
|
||||||
|
|
||||||
dma_release_channel(dac->dma.chan);
|
dma_release_channel(dac->dma.chan);
|
||||||
dac->dma.chan = NULL;
|
dac->dma.chan = NULL;
|
||||||
snd_card_set_dev(card, NULL);
|
|
||||||
iounmap(dac->regs);
|
iounmap(dac->regs);
|
||||||
free_irq(dac->irq, dac);
|
free_irq(dac->irq, dac);
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
|
|
|
@ -945,8 +945,9 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
clk_enable(pclk);
|
clk_enable(pclk);
|
||||||
|
|
||||||
retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
|
retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1,
|
||||||
THIS_MODULE, sizeof(struct atmel_ac97c), &card);
|
SNDRV_DEFAULT_STR1, THIS_MODULE,
|
||||||
|
sizeof(struct atmel_ac97c), &card);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
dev_dbg(&pdev->dev, "could not create sound card device\n");
|
dev_dbg(&pdev->dev, "could not create sound card device\n");
|
||||||
goto err_snd_card_new;
|
goto err_snd_card_new;
|
||||||
|
@ -990,8 +991,6 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
|
||||||
chip->reset_pin = -EINVAL;
|
chip->reset_pin = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_set_dev(card, &pdev->dev);
|
|
||||||
|
|
||||||
atmel_ac97c_reset(chip);
|
atmel_ac97c_reset(chip);
|
||||||
|
|
||||||
/* Enable overrun interrupt from codec channel */
|
/* Enable overrun interrupt from codec channel */
|
||||||
|
@ -1113,8 +1112,6 @@ err_dma:
|
||||||
chip->dma.tx_chan = NULL;
|
chip->dma.tx_chan = NULL;
|
||||||
}
|
}
|
||||||
err_ac97_bus:
|
err_ac97_bus:
|
||||||
snd_card_set_dev(card, NULL);
|
|
||||||
|
|
||||||
if (gpio_is_valid(chip->reset_pin))
|
if (gpio_is_valid(chip->reset_pin))
|
||||||
gpio_free(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;
|
chip->dma.tx_chan = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_card_set_dev(card, NULL);
|
|
||||||
snd_card_free(card);
|
snd_card_free(card);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -151,7 +151,7 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask,
|
||||||
if (snd_BUG_ON(!card || !id))
|
if (snd_BUG_ON(!card || !id))
|
||||||
return;
|
return;
|
||||||
read_lock(&card->ctl_files_rwlock);
|
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++;
|
card->mixer_oss_change_count++;
|
||||||
#endif
|
#endif
|
||||||
list_for_each_entry(ctl, &card->ctl_files, list) {
|
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;
|
ev->mask = mask;
|
||||||
list_add_tail(&ev->list, &ctl->events);
|
list_add_tail(&ev->list, &ctl->events);
|
||||||
} else {
|
} else {
|
||||||
snd_printk(KERN_ERR "No memory available to allocate event\n");
|
dev_err(card->dev, "No memory available to allocate event\n");
|
||||||
}
|
}
|
||||||
_found:
|
_found:
|
||||||
wake_up(&ctl->change_sleep);
|
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);
|
kctl = kzalloc(sizeof(*kctl) + sizeof(struct snd_kcontrol_volatile) * control->count, GFP_KERNEL);
|
||||||
if (kctl == NULL) {
|
if (kctl == NULL) {
|
||||||
snd_printk(KERN_ERR "Cannot allocate control instance\n");
|
pr_err("ALSA: Cannot allocate control instance\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*kctl = *control;
|
*kctl = *control;
|
||||||
|
@ -241,9 +241,8 @@ struct snd_kcontrol *snd_ctl_new1(const struct snd_kcontrol_new *ncontrol,
|
||||||
if (ncontrol->name) {
|
if (ncontrol->name) {
|
||||||
strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
|
strlcpy(kctl.id.name, ncontrol->name, sizeof(kctl.id.name));
|
||||||
if (strcmp(ncontrol->name, kctl.id.name) != 0)
|
if (strcmp(ncontrol->name, kctl.id.name) != 0)
|
||||||
snd_printk(KERN_WARNING
|
pr_warn("ALSA: Control name '%s' truncated to '%s'\n",
|
||||||
"Control name '%s' truncated to '%s'\n",
|
ncontrol->name, kctl.id.name);
|
||||||
ncontrol->name, kctl.id.name);
|
|
||||||
}
|
}
|
||||||
kctl.id.index = ncontrol->index;
|
kctl.id.index = ncontrol->index;
|
||||||
kctl.count = ncontrol->count ? ncontrol->count : 1;
|
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)) {
|
while (snd_ctl_remove_numid_conflict(card, count)) {
|
||||||
if (--iter == 0) {
|
if (--iter == 0) {
|
||||||
/* this situation is very unlikely */
|
/* 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;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +340,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
|
||||||
down_write(&card->controls_rwsem);
|
down_write(&card->controls_rwsem);
|
||||||
if (snd_ctl_find_id(card, &id)) {
|
if (snd_ctl_find_id(card, &id)) {
|
||||||
up_write(&card->controls_rwsem);
|
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.iface,
|
||||||
id.device,
|
id.device,
|
||||||
id.subdevice,
|
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);
|
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;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ static int copy_ctl_value_from_user(struct snd_card *card,
|
||||||
} else {
|
} else {
|
||||||
size = get_elem_size(type, count);
|
size = get_elem_size(type, count);
|
||||||
if (size < 0) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (copy_from_user(data->value.bytes.data,
|
if (copy_from_user(data->value.bytes.data,
|
||||||
|
|
|
@ -41,28 +41,72 @@
|
||||||
*
|
*
|
||||||
* Return: Zero if successful, or a negative error code on failure.
|
* 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)
|
void *device_data, struct snd_device_ops *ops)
|
||||||
{
|
{
|
||||||
struct snd_device *dev;
|
struct snd_device *dev;
|
||||||
|
struct list_head *p;
|
||||||
|
|
||||||
if (snd_BUG_ON(!card || !device_data || !ops))
|
if (snd_BUG_ON(!card || !device_data || !ops))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||||
if (dev == NULL) {
|
if (dev == NULL) {
|
||||||
snd_printk(KERN_ERR "Cannot allocate device\n");
|
dev_err(card->dev, "Cannot allocate device, type=%d\n", type);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
INIT_LIST_HEAD(&dev->list);
|
||||||
dev->card = card;
|
dev->card = card;
|
||||||
dev->type = type;
|
dev->type = type;
|
||||||
dev->state = SNDRV_DEV_BUILD;
|
dev->state = SNDRV_DEV_BUILD;
|
||||||
dev->device_data = device_data;
|
dev->device_data = device_data;
|
||||||
dev->ops = ops;
|
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;
|
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
|
* 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
|
* Removes the device from the list on the card and invokes the
|
||||||
* callbacks, dev_disconnect and dev_free, corresponding to the state.
|
* callbacks, dev_disconnect and dev_free, corresponding to the state.
|
||||||
* Then release the device.
|
* 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;
|
struct snd_device *dev;
|
||||||
|
|
||||||
if (snd_BUG_ON(!card || !device_data))
|
if (snd_BUG_ON(!card || !device_data))
|
||||||
return -ENXIO;
|
return;
|
||||||
list_for_each_entry(dev, &card->devices, list) {
|
dev = look_for_dev(card, device_data);
|
||||||
if (dev->device_data != device_data)
|
if (dev)
|
||||||
continue;
|
__snd_device_free(dev);
|
||||||
/* unlink */
|
else
|
||||||
list_del(&dev->list);
|
dev_dbg(card->dev, "device free %p (from %pF), not found\n",
|
||||||
if (dev->state == SNDRV_DEV_REGISTERED &&
|
device_data, __builtin_return_address(0));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(snd_device_free);
|
EXPORT_SYMBOL(snd_device_free);
|
||||||
|
|
||||||
/**
|
static int __snd_device_register(struct snd_device *dev)
|
||||||
* 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)
|
|
||||||
{
|
{
|
||||||
struct snd_device *dev;
|
if (dev->state == SNDRV_DEV_BUILD) {
|
||||||
|
if (dev->ops->dev_register) {
|
||||||
if (snd_BUG_ON(!card || !device_data))
|
int err = dev->ops->dev_register(dev);
|
||||||
return -ENXIO;
|
if (err < 0)
|
||||||
list_for_each_entry(dev, &card->devices, list) {
|
return err;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
return 0;
|
dev->state = SNDRV_DEV_REGISTERED;
|
||||||
}
|
}
|
||||||
snd_printd("device disconnect %p (from %pF), not found\n", device_data,
|
return 0;
|
||||||
__builtin_return_address(0));
|
|
||||||
return -ENXIO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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)
|
int snd_device_register(struct snd_card *card, void *device_data)
|
||||||
{
|
{
|
||||||
struct snd_device *dev;
|
struct snd_device *dev;
|
||||||
int err;
|
|
||||||
|
|
||||||
if (snd_BUG_ON(!card || !device_data))
|
if (snd_BUG_ON(!card || !device_data))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
list_for_each_entry(dev, &card->devices, list) {
|
dev = look_for_dev(card, device_data);
|
||||||
if (dev->device_data != device_data)
|
if (dev)
|
||||||
continue;
|
return __snd_device_register(dev);
|
||||||
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;
|
|
||||||
}
|
|
||||||
snd_BUG();
|
snd_BUG();
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(snd_device_register);
|
EXPORT_SYMBOL(snd_device_register);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -191,11 +184,9 @@ int snd_device_register_all(struct snd_card *card)
|
||||||
if (snd_BUG_ON(!card))
|
if (snd_BUG_ON(!card))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
list_for_each_entry(dev, &card->devices, list) {
|
list_for_each_entry(dev, &card->devices, list) {
|
||||||
if (dev->state == SNDRV_DEV_BUILD && dev->ops->dev_register) {
|
err = __snd_device_register(dev);
|
||||||
if ((err = dev->ops->dev_register(dev)) < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
dev->state = SNDRV_DEV_REGISTERED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -211,8 +202,8 @@ int snd_device_disconnect_all(struct snd_card *card)
|
||||||
|
|
||||||
if (snd_BUG_ON(!card))
|
if (snd_BUG_ON(!card))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
list_for_each_entry(dev, &card->devices, list) {
|
list_for_each_entry_reverse(dev, &card->devices, list) {
|
||||||
if (snd_device_disconnect(card, dev->device_data) < 0)
|
if (__snd_device_disconnect(dev) < 0)
|
||||||
err = -ENXIO;
|
err = -ENXIO;
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
|
@ -222,24 +213,12 @@ int snd_device_disconnect_all(struct snd_card *card)
|
||||||
* release all the devices on the card.
|
* release all the devices on the card.
|
||||||
* called from init.c
|
* 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;
|
struct snd_device *dev, *next;
|
||||||
int err;
|
|
||||||
unsigned int range_low, range_high, type;
|
|
||||||
|
|
||||||
if (snd_BUG_ON(!card))
|
if (snd_BUG_ON(!card))
|
||||||
return -ENXIO;
|
return;
|
||||||
range_low = (__force unsigned int)cmd * SNDRV_DEV_TYPE_RANGE_SIZE;
|
list_for_each_entry_safe_reverse(dev, next, &card->devices, list)
|
||||||
range_high = range_low + SNDRV_DEV_TYPE_RANGE_SIZE - 1;
|
__snd_device_free(dev);
|
||||||
__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;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,8 +126,7 @@ static int __init snd_hrtimer_init(void)
|
||||||
|
|
||||||
hrtimer_get_res(CLOCK_MONOTONIC, &tp);
|
hrtimer_get_res(CLOCK_MONOTONIC, &tp);
|
||||||
if (tp.tv_sec > 0 || !tp.tv_nsec) {
|
if (tp.tv_sec > 0 || !tp.tv_nsec) {
|
||||||
snd_printk(KERN_ERR
|
pr_err("snd-hrtimer: Invalid resolution %u.%09u",
|
||||||
"snd-hrtimer: Invalid resolution %u.%09u",
|
|
||||||
(unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
|
(unsigned)tp.tv_sec, (unsigned)tp.tv_nsec);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
|
||||||
*rhwdep = NULL;
|
*rhwdep = NULL;
|
||||||
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
|
hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
|
||||||
if (hwdep == NULL) {
|
if (hwdep == NULL) {
|
||||||
snd_printk(KERN_ERR "hwdep: cannot allocate\n");
|
dev_err(card->dev, "hwdep: cannot allocate\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
hwdep->card = card;
|
hwdep->card = card;
|
||||||
|
@ -395,6 +395,7 @@ int snd_hwdep_new(struct snd_card *card, char *id, int device,
|
||||||
*rhwdep = hwdep;
|
*rhwdep = hwdep;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_hwdep_new);
|
||||||
|
|
||||||
static int snd_hwdep_free(struct snd_hwdep *hwdep)
|
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)
|
static int snd_hwdep_dev_register(struct snd_device *device)
|
||||||
{
|
{
|
||||||
struct snd_hwdep *hwdep = device->device_data;
|
struct snd_hwdep *hwdep = device->device_data;
|
||||||
|
struct snd_card *card = hwdep->card;
|
||||||
|
struct device *dev;
|
||||||
int err;
|
int err;
|
||||||
char name[32];
|
char name[32];
|
||||||
|
|
||||||
mutex_lock(®ister_mutex);
|
mutex_lock(®ister_mutex);
|
||||||
if (snd_hwdep_search(hwdep->card, hwdep->device)) {
|
if (snd_hwdep_search(card, hwdep->device)) {
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
list_add_tail(&hwdep->list, &snd_hwdep_devices);
|
list_add_tail(&hwdep->list, &snd_hwdep_devices);
|
||||||
sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device);
|
sprintf(name, "hwC%iD%i", hwdep->card->number, hwdep->device);
|
||||||
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_HWDEP,
|
dev = hwdep->dev;
|
||||||
hwdep->card, hwdep->device,
|
if (!dev)
|
||||||
&snd_hwdep_f_ops, hwdep, name)) < 0) {
|
dev = snd_card_get_device_link(hwdep->card);
|
||||||
snd_printk(KERN_ERR "unable to register hardware dependent device %i:%i\n",
|
err = snd_register_device_for_dev(SNDRV_DEVICE_TYPE_HWDEP,
|
||||||
hwdep->card->number, hwdep->device);
|
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);
|
list_del(&hwdep->list);
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
return err;
|
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
|
#ifdef CONFIG_SND_OSSEMUL
|
||||||
hwdep->ossreg = 0;
|
hwdep->ossreg = 0;
|
||||||
if (hwdep->oss_type >= 0) {
|
if (hwdep->oss_type >= 0) {
|
||||||
if ((hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM) && (hwdep->device != 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 {
|
} else {
|
||||||
if (snd_register_oss_device(hwdep->oss_type,
|
if (snd_register_oss_device(hwdep->oss_type,
|
||||||
hwdep->card, hwdep->device,
|
card, hwdep->device,
|
||||||
&snd_hwdep_f_ops, hwdep,
|
&snd_hwdep_f_ops, hwdep) < 0) {
|
||||||
hwdep->oss_dev) < 0) {
|
dev_err(dev,
|
||||||
snd_printk(KERN_ERR "unable to register OSS compatibility device %i:%i\n",
|
"unable to register OSS compatibility device %i:%i\n",
|
||||||
hwdep->card->number, hwdep->device);
|
card->number, hwdep->device);
|
||||||
} else
|
} else
|
||||||
hwdep->ossreg = 1;
|
hwdep->ossreg = 1;
|
||||||
}
|
}
|
||||||
|
@ -543,5 +568,3 @@ static void __exit alsa_hwdep_exit(void)
|
||||||
|
|
||||||
module_init(alsa_hwdep_init)
|
module_init(alsa_hwdep_init)
|
||||||
module_exit(alsa_hwdep_exit)
|
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) {
|
if (entry->c.text.write) {
|
||||||
entry->c.text.write(entry, data->wbuffer);
|
entry->c.text.write(entry, data->wbuffer);
|
||||||
if (data->wbuffer->error) {
|
if (data->wbuffer->error) {
|
||||||
snd_printk(KERN_WARNING "data write error to %s (%i)\n",
|
if (entry->card)
|
||||||
entry->name,
|
dev_warn(entry->card->dev, "info: data write error to %s (%i)\n",
|
||||||
data->wbuffer->error);
|
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);
|
kfree(data->wbuffer->buffer);
|
||||||
|
@ -540,7 +545,7 @@ int __init snd_info_init(void)
|
||||||
snd_oss_root = entry;
|
snd_oss_root = entry;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_SND_SEQUENCER) || defined(CONFIG_SND_SEQUENCER_MODULE)
|
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
|
||||||
{
|
{
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
if ((entry = snd_info_create_module_entry(THIS_MODULE, "seq", NULL)) == NULL)
|
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_minor_info_done();
|
||||||
snd_info_version_done();
|
snd_info_version_done();
|
||||||
if (snd_proc_root) {
|
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);
|
snd_info_free_entry(snd_seq_root);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_SND_OSSEMUL
|
#ifdef CONFIG_SND_OSSEMUL
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
|
#include <linux/completion.h>
|
||||||
|
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
@ -94,7 +95,7 @@ static int module_slot_match(struct module *module, int idx)
|
||||||
return match;
|
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);
|
int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
|
||||||
EXPORT_SYMBOL(snd_mixer_oss_notify_callback);
|
EXPORT_SYMBOL(snd_mixer_oss_notify_callback);
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,11 +113,11 @@ static inline int init_info_for_card(struct snd_card *card)
|
||||||
struct snd_info_entry *entry;
|
struct snd_info_entry *entry;
|
||||||
|
|
||||||
if ((err = snd_info_card_register(card)) < 0) {
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
entry->c.text.read = snd_card_id_read;
|
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 */
|
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)]
|
* @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
|
||||||
* @xid: card identification (ASCII string)
|
* @xid: card identification (ASCII string)
|
||||||
* @module: top level module for locking
|
* @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.
|
* 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 module *module, int extra_size,
|
||||||
struct snd_card **card_ret)
|
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);
|
card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
|
||||||
if (!card)
|
if (!card)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
if (extra_size > 0)
|
||||||
|
card->private_data = (char *)card + sizeof(struct snd_card);
|
||||||
if (xid)
|
if (xid)
|
||||||
strlcpy(card->id, xid, sizeof(card->id));
|
strlcpy(card->id, xid, sizeof(card->id));
|
||||||
err = 0;
|
err = 0;
|
||||||
|
@ -205,14 +217,16 @@ int snd_card_create(int idx, const char *xid,
|
||||||
err = -ENODEV;
|
err = -ENODEV;
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
mutex_unlock(&snd_card_mutex);
|
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);
|
idx, snd_ecards_limit - 1, err);
|
||||||
goto __error;
|
kfree(card);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
set_bit(idx, snd_cards_lock); /* lock it */
|
set_bit(idx, snd_cards_lock); /* lock it */
|
||||||
if (idx >= snd_ecards_limit)
|
if (idx >= snd_ecards_limit)
|
||||||
snd_ecards_limit = idx + 1; /* increase the limit */
|
snd_ecards_limit = idx + 1; /* increase the limit */
|
||||||
mutex_unlock(&snd_card_mutex);
|
mutex_unlock(&snd_card_mutex);
|
||||||
|
card->dev = parent;
|
||||||
card->number = idx;
|
card->number = idx;
|
||||||
card->module = module;
|
card->module = module;
|
||||||
INIT_LIST_HEAD(&card->devices);
|
INIT_LIST_HEAD(&card->devices);
|
||||||
|
@ -222,36 +236,42 @@ int snd_card_create(int idx, const char *xid,
|
||||||
INIT_LIST_HEAD(&card->ctl_files);
|
INIT_LIST_HEAD(&card->ctl_files);
|
||||||
spin_lock_init(&card->files_lock);
|
spin_lock_init(&card->files_lock);
|
||||||
INIT_LIST_HEAD(&card->files_list);
|
INIT_LIST_HEAD(&card->files_list);
|
||||||
init_waitqueue_head(&card->shutdown_sleep);
|
|
||||||
atomic_set(&card->refcount, 0);
|
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
mutex_init(&card->power_lock);
|
mutex_init(&card->power_lock);
|
||||||
init_waitqueue_head(&card->power_sleep);
|
init_waitqueue_head(&card->power_sleep);
|
||||||
#endif
|
#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 */
|
/* the control interface cannot be accessed from the user space until */
|
||||||
/* snd_cards_bitmask and snd_cards are set with snd_card_register */
|
/* snd_cards_bitmask and snd_cards are set with snd_card_register */
|
||||||
err = snd_ctl_create(card);
|
err = snd_ctl_create(card);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_printk(KERN_ERR "unable to register control minors\n");
|
dev_err(parent, "unable to register control minors\n");
|
||||||
goto __error;
|
goto __error;
|
||||||
}
|
}
|
||||||
err = snd_info_card_create(card);
|
err = snd_info_card_create(card);
|
||||||
if (err < 0) {
|
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;
|
goto __error_ctl;
|
||||||
}
|
}
|
||||||
if (extra_size > 0)
|
|
||||||
card->private_data = (char *)card + sizeof(struct snd_card);
|
|
||||||
*card_ret = card;
|
*card_ret = card;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
__error_ctl:
|
__error_ctl:
|
||||||
snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
|
snd_device_free_all(card);
|
||||||
__error:
|
__error:
|
||||||
kfree(card);
|
put_device(&card->card_dev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(snd_card_create);
|
EXPORT_SYMBOL(snd_card_new);
|
||||||
|
|
||||||
/* return non-zero if a card is already locked */
|
/* return non-zero if a card is already locked */
|
||||||
int snd_card_locked(int card)
|
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 */
|
/* phase 3: notify all connected devices about disconnection */
|
||||||
/* at this point, they cannot respond to any calls except release() */
|
/* 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)
|
if (snd_mixer_oss_notify_callback)
|
||||||
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
|
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
|
||||||
#endif
|
#endif
|
||||||
|
@ -402,12 +422,12 @@ int snd_card_disconnect(struct snd_card *card)
|
||||||
/* notify all devices that we are disconnected */
|
/* notify all devices that we are disconnected */
|
||||||
err = snd_device_disconnect_all(card);
|
err = snd_device_disconnect_all(card);
|
||||||
if (err < 0)
|
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);
|
snd_info_card_disconnect(card);
|
||||||
if (card->card_dev) {
|
if (card->registered) {
|
||||||
device_unregister(card->card_dev);
|
device_del(&card->card_dev);
|
||||||
card->card_dev = NULL;
|
card->registered = false;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
wake_up(&card->power_sleep);
|
wake_up(&card->power_sleep);
|
||||||
|
@ -430,81 +450,48 @@ EXPORT_SYMBOL(snd_card_disconnect);
|
||||||
*/
|
*/
|
||||||
static int snd_card_do_free(struct snd_card *card)
|
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)
|
if (snd_mixer_oss_notify_callback)
|
||||||
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
|
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
|
||||||
#endif
|
#endif
|
||||||
if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) {
|
snd_device_free_all(card);
|
||||||
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 */
|
|
||||||
}
|
|
||||||
if (card->private_free)
|
if (card->private_free)
|
||||||
card->private_free(card);
|
card->private_free(card);
|
||||||
snd_info_free_entry(card->proc_id);
|
snd_info_free_entry(card->proc_id);
|
||||||
if (snd_info_card_free(card) < 0) {
|
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 */
|
/* Not fatal error */
|
||||||
}
|
}
|
||||||
|
if (card->release_completion)
|
||||||
|
complete(card->release_completion);
|
||||||
kfree(card);
|
kfree(card);
|
||||||
return 0;
|
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 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);
|
int ret = snd_card_disconnect(card);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
put_device(&card->card_dev);
|
||||||
/* wait, until all devices are ready for the free operation */
|
|
||||||
wait_event(card->shutdown_sleep, !atomic_read(&card->refcount));
|
|
||||||
snd_card_do_free(card);
|
|
||||||
return 0;
|
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);
|
EXPORT_SYMBOL(snd_card_free);
|
||||||
|
|
||||||
/* retrieve the last word of shortname or longname */
|
/* 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;
|
goto again;
|
||||||
}
|
}
|
||||||
/* last resort... */
|
/* 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)
|
if (card->proc_root->name)
|
||||||
strlcpy(card->id, card->proc_root->name, sizeof(card->id));
|
strlcpy(card->id, card->proc_root->name, sizeof(card->id));
|
||||||
}
|
}
|
||||||
|
@ -626,15 +613,15 @@ static ssize_t
|
||||||
card_id_show_attr(struct device *dev,
|
card_id_show_attr(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct snd_card *card = dev_get_drvdata(dev);
|
struct snd_card *card = container_of(dev, struct snd_card, card_dev);
|
||||||
return snprintf(buf, PAGE_SIZE, "%s\n", card ? card->id : "(null)");
|
return snprintf(buf, PAGE_SIZE, "%s\n", card->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
card_id_store_attr(struct device *dev, struct device_attribute *attr,
|
card_id_store_attr(struct device *dev, struct device_attribute *attr,
|
||||||
const char *buf, size_t count)
|
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)];
|
char buf1[sizeof(card->id)];
|
||||||
size_t copy = count > sizeof(card->id) - 1 ?
|
size_t copy = count > sizeof(card->id) - 1 ?
|
||||||
sizeof(card->id) - 1 : count;
|
sizeof(card->id) - 1 : count;
|
||||||
|
@ -660,19 +647,32 @@ card_id_store_attr(struct device *dev, struct device_attribute *attr,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct device_attribute card_id_attrs =
|
static DEVICE_ATTR(id, S_IRUGO | S_IWUSR, card_id_show_attr, card_id_store_attr);
|
||||||
__ATTR(id, S_IRUGO | S_IWUSR, card_id_show_attr, card_id_store_attr);
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
card_number_show_attr(struct device *dev,
|
card_number_show_attr(struct device *dev,
|
||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct snd_card *card = dev_get_drvdata(dev);
|
struct snd_card *card = container_of(dev, struct snd_card, card_dev);
|
||||||
return snprintf(buf, PAGE_SIZE, "%i\n", card ? card->number : -1);
|
return snprintf(buf, PAGE_SIZE, "%i\n", card->number);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct device_attribute card_number_attrs =
|
static DEVICE_ATTR(number, S_IRUGO, card_number_show_attr, NULL);
|
||||||
__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
|
* snd_card_register - register the soundcard
|
||||||
|
@ -692,12 +692,11 @@ int snd_card_register(struct snd_card *card)
|
||||||
if (snd_BUG_ON(!card))
|
if (snd_BUG_ON(!card))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!card->card_dev) {
|
if (!card->registered) {
|
||||||
card->card_dev = device_create(sound_class, card->dev,
|
err = device_add(&card->card_dev);
|
||||||
MKDEV(0, 0), card,
|
if (err < 0)
|
||||||
"card%i", card->number);
|
return err;
|
||||||
if (IS_ERR(card->card_dev))
|
card->registered = true;
|
||||||
card->card_dev = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = snd_device_register_all(card)) < 0)
|
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;
|
snd_cards[card->number] = card;
|
||||||
mutex_unlock(&snd_card_mutex);
|
mutex_unlock(&snd_card_mutex);
|
||||||
init_info_for_card(card);
|
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)
|
if (snd_mixer_oss_notify_callback)
|
||||||
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
|
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
|
||||||
#endif
|
#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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,7 +898,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
list_add(&mfile->list, &card->files_list);
|
list_add(&mfile->list, &card->files_list);
|
||||||
atomic_inc(&card->refcount);
|
get_device(&card->card_dev);
|
||||||
spin_unlock(&card->files_lock);
|
spin_unlock(&card->files_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -947,11 +937,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
|
||||||
}
|
}
|
||||||
spin_unlock(&card->files_lock);
|
spin_unlock(&card->files_lock);
|
||||||
if (!found) {
|
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;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
kfree(found);
|
kfree(found);
|
||||||
snd_card_unref(card);
|
put_device(&card->card_dev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ unsigned int snd_dma_pointer(unsigned long dma, unsigned int size)
|
||||||
result = result1;
|
result = result1;
|
||||||
#ifdef CONFIG_SND_DEBUG
|
#ifdef CONFIG_SND_DEBUG
|
||||||
if (result > size)
|
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
|
#endif
|
||||||
if (result >= size || result == 0)
|
if (result >= size || result == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -207,7 +207,7 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
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->area = NULL;
|
||||||
dmab->addr = 0;
|
dmab->addr = 0;
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
@ -284,7 +284,7 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
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)
|
if (oss_mixer_names[ch] && strcmp(oss_mixer_names[ch], str) == 0)
|
||||||
break;
|
break;
|
||||||
if (ch >= SNDRV_OSS_MAX_MIXERS) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
cptr = snd_info_get_str(str, cptr, sizeof(str));
|
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));
|
snd_info_get_str(idxstr, cptr, sizeof(idxstr));
|
||||||
idx = simple_strtoul(idxstr, NULL, 10);
|
idx = simple_strtoul(idxstr, NULL, 10);
|
||||||
if (idx >= 0x4000) { /* too big */
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
mutex_lock(&mixer->reg_mutex);
|
mutex_lock(&mixer->reg_mutex);
|
||||||
|
@ -1212,7 +1213,7 @@ static void snd_mixer_oss_proc_write(struct snd_info_entry *entry,
|
||||||
goto __unlock;
|
goto __unlock;
|
||||||
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
tbl = kmalloc(sizeof(*tbl), GFP_KERNEL);
|
||||||
if (! tbl) {
|
if (! tbl) {
|
||||||
snd_printk(KERN_ERR "mixer_oss: no memory\n");
|
pr_err("ALSA: mixer_oss: no memory\n");
|
||||||
goto __unlock;
|
goto __unlock;
|
||||||
}
|
}
|
||||||
tbl->oss_id = ch;
|
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;
|
struct snd_mixer_oss *mixer;
|
||||||
|
|
||||||
if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) {
|
if (cmd == SND_MIXER_OSS_NOTIFY_REGISTER) {
|
||||||
char name[128];
|
|
||||||
int idx, err;
|
int idx, err;
|
||||||
|
|
||||||
mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL);
|
mixer = kcalloc(2, sizeof(*mixer), GFP_KERNEL);
|
||||||
if (mixer == NULL)
|
if (mixer == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
mutex_init(&mixer->reg_mutex);
|
mutex_init(&mixer->reg_mutex);
|
||||||
sprintf(name, "mixer%i%i", card->number, 0);
|
|
||||||
if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER,
|
if ((err = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIXER,
|
||||||
card, 0,
|
card, 0,
|
||||||
&snd_mixer_oss_f_ops, card,
|
&snd_mixer_oss_f_ops, card)) < 0) {
|
||||||
name)) < 0) {
|
dev_err(card->dev,
|
||||||
snd_printk(KERN_ERR "unable to register OSS mixer device %i:%i\n",
|
"unable to register OSS mixer device %i:%i\n",
|
||||||
card->number, 0);
|
card->number, 0);
|
||||||
kfree(mixer);
|
kfree(mixer);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1365,7 +1364,8 @@ static int snd_mixer_oss_notify_handler(struct snd_card *card, int cmd)
|
||||||
if (*card->mixername)
|
if (*card->mixername)
|
||||||
strlcpy(mixer->name, card->mixername, sizeof(mixer->name));
|
strlcpy(mixer->name, card->mixername, sizeof(mixer->name));
|
||||||
else
|
else
|
||||||
strlcpy(mixer->name, name, sizeof(mixer->name));
|
snprintf(mixer->name, sizeof(mixer->name),
|
||||||
|
"mixer%i", card->number);
|
||||||
#ifdef SNDRV_OSS_INFO_DEV_MIXERS
|
#ifdef SNDRV_OSS_INFO_DEV_MIXERS
|
||||||
snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIXERS,
|
snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIXERS,
|
||||||
card->number,
|
card->number,
|
||||||
|
|
|
@ -854,7 +854,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
||||||
params = kmalloc(sizeof(*params), GFP_KERNEL);
|
params = kmalloc(sizeof(*params), GFP_KERNEL);
|
||||||
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
|
sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
|
||||||
if (!sw_params || !params || !sparams) {
|
if (!sw_params || !params || !sparams) {
|
||||||
snd_printd("No memory\n");
|
pcm_dbg(substream->pcm, "No memory\n");
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto failure;
|
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);
|
err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_printd("No usable accesses\n");
|
pcm_dbg(substream->pcm, "No usable accesses\n");
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
@ -902,7 +902,7 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((__force int)sformat > (__force int)SNDRV_PCM_FORMAT_LAST) {
|
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;
|
err = -EINVAL;
|
||||||
goto failure;
|
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,
|
if ((err = snd_pcm_plug_format_plugins(substream,
|
||||||
params,
|
params,
|
||||||
sparams)) < 0) {
|
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);
|
snd_pcm_oss_plugin_clear(substream);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
if (runtime->oss.plugin_first) {
|
if (runtime->oss.plugin_first) {
|
||||||
struct snd_pcm_plugin *plugin;
|
struct snd_pcm_plugin *plugin;
|
||||||
if ((err = snd_pcm_plugin_build_io(substream, sparams, &plugin)) < 0) {
|
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);
|
snd_pcm_oss_plugin_clear(substream);
|
||||||
goto failure;
|
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);
|
snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
|
||||||
|
|
||||||
if ((err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_HW_PARAMS, sparams)) < 0) {
|
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;
|
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) {
|
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;
|
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);
|
err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL);
|
||||||
if (err < 0) {
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
runtime->oss.prepare = 0;
|
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 ||
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
pcm_dbg(substream->pcm,
|
||||||
printk(KERN_DEBUG "pcm_oss: write: "
|
"pcm_oss: write: recovering from %s\n",
|
||||||
"recovering from XRUN\n");
|
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||||
else
|
"XRUN" : "SUSPEND");
|
||||||
printk(KERN_DEBUG "pcm_oss: write: "
|
|
||||||
"recovering from SUSPEND\n");
|
|
||||||
#endif
|
#endif
|
||||||
ret = snd_pcm_oss_prepare(substream);
|
ret = snd_pcm_oss_prepare(substream);
|
||||||
if (ret < 0)
|
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 ||
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
pcm_dbg(substream->pcm,
|
||||||
printk(KERN_DEBUG "pcm_oss: read: "
|
"pcm_oss: read: recovering from %s\n",
|
||||||
"recovering from XRUN\n");
|
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||||
else
|
"XRUN" : "SUSPEND");
|
||||||
printk(KERN_DEBUG "pcm_oss: read: "
|
|
||||||
"recovering from SUSPEND\n");
|
|
||||||
#endif
|
#endif
|
||||||
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
||||||
if (ret < 0)
|
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 ||
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
pcm_dbg(substream->pcm,
|
||||||
printk(KERN_DEBUG "pcm_oss: writev: "
|
"pcm_oss: writev: recovering from %s\n",
|
||||||
"recovering from XRUN\n");
|
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||||
else
|
"XRUN" : "SUSPEND");
|
||||||
printk(KERN_DEBUG "pcm_oss: writev: "
|
|
||||||
"recovering from SUSPEND\n");
|
|
||||||
#endif
|
#endif
|
||||||
ret = snd_pcm_oss_prepare(substream);
|
ret = snd_pcm_oss_prepare(substream);
|
||||||
if (ret < 0)
|
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 ||
|
if (runtime->status->state == SNDRV_PCM_STATE_XRUN ||
|
||||||
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
if (runtime->status->state == SNDRV_PCM_STATE_XRUN)
|
pcm_dbg(substream->pcm,
|
||||||
printk(KERN_DEBUG "pcm_oss: readv: "
|
"pcm_oss: readv: recovering from %s\n",
|
||||||
"recovering from XRUN\n");
|
runtime->status->state == SNDRV_PCM_STATE_XRUN ?
|
||||||
else
|
"XRUN" : "SUSPEND");
|
||||||
printk(KERN_DEBUG "pcm_oss: readv: "
|
|
||||||
"recovering from SUSPEND\n");
|
|
||||||
#endif
|
#endif
|
||||||
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
|
||||||
if (ret < 0)
|
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);
|
init_waitqueue_entry(&wait, current);
|
||||||
add_wait_queue(&runtime->sleep, &wait);
|
add_wait_queue(&runtime->sleep, &wait);
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
printk(KERN_DEBUG "sync1: size = %li\n", size);
|
pcm_dbg(substream->pcm, "sync1: size = %li\n", size);
|
||||||
#endif
|
#endif
|
||||||
while (1) {
|
while (1) {
|
||||||
result = snd_pcm_oss_write2(substream, runtime->oss.buffer, size, 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;
|
break;
|
||||||
}
|
}
|
||||||
if (res == 0) {
|
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;
|
result = -EIO;
|
||||||
break;
|
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);
|
mutex_lock(&runtime->oss.params_lock);
|
||||||
if (runtime->oss.buffer_used > 0) {
|
if (runtime->oss.buffer_used > 0) {
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
printk(KERN_DEBUG "sync: buffer_used\n");
|
pcm_dbg(substream->pcm, "sync: buffer_used\n");
|
||||||
#endif
|
#endif
|
||||||
size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width;
|
size = (8 * (runtime->oss.period_bytes - runtime->oss.buffer_used) + 7) / width;
|
||||||
snd_pcm_format_set_silence(format,
|
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) {
|
} else if (runtime->oss.period_ptr > 0) {
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
printk(KERN_DEBUG "sync: period_ptr\n");
|
pcm_dbg(substream->pcm, "sync: period_ptr\n");
|
||||||
#endif
|
#endif
|
||||||
size = runtime->oss.period_bytes - runtime->oss.period_ptr;
|
size = runtime->oss.period_bytes - runtime->oss.period_ptr;
|
||||||
snd_pcm_format_set_silence(format,
|
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;
|
int err, cmd;
|
||||||
|
|
||||||
#ifdef OSS_DEBUG
|
#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
|
#endif
|
||||||
|
|
||||||
psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK];
|
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
|
#ifdef OSS_DEBUG
|
||||||
printk(KERN_DEBUG "pcm_oss: space: bytes = %i, fragments = %i, "
|
pcm_dbg(substream->pcm,
|
||||||
"fragstotal = %i, fragsize = %i\n",
|
"pcm_oss: space: bytes = %i, fragments = %i, fragstotal = %i, fragsize = %i\n",
|
||||||
info.bytes, info.fragments, info.fragstotal, info.fragsize);
|
info.bytes, info.fragments, info.fragstotal, info.fragsize);
|
||||||
#endif
|
#endif
|
||||||
if (copy_to_user(_info, &info, sizeof(info)))
|
if (copy_to_user(_info, &info, sizeof(info)))
|
||||||
return -EFAULT;
|
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)
|
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
|
// 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;
|
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')
|
if (((cmd >> 8) & 0xff) != 'P')
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
printk(KERN_DEBUG "pcm_oss: ioctl = 0x%x\n", cmd);
|
pr_debug("pcm_oss: ioctl = 0x%x\n", cmd);
|
||||||
#endif
|
#endif
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SNDCTL_DSP_RESET:
|
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:
|
case SNDCTL_DSP_PROFILE:
|
||||||
return 0; /* silently ignore */
|
return 0; /* silently ignore */
|
||||||
default:
|
default:
|
||||||
snd_printd("pcm_oss: unknown command = 0x%x\n", cmd);
|
pr_debug("pcm_oss: unknown command = 0x%x\n", cmd);
|
||||||
}
|
}
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -2673,8 +2669,9 @@ static ssize_t snd_pcm_oss_read(struct file *file, char __user *buf, size_t coun
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
ssize_t res = snd_pcm_oss_read1(substream, buf, count);
|
ssize_t res = snd_pcm_oss_read1(substream, buf, count);
|
||||||
printk(KERN_DEBUG "pcm_oss: read %li bytes "
|
pcm_dbg(substream->pcm,
|
||||||
"(returned %li bytes)\n", (long)count, (long)res);
|
"pcm_oss: read %li bytes (returned %li bytes)\n",
|
||||||
|
(long)count, (long)res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
substream->f_flags = file->f_flags & O_NONBLOCK;
|
||||||
result = snd_pcm_oss_write1(substream, buf, count);
|
result = snd_pcm_oss_write1(substream, buf, count);
|
||||||
#ifdef OSS_DEBUG
|
#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);
|
(long)count, (long)result);
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
|
@ -2772,7 +2769,7 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
#ifdef OSS_DEBUG
|
#ifdef OSS_DEBUG
|
||||||
printk(KERN_DEBUG "pcm_oss: mmap begin\n");
|
pr_debug("pcm_oss: mmap begin\n");
|
||||||
#endif
|
#endif
|
||||||
pcm_oss_file = file->private_data;
|
pcm_oss_file = file->private_data;
|
||||||
switch ((area->vm_flags & (VM_READ | VM_WRITE))) {
|
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_threshold = 0;
|
||||||
runtime->silence_size = 0;
|
runtime->silence_size = 0;
|
||||||
#ifdef OSS_DEBUG
|
#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);
|
runtime->oss.mmap_bytes);
|
||||||
#endif
|
#endif
|
||||||
/* In mmap mode we never stop */
|
/* 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)
|
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,
|
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_PCM,
|
||||||
pcm->card, index, &snd_pcm_oss_f_reg,
|
pcm->card, index, &snd_pcm_oss_f_reg,
|
||||||
pcm, name) < 0) {
|
pcm) < 0) {
|
||||||
snd_printk(KERN_ERR "unable to register OSS PCM device %i:%i\n",
|
pcm_err(pcm, "unable to register OSS PCM device %i:%i\n",
|
||||||
pcm->card->number, pcm->device);
|
pcm->card->number, pcm->device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3093,12 +3088,12 @@ static int __init alsa_pcm_oss_init(void)
|
||||||
/* check device map table */
|
/* check device map table */
|
||||||
for (i = 0; i < SNDRV_CARDS; i++) {
|
for (i = 0; i < SNDRV_CARDS; i++) {
|
||||||
if (dsp_map[i] < 0 || dsp_map[i] >= SNDRV_PCM_DEVICES) {
|
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]);
|
i, dsp_map[i]);
|
||||||
dsp_map[i] = 0;
|
dsp_map[i] = 0;
|
||||||
}
|
}
|
||||||
if (adsp_map[i] < 0 || adsp_map[i] >= SNDRV_PCM_DEVICES) {
|
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]);
|
i, adsp_map[i]);
|
||||||
adsp_map[i] = 1;
|
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];
|
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>
|
#include <linux/soundcard.h>
|
||||||
|
|
||||||
static const char *snd_pcm_oss_format_name(int format)
|
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);
|
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
||||||
if (! info) {
|
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;
|
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, "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, "period_size: %lu\n", runtime->period_size);
|
||||||
snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_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) {
|
if (substream->oss.oss) {
|
||||||
snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format));
|
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);
|
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_str *pstr = &pcm->streams[stream];
|
||||||
struct snd_pcm_substream *substream, *prev;
|
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);
|
mutex_init(&pstr->oss.setup_mutex);
|
||||||
#endif
|
#endif
|
||||||
pstr->stream = stream;
|
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) {
|
if (substream_count > 0 && !pcm->internal) {
|
||||||
err = snd_pcm_stream_proc_init(pstr);
|
err = snd_pcm_stream_proc_init(pstr);
|
||||||
if (err < 0) {
|
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;
|
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++) {
|
for (idx = 0, prev = NULL; idx < substream_count; idx++) {
|
||||||
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
||||||
if (substream == NULL) {
|
if (substream == NULL) {
|
||||||
snd_printk(KERN_ERR "Cannot allocate PCM substream\n");
|
pcm_err(pcm, "Cannot allocate PCM substream\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
substream->pcm = pcm;
|
substream->pcm = pcm;
|
||||||
|
@ -685,7 +686,8 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
|
||||||
if (!pcm->internal) {
|
if (!pcm->internal) {
|
||||||
err = snd_pcm_substream_proc_init(substream);
|
err = snd_pcm_substream_proc_init(substream);
|
||||||
if (err < 0) {
|
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)
|
if (prev == NULL)
|
||||||
pstr->substream = NULL;
|
pstr->substream = NULL;
|
||||||
else
|
else
|
||||||
|
@ -724,7 +726,7 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
|
||||||
*rpcm = NULL;
|
*rpcm = NULL;
|
||||||
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
|
pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
|
||||||
if (pcm == NULL) {
|
if (pcm == NULL) {
|
||||||
snd_printk(KERN_ERR "Cannot allocate PCM\n");
|
dev_err(card->dev, "Cannot allocate PCM\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
pcm->card = card;
|
pcm->card = card;
|
||||||
|
@ -807,7 +809,7 @@ EXPORT_SYMBOL(snd_pcm_new_internal);
|
||||||
static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
|
static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
|
||||||
{
|
{
|
||||||
struct snd_pcm_substream *substream, *substream_next;
|
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;
|
struct snd_pcm_oss_setup *setup, *setupn;
|
||||||
#endif
|
#endif
|
||||||
substream = pstr->substream;
|
substream = pstr->substream;
|
||||||
|
@ -819,7 +821,7 @@ static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
|
||||||
substream = substream_next;
|
substream = substream_next;
|
||||||
}
|
}
|
||||||
snd_pcm_stream_proc_done(pstr);
|
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) {
|
for (setup = pstr->oss.setup_list; setup; setup = setupn) {
|
||||||
setupn = setup->next;
|
setupn = setup->next;
|
||||||
kfree(setup->task_name);
|
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);
|
return snprintf(buf, PAGE_SIZE, "%s\n", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct device_attribute pcm_attrs =
|
static DEVICE_ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL);
|
||||||
__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)
|
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);
|
mutex_unlock(®ister_mutex);
|
||||||
return err;
|
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)
|
for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
|
||||||
snd_pcm_timer_init(substream);
|
snd_pcm_timer_init(substream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ static void xrun(struct snd_pcm_substream *substream)
|
||||||
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) {
|
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) {
|
||||||
char name[16];
|
char name[16];
|
||||||
snd_pcm_debug_name(substream, name, sizeof(name));
|
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);
|
dump_stack_on_xrun(substream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,9 +184,7 @@ static void xrun(struct snd_pcm_substream *substream)
|
||||||
do { \
|
do { \
|
||||||
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \
|
if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \
|
||||||
xrun_log_show(substream); \
|
xrun_log_show(substream); \
|
||||||
if (snd_printd_ratelimit()) { \
|
pr_err_ratelimited("ALSA: PCM: " fmt, ##args); \
|
||||||
snd_printd("PCM: " fmt, ##args); \
|
|
||||||
} \
|
|
||||||
dump_stack_on_xrun(substream); \
|
dump_stack_on_xrun(substream); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -253,7 +251,7 @@ static void xrun_log_show(struct snd_pcm_substream *substream)
|
||||||
entry = &log->entries[idx];
|
entry = &log->entries[idx];
|
||||||
if (entry->period_size == 0)
|
if (entry->period_size == 0)
|
||||||
break;
|
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",
|
"hwptr=%ld/%ld\n",
|
||||||
name, entry->in_interrupt ? "[Q] " : "",
|
name, entry->in_interrupt ? "[Q] " : "",
|
||||||
entry->jiffies,
|
entry->jiffies,
|
||||||
|
@ -342,14 +340,14 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
}
|
}
|
||||||
if (pos >= runtime->buffer_size) {
|
if (pos >= runtime->buffer_size) {
|
||||||
if (snd_printd_ratelimit()) {
|
if (printk_ratelimit()) {
|
||||||
char name[16];
|
char name[16];
|
||||||
snd_pcm_debug_name(substream, name, sizeof(name));
|
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||||
xrun_log_show(substream);
|
xrun_log_show(substream);
|
||||||
snd_printd(KERN_ERR "BUG: %s, pos = %ld, "
|
pcm_err(substream->pcm,
|
||||||
"buffer size = %ld, period size = %ld\n",
|
"BUG: %s, pos = %ld, buffer size = %ld, period size = %ld\n",
|
||||||
name, pos, runtime->buffer_size,
|
name, pos, runtime->buffer_size,
|
||||||
runtime->period_size);
|
runtime->period_size);
|
||||||
}
|
}
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
@ -394,8 +392,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
|
||||||
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
|
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
|
||||||
char name[16];
|
char name[16];
|
||||||
snd_pcm_debug_name(substream, name, sizeof(name));
|
snd_pcm_debug_name(substream, name, sizeof(name));
|
||||||
snd_printd("%s_update: %s: pos=%u/%u/%u, "
|
pcm_dbg(substream->pcm,
|
||||||
"hwptr=%ld/%ld/%ld/%ld\n",
|
"%s_update: %s: pos=%u/%u/%u, hwptr=%ld/%ld/%ld/%ld\n",
|
||||||
in_interrupt ? "period" : "hwptr",
|
in_interrupt ? "period" : "hwptr",
|
||||||
name,
|
name,
|
||||||
(unsigned int)pos,
|
(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 -EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_pcm_hw_constraint_mask64);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_pcm_hw_constraint_integer - apply an integer constraint to an interval
|
* 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;
|
continue;
|
||||||
}
|
}
|
||||||
if (!tout) {
|
if (!tout) {
|
||||||
snd_printd("%s write error (DMA or IRQ trouble?)\n",
|
pcm_dbg(substream->pcm,
|
||||||
is_playback ? "playback" : "capture");
|
"%s write error (DMA or IRQ trouble?)\n",
|
||||||
|
is_playback ? "playback" : "capture");
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,12 +190,12 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
||||||
if (!(params->rmask & (1 << k)))
|
if (!(params->rmask & (1 << k)))
|
||||||
continue;
|
continue;
|
||||||
#ifdef RULES_DEBUG
|
#ifdef RULES_DEBUG
|
||||||
printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]);
|
pr_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_cont("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]);
|
||||||
#endif
|
#endif
|
||||||
changed = snd_mask_refine(m, constrs_mask(constrs, k));
|
changed = snd_mask_refine(m, constrs_mask(constrs, k));
|
||||||
#ifdef RULES_DEBUG
|
#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
|
#endif
|
||||||
if (changed)
|
if (changed)
|
||||||
params->cmask |= 1 << k;
|
params->cmask |= 1 << k;
|
||||||
|
@ -210,21 +210,21 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
||||||
if (!(params->rmask & (1 << k)))
|
if (!(params->rmask & (1 << k)))
|
||||||
continue;
|
continue;
|
||||||
#ifdef RULES_DEBUG
|
#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)
|
if (i->empty)
|
||||||
printk("empty");
|
pr_cont("empty");
|
||||||
else
|
else
|
||||||
printk("%c%u %u%c",
|
pr_cont("%c%u %u%c",
|
||||||
i->openmin ? '(' : '[', i->min,
|
i->openmin ? '(' : '[', i->min,
|
||||||
i->max, i->openmax ? ')' : ']');
|
i->max, i->openmax ? ')' : ']');
|
||||||
printk(" -> ");
|
pr_cont(" -> ");
|
||||||
#endif
|
#endif
|
||||||
changed = snd_interval_refine(i, constrs_interval(constrs, k));
|
changed = snd_interval_refine(i, constrs_interval(constrs, k));
|
||||||
#ifdef RULES_DEBUG
|
#ifdef RULES_DEBUG
|
||||||
if (i->empty)
|
if (i->empty)
|
||||||
printk("empty\n");
|
pr_cont("empty\n");
|
||||||
else
|
else
|
||||||
printk("%c%u %u%c\n",
|
pr_cont("%c%u %u%c\n",
|
||||||
i->openmin ? '(' : '[', i->min,
|
i->openmin ? '(' : '[', i->min,
|
||||||
i->max, i->openmax ? ')' : ']');
|
i->max, i->openmax ? ')' : ']');
|
||||||
#endif
|
#endif
|
||||||
|
@ -255,18 +255,18 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
||||||
if (!doit)
|
if (!doit)
|
||||||
continue;
|
continue;
|
||||||
#ifdef RULES_DEBUG
|
#ifdef RULES_DEBUG
|
||||||
printk(KERN_DEBUG "Rule %d [%p]: ", k, r->func);
|
pr_debug("Rule %d [%p]: ", k, r->func);
|
||||||
if (r->var >= 0) {
|
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)) {
|
if (hw_is_mask(r->var)) {
|
||||||
m = hw_param_mask(params, r->var);
|
m = hw_param_mask(params, r->var);
|
||||||
printk("%x", *m->bits);
|
pr_cont("%x", *m->bits);
|
||||||
} else {
|
} else {
|
||||||
i = hw_param_interval(params, r->var);
|
i = hw_param_interval(params, r->var);
|
||||||
if (i->empty)
|
if (i->empty)
|
||||||
printk("empty");
|
pr_cont("empty");
|
||||||
else
|
else
|
||||||
printk("%c%u %u%c",
|
pr_cont("%c%u %u%c",
|
||||||
i->openmin ? '(' : '[', i->min,
|
i->openmin ? '(' : '[', i->min,
|
||||||
i->max, i->openmax ? ')' : ']');
|
i->max, i->openmax ? ')' : ']');
|
||||||
}
|
}
|
||||||
|
@ -275,19 +275,19 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
|
||||||
changed = r->func(params, r);
|
changed = r->func(params, r);
|
||||||
#ifdef RULES_DEBUG
|
#ifdef RULES_DEBUG
|
||||||
if (r->var >= 0) {
|
if (r->var >= 0) {
|
||||||
printk(" -> ");
|
pr_cont(" -> ");
|
||||||
if (hw_is_mask(r->var))
|
if (hw_is_mask(r->var))
|
||||||
printk("%x", *m->bits);
|
pr_cont("%x", *m->bits);
|
||||||
else {
|
else {
|
||||||
if (i->empty)
|
if (i->empty)
|
||||||
printk("empty");
|
pr_cont("empty");
|
||||||
else
|
else
|
||||||
printk("%c%u %u%c",
|
pr_cont("%c%u %u%c",
|
||||||
i->openmin ? '(' : '[', i->min,
|
i->openmin ? '(' : '[', i->min,
|
||||||
i->max, i->openmax ? ')' : ']');
|
i->max, i->openmax ? ')' : ']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printk("\n");
|
pr_cont("\n");
|
||||||
#endif
|
#endif
|
||||||
rstamps[k] = stamp;
|
rstamps[k] = stamp;
|
||||||
if (changed && r->var >= 0) {
|
if (changed && r->var >= 0) {
|
||||||
|
@ -399,7 +399,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
}
|
}
|
||||||
snd_pcm_stream_unlock_irq(substream);
|
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)
|
if (!substream->oss.oss)
|
||||||
#endif
|
#endif
|
||||||
if (atomic_read(&substream->mmap_count))
|
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.
|
* 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)
|
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)
|
if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
|
||||||
result = -ESTRPIPE;
|
result = -ESTRPIPE;
|
||||||
else {
|
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);
|
snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
}
|
}
|
||||||
|
@ -2066,7 +2067,7 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,
|
||||||
|
|
||||||
err = snd_pcm_hw_constraints_init(substream);
|
err = snd_pcm_hw_constraints_init(substream);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_printd("snd_pcm_hw_constraints_init failed\n");
|
pcm_dbg(pcm, "snd_pcm_hw_constraints_init failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2077,7 +2078,7 @@ int snd_pcm_open_substream(struct snd_pcm *pcm, int stream,
|
||||||
|
|
||||||
err = snd_pcm_hw_constraints_complete(substream);
|
err = snd_pcm_hw_constraints_complete(substream);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_printd("snd_pcm_hw_constraints_complete failed\n");
|
pcm_dbg(pcm, "snd_pcm_hw_constraints_complete failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2609,7 +2610,7 @@ static int snd_pcm_common_ioctl1(struct file *file,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snd_printd("unknown ioctl = 0x%x\n", cmd);
|
pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd);
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,9 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream)
|
||||||
post *= 2;
|
post *= 2;
|
||||||
}
|
}
|
||||||
if (rate == 0) {
|
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;
|
runtime->timer_resolution = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,13 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device);
|
||||||
static LIST_HEAD(snd_rawmidi_devices);
|
static LIST_HEAD(snd_rawmidi_devices);
|
||||||
static DEFINE_MUTEX(register_mutex);
|
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)
|
static struct snd_rawmidi *snd_rawmidi_search(struct snd_card *card, int device)
|
||||||
{
|
{
|
||||||
struct snd_rawmidi *rawmidi;
|
struct snd_rawmidi *rawmidi;
|
||||||
|
@ -165,6 +172,7 @@ int snd_rawmidi_drop_output(struct snd_rawmidi_substream *substream)
|
||||||
spin_unlock_irqrestore(&runtime->lock, flags);
|
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_drop_output);
|
||||||
|
|
||||||
int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
|
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))
|
if (signal_pending(current))
|
||||||
err = -ERESTARTSYS;
|
err = -ERESTARTSYS;
|
||||||
if (runtime->avail < runtime->buffer_size && !timeout) {
|
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;
|
err = -EIO;
|
||||||
}
|
}
|
||||||
runtime->drain = 0;
|
runtime->drain = 0;
|
||||||
|
@ -194,6 +204,7 @@ int snd_rawmidi_drain_output(struct snd_rawmidi_substream *substream)
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_drain_output);
|
||||||
|
|
||||||
int snd_rawmidi_drain_input(struct snd_rawmidi_substream *substream)
|
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);
|
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_drain_input);
|
||||||
|
|
||||||
/* look for an available substream for the given stream direction;
|
/* look for an available substream for the given stream direction;
|
||||||
* if a specific subdevice is given, try to assign it
|
* 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);
|
module_put(rmidi->card->module);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_kernel_open);
|
||||||
|
|
||||||
static int snd_rawmidi_open(struct inode *inode, struct file *file)
|
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);
|
module_put(rmidi->card->module);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_kernel_release);
|
||||||
|
|
||||||
static int snd_rawmidi_release(struct inode *inode, struct file *file)
|
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;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_info_select);
|
||||||
|
|
||||||
static int snd_rawmidi_info_select_user(struct snd_card *card,
|
static int snd_rawmidi_info_select_user(struct snd_card *card,
|
||||||
struct snd_rawmidi_info __user *_info)
|
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;
|
substream->active_sensing = !params->no_active_sensing;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_output_params);
|
||||||
|
|
||||||
int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
|
int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
|
||||||
struct snd_rawmidi_params * params)
|
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;
|
runtime->avail_min = params->avail_min;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_input_params);
|
||||||
|
|
||||||
static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream,
|
static int snd_rawmidi_output_status(struct snd_rawmidi_substream *substream,
|
||||||
struct snd_rawmidi_status * status)
|
struct snd_rawmidi_status * status)
|
||||||
|
@ -802,10 +819,9 @@ static long snd_rawmidi_ioctl(struct file *file, unsigned int cmd, unsigned long
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_SND_DEBUG
|
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING "rawmidi: unknown command = 0x%x\n", cmd);
|
rmidi_dbg(rfile->rmidi,
|
||||||
#endif
|
"rawmidi: unknown command = 0x%x\n", cmd);
|
||||||
}
|
}
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
@ -875,7 +891,8 @@ int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
|
||||||
if (!substream->opened)
|
if (!substream->opened)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
if (runtime->buffer == NULL) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&runtime->lock, flags);
|
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);
|
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_receive);
|
||||||
|
|
||||||
static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
|
static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream,
|
||||||
unsigned char __user *userbuf,
|
unsigned char __user *userbuf,
|
||||||
|
@ -968,6 +986,7 @@ long snd_rawmidi_kernel_read(struct snd_rawmidi_substream *substream,
|
||||||
snd_rawmidi_input_trigger(substream, 1);
|
snd_rawmidi_input_trigger(substream, 1);
|
||||||
return snd_rawmidi_kernel_read1(substream, NULL/*userbuf*/, buf, count);
|
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,
|
static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t count,
|
||||||
loff_t *offset)
|
loff_t *offset)
|
||||||
|
@ -1034,7 +1053,8 @@ int snd_rawmidi_transmit_empty(struct snd_rawmidi_substream *substream)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
if (runtime->buffer == NULL) {
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&runtime->lock, flags);
|
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);
|
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_transmit_empty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_rawmidi_transmit_peek - copy data from the internal buffer
|
* 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;
|
struct snd_rawmidi_runtime *runtime = substream->runtime;
|
||||||
|
|
||||||
if (runtime->buffer == NULL) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -1097,11 +1119,12 @@ int snd_rawmidi_transmit_peek(struct snd_rawmidi_substream *substream,
|
||||||
spin_unlock_irqrestore(&runtime->lock, flags);
|
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_transmit_peek);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_rawmidi_transmit_ack - acknowledge the transmission
|
* snd_rawmidi_transmit_ack - acknowledge the transmission
|
||||||
* @substream: the rawmidi substream
|
* @substream: the rawmidi substream
|
||||||
* @count: the tranferred count
|
* @count: the transferred count
|
||||||
*
|
*
|
||||||
* Advances the hardware pointer for the internal output buffer with
|
* Advances the hardware pointer for the internal output buffer with
|
||||||
* the given size and updates the condition.
|
* 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;
|
struct snd_rawmidi_runtime *runtime = substream->runtime;
|
||||||
|
|
||||||
if (runtime->buffer == NULL) {
|
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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
spin_lock_irqsave(&runtime->lock, flags);
|
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);
|
spin_unlock_irqrestore(&runtime->lock, flags);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_transmit_ack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* snd_rawmidi_transmit - copy from the buffer to the device
|
* 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 count;
|
||||||
return snd_rawmidi_transmit_ack(substream, count);
|
return snd_rawmidi_transmit_ack(substream, count);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_transmit);
|
||||||
|
|
||||||
static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
|
static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
|
||||||
const unsigned char __user *userbuf,
|
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);
|
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,
|
static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf,
|
||||||
size_t count, loff_t *offset)
|
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++) {
|
for (idx = 0; idx < count; idx++) {
|
||||||
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
substream = kzalloc(sizeof(*substream), GFP_KERNEL);
|
||||||
if (substream == NULL) {
|
if (substream == NULL) {
|
||||||
snd_printk(KERN_ERR "rawmidi: cannot allocate substream\n");
|
rmidi_err(rmidi, "rawmidi: cannot allocate substream\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
substream->stream = direction;
|
substream->stream = direction;
|
||||||
|
@ -1458,7 +1485,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
|
||||||
*rrawmidi = NULL;
|
*rrawmidi = NULL;
|
||||||
rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
|
rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
|
||||||
if (rmidi == NULL) {
|
if (rmidi == NULL) {
|
||||||
snd_printk(KERN_ERR "rawmidi: cannot allocate\n");
|
dev_err(card->dev, "rawmidi: cannot allocate\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
rmidi->card = card;
|
rmidi->card = card;
|
||||||
|
@ -1492,6 +1519,7 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
|
||||||
*rrawmidi = rmidi;
|
*rrawmidi = rmidi;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_new);
|
||||||
|
|
||||||
static void snd_rawmidi_free_substreams(struct snd_rawmidi_str *stream)
|
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,
|
if ((err = snd_register_device(SNDRV_DEVICE_TYPE_RAWMIDI,
|
||||||
rmidi->card, rmidi->device,
|
rmidi->card, rmidi->device,
|
||||||
&snd_rawmidi_f_ops, rmidi, name)) < 0) {
|
&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);
|
list_del(&rmidi->list);
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
return err;
|
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 ((int)rmidi->device == midi_map[rmidi->card->number]) {
|
||||||
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
|
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
|
||||||
rmidi->card, 0, &snd_rawmidi_f_ops,
|
rmidi->card, 0, &snd_rawmidi_f_ops,
|
||||||
rmidi, name) < 0) {
|
rmidi) < 0) {
|
||||||
snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
|
rmidi_err(rmidi,
|
||||||
|
"unable to register OSS rawmidi device %i:%i\n",
|
||||||
|
rmidi->card->number, 0);
|
||||||
} else {
|
} else {
|
||||||
rmidi->ossreg++;
|
rmidi->ossreg++;
|
||||||
#ifdef SNDRV_OSS_INFO_DEV_MIDI
|
#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 ((int)rmidi->device == amidi_map[rmidi->card->number]) {
|
||||||
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
|
if (snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI,
|
||||||
rmidi->card, 1, &snd_rawmidi_f_ops,
|
rmidi->card, 1, &snd_rawmidi_f_ops,
|
||||||
rmidi, name) < 0) {
|
rmidi) < 0) {
|
||||||
snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
|
rmidi_err(rmidi,
|
||||||
|
"unable to register OSS rawmidi device %i:%i\n",
|
||||||
|
rmidi->card->number, 1);
|
||||||
} else {
|
} else {
|
||||||
rmidi->ossreg++;
|
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)
|
list_for_each_entry(substream, &rmidi->streams[stream].substreams, list)
|
||||||
substream->ops = ops;
|
substream->ops = ops;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL(snd_rawmidi_set_ops);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ENTRY functions
|
* ENTRY functions
|
||||||
|
@ -1685,11 +1719,13 @@ static int __init alsa_rawmidi_init(void)
|
||||||
/* check device map table */
|
/* check device map table */
|
||||||
for (i = 0; i < SNDRV_CARDS; i++) {
|
for (i = 0; i < SNDRV_CARDS; i++) {
|
||||||
if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
|
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;
|
midi_map[i] = 0;
|
||||||
}
|
}
|
||||||
if (amidi_map[i] < 0 || amidi_map[i] >= SNDRV_RAWMIDI_DEVICES) {
|
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;
|
amidi_map[i] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1706,21 +1742,3 @@ static void __exit alsa_rawmidi_exit(void)
|
||||||
|
|
||||||
module_init(alsa_rawmidi_init)
|
module_init(alsa_rawmidi_init)
|
||||||
module_exit(alsa_rawmidi_exit)
|
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/core.h>
|
||||||
#include <sound/timer.h>
|
#include <sound/timer.h>
|
||||||
|
|
||||||
#if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE)
|
#if IS_ENABLED(CONFIG_RTC)
|
||||||
|
|
||||||
#include <linux/mc146818rtc.h>
|
#include <linux/mc146818rtc.h>
|
||||||
|
|
||||||
|
@ -132,8 +132,7 @@ static int __init rtctimer_init(void)
|
||||||
|
|
||||||
if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
|
if (rtctimer_freq < 2 || rtctimer_freq > 8192 ||
|
||||||
!is_power_of_2(rtctimer_freq)) {
|
!is_power_of_2(rtctimer_freq)) {
|
||||||
snd_printk(KERN_ERR "rtctimer: invalid frequency %d\n",
|
pr_err("ALSA: rtctimer: invalid frequency %d\n", rtctimer_freq);
|
||||||
rtctimer_freq);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,4 +184,4 @@ MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
MODULE_ALIAS("snd-timer-" __stringify(SNDRV_TIMER_GLOBAL_RTC));
|
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_SEQUENCER);
|
||||||
MODULE_ALIAS_SNDRV_MINOR(SNDRV_MINOR_OSS_MUSIC);
|
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
|
* prototypes
|
||||||
|
@ -231,22 +225,19 @@ register_device(void)
|
||||||
mutex_lock(®ister_mutex);
|
mutex_lock(®ister_mutex);
|
||||||
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,
|
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
&seq_oss_f_ops, NULL,
|
&seq_oss_f_ops, NULL)) < 0) {
|
||||||
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
|
pr_err("ALSA: seq_oss: can't register device seq\n");
|
||||||
snd_printk(KERN_ERR "can't register device seq\n");
|
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,
|
if ((rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,
|
||||||
NULL, 0,
|
NULL, 0,
|
||||||
&seq_oss_f_ops, NULL,
|
&seq_oss_f_ops, NULL)) < 0) {
|
||||||
SNDRV_SEQ_OSS_DEVNAME)) < 0) {
|
pr_err("ALSA: seq_oss: can't register device music\n");
|
||||||
snd_printk(KERN_ERR "can't register device music\n");
|
|
||||||
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);
|
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
debug_printk(("device registered\n"));
|
|
||||||
mutex_unlock(®ister_mutex);
|
mutex_unlock(®ister_mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -255,11 +246,10 @@ static void
|
||||||
unregister_device(void)
|
unregister_device(void)
|
||||||
{
|
{
|
||||||
mutex_lock(®ister_mutex);
|
mutex_lock(®ister_mutex);
|
||||||
debug_printk(("device unregistered\n"));
|
|
||||||
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0)
|
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)
|
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);
|
mutex_unlock(®ister_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
#include <sound/seq_kernel.h>
|
#include <sound/seq_kernel.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
|
|
||||||
/* enable debug print */
|
|
||||||
#define SNDRV_SEQ_OSS_DEBUG
|
|
||||||
|
|
||||||
/* max. applications */
|
/* max. applications */
|
||||||
#define SNDRV_SEQ_OSS_MAX_CLIENTS 16
|
#define SNDRV_SEQ_OSS_MAX_CLIENTS 16
|
||||||
#define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16
|
#define SNDRV_SEQ_OSS_MAX_SYNTH_DEVS 16
|
||||||
|
@ -46,7 +43,6 @@
|
||||||
#define SNDRV_SEQ_OSS_VERSION_STR "0.1.8"
|
#define SNDRV_SEQ_OSS_VERSION_STR "0.1.8"
|
||||||
|
|
||||||
/* device and proc interface name */
|
/* device and proc interface name */
|
||||||
#define SNDRV_SEQ_OSS_DEVNAME "seq_oss"
|
|
||||||
#define SNDRV_SEQ_OSS_PROCNAME "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 */
|
/* misc. functions for proc interface */
|
||||||
char *enabled_str(int bool);
|
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 */
|
#endif /* __SEQ_OSS_DEVICE_H */
|
||||||
|
|
|
@ -92,7 +92,6 @@ snd_seq_oss_create_client(void)
|
||||||
goto __error;
|
goto __error;
|
||||||
|
|
||||||
system_client = rc;
|
system_client = rc;
|
||||||
debug_printk(("new client = %d\n", rc));
|
|
||||||
|
|
||||||
/* create annoucement receiver port */
|
/* create annoucement receiver port */
|
||||||
memset(port, 0, sizeof(*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);
|
dp = kzalloc(sizeof(*dp), GFP_KERNEL);
|
||||||
if (!dp) {
|
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;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
debug_printk(("oss_open: dp = %p\n", dp));
|
|
||||||
|
|
||||||
dp->cseq = system_client;
|
dp->cseq = system_client;
|
||||||
dp->port = -1;
|
dp->port = -1;
|
||||||
|
@ -206,7 +204,7 @@ snd_seq_oss_open(struct file *file, int level)
|
||||||
|
|
||||||
dp->index = i;
|
dp->index = i;
|
||||||
if (i >= SNDRV_SEQ_OSS_MAX_CLIENTS) {
|
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;
|
rc = -ENOMEM;
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
@ -216,21 +214,19 @@ snd_seq_oss_open(struct file *file, int level)
|
||||||
snd_seq_oss_midi_setup(dp);
|
snd_seq_oss_midi_setup(dp);
|
||||||
|
|
||||||
if (dp->synth_opened == 0 && dp->max_mididev == 0) {
|
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;
|
rc = -ENODEV;
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create port */
|
/* create port */
|
||||||
debug_printk(("create new port\n"));
|
|
||||||
rc = create_port(dp);
|
rc = create_port(dp);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
snd_printk(KERN_ERR "can't create port\n");
|
pr_err("ALSA: seq_oss: can't create port\n");
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate queue */
|
/* allocate queue */
|
||||||
debug_printk(("allocate queue\n"));
|
|
||||||
rc = alloc_seq_queue(dp);
|
rc = alloc_seq_queue(dp);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto _error;
|
goto _error;
|
||||||
|
@ -247,7 +243,6 @@ snd_seq_oss_open(struct file *file, int level)
|
||||||
dp->file_mode = translate_mode(file);
|
dp->file_mode = translate_mode(file);
|
||||||
|
|
||||||
/* initialize read queue */
|
/* initialize read queue */
|
||||||
debug_printk(("initialize read queue\n"));
|
|
||||||
if (is_read_mode(dp->file_mode)) {
|
if (is_read_mode(dp->file_mode)) {
|
||||||
dp->readq = snd_seq_oss_readq_new(dp, maxqlen);
|
dp->readq = snd_seq_oss_readq_new(dp, maxqlen);
|
||||||
if (!dp->readq) {
|
if (!dp->readq) {
|
||||||
|
@ -257,7 +252,6 @@ snd_seq_oss_open(struct file *file, int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize write queue */
|
/* initialize write queue */
|
||||||
debug_printk(("initialize write queue\n"));
|
|
||||||
if (is_write_mode(dp->file_mode)) {
|
if (is_write_mode(dp->file_mode)) {
|
||||||
dp->writeq = snd_seq_oss_writeq_new(dp, maxqlen);
|
dp->writeq = snd_seq_oss_writeq_new(dp, maxqlen);
|
||||||
if (!dp->writeq) {
|
if (!dp->writeq) {
|
||||||
|
@ -267,14 +261,12 @@ snd_seq_oss_open(struct file *file, int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize timer */
|
/* initialize timer */
|
||||||
debug_printk(("initialize timer\n"));
|
|
||||||
dp->timer = snd_seq_oss_timer_new(dp);
|
dp->timer = snd_seq_oss_timer_new(dp);
|
||||||
if (!dp->timer) {
|
if (!dp->timer) {
|
||||||
snd_printk(KERN_ERR "can't alloc timer\n");
|
pr_err("ALSA: seq_oss: can't alloc timer\n");
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto _error;
|
goto _error;
|
||||||
}
|
}
|
||||||
debug_printk(("timer initialized\n"));
|
|
||||||
|
|
||||||
/* set private data pointer */
|
/* set private data pointer */
|
||||||
file->private_data = dp;
|
file->private_data = dp;
|
||||||
|
@ -288,7 +280,6 @@ snd_seq_oss_open(struct file *file, int level)
|
||||||
client_table[dp->index] = dp;
|
client_table[dp->index] = dp;
|
||||||
num_clients++;
|
num_clients++;
|
||||||
|
|
||||||
debug_printk(("open done\n"));
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_error:
|
_error:
|
||||||
|
@ -347,7 +338,6 @@ create_port(struct seq_oss_devinfo *dp)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
dp->port = port.addr.port;
|
dp->port = port.addr.port;
|
||||||
debug_printk(("new port = %d\n", port.addr.port));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +353,6 @@ delete_port(struct seq_oss_devinfo *dp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printk(("delete_port %i\n", dp->port));
|
|
||||||
return snd_seq_event_port_detach(dp->cseq, dp->port);
|
return snd_seq_event_port_detach(dp->cseq, dp->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +390,7 @@ delete_seq_queue(int queue)
|
||||||
qinfo.queue = queue;
|
qinfo.queue = queue;
|
||||||
rc = call_ctl(SNDRV_SEQ_IOCTL_DELETE_QUEUE, &qinfo);
|
rc = call_ctl(SNDRV_SEQ_IOCTL_DELETE_QUEUE, &qinfo);
|
||||||
if (rc < 0)
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,21 +427,16 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp)
|
||||||
client_table[dp->index] = NULL;
|
client_table[dp->index] = NULL;
|
||||||
num_clients--;
|
num_clients--;
|
||||||
|
|
||||||
debug_printk(("resetting..\n"));
|
|
||||||
snd_seq_oss_reset(dp);
|
snd_seq_oss_reset(dp);
|
||||||
|
|
||||||
debug_printk(("cleaning up..\n"));
|
|
||||||
snd_seq_oss_synth_cleanup(dp);
|
snd_seq_oss_synth_cleanup(dp);
|
||||||
snd_seq_oss_midi_cleanup(dp);
|
snd_seq_oss_midi_cleanup(dp);
|
||||||
|
|
||||||
/* clear slot */
|
/* clear slot */
|
||||||
debug_printk(("releasing resource..\n"));
|
|
||||||
queue = dp->queue;
|
queue = dp->queue;
|
||||||
if (dp->port >= 0)
|
if (dp->port >= 0)
|
||||||
delete_port(dp);
|
delete_port(dp);
|
||||||
delete_seq_queue(queue);
|
delete_seq_queue(queue);
|
||||||
|
|
||||||
debug_printk(("release done\n"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -466,7 +450,6 @@ snd_seq_oss_drain_write(struct seq_oss_devinfo *dp)
|
||||||
return;
|
return;
|
||||||
if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) &&
|
if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) &&
|
||||||
dp->writeq) {
|
dp->writeq) {
|
||||||
debug_printk(("syncing..\n"));
|
|
||||||
while (snd_seq_oss_writeq_sync(dp->writeq))
|
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);
|
return snd_seq_oss_timer_ioctl(dp->timer, cmd, arg);
|
||||||
|
|
||||||
case SNDCTL_SEQ_PANIC:
|
case SNDCTL_SEQ_PANIC:
|
||||||
debug_printk(("panic\n"));
|
|
||||||
snd_seq_oss_reset(dp);
|
snd_seq_oss_reset(dp);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
case SNDCTL_SEQ_SYNC:
|
case SNDCTL_SEQ_SYNC:
|
||||||
debug_printk(("sync\n"));
|
|
||||||
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
|
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
while (snd_seq_oss_writeq_sync(dp->writeq))
|
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;
|
return 0;
|
||||||
|
|
||||||
case SNDCTL_SEQ_RESET:
|
case SNDCTL_SEQ_RESET:
|
||||||
debug_printk(("reset\n"));
|
|
||||||
snd_seq_oss_reset(dp);
|
snd_seq_oss_reset(dp);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case SNDCTL_SEQ_TESTMIDI:
|
case SNDCTL_SEQ_TESTMIDI:
|
||||||
debug_printk(("test midi\n"));
|
|
||||||
if (get_user(dev, p))
|
if (get_user(dev, p))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return snd_seq_oss_midi_open(dp, dev, dp->file_mode);
|
return snd_seq_oss_midi_open(dp, dev, dp->file_mode);
|
||||||
|
|
||||||
case SNDCTL_SEQ_GETINCOUNT:
|
case SNDCTL_SEQ_GETINCOUNT:
|
||||||
debug_printk(("get in count\n"));
|
|
||||||
if (dp->readq == NULL || ! is_read_mode(dp->file_mode))
|
if (dp->readq == NULL || ! is_read_mode(dp->file_mode))
|
||||||
return 0;
|
return 0;
|
||||||
return put_user(dp->readq->qlen, p) ? -EFAULT : 0;
|
return put_user(dp->readq->qlen, p) ? -EFAULT : 0;
|
||||||
|
|
||||||
case SNDCTL_SEQ_GETOUTCOUNT:
|
case SNDCTL_SEQ_GETOUTCOUNT:
|
||||||
debug_printk(("get out count\n"));
|
|
||||||
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
|
if (! is_write_mode(dp->file_mode) || dp->writeq == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0;
|
return put_user(snd_seq_oss_writeq_get_free_size(dp->writeq), p) ? -EFAULT : 0;
|
||||||
|
|
||||||
case SNDCTL_SEQ_GETTIME:
|
case SNDCTL_SEQ_GETTIME:
|
||||||
debug_printk(("get time\n"));
|
|
||||||
return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0;
|
return put_user(snd_seq_oss_timer_cur_tick(dp->timer), p) ? -EFAULT : 0;
|
||||||
|
|
||||||
case SNDCTL_SEQ_RESETSAMPLES:
|
case SNDCTL_SEQ_RESETSAMPLES:
|
||||||
debug_printk(("reset samples\n"));
|
|
||||||
if (get_user(dev, p))
|
if (get_user(dev, p))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
return snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
||||||
|
|
||||||
case SNDCTL_SEQ_NRSYNTHS:
|
case SNDCTL_SEQ_NRSYNTHS:
|
||||||
debug_printk(("nr synths\n"));
|
|
||||||
return put_user(dp->max_synthdev, p) ? -EFAULT : 0;
|
return put_user(dp->max_synthdev, p) ? -EFAULT : 0;
|
||||||
|
|
||||||
case SNDCTL_SEQ_NRMIDIS:
|
case SNDCTL_SEQ_NRMIDIS:
|
||||||
debug_printk(("nr midis\n"));
|
|
||||||
return put_user(dp->max_mididev, p) ? -EFAULT : 0;
|
return put_user(dp->max_mididev, p) ? -EFAULT : 0;
|
||||||
|
|
||||||
case SNDCTL_SYNTH_MEMAVL:
|
case SNDCTL_SYNTH_MEMAVL:
|
||||||
debug_printk(("mem avail\n"));
|
|
||||||
if (get_user(dev, p))
|
if (get_user(dev, p))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
val = snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
||||||
return put_user(val, p) ? -EFAULT : 0;
|
return put_user(val, p) ? -EFAULT : 0;
|
||||||
|
|
||||||
case SNDCTL_FM_4OP_ENABLE:
|
case SNDCTL_FM_4OP_ENABLE:
|
||||||
debug_printk(("4op\n"));
|
|
||||||
if (get_user(dev, p))
|
if (get_user(dev, p))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
snd_seq_oss_synth_ioctl(dp, dev, cmd, carg);
|
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_INFO:
|
||||||
case SNDCTL_SYNTH_ID:
|
case SNDCTL_SYNTH_ID:
|
||||||
debug_printk(("synth info\n"));
|
|
||||||
return snd_seq_oss_synth_info_user(dp, arg);
|
return snd_seq_oss_synth_info_user(dp, arg);
|
||||||
|
|
||||||
case SNDCTL_SEQ_OUTOFBAND:
|
case SNDCTL_SEQ_OUTOFBAND:
|
||||||
debug_printk(("out of band\n"));
|
|
||||||
return snd_seq_oss_oob_user(dp, arg);
|
return snd_seq_oss_oob_user(dp, arg);
|
||||||
|
|
||||||
case SNDCTL_MIDI_INFO:
|
case SNDCTL_MIDI_INFO:
|
||||||
debug_printk(("midi info\n"));
|
|
||||||
return snd_seq_oss_midi_info_user(dp, arg);
|
return snd_seq_oss_midi_info_user(dp, arg);
|
||||||
|
|
||||||
case SNDCTL_SEQ_THRESHOLD:
|
case SNDCTL_SEQ_THRESHOLD:
|
||||||
debug_printk(("threshold\n"));
|
|
||||||
if (! is_write_mode(dp->file_mode))
|
if (! is_write_mode(dp->file_mode))
|
||||||
return 0;
|
return 0;
|
||||||
if (get_user(val, p))
|
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;
|
return 0;
|
||||||
|
|
||||||
case SNDCTL_MIDI_PRETIME:
|
case SNDCTL_MIDI_PRETIME:
|
||||||
debug_printk(("pretime\n"));
|
|
||||||
if (dp->readq == NULL || !is_read_mode(dp->file_mode))
|
if (dp->readq == NULL || !is_read_mode(dp->file_mode))
|
||||||
return 0;
|
return 0;
|
||||||
if (get_user(val, p))
|
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;
|
return put_user(val, p) ? -EFAULT : 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
debug_printk(("others\n"));
|
|
||||||
if (! is_write_mode(dp->file_mode))
|
if (! is_write_mode(dp->file_mode))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
return snd_seq_oss_synth_ioctl(dp, 0, cmd, carg);
|
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;
|
struct seq_oss_midi *mdev;
|
||||||
unsigned long flags;
|
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 */
|
/* the port must include generic midi */
|
||||||
if (! (pinfo->type & SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC))
|
if (! (pinfo->type & SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -175,7 +174,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
|
||||||
* allocate midi info record
|
* allocate midi info record
|
||||||
*/
|
*/
|
||||||
if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) {
|
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;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +190,7 @@ snd_seq_oss_midi_check_new_port(struct snd_seq_port_info *pinfo)
|
||||||
|
|
||||||
/* create MIDI coder */
|
/* create MIDI coder */
|
||||||
if (snd_midi_event_new(MAX_MIDI_EVENT_BUF, &mdev->coder) < 0) {
|
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);
|
kfree(mdev);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +405,6 @@ snd_seq_oss_midi_close(struct seq_oss_devinfo *dp, int dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printk(("closing client %d port %d mode %d\n", mdev->client, mdev->port, mdev->opened));
|
|
||||||
memset(&subs, 0, sizeof(subs));
|
memset(&subs, 0, sizeof(subs));
|
||||||
if (mdev->opened & PERM_WRITE) {
|
if (mdev->opened & PERM_WRITE) {
|
||||||
subs.sender = dp->addr;
|
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;
|
struct snd_seq_event ev;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
debug_printk(("resetting client %d port %d\n", mdev->client, mdev->port));
|
|
||||||
memset(&ev, 0, sizeof(ev));
|
memset(&ev, 0, sizeof(ev));
|
||||||
ev.dest.client = mdev->client;
|
ev.dest.client = mdev->client;
|
||||||
ev.dest.port = mdev->port;
|
ev.dest.port = mdev->port;
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче