sound updates for 4.14-rc1

We have touched quite a lot of files but with fewer changes at this
 cycle; as you can see, most of changes are trivial fixes, especially
 constification patches.  Among the massive attacks by constification
 gangs, we had a few core changes (mostly for ASoC core), as well the
 fixes and the updates by major vendors.  Some highlights are below:
 
 ALSA core:
 - Fix possible races in control API user-TLV codes
 - Small cleanup of PCM core
 
 ASoC:
 - Continued work for componentization; still half-baked, but we're
   certainly progressing
 - Use of devres for jack detection GPIOs, rather as a cleanup
 - Jack detection support for Qualcomm MSM8916
 - Support for Allwinner H3, Cirrus Logic CS43130, Intel Kabylake
   systems with RT5663, Realtek RT274, TI TLV320AIC32x6 and Wolfson
   WM8523
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEECxfAB4MH3rD5mfB6bDGAVD0pKaQFAlmuvBsOHHRpd2FpQHN1
 c2UuZGUACgkQbDGAVD0pKaQl2Q/+I7gcTwlNqjqKL0NZx2cX37nHmfsEcEkWXzx5
 +GFx7LJQf1sLlpxA8YWFThY24/59lH711guC1q8OGwRFdwl9X01+b/vScpvrxnzH
 a0wBTFuvQhr70brc33Y3q3mPhspC5QIUOJtzULG6MiLgzlTBZqLLu2uKV4fSz36I
 pGhi9OB7gMyUL4PFXk7xkcCNxzdOiptWWwFJgh39Yd+9yNP3/U0y3hHz6uzDuQf1
 tUIxDhwl22w8gCiYYNbBn8pcSGH+KT4BMqa5+/+qlV5exNa+Es8DozCQ+lis579+
 dnVc/rpzDJPotmWYdWJsuAmkURvtgzizWSill31bRSoydhfClw6yfl6EoGfZdP50
 3SES87YhTCAPCWfMFSUBtG3PZHgKQcp+QqWCrPaxmVIjqFDS+OxYxtkfVqGRd1u3
 Vv9VCbXhocsdMxA4FlTdyoQPCM9DxcHIdqCmYyjDs55eSy/dO4ND005eunnZawNh
 8kbQcP4873PbDdCssXEeWsbvDSkaeVEa5/taLpalfG7bIO9zHX7ese/0zIgljaF3
 0zK3beWIaIxIeZ473+/gwmzFSpUeIEFJW6YJDkT7CDrRuT1C6fzhaAkz7J+BdzZd
 et0Cqr9tQg0Xk9SsXV1rq1h90e9yQcG0wdalkGrxEVDVtnTRmL5v4AiyX8wzpTAp
 MbuniQo=
 =/Rv6
 -----END PGP SIGNATURE-----

Merge tag 'sound-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound updates from Takashi Iwai:
 "We have touched quite a lot of files but with fewer changes at this
  cycle; as you can see, most of changes are trivial fixes, especially
  constification patches.

  Among the massive attacks by constification gangs, we had a few core
  changes (mostly for ASoC core), as well the fixes and the updates by
  major vendors.

  Some highlights:

  ALSA core:

   - Fix possible races in control API user-TLV codes

   - Small cleanup of PCM core

  ASoC:

   - Continued work for componentization; still half-baked, but we're
     certainly progressing

   - Use of devres for jack detection GPIOs, rather as a cleanup

   - Jack detection support for Qualcomm MSM8916

   - Support for Allwinner H3, Cirrus Logic CS43130, Intel Kabylake
     systems with RT5663, Realtek RT274, TI TLV320AIC32x6 and Wolfson
     WM8523"

* tag 'sound-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (512 commits)
  ALSA: hda/ca0132 - Fix memory leak at error path
  ALSA: hda: Fix forget to free resource in error handling code path in hda_codec_driver_probe
  ASoC: cs43130: Fix unused compiler warnings for PM runtime
  ASoC: cs43130: Fix possible Oops with invalid dev_id
  ASoC: cs43130: fix spelling mistake: "irq_occurrance" -> "irq_occurrence"
  ALSA: atmel: Remove leftovers of AVR32 removal
  ALSA: atmel: convert AC97c driver to GPIO descriptor API
  ALSA: hda/realtek - Enable jack detection function for Intel ALC700
  ALSA: hda: Fix regression of hdmi eld control created based on invalid pcm
  ASoC: Intel: Skylake: Add IPC to configure the copier secondary pins
  ASoC: add missing compile rule for max98371
  ASoC: add missing compile rule for sirf-audio-codec
  ASoC: add missing compile rule for max98371
  ASoC: cs43130: Add devicetree bindings for CS43130
  ASoC: cs43130: Add support for CS43130 codec
  ASoC: make clock direction configurable in asoc-simple
  ALSA: ctxfi: Remove null check before kfree
  ASoC: max98927: Changed device property read function
  ASoC: max98927: Modified DAPM widget and map to enable/disable VI sense path
  ASoC: max98927: Added PM suspend and resume function
  ...
This commit is contained in:
Linus Torvalds 2017-09-07 12:44:53 -07:00
commit d969443064
493 changed files with 12118 additions and 3127 deletions

View File

@ -0,0 +1,67 @@
CS43130 DAC
Required properties:
- compatible : "cirrus,cs43130", "cirrus,cs4399", "cirrus,cs43131",
"cirrus,cs43198"
- reg : the I2C address of the device for I2C
- VA-supply, VP-supply, VL-supply, VCP-supply, VD-supply:
power supplies for the device, as covered in
Documentation/devicetree/bindings/regulator/regulator.txt.
Optional properties:
- reset-gpios : Active low GPIO used to reset the device
- cirrus,xtal-ibias:
When external MCLK is generated by external crystal
oscillator, CS43130 can be used to provide bias current
for external crystal. Amount of bias current sent is
set as:
1 = 7.5uA
2 = 12.5uA
3 = 15uA
- cirrus,dc-measure:
Boolean, define to enable headphone DC impedance measurement.
- cirrus,ac-measure:
Boolean, define to enable headphone AC impedance measurement.
DC impedance must also be enabled for AC impedance measurement.
- cirrus,dc-threshold:
Define 2 DC impedance thresholds in ohms for HP output control.
Default values are 50 and 120 Ohms.
- cirrus,ac-freq:
Define the frequencies at which to measure HP AC impedance.
Only used if "cirrus,dc-measure" is defined.
Exactly 10 frequencies must be defined.
If this properties is undefined, by default,
following frequencies are used:
<24 43 93 200 431 928 2000 4309 9283 20000>
The above frequencies are logarithmically equally spaced.
Log base is 10.
Example:
cs43130: audio-codec@30 {
compatible = "cirrus,cs43130";
reg = <0x30>;
reset-gpios = <&axi_gpio 54 0>;
VA-supply = <&dummy_vreg>;
VP-supply = <&dummy_vreg>;
VL-supply = <&dummy_vreg>;
VCP-supply = <&dummy_vreg>;
VD-supply = <&dummy_vreg>;
cirrus,xtal-ibias = <2>;
interrupt-parent = <&gpio0>;
interrupts = <55 8>;
cirrus,dc-measure;
cirrus,ac-measure;
cirrus,dc-threshold = /bits/ 16 <20 100>;
cirrus,ac-freq = /bits/ 16 <24 43 93 200 431 928 2000 4309 9283 20000>;
};

View File

@ -0,0 +1,16 @@
Device-Tree bindings for Digital microphone (DMIC) codec
This device support generic PDM digital microphone.
Required properties:
- compatible: should be "dmic-codec".
Optional properties:
- dmicen-gpios: GPIO specifier for dmic to control start and stop
Example node:
dmic_codec: dmic@0 {
compatible = "dmic-codec";
dmicen-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
};

View File

@ -3,7 +3,8 @@ Mediatek AFE PCM controller for mt2701
Required properties: Required properties:
- compatible = "mediatek,mt2701-audio"; - compatible = "mediatek,mt2701-audio";
- reg: register location and size - reg: register location and size
- interrupts: Should contain AFE interrupt - interrupts: should contain AFE and ASYS interrupts
- interrupt-names: should be "afe" and "asys"
- power-domains: should define the power domain - power-domains: should define the power domain
- clock-names: should have these clock names: - clock-names: should have these clock names:
"infra_sys_audio_clk", "infra_sys_audio_clk",
@ -59,6 +60,7 @@ Example:
<0 0x112A0000 0 0x20000>; <0 0x112A0000 0 0x20000>;
interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_LOW>, interrupts = <GIC_SPI 104 IRQ_TYPE_LEVEL_LOW>,
<GIC_SPI 132 IRQ_TYPE_LEVEL_LOW>; <GIC_SPI 132 IRQ_TYPE_LEVEL_LOW>;
interrupt-names = "afe", "asys";
power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>; power-domains = <&scpsys MT2701_POWER_DOMAIN_IFR_MSC>;
clocks = <&infracfg CLK_INFRA_AUDIO>, clocks = <&infracfg CLK_INFRA_AUDIO>,
<&topckgen CLK_TOP_AUD_MUX1_SEL>, <&topckgen CLK_TOP_AUD_MUX1_SEL>,

View File

@ -31,8 +31,22 @@ Required properties
- vdd-cdc-io-supply: phandle to VDD_CDC_IO regulator DT node. - vdd-cdc-io-supply: phandle to VDD_CDC_IO regulator DT node.
- vdd-cdc-tx-rx-cx-supply: phandle to VDD_CDC_TX/RX/CX regulator DT node. - vdd-cdc-tx-rx-cx-supply: phandle to VDD_CDC_TX/RX/CX regulator DT node.
- vdd-micbias-supply: phandle of VDD_MICBIAS supply's regulator DT node. - vdd-micbias-supply: phandle of VDD_MICBIAS supply's regulator DT node.
Optional Properties: Optional Properties:
- qcom,mbhc-vthreshold-low: Array of 5 threshold voltages in mV for 5 buttons
detection on headset when the mbhc is powered up
by internal current source, this is a low power.
- qcom,mbhc-vthreshold-high: Array of 5 thresold voltages in mV for 5 buttons
detection on headset when mbhc is powered up
from micbias.
- qcom,micbias-lvl: Voltage (mV) for Mic Bias
- qcom,hphl-jack-type-normally-open: boolean, present if hphl pin on jack is a
NO (Normally Open). If not specified, then
its assumed that hphl pin on jack is NC
(Normally Closed).
- qcom,gnd-jack-type-normally-open: boolean, present if gnd pin on jack is
NO (Normally Open). If not specified, then
its assumed that gnd pin on jack is NC
(Normally Closed).
- qcom,micbias1-ext-cap: boolean, present if micbias1 has external capacitor - qcom,micbias1-ext-cap: boolean, present if micbias1 has external capacitor
connected. connected.
- qcom,micbias2-ext-cap: boolean, present if micbias2 has external capacitor - qcom,micbias2-ext-cap: boolean, present if micbias2 has external capacitor
@ -48,6 +62,8 @@ spmi_bus {
reg-names = "pmic-codec-core"; reg-names = "pmic-codec-core";
clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>; clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
clock-names = "mclk"; clock-names = "mclk";
qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
interrupt-parent = <&spmi_bus>; interrupt-parent = <&spmi_bus>;
interrupts = <0x1 0xf0 0x0 IRQ_TYPE_NONE>, interrupts = <0x1 0xf0 0x0 IRQ_TYPE_NONE>,
<0x1 0xf0 0x1 IRQ_TYPE_NONE>, <0x1 0xf0 0x1 IRQ_TYPE_NONE>,

View File

@ -199,10 +199,10 @@ Ex)
sound { sound {
compatible = "simple-scu-audio-card"; compatible = "simple-scu-audio-card";
... ...
simple-audio-card,cpu@0 { simple-audio-card,cpu-0 {
sound-dai = <&rcar_sound 0>; sound-dai = <&rcar_sound 0>;
}; };
simple-audio-card,cpu@1 { simple-audio-card,cpu-1 {
sound-dai = <&rcar_sound 1>; sound-dai = <&rcar_sound 1>;
}; };
simple-audio-card,codec { simple-audio-card,codec {
@ -441,79 +441,79 @@ rcar_sound: sound@ec500000 {
"clk_a", "clk_b", "clk_c", "clk_i"; "clk_a", "clk_b", "clk_c", "clk_i";
rcar_sound,dvc { rcar_sound,dvc {
dvc0: dvc@0 { dvc0: dvc-0 {
dmas = <&audma0 0xbc>; dmas = <&audma0 0xbc>;
dma-names = "tx"; dma-names = "tx";
}; };
dvc1: dvc@1 { dvc1: dvc-1 {
dmas = <&audma0 0xbe>; dmas = <&audma0 0xbe>;
dma-names = "tx"; dma-names = "tx";
}; };
}; };
rcar_sound,mix { rcar_sound,mix {
mix0: mix@0 { }; mix0: mix-0 { };
mix1: mix@1 { }; mix1: mix-1 { };
}; };
rcar_sound,ctu { rcar_sound,ctu {
ctu00: ctu@0 { }; ctu00: ctu-0 { };
ctu01: ctu@1 { }; ctu01: ctu-1 { };
ctu02: ctu@2 { }; ctu02: ctu-2 { };
ctu03: ctu@3 { }; ctu03: ctu-3 { };
ctu10: ctu@4 { }; ctu10: ctu-4 { };
ctu11: ctu@5 { }; ctu11: ctu-5 { };
ctu12: ctu@6 { }; ctu12: ctu-6 { };
ctu13: ctu@7 { }; ctu13: ctu-7 { };
}; };
rcar_sound,src { rcar_sound,src {
src0: src@0 { src0: src-0 {
interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 352 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x85>, <&audma1 0x9a>; dmas = <&audma0 0x85>, <&audma1 0x9a>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src1: src@1 { src1: src-1 {
interrupts = <0 353 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 353 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x87>, <&audma1 0x9c>; dmas = <&audma0 0x87>, <&audma1 0x9c>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src2: src@2 { src2: src-2 {
interrupts = <0 354 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 354 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x89>, <&audma1 0x9e>; dmas = <&audma0 0x89>, <&audma1 0x9e>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src3: src@3 { src3: src-3 {
interrupts = <0 355 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 355 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x8b>, <&audma1 0xa0>; dmas = <&audma0 0x8b>, <&audma1 0xa0>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src4: src@4 { src4: src-4 {
interrupts = <0 356 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 356 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x8d>, <&audma1 0xb0>; dmas = <&audma0 0x8d>, <&audma1 0xb0>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src5: src@5 { src5: src-5 {
interrupts = <0 357 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 357 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x8f>, <&audma1 0xb2>; dmas = <&audma0 0x8f>, <&audma1 0xb2>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src6: src@6 { src6: src-6 {
interrupts = <0 358 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 358 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x91>, <&audma1 0xb4>; dmas = <&audma0 0x91>, <&audma1 0xb4>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src7: src@7 { src7: src-7 {
interrupts = <0 359 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 359 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x93>, <&audma1 0xb6>; dmas = <&audma0 0x93>, <&audma1 0xb6>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src8: src@8 { src8: src-8 {
interrupts = <0 360 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 360 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x95>, <&audma1 0xb8>; dmas = <&audma0 0x95>, <&audma1 0xb8>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
}; };
src9: src@9 { src9: src-9 {
interrupts = <0 361 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 361 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x97>, <&audma1 0xba>; dmas = <&audma0 0x97>, <&audma1 0xba>;
dma-names = "rx", "tx"; dma-names = "rx", "tx";
@ -521,52 +521,52 @@ rcar_sound: sound@ec500000 {
}; };
rcar_sound,ssi { rcar_sound,ssi {
ssi0: ssi@0 { ssi0: ssi-0 {
interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 370 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x01>, <&audma1 0x02>, <&audma0 0x15>, <&audma1 0x16>; dmas = <&audma0 0x01>, <&audma1 0x02>, <&audma0 0x15>, <&audma1 0x16>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi1: ssi@1 { ssi1: ssi-1 {
interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 371 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x03>, <&audma1 0x04>, <&audma0 0x49>, <&audma1 0x4a>; dmas = <&audma0 0x03>, <&audma1 0x04>, <&audma0 0x49>, <&audma1 0x4a>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi2: ssi@2 { ssi2: ssi-2 {
interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 372 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x05>, <&audma1 0x06>, <&audma0 0x63>, <&audma1 0x64>; dmas = <&audma0 0x05>, <&audma1 0x06>, <&audma0 0x63>, <&audma1 0x64>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi3: ssi@3 { ssi3: ssi-3 {
interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 373 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x07>, <&audma1 0x08>, <&audma0 0x6f>, <&audma1 0x70>; dmas = <&audma0 0x07>, <&audma1 0x08>, <&audma0 0x6f>, <&audma1 0x70>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi4: ssi@4 { ssi4: ssi-4 {
interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 374 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x09>, <&audma1 0x0a>, <&audma0 0x71>, <&audma1 0x72>; dmas = <&audma0 0x09>, <&audma1 0x0a>, <&audma0 0x71>, <&audma1 0x72>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi5: ssi@5 { ssi5: ssi-5 {
interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 375 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x0b>, <&audma1 0x0c>, <&audma0 0x73>, <&audma1 0x74>; dmas = <&audma0 0x0b>, <&audma1 0x0c>, <&audma0 0x73>, <&audma1 0x74>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi6: ssi@6 { ssi6: ssi-6 {
interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 376 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x0d>, <&audma1 0x0e>, <&audma0 0x75>, <&audma1 0x76>; dmas = <&audma0 0x0d>, <&audma1 0x0e>, <&audma0 0x75>, <&audma1 0x76>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi7: ssi@7 { ssi7: ssi-7 {
interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 377 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x0f>, <&audma1 0x10>, <&audma0 0x79>, <&audma1 0x7a>; dmas = <&audma0 0x0f>, <&audma1 0x10>, <&audma0 0x79>, <&audma1 0x7a>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi8: ssi@8 { ssi8: ssi-8 {
interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 378 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x11>, <&audma1 0x12>, <&audma0 0x7b>, <&audma1 0x7c>; dmas = <&audma0 0x11>, <&audma1 0x12>, <&audma0 0x7b>, <&audma1 0x7c>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";
}; };
ssi9: ssi@9 { ssi9: ssi-9 {
interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>; interrupts = <0 379 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&audma0 0x13>, <&audma1 0x14>, <&audma0 0x7d>, <&audma1 0x7e>; dmas = <&audma0 0x13>, <&audma1 0x14>, <&audma0 0x7d>, <&audma1 0x7e>;
dma-names = "rx", "tx", "rxu", "txu"; dma-names = "rx", "tx", "rxu", "txu";

View File

@ -29,11 +29,14 @@ pdm: pdm@ff040000 {
dma-names = "rx"; dma-names = "rx";
pinctrl-names = "default", "sleep"; pinctrl-names = "default", "sleep";
pinctrl-0 = <&pdmm0_clk pinctrl-0 = <&pdmm0_clk
&pdmm0_fsync
&pdmm0_sdi0 &pdmm0_sdi0
&pdmm0_sdi1 &pdmm0_sdi1
&pdmm0_sdi2 &pdmm0_sdi2
&pdmm0_sdi3>; &pdmm0_sdi3>;
pinctrl-1 = <&pdmm0_sleep>; pinctrl-1 = <&pdmm0_clk_sleep
&pdmm0_sdi0_sleep
&pdmm0_sdi1_sleep
&pdmm0_sdi2_sleep
&pdmm0_sdi3_sleep>;
status = "disabled"; status = "disabled";
}; };

View File

@ -4,7 +4,7 @@ Required properties:
- compatible: "rockchip,rk3399-gru-sound" - compatible: "rockchip,rk3399-gru-sound"
- rockchip,cpu: The phandle of the Rockchip I2S controller that's - rockchip,cpu: The phandle of the Rockchip I2S controller that's
connected to the codecs connected to the codecs
- rockchip,codec: The phandle of the MAX98357A/RT5514/DA7219 codecs - rockchip,codec: The phandle of the audio codecs
Optional properties: Optional properties:
- dmic-wakeup-delay-ms : specify delay time (ms) for DMIC ready. - dmic-wakeup-delay-ms : specify delay time (ms) for DMIC ready.

View File

@ -7,8 +7,12 @@ Required properties:
- compatible: should be one of the following: - compatible: should be one of the following:
- "rockchip,rk3066-i2s": for rk3066 - "rockchip,rk3066-i2s": for rk3066
- "rockchip,rk3036-i2s", "rockchip,rk3066-i2s": for rk3036
- "rockchip,rk3188-i2s", "rockchip,rk3066-i2s": for rk3188 - "rockchip,rk3188-i2s", "rockchip,rk3066-i2s": for rk3188
- "rockchip,rk3228-i2s", "rockchip,rk3066-i2s": for rk3228
- "rockchip,rk3288-i2s", "rockchip,rk3066-i2s": for rk3288 - "rockchip,rk3288-i2s", "rockchip,rk3066-i2s": for rk3288
- "rockchip,rk3328-i2s", "rockchip,rk3066-i2s": for rk3328
- "rockchip,rk3366-i2s", "rockchip,rk3066-i2s": for rk3366
- "rockchip,rk3368-i2s", "rockchip,rk3066-i2s": for rk3368 - "rockchip,rk3368-i2s", "rockchip,rk3066-i2s": for rk3368
- "rockchip,rk3399-i2s", "rockchip,rk3066-i2s": for rk3399 - "rockchip,rk3399-i2s", "rockchip,rk3066-i2s": for rk3399
- reg: physical base address of the controller and length of memory mapped - reg: physical base address of the controller and length of memory mapped

View File

@ -0,0 +1,33 @@
RT274 audio CODEC
This device supports I2C only.
Required properties:
- compatible : "realtek,rt274".
- reg : The I2C address of the device.
Optional properties:
- interrupts : The CODEC's interrupt output.
Pins on the device (for linking into audio routes) for RT274:
* DMIC1 Pin
* DMIC2 Pin
* MIC
* LINE1
* LINE2
* HPO Pin
* SPDIF
* LINE3
Example:
codec: rt274@1c {
compatible = "realtek,rt274";
reg = <0x1c>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
};

View File

@ -12,6 +12,14 @@ Required properties:
Optional properties: Optional properties:
- "realtek,dc_offset_l_manual"
- "realtek,dc_offset_r_manual"
- "realtek,dc_offset_l_manual_mic"
- "realtek,dc_offset_r_manual_mic"
Based on the different PCB layout, add the manual offset value to
compensate the DC offset for each L and R channel, and they are different
between headphone and headset.
Pins on the device (for linking into audio routes) for RT5663: Pins on the device (for linking into audio routes) for RT5663:
* IN1P * IN1P

View File

@ -7,9 +7,6 @@ Required properties:
- model - the user-visible name of this sound complex - model - the user-visible name of this sound complex
- clocks - should contain entries matching clock names in the clock-names - clocks - should contain entries matching clock names in the clock-names
property property
- clock-names - should contain following entries:
- "epll" - indicating the EPLL output clock
- "i2s_rclk" - indicating the RCLK (root) clock of the I2S0 controller
- samsung,audio-widgets - this property specifies off-codec audio elements - samsung,audio-widgets - this property specifies off-codec audio elements
like headphones or speakers, for details see widgets.txt like headphones or speakers, for details see widgets.txt
- samsung,audio-routing - a list of the connections between audio - samsung,audio-routing - a list of the connections between audio
@ -46,9 +43,6 @@ sound {
"IN1", "Mic Jack", "IN1", "Mic Jack",
"Mic Jack", "MICBIAS"; "Mic Jack", "MICBIAS";
clocks = <&clock CLK_FOUT_EPLL>, <&i2s0 CLK_I2S_RCLK_SRC>;
clock-names = "epll", "sclk_i2s";
cpu { cpu {
sound-dai = <&i2s0 0>; sound-dai = <&i2s0 0>;
}; };

View File

@ -86,6 +86,9 @@ Optional CPU/CODEC subnodes properties:
in dai startup() and disabled with in dai startup() and disabled with
clk_disable_unprepare() in dai clk_disable_unprepare() in dai
shutdown(). shutdown().
- system-clock-direction-out : specifies clock direction as 'out' on
initialization. It is useful for some aCPUs with
fixed clocks.
Example 1 - single DAI link: Example 1 - single DAI link:

View File

@ -24,6 +24,7 @@ Optional subnode properties:
- simple-audio-card,convert-rate : platform specified sampling rate convert - simple-audio-card,convert-rate : platform specified sampling rate convert
- simple-audio-card,convert-channels : platform specified converted channel size (2 - 8 ch) - simple-audio-card,convert-channels : platform specified converted channel size (2 - 8 ch)
- simple-audio-card,prefix : see routing - simple-audio-card,prefix : see routing
- 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 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. the second being the connection's source. Valid names for sources.

View File

@ -8,6 +8,7 @@ Required properties:
- compatible: should be one of the following: - compatible: should be one of the following:
- "allwinner,sun4i-a10-i2s" - "allwinner,sun4i-a10-i2s"
- "allwinner,sun6i-a31-i2s" - "allwinner,sun6i-a31-i2s"
- "allwinner,sun8i-h3-i2s"
- 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.
- interrupts: should contain the I2S interrupt. - interrupts: should contain the I2S interrupt.
@ -22,6 +23,7 @@ Required properties:
Required properties for the following compatibles: Required properties for the following compatibles:
- "allwinner,sun6i-a31-i2s" - "allwinner,sun6i-a31-i2s"
- "allwinner,sun8i-h3-i2s"
- resets: phandle to the reset line for this codec - resets: phandle to the reset line for this codec
Example: Example:

View File

@ -3,7 +3,9 @@ Texas Instruments - tlv320aic32x4 Codec module
The tlv320aic32x4 serial control bus communicates through I2C protocols The tlv320aic32x4 serial control bus communicates through I2C protocols
Required properties: Required properties:
- compatible: Should be "ti,tlv320aic32x4" - compatible - "string" - One of:
"ti,tlv320aic32x4" TLV320AIC3204
"ti,tlv320aic32x6" TLV320AIC3206, TLV320AIC3256
- reg: I2C slave address - reg: I2C slave address
- supply-*: Required supply regulators are: - supply-*: Required supply regulators are:
"iov" - digital IO power supply "iov" - digital IO power supply
@ -18,6 +20,8 @@ Optional properties:
- reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt - 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. - clocks/clock-names: Clock named 'mclk' for the master clock of the codec.
See clock/clock-bindings.txt for information about the detailed format. See clock/clock-bindings.txt for information about the detailed format.
- aic32x4-gpio-func - <array of 5 int>
- Types are defined in include/sound/tlv320aic32x4.h
Example: Example:
@ -27,4 +31,11 @@ codec: tlv320aic32x4@18 {
reg = <0x18>; reg = <0x18>;
clocks = <&clks 201>; clocks = <&clks 201>;
clock-names = "mclk"; clock-names = "mclk";
aic32x4-gpio-func= <
0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
0x04 /* MFP3 AIC32X4_MFP3_GPIO_ENABLED */
0xff /* AIC32X4_MFPX_DEFAULT_VALUE */
0x08 /* MFP5 AIC32X4_MFP5_GPIO_INPUT */
>;
}; };

View File

@ -26,6 +26,11 @@ Optional properties:
3 - MICBIAS output is connected to AVDD, 3 - MICBIAS output is connected to AVDD,
If this node is not mentioned or if the value is incorrect, then MicBias If this node is not mentioned or if the value is incorrect, then MicBias
is powered down. is powered down.
- ai3x-ocmv - Output Common-Mode Voltage selection:
0 - 1.35V,
1 - 1.5V,
2 - 1.65V,
3 - 1.8V
- AVDD-supply, IOVDD-supply, DRVDD-supply, DVDD-supply : power supplies for the - AVDD-supply, IOVDD-supply, DRVDD-supply, DVDD-supply : power supplies for the
device as covered in Documentation/devicetree/bindings/regulator/regulator.txt device as covered in Documentation/devicetree/bindings/regulator/regulator.txt

View File

@ -0,0 +1,16 @@
WM8524 audio CODEC
This device does not use I2C or SPI but a simple Hardware Control Interface.
Required properties:
- compatible : "wlf,wm8524"
- wlf,mute-gpios: a GPIO spec for the MUTE pin.
Example:
codec: wm8524@0 {
compatible = "wlf,wm8524";
wlf,mute-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
};

View File

@ -1,23 +0,0 @@
/*
* Driver for the Atmel Audio Bitstream DAC (ABDAC)
*
* Copyright (C) 2009 Atmel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H
#define __INCLUDE_SOUND_ATMEL_ABDAC_H
#include <linux/platform_data/dma-dw.h>
/**
* struct atmel_abdac_pdata - board specific ABDAC configuration
* @dws: DMA slave interface to use for sound playback.
*/
struct atmel_abdac_pdata {
struct dw_dma_slave dws;
};
#endif /* __INCLUDE_SOUND_ATMEL_ABDAC_H */

View File

@ -1,38 +0,0 @@
/*
* Driver for the Atmel AC97C controller
*
* Copyright (C) 2005-2009 Atmel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H
#define __INCLUDE_SOUND_ATMEL_AC97C_H
#include <linux/platform_data/dma-dw.h>
#define AC97C_CAPTURE 0x01
#define AC97C_PLAYBACK 0x02
#define AC97C_BOTH (AC97C_CAPTURE | AC97C_PLAYBACK)
/**
* struct atmel_ac97c_pdata - board specific AC97C configuration
* @rx_dws: DMA slave interface to use for sound capture.
* @tx_dws: DMA slave interface to use for sound playback.
* @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
* optional to use, set to -ENODEV if not in use. AC97 layer will
* try to do a software reset of the external codec anyway.
*
* If the user do not want to use a DMA channel for playback or capture, i.e.
* only one feature is required on the board. The slave for playback or capture
* can be set to NULL. The AC97C driver will take use of this when setting up
* the sound streams.
*/
struct ac97c_platform_data {
struct dw_dma_slave rx_dws;
struct dw_dma_slave tx_dws;
int reset_pin;
};
#endif /* __INCLUDE_SOUND_ATMEL_AC97C_H */

View File

@ -118,8 +118,6 @@ struct snd_card {
int user_ctl_count; /* count of all user controls */ int user_ctl_count; /* count of all user controls */
struct list_head controls; /* all controls for this card */ struct list_head controls; /* all controls for this card */
struct list_head ctl_files; /* active control files */ struct list_head ctl_files; /* active control files */
struct mutex user_ctl_lock; /* protects user controls against
concurrent access */
struct snd_info_entry *proc_root; /* root for soundcard specific files */ struct snd_info_entry *proc_root; /* root for soundcard specific files */
struct snd_info_entry *proc_id; /* the card id */ struct snd_info_entry *proc_id; /* the card id */
@ -138,7 +136,6 @@ struct snd_card {
#ifdef CONFIG_PM #ifdef CONFIG_PM
unsigned int power_state; /* power state */ unsigned int power_state; /* power state */
struct mutex power_lock; /* power lock */
wait_queue_head_t power_sleep; wait_queue_head_t power_sleep;
#endif #endif
@ -151,16 +148,6 @@ struct snd_card {
#define dev_to_snd_card(p) container_of(p, struct snd_card, card_dev) #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)
{
mutex_lock(&card->power_lock);
}
static inline void snd_power_unlock(struct snd_card *card)
{
mutex_unlock(&card->power_lock);
}
static inline unsigned int snd_power_get_state(struct snd_card *card) static inline unsigned int snd_power_get_state(struct snd_card *card)
{ {
return card->power_state; return card->power_state;
@ -177,8 +164,6 @@ int snd_power_wait(struct snd_card *card, unsigned int power_state);
#else /* ! CONFIG_PM */ #else /* ! CONFIG_PM */
#define snd_power_lock(card) do { (void)(card); } while (0)
#define snd_power_unlock(card) do { (void)(card); } while (0)
static inline int snd_power_wait(struct snd_card *card, unsigned int state) { return 0; } static inline int snd_power_wait(struct snd_card *card, unsigned int state) { return 0; }
#define snd_power_get_state(card) ({ (void)(card); SNDRV_CTL_POWER_D0; }) #define snd_power_get_state(card) ({ (void)(card); SNDRV_CTL_POWER_D0; })
#define snd_power_change_state(card, state) do { (void)(card); } while (0) #define snd_power_change_state(card, state) do { (void)(card); } while (0)

22
include/sound/rt5663.h Normal file
View File

@ -0,0 +1,22 @@
/*
* linux/sound/rt5663.h -- Platform data for RT5663
*
* Copyright 2017 Realtek Semiconductor Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __LINUX_SND_RT5663_H
#define __LINUX_SND_RT5663_H
struct rt5663_platform_data {
unsigned int dc_offset_l_manual;
unsigned int dc_offset_r_manual;
unsigned int dc_offset_l_manual_mic;
unsigned int dc_offset_r_manual_mic;
};
#endif

View File

@ -1,45 +0,0 @@
/*
* linux/sound/rt5677.h -- Platform data for RT5677
*
* Copyright 2013 Realtek Semiconductor Corp.
* Author: Oder Chiou <oder_chiou@realtek.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __LINUX_SND_RT5677_H
#define __LINUX_SND_RT5677_H
enum rt5677_dmic2_clk {
RT5677_DMIC_CLK1 = 0,
RT5677_DMIC_CLK2 = 1,
};
struct rt5677_platform_data {
/* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */
bool in1_diff;
bool in2_diff;
bool lout1_diff;
bool lout2_diff;
bool lout3_diff;
/* DMIC2 clock source selection */
enum rt5677_dmic2_clk dmic2_clk_pin;
/* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */
u8 gpio_config[6];
/* jd1 can select 0 ~ 3 as OFF, GPIO1, GPIO2 and GPIO3 respectively */
unsigned int jd1_gpio;
/* jd2 and jd3 can select 0 ~ 3 as
OFF, GPIO4, GPIO5 and GPIO6 respectively */
unsigned int jd2_gpio;
unsigned int jd3_gpio;
/* Set MICBIAS1 VDD 1v8 or 3v3 */
bool micbias1_vdd_3v3;
};
#endif

View File

@ -15,6 +15,7 @@
struct asoc_simple_dai { struct asoc_simple_dai {
const char *name; const char *name;
unsigned int sysclk; unsigned int sysclk;
int clk_direction;
int slots; int slots;
int slot_width; int slot_width;
unsigned int tx_slot_mask; unsigned int tx_slot_mask;

View File

@ -469,10 +469,10 @@ int snd_soc_register_codec(struct device *dev,
struct snd_soc_dai_driver *dai_drv, int num_dai); struct snd_soc_dai_driver *dai_drv, int num_dai);
void snd_soc_unregister_codec(struct device *dev); void snd_soc_unregister_codec(struct device *dev);
int snd_soc_register_component(struct device *dev, int snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *cmpnt_drv, const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv, int num_dai); struct snd_soc_dai_driver *dai_drv, int num_dai);
int devm_snd_soc_register_component(struct device *dev, int devm_snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *cmpnt_drv, const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv, int num_dai); struct snd_soc_dai_driver *dai_drv, int num_dai);
void snd_soc_unregister_component(struct device *dev); void snd_soc_unregister_component(struct device *dev);
int snd_soc_cache_init(struct snd_soc_codec *codec); int snd_soc_cache_init(struct snd_soc_codec *codec);
@ -795,6 +795,14 @@ struct snd_soc_component_driver {
int (*suspend)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *);
int (*resume)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *);
/* component wide operations */
int (*set_sysclk)(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir);
int (*set_pll)(struct snd_soc_component *component, int pll_id,
int source, unsigned int freq_in, unsigned int freq_out);
int (*set_jack)(struct snd_soc_component *component,
struct snd_soc_jack *jack, void *data);
/* DT */ /* DT */
int (*of_xlate_dai_name)(struct snd_soc_component *component, int (*of_xlate_dai_name)(struct snd_soc_component *component,
struct of_phandle_args *args, struct of_phandle_args *args,
@ -858,12 +866,6 @@ struct snd_soc_component {
/* Don't use these, use snd_soc_component_get_dapm() */ /* Don't use these, use snd_soc_component_get_dapm() */
struct snd_soc_dapm_context dapm; struct snd_soc_dapm_context dapm;
const struct snd_kcontrol_new *controls;
unsigned int num_controls;
const struct snd_soc_dapm_widget *dapm_widgets;
unsigned int num_dapm_widgets;
const struct snd_soc_dapm_route *dapm_routes;
unsigned int num_dapm_routes;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
int (*probe)(struct snd_soc_component *); int (*probe)(struct snd_soc_component *);
@ -871,6 +873,13 @@ struct snd_soc_component {
int (*suspend)(struct snd_soc_component *); int (*suspend)(struct snd_soc_component *);
int (*resume)(struct snd_soc_component *); int (*resume)(struct snd_soc_component *);
int (*set_sysclk)(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir);
int (*set_pll)(struct snd_soc_component *component, int pll_id,
int source, unsigned int freq_in, unsigned int freq_out);
int (*set_jack)(struct snd_soc_component *component,
struct snd_soc_jack *jack, void *data);
/* machine specific init */ /* machine specific init */
int (*init)(struct snd_soc_component *component); int (*init)(struct snd_soc_component *component);
@ -880,6 +889,18 @@ struct snd_soc_component {
#endif #endif
}; };
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_component*
snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
const char *driver_name);
#define for_each_rtdcom(rtd, rtdcom) \
list_for_each_entry(rtdcom, &(rtd)->component_list, list)
#define for_each_rtdcom_safe(rtd, rtdcom1, rtdcom2) \
list_for_each_entry_safe(rtdcom1, rtdcom2, &(rtd)->component_list, list)
/* SoC Audio Codec device */ /* SoC Audio Codec device */
struct snd_soc_codec { struct snd_soc_codec {
struct device *dev; struct device *dev;
@ -888,7 +909,6 @@ struct snd_soc_codec {
struct list_head list; struct list_head list;
/* runtime */ /* runtime */
unsigned int cache_bypass:1; /* Suppress access to the cache */
unsigned int cache_init:1; /* codec cache has been initialized */ unsigned int cache_init:1; /* codec cache has been initialized */
/* codec IO */ /* codec IO */
@ -898,10 +918,6 @@ struct snd_soc_codec {
/* component */ /* component */
struct snd_soc_component component; struct snd_soc_component component;
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_reg;
#endif
}; };
/* codec driver */ /* codec driver */
@ -1224,7 +1240,7 @@ struct snd_soc_pcm_runtime {
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct snd_compr *compr; struct snd_compr *compr;
struct snd_soc_codec *codec; struct snd_soc_codec *codec;
struct snd_soc_platform *platform; struct snd_soc_platform *platform; /* will be removed */
struct snd_soc_dai *codec_dai; struct snd_soc_dai *codec_dai;
struct snd_soc_dai *cpu_dai; struct snd_soc_dai *cpu_dai;
@ -1234,11 +1250,11 @@ struct snd_soc_pcm_runtime {
struct delayed_work delayed_work; struct delayed_work delayed_work;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dpcm_root; struct dentry *debugfs_dpcm_root;
struct dentry *debugfs_dpcm_state;
#endif #endif
unsigned int num; /* 0-based and monotonic increasing */ unsigned int num; /* 0-based and monotonic increasing */
struct list_head list; /* rtd list of the soc card */ struct list_head list; /* rtd list of the soc card */
struct list_head component_list; /* list of connected components */
/* bit field */ /* bit field */
unsigned int dev_registered:1; unsigned int dev_registered:1;
@ -1465,6 +1481,13 @@ void snd_soc_component_async_complete(struct snd_soc_component *component);
int snd_soc_component_test_bits(struct snd_soc_component *component, int snd_soc_component_test_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int value); unsigned int reg, unsigned int mask, unsigned int value);
/* component wide operations */
int snd_soc_component_set_sysclk(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir);
int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
int source, unsigned int freq_in,
unsigned int freq_out);
#ifdef CONFIG_REGMAP #ifdef CONFIG_REGMAP
void snd_soc_component_init_regmap(struct snd_soc_component *component, void snd_soc_component_init_regmap(struct snd_soc_component *component,

View File

@ -22,7 +22,30 @@
#define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K 0x00000001 #define AIC32X4_MICPGA_ROUTE_LMIC_IN2R_10K 0x00000001
#define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K 0x00000002 #define AIC32X4_MICPGA_ROUTE_RMIC_IN1L_10K 0x00000002
/* GPIO API */
#define AIC32X4_MFPX_DEFAULT_VALUE 0xff
#define AIC32X4_MFP1_DIN_DISABLED 0
#define AIC32X4_MFP1_DIN_ENABLED 0x2
#define AIC32X4_MFP1_GPIO_IN 0x4
#define AIC32X4_MFP2_GPIO_OUT_LOW 0x0
#define AIC32X4_MFP2_GPIO_OUT_HIGH 0x1
#define AIC32X4_MFP_GPIO_ENABLED 0x4
#define AIC32X4_MFP5_GPIO_DISABLED 0x0
#define AIC32X4_MFP5_GPIO_INPUT 0x8
#define AIC32X4_MFP5_GPIO_OUTPUT 0xc
#define AIC32X4_MFP5_GPIO_OUT_LOW 0x0
#define AIC32X4_MFP5_GPIO_OUT_HIGH 0x1
struct aic32x4_setup_data {
unsigned int gpio_func[5];
};
struct aic32x4_pdata { struct aic32x4_pdata {
struct aic32x4_setup_data *setup;
u32 power_cfg; u32 power_cfg;
u32 micpga_routing; u32 micpga_routing;
bool swapdacs; bool swapdacs;

View File

@ -163,8 +163,71 @@
* *
* %SKL_TKN_U32_DMA_BUF_SIZE: DMA buffer size in millisec * %SKL_TKN_U32_DMA_BUF_SIZE: DMA buffer size in millisec
* *
* %SKL_TKN_U32_PIPE_DIR: Specifies pipe direction. Can be
* playback/capture.
*
* %SKL_TKN_U32_NUM_CONFIGS: Number of pipe configs
*
* %SKL_TKN_U32_PATH_MEM_PGS: Size of memory (in pages) required for pipeline
* and its data
*
* %SKL_TKN_U32_PIPE_CONFIG_ID: Config id for the modules in the pipe
* and PCM params supported by that pipe
* config. This is used as index to fill
* up the pipe config and module config
* structure.
*
* %SKL_TKN_U32_CFG_FREQ:
* %SKL_TKN_U8_CFG_CHAN:
* %SKL_TKN_U8_CFG_BPS: PCM params (freq, channels, bits per sample)
* supported for each of the pipe configs.
*
* %SKL_TKN_CFG_MOD_RES_ID: Module's resource index for each of the
* pipe config
*
* %SKL_TKN_CFG_MOD_FMT_ID: Module's interface index for each of the
* pipe config
*
* %SKL_TKN_U8_NUM_MOD: Number of modules in the manifest
*
* %SKL_TKN_MM_U8_MOD_IDX: Current index of the module in the manifest
*
* %SKL_TKN_MM_U8_NUM_RES: Number of resources for the module
*
* %SKL_TKN_MM_U8_NUM_INTF: Number of interfaces for the module
*
* %SKL_TKN_MM_U32_RES_ID: Resource index for the resource info to
* be filled into.
* A module can support multiple resource
* configuration and is represnted as a
* resource table. This index is used to
* fill information into appropriate index.
*
* %SKL_TKN_MM_U32_CPS: DSP cycles per second
*
* %SKL_TKN_MM_U32_DMA_SIZE: Allocated buffer size for gateway DMA
*
* %SKL_TKN_MM_U32_CPC: DSP cycles allocated per frame
*
* %SKL_TKN_MM_U32_RES_PIN_ID: Resource pin index in the module
*
* %SKL_TKN_MM_U32_INTF_PIN_ID: Interface index in the module
*
* %SKL_TKN_MM_U32_PIN_BUF: Buffer size of the module pin
*
* %SKL_TKN_MM_U32_FMT_ID: Format index for each of the interface/
* format information to be filled into.
*
* %SKL_TKN_MM_U32_NUM_IN_FMT: Number of input formats
* %SKL_TKN_MM_U32_NUM_OUT_FMT: Number of output formats
*
* module_id and loadable flags dont have tokens as these values will be * module_id and loadable flags dont have tokens as these values will be
* read from the DSP FW manifest * read from the DSP FW manifest
*
* Tokens defined can be used either in the manifest or widget private data.
*
* SKL_TKN_MM is used as a suffix for all tokens that represent
* module data in the manifest.
*/ */
enum SKL_TKNS { enum SKL_TKNS {
SKL_TKN_UUID = 1, SKL_TKN_UUID = 1,
@ -218,7 +281,34 @@ enum SKL_TKNS {
SKL_TKL_U32_D0I3_CAPS, /* Typo added at v4.10 */ SKL_TKL_U32_D0I3_CAPS, /* Typo added at v4.10 */
SKL_TKN_U32_D0I3_CAPS = SKL_TKL_U32_D0I3_CAPS, SKL_TKN_U32_D0I3_CAPS = SKL_TKL_U32_D0I3_CAPS,
SKL_TKN_U32_DMA_BUF_SIZE, SKL_TKN_U32_DMA_BUF_SIZE,
SKL_TKN_MAX = SKL_TKN_U32_DMA_BUF_SIZE,
SKL_TKN_U32_PIPE_DIRECTION,
SKL_TKN_U32_PIPE_CONFIG_ID,
SKL_TKN_U32_NUM_CONFIGS,
SKL_TKN_U32_PATH_MEM_PGS,
SKL_TKN_U32_CFG_FREQ,
SKL_TKN_U8_CFG_CHAN,
SKL_TKN_U8_CFG_BPS,
SKL_TKN_CFG_MOD_RES_ID,
SKL_TKN_CFG_MOD_FMT_ID,
SKL_TKN_U8_NUM_MOD,
SKL_TKN_MM_U8_MOD_IDX,
SKL_TKN_MM_U8_NUM_RES,
SKL_TKN_MM_U8_NUM_INTF,
SKL_TKN_MM_U32_RES_ID,
SKL_TKN_MM_U32_CPS,
SKL_TKN_MM_U32_DMA_SIZE,
SKL_TKN_MM_U32_CPC,
SKL_TKN_MM_U32_RES_PIN_ID,
SKL_TKN_MM_U32_INTF_PIN_ID,
SKL_TKN_MM_U32_PIN_BUF,
SKL_TKN_MM_U32_FMT_ID,
SKL_TKN_MM_U32_NUM_IN_FMT,
SKL_TKN_MM_U32_NUM_OUT_FMT,
SKL_TKN_MAX = SKL_TKN_MM_U32_NUM_OUT_FMT,
}; };
#endif #endif

View File

@ -167,7 +167,7 @@ static int onyx_snd_vol_put(struct snd_kcontrol *kcontrol,
return 1; return 1;
} }
static struct snd_kcontrol_new volume_control = { static const struct snd_kcontrol_new volume_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume", .name = "Master Playback Volume",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE, .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@ -229,7 +229,7 @@ static int onyx_snd_inputgain_put(struct snd_kcontrol *kcontrol,
return n != v; return n != v;
} }
static struct snd_kcontrol_new inputgain_control = { static const struct snd_kcontrol_new inputgain_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Capture Volume", .name = "Master Capture Volume",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE, .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@ -284,7 +284,7 @@ static int onyx_snd_capture_source_put(struct snd_kcontrol *kcontrol,
return 1; return 1;
} }
static struct snd_kcontrol_new capture_source_control = { static const struct snd_kcontrol_new capture_source_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
/* If we name this 'Input Source', it properly shows up in /* If we name this 'Input Source', it properly shows up in
* alsamixer as a selection, * but it's shown under the * alsamixer as a selection, * but it's shown under the
@ -348,7 +348,7 @@ static int onyx_snd_mute_put(struct snd_kcontrol *kcontrol,
return !err ? (v != c) : err; return !err ? (v != c) : err;
} }
static struct snd_kcontrol_new mute_control = { static const struct snd_kcontrol_new mute_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Switch", .name = "Master Playback Switch",
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE, .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@ -476,7 +476,7 @@ static int onyx_spdif_mask_get(struct snd_kcontrol *kcontrol,
return 0; return 0;
} }
static struct snd_kcontrol_new onyx_spdif_mask = { static const struct snd_kcontrol_new onyx_spdif_mask = {
.access = SNDRV_CTL_ELEM_ACCESS_READ, .access = SNDRV_CTL_ELEM_ACCESS_READ,
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
@ -533,7 +533,7 @@ static int onyx_spdif_put(struct snd_kcontrol *kcontrol,
return 1; return 1;
} }
static struct snd_kcontrol_new onyx_spdif_ctrl = { static const struct snd_kcontrol_new onyx_spdif_ctrl = {
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE, .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),

View File

@ -905,8 +905,8 @@ static int tas_i2c_probe(struct i2c_client *client,
goto fail; goto fail;
} }
printk(KERN_DEBUG printk(KERN_DEBUG
"snd-aoa-codec-tas: tas found, addr 0x%02x on %s\n", "snd-aoa-codec-tas: tas found, addr 0x%02x on %pOF\n",
(unsigned int)client->addr, node->full_name); (unsigned int)client->addr, node);
return 0; return 0;
fail: fail:
mutex_destroy(&tas->mtx); mutex_destroy(&tas->mtx);

View File

@ -778,7 +778,7 @@ static snd_pcm_uframes_t i2sbus_playback_pointer(struct snd_pcm_substream
return i2sbus_pcm_pointer(i2sdev, 0); return i2sbus_pcm_pointer(i2sdev, 0);
} }
static struct snd_pcm_ops i2sbus_playback_ops = { static const struct snd_pcm_ops i2sbus_playback_ops = {
.open = i2sbus_playback_open, .open = i2sbus_playback_open,
.close = i2sbus_playback_close, .close = i2sbus_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -848,7 +848,7 @@ static snd_pcm_uframes_t i2sbus_record_pointer(struct snd_pcm_substream
return i2sbus_pcm_pointer(i2sdev, 1); return i2sbus_pcm_pointer(i2sdev, 1);
} }
static struct snd_pcm_ops i2sbus_record_ops = { static const struct snd_pcm_ops i2sbus_record_ops = {
.open = i2sbus_record_open, .open = i2sbus_record_open,
.close = i2sbus_record_close, .close = i2sbus_record_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -348,7 +348,7 @@ static irqreturn_t aaci_irq(int irq, void *devid)
/* /*
* ALSA support. * ALSA support.
*/ */
static struct snd_pcm_hardware aaci_hw_info = { static const struct snd_pcm_hardware aaci_hw_info = {
.info = SNDRV_PCM_INFO_MMAP | .info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
@ -635,7 +635,7 @@ static int aaci_pcm_playback_trigger(struct snd_pcm_substream *substream, int cm
return ret; return ret;
} }
static struct snd_pcm_ops aaci_playback_ops = { static const struct snd_pcm_ops aaci_playback_ops = {
.open = aaci_pcm_open, .open = aaci_pcm_open,
.close = aaci_pcm_close, .close = aaci_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -738,7 +738,7 @@ static int aaci_pcm_capture_prepare(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static struct snd_pcm_ops aaci_capture_ops = { static const struct snd_pcm_ops aaci_capture_ops = {
.open = aaci_pcm_open, .open = aaci_pcm_open,
.close = aaci_pcm_close, .close = aaci_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -786,7 +786,7 @@ static SIMPLE_DEV_PM_OPS(aaci_dev_pm_ops, aaci_suspend, aaci_resume);
#endif #endif
static struct ac97_pcm ac97_defs[] = { static const struct ac97_pcm ac97_defs[] = {
[0] = { /* Front PCM */ [0] = { /* Front PCM */
.exclusive = 1, .exclusive = 1,
.r = { .r = {

View File

@ -68,7 +68,7 @@ static int pxa2xx_pcm_close(struct snd_pcm_substream *substream)
return __pxa2xx_pcm_close(substream); return __pxa2xx_pcm_close(substream);
} }
static struct snd_pcm_ops pxa2xx_pcm_ops = { static const struct snd_pcm_ops pxa2xx_pcm_ops = {
.open = pxa2xx_pcm_open, .open = pxa2xx_pcm_open,
.close = pxa2xx_pcm_close, .close = pxa2xx_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -12,16 +12,15 @@
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/atmel_pdc.h> #include <linux/atmel_pdc.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/gpio.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <sound/core.h> #include <sound/core.h>
@ -29,7 +28,6 @@
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
#include <sound/ac97_codec.h> #include <sound/ac97_codec.h>
#include <sound/atmel-ac97c.h>
#include <sound/memalloc.h> #include <sound/memalloc.h>
#include "ac97c.h" #include "ac97c.h"
@ -56,7 +54,7 @@ struct atmel_ac97c {
void __iomem *regs; void __iomem *regs;
int irq; int irq;
int opened; int opened;
int reset_pin; struct gpio_desc *reset_pin;
}; };
#define get_chip(card) ((struct atmel_ac97c *)(card)->private_data) #define get_chip(card) ((struct atmel_ac97c *)(card)->private_data)
@ -66,7 +64,7 @@ struct atmel_ac97c {
#define ac97c_readl(chip, reg) \ #define ac97c_readl(chip, reg) \
__raw_readl((chip)->regs + AC97C_##reg) __raw_readl((chip)->regs + AC97C_##reg)
static struct snd_pcm_hardware atmel_ac97c_hw = { static const struct snd_pcm_hardware atmel_ac97c_hw = {
.info = (SNDRV_PCM_INFO_MMAP .info = (SNDRV_PCM_INFO_MMAP
| SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID
| SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED
@ -461,7 +459,7 @@ atmel_ac97c_capture_pointer(struct snd_pcm_substream *substream)
return frames; return frames;
} }
static struct snd_pcm_ops atmel_ac97_playback_ops = { static const struct snd_pcm_ops atmel_ac97_playback_ops = {
.open = atmel_ac97c_playback_open, .open = atmel_ac97c_playback_open,
.close = atmel_ac97c_playback_close, .close = atmel_ac97c_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -472,7 +470,7 @@ static struct snd_pcm_ops atmel_ac97_playback_ops = {
.pointer = atmel_ac97c_playback_pointer, .pointer = atmel_ac97c_playback_pointer,
}; };
static struct snd_pcm_ops atmel_ac97_capture_ops = { static const struct snd_pcm_ops atmel_ac97_capture_ops = {
.open = atmel_ac97c_capture_open, .open = atmel_ac97c_capture_open,
.close = atmel_ac97c_capture_close, .close = atmel_ac97c_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -558,7 +556,7 @@ static irqreturn_t atmel_ac97c_interrupt(int irq, void *dev)
return retval; return retval;
} }
static struct ac97_pcm at91_ac97_pcm_defs[] = { static const struct ac97_pcm at91_ac97_pcm_defs[] = {
/* Playback */ /* Playback */
{ {
.exclusive = 1, .exclusive = 1,
@ -700,11 +698,11 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip)
ac97c_writel(chip, CAMR, 0); ac97c_writel(chip, CAMR, 0);
ac97c_writel(chip, COMR, 0); ac97c_writel(chip, COMR, 0);
if (gpio_is_valid(chip->reset_pin)) { if (!IS_ERR(chip->reset_pin)) {
gpio_set_value(chip->reset_pin, 0); gpiod_set_value(chip->reset_pin, 0);
/* AC97 v2.2 specifications says minimum 1 us. */ /* AC97 v2.2 specifications says minimum 1 us. */
udelay(2); udelay(2);
gpio_set_value(chip->reset_pin, 1); gpiod_set_value(chip->reset_pin, 1);
} else { } else {
ac97c_writel(chip, MR, AC97C_MR_WRST | AC97C_MR_ENA); ac97c_writel(chip, MR, AC97C_MR_WRST | AC97C_MR_ENA);
udelay(2); udelay(2);
@ -712,45 +710,18 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip)
} }
} }
#ifdef CONFIG_OF
static const struct of_device_id atmel_ac97c_dt_ids[] = { static const struct of_device_id atmel_ac97c_dt_ids[] = {
{ .compatible = "atmel,at91sam9263-ac97c", }, { .compatible = "atmel,at91sam9263-ac97c", },
{ } { }
}; };
MODULE_DEVICE_TABLE(of, atmel_ac97c_dt_ids); MODULE_DEVICE_TABLE(of, atmel_ac97c_dt_ids);
static struct ac97c_platform_data *atmel_ac97c_probe_dt(struct device *dev)
{
struct ac97c_platform_data *pdata;
struct device_node *node = dev->of_node;
if (!node) {
dev_err(dev, "Device does not have associated DT data\n");
return ERR_PTR(-EINVAL);
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
return ERR_PTR(-ENOMEM);
pdata->reset_pin = of_get_named_gpio(dev->of_node, "ac97-gpios", 2);
return pdata;
}
#else
static struct ac97c_platform_data *atmel_ac97c_probe_dt(struct device *dev)
{
dev_err(dev, "no platform data defined\n");
return ERR_PTR(-ENXIO);
}
#endif
static int atmel_ac97c_probe(struct platform_device *pdev) static int atmel_ac97c_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
struct snd_card *card; struct snd_card *card;
struct atmel_ac97c *chip; struct atmel_ac97c *chip;
struct resource *regs; struct resource *regs;
struct ac97c_platform_data *pdata;
struct clk *pclk; struct clk *pclk;
static struct snd_ac97_bus_ops ops = { static struct snd_ac97_bus_ops ops = {
.write = atmel_ac97c_write, .write = atmel_ac97c_write,
@ -765,13 +736,6 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
return -ENXIO; return -ENXIO;
} }
pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
pdata = atmel_ac97c_probe_dt(&pdev->dev);
if (IS_ERR(pdata))
return PTR_ERR(pdata);
}
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_dbg(&pdev->dev, "could not get irq: %d\n", irq); dev_dbg(&pdev->dev, "could not get irq: %d\n", irq);
@ -783,7 +747,9 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "no peripheral clock\n"); dev_dbg(&pdev->dev, "no peripheral clock\n");
return PTR_ERR(pclk); return PTR_ERR(pclk);
} }
clk_prepare_enable(pclk); retval = clk_prepare_enable(pclk);
if (retval)
goto err_prepare_enable;
retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, retval = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1,
SNDRV_DEFAULT_STR1, THIS_MODULE, SNDRV_DEFAULT_STR1, THIS_MODULE,
@ -819,17 +785,9 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
goto err_ioremap; goto err_ioremap;
} }
if (gpio_is_valid(pdata->reset_pin)) { chip->reset_pin = devm_gpiod_get_index(dev, "ac97", 2, GPIOD_OUT_HIGH);
if (gpio_request(pdata->reset_pin, "reset_pin")) { if (IS_ERR(chip->reset_pin))
dev_dbg(&pdev->dev, "reset pin not available\n"); dev_dbg(dev, "reset pin not available\n");
chip->reset_pin = -ENODEV;
} else {
gpio_direction_output(pdata->reset_pin, 1);
chip->reset_pin = pdata->reset_pin;
}
} else {
chip->reset_pin = -EINVAL;
}
atmel_ac97c_reset(chip); atmel_ac97c_reset(chip);
@ -869,9 +827,6 @@ static int atmel_ac97c_probe(struct platform_device *pdev)
return 0; return 0;
err_ac97_bus: err_ac97_bus:
if (gpio_is_valid(chip->reset_pin))
gpio_free(chip->reset_pin);
iounmap(chip->regs); iounmap(chip->regs);
err_ioremap: err_ioremap:
free_irq(irq, chip); free_irq(irq, chip);
@ -879,6 +834,7 @@ err_request_irq:
snd_card_free(card); snd_card_free(card);
err_snd_card_new: err_snd_card_new:
clk_disable_unprepare(pclk); clk_disable_unprepare(pclk);
err_prepare_enable:
clk_put(pclk); clk_put(pclk);
return retval; return retval;
} }
@ -897,9 +853,9 @@ static int atmel_ac97c_resume(struct device *pdev)
{ {
struct snd_card *card = dev_get_drvdata(pdev); struct snd_card *card = dev_get_drvdata(pdev);
struct atmel_ac97c *chip = card->private_data; struct atmel_ac97c *chip = card->private_data;
int ret = clk_prepare_enable(chip->pclk);
clk_prepare_enable(chip->pclk); return ret;
return 0;
} }
static SIMPLE_DEV_PM_OPS(atmel_ac97c_pm, atmel_ac97c_suspend, atmel_ac97c_resume); static SIMPLE_DEV_PM_OPS(atmel_ac97c_pm, atmel_ac97c_suspend, atmel_ac97c_resume);
@ -913,9 +869,6 @@ static int atmel_ac97c_remove(struct platform_device *pdev)
struct snd_card *card = platform_get_drvdata(pdev); struct snd_card *card = platform_get_drvdata(pdev);
struct atmel_ac97c *chip = get_chip(card); struct atmel_ac97c *chip = get_chip(card);
if (gpio_is_valid(chip->reset_pin))
gpio_free(chip->reset_pin);
ac97c_writel(chip, CAMR, 0); ac97c_writel(chip, CAMR, 0);
ac97c_writel(chip, COMR, 0); ac97c_writel(chip, COMR, 0);
ac97c_writel(chip, MR, 0); ac97c_writel(chip, MR, 0);
@ -936,7 +889,7 @@ static struct platform_driver atmel_ac97c_driver = {
.driver = { .driver = {
.name = "atmel_ac97c", .name = "atmel_ac97c",
.pm = ATMEL_AC97C_PM_OPS, .pm = ATMEL_AC97C_PM_OPS,
.of_match_table = of_match_ptr(atmel_ac97c_dt_ids), .of_match_table = atmel_ac97c_dt_ids,
}, },
}; };
module_platform_driver(atmel_ac97c_driver); module_platform_driver(atmel_ac97c_driver);

View File

@ -864,14 +864,14 @@ static int snd_ctl_elem_info_user(struct snd_ctl_file *ctl,
if (copy_from_user(&info, _info, sizeof(info))) if (copy_from_user(&info, _info, sizeof(info)))
return -EFAULT; return -EFAULT;
snd_power_lock(ctl->card);
result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); result = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0);
if (result >= 0) if (result < 0)
result = snd_ctl_elem_info(ctl, &info); return result;
snd_power_unlock(ctl->card); result = snd_ctl_elem_info(ctl, &info);
if (result >= 0) if (result < 0)
if (copy_to_user(_info, &info, sizeof(info))) return result;
return -EFAULT; if (copy_to_user(_info, &info, sizeof(info)))
return -EFAULT;
return result; return result;
} }
@ -881,24 +881,18 @@ static int snd_ctl_elem_read(struct snd_card *card,
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
struct snd_kcontrol_volatile *vd; struct snd_kcontrol_volatile *vd;
unsigned int index_offset; unsigned int index_offset;
int result;
down_read(&card->controls_rwsem);
kctl = snd_ctl_find_id(card, &control->id); kctl = snd_ctl_find_id(card, &control->id);
if (kctl == NULL) { if (kctl == NULL)
result = -ENOENT; return -ENOENT;
} else {
index_offset = snd_ctl_get_ioff(kctl, &control->id); index_offset = snd_ctl_get_ioff(kctl, &control->id);
vd = &kctl->vd[index_offset]; vd = &kctl->vd[index_offset];
if ((vd->access & SNDRV_CTL_ELEM_ACCESS_READ) && if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_READ) && kctl->get == NULL)
kctl->get != NULL) { return -EPERM;
snd_ctl_build_ioff(&control->id, kctl, index_offset);
result = kctl->get(kctl, control); snd_ctl_build_ioff(&control->id, kctl, index_offset);
} else return kctl->get(kctl, control);
result = -EPERM;
}
up_read(&card->controls_rwsem);
return result;
} }
static int snd_ctl_elem_read_user(struct snd_card *card, static int snd_ctl_elem_read_user(struct snd_card *card,
@ -911,14 +905,19 @@ static int snd_ctl_elem_read_user(struct snd_card *card,
if (IS_ERR(control)) if (IS_ERR(control))
return PTR_ERR(control); return PTR_ERR(control);
snd_power_lock(card);
result = snd_power_wait(card, SNDRV_CTL_POWER_D0); result = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (result >= 0) if (result < 0)
result = snd_ctl_elem_read(card, control); goto error;
snd_power_unlock(card);
if (result >= 0) down_read(&card->controls_rwsem);
if (copy_to_user(_control, control, sizeof(*control))) result = snd_ctl_elem_read(card, control);
result = -EFAULT; up_read(&card->controls_rwsem);
if (result < 0)
goto error;
if (copy_to_user(_control, control, sizeof(*control)))
result = -EFAULT;
error:
kfree(control); kfree(control);
return result; return result;
} }
@ -931,30 +930,28 @@ static int snd_ctl_elem_write(struct snd_card *card, struct snd_ctl_file *file,
unsigned int index_offset; unsigned int index_offset;
int result; int result;
down_read(&card->controls_rwsem);
kctl = snd_ctl_find_id(card, &control->id); kctl = snd_ctl_find_id(card, &control->id);
if (kctl == NULL) { if (kctl == NULL)
result = -ENOENT; return -ENOENT;
} else {
index_offset = snd_ctl_get_ioff(kctl, &control->id); index_offset = snd_ctl_get_ioff(kctl, &control->id);
vd = &kctl->vd[index_offset]; vd = &kctl->vd[index_offset];
if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || kctl->put == NULL ||
kctl->put == NULL || (file && vd->owner && vd->owner != file)) {
(file && vd->owner && vd->owner != file)) { return -EPERM;
result = -EPERM;
} else {
snd_ctl_build_ioff(&control->id, kctl, index_offset);
result = kctl->put(kctl, control);
}
if (result > 0) {
struct snd_ctl_elem_id id = control->id;
up_read(&card->controls_rwsem);
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &id);
return 0;
}
} }
up_read(&card->controls_rwsem);
return result; snd_ctl_build_ioff(&control->id, kctl, index_offset);
result = kctl->put(kctl, control);
if (result < 0)
return result;
if (result > 0) {
struct snd_ctl_elem_id id = control->id;
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &id);
}
return 0;
} }
static int snd_ctl_elem_write_user(struct snd_ctl_file *file, static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
@ -969,14 +966,19 @@ static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
return PTR_ERR(control); return PTR_ERR(control);
card = file->card; card = file->card;
snd_power_lock(card);
result = snd_power_wait(card, SNDRV_CTL_POWER_D0); result = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (result >= 0) if (result < 0)
result = snd_ctl_elem_write(card, file, control); goto error;
snd_power_unlock(card);
if (result >= 0) down_write(&card->controls_rwsem);
if (copy_to_user(_control, control, sizeof(*control))) result = snd_ctl_elem_write(card, file, control);
result = -EFAULT; up_write(&card->controls_rwsem);
if (result < 0)
goto error;
if (copy_to_user(_control, control, sizeof(*control)))
result = -EFAULT;
error:
kfree(control); kfree(control);
return result; return result;
} }
@ -1095,9 +1097,7 @@ static int snd_ctl_elem_user_get(struct snd_kcontrol *kcontrol,
char *src = ue->elem_data + char *src = ue->elem_data +
snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size; snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
mutex_lock(&ue->card->user_ctl_lock);
memcpy(&ucontrol->value, src, size); memcpy(&ucontrol->value, src, size);
mutex_unlock(&ue->card->user_ctl_lock);
return 0; return 0;
} }
@ -1110,60 +1110,83 @@ static int snd_ctl_elem_user_put(struct snd_kcontrol *kcontrol,
char *dst = ue->elem_data + char *dst = ue->elem_data +
snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size; snd_ctl_get_ioff(kcontrol, &ucontrol->id) * size;
mutex_lock(&ue->card->user_ctl_lock);
change = memcmp(&ucontrol->value, dst, size) != 0; change = memcmp(&ucontrol->value, dst, size) != 0;
if (change) if (change)
memcpy(dst, &ucontrol->value, size); memcpy(dst, &ucontrol->value, size);
mutex_unlock(&ue->card->user_ctl_lock);
return change; return change;
} }
static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, static int replace_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf,
int op_flag, unsigned int size)
unsigned int size,
unsigned int __user *tlv)
{ {
struct user_element *ue = kcontrol->private_data; struct user_element *ue = kctl->private_data;
int change = 0; unsigned int *container;
void *new_data; struct snd_ctl_elem_id id;
unsigned int mask = 0;
int i;
int change;
if (op_flag == SNDRV_CTL_TLV_OP_WRITE) { if (size > 1024 * 128) /* sane value */
if (size > 1024 * 128) /* sane value */ return -EINVAL;
return -EINVAL;
new_data = memdup_user(tlv, size); container = memdup_user(buf, size);
if (IS_ERR(new_data)) if (IS_ERR(container))
return PTR_ERR(new_data); return PTR_ERR(container);
mutex_lock(&ue->card->user_ctl_lock);
change = ue->tlv_data_size != size;
if (!change)
change = memcmp(ue->tlv_data, new_data, size) != 0;
kfree(ue->tlv_data);
ue->tlv_data = new_data;
ue->tlv_data_size = size;
mutex_unlock(&ue->card->user_ctl_lock);
} else {
int ret = 0;
mutex_lock(&ue->card->user_ctl_lock); change = ue->tlv_data_size != size;
if (!ue->tlv_data_size || !ue->tlv_data) { if (!change)
ret = -ENXIO; change = memcmp(ue->tlv_data, container, size) != 0;
goto err_unlock; if (!change) {
} kfree(container);
if (size < ue->tlv_data_size) { return 0;
ret = -ENOSPC;
goto err_unlock;
}
if (copy_to_user(tlv, ue->tlv_data, ue->tlv_data_size))
ret = -EFAULT;
err_unlock:
mutex_unlock(&ue->card->user_ctl_lock);
if (ret)
return ret;
} }
if (ue->tlv_data == NULL) {
/* Now TLV data is available. */
for (i = 0; i < kctl->count; ++i)
kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
mask = SNDRV_CTL_EVENT_MASK_INFO;
}
kfree(ue->tlv_data);
ue->tlv_data = container;
ue->tlv_data_size = size;
mask |= SNDRV_CTL_EVENT_MASK_TLV;
for (i = 0; i < kctl->count; ++i) {
snd_ctl_build_ioff(&id, kctl, i);
snd_ctl_notify(ue->card, mask, &id);
}
return change; return change;
} }
static int read_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf,
unsigned int size)
{
struct user_element *ue = kctl->private_data;
if (ue->tlv_data_size == 0 || ue->tlv_data == NULL)
return -ENXIO;
if (size < ue->tlv_data_size)
return -ENOSPC;
if (copy_to_user(buf, ue->tlv_data, ue->tlv_data_size))
return -EFAULT;
return 0;
}
static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kctl, int op_flag,
unsigned int size, unsigned int __user *buf)
{
if (op_flag == SNDRV_CTL_TLV_OP_WRITE)
return replace_user_tlv(kctl, buf, size);
else
return read_user_tlv(kctl, buf, size);
}
static int snd_ctl_elem_init_enum_names(struct user_element *ue) static int snd_ctl_elem_init_enum_names(struct user_element *ue)
{ {
char *names, *p; char *names, *p;
@ -1267,8 +1290,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
access = SNDRV_CTL_ELEM_ACCESS_READWRITE; access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
access &= (SNDRV_CTL_ELEM_ACCESS_READWRITE | access &= (SNDRV_CTL_ELEM_ACCESS_READWRITE |
SNDRV_CTL_ELEM_ACCESS_INACTIVE | SNDRV_CTL_ELEM_ACCESS_INACTIVE |
SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE); SNDRV_CTL_ELEM_ACCESS_TLV_WRITE);
if (access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)
/* In initial state, nothing is available as TLV container. */
if (access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
access |= SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; access |= SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
access |= SNDRV_CTL_ELEM_ACCESS_USER; access |= SNDRV_CTL_ELEM_ACCESS_USER;
@ -1331,7 +1356,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
kctl->get = snd_ctl_elem_user_get; kctl->get = snd_ctl_elem_user_get;
if (access & SNDRV_CTL_ELEM_ACCESS_WRITE) if (access & SNDRV_CTL_ELEM_ACCESS_WRITE)
kctl->put = snd_ctl_elem_user_put; kctl->put = snd_ctl_elem_user_put;
if (access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) if (access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE)
kctl->tlv.c = snd_ctl_elem_user_tlv; kctl->tlv.c = snd_ctl_elem_user_tlv;
/* This function manage to free the instance on failure. */ /* This function manage to free the instance on failure. */
@ -1405,71 +1430,107 @@ static int snd_ctl_subscribe_events(struct snd_ctl_file *file, int __user *ptr)
return 0; return 0;
} }
static int call_tlv_handler(struct snd_ctl_file *file, int op_flag,
struct snd_kcontrol *kctl,
struct snd_ctl_elem_id *id,
unsigned int __user *buf, unsigned int size)
{
static const struct {
int op;
int perm;
} pairs[] = {
{SNDRV_CTL_TLV_OP_READ, SNDRV_CTL_ELEM_ACCESS_TLV_READ},
{SNDRV_CTL_TLV_OP_WRITE, SNDRV_CTL_ELEM_ACCESS_TLV_WRITE},
{SNDRV_CTL_TLV_OP_CMD, SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND},
};
struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)];
int i;
/* Check support of the request for this element. */
for (i = 0; i < ARRAY_SIZE(pairs); ++i) {
if (op_flag == pairs[i].op && (vd->access & pairs[i].perm))
break;
}
if (i == ARRAY_SIZE(pairs))
return -ENXIO;
if (kctl->tlv.c == NULL)
return -ENXIO;
/* When locked, this is unavailable. */
if (vd->owner != NULL && vd->owner != file)
return -EPERM;
return kctl->tlv.c(kctl, op_flag, size, buf);
}
static int read_tlv_buf(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id,
unsigned int __user *buf, unsigned int size)
{
struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)];
unsigned int len;
if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ))
return -ENXIO;
if (kctl->tlv.p == NULL)
return -ENXIO;
len = sizeof(unsigned int) * 2 + kctl->tlv.p[1];
if (size < len)
return -ENOMEM;
if (copy_to_user(buf, kctl->tlv.p, len))
return -EFAULT;
return 0;
}
static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
struct snd_ctl_tlv __user *_tlv, struct snd_ctl_tlv __user *buf,
int op_flag) int op_flag)
{ {
struct snd_card *card = file->card; struct snd_ctl_tlv header;
struct snd_ctl_tlv tlv; unsigned int *container;
unsigned int container_size;
struct snd_kcontrol *kctl; struct snd_kcontrol *kctl;
struct snd_ctl_elem_id id;
struct snd_kcontrol_volatile *vd; struct snd_kcontrol_volatile *vd;
unsigned int len;
int err = 0;
if (copy_from_user(&tlv, _tlv, sizeof(tlv))) if (copy_from_user(&header, buf, sizeof(header)))
return -EFAULT; return -EFAULT;
if (tlv.length < sizeof(unsigned int) * 2)
/* In design of control core, numerical ID starts at 1. */
if (header.numid == 0)
return -EINVAL; return -EINVAL;
if (!tlv.numid)
/* At least, container should include type and length fields. */
if (header.length < sizeof(unsigned int) * 2)
return -EINVAL; return -EINVAL;
down_read(&card->controls_rwsem); container_size = header.length;
kctl = snd_ctl_find_numid(card, tlv.numid); container = buf->tlv;
if (kctl == NULL) {
err = -ENOENT; kctl = snd_ctl_find_numid(file->card, header.numid);
goto __kctl_end; if (kctl == NULL)
} return -ENOENT;
if (kctl->tlv.p == NULL) {
err = -ENXIO; /* Calculate index of the element in this set. */
goto __kctl_end; id = kctl->id;
} snd_ctl_build_ioff(&id, kctl, header.numid - id.numid);
vd = &kctl->vd[tlv.numid - kctl->id.numid]; vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
if ((op_flag == SNDRV_CTL_TLV_OP_READ &&
(vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) ||
(op_flag == SNDRV_CTL_TLV_OP_WRITE &&
(vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) ||
(op_flag == SNDRV_CTL_TLV_OP_CMD &&
(vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) {
err = -ENXIO;
goto __kctl_end;
}
if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) { if (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
if (vd->owner != NULL && vd->owner != file) { return call_tlv_handler(file, op_flag, kctl, &id, container,
err = -EPERM; container_size);
goto __kctl_end;
}
err = kctl->tlv.c(kctl, op_flag, tlv.length, _tlv->tlv);
if (err > 0) {
struct snd_ctl_elem_id id = kctl->id;
up_read(&card->controls_rwsem);
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_TLV, &id);
return 0;
}
} else { } else {
if (op_flag != SNDRV_CTL_TLV_OP_READ) { if (op_flag == SNDRV_CTL_TLV_OP_READ) {
err = -ENXIO; return read_tlv_buf(kctl, &id, container,
goto __kctl_end; container_size);
} }
len = kctl->tlv.p[1] + 2 * sizeof(unsigned int);
if (tlv.length < len) {
err = -ENOMEM;
goto __kctl_end;
}
if (copy_to_user(_tlv->tlv, kctl->tlv.p, len))
err = -EFAULT;
} }
__kctl_end:
up_read(&card->controls_rwsem); /* Not supported. */
return err; return -ENXIO;
} }
static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@ -1511,11 +1572,20 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg
case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS: case SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS:
return snd_ctl_subscribe_events(ctl, ip); return snd_ctl_subscribe_events(ctl, ip);
case SNDRV_CTL_IOCTL_TLV_READ: case SNDRV_CTL_IOCTL_TLV_READ:
return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ); down_read(&ctl->card->controls_rwsem);
err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_READ);
up_read(&ctl->card->controls_rwsem);
return err;
case SNDRV_CTL_IOCTL_TLV_WRITE: case SNDRV_CTL_IOCTL_TLV_WRITE:
return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE); down_write(&ctl->card->controls_rwsem);
err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_WRITE);
up_write(&ctl->card->controls_rwsem);
return err;
case SNDRV_CTL_IOCTL_TLV_COMMAND: case SNDRV_CTL_IOCTL_TLV_COMMAND:
return snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD); down_write(&ctl->card->controls_rwsem);
err = snd_ctl_tlv_ioctl(ctl, argp, SNDRV_CTL_TLV_OP_CMD);
up_write(&ctl->card->controls_rwsem);
return err;
case SNDRV_CTL_IOCTL_POWER: case SNDRV_CTL_IOCTL_POWER:
return -ENOPROTOOPT; return -ENOPROTOOPT;
case SNDRV_CTL_IOCTL_POWER_STATE: case SNDRV_CTL_IOCTL_POWER_STATE:

View File

@ -111,12 +111,10 @@ static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl,
if (get_user(data->value.enumerated.item, &data32->value.enumerated.item)) if (get_user(data->value.enumerated.item, &data32->value.enumerated.item))
goto error; goto error;
snd_power_lock(ctl->card);
err = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0); err = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0);
if (err >= 0) if (err < 0)
err = snd_ctl_elem_info(ctl, data); goto error;
snd_power_unlock(ctl->card); err = snd_ctl_elem_info(ctl, data);
if (err < 0) if (err < 0)
goto error; goto error;
/* restore info to 32bit */ /* restore info to 32bit */
@ -315,14 +313,13 @@ static int ctl_elem_read_user(struct snd_card *card,
if (err < 0) if (err < 0)
goto error; goto error;
snd_power_lock(card);
err = snd_power_wait(card, SNDRV_CTL_POWER_D0); err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (err >= 0) if (err < 0)
err = snd_ctl_elem_read(card, data); goto error;
snd_power_unlock(card); err = snd_ctl_elem_read(card, data);
if (err >= 0) if (err < 0)
err = copy_ctl_value_to_user(userdata, valuep, data, goto error;
type, count); err = copy_ctl_value_to_user(userdata, valuep, data, type, count);
error: error:
kfree(data); kfree(data);
return err; return err;
@ -344,14 +341,13 @@ static int ctl_elem_write_user(struct snd_ctl_file *file,
if (err < 0) if (err < 0)
goto error; goto error;
snd_power_lock(card);
err = snd_power_wait(card, SNDRV_CTL_POWER_D0); err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (err >= 0) if (err < 0)
err = snd_ctl_elem_write(card, file, data); goto error;
snd_power_unlock(card); err = snd_ctl_elem_write(card, file, data);
if (err >= 0) if (err < 0)
err = copy_ctl_value_to_user(userdata, valuep, data, goto error;
type, count); err = copy_ctl_value_to_user(userdata, valuep, data, type, count);
error: error:
kfree(data); kfree(data);
return err; return err;

View File

@ -248,13 +248,11 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
INIT_LIST_HEAD(&card->devices); INIT_LIST_HEAD(&card->devices);
init_rwsem(&card->controls_rwsem); init_rwsem(&card->controls_rwsem);
rwlock_init(&card->ctl_files_rwlock); rwlock_init(&card->ctl_files_rwlock);
mutex_init(&card->user_ctl_lock);
INIT_LIST_HEAD(&card->controls); INIT_LIST_HEAD(&card->controls);
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);
#ifdef CONFIG_PM #ifdef CONFIG_PM
mutex_init(&card->power_lock);
init_waitqueue_head(&card->power_sleep); init_waitqueue_head(&card->power_sleep);
#endif #endif
@ -979,8 +977,6 @@ EXPORT_SYMBOL(snd_card_file_remove);
* Waits until the power-state is changed. * Waits until the power-state is changed.
* *
* Return: Zero if successful, or a negative error code. * Return: Zero if successful, or a negative error code.
*
* Note: the power lock must be active before call.
*/ */
int snd_power_wait(struct snd_card *card, unsigned int power_state) int snd_power_wait(struct snd_card *card, unsigned int power_state)
{ {
@ -1000,9 +996,7 @@ int snd_power_wait(struct snd_card *card, unsigned int power_state)
if (snd_power_get_state(card) == power_state) if (snd_power_get_state(card) == power_state)
break; break;
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
snd_power_unlock(card);
schedule_timeout(30 * HZ); schedule_timeout(30 * HZ);
snd_power_lock(card);
} }
remove_wait_queue(&card->power_sleep, &wait); remove_wait_queue(&card->power_sleep, &wait);
return result; return result;

View File

@ -523,7 +523,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
sprintf(name, "pcm%i%c", pcm->device, sprintf(name, "pcm%i%c", pcm->device,
pstr->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c'); pstr->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c');
if ((entry = snd_info_create_card_entry(pcm->card, name, pcm->card->proc_root)) == NULL) entry = snd_info_create_card_entry(pcm->card, name,
pcm->card->proc_root);
if (!entry)
return -ENOMEM; return -ENOMEM;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO; entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
@ -531,8 +533,8 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
return -ENOMEM; return -ENOMEM;
} }
pstr->proc_root = entry; pstr->proc_root = entry;
entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root);
if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) { if (entry) {
snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read); snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry); snd_info_free_entry(entry);
@ -542,8 +544,9 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
pstr->proc_info_entry = entry; pstr->proc_info_entry = entry;
#ifdef CONFIG_SND_PCM_XRUN_DEBUG #ifdef CONFIG_SND_PCM_XRUN_DEBUG
if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug", entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
pstr->proc_root)) != NULL) { pstr->proc_root);
if (entry) {
entry->c.text.read = snd_pcm_xrun_debug_read; entry->c.text.read = snd_pcm_xrun_debug_read;
entry->c.text.write = snd_pcm_xrun_debug_write; entry->c.text.write = snd_pcm_xrun_debug_write;
entry->mode |= S_IWUSR; entry->mode |= S_IWUSR;
@ -580,7 +583,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
card = substream->pcm->card; card = substream->pcm->card;
sprintf(name, "sub%i", substream->number); sprintf(name, "sub%i", substream->number);
if ((entry = snd_info_create_card_entry(card, name, substream->pstr->proc_root)) == NULL) entry = snd_info_create_card_entry(card, name,
substream->pstr->proc_root);
if (!entry)
return -ENOMEM; return -ENOMEM;
entry->mode = S_IFDIR | S_IRUGO | S_IXUGO; entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
@ -588,8 +593,8 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
return -ENOMEM; return -ENOMEM;
} }
substream->proc_root = entry; substream->proc_root = entry;
entry = snd_info_create_card_entry(card, "info", substream->proc_root);
if ((entry = snd_info_create_card_entry(card, "info", substream->proc_root)) != NULL) { if (entry) {
snd_info_set_text_ops(entry, substream, snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_info_read); snd_pcm_substream_proc_info_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
@ -598,8 +603,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
} }
} }
substream->proc_info_entry = entry; substream->proc_info_entry = entry;
entry = snd_info_create_card_entry(card, "hw_params",
if ((entry = snd_info_create_card_entry(card, "hw_params", substream->proc_root)) != NULL) { substream->proc_root);
if (entry) {
snd_info_set_text_ops(entry, substream, snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_hw_params_read); snd_pcm_substream_proc_hw_params_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
@ -608,8 +614,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
} }
} }
substream->proc_hw_params_entry = entry; substream->proc_hw_params_entry = entry;
entry = snd_info_create_card_entry(card, "sw_params",
if ((entry = snd_info_create_card_entry(card, "sw_params", substream->proc_root)) != NULL) { substream->proc_root);
if (entry) {
snd_info_set_text_ops(entry, substream, snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_sw_params_read); snd_pcm_substream_proc_sw_params_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
@ -618,8 +625,9 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
} }
} }
substream->proc_sw_params_entry = entry; substream->proc_sw_params_entry = entry;
entry = snd_info_create_card_entry(card, "status",
if ((entry = snd_info_create_card_entry(card, "status", substream->proc_root)) != NULL) { substream->proc_root);
if (entry) {
snd_info_set_text_ops(entry, substream, snd_info_set_text_ops(entry, substream,
snd_pcm_substream_proc_status_read); snd_pcm_substream_proc_status_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
@ -783,21 +791,27 @@ static int _snd_pcm_new(struct snd_card *card, const char *id, int device,
INIT_LIST_HEAD(&pcm->list); INIT_LIST_HEAD(&pcm->list);
if (id) if (id)
strlcpy(pcm->id, id, sizeof(pcm->id)); strlcpy(pcm->id, id, sizeof(pcm->id));
if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
snd_pcm_free(pcm); err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
return err; playback_count);
} if (err < 0)
if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) { goto free_pcm;
snd_pcm_free(pcm);
return err; err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
} if (err < 0)
if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) { goto free_pcm;
snd_pcm_free(pcm);
return err; err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops);
} if (err < 0)
goto free_pcm;
if (rpcm) if (rpcm)
*rpcm = pcm; *rpcm = pcm;
return 0; return 0;
free_pcm:
snd_pcm_free(pcm);
return err;
} }
/** /**
@ -1224,7 +1238,8 @@ static void snd_pcm_proc_init(void)
{ {
struct snd_info_entry *entry; struct snd_info_entry *entry;
if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) { entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);
if (entry) {
snd_info_set_text_ops(entry, NULL, snd_pcm_proc_read); snd_info_set_text_ops(entry, NULL, snd_pcm_proc_read);
if (snd_info_register(entry) < 0) { if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry); snd_info_free_entry(entry);

View File

@ -689,10 +689,7 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
case SNDRV_PCM_IOCTL_XRUN: case SNDRV_PCM_IOCTL_XRUN:
case SNDRV_PCM_IOCTL_LINK: case SNDRV_PCM_IOCTL_LINK:
case SNDRV_PCM_IOCTL_UNLINK: case SNDRV_PCM_IOCTL_UNLINK:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) return snd_pcm_common_ioctl(file, substream, cmd, argp);
return snd_pcm_playback_ioctl1(file, substream, cmd, argp);
else
return snd_pcm_capture_ioctl1(file, substream, cmd, argp);
case SNDRV_PCM_IOCTL_HW_REFINE32: case SNDRV_PCM_IOCTL_HW_REFINE32:
return snd_pcm_ioctl_hw_params_compat(substream, 1, argp); return snd_pcm_ioctl_hw_params_compat(substream, 1, argp);
case SNDRV_PCM_IOCTL_HW_PARAMS32: case SNDRV_PCM_IOCTL_HW_PARAMS32:

View File

@ -1830,7 +1830,6 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
add_wait_queue(&to_check->sleep, &wait); add_wait_queue(&to_check->sleep, &wait);
snd_pcm_stream_unlock_irq(substream); snd_pcm_stream_unlock_irq(substream);
up_read(&snd_pcm_link_rwsem); up_read(&snd_pcm_link_rwsem);
snd_power_unlock(card);
if (runtime->no_period_wakeup) if (runtime->no_period_wakeup)
tout = MAX_SCHEDULE_TIMEOUT; tout = MAX_SCHEDULE_TIMEOUT;
else { else {
@ -1842,7 +1841,6 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,
tout = msecs_to_jiffies(tout * 1000); tout = msecs_to_jiffies(tout * 1000);
} }
tout = schedule_timeout_interruptible(tout); tout = schedule_timeout_interruptible(tout);
snd_power_lock(card);
down_read(&snd_pcm_link_rwsem); down_read(&snd_pcm_link_rwsem);
snd_pcm_stream_lock_irq(substream); snd_pcm_stream_lock_irq(substream);
remove_wait_queue(&to_check->sleep, &wait); remove_wait_queue(&to_check->sleep, &wait);
@ -2763,12 +2761,106 @@ static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg)
runtime->tstamp_type = arg; runtime->tstamp_type = arg;
return 0; return 0;
} }
static int snd_pcm_xferi_frames_ioctl(struct snd_pcm_substream *substream,
struct snd_xferi __user *_xferi)
{
struct snd_xferi xferi;
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
if (put_user(0, &_xferi->result))
return -EFAULT;
if (copy_from_user(&xferi, _xferi, sizeof(xferi)))
return -EFAULT;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
result = snd_pcm_lib_write(substream, xferi.buf, xferi.frames);
else
result = snd_pcm_lib_read(substream, xferi.buf, xferi.frames);
__put_user(result, &_xferi->result);
return result < 0 ? result : 0;
}
static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
struct snd_xfern __user *_xfern)
{
struct snd_xfern xfern;
struct snd_pcm_runtime *runtime = substream->runtime;
void *bufs;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
if (runtime->channels > 128)
return -EINVAL;
if (put_user(0, &_xfern->result))
return -EFAULT;
if (copy_from_user(&xfern, _xfern, sizeof(xfern)))
return -EFAULT;
bufs = memdup_user(xfern.bufs, sizeof(void *) * runtime->channels);
if (IS_ERR(bufs))
return PTR_ERR(bufs);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
else
result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
kfree(bufs);
__put_user(result, &_xfern->result);
return result < 0 ? result : 0;
}
static int snd_pcm_rewind_ioctl(struct snd_pcm_substream *substream,
snd_pcm_uframes_t __user *_frames)
{
snd_pcm_uframes_t frames;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (put_user(0, _frames))
return -EFAULT;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
result = snd_pcm_playback_rewind(substream, frames);
else
result = snd_pcm_capture_rewind(substream, frames);
__put_user(result, _frames);
return result < 0 ? result : 0;
}
static int snd_pcm_forward_ioctl(struct snd_pcm_substream *substream,
snd_pcm_uframes_t __user *_frames)
{
snd_pcm_uframes_t frames;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (put_user(0, _frames))
return -EFAULT;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
result = snd_pcm_playback_forward(substream, frames);
else
result = snd_pcm_capture_forward(substream, frames);
__put_user(result, _frames);
return result < 0 ? result : 0;
}
static int snd_pcm_common_ioctl(struct file *file, static int snd_pcm_common_ioctl(struct file *file,
struct snd_pcm_substream *substream, struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg) unsigned int cmd, void __user *arg)
{ {
struct snd_pcm_file *pcm_file = file->private_data; struct snd_pcm_file *pcm_file = file->private_data;
int res;
if (PCM_RUNTIME_CHECK(substream))
return -ENXIO;
res = snd_power_wait(substream->pcm->card, SNDRV_CTL_POWER_D0);
if (res < 0)
return res;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_IOCTL_PVERSION: case SNDRV_PCM_IOCTL_PVERSION:
@ -2841,188 +2933,23 @@ static int snd_pcm_common_ioctl(struct file *file,
return snd_pcm_action_lock_irq(&snd_pcm_action_pause, return snd_pcm_action_lock_irq(&snd_pcm_action_pause,
substream, substream,
(int)(unsigned long)arg); (int)(unsigned long)arg);
case SNDRV_PCM_IOCTL_WRITEI_FRAMES:
case SNDRV_PCM_IOCTL_READI_FRAMES:
return snd_pcm_xferi_frames_ioctl(substream, arg);
case SNDRV_PCM_IOCTL_WRITEN_FRAMES:
case SNDRV_PCM_IOCTL_READN_FRAMES:
return snd_pcm_xfern_frames_ioctl(substream, arg);
case SNDRV_PCM_IOCTL_REWIND:
return snd_pcm_rewind_ioctl(substream, arg);
case SNDRV_PCM_IOCTL_FORWARD:
return snd_pcm_forward_ioctl(substream, arg);
} }
pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd); pcm_dbg(substream->pcm, "unknown ioctl = 0x%x\n", cmd);
return -ENOTTY; return -ENOTTY;
} }
static int snd_pcm_common_ioctl1(struct file *file, static long snd_pcm_ioctl(struct file *file, unsigned int cmd,
struct snd_pcm_substream *substream, unsigned long arg)
unsigned int cmd, void __user *arg)
{
struct snd_card *card = substream->pcm->card;
int res;
snd_power_lock(card);
res = snd_power_wait(card, SNDRV_CTL_POWER_D0);
if (res >= 0)
res = snd_pcm_common_ioctl(file, substream, cmd, arg);
snd_power_unlock(card);
return res;
}
static int snd_pcm_playback_ioctl1(struct file *file,
struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg)
{
if (PCM_RUNTIME_CHECK(substream))
return -ENXIO;
if (snd_BUG_ON(substream->stream != SNDRV_PCM_STREAM_PLAYBACK))
return -EINVAL;
switch (cmd) {
case SNDRV_PCM_IOCTL_WRITEI_FRAMES:
{
struct snd_xferi xferi;
struct snd_xferi __user *_xferi = arg;
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
if (put_user(0, &_xferi->result))
return -EFAULT;
if (copy_from_user(&xferi, _xferi, sizeof(xferi)))
return -EFAULT;
result = snd_pcm_lib_write(substream, xferi.buf, xferi.frames);
__put_user(result, &_xferi->result);
return result < 0 ? result : 0;
}
case SNDRV_PCM_IOCTL_WRITEN_FRAMES:
{
struct snd_xfern xfern;
struct snd_xfern __user *_xfern = arg;
struct snd_pcm_runtime *runtime = substream->runtime;
void __user **bufs;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
if (runtime->channels > 128)
return -EINVAL;
if (put_user(0, &_xfern->result))
return -EFAULT;
if (copy_from_user(&xfern, _xfern, sizeof(xfern)))
return -EFAULT;
bufs = memdup_user(xfern.bufs,
sizeof(void *) * runtime->channels);
if (IS_ERR(bufs))
return PTR_ERR(bufs);
result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
kfree(bufs);
__put_user(result, &_xfern->result);
return result < 0 ? result : 0;
}
case SNDRV_PCM_IOCTL_REWIND:
{
snd_pcm_uframes_t frames;
snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (put_user(0, _frames))
return -EFAULT;
result = snd_pcm_playback_rewind(substream, frames);
__put_user(result, _frames);
return result < 0 ? result : 0;
}
case SNDRV_PCM_IOCTL_FORWARD:
{
snd_pcm_uframes_t frames;
snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (put_user(0, _frames))
return -EFAULT;
result = snd_pcm_playback_forward(substream, frames);
__put_user(result, _frames);
return result < 0 ? result : 0;
}
}
return snd_pcm_common_ioctl1(file, substream, cmd, arg);
}
static int snd_pcm_capture_ioctl1(struct file *file,
struct snd_pcm_substream *substream,
unsigned int cmd, void __user *arg)
{
if (PCM_RUNTIME_CHECK(substream))
return -ENXIO;
if (snd_BUG_ON(substream->stream != SNDRV_PCM_STREAM_CAPTURE))
return -EINVAL;
switch (cmd) {
case SNDRV_PCM_IOCTL_READI_FRAMES:
{
struct snd_xferi xferi;
struct snd_xferi __user *_xferi = arg;
struct snd_pcm_runtime *runtime = substream->runtime;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
if (put_user(0, &_xferi->result))
return -EFAULT;
if (copy_from_user(&xferi, _xferi, sizeof(xferi)))
return -EFAULT;
result = snd_pcm_lib_read(substream, xferi.buf, xferi.frames);
__put_user(result, &_xferi->result);
return result < 0 ? result : 0;
}
case SNDRV_PCM_IOCTL_READN_FRAMES:
{
struct snd_xfern xfern;
struct snd_xfern __user *_xfern = arg;
struct snd_pcm_runtime *runtime = substream->runtime;
void *bufs;
snd_pcm_sframes_t result;
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
return -EBADFD;
if (runtime->channels > 128)
return -EINVAL;
if (put_user(0, &_xfern->result))
return -EFAULT;
if (copy_from_user(&xfern, _xfern, sizeof(xfern)))
return -EFAULT;
bufs = memdup_user(xfern.bufs,
sizeof(void *) * runtime->channels);
if (IS_ERR(bufs))
return PTR_ERR(bufs);
result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
kfree(bufs);
__put_user(result, &_xfern->result);
return result < 0 ? result : 0;
}
case SNDRV_PCM_IOCTL_REWIND:
{
snd_pcm_uframes_t frames;
snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (put_user(0, _frames))
return -EFAULT;
result = snd_pcm_capture_rewind(substream, frames);
__put_user(result, _frames);
return result < 0 ? result : 0;
}
case SNDRV_PCM_IOCTL_FORWARD:
{
snd_pcm_uframes_t frames;
snd_pcm_uframes_t __user *_frames = arg;
snd_pcm_sframes_t result;
if (get_user(frames, _frames))
return -EFAULT;
if (put_user(0, _frames))
return -EFAULT;
result = snd_pcm_capture_forward(substream, frames);
__put_user(result, _frames);
return result < 0 ? result : 0;
}
}
return snd_pcm_common_ioctl1(file, substream, cmd, arg);
}
static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ {
struct snd_pcm_file *pcm_file; struct snd_pcm_file *pcm_file;
@ -3031,22 +2958,8 @@ static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd,
if (((cmd >> 8) & 0xff) != 'A') if (((cmd >> 8) & 0xff) != 'A')
return -ENOTTY; return -ENOTTY;
return snd_pcm_playback_ioctl1(file, pcm_file->substream, cmd, return snd_pcm_common_ioctl(file, pcm_file->substream, cmd,
(void __user *)arg); (void __user *)arg);
}
static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct snd_pcm_file *pcm_file;
pcm_file = file->private_data;
if (((cmd >> 8) & 0xff) != 'A')
return -ENOTTY;
return snd_pcm_capture_ioctl1(file, pcm_file->substream, cmd,
(void __user *)arg);
} }
/** /**
@ -3064,7 +2977,6 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
{ {
snd_pcm_uframes_t *frames = arg; snd_pcm_uframes_t *frames = arg;
snd_pcm_sframes_t result; snd_pcm_sframes_t result;
int err;
switch (cmd) { switch (cmd) {
case SNDRV_PCM_IOCTL_FORWARD: case SNDRV_PCM_IOCTL_FORWARD:
@ -3084,10 +2996,7 @@ int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream,
case SNDRV_PCM_IOCTL_START: case SNDRV_PCM_IOCTL_START:
return snd_pcm_start_lock_irq(substream); return snd_pcm_start_lock_irq(substream);
case SNDRV_PCM_IOCTL_DRAIN: case SNDRV_PCM_IOCTL_DRAIN:
snd_power_lock(substream->pcm->card); return snd_pcm_drain(substream, NULL);
err = snd_pcm_drain(substream, NULL);
snd_power_unlock(substream->pcm->card);
return err;
case SNDRV_PCM_IOCTL_DROP: case SNDRV_PCM_IOCTL_DROP:
return snd_pcm_drop(substream); return snd_pcm_drop(substream);
case SNDRV_PCM_IOCTL_DELAY: case SNDRV_PCM_IOCTL_DELAY:
@ -3791,7 +3700,7 @@ const struct file_operations snd_pcm_f_ops[2] = {
.release = snd_pcm_release, .release = snd_pcm_release,
.llseek = no_llseek, .llseek = no_llseek,
.poll = snd_pcm_playback_poll, .poll = snd_pcm_playback_poll,
.unlocked_ioctl = snd_pcm_playback_ioctl, .unlocked_ioctl = snd_pcm_ioctl,
.compat_ioctl = snd_pcm_ioctl_compat, .compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap, .mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync, .fasync = snd_pcm_fasync,
@ -3805,7 +3714,7 @@ const struct file_operations snd_pcm_f_ops[2] = {
.release = snd_pcm_release, .release = snd_pcm_release,
.llseek = no_llseek, .llseek = no_llseek,
.poll = snd_pcm_capture_poll, .poll = snd_pcm_capture_poll,
.unlocked_ioctl = snd_pcm_capture_ioctl, .unlocked_ioctl = snd_pcm_ioctl,
.compat_ioctl = snd_pcm_ioctl_compat, .compat_ioctl = snd_pcm_ioctl_compat,
.mmap = snd_pcm_mmap, .mmap = snd_pcm_mmap,
.fasync = snd_pcm_fasync, .fasync = snd_pcm_fasync,

View File

@ -393,7 +393,8 @@ unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
if (timeri == NULL) if (timeri == NULL)
return 0; return 0;
if ((timer = timeri->timer) != NULL) { timer = timeri->timer;
if (timer) {
if (timer->hw.c_resolution) if (timer->hw.c_resolution)
return timer->hw.c_resolution(timer); return timer->hw.c_resolution(timer);
return timer->hw.resolution; return timer->hw.resolution;
@ -2096,8 +2097,7 @@ static int __init alsa_timer_init(void)
err = snd_timer_register_system(); err = snd_timer_register_system();
if (err < 0) { if (err < 0) {
pr_err("ALSA: unable to register system timer (%i)\n", err); pr_err("ALSA: unable to register system timer (%i)\n", err);
put_device(&timer_dev); goto put_timer;
return err;
} }
err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0, err = snd_register_device(SNDRV_DEVICE_TYPE_TIMER, NULL, 0,
@ -2105,12 +2105,15 @@ static int __init alsa_timer_init(void)
if (err < 0) { if (err < 0) {
pr_err("ALSA: unable to register timer device (%i)\n", err); pr_err("ALSA: unable to register timer device (%i)\n", err);
snd_timer_free_all(); snd_timer_free_all();
put_device(&timer_dev); goto put_timer;
return err;
} }
snd_timer_proc_init(); snd_timer_proc_init();
return 0; return 0;
put_timer:
put_device(&timer_dev);
return err;
} }
static void __exit alsa_timer_exit(void) static void __exit alsa_timer_exit(void)

View File

@ -561,7 +561,7 @@ static snd_pcm_uframes_t loopback_pointer(struct snd_pcm_substream *substream)
return bytes_to_frames(runtime, pos); return bytes_to_frames(runtime, pos);
} }
static struct snd_pcm_hardware loopback_pcm_hardware = static const struct snd_pcm_hardware loopback_pcm_hardware =
{ {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE |
@ -750,7 +750,7 @@ static int loopback_close(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static struct snd_pcm_ops loopback_playback_ops = { static const struct snd_pcm_ops loopback_playback_ops = {
.open = loopback_open, .open = loopback_open,
.close = loopback_close, .close = loopback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -763,7 +763,7 @@ static struct snd_pcm_ops loopback_playback_ops = {
.mmap = snd_pcm_lib_mmap_vmalloc, .mmap = snd_pcm_lib_mmap_vmalloc,
}; };
static struct snd_pcm_ops loopback_capture_ops = { static const struct snd_pcm_ops loopback_capture_ops = {
.open = loopback_open, .open = loopback_open,
.close = loopback_close, .close = loopback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -520,7 +520,7 @@ static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream)
return get_dummy_ops(substream)->pointer(substream); return get_dummy_ops(substream)->pointer(substream);
} }
static struct snd_pcm_hardware dummy_pcm_hardware = { static const struct snd_pcm_hardware dummy_pcm_hardware = {
.info = (SNDRV_PCM_INFO_MMAP | .info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_RESUME |

View File

@ -373,7 +373,7 @@ struct snd_ml403_ac97cr {
struct snd_pcm_indirect2 capture_ind2_rec; struct snd_pcm_indirect2 capture_ind2_rec;
}; };
static struct snd_pcm_hardware snd_ml403_ac97cr_playback = { static const struct snd_pcm_hardware snd_ml403_ac97cr_playback = {
.info = (SNDRV_PCM_INFO_MMAP | .info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -392,7 +392,7 @@ static struct snd_pcm_hardware snd_ml403_ac97cr_playback = {
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_ml403_ac97cr_capture = { static const struct snd_pcm_hardware snd_ml403_ac97cr_capture = {
.info = (SNDRV_PCM_INFO_MMAP | .info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -759,7 +759,7 @@ static int snd_ml403_ac97cr_capture_close(struct snd_pcm_substream *substream)
return 0; return 0;
} }
static struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = { static const struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = {
.open = snd_ml403_ac97cr_playback_open, .open = snd_ml403_ac97cr_playback_open,
.close = snd_ml403_ac97cr_playback_close, .close = snd_ml403_ac97cr_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -770,7 +770,7 @@ static struct snd_pcm_ops snd_ml403_ac97cr_playback_ops = {
.pointer = snd_ml403_ac97cr_pcm_pointer, .pointer = snd_ml403_ac97cr_pcm_pointer,
}; };
static struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = { static const struct snd_pcm_ops snd_ml403_ac97cr_capture_ops = {
.open = snd_ml403_ac97cr_capture_open, .open = snd_ml403_ac97cr_capture_open,
.close = snd_ml403_ac97cr_capture_close, .close = snd_ml403_ac97cr_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -148,7 +148,7 @@ static struct platform_driver snd_mpu401_driver = {
#define IO_EXTENT 2 #define IO_EXTENT 2
static struct pnp_device_id snd_mpu401_pnpids[] = { static const struct pnp_device_id snd_mpu401_pnpids[] = {
{ .id = "PNPb006" }, { .id = "PNPb006" },
{ .id = "" } { .id = "" }
}; };

View File

@ -136,7 +136,7 @@ irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id)
{ {
struct snd_mpu401 *mpu = dev_id; struct snd_mpu401 *mpu = dev_id;
if (mpu == NULL) if (!mpu)
return IRQ_NONE; return IRQ_NONE;
_snd_mpu401_uart_interrupt(mpu); _snd_mpu401_uart_interrupt(mpu);
return IRQ_HANDLED; return IRQ_HANDLED;
@ -157,7 +157,7 @@ irqreturn_t snd_mpu401_uart_interrupt_tx(int irq, void *dev_id)
{ {
struct snd_mpu401 *mpu = dev_id; struct snd_mpu401 *mpu = dev_id;
if (mpu == NULL) if (!mpu)
return IRQ_NONE; return IRQ_NONE;
uart_interrupt_tx(mpu); uart_interrupt_tx(mpu);
return IRQ_HANDLED; return IRQ_HANDLED;
@ -544,10 +544,9 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
out_enable, in_enable, &rmidi)) < 0) out_enable, in_enable, &rmidi)) < 0)
return err; return err;
mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
if (mpu == NULL) { if (!mpu) {
snd_printk(KERN_ERR "mpu401_uart: cannot allocate\n"); err = -ENOMEM;
snd_device_free(card, rmidi); goto free_device;
return -ENOMEM;
} }
rmidi->private_data = mpu; rmidi->private_data = mpu;
rmidi->private_free = snd_mpu401_uart_free; rmidi->private_free = snd_mpu401_uart_free;
@ -559,12 +558,12 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
if (! (info_flags & MPU401_INFO_INTEGRATED)) { if (! (info_flags & MPU401_INFO_INTEGRATED)) {
int res_size = hardware == MPU401_HW_PC98II ? 4 : 2; int res_size = hardware == MPU401_HW_PC98II ? 4 : 2;
mpu->res = request_region(port, res_size, "MPU401 UART"); mpu->res = request_region(port, res_size, "MPU401 UART");
if (mpu->res == NULL) { if (!mpu->res) {
snd_printk(KERN_ERR "mpu401_uart: " snd_printk(KERN_ERR "mpu401_uart: "
"unable to grab port 0x%lx size %d\n", "unable to grab port 0x%lx size %d\n",
port, res_size); port, res_size);
snd_device_free(card, rmidi); err = -EBUSY;
return -EBUSY; goto free_device;
} }
} }
if (info_flags & MPU401_INFO_MMIO) { if (info_flags & MPU401_INFO_MMIO) {
@ -584,8 +583,8 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
"MPU401 UART", (void *) mpu)) { "MPU401 UART", (void *) mpu)) {
snd_printk(KERN_ERR "mpu401_uart: " snd_printk(KERN_ERR "mpu401_uart: "
"unable to grab IRQ %d\n", irq); "unable to grab IRQ %d\n", irq);
snd_device_free(card, rmidi); err = -EBUSY;
return -EBUSY; goto free_device;
} }
} }
if (irq < 0 && !(info_flags & MPU401_INFO_IRQ_HOOK)) if (irq < 0 && !(info_flags & MPU401_INFO_IRQ_HOOK))
@ -613,6 +612,9 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
if (rrawmidi) if (rrawmidi)
*rrawmidi = rmidi; *rrawmidi = rmidi;
return 0; return 0;
free_device:
snd_device_free(card, rmidi);
return err;
} }
EXPORT_SYMBOL(snd_mpu401_uart_new); EXPORT_SYMBOL(snd_mpu401_uart_new);

View File

@ -355,10 +355,8 @@ int snd_opl3_new(struct snd_card *card,
*ropl3 = NULL; *ropl3 = NULL;
opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL); opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL);
if (opl3 == NULL) { if (!opl3)
snd_printk(KERN_ERR "opl3: cannot allocate\n");
return -ENOMEM; return -ENOMEM;
}
opl3->card = card; opl3->card = card;
opl3->hardware = hardware; opl3->hardware = hardware;

View File

@ -131,8 +131,8 @@ static void debug_alloc(struct snd_opl3 *opl3, char *s, int voice) {
printk(KERN_DEBUG "time %.5i: %s [%.2i]: ", opl3->use_time, s, voice); printk(KERN_DEBUG "time %.5i: %s [%.2i]: ", opl3->use_time, s, voice);
for (i = 0; i < opl3->max_voices; i++) for (i = 0; i < opl3->max_voices; i++)
printk("%c", *(str + opl3->voices[i].state + 1)); printk(KERN_CONT "%c", *(str + opl3->voices[i].state + 1));
printk("\n"); printk(KERN_CONT "\n");
} }
#endif #endif

View File

@ -108,22 +108,17 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
return err; return err;
err = snd_pcsp_create(card); err = snd_pcsp_create(card);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
if (!nopcm) { if (!nopcm) {
err = snd_pcsp_new_pcm(&pcsp_chip); err = snd_pcsp_new_pcm(&pcsp_chip);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
} }
err = snd_pcsp_new_mixer(&pcsp_chip, nopcm); err = snd_pcsp_new_mixer(&pcsp_chip, nopcm);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
strcpy(card->driver, "PC-Speaker"); strcpy(card->driver, "PC-Speaker");
strcpy(card->shortname, "pcsp"); strcpy(card->shortname, "pcsp");
@ -131,12 +126,14 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
pcsp_chip.port); pcsp_chip.port);
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) { if (err < 0)
snd_card_free(card); goto free_card;
return err;
}
return 0; return 0;
free_card:
snd_card_free(card);
return err;
} }
static int alsa_card_pcsp_init(struct device *dev) static int alsa_card_pcsp_init(struct device *dev)

View File

@ -285,7 +285,7 @@ static snd_pcm_uframes_t snd_pcsp_playback_pointer(struct snd_pcm_substream
return bytes_to_frames(substream->runtime, pos); return bytes_to_frames(substream->runtime, pos);
} }
static struct snd_pcm_hardware snd_pcsp_playback = { static const struct snd_pcm_hardware snd_pcsp_playback = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_HALF_DUPLEX | SNDRV_PCM_INFO_HALF_DUPLEX |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID),

View File

@ -256,8 +256,8 @@ int vx_send_msg_nolock(struct vx_core *chip, struct vx_rmh *rmh)
if (rmh->LgCmd > 1) { if (rmh->LgCmd > 1) {
printk(KERN_DEBUG " "); printk(KERN_DEBUG " ");
for (i = 1; i < rmh->LgCmd; i++) for (i = 1; i < rmh->LgCmd; i++)
printk("0x%06x ", rmh->Cmd[i]); printk(KERN_CONT "0x%06x ", rmh->Cmd[i]);
printk("\n"); printk(KERN_CONT "\n");
} }
#endif #endif
/* Check bit M is set according to length of the command */ /* Check bit M is set according to length of the command */

View File

@ -500,7 +500,7 @@ static int vx_stop_stream(struct vx_core *chip, struct vx_pipe *pipe)
* playback hw information * playback hw information
*/ */
static struct snd_pcm_hardware vx_pcm_playback_hw = { static const struct snd_pcm_hardware vx_pcm_playback_hw = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/
/*SNDRV_PCM_INFO_RESUME*/), /*SNDRV_PCM_INFO_RESUME*/),
@ -891,7 +891,7 @@ static const struct snd_pcm_ops vx_pcm_playback_ops = {
* playback hw information * playback hw information
*/ */
static struct snd_pcm_hardware vx_pcm_capture_hw = { static const struct snd_pcm_hardware vx_pcm_capture_hw = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/
/*SNDRV_PCM_INFO_RESUME*/), /*SNDRV_PCM_INFO_RESUME*/),

View File

@ -58,7 +58,7 @@ enum snd_bebob_clock_type {
struct snd_bebob_clock_spec { struct snd_bebob_clock_spec {
unsigned int num; unsigned int num;
const char *const *labels; const char *const *labels;
enum snd_bebob_clock_type *types; const enum snd_bebob_clock_type *types;
int (*get)(struct snd_bebob *bebob, unsigned int *id); int (*get)(struct snd_bebob *bebob, unsigned int *id);
}; };
struct snd_bebob_rate_spec { struct snd_bebob_rate_spec {

View File

@ -103,12 +103,12 @@ saffire_write_quad(struct snd_bebob *bebob, u64 offset, u32 value)
&data, sizeof(__be32), 0); &data, sizeof(__be32), 0);
} }
static enum snd_bebob_clock_type saffirepro_10_clk_src_types[] = { static const enum snd_bebob_clock_type saffirepro_10_clk_src_types[] = {
SND_BEBOB_CLOCK_TYPE_INTERNAL, SND_BEBOB_CLOCK_TYPE_INTERNAL,
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */
}; };
static enum snd_bebob_clock_type saffirepro_26_clk_src_types[] = { static const enum snd_bebob_clock_type saffirepro_26_clk_src_types[] = {
SND_BEBOB_CLOCK_TYPE_INTERNAL, SND_BEBOB_CLOCK_TYPE_INTERNAL,
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* ADAT1 */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* ADAT1 */
@ -201,7 +201,7 @@ end:
} }
const struct snd_bebob_spec saffire_le_spec; const struct snd_bebob_spec saffire_le_spec;
static enum snd_bebob_clock_type saffire_both_clk_src_types[] = { static const enum snd_bebob_clock_type saffire_both_clk_src_types[] = {
SND_BEBOB_CLOCK_TYPE_INTERNAL, SND_BEBOB_CLOCK_TYPE_INTERNAL,
SND_BEBOB_CLOCK_TYPE_EXTERNAL, SND_BEBOB_CLOCK_TYPE_EXTERNAL,
}; };

View File

@ -340,7 +340,7 @@ end:
} }
/* Clock source control for special firmware */ /* Clock source control for special firmware */
static enum snd_bebob_clock_type special_clk_types[] = { static const enum snd_bebob_clock_type special_clk_types[] = {
SND_BEBOB_CLOCK_TYPE_INTERNAL, /* With digital mute */ SND_BEBOB_CLOCK_TYPE_INTERNAL, /* With digital mute */
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* SPDIF/ADAT */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* SPDIF/ADAT */
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */

View File

@ -8,7 +8,7 @@
#include "./bebob.h" #include "./bebob.h"
static enum snd_bebob_clock_type phase88_rack_clk_src_types[] = { static const enum snd_bebob_clock_type phase88_rack_clk_src_types[] = {
SND_BEBOB_CLOCK_TYPE_INTERNAL, SND_BEBOB_CLOCK_TYPE_INTERNAL,
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */

View File

@ -31,7 +31,7 @@
* Yamaha GO 44 and GO 46. Yamaha and Terratec had cooperated for these models. * Yamaha GO 44 and GO 46. Yamaha and Terratec had cooperated for these models.
*/ */
static enum snd_bebob_clock_type clk_src_types[] = { static const enum snd_bebob_clock_type clk_src_types[] = {
SND_BEBOB_CLOCK_TYPE_INTERNAL, SND_BEBOB_CLOCK_TYPE_INTERNAL,
SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
}; };

View File

@ -26,7 +26,7 @@ MODULE_LICENSE("GPL v2");
*/ */
static bool force_two_pcm_support(struct fw_unit *unit) static bool force_two_pcm_support(struct fw_unit *unit)
{ {
const char *const models[] = { static const char *const models[] = {
/* TC Electronic models. */ /* TC Electronic models. */
"StudioKonnekt48", "StudioKonnekt48",
/* Focusrite models. */ /* Focusrite models. */

View File

@ -138,16 +138,12 @@ static int pcm_open(struct snd_pcm_substream *substream)
return err; return err;
err = pcm_init_hw_params(ff, substream); err = pcm_init_hw_params(ff, substream);
if (err < 0) { if (err < 0)
snd_ff_stream_lock_release(ff); goto release_lock;
return err;
}
err = ff->spec->protocol->get_clock(ff, &rate, &src); err = ff->spec->protocol->get_clock(ff, &rate, &src);
if (err < 0) { if (err < 0)
snd_ff_stream_lock_release(ff); goto release_lock;
return err;
}
if (src != SND_FF_CLOCK_SRC_INTERNAL) { if (src != SND_FF_CLOCK_SRC_INTERNAL) {
for (i = 0; i < CIP_SFC_COUNT; ++i) { for (i = 0; i < CIP_SFC_COUNT; ++i) {
@ -159,8 +155,8 @@ static int pcm_open(struct snd_pcm_substream *substream)
* streaming engine can't support. * streaming engine can't support.
*/ */
if (i >= CIP_SFC_COUNT) { if (i >= CIP_SFC_COUNT) {
snd_ff_stream_lock_release(ff); err = -EIO;
return -EIO; goto release_lock;
} }
substream->runtime->hw.rate_min = rate; substream->runtime->hw.rate_min = rate;
@ -177,6 +173,10 @@ static int pcm_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream); snd_pcm_set_sync(substream);
return 0; return 0;
release_lock:
snd_ff_stream_lock_release(ff);
return err;
} }
static int pcm_close(struct snd_pcm_substream *substream) static int pcm_close(struct snd_pcm_substream *substream)

View File

@ -356,7 +356,7 @@ static void ff400_dump_clock_config(struct snd_ff *ff,
snd_iprintf(buffer, "Sync to clock source: %s\n", src); snd_iprintf(buffer, "Sync to clock source: %s\n", src);
} }
struct snd_ff_protocol snd_ff_protocol_ff400 = { const struct snd_ff_protocol snd_ff_protocol_ff400 = {
.get_clock = ff400_get_clock, .get_clock = ff400_get_clock,
.begin_session = ff400_begin_session, .begin_session = ff400_begin_session,
.finish_session = ff400_finish_session, .finish_session = ff400_finish_session,

View File

@ -157,7 +157,7 @@ static void snd_ff_remove(struct fw_unit *unit)
} }
} }
static struct snd_ff_spec spec_ff400 = { static const struct snd_ff_spec spec_ff400 = {
.name = "Fireface400", .name = "Fireface400",
.pcm_capture_channels = {18, 14, 10}, .pcm_capture_channels = {18, 14, 10},
.pcm_playback_channels = {18, 14, 10}, .pcm_playback_channels = {18, 14, 10},

View File

@ -47,7 +47,7 @@ struct snd_ff_spec {
unsigned int midi_in_ports; unsigned int midi_in_ports;
unsigned int midi_out_ports; unsigned int midi_out_ports;
struct snd_ff_protocol *protocol; const struct snd_ff_protocol *protocol;
}; };
struct snd_ff { struct snd_ff {
@ -112,7 +112,7 @@ struct snd_ff_protocol {
u64 midi_rx_port_1_reg; u64 midi_rx_port_1_reg;
}; };
extern struct snd_ff_protocol snd_ff_protocol_ff400; extern const struct snd_ff_protocol snd_ff_protocol_ff400;
int snd_ff_transaction_register(struct snd_ff *ff); int snd_ff_transaction_register(struct snd_ff *ff);
int snd_ff_transaction_reregister(struct snd_ff *ff); int snd_ff_transaction_reregister(struct snd_ff *ff);

View File

@ -12,7 +12,7 @@
static inline const char* static inline const char*
get_phys_name(struct snd_efw_phys_grp *grp, bool input) get_phys_name(struct snd_efw_phys_grp *grp, bool input)
{ {
const char *const ch_type[] = { static const char *const ch_type[] = {
"Analog", "S/PDIF", "ADAT", "S/PDIF or ADAT", "Mirroring", "Analog", "S/PDIF", "ADAT", "S/PDIF or ADAT", "Mirroring",
"Headphones", "I2S", "Guitar", "Pirzo Guitar", "Guitar String", "Headphones", "I2S", "Guitar", "Pirzo Guitar", "Guitar String",
}; };

View File

@ -444,7 +444,7 @@ static snd_pcm_uframes_t isight_pointer(struct snd_pcm_substream *substream)
static int isight_create_pcm(struct isight *isight) static int isight_create_pcm(struct isight *isight)
{ {
static struct snd_pcm_ops ops = { static const struct snd_pcm_ops ops = {
.open = isight_open, .open = isight_open,
.close = isight_close, .close = isight_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -128,12 +128,12 @@ static void set_midi_substream_names(struct snd_motu *motu,
int snd_motu_create_midi_devices(struct snd_motu *motu) int snd_motu_create_midi_devices(struct snd_motu *motu)
{ {
static struct snd_rawmidi_ops capture_ops = { static const struct snd_rawmidi_ops capture_ops = {
.open = midi_capture_open, .open = midi_capture_open,
.close = midi_capture_close, .close = midi_capture_close,
.trigger = midi_capture_trigger, .trigger = midi_capture_trigger,
}; };
static struct snd_rawmidi_ops playback_ops = { static const struct snd_rawmidi_ops playback_ops = {
.open = midi_playback_open, .open = midi_playback_open,
.close = midi_playback_close, .close = midi_playback_close,
.trigger = midi_playback_trigger, .trigger = midi_playback_trigger,

View File

@ -145,7 +145,7 @@ static int pcm_open(struct snd_pcm_substream *substream)
mutex_lock(&motu->mutex); mutex_lock(&motu->mutex);
err = protocol->cache_packet_formats(motu); err = snd_motu_stream_cache_packet_formats(motu);
if (err < 0) if (err < 0)
goto err_locked; goto err_locked;
@ -352,7 +352,7 @@ static int playback_ack(struct snd_pcm_substream *substream)
int snd_motu_create_pcm_devices(struct snd_motu *motu) int snd_motu_create_pcm_devices(struct snd_motu *motu)
{ {
static struct snd_pcm_ops capture_ops = { static const struct snd_pcm_ops capture_ops = {
.open = pcm_open, .open = pcm_open,
.close = pcm_close, .close = pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -365,7 +365,7 @@ int snd_motu_create_pcm_devices(struct snd_motu *motu)
.page = snd_pcm_lib_get_vmalloc_page, .page = snd_pcm_lib_get_vmalloc_page,
.mmap = snd_pcm_lib_mmap_vmalloc, .mmap = snd_pcm_lib_mmap_vmalloc,
}; };
static struct snd_pcm_ops playback_ops = { static const struct snd_pcm_ops playback_ops = {
.open = pcm_open, .open = pcm_open,
.close = pcm_close, .close = pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -217,12 +217,7 @@ static int v2_cache_packet_formats(struct snd_motu *motu)
calculate_differed_part(&motu->rx_packet_formats, motu->spec->flags, calculate_differed_part(&motu->rx_packet_formats, motu->spec->flags,
data, V2_OPT_OUT_IFACE_MASK, V2_OPT_OUT_IFACE_SHIFT); data, V2_OPT_OUT_IFACE_MASK, V2_OPT_OUT_IFACE_SHIFT);
motu->tx_packet_formats.midi_flag_offset = 4;
motu->tx_packet_formats.midi_byte_offset = 6;
motu->tx_packet_formats.pcm_byte_offset = 10; motu->tx_packet_formats.pcm_byte_offset = 10;
motu->rx_packet_formats.midi_flag_offset = 4;
motu->rx_packet_formats.midi_byte_offset = 6;
motu->rx_packet_formats.pcm_byte_offset = 10; motu->rx_packet_formats.pcm_byte_offset = 10;
return 0; return 0;

View File

@ -291,12 +291,7 @@ static int v3_cache_packet_formats(struct snd_motu *motu)
V3_ENABLE_OPT_OUT_IFACE_A, V3_NO_ADAT_OPT_OUT_IFACE_A, V3_ENABLE_OPT_OUT_IFACE_A, V3_NO_ADAT_OPT_OUT_IFACE_A,
V3_ENABLE_OPT_OUT_IFACE_B, V3_NO_ADAT_OPT_OUT_IFACE_B); V3_ENABLE_OPT_OUT_IFACE_B, V3_NO_ADAT_OPT_OUT_IFACE_B);
motu->tx_packet_formats.midi_flag_offset = 8;
motu->tx_packet_formats.midi_byte_offset = 7;
motu->tx_packet_formats.pcm_byte_offset = 10; motu->tx_packet_formats.pcm_byte_offset = 10;
motu->rx_packet_formats.midi_flag_offset = 8;
motu->rx_packet_formats.midi_byte_offset = 7;
motu->rx_packet_formats.pcm_byte_offset = 10; motu->rx_packet_formats.pcm_byte_offset = 10;
return 0; return 0;

View File

@ -33,7 +33,8 @@ static int start_both_streams(struct snd_motu *motu, unsigned int rate)
u32 data; u32 data;
int err; int err;
if (motu->spec->flags & SND_MOTU_SPEC_HAS_MIDI) if ((motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_2ND_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_3RD_Q))
midi_ports = 1; midi_ports = 1;
/* Set packet formation to our packet streaming engine. */ /* Set packet formation to our packet streaming engine. */
@ -42,6 +43,12 @@ static int start_both_streams(struct snd_motu *motu, unsigned int rate)
if (err < 0) if (err < 0)
return err; return err;
if ((motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_2ND_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_3RD_Q))
midi_ports = 1;
else
midi_ports = 0;
err = amdtp_motu_set_parameters(&motu->tx_stream, rate, midi_ports, err = amdtp_motu_set_parameters(&motu->tx_stream, rate, midi_ports,
&motu->tx_packet_formats); &motu->tx_packet_formats);
if (err < 0) if (err < 0)
@ -141,6 +148,33 @@ static void stop_isoc_ctx(struct snd_motu *motu, struct amdtp_stream *stream)
fw_iso_resources_free(resources); fw_iso_resources_free(resources);
} }
int snd_motu_stream_cache_packet_formats(struct snd_motu *motu)
{
int err;
err = motu->spec->protocol->cache_packet_formats(motu);
if (err < 0)
return err;
if (motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_2ND_Q) {
motu->tx_packet_formats.midi_flag_offset = 4;
motu->tx_packet_formats.midi_byte_offset = 6;
} else if (motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_3RD_Q) {
motu->tx_packet_formats.midi_flag_offset = 8;
motu->tx_packet_formats.midi_byte_offset = 7;
}
if (motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_2ND_Q) {
motu->rx_packet_formats.midi_flag_offset = 4;
motu->rx_packet_formats.midi_byte_offset = 6;
} else if (motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_3RD_Q) {
motu->rx_packet_formats.midi_flag_offset = 8;
motu->rx_packet_formats.midi_byte_offset = 7;
}
return 0;
}
static int ensure_packet_formats(struct snd_motu *motu) static int ensure_packet_formats(struct snd_motu *motu)
{ {
__be32 reg; __be32 reg;
@ -184,7 +218,7 @@ int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate)
stop_both_streams(motu); stop_both_streams(motu);
} }
err = protocol->cache_packet_formats(motu); err = snd_motu_stream_cache_packet_formats(motu);
if (err < 0) if (err < 0)
return err; return err;

View File

@ -103,7 +103,10 @@ static void do_registration(struct work_struct *work)
if (err < 0) if (err < 0)
goto error; goto error;
if (motu->spec->flags & SND_MOTU_SPEC_HAS_MIDI) { if ((motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_2ND_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_RX_MIDI_3RD_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_2ND_Q) ||
(motu->spec->flags & SND_MOTU_SPEC_TX_MIDI_3RD_Q)) {
err = snd_motu_create_midi_devices(motu); err = snd_motu_create_midi_devices(motu);
if (err < 0) if (err < 0)
goto error; goto error;
@ -191,20 +194,21 @@ static void motu_bus_update(struct fw_unit *unit)
snd_motu_transaction_reregister(motu); snd_motu_transaction_reregister(motu);
} }
static struct snd_motu_spec motu_828mk2 = { static const struct snd_motu_spec motu_828mk2 = {
.name = "828mk2", .name = "828mk2",
.protocol = &snd_motu_protocol_v2, .protocol = &snd_motu_protocol_v2,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 | .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_TX_MICINST_CHUNK | SND_MOTU_SPEC_TX_MICINST_CHUNK |
SND_MOTU_SPEC_TX_RETURN_CHUNK | SND_MOTU_SPEC_TX_RETURN_CHUNK |
SND_MOTU_SPEC_HAS_OPT_IFACE_A | SND_MOTU_SPEC_HAS_OPT_IFACE_A |
SND_MOTU_SPEC_HAS_MIDI, SND_MOTU_SPEC_RX_MIDI_2ND_Q |
SND_MOTU_SPEC_TX_MIDI_2ND_Q,
.analog_in_ports = 8, .analog_in_ports = 8,
.analog_out_ports = 8, .analog_out_ports = 8,
}; };
static struct snd_motu_spec motu_828mk3 = { static const struct snd_motu_spec motu_828mk3 = {
.name = "828mk3", .name = "828mk3",
.protocol = &snd_motu_protocol_v3, .protocol = &snd_motu_protocol_v3,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 | .flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
@ -214,12 +218,25 @@ static struct snd_motu_spec motu_828mk3 = {
SND_MOTU_SPEC_TX_REVERB_CHUNK | SND_MOTU_SPEC_TX_REVERB_CHUNK |
SND_MOTU_SPEC_HAS_OPT_IFACE_A | SND_MOTU_SPEC_HAS_OPT_IFACE_A |
SND_MOTU_SPEC_HAS_OPT_IFACE_B | SND_MOTU_SPEC_HAS_OPT_IFACE_B |
SND_MOTU_SPEC_HAS_MIDI, SND_MOTU_SPEC_RX_MIDI_3RD_Q |
SND_MOTU_SPEC_TX_MIDI_3RD_Q,
.analog_in_ports = 8, .analog_in_ports = 8,
.analog_out_ports = 8, .analog_out_ports = 8,
}; };
static const struct snd_motu_spec motu_audio_express = {
.name = "AudioExpress",
.protocol = &snd_motu_protocol_v3,
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
SND_MOTU_SPEC_TX_MICINST_CHUNK |
SND_MOTU_SPEC_TX_RETURN_CHUNK |
SND_MOTU_SPEC_RX_MIDI_2ND_Q |
SND_MOTU_SPEC_TX_MIDI_3RD_Q,
.analog_in_ports = 2,
.analog_out_ports = 4,
};
#define SND_MOTU_DEV_ENTRY(model, data) \ #define SND_MOTU_DEV_ENTRY(model, data) \
{ \ { \
.match_flags = IEEE1394_MATCH_VENDOR_ID | \ .match_flags = IEEE1394_MATCH_VENDOR_ID | \
@ -235,6 +252,7 @@ static const struct ieee1394_device_id motu_id_table[] = {
SND_MOTU_DEV_ENTRY(0x101800, &motu_828mk2), SND_MOTU_DEV_ENTRY(0x101800, &motu_828mk2),
SND_MOTU_DEV_ENTRY(0x106800, &motu_828mk3), /* FireWire only. */ SND_MOTU_DEV_ENTRY(0x106800, &motu_828mk3), /* FireWire only. */
SND_MOTU_DEV_ENTRY(0x100800, &motu_828mk3), /* Hybrid. */ SND_MOTU_DEV_ENTRY(0x100800, &motu_828mk3), /* Hybrid. */
SND_MOTU_DEV_ENTRY(0x104800, &motu_audio_express),
{ } { }
}; };
MODULE_DEVICE_TABLE(ieee1394, motu_id_table); MODULE_DEVICE_TABLE(ieee1394, motu_id_table);

View File

@ -82,7 +82,10 @@ enum snd_motu_spec_flags {
SND_MOTU_SPEC_TX_AESEBU_CHUNK = 0x0020, SND_MOTU_SPEC_TX_AESEBU_CHUNK = 0x0020,
SND_MOTU_SPEC_HAS_OPT_IFACE_A = 0x0040, SND_MOTU_SPEC_HAS_OPT_IFACE_A = 0x0040,
SND_MOTU_SPEC_HAS_OPT_IFACE_B = 0x0080, SND_MOTU_SPEC_HAS_OPT_IFACE_B = 0x0080,
SND_MOTU_SPEC_HAS_MIDI = 0x0100, SND_MOTU_SPEC_RX_MIDI_2ND_Q = 0x0100,
SND_MOTU_SPEC_RX_MIDI_3RD_Q = 0x0200,
SND_MOTU_SPEC_TX_MIDI_2ND_Q = 0x0400,
SND_MOTU_SPEC_TX_MIDI_3RD_Q = 0x0800,
}; };
#define SND_MOTU_CLOCK_RATE_COUNT 6 #define SND_MOTU_CLOCK_RATE_COUNT 6
@ -146,6 +149,7 @@ void snd_motu_transaction_unregister(struct snd_motu *motu);
int snd_motu_stream_init_duplex(struct snd_motu *motu); int snd_motu_stream_init_duplex(struct snd_motu *motu);
void snd_motu_stream_destroy_duplex(struct snd_motu *motu); void snd_motu_stream_destroy_duplex(struct snd_motu *motu);
int snd_motu_stream_cache_packet_formats(struct snd_motu *motu);
int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate); int snd_motu_stream_start_duplex(struct snd_motu *motu, unsigned int rate);
void snd_motu_stream_stop_duplex(struct snd_motu *motu); void snd_motu_stream_stop_duplex(struct snd_motu *motu);
int snd_motu_stream_lock_try(struct snd_motu *motu); int snd_motu_stream_lock_try(struct snd_motu *motu);

View File

@ -297,12 +297,6 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *stream, int up)
} }
} }
static const struct snd_rawmidi_ops midi_capture_ops = {
.open = midi_capture_open,
.close = midi_capture_close,
.trigger = midi_capture_trigger,
};
static int midi_playback_open(struct snd_rawmidi_substream *stream) static int midi_playback_open(struct snd_rawmidi_substream *stream)
{ {
return 0; return 0;
@ -363,6 +357,11 @@ void snd_oxfw_scs1x_update(struct snd_oxfw *oxfw)
int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw) int snd_oxfw_scs1x_add(struct snd_oxfw *oxfw)
{ {
static const struct snd_rawmidi_ops midi_capture_ops = {
.open = midi_capture_open,
.close = midi_capture_close,
.trigger = midi_capture_trigger,
};
static const struct snd_rawmidi_ops midi_playback_ops = { static const struct snd_rawmidi_ops midi_playback_ops = {
.open = midi_playback_open, .open = midi_playback_open,
.close = midi_playback_close, .close = midi_playback_close,

View File

@ -12,7 +12,7 @@ MODULE_DESCRIPTION("TASCAM FireWire series Driver");
MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>"); MODULE_AUTHOR("Takashi Sakamoto <o-takashi@sakamocchi.jp>");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
static struct snd_tscm_spec model_specs[] = { static const struct snd_tscm_spec model_specs[] = {
{ {
.name = "FW-1884", .name = "FW-1884",
.has_adat = true, .has_adat = true,

View File

@ -336,7 +336,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier);
/* check whether intel graphics is present */ /* check whether intel graphics is present */
static bool i915_gfx_present(void) static bool i915_gfx_present(void)
{ {
static struct pci_device_id ids[] = { static const struct pci_device_id ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID), { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_ANY_ID),
.class = PCI_BASE_CLASS_DISPLAY << 16, .class = PCI_BASE_CLASS_DISPLAY << 16,
.class_mask = 0xff << 16 }, .class_mask = 0xff << 16 },

View File

@ -63,7 +63,7 @@ MODULE_PARM_DESC(enable, "Enable ad1816a based soundcard.");
module_param_array(clockfreq, int, NULL, 0444); module_param_array(clockfreq, int, NULL, 0444);
MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0).");
static struct pnp_card_device_id snd_ad1816a_pnpids[] = { static const struct pnp_card_device_id snd_ad1816a_pnpids[] = {
/* Analog Devices AD1815 */ /* Analog Devices AD1815 */
{ .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } }, { .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } },
/* Analog Device AD1816? */ /* Analog Device AD1816? */

View File

@ -339,7 +339,7 @@ static irqreturn_t snd_ad1816a_interrupt(int irq, void *dev_id)
} }
static struct snd_pcm_hardware snd_ad1816a_playback = { static const struct snd_pcm_hardware snd_ad1816a_playback = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW |
@ -358,7 +358,7 @@ static struct snd_pcm_hardware snd_ad1816a_playback = {
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_ad1816a_capture = { static const struct snd_pcm_hardware snd_ad1816a_capture = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
.formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW |
@ -653,7 +653,7 @@ int snd_ad1816a_create(struct snd_card *card,
return 0; return 0;
} }
static struct snd_pcm_ops snd_ad1816a_playback_ops = { static const struct snd_pcm_ops snd_ad1816a_playback_ops = {
.open = snd_ad1816a_playback_open, .open = snd_ad1816a_playback_open,
.close = snd_ad1816a_playback_close, .close = snd_ad1816a_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -664,7 +664,7 @@ static struct snd_pcm_ops snd_ad1816a_playback_ops = {
.pointer = snd_ad1816a_playback_pointer, .pointer = snd_ad1816a_playback_pointer,
}; };
static struct snd_pcm_ops snd_ad1816a_capture_ops = { static const struct snd_pcm_ops snd_ad1816a_capture_ops = {
.open = snd_ad1816a_capture_open, .open = snd_ad1816a_capture_open,
.close = snd_ad1816a_capture_close, .close = snd_ad1816a_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -110,13 +110,17 @@ static int snd_ad1848_probe(struct device *dev, unsigned int n)
if (error < 0) if (error < 0)
goto out; goto out;
strcpy(card->driver, "AD1848"); strlcpy(card->driver, "AD1848", sizeof(card->driver));
strcpy(card->shortname, chip->pcm->name); strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", if (!thinkpad[n])
chip->pcm->name, chip->port, irq[n], dma1[n]); snprintf(card->longname, sizeof(card->longname),
if (thinkpad[n]) "%s at 0x%lx, irq %d, dma %d",
strcat(card->longname, " [Thinkpad]"); chip->pcm->name, chip->port, irq[n], dma1[n]);
else
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %d, dma %d [Thinkpad]",
chip->pcm->name, chip->port, irq[n], dma1[n]);
error = snd_card_register(card); error = snd_card_register(card);
if (error < 0) if (error < 0)

View File

@ -79,7 +79,7 @@ struct snd_card_als100 {
struct snd_sb *chip; struct snd_sb *chip;
}; };
static struct pnp_card_device_id snd_als100_pnpids[] = { static const struct pnp_card_device_id snd_als100_pnpids[] = {
/* DT197A30 */ /* DT197A30 */
{ .id = "RWB1688", { .id = "RWB1688",
.devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } }, .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } },
@ -222,15 +222,16 @@ static int snd_card_als100_probe(int dev,
if (pid->driver_data == SB_HW_DT019X) { if (pid->driver_data == SB_HW_DT019X) {
strcpy(card->driver, "DT-019X"); strcpy(card->driver, "DT-019X");
strcpy(card->shortname, "Diamond Tech. DT-019X"); strcpy(card->shortname, "Diamond Tech. DT-019X");
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", snprintf(card->longname, sizeof(card->longname),
card->shortname, chip->name, chip->port, "Diamond Tech. DT-019X, %s at 0x%lx, irq %d, dma %d",
irq[dev], dma8[dev]); chip->name, chip->port, irq[dev], dma8[dev]);
} else { } else {
strcpy(card->driver, "ALS100"); strcpy(card->driver, "ALS100");
strcpy(card->shortname, "Avance Logic ALS100"); strcpy(card->shortname, "Avance Logic ALS100");
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", snprintf(card->longname, sizeof(card->longname),
card->shortname, chip->name, chip->port, "Avance Logic ALS100, %s at 0x%lx, irq %d, dma %d&%d",
irq[dev], dma8[dev], dma16[dev]); chip->name, chip->port, irq[dev], dma8[dev],
dma16[dev]);
} }
if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) { if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) {

View File

@ -79,7 +79,7 @@ struct snd_card_azt2320 {
struct snd_wss *chip; struct snd_wss *chip;
}; };
static struct pnp_card_device_id snd_azt2320_pnpids[] = { static const struct pnp_card_device_id snd_azt2320_pnpids[] = {
/* PRO16V */ /* PRO16V */
{ .id = "AZT1008", .devs = { { "AZT1008" }, { "AZT2001" }, } }, { .id = "AZT1008", .devs = { { "AZT1008" }, { "AZT2001" }, } },
/* Aztech Sound Galaxy 16 */ /* Aztech Sound Galaxy 16 */

View File

@ -182,7 +182,7 @@ struct snd_cmi8330 {
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static struct pnp_card_device_id snd_cmi8330_pnpids[] = { static const struct pnp_card_device_id snd_cmi8330_pnpids[] = {
{ .id = "CMI0001", .devs = { { "@X@0001" }, { "@@@0001" }, { "@H@0001" }, { "A@@0001" } } }, { .id = "CMI0001", .devs = { { "@X@0001" }, { "@@@0001" }, { "@H@0001" }, { "A@@0001" } } },
{ .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } }, { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } },
{ .id = "" } { .id = "" }

View File

@ -109,13 +109,17 @@ static int snd_cs4231_probe(struct device *dev, unsigned int n)
if (error < 0) if (error < 0)
goto out; goto out;
strcpy(card->driver, "CS4231"); strlcpy(card->driver, "CS4231", sizeof(card->driver));
strcpy(card->shortname, chip->pcm->name); strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", if (dma2[n] < 0)
chip->pcm->name, chip->port, irq[n], dma1[n]); snprintf(card->longname, sizeof(card->longname),
if (dma2[n] >= 0) "%s at 0x%lx, irq %d, dma %d",
sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]); chip->pcm->name, chip->port, irq[n], dma1[n]);
else
snprintf(card->longname, sizeof(card->longname),
"%s at 0x%lx, irq %d, dma %d&%d",
chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]);
error = snd_wss_mixer(chip); error = snd_wss_mixer(chip);
if (error < 0) if (error < 0)

View File

@ -149,7 +149,7 @@ static const struct pnp_device_id snd_cs423x_pnpbiosids[] = {
MODULE_DEVICE_TABLE(pnp, snd_cs423x_pnpbiosids); MODULE_DEVICE_TABLE(pnp, snd_cs423x_pnpbiosids);
#define CS423X_ISAPNP_DRIVER "cs4232_isapnp" #define CS423X_ISAPNP_DRIVER "cs4232_isapnp"
static struct pnp_card_device_id snd_cs423x_pnpids[] = { static const struct pnp_card_device_id snd_cs423x_pnpids[] = {
/* Philips PCA70PS */ /* Philips PCA70PS */
{ .id = "CSC0d32", .devs = { { "CSC0000" }, { "CSC0010" }, { "PNPb006" } } }, { .id = "CSC0d32", .devs = { { "CSC0000" }, { "CSC0010" }, { "PNPb006" } } },
/* TerraTec Maestro 32/96 (CS4232) */ /* TerraTec Maestro 32/96 (CS4232) */
@ -419,15 +419,17 @@ static int snd_cs423x_probe(struct snd_card *card, int dev)
if (err < 0) if (err < 0)
return err; return err;
} }
strcpy(card->driver, chip->pcm->name); strlcpy(card->driver, chip->pcm->name, sizeof(card->driver));
strcpy(card->shortname, chip->pcm->name); strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname));
sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", if (dma2[dev] < 0)
chip->pcm->name, snprintf(card->longname, sizeof(card->longname),
chip->port, "%s at 0x%lx, irq %i, dma %i",
irq[dev], chip->pcm->name, chip->port, irq[dev], dma1[dev]);
dma1[dev]); else
if (dma2[dev] >= 0) snprintf(card->longname, sizeof(card->longname),
sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); "%s at 0x%lx, irq %i, dma %i&%d",
chip->pcm->name, chip->port, irq[dev], dma1[dev],
dma2[dev]);
err = snd_wss_timer(chip, 0); err = snd_wss_timer(chip, 0);
if (err < 0) if (err < 0)

View File

@ -321,7 +321,7 @@ static int snd_es968_pnp_resume(struct pnp_card_link *pcard)
} }
#endif #endif
static struct pnp_card_device_id snd_es968_pnpids[] = { static const struct pnp_card_device_id snd_es968_pnpids[] = {
{ .id = "ESS0968", .devs = { { "@@@0968" }, } }, { .id = "ESS0968", .devs = { { "@@@0968" }, } },
{ .id = "ESS0968", .devs = { { "ESS0968" }, } }, { .id = "ESS0968", .devs = { { "ESS0968" }, } },
{ .id = "", } /* end */ { .id = "", } /* end */

View File

@ -526,7 +526,7 @@ static snd_pcm_uframes_t snd_es1688_capture_pointer(struct snd_pcm_substream *su
*/ */
static struct snd_pcm_hardware snd_es1688_playback = static const struct snd_pcm_hardware snd_es1688_playback =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -544,7 +544,7 @@ static struct snd_pcm_hardware snd_es1688_playback =
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_es1688_capture = static const struct snd_pcm_hardware snd_es1688_capture =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -706,7 +706,7 @@ exit:
return err; return err;
} }
static struct snd_pcm_ops snd_es1688_playback_ops = { static const struct snd_pcm_ops snd_es1688_playback_ops = {
.open = snd_es1688_playback_open, .open = snd_es1688_playback_open,
.close = snd_es1688_playback_close, .close = snd_es1688_playback_close,
.ioctl = snd_es1688_ioctl, .ioctl = snd_es1688_ioctl,
@ -717,7 +717,7 @@ static struct snd_pcm_ops snd_es1688_playback_ops = {
.pointer = snd_es1688_playback_pointer, .pointer = snd_es1688_playback_pointer,
}; };
static struct snd_pcm_ops snd_es1688_capture_ops = { static const struct snd_pcm_ops snd_es1688_capture_ops = {
.open = snd_es1688_capture_open, .open = snd_es1688_capture_open,
.close = snd_es1688_capture_close, .close = snd_es1688_capture_close,
.ioctl = snd_es1688_ioctl, .ioctl = snd_es1688_ioctl,

View File

@ -838,7 +838,7 @@ static snd_pcm_uframes_t snd_es18xx_capture_pointer(struct snd_pcm_substream *su
return pos >> chip->dma1_shift; return pos >> chip->dma1_shift;
} }
static struct snd_pcm_hardware snd_es18xx_playback = static const struct snd_pcm_hardware snd_es18xx_playback =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_RESUME |
@ -858,7 +858,7 @@ static struct snd_pcm_hardware snd_es18xx_playback =
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_es18xx_capture = static const struct snd_pcm_hardware snd_es18xx_capture =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_RESUME |
@ -1665,7 +1665,7 @@ static int snd_es18xx_probe(struct snd_es18xx *chip,
return snd_es18xx_initialize(chip, mpu_port, fm_port); return snd_es18xx_initialize(chip, mpu_port, fm_port);
} }
static struct snd_pcm_ops snd_es18xx_playback_ops = { static const struct snd_pcm_ops snd_es18xx_playback_ops = {
.open = snd_es18xx_playback_open, .open = snd_es18xx_playback_open,
.close = snd_es18xx_playback_close, .close = snd_es18xx_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -1676,7 +1676,7 @@ static struct snd_pcm_ops snd_es18xx_playback_ops = {
.pointer = snd_es18xx_playback_pointer, .pointer = snd_es18xx_playback_pointer,
}; };
static struct snd_pcm_ops snd_es18xx_capture_ops = { static const struct snd_pcm_ops snd_es18xx_capture_ops = {
.open = snd_es18xx_capture_open, .open = snd_es18xx_capture_open,
.close = snd_es18xx_capture_close, .close = snd_es18xx_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -2017,7 +2017,7 @@ static int isa_registered;
static int pnp_registered; static int pnp_registered;
static int pnpc_registered; static int pnpc_registered;
static struct pnp_device_id snd_audiodrive_pnpbiosids[] = { static const struct pnp_device_id snd_audiodrive_pnpbiosids[] = {
{ .id = "ESS1869" }, { .id = "ESS1869" },
{ .id = "ESS1879" }, { .id = "ESS1879" },
{ .id = "" } /* end */ { .id = "" } /* end */
@ -2062,7 +2062,7 @@ static int snd_audiodrive_pnp(int dev, struct snd_es18xx *chip,
return 0; return 0;
} }
static struct pnp_card_device_id snd_audiodrive_pnpids[] = { static const struct pnp_card_device_id snd_audiodrive_pnpids[] = {
/* ESS 1868 (integrated on Compaq dual P-Pro motherboard and Genius 18PnP 3D) */ /* ESS 1868 (integrated on Compaq dual P-Pro motherboard and Genius 18PnP 3D) */
{ .id = "ESS1868", .devs = { { "ESS1868" }, { "ESS0000" } } }, { .id = "ESS1868", .devs = { { "ESS1868" }, { "ESS0000" } } },
/* ESS 1868 (integrated on Maxisound Cards) */ /* ESS 1868 (integrated on Maxisound Cards) */

View File

@ -650,7 +650,7 @@ static void snd_gf1_pcm_interrupt_dma_read(struct snd_gus_card * gus)
} }
} }
static struct snd_pcm_hardware snd_gf1_pcm_playback = static const struct snd_pcm_hardware snd_gf1_pcm_playback =
{ {
.info = SNDRV_PCM_INFO_NONINTERLEAVED, .info = SNDRV_PCM_INFO_NONINTERLEAVED,
.formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 |
@ -668,7 +668,7 @@ static struct snd_pcm_hardware snd_gf1_pcm_playback =
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_gf1_pcm_capture = static const struct snd_pcm_hardware snd_gf1_pcm_capture =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -842,7 +842,7 @@ static const struct snd_kcontrol_new snd_gf1_pcm_volume_control1 =
.put = snd_gf1_pcm_volume_put .put = snd_gf1_pcm_volume_put
}; };
static struct snd_pcm_ops snd_gf1_pcm_playback_ops = { static const struct snd_pcm_ops snd_gf1_pcm_playback_ops = {
.open = snd_gf1_pcm_playback_open, .open = snd_gf1_pcm_playback_open,
.close = snd_gf1_pcm_playback_close, .close = snd_gf1_pcm_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -856,7 +856,7 @@ static struct snd_pcm_ops snd_gf1_pcm_playback_ops = {
.fill_silence = snd_gf1_pcm_playback_silence, .fill_silence = snd_gf1_pcm_playback_silence,
}; };
static struct snd_pcm_ops snd_gf1_pcm_capture_ops = { static const struct snd_pcm_ops snd_gf1_pcm_capture_ops = {
.open = snd_gf1_pcm_capture_open, .open = snd_gf1_pcm_capture_open,
.close = snd_gf1_pcm_capture_close, .close = snd_gf1_pcm_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -136,7 +136,7 @@ struct snd_interwave {
static int isa_registered; static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id snd_interwave_pnpids[] = { static const struct pnp_card_device_id snd_interwave_pnpids[] = {
#ifndef SNDRV_STB #ifndef SNDRV_STB
/* Gravis UltraSound Plug & Play */ /* Gravis UltraSound Plug & Play */
{ .id = "GRV0001", .devs = { { .id = "GRV0000" } } }, { .id = "GRV0001", .devs = { { .id = "GRV0000" } } },

View File

@ -437,7 +437,7 @@ static void snd_msnd_capture_reset_queue(struct snd_msnd *chip,
} }
} }
static struct snd_pcm_hardware snd_msnd_playback = { static const struct snd_pcm_hardware snd_msnd_playback = {
.info = SNDRV_PCM_INFO_MMAP | .info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
@ -456,7 +456,7 @@ static struct snd_pcm_hardware snd_msnd_playback = {
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_msnd_capture = { static const struct snd_pcm_hardware snd_msnd_capture = {
.info = SNDRV_PCM_INFO_MMAP | .info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
@ -572,7 +572,7 @@ snd_msnd_playback_pointer(struct snd_pcm_substream *substream)
} }
static struct snd_pcm_ops snd_msnd_playback_ops = { static const struct snd_pcm_ops snd_msnd_playback_ops = {
.open = snd_msnd_playback_open, .open = snd_msnd_playback_open,
.close = snd_msnd_playback_close, .close = snd_msnd_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -669,7 +669,7 @@ static int snd_msnd_capture_hw_params(struct snd_pcm_substream *substream,
} }
static struct snd_pcm_ops snd_msnd_capture_ops = { static const struct snd_pcm_ops snd_msnd_capture_ops = {
.open = snd_msnd_capture_open, .open = snd_msnd_capture_open,
.close = snd_msnd_capture_close, .close = snd_msnd_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -1192,7 +1192,7 @@ static void snd_msnd_pnp_remove(struct pnp_card_link *pcard)
static int isa_registered; static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id msnd_pnpids[] = { static const struct pnp_card_device_id msnd_pnpids[] = {
/* Pinnacle PnP */ /* Pinnacle PnP */
{ .id = "BVJ0440", .devs = { { "TBS0000" }, { "TBS0001" } } }, { .id = "BVJ0440", .devs = { { "TBS0000" }, { "TBS0001" } } },
{ .id = "" } /* end */ { .id = "" } /* end */

View File

@ -141,7 +141,7 @@ struct snd_opl3sa2 {
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { static const struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
{ .id = "YMH0021" }, { .id = "YMH0021" },
{ .id = "NMX2210" }, /* Gateway Solo 2500 */ { .id = "NMX2210" }, /* Gateway Solo 2500 */
{ .id = "" } /* end */ { .id = "" } /* end */
@ -149,7 +149,7 @@ static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
MODULE_DEVICE_TABLE(pnp, snd_opl3sa2_pnpbiosids); MODULE_DEVICE_TABLE(pnp, snd_opl3sa2_pnpbiosids);
static struct pnp_card_device_id snd_opl3sa2_pnpids[] = { static const struct pnp_card_device_id snd_opl3sa2_pnpids[] = {
/* Yamaha YMF719E-S (Genius Sound Maker 3DX) */ /* Yamaha YMF719E-S (Genius Sound Maker 3DX) */
{ .id = "YMH0020", .devs = { { "YMH0021" } } }, { .id = "YMH0020", .devs = { { "YMH0021" } } },
/* Yamaha OPL3-SA3 (integrated on Intel's Pentium II AL440LX motherboard) */ /* Yamaha OPL3-SA3 (integrated on Intel's Pentium II AL440LX motherboard) */

View File

@ -143,7 +143,7 @@ static int snd_miro_pnp_is_probed;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static struct pnp_card_device_id snd_miro_pnpids[] = { static const struct pnp_card_device_id snd_miro_pnpids[] = {
/* PCM20 and PCM12 in PnP mode */ /* PCM20 and PCM12 in PnP mode */
{ .id = "MIR0924", { .id = "MIR0924",
.devs = { { "MIR0000" }, { "MIR0002" }, { "MIR0005" } }, }, .devs = { { "MIR0000" }, { "MIR0002" }, { "MIR0005" } }, },
@ -1353,9 +1353,10 @@ static int snd_miro_probe(struct snd_card *card)
} }
strcpy(card->driver, "miro"); strcpy(card->driver, "miro");
sprintf(card->longname, "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d", snprintf(card->longname, sizeof(card->longname),
card->shortname, miro->name, codec->pcm->name, "%s: OPTi%s, %s at 0x%lx, irq %d, dma %d&%d",
miro->wss_base + 4, miro->irq, miro->dma1, miro->dma2); card->shortname, miro->name, codec->pcm->name,
miro->wss_base + 4, miro->irq, miro->dma1, miro->dma2);
if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
rmidi = NULL; rmidi = NULL;

View File

@ -151,7 +151,7 @@ static int snd_opti9xx_pnp_is_probed;
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static struct pnp_card_device_id snd_opti9xx_pnpids[] = { static const struct pnp_card_device_id snd_opti9xx_pnpids[] = {
#ifndef OPTi93X #ifndef OPTi93X
/* OPTi 82C924 */ /* OPTi 82C924 */
{ .id = "OPT0924", { .id = "OPT0924",
@ -879,13 +879,15 @@ static int snd_opti9xx_probe(struct snd_card *card)
strcpy(card->driver, chip->name); strcpy(card->driver, chip->name);
sprintf(card->shortname, "OPTi %s", card->driver); sprintf(card->shortname, "OPTi %s", card->driver);
#if defined(CS4231) || defined(OPTi93X) #if defined(CS4231) || defined(OPTi93X)
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", snprintf(card->longname, sizeof(card->longname),
card->shortname, codec->pcm->name, "%s, %s at 0x%lx, irq %d, dma %d&%d",
chip->wss_base + 4, irq, dma1, xdma2); card->shortname, codec->pcm->name,
chip->wss_base + 4, irq, dma1, xdma2);
#else #else
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", snprintf(card->longname, sizeof(card->longname),
card->shortname, codec->pcm->name, chip->wss_base + 4, irq, "%s, %s at 0x%lx, irq %d, dma %d",
dma1); card->shortname, codec->pcm->name, chip->wss_base + 4, irq,
dma1);
#endif /* CS4231 || OPTi93X */ #endif /* CS4231 || OPTi93X */
if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT) if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)

View File

@ -62,7 +62,7 @@ static void snd_emu8000_tweak_voice(struct snd_emu8000 *emu, int ch);
/* /*
* set up operators * set up operators
*/ */
static struct snd_emux_operators emu8000_ops = { static const struct snd_emux_operators emu8000_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.get_voice = get_voice, .get_voice = get_voice,
.prepare = start_voice, .prepare = start_voice,

View File

@ -157,7 +157,7 @@ static int calc_rate_offset(int hz)
/* /*
*/ */
static struct snd_pcm_hardware emu8k_pcm_hw = { static const struct snd_pcm_hardware emu8k_pcm_hw = {
#ifdef USE_NONINTERLEAVE #ifdef USE_NONINTERLEAVE
.info = SNDRV_PCM_INFO_NONINTERLEAVED, .info = SNDRV_PCM_INFO_NONINTERLEAVED,
#else #else
@ -670,7 +670,7 @@ static snd_pcm_uframes_t emu8k_pcm_pointer(struct snd_pcm_substream *subs)
} }
static struct snd_pcm_ops emu8k_pcm_ops = { static const struct snd_pcm_ops emu8k_pcm_ops = {
.open = emu8k_pcm_open, .open = emu8k_pcm_open,
.close = emu8k_pcm_close, .close = emu8k_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -145,7 +145,7 @@ struct snd_card_sb16 {
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
static struct pnp_card_device_id snd_sb16_pnpids[] = { static const struct pnp_card_device_id snd_sb16_pnpids[] = {
#ifndef SNDRV_SBAWE #ifndef SNDRV_SBAWE
/* Sound Blaster 16 PnP */ /* Sound Blaster 16 PnP */
{ .id = "CTL0024", .devs = { { "CTL0031" } } }, { .id = "CTL0024", .devs = { { "CTL0031" } } },

View File

@ -473,7 +473,7 @@ static snd_pcm_uframes_t snd_sb16_capture_pointer(struct snd_pcm_substream *subs
*/ */
static struct snd_pcm_hardware snd_sb16_playback = static const struct snd_pcm_hardware snd_sb16_playback =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -491,7 +491,7 @@ static struct snd_pcm_hardware snd_sb16_playback =
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_sb16_capture = static const struct snd_pcm_hardware snd_sb16_capture =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -838,7 +838,7 @@ int snd_sb16dsp_configure(struct snd_sb * chip)
return 0; return 0;
} }
static struct snd_pcm_ops snd_sb16_playback_ops = { static const struct snd_pcm_ops snd_sb16_playback_ops = {
.open = snd_sb16_playback_open, .open = snd_sb16_playback_open,
.close = snd_sb16_playback_close, .close = snd_sb16_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -849,7 +849,7 @@ static struct snd_pcm_ops snd_sb16_playback_ops = {
.pointer = snd_sb16_playback_pointer, .pointer = snd_sb16_playback_pointer,
}; };
static struct snd_pcm_ops snd_sb16_capture_ops = { static const struct snd_pcm_ops snd_sb16_capture_ops = {
.open = snd_sb16_capture_open, .open = snd_sb16_capture_open,
.close = snd_sb16_capture_close, .close = snd_sb16_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -447,7 +447,7 @@ static snd_pcm_uframes_t snd_sb8_capture_pointer(struct snd_pcm_substream *subst
*/ */
static struct snd_pcm_hardware snd_sb8_playback = static const struct snd_pcm_hardware snd_sb8_playback =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -466,7 +466,7 @@ static struct snd_pcm_hardware snd_sb8_playback =
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_sb8_capture = static const struct snd_pcm_hardware snd_sb8_capture =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID), SNDRV_PCM_INFO_MMAP_VALID),
@ -572,7 +572,7 @@ static int snd_sb8_close(struct snd_pcm_substream *substream)
* Initialization part * Initialization part
*/ */
static struct snd_pcm_ops snd_sb8_playback_ops = { static const struct snd_pcm_ops snd_sb8_playback_ops = {
.open = snd_sb8_open, .open = snd_sb8_open,
.close = snd_sb8_close, .close = snd_sb8_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -583,7 +583,7 @@ static struct snd_pcm_ops snd_sb8_playback_ops = {
.pointer = snd_sb8_playback_pointer, .pointer = snd_sb8_playback_pointer,
}; };
static struct snd_pcm_ops snd_sb8_capture_ops = { static const struct snd_pcm_ops snd_sb8_capture_ops = {
.open = snd_sb8_open, .open = snd_sb8_open,
.close = snd_sb8_close, .close = snd_sb8_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -88,7 +88,7 @@ MODULE_PARM_DESC(joystick, "Enable gameport.");
static int isa_registered; static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id sscape_pnpids[] = { static const struct pnp_card_device_id sscape_pnpids[] = {
{ .id = "ENS3081", .devs = { { "ENS0000" } } }, /* Soundscape PnP */ { .id = "ENS3081", .devs = { { "ENS0000" } } }, /* Soundscape PnP */
{ .id = "ENS4081", .devs = { { "ENS1011" } } }, /* VIVO90 */ { .id = "ENS4081", .devs = { { "ENS1011" } } }, /* VIVO90 */
{ .id = "" } /* end */ { .id = "" } /* end */

View File

@ -88,7 +88,7 @@ MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly lo
static int isa_registered; static int isa_registered;
static int pnp_registered; static int pnp_registered;
static struct pnp_card_device_id snd_wavefront_pnpids[] = { static const struct pnp_card_device_id snd_wavefront_pnpids[] = {
/* Tropez */ /* Tropez */
{ .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } }, { .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },
/* Tropez+ */ /* Tropez+ */

View File

@ -1452,7 +1452,7 @@ static int snd_wss_probe(struct snd_wss *chip)
*/ */
static struct snd_pcm_hardware snd_wss_playback = static const struct snd_pcm_hardware snd_wss_playback =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
@ -1472,7 +1472,7 @@ static struct snd_pcm_hardware snd_wss_playback =
.fifo_size = 0, .fifo_size = 0,
}; };
static struct snd_pcm_hardware snd_wss_capture = static const struct snd_pcm_hardware snd_wss_capture =
{ {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
@ -1901,7 +1901,7 @@ int snd_wss_create(struct snd_card *card,
} }
EXPORT_SYMBOL(snd_wss_create); EXPORT_SYMBOL(snd_wss_create);
static struct snd_pcm_ops snd_wss_playback_ops = { static const struct snd_pcm_ops snd_wss_playback_ops = {
.open = snd_wss_playback_open, .open = snd_wss_playback_open,
.close = snd_wss_playback_close, .close = snd_wss_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -1912,7 +1912,7 @@ static struct snd_pcm_ops snd_wss_playback_ops = {
.pointer = snd_wss_playback_pointer, .pointer = snd_wss_playback_pointer,
}; };
static struct snd_pcm_ops snd_wss_capture_ops = { static const struct snd_pcm_ops snd_wss_capture_ops = {
.open = snd_wss_capture_open, .open = snd_wss_capture_open,
.close = snd_wss_capture_close, .close = snd_wss_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -496,7 +496,7 @@ static void hal2_free_dmabuf(struct hal2_codec *codec)
DMA_ATTR_NON_CONSISTENT); DMA_ATTR_NON_CONSISTENT);
} }
static struct snd_pcm_hardware hal2_pcm_hw = { static const struct snd_pcm_hardware hal2_pcm_hw = {
.info = (SNDRV_PCM_INFO_MMAP | .info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
@ -711,7 +711,7 @@ static int hal2_capture_ack(struct snd_pcm_substream *substream)
hal2_capture_transfer); hal2_capture_transfer);
} }
static struct snd_pcm_ops hal2_playback_ops = { static const struct snd_pcm_ops hal2_playback_ops = {
.open = hal2_playback_open, .open = hal2_playback_open,
.close = hal2_playback_close, .close = hal2_playback_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -723,7 +723,7 @@ static struct snd_pcm_ops hal2_playback_ops = {
.ack = hal2_playback_ack, .ack = hal2_playback_ack,
}; };
static struct snd_pcm_ops hal2_capture_ops = { static const struct snd_pcm_ops hal2_capture_ops = {
.open = hal2_capture_open, .open = hal2_capture_open,
.close = hal2_capture_close, .close = hal2_capture_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

View File

@ -532,7 +532,7 @@ static irqreturn_t snd_sgio2audio_error_isr(int irq, void *dev_id)
/* PCM part */ /* PCM part */
/* PCM hardware definition */ /* PCM hardware definition */
static struct snd_pcm_hardware snd_sgio2audio_pcm_hw = { static const struct snd_pcm_hardware snd_sgio2audio_pcm_hw = {
.info = (SNDRV_PCM_INFO_MMAP | .info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_INTERLEAVED |
@ -675,7 +675,7 @@ snd_sgio2audio_pcm_pointer(struct snd_pcm_substream *substream)
} }
/* operators */ /* operators */
static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
.open = snd_sgio2audio_playback1_open, .open = snd_sgio2audio_playback1_open,
.close = snd_sgio2audio_pcm_close, .close = snd_sgio2audio_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -688,7 +688,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
.mmap = snd_pcm_lib_mmap_vmalloc, .mmap = snd_pcm_lib_mmap_vmalloc,
}; };
static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
.open = snd_sgio2audio_playback2_open, .open = snd_sgio2audio_playback2_open,
.close = snd_sgio2audio_pcm_close, .close = snd_sgio2audio_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,
@ -701,7 +701,7 @@ static struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
.mmap = snd_pcm_lib_mmap_vmalloc, .mmap = snd_pcm_lib_mmap_vmalloc,
}; };
static struct snd_pcm_ops snd_sgio2audio_capture_ops = { static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
.open = snd_sgio2audio_capture_open, .open = snd_sgio2audio_capture_open,
.close = snd_sgio2audio_pcm_close, .close = snd_sgio2audio_pcm_close,
.ioctl = snd_pcm_lib_ioctl, .ioctl = snd_pcm_lib_ioctl,

Some files were not shown because too many files have changed in this diff Show More