Pull sound updates from Takashi Iwai: "The majority of changes at this time were about ASoC with a lot of code refactoring works. From the functionality POV, there isn't much to see, but we have a wide range of device-specific fixes and updates. Here are some highlights: - Continued ASoC API cleanup work, spanned over many files - Added a SoundWire SCDA generic class driver with regmap support - Enhancements and fixes for Cirrus, Intel, Maxim and Qualcomm. - Support for ASoC Allwinner A523, Mediatek MT8189, Qualcomm QCM2290, QRB2210 and SM6115, SpacemiT K1, and TI TAS2568, TAS5802, TAS5806, TAS5815, TAS5828 and TAS5830 - Usual HD-audio and USB-audio quirks and fixups - Support for Onkyo SE-300PCIE, TASCAM IF-FW/DM MkII Some gpiolib changes for shared GPIOs are included along with this PR for covering ASoC drivers changes" * tag 'sound-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (739 commits) ALSA: hda/realtek: Add PCI SSIDs to HP ProBook quirks ALSA: usb-audio: Simplify with usb_endpoint_max_periodic_payload() ALSA: hda/realtek: fix mute/micmute LEDs don't work for more HP laptops ALSA: rawmidi: Fix inconsistent indenting warning reported by smatch ALSA: dice: fix buffer overflow in detect_stream_formats() ASoC: codecs: Modify awinic amplifier dsp read and write functions ASoC: SDCA: Fixup some more Kconfig issues ASoC: cs35l56: Log a message if firmware is missing ASoC: nau8325: Delete a stray tab firmware: cs_dsp: Add test cases for client_ops == NULL firmware: cs_dsp: Don't require client to provide a struct cs_dsp_client_ops ASoC: fsl_micfil: Set channel range control ASoC: fsl_micfil: Add default quality for different platforms ASoC: intel: sof_sdw: Add codec_info for cs42l45 ASoC: sdw_utils: Add cs42l45 support functions ASoC: intel: sof_sdw: Add ability to have auxiliary devices ASoC: sdw_utils: Move codec_name to dai info ASoC: sdw_utils: Add codec_conf for every DAI ASoC: SDCA: Add terminal type into input/output widget name ASoC: SDCA: Align mute controls to ALSA expectations ...
Unified · Split
| @@ -1,60 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/adi,max98363.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Analog Devices MAX98363 SoundWire Amplifier | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Ryan Lee <ryans.lee@analog.com> | ||
| 11 | |||
| 12 | description: | ||
| 13 | The MAX98363 is a SoundWire input Class D mono amplifier that | ||
| 14 | supports MIPI SoundWire v1.2-compatible digital interface for | ||
| 15 | audio and control data. | ||
| 16 | SoundWire peripheral device ID of MAX98363 is 0x3*019f836300 | ||
| 17 | where * is the peripheral device unique ID decoded from pin. | ||
| 18 | It supports up to 10 peripheral devices(0x0 to 0x9). | ||
| 19 | |||
| 20 | allOf: | ||
| 21 | - $ref: dai-common.yaml# | ||
| 22 | |||
| 23 | properties: | ||
| 24 | compatible: | ||
| 25 | const: sdw3019f836300 | ||
| 26 | |||
| 27 | reg: | ||
| 28 | maxItems: 1 | ||
| 29 | |||
| 30 | '#sound-dai-cells': | ||
| 31 | const: 0 | ||
| 32 | |||
| 33 | required: | ||
| 34 | - compatible | ||
| 35 | - reg | ||
| 36 | - "#sound-dai-cells" | ||
| 37 | |||
| 38 | unevaluatedProperties: false | ||
| 39 | |||
| 40 | examples: | ||
| 41 | - | | ||
| 42 | soundwire@3250000 { | ||
| 43 | #address-cells = <2>; | ||
| 44 | #size-cells = <0>; | ||
| 45 | reg = <0x3250000 0x2000>; | ||
| 46 | |||
| 47 | speaker@0,0 { | ||
| 48 | compatible = "sdw3019f836300"; | ||
| 49 | reg = <0 0>; | ||
| 50 | #sound-dai-cells = <0>; | ||
| 51 | sound-name-prefix = "Speaker Left"; | ||
| 52 | }; | ||
| 53 | |||
| 54 | speaker@0,1 { | ||
| 55 | compatible = "sdw3019f836300"; | ||
| 56 | reg = <0 1>; | ||
| 57 | #sound-dai-cells = <0>; | ||
| 58 | sound-name-prefix = "Speaker Right"; | ||
| 59 | }; | ||
| 60 | }; | ||
| @@ -1,19 +0,0 @@ | |||
| 1 | Analog Devices SSM2602, SSM2603 and SSM2604 I2S audio CODEC devices | ||
| 2 | |||
| 3 | SSM2602 support both I2C and SPI as the configuration interface, | ||
| 4 | the selection is made by the MODE strap-in pin. | ||
| 5 | SSM2603 and SSM2604 only support I2C as the configuration interface. | ||
| 6 | |||
| 7 | Required properties: | ||
| 8 | |||
| 9 | - compatible : One of "adi,ssm2602", "adi,ssm2603" or "adi,ssm2604" | ||
| 10 | |||
| 11 | - reg : the I2C address of the device for I2C, the chip select | ||
| 12 | number for SPI. | ||
| 13 | |||
| 14 | Example: | ||
| 15 | |||
| 16 | ssm2602: ssm2602@1a { | ||
| 17 | compatible = "adi,ssm2602"; | ||
| 18 | reg = <0x1a>; | ||
| 19 | }; | ||
| @@ -1,49 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/adi,ssm3515.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Analog Devices SSM3515 Audio Amplifier | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Martin Povišer <povik+lin@cutebit.org> | ||
| 11 | |||
| 12 | description: | | ||
| 13 | SSM3515 is a mono Class-D audio amplifier with digital input. | ||
| 14 | |||
| 15 | https://www.analog.com/media/en/technical-documentation/data-sheets/SSM3515.pdf | ||
| 16 | |||
| 17 | allOf: | ||
| 18 | - $ref: dai-common.yaml# | ||
| 19 | |||
| 20 | properties: | ||
| 21 | compatible: | ||
| 22 | enum: | ||
| 23 | - adi,ssm3515 | ||
| 24 | |||
| 25 | reg: | ||
| 26 | maxItems: 1 | ||
| 27 | |||
| 28 | '#sound-dai-cells': | ||
| 29 | const: 0 | ||
| 30 | |||
| 31 | required: | ||
| 32 | - compatible | ||
| 33 | - reg | ||
| 34 | |||
| 35 | unevaluatedProperties: false | ||
| 36 | |||
| 37 | examples: | ||
| 38 | - | | ||
| 39 | i2c { | ||
| 40 | #address-cells = <1>; | ||
| 41 | #size-cells = <0>; | ||
| 42 | |||
| 43 | codec@14 { | ||
| 44 | compatible = "adi,ssm3515"; | ||
| 45 | reg = <0x14>; | ||
| 46 | #sound-dai-cells = <0>; | ||
| 47 | sound-name-prefix = "Left Tweeter"; | ||
| 48 | }; | ||
| 49 | }; | ||
| @@ -33,7 +33,9 @@ properties: · 32 unmodified lines | |||
| 33 | - const: allwinner,sun50i-h6-i2s | 33 | - const: allwinner,sun50i-h6-i2s |
| 34 | - const: allwinner,sun50i-r329-i2s | 34 | - const: allwinner,sun50i-r329-i2s |
| 35 | - items: | 35 | - items: |
| 36 | - const: allwinner,sun20i-d1-i2s | 36 | - enum: |
| 37 | - allwinner,sun20i-d1-i2s | ||
| 38 | - allwinner,sun55i-a523-i2s | ||
| 37 | - const: allwinner,sun50i-r329-i2s | 39 | - const: allwinner,sun50i-r329-i2s |
| 38 | 40 | ||
| 39 | reg: | 41 | reg: |
| @@ -23,6 +23,7 @@ properties: · 22 unmodified lines | |||
| 23 | - const: allwinner,sun8i-h3-spdif | 23 | - const: allwinner,sun8i-h3-spdif |
| 24 | - const: allwinner,sun50i-h6-spdif | 24 | - const: allwinner,sun50i-h6-spdif |
| 25 | - const: allwinner,sun50i-h616-spdif | 25 | - const: allwinner,sun50i-h616-spdif |
| 26 | - const: allwinner,sun55i-a523-spdif | ||
| 26 | - items: | 27 | - items: |
| 27 | - const: allwinner,sun8i-a83t-spdif | 28 | - const: allwinner,sun8i-a83t-spdif |
| 28 | - const: allwinner,sun8i-h3-spdif | 29 | - const: allwinner,sun8i-h3-spdif |
| @@ -37,14 +38,12 @@ properties: · 8 unmodified lines | |||
| 37 | maxItems: 1 | 38 | maxItems: 1 |
| 38 | 39 | ||
| 39 | clocks: | 40 | clocks: |
| 40 | items: | 41 | minItems: 2 |
| 41 | - description: Bus Clock | 42 | maxItems: 3 |
| 42 | - description: Module Clock | ||
| 43 | 43 | ||
| 44 | clock-names: | 44 | clock-names: |
| 45 | items: | 45 | minItems: 2 |
| 46 | - const: apb | 46 | maxItems: 3 |
| 47 | - const: spdif | ||
| 48 | 47 | ||
| 49 | # Even though it only applies to subschemas under the conditionals, | 48 | # Even though it only applies to subschemas under the conditionals, |
| 50 | # not listing them here will trigger a warning because of the | 49 | # not listing them here will trigger a warning because of the |
| @@ -65,6 +64,7 @@ allOf: · 14 unmodified lines | |||
| 65 | - allwinner,sun8i-h3-spdif | 64 | - allwinner,sun8i-h3-spdif |
| 66 | - allwinner,sun50i-h6-spdif | 65 | - allwinner,sun50i-h6-spdif |
| 67 | - allwinner,sun50i-h616-spdif | 66 | - allwinner,sun50i-h616-spdif |
| 67 | - allwinner,sun55i-a523-spdif | ||
| 68 | 68 | ||
| 69 | then: | 69 | then: |
| 70 | required: | 70 | required: |
| @@ -98,6 +98,38 @@ allOf: · 27 unmodified lines | |||
| 98 | - const: rx | 98 | - const: rx |
| 99 | - const: tx | 99 | - const: tx |
| 100 | 100 | ||
| 101 | - if: | ||
| 102 | properties: | ||
| 103 | compatible: | ||
| 104 | contains: | ||
| 105 | enum: | ||
| 106 | - allwinner,sun55i-a523-spdif | ||
| 107 | |||
| 108 | then: | ||
| 109 | properties: | ||
| 110 | clocks: | ||
| 111 | items: | ||
| 112 | - description: Bus Clock | ||
| 113 | - description: TX Clock | ||
| 114 | - description: RX Clock | ||
| 115 | |||
| 116 | clock-names: | ||
| 117 | items: | ||
| 118 | - const: apb | ||
| 119 | - const: tx | ||
| 120 | - const: rx | ||
| 121 | else: | ||
| 122 | properties: | ||
| 123 | clocks: | ||
| 124 | items: | ||
| 125 | - description: Bus Clock | ||
| 126 | - description: Module Clock | ||
| 127 | |||
| 128 | clock-names: | ||
| 129 | items: | ||
| 130 | - const: apb | ||
| 131 | - const: spdif | ||
| 132 | |||
| 101 | required: | 133 | required: |
| 102 | - "#sound-dai-cells" | 134 | - "#sound-dai-cells" |
| 103 | - compatible | 135 | - compatible |
| @@ -25,6 +25,16 @@ properties: · 24 unmodified lines | |||
| 25 | reg: | 25 | reg: |
| 26 | maxItems: 1 | 26 | maxItems: 1 |
| 27 | 27 | ||
| 28 | clocks: | ||
| 29 | items: | ||
| 30 | - description: | ||
| 31 | Master clock connected to the MCLK pin if MCLK is an input (i.e. no | ||
| 32 | crystal used). | ||
| 33 | |||
| 34 | clock-names: | ||
| 35 | items: | ||
| 36 | - const: mclk | ||
| 37 | |||
| 28 | spi-cpha: true | 38 | spi-cpha: true |
| 29 | 39 | ||
| 30 | spi-cpol: true | 40 | spi-cpol: true |
| @@ -15,10 +15,15 @@ description: · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | allOf: | 16 | allOf: |
| 17 | - $ref: dai-common.yaml# | 17 | - $ref: dai-common.yaml# |
| 18 | - $ref: /schemas/spi/spi-peripheral-props.yaml# | ||
| 18 | 19 | ||
| 19 | properties: | 20 | properties: |
| 20 | compatible: | 21 | compatible: |
| 21 | enum: | 22 | enum: |
| 23 | - cirrus,cs4282 | ||
| 24 | - cirrus,cs4302 | ||
| 25 | - cirrus,cs4304 | ||
| 26 | - cirrus,cs4308 | ||
| 22 | - cirrus,cs5302 | 27 | - cirrus,cs5302 |
| 23 | - cirrus,cs5304 | 28 | - cirrus,cs5304 |
| 24 | - cirrus,cs5308 | 29 | - cirrus,cs5308 |
| @@ -26,6 +31,9 @@ properties: · 1 unmodified line | |||
| 26 | reg: | 31 | reg: |
| 27 | maxItems: 1 | 32 | maxItems: 1 |
| 28 | 33 | ||
| 34 | spi-max-frequency: | ||
| 35 | maximum: 24000000 | ||
| 36 | |||
| 29 | '#sound-dai-cells': | 37 | '#sound-dai-cells': |
| 30 | const: 1 | 38 | const: 1 |
| 31 | 39 | ||
| @@ -1,29 +0,0 @@ | |||
| 1 | CS4265 audio CODEC | ||
| 2 | |||
| 3 | This device supports I2C only. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : "cirrus,cs4265" | ||
| 8 | |||
| 9 | - reg : the I2C address of the device for I2C. The I2C address depends on | ||
| 10 | the state of the AD0 pin. If AD0 is high, the i2c address is 0x4f. | ||
| 11 | If it is low, the i2c address is 0x4e. | ||
| 12 | |||
| 13 | Optional properties: | ||
| 14 | |||
| 15 | - reset-gpios : a GPIO spec for the reset pin. If specified, it will be | ||
| 16 | deasserted before communication to the codec starts. | ||
| 17 | |||
| 18 | Examples: | ||
| 19 | |||
| 20 | codec_ad0_high: cs4265@4f { /* AD0 Pin is high */ | ||
| 21 | compatible = "cirrus,cs4265"; | ||
| 22 | reg = <0x4f>; | ||
| 23 | }; | ||
| 24 | |||
| 25 | |||
| 26 | codec_ad0_low: cs4265@4e { /* AD0 Pin is low */ | ||
| 27 | compatible = "cirrus,cs4265"; | ||
| 28 | reg = <0x4e>; | ||
| 29 | }; | ||
| @@ -1,22 +0,0 @@ | |||
| 1 | Cirrus Logic CS4341 audio DAC | ||
| 2 | |||
| 3 | This device supports both I2C and SPI (configured with pin strapping | ||
| 4 | on the board). | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | - compatible: "cirrus,cs4341a" | ||
| 8 | - reg : the I2C address of the device for I2C, the chip select | ||
| 9 | number for SPI. | ||
| 10 | |||
| 11 | For required properties on I2C-bus, please consult | ||
| 12 | dtschema schemas/i2c/i2c-controller.yaml | ||
| 13 | For required properties on SPI-bus, please consult | ||
| 14 | Documentation/devicetree/bindings/spi/spi-bus.txt | ||
| 15 | |||
| 16 | Example: | ||
| 17 | codec: cs4341@0 { | ||
| 18 | #sound-dai-cells = <0>; | ||
| 19 | compatible = "cirrus,cs4341a"; | ||
| 20 | reg = <0>; | ||
| 21 | spi-max-frequency = <6000000>; | ||
| 22 | }; | ||
| @@ -1,19 +0,0 @@ | |||
| 1 | CS4349 audio CODEC | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | |||
| 5 | - compatible : "cirrus,cs4349" | ||
| 6 | |||
| 7 | - reg : the I2C address of the device for I2C | ||
| 8 | |||
| 9 | Optional properties: | ||
| 10 | |||
| 11 | - reset-gpios : a GPIO spec for the reset pin. | ||
| 12 | |||
| 13 | Example: | ||
| 14 | |||
| 15 | codec: cs4349@48 { | ||
| 16 | compatible = "cirrus,cs4349"; | ||
| 17 | reg = <0x48>; | ||
| 18 | reset-gpios = <&gpio 54 0>; | ||
| 19 | }; | ||
| @@ -1,22 +0,0 @@ | |||
| 1 | * Dialog DA9055 Audio CODEC | ||
| 2 | |||
| 3 | DA9055 provides Audio CODEC support (I2C only). | ||
| 4 | |||
| 5 | The Audio CODEC device in DA9055 has its own I2C address which is configurable, | ||
| 6 | so the device is instantiated separately from the PMIC (MFD) device. | ||
| 7 | |||
| 8 | For details on accompanying PMIC I2C device, see the following: | ||
| 9 | Documentation/devicetree/bindings/mfd/da9055.txt | ||
| 10 | |||
| 11 | Required properties: | ||
| 12 | |||
| 13 | - compatible: "dlg,da9055-codec" | ||
| 14 | - reg: Specifies the I2C slave address | ||
| 15 | |||
| 16 | |||
| 17 | Example: | ||
| 18 | |||
| 19 | codec: da9055-codec@1a { | ||
| 20 | compatible = "dlg,da9055-codec"; | ||
| 21 | reg = <0x1a>; | ||
| 22 | }; | ||
| @@ -0,0 +1,178 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/mediatek,mt8189-afe-pcm.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: MediaTek Audio Front End PCM controller for MT8189 | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Darren Ye <darren.ye@mediatek.com> | ||
| 11 | - Cyril Chao <cyril.chao@mediatek.com> | ||
| 12 | |||
| 13 | properties: | ||
| 14 | compatible: | ||
| 15 | const: mediatek,mt8189-afe-pcm | ||
| 16 | |||
| 17 | reg: | ||
| 18 | maxItems: 1 | ||
| 19 | |||
| 20 | interrupts: | ||
| 21 | maxItems: 1 | ||
| 22 | |||
| 23 | memory-region: | ||
| 24 | maxItems: 1 | ||
| 25 | |||
| 26 | mediatek,apmixedsys: | ||
| 27 | $ref: /schemas/types.yaml#/definitions/phandle | ||
| 28 | description: To set up the apll12 tuner | ||
| 29 | |||
| 30 | power-domains: | ||
| 31 | maxItems: 1 | ||
| 32 | |||
| 33 | clocks: | ||
| 34 | items: | ||
| 35 | - description: mux for audio intbus | ||
| 36 | - description: mux for audio engen1 | ||
| 37 | - description: mux for audio engen2 | ||
| 38 | - description: mux for audio h | ||
| 39 | - description: audio apll1 clock | ||
| 40 | - description: audio apll2 clock | ||
| 41 | - description: audio apll1 divide4 | ||
| 42 | - description: audio apll2 divide4 | ||
| 43 | - description: audio apll12 divide for i2sin0 | ||
| 44 | - description: audio apll12 divide for i2sin1 | ||
| 45 | - description: audio apll12 divide for i2sout0 | ||
| 46 | - description: audio apll12 divide for i2sout1 | ||
| 47 | - description: audio apll12 divide for fmi2s | ||
| 48 | - description: audio apll12 divide for tdmout mck | ||
| 49 | - description: audio apll12 divide for tdmout bck | ||
| 50 | - description: mux for audio apll1 | ||
| 51 | - description: mux for audio apll2 | ||
| 52 | - description: mux for i2sin0 mck | ||
| 53 | - description: mux for i2sin1 mck | ||
| 54 | - description: mux for i2sout0 mck | ||
| 55 | - description: mux for i2sout1 mck | ||
| 56 | - description: mux for fmi2s mck | ||
| 57 | - description: mux for tdmout mck | ||
| 58 | - description: 26m clock | ||
| 59 | - description: audio slv clock | ||
| 60 | - description: audio mst clock | ||
| 61 | - description: audio intbus clock | ||
| 62 | |||
| 63 | clock-names: | ||
| 64 | items: | ||
| 65 | - const: top_aud_intbus | ||
| 66 | - const: top_aud_eng1 | ||
| 67 | - const: top_aud_eng2 | ||
| 68 | - const: top_aud_h | ||
| 69 | - const: apll1 | ||
| 70 | - const: apll2 | ||
| 71 | - const: apll1_d4 | ||
| 72 | - const: apll2_d4 | ||
| 73 | - const: apll12_div_i2sin0 | ||
| 74 | - const: apll12_div_i2sin1 | ||
| 75 | - const: apll12_div_i2sout0 | ||
| 76 | - const: apll12_div_i2sout1 | ||
| 77 | - const: apll12_div_fmi2s | ||
| 78 | - const: apll12_div_tdmout_m | ||
| 79 | - const: apll12_div_tdmout_b | ||
| 80 | - const: top_apll1 | ||
| 81 | - const: top_apll2 | ||
| 82 | - const: top_i2sin0 | ||
| 83 | - const: top_i2sin1 | ||
| 84 | - const: top_i2sout0 | ||
| 85 | - const: top_i2sout1 | ||
| 86 | - const: top_fmi2s | ||
| 87 | - const: top_dptx | ||
| 88 | - const: clk26m | ||
| 89 | - const: aud_slv_ck_peri | ||
| 90 | - const: aud_mst_ck_peri | ||
| 91 | - const: aud_intbus_ck_peri | ||
| 92 | |||
| 93 | required: | ||
| 94 | - compatible | ||
| 95 | - reg | ||
| 96 | - interrupts | ||
| 97 | - memory-region | ||
| 98 | - power-domains | ||
| 99 | - clocks | ||
| 100 | - clock-names | ||
| 101 | |||
| 102 | additionalProperties: false | ||
| 103 | |||
| 104 | examples: | ||
| 105 | - | | ||
| 106 | #include <dt-bindings/interrupt-controller/arm-gic.h> | ||
| 107 | #include <dt-bindings/interrupt-controller/irq.h> | ||
| 108 | |||
| 109 | soc { | ||
| 110 | #address-cells = <2>; | ||
| 111 | #size-cells = <2>; | ||
| 112 | |||
| 113 | afe@11050000 { | ||
| 114 | compatible = "mediatek,mt8189-afe-pcm"; | ||
| 115 | reg = <0 0x11050000 0 0x10000>; | ||
| 116 | interrupts = <GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH 0>; | ||
| 117 | memory-region = <&afe_dma_mem_reserved>; | ||
| 118 | pinctrl-names = "default"; | ||
| 119 | pinctrl-0 = <&aud_pins_default>; | ||
| 120 | power-domains = <&scpsys 1>; //MT8189_POWER_DOMAIN_AUDIO | ||
| 121 | clocks = <&topckgen_clk 23>, //CLK_TOP_AUD_INTBUS_SEL | ||
| 122 | <&topckgen_clk 39>, //CLK_TOP_AUD_ENGEN1_SEL | ||
| 123 | <&topckgen_clk 40>, //CLK_TOP_AUD_ENGEN2_SEL | ||
| 124 | <&topckgen_clk 49>, //CLK_TOP_AUDIO_H_SEL | ||
| 125 | <&topckgen_clk 146>, //CLK_TOP_APLL1 | ||
| 126 | <&topckgen_clk 151>, //CLK_TOP_APLL2 | ||
| 127 | <&topckgen_clk 148>, //CLK_TOP_APLL1_D4 | ||
| 128 | <&topckgen_clk 153>, //CLK_TOP_APLL2_D4 | ||
| 129 | <&topckgen_clk 93>, //CLK_TOP_APLL12_CK_DIV_I2SIN0 | ||
| 130 | <&topckgen_clk 94>, //CLK_TOP_APLL12_CK_DIV_I2SIN1 | ||
| 131 | <&topckgen_clk 95>, //CLK_TOP_APLL12_CK_DIV_I2SOUT0 | ||
| 132 | <&topckgen_clk 96>, //CLK_TOP_APLL12_CK_DIV_I2SOUT1 | ||
| 133 | <&topckgen_clk 97>, //CLK_TOP_APLL12_CK_DIV_FMI2S | ||
| 134 | <&topckgen_clk 98>, //CLK_TOP_APLL12_CK_DIV_TDMOUT_M | ||
| 135 | <&topckgen_clk 99>, //CLK_TOP_APLL12_CK_DIV_TDMOUT_B | ||
| 136 | <&topckgen_clk 44>, //CLK_TOP_AUD_1_SEL | ||
| 137 | <&topckgen_clk 45>, //CLK_TOP_AUD_2_SEL | ||
| 138 | <&topckgen_clk 78>, //CLK_TOP_APLL_I2SIN0_MCK_SEL | ||
| 139 | <&topckgen_clk 79>, //CLK_TOP_APLL_I2SIN1_MCK_SEL | ||
| 140 | <&topckgen_clk 84>, //CLK_TOP_APLL_I2SOUT0_MCK_SEL | ||
| 141 | <&topckgen_clk 85>, //CLK_TOP_APLL_I2SOUT1_MCK_SEL | ||
| 142 | <&topckgen_clk 90>, //CLK_TOP_APLL_FMI2S_MCK_SEL | ||
| 143 | <&topckgen_clk 91>, //CLK_TOP_APLL_TDMOUT_MCK_SEL | ||
| 144 | <&topckgen_clk 191>, //CLK_TOP_TCK_26M_MX9 | ||
| 145 | <&pericfg_ao_clk 77>, //CLK_PERAO_AUDIO0 | ||
| 146 | <&pericfg_ao_clk 78>, //CLK_PERAO_AUDIO1 | ||
| 147 | <&pericfg_ao_clk 79>; //CLK_PERAO_AUDIO2 | ||
| 148 | clock-names = "top_aud_intbus", | ||
| 149 | "top_aud_eng1", | ||
| 150 | "top_aud_eng2", | ||
| 151 | "top_aud_h", | ||
| 152 | "apll1", | ||
| 153 | "apll2", | ||
| 154 | "apll1_d4", | ||
| 155 | "apll2_d4", | ||
| 156 | "apll12_div_i2sin0", | ||
| 157 | "apll12_div_i2sin1", | ||
| 158 | "apll12_div_i2sout0", | ||
| 159 | "apll12_div_i2sout1", | ||
| 160 | "apll12_div_fmi2s", | ||
| 161 | "apll12_div_tdmout_m", | ||
| 162 | "apll12_div_tdmout_b", | ||
| 163 | "top_apll1", | ||
| 164 | "top_apll2", | ||
| 165 | "top_i2sin0", | ||
| 166 | "top_i2sin1", | ||
| 167 | "top_i2sout0", | ||
| 168 | "top_i2sout1", | ||
| 169 | "top_fmi2s", | ||
| 170 | "top_dptx", | ||
| 171 | "clk26m", | ||
| 172 | "aud_slv_ck_peri", | ||
| 173 | "aud_mst_ck_peri", | ||
| 174 | "aud_intbus_ck_peri"; | ||
| 175 | }; | ||
| 176 | }; | ||
| 177 | |||
| 178 | ... | ||
| @@ -0,0 +1,101 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/mediatek,mt8189-nau8825.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: MediaTek MT8189 ASoC sound card | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Darren Ye <darren.ye@mediatek.com> | ||
| 11 | - Cyril Chao <cyril.chao@mediatek.com> | ||
| 12 | |||
| 13 | allOf: | ||
| 14 | - $ref: sound-card-common.yaml# | ||
| 15 | |||
| 16 | properties: | ||
| 17 | compatible: | ||
| 18 | enum: | ||
| 19 | - mediatek,mt8189-nau8825 | ||
| 20 | - mediatek,mt8189-rt5650 | ||
| 21 | - mediatek,mt8189-rt5682s | ||
| 22 | - mediatek,mt8189-rt5682i | ||
| 23 | - mediatek,mt8189-es8326 | ||
| 24 | |||
| 25 | mediatek,platform: | ||
| 26 | $ref: /schemas/types.yaml#/definitions/phandle | ||
| 27 | description: The phandle of MT8189 ASoC platform. | ||
| 28 | |||
| 29 | patternProperties: | ||
| 30 | "^dai-link-[0-9]+$": | ||
| 31 | type: object | ||
| 32 | description: | ||
| 33 | Container for dai-link level properties and CODEC sub-nodes. | ||
| 34 | |||
| 35 | properties: | ||
| 36 | link-name: | ||
| 37 | description: | ||
| 38 | This property corresponds to the name of the BE dai-link to which | ||
| 39 | we are going to update parameters in this node. | ||
| 40 | enum: | ||
| 41 | - TDM_DPTX_BE | ||
| 42 | - I2SOUT0_BE | ||
| 43 | - I2SIN0_BE | ||
| 44 | - I2SOUT1_BE | ||
| 45 | |||
| 46 | codec: | ||
| 47 | description: Holds subnode which indicates codec dai. | ||
| 48 | type: object | ||
| 49 | additionalProperties: false | ||
| 50 | |||
| 51 | properties: | ||
| 52 | sound-dai: | ||
| 53 | minItems: 1 | ||
| 54 | maxItems: 2 | ||
| 55 | required: | ||
| 56 | - sound-dai | ||
| 57 | |||
| 58 | dai-format: | ||
| 59 | description: audio format. | ||
| 60 | enum: | ||
| 61 | - i2s | ||
| 62 | - right_j | ||
| 63 | - left_j | ||
| 64 | - dsp_a | ||
| 65 | - dsp_b | ||
| 66 | |||
| 67 | mediatek,clk-provider: | ||
| 68 | $ref: /schemas/types.yaml#/definitions/string | ||
| 69 | description: Indicates dai-link clock master. | ||
| 70 | enum: | ||
| 71 | - cpu | ||
| 72 | - codec | ||
| 73 | |||
| 74 | additionalProperties: false | ||
| 75 | |||
| 76 | required: | ||
| 77 | - link-name | ||
| 78 | |||
| 79 | required: | ||
| 80 | - compatible | ||
| 81 | - mediatek,platform | ||
| 82 | |||
| 83 | unevaluatedProperties: false | ||
| 84 | |||
| 85 | examples: | ||
| 86 | - | | ||
| 87 | sound { | ||
| 88 | compatible = "mediatek,mt8189-nau8825"; | ||
| 89 | model = "mt8189_rt9123_8825"; | ||
| 90 | mediatek,platform = <&afe>; | ||
| 91 | dai-link-0 { | ||
| 92 | link-name = "I2SOUT1_BE"; | ||
| 93 | dai-format = "i2s"; | ||
| 94 | mediatek,clk-provider = "cpu"; | ||
| 95 | codec { | ||
| 96 | sound-dai = <&nau8825>; | ||
| 97 | }; | ||
| 98 | }; | ||
| 99 | }; | ||
| 100 | |||
| 101 | ... | ||
| @@ -1,40 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/nuvoton,nau8540.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Nuvoton Technology Corporation NAU85L40 Audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - John Hsu <KCHSU0@nuvoton.com> | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: nuvoton,nau8540 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | codec@1c { | ||
| 37 | compatible = "nuvoton,nau8540"; | ||
| 38 | reg = <0x1c>; | ||
| 39 | }; | ||
| 40 | }; | ||
| @@ -1,45 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/nuvoton,nau8810.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: NAU8810/NAU8812/NAU8814 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - David Lin <CTLIN0@nuvoton.com> | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | enum: | ||
| 18 | - nuvoton,nau8810 | ||
| 19 | - nuvoton,nau8812 | ||
| 20 | - nuvoton,nau8814 | ||
| 21 | |||
| 22 | reg: | ||
| 23 | maxItems: 1 | ||
| 24 | |||
| 25 | '#sound-dai-cells': | ||
| 26 | const: 0 | ||
| 27 | |||
| 28 | required: | ||
| 29 | - compatible | ||
| 30 | - reg | ||
| 31 | |||
| 32 | unevaluatedProperties: false | ||
| 33 | |||
| 34 | examples: | ||
| 35 | - | | ||
| 36 | i2c { | ||
| 37 | #address-cells = <1>; | ||
| 38 | #size-cells = <0>; | ||
| 39 | |||
| 40 | codec@1a { | ||
| 41 | #sound-dai-cells = <0>; | ||
| 42 | compatible = "nuvoton,nau8810"; | ||
| 43 | reg = <0x1a>; | ||
| 44 | }; | ||
| 45 | }; | ||
| @@ -67,46 +67,72 @@ properties: · 66 unmodified lines | |||
| 67 | $ref: audio-graph-port.yaml# | 67 | $ref: audio-graph-port.yaml# |
| 68 | unevaluatedProperties: false | 68 | unevaluatedProperties: false |
| 69 | 69 | ||
| 70 | if: | 70 | allOf: |
| 71 | properties: | 71 | - if: |
| 72 | compatible: | 72 | properties: |
| 73 | contains: | 73 | compatible: |
| 74 | const: nvidia,tegra210-admaif | 74 | contains: |
| 75 | 75 | const: nvidia,tegra210-admaif | |
| 76 | then: | 76 | then: |
| 77 | properties: | 77 | properties: |
| 78 | dmas: | 78 | dmas: |
| 79 | description: | 79 | description: |
| 80 | DMA channel specifiers, equally divided for Tx and Rx. | 80 | DMA channel specifiers, equally divided for Tx and Rx. |
| 81 | minItems: 1 | 81 | minItems: 1 |
| 82 | maxItems: 20 | 82 | maxItems: 20 |
| 83 | dma-names: | 83 | dma-names: |
| 84 | items: | 84 | items: |
| 85 | pattern: "^[rt]x(10|[1-9])$" | 85 | pattern: "^[rt]x(10|[1-9])$" |
| 86 | description: | 86 | description: |
| 87 | Should be "rx1", "rx2" ... "rx10" for DMA Rx channel | 87 | Should be "rx1", "rx2" ... "rx10" for DMA Rx channel |
| 88 | Should be "tx1", "tx2" ... "tx10" for DMA Tx channel | 88 | Should be "tx1", "tx2" ... "tx10" for DMA Tx channel |
| 89 | minItems: 1 | 89 | minItems: 1 |
| 90 | maxItems: 20 | 90 | maxItems: 20 |
| 91 | interconnects: false | 91 | interconnects: false |
| 92 | interconnect-names: false | 92 | interconnect-names: false |
| 93 | iommus: false | 93 | iommus: false |
| 94 | 94 | ||
| 95 | else: | 95 | - if: |
| 96 | properties: | 96 | properties: |
| 97 | dmas: | 97 | compatible: |
| 98 | description: | 98 | contains: |
| 99 | DMA channel specifiers, equally divided for Tx and Rx. | 99 | const: nvidia,tegra186-admaif |
| 100 | minItems: 1 | 100 | then: |
| 101 | maxItems: 40 | 101 | properties: |
| 102 | dma-names: | 102 | dmas: |
| 103 | items: | 103 | description: |
| 104 | pattern: "^[rt]x(1[0-9]|[1-9]|20)$" | 104 | DMA channel specifiers, equally divided for Tx and Rx. |
| 105 | description: | 105 | minItems: 1 |
| 106 | Should be "rx1", "rx2" ... "rx20" for DMA Rx channel | 106 | maxItems: 40 |
| 107 | Should be "tx1", "tx2" ... "tx20" for DMA Tx channel | 107 | dma-names: |
| 108 | minItems: 1 | 108 | items: |
| 109 | maxItems: 40 | 109 | pattern: "^[rt]x(1[0-9]|[1-9]|20)$" |
| 110 | description: | ||
| 111 | Should be "rx1", "rx2" ... "rx20" for DMA Rx channel | ||
| 112 | Should be "tx1", "tx2" ... "tx20" for DMA Tx channel | ||
| 113 | minItems: 1 | ||
| 114 | maxItems: 40 | ||
| 115 | |||
| 116 | - if: | ||
| 117 | properties: | ||
| 118 | compatible: | ||
| 119 | contains: | ||
| 120 | const: nvidia,tegra264-admaif | ||
| 121 | then: | ||
| 122 | properties: | ||
| 123 | dmas: | ||
| 124 | description: | ||
| 125 | DMA channel specifiers, equally divided for Tx and Rx. | ||
| 126 | minItems: 1 | ||
| 127 | maxItems: 64 | ||
| 128 | dma-names: | ||
| 129 | items: | ||
| 130 | pattern: "^[rt]x(3[0-2]|[1-2][0-9]|[1-9])$" | ||
| 131 | description: | ||
| 132 | Should be "rx1", "rx2" ... "rx32" for DMA Rx channel | ||
| 133 | Should be "tx1", "tx2" ... "tx32" for DMA Tx channel | ||
| 134 | minItems: 1 | ||
| 135 | maxItems: 64 | ||
| 110 | 136 | ||
| 111 | required: | 137 | required: |
| 112 | - compatible | 138 | - compatible |
| @@ -1,44 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/nxp,tfa9879.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: NXP TFA9879 class-D audio amplifier | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Peter Rosin <peda@axentia.se> | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: nxp,tfa9879 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | - '#sound-dai-cells' | ||
| 29 | |||
| 30 | unevaluatedProperties: false | ||
| 31 | |||
| 32 | examples: | ||
| 33 | - | | ||
| 34 | i2c1 { | ||
| 35 | #address-cells = <1>; | ||
| 36 | #size-cells = <0>; | ||
| 37 | amplifier@6c { | ||
| 38 | compatible = "nxp,tfa9879"; | ||
| 39 | reg = <0x6c>; | ||
| 40 | pinctrl-names = "default"; | ||
| 41 | pinctrl-0 = <&pinctrl_i2c1>; | ||
| 42 | #sound-dai-cells = <0>; | ||
| 43 | }; | ||
| 44 | }; | ||
| @@ -1,42 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/nxp,uda1342.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: NXP uda1342 audio CODECs | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Binbin Zhou <zhoubinbin@loongson.cn> | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: nxp,uda1342 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | '#sound-dai-cells': | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | - '#sound-dai-cells' | ||
| 29 | |||
| 30 | unevaluatedProperties: false | ||
| 31 | |||
| 32 | examples: | ||
| 33 | - | | ||
| 34 | i2c { | ||
| 35 | #address-cells = <1>; | ||
| 36 | #size-cells = <0>; | ||
| 37 | codec@1a { | ||
| 38 | compatible = "nxp,uda1342"; | ||
| 39 | reg = <0x1a>; | ||
| 40 | #sound-dai-cells = <0>; | ||
| 41 | }; | ||
| 42 | }; | ||
| @@ -1,22 +0,0 @@ | |||
| 1 | Texas Instruments pcm1789 DT bindings | ||
| 2 | |||
| 3 | PCM1789 is a simple audio codec that can be connected via | ||
| 4 | I2C or SPI. Currently, only I2C bus is supported. | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | |||
| 8 | - compatible: "ti,pcm1789" | ||
| 9 | |||
| 10 | Required properties on I2C: | ||
| 11 | |||
| 12 | - reg: the I2C address | ||
| 13 | - reset-gpios: GPIO to control the RESET pin | ||
| 14 | |||
| 15 | Examples: | ||
| 16 | |||
| 17 | audio-codec@4c { | ||
| 18 | compatible = "ti,pcm1789"; | ||
| 19 | reg = <0x4c>; | ||
| 20 | reset-gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; | ||
| 21 | #sound-dai-cells = <0>; | ||
| 22 | }; | ||
| @@ -1,27 +0,0 @@ | |||
| 1 | Texas Instruments pcm179x DT bindings | ||
| 2 | |||
| 3 | This driver supports both the I2C and SPI bus. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible: "ti,pcm1792a" | ||
| 8 | |||
| 9 | For required properties on SPI, please consult | ||
| 10 | Documentation/devicetree/bindings/spi/spi-bus.txt | ||
| 11 | |||
| 12 | Required properties on I2C: | ||
| 13 | |||
| 14 | - reg: the I2C address | ||
| 15 | |||
| 16 | |||
| 17 | Examples: | ||
| 18 | |||
| 19 | codec_spi: 1792a@0 { | ||
| 20 | compatible = "ti,pcm1792a"; | ||
| 21 | spi-max-frequency = <600000>; | ||
| 22 | }; | ||
| 23 | |||
| 24 | codec_i2c: 1792a@4c { | ||
| 25 | compatible = "ti,pcm1792a"; | ||
| 26 | reg = <0x4c>; | ||
| 27 | }; | ||
| @@ -1,42 +0,0 @@ | |||
| 1 | Texas Instruments PCM186x Universal Audio ADC | ||
| 2 | |||
| 3 | These devices support both I2C and SPI (configured with pin strapping | ||
| 4 | on the board). | ||
| 5 | |||
| 6 | Required properties: | ||
| 7 | |||
| 8 | - compatible : "ti,pcm1862", | ||
| 9 | "ti,pcm1863", | ||
| 10 | "ti,pcm1864", | ||
| 11 | "ti,pcm1865" | ||
| 12 | |||
| 13 | - reg : The I2C address of the device for I2C, the chip select | ||
| 14 | number for SPI. | ||
| 15 | |||
| 16 | - avdd-supply: Analog core power supply (3.3v) | ||
| 17 | - dvdd-supply: Digital core power supply | ||
| 18 | - iovdd-supply: Digital IO power supply | ||
| 19 | See regulator/regulator.txt for more information | ||
| 20 | |||
| 21 | CODEC input pins: | ||
| 22 | * VINL1 | ||
| 23 | * VINR1 | ||
| 24 | * VINL2 | ||
| 25 | * VINR2 | ||
| 26 | * VINL3 | ||
| 27 | * VINR3 | ||
| 28 | * VINL4 | ||
| 29 | * VINR4 | ||
| 30 | |||
| 31 | The pins can be used in referring sound node's audio-routing property. | ||
| 32 | |||
| 33 | Example: | ||
| 34 | |||
| 35 | pcm186x: audio-codec@4a { | ||
| 36 | compatible = "ti,pcm1865"; | ||
| 37 | reg = <0x4a>; | ||
| 38 | |||
| 39 | avdd-supply = <®_3v3_analog>; | ||
| 40 | dvdd-supply = <®_3v3>; | ||
| 41 | iovdd-supply = <®_1v8>; | ||
| 42 | }; | ||
| @@ -1,13 +0,0 @@ | |||
| 1 | PCM5102a audio CODECs | ||
| 2 | |||
| 3 | These devices does not use I2C or SPI. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : set as "ti,pcm5102a" | ||
| 8 | |||
| 9 | Examples: | ||
| 10 | |||
| 11 | pcm5102a: pcm5102a { | ||
| 12 | compatible = "ti,pcm5102a"; | ||
| 13 | }; | ||
| @@ -14,12 +14,14 @@ properties: · 13 unmodified lines | |||
| 14 | oneOf: | 14 | oneOf: |
| 15 | - enum: | 15 | - enum: |
| 16 | - qcom,sc7280-lpass-rx-macro | 16 | - qcom,sc7280-lpass-rx-macro |
| 17 | - qcom,sm6115-lpass-rx-macro | ||
| 17 | - qcom,sm8250-lpass-rx-macro | 18 | - qcom,sm8250-lpass-rx-macro |
| 18 | - qcom,sm8450-lpass-rx-macro | 19 | - qcom,sm8450-lpass-rx-macro |
| 19 | - qcom,sm8550-lpass-rx-macro | 20 | - qcom,sm8550-lpass-rx-macro |
| 20 | - qcom,sc8280xp-lpass-rx-macro | 21 | - qcom,sc8280xp-lpass-rx-macro |
| 21 | - items: | 22 | - items: |
| 22 | - enum: | 23 | - enum: |
| 24 | - qcom,kaanapali-lpass-rx-macro | ||
| 23 | - qcom,sm8650-lpass-rx-macro | 25 | - qcom,sm8650-lpass-rx-macro |
| 24 | - qcom,sm8750-lpass-rx-macro | 26 | - qcom,sm8750-lpass-rx-macro |
| 25 | - qcom,x1e80100-lpass-rx-macro | 27 | - qcom,x1e80100-lpass-rx-macro |
| @@ -80,6 +82,23 @@ allOf: · 54 unmodified lines | |||
| 80 | - const: npl | 82 | - const: npl |
| 81 | - const: fsgen | 83 | - const: fsgen |
| 82 | 84 | ||
| 85 | - if: | ||
| 86 | properties: | ||
| 87 | compatible: | ||
| 88 | enum: | ||
| 89 | - qcom,sm6115-lpass-rx-macro | ||
| 90 | then: | ||
| 91 | properties: | ||
| 92 | clocks: | ||
| 93 | minItems: 4 | ||
| 94 | maxItems: 4 | ||
| 95 | clock-names: | ||
| 96 | items: | ||
| 97 | - const: mclk | ||
| 98 | - const: npl | ||
| 99 | - const: dcodec | ||
| 100 | - const: fsgen | ||
| 101 | |||
| 83 | - if: | 102 | - if: |
| 84 | properties: | 103 | properties: |
| 85 | compatible: | 104 | compatible: |
| @@ -21,6 +21,7 @@ properties: · 20 unmodified lines | |||
| 21 | - qcom,sc8280xp-lpass-tx-macro | 21 | - qcom,sc8280xp-lpass-tx-macro |
| 22 | - items: | 22 | - items: |
| 23 | - enum: | 23 | - enum: |
| 24 | - qcom,kaanapali-lpass-tx-macro | ||
| 24 | - qcom,sm8650-lpass-tx-macro | 25 | - qcom,sm8650-lpass-tx-macro |
| 25 | - qcom,sm8750-lpass-tx-macro | 26 | - qcom,sm8750-lpass-tx-macro |
| 26 | - qcom,x1e80100-lpass-tx-macro | 27 | - qcom,x1e80100-lpass-tx-macro |
| @@ -14,6 +14,7 @@ properties: · 13 unmodified lines | |||
| 14 | oneOf: | 14 | oneOf: |
| 15 | - enum: | 15 | - enum: |
| 16 | - qcom,sc7280-lpass-va-macro | 16 | - qcom,sc7280-lpass-va-macro |
| 17 | - qcom,sm6115-lpass-va-macro | ||
| 17 | - qcom,sm8250-lpass-va-macro | 18 | - qcom,sm8250-lpass-va-macro |
| 18 | - qcom,sm8450-lpass-va-macro | 19 | - qcom,sm8450-lpass-va-macro |
| 19 | - qcom,sm8550-lpass-va-macro | 20 | - qcom,sm8550-lpass-va-macro |
| @@ -21,6 +22,7 @@ properties: · 1 unmodified line | |||
| 21 | - items: | 22 | - items: |
| 22 | - enum: | 23 | - enum: |
| 23 | - qcom,glymur-lpass-va-macro | 24 | - qcom,glymur-lpass-va-macro |
| 25 | - qcom,kaanapali-lpass-va-macro | ||
| 24 | - qcom,sm8650-lpass-va-macro | 26 | - qcom,sm8650-lpass-va-macro |
| 25 | - qcom,sm8750-lpass-va-macro | 27 | - qcom,sm8750-lpass-va-macro |
| 26 | - qcom,x1e80100-lpass-va-macro | 28 | - qcom,x1e80100-lpass-va-macro |
| @@ -41,11 +43,7 @@ properties: · 14 unmodified lines | |||
| 41 | 43 | ||
| 42 | clock-names: | 44 | clock-names: |
| 43 | minItems: 1 | 45 | minItems: 1 |
| 44 | items: | 46 | maxItems: 4 |
| 45 | - const: mclk | ||
| 46 | - const: macro | ||
| 47 | - const: dcodec | ||
| 48 | - const: npl | ||
| 49 | 47 | ||
| 50 | clock-output-names: | 48 | clock-output-names: |
| 51 | maxItems: 1 | 49 | maxItems: 1 |
| @@ -90,29 +88,48 @@ allOf: · 38 unmodified lines | |||
| 90 | clocks: | 88 | clocks: |
| 91 | maxItems: 1 | 89 | maxItems: 1 |
| 92 | clock-names: | 90 | clock-names: |
| 93 | maxItems: 1 | 91 | items: |
| 92 | - const: mclk | ||
| 94 | else: | 93 | else: |
| 95 | properties: | 94 | properties: |
| 96 | clocks: | 95 | clocks: |
| 97 | minItems: 3 | 96 | minItems: 3 |
| 98 | maxItems: 3 | 97 | maxItems: 3 |
| 99 | clock-names: | 98 | clock-names: |
| 100 | minItems: 3 | 99 | items: |
| 101 | maxItems: 3 | 100 | - const: mclk |
| 102 | 101 | - const: macro | |
| 102 | - const: dcodec | ||
| 103 | - if: | 103 | - if: |
| 104 | properties: | 104 | properties: |
| 105 | compatible: | 105 | compatible: |
| 106 | contains: | 106 | contains: |
| 107 | const: qcom,sm8250-lpass-va-macro | 107 | const: qcom,sm6115-lpass-va-macro |
| 108 | then: | 108 | then: |
| 109 | properties: | 109 | properties: |
| 110 | clocks: | 110 | clocks: |
| 111 | minItems: 3 | 111 | minItems: 3 |
| 112 | maxItems: 3 | 112 | maxItems: 3 |
| 113 | clock-names: | 113 | clock-names: |
| 114 | items: | ||
| 115 | - const: mclk | ||
| 116 | - const: dcodec | ||
| 117 | - const: npl | ||
| 118 | - if: | ||
| 119 | properties: | ||
| 120 | compatible: | ||
| 121 | contains: | ||
| 122 | const: qcom,sm8250-lpass-va-macro | ||
| 123 | then: | ||
| 124 | properties: | ||
| 125 | clocks: | ||
| 114 | minItems: 3 | 126 | minItems: 3 |
| 115 | maxItems: 3 | 127 | maxItems: 3 |
| 128 | clock-names: | ||
| 129 | items: | ||
| 130 | - const: mclk | ||
| 131 | - const: macro | ||
| 132 | - const: dcodec | ||
| 116 | 133 | ||
| 117 | - if: | 134 | - if: |
| 118 | properties: | 135 | properties: |
| @@ -127,8 +144,11 @@ allOf: · 8 unmodified lines | |||
| 127 | minItems: 4 | 144 | minItems: 4 |
| 128 | maxItems: 4 | 145 | maxItems: 4 |
| 129 | clock-names: | 146 | clock-names: |
| 130 | minItems: 4 | 147 | items: |
| 131 | maxItems: 4 | 148 | - const: mclk |
| 149 | - const: macro | ||
| 150 | - const: dcodec | ||
| 151 | - const: npl | ||
| 132 | 152 | ||
| 133 | - if: | 153 | - if: |
| 134 | properties: | 154 | properties: |
| @@ -142,8 +162,10 @@ allOf: · 7 unmodified lines | |||
| 142 | minItems: 3 | 162 | minItems: 3 |
| 143 | maxItems: 3 | 163 | maxItems: 3 |
| 144 | clock-names: | 164 | clock-names: |
| 145 | minItems: 3 | 165 | items: |
| 146 | maxItems: 3 | 166 | - const: mclk |
| 167 | - const: macro | ||
| 168 | - const: dcodec | ||
| 147 | 169 | ||
| 148 | unevaluatedProperties: false | 170 | unevaluatedProperties: false |
| 149 | 171 | ||
| @@ -21,6 +21,7 @@ properties: · 20 unmodified lines | |||
| 21 | - items: | 21 | - items: |
| 22 | - enum: | 22 | - enum: |
| 23 | - qcom,glymur-lpass-wsa-macro | 23 | - qcom,glymur-lpass-wsa-macro |
| 24 | - qcom,kaanapali-lpass-wsa-macro | ||
| 24 | - qcom,sm8650-lpass-wsa-macro | 25 | - qcom,sm8650-lpass-wsa-macro |
| 25 | - qcom,sm8750-lpass-wsa-macro | 26 | - qcom,sm8750-lpass-wsa-macro |
| 26 | - qcom,x1e80100-lpass-wsa-macro | 27 | - qcom,x1e80100-lpass-wsa-macro |
| @@ -23,6 +23,7 @@ properties: · 22 unmodified lines | |||
| 23 | - const: qcom,sdm845-sndcard | 23 | - const: qcom,sdm845-sndcard |
| 24 | - items: | 24 | - items: |
| 25 | - enum: | 25 | - enum: |
| 26 | - qcom,kaanapali-sndcard | ||
| 26 | - qcom,sm8550-sndcard | 27 | - qcom,sm8550-sndcard |
| 27 | - qcom,sm8650-sndcard | 28 | - qcom,sm8650-sndcard |
| 28 | - qcom,sm8750-sndcard | 29 | - qcom,sm8750-sndcard |
| @@ -38,6 +39,7 @@ properties: · 9 unmodified lines | |||
| 38 | - qcom,qcs8275-sndcard | 39 | - qcom,qcs8275-sndcard |
| 39 | - qcom,qcs9075-sndcard | 40 | - qcom,qcs9075-sndcard |
| 40 | - qcom,qcs9100-sndcard | 41 | - qcom,qcs9100-sndcard |
| 42 | - qcom,qrb2210-sndcard | ||
| 41 | - qcom,qrb4210-rb2-sndcard | 43 | - qcom,qrb4210-rb2-sndcard |
| 42 | - qcom,qrb5165-rb5-sndcard | 44 | - qcom,qrb5165-rb5-sndcard |
| 43 | - qcom,sc7180-qdsp6-sndcard | 45 | - qcom,sc7180-qdsp6-sndcard |
| @@ -132,7 +132,7 @@ properties: · 131 unmodified lines | |||
| 132 | $ref: /schemas/gpio/qcom,wcd934x-gpio.yaml# | 132 | $ref: /schemas/gpio/qcom,wcd934x-gpio.yaml# |
| 133 | 133 | ||
| 134 | patternProperties: | 134 | patternProperties: |
| 135 | "^.*@[0-9a-f]+$": | 135 | "@[0-9a-f]+$": |
| 136 | type: object | 136 | type: object |
| 137 | additionalProperties: true | 137 | additionalProperties: true |
| 138 | description: | | 138 | description: | |
| @@ -0,0 +1,87 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/spacemit,k1-i2s.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: K1 I2S controller | ||
| 8 | |||
| 9 | description: | ||
| 10 | The I2S bus (Inter-IC sound bus) is a serial link for digital | ||
| 11 | audio data transfer between devices in the system. | ||
| 12 | |||
| 13 | maintainers: | ||
| 14 | - Troy Mitchell <troy.mitchell@linux.spacemit.com> | ||
| 15 | |||
| 16 | allOf: | ||
| 17 | - $ref: dai-common.yaml# | ||
| 18 | |||
| 19 | properties: | ||
| 20 | compatible: | ||
| 21 | const: spacemit,k1-i2s | ||
| 22 | |||
| 23 | reg: | ||
| 24 | maxItems: 1 | ||
| 25 | |||
| 26 | clocks: | ||
| 27 | items: | ||
| 28 | - description: clock for I2S sysclk | ||
| 29 | - description: clock for I2S bclk | ||
| 30 | - description: clock for I2S bus | ||
| 31 | - description: clock for I2S controller | ||
| 32 | |||
| 33 | clock-names: | ||
| 34 | items: | ||
| 35 | - const: sysclk | ||
| 36 | - const: bclk | ||
| 37 | - const: bus | ||
| 38 | - const: func | ||
| 39 | |||
| 40 | dmas: | ||
| 41 | minItems: 1 | ||
| 42 | maxItems: 2 | ||
| 43 | |||
| 44 | dma-names: | ||
| 45 | minItems: 1 | ||
| 46 | items: | ||
| 47 | - const: tx | ||
| 48 | - const: rx | ||
| 49 | |||
| 50 | resets: | ||
| 51 | maxItems: 1 | ||
| 52 | |||
| 53 | port: | ||
| 54 | $ref: audio-graph-port.yaml# | ||
| 55 | unevaluatedProperties: false | ||
| 56 | |||
| 57 | "#sound-dai-cells": | ||
| 58 | const: 0 | ||
| 59 | |||
| 60 | required: | ||
| 61 | - compatible | ||
| 62 | - reg | ||
| 63 | - clocks | ||
| 64 | - clock-names | ||
| 65 | - dmas | ||
| 66 | - dma-names | ||
| 67 | - resets | ||
| 68 | - "#sound-dai-cells" | ||
| 69 | |||
| 70 | unevaluatedProperties: false | ||
| 71 | |||
| 72 | examples: | ||
| 73 | - | | ||
| 74 | #include <dt-bindings/clock/spacemit,k1-syscon.h> | ||
| 75 | i2s@d4026000 { | ||
| 76 | compatible = "spacemit,k1-i2s"; | ||
| 77 | reg = <0xd4026000 0x30>; | ||
| 78 | clocks = <&syscon_mpmu CLK_I2S_SYSCLK>, | ||
| 79 | <&syscon_mpmu CLK_I2S_BCLK>, | ||
| 80 | <&syscon_apbc CLK_SSPA0_BUS>, | ||
| 81 | <&syscon_apbc CLK_SSPA0>; | ||
| 82 | clock-names = "sysclk", "bclk", "bus", "func"; | ||
| 83 | dmas = <&pdma0 21>, <&pdma0 22>; | ||
| 84 | dma-names = "tx", "rx"; | ||
| 85 | resets = <&syscon_apbc RESET_SSPA0>; | ||
| 86 | #sound-dai-cells = <0>; | ||
| 87 | }; | ||
| @@ -0,0 +1,76 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/ti,pcm1862.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Texas Instruments PCM186x Universal Audio ADC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Ranganath V N <vnranganath.20@gmail.com> | ||
| 11 | |||
| 12 | description: | | ||
| 13 | The Texas Instruments PCM186x family are multi-channel audio ADCs | ||
| 14 | that support both I2C and SPI control interfaces, selected by | ||
| 15 | pin strapping. These devices include on-chip programmable gain | ||
| 16 | amplifiers and support differential or single-ended analog inputs. | ||
| 17 | |||
| 18 | CODEC input pins: | ||
| 19 | * VINL1 | ||
| 20 | * VINR1 | ||
| 21 | * VINL2 | ||
| 22 | * VINR2 | ||
| 23 | * VINL3 | ||
| 24 | * VINR3 | ||
| 25 | * VINL4 | ||
| 26 | * VINR4 | ||
| 27 | |||
| 28 | The pins can be used in referring sound node's audio-routing property. | ||
| 29 | |||
| 30 | allOf: | ||
| 31 | - $ref: dai-common.yaml# | ||
| 32 | |||
| 33 | properties: | ||
| 34 | compatible: | ||
| 35 | enum: | ||
| 36 | - ti,pcm1862 | ||
| 37 | - ti,pcm1863 | ||
| 38 | - ti,pcm1864 | ||
| 39 | - ti,pcm1865 | ||
| 40 | |||
| 41 | reg: | ||
| 42 | maxItems: 1 | ||
| 43 | |||
| 44 | avdd-supply: true | ||
| 45 | |||
| 46 | dvdd-supply: true | ||
| 47 | |||
| 48 | iovdd-supply: true | ||
| 49 | |||
| 50 | '#sound-dai-cells': | ||
| 51 | const: 0 | ||
| 52 | |||
| 53 | required: | ||
| 54 | - compatible | ||
| 55 | - reg | ||
| 56 | - avdd-supply | ||
| 57 | - dvdd-supply | ||
| 58 | - iovdd-supply | ||
| 59 | |||
| 60 | unevaluatedProperties: false | ||
| 61 | |||
| 62 | examples: | ||
| 63 | - | | ||
| 64 | i2c { | ||
| 65 | #address-cells = <1>; | ||
| 66 | #size-cells = <0>; | ||
| 67 | |||
| 68 | audio-codec@4a { | ||
| 69 | compatible = "ti,pcm1865"; | ||
| 70 | reg = <0x4a>; | ||
| 71 | |||
| 72 | avdd-supply = <®_3v3_analog>; | ||
| 73 | dvdd-supply = <®_3v3>; | ||
| 74 | iovdd-supply = <®_1v8>; | ||
| 75 | }; | ||
| 76 | }; | ||
| @@ -24,21 +24,26 @@ description: | · 23 unmodified lines | |||
| 24 | Instruments Smart Amp speaker protection algorithm. The | 24 | Instruments Smart Amp speaker protection algorithm. The |
| 25 | integrated speaker voltage and current sense provides for real time | 25 | integrated speaker voltage and current sense provides for real time |
| 26 | monitoring of loudspeaker behavior. | 26 | monitoring of loudspeaker behavior. |
| 27 | The TAS5802/TAS5815/TAS5825/TAS5827/TAS5828 is a stereo, digital input | 27 | The TAS5802/TAS5815/TAS5822/TAS5825/TAS5827/TAS5828 is a stereo, |
| 28 | Class-D audio amplifier optimized for efficiently driving high peak | 28 | digital input Class-D audio amplifier optimized for efficiently driving |
| 29 | power into small loudspeakers. An integrated on-chip DSP supports | 29 | high peak power into small loudspeakers. An integrated on-chip DSP |
| 30 | Texas Instruments Smart Amp speaker protection algorithm. | 30 | supports Texas Instruments Smart Amp speaker protection algorithm. |
| 31 | 31 | ||
| 32 | Specifications about the audio amplifier can be found at: | 32 | Specifications about the audio amplifier can be found at: |
| 33 | https://www.ti.com/lit/gpn/tas2120 | 33 | https://www.ti.com/lit/gpn/tas2120 |
| 34 | https://www.ti.com/lit/gpn/tas2320 | 34 | https://www.ti.com/lit/gpn/tas2320 |
| 35 | https://www.ti.com/lit/gpn/tas2563 | 35 | https://www.ti.com/lit/gpn/tas2563 |
| 36 | https://www.ti.com/lit/gpn/tas2572 | 36 | https://www.ti.com/lit/gpn/tas2572 |
| 37 | https://www.ti.com/lit/gpn/tas2574 | ||
| 37 | https://www.ti.com/lit/gpn/tas2781 | 38 | https://www.ti.com/lit/gpn/tas2781 |
| 39 | https://www.ti.com/lit/gpn/tas5806m | ||
| 40 | https://www.ti.com/lit/gpn/tas5806md | ||
| 38 | https://www.ti.com/lit/gpn/tas5815 | 41 | https://www.ti.com/lit/gpn/tas5815 |
| 42 | https://www.ti.com/lit/gpn/tas5822m | ||
| 39 | https://www.ti.com/lit/gpn/tas5825m | 43 | https://www.ti.com/lit/gpn/tas5825m |
| 40 | https://www.ti.com/lit/gpn/tas5827 | 44 | https://www.ti.com/lit/gpn/tas5827 |
| 41 | https://www.ti.com/lit/gpn/tas5828m | 45 | https://www.ti.com/lit/gpn/tas5828m |
| 46 | https://www.ti.com/lit/gpn/tas5830 | ||
| 42 | 47 | ||
| 43 | properties: | 48 | properties: |
| 44 | compatible: | 49 | compatible: |
| @@ -57,12 +62,18 @@ properties: · 12 unmodified lines | |||
| 57 | ti,tas2563: 6.1-W Boosted Class-D Audio Amplifier With Integrated | 62 | ti,tas2563: 6.1-W Boosted Class-D Audio Amplifier With Integrated |
| 58 | DSP and IV Sense, 16/20/24/32bit stereo I2S or multichannel TDM. | 63 | DSP and IV Sense, 16/20/24/32bit stereo I2S or multichannel TDM. |
| 59 | 64 | ||
| 65 | ti,tas2568: 5.3-W Digital Input Smart Amp with I/V Sense and Integrated | ||
| 66 | 10.75-V Class-H Boost | ||
| 67 | |||
| 60 | ti,tas2570: 5.8-W Digital Input smart amp with I/V sense and integrated | 68 | ti,tas2570: 5.8-W Digital Input smart amp with I/V sense and integrated |
| 61 | 11-V Class-H Boost | 69 | 11-V Class-H Boost |
| 62 | 70 | ||
| 63 | ti,tas2572: 6.6-W Digital Input smart amp with I/V sense and integrated | 71 | ti,tas2572: 6.6-W Digital Input smart amp with I/V sense and integrated |
| 64 | 13-V Class-H Boost | 72 | 13-V Class-H Boost |
| 65 | 73 | ||
| 74 | ti,tas2574: 8.5-W Digital Input smart amp with I/V sense and integrated | ||
| 75 | 15-V Class-H Boost | ||
| 76 | |||
| 66 | ti,tas2781: 24-V Class-D Amplifier with Real Time Integrated Speaker | 77 | ti,tas2781: 24-V Class-D Amplifier with Real Time Integrated Speaker |
| 67 | Protection and Audio Processing, 16/20/24/32bit stereo I2S or | 78 | Protection and Audio Processing, 16/20/24/32bit stereo I2S or |
| 68 | multichannel TDM. | 79 | multichannel TDM. |
| @@ -71,9 +82,20 @@ properties: · 2 unmodified lines | |||
| 71 | Audio Amplifier with 96-Khz Extended Processing and Low Idle Power | 82 | Audio Amplifier with 96-Khz Extended Processing and Low Idle Power |
| 72 | Dissipation. | 83 | Dissipation. |
| 73 | 84 | ||
| 85 | ti,tas5806m: 23-W, Inductor-Less, Digital Input, Stereo, Closed-Loop | ||
| 86 | Class-D Audio Amplifier with Enhanced Processing and Low Power | ||
| 87 | Dissipation. | ||
| 88 | |||
| 89 | ti,tas5806md: 23-W, Inductor-Less, Digital Input, Stereo, Closed-Loop | ||
| 90 | Class-D Audio Amplifier with Enhanced Processing and DirectPath(TM) | ||
| 91 | HP Driver | ||
| 92 | |||
| 74 | ti,tas5815: 30-W, Digital Input, Stereo, Closed-loop Class-D Audio | 93 | ti,tas5815: 30-W, Digital Input, Stereo, Closed-loop Class-D Audio |
| 75 | Amplifier with 96 kHz Enhanced Processing | 94 | Amplifier with 96 kHz Enhanced Processing |
| 76 | 95 | ||
| 96 | ti,tas5822: 35-W, Digital Input, Stereo, Closed-Loop Class-D Audio | ||
| 97 | Amplifier with 96 kHz Enhanced Processing | ||
| 98 | |||
| 77 | ti,tas5825: 38-W Stereo, Inductor-Less, Digital Input, Closed-Loop 4.5V | 99 | ti,tas5825: 38-W Stereo, Inductor-Less, Digital Input, Closed-Loop 4.5V |
| 78 | to 26.4V Class-D Audio Amplifier with 192-kHz Extended Audio Processing. | 100 | to 26.4V Class-D Audio Amplifier with 192-kHz Extended Audio Processing. |
| 79 | 101 | ||
| @@ -82,6 +104,9 @@ properties: · 2 unmodified lines | |||
| 82 | 104 | ||
| 83 | ti,tas5828: 50-W Stereo, Digital Input, High Efficiency Closed-Loop | 105 | ti,tas5828: 50-W Stereo, Digital Input, High Efficiency Closed-Loop |
| 84 | Class-D Amplifier with Hybrid-Pro Algorithm | 106 | Class-D Amplifier with Hybrid-Pro Algorithm |
| 107 | |||
| 108 | ti,tas5830: 65-W Stereo, Digital Input, High Efficiency Closed-Loop | ||
| 109 | Class-D Amplifier with Class-H Algorithm | ||
| 85 | oneOf: | 110 | oneOf: |
| 86 | - items: | 111 | - items: |
| 87 | - enum: | 112 | - enum: |
| @@ -90,13 +115,19 @@ properties: · 2 unmodified lines | |||
| 90 | - ti,tas2120 | 115 | - ti,tas2120 |
| 91 | - ti,tas2320 | 116 | - ti,tas2320 |
| 92 | - ti,tas2563 | 117 | - ti,tas2563 |
| 118 | - ti,tas2568 | ||
| 93 | - ti,tas2570 | 119 | - ti,tas2570 |
| 94 | - ti,tas2572 | 120 | - ti,tas2572 |
| 121 | - ti,tas2574 | ||
| 95 | - ti,tas5802 | 122 | - ti,tas5802 |
| 123 | - ti,tas5806m | ||
| 124 | - ti,tas5806md | ||
| 96 | - ti,tas5815 | 125 | - ti,tas5815 |
| 126 | - ti,tas5822 | ||
| 97 | - ti,tas5825 | 127 | - ti,tas5825 |
| 98 | - ti,tas5827 | 128 | - ti,tas5827 |
| 99 | - ti,tas5828 | 129 | - ti,tas5828 |
| 130 | - ti,tas5830 | ||
| 100 | - const: ti,tas2781 | 131 | - const: ti,tas2781 |
| 101 | - enum: | 132 | - enum: |
| 102 | - ti,tas2781 | 133 | - ti,tas2781 |
| @@ -132,6 +163,8 @@ allOf: · 29 unmodified lines | |||
| 132 | - ti,tas2118 | 163 | - ti,tas2118 |
| 133 | - ti,tas2120 | 164 | - ti,tas2120 |
| 134 | - ti,tas2320 | 165 | - ti,tas2320 |
| 166 | - ti,tas2568 | ||
| 167 | - ti,tas2574 | ||
| 135 | then: | 168 | then: |
| 136 | properties: | 169 | properties: |
| 137 | reg: | 170 | reg: |
| @@ -207,6 +240,22 @@ allOf: · 69 unmodified lines | |||
| 207 | minimum: 0x54 | 240 | minimum: 0x54 |
| 208 | maximum: 0x57 | 241 | maximum: 0x57 |
| 209 | 242 | ||
| 243 | - if: | ||
| 244 | properties: | ||
| 245 | compatible: | ||
| 246 | contains: | ||
| 247 | enum: | ||
| 248 | - ti,tas5806m | ||
| 249 | - ti,tas5806md | ||
| 250 | - ti,tas5822 | ||
| 251 | then: | ||
| 252 | properties: | ||
| 253 | reg: | ||
| 254 | maxItems: 4 | ||
| 255 | items: | ||
| 256 | minimum: 0x2c | ||
| 257 | maximum: 0x2f | ||
| 258 | |||
| 210 | - if: | 259 | - if: |
| 211 | properties: | 260 | properties: |
| 212 | compatible: | 261 | compatible: |
| @@ -214,6 +263,7 @@ allOf: · 1 unmodified line | |||
| 214 | enum: | 263 | enum: |
| 215 | - ti,tas5827 | 264 | - ti,tas5827 |
| 216 | - ti,tas5828 | 265 | - ti,tas5828 |
| 266 | - ti,tas5830 | ||
| 217 | then: | 267 | then: |
| 218 | properties: | 268 | properties: |
| 219 | reg: | 269 | reg: |
| @@ -0,0 +1,79 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/trivial-codec.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Trivial Audio Codec | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - Rob Herring <robh@kernel.org> | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | enum: | ||
| 18 | # Analog Devices SSM2602 I2S audio CODEC devices | ||
| 19 | - adi,ssm2602 | ||
| 20 | - adi,ssm2603 | ||
| 21 | - adi,ssm2604 | ||
| 22 | - adi,ssm3515 | ||
| 23 | # Cirrus Logic CS4265 audio DAC | ||
| 24 | - cirrus,cs4265 | ||
| 25 | - cirrus,cs4341a | ||
| 26 | - cirrus,cs4349 | ||
| 27 | - dlg,da9055-codec | ||
| 28 | # Nuvoton Technology Corporation NAU85L40 Audio CODEC | ||
| 29 | - nuvoton,nau8540 | ||
| 30 | - nuvoton,nau8810 | ||
| 31 | - nuvoton,nau8812 | ||
| 32 | - nuvoton,nau8814 | ||
| 33 | # NXP TFA9879 class-D audio amplifier | ||
| 34 | - nxp,tfa9879 | ||
| 35 | - nxp,uda1342 | ||
| 36 | - sdw3019f836300 | ||
| 37 | - ti,pcm1789 | ||
| 38 | - ti,pcm1792a | ||
| 39 | - ti,pcm5102a | ||
| 40 | - wlf,wm8510 | ||
| 41 | - wlf,wm8523 | ||
| 42 | - wlf,wm8580 | ||
| 43 | - wlf,wm8581 | ||
| 44 | - wlf,wm8711 | ||
| 45 | - wlf,wm8728 | ||
| 46 | - wlf,wm8737 | ||
| 47 | - wlf,wm8750 | ||
| 48 | - wlf,wm8753 | ||
| 49 | - wlf,wm8770 | ||
| 50 | - wlf,wm8776 | ||
| 51 | - wlf,wm8961 | ||
| 52 | - wlf,wm8974 | ||
| 53 | - wlf,wm8987 | ||
| 54 | |||
| 55 | reg: | ||
| 56 | maxItems: 1 | ||
| 57 | |||
| 58 | "#sound-dai-cells": | ||
| 59 | const: 0 | ||
| 60 | |||
| 61 | reset-gpios: | ||
| 62 | maxItems: 1 | ||
| 63 | |||
| 64 | required: | ||
| 65 | - compatible | ||
| 66 | - reg | ||
| 67 | |||
| 68 | unevaluatedProperties: false | ||
| 69 | |||
| 70 | examples: | ||
| 71 | - | | ||
| 72 | i2c { | ||
| 73 | #address-cells = <1>; | ||
| 74 | #size-cells = <0>; | ||
| 75 | codec@1a { | ||
| 76 | compatible = "wlf,wm8523"; | ||
| 77 | reg = <0x1a>; | ||
| 78 | }; | ||
| 79 | }; | ||
| @@ -1,41 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8510.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8510 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8510 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | |||
| 37 | codec@1a { | ||
| 38 | compatible = "wlf,wm8510"; | ||
| 39 | reg = <0x1a>; | ||
| 40 | }; | ||
| 41 | }; | ||
| @@ -1,40 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8523.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8523 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8523 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | codec@1a { | ||
| 37 | compatible = "wlf,wm8523"; | ||
| 38 | reg = <0x1a>; | ||
| 39 | }; | ||
| 40 | }; | ||
| @@ -1,42 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8580.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8580 and WM8581 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | enum: | ||
| 18 | - wlf,wm8580 | ||
| 19 | - wlf,wm8581 | ||
| 20 | |||
| 21 | reg: | ||
| 22 | maxItems: 1 | ||
| 23 | |||
| 24 | "#sound-dai-cells": | ||
| 25 | const: 0 | ||
| 26 | |||
| 27 | required: | ||
| 28 | - compatible | ||
| 29 | - reg | ||
| 30 | |||
| 31 | unevaluatedProperties: false | ||
| 32 | |||
| 33 | examples: | ||
| 34 | - | | ||
| 35 | i2c { | ||
| 36 | #address-cells = <1>; | ||
| 37 | #size-cells = <0>; | ||
| 38 | codec@1a { | ||
| 39 | compatible = "wlf,wm8580"; | ||
| 40 | reg = <0x1a>; | ||
| 41 | }; | ||
| 42 | }; | ||
| @@ -1,40 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8711.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8711 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8711 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | codec@1a { | ||
| 37 | compatible = "wlf,wm8711"; | ||
| 38 | reg = <0x1a>; | ||
| 39 | }; | ||
| 40 | }; | ||
| @@ -1,40 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8728.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8728 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8728 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | codec@1a { | ||
| 37 | compatible = "wlf,wm8728"; | ||
| 38 | reg = <0x1a>; | ||
| 39 | }; | ||
| 40 | }; | ||
| @@ -1,40 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8737.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8737 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8737 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | codec@1a { | ||
| 37 | compatible = "wlf,wm8737"; | ||
| 38 | reg = <0x1a>; | ||
| 39 | }; | ||
| 40 | }; | ||
| @@ -1,42 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8750.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8750 and WM8987 audio CODECs | ||
| 8 | |||
| 9 | description: | | ||
| 10 | These devices support both I2C and SPI (configured with pin strapping | ||
| 11 | on the board). | ||
| 12 | |||
| 13 | maintainers: | ||
| 14 | - Mark Brown <broonie@kernel.org> | ||
| 15 | |||
| 16 | properties: | ||
| 17 | compatible: | ||
| 18 | enum: | ||
| 19 | - wlf,wm8750 | ||
| 20 | - wlf,wm8987 | ||
| 21 | |||
| 22 | reg: | ||
| 23 | description: | ||
| 24 | The I2C address of the device for I2C, the chip select number for SPI | ||
| 25 | maxItems: 1 | ||
| 26 | |||
| 27 | additionalProperties: false | ||
| 28 | |||
| 29 | required: | ||
| 30 | - reg | ||
| 31 | |||
| 32 | examples: | ||
| 33 | - | | ||
| 34 | i2c { | ||
| 35 | #address-cells = <1>; | ||
| 36 | #size-cells = <0>; | ||
| 37 | |||
| 38 | codec@1a { | ||
| 39 | compatible = "wlf,wm8750"; | ||
| 40 | reg = <0x1a>; | ||
| 41 | }; | ||
| 42 | }; | ||
| @@ -1,62 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8753.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8753 audio CODEC | ||
| 8 | |||
| 9 | description: | | ||
| 10 | Pins on the device (for linking into audio routes): | ||
| 11 | * LOUT1 | ||
| 12 | * LOUT2 | ||
| 13 | * ROUT1 | ||
| 14 | * ROUT2 | ||
| 15 | * MONO1 | ||
| 16 | * MONO2 | ||
| 17 | * OUT3 | ||
| 18 | * OUT4 | ||
| 19 | * LINE1 | ||
| 20 | * LINE2 | ||
| 21 | * RXP | ||
| 22 | * RXN | ||
| 23 | * ACIN | ||
| 24 | * ACOP | ||
| 25 | * MIC1N | ||
| 26 | * MIC1 | ||
| 27 | * MIC2N | ||
| 28 | * MIC2 | ||
| 29 | * Mic Bias | ||
| 30 | |||
| 31 | maintainers: | ||
| 32 | - patches@opensource.cirrus.com | ||
| 33 | |||
| 34 | allOf: | ||
| 35 | - $ref: dai-common.yaml# | ||
| 36 | |||
| 37 | properties: | ||
| 38 | compatible: | ||
| 39 | const: wlf,wm8753 | ||
| 40 | |||
| 41 | reg: | ||
| 42 | maxItems: 1 | ||
| 43 | |||
| 44 | "#sound-dai-cells": | ||
| 45 | const: 0 | ||
| 46 | |||
| 47 | required: | ||
| 48 | - compatible | ||
| 49 | - reg | ||
| 50 | |||
| 51 | unevaluatedProperties: false | ||
| 52 | |||
| 53 | examples: | ||
| 54 | - | | ||
| 55 | i2c { | ||
| 56 | #address-cells = <1>; | ||
| 57 | #size-cells = <0>; | ||
| 58 | codec@1a { | ||
| 59 | compatible = "wlf,wm8753"; | ||
| 60 | reg = <0x1a>; | ||
| 61 | }; | ||
| 62 | }; | ||
| @@ -1,41 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8776.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8776 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8776 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | |||
| 37 | codec@1a { | ||
| 38 | compatible = "wlf,wm8776"; | ||
| 39 | reg = <0x1a>; | ||
| 40 | }; | ||
| 41 | }; | ||
| @@ -1,43 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8961.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: Wolfson WM8961 Ultra-Low Power Stereo CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8961 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | '#sound-dai-cells': | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | - '#sound-dai-cells' | ||
| 29 | |||
| 30 | unevaluatedProperties: false | ||
| 31 | |||
| 32 | examples: | ||
| 33 | - | | ||
| 34 | i2c { | ||
| 35 | #address-cells = <1>; | ||
| 36 | #size-cells = <0>; | ||
| 37 | |||
| 38 | wm8961: codec@4a { | ||
| 39 | compatible = "wlf,wm8961"; | ||
| 40 | reg = <0x4a>; | ||
| 41 | #sound-dai-cells = <0>; | ||
| 42 | }; | ||
| 43 | }; | ||
| @@ -1,41 +0,0 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause | ||
| 2 | %YAML 1.2 | ||
| 3 | --- | ||
| 4 | $id: http://devicetree.org/schemas/sound/wlf,wm8974.yaml# | ||
| 5 | $schema: http://devicetree.org/meta-schemas/core.yaml# | ||
| 6 | |||
| 7 | title: WM8974 audio CODEC | ||
| 8 | |||
| 9 | maintainers: | ||
| 10 | - patches@opensource.cirrus.com | ||
| 11 | |||
| 12 | allOf: | ||
| 13 | - $ref: dai-common.yaml# | ||
| 14 | |||
| 15 | properties: | ||
| 16 | compatible: | ||
| 17 | const: wlf,wm8974 | ||
| 18 | |||
| 19 | reg: | ||
| 20 | maxItems: 1 | ||
| 21 | |||
| 22 | "#sound-dai-cells": | ||
| 23 | const: 0 | ||
| 24 | |||
| 25 | required: | ||
| 26 | - compatible | ||
| 27 | - reg | ||
| 28 | |||
| 29 | unevaluatedProperties: false | ||
| 30 | |||
| 31 | examples: | ||
| 32 | - | | ||
| 33 | i2c { | ||
| 34 | #address-cells = <1>; | ||
| 35 | #size-cells = <0>; | ||
| 36 | |||
| 37 | codec@1a { | ||
| 38 | compatible = "wlf,wm8974"; | ||
| 39 | reg = <0x1a>; | ||
| 40 | }; | ||
| 41 | }; | ||
| @@ -1,16 +0,0 @@ | |||
| 1 | WM8770 audio CODEC | ||
| 2 | |||
| 3 | This device supports SPI. | ||
| 4 | |||
| 5 | Required properties: | ||
| 6 | |||
| 7 | - compatible : "wlf,wm8770" | ||
| 8 | |||
| 9 | - reg : the chip select number. | ||
| 10 | |||
| 11 | Example: | ||
| 12 | |||
| 13 | wm8770: codec@1 { | ||
| 14 | compatible = "wlf,wm8770"; | ||
| 15 | reg = <1>; | ||
| 16 | }; | ||
| @@ -1758,6 +1758,7 @@ S: Supported · 1757 unmodified lines | |||
| 1758 | W: http://wiki.analog.com/ | 1758 | W: http://wiki.analog.com/ |
| 1759 | W: https://ez.analog.com/linux-software-drivers | 1759 | W: https://ez.analog.com/linux-software-drivers |
| 1760 | F: Documentation/devicetree/bindings/sound/adi,* | 1760 | F: Documentation/devicetree/bindings/sound/adi,* |
| 1761 | F: Documentation/devicetree/bindings/sound/trivial-codec.yaml | ||
| 1761 | F: sound/soc/codecs/ad1* | 1762 | F: sound/soc/codecs/ad1* |
| 1762 | F: sound/soc/codecs/ad7* | 1763 | F: sound/soc/codecs/ad7* |
| 1763 | F: sound/soc/codecs/adau* | 1764 | F: sound/soc/codecs/adau* |
| @@ -2421,9 +2422,9 @@ M: Martin Povišer <povik+lin@cutebit.org> · 657 unmodified lines | |||
| 2421 | L: asahi@lists.linux.dev | 2422 | L: asahi@lists.linux.dev |
| 2422 | L: linux-sound@vger.kernel.org | 2423 | L: linux-sound@vger.kernel.org |
| 2423 | S: Maintained | 2424 | S: Maintained |
| 2424 | F: Documentation/devicetree/bindings/sound/adi,ssm3515.yaml | ||
| 2425 | F: Documentation/devicetree/bindings/sound/cirrus,cs42l84.yaml | ||
| 2426 | F: Documentation/devicetree/bindings/sound/apple,* | 2425 | F: Documentation/devicetree/bindings/sound/apple,* |
| 2426 | F: Documentation/devicetree/bindings/sound/cirrus,cs42l84.yaml | ||
| 2427 | F: Documentation/devicetree/bindings/sound/trivial-codec.yaml | ||
| 2427 | F: sound/soc/apple/* | 2428 | F: sound/soc/apple/* |
| 2428 | F: sound/soc/codecs/cs42l83-i2c.c | 2429 | F: sound/soc/codecs/cs42l83-i2c.c |
| 2429 | F: sound/soc/codecs/cs42l84.* | 2430 | F: sound/soc/codecs/cs42l84.* |
| @@ -18749,7 +18750,7 @@ NXP TFA9879 DRIVER · 16319 unmodified lines | |||
| 18749 | M: Peter Rosin <peda@axentia.se> | 18750 | M: Peter Rosin <peda@axentia.se> |
| 18750 | L: linux-sound@vger.kernel.org | 18751 | L: linux-sound@vger.kernel.org |
| 18751 | S: Maintained | 18752 | S: Maintained |
| 18752 | F: Documentation/devicetree/bindings/sound/nxp,tfa9879.yaml | 18753 | F: Documentation/devicetree/bindings/sound/trivial-codec.yaml |
| 18753 | F: sound/soc/codecs/tfa9879* | 18754 | F: sound/soc/codecs/tfa9879* |
| 18754 | 18755 | ||
| 18755 | NXP-NCI NFC DRIVER | 18756 | NXP-NCI NFC DRIVER |
| @@ -27799,6 +27800,7 @@ F: Documentation/devicetree/bindings/extcon/wlf,arizona.yaml · 9043 unmodified lines | |||
| 27799 | F: Documentation/devicetree/bindings/mfd/wlf,arizona.yaml | 27800 | F: Documentation/devicetree/bindings/mfd/wlf,arizona.yaml |
| 27800 | F: Documentation/devicetree/bindings/mfd/wm831x.txt | 27801 | F: Documentation/devicetree/bindings/mfd/wm831x.txt |
| 27801 | F: Documentation/devicetree/bindings/regulator/wlf,arizona.yaml | 27802 | F: Documentation/devicetree/bindings/regulator/wlf,arizona.yaml |
| 27803 | F: Documentation/devicetree/bindings/sound/trivial-codec.yaml | ||
| 27802 | F: Documentation/devicetree/bindings/sound/wlf,*.yaml | 27804 | F: Documentation/devicetree/bindings/sound/wlf,*.yaml |
| 27803 | F: Documentation/devicetree/bindings/sound/wm* | 27805 | F: Documentation/devicetree/bindings/sound/wm* |
| 27804 | F: Documentation/hwmon/wm83??.rst | 27806 | F: Documentation/hwmon/wm83??.rst |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | struct regmap_mbq_context { | 16 | struct regmap_mbq_context { |
| 17 | struct device *dev; | 17 | struct device *dev; |
| 18 | struct sdw_slave *sdw; | ||
| 18 | 19 | ||
| 19 | struct regmap_sdw_mbq_cfg cfg; | 20 | struct regmap_sdw_mbq_cfg cfg; |
| 20 | 21 | ||
| @@ -46,7 +47,7 @@ static bool regmap_sdw_mbq_deferrable(struct regmap_mbq_context *ctx, unsigned i · 25 unmodified lines | |||
| 46 | static int regmap_sdw_mbq_poll_busy(struct sdw_slave *slave, unsigned int reg, | 47 | static int regmap_sdw_mbq_poll_busy(struct sdw_slave *slave, unsigned int reg, |
| 47 | struct regmap_mbq_context *ctx) | 48 | struct regmap_mbq_context *ctx) |
| 48 | { | 49 | { |
| 49 | struct device *dev = &slave->dev; | 50 | struct device *dev = ctx->dev; |
| 50 | int val, ret = 0; | 51 | int val, ret = 0; |
| 51 | 52 | ||
| 52 | dev_dbg(dev, "Deferring transaction for 0x%x\n", reg); | 53 | dev_dbg(dev, "Deferring transaction for 0x%x\n", reg); |
| @@ -96,8 +97,7 @@ static int regmap_sdw_mbq_write_impl(struct sdw_slave *slave, · 43 unmodified lines | |||
| 96 | static int regmap_sdw_mbq_write(void *context, unsigned int reg, unsigned int val) | 97 | static int regmap_sdw_mbq_write(void *context, unsigned int reg, unsigned int val) |
| 97 | { | 98 | { |
| 98 | struct regmap_mbq_context *ctx = context; | 99 | struct regmap_mbq_context *ctx = context; |
| 99 | struct device *dev = ctx->dev; | 100 | struct sdw_slave *slave = ctx->sdw; |
| 100 | struct sdw_slave *slave = dev_to_sdw_dev(dev); | ||
| 101 | bool deferrable = regmap_sdw_mbq_deferrable(ctx, reg); | 101 | bool deferrable = regmap_sdw_mbq_deferrable(ctx, reg); |
| 102 | int mbq_size = regmap_sdw_mbq_size(ctx, reg); | 102 | int mbq_size = regmap_sdw_mbq_size(ctx, reg); |
| 103 | int ret; | 103 | int ret; |
| @@ -156,8 +156,7 @@ static int regmap_sdw_mbq_read_impl(struct sdw_slave *slave, · 52 unmodified lines | |||
| 156 | static int regmap_sdw_mbq_read(void *context, unsigned int reg, unsigned int *val) | 156 | static int regmap_sdw_mbq_read(void *context, unsigned int reg, unsigned int *val) |
| 157 | { | 157 | { |
| 158 | struct regmap_mbq_context *ctx = context; | 158 | struct regmap_mbq_context *ctx = context; |
| 159 | struct device *dev = ctx->dev; | 159 | struct sdw_slave *slave = ctx->sdw; |
| 160 | struct sdw_slave *slave = dev_to_sdw_dev(dev); | ||
| 161 | bool deferrable = regmap_sdw_mbq_deferrable(ctx, reg); | 160 | bool deferrable = regmap_sdw_mbq_deferrable(ctx, reg); |
| 162 | int mbq_size = regmap_sdw_mbq_size(ctx, reg); | 161 | int mbq_size = regmap_sdw_mbq_size(ctx, reg); |
| 163 | int ret; | 162 | int ret; |
| @@ -208,6 +207,7 @@ static int regmap_sdw_mbq_config_check(const struct regmap_config *config) · 44 unmodified lines | |||
| 208 | 207 | ||
| 209 | static struct regmap_mbq_context * | 208 | static struct regmap_mbq_context * |
| 210 | regmap_sdw_mbq_gen_context(struct device *dev, | 209 | regmap_sdw_mbq_gen_context(struct device *dev, |
| 210 | struct sdw_slave *sdw, | ||
| 211 | const struct regmap_config *config, | 211 | const struct regmap_config *config, |
| 212 | const struct regmap_sdw_mbq_cfg *mbq_config) | 212 | const struct regmap_sdw_mbq_cfg *mbq_config) |
| 213 | { | 213 | { |
| @@ -218,6 +218,7 @@ regmap_sdw_mbq_gen_context(struct device *dev, · 4 unmodified lines | |||
| 218 | return ERR_PTR(-ENOMEM); | 218 | return ERR_PTR(-ENOMEM); |
| 219 | 219 | ||
| 220 | ctx->dev = dev; | 220 | ctx->dev = dev; |
| 221 | ctx->sdw = sdw; | ||
| 221 | 222 | ||
| 222 | if (mbq_config) | 223 | if (mbq_config) |
| 223 | ctx->cfg = *mbq_config; | 224 | ctx->cfg = *mbq_config; |
| @@ -228,7 +229,7 @@ regmap_sdw_mbq_gen_context(struct device *dev, · 4 unmodified lines | |||
| 228 | return ctx; | 229 | return ctx; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 231 | struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw, | 232 | struct regmap *__regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw, |
| 232 | const struct regmap_config *config, | 233 | const struct regmap_config *config, |
| 233 | const struct regmap_sdw_mbq_cfg *mbq_config, | 234 | const struct regmap_sdw_mbq_cfg *mbq_config, |
| 234 | struct lock_class_key *lock_key, | 235 | struct lock_class_key *lock_key, |
| @@ -241,16 +242,16 @@ struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw, · 6 unmodified lines | |||
| 241 | if (ret) | 242 | if (ret) |
| 242 | return ERR_PTR(ret); | 243 | return ERR_PTR(ret); |
| 243 | 244 | ||
| 244 | ctx = regmap_sdw_mbq_gen_context(&sdw->dev, config, mbq_config); | 245 | ctx = regmap_sdw_mbq_gen_context(dev, sdw, config, mbq_config); |
| 245 | if (IS_ERR(ctx)) | 246 | if (IS_ERR(ctx)) |
| 246 | return ERR_CAST(ctx); | 247 | return ERR_CAST(ctx); |
| 247 | 248 | ||
| 248 | return __regmap_init(&sdw->dev, ®map_sdw_mbq, ctx, | 249 | return __regmap_init(dev, ®map_sdw_mbq, ctx, |
| 249 | config, lock_key, lock_name); | 250 | config, lock_key, lock_name); |
| 250 | } | 251 | } |
| 251 | EXPORT_SYMBOL_GPL(__regmap_init_sdw_mbq); | 252 | EXPORT_SYMBOL_GPL(__regmap_init_sdw_mbq); |
| 252 | 253 | ||
| 253 | struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw, | 254 | struct regmap *__devm_regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw, |
| 254 | const struct regmap_config *config, | 255 | const struct regmap_config *config, |
| 255 | const struct regmap_sdw_mbq_cfg *mbq_config, | 256 | const struct regmap_sdw_mbq_cfg *mbq_config, |
| 256 | struct lock_class_key *lock_key, | 257 | struct lock_class_key *lock_key, |
| @@ -263,11 +264,11 @@ struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw, · 6 unmodified lines | |||
| 263 | if (ret) | 264 | if (ret) |
| 264 | return ERR_PTR(ret); | 265 | return ERR_PTR(ret); |
| 265 | 266 | ||
| 266 | ctx = regmap_sdw_mbq_gen_context(&sdw->dev, config, mbq_config); | 267 | ctx = regmap_sdw_mbq_gen_context(dev, sdw, config, mbq_config); |
| 267 | if (IS_ERR(ctx)) | 268 | if (IS_ERR(ctx)) |
| 268 | return ERR_CAST(ctx); | 269 | return ERR_CAST(ctx); |
| 269 | 270 | ||
| 270 | return __devm_regmap_init(&sdw->dev, ®map_sdw_mbq, ctx, | 271 | return __devm_regmap_init(dev, ®map_sdw_mbq, ctx, |
| 271 | config, lock_key, lock_name); | 272 | config, lock_key, lock_name); |
| 272 | } | 273 | } |
| 273 | EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw_mbq); | 274 | EXPORT_SYMBOL_GPL(__devm_regmap_init_sdw_mbq); |
| @@ -9,9 +9,11 @@ · 8 unmodified lines | |||
| 9 | * Cirrus Logic International Semiconductor Ltd. | 9 | * Cirrus Logic International Semiconductor Ltd. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/cleanup.h> | ||
| 12 | #include <linux/ctype.h> | 13 | #include <linux/ctype.h> |
| 13 | #include <linux/debugfs.h> | 14 | #include <linux/debugfs.h> |
| 14 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/math.h> | ||
| 15 | #include <linux/minmax.h> | 17 | #include <linux/minmax.h> |
| 16 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 17 | #include <linux/moduleparam.h> | 19 | #include <linux/moduleparam.h> |
| @@ -316,44 +318,6 @@ struct cs_dsp_alg_region_list_item { · 298 unmodified lines | |||
| 316 | struct cs_dsp_alg_region alg_region; | 318 | struct cs_dsp_alg_region alg_region; |
| 317 | }; | 319 | }; |
| 318 | 320 | ||
| 319 | struct cs_dsp_buf { | ||
| 320 | struct list_head list; | ||
| 321 | void *buf; | ||
| 322 | }; | ||
| 323 | |||
| 324 | static struct cs_dsp_buf *cs_dsp_buf_alloc(const void *src, size_t len, | ||
| 325 | struct list_head *list) | ||
| 326 | { | ||
| 327 | struct cs_dsp_buf *buf = kzalloc(sizeof(*buf), GFP_KERNEL); | ||
| 328 | |||
| 329 | if (buf == NULL) | ||
| 330 | return NULL; | ||
| 331 | |||
| 332 | buf->buf = vmalloc(len); | ||
| 333 | if (!buf->buf) { | ||
| 334 | kfree(buf); | ||
| 335 | return NULL; | ||
| 336 | } | ||
| 337 | memcpy(buf->buf, src, len); | ||
| 338 | |||
| 339 | if (list) | ||
| 340 | list_add_tail(&buf->list, list); | ||
| 341 | |||
| 342 | return buf; | ||
| 343 | } | ||
| 344 | |||
| 345 | static void cs_dsp_buf_free(struct list_head *list) | ||
| 346 | { | ||
| 347 | while (!list_empty(list)) { | ||
| 348 | struct cs_dsp_buf *buf = list_first_entry(list, | ||
| 349 | struct cs_dsp_buf, | ||
| 350 | list); | ||
| 351 | list_del(&buf->list); | ||
| 352 | vfree(buf->buf); | ||
| 353 | kfree(buf); | ||
| 354 | } | ||
| 355 | } | ||
| 356 | |||
| 357 | /** | 321 | /** |
| 358 | * cs_dsp_mem_region_name() - Return a name string for a memory type | 322 | * cs_dsp_mem_region_name() - Return a name string for a memory type |
| 359 | * @type: the memory type to match | 323 | * @type: the memory type to match |
| @@ -388,18 +352,14 @@ EXPORT_SYMBOL_NS_GPL(cs_dsp_mem_region_name, "FW_CS_DSP"); · 28 unmodified lines | |||
| 388 | #ifdef CONFIG_DEBUG_FS | 352 | #ifdef CONFIG_DEBUG_FS |
| 389 | static void cs_dsp_debugfs_save_wmfwname(struct cs_dsp *dsp, const char *s) | 353 | static void cs_dsp_debugfs_save_wmfwname(struct cs_dsp *dsp, const char *s) |
| 390 | { | 354 | { |
| 391 | char *tmp = kasprintf(GFP_KERNEL, "%s\n", s); | ||
| 392 | |||
| 393 | kfree(dsp->wmfw_file_name); | 355 | kfree(dsp->wmfw_file_name); |
| 394 | dsp->wmfw_file_name = tmp; | 356 | dsp->wmfw_file_name = kstrdup(s, GFP_KERNEL); |
| 395 | } | 357 | } |
| 396 | 358 | ||
| 397 | static void cs_dsp_debugfs_save_binname(struct cs_dsp *dsp, const char *s) | 359 | static void cs_dsp_debugfs_save_binname(struct cs_dsp *dsp, const char *s) |
| 398 | { | 360 | { |
| 399 | char *tmp = kasprintf(GFP_KERNEL, "%s\n", s); | ||
| 400 | |||
| 401 | kfree(dsp->bin_file_name); | 361 | kfree(dsp->bin_file_name); |
| 402 | dsp->bin_file_name = tmp; | 362 | dsp->bin_file_name = kstrdup(s, GFP_KERNEL); |
| 403 | } | 363 | } |
| 404 | 364 | ||
| 405 | static void cs_dsp_debugfs_clear(struct cs_dsp *dsp) | 365 | static void cs_dsp_debugfs_clear(struct cs_dsp *dsp) |
| @@ -410,24 +370,33 @@ static void cs_dsp_debugfs_clear(struct cs_dsp *dsp) · 4 unmodified lines | |||
| 410 | dsp->bin_file_name = NULL; | 370 | dsp->bin_file_name = NULL; |
| 411 | } | 371 | } |
| 412 | 372 | ||
| 373 | static ssize_t cs_dsp_debugfs_string_read(struct cs_dsp *dsp, | ||
| 374 | char __user *user_buf, | ||
| 375 | size_t count, loff_t *ppos, | ||
| 376 | const char **pstr) | ||
| 377 | { | ||
| 378 | const char *str __free(kfree) = NULL; | ||
| 379 | |||
| 380 | scoped_guard(mutex, &dsp->pwr_lock) { | ||
| 381 | if (!*pstr) | ||
| 382 | return 0; | ||
| 383 | |||
| 384 | str = kasprintf(GFP_KERNEL, "%s\n", *pstr); | ||
| 385 | if (!str) | ||
| 386 | return -ENOMEM; | ||
| 387 | |||
| 388 | return simple_read_from_buffer(user_buf, count, ppos, str, strlen(str)); | ||
| 389 | } | ||
| 390 | } | ||
| 391 | |||
| 413 | static ssize_t cs_dsp_debugfs_wmfw_read(struct file *file, | 392 | static ssize_t cs_dsp_debugfs_wmfw_read(struct file *file, |
| 414 | char __user *user_buf, | 393 | char __user *user_buf, |
| 415 | size_t count, loff_t *ppos) | 394 | size_t count, loff_t *ppos) |
| 416 | { | 395 | { |
| 417 | struct cs_dsp *dsp = file->private_data; | 396 | struct cs_dsp *dsp = file->private_data; |
| 418 | ssize_t ret; | ||
| 419 | |||
| 420 | mutex_lock(&dsp->pwr_lock); | ||
| 421 | 397 | ||
| 422 | if (!dsp->wmfw_file_name || !dsp->booted) | 398 | return cs_dsp_debugfs_string_read(dsp, user_buf, count, ppos, |
| 423 | ret = 0; | 399 | &dsp->wmfw_file_name); |
| 424 | else | ||
| 425 | ret = simple_read_from_buffer(user_buf, count, ppos, | ||
| 426 | dsp->wmfw_file_name, | ||
| 427 | strlen(dsp->wmfw_file_name)); | ||
| 428 | |||
| 429 | mutex_unlock(&dsp->pwr_lock); | ||
| 430 | return ret; | ||
| 431 | } | 400 | } |
| 432 | 401 | ||
| 433 | static ssize_t cs_dsp_debugfs_bin_read(struct file *file, | 402 | static ssize_t cs_dsp_debugfs_bin_read(struct file *file, |
| @@ -435,19 +404,9 @@ static ssize_t cs_dsp_debugfs_bin_read(struct file *file, · 1 unmodified line | |||
| 435 | size_t count, loff_t *ppos) | 404 | size_t count, loff_t *ppos) |
| 436 | { | 405 | { |
| 437 | struct cs_dsp *dsp = file->private_data; | 406 | struct cs_dsp *dsp = file->private_data; |
| 438 | ssize_t ret; | ||
| 439 | |||
| 440 | mutex_lock(&dsp->pwr_lock); | ||
| 441 | 407 | ||
| 442 | if (!dsp->bin_file_name || !dsp->booted) | 408 | return cs_dsp_debugfs_string_read(dsp, user_buf, count, ppos, |
| 443 | ret = 0; | 409 | &dsp->bin_file_name); |
| 444 | else | ||
| 445 | ret = simple_read_from_buffer(user_buf, count, ppos, | ||
| 446 | dsp->bin_file_name, | ||
| 447 | strlen(dsp->bin_file_name)); | ||
| 448 | |||
| 449 | mutex_unlock(&dsp->pwr_lock); | ||
| 450 | return ret; | ||
| 451 | } | 410 | } |
| 452 | 411 | ||
| 453 | static const struct { | 412 | static const struct { |
| @@ -479,9 +438,11 @@ static int cs_dsp_debugfs_read_controls_show(struct seq_file *s, void *ignored) · 25 unmodified lines | |||
| 479 | struct cs_dsp_coeff_ctl *ctl; | 438 | struct cs_dsp_coeff_ctl *ctl; |
| 480 | unsigned int reg; | 439 | unsigned int reg; |
| 481 | 440 | ||
| 441 | guard(mutex)(&dsp->pwr_lock); | ||
| 442 | |||
| 482 | list_for_each_entry(ctl, &dsp->ctl_list, list) { | 443 | list_for_each_entry(ctl, &dsp->ctl_list, list) { |
| 483 | cs_dsp_coeff_base_reg(ctl, ®, 0); | 444 | cs_dsp_coeff_base_reg(ctl, ®, 0); |
| 484 | seq_printf(s, "%22.*s: %#8zx %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n", | 445 | seq_printf(s, "%22.*s: %#8x %s:%08x %#8x %s %#8x %#4x %c%c%c%c %s %s\n", |
| 485 | ctl->subname_len, ctl->subname, ctl->len, | 446 | ctl->subname_len, ctl->subname, ctl->len, |
| 486 | cs_dsp_mem_region_name(ctl->alg_region.type), | 447 | cs_dsp_mem_region_name(ctl->alg_region.type), |
| 487 | ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type, | 448 | ctl->offset, reg, ctl->fw_name, ctl->alg_region.alg, ctl->type, |
| @@ -1028,7 +989,7 @@ static void cs_dsp_signal_event_controls(struct cs_dsp *dsp, · 540 unmodified lines | |||
| 1028 | 989 | ||
| 1029 | static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl) | 990 | static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl) |
| 1030 | { | 991 | { |
| 1031 | kfree(ctl->cache); | 992 | kvfree(ctl->cache); |
| 1032 | kfree(ctl->subname); | 993 | kfree(ctl->subname); |
| 1033 | kfree(ctl); | 994 | kfree(ctl); |
| 1034 | } | 995 | } |
| @@ -1078,7 +1039,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, · 43 unmodified lines | |||
| 1078 | ctl->type = type; | 1039 | ctl->type = type; |
| 1079 | ctl->offset = offset; | 1040 | ctl->offset = offset; |
| 1080 | ctl->len = len; | 1041 | ctl->len = len; |
| 1081 | ctl->cache = kzalloc(ctl->len, GFP_KERNEL); | 1042 | ctl->cache = kvzalloc(ctl->len, GFP_KERNEL); |
| 1082 | if (!ctl->cache) { | 1043 | if (!ctl->cache) { |
| 1083 | ret = -ENOMEM; | 1044 | ret = -ENOMEM; |
| 1084 | goto err_ctl_subname; | 1045 | goto err_ctl_subname; |
| @@ -1096,7 +1057,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, · 11 unmodified lines | |||
| 1096 | 1057 | ||
| 1097 | err_list_del: | 1058 | err_list_del: |
| 1098 | list_del(&ctl->list); | 1059 | list_del(&ctl->list); |
| 1099 | kfree(ctl->cache); | 1060 | kvfree(ctl->cache); |
| 1100 | err_ctl_subname: | 1061 | err_ctl_subname: |
| 1101 | kfree(ctl->subname); | 1062 | kfree(ctl->subname); |
| 1102 | err_ctl: | 1063 | err_ctl: |
| @@ -1485,7 +1446,9 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware, · 382 unmodified lines | |||
| 1485 | const struct wmfw_region *region; | 1446 | const struct wmfw_region *region; |
| 1486 | const struct cs_dsp_region *mem; | 1447 | const struct cs_dsp_region *mem; |
| 1487 | const char *region_name; | 1448 | const char *region_name; |
| 1488 | struct cs_dsp_buf *buf; | 1449 | u8 *buf __free(kfree) = NULL; |
| 1450 | size_t buf_len = 0; | ||
| 1451 | size_t region_len; | ||
| 1489 | unsigned int reg; | 1452 | unsigned int reg; |
| 1490 | int regions = 0; | 1453 | int regions = 0; |
| 1491 | int ret, offset, type; | 1454 | int ret, offset, type; |
| @@ -1605,23 +1568,23 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware, · 113 unmodified lines | |||
| 1605 | region_name); | 1568 | region_name); |
| 1606 | 1569 | ||
| 1607 | if (reg) { | 1570 | if (reg) { |
| 1608 | buf = cs_dsp_buf_alloc(region->data, | 1571 | region_len = le32_to_cpu(region->len); |
| 1609 | le32_to_cpu(region->len), | 1572 | if (region_len > buf_len) { |
| 1610 | &buf_list); | 1573 | buf_len = round_up(region_len, PAGE_SIZE); |
| 1611 | if (!buf) { | 1574 | kfree(buf); |
| 1612 | cs_dsp_err(dsp, "Out of memory\n"); | 1575 | buf = kmalloc(buf_len, GFP_KERNEL | GFP_DMA); |
| 1613 | ret = -ENOMEM; | 1576 | if (!buf) { |
| 1614 | goto out_fw; | 1577 | ret = -ENOMEM; |
| 1578 | goto out_fw; | ||
| 1579 | } | ||
| 1615 | } | 1580 | } |
| 1616 | 1581 | ||
| 1617 | ret = regmap_raw_write(regmap, reg, buf->buf, | 1582 | memcpy(buf, region->data, region_len); |
| 1618 | le32_to_cpu(region->len)); | 1583 | ret = regmap_raw_write(regmap, reg, buf, region_len); |
| 1619 | if (ret != 0) { | 1584 | if (ret != 0) { |
| 1620 | cs_dsp_err(dsp, | 1585 | cs_dsp_err(dsp, |
| 1621 | "%s.%d: Failed to write %d bytes at %d in %s: %d\n", | 1586 | "%s.%d: Failed to write %zu bytes at %d in %s: %d\n", |
| 1622 | file, regions, | 1587 | file, regions, region_len, offset, region_name, ret); |
| 1623 | le32_to_cpu(region->len), offset, | ||
| 1624 | region_name, ret); | ||
| 1625 | goto out_fw; | 1588 | goto out_fw; |
| 1626 | } | 1589 | } |
| 1627 | } | 1590 | } |
| @@ -1638,8 +1601,6 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware, · 10 unmodified lines | |||
| 1638 | 1601 | ||
| 1639 | ret = 0; | 1602 | ret = 0; |
| 1640 | out_fw: | 1603 | out_fw: |
| 1641 | cs_dsp_buf_free(&buf_list); | ||
| 1642 | |||
| 1643 | if (ret == -EOVERFLOW) | 1604 | if (ret == -EOVERFLOW) |
| 1644 | cs_dsp_err(dsp, "%s: file content overflows file data\n", file); | 1605 | cs_dsp_err(dsp, "%s: file content overflows file data\n", file); |
| 1645 | 1606 | ||
| @@ -2171,7 +2132,9 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 525 unmodified lines | |||
| 2171 | struct cs_dsp_alg_region *alg_region; | 2132 | struct cs_dsp_alg_region *alg_region; |
| 2172 | const char *region_name; | 2133 | const char *region_name; |
| 2173 | int ret, pos, blocks, type, offset, reg, version; | 2134 | int ret, pos, blocks, type, offset, reg, version; |
| 2174 | struct cs_dsp_buf *buf; | 2135 | u8 *buf __free(kfree) = NULL; |
| 2136 | size_t buf_len = 0; | ||
| 2137 | size_t region_len; | ||
| 2175 | 2138 | ||
| 2176 | if (!firmware) | 2139 | if (!firmware) |
| 2177 | return 0; | 2140 | return 0; |
| @@ -2313,20 +2276,22 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 135 unmodified lines | |||
| 2313 | } | 2276 | } |
| 2314 | 2277 | ||
| 2315 | if (reg) { | 2278 | if (reg) { |
| 2316 | buf = cs_dsp_buf_alloc(blk->data, | 2279 | region_len = le32_to_cpu(blk->len); |
| 2317 | le32_to_cpu(blk->len), | 2280 | if (region_len > buf_len) { |
| 2318 | &buf_list); | 2281 | buf_len = round_up(region_len, PAGE_SIZE); |
| 2319 | if (!buf) { | 2282 | kfree(buf); |
| 2320 | cs_dsp_err(dsp, "Out of memory\n"); | 2283 | buf = kmalloc(buf_len, GFP_KERNEL | GFP_DMA); |
| 2321 | ret = -ENOMEM; | 2284 | if (!buf) { |
| 2322 | goto out_fw; | 2285 | ret = -ENOMEM; |
| 2286 | goto out_fw; | ||
| 2287 | } | ||
| 2323 | } | 2288 | } |
| 2324 | 2289 | ||
| 2325 | cs_dsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", | 2290 | memcpy(buf, blk->data, region_len); |
| 2326 | file, blocks, le32_to_cpu(blk->len), | 2291 | |
| 2327 | reg); | 2292 | cs_dsp_dbg(dsp, "%s.%d: Writing %zu bytes at %x\n", |
| 2328 | ret = regmap_raw_write(regmap, reg, buf->buf, | 2293 | file, blocks, region_len, reg); |
| 2329 | le32_to_cpu(blk->len)); | 2294 | ret = regmap_raw_write(regmap, reg, buf, region_len); |
| 2330 | if (ret != 0) { | 2295 | if (ret != 0) { |
| 2331 | cs_dsp_err(dsp, | 2296 | cs_dsp_err(dsp, |
| 2332 | "%s.%d: Failed to write to %x in %s: %d\n", | 2297 | "%s.%d: Failed to write to %x in %s: %d\n", |
| @@ -2346,8 +2311,6 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware · 13 unmodified lines | |||
| 2346 | 2311 | ||
| 2347 | ret = 0; | 2312 | ret = 0; |
| 2348 | out_fw: | 2313 | out_fw: |
| 2349 | cs_dsp_buf_free(&buf_list); | ||
| 2350 | |||
| 2351 | if (ret == -EOVERFLOW) | 2314 | if (ret == -EOVERFLOW) |
| 2352 | cs_dsp_err(dsp, "%s: file content overflows file data\n", file); | 2315 | cs_dsp_err(dsp, "%s: file content overflows file data\n", file); |
| 2353 | 2316 | ||
| @@ -2366,6 +2329,9 @@ static int cs_dsp_create_name(struct cs_dsp *dsp) · 12 unmodified lines | |||
| 2366 | return 0; | 2329 | return 0; |
| 2367 | } | 2330 | } |
| 2368 | 2331 | ||
| 2332 | static const struct cs_dsp_client_ops cs_dsp_default_client_ops = { | ||
| 2333 | }; | ||
| 2334 | |||
| 2369 | static int cs_dsp_common_init(struct cs_dsp *dsp) | 2335 | static int cs_dsp_common_init(struct cs_dsp *dsp) |
| 2370 | { | 2336 | { |
| 2371 | int ret; | 2337 | int ret; |
| @@ -2379,6 +2345,9 @@ static int cs_dsp_common_init(struct cs_dsp *dsp) · 7 unmodified lines | |||
| 2379 | 2345 | ||
| 2380 | mutex_init(&dsp->pwr_lock); | 2346 | mutex_init(&dsp->pwr_lock); |
| 2381 | 2347 | ||
| 2348 | if (!dsp->client_ops) | ||
| 2349 | dsp->client_ops = &cs_dsp_default_client_ops; | ||
| 2350 | |||
| 2382 | #ifdef CONFIG_DEBUG_FS | 2351 | #ifdef CONFIG_DEBUG_FS |
| 2383 | /* Ensure this is invalid if client never provides a debugfs root */ | 2352 | /* Ensure this is invalid if client never provides a debugfs root */ |
| 2384 | dsp->debugfs_root = ERR_PTR(-ENODEV); | 2353 | dsp->debugfs_root = ERR_PTR(-ENODEV); |
| @@ -600,6 +600,7 @@ KUNIT_ARRAY_PARAM(cs_dsp_callbacks_ops, · 599 unmodified lines | |||
| 600 | 600 | ||
| 601 | static const struct cs_dsp_callbacks_test_param cs_dsp_no_callbacks_cases[] = { | 601 | static const struct cs_dsp_callbacks_test_param cs_dsp_no_callbacks_cases[] = { |
| 602 | { .ops = &cs_dsp_callback_test_empty_client_ops, .case_name = "empty ops" }, | 602 | { .ops = &cs_dsp_callback_test_empty_client_ops, .case_name = "empty ops" }, |
| 603 | { .ops = NULL, .case_name = "NULL ops" }, | ||
| 603 | }; | 604 | }; |
| 604 | 605 | ||
| 605 | KUNIT_ARRAY_PARAM(cs_dsp_no_callbacks, | 606 | KUNIT_ARRAY_PARAM(cs_dsp_no_callbacks, |
| @@ -6,6 +6,9 @@ · 5 unmodified lines | |||
| 6 | config GPIOLIB_LEGACY | 6 | config GPIOLIB_LEGACY |
| 7 | def_bool y | 7 | def_bool y |
| 8 | 8 | ||
| 9 | config HAVE_SHARED_GPIOS | ||
| 10 | bool | ||
| 11 | |||
| 9 | menuconfig GPIOLIB | 12 | menuconfig GPIOLIB |
| 10 | bool "GPIO Support" | 13 | bool "GPIO Support" |
| 11 | help | 14 | help |
| @@ -50,6 +53,11 @@ config OF_GPIO_MM_GPIOCHIP · 38 unmodified lines | |||
| 50 | this symbol, but new drivers should use the generic gpio-regmap | 53 | this symbol, but new drivers should use the generic gpio-regmap |
| 51 | infrastructure instead. | 54 | infrastructure instead. |
| 52 | 55 | ||
| 56 | config GPIO_SHARED | ||
| 57 | def_bool y | ||
| 58 | depends on HAVE_SHARED_GPIOS || COMPILE_TEST | ||
| 59 | select AUXILIARY_BUS | ||
| 60 | |||
| 53 | config DEBUG_GPIO | 61 | config DEBUG_GPIO |
| 54 | bool "Debug GPIO calls" | 62 | bool "Debug GPIO calls" |
| 55 | depends on DEBUG_KERNEL | 63 | depends on DEBUG_KERNEL |
| @@ -2017,6 +2025,15 @@ config GPIO_SIM · 1961 unmodified lines | |||
| 2017 | This enables the GPIO simulator - a configfs-based GPIO testing | 2025 | This enables the GPIO simulator - a configfs-based GPIO testing |
| 2018 | driver. | 2026 | driver. |
| 2019 | 2027 | ||
| 2028 | config GPIO_SHARED_PROXY | ||
| 2029 | tristate "Proxy driver for non-exclusive GPIOs" | ||
| 2030 | default m | ||
| 2031 | depends on GPIO_SHARED || COMPILE_TEST | ||
| 2032 | select AUXILIARY_BUS | ||
| 2033 | help | ||
| 2034 | This enables the GPIO shared proxy driver - an abstraction layer | ||
| 2035 | for GPIO pins that are shared by multiple devices. | ||
| 2036 | |||
| 2020 | endmenu | 2037 | endmenu |
| 2021 | 2038 | ||
| 2022 | menu "GPIO Debugging utilities" | 2039 | menu "GPIO Debugging utilities" |
| @@ -12,6 +12,7 @@ obj-$(CONFIG_GPIO_SYSFS) += gpiolib-sysfs.o · 11 unmodified lines | |||
| 12 | obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o | 12 | obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o |
| 13 | gpiolib-acpi-y := gpiolib-acpi-core.o gpiolib-acpi-quirks.o | 13 | gpiolib-acpi-y := gpiolib-acpi-core.o gpiolib-acpi-quirks.o |
| 14 | obj-$(CONFIG_GPIOLIB) += gpiolib-swnode.o | 14 | obj-$(CONFIG_GPIOLIB) += gpiolib-swnode.o |
| 15 | obj-$(CONFIG_GPIO_SHARED) += gpiolib-shared.o | ||
| 15 | 16 | ||
| 16 | # Device drivers. Generally keep list sorted alphabetically | 17 | # Device drivers. Generally keep list sorted alphabetically |
| 17 | obj-$(CONFIG_GPIO_REGMAP) += gpio-regmap.o | 18 | obj-$(CONFIG_GPIO_REGMAP) += gpio-regmap.o |
| @@ -159,6 +160,7 @@ obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o · 141 unmodified lines | |||
| 159 | obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o | 160 | obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o |
| 160 | obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o | 161 | obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o |
| 161 | obj-$(CONFIG_GPIO_SCH) += gpio-sch.o | 162 | obj-$(CONFIG_GPIO_SCH) += gpio-sch.o |
| 163 | obj-$(CONFIG_GPIO_SHARED_PROXY) += gpio-shared-proxy.o | ||
| 162 | obj-$(CONFIG_GPIO_SIFIVE) += gpio-sifive.o | 164 | obj-$(CONFIG_GPIO_SIFIVE) += gpio-sifive.o |
| 163 | obj-$(CONFIG_GPIO_SIM) += gpio-sim.o | 165 | obj-$(CONFIG_GPIO_SIM) += gpio-sim.o |
| 164 | obj-$(CONFIG_GPIO_SIOX) += gpio-siox.o | 166 | obj-$(CONFIG_GPIO_SIOX) += gpio-siox.o |
| @@ -0,0 +1,333 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2025 Linaro Ltd. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <linux/auxiliary_bus.h> | ||
| 7 | #include <linux/cleanup.h> | ||
| 8 | #include <linux/device.h> | ||
| 9 | #include <linux/err.h> | ||
| 10 | #include <linux/gpio/consumer.h> | ||
| 11 | #include <linux/gpio/driver.h> | ||
| 12 | #include <linux/mod_devicetable.h> | ||
| 13 | #include <linux/module.h> | ||
| 14 | #include <linux/string_choices.h> | ||
| 15 | #include <linux/types.h> | ||
| 16 | |||
| 17 | #include "gpiolib-shared.h" | ||
| 18 | |||
| 19 | struct gpio_shared_proxy_data { | ||
| 20 | struct gpio_chip gc; | ||
| 21 | struct gpio_shared_desc *shared_desc; | ||
| 22 | struct device *dev; | ||
| 23 | bool voted_high; | ||
| 24 | }; | ||
| 25 | |||
| 26 | static int | ||
| 27 | gpio_shared_proxy_set_unlocked(struct gpio_shared_proxy_data *proxy, | ||
| 28 | int (*set_func)(struct gpio_desc *desc, int value), | ||
| 29 | int value) | ||
| 30 | { | ||
| 31 | struct gpio_shared_desc *shared_desc = proxy->shared_desc; | ||
| 32 | struct gpio_desc *desc = shared_desc->desc; | ||
| 33 | int ret = 0; | ||
| 34 | |||
| 35 | gpio_shared_lockdep_assert(shared_desc); | ||
| 36 | |||
| 37 | if (value) { | ||
| 38 | /* User wants to set value to high. */ | ||
| 39 | if (proxy->voted_high) | ||
| 40 | /* Already voted for high, nothing to do. */ | ||
| 41 | goto out; | ||
| 42 | |||
| 43 | /* Haven't voted for high yet. */ | ||
| 44 | if (!shared_desc->highcnt) { | ||
| 45 | /* | ||
| 46 | * Current value is low, need to actually set value | ||
| 47 | * to high. | ||
| 48 | */ | ||
| 49 | ret = set_func(desc, 1); | ||
| 50 | if (ret) | ||
| 51 | goto out; | ||
| 52 | } | ||
| 53 | |||
| 54 | shared_desc->highcnt++; | ||
| 55 | proxy->voted_high = true; | ||
| 56 | |||
| 57 | goto out; | ||
| 58 | } | ||
| 59 | |||
| 60 | /* Desired value is low. */ | ||
| 61 | if (!proxy->voted_high) | ||
| 62 | /* We didn't vote for high, nothing to do. */ | ||
| 63 | goto out; | ||
| 64 | |||
| 65 | /* We previously voted for high. */ | ||
| 66 | if (shared_desc->highcnt == 1) { | ||
| 67 | /* This is the last remaining vote for high, set value to low. */ | ||
| 68 | ret = set_func(desc, 0); | ||
| 69 | if (ret) | ||
| 70 | goto out; | ||
| 71 | } | ||
| 72 | |||
| 73 | shared_desc->highcnt--; | ||
| 74 | proxy->voted_high = false; | ||
| 75 | |||
| 76 | out: | ||
| 77 | if (shared_desc->highcnt) | ||
| 78 | dev_dbg(proxy->dev, | ||
| 79 | "Voted for value '%s', effective value is 'high', number of votes for 'high': %u\n", | ||
| 80 | str_high_low(value), shared_desc->highcnt); | ||
| 81 | else | ||
| 82 | dev_dbg(proxy->dev, "Voted for value 'low', effective value is 'low'\n"); | ||
| 83 | |||
| 84 | return ret; | ||
| 85 | } | ||
| 86 | |||
| 87 | static int gpio_shared_proxy_request(struct gpio_chip *gc, unsigned int offset) | ||
| 88 | { | ||
| 89 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 90 | struct gpio_shared_desc *shared_desc = proxy->shared_desc; | ||
| 91 | |||
| 92 | guard(gpio_shared_desc_lock)(shared_desc); | ||
| 93 | |||
| 94 | proxy->shared_desc->usecnt++; | ||
| 95 | |||
| 96 | dev_dbg(proxy->dev, "Shared GPIO requested, number of users: %u\n", | ||
| 97 | proxy->shared_desc->usecnt); | ||
| 98 | |||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | |||
| 102 | static void gpio_shared_proxy_free(struct gpio_chip *gc, unsigned int offset) | ||
| 103 | { | ||
| 104 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 105 | struct gpio_shared_desc *shared_desc = proxy->shared_desc; | ||
| 106 | |||
| 107 | guard(gpio_shared_desc_lock)(shared_desc); | ||
| 108 | |||
| 109 | proxy->shared_desc->usecnt--; | ||
| 110 | |||
| 111 | dev_dbg(proxy->dev, "Shared GPIO freed, number of users: %u\n", | ||
| 112 | proxy->shared_desc->usecnt); | ||
| 113 | } | ||
| 114 | |||
| 115 | static int gpio_shared_proxy_set_config(struct gpio_chip *gc, | ||
| 116 | unsigned int offset, unsigned long cfg) | ||
| 117 | { | ||
| 118 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 119 | struct gpio_shared_desc *shared_desc = proxy->shared_desc; | ||
| 120 | struct gpio_desc *desc = shared_desc->desc; | ||
| 121 | int ret; | ||
| 122 | |||
| 123 | guard(gpio_shared_desc_lock)(shared_desc); | ||
| 124 | |||
| 125 | if (shared_desc->usecnt > 1) { | ||
| 126 | if (shared_desc->cfg != cfg) { | ||
| 127 | dev_dbg(proxy->dev, | ||
| 128 | "Shared GPIO's configuration already set, accepting changes but users may conflict!!\n"); | ||
| 129 | } else { | ||
| 130 | dev_dbg(proxy->dev, "Equal config requested, nothing to do\n"); | ||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | ret = gpiod_set_config(desc, cfg); | ||
| 136 | if (ret && ret != -ENOTSUPP) | ||
| 137 | return ret; | ||
| 138 | |||
| 139 | shared_desc->cfg = cfg; | ||
| 140 | return 0; | ||
| 141 | } | ||
| 142 | |||
| 143 | static int gpio_shared_proxy_direction_input(struct gpio_chip *gc, | ||
| 144 | unsigned int offset) | ||
| 145 | { | ||
| 146 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 147 | struct gpio_shared_desc *shared_desc = proxy->shared_desc; | ||
| 148 | struct gpio_desc *desc = shared_desc->desc; | ||
| 149 | int dir; | ||
| 150 | |||
| 151 | guard(gpio_shared_desc_lock)(shared_desc); | ||
| 152 | |||
| 153 | if (shared_desc->usecnt == 1) { | ||
| 154 | dev_dbg(proxy->dev, | ||
| 155 | "Only one user of this shared GPIO, allowing to set direction to input\n"); | ||
| 156 | |||
| 157 | return gpiod_direction_input(desc); | ||
| 158 | } | ||
| 159 | |||
| 160 | dir = gpiod_get_direction(desc); | ||
| 161 | if (dir < 0) | ||
| 162 | return dir; | ||
| 163 | |||
| 164 | if (dir == GPIO_LINE_DIRECTION_OUT) { | ||
| 165 | dev_dbg(proxy->dev, | ||
| 166 | "Shared GPIO's direction already set to output, refusing to change\n"); | ||
| 167 | return -EPERM; | ||
| 168 | } | ||
| 169 | |||
| 170 | return 0; | ||
| 171 | } | ||
| 172 | |||
| 173 | static int gpio_shared_proxy_direction_output(struct gpio_chip *gc, | ||
| 174 | unsigned int offset, int value) | ||
| 175 | { | ||
| 176 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 177 | struct gpio_shared_desc *shared_desc = proxy->shared_desc; | ||
| 178 | struct gpio_desc *desc = shared_desc->desc; | ||
| 179 | int ret, dir; | ||
| 180 | |||
| 181 | guard(gpio_shared_desc_lock)(shared_desc); | ||
| 182 | |||
| 183 | if (shared_desc->usecnt == 1) { | ||
| 184 | dev_dbg(proxy->dev, | ||
| 185 | "Only one user of this shared GPIO, allowing to set direction to output with value '%s'\n", | ||
| 186 | str_high_low(value)); | ||
| 187 | |||
| 188 | ret = gpiod_direction_output(desc, value); | ||
| 189 | if (ret) | ||
| 190 | return ret; | ||
| 191 | |||
| 192 | if (value) { | ||
| 193 | proxy->voted_high = true; | ||
| 194 | shared_desc->highcnt = 1; | ||
| 195 | } else { | ||
| 196 | proxy->voted_high = false; | ||
| 197 | shared_desc->highcnt = 0; | ||
| 198 | } | ||
| 199 | |||
| 200 | return 0; | ||
| 201 | } | ||
| 202 | |||
| 203 | dir = gpiod_get_direction(desc); | ||
| 204 | if (dir < 0) | ||
| 205 | return dir; | ||
| 206 | |||
| 207 | if (dir == GPIO_LINE_DIRECTION_IN) { | ||
| 208 | dev_dbg(proxy->dev, | ||
| 209 | "Shared GPIO's direction already set to input, refusing to change\n"); | ||
| 210 | return -EPERM; | ||
| 211 | } | ||
| 212 | |||
| 213 | return gpio_shared_proxy_set_unlocked(proxy, gpiod_direction_output, value); | ||
| 214 | } | ||
| 215 | |||
| 216 | static int gpio_shared_proxy_get(struct gpio_chip *gc, unsigned int offset) | ||
| 217 | { | ||
| 218 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 219 | |||
| 220 | return gpiod_get_value(proxy->shared_desc->desc); | ||
| 221 | } | ||
| 222 | |||
| 223 | static int gpio_shared_proxy_get_cansleep(struct gpio_chip *gc, | ||
| 224 | unsigned int offset) | ||
| 225 | { | ||
| 226 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 227 | |||
| 228 | return gpiod_get_value_cansleep(proxy->shared_desc->desc); | ||
| 229 | } | ||
| 230 | |||
| 231 | static int gpio_shared_proxy_do_set(struct gpio_shared_proxy_data *proxy, | ||
| 232 | int (*set_func)(struct gpio_desc *desc, int value), | ||
| 233 | int value) | ||
| 234 | { | ||
| 235 | guard(gpio_shared_desc_lock)(proxy->shared_desc); | ||
| 236 | |||
| 237 | return gpio_shared_proxy_set_unlocked(proxy, set_func, value); | ||
| 238 | } | ||
| 239 | |||
| 240 | static int gpio_shared_proxy_set(struct gpio_chip *gc, unsigned int offset, | ||
| 241 | int value) | ||
| 242 | { | ||
| 243 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 244 | |||
| 245 | return gpio_shared_proxy_do_set(proxy, gpiod_set_value, value); | ||
| 246 | } | ||
| 247 | |||
| 248 | static int gpio_shared_proxy_set_cansleep(struct gpio_chip *gc, | ||
| 249 | unsigned int offset, int value) | ||
| 250 | { | ||
| 251 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 252 | |||
| 253 | return gpio_shared_proxy_do_set(proxy, gpiod_set_value_cansleep, value); | ||
| 254 | } | ||
| 255 | |||
| 256 | static int gpio_shared_proxy_get_direction(struct gpio_chip *gc, | ||
| 257 | unsigned int offset) | ||
| 258 | { | ||
| 259 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 260 | |||
| 261 | return gpiod_get_direction(proxy->shared_desc->desc); | ||
| 262 | } | ||
| 263 | |||
| 264 | static int gpio_shared_proxy_to_irq(struct gpio_chip *gc, unsigned int offset) | ||
| 265 | { | ||
| 266 | struct gpio_shared_proxy_data *proxy = gpiochip_get_data(gc); | ||
| 267 | |||
| 268 | return gpiod_to_irq(proxy->shared_desc->desc); | ||
| 269 | } | ||
| 270 | |||
| 271 | static int gpio_shared_proxy_probe(struct auxiliary_device *adev, | ||
| 272 | const struct auxiliary_device_id *id) | ||
| 273 | { | ||
| 274 | struct gpio_shared_proxy_data *proxy; | ||
| 275 | struct gpio_shared_desc *shared_desc; | ||
| 276 | struct device *dev = &adev->dev; | ||
| 277 | struct gpio_chip *gc; | ||
| 278 | |||
| 279 | shared_desc = devm_gpiod_shared_get(dev); | ||
| 280 | if (IS_ERR(shared_desc)) | ||
| 281 | return PTR_ERR(shared_desc); | ||
| 282 | |||
| 283 | proxy = devm_kzalloc(dev, sizeof(*proxy), GFP_KERNEL); | ||
| 284 | if (!proxy) | ||
| 285 | return -ENOMEM; | ||
| 286 | |||
| 287 | proxy->shared_desc = shared_desc; | ||
| 288 | proxy->dev = dev; | ||
| 289 | |||
| 290 | gc = &proxy->gc; | ||
| 291 | gc->base = -1; | ||
| 292 | gc->ngpio = 1; | ||
| 293 | gc->label = dev_name(dev); | ||
| 294 | gc->parent = dev; | ||
| 295 | gc->owner = THIS_MODULE; | ||
| 296 | gc->can_sleep = shared_desc->can_sleep; | ||
| 297 | |||
| 298 | gc->request = gpio_shared_proxy_request; | ||
| 299 | gc->free = gpio_shared_proxy_free; | ||
| 300 | gc->set_config = gpio_shared_proxy_set_config; | ||
| 301 | gc->direction_input = gpio_shared_proxy_direction_input; | ||
| 302 | gc->direction_output = gpio_shared_proxy_direction_output; | ||
| 303 | if (gc->can_sleep) { | ||
| 304 | gc->set = gpio_shared_proxy_set_cansleep; | ||
| 305 | gc->get = gpio_shared_proxy_get_cansleep; | ||
| 306 | } else { | ||
| 307 | gc->set = gpio_shared_proxy_set; | ||
| 308 | gc->get = gpio_shared_proxy_get; | ||
| 309 | } | ||
| 310 | gc->get_direction = gpio_shared_proxy_get_direction; | ||
| 311 | gc->to_irq = gpio_shared_proxy_to_irq; | ||
| 312 | |||
| 313 | return devm_gpiochip_add_data(dev, &proxy->gc, proxy); | ||
| 314 | } | ||
| 315 | |||
| 316 | static const struct auxiliary_device_id gpio_shared_proxy_id_table[] = { | ||
| 317 | { .name = "gpiolib_shared.proxy" }, | ||
| 318 | {}, | ||
| 319 | }; | ||
| 320 | MODULE_DEVICE_TABLE(auxiliary, gpio_shared_proxy_id_table); | ||
| 321 | |||
| 322 | static struct auxiliary_driver gpio_shared_proxy_driver = { | ||
| 323 | .driver = { | ||
| 324 | .name = "gpio-shared-proxy", | ||
| 325 | }, | ||
| 326 | .probe = gpio_shared_proxy_probe, | ||
| 327 | .id_table = gpio_shared_proxy_id_table, | ||
| 328 | }; | ||
| 329 | module_auxiliary_driver(gpio_shared_proxy_driver); | ||
| 330 | |||
| 331 | MODULE_AUTHOR("Bartosz Golaszewski <bartosz.golaszewski@linaro.org>"); | ||
| 332 | MODULE_DESCRIPTION("Shared GPIO mux driver."); | ||
| 333 | MODULE_LICENSE("GPL"); | ||
| @@ -0,0 +1,558 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2025 Linaro Ltd. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 7 | |||
| 8 | #include <linux/auxiliary_bus.h> | ||
| 9 | #include <linux/cleanup.h> | ||
| 10 | #include <linux/device.h> | ||
| 11 | #include <linux/fwnode.h> | ||
| 12 | #include <linux/gpio/consumer.h> | ||
| 13 | #include <linux/gpio/machine.h> | ||
| 14 | #include <linux/idr.h> | ||
| 15 | #include <linux/kref.h> | ||
| 16 | #include <linux/list.h> | ||
| 17 | #include <linux/lockdep.h> | ||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/mutex.h> | ||
| 20 | #include <linux/of.h> | ||
| 21 | #include <linux/overflow.h> | ||
| 22 | #include <linux/printk.h> | ||
| 23 | #include <linux/property.h> | ||
| 24 | #include <linux/slab.h> | ||
| 25 | #include <linux/string.h> | ||
| 26 | |||
| 27 | #include "gpiolib.h" | ||
| 28 | #include "gpiolib-shared.h" | ||
| 29 | |||
| 30 | /* Represents a single reference to a GPIO pin. */ | ||
| 31 | struct gpio_shared_ref { | ||
| 32 | struct list_head list; | ||
| 33 | /* Firmware node associated with this GPIO's consumer. */ | ||
| 34 | struct fwnode_handle *fwnode; | ||
| 35 | /* GPIO flags this consumer uses for the request. */ | ||
| 36 | enum gpiod_flags flags; | ||
| 37 | char *con_id; | ||
| 38 | int dev_id; | ||
| 39 | struct auxiliary_device adev; | ||
| 40 | struct gpiod_lookup_table *lookup; | ||
| 41 | }; | ||
| 42 | |||
| 43 | /* Represents a single GPIO pin. */ | ||
| 44 | struct gpio_shared_entry { | ||
| 45 | struct list_head list; | ||
| 46 | /* Firmware node associated with the GPIO controller. */ | ||
| 47 | struct fwnode_handle *fwnode; | ||
| 48 | /* Hardware offset of the GPIO within its chip. */ | ||
| 49 | unsigned int offset; | ||
| 50 | /* Index in the property value array. */ | ||
| 51 | size_t index; | ||
| 52 | struct gpio_shared_desc *shared_desc; | ||
| 53 | struct kref ref; | ||
| 54 | struct list_head refs; | ||
| 55 | }; | ||
| 56 | |||
| 57 | static LIST_HEAD(gpio_shared_list); | ||
| 58 | static DEFINE_MUTEX(gpio_shared_lock); | ||
| 59 | static DEFINE_IDA(gpio_shared_ida); | ||
| 60 | |||
| 61 | static struct gpio_shared_entry * | ||
| 62 | gpio_shared_find_entry(struct fwnode_handle *controller_node, | ||
| 63 | unsigned int offset) | ||
| 64 | { | ||
| 65 | struct gpio_shared_entry *entry; | ||
| 66 | |||
| 67 | list_for_each_entry(entry, &gpio_shared_list, list) { | ||
| 68 | if (entry->fwnode == controller_node && entry->offset == offset) | ||
| 69 | return entry; | ||
| 70 | } | ||
| 71 | |||
| 72 | return NULL; | ||
| 73 | } | ||
| 74 | |||
| 75 | #if IS_ENABLED(CONFIG_OF) | ||
| 76 | static int gpio_shared_of_traverse(struct device_node *curr) | ||
| 77 | { | ||
| 78 | struct gpio_shared_entry *entry; | ||
| 79 | size_t con_id_len, suffix_len; | ||
| 80 | struct fwnode_handle *fwnode; | ||
| 81 | struct of_phandle_args args; | ||
| 82 | struct property *prop; | ||
| 83 | unsigned int offset; | ||
| 84 | const char *suffix; | ||
| 85 | int ret, count, i; | ||
| 86 | |||
| 87 | for_each_property_of_node(curr, prop) { | ||
| 88 | /* | ||
| 89 | * The standard name for a GPIO property is "foo-gpios" | ||
| 90 | * or "foo-gpio". Some bindings also use "gpios" or "gpio". | ||
| 91 | * There are some legacy device-trees which have a different | ||
| 92 | * naming convention and for which we have rename quirks in | ||
| 93 | * place in gpiolib-of.c. I don't think any of them require | ||
| 94 | * support for shared GPIOs so for now let's just ignore | ||
| 95 | * them. We can always just export the quirk list and | ||
| 96 | * iterate over it here. | ||
| 97 | */ | ||
| 98 | if (!strends(prop->name, "-gpios") && | ||
| 99 | !strends(prop->name, "-gpio") && | ||
| 100 | strcmp(prop->name, "gpios") != 0 && | ||
| 101 | strcmp(prop->name, "gpio") != 0) | ||
| 102 | continue; | ||
| 103 | |||
| 104 | count = of_count_phandle_with_args(curr, prop->name, | ||
| 105 | "#gpio-cells"); | ||
| 106 | if (count <= 0) | ||
| 107 | continue; | ||
| 108 | |||
| 109 | for (i = 0; i < count; i++) { | ||
| 110 | struct device_node *np __free(device_node) = NULL; | ||
| 111 | |||
| 112 | ret = of_parse_phandle_with_args(curr, prop->name, | ||
| 113 | "#gpio-cells", i, | ||
| 114 | &args); | ||
| 115 | if (ret) | ||
| 116 | continue; | ||
| 117 | |||
| 118 | np = args.np; | ||
| 119 | |||
| 120 | if (!of_property_present(np, "gpio-controller")) | ||
| 121 | continue; | ||
| 122 | |||
| 123 | /* | ||
| 124 | * We support 1, 2 and 3 cell GPIO bindings in the | ||
| 125 | * kernel currently. There's only one old MIPS dts that | ||
| 126 | * has a one-cell binding but there's no associated | ||
| 127 | * consumer so it may as well be an error. There don't | ||
| 128 | * seem to be any 3-cell users of non-exclusive GPIOs, | ||
| 129 | * so we can skip this as well. Let's occupy ourselves | ||
| 130 | * with the predominant 2-cell binding with the first | ||
| 131 | * cell indicating the hardware offset of the GPIO and | ||
| 132 | * the second defining the GPIO flags of the request. | ||
| 133 | */ | ||
| 134 | if (args.args_count != 2) | ||
| 135 | continue; | ||
| 136 | |||
| 137 | fwnode = of_fwnode_handle(args.np); | ||
| 138 | offset = args.args[0]; | ||
| 139 | |||
| 140 | entry = gpio_shared_find_entry(fwnode, offset); | ||
| 141 | if (!entry) { | ||
| 142 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
| 143 | if (!entry) | ||
| 144 | return -ENOMEM; | ||
| 145 | |||
| 146 | entry->fwnode = fwnode_handle_get(fwnode); | ||
| 147 | entry->offset = offset; | ||
| 148 | entry->index = count; | ||
| 149 | INIT_LIST_HEAD(&entry->refs); | ||
| 150 | |||
| 151 | list_add_tail(&entry->list, &gpio_shared_list); | ||
| 152 | } | ||
| 153 | |||
| 154 | struct gpio_shared_ref *ref __free(kfree) = | ||
| 155 | kzalloc(sizeof(*ref), GFP_KERNEL); | ||
| 156 | if (!ref) | ||
| 157 | return -ENOMEM; | ||
| 158 | |||
| 159 | ref->fwnode = fwnode_handle_get(of_fwnode_handle(curr)); | ||
| 160 | ref->flags = args.args[1]; | ||
| 161 | |||
| 162 | if (strends(prop->name, "gpios")) | ||
| 163 | suffix = "-gpios"; | ||
| 164 | else if (strends(prop->name, "gpio")) | ||
| 165 | suffix = "-gpio"; | ||
| 166 | else | ||
| 167 | suffix = NULL; | ||
| 168 | if (!suffix) | ||
| 169 | continue; | ||
| 170 | |||
| 171 | /* We only set con_id if there's actually one. */ | ||
| 172 | if (strcmp(prop->name, "gpios") && strcmp(prop->name, "gpio")) { | ||
| 173 | ref->con_id = kstrdup(prop->name, GFP_KERNEL); | ||
| 174 | if (!ref->con_id) | ||
| 175 | return -ENOMEM; | ||
| 176 | |||
| 177 | con_id_len = strlen(ref->con_id); | ||
| 178 | suffix_len = strlen(suffix); | ||
| 179 | |||
| 180 | ref->con_id[con_id_len - suffix_len] = '\0'; | ||
| 181 | } | ||
| 182 | |||
| 183 | ref->dev_id = ida_alloc(&gpio_shared_ida, GFP_KERNEL); | ||
| 184 | if (ref->dev_id < 0) { | ||
| 185 | kfree(ref->con_id); | ||
| 186 | return -ENOMEM; | ||
| 187 | } | ||
| 188 | |||
| 189 | if (!list_empty(&entry->refs)) | ||
| 190 | pr_debug("GPIO %u at %s is shared by multiple firmware nodes\n", | ||
| 191 | entry->offset, fwnode_get_name(entry->fwnode)); | ||
| 192 | |||
| 193 | list_add_tail(&no_free_ptr(ref)->list, &entry->refs); | ||
| 194 | } | ||
| 195 | } | ||
| 196 | |||
| 197 | for_each_child_of_node_scoped(curr, child) { | ||
| 198 | ret = gpio_shared_of_traverse(child); | ||
| 199 | if (ret) | ||
| 200 | return ret; | ||
| 201 | } | ||
| 202 | |||
| 203 | return 0; | ||
| 204 | } | ||
| 205 | |||
| 206 | static int gpio_shared_of_scan(void) | ||
| 207 | { | ||
| 208 | return gpio_shared_of_traverse(of_root); | ||
| 209 | } | ||
| 210 | #else | ||
| 211 | static int gpio_shared_of_scan(void) | ||
| 212 | { | ||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | #endif /* CONFIG_OF */ | ||
| 216 | |||
| 217 | static void gpio_shared_adev_release(struct device *dev) | ||
| 218 | { | ||
| 219 | |||
| 220 | } | ||
| 221 | |||
| 222 | static int gpio_shared_make_adev(struct gpio_device *gdev, | ||
| 223 | struct gpio_shared_ref *ref) | ||
| 224 | { | ||
| 225 | struct auxiliary_device *adev = &ref->adev; | ||
| 226 | int ret; | ||
| 227 | |||
| 228 | lockdep_assert_held(&gpio_shared_lock); | ||
| 229 | |||
| 230 | memset(adev, 0, sizeof(*adev)); | ||
| 231 | |||
| 232 | adev->id = ref->dev_id; | ||
| 233 | adev->name = "proxy"; | ||
| 234 | adev->dev.parent = gdev->dev.parent; | ||
| 235 | adev->dev.release = gpio_shared_adev_release; | ||
| 236 | |||
| 237 | ret = auxiliary_device_init(adev); | ||
| 238 | if (ret) | ||
| 239 | return ret; | ||
| 240 | |||
| 241 | ret = auxiliary_device_add(adev); | ||
| 242 | if (ret) { | ||
| 243 | auxiliary_device_uninit(adev); | ||
| 244 | return ret; | ||
| 245 | } | ||
| 246 | |||
| 247 | pr_debug("Created an auxiliary GPIO proxy %s for GPIO device %s\n", | ||
| 248 | dev_name(&adev->dev), gpio_device_get_label(gdev)); | ||
| 249 | |||
| 250 | return 0; | ||
| 251 | } | ||
| 252 | |||
| 253 | int gpio_shared_add_proxy_lookup(struct device *consumer, unsigned long lflags) | ||
| 254 | { | ||
| 255 | const char *dev_id = dev_name(consumer); | ||
| 256 | struct gpio_shared_entry *entry; | ||
| 257 | struct gpio_shared_ref *ref; | ||
| 258 | |||
| 259 | struct gpiod_lookup_table *lookup __free(kfree) = | ||
| 260 | kzalloc(struct_size(lookup, table, 2), GFP_KERNEL); | ||
| 261 | if (!lookup) | ||
| 262 | return -ENOMEM; | ||
| 263 | |||
| 264 | guard(mutex)(&gpio_shared_lock); | ||
| 265 | |||
| 266 | list_for_each_entry(entry, &gpio_shared_list, list) { | ||
| 267 | list_for_each_entry(ref, &entry->refs, list) { | ||
| 268 | if (!device_match_fwnode(consumer, ref->fwnode)) | ||
| 269 | continue; | ||
| 270 | |||
| 271 | /* We've already done that on a previous request. */ | ||
| 272 | if (ref->lookup) | ||
| 273 | return 0; | ||
| 274 | |||
| 275 | char *key __free(kfree) = | ||
| 276 | kasprintf(GFP_KERNEL, | ||
| 277 | KBUILD_MODNAME ".proxy.%u", | ||
| 278 | ref->adev.id); | ||
| 279 | if (!key) | ||
| 280 | return -ENOMEM; | ||
| 281 | |||
| 282 | pr_debug("Adding machine lookup entry for a shared GPIO for consumer %s, with key '%s' and con_id '%s'\n", | ||
| 283 | dev_id, key, ref->con_id ?: "none"); | ||
| 284 | |||
| 285 | lookup->dev_id = dev_id; | ||
| 286 | lookup->table[0] = GPIO_LOOKUP(no_free_ptr(key), 0, | ||
| 287 | ref->con_id, lflags); | ||
| 288 | |||
| 289 | gpiod_add_lookup_table(no_free_ptr(lookup)); | ||
| 290 | |||
| 291 | return 0; | ||
| 292 | } | ||
| 293 | } | ||
| 294 | |||
| 295 | /* We warn here because this can only happen if the programmer borked. */ | ||
| 296 | WARN_ON(1); | ||
| 297 | return -ENOENT; | ||
| 298 | } | ||
| 299 | |||
| 300 | static void gpio_shared_remove_adev(struct auxiliary_device *adev) | ||
| 301 | { | ||
| 302 | lockdep_assert_held(&gpio_shared_lock); | ||
| 303 | |||
| 304 | auxiliary_device_uninit(adev); | ||
| 305 | auxiliary_device_delete(adev); | ||
| 306 | } | ||
| 307 | |||
| 308 | int gpio_device_setup_shared(struct gpio_device *gdev) | ||
| 309 | { | ||
| 310 | struct gpio_shared_entry *entry; | ||
| 311 | struct gpio_shared_ref *ref; | ||
| 312 | unsigned long *flags; | ||
| 313 | int ret; | ||
| 314 | |||
| 315 | guard(mutex)(&gpio_shared_lock); | ||
| 316 | |||
| 317 | list_for_each_entry(entry, &gpio_shared_list, list) { | ||
| 318 | list_for_each_entry(ref, &entry->refs, list) { | ||
| 319 | if (gdev->dev.parent == &ref->adev.dev) { | ||
| 320 | /* | ||
| 321 | * This is a shared GPIO proxy. Mark its | ||
| 322 | * descriptor as such and return here. | ||
| 323 | */ | ||
| 324 | __set_bit(GPIOD_FLAG_SHARED_PROXY, | ||
| 325 | &gdev->descs[0].flags); | ||
| 326 | return 0; | ||
| 327 | } | ||
| 328 | } | ||
| 329 | } | ||
| 330 | |||
| 331 | /* | ||
| 332 | * This is not a shared GPIO proxy but it still may be the device | ||
| 333 | * exposing shared pins. Find them and create the proxy devices. | ||
| 334 | */ | ||
| 335 | list_for_each_entry(entry, &gpio_shared_list, list) { | ||
| 336 | if (!device_match_fwnode(&gdev->dev, entry->fwnode)) | ||
| 337 | continue; | ||
| 338 | |||
| 339 | if (list_count_nodes(&entry->refs) <= 1) | ||
| 340 | continue; | ||
| 341 | |||
| 342 | flags = &gdev->descs[entry->offset].flags; | ||
| 343 | |||
| 344 | __set_bit(GPIOD_FLAG_SHARED, flags); | ||
| 345 | /* | ||
| 346 | * Shared GPIOs are not requested via the normal path. Make | ||
| 347 | * them inaccessible to anyone even before we register the | ||
| 348 | * chip. | ||
| 349 | */ | ||
| 350 | __set_bit(GPIOD_FLAG_REQUESTED, flags); | ||
| 351 | |||
| 352 | pr_debug("GPIO %u owned by %s is shared by multiple consumers\n", | ||
| 353 | entry->offset, gpio_device_get_label(gdev)); | ||
| 354 | |||
| 355 | list_for_each_entry(ref, &entry->refs, list) { | ||
| 356 | pr_debug("Setting up a shared GPIO entry for %s\n", | ||
| 357 | fwnode_get_name(ref->fwnode)); | ||
| 358 | |||
| 359 | ret = gpio_shared_make_adev(gdev, ref); | ||
| 360 | if (ret) | ||
| 361 | return ret; | ||
| 362 | } | ||
| 363 | } | ||
| 364 | |||
| 365 | return 0; | ||
| 366 | } | ||
| 367 | |||
| 368 | void gpio_device_teardown_shared(struct gpio_device *gdev) | ||
| 369 | { | ||
| 370 | struct gpio_shared_entry *entry; | ||
| 371 | struct gpio_shared_ref *ref; | ||
| 372 | |||
| 373 | guard(mutex)(&gpio_shared_lock); | ||
| 374 | |||
| 375 | list_for_each_entry(entry, &gpio_shared_list, list) { | ||
| 376 | if (!device_match_fwnode(&gdev->dev, entry->fwnode)) | ||
| 377 | continue; | ||
| 378 | |||
| 379 | list_for_each_entry(ref, &entry->refs, list) { | ||
| 380 | gpiod_remove_lookup_table(ref->lookup); | ||
| 381 | kfree(ref->lookup->table[0].key); | ||
| 382 | kfree(ref->lookup); | ||
| 383 | ref->lookup = NULL; | ||
| 384 | gpio_shared_remove_adev(&ref->adev); | ||
| 385 | } | ||
| 386 | } | ||
| 387 | } | ||
| 388 | |||
| 389 | static void gpio_shared_release(struct kref *kref) | ||
| 390 | { | ||
| 391 | struct gpio_shared_entry *entry = | ||
| 392 | container_of(kref, struct gpio_shared_entry, ref); | ||
| 393 | struct gpio_shared_desc *shared_desc = entry->shared_desc; | ||
| 394 | |||
| 395 | guard(mutex)(&gpio_shared_lock); | ||
| 396 | |||
| 397 | gpio_device_put(shared_desc->desc->gdev); | ||
| 398 | if (shared_desc->can_sleep) | ||
| 399 | mutex_destroy(&shared_desc->mutex); | ||
| 400 | kfree(shared_desc); | ||
| 401 | entry->shared_desc = NULL; | ||
| 402 | } | ||
| 403 | |||
| 404 | static void gpiod_shared_put(void *data) | ||
| 405 | { | ||
| 406 | struct gpio_shared_entry *entry = data; | ||
| 407 | |||
| 408 | lockdep_assert_not_held(&gpio_shared_lock); | ||
| 409 | |||
| 410 | kref_put(&entry->ref, gpio_shared_release); | ||
| 411 | } | ||
| 412 | |||
| 413 | static struct gpio_shared_desc * | ||
| 414 | gpiod_shared_desc_create(struct gpio_shared_entry *entry) | ||
| 415 | { | ||
| 416 | struct gpio_shared_desc *shared_desc; | ||
| 417 | struct gpio_device *gdev; | ||
| 418 | |||
| 419 | shared_desc = kzalloc(sizeof(*shared_desc), GFP_KERNEL); | ||
| 420 | if (!shared_desc) | ||
| 421 | return ERR_PTR(-ENOMEM); | ||
| 422 | |||
| 423 | gdev = gpio_device_find_by_fwnode(entry->fwnode); | ||
| 424 | if (!gdev) { | ||
| 425 | kfree(shared_desc); | ||
| 426 | return ERR_PTR(-EPROBE_DEFER); | ||
| 427 | } | ||
| 428 | |||
| 429 | shared_desc->desc = &gdev->descs[entry->offset]; | ||
| 430 | shared_desc->can_sleep = gpiod_cansleep(shared_desc->desc); | ||
| 431 | if (shared_desc->can_sleep) | ||
| 432 | mutex_init(&shared_desc->mutex); | ||
| 433 | else | ||
| 434 | spin_lock_init(&shared_desc->spinlock); | ||
| 435 | |||
| 436 | return shared_desc; | ||
| 437 | } | ||
| 438 | |||
| 439 | static struct gpio_shared_entry *gpiod_shared_find(struct auxiliary_device *adev) | ||
| 440 | { | ||
| 441 | struct gpio_shared_desc *shared_desc; | ||
| 442 | struct gpio_shared_entry *entry; | ||
| 443 | struct gpio_shared_ref *ref; | ||
| 444 | |||
| 445 | guard(mutex)(&gpio_shared_lock); | ||
| 446 | |||
| 447 | list_for_each_entry(entry, &gpio_shared_list, list) { | ||
| 448 | list_for_each_entry(ref, &entry->refs, list) { | ||
| 449 | if (adev != &ref->adev) | ||
| 450 | continue; | ||
| 451 | |||
| 452 | if (entry->shared_desc) { | ||
| 453 | kref_get(&entry->ref); | ||
| 454 | return entry; | ||
| 455 | } | ||
| 456 | |||
| 457 | shared_desc = gpiod_shared_desc_create(entry); | ||
| 458 | if (IS_ERR(shared_desc)) | ||
| 459 | return ERR_CAST(shared_desc); | ||
| 460 | |||
| 461 | kref_init(&entry->ref); | ||
| 462 | entry->shared_desc = shared_desc; | ||
| 463 | |||
| 464 | pr_debug("Device %s acquired a reference to the shared GPIO %u owned by %s\n", | ||
| 465 | dev_name(&adev->dev), gpio_chip_hwgpio(shared_desc->desc), | ||
| 466 | gpio_device_get_label(shared_desc->desc->gdev)); | ||
| 467 | |||
| 468 | |||
| 469 | return entry; | ||
| 470 | } | ||
| 471 | } | ||
| 472 | |||
| 473 | return ERR_PTR(-ENOENT); | ||
| 474 | } | ||
| 475 | |||
| 476 | struct gpio_shared_desc *devm_gpiod_shared_get(struct device *dev) | ||
| 477 | { | ||
| 478 | struct gpio_shared_entry *entry; | ||
| 479 | int ret; | ||
| 480 | |||
| 481 | entry = gpiod_shared_find(to_auxiliary_dev(dev)); | ||
| 482 | if (IS_ERR(entry)) | ||
| 483 | return ERR_CAST(entry); | ||
| 484 | |||
| 485 | ret = devm_add_action_or_reset(dev, gpiod_shared_put, entry); | ||
| 486 | if (ret) | ||
| 487 | return ERR_PTR(ret); | ||
| 488 | |||
| 489 | return entry->shared_desc; | ||
| 490 | } | ||
| 491 | EXPORT_SYMBOL_GPL(devm_gpiod_shared_get); | ||
| 492 | |||
| 493 | static void gpio_shared_drop_ref(struct gpio_shared_ref *ref) | ||
| 494 | { | ||
| 495 | list_del(&ref->list); | ||
| 496 | kfree(ref->con_id); | ||
| 497 | ida_free(&gpio_shared_ida, ref->dev_id); | ||
| 498 | fwnode_handle_put(ref->fwnode); | ||
| 499 | kfree(ref); | ||
| 500 | } | ||
| 501 | |||
| 502 | static void gpio_shared_drop_entry(struct gpio_shared_entry *entry) | ||
| 503 | { | ||
| 504 | list_del(&entry->list); | ||
| 505 | fwnode_handle_put(entry->fwnode); | ||
| 506 | kfree(entry); | ||
| 507 | } | ||
| 508 | |||
| 509 | /* | ||
| 510 | * This is only called if gpio_shared_init() fails so it's in fact __init and | ||
| 511 | * not __exit. | ||
| 512 | */ | ||
| 513 | static void __init gpio_shared_teardown(void) | ||
| 514 | { | ||
| 515 | struct gpio_shared_entry *entry, *epos; | ||
| 516 | struct gpio_shared_ref *ref, *rpos; | ||
| 517 | |||
| 518 | list_for_each_entry_safe(entry, epos, &gpio_shared_list, list) { | ||
| 519 | list_for_each_entry_safe(ref, rpos, &entry->refs, list) | ||
| 520 | gpio_shared_drop_ref(ref); | ||
| 521 | |||
| 522 | gpio_shared_drop_entry(entry); | ||
| 523 | } | ||
| 524 | } | ||
| 525 | |||
| 526 | static void gpio_shared_free_exclusive(void) | ||
| 527 | { | ||
| 528 | struct gpio_shared_entry *entry, *epos; | ||
| 529 | |||
| 530 | list_for_each_entry_safe(entry, epos, &gpio_shared_list, list) { | ||
| 531 | if (list_count_nodes(&entry->refs) > 1) | ||
| 532 | continue; | ||
| 533 | |||
| 534 | gpio_shared_drop_ref(list_first_entry(&entry->refs, | ||
| 535 | struct gpio_shared_ref, | ||
| 536 | list)); | ||
| 537 | gpio_shared_drop_entry(entry); | ||
| 538 | } | ||
| 539 | } | ||
| 540 | |||
| 541 | static int __init gpio_shared_init(void) | ||
| 542 | { | ||
| 543 | int ret; | ||
| 544 | |||
| 545 | /* Right now, we only support OF-based systems. */ | ||
| 546 | ret = gpio_shared_of_scan(); | ||
| 547 | if (ret) { | ||
| 548 | gpio_shared_teardown(); | ||
| 549 | pr_err("Failed to scan OF nodes for shared GPIOs: %d\n", ret); | ||
| 550 | return ret; | ||
| 551 | } | ||
| 552 | |||
| 553 | gpio_shared_free_exclusive(); | ||
| 554 | |||
| 555 | pr_debug("Finished scanning firmware nodes for shared GPIOs\n"); | ||
| 556 | return 0; | ||
| 557 | } | ||
| 558 | postcore_initcall(gpio_shared_init); | ||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifndef __LINUX_GPIO_SHARED_H | ||
| 4 | #define __LINUX_GPIO_SHARED_H | ||
| 5 | |||
| 6 | #include <linux/cleanup.h> | ||
| 7 | #include <linux/lockdep.h> | ||
| 8 | #include <linux/mutex.h> | ||
| 9 | #include <linux/spinlock.h> | ||
| 10 | |||
| 11 | struct gpio_device; | ||
| 12 | struct gpio_desc; | ||
| 13 | struct device; | ||
| 14 | |||
| 15 | #if IS_ENABLED(CONFIG_GPIO_SHARED) | ||
| 16 | |||
| 17 | int gpio_device_setup_shared(struct gpio_device *gdev); | ||
| 18 | void gpio_device_teardown_shared(struct gpio_device *gdev); | ||
| 19 | int gpio_shared_add_proxy_lookup(struct device *consumer, unsigned long lflags); | ||
| 20 | |||
| 21 | #else | ||
| 22 | |||
| 23 | static inline int gpio_device_setup_shared(struct gpio_device *gdev) | ||
| 24 | { | ||
| 25 | return 0; | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline void gpio_device_teardown_shared(struct gpio_device *gdev) { } | ||
| 29 | |||
| 30 | static inline int gpio_shared_add_proxy_lookup(struct device *consumer, | ||
| 31 | unsigned long lflags) | ||
| 32 | { | ||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | #endif /* CONFIG_GPIO_SHARED */ | ||
| 37 | |||
| 38 | struct gpio_shared_desc { | ||
| 39 | struct gpio_desc *desc; | ||
| 40 | bool can_sleep; | ||
| 41 | unsigned long cfg; | ||
| 42 | unsigned int usecnt; | ||
| 43 | unsigned int highcnt; | ||
| 44 | union { | ||
| 45 | struct mutex mutex; | ||
| 46 | spinlock_t spinlock; | ||
| 47 | }; | ||
| 48 | }; | ||
| 49 | |||
| 50 | struct gpio_shared_desc *devm_gpiod_shared_get(struct device *dev); | ||
| 51 | |||
| 52 | DEFINE_LOCK_GUARD_1(gpio_shared_desc_lock, struct gpio_shared_desc, | ||
| 53 | if (_T->lock->can_sleep) | ||
| 54 | mutex_lock(&_T->lock->mutex); | ||
| 55 | else | ||
| 56 | spin_lock_irqsave(&_T->lock->spinlock, _T->flags), | ||
| 57 | if (_T->lock->can_sleep) | ||
| 58 | mutex_unlock(&_T->lock->mutex); | ||
| 59 | else | ||
| 60 | spin_unlock_irqrestore(&_T->lock->spinlock, _T->flags), | ||
| 61 | unsigned long flags) | ||
| 62 | |||
| 63 | static inline void gpio_shared_lockdep_assert(struct gpio_shared_desc *shared_desc) | ||
| 64 | { | ||
| 65 | if (shared_desc->can_sleep) | ||
| 66 | lockdep_assert_held(&shared_desc->mutex); | ||
| 67 | else | ||
| 68 | lockdep_assert_held(&shared_desc->spinlock); | ||
| 69 | } | ||
| 70 | |||
| 71 | #endif /* __LINUX_GPIO_SHARED_H */ | ||
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #include "gpiolib-acpi.h" | 37 | #include "gpiolib-acpi.h" |
| 38 | #include "gpiolib-cdev.h" | 38 | #include "gpiolib-cdev.h" |
| 39 | #include "gpiolib-of.h" | 39 | #include "gpiolib-of.h" |
| 40 | #include "gpiolib-shared.h" | ||
| 40 | #include "gpiolib-swnode.h" | 41 | #include "gpiolib-swnode.h" |
| 41 | #include "gpiolib-sysfs.h" | 42 | #include "gpiolib-sysfs.h" |
| 42 | #include "gpiolib.h" | 43 | #include "gpiolib.h" |
| @@ -1200,6 +1201,10 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 1157 unmodified lines | |||
| 1200 | if (ret) | 1201 | if (ret) |
| 1201 | goto err_remove_irqchip_mask; | 1202 | goto err_remove_irqchip_mask; |
| 1202 | 1203 | ||
| 1204 | ret = gpio_device_setup_shared(gdev); | ||
| 1205 | if (ret) | ||
| 1206 | goto err_remove_irqchip; | ||
| 1207 | |||
| 1203 | /* | 1208 | /* |
| 1204 | * By first adding the chardev, and then adding the device, | 1209 | * By first adding the chardev, and then adding the device, |
| 1205 | * we get a device node entry in sysfs under | 1210 | * we get a device node entry in sysfs under |
| @@ -1211,10 +1216,13 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, · 5 unmodified lines | |||
| 1211 | if (gpiolib_initialized) { | 1216 | if (gpiolib_initialized) { |
| 1212 | ret = gpiochip_setup_dev(gdev); | 1217 | ret = gpiochip_setup_dev(gdev); |
| 1213 | if (ret) | 1218 | if (ret) |
| 1214 | goto err_remove_irqchip; | 1219 | goto err_teardown_shared; |
| 1215 | } | 1220 | } |
| 1221 | |||
| 1216 | return 0; | 1222 | return 0; |
| 1217 | 1223 | ||
| 1224 | err_teardown_shared: | ||
| 1225 | gpio_device_teardown_shared(gdev); | ||
| 1218 | err_remove_irqchip: | 1226 | err_remove_irqchip: |
| 1219 | gpiochip_irqchip_remove(gc); | 1227 | gpiochip_irqchip_remove(gc); |
| 1220 | err_remove_irqchip_mask: | 1228 | err_remove_irqchip_mask: |
| @@ -1283,6 +1291,7 @@ void gpiochip_remove(struct gpio_chip *gc) · 62 unmodified lines | |||
| 1283 | /* Numb the device, cancelling all outstanding operations */ | 1291 | /* Numb the device, cancelling all outstanding operations */ |
| 1284 | rcu_assign_pointer(gdev->chip, NULL); | 1292 | rcu_assign_pointer(gdev->chip, NULL); |
| 1285 | synchronize_srcu(&gdev->srcu); | 1293 | synchronize_srcu(&gdev->srcu); |
| 1294 | gpio_device_teardown_shared(gdev); | ||
| 1286 | gpiochip_irqchip_remove(gc); | 1295 | gpiochip_irqchip_remove(gc); |
| 1287 | acpi_gpiochip_remove(gc); | 1296 | acpi_gpiochip_remove(gc); |
| 1288 | of_gpiochip_remove(gc); | 1297 | of_gpiochip_remove(gc); |
| @@ -3981,6 +3990,26 @@ int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name) · 2692 unmodified lines | |||
| 3981 | } | 3990 | } |
| 3982 | EXPORT_SYMBOL_GPL(gpiod_set_consumer_name); | 3991 | EXPORT_SYMBOL_GPL(gpiod_set_consumer_name); |
| 3983 | 3992 | ||
| 3993 | /** | ||
| 3994 | * gpiod_is_shared() - check if this GPIO can be shared by multiple consumers | ||
| 3995 | * @desc: GPIO to inspect | ||
| 3996 | * | ||
| 3997 | * Returns: | ||
| 3998 | * True if this GPIO can be shared by multiple consumers at once. False if it's | ||
| 3999 | * a regular, exclusive GPIO. | ||
| 4000 | * | ||
| 4001 | * Note: | ||
| 4002 | * This function returning true does not mean that this GPIO is currently being | ||
| 4003 | * shared. It means the GPIO core has registered the fact that the firmware | ||
| 4004 | * configuration indicates that it can be shared by multiple consumers and is | ||
| 4005 | * in charge of arbitrating the access. | ||
| 4006 | */ | ||
| 4007 | bool gpiod_is_shared(const struct gpio_desc *desc) | ||
| 4008 | { | ||
| 4009 | return test_bit(GPIOD_FLAG_SHARED_PROXY, &desc->flags); | ||
| 4010 | } | ||
| 4011 | EXPORT_SYMBOL_GPL(gpiod_is_shared); | ||
| 4012 | |||
| 3984 | /** | 4013 | /** |
| 3985 | * gpiod_to_irq() - return the IRQ corresponding to a GPIO | 4014 | * gpiod_to_irq() - return the IRQ corresponding to a GPIO |
| 3986 | * @desc: gpio whose IRQ will be returned (already requested) | 4015 | * @desc: gpio whose IRQ will be returned (already requested) |
| @@ -4652,11 +4681,29 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 665 unmodified lines | |||
| 4652 | scoped_guard(srcu, &gpio_devices_srcu) { | 4681 | scoped_guard(srcu, &gpio_devices_srcu) { |
| 4653 | desc = gpiod_fwnode_lookup(fwnode, consumer, con_id, idx, | 4682 | desc = gpiod_fwnode_lookup(fwnode, consumer, con_id, idx, |
| 4654 | &flags, &lookupflags); | 4683 | &flags, &lookupflags); |
| 4684 | if (!IS_ERR_OR_NULL(desc) && | ||
| 4685 | test_bit(GPIOD_FLAG_SHARED, &desc->flags)) { | ||
| 4686 | /* | ||
| 4687 | * We're dealing with a GPIO shared by multiple | ||
| 4688 | * consumers. This is the moment to add the machine | ||
| 4689 | * lookup table for the proxy device as previously | ||
| 4690 | * we only knew the consumer's fwnode. | ||
| 4691 | */ | ||
| 4692 | ret = gpio_shared_add_proxy_lookup(consumer, lookupflags); | ||
| 4693 | if (ret) | ||
| 4694 | return ERR_PTR(ret); | ||
| 4695 | |||
| 4696 | /* Trigger platform lookup for shared GPIO proxy. */ | ||
| 4697 | desc = ERR_PTR(-ENOENT); | ||
| 4698 | /* Trigger it even for fwnode-only gpiod_get(). */ | ||
| 4699 | platform_lookup_allowed = true; | ||
| 4700 | } | ||
| 4701 | |||
| 4655 | if (gpiod_not_found(desc) && platform_lookup_allowed) { | 4702 | if (gpiod_not_found(desc) && platform_lookup_allowed) { |
| 4656 | /* | 4703 | /* |
| 4657 | * Either we are not using DT or ACPI, or their lookup | 4704 | * Either we are not using DT or ACPI, or their lookup |
| 4658 | * did not return a result. In that case, use platform | 4705 | * did not return a result or this is a shared GPIO. In |
| 4659 | * lookup as a fallback. | 4706 | * that case, use platform lookup as a fallback. |
| 4660 | */ | 4707 | */ |
| 4661 | dev_dbg(consumer, | 4708 | dev_dbg(consumer, |
| 4662 | "using lookup tables for GPIO lookup\n"); | 4709 | "using lookup tables for GPIO lookup\n"); |
| @@ -4679,14 +4726,19 @@ struct gpio_desc *gpiod_find_and_request(struct device *consumer, · 16 unmodified lines | |||
| 4679 | return ERR_PTR(ret); | 4726 | return ERR_PTR(ret); |
| 4680 | 4727 | ||
| 4681 | /* | 4728 | /* |
| 4682 | * This happens when there are several consumers for | 4729 | * This happens when there are several consumers for the same |
| 4683 | * the same GPIO line: we just return here without | 4730 | * GPIO line: we just return here without further |
| 4684 | * further initialization. It is a bit of a hack. | 4731 | * initialization. It's a hack introduced long ago to support |
| 4685 | * This is necessary to support fixed regulators. | 4732 | * fixed regulators. We now have a better solution with |
| 4733 | * automated scanning where affected platforms just need to | ||
| 4734 | * select the provided Kconfig option. | ||
| 4686 | * | 4735 | * |
| 4687 | * FIXME: Make this more sane and safe. | 4736 | * FIXME: Remove the GPIOD_FLAGS_BIT_NONEXCLUSIVE flag after |
| 4737 | * making sure all platforms use the new mechanism. | ||
| 4688 | */ | 4738 | */ |
| 4689 | dev_info(consumer, "nonexclusive access to GPIO for %s\n", name); | 4739 | dev_info(consumer, |
| 4740 | "nonexclusive access to GPIO for %s, consider updating your code to using gpio-shared-proxy\n", | ||
| 4741 | name); | ||
| 4690 | return desc; | 4742 | return desc; |
| 4691 | } | 4743 | } |
| 4692 | 4744 | ||
| @@ -204,6 +204,8 @@ struct gpio_desc { · 203 unmodified lines | |||
| 204 | #define GPIOD_FLAG_EDGE_FALLING 17 /* GPIO CDEV detects falling edge events */ | 204 | #define GPIOD_FLAG_EDGE_FALLING 17 /* GPIO CDEV detects falling edge events */ |
| 205 | #define GPIOD_FLAG_EVENT_CLOCK_REALTIME 18 /* GPIO CDEV reports REALTIME timestamps in events */ | 205 | #define GPIOD_FLAG_EVENT_CLOCK_REALTIME 18 /* GPIO CDEV reports REALTIME timestamps in events */ |
| 206 | #define GPIOD_FLAG_EVENT_CLOCK_HTE 19 /* GPIO CDEV reports hardware timestamps in events */ | 206 | #define GPIOD_FLAG_EVENT_CLOCK_HTE 19 /* GPIO CDEV reports hardware timestamps in events */ |
| 207 | #define GPIOD_FLAG_SHARED 20 /* GPIO is shared by multiple consumers */ | ||
| 208 | #define GPIOD_FLAG_SHARED_PROXY 21 /* GPIO is a virtual proxy to a physically shared pin. */ | ||
| 207 | 209 | ||
| 208 | /* Connection label */ | 210 | /* Connection label */ |
| 209 | struct gpio_desc_label __rcu *label; | 211 | struct gpio_desc_label __rcu *label; |
| @@ -34,8 +34,6 @@ static void arizona_haptics_work(struct work_struct *work) · 33 unmodified lines | |||
| 34 | struct arizona_haptics, | 34 | struct arizona_haptics, |
| 35 | work); | 35 | work); |
| 36 | struct arizona *arizona = haptics->arizona; | 36 | struct arizona *arizona = haptics->arizona; |
| 37 | struct snd_soc_component *component = | ||
| 38 | snd_soc_dapm_to_component(arizona->dapm); | ||
| 39 | int ret; | 37 | int ret; |
| 40 | 38 | ||
| 41 | if (!haptics->arizona->dapm) { | 39 | if (!haptics->arizona->dapm) { |
| @@ -65,7 +63,7 @@ static void arizona_haptics_work(struct work_struct *work) · 23 unmodified lines | |||
| 65 | return; | 63 | return; |
| 66 | } | 64 | } |
| 67 | 65 | ||
| 68 | ret = snd_soc_component_enable_pin(component, "HAPTICS"); | 66 | ret = snd_soc_dapm_enable_pin(arizona->dapm, "HAPTICS"); |
| 69 | if (ret != 0) { | 67 | if (ret != 0) { |
| 70 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", | 68 | dev_err(arizona->dev, "Failed to start HAPTICS: %d\n", |
| 71 | ret); | 69 | ret); |
| @@ -80,7 +78,7 @@ static void arizona_haptics_work(struct work_struct *work) · 8 unmodified lines | |||
| 80 | } | 78 | } |
| 81 | } else { | 79 | } else { |
| 82 | /* This disable sequence will be a noop if already enabled */ | 80 | /* This disable sequence will be a noop if already enabled */ |
| 83 | ret = snd_soc_component_disable_pin(component, "HAPTICS"); | 81 | ret = snd_soc_dapm_disable_pin(arizona->dapm, "HAPTICS"); |
| 84 | if (ret != 0) { | 82 | if (ret != 0) { |
| 85 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", | 83 | dev_err(arizona->dev, "Failed to disable HAPTICS: %d\n", |
| 86 | ret); | 84 | ret); |
| @@ -139,14 +137,12 @@ static int arizona_haptics_play(struct input_dev *input, void *data, · 52 unmodified lines | |||
| 139 | static void arizona_haptics_close(struct input_dev *input) | 137 | static void arizona_haptics_close(struct input_dev *input) |
| 140 | { | 138 | { |
| 141 | struct arizona_haptics *haptics = input_get_drvdata(input); | 139 | struct arizona_haptics *haptics = input_get_drvdata(input); |
| 142 | struct snd_soc_component *component; | 140 | struct snd_soc_dapm_context *dapm = haptics->arizona->dapm; |
| 143 | 141 | ||
| 144 | cancel_work_sync(&haptics->work); | 142 | cancel_work_sync(&haptics->work); |
| 145 | 143 | ||
| 146 | if (haptics->arizona->dapm) { | 144 | if (dapm) |
| 147 | component = snd_soc_dapm_to_component(haptics->arizona->dapm); | 145 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 148 | snd_soc_component_disable_pin(component, "HAPTICS"); | ||
| 149 | } | ||
| 150 | } | 146 | } |
| 151 | 147 | ||
| 152 | static int arizona_haptics_probe(struct platform_device *pdev) | 148 | static int arizona_haptics_probe(struct platform_device *pdev) |
| @@ -48,7 +48,6 @@ static void arizona_micsupp_check_cp(struct work_struct *work) · 47 unmodified lines | |||
| 48 | struct arizona_micsupp *micsupp = | 48 | struct arizona_micsupp *micsupp = |
| 49 | container_of(work, struct arizona_micsupp, check_cp_work); | 49 | container_of(work, struct arizona_micsupp, check_cp_work); |
| 50 | struct snd_soc_dapm_context *dapm = *micsupp->dapm; | 50 | struct snd_soc_dapm_context *dapm = *micsupp->dapm; |
| 51 | struct snd_soc_component *component; | ||
| 52 | const struct regulator_desc *desc = micsupp->desc; | 51 | const struct regulator_desc *desc = micsupp->desc; |
| 53 | unsigned int val; | 52 | unsigned int val; |
| 54 | int ret; | 53 | int ret; |
| @@ -61,14 +60,11 @@ static void arizona_micsupp_check_cp(struct work_struct *work) · 6 unmodified lines | |||
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | if (dapm) { | 62 | if (dapm) { |
| 64 | component = snd_soc_dapm_to_component(dapm); | ||
| 65 | |||
| 66 | if ((val & (desc->enable_mask | desc->bypass_mask)) == | 63 | if ((val & (desc->enable_mask | desc->bypass_mask)) == |
| 67 | desc->enable_mask) | 64 | desc->enable_mask) |
| 68 | snd_soc_component_force_enable_pin(component, | 65 | snd_soc_dapm_force_enable_pin(dapm, "MICSUPP"); |
| 69 | "MICSUPP"); | ||
| 70 | else | 66 | else |
| 71 | snd_soc_component_disable_pin(component, "MICSUPP"); | 67 | snd_soc_dapm_disable_pin(dapm, "MICSUPP"); |
| 72 | 68 | ||
| 73 | snd_soc_dapm_sync(dapm); | 69 | snd_soc_dapm_sync(dapm); |
| 74 | } | 70 | } |
| @@ -807,6 +807,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) · 806 unmodified lines | |||
| 807 | { | 807 | { |
| 808 | int ret; | 808 | int ret; |
| 809 | struct snd_soc_component *comp; | 809 | struct snd_soc_component *comp; |
| 810 | struct snd_soc_dapm_context *dapm; | ||
| 810 | struct gbaudio_jack *jack = NULL; | 811 | struct gbaudio_jack *jack = NULL; |
| 811 | 812 | ||
| 812 | if (!gbcodec) { | 813 | if (!gbcodec) { |
| @@ -815,6 +816,7 @@ int gbaudio_register_module(struct gbaudio_module_info *module) · 2 unmodified lines | |||
| 815 | } | 816 | } |
| 816 | 817 | ||
| 817 | comp = gbcodec->component; | 818 | comp = gbcodec->component; |
| 819 | dapm = snd_soc_component_to_dapm(comp); | ||
| 818 | 820 | ||
| 819 | mutex_lock(&gbcodec->register_mutex); | 821 | mutex_lock(&gbcodec->register_mutex); |
| 820 | 822 | ||
| @@ -833,18 +835,18 @@ int gbaudio_register_module(struct gbaudio_module_info *module) · 12 unmodified lines | |||
| 833 | } | 835 | } |
| 834 | 836 | ||
| 835 | if (module->dapm_widgets) | 837 | if (module->dapm_widgets) |
| 836 | snd_soc_dapm_new_controls(&comp->dapm, module->dapm_widgets, | 838 | snd_soc_dapm_new_controls(dapm, module->dapm_widgets, |
| 837 | module->num_dapm_widgets); | 839 | module->num_dapm_widgets); |
| 838 | if (module->controls) | 840 | if (module->controls) |
| 839 | snd_soc_add_component_controls(comp, module->controls, | 841 | snd_soc_add_component_controls(comp, module->controls, |
| 840 | module->num_controls); | 842 | module->num_controls); |
| 841 | if (module->dapm_routes) | 843 | if (module->dapm_routes) |
| 842 | snd_soc_dapm_add_routes(&comp->dapm, module->dapm_routes, | 844 | snd_soc_dapm_add_routes(dapm, module->dapm_routes, |
| 843 | module->num_dapm_routes); | 845 | module->num_dapm_routes); |
| 844 | 846 | ||
| 845 | /* card already instantiated, create widgets here only */ | 847 | /* card already instantiated, create widgets here only */ |
| 846 | if (comp->card->instantiated) { | 848 | if (comp->card->instantiated) { |
| 847 | gbaudio_dapm_link_component_dai_widgets(comp->card, &comp->dapm); | 849 | gbaudio_dapm_link_component_dai_widgets(comp->card, dapm); |
| 848 | #ifdef CONFIG_SND_JACK | 850 | #ifdef CONFIG_SND_JACK |
| 849 | /* | 851 | /* |
| 850 | * register jack devices for this module | 852 | * register jack devices for this module |
| @@ -966,9 +968,11 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) · 115 unmodified lines | |||
| 966 | #endif | 968 | #endif |
| 967 | 969 | ||
| 968 | if (module->dapm_routes) { | 970 | if (module->dapm_routes) { |
| 971 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp); | ||
| 972 | |||
| 969 | dev_dbg(comp->dev, "Removing %d routes\n", | 973 | dev_dbg(comp->dev, "Removing %d routes\n", |
| 970 | module->num_dapm_routes); | 974 | module->num_dapm_routes); |
| 971 | snd_soc_dapm_del_routes(&comp->dapm, module->dapm_routes, | 975 | snd_soc_dapm_del_routes(dapm, module->dapm_routes, |
| 972 | module->num_dapm_routes); | 976 | module->num_dapm_routes); |
| 973 | } | 977 | } |
| 974 | if (module->controls) { | 978 | if (module->controls) { |
| @@ -979,9 +983,11 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module) · 4 unmodified lines | |||
| 979 | module->num_controls); | 983 | module->num_controls); |
| 980 | } | 984 | } |
| 981 | if (module->dapm_widgets) { | 985 | if (module->dapm_widgets) { |
| 986 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp); | ||
| 987 | |||
| 982 | dev_dbg(comp->dev, "Removing %d widgets\n", | 988 | dev_dbg(comp->dev, "Removing %d widgets\n", |
| 983 | module->num_dapm_widgets); | 989 | module->num_dapm_widgets); |
| 984 | gbaudio_dapm_free_controls(&comp->dapm, module->dapm_widgets, | 990 | gbaudio_dapm_free_controls(dapm, module->dapm_widgets, |
| 985 | module->num_dapm_widgets); | 991 | module->num_dapm_widgets); |
| 986 | } | 992 | } |
| 987 | 993 | ||
| @@ -115,12 +115,13 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, · 114 unmodified lines | |||
| 115 | { | 115 | { |
| 116 | int i; | 116 | int i; |
| 117 | struct snd_soc_dapm_widget *w, *tmp_w; | 117 | struct snd_soc_dapm_widget *w, *tmp_w; |
| 118 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); | ||
| 118 | 119 | ||
| 119 | mutex_lock(&dapm->card->dapm_mutex); | 120 | mutex_lock(&card->dapm_mutex); |
| 120 | for (i = 0; i < num; i++) { | 121 | for (i = 0; i < num; i++) { |
| 121 | /* below logic can be optimized to identify widget pointer */ | 122 | /* below logic can be optimized to identify widget pointer */ |
| 122 | w = NULL; | 123 | w = NULL; |
| 123 | list_for_each_entry(tmp_w, &dapm->card->widgets, list) { | 124 | list_for_each_entry(tmp_w, &card->widgets, list) { |
| 124 | if (tmp_w->dapm == dapm && | 125 | if (tmp_w->dapm == dapm && |
| 125 | !strcmp(tmp_w->name, widget->name)) { | 126 | !strcmp(tmp_w->name, widget->name)) { |
| 126 | w = tmp_w; | 127 | w = tmp_w; |
| @@ -128,7 +129,7 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, · 1 unmodified line | |||
| 128 | } | 129 | } |
| 129 | } | 130 | } |
| 130 | if (!w) { | 131 | if (!w) { |
| 131 | dev_err(dapm->dev, "%s: widget not found\n", | 132 | dev_err(card->dev, "%s: widget not found\n", |
| 132 | widget->name); | 133 | widget->name); |
| 133 | widget++; | 134 | widget++; |
| 134 | continue; | 135 | continue; |
| @@ -136,7 +137,7 @@ int gbaudio_dapm_free_controls(struct snd_soc_dapm_context *dapm, · 1 unmodified line | |||
| 136 | widget++; | 137 | widget++; |
| 137 | gbaudio_dapm_free_widget(w); | 138 | gbaudio_dapm_free_widget(w); |
| 138 | } | 139 | } |
| 139 | mutex_unlock(&dapm->card->dapm_mutex); | 140 | mutex_unlock(&card->dapm_mutex); |
| 140 | return 0; | 141 | return 0; |
| 141 | } | 142 | } |
| 142 | 143 | ||
| @@ -163,7 +163,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, · 162 unmodified lines | |||
| 163 | struct gbaudio_ctl_pvt *data; | 163 | struct gbaudio_ctl_pvt *data; |
| 164 | struct gb_audio_ctl_elem_info *info; | 164 | struct gb_audio_ctl_elem_info *info; |
| 165 | struct gbaudio_module_info *module; | 165 | struct gbaudio_module_info *module; |
| 166 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 166 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 167 | struct gbaudio_codec_info *gbcodec = snd_soc_component_get_drvdata(comp); | 167 | struct gbaudio_codec_info *gbcodec = snd_soc_component_get_drvdata(comp); |
| 168 | 168 | ||
| 169 | dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); | 169 | dev_dbg(comp->dev, "Entered %s:%s\n", __func__, kcontrol->id.name); |
| @@ -214,7 +214,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, · 44 unmodified lines | |||
| 214 | struct gbaudio_ctl_pvt *data; | 214 | struct gbaudio_ctl_pvt *data; |
| 215 | struct gb_audio_ctl_elem_value gbvalue; | 215 | struct gb_audio_ctl_elem_value gbvalue; |
| 216 | struct gbaudio_module_info *module; | 216 | struct gbaudio_module_info *module; |
| 217 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 217 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 218 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); | 218 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); |
| 219 | struct gb_bundle *bundle; | 219 | struct gb_bundle *bundle; |
| 220 | 220 | ||
| @@ -276,7 +276,7 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol, · 55 unmodified lines | |||
| 276 | struct gbaudio_ctl_pvt *data; | 276 | struct gbaudio_ctl_pvt *data; |
| 277 | struct gb_audio_ctl_elem_value gbvalue; | 277 | struct gb_audio_ctl_elem_value gbvalue; |
| 278 | struct gbaudio_module_info *module; | 278 | struct gbaudio_module_info *module; |
| 279 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 279 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 280 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); | 280 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); |
| 281 | struct gb_bundle *bundle; | 281 | struct gb_bundle *bundle; |
| 282 | 282 | ||
| @@ -380,7 +380,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol, · 97 unmodified lines | |||
| 380 | struct gbaudio_module_info *module; | 380 | struct gbaudio_module_info *module; |
| 381 | struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); | 381 | struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); |
| 382 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; | 382 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; |
| 383 | struct device *codec_dev = widget->dapm->dev; | 383 | struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm); |
| 384 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); | 384 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); |
| 385 | struct gb_bundle *bundle; | 385 | struct gb_bundle *bundle; |
| 386 | 386 | ||
| @@ -393,7 +393,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 393 | bundle = to_gb_bundle(module->dev); | 393 | bundle = to_gb_bundle(module->dev); |
| 394 | 394 | ||
| 395 | if (data->vcount == 2) | 395 | if (data->vcount == 2) |
| 396 | dev_warn(widget->dapm->dev, | 396 | dev_warn(codec_dev, |
| 397 | "GB: Control '%s' is stereo, which is not supported\n", | 397 | "GB: Control '%s' is stereo, which is not supported\n", |
| 398 | kcontrol->id.name); | 398 | kcontrol->id.name); |
| 399 | 399 | ||
| @@ -429,7 +429,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 29 unmodified lines | |||
| 429 | struct gbaudio_module_info *module; | 429 | struct gbaudio_module_info *module; |
| 430 | struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); | 430 | struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); |
| 431 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; | 431 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; |
| 432 | struct device *codec_dev = widget->dapm->dev; | 432 | struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm); |
| 433 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); | 433 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); |
| 434 | struct gb_bundle *bundle; | 434 | struct gb_bundle *bundle; |
| 435 | 435 | ||
| @@ -443,7 +443,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 443 | bundle = to_gb_bundle(module->dev); | 443 | bundle = to_gb_bundle(module->dev); |
| 444 | 444 | ||
| 445 | if (data->vcount == 2) | 445 | if (data->vcount == 2) |
| 446 | dev_warn(widget->dapm->dev, | 446 | dev_warn(codec_dev, |
| 447 | "GB: Control '%s' is stereo, which is not supported\n", | 447 | "GB: Control '%s' is stereo, which is not supported\n", |
| 448 | kcontrol->id.name); | 448 | kcontrol->id.name); |
| 449 | 449 | ||
| @@ -543,7 +543,7 @@ static int gbcodec_enum_ctl_get(struct snd_kcontrol *kcontrol, · 93 unmodified lines | |||
| 543 | struct snd_ctl_elem_value *ucontrol) | 543 | struct snd_ctl_elem_value *ucontrol) |
| 544 | { | 544 | { |
| 545 | int ret, ctl_id; | 545 | int ret, ctl_id; |
| 546 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 546 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 547 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); | 547 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); |
| 548 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 548 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 549 | struct gb_audio_ctl_elem_value gbvalue; | 549 | struct gb_audio_ctl_elem_value gbvalue; |
| @@ -588,7 +588,7 @@ static int gbcodec_enum_ctl_put(struct snd_kcontrol *kcontrol, · 38 unmodified lines | |||
| 588 | struct snd_ctl_elem_value *ucontrol) | 588 | struct snd_ctl_elem_value *ucontrol) |
| 589 | { | 589 | { |
| 590 | int ret, ctl_id; | 590 | int ret, ctl_id; |
| 591 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 591 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 592 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); | 592 | struct gbaudio_codec_info *gb = snd_soc_component_get_drvdata(comp); |
| 593 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 593 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 594 | struct gb_audio_ctl_elem_value gbvalue; | 594 | struct gb_audio_ctl_elem_value gbvalue; |
| @@ -712,7 +712,7 @@ static int gbcodec_enum_dapm_ctl_get(struct snd_kcontrol *kcontrol, · 117 unmodified lines | |||
| 712 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; | 712 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; |
| 713 | struct gbaudio_module_info *module; | 713 | struct gbaudio_module_info *module; |
| 714 | struct gb_audio_ctl_elem_value gbvalue; | 714 | struct gb_audio_ctl_elem_value gbvalue; |
| 715 | struct device *codec_dev = widget->dapm->dev; | 715 | struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm); |
| 716 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); | 716 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); |
| 717 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 717 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 718 | struct gb_bundle *bundle; | 718 | struct gb_bundle *bundle; |
| @@ -759,7 +759,7 @@ static int gbcodec_enum_dapm_ctl_put(struct snd_kcontrol *kcontrol, · 40 unmodified lines | |||
| 759 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; | 759 | struct snd_soc_dapm_widget *widget = wlist->widgets[0]; |
| 760 | struct gb_audio_ctl_elem_value gbvalue; | 760 | struct gb_audio_ctl_elem_value gbvalue; |
| 761 | struct gbaudio_module_info *module; | 761 | struct gbaudio_module_info *module; |
| 762 | struct device *codec_dev = widget->dapm->dev; | 762 | struct device *codec_dev = snd_soc_dapm_to_dev(widget->dapm); |
| 763 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); | 763 | struct gbaudio_codec_info *gb = dev_get_drvdata(codec_dev); |
| 764 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 764 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 765 | struct gb_bundle *bundle; | 765 | struct gb_bundle *bundle; |
| @@ -924,7 +924,7 @@ static int gbaudio_widget_event(struct snd_soc_dapm_widget *w, · 158 unmodified lines | |||
| 924 | { | 924 | { |
| 925 | int wid; | 925 | int wid; |
| 926 | int ret; | 926 | int ret; |
| 927 | struct device *codec_dev = w->dapm->dev; | 927 | struct device *codec_dev = snd_soc_dapm_to_dev(w->dapm); |
| 928 | struct gbaudio_codec_info *gbcodec = dev_get_drvdata(codec_dev); | 928 | struct gbaudio_codec_info *gbcodec = dev_get_drvdata(codec_dev); |
| 929 | struct gbaudio_module_info *module; | 929 | struct gbaudio_module_info *module; |
| 930 | struct gb_bundle *bundle; | 930 | struct gb_bundle *bundle; |
| @@ -102,7 +102,7 @@ struct cs_dsp_coeff_ctl { · 101 unmodified lines | |||
| 102 | const char *subname; | 102 | const char *subname; |
| 103 | unsigned int subname_len; | 103 | unsigned int subname_len; |
| 104 | unsigned int offset; | 104 | unsigned int offset; |
| 105 | size_t len; | 105 | unsigned int len; |
| 106 | unsigned int type; | 106 | unsigned int type; |
| 107 | unsigned int flags; | 107 | unsigned int flags; |
| 108 | unsigned int set:1; | 108 | unsigned int set:1; |
| @@ -188,8 +188,8 @@ struct cs_dsp { · 79 unmodified lines | |||
| 188 | 188 | ||
| 189 | #ifdef CONFIG_DEBUG_FS | 189 | #ifdef CONFIG_DEBUG_FS |
| 190 | struct dentry *debugfs_root; | 190 | struct dentry *debugfs_root; |
| 191 | char *wmfw_file_name; | 191 | const char *wmfw_file_name; |
| 192 | char *bin_file_name; | 192 | const char *bin_file_name; |
| 193 | #endif | 193 | #endif |
| 194 | }; | 194 | }; |
| 195 | 195 | ||
| @@ -26,21 +26,21 @@ struct cs_dsp_test { · 25 unmodified lines | |||
| 26 | 26 | ||
| 27 | struct cs_dsp_test_local *local; | 27 | struct cs_dsp_test_local *local; |
| 28 | 28 | ||
| 29 | /* Following members are private */ | 29 | /* private: Following members are private */ |
| 30 | bool saw_bus_write; | 30 | bool saw_bus_write; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | /** | 33 | /** |
| 34 | * struct cs_dsp_mock_alg_def - Info for creating a mock algorithm entry. | 34 | * struct cs_dsp_mock_alg_def - Info for creating a mock algorithm entry. |
| 35 | * | 35 | * |
| 36 | * @id Algorithm ID. | 36 | * @id: Algorithm ID. |
| 37 | * @ver; Algorithm version. | 37 | * @ver: Algorithm version. |
| 38 | * @xm_base_words XM base address in DSP words. | 38 | * @xm_base_words: XM base address in DSP words. |
| 39 | * @xm_size_words XM size in DSP words. | 39 | * @xm_size_words: XM size in DSP words. |
| 40 | * @ym_base_words YM base address in DSP words. | 40 | * @ym_base_words: YM base address in DSP words. |
| 41 | * @ym_size_words YM size in DSP words. | 41 | * @ym_size_words: YM size in DSP words. |
| 42 | * @zm_base_words ZM base address in DSP words. | 42 | * @zm_base_words: ZM base address in DSP words. |
| 43 | * @zm_size_words ZM size in DSP words. | 43 | * @zm_size_words: ZM size in DSP words. |
| 44 | */ | 44 | */ |
| 45 | struct cs_dsp_mock_alg_def { | 45 | struct cs_dsp_mock_alg_def { |
| 46 | unsigned int id; | 46 | unsigned int id; |
| @@ -167,6 +167,8 @@ int gpiod_cansleep(const struct gpio_desc *desc); · 166 unmodified lines | |||
| 167 | int gpiod_to_irq(const struct gpio_desc *desc); | 167 | int gpiod_to_irq(const struct gpio_desc *desc); |
| 168 | int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name); | 168 | int gpiod_set_consumer_name(struct gpio_desc *desc, const char *name); |
| 169 | 169 | ||
| 170 | bool gpiod_is_shared(const struct gpio_desc *desc); | ||
| 171 | |||
| 170 | /* Convert between the old gpio_ and new gpiod_ interfaces */ | 172 | /* Convert between the old gpio_ and new gpiod_ interfaces */ |
| 171 | struct gpio_desc *gpio_to_desc(unsigned gpio); | 173 | struct gpio_desc *gpio_to_desc(unsigned gpio); |
| 172 | int desc_to_gpio(const struct gpio_desc *desc); | 174 | int desc_to_gpio(const struct gpio_desc *desc); |
| @@ -520,6 +522,13 @@ static inline int gpiod_set_consumer_name(struct gpio_desc *desc, · 347 unmodified lines | |||
| 520 | return -EINVAL; | 522 | return -EINVAL; |
| 521 | } | 523 | } |
| 522 | 524 | ||
| 525 | static inline bool gpiod_is_shared(const struct gpio_desc *desc) | ||
| 526 | { | ||
| 527 | /* GPIO can never have been requested */ | ||
| 528 | WARN_ON(desc); | ||
| 529 | return false; | ||
| 530 | } | ||
| 531 | |||
| 523 | static inline struct gpio_desc *gpio_to_desc(unsigned gpio) | 532 | static inline struct gpio_desc *gpio_to_desc(unsigned gpio) |
| 524 | { | 533 | { |
| 525 | return NULL; | 534 | return NULL; |
| @@ -3075,6 +3075,7 @@ · 3074 unmodified lines | |||
| 3075 | #define PCI_DEVICE_ID_INTEL_5100_22 0x65f6 | 3075 | #define PCI_DEVICE_ID_INTEL_5100_22 0x65f6 |
| 3076 | #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff | 3076 | #define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff |
| 3077 | #define PCI_DEVICE_ID_INTEL_HDA_FCL 0x67a8 | 3077 | #define PCI_DEVICE_ID_INTEL_HDA_FCL 0x67a8 |
| 3078 | #define PCI_DEVICE_ID_INTEL_HDA_NVL_S 0x6e50 | ||
| 3078 | #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 | 3079 | #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 |
| 3079 | #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 | 3080 | #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 |
| 3080 | #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 | 3081 | #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 |
| @@ -676,7 +676,7 @@ struct regmap *__regmap_init_sdw(struct sdw_slave *sdw, · 675 unmodified lines | |||
| 676 | const struct regmap_config *config, | 676 | const struct regmap_config *config, |
| 677 | struct lock_class_key *lock_key, | 677 | struct lock_class_key *lock_key, |
| 678 | const char *lock_name); | 678 | const char *lock_name); |
| 679 | struct regmap *__regmap_init_sdw_mbq(struct sdw_slave *sdw, | 679 | struct regmap *__regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw, |
| 680 | const struct regmap_config *config, | 680 | const struct regmap_config *config, |
| 681 | const struct regmap_sdw_mbq_cfg *mbq_config, | 681 | const struct regmap_sdw_mbq_cfg *mbq_config, |
| 682 | struct lock_class_key *lock_key, | 682 | struct lock_class_key *lock_key, |
| @@ -738,7 +738,7 @@ struct regmap *__devm_regmap_init_sdw(struct sdw_slave *sdw, · 55 unmodified lines | |||
| 738 | const struct regmap_config *config, | 738 | const struct regmap_config *config, |
| 739 | struct lock_class_key *lock_key, | 739 | struct lock_class_key *lock_key, |
| 740 | const char *lock_name); | 740 | const char *lock_name); |
| 741 | struct regmap *__devm_regmap_init_sdw_mbq(struct sdw_slave *sdw, | 741 | struct regmap *__devm_regmap_init_sdw_mbq(struct device *dev, struct sdw_slave *sdw, |
| 742 | const struct regmap_config *config, | 742 | const struct regmap_config *config, |
| 743 | const struct regmap_sdw_mbq_cfg *mbq_config, | 743 | const struct regmap_sdw_mbq_cfg *mbq_config, |
| 744 | struct lock_class_key *lock_key, | 744 | struct lock_class_key *lock_key, |
| @@ -970,7 +970,7 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 225 unmodified lines | |||
| 970 | */ | 970 | */ |
| 971 | #define regmap_init_sdw_mbq(sdw, config) \ | 971 | #define regmap_init_sdw_mbq(sdw, config) \ |
| 972 | __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \ | 972 | __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \ |
| 973 | sdw, config, NULL) | 973 | &sdw->dev, sdw, config, NULL) |
| 974 | 974 | ||
| 975 | /** | 975 | /** |
| 976 | * regmap_init_sdw_mbq_cfg() - Initialise MBQ SDW register map with config | 976 | * regmap_init_sdw_mbq_cfg() - Initialise MBQ SDW register map with config |
| @@ -983,9 +983,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 6 unmodified lines | |||
| 983 | * to a struct regmap. The regmap will be automatically freed by the | 983 | * to a struct regmap. The regmap will be automatically freed by the |
| 984 | * device management code. | 984 | * device management code. |
| 985 | */ | 985 | */ |
| 986 | #define regmap_init_sdw_mbq_cfg(sdw, config, mbq_config) \ | 986 | #define regmap_init_sdw_mbq_cfg(dev, sdw, config, mbq_config) \ |
| 987 | __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \ | 987 | __regmap_lockdep_wrapper(__regmap_init_sdw_mbq, #config, \ |
| 988 | sdw, config, mbq_config) | 988 | dev, sdw, config, mbq_config) |
| 989 | 989 | ||
| 990 | /** | 990 | /** |
| 991 | * regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave | 991 | * regmap_init_spi_avmm() - Initialize register map for Intel SPI Slave |
| @@ -1198,12 +1198,13 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 206 unmodified lines | |||
| 1198 | */ | 1198 | */ |
| 1199 | #define devm_regmap_init_sdw_mbq(sdw, config) \ | 1199 | #define devm_regmap_init_sdw_mbq(sdw, config) \ |
| 1200 | __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, #config, \ | 1200 | __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, #config, \ |
| 1201 | sdw, config, NULL) | 1201 | &sdw->dev, sdw, config, NULL) |
| 1202 | 1202 | ||
| 1203 | /** | 1203 | /** |
| 1204 | * devm_regmap_init_sdw_mbq_cfg() - Initialise managed MBQ SDW register map with config | 1204 | * devm_regmap_init_sdw_mbq_cfg() - Initialise managed MBQ SDW register map with config |
| 1205 | * | 1205 | * |
| 1206 | * @sdw: Device that will be interacted with | 1206 | * @dev: Device that will be interacted with |
| 1207 | * @sdw: SoundWire Device that will be interacted with | ||
| 1207 | * @config: Configuration for register map | 1208 | * @config: Configuration for register map |
| 1208 | * @mbq_config: Properties for the MBQ registers | 1209 | * @mbq_config: Properties for the MBQ registers |
| 1209 | * | 1210 | * |
| @@ -1211,9 +1212,9 @@ bool regmap_ac97_default_volatile(struct device *dev, unsigned int reg); · 1 unmodified line | |||
| 1211 | * to a struct regmap. The regmap will be automatically freed by the | 1212 | * to a struct regmap. The regmap will be automatically freed by the |
| 1212 | * device management code. | 1213 | * device management code. |
| 1213 | */ | 1214 | */ |
| 1214 | #define devm_regmap_init_sdw_mbq_cfg(sdw, config, mbq_config) \ | 1215 | #define devm_regmap_init_sdw_mbq_cfg(dev, sdw, config, mbq_config) \ |
| 1215 | __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, \ | 1216 | __regmap_lockdep_wrapper(__devm_regmap_init_sdw_mbq, \ |
| 1216 | #config, sdw, config, mbq_config) | 1217 | #config, dev, sdw, config, mbq_config) |
| 1217 | 1218 | ||
| 1218 | /** | 1219 | /** |
| 1219 | * devm_regmap_init_slimbus() - Initialise managed register map | 1220 | * devm_regmap_init_slimbus() - Initialise managed register map |
| @@ -355,4 +355,6 @@ · 354 unmodified lines | |||
| 355 | /* Check the reserved and fixed bits in address */ | 355 | /* Check the reserved and fixed bits in address */ |
| 356 | #define SDW_SDCA_VALID_CTL(reg) (((reg) & (GENMASK(31, 25) | BIT(18) | BIT(13))) == BIT(30)) | 356 | #define SDW_SDCA_VALID_CTL(reg) (((reg) & (GENMASK(31, 25) | BIT(18) | BIT(13))) == BIT(30)) |
| 357 | 357 | ||
| 358 | #define SDW_SDCA_MAX_REGISTER 0x47FFFFFF | ||
| 359 | |||
| 358 | #endif /* __SDW_REGISTERS_H */ | 360 | #endif /* __SDW_REGISTERS_H */ |
| @@ -562,4 +562,22 @@ static inline bool strstarts(const char *str, const char *prefix) · 561 unmodified lines | |||
| 562 | return strncmp(str, prefix, strlen(prefix)) == 0; | 562 | return strncmp(str, prefix, strlen(prefix)) == 0; |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | /** | ||
| 566 | * strends - Check if a string ends with another string. | ||
| 567 | * @str - NULL-terminated string to check against @suffix | ||
| 568 | * @suffix - NULL-terminated string defining the suffix to look for in @str | ||
| 569 | * | ||
| 570 | * Returns: | ||
| 571 | * True if @str ends with @suffix. False in all other cases. | ||
| 572 | */ | ||
| 573 | static inline bool strends(const char *str, const char *suffix) | ||
| 574 | { | ||
| 575 | unsigned int str_len = strlen(str), suffix_len = strlen(suffix); | ||
| 576 | |||
| 577 | if (str_len < suffix_len) | ||
| 578 | return false; | ||
| 579 | |||
| 580 | return !(strcmp(str + str_len - suffix_len, suffix)); | ||
| 581 | } | ||
| 582 | |||
| 565 | #endif /* _LINUX_STRING_H_ */ | 583 | #endif /* _LINUX_STRING_H_ */ |
| @@ -47,21 +47,44 @@ struct cirrus_amp_cal_controls { · 46 unmodified lines | |||
| 47 | int cs_amp_write_cal_coeffs(struct cs_dsp *dsp, | 47 | int cs_amp_write_cal_coeffs(struct cs_dsp *dsp, |
| 48 | const struct cirrus_amp_cal_controls *controls, | 48 | const struct cirrus_amp_cal_controls *controls, |
| 49 | const struct cirrus_amp_cal_data *data); | 49 | const struct cirrus_amp_cal_data *data); |
| 50 | int cs_amp_read_cal_coeffs(struct cs_dsp *dsp, | ||
| 51 | const struct cirrus_amp_cal_controls *controls, | ||
| 52 | struct cirrus_amp_cal_data *data); | ||
| 53 | int cs_amp_write_ambient_temp(struct cs_dsp *dsp, | ||
| 54 | const struct cirrus_amp_cal_controls *controls, | ||
| 55 | u32 temp); | ||
| 50 | int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_index, | 56 | int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_index, |
| 51 | struct cirrus_amp_cal_data *out_data); | 57 | struct cirrus_amp_cal_data *out_data); |
| 58 | int cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int num_amps, | ||
| 59 | const struct cirrus_amp_cal_data *in_data); | ||
| 52 | int cs_amp_get_vendor_spkid(struct device *dev); | 60 | int cs_amp_get_vendor_spkid(struct device *dev); |
| 61 | struct dentry *cs_amp_create_debugfs(struct device *dev); | ||
| 62 | |||
| 63 | static inline u64 cs_amp_cal_target_u64(const struct cirrus_amp_cal_data *data) | ||
| 64 | { | ||
| 65 | return ((u64)data->calTarget[1] << 32) | data->calTarget[0]; | ||
| 66 | } | ||
| 53 | 67 | ||
| 54 | struct cs_amp_test_hooks { | 68 | struct cs_amp_test_hooks { |
| 55 | efi_status_t (*get_efi_variable)(efi_char16_t *name, | 69 | efi_status_t (*get_efi_variable)(efi_char16_t *name, |
| 56 | efi_guid_t *guid, | 70 | efi_guid_t *guid, |
| 71 | u32 *returned_attr, | ||
| 57 | unsigned long *size, | 72 | unsigned long *size, |
| 58 | void *buf); | 73 | void *buf); |
| 74 | efi_status_t (*set_efi_variable)(efi_char16_t *name, | ||
| 75 | efi_guid_t *guid, | ||
| 76 | u32 attr, | ||
| 77 | unsigned long size, | ||
| 78 | void *buf); | ||
| 59 | 79 | ||
| 60 | int (*write_cal_coeff)(struct cs_dsp *dsp, | 80 | int (*write_cal_coeff)(struct cs_dsp *dsp, |
| 61 | const struct cirrus_amp_cal_controls *controls, | 81 | const struct cirrus_amp_cal_controls *controls, |
| 62 | const char *ctl_name, u32 val); | 82 | const char *ctl_name, u32 val); |
| 63 | }; | ||
| 64 | 83 | ||
| 84 | int (*read_cal_coeff)(struct cs_dsp *dsp, | ||
| 85 | const struct cirrus_amp_cal_controls *controls, | ||
| 86 | const char *ctl_name, u32 *val); | ||
| 87 | }; | ||
| 65 | extern const struct cs_amp_test_hooks * const cs_amp_test_hooks; | 88 | extern const struct cs_amp_test_hooks * const cs_amp_test_hooks; |
| 66 | 89 | ||
| 67 | #endif /* CS_AMP_LIB_H */ | 90 | #endif /* CS_AMP_LIB_H */ |
| @@ -9,12 +9,15 @@ · 8 unmodified lines | |||
| 9 | #ifndef __CS35L56_H | 9 | #ifndef __CS35L56_H |
| 10 | #define __CS35L56_H | 10 | #define __CS35L56_H |
| 11 | 11 | ||
| 12 | #include <linux/debugfs.h> | ||
| 12 | #include <linux/firmware/cirrus/cs_dsp.h> | 13 | #include <linux/firmware/cirrus/cs_dsp.h> |
| 13 | #include <linux/regulator/consumer.h> | 14 | #include <linux/regulator/consumer.h> |
| 14 | #include <linux/regmap.h> | 15 | #include <linux/regmap.h> |
| 15 | #include <linux/spi/spi.h> | 16 | #include <linux/spi/spi.h> |
| 16 | #include <sound/cs-amp-lib.h> | 17 | #include <sound/cs-amp-lib.h> |
| 17 | 18 | ||
| 19 | struct snd_ctl_elem_value; | ||
| 20 | |||
| 18 | #define CS35L56_DEVID 0x0000000 | 21 | #define CS35L56_DEVID 0x0000000 |
| 19 | #define CS35L56_REVID 0x0000004 | 22 | #define CS35L56_REVID 0x0000004 |
| 20 | #define CS35L56_RELID 0x000000C | 23 | #define CS35L56_RELID 0x000000C |
| @@ -62,6 +65,8 @@ · 41 unmodified lines | |||
| 62 | #define CS35L56_IRQ1_MASK_8 0x000E0AC | 65 | #define CS35L56_IRQ1_MASK_8 0x000E0AC |
| 63 | #define CS35L56_IRQ1_MASK_18 0x000E0D4 | 66 | #define CS35L56_IRQ1_MASK_18 0x000E0D4 |
| 64 | #define CS35L56_IRQ1_MASK_20 0x000E0DC | 67 | #define CS35L56_IRQ1_MASK_20 0x000E0DC |
| 68 | #define CS35L56_MIXER_NGATE_CH1_CFG 0x0010004 | ||
| 69 | #define CS35L56_MIXER_NGATE_CH2_CFG 0x0010008 | ||
| 65 | #define CS35L56_DSP_MBOX_1_RAW 0x0011000 | 70 | #define CS35L56_DSP_MBOX_1_RAW 0x0011000 |
| 66 | #define CS35L56_DSP_VIRTUAL1_MBOX_1 0x0011020 | 71 | #define CS35L56_DSP_VIRTUAL1_MBOX_1 0x0011020 |
| 67 | #define CS35L56_DSP_VIRTUAL1_MBOX_2 0x0011024 | 72 | #define CS35L56_DSP_VIRTUAL1_MBOX_2 0x0011024 |
| @@ -177,6 +182,9 @@ · 109 unmodified lines | |||
| 177 | /* IRQ1_EINT_8 */ | 182 | /* IRQ1_EINT_8 */ |
| 178 | #define CS35L56_TEMP_ERR_EINT1_MASK 0x80000000 | 183 | #define CS35L56_TEMP_ERR_EINT1_MASK 0x80000000 |
| 179 | 184 | ||
| 185 | /* MIXER_NGATE_CHn_CFG */ | ||
| 186 | #define CS35L56_AUX_NGATE_CHn_EN 0x00000001 | ||
| 187 | |||
| 180 | /* Mixer input sources */ | 188 | /* Mixer input sources */ |
| 181 | #define CS35L56_INPUT_SRC_NONE 0x00 | 189 | #define CS35L56_INPUT_SRC_NONE 0x00 |
| 182 | #define CS35L56_INPUT_SRC_ASP1RX1 0x08 | 190 | #define CS35L56_INPUT_SRC_ASP1RX1 0x08 |
| @@ -243,6 +251,7 @@ · 60 unmodified lines | |||
| 243 | #define CS35L56_MBOX_CMD_AUDIO_PLAY 0x0B000001 | 251 | #define CS35L56_MBOX_CMD_AUDIO_PLAY 0x0B000001 |
| 244 | #define CS35L56_MBOX_CMD_AUDIO_PAUSE 0x0B000002 | 252 | #define CS35L56_MBOX_CMD_AUDIO_PAUSE 0x0B000002 |
| 245 | #define CS35L56_MBOX_CMD_AUDIO_REINIT 0x0B000003 | 253 | #define CS35L56_MBOX_CMD_AUDIO_REINIT 0x0B000003 |
| 254 | #define CS35L56_MBOX_CMD_AUDIO_CALIBRATION 0x0B000006 | ||
| 246 | #define CS35L56_MBOX_CMD_HIBERNATE_NOW 0x02000001 | 255 | #define CS35L56_MBOX_CMD_HIBERNATE_NOW 0x02000001 |
| 247 | #define CS35L56_MBOX_CMD_WAKEUP 0x02000002 | 256 | #define CS35L56_MBOX_CMD_WAKEUP 0x02000002 |
| 248 | #define CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE 0x02000003 | 257 | #define CS35L56_MBOX_CMD_PREVENT_AUTO_HIBERNATE 0x02000003 |
| @@ -258,12 +267,22 @@ · 9 unmodified lines | |||
| 258 | #define CS35L56_PS3_POLL_US 500 | 267 | #define CS35L56_PS3_POLL_US 500 |
| 259 | #define CS35L56_PS3_TIMEOUT_US 300000 | 268 | #define CS35L56_PS3_TIMEOUT_US 300000 |
| 260 | 269 | ||
| 270 | #define CS35L56_CAL_STATUS_SUCCESS 1 | ||
| 271 | #define CS35L56_CAL_STATUS_OUT_OF_RANGE 3 | ||
| 272 | |||
| 273 | #define CS35L56_CAL_SET_STATUS_UNKNOWN 0 | ||
| 274 | #define CS35L56_CAL_SET_STATUS_DEFAULT 1 | ||
| 275 | #define CS35L56_CAL_SET_STATUS_SET 2 | ||
| 276 | |||
| 261 | #define CS35L56_CONTROL_PORT_READY_US 2200 | 277 | #define CS35L56_CONTROL_PORT_READY_US 2200 |
| 262 | #define CS35L56_HALO_STATE_POLL_US 1000 | 278 | #define CS35L56_HALO_STATE_POLL_US 1000 |
| 263 | #define CS35L56_HALO_STATE_TIMEOUT_US 250000 | 279 | #define CS35L56_HALO_STATE_TIMEOUT_US 250000 |
| 264 | #define CS35L56_RESET_PULSE_MIN_US 1100 | 280 | #define CS35L56_RESET_PULSE_MIN_US 1100 |
| 265 | #define CS35L56_WAKE_HOLD_TIME_US 1000 | 281 | #define CS35L56_WAKE_HOLD_TIME_US 1000 |
| 266 | 282 | ||
| 283 | #define CS35L56_CALIBRATION_POLL_US (100 * USEC_PER_MSEC) | ||
| 284 | #define CS35L56_CALIBRATION_TIMEOUT_US (5 * USEC_PER_SEC) | ||
| 285 | |||
| 267 | #define CS35L56_SDW1_PLAYBACK_PORT 1 | 286 | #define CS35L56_SDW1_PLAYBACK_PORT 1 |
| 268 | #define CS35L56_SDW1_CAPTURE_PORT 3 | 287 | #define CS35L56_SDW1_CAPTURE_PORT 3 |
| 269 | 288 | ||
| @@ -291,9 +310,16 @@ struct cs35l56_fw_reg { · 21 unmodified lines | |||
| 291 | unsigned int posture_number; | 310 | unsigned int posture_number; |
| 292 | }; | 311 | }; |
| 293 | 312 | ||
| 313 | struct cs35l56_cal_debugfs_fops { | ||
| 314 | const struct debugfs_short_fops calibrate; | ||
| 315 | const struct debugfs_short_fops cal_temperature; | ||
| 316 | const struct debugfs_short_fops cal_data; | ||
| 317 | }; | ||
| 318 | |||
| 294 | struct cs35l56_base { | 319 | struct cs35l56_base { |
| 295 | struct device *dev; | 320 | struct device *dev; |
| 296 | struct regmap *regmap; | 321 | struct regmap *regmap; |
| 322 | struct cs_dsp *dsp; | ||
| 297 | int irq; | 323 | int irq; |
| 298 | struct mutex irq_lock; | 324 | struct mutex irq_lock; |
| 299 | u8 type; | 325 | u8 type; |
| @@ -304,11 +330,14 @@ struct cs35l56_base { · 4 unmodified lines | |||
| 304 | bool can_hibernate; | 330 | bool can_hibernate; |
| 305 | bool cal_data_valid; | 331 | bool cal_data_valid; |
| 306 | s8 cal_index; | 332 | s8 cal_index; |
| 333 | u8 num_amps; | ||
| 307 | struct cirrus_amp_cal_data cal_data; | 334 | struct cirrus_amp_cal_data cal_data; |
| 308 | struct gpio_desc *reset_gpio; | 335 | struct gpio_desc *reset_gpio; |
| 309 | struct cs35l56_spi_payload *spi_payload_buf; | 336 | struct cs35l56_spi_payload *spi_payload_buf; |
| 310 | const struct cs35l56_fw_reg *fw_reg; | 337 | const struct cs35l56_fw_reg *fw_reg; |
| 311 | const struct cirrus_amp_cal_controls *calibration_controls; | 338 | const struct cirrus_amp_cal_controls *calibration_controls; |
| 339 | struct dentry *debugfs; | ||
| 340 | u64 silicon_uid; | ||
| 312 | }; | 341 | }; |
| 313 | 342 | ||
| 314 | static inline bool cs35l56_is_otp_register(unsigned int reg) | 343 | static inline bool cs35l56_is_otp_register(unsigned int reg) |
| @@ -340,6 +369,7 @@ extern const struct regmap_config cs35l63_regmap_i2c; · 25 unmodified lines | |||
| 340 | extern const struct regmap_config cs35l63_regmap_sdw; | 369 | extern const struct regmap_config cs35l63_regmap_sdw; |
| 341 | 370 | ||
| 342 | extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls; | 371 | extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls; |
| 372 | extern const char * const cs35l56_cal_set_status_text[3]; | ||
| 343 | 373 | ||
| 344 | extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC]; | 374 | extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC]; |
| 345 | extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC]; | 375 | extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC]; |
| @@ -358,8 +388,28 @@ int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base); · 12 unmodified lines | |||
| 358 | int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire); | 388 | int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire); |
| 359 | void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); | 389 | void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); |
| 360 | int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base); | 390 | int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base); |
| 391 | int cs35l56_stash_calibration(struct cs35l56_base *cs35l56_base, | ||
| 392 | const struct cirrus_amp_cal_data *data); | ||
| 393 | ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base, | ||
| 394 | const char __user *from, size_t count, | ||
| 395 | loff_t *ppos); | ||
| 396 | ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base, | ||
| 397 | const char __user *from, size_t count, | ||
| 398 | loff_t *ppos); | ||
| 399 | ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base, | ||
| 400 | char __user *to, size_t count, | ||
| 401 | loff_t *ppos); | ||
| 402 | ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base, | ||
| 403 | const char __user *from, size_t count, | ||
| 404 | loff_t *ppos); | ||
| 405 | void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base, | ||
| 406 | const struct cs35l56_cal_debugfs_fops *fops); | ||
| 407 | void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base); | ||
| 408 | int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base, | ||
| 409 | struct snd_ctl_elem_value *uvalue); | ||
| 361 | int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, | 410 | int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, |
| 362 | bool *fw_missing, unsigned int *fw_version); | 411 | bool *fw_missing, unsigned int *fw_version); |
| 412 | void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base); | ||
| 363 | void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); | 413 | void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); |
| 364 | int cs35l56_hw_init(struct cs35l56_base *cs35l56_base); | 414 | int cs35l56_hw_init(struct cs35l56_base *cs35l56_base); |
| 365 | int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base); | 415 | int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base); |
| @@ -12,19 +12,24 @@ · 11 unmodified lines | |||
| 12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
| 13 | #include <linux/kconfig.h> | 13 | #include <linux/kconfig.h> |
| 14 | 14 | ||
| 15 | struct acpi_table_swft; | ||
| 16 | struct fwnode_handle; | ||
| 15 | struct sdw_slave; | 17 | struct sdw_slave; |
| 18 | struct sdca_dev; | ||
| 16 | 19 | ||
| 17 | #define SDCA_MAX_FUNCTION_COUNT 8 | 20 | #define SDCA_MAX_FUNCTION_COUNT 8 |
| 18 | 21 | ||
| 19 | /** | 22 | /** |
| 20 | * struct sdca_function_desc - short descriptor for an SDCA Function | 23 | * struct sdca_function_desc - short descriptor for an SDCA Function |
| 21 | * @node: firmware node for the Function. | 24 | * @node: firmware node for the Function. |
| 25 | * @func_dev: pointer to SDCA function device. | ||
| 22 | * @name: Human-readable string. | 26 | * @name: Human-readable string. |
| 23 | * @type: Function topology type. | 27 | * @type: Function topology type. |
| 24 | * @adr: ACPI address (used for SDCA register access). | 28 | * @adr: ACPI address (used for SDCA register access). |
| 25 | */ | 29 | */ |
| 26 | struct sdca_function_desc { | 30 | struct sdca_function_desc { |
| 27 | struct fwnode_handle *node; | 31 | struct fwnode_handle *node; |
| 32 | struct sdca_dev *func_dev; | ||
| 28 | const char *name; | 33 | const char *name; |
| 29 | u32 type; | 34 | u32 type; |
| 30 | u8 adr; | 35 | u8 adr; |
| @@ -37,11 +42,13 @@ struct sdca_function_desc { · 6 unmodified lines | |||
| 37 | * @num_functions: Total number of supported SDCA functions. Invalid/unsupported | 42 | * @num_functions: Total number of supported SDCA functions. Invalid/unsupported |
| 38 | * functions will be skipped. | 43 | * functions will be skipped. |
| 39 | * @function: Array of function descriptors. | 44 | * @function: Array of function descriptors. |
| 45 | * @swft: Pointer to the SWFT table, if available. | ||
| 40 | */ | 46 | */ |
| 41 | struct sdca_device_data { | 47 | struct sdca_device_data { |
| 42 | u32 interface_revision; | 48 | u32 interface_revision; |
| 43 | int num_functions; | 49 | int num_functions; |
| 44 | struct sdca_function_desc function[SDCA_MAX_FUNCTION_COUNT]; | 50 | struct sdca_function_desc function[SDCA_MAX_FUNCTION_COUNT]; |
| 51 | struct acpi_table_swft *swft; | ||
| 45 | }; | 52 | }; |
| 46 | 53 | ||
| 47 | enum sdca_quirk { | 54 | enum sdca_quirk { |
| @@ -52,17 +59,29 @@ enum sdca_quirk { · 4 unmodified lines | |||
| 52 | #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA) | 59 | #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA) |
| 53 | 60 | ||
| 54 | void sdca_lookup_functions(struct sdw_slave *slave); | 61 | void sdca_lookup_functions(struct sdw_slave *slave); |
| 62 | void sdca_lookup_swft(struct sdw_slave *slave); | ||
| 55 | void sdca_lookup_interface_revision(struct sdw_slave *slave); | 63 | void sdca_lookup_interface_revision(struct sdw_slave *slave); |
| 56 | bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk); | 64 | bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk); |
| 65 | int sdca_dev_register_functions(struct sdw_slave *slave); | ||
| 66 | void sdca_dev_unregister_functions(struct sdw_slave *slave); | ||
| 57 | 67 | ||
| 58 | #else | 68 | #else |
| 59 | 69 | ||
| 60 | static inline void sdca_lookup_functions(struct sdw_slave *slave) {} | 70 | static inline void sdca_lookup_functions(struct sdw_slave *slave) {} |
| 71 | static inline void sdca_lookup_swft(struct sdw_slave *slave) {} | ||
| 61 | static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {} | 72 | static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {} |
| 62 | static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk) | 73 | static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk) |
| 63 | { | 74 | { |
| 64 | return false; | 75 | return false; |
| 65 | } | 76 | } |
| 77 | |||
| 78 | static inline int sdca_dev_register_functions(struct sdw_slave *slave) | ||
| 79 | { | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | |||
| 83 | static inline void sdca_dev_unregister_functions(struct sdw_slave *slave) {} | ||
| 84 | |||
| 66 | #endif | 85 | #endif |
| 67 | 86 | ||
| 68 | #endif | 87 | #endif |
| @@ -0,0 +1,105 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * The MIPI SDCA specification is available for public downloads at | ||
| 4 | * https://www.mipi.org/mipi-sdca-v1-0-download | ||
| 5 | * | ||
| 6 | * Copyright (C) 2025 Cirrus Logic, Inc. and | ||
| 7 | * Cirrus Logic International Semiconductor Ltd. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __SDCA_FDL_H__ | ||
| 11 | #define __SDCA_FDL_H__ | ||
| 12 | |||
| 13 | #include <linux/completion.h> | ||
| 14 | #include <linux/workqueue.h> | ||
| 15 | |||
| 16 | struct device; | ||
| 17 | struct regmap; | ||
| 18 | struct sdca_fdl_set; | ||
| 19 | struct sdca_function_data; | ||
| 20 | struct sdca_interrupt; | ||
| 21 | struct sdca_interrupt_info; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * struct fdl_state - FDL state structure to keep data between interrupts | ||
| 25 | * @begin: Completion indicating the start of an FDL download cycle. | ||
| 26 | * @done: Completion indicating the end of an FDL download cycle. | ||
| 27 | * @timeout: Delayed work used for timing out UMP transactions. | ||
| 28 | * @lock: Mutex to protect between the timeout work and IRQ handlers. | ||
| 29 | * @interrupt: Pointer to the interrupt struct to which this FDL is attached. | ||
| 30 | * @set: Pointer to the FDL set currently being downloaded. | ||
| 31 | * @file_index: Index of the current file being processed. | ||
| 32 | */ | ||
| 33 | struct fdl_state { | ||
| 34 | struct completion begin; | ||
| 35 | struct completion done; | ||
| 36 | struct delayed_work timeout; | ||
| 37 | struct mutex lock; | ||
| 38 | |||
| 39 | struct sdca_interrupt *interrupt; | ||
| 40 | struct sdca_fdl_set *set; | ||
| 41 | int file_index; | ||
| 42 | }; | ||
| 43 | |||
| 44 | #define SDCA_CTL_XU_FDLH_COMPLETE 0 | ||
| 45 | #define SDCA_CTL_XU_FDLH_MORE_FILES SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | ||
| 46 | #define SDCA_CTL_XU_FDLH_FILE_AVAILABLE (SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \ | ||
| 47 | SDCA_CTL_XU_FDLH_SET_IN_PROGRESS) | ||
| 48 | #define SDCA_CTL_XU_FDLH_MASK (SDCA_CTL_XU_FDLH_TRANSFERRED_CHUNK | \ | ||
| 49 | SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \ | ||
| 50 | SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \ | ||
| 51 | SDCA_CTL_XU_FDLH_RESET_ACK | \ | ||
| 52 | SDCA_CTL_XU_FDLH_REQ_ABORT) | ||
| 53 | |||
| 54 | #define SDCA_CTL_XU_FDLD_COMPLETE 0 | ||
| 55 | #define SDCA_CTL_XU_FDLD_FILE_OK (SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \ | ||
| 56 | SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \ | ||
| 57 | SDCA_CTL_XU_FDLD_ACK_TRANSFER | \ | ||
| 58 | SDCA_CTL_XU_FDLD_NEEDS_SET) | ||
| 59 | #define SDCA_CTL_XU_FDLD_MORE_FILES_OK (SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \ | ||
| 60 | SDCA_CTL_XU_FDLD_ACK_TRANSFER | \ | ||
| 61 | SDCA_CTL_XU_FDLD_NEEDS_SET) | ||
| 62 | #define SDCA_CTL_XU_FDLD_MASK (SDCA_CTL_XU_FDLD_REQ_RESET | \ | ||
| 63 | SDCA_CTL_XU_FDLD_REQ_ABORT | \ | ||
| 64 | SDCA_CTL_XU_FDLD_ACK_TRANSFER | \ | ||
| 65 | SDCA_CTL_XU_FDLD_NEEDS_SET) | ||
| 66 | |||
| 67 | #if IS_ENABLED(CONFIG_SND_SOC_SDCA_FDL) | ||
| 68 | |||
| 69 | int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt); | ||
| 70 | int sdca_fdl_process(struct sdca_interrupt *interrupt); | ||
| 71 | int sdca_fdl_sync(struct device *dev, struct sdca_function_data *function, | ||
| 72 | struct sdca_interrupt_info *info); | ||
| 73 | |||
| 74 | int sdca_reset_function(struct device *dev, struct sdca_function_data *function, | ||
| 75 | struct regmap *regmap); | ||
| 76 | |||
| 77 | #else | ||
| 78 | |||
| 79 | static inline int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt) | ||
| 80 | { | ||
| 81 | return 0; | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline int sdca_fdl_process(struct sdca_interrupt *interrupt) | ||
| 85 | { | ||
| 86 | return 0; | ||
| 87 | } | ||
| 88 | |||
| 89 | static inline int sdca_fdl_sync(struct device *dev, | ||
| 90 | struct sdca_function_data *function, | ||
| 91 | struct sdca_interrupt_info *info) | ||
| 92 | { | ||
| 93 | return 0; | ||
| 94 | } | ||
| 95 | |||
| 96 | static inline int sdca_reset_function(struct device *dev, | ||
| 97 | struct sdca_function_data *function, | ||
| 98 | struct regmap *regmap) | ||
| 99 | { | ||
| 100 | return 0; | ||
| 101 | } | ||
| 102 | |||
| 103 | #endif // CONFIG_SND_SOC_SDCA_FDL | ||
| 104 | |||
| 105 | #endif // __SDCA_FDL_H__ | ||
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
| 14 | #include <linux/hid.h> | 14 | #include <linux/hid.h> |
| 15 | 15 | ||
| 16 | struct acpi_table_swft; | ||
| 16 | struct device; | 17 | struct device; |
| 17 | struct sdca_entity; | 18 | struct sdca_entity; |
| 18 | struct sdca_function_desc; | 19 | struct sdca_function_desc; |
| @@ -63,6 +64,7 @@ struct sdca_function_desc; · 44 unmodified lines | |||
| 63 | * @SDCA_FUNCTION_TYPE_RJ: Retaskable jack. | 64 | * @SDCA_FUNCTION_TYPE_RJ: Retaskable jack. |
| 64 | * @SDCA_FUNCTION_TYPE_SIMPLE_JACK: Subset of UAJ. | 65 | * @SDCA_FUNCTION_TYPE_SIMPLE_JACK: Subset of UAJ. |
| 65 | * @SDCA_FUNCTION_TYPE_HID: Human Interface Device, for e.g. buttons. | 66 | * @SDCA_FUNCTION_TYPE_HID: Human Interface Device, for e.g. buttons. |
| 67 | * @SDCA_FUNCTION_TYPE_COMPANION_AMP: Sources audio from another amp. | ||
| 66 | * @SDCA_FUNCTION_TYPE_IMP_DEF: Implementation-defined function. | 68 | * @SDCA_FUNCTION_TYPE_IMP_DEF: Implementation-defined function. |
| 67 | * | 69 | * |
| 68 | * SDCA Function Types from SDCA specification v1.0a Section 5.1.2 | 70 | * SDCA Function Types from SDCA specification v1.0a Section 5.1.2 |
| @@ -82,6 +84,7 @@ enum sdca_function_type { · 13 unmodified lines | |||
| 82 | SDCA_FUNCTION_TYPE_RJ = 0x07, | 84 | SDCA_FUNCTION_TYPE_RJ = 0x07, |
| 83 | SDCA_FUNCTION_TYPE_SIMPLE_JACK = 0x08, | 85 | SDCA_FUNCTION_TYPE_SIMPLE_JACK = 0x08, |
| 84 | SDCA_FUNCTION_TYPE_HID = 0x0A, | 86 | SDCA_FUNCTION_TYPE_HID = 0x0A, |
| 87 | SDCA_FUNCTION_TYPE_COMPANION_AMP = 0x0B, | ||
| 85 | SDCA_FUNCTION_TYPE_IMP_DEF = 0x1F, | 88 | SDCA_FUNCTION_TYPE_IMP_DEF = 0x1F, |
| 86 | }; | 89 | }; |
| 87 | 90 | ||
| @@ -95,6 +98,7 @@ enum sdca_function_type { · 7 unmodified lines | |||
| 95 | #define SDCA_FUNCTION_TYPE_RJ_NAME "RJ" | 98 | #define SDCA_FUNCTION_TYPE_RJ_NAME "RJ" |
| 96 | #define SDCA_FUNCTION_TYPE_SIMPLE_NAME "SimpleJack" | 99 | #define SDCA_FUNCTION_TYPE_SIMPLE_NAME "SimpleJack" |
| 97 | #define SDCA_FUNCTION_TYPE_HID_NAME "HID" | 100 | #define SDCA_FUNCTION_TYPE_HID_NAME "HID" |
| 101 | #define SDCA_FUNCTION_TYPE_COMPANION_AMP_NAME "CompanionAmp" | ||
| 98 | #define SDCA_FUNCTION_TYPE_IMP_DEF_NAME "ImplementationDefined" | 102 | #define SDCA_FUNCTION_TYPE_IMP_DEF_NAME "ImplementationDefined" |
| 99 | 103 | ||
| 100 | /** | 104 | /** |
| @@ -133,6 +137,32 @@ struct sdca_init_write { · 32 unmodified lines | |||
| 133 | #define SDCA_CTL_TYPE_S(ent, sel) SDCA_CTL_TYPE(SDCA_ENTITY_TYPE_##ent, \ | 137 | #define SDCA_CTL_TYPE_S(ent, sel) SDCA_CTL_TYPE(SDCA_ENTITY_TYPE_##ent, \ |
| 134 | SDCA_CTL_##ent##_##sel) | 138 | SDCA_CTL_##ent##_##sel) |
| 135 | 139 | ||
| 140 | /** | ||
| 141 | * enum sdca_messageoffset_range - Column definitions UMP MessageOffset | ||
| 142 | */ | ||
| 143 | enum sdca_messageoffset_range { | ||
| 144 | SDCA_MESSAGEOFFSET_BUFFER_START_ADDRESS = 0, | ||
| 145 | SDCA_MESSAGEOFFSET_BUFFER_LENGTH = 1, | ||
| 146 | SDCA_MESSAGEOFFSET_UMP_MODE = 2, | ||
| 147 | SDCA_MESSAGEOFFSET_NCOLS = 3, | ||
| 148 | }; | ||
| 149 | |||
| 150 | /** | ||
| 151 | * enum sdca_ump_mode - SDCA UMP Mode | ||
| 152 | */ | ||
| 153 | enum sdca_ump_mode { | ||
| 154 | SDCA_UMP_MODE_DIRECT = 0x00, | ||
| 155 | SDCA_UMP_MODE_INDIRECT = 0x01, | ||
| 156 | }; | ||
| 157 | |||
| 158 | /** | ||
| 159 | * enum sdca_ump_owner - SDCA UMP Owner | ||
| 160 | */ | ||
| 161 | enum sdca_ump_owner { | ||
| 162 | SDCA_UMP_OWNER_HOST = 0x00, | ||
| 163 | SDCA_UMP_OWNER_DEVICE = 0x01, | ||
| 164 | }; | ||
| 165 | |||
| 136 | /** | 166 | /** |
| 137 | * enum sdca_it_controls - SDCA Controls for Input Terminal | 167 | * enum sdca_it_controls - SDCA Controls for Input Terminal |
| 138 | * | 168 | * |
| @@ -258,6 +288,27 @@ enum sdca_xu_controls { · 119 unmodified lines | |||
| 258 | SDCA_CTL_XU_FDL_STATUS = 0x14, | 288 | SDCA_CTL_XU_FDL_STATUS = 0x14, |
| 259 | SDCA_CTL_XU_FDL_SET_INDEX = 0x15, | 289 | SDCA_CTL_XU_FDL_SET_INDEX = 0x15, |
| 260 | SDCA_CTL_XU_FDL_HOST_REQUEST = 0x16, | 290 | SDCA_CTL_XU_FDL_HOST_REQUEST = 0x16, |
| 291 | |||
| 292 | /* FDL Status Host->Device bit definitions */ | ||
| 293 | SDCA_CTL_XU_FDLH_TRANSFERRED_CHUNK = BIT(0), | ||
| 294 | SDCA_CTL_XU_FDLH_TRANSFERRED_FILE = BIT(1), | ||
| 295 | SDCA_CTL_XU_FDLH_SET_IN_PROGRESS = BIT(2), | ||
| 296 | SDCA_CTL_XU_FDLH_RESET_ACK = BIT(4), | ||
| 297 | SDCA_CTL_XU_FDLH_REQ_ABORT = BIT(5), | ||
| 298 | /* FDL Status Device->Host bit definitions */ | ||
| 299 | SDCA_CTL_XU_FDLD_REQ_RESET = BIT(4), | ||
| 300 | SDCA_CTL_XU_FDLD_REQ_ABORT = BIT(5), | ||
| 301 | SDCA_CTL_XU_FDLD_ACK_TRANSFER = BIT(6), | ||
| 302 | SDCA_CTL_XU_FDLD_NEEDS_SET = BIT(7), | ||
| 303 | }; | ||
| 304 | |||
| 305 | /** | ||
| 306 | * enum sdca_set_index_range - Column definitions UMP SetIndex | ||
| 307 | */ | ||
| 308 | enum sdca_fdl_set_index_range { | ||
| 309 | SDCA_FDL_SET_INDEX_SET_NUMBER = 0, | ||
| 310 | SDCA_FDL_SET_INDEX_FILE_SET_ID = 1, | ||
| 311 | SDCA_FDL_SET_INDEX_NCOLS = 2, | ||
| 261 | }; | 312 | }; |
| 262 | 313 | ||
| 263 | /** | 314 | /** |
| @@ -542,6 +593,9 @@ enum sdca_entity0_controls { · 278 unmodified lines | |||
| 542 | SDCA_CTL_ENTITY_0_FUNCTION_NEEDS_INITIALIZATION = BIT(5), | 593 | SDCA_CTL_ENTITY_0_FUNCTION_NEEDS_INITIALIZATION = BIT(5), |
| 543 | SDCA_CTL_ENTITY_0_FUNCTION_HAS_BEEN_RESET = BIT(6), | 594 | SDCA_CTL_ENTITY_0_FUNCTION_HAS_BEEN_RESET = BIT(6), |
| 544 | SDCA_CTL_ENTITY_0_FUNCTION_BUSY = BIT(7), | 595 | SDCA_CTL_ENTITY_0_FUNCTION_BUSY = BIT(7), |
| 596 | |||
| 597 | /* Function Action Bits */ | ||
| 598 | SDCA_CTL_ENTITY_0_RESET_FUNCTION_NOW = BIT(0), | ||
| 545 | }; | 599 | }; |
| 546 | 600 | ||
| 547 | #define SDCA_CTL_MIC_BIAS_NAME "Mic Bias" | 601 | #define SDCA_CTL_MIC_BIAS_NAME "Mic Bias" |
| @@ -557,7 +611,7 @@ enum sdca_entity0_controls { · 9 unmodified lines | |||
| 557 | #define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type" | 611 | #define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type" |
| 558 | #define SDCA_CTL_MIXER_NAME "Mixer" | 612 | #define SDCA_CTL_MIXER_NAME "Mixer" |
| 559 | #define SDCA_CTL_SELECTOR_NAME "Selector" | 613 | #define SDCA_CTL_SELECTOR_NAME "Selector" |
| 560 | #define SDCA_CTL_MUTE_NAME "Mute" | 614 | #define SDCA_CTL_MUTE_NAME "Channel" |
| 561 | #define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume" | 615 | #define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume" |
| 562 | #define SDCA_CTL_AGC_NAME "AGC" | 616 | #define SDCA_CTL_AGC_NAME "AGC" |
| 563 | #define SDCA_CTL_BASS_BOOST_NAME "Bass Boost" | 617 | #define SDCA_CTL_BASS_BOOST_NAME "Bass Boost" |
| @@ -771,6 +825,7 @@ struct sdca_control { · 207 unmodified lines | |||
| 771 | u8 layers; | 825 | u8 layers; |
| 772 | 826 | ||
| 773 | bool deferrable; | 827 | bool deferrable; |
| 828 | bool is_volatile; | ||
| 774 | bool has_default; | 829 | bool has_default; |
| 775 | bool has_fixed; | 830 | bool has_fixed; |
| 776 | }; | 831 | }; |
| @@ -1089,6 +1144,27 @@ struct sdca_entity_hide { · 312 unmodified lines | |||
| 1089 | struct hid_descriptor hid_desc; | 1144 | struct hid_descriptor hid_desc; |
| 1090 | }; | 1145 | }; |
| 1091 | 1146 | ||
| 1147 | /** | ||
| 1148 | * enum sdca_xu_reset_machanism - SDCA FDL Resets | ||
| 1149 | */ | ||
| 1150 | enum sdca_xu_reset_mechanism { | ||
| 1151 | SDCA_XU_RESET_FUNCTION = 0x0, | ||
| 1152 | SDCA_XU_RESET_DEVICE = 0x1, | ||
| 1153 | SDCA_XU_RESET_BUS = 0x2, | ||
| 1154 | }; | ||
| 1155 | |||
| 1156 | /** | ||
| 1157 | * struct sdca_entity_xu - information specific to XU Entities | ||
| 1158 | * @max_delay: the maximum time in microseconds allowed for the Device | ||
| 1159 | * to change the ownership from Device to Host | ||
| 1160 | * @reset_mechanism: indicates the type of reset that can be requested | ||
| 1161 | * the end of an FDL. | ||
| 1162 | */ | ||
| 1163 | struct sdca_entity_xu { | ||
| 1164 | unsigned int max_delay; | ||
| 1165 | enum sdca_xu_reset_mechanism reset_mechanism; | ||
| 1166 | }; | ||
| 1167 | |||
| 1092 | /** | 1168 | /** |
| 1093 | * struct sdca_entity - information for one SDCA Entity | 1169 | * struct sdca_entity - information for one SDCA Entity |
| 1094 | * @label: String such as "OT 12". | 1170 | * @label: String such as "OT 12". |
| @@ -1105,6 +1181,7 @@ struct sdca_entity_hide { · 10 unmodified lines | |||
| 1105 | * @pde: Power Domain Entity specific Entity properties. | 1181 | * @pde: Power Domain Entity specific Entity properties. |
| 1106 | * @ge: Group Entity specific Entity properties. | 1182 | * @ge: Group Entity specific Entity properties. |
| 1107 | * @hide: HIDE Entity specific Entity properties. | 1183 | * @hide: HIDE Entity specific Entity properties. |
| 1184 | * @xu: XU Entity specific Entity properties. | ||
| 1108 | */ | 1185 | */ |
| 1109 | struct sdca_entity { | 1186 | struct sdca_entity { |
| 1110 | const char *label; | 1187 | const char *label; |
| @@ -1122,6 +1199,7 @@ struct sdca_entity { · 11 unmodified lines | |||
| 1122 | struct sdca_entity_pde pde; | 1199 | struct sdca_entity_pde pde; |
| 1123 | struct sdca_entity_ge ge; | 1200 | struct sdca_entity_ge ge; |
| 1124 | struct sdca_entity_hide hide; | 1201 | struct sdca_entity_hide hide; |
| 1202 | struct sdca_entity_xu xu; | ||
| 1125 | }; | 1203 | }; |
| 1126 | }; | 1204 | }; |
| 1127 | 1205 | ||
| @@ -1288,6 +1366,42 @@ enum sdca_cluster_range { · 160 unmodified lines | |||
| 1288 | SDCA_CLUSTER_NCOLS = 2, | 1366 | SDCA_CLUSTER_NCOLS = 2, |
| 1289 | }; | 1367 | }; |
| 1290 | 1368 | ||
| 1369 | /** | ||
| 1370 | * struct sdca_fdl_file - information about a file from a fileset used in FDL | ||
| 1371 | * @vendor_id: Vendor ID of the file. | ||
| 1372 | * @file_id: File ID of the file. | ||
| 1373 | * @fdl_offset: Offset information for FDL. | ||
| 1374 | */ | ||
| 1375 | struct sdca_fdl_file { | ||
| 1376 | u16 vendor_id; | ||
| 1377 | u32 file_id; | ||
| 1378 | u32 fdl_offset; | ||
| 1379 | }; | ||
| 1380 | |||
| 1381 | /** | ||
| 1382 | * struct sdca_fdl_set - information about a set of files used in FDL | ||
| 1383 | * @files: Array of files in this FDL set. | ||
| 1384 | * @num_files: Number of files in this FDL set. | ||
| 1385 | * @id: ID of the FDL set. | ||
| 1386 | */ | ||
| 1387 | struct sdca_fdl_set { | ||
| 1388 | struct sdca_fdl_file *files; | ||
| 1389 | int num_files; | ||
| 1390 | u32 id; | ||
| 1391 | }; | ||
| 1392 | |||
| 1393 | /** | ||
| 1394 | * struct sdca_fdl_data - information about a function's FDL data | ||
| 1395 | * @swft: Pointer to the SoundWire File Table. | ||
| 1396 | * @sets: Array of FDL sets used by this function. | ||
| 1397 | * @num_sets: Number of FDL sets used by this function. | ||
| 1398 | */ | ||
| 1399 | struct sdca_fdl_data { | ||
| 1400 | struct acpi_table_swft *swft; | ||
| 1401 | struct sdca_fdl_set *sets; | ||
| 1402 | int num_sets; | ||
| 1403 | }; | ||
| 1404 | |||
| 1291 | /** | 1405 | /** |
| 1292 | * struct sdca_function_data - top-level information for one SDCA function | 1406 | * struct sdca_function_data - top-level information for one SDCA function |
| 1293 | * @desc: Pointer to short descriptor from initial parsing. | 1407 | * @desc: Pointer to short descriptor from initial parsing. |
| @@ -1299,6 +1413,9 @@ enum sdca_cluster_range { · 5 unmodified lines | |||
| 1299 | * @num_clusters: Number of Channel Clusters reported in this Function. | 1413 | * @num_clusters: Number of Channel Clusters reported in this Function. |
| 1300 | * @busy_max_delay: Maximum Function busy delay in microseconds, before an | 1414 | * @busy_max_delay: Maximum Function busy delay in microseconds, before an |
| 1301 | * error should be reported. | 1415 | * error should be reported. |
| 1416 | * @reset_max_delay: Maximum Function reset delay in microseconds, before an | ||
| 1417 | * error should be reported. | ||
| 1418 | * @fdl_data: FDL data for this Function, if available. | ||
| 1302 | */ | 1419 | */ |
| 1303 | struct sdca_function_data { | 1420 | struct sdca_function_data { |
| 1304 | struct sdca_function_desc *desc; | 1421 | struct sdca_function_desc *desc; |
| @@ -1311,6 +1428,9 @@ struct sdca_function_data { · 6 unmodified lines | |||
| 1311 | int num_clusters; | 1428 | int num_clusters; |
| 1312 | 1429 | ||
| 1313 | unsigned int busy_max_delay; | 1430 | unsigned int busy_max_delay; |
| 1431 | unsigned int reset_max_delay; | ||
| 1432 | |||
| 1433 | struct sdca_fdl_data fdl_data; | ||
| 1314 | }; | 1434 | }; |
| 1315 | 1435 | ||
| 1316 | static inline u32 sdca_range(struct sdca_control_range *range, | 1436 | static inline u32 sdca_range(struct sdca_control_range *range, |
| @@ -1332,10 +1452,12 @@ static inline u32 sdca_range_search(struct sdca_control_range *range, · 15 unmodified lines | |||
| 1332 | return 0; | 1452 | return 0; |
| 1333 | } | 1453 | } |
| 1334 | 1454 | ||
| 1335 | int sdca_parse_function(struct device *dev, | 1455 | int sdca_parse_function(struct device *dev, struct sdw_slave *sdw, |
| 1336 | struct sdca_function_desc *desc, | 1456 | struct sdca_function_desc *desc, |
| 1337 | struct sdca_function_data *function); | 1457 | struct sdca_function_data *function); |
| 1338 | 1458 | ||
| 1459 | const char *sdca_find_terminal_name(enum sdca_terminal_type type); | ||
| 1460 | |||
| 1339 | struct sdca_control *sdca_selector_find_control(struct device *dev, | 1461 | struct sdca_control *sdca_selector_find_control(struct device *dev, |
| 1340 | struct sdca_entity *entity, | 1462 | struct sdca_entity *entity, |
| 1341 | const int sel); | 1463 | const int sel); |
| @@ -8,14 +8,27 @@ · 7 unmodified lines | |||
| 8 | #ifndef __SDCA_HID_H__ | 8 | #ifndef __SDCA_HID_H__ |
| 9 | #define __SDCA_HID_H__ | 9 | #define __SDCA_HID_H__ |
| 10 | 10 | ||
| 11 | #include <linux/types.h> | 11 | struct device; |
| 12 | #include <linux/hid.h> | 12 | struct sdw_slave; |
| 13 | |||
| 14 | struct sdca_entity; | ||
| 15 | struct sdca_interrupt; | ||
| 13 | 16 | ||
| 14 | #if IS_ENABLED(CONFIG_SND_SOC_SDCA_HID) | 17 | #if IS_ENABLED(CONFIG_SND_SOC_SDCA_HID) |
| 15 | int sdca_add_hid_device(struct device *dev, struct sdca_entity *entity); | 18 | |
| 19 | int sdca_add_hid_device(struct device *dev, struct sdw_slave *sdw, | ||
| 20 | struct sdca_entity *entity); | ||
| 21 | int sdca_hid_process_report(struct sdca_interrupt *interrupt); | ||
| 16 | 22 | ||
| 17 | #else | 23 | #else |
| 18 | static inline int sdca_add_hid_device(struct device *dev, struct sdca_entity *entity) | 24 | |
| 25 | static inline int sdca_add_hid_device(struct device *dev, struct sdw_slave *sdw, | ||
| 26 | struct sdca_entity *entity) | ||
| 27 | { | ||
| 28 | return 0; | ||
| 29 | } | ||
| 30 | |||
| 31 | static inline int sdca_hid_process_report(struct sdca_interrupt *interrupt) | ||
| 19 | { | 32 | { |
| 20 | return 0; | 33 | return 0; |
| 21 | } | 34 | } |
| @@ -23,18 +23,23 @@ struct sdca_function_data; · 22 unmodified lines | |||
| 23 | /** | 23 | /** |
| 24 | * struct sdca_interrupt - contains information about a single SDCA interrupt | 24 | * struct sdca_interrupt - contains information about a single SDCA interrupt |
| 25 | * @name: The name of the interrupt. | 25 | * @name: The name of the interrupt. |
| 26 | * @dev: Pointer to the Function device. | ||
| 27 | * @device_regmap: Pointer to the IRQ regmap. | ||
| 28 | * @function_regmap: Pointer to the SDCA Function regmap. | ||
| 26 | * @component: Pointer to the ASoC component owns the interrupt. | 29 | * @component: Pointer to the ASoC component owns the interrupt. |
| 27 | * @function: Pointer to the Function that the interrupt is associated with. | 30 | * @function: Pointer to the Function that the interrupt is associated with. |
| 28 | * @entity: Pointer to the Entity that the interrupt is associated with. | 31 | * @entity: Pointer to the Entity that the interrupt is associated with. |
| 29 | * @control: Pointer to the Control that the interrupt is associated with. | 32 | * @control: Pointer to the Control that the interrupt is associated with. |
| 30 | * @priv: Pointer to private data for use by the handler. | 33 | * @priv: Pointer to private data for use by the handler. |
| 31 | * @externally_requested: Internal flag used to check if a client driver has | 34 | * @irq: IRQ number allocated to this interrupt, also used internally to track |
| 32 | * already requested the interrupt, for custom handling, allowing the core to | 35 | * the IRQ being assigned. |
| 33 | * skip handling this interrupt. | ||
| 34 | */ | 36 | */ |
| 35 | struct sdca_interrupt { | 37 | struct sdca_interrupt { |
| 36 | const char *name; | 38 | const char *name; |
| 37 | 39 | ||
| 40 | struct device *dev; | ||
| 41 | struct regmap *device_regmap; | ||
| 42 | struct regmap *function_regmap; | ||
| 38 | struct snd_soc_component *component; | 43 | struct snd_soc_component *component; |
| 39 | struct sdca_function_data *function; | 44 | struct sdca_function_data *function; |
| 40 | struct sdca_entity *entity; | 45 | struct sdca_entity *entity; |
| @@ -42,7 +47,7 @@ struct sdca_interrupt { · 1 unmodified line | |||
| 42 | 47 | ||
| 43 | void *priv; | 48 | void *priv; |
| 44 | 49 | ||
| 45 | bool externally_requested; | 50 | int irq; |
| 46 | }; | 51 | }; |
| 47 | 52 | ||
| 48 | /** | 53 | /** |
| @@ -64,11 +69,15 @@ struct sdca_interrupt_info { · 15 unmodified lines | |||
| 64 | int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *interrupt_info, | 69 | int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *interrupt_info, |
| 65 | int sdca_irq, const char *name, irq_handler_t handler, | 70 | int sdca_irq, const char *name, irq_handler_t handler, |
| 66 | void *data); | 71 | void *data); |
| 67 | int sdca_irq_data_populate(struct snd_soc_component *component, | 72 | int sdca_irq_data_populate(struct device *dev, struct regmap *function_regmap, |
| 73 | struct snd_soc_component *component, | ||
| 68 | struct sdca_function_data *function, | 74 | struct sdca_function_data *function, |
| 69 | struct sdca_entity *entity, | 75 | struct sdca_entity *entity, |
| 70 | struct sdca_control *control, | 76 | struct sdca_control *control, |
| 71 | struct sdca_interrupt *interrupt); | 77 | struct sdca_interrupt *interrupt); |
| 78 | int sdca_irq_populate_early(struct device *dev, struct regmap *function_regmap, | ||
| 79 | struct sdca_function_data *function, | ||
| 80 | struct sdca_interrupt_info *info); | ||
| 72 | int sdca_irq_populate(struct sdca_function_data *function, | 81 | int sdca_irq_populate(struct sdca_function_data *function, |
| 73 | struct snd_soc_component *component, | 82 | struct snd_soc_component *component, |
| 74 | struct sdca_interrupt_info *info); | 83 | struct sdca_interrupt_info *info); |
| @@ -27,5 +27,7 @@ int sdca_regmap_populate_constants(struct device *dev, struct sdca_function_data · 26 unmodified lines | |||
| 27 | 27 | ||
| 28 | int sdca_regmap_write_defaults(struct device *dev, struct regmap *regmap, | 28 | int sdca_regmap_write_defaults(struct device *dev, struct regmap *regmap, |
| 29 | struct sdca_function_data *function); | 29 | struct sdca_function_data *function); |
| 30 | int sdca_regmap_write_init(struct device *dev, struct regmap *regmap, | ||
| 31 | struct sdca_function_data *function); | ||
| 30 | 32 | ||
| 31 | #endif // __SDCA_REGMAP_H__ | 33 | #endif // __SDCA_REGMAP_H__ |
| @@ -0,0 +1,50 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | /* | ||
| 3 | * The MIPI SDCA specification is available for public downloads at | ||
| 4 | * https://www.mipi.org/mipi-sdca-v1-0-download | ||
| 5 | * | ||
| 6 | * Copyright (C) 2025 Cirrus Logic, Inc. and | ||
| 7 | * Cirrus Logic International Semiconductor Ltd. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #ifndef __SDCA_UMP_H__ | ||
| 11 | #define __SDCA_UMP_H__ | ||
| 12 | |||
| 13 | struct regmap; | ||
| 14 | struct sdca_control; | ||
| 15 | struct sdca_entity; | ||
| 16 | struct sdca_function_data; | ||
| 17 | struct snd_soc_component; | ||
| 18 | struct delayed_work; | ||
| 19 | |||
| 20 | int sdca_ump_get_owner_host(struct device *dev, | ||
| 21 | struct regmap *function_regmap, | ||
| 22 | struct sdca_function_data *function, | ||
| 23 | struct sdca_entity *entity, | ||
| 24 | struct sdca_control *control); | ||
| 25 | int sdca_ump_set_owner_device(struct device *dev, | ||
| 26 | struct regmap *function_regmap, | ||
| 27 | struct sdca_function_data *function, | ||
| 28 | struct sdca_entity *entity, | ||
| 29 | struct sdca_control *control); | ||
| 30 | int sdca_ump_read_message(struct device *dev, | ||
| 31 | struct regmap *device_regmap, | ||
| 32 | struct regmap *function_regmap, | ||
| 33 | struct sdca_function_data *function, | ||
| 34 | struct sdca_entity *entity, | ||
| 35 | unsigned int offset_sel, unsigned int length_sel, | ||
| 36 | void **msg); | ||
| 37 | int sdca_ump_write_message(struct device *dev, | ||
| 38 | struct regmap *device_regmap, | ||
| 39 | struct regmap *function_regmap, | ||
| 40 | struct sdca_function_data *function, | ||
| 41 | struct sdca_entity *entity, | ||
| 42 | unsigned int offset_sel, unsigned int msg_offset, | ||
| 43 | unsigned int length_sel, | ||
| 44 | void *msg, int msg_len); | ||
| 45 | |||
| 46 | void sdca_ump_cancel_timeout(struct delayed_work *work); | ||
| 47 | void sdca_ump_schedule_timeout(struct delayed_work *work, | ||
| 48 | unsigned int timeout_us); | ||
| 49 | |||
| 50 | #endif // __SDCA_UMP_H__ | ||
| @@ -34,6 +34,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[]; · 33 unmodified lines | |||
| 34 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[]; | 34 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[]; |
| 35 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[]; | 35 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[]; |
| 36 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[]; | 36 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_machines[]; |
| 37 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_machines[]; | ||
| 37 | 38 | ||
| 38 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[]; | 39 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_sdw_machines[]; |
| 39 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_sdw_machines[]; | 40 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cfl_sdw_machines[]; |
| @@ -46,6 +47,7 @@ extern struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[]; · 6 unmodified lines | |||
| 46 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[]; | 47 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[]; |
| 47 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[]; | 48 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[]; |
| 48 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[]; | 49 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[]; |
| 50 | extern struct snd_soc_acpi_mach snd_soc_acpi_intel_nvl_sdw_machines[]; | ||
| 49 | 51 | ||
| 50 | /* | 52 | /* |
| 51 | * generic table used for HDA codec-based platforms, possibly with | 53 | * generic table used for HDA codec-based platforms, possibly with |
| @@ -114,8 +114,8 @@ struct snd_soc_acpi_endpoint { · 113 unmodified lines | |||
| 114 | * @name_prefix: string used for codec controls | 114 | * @name_prefix: string used for codec controls |
| 115 | */ | 115 | */ |
| 116 | struct snd_soc_acpi_adr_device { | 116 | struct snd_soc_acpi_adr_device { |
| 117 | const u64 adr; | 117 | u64 adr; |
| 118 | const u8 num_endpoints; | 118 | u8 num_endpoints; |
| 119 | const struct snd_soc_acpi_endpoint *endpoints; | 119 | const struct snd_soc_acpi_endpoint *endpoints; |
| 120 | const char *name_prefix; | 120 | const char *name_prefix; |
| 121 | }; | 121 | }; |
| @@ -131,8 +131,8 @@ struct snd_soc_acpi_adr_device { · 9 unmodified lines | |||
| 131 | */ | 131 | */ |
| 132 | 132 | ||
| 133 | struct snd_soc_acpi_link_adr { | 133 | struct snd_soc_acpi_link_adr { |
| 134 | const u32 mask; | 134 | u32 mask; |
| 135 | const u32 num_adr; | 135 | u32 num_adr; |
| 136 | const struct snd_soc_acpi_adr_device *adr_d; | 136 | const struct snd_soc_acpi_adr_device *adr_d; |
| 137 | }; | 137 | }; |
| 138 | 138 | ||
| @@ -319,6 +319,13 @@ struct platform_device; · 318 unmodified lines | |||
| 319 | #define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \ | 319 | #define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \ |
| 320 | SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) | 320 | SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) |
| 321 | 321 | ||
| 322 | #define SOC_ENUM_EXT_ACC(xname, xenum, xhandler_get, xhandler_put, xaccess) \ | ||
| 323 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
| 324 | .access = xaccess, \ | ||
| 325 | .info = snd_soc_info_enum_double, \ | ||
| 326 | .get = xhandler_get, .put = xhandler_put, \ | ||
| 327 | .private_value = (unsigned long)&xenum } | ||
| 328 | |||
| 322 | #define SND_SOC_BYTES(xname, xbase, xregs) \ | 329 | #define SND_SOC_BYTES(xname, xbase, xregs) \ |
| 323 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 330 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 324 | .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ | 331 | .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ |
| @@ -331,6 +338,13 @@ struct platform_device; · 6 unmodified lines | |||
| 331 | .put = xhandler_put, .private_value = \ | 338 | .put = xhandler_put, .private_value = \ |
| 332 | ((unsigned long)&(struct soc_bytes) \ | 339 | ((unsigned long)&(struct soc_bytes) \ |
| 333 | {.base = xbase, .num_regs = xregs }) } | 340 | {.base = xbase, .num_regs = xregs }) } |
| 341 | #define SND_SOC_BYTES_E_ACC(xname, xbase, xregs, xhandler_get, xhandler_put, xaccess) \ | ||
| 342 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
| 343 | .access = xaccess, \ | ||
| 344 | .info = snd_soc_bytes_info, .get = xhandler_get, \ | ||
| 345 | .put = xhandler_put, .private_value = \ | ||
| 346 | ((unsigned long)&(struct soc_bytes) \ | ||
| 347 | {.base = xbase, .num_regs = xregs }) } | ||
| 334 | 348 | ||
| 335 | #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \ | 349 | #define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \ |
| 336 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 350 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| @@ -1225,6 +1239,7 @@ struct soc_mixer_control { · 888 unmodified lines | |||
| 1225 | unsigned int sign_bit; | 1239 | unsigned int sign_bit; |
| 1226 | unsigned int invert:1; | 1240 | unsigned int invert:1; |
| 1227 | unsigned int autodisable:1; | 1241 | unsigned int autodisable:1; |
| 1242 | unsigned int sdca_q78:1; | ||
| 1228 | #ifdef CONFIG_SND_SOC_TOPOLOGY | 1243 | #ifdef CONFIG_SND_SOC_TOPOLOGY |
| 1229 | struct snd_soc_dobj dobj; | 1244 | struct snd_soc_dobj dobj; |
| 1230 | #endif | 1245 | #endif |
| @@ -1305,22 +1320,6 @@ static inline unsigned int snd_soc_enum_item_to_val(const struct soc_enum *e, · 74 unmodified lines | |||
| 1305 | return e->values[item]; | 1320 | return e->values[item]; |
| 1306 | } | 1321 | } |
| 1307 | 1322 | ||
| 1308 | /** | ||
| 1309 | * snd_soc_kcontrol_component() - Returns the component that registered the | ||
| 1310 | * control | ||
| 1311 | * @kcontrol: The control for which to get the component | ||
| 1312 | * | ||
| 1313 | * Note: This function will work correctly if the control has been registered | ||
| 1314 | * for a component. With snd_soc_add_codec_controls() or via table based | ||
| 1315 | * setup for either a CODEC or component driver. Otherwise the behavior is | ||
| 1316 | * undefined. | ||
| 1317 | */ | ||
| 1318 | static inline struct snd_soc_component *snd_soc_kcontrol_component( | ||
| 1319 | struct snd_kcontrol *kcontrol) | ||
| 1320 | { | ||
| 1321 | return snd_kcontrol_chip(kcontrol); | ||
| 1322 | } | ||
| 1323 | |||
| 1324 | int snd_soc_util_init(void); | 1323 | int snd_soc_util_init(void); |
| 1325 | void snd_soc_util_exit(void); | 1324 | void snd_soc_util_exit(void); |
| 1326 | 1325 | ||
| @@ -1482,22 +1481,22 @@ static inline void _snd_soc_dapm_mutex_assert_held_c(struct snd_soc_card *card) · 155 unmodified lines | |||
| 1482 | 1481 | ||
| 1483 | static inline void _snd_soc_dapm_mutex_lock_root_d(struct snd_soc_dapm_context *dapm) | 1482 | static inline void _snd_soc_dapm_mutex_lock_root_d(struct snd_soc_dapm_context *dapm) |
| 1484 | { | 1483 | { |
| 1485 | _snd_soc_dapm_mutex_lock_root_c(dapm->card); | 1484 | _snd_soc_dapm_mutex_lock_root_c(snd_soc_dapm_to_card(dapm)); |
| 1486 | } | 1485 | } |
| 1487 | 1486 | ||
| 1488 | static inline void _snd_soc_dapm_mutex_lock_d(struct snd_soc_dapm_context *dapm) | 1487 | static inline void _snd_soc_dapm_mutex_lock_d(struct snd_soc_dapm_context *dapm) |
| 1489 | { | 1488 | { |
| 1490 | _snd_soc_dapm_mutex_lock_c(dapm->card); | 1489 | _snd_soc_dapm_mutex_lock_c(snd_soc_dapm_to_card(dapm)); |
| 1491 | } | 1490 | } |
| 1492 | 1491 | ||
| 1493 | static inline void _snd_soc_dapm_mutex_unlock_d(struct snd_soc_dapm_context *dapm) | 1492 | static inline void _snd_soc_dapm_mutex_unlock_d(struct snd_soc_dapm_context *dapm) |
| 1494 | { | 1493 | { |
| 1495 | _snd_soc_dapm_mutex_unlock_c(dapm->card); | 1494 | _snd_soc_dapm_mutex_unlock_c(snd_soc_dapm_to_card(dapm)); |
| 1496 | } | 1495 | } |
| 1497 | 1496 | ||
| 1498 | static inline void _snd_soc_dapm_mutex_assert_held_d(struct snd_soc_dapm_context *dapm) | 1497 | static inline void _snd_soc_dapm_mutex_assert_held_d(struct snd_soc_dapm_context *dapm) |
| 1499 | { | 1498 | { |
| 1500 | _snd_soc_dapm_mutex_assert_held_c(dapm->card); | 1499 | _snd_soc_dapm_mutex_assert_held_c(snd_soc_dapm_to_card(dapm)); |
| 1501 | } | 1500 | } |
| 1502 | 1501 | ||
| 1503 | #define snd_soc_dapm_mutex_lock_root(x) _Generic((x), \ | 1502 | #define snd_soc_dapm_mutex_lock_root(x) _Generic((x), \ |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <sound/soc-acpi.h> | 13 | #include <sound/soc-acpi.h> |
| 14 | 14 | ||
| 15 | #define SOC_SDW_MAX_DAI_NUM 8 | 15 | #define SOC_SDW_MAX_DAI_NUM 8 |
| 16 | #define SOC_SDW_MAX_AUX_NUM 2 | ||
| 16 | #define SOC_SDW_MAX_NO_PROPS 2 | 17 | #define SOC_SDW_MAX_NO_PROPS 2 |
| 17 | #define SOC_SDW_JACK_JDSRC(quirk) ((quirk) & GENMASK(3, 0)) | 18 | #define SOC_SDW_JACK_JDSRC(quirk) ((quirk) & GENMASK(3, 0)) |
| 18 | 19 | ||
| @@ -45,6 +46,7 @@ struct asoc_sdw_codec_info; · 26 unmodified lines | |||
| 45 | 46 | ||
| 46 | struct asoc_sdw_dai_info { | 47 | struct asoc_sdw_dai_info { |
| 47 | const bool direction[2]; /* playback & capture support */ | 48 | const bool direction[2]; /* playback & capture support */ |
| 49 | const char *codec_name; | ||
| 48 | const char *dai_name; | 50 | const char *dai_name; |
| 49 | const char *component_name; | 51 | const char *component_name; |
| 50 | const int dai_type; | 52 | const int dai_type; |
| @@ -64,16 +66,22 @@ struct asoc_sdw_dai_info { · 13 unmodified lines | |||
| 64 | bool quirk_exclude; | 66 | bool quirk_exclude; |
| 65 | }; | 67 | }; |
| 66 | 68 | ||
| 69 | struct asoc_sdw_aux_info { | ||
| 70 | const char *codec_name; | ||
| 71 | }; | ||
| 72 | |||
| 67 | struct asoc_sdw_codec_info { | 73 | struct asoc_sdw_codec_info { |
| 68 | const int part_id; | 74 | const int part_id; |
| 69 | const int version_id; | 75 | const int version_id; |
| 70 | const char *codec_name; | 76 | const char *name_prefix; |
| 71 | int amp_num; | 77 | int amp_num; |
| 72 | const u8 acpi_id[ACPI_ID_LEN]; | 78 | const u8 acpi_id[ACPI_ID_LEN]; |
| 73 | const bool ignore_internal_dmic; | 79 | const bool ignore_internal_dmic; |
| 74 | const struct snd_soc_ops *ops; | 80 | const struct snd_soc_ops *ops; |
| 75 | struct asoc_sdw_dai_info dais[SOC_SDW_MAX_DAI_NUM]; | 81 | struct asoc_sdw_dai_info dais[SOC_SDW_MAX_DAI_NUM]; |
| 76 | const int dai_num; | 82 | const int dai_num; |
| 83 | struct asoc_sdw_aux_info auxs[SOC_SDW_MAX_AUX_NUM]; | ||
| 84 | const int aux_num; | ||
| 77 | 85 | ||
| 78 | int (*codec_card_late_probe)(struct snd_soc_card *card); | 86 | int (*codec_card_late_probe)(struct snd_soc_card *card); |
| 79 | 87 | ||
| @@ -130,7 +138,7 @@ int asoc_sdw_hw_free(struct snd_pcm_substream *substream); · 50 unmodified lines | |||
| 130 | void asoc_sdw_shutdown(struct snd_pcm_substream *substream); | 138 | void asoc_sdw_shutdown(struct snd_pcm_substream *substream); |
| 131 | 139 | ||
| 132 | const char *asoc_sdw_get_codec_name(struct device *dev, | 140 | const char *asoc_sdw_get_codec_name(struct device *dev, |
| 133 | const struct asoc_sdw_codec_info *codec_info, | 141 | const struct asoc_sdw_dai_info *dai_info, |
| 134 | const struct snd_soc_acpi_link_adr *adr_link, | 142 | const struct snd_soc_acpi_link_adr *adr_link, |
| 135 | int adr_index); | 143 | int adr_index); |
| 136 | 144 | ||
| @@ -164,12 +172,15 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, struct snd_soc_dai_link *d · 27 unmodified lines | |||
| 164 | int no_pcm, int (*init)(struct snd_soc_pcm_runtime *rtd), | 172 | int no_pcm, int (*init)(struct snd_soc_pcm_runtime *rtd), |
| 165 | const struct snd_soc_ops *ops); | 173 | const struct snd_soc_ops *ops); |
| 166 | 174 | ||
| 167 | int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int *num_ends); | 175 | int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, |
| 176 | int *num_devs, int *num_ends, int *num_aux); | ||
| 168 | 177 | ||
| 169 | struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks, | 178 | struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks, |
| 170 | const struct snd_soc_acpi_endpoint *new); | 179 | const struct snd_soc_acpi_endpoint *new); |
| 180 | int asoc_sdw_get_dai_type(u32 type); | ||
| 171 | 181 | ||
| 172 | int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, | 182 | int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, |
| 183 | struct snd_soc_aux_dev *soc_aux, | ||
| 173 | struct asoc_sdw_dailink *soc_dais, | 184 | struct asoc_sdw_dailink *soc_dais, |
| 174 | struct asoc_sdw_endpoint *soc_ends, | 185 | struct asoc_sdw_endpoint *soc_ends, |
| 175 | int *num_devs); | 186 | int *num_devs); |
| @@ -246,6 +257,8 @@ int asoc_sdw_cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_da · 70 unmodified lines | |||
| 246 | int asoc_sdw_cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | 257 | int asoc_sdw_cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); |
| 247 | int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | 258 | int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); |
| 248 | int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | 259 | int asoc_sdw_cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); |
| 260 | int asoc_sdw_cs42l45_hs_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | ||
| 261 | int asoc_sdw_cs42l45_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | ||
| 249 | int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | 262 | int asoc_sdw_cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); |
| 250 | int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); | 263 | int asoc_sdw_maxim_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai *dai); |
| 251 | /* TI */ | 264 | /* TI */ |
| @@ -117,14 +117,20 @@ enum audio_device { · 116 unmodified lines | |||
| 117 | TAS2120, | 117 | TAS2120, |
| 118 | TAS2320, | 118 | TAS2320, |
| 119 | TAS2563, | 119 | TAS2563, |
| 120 | TAS2568, | ||
| 120 | TAS2570, | 121 | TAS2570, |
| 121 | TAS2572, | 122 | TAS2572, |
| 123 | TAS2574, | ||
| 122 | TAS2781, | 124 | TAS2781, |
| 123 | TAS5802, | 125 | TAS5802, |
| 126 | TAS5806M, | ||
| 127 | TAS5806MD, | ||
| 124 | TAS5815, | 128 | TAS5815, |
| 129 | TAS5822, | ||
| 125 | TAS5825, | 130 | TAS5825, |
| 126 | TAS5827, | 131 | TAS5827, |
| 127 | TAS5828, | 132 | TAS5828, |
| 133 | TAS5830, | ||
| 128 | TAS_OTHERS, | 134 | TAS_OTHERS, |
| 129 | }; | 135 | }; |
| 130 | 136 | ||
| @@ -197,7 +203,6 @@ struct tasdevice_priv { · 66 unmodified lines | |||
| 197 | struct acoustic_data acou_data; | 203 | struct acoustic_data acou_data; |
| 198 | #endif | 204 | #endif |
| 199 | struct tasdevice_fw *fmw; | 205 | struct tasdevice_fw *fmw; |
| 200 | struct gpio_desc *speaker_id; | ||
| 201 | struct gpio_desc *reset; | 206 | struct gpio_desc *reset; |
| 202 | struct mutex codec_lock; | 207 | struct mutex codec_lock; |
| 203 | struct regmap *regmap; | 208 | struct regmap *regmap; |
| @@ -215,6 +220,7 @@ struct tasdevice_priv { · 11 unmodified lines | |||
| 215 | unsigned int magic_num; | 220 | unsigned int magic_num; |
| 216 | unsigned int chip_id; | 221 | unsigned int chip_id; |
| 217 | unsigned int sysclk; | 222 | unsigned int sysclk; |
| 223 | int speaker_id; | ||
| 218 | 224 | ||
| 219 | int irq; | 225 | int irq; |
| 220 | int cur_prog; | 226 | int cur_prog; |
| @@ -27,8 +27,8 @@ DECLARE_EVENT_CLASS(snd_soc_dapm, · 26 unmodified lines | |||
| 27 | TP_ARGS(dapm, val), | 27 | TP_ARGS(dapm, val), |
| 28 | 28 | ||
| 29 | TP_STRUCT__entry( | 29 | TP_STRUCT__entry( |
| 30 | __string( card_name, dapm->card->name) | 30 | __string( card_name, snd_soc_dapm_to_card(dapm)->name) |
| 31 | __string( comp_name, dapm->component ? dapm->component->name : "(none)") | 31 | __string( comp_name, snd_soc_dapm_to_component(dapm) ? snd_soc_dapm_to_component(dapm)->name : "(none)") |
| 32 | __field( int, val) | 32 | __field( int, val) |
| 33 | ), | 33 | ), |
| 34 | 34 | ||
| @@ -21,6 +21,7 @@ enum avs_tplg_token { · 20 unmodified lines | |||
| 21 | AVS_TKN_MANIFEST_NUM_BINDINGS_U32 = 8, | 21 | AVS_TKN_MANIFEST_NUM_BINDINGS_U32 = 8, |
| 22 | AVS_TKN_MANIFEST_NUM_CONDPATH_TMPLS_U32 = 9, | 22 | AVS_TKN_MANIFEST_NUM_CONDPATH_TMPLS_U32 = 9, |
| 23 | AVS_TKN_MANIFEST_NUM_INIT_CONFIGS_U32 = 10, | 23 | AVS_TKN_MANIFEST_NUM_INIT_CONFIGS_U32 = 10, |
| 24 | AVS_TKN_MANIFEST_NUM_NHLT_CONFIGS_U32 = 11, | ||
| 24 | 25 | ||
| 25 | /* struct avs_tplg_library */ | 26 | /* struct avs_tplg_library */ |
| 26 | AVS_TKN_LIBRARY_ID_U32 = 101, | 27 | AVS_TKN_LIBRARY_ID_U32 = 101, |
| @@ -124,6 +125,7 @@ enum avs_tplg_token { · 97 unmodified lines | |||
| 124 | AVS_TKN_MOD_KCONTROL_ID_U32 = 1707, | 125 | AVS_TKN_MOD_KCONTROL_ID_U32 = 1707, |
| 125 | AVS_TKN_MOD_INIT_CONFIG_NUM_IDS_U32 = 1708, | 126 | AVS_TKN_MOD_INIT_CONFIG_NUM_IDS_U32 = 1708, |
| 126 | AVS_TKN_MOD_INIT_CONFIG_ID_U32 = 1709, | 127 | AVS_TKN_MOD_INIT_CONFIG_ID_U32 = 1709, |
| 128 | AVS_TKN_MOD_NHLT_CONFIG_ID_U32 = 1710, | ||
| 127 | 129 | ||
| 128 | /* struct avs_tplg_path_template */ | 130 | /* struct avs_tplg_path_template */ |
| 129 | AVS_TKN_PATH_TMPL_ID_U32 = 1801, | 131 | AVS_TKN_PATH_TMPL_ID_U32 = 1801, |
| @@ -160,6 +162,10 @@ enum avs_tplg_token { · 30 unmodified lines | |||
| 160 | AVS_TKN_INIT_CONFIG_ID_U32 = 2401, | 162 | AVS_TKN_INIT_CONFIG_ID_U32 = 2401, |
| 161 | AVS_TKN_INIT_CONFIG_PARAM_U8 = 2402, | 163 | AVS_TKN_INIT_CONFIG_PARAM_U8 = 2402, |
| 162 | AVS_TKN_INIT_CONFIG_LENGTH_U32 = 2403, | 164 | AVS_TKN_INIT_CONFIG_LENGTH_U32 = 2403, |
| 165 | |||
| 166 | /* struct avs_tplg_nhlt_config */ | ||
| 167 | AVS_TKN_NHLT_CONFIG_ID_U32 = 2501, | ||
| 168 | AVS_TKN_NHLT_CONFIG_SIZE_U32 = 2502, | ||
| 163 | }; | 169 | }; |
| 164 | 170 | ||
| 165 | #endif | 171 | #endif |
| @@ -602,6 +602,18 @@ static void string_test_memtostr(struct kunit *test) · 601 unmodified lines | |||
| 602 | KUNIT_EXPECT_EQ(test, dest[7], '\0'); | 602 | KUNIT_EXPECT_EQ(test, dest[7], '\0'); |
| 603 | } | 603 | } |
| 604 | 604 | ||
| 605 | static void string_test_strends(struct kunit *test) | ||
| 606 | { | ||
| 607 | KUNIT_EXPECT_TRUE(test, strends("foo-bar", "bar")); | ||
| 608 | KUNIT_EXPECT_TRUE(test, strends("foo-bar", "-bar")); | ||
| 609 | KUNIT_EXPECT_TRUE(test, strends("foobar", "foobar")); | ||
| 610 | KUNIT_EXPECT_TRUE(test, strends("foobar", "")); | ||
| 611 | KUNIT_EXPECT_FALSE(test, strends("bar", "foobar")); | ||
| 612 | KUNIT_EXPECT_FALSE(test, strends("", "foo")); | ||
| 613 | KUNIT_EXPECT_FALSE(test, strends("foobar", "ba")); | ||
| 614 | KUNIT_EXPECT_TRUE(test, strends("", "")); | ||
| 615 | } | ||
| 616 | |||
| 605 | static struct kunit_case string_test_cases[] = { | 617 | static struct kunit_case string_test_cases[] = { |
| 606 | KUNIT_CASE(string_test_memset16), | 618 | KUNIT_CASE(string_test_memset16), |
| 607 | KUNIT_CASE(string_test_memset32), | 619 | KUNIT_CASE(string_test_memset32), |
| @@ -623,6 +635,7 @@ static struct kunit_case string_test_cases[] = { · 15 unmodified lines | |||
| 623 | KUNIT_CASE(string_test_strlcat), | 635 | KUNIT_CASE(string_test_strlcat), |
| 624 | KUNIT_CASE(string_test_strtomem), | 636 | KUNIT_CASE(string_test_strtomem), |
| 625 | KUNIT_CASE(string_test_memtostr), | 637 | KUNIT_CASE(string_test_memtostr), |
| 638 | KUNIT_CASE(string_test_strends), | ||
| 626 | {} | 639 | {} |
| 627 | }; | 640 | }; |
| 628 | 641 | ||
| @@ -46,11 +46,14 @@ static bool snd_ac97_check_id(struct snd_ac97 *ac97, unsigned int id, · 45 unmodified lines | |||
| 46 | * @id_mask: Mask that is applied to the device ID before comparing to @id | 46 | * @id_mask: Mask that is applied to the device ID before comparing to @id |
| 47 | * | 47 | * |
| 48 | * This function resets the AC'97 device. If @try_warm is true the function | 48 | * This function resets the AC'97 device. If @try_warm is true the function |
| 49 | * first performs a warm reset. If the warm reset is successful the function | 49 | * first performs a warm reset. If @try_warm is false the function issues |
| 50 | * returns 1. Otherwise or if @try_warm is false the function issues cold reset | 50 | * cold reset followed by a warm reset. If @id is 0 any valid device ID |
| 51 | * followed by a warm reset. If this is successful the function returns 0, | 51 | * will be accepted, otherwise only the ID that matches @id and @id_mask |
| 52 | * otherwise a negative error code. If @id is 0 any valid device ID will be | 52 | * is accepted. |
| 53 | * accepted, otherwise only the ID that matches @id and @id_mask is accepted. | 53 | * Returns: |
| 54 | * * %1 - if warm reset is successful | ||
| 55 | * * %0 - if cold reset and warm reset is successful | ||
| 56 | * * %-ENODEV - if @id and @id_mask not matching | ||
| 54 | */ | 57 | */ |
| 55 | int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id, | 58 | int snd_ac97_reset(struct snd_ac97 *ac97, bool try_warm, unsigned int id, |
| 56 | unsigned int id_mask) | 59 | unsigned int id_mask) |
| @@ -379,7 +379,7 @@ int snd_parse_eld(struct device *dev, struct snd_parsed_hdmi_eld *e, · 378 unmodified lines | |||
| 379 | * in console or for audio devices. Assume the highest speakers | 379 | * in console or for audio devices. Assume the highest speakers |
| 380 | * configuration, to _not_ prohibit multi-channel audio playback. | 380 | * configuration, to _not_ prohibit multi-channel audio playback. |
| 381 | */ | 381 | */ |
| 382 | if (!e->spk_alloc) | 382 | if (!e->spk_alloc && e->sad_count) |
| 383 | e->spk_alloc = 0xffff; | 383 | e->spk_alloc = 0xffff; |
| 384 | 384 | ||
| 385 | return 0; | 385 | return 0; |
| @@ -2106,13 +2106,11 @@ EXPORT_SYMBOL(snd_rawmidi_set_ops); · 2105 unmodified lines | |||
| 2106 | 2106 | ||
| 2107 | static int __init alsa_rawmidi_init(void) | 2107 | static int __init alsa_rawmidi_init(void) |
| 2108 | { | 2108 | { |
| 2109 | |||
| 2110 | snd_ctl_register_ioctl(snd_rawmidi_control_ioctl); | 2109 | snd_ctl_register_ioctl(snd_rawmidi_control_ioctl); |
| 2111 | snd_ctl_register_ioctl_compat(snd_rawmidi_control_ioctl); | 2110 | snd_ctl_register_ioctl_compat(snd_rawmidi_control_ioctl); |
| 2112 | #ifdef CONFIG_SND_OSSEMUL | 2111 | #ifdef CONFIG_SND_OSSEMUL |
| 2113 | { int i; | ||
| 2114 | /* check device map table */ | 2112 | /* check device map table */ |
| 2115 | for (i = 0; i < SNDRV_CARDS; i++) { | 2113 | for (int i = 0; i < SNDRV_CARDS; i++) { |
| 2116 | if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) { | 2114 | if (midi_map[i] < 0 || midi_map[i] >= SNDRV_RAWMIDI_DEVICES) { |
| 2117 | pr_err("ALSA: rawmidi: invalid midi_map[%d] = %d\n", | 2115 | pr_err("ALSA: rawmidi: invalid midi_map[%d] = %d\n", |
| 2118 | i, midi_map[i]); | 2116 | i, midi_map[i]); |
| @@ -2124,7 +2122,6 @@ static int __init alsa_rawmidi_init(void) · 5 unmodified lines | |||
| 2124 | amidi_map[i] = 1; | 2122 | amidi_map[i] = 1; |
| 2125 | } | 2123 | } |
| 2126 | } | 2124 | } |
| 2127 | } | ||
| 2128 | #endif /* CONFIG_SND_OSSEMUL */ | 2125 | #endif /* CONFIG_SND_OSSEMUL */ |
| 2129 | return 0; | 2126 | return 0; |
| 2130 | } | 2127 | } |
| @@ -696,10 +696,10 @@ static int setup_patt_bufs(void) · 695 unmodified lines | |||
| 696 | size_t i; | 696 | size_t i; |
| 697 | 697 | ||
| 698 | for (i = 0; i < ARRAY_SIZE(patt_bufs); i++) { | 698 | for (i = 0; i < ARRAY_SIZE(patt_bufs); i++) { |
| 699 | patt_bufs[i].buf = kzalloc(MAX_PATTERN_LEN, GFP_KERNEL); | 699 | patt_bufs[i].buf = kmalloc(MAX_PATTERN_LEN, GFP_KERNEL); |
| 700 | if (!patt_bufs[i].buf) | 700 | if (!patt_bufs[i].buf) |
| 701 | break; | 701 | break; |
| 702 | strcpy(patt_bufs[i].buf, DEFAULT_PATTERN); | 702 | strscpy_pad(patt_bufs[i].buf, DEFAULT_PATTERN, MAX_PATTERN_LEN); |
| 703 | patt_bufs[i].len = DEFAULT_PATTERN_LEN; | 703 | patt_bufs[i].len = DEFAULT_PATTERN_LEN; |
| 704 | } | 704 | } |
| 705 | 705 | ||
| @@ -2,5 +2,5 @@ · 1 unmodified line | |||
| 2 | snd-dice-y := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \ | 2 | snd-dice-y := dice-transaction.o dice-stream.o dice-proc.o dice-midi.o \ |
| 3 | dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \ | 3 | dice-pcm.o dice-hwdep.o dice.o dice-tcelectronic.o \ |
| 4 | dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \ | 4 | dice-alesis.o dice-extension.o dice-mytek.o dice-presonus.o \ |
| 5 | dice-harman.o dice-focusrite.o dice-weiss.o | 5 | dice-harman.o dice-focusrite.o dice-weiss.o dice-teac.o |
| 6 | obj-$(CONFIG_SND_DICE) += snd-dice.o | 6 | obj-$(CONFIG_SND_DICE) += snd-dice.o |
| @@ -116,7 +116,7 @@ static int detect_stream_formats(struct snd_dice *dice, u64 section_addr) · 115 unmodified lines | |||
| 116 | break; | 116 | break; |
| 117 | 117 | ||
| 118 | base_offset += EXT_APP_STREAM_ENTRIES; | 118 | base_offset += EXT_APP_STREAM_ENTRIES; |
| 119 | stream_count = be32_to_cpu(reg[0]); | 119 | stream_count = min_t(unsigned int, be32_to_cpu(reg[0]), MAX_STREAMS); |
| 120 | err = read_stream_entries(dice, section_addr, base_offset, | 120 | err = read_stream_entries(dice, section_addr, base_offset, |
| 121 | stream_count, mode, | 121 | stream_count, mode, |
| 122 | dice->tx_pcm_chs, | 122 | dice->tx_pcm_chs, |
| @@ -125,7 +125,7 @@ static int detect_stream_formats(struct snd_dice *dice, u64 section_addr) · 2 unmodified lines | |||
| 125 | break; | 125 | break; |
| 126 | 126 | ||
| 127 | base_offset += stream_count * EXT_APP_STREAM_ENTRY_SIZE; | 127 | base_offset += stream_count * EXT_APP_STREAM_ENTRY_SIZE; |
| 128 | stream_count = be32_to_cpu(reg[1]); | 128 | stream_count = min_t(unsigned int, be32_to_cpu(reg[1]), MAX_STREAMS); |
| 129 | err = read_stream_entries(dice, section_addr, base_offset, | 129 | err = read_stream_entries(dice, section_addr, base_offset, |
| 130 | stream_count, | 130 | stream_count, |
| 131 | mode, dice->rx_pcm_chs, | 131 | mode, dice->rx_pcm_chs, |
| @@ -0,0 +1,43 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | // dice-teac.c - a part of driver for DICE based devices | ||
| 3 | // | ||
| 4 | // Copyright (c) 2025 Takashi Sakamoto | ||
| 5 | |||
| 6 | #include "dice.h" | ||
| 7 | |||
| 8 | int snd_dice_detect_teac_formats(struct snd_dice *dice) | ||
| 9 | { | ||
| 10 | __be32 reg; | ||
| 11 | u32 data; | ||
| 12 | int err; | ||
| 13 | |||
| 14 | err = snd_dice_transaction_read_tx(dice, TX_NUMBER, ®, sizeof(reg)); | ||
| 15 | if (err < 0) | ||
| 16 | return err; | ||
| 17 | |||
| 18 | dice->tx_pcm_chs[0][SND_DICE_RATE_MODE_LOW] = 16; | ||
| 19 | dice->tx_pcm_chs[0][SND_DICE_RATE_MODE_MIDDLE] = 16; | ||
| 20 | dice->tx_midi_ports[0] = 1; | ||
| 21 | |||
| 22 | data = be32_to_cpu(reg); | ||
| 23 | if (data > 1) { | ||
| 24 | dice->tx_pcm_chs[1][SND_DICE_RATE_MODE_LOW] = 16; | ||
| 25 | dice->tx_pcm_chs[1][SND_DICE_RATE_MODE_MIDDLE] = 16; | ||
| 26 | } | ||
| 27 | |||
| 28 | err = snd_dice_transaction_read_rx(dice, RX_NUMBER, ®, sizeof(reg)); | ||
| 29 | if (err < 0) | ||
| 30 | return err; | ||
| 31 | |||
| 32 | dice->rx_pcm_chs[0][SND_DICE_RATE_MODE_LOW] = 16; | ||
| 33 | dice->rx_pcm_chs[0][SND_DICE_RATE_MODE_MIDDLE] = 16; | ||
| 34 | dice->rx_midi_ports[0] = 1; | ||
| 35 | |||
| 36 | data = be32_to_cpu(reg); | ||
| 37 | if (data > 1) { | ||
| 38 | dice->rx_pcm_chs[1][SND_DICE_RATE_MODE_LOW] = 16; | ||
| 39 | dice->rx_pcm_chs[1][SND_DICE_RATE_MODE_MIDDLE] = 16; | ||
| 40 | } | ||
| 41 | |||
| 42 | return 0; | ||
| 43 | } | ||
| @@ -22,6 +22,7 @@ MODULE_LICENSE("GPL"); · 21 unmodified lines | |||
| 22 | #define OUI_PRESONUS 0x000a92 | 22 | #define OUI_PRESONUS 0x000a92 |
| 23 | #define OUI_HARMAN 0x000fd7 | 23 | #define OUI_HARMAN 0x000fd7 |
| 24 | #define OUI_AVID 0x00a07e | 24 | #define OUI_AVID 0x00a07e |
| 25 | #define OUI_TEAC 0x00022e | ||
| 25 | 26 | ||
| 26 | #define DICE_CATEGORY_ID 0x04 | 27 | #define DICE_CATEGORY_ID 0x04 |
| 27 | #define WEISS_CATEGORY_ID 0x00 | 28 | #define WEISS_CATEGORY_ID 0x00 |
| @@ -458,6 +459,18 @@ static const struct ieee1394_device_id dice_id_table[] = { · 430 unmodified lines | |||
| 458 | .match_flags = IEEE1394_MATCH_VERSION, | 459 | .match_flags = IEEE1394_MATCH_VERSION, |
| 459 | .version = DICE_INTERFACE, | 460 | .version = DICE_INTERFACE, |
| 460 | }, | 461 | }, |
| 462 | // Tascam IF-FW/DM MkII for DM-3200 and DM-4800. | ||
| 463 | { | ||
| 464 | .match_flags = IEEE1394_MATCH_VENDOR_ID | | ||
| 465 | IEEE1394_MATCH_MODEL_ID | | ||
| 466 | IEEE1394_MATCH_SPECIFIER_ID | | ||
| 467 | IEEE1394_MATCH_VERSION, | ||
| 468 | .vendor_id = OUI_TEAC, | ||
| 469 | .model_id = OUI_TEAC, | ||
| 470 | .specifier_id = OUI_TEAC, | ||
| 471 | .version = 0x800006, | ||
| 472 | .driver_data = (kernel_ulong_t)snd_dice_detect_teac_formats, | ||
| 473 | }, | ||
| 461 | { } | 474 | { } |
| 462 | }; | 475 | }; |
| 463 | MODULE_DEVICE_TABLE(ieee1394, dice_id_table); | 476 | MODULE_DEVICE_TABLE(ieee1394, dice_id_table); |
| @@ -233,5 +233,6 @@ int snd_dice_detect_presonus_formats(struct snd_dice *dice); · 232 unmodified lines | |||
| 233 | int snd_dice_detect_harman_formats(struct snd_dice *dice); | 233 | int snd_dice_detect_harman_formats(struct snd_dice *dice); |
| 234 | int snd_dice_detect_focusrite_pro40_tcd3070_formats(struct snd_dice *dice); | 234 | int snd_dice_detect_focusrite_pro40_tcd3070_formats(struct snd_dice *dice); |
| 235 | int snd_dice_detect_weiss_formats(struct snd_dice *dice); | 235 | int snd_dice_detect_weiss_formats(struct snd_dice *dice); |
| 236 | int snd_dice_detect_teac_formats(struct snd_dice *dice); | ||
| 236 | 237 | ||
| 237 | #endif | 238 | #endif |
| @@ -793,6 +793,7 @@ static const struct hda_device_id snd_hda_id_intelhdmi[] = { · 792 unmodified lines | |||
| 793 | HDA_CODEC_ID_MODEL(0x80862820, "Lunar Lake HDMI", MODEL_ADLP), | 793 | HDA_CODEC_ID_MODEL(0x80862820, "Lunar Lake HDMI", MODEL_ADLP), |
| 794 | HDA_CODEC_ID_MODEL(0x80862822, "Panther Lake HDMI", MODEL_ADLP), | 794 | HDA_CODEC_ID_MODEL(0x80862822, "Panther Lake HDMI", MODEL_ADLP), |
| 795 | HDA_CODEC_ID_MODEL(0x80862823, "Wildcat Lake HDMI", MODEL_ADLP), | 795 | HDA_CODEC_ID_MODEL(0x80862823, "Wildcat Lake HDMI", MODEL_ADLP), |
| 796 | HDA_CODEC_ID_MODEL(0x80862824, "Nova Lake HDMI", MODEL_ADLP), | ||
| 796 | HDA_CODEC_ID_MODEL(0x80862882, "Valleyview2 HDMI", MODEL_BYT), | 797 | HDA_CODEC_ID_MODEL(0x80862882, "Valleyview2 HDMI", MODEL_BYT), |
| 797 | HDA_CODEC_ID_MODEL(0x80862883, "Braswell HDMI", MODEL_BYT), | 798 | HDA_CODEC_ID_MODEL(0x80862883, "Braswell HDMI", MODEL_BYT), |
| 798 | {} /* terminator */ | 799 | {} /* terminator */ |
| @@ -3406,7 +3406,42 @@ static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec, · 3405 unmodified lines | |||
| 3406 | spec->power_hook = alc287_s4_power_gpio3_default; | 3406 | spec->power_hook = alc287_s4_power_gpio3_default; |
| 3407 | spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook; | 3407 | spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook; |
| 3408 | } | 3408 | } |
| 3409 | /* GPIO2: mute led GPIO3: micmute led */ | ||
| 3410 | static void alc245_tas2781_spi_hp_fixup_muteled(struct hda_codec *codec, | ||
| 3411 | const struct hda_fixup *fix, int action) | ||
| 3412 | { | ||
| 3413 | struct alc_spec *spec = codec->spec; | ||
| 3414 | static const hda_nid_t conn[] = { 0x02 }; | ||
| 3415 | |||
| 3416 | switch (action) { | ||
| 3417 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
| 3418 | spec->gen.auto_mute_via_amp = 1; | ||
| 3419 | snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); | ||
| 3420 | break; | ||
| 3421 | } | ||
| 3422 | |||
| 3423 | tas2781_fixup_spi(codec, fix, action); | ||
| 3424 | alc_fixup_hp_gpio_led(codec, action, 0x04, 0x0); | ||
| 3425 | alc285_fixup_hp_coef_micmute_led(codec, fix, action); | ||
| 3426 | } | ||
| 3427 | /* JD2: mute led GPIO3: micmute led */ | ||
| 3428 | static void alc245_tas2781_i2c_hp_fixup_muteled(struct hda_codec *codec, | ||
| 3429 | const struct hda_fixup *fix, int action) | ||
| 3430 | { | ||
| 3431 | struct alc_spec *spec = codec->spec; | ||
| 3432 | static const hda_nid_t conn[] = { 0x02 }; | ||
| 3433 | |||
| 3434 | switch (action) { | ||
| 3435 | case HDA_FIXUP_ACT_PRE_PROBE: | ||
| 3436 | spec->gen.auto_mute_via_amp = 1; | ||
| 3437 | snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); | ||
| 3438 | break; | ||
| 3439 | } | ||
| 3409 | 3440 | ||
| 3441 | tas2781_fixup_txnw_i2c(codec, fix, action); | ||
| 3442 | alc245_fixup_hp_mute_led_coefbit(codec, fix, action); | ||
| 3443 | alc285_fixup_hp_coef_micmute_led(codec, fix, action); | ||
| 3444 | } | ||
| 3410 | /* | 3445 | /* |
| 3411 | * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly | 3446 | * Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly |
| 3412 | * at PM resume | 3447 | * at PM resume |
| @@ -3418,6 +3453,21 @@ static void alc283_fixup_dell_hp_resume(struct hda_codec *codec, · 5 unmodified lines | |||
| 3418 | alc_write_coef_idx(codec, 0xd, 0x2800); | 3453 | alc_write_coef_idx(codec, 0xd, 0x2800); |
| 3419 | } | 3454 | } |
| 3420 | 3455 | ||
| 3456 | /* Swap DAC assignments for HP and speaker */ | ||
| 3457 | static void alc288_fixup_surface_swap_dacs(struct hda_codec *codec, | ||
| 3458 | const struct hda_fixup *fix, int action) | ||
| 3459 | { | ||
| 3460 | struct alc_spec *spec = codec->spec; | ||
| 3461 | static hda_nid_t preferred_pairs[] = { | ||
| 3462 | 0x21, 0x03, 0x14, 0x02, 0 | ||
| 3463 | }; | ||
| 3464 | |||
| 3465 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | ||
| 3466 | return; | ||
| 3467 | |||
| 3468 | spec->gen.preferred_dacs = preferred_pairs; | ||
| 3469 | } | ||
| 3470 | |||
| 3421 | enum { | 3471 | enum { |
| 3422 | ALC269_FIXUP_GPIO2, | 3472 | ALC269_FIXUP_GPIO2, |
| 3423 | ALC269_FIXUP_SONY_VAIO, | 3473 | ALC269_FIXUP_SONY_VAIO, |
| @@ -3737,6 +3787,10 @@ enum { · 313 unmodified lines | |||
| 3737 | ALC269_FIXUP_POSITIVO_P15X_HEADSET_MIC, | 3787 | ALC269_FIXUP_POSITIVO_P15X_HEADSET_MIC, |
| 3738 | ALC289_FIXUP_ASUS_ZEPHYRUS_DUAL_SPK, | 3788 | ALC289_FIXUP_ASUS_ZEPHYRUS_DUAL_SPK, |
| 3739 | ALC256_FIXUP_VAIO_RPL_MIC_NO_PRESENCE, | 3789 | ALC256_FIXUP_VAIO_RPL_MIC_NO_PRESENCE, |
| 3790 | ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED, | ||
| 3791 | ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED, | ||
| 3792 | ALC288_FIXUP_SURFACE_SWAP_DACS, | ||
| 3793 | ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO, | ||
| 3740 | }; | 3794 | }; |
| 3741 | 3795 | ||
| 3742 | /* A special fixup for Lenovo C940 and Yoga Duet 7; | 3796 | /* A special fixup for Lenovo C940 and Yoga Duet 7; |
| @@ -5270,6 +5324,12 @@ static const struct hda_fixup alc269_fixups[] = { · 1527 unmodified lines | |||
| 5270 | .type = HDA_FIXUP_FUNC, | 5324 | .type = HDA_FIXUP_FUNC, |
| 5271 | .v.func = alc236_fixup_hp_mute_led_micmute_vref, | 5325 | .v.func = alc236_fixup_hp_mute_led_micmute_vref, |
| 5272 | }, | 5326 | }, |
| 5327 | [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO] = { | ||
| 5328 | .type = HDA_FIXUP_FUNC, | ||
| 5329 | .v.func = alc236_fixup_hp_mute_led_coefbit2, | ||
| 5330 | .chained = true, | ||
| 5331 | .chain_id = ALC236_FIXUP_HP_GPIO_LED, | ||
| 5332 | }, | ||
| 5273 | [ALC236_FIXUP_LENOVO_INV_DMIC] = { | 5333 | [ALC236_FIXUP_LENOVO_INV_DMIC] = { |
| 5274 | .type = HDA_FIXUP_FUNC, | 5334 | .type = HDA_FIXUP_FUNC, |
| 5275 | .v.func = alc_fixup_inv_dmic, | 5335 | .v.func = alc_fixup_inv_dmic, |
| @@ -6183,7 +6243,19 @@ static const struct hda_fixup alc269_fixups[] = { · 907 unmodified lines | |||
| 6183 | }, | 6243 | }, |
| 6184 | .chained = true, | 6244 | .chained = true, |
| 6185 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST | 6245 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST |
| 6186 | } | 6246 | }, |
| 6247 | [ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED] = { | ||
| 6248 | .type = HDA_FIXUP_FUNC, | ||
| 6249 | .v.func = alc245_tas2781_spi_hp_fixup_muteled, | ||
| 6250 | }, | ||
| 6251 | [ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED] = { | ||
| 6252 | .type = HDA_FIXUP_FUNC, | ||
| 6253 | .v.func = alc245_tas2781_i2c_hp_fixup_muteled, | ||
| 6254 | }, | ||
| 6255 | [ALC288_FIXUP_SURFACE_SWAP_DACS] = { | ||
| 6256 | .type = HDA_FIXUP_FUNC, | ||
| 6257 | .v.func = alc288_fixup_surface_swap_dacs, | ||
| 6258 | }, | ||
| 6187 | }; | 6259 | }; |
| 6188 | 6260 | ||
| 6189 | static const struct hda_quirk alc269_fixup_tbl[] = { | 6261 | static const struct hda_quirk alc269_fixup_tbl[] = { |
| @@ -6526,6 +6598,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 336 unmodified lines | |||
| 6526 | SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4), | 6598 | SND_PCI_QUIRK(0x103c, 0x8a6e, "HP EDNA 360", ALC287_FIXUP_CS35L41_I2C_4), |
| 6527 | SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), | 6599 | SND_PCI_QUIRK(0x103c, 0x8a74, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), |
| 6528 | SND_PCI_QUIRK(0x103c, 0x8a75, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), | 6600 | SND_PCI_QUIRK(0x103c, 0x8a75, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), |
| 6601 | SND_PCI_QUIRK(0x103c, 0x8a76, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), | ||
| 6602 | SND_PCI_QUIRK(0x103c, 0x8a77, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED), | ||
| 6529 | SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), | 6603 | SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST), |
| 6530 | SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED), | 6604 | SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED), |
| 6531 | SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED), | 6605 | SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED), |
| @@ -6696,15 +6770,29 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 164 unmodified lines | |||
| 6696 | SND_PCI_QUIRK(0x103c, 0x8e60, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2), | 6770 | SND_PCI_QUIRK(0x103c, 0x8e60, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2), |
| 6697 | SND_PCI_QUIRK(0x103c, 0x8e61, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2), | 6771 | SND_PCI_QUIRK(0x103c, 0x8e61, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2), |
| 6698 | SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2), | 6772 | SND_PCI_QUIRK(0x103c, 0x8e62, "HP Trekker ", ALC287_FIXUP_CS35L41_I2C_2), |
| 6699 | SND_PCI_QUIRK(0x103c, 0x8ed5, "HP Merino13X", ALC245_FIXUP_TAS2781_SPI_2), | 6773 | SND_PCI_QUIRK(0x103c, 0x8eb6, "HP Abe A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6700 | SND_PCI_QUIRK(0x103c, 0x8ed6, "HP Merino13", ALC245_FIXUP_TAS2781_SPI_2), | 6774 | SND_PCI_QUIRK(0x103c, 0x8eb7, "HP Abe A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6701 | SND_PCI_QUIRK(0x103c, 0x8ed7, "HP Merino14", ALC245_FIXUP_TAS2781_SPI_2), | 6775 | SND_PCI_QUIRK(0x103c, 0x8eb8, "HP Abe A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6702 | SND_PCI_QUIRK(0x103c, 0x8ed8, "HP Merino16", ALC245_FIXUP_TAS2781_SPI_2), | 6776 | SND_PCI_QUIRK(0x103c, 0x8ec1, "HP 200 G2i", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6703 | SND_PCI_QUIRK(0x103c, 0x8ed9, "HP Merino14W", ALC245_FIXUP_TAS2781_SPI_2), | 6777 | SND_PCI_QUIRK(0x103c, 0x8ec4, "HP Bantie I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6704 | SND_PCI_QUIRK(0x103c, 0x8eda, "HP Merino16W", ALC245_FIXUP_TAS2781_SPI_2), | 6778 | SND_PCI_QUIRK(0x103c, 0x8ec5, "HP Bantie I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6705 | SND_PCI_QUIRK(0x103c, 0x8f40, "HP Lampas14", ALC287_FIXUP_TXNW2781_I2C), | 6779 | SND_PCI_QUIRK(0x103c, 0x8ece, "HP Abe I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6706 | SND_PCI_QUIRK(0x103c, 0x8f41, "HP Lampas16", ALC287_FIXUP_TXNW2781_I2C), | 6780 | SND_PCI_QUIRK(0x103c, 0x8ecf, "HP Abe I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6707 | SND_PCI_QUIRK(0x103c, 0x8f42, "HP LampasW14", ALC287_FIXUP_TXNW2781_I2C), | 6781 | SND_PCI_QUIRK(0x103c, 0x8ed2, "HP Abe I6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), |
| 6782 | SND_PCI_QUIRK(0x103c, 0x8ed5, "HP EliteBook 8 Flip G2i 13", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED), | ||
| 6783 | SND_PCI_QUIRK(0x103c, 0x8ed6, "HP EliteBook 8 G2i 13", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED), | ||
| 6784 | SND_PCI_QUIRK(0x103c, 0x8ed7, "HP EliteBook 8 G2i 14", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED), | ||
| 6785 | SND_PCI_QUIRK(0x103c, 0x8ed8, "HP EliteBook 8 G2i 16", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED), | ||
| 6786 | SND_PCI_QUIRK(0x103c, 0x8ed9, "HP ZBook Firefly 14W", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED), | ||
| 6787 | SND_PCI_QUIRK(0x103c, 0x8eda, "HP ZBook Firefly 16W", ALC245_FIXUP_HP_TAS2781_SPI_MUTE_LED), | ||
| 6788 | SND_PCI_QUIRK(0x103c, 0x8ee4, "HP Bantie A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), | ||
| 6789 | SND_PCI_QUIRK(0x103c, 0x8ee5, "HP Bantie A6U", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO), | ||
| 6790 | SND_PCI_QUIRK(0x103c, 0x8f0c, "HP ZBook X G2i 16W", ALC236_FIXUP_HP_GPIO_LED), | ||
| 6791 | SND_PCI_QUIRK(0x103c, 0x8f0e, "HP ZBook X G2i 16W", ALC236_FIXUP_HP_GPIO_LED), | ||
| 6792 | SND_PCI_QUIRK(0x103c, 0x8f40, "HP ZBook 8 G2a 14", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED), | ||
| 6793 | SND_PCI_QUIRK(0x103c, 0x8f41, "HP ZBook 8 G2a 16", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED), | ||
| 6794 | SND_PCI_QUIRK(0x103c, 0x8f42, "HP ZBook 8 G2a 14W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED), | ||
| 6795 | SND_PCI_QUIRK(0x103c, 0x8f62, "HP ZBook 8 G2a 16W", ALC245_FIXUP_HP_TAS2781_I2C_MUTE_LED), | ||
| 6708 | SND_PCI_QUIRK(0x1043, 0x1032, "ASUS VivoBook X513EA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), | 6796 | SND_PCI_QUIRK(0x1043, 0x1032, "ASUS VivoBook X513EA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 6709 | SND_PCI_QUIRK(0x1043, 0x1034, "ASUS GU605C", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1), | 6797 | SND_PCI_QUIRK(0x1043, 0x1034, "ASUS GU605C", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1), |
| 6710 | SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), | 6798 | SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC), |
| @@ -6736,6 +6824,8 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 25 unmodified lines | |||
| 6736 | SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), | 6824 | SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 6737 | SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE), | 6825 | SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 6738 | SND_PCI_QUIRK(0x1043, 0x1314, "ASUS GA605K", ALC285_FIXUP_ASUS_GA605K_HEADSET_MIC), | 6826 | SND_PCI_QUIRK(0x1043, 0x1314, "ASUS GA605K", ALC285_FIXUP_ASUS_GA605K_HEADSET_MIC), |
| 6827 | SND_PCI_QUIRK(0x1043, 0x1384, "ASUS RC73XA", ALC287_FIXUP_TXNW2781_I2C), | ||
| 6828 | SND_PCI_QUIRK(0x1043, 0x1394, "ASUS RC73YA", ALC287_FIXUP_TXNW2781_I2C), | ||
| 6739 | SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), | 6829 | SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), |
| 6740 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), | 6830 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), |
| 6741 | SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC), | 6831 | SND_PCI_QUIRK(0x1043, 0x1433, "ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVV", ALC285_FIXUP_ASUS_I2C_HEADSET_MIC), |
| @@ -6883,6 +6973,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = { · 141 unmodified lines | |||
| 6883 | SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), | 6973 | SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), |
| 6884 | SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), | 6974 | SND_PCI_QUIRK(0x10ec, 0x12f6, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK), |
| 6885 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC), | 6975 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC), |
| 6976 | SND_PCI_QUIRK(0x1414, 0x9c20, "Microsoft Surface Pro 2/3", ALC288_FIXUP_SURFACE_SWAP_DACS), | ||
| 6886 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), | 6977 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), |
| 6887 | SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP), | 6978 | SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP), |
| 6888 | SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP), | 6979 | SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP), |
| @@ -19,6 +19,9 @@ · 18 unmodified lines | |||
| 19 | #include "hda_jack.h" | 19 | #include "hda_jack.h" |
| 20 | #include "generic.h" | 20 | #include "generic.h" |
| 21 | 21 | ||
| 22 | /* GPIO node ID */ | ||
| 23 | #define SENARY_GPIO_NODE 0x01 | ||
| 24 | |||
| 22 | struct senary_spec { | 25 | struct senary_spec { |
| 23 | struct hda_gen_spec gen; | 26 | struct hda_gen_spec gen; |
| 24 | 27 | ||
| @@ -120,11 +123,11 @@ static void senary_init_gpio_led(struct hda_codec *codec) · 95 unmodified lines | |||
| 120 | unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask; | 123 | unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask; |
| 121 | 124 | ||
| 122 | if (mask) { | 125 | if (mask) { |
| 123 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, | 126 | snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_MASK, |
| 124 | mask); | 127 | mask); |
| 125 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, | 128 | snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_DIRECTION, |
| 126 | mask); | 129 | mask); |
| 127 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | 130 | snd_hda_codec_write(codec, SENARY_GPIO_NODE, 0, AC_VERB_SET_GPIO_DATA, |
| 128 | spec->gpio_led); | 131 | spec->gpio_led); |
| 129 | } | 132 | } |
| 130 | } | 133 | } |
| @@ -88,6 +88,21 @@ config SND_HDA_SCODEC_CS35L56_SPI · 87 unmodified lines | |||
| 88 | Say Y or M here to include CS35L56 amplifier support with | 88 | Say Y or M here to include CS35L56 amplifier support with |
| 89 | SPI control. | 89 | SPI control. |
| 90 | 90 | ||
| 91 | menu "CS35L56 driver options" | ||
| 92 | depends on SND_HDA_SCODEC_CS35L56 | ||
| 93 | |||
| 94 | config SND_HDA_SCODEC_CS35L56_CAL_DEBUGFS | ||
| 95 | bool "CS35L56 create debugfs for factory calibration" | ||
| 96 | default N | ||
| 97 | depends on DEBUG_FS | ||
| 98 | select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON | ||
| 99 | help | ||
| 100 | Create debugfs entries used during factory-line manufacture | ||
| 101 | for factory calibration. | ||
| 102 | |||
| 103 | If unsure select "N". | ||
| 104 | endmenu | ||
| 105 | |||
| 91 | config SND_HDA_SCODEC_TAS2781 | 106 | config SND_HDA_SCODEC_TAS2781 |
| 92 | tristate | 107 | tristate |
| 93 | select SND_HDA_GENERIC | 108 | select SND_HDA_GENERIC |
| @@ -548,20 +548,24 @@ static void cs35l56_hda_release_firmware_files(const struct firmware *wmfw_firmw · 547 unmodified lines | |||
| 548 | kfree(coeff_filename); | 548 | kfree(coeff_filename); |
| 549 | } | 549 | } |
| 550 | 550 | ||
| 551 | static void cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56) | 551 | static int cs35l56_hda_apply_calibration(struct cs35l56_hda *cs35l56) |
| 552 | { | 552 | { |
| 553 | int ret; | 553 | int ret; |
| 554 | 554 | ||
| 555 | if (!cs35l56->base.cal_data_valid || cs35l56->base.secured) | 555 | if (!cs35l56->base.cal_data_valid || cs35l56->base.secured) |
| 556 | return; | 556 | return -EACCES; |
| 557 | 557 | ||
| 558 | ret = cs_amp_write_cal_coeffs(&cs35l56->cs_dsp, | 558 | ret = cs_amp_write_cal_coeffs(&cs35l56->cs_dsp, |
| 559 | &cs35l56_calibration_controls, | 559 | &cs35l56_calibration_controls, |
| 560 | &cs35l56->base.cal_data); | 560 | &cs35l56->base.cal_data); |
| 561 | if (ret < 0) | 561 | if (ret < 0) { |
| 562 | dev_warn(cs35l56->base.dev, "Failed to write calibration: %d\n", ret); | 562 | dev_warn(cs35l56->base.dev, "Failed to write calibration: %d\n", ret); |
| 563 | else | 563 | return ret; |
| 564 | dev_info(cs35l56->base.dev, "Calibration applied\n"); | 564 | } |
| 565 | |||
| 566 | dev_info(cs35l56->base.dev, "Calibration applied\n"); | ||
| 567 | |||
| 568 | return 0; | ||
| 565 | } | 569 | } |
| 566 | 570 | ||
| 567 | static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) | 571 | static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) |
| @@ -669,7 +673,9 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56) · 101 unmodified lines | |||
| 669 | if (ret) | 673 | if (ret) |
| 670 | dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret); | 674 | dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret); |
| 671 | 675 | ||
| 676 | /* Don't need to check return code, it's not fatal if this fails */ | ||
| 672 | cs35l56_hda_apply_calibration(cs35l56); | 677 | cs35l56_hda_apply_calibration(cs35l56); |
| 678 | |||
| 673 | ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT); | 679 | ret = cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT); |
| 674 | if (ret) | 680 | if (ret) |
| 675 | cs_dsp_stop(&cs35l56->cs_dsp); | 681 | cs_dsp_stop(&cs35l56->cs_dsp); |
| @@ -695,6 +701,100 @@ static void cs35l56_hda_dsp_work(struct work_struct *work) · 19 unmodified lines | |||
| 695 | cs35l56_hda_fw_load(cs35l56); | 701 | cs35l56_hda_fw_load(cs35l56); |
| 696 | } | 702 | } |
| 697 | 703 | ||
| 704 | static ssize_t cs35l56_hda_debugfs_calibrate_write(struct file *file, | ||
| 705 | const char __user *from, | ||
| 706 | size_t count, loff_t *ppos) | ||
| 707 | { | ||
| 708 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 709 | ssize_t ret; | ||
| 710 | |||
| 711 | ret = pm_runtime_resume_and_get(cs35l56_base->dev); | ||
| 712 | if (ret) | ||
| 713 | return ret; | ||
| 714 | |||
| 715 | ret = cs35l56_calibrate_debugfs_write(cs35l56_base, from, count, ppos); | ||
| 716 | pm_runtime_autosuspend(cs35l56_base->dev); | ||
| 717 | |||
| 718 | return ret; | ||
| 719 | } | ||
| 720 | |||
| 721 | static ssize_t cs35l56_hda_debugfs_cal_temperature_write(struct file *file, | ||
| 722 | const char __user *from, | ||
| 723 | size_t count, loff_t *ppos) | ||
| 724 | { | ||
| 725 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 726 | ssize_t ret; | ||
| 727 | |||
| 728 | ret = pm_runtime_resume_and_get(cs35l56_base->dev); | ||
| 729 | if (ret) | ||
| 730 | return ret; | ||
| 731 | |||
| 732 | ret = cs35l56_cal_ambient_debugfs_write(cs35l56_base, from, count, ppos); | ||
| 733 | pm_runtime_autosuspend(cs35l56_base->dev); | ||
| 734 | |||
| 735 | return ret; | ||
| 736 | } | ||
| 737 | |||
| 738 | static ssize_t cs35l56_hda_debugfs_cal_data_read(struct file *file, | ||
| 739 | char __user *to, | ||
| 740 | size_t count, loff_t *ppos) | ||
| 741 | { | ||
| 742 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 743 | ssize_t ret; | ||
| 744 | |||
| 745 | ret = pm_runtime_resume_and_get(cs35l56_base->dev); | ||
| 746 | if (ret) | ||
| 747 | return ret; | ||
| 748 | |||
| 749 | ret = cs35l56_cal_data_debugfs_read(cs35l56_base, to, count, ppos); | ||
| 750 | pm_runtime_autosuspend(cs35l56_base->dev); | ||
| 751 | |||
| 752 | return ret; | ||
| 753 | } | ||
| 754 | |||
| 755 | static ssize_t cs35l56_hda_debugfs_cal_data_write(struct file *file, | ||
| 756 | const char __user *from, | ||
| 757 | size_t count, loff_t *ppos) | ||
| 758 | { | ||
| 759 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 760 | struct cs35l56_hda *cs35l56 = cs35l56_hda_from_base(cs35l56_base); | ||
| 761 | ssize_t ret; | ||
| 762 | |||
| 763 | ret = cs35l56_cal_data_debugfs_write(cs35l56_base, from, count, ppos); | ||
| 764 | if (ret == -ENODATA) | ||
| 765 | return count; /* Ignore writes of empty cal blobs */ | ||
| 766 | |||
| 767 | if (ret < 0) | ||
| 768 | return ret; | ||
| 769 | |||
| 770 | ret = pm_runtime_resume_and_get(cs35l56_base->dev); | ||
| 771 | if (ret) | ||
| 772 | return ret; | ||
| 773 | |||
| 774 | ret = cs35l56_hda_apply_calibration(cs35l56); | ||
| 775 | if (ret == 0) | ||
| 776 | cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_AUDIO_REINIT); | ||
| 777 | else | ||
| 778 | count = -EIO; | ||
| 779 | |||
| 780 | pm_runtime_autosuspend(cs35l56_base->dev); | ||
| 781 | |||
| 782 | return count; | ||
| 783 | } | ||
| 784 | |||
| 785 | static const struct cs35l56_cal_debugfs_fops cs35l56_hda_cal_debugfs_fops = { | ||
| 786 | .calibrate = { | ||
| 787 | .write = cs35l56_hda_debugfs_calibrate_write, | ||
| 788 | }, | ||
| 789 | .cal_temperature = { | ||
| 790 | .write = cs35l56_hda_debugfs_cal_temperature_write, | ||
| 791 | }, | ||
| 792 | .cal_data = { | ||
| 793 | .read = cs35l56_hda_debugfs_cal_data_read, | ||
| 794 | .write = cs35l56_hda_debugfs_cal_data_write, | ||
| 795 | }, | ||
| 796 | }; | ||
| 797 | |||
| 698 | static int cs35l56_hda_bind(struct device *dev, struct device *master, void *master_data) | 798 | static int cs35l56_hda_bind(struct device *dev, struct device *master, void *master_data) |
| 699 | { | 799 | { |
| 700 | struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); | 800 | struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev); |
| @@ -722,6 +822,9 @@ static int cs35l56_hda_bind(struct device *dev, struct device *master, void *mas · 21 unmodified lines | |||
| 722 | cs_dsp_init_debugfs(&cs35l56->cs_dsp, cs35l56->debugfs_root); | 822 | cs_dsp_init_debugfs(&cs35l56->cs_dsp, cs35l56->debugfs_root); |
| 723 | #endif | 823 | #endif |
| 724 | 824 | ||
| 825 | if (IS_ENABLED(CONFIG_SND_HDA_SCODEC_CS35L56_CAL_DEBUGFS)) | ||
| 826 | cs35l56_create_cal_debugfs(&cs35l56->base, &cs35l56_hda_cal_debugfs_fops); | ||
| 827 | |||
| 725 | dev_dbg(cs35l56->base.dev, "Bound\n"); | 828 | dev_dbg(cs35l56->base.dev, "Bound\n"); |
| 726 | 829 | ||
| 727 | return 0; | 830 | return 0; |
| @@ -735,6 +838,7 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void * · 7 unmodified lines | |||
| 735 | 838 | ||
| 736 | cancel_work_sync(&cs35l56->dsp_work); | 839 | cancel_work_sync(&cs35l56->dsp_work); |
| 737 | 840 | ||
| 841 | cs35l56_remove_cal_debugfs(&cs35l56->base); | ||
| 738 | cs35l56_hda_remove_controls(cs35l56); | 842 | cs35l56_hda_remove_controls(cs35l56); |
| 739 | 843 | ||
| 740 | #if IS_ENABLED(CONFIG_SND_DEBUG) | 844 | #if IS_ENABLED(CONFIG_SND_DEBUG) |
| @@ -1050,7 +1154,7 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id) · 309 unmodified lines | |||
| 1050 | } | 1154 | } |
| 1051 | 1155 | ||
| 1052 | cs35l56->base.type = hid & 0xff; | 1156 | cs35l56->base.type = hid & 0xff; |
| 1053 | cs35l56->base.cal_index = -1; | 1157 | cs35l56->base.cal_index = cs35l56->index; |
| 1054 | 1158 | ||
| 1055 | cs35l56_init_cs_dsp(&cs35l56->base, &cs35l56->cs_dsp); | 1159 | cs35l56_init_cs_dsp(&cs35l56->base, &cs35l56->cs_dsp); |
| 1056 | cs35l56->cs_dsp.client_ops = &cs35l56_hda_client_ops; | 1160 | cs35l56->cs_dsp.client_ops = &cs35l56_hda_client_ops; |
| @@ -9,6 +9,7 @@ · 8 unmodified lines | |||
| 9 | #ifndef __CS35L56_HDA_H__ | 9 | #ifndef __CS35L56_HDA_H__ |
| 10 | #define __CS35L56_HDA_H__ | 10 | #define __CS35L56_HDA_H__ |
| 11 | 11 | ||
| 12 | #include <linux/container_of.h> | ||
| 12 | #include <linux/device.h> | 13 | #include <linux/device.h> |
| 13 | #include <linux/gpio/consumer.h> | 14 | #include <linux/gpio/consumer.h> |
| 14 | #include <linux/firmware/cirrus/cs_dsp.h> | 15 | #include <linux/firmware/cirrus/cs_dsp.h> |
| @@ -42,6 +43,11 @@ struct cs35l56_hda { · 27 unmodified lines | |||
| 42 | #endif | 43 | #endif |
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 46 | static inline struct cs35l56_hda *cs35l56_hda_from_base(struct cs35l56_base *cs35l56_base) | ||
| 47 | { | ||
| 48 | return container_of(cs35l56_base, struct cs35l56_hda, base); | ||
| 49 | } | ||
| 50 | |||
| 45 | extern const struct dev_pm_ops cs35l56_hda_pm_ops; | 51 | extern const struct dev_pm_ops cs35l56_hda_pm_ops; |
| 46 | 52 | ||
| 47 | int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id); | 53 | int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int hid, int id); |
| @@ -87,6 +87,7 @@ static const struct acpi_gpio_mapping tas2781_speaker_id_gpios[] = { · 86 unmodified lines | |||
| 87 | 87 | ||
| 88 | static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) | 88 | static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) |
| 89 | { | 89 | { |
| 90 | struct gpio_desc *speaker_id; | ||
| 90 | struct acpi_device *adev; | 91 | struct acpi_device *adev; |
| 91 | struct device *physdev; | 92 | struct device *physdev; |
| 92 | LIST_HEAD(resources); | 93 | LIST_HEAD(resources); |
| @@ -119,19 +120,31 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid) · 26 unmodified lines | |||
| 119 | /* Speaker id was needed for ASUS projects. */ | 120 | /* Speaker id was needed for ASUS projects. */ |
| 120 | ret = kstrtou32(sub, 16, &subid); | 121 | ret = kstrtou32(sub, 16, &subid); |
| 121 | if (!ret && upper_16_bits(subid) == PCI_VENDOR_ID_ASUSTEK) { | 122 | if (!ret && upper_16_bits(subid) == PCI_VENDOR_ID_ASUSTEK) { |
| 122 | ret = devm_acpi_dev_add_driver_gpios(p->dev, | 123 | ret = acpi_dev_add_driver_gpios(adev, tas2781_speaker_id_gpios); |
| 123 | tas2781_speaker_id_gpios); | 124 | if (ret < 0) { |
| 124 | if (ret < 0) | ||
| 125 | dev_err(p->dev, "Failed to add driver gpio %d.\n", | 125 | dev_err(p->dev, "Failed to add driver gpio %d.\n", |
| 126 | ret); | 126 | ret); |
| 127 | p->speaker_id = devm_gpiod_get(p->dev, "speakerid", GPIOD_IN); | 127 | p->speaker_id = -1; |
| 128 | if (IS_ERR(p->speaker_id)) { | 128 | goto end_2563; |
| 129 | dev_err(p->dev, "Failed to get Speaker id.\n"); | 129 | } |
| 130 | ret = PTR_ERR(p->speaker_id); | 130 | |
| 131 | goto err; | 131 | speaker_id = fwnode_gpiod_get_index(acpi_fwnode_handle(adev), |
| 132 | "speakerid", 0, GPIOD_IN, NULL); | ||
| 133 | if (!IS_ERR(speaker_id)) { | ||
| 134 | p->speaker_id = gpiod_get_value_cansleep(speaker_id); | ||
| 135 | dev_dbg(p->dev, "Got speaker id gpio from ACPI: %d.\n", | ||
| 136 | p->speaker_id); | ||
| 137 | gpiod_put(speaker_id); | ||
| 138 | } else { | ||
| 139 | p->speaker_id = -1; | ||
| 140 | ret = PTR_ERR(speaker_id); | ||
| 141 | dev_err(p->dev, "Get speaker id gpio failed %d.\n", | ||
| 142 | ret); | ||
| 132 | } | 143 | } |
| 144 | |||
| 145 | acpi_dev_remove_driver_gpios(adev); | ||
| 133 | } else { | 146 | } else { |
| 134 | p->speaker_id = NULL; | 147 | p->speaker_id = -1; |
| 135 | } | 148 | } |
| 136 | 149 | ||
| 137 | end_2563: | 150 | end_2563: |
| @@ -432,23 +445,16 @@ static void tasdevice_dspfw_init(void *context) · 294 unmodified lines | |||
| 432 | struct tas2781_hda *tas_hda = dev_get_drvdata(tas_priv->dev); | 445 | struct tas2781_hda *tas_hda = dev_get_drvdata(tas_priv->dev); |
| 433 | struct tas2781_hda_i2c_priv *hda_priv = tas_hda->hda_priv; | 446 | struct tas2781_hda_i2c_priv *hda_priv = tas_hda->hda_priv; |
| 434 | struct hda_codec *codec = tas_priv->codec; | 447 | struct hda_codec *codec = tas_priv->codec; |
| 435 | int ret, spk_id; | 448 | int ret; |
| 436 | 449 | ||
| 437 | tasdevice_dsp_remove(tas_priv); | 450 | tasdevice_dsp_remove(tas_priv); |
| 438 | tas_priv->fw_state = TASDEVICE_DSP_FW_PENDING; | 451 | tas_priv->fw_state = TASDEVICE_DSP_FW_PENDING; |
| 439 | if (tas_priv->speaker_id != NULL) { | 452 | if (tas_priv->speaker_id >= 0) { |
| 440 | // Speaker id need to be checked for ASUS only. | ||
| 441 | spk_id = gpiod_get_value(tas_priv->speaker_id); | ||
| 442 | if (spk_id < 0) { | ||
| 443 | // Speaker id is not valid, use default. | ||
| 444 | dev_dbg(tas_priv->dev, "Wrong spk_id = %d\n", spk_id); | ||
| 445 | spk_id = 0; | ||
| 446 | } | ||
| 447 | snprintf(tas_priv->coef_binaryname, | 453 | snprintf(tas_priv->coef_binaryname, |
| 448 | sizeof(tas_priv->coef_binaryname), | 454 | sizeof(tas_priv->coef_binaryname), |
| 449 | "TAS2XXX%04X%d.bin", | 455 | "TAS2XXX%04X%d.bin", |
| 450 | lower_16_bits(codec->core.subsystem_id), | 456 | lower_16_bits(codec->core.subsystem_id), |
| 451 | spk_id); | 457 | tas_priv->speaker_id); |
| 452 | } else { | 458 | } else { |
| 453 | snprintf(tas_priv->coef_binaryname, | 459 | snprintf(tas_priv->coef_binaryname, |
| 454 | sizeof(tas_priv->coef_binaryname), | 460 | sizeof(tas_priv->coef_binaryname), |
| @@ -2550,6 +2550,8 @@ static const struct pci_device_id azx_ids[] = { · 2549 unmodified lines | |||
| 2550 | { PCI_DEVICE_DATA(INTEL, HDA_PTL_H, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) }, | 2550 | { PCI_DEVICE_DATA(INTEL, HDA_PTL_H, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) }, |
| 2551 | /* Wildcat Lake */ | 2551 | /* Wildcat Lake */ |
| 2552 | { PCI_DEVICE_DATA(INTEL, HDA_WCL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) }, | 2552 | { PCI_DEVICE_DATA(INTEL, HDA_WCL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) }, |
| 2553 | /* Nova Lake */ | ||
| 2554 | { PCI_DEVICE_DATA(INTEL, HDA_NVL_S, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_LNL) }, | ||
| 2553 | /* Apollolake (Broxton-P) */ | 2555 | /* Apollolake (Broxton-P) */ |
| 2554 | { PCI_DEVICE_DATA(INTEL, HDA_APL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON) }, | 2556 | { PCI_DEVICE_DATA(INTEL, HDA_APL, AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON) }, |
| 2555 | /* Gemini-Lake */ | 2557 | /* Gemini-Lake */ |
| @@ -578,6 +578,14 @@ static const struct config_entry config_table[] = { · 577 unmodified lines | |||
| 578 | 578 | ||
| 579 | #endif | 579 | #endif |
| 580 | 580 | ||
| 581 | /* Nova Lake */ | ||
| 582 | #if IS_ENABLED(CONFIG_SND_SOC_SOF_NOVALAKE) | ||
| 583 | { | ||
| 584 | .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, | ||
| 585 | .device = PCI_DEVICE_ID_INTEL_HDA_NVL_S, | ||
| 586 | }, | ||
| 587 | #endif | ||
| 588 | |||
| 581 | }; | 589 | }; |
| 582 | 590 | ||
| 583 | static const struct config_entry *snd_intel_dsp_find_config | 591 | static const struct config_entry *snd_intel_dsp_find_config |
| @@ -9,9 +9,6 @@ · 8 unmodified lines | |||
| 9 | #include <sound/core.h> | 9 | #include <sound/core.h> |
| 10 | #include <sound/gus.h> | 10 | #include <sound/gus.h> |
| 11 | 11 | ||
| 12 | extern int snd_gf1_synth_init(struct snd_gus_card * gus); | ||
| 13 | extern void snd_gf1_synth_done(struct snd_gus_card * gus); | ||
| 14 | |||
| 15 | /* | 12 | /* |
| 16 | * ok.. default interrupt handlers... | 13 | * ok.. default interrupt handlers... |
| 17 | */ | 14 | */ |
| @@ -278,6 +278,7 @@ static int snd_wavefront_midi_input_close(struct snd_rawmidi_substream *substrea · 277 unmodified lines | |||
| 278 | return -EIO; | 278 | return -EIO; |
| 279 | 279 | ||
| 280 | guard(spinlock_irqsave)(&midi->open); | 280 | guard(spinlock_irqsave)(&midi->open); |
| 281 | midi->substream_input[mpu] = NULL; | ||
| 281 | midi->mode[mpu] &= ~MPU401_MODE_INPUT; | 282 | midi->mode[mpu] &= ~MPU401_MODE_INPUT; |
| 282 | 283 | ||
| 283 | return 0; | 284 | return 0; |
| @@ -300,6 +301,7 @@ static int snd_wavefront_midi_output_close(struct snd_rawmidi_substream *substre · 16 unmodified lines | |||
| 300 | return -EIO; | 301 | return -EIO; |
| 301 | 302 | ||
| 302 | guard(spinlock_irqsave)(&midi->open); | 303 | guard(spinlock_irqsave)(&midi->open); |
| 304 | midi->substream_output[mpu] = NULL; | ||
| 303 | midi->mode[mpu] &= ~MPU401_MODE_OUTPUT; | 305 | midi->mode[mpu] &= ~MPU401_MODE_OUTPUT; |
| 304 | return 0; | 306 | return 0; |
| 305 | } | 307 | } |
| @@ -950,9 +950,9 @@ wavefront_send_sample (snd_wavefront_t *dev, · 949 unmodified lines | |||
| 950 | if (header->size) { | 950 | if (header->size) { |
| 951 | dev->freemem = wavefront_freemem (dev); | 951 | dev->freemem = wavefront_freemem (dev); |
| 952 | 952 | ||
| 953 | if (dev->freemem < (int)header->size) { | 953 | if (dev->freemem < 0 || dev->freemem < header->size) { |
| 954 | dev_err(dev->card->dev, | 954 | dev_err(dev->card->dev, |
| 955 | "insufficient memory to load %d byte sample.\n", | 955 | "insufficient memory to load %u byte sample.\n", |
| 956 | header->size); | 956 | header->size); |
| 957 | return -ENOMEM; | 957 | return -ENOMEM; |
| 958 | } | 958 | } |
| @@ -568,7 +568,7 @@ static int vortex_Eqlzr_SetAllBandsFromActiveCoeffSet(vortex_t * vortex) · 567 unmodified lines | |||
| 568 | eqlzr_t *eq = &(vortex->eq); | 568 | eqlzr_t *eq = &(vortex->eq); |
| 569 | 569 | ||
| 570 | vortex_EqHw_SetLeftGainsTarget(vortex, eq->this130); | 570 | vortex_EqHw_SetLeftGainsTarget(vortex, eq->this130); |
| 571 | vortex_EqHw_SetRightGainsTarget(vortex, &(eq->this130[eq->this10])); | 571 | vortex_EqHw_SetRightGainsTarget(vortex, eq->this130 + eq->this10); |
| 572 | 572 | ||
| 573 | return 0; | 573 | return 0; |
| 574 | } | 574 | } |
| @@ -25,6 +25,9 @@ · 24 unmodified lines | |||
| 25 | #include <sound/control.h> | 25 | #include <sound/control.h> |
| 26 | #include <sound/asoundef.h> | 26 | #include <sound/asoundef.h> |
| 27 | 27 | ||
| 28 | #define NUM_ATC_SRCS 6 | ||
| 29 | #define NUM_ATC_PCM (2 * 4) | ||
| 30 | |||
| 28 | #define MONO_SUM_SCALE 0x19a8 /* 2^(-0.5) in 14-bit floating format */ | 31 | #define MONO_SUM_SCALE 0x19a8 /* 2^(-0.5) in 14-bit floating format */ |
| 29 | #define MAX_MULTI_CHN 8 | 32 | #define MAX_MULTI_CHN 8 |
| 30 | 33 | ||
| @@ -60,6 +63,7 @@ static const struct snd_pci_quirk subsys_20k2_list[] = { · 29 unmodified lines | |||
| 60 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_CREATIVE, 0xf000, | 63 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_CREATIVE, 0xf000, |
| 61 | PCI_SUBDEVICE_ID_CREATIVE_HENDRIX, "HENDRIX", | 64 | PCI_SUBDEVICE_ID_CREATIVE_HENDRIX, "HENDRIX", |
| 62 | CTHENDRIX), | 65 | CTHENDRIX), |
| 66 | SND_PCI_QUIRK(0x160b, 0x0101, "OK0010", CTOK0010), | ||
| 63 | { } /* terminator */ | 67 | { } /* terminator */ |
| 64 | }; | 68 | }; |
| 65 | 69 | ||
| @@ -75,6 +79,7 @@ static const char *ct_subsys_name[NUM_CTCARDS] = { · 9 unmodified lines | |||
| 75 | [CTHENDRIX] = "Hendrix", | 79 | [CTHENDRIX] = "Hendrix", |
| 76 | [CTSB0880] = "SB0880", | 80 | [CTSB0880] = "SB0880", |
| 77 | [CTSB1270] = "SB1270", | 81 | [CTSB1270] = "SB1270", |
| 82 | [CTOK0010] = "OK0010", | ||
| 78 | [CT20K2_UNKNOWN] = "Unknown", | 83 | [CT20K2_UNKNOWN] = "Unknown", |
| 79 | }; | 84 | }; |
| 80 | 85 | ||
| @@ -984,6 +989,24 @@ static struct capabilities atc_capabilities(struct ct_atc *atc) · 903 unmodified lines | |||
| 984 | return hw->capabilities(hw); | 989 | return hw->capabilities(hw); |
| 985 | } | 990 | } |
| 986 | 991 | ||
| 992 | static void atc_dedicated_rca_select(struct ct_atc *atc) | ||
| 993 | { | ||
| 994 | struct dao *dao; | ||
| 995 | struct ct_mixer *mixer = atc->mixer; | ||
| 996 | struct rsc *rscs[2] = {NULL}; | ||
| 997 | |||
| 998 | dao = container_of(atc->daios[atc->rca_state ? RCA : LINEO1], | ||
| 999 | struct dao, daio); | ||
| 1000 | dao->ops->clear_left_input(dao); | ||
| 1001 | dao->ops->clear_right_input(dao); | ||
| 1002 | |||
| 1003 | mixer->get_output_ports(mixer, MIX_WAVE_FRONT, &rscs[0], &rscs[1]); | ||
| 1004 | dao = container_of(atc->daios[atc->rca_state ? LINEO1 : RCA], | ||
| 1005 | struct dao, daio); | ||
| 1006 | dao->ops->set_left_input(dao, rscs[0]); | ||
| 1007 | dao->ops->set_right_input(dao, rscs[1]); | ||
| 1008 | } | ||
| 1009 | |||
| 987 | static int atc_output_switch_get(struct ct_atc *atc) | 1010 | static int atc_output_switch_get(struct ct_atc *atc) |
| 988 | { | 1011 | { |
| 989 | struct hw *hw = atc->hw; | 1012 | struct hw *hw = atc->hw; |
| @@ -1085,6 +1108,11 @@ static int atc_mic_unmute(struct ct_atc *atc, unsigned char state) · 95 unmodified lines | |||
| 1085 | return atc_daio_unmute(atc, state, MIC); | 1108 | return atc_daio_unmute(atc, state, MIC); |
| 1086 | } | 1109 | } |
| 1087 | 1110 | ||
| 1111 | static int atc_rca_unmute(struct ct_atc *atc, unsigned char state) | ||
| 1112 | { | ||
| 1113 | return atc_daio_unmute(atc, state, RCA); | ||
| 1114 | } | ||
| 1115 | |||
| 1088 | static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state) | 1116 | static int atc_spdif_out_unmute(struct ct_atc *atc, unsigned char state) |
| 1089 | { | 1117 | { |
| 1090 | return atc_daio_unmute(atc, state, SPDIFOO); | 1118 | return atc_daio_unmute(atc, state, SPDIFOO); |
| @@ -1161,9 +1189,11 @@ static int atc_release_resources(struct ct_atc *atc) · 70 unmodified lines | |||
| 1161 | 1189 | ||
| 1162 | if (atc->daios) { | 1190 | if (atc->daios) { |
| 1163 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; | 1191 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; |
| 1164 | for (i = 0; i < atc->n_daio; i++) { | 1192 | for (i = 0; i < NUM_DAIOTYP; i++) { |
| 1165 | daio = atc->daios[i]; | 1193 | daio = atc->daios[i]; |
| 1166 | if (daio->type < LINEIM) { | 1194 | if (!daio) |
| 1195 | continue; | ||
| 1196 | if (daio->output) { | ||
| 1167 | dao = container_of(daio, struct dao, daio); | 1197 | dao = container_of(daio, struct dao, daio); |
| 1168 | dao->ops->clear_left_input(dao); | 1198 | dao->ops->clear_left_input(dao); |
| 1169 | dao->ops->clear_right_input(dao); | 1199 | dao->ops->clear_right_input(dao); |
| @@ -1176,8 +1206,9 @@ static int atc_release_resources(struct ct_atc *atc) · 6 unmodified lines | |||
| 1176 | 1206 | ||
| 1177 | if (atc->pcm) { | 1207 | if (atc->pcm) { |
| 1178 | sum_mgr = atc->rsc_mgrs[SUM]; | 1208 | sum_mgr = atc->rsc_mgrs[SUM]; |
| 1179 | for (i = 0; i < atc->n_pcm; i++) | 1209 | for (i = 0; i < NUM_ATC_PCM; i++) |
| 1180 | sum_mgr->put_sum(sum_mgr, atc->pcm[i]); | 1210 | if (atc->pcm[i]) |
| 1211 | sum_mgr->put_sum(sum_mgr, atc->pcm[i]); | ||
| 1181 | 1212 | ||
| 1182 | kfree(atc->pcm); | 1213 | kfree(atc->pcm); |
| 1183 | atc->pcm = NULL; | 1214 | atc->pcm = NULL; |
| @@ -1185,8 +1216,9 @@ static int atc_release_resources(struct ct_atc *atc) · 1 unmodified line | |||
| 1185 | 1216 | ||
| 1186 | if (atc->srcs) { | 1217 | if (atc->srcs) { |
| 1187 | src_mgr = atc->rsc_mgrs[SRC]; | 1218 | src_mgr = atc->rsc_mgrs[SRC]; |
| 1188 | for (i = 0; i < atc->n_src; i++) | 1219 | for (i = 0; i < NUM_ATC_SRCS; i++) |
| 1189 | src_mgr->put_src(src_mgr, atc->srcs[i]); | 1220 | if (atc->srcs[i]) |
| 1221 | src_mgr->put_src(src_mgr, atc->srcs[i]); | ||
| 1190 | 1222 | ||
| 1191 | kfree(atc->srcs); | 1223 | kfree(atc->srcs); |
| 1192 | atc->srcs = NULL; | 1224 | atc->srcs = NULL; |
| @@ -1194,7 +1226,9 @@ static int atc_release_resources(struct ct_atc *atc) · 1 unmodified line | |||
| 1194 | 1226 | ||
| 1195 | if (atc->srcimps) { | 1227 | if (atc->srcimps) { |
| 1196 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; | 1228 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; |
| 1197 | for (i = 0; i < atc->n_srcimp; i++) { | 1229 | for (i = 0; i < NUM_ATC_SRCS; i++) { |
| 1230 | if (!atc->srcimps[i]) | ||
| 1231 | continue; | ||
| 1198 | srcimp = atc->srcimps[i]; | 1232 | srcimp = atc->srcimps[i]; |
| 1199 | srcimp->ops->unmap(srcimp); | 1233 | srcimp->ops->unmap(srcimp); |
| 1200 | srcimp_mgr->put_srcimp(srcimp_mgr, atc->srcimps[i]); | 1234 | srcimp_mgr->put_srcimp(srcimp_mgr, atc->srcimps[i]); |
| @@ -1294,6 +1328,7 @@ static int atc_identify_card(struct ct_atc *atc, unsigned int ssid) · 93 unmodified lines | |||
| 1294 | dev_info(atc->card->dev, "chip %s model %s (%04x:%04x) is found\n", | 1328 | dev_info(atc->card->dev, "chip %s model %s (%04x:%04x) is found\n", |
| 1295 | atc->chip_name, atc->model_name, | 1329 | atc->chip_name, atc->model_name, |
| 1296 | vendor_id, device_id); | 1330 | vendor_id, device_id); |
| 1331 | atc->rca_state = 0; | ||
| 1297 | return 0; | 1332 | return 0; |
| 1298 | } | 1333 | } |
| 1299 | 1334 | ||
| @@ -1367,32 +1402,35 @@ static int atc_get_resources(struct ct_atc *atc) · 67 unmodified lines | |||
| 1367 | struct srcimp_mgr *srcimp_mgr; | 1402 | struct srcimp_mgr *srcimp_mgr; |
| 1368 | struct sum_desc sum_dsc = {0}; | 1403 | struct sum_desc sum_dsc = {0}; |
| 1369 | struct sum_mgr *sum_mgr; | 1404 | struct sum_mgr *sum_mgr; |
| 1370 | int err, i, num_srcs, num_daios; | 1405 | struct capabilities cap; |
| 1406 | int err, i; | ||
| 1371 | 1407 | ||
| 1372 | num_daios = ((atc->model == CTSB1270) ? 8 : 7); | 1408 | cap = atc->capabilities(atc); |
| 1373 | num_srcs = ((atc->model == CTSB1270) ? 6 : 4); | ||
| 1374 | 1409 | ||
| 1375 | atc->daios = kcalloc(num_daios, sizeof(void *), GFP_KERNEL); | 1410 | atc->daios = kcalloc(NUM_DAIOTYP, sizeof(void *), GFP_KERNEL); |
| 1376 | if (!atc->daios) | 1411 | if (!atc->daios) |
| 1377 | return -ENOMEM; | 1412 | return -ENOMEM; |
| 1378 | 1413 | ||
| 1379 | atc->srcs = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL); | 1414 | atc->srcs = kcalloc(NUM_ATC_SRCS, sizeof(void *), GFP_KERNEL); |
| 1380 | if (!atc->srcs) | 1415 | if (!atc->srcs) |
| 1381 | return -ENOMEM; | 1416 | return -ENOMEM; |
| 1382 | 1417 | ||
| 1383 | atc->srcimps = kcalloc(num_srcs, sizeof(void *), GFP_KERNEL); | 1418 | atc->srcimps = kcalloc(NUM_ATC_SRCS, sizeof(void *), GFP_KERNEL); |
| 1384 | if (!atc->srcimps) | 1419 | if (!atc->srcimps) |
| 1385 | return -ENOMEM; | 1420 | return -ENOMEM; |
| 1386 | 1421 | ||
| 1387 | atc->pcm = kcalloc(2 * 4, sizeof(void *), GFP_KERNEL); | 1422 | atc->pcm = kcalloc(NUM_ATC_PCM, sizeof(void *), GFP_KERNEL); |
| 1388 | if (!atc->pcm) | 1423 | if (!atc->pcm) |
| 1389 | return -ENOMEM; | 1424 | return -ENOMEM; |
| 1390 | 1425 | ||
| 1391 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; | 1426 | daio_mgr = (struct daio_mgr *)atc->rsc_mgrs[DAIO]; |
| 1392 | da_desc.msr = atc->msr; | 1427 | da_desc.msr = atc->msr; |
| 1393 | for (i = 0, atc->n_daio = 0; i < num_daios; i++) { | 1428 | for (i = 0; i < NUM_DAIOTYP; i++) { |
| 1429 | if (((i == MIC) && !cap.dedicated_mic) || ((i == RCA) && !cap.dedicated_rca)) | ||
| 1430 | continue; | ||
| 1394 | da_desc.type = (atc->model != CTSB073X) ? i : | 1431 | da_desc.type = (atc->model != CTSB073X) ? i : |
| 1395 | ((i == SPDIFIO) ? SPDIFI1 : i); | 1432 | ((i == SPDIFIO) ? SPDIFI1 : i); |
| 1433 | da_desc.output = (i < LINEIM) || (i == RCA); | ||
| 1396 | err = daio_mgr->get_daio(daio_mgr, &da_desc, | 1434 | err = daio_mgr->get_daio(daio_mgr, &da_desc, |
| 1397 | (struct daio **)&atc->daios[i]); | 1435 | (struct daio **)&atc->daios[i]); |
| 1398 | if (err) { | 1436 | if (err) { |
| @@ -1401,42 +1439,39 @@ static int atc_get_resources(struct ct_atc *atc) · 2 unmodified lines | |||
| 1401 | i); | 1439 | i); |
| 1402 | return err; | 1440 | return err; |
| 1403 | } | 1441 | } |
| 1404 | atc->n_daio++; | ||
| 1405 | } | 1442 | } |
| 1406 | 1443 | ||
| 1407 | src_mgr = atc->rsc_mgrs[SRC]; | 1444 | src_mgr = atc->rsc_mgrs[SRC]; |
| 1408 | src_dsc.multi = 1; | 1445 | src_dsc.multi = 1; |
| 1409 | src_dsc.msr = atc->msr; | 1446 | src_dsc.msr = atc->msr; |
| 1410 | src_dsc.mode = ARCRW; | 1447 | src_dsc.mode = ARCRW; |
| 1411 | for (i = 0, atc->n_src = 0; i < num_srcs; i++) { | 1448 | for (i = 0; i < NUM_ATC_SRCS; i++) { |
| 1449 | if (((i > 3) && !cap.dedicated_mic)) | ||
| 1450 | continue; | ||
| 1412 | err = src_mgr->get_src(src_mgr, &src_dsc, | 1451 | err = src_mgr->get_src(src_mgr, &src_dsc, |
| 1413 | (struct src **)&atc->srcs[i]); | 1452 | (struct src **)&atc->srcs[i]); |
| 1414 | if (err) | 1453 | if (err) |
| 1415 | return err; | 1454 | return err; |
| 1416 | |||
| 1417 | atc->n_src++; | ||
| 1418 | } | 1455 | } |
| 1419 | 1456 | ||
| 1420 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; | 1457 | srcimp_mgr = atc->rsc_mgrs[SRCIMP]; |
| 1421 | srcimp_dsc.msr = 8; | 1458 | srcimp_dsc.msr = 8; |
| 1422 | for (i = 0, atc->n_srcimp = 0; i < num_srcs; i++) { | 1459 | for (i = 0; i < NUM_ATC_SRCS; i++) { |
| 1460 | if (((i > 3) && !cap.dedicated_mic)) | ||
| 1461 | continue; | ||
| 1423 | err = srcimp_mgr->get_srcimp(srcimp_mgr, &srcimp_dsc, | 1462 | err = srcimp_mgr->get_srcimp(srcimp_mgr, &srcimp_dsc, |
| 1424 | (struct srcimp **)&atc->srcimps[i]); | 1463 | (struct srcimp **)&atc->srcimps[i]); |
| 1425 | if (err) | 1464 | if (err) |
| 1426 | return err; | 1465 | return err; |
| 1427 | |||
| 1428 | atc->n_srcimp++; | ||
| 1429 | } | 1466 | } |
| 1430 | 1467 | ||
| 1431 | sum_mgr = atc->rsc_mgrs[SUM]; | 1468 | sum_mgr = atc->rsc_mgrs[SUM]; |
| 1432 | sum_dsc.msr = atc->msr; | 1469 | sum_dsc.msr = atc->msr; |
| 1433 | for (i = 0, atc->n_pcm = 0; i < (2*4); i++) { | 1470 | for (i = 0; i < NUM_ATC_PCM; i++) { |
| 1434 | err = sum_mgr->get_sum(sum_mgr, &sum_dsc, | 1471 | err = sum_mgr->get_sum(sum_mgr, &sum_dsc, |
| 1435 | (struct sum **)&atc->pcm[i]); | 1472 | (struct sum **)&atc->pcm[i]); |
| 1436 | if (err) | 1473 | if (err) |
| 1437 | return err; | 1474 | return err; |
| 1438 | |||
| 1439 | atc->n_pcm++; | ||
| 1440 | } | 1475 | } |
| 1441 | 1476 | ||
| 1442 | return 0; | 1477 | return 0; |
| @@ -1489,9 +1524,11 @@ static void atc_connect_resources(struct ct_atc *atc) · 46 unmodified lines | |||
| 1489 | struct sum *sum; | 1524 | struct sum *sum; |
| 1490 | struct ct_mixer *mixer; | 1525 | struct ct_mixer *mixer; |
| 1491 | struct rsc *rscs[2] = {NULL}; | 1526 | struct rsc *rscs[2] = {NULL}; |
| 1527 | struct capabilities cap; | ||
| 1492 | int i, j; | 1528 | int i, j; |
| 1493 | 1529 | ||
| 1494 | mixer = atc->mixer; | 1530 | mixer = atc->mixer; |
| 1531 | cap = atc->capabilities(atc); | ||
| 1495 | 1532 | ||
| 1496 | for (i = MIX_WAVE_FRONT, j = LINEO1; i <= MIX_SPDIF_OUT; i++, j++) { | 1533 | for (i = MIX_WAVE_FRONT, j = LINEO1; i <= MIX_SPDIF_OUT; i++, j++) { |
| 1497 | mixer->get_output_ports(mixer, i, &rscs[0], &rscs[1]); | 1534 | mixer->get_output_ports(mixer, i, &rscs[0], &rscs[1]); |
| @@ -1500,6 +1537,11 @@ static void atc_connect_resources(struct ct_atc *atc) · 2 unmodified lines | |||
| 1500 | dao->ops->set_right_input(dao, rscs[1]); | 1537 | dao->ops->set_right_input(dao, rscs[1]); |
| 1501 | } | 1538 | } |
| 1502 | 1539 | ||
| 1540 | if (cap.dedicated_rca) { | ||
| 1541 | /* SE-300PCIE has a dedicated DAC for the RCA. */ | ||
| 1542 | atc_dedicated_rca_select(atc); | ||
| 1543 | } | ||
| 1544 | |||
| 1503 | dai = container_of(atc->daios[LINEIM], struct dai, daio); | 1545 | dai = container_of(atc->daios[LINEIM], struct dai, daio); |
| 1504 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, | 1546 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, |
| 1505 | (struct src **)&atc->srcs[2], | 1547 | (struct src **)&atc->srcs[2], |
| @@ -1509,8 +1551,9 @@ static void atc_connect_resources(struct ct_atc *atc) · 3 unmodified lines | |||
| 1509 | src = atc->srcs[3]; | 1551 | src = atc->srcs[3]; |
| 1510 | mixer->set_input_right(mixer, MIX_LINE_IN, &src->rsc); | 1552 | mixer->set_input_right(mixer, MIX_LINE_IN, &src->rsc); |
| 1511 | 1553 | ||
| 1512 | if (atc->model == CTSB1270) { | 1554 | if (cap.dedicated_mic) { |
| 1513 | /* Titanium HD has a dedicated ADC for the Mic. */ | 1555 | /* Titanium HD has a dedicated ADC for the Mic. */ |
| 1556 | /* SE-300PCIE has a 4-channel ADC. */ | ||
| 1514 | dai = container_of(atc->daios[MIC], struct dai, daio); | 1557 | dai = container_of(atc->daios[MIC], struct dai, daio); |
| 1515 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, | 1558 | atc_connect_dai(atc->rsc_mgrs[SRC], dai, |
| 1516 | (struct src **)&atc->srcs[4], | 1559 | (struct src **)&atc->srcs[4], |
| @@ -1632,12 +1675,14 @@ static const struct ct_atc atc_preset = { · 115 unmodified lines | |||
| 1632 | .line_rear_unmute = atc_line_rear_unmute, | 1675 | .line_rear_unmute = atc_line_rear_unmute, |
| 1633 | .line_in_unmute = atc_line_in_unmute, | 1676 | .line_in_unmute = atc_line_in_unmute, |
| 1634 | .mic_unmute = atc_mic_unmute, | 1677 | .mic_unmute = atc_mic_unmute, |
| 1678 | .rca_unmute = atc_rca_unmute, | ||
| 1635 | .spdif_out_unmute = atc_spdif_out_unmute, | 1679 | .spdif_out_unmute = atc_spdif_out_unmute, |
| 1636 | .spdif_in_unmute = atc_spdif_in_unmute, | 1680 | .spdif_in_unmute = atc_spdif_in_unmute, |
| 1637 | .spdif_out_get_status = atc_spdif_out_get_status, | 1681 | .spdif_out_get_status = atc_spdif_out_get_status, |
| 1638 | .spdif_out_set_status = atc_spdif_out_set_status, | 1682 | .spdif_out_set_status = atc_spdif_out_set_status, |
| 1639 | .spdif_out_passthru = atc_spdif_out_passthru, | 1683 | .spdif_out_passthru = atc_spdif_out_passthru, |
| 1640 | .capabilities = atc_capabilities, | 1684 | .capabilities = atc_capabilities, |
| 1685 | .dedicated_rca_select = atc_dedicated_rca_select, | ||
| 1641 | .output_switch_get = atc_output_switch_get, | 1686 | .output_switch_get = atc_output_switch_get, |
| 1642 | .output_switch_put = atc_output_switch_put, | 1687 | .output_switch_put = atc_output_switch_put, |
| 1643 | .mic_source_switch_get = atc_mic_source_switch_get, | 1688 | .mic_source_switch_get = atc_mic_source_switch_get, |
| @@ -82,6 +82,8 @@ struct ct_atc { · 81 unmodified lines | |||
| 82 | const char *chip_name; | 82 | const char *chip_name; |
| 83 | const char *model_name; | 83 | const char *model_name; |
| 84 | 84 | ||
| 85 | unsigned char rca_state; /* 0 = dedicated RCA, 1 = 7.1ch Front */ | ||
| 86 | |||
| 85 | struct ct_vm *vm; /* device virtual memory manager for this card */ | 87 | struct ct_vm *vm; /* device virtual memory manager for this card */ |
| 86 | int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); | 88 | int (*map_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); |
| 87 | void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); | 89 | void (*unmap_audio_buffer)(struct ct_atc *atc, struct ct_atc_pcm *apcm); |
| @@ -113,12 +115,14 @@ struct ct_atc { · 25 unmodified lines | |||
| 113 | int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state); | 115 | int (*line_rear_unmute)(struct ct_atc *atc, unsigned char state); |
| 114 | int (*line_in_unmute)(struct ct_atc *atc, unsigned char state); | 116 | int (*line_in_unmute)(struct ct_atc *atc, unsigned char state); |
| 115 | int (*mic_unmute)(struct ct_atc *atc, unsigned char state); | 117 | int (*mic_unmute)(struct ct_atc *atc, unsigned char state); |
| 118 | int (*rca_unmute)(struct ct_atc *atc, unsigned char state); | ||
| 116 | int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state); | 119 | int (*spdif_out_unmute)(struct ct_atc *atc, unsigned char state); |
| 117 | int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state); | 120 | int (*spdif_in_unmute)(struct ct_atc *atc, unsigned char state); |
| 118 | int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status); | 121 | int (*spdif_out_get_status)(struct ct_atc *atc, unsigned int *status); |
| 119 | int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status); | 122 | int (*spdif_out_set_status)(struct ct_atc *atc, unsigned int status); |
| 120 | int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state); | 123 | int (*spdif_out_passthru)(struct ct_atc *atc, unsigned char state); |
| 121 | struct capabilities (*capabilities)(struct ct_atc *atc); | 124 | struct capabilities (*capabilities)(struct ct_atc *atc); |
| 125 | void (*dedicated_rca_select)(struct ct_atc *atc); | ||
| 122 | int (*output_switch_get)(struct ct_atc *atc); | 126 | int (*output_switch_get)(struct ct_atc *atc); |
| 123 | int (*output_switch_put)(struct ct_atc *atc, int position); | 127 | int (*output_switch_put)(struct ct_atc *atc, int position); |
| 124 | int (*mic_source_switch_get)(struct ct_atc *atc); | 128 | int (*mic_source_switch_get)(struct ct_atc *atc); |
| @@ -132,10 +136,6 @@ struct ct_atc { · 7 unmodified lines | |||
| 132 | void **pcm; /* SUMs for collecting all pcm stream */ | 136 | void **pcm; /* SUMs for collecting all pcm stream */ |
| 133 | void **srcs; /* Sample Rate Converters for input signal */ | 137 | void **srcs; /* Sample Rate Converters for input signal */ |
| 134 | void **srcimps; /* input mappers for SRCs */ | 138 | void **srcimps; /* input mappers for SRCs */ |
| 135 | unsigned char n_daio; | ||
| 136 | unsigned char n_src; | ||
| 137 | unsigned char n_srcimp; | ||
| 138 | unsigned char n_pcm; | ||
| 139 | 139 | ||
| 140 | struct ct_timer *timer; | 140 | struct ct_timer *timer; |
| 141 | 141 | ||
| @@ -18,8 +18,6 @@ · 17 unmodified lines | |||
| 18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
| 19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 20 | 20 | ||
| 21 | #define DAIO_OUT_MAX SPDIFOO | ||
| 22 | |||
| 23 | struct daio_usage { | 21 | struct daio_usage { |
| 24 | unsigned short data; | 22 | unsigned short data; |
| 25 | }; | 23 | }; |
| @@ -47,6 +45,7 @@ static const struct daio_rsc_idx idx_20k2[NUM_DAIOTYP] = { · 21 unmodified lines | |||
| 47 | [LINEO4] = {.left = 0x70, .right = 0x71}, | 45 | [LINEO4] = {.left = 0x70, .right = 0x71}, |
| 48 | [LINEIM] = {.left = 0x45, .right = 0xc5}, | 46 | [LINEIM] = {.left = 0x45, .right = 0xc5}, |
| 49 | [MIC] = {.left = 0x55, .right = 0xd5}, | 47 | [MIC] = {.left = 0x55, .right = 0xd5}, |
| 48 | [RCA] = {.left = 0x30, .right = 0x31}, | ||
| 50 | [SPDIFOO] = {.left = 0x00, .right = 0x01}, | 49 | [SPDIFOO] = {.left = 0x00, .right = 0x01}, |
| 51 | [SPDIFIO] = {.left = 0x05, .right = 0x85}, | 50 | [SPDIFIO] = {.left = 0x05, .right = 0x85}, |
| 52 | }; | 51 | }; |
| @@ -125,6 +124,7 @@ static unsigned int daio_device_index(enum DAIOTYP type, struct hw *hw) · 72 unmodified lines | |||
| 125 | case LINEO4: return 6; | 124 | case LINEO4: return 6; |
| 126 | case LINEIM: return 4; | 125 | case LINEIM: return 4; |
| 127 | case MIC: return 5; | 126 | case MIC: return 5; |
| 127 | case RCA: return 3; | ||
| 128 | default: return -EINVAL; | 128 | default: return -EINVAL; |
| 129 | } | 129 | } |
| 130 | default: | 130 | default: |
| @@ -329,7 +329,7 @@ static int daio_rsc_init(struct daio *daio, · 198 unmodified lines | |||
| 329 | goto error1; | 329 | goto error1; |
| 330 | 330 | ||
| 331 | /* Set daio->rscl/r->ops to daio specific ones */ | 331 | /* Set daio->rscl/r->ops to daio specific ones */ |
| 332 | if (desc->type <= DAIO_OUT_MAX) { | 332 | if (desc->output) { |
| 333 | daio->rscl.ops = daio->rscr.ops = &daio_out_rsc_ops; | 333 | daio->rscl.ops = daio->rscr.ops = &daio_out_rsc_ops; |
| 334 | } else { | 334 | } else { |
| 335 | switch (hw->chip_type) { | 335 | switch (hw->chip_type) { |
| @@ -344,6 +344,7 @@ static int daio_rsc_init(struct daio *daio, · 8 unmodified lines | |||
| 344 | } | 344 | } |
| 345 | } | 345 | } |
| 346 | daio->type = desc->type; | 346 | daio->type = desc->type; |
| 347 | daio->output = desc->output; | ||
| 347 | 348 | ||
| 348 | return 0; | 349 | return 0; |
| 349 | 350 | ||
| @@ -390,7 +391,7 @@ static int dao_rsc_init(struct dao *dao, · 40 unmodified lines | |||
| 390 | hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk); | 391 | hw->daio_mgr_commit_write(hw, mgr->mgr.ctrl_blk); |
| 391 | 392 | ||
| 392 | conf = (desc->msr & 0x7) | (desc->passthru << 3); | 393 | conf = (desc->msr & 0x7) | (desc->passthru << 3); |
| 393 | hw->daio_mgr_dao_init(mgr->mgr.ctrl_blk, | 394 | hw->daio_mgr_dao_init(hw, mgr->mgr.ctrl_blk, |
| 394 | daio_device_index(dao->daio.type, hw), conf); | 395 | daio_device_index(dao->daio.type, hw), conf); |
| 395 | hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk, | 396 | hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk, |
| 396 | daio_device_index(dao->daio.type, hw)); | 397 | daio_device_index(dao->daio.type, hw)); |
| @@ -433,6 +434,7 @@ static int dao_rsc_reinit(struct dao *dao, const struct dao_desc *desc) · 36 unmodified lines | |||
| 433 | dsc.type = dao->daio.type; | 434 | dsc.type = dao->daio.type; |
| 434 | dsc.msr = desc->msr; | 435 | dsc.msr = desc->msr; |
| 435 | dsc.passthru = desc->passthru; | 436 | dsc.passthru = desc->passthru; |
| 437 | dsc.output = dao->daio.output; | ||
| 436 | dao_rsc_uninit(dao); | 438 | dao_rsc_uninit(dao); |
| 437 | return dao_rsc_init(dao, &dsc, mgr); | 439 | return dao_rsc_init(dao, &dsc, mgr); |
| 438 | } | 440 | } |
| @@ -518,7 +520,7 @@ static int get_daio_rsc(struct daio_mgr *mgr, · 79 unmodified lines | |||
| 518 | 520 | ||
| 519 | err = -ENOMEM; | 521 | err = -ENOMEM; |
| 520 | /* Allocate mem for daio resource */ | 522 | /* Allocate mem for daio resource */ |
| 521 | if (desc->type <= DAIO_OUT_MAX) { | 523 | if (desc->output) { |
| 522 | struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL); | 524 | struct dao *dao = kzalloc(sizeof(*dao), GFP_KERNEL); |
| 523 | if (!dao) | 525 | if (!dao) |
| 524 | goto error; | 526 | goto error; |
| @@ -565,7 +567,7 @@ static int put_daio_rsc(struct daio_mgr *mgr, struct daio *daio) · 40 unmodified lines | |||
| 565 | daio_mgr_put_rsc(&mgr->mgr, daio->type); | 567 | daio_mgr_put_rsc(&mgr->mgr, daio->type); |
| 566 | } | 568 | } |
| 567 | 569 | ||
| 568 | if (daio->type <= DAIO_OUT_MAX) { | 570 | if (daio->output) { |
| 569 | dao_rsc_uninit(container_of(daio, struct dao, daio)); | 571 | dao_rsc_uninit(container_of(daio, struct dao, daio)); |
| 570 | kfree(container_of(daio, struct dao, daio)); | 572 | kfree(container_of(daio, struct dao, daio)); |
| 571 | } else { | 573 | } else { |
| @@ -580,7 +582,7 @@ static int daio_mgr_enb_daio(struct daio_mgr *mgr, struct daio *daio) · 8 unmodified lines | |||
| 580 | { | 582 | { |
| 581 | struct hw *hw = mgr->mgr.hw; | 583 | struct hw *hw = mgr->mgr.hw; |
| 582 | 584 | ||
| 583 | if (DAIO_OUT_MAX >= daio->type) { | 585 | if (daio->output) { |
| 584 | hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk, | 586 | hw->daio_mgr_enb_dao(mgr->mgr.ctrl_blk, |
| 585 | daio_device_index(daio->type, hw)); | 587 | daio_device_index(daio->type, hw)); |
| 586 | } else { | 588 | } else { |
| @@ -594,7 +596,7 @@ static int daio_mgr_dsb_daio(struct daio_mgr *mgr, struct daio *daio) · 7 unmodified lines | |||
| 594 | { | 596 | { |
| 595 | struct hw *hw = mgr->mgr.hw; | 597 | struct hw *hw = mgr->mgr.hw; |
| 596 | 598 | ||
| 597 | if (DAIO_OUT_MAX >= daio->type) { | 599 | if (daio->output) { |
| 598 | hw->daio_mgr_dsb_dao(mgr->mgr.ctrl_blk, | 600 | hw->daio_mgr_dsb_dao(mgr->mgr.ctrl_blk, |
| 599 | daio_device_index(daio->type, hw)); | 601 | daio_device_index(daio->type, hw)); |
| 600 | } else { | 602 | } else { |
| @@ -31,6 +31,7 @@ enum DAIOTYP { · 30 unmodified lines | |||
| 31 | LINEIM, | 31 | LINEIM, |
| 32 | SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */ | 32 | SPDIFIO, /* S/PDIF In (Flexijack/Optical) on the card */ |
| 33 | MIC, /* Dedicated mic on Titanium HD */ | 33 | MIC, /* Dedicated mic on Titanium HD */ |
| 34 | RCA, /* Dedicated RCA on SE-300PCIE */ | ||
| 34 | SPDIFI1, /* S/PDIF In on internal Drive Bay */ | 35 | SPDIFI1, /* S/PDIF In on internal Drive Bay */ |
| 35 | NUM_DAIOTYP | 36 | NUM_DAIOTYP |
| 36 | }; | 37 | }; |
| @@ -43,6 +44,7 @@ struct daio { · 6 unmodified lines | |||
| 43 | struct rsc rscl; /* Basic resource info for left TX/RX */ | 44 | struct rsc rscl; /* Basic resource info for left TX/RX */ |
| 44 | struct rsc rscr; /* Basic resource info for right TX/RX */ | 45 | struct rsc rscr; /* Basic resource info for right TX/RX */ |
| 45 | enum DAIOTYP type; | 46 | enum DAIOTYP type; |
| 47 | unsigned char output; | ||
| 46 | }; | 48 | }; |
| 47 | 49 | ||
| 48 | struct dao { | 50 | struct dao { |
| @@ -91,6 +93,7 @@ struct daio_desc { · 42 unmodified lines | |||
| 91 | unsigned int type:4; | 93 | unsigned int type:4; |
| 92 | unsigned int msr:4; | 94 | unsigned int msr:4; |
| 93 | unsigned int passthru:1; | 95 | unsigned int passthru:1; |
| 96 | unsigned int output:1; | ||
| 94 | }; | 97 | }; |
| 95 | 98 | ||
| 96 | struct daio_mgr { | 99 | struct daio_mgr { |
| @@ -38,6 +38,7 @@ enum CTCARDS { · 37 unmodified lines | |||
| 38 | CTHENDRIX, | 38 | CTHENDRIX, |
| 39 | CTSB0880, | 39 | CTSB0880, |
| 40 | CTSB1270, | 40 | CTSB1270, |
| 41 | CTOK0010, | ||
| 41 | CT20K2_UNKNOWN, | 42 | CT20K2_UNKNOWN, |
| 42 | NUM_CTCARDS /* This should always be the last */ | 43 | NUM_CTCARDS /* This should always be the last */ |
| 43 | }; | 44 | }; |
| @@ -62,6 +63,7 @@ struct card_conf { · 18 unmodified lines | |||
| 62 | struct capabilities { | 63 | struct capabilities { |
| 63 | unsigned int digit_io_switch:1; | 64 | unsigned int digit_io_switch:1; |
| 64 | unsigned int dedicated_mic:1; | 65 | unsigned int dedicated_mic:1; |
| 66 | unsigned int dedicated_rca:1; | ||
| 65 | unsigned int output_switch:1; | 67 | unsigned int output_switch:1; |
| 66 | unsigned int mic_source_switch:1; | 68 | unsigned int mic_source_switch:1; |
| 67 | }; | 69 | }; |
| @@ -167,7 +169,7 @@ struct hw { · 99 unmodified lines | |||
| 167 | int (*daio_mgr_dsb_dai)(void *blk, unsigned int idx); | 169 | int (*daio_mgr_dsb_dai)(void *blk, unsigned int idx); |
| 168 | int (*daio_mgr_enb_dao)(void *blk, unsigned int idx); | 170 | int (*daio_mgr_enb_dao)(void *blk, unsigned int idx); |
| 169 | int (*daio_mgr_dsb_dao)(void *blk, unsigned int idx); | 171 | int (*daio_mgr_dsb_dao)(void *blk, unsigned int idx); |
| 170 | int (*daio_mgr_dao_init)(void *blk, unsigned int idx, | 172 | int (*daio_mgr_dao_init)(struct hw *hw, void *blk, unsigned int idx, |
| 171 | unsigned int conf); | 173 | unsigned int conf); |
| 172 | int (*daio_mgr_set_imaparc)(void *blk, unsigned int slot); | 174 | int (*daio_mgr_set_imaparc)(void *blk, unsigned int slot); |
| 173 | int (*daio_mgr_set_imapnxt)(void *blk, unsigned int next); | 175 | int (*daio_mgr_set_imapnxt)(void *blk, unsigned int next); |
| @@ -1031,7 +1031,7 @@ static int daio_mgr_dsb_dao(void *blk, unsigned int idx) · 1030 unmodified lines | |||
| 1031 | return 0; | 1031 | return 0; |
| 1032 | } | 1032 | } |
| 1033 | 1033 | ||
| 1034 | static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf) | 1034 | static int daio_mgr_dao_init(struct hw *hw __maybe_unused, void *blk, unsigned int idx, unsigned int conf) |
| 1035 | { | 1035 | { |
| 1036 | struct daio_mgr_ctrl_blk *ctl = blk; | 1036 | struct daio_mgr_ctrl_blk *ctl = blk; |
| 1037 | 1037 | ||
| @@ -1775,6 +1775,7 @@ static struct capabilities hw_capabilities(struct hw *hw) · 737 unmodified lines | |||
| 1775 | /* SB073x and Vista compatible cards have no digit IO switch */ | 1775 | /* SB073x and Vista compatible cards have no digit IO switch */ |
| 1776 | cap.digit_io_switch = !(hw->model == CTSB073X || hw->model == CTUAA); | 1776 | cap.digit_io_switch = !(hw->model == CTSB073X || hw->model == CTUAA); |
| 1777 | cap.dedicated_mic = 0; | 1777 | cap.dedicated_mic = 0; |
| 1778 | cap.dedicated_rca = 0; | ||
| 1778 | cap.output_switch = 0; | 1779 | cap.output_switch = 0; |
| 1779 | cap.mic_source_switch = 0; | 1780 | cap.mic_source_switch = 0; |
| 1780 | 1781 | ||
| @@ -910,7 +910,7 @@ static int dao_commit_write(struct hw *hw, unsigned int idx, void *blk) · 909 unmodified lines | |||
| 910 | struct dao_ctrl_blk *ctl = blk; | 910 | struct dao_ctrl_blk *ctl = blk; |
| 911 | 911 | ||
| 912 | if (ctl->dirty.bf.atxcsl) { | 912 | if (ctl->dirty.bf.atxcsl) { |
| 913 | if (idx < 4) { | 913 | if ((idx < 4) && ((hw->model != CTOK0010) || (idx < 3))) { |
| 914 | /* S/PDIF SPOSx */ | 914 | /* S/PDIF SPOSx */ |
| 915 | hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_L+0x40*idx, | 915 | hw_write_20kx(hw, AUDIO_IO_TX_CSTAT_L+0x40*idx, |
| 916 | ctl->atxcsl); | 916 | ctl->atxcsl); |
| @@ -985,11 +985,12 @@ static int daio_mgr_dsb_dao(void *blk, unsigned int idx) · 68 unmodified lines | |||
| 985 | return 0; | 985 | return 0; |
| 986 | } | 986 | } |
| 987 | 987 | ||
| 988 | static int daio_mgr_dao_init(void *blk, unsigned int idx, unsigned int conf) | 988 | static int daio_mgr_dao_init(struct hw *hw, void *blk, unsigned int idx, unsigned int conf) |
| 989 | { | 989 | { |
| 990 | struct daio_mgr_ctrl_blk *ctl = blk; | 990 | struct daio_mgr_ctrl_blk *ctl = blk; |
| 991 | 991 | ||
| 992 | if (idx < 4) { | 992 | /* Port 3 is dedicated to RCA on SE-300PCIE */ |
| 993 | if ((idx < 4) && ((hw->model != CTOK0010) || (idx < 3))) { | ||
| 993 | /* S/PDIF output */ | 994 | /* S/PDIF output */ |
| 994 | switch ((conf & 0xf)) { | 995 | switch ((conf & 0xf)) { |
| 995 | case 1: | 996 | case 1: |
| @@ -1176,6 +1177,10 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) · 180 unmodified lines | |||
| 1176 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21011111); | 1177 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21011111); |
| 1177 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121); | 1178 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121); |
| 1178 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); | 1179 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); |
| 1180 | } else if ((4 == info->msr) && (hw->model == CTOK0010)) { | ||
| 1181 | hw_write_20kx(hw, AUDIO_IO_MCLK, 0x21212121); | ||
| 1182 | hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x21212121); | ||
| 1183 | hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0); | ||
| 1179 | } else { | 1184 | } else { |
| 1180 | dev_alert(hw->card->dev, | 1185 | dev_alert(hw->card->dev, |
| 1181 | "ERROR!!! Invalid sampling rate!!!\n"); | 1186 | "ERROR!!! Invalid sampling rate!!!\n"); |
| @@ -1183,7 +1188,8 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info) · 1 unmodified line | |||
| 1183 | } | 1188 | } |
| 1184 | 1189 | ||
| 1185 | for (i = 0; i < 8; i++) { | 1190 | for (i = 0; i < 8; i++) { |
| 1186 | if (i <= 3) { | 1191 | /* Port 3 is configured as I2S on SE-300PCIE */ |
| 1192 | if ((i < 4) && ((hw->model != CTOK0010) || (i < 3))) { | ||
| 1187 | /* This comment looks wrong since loop is over 4 */ | 1193 | /* This comment looks wrong since loop is over 4 */ |
| 1188 | /* channels and emu20k2 supports 4 spdif IOs. */ | 1194 | /* channels and emu20k2 supports 4 spdif IOs. */ |
| 1189 | /* 1st 3 channels are SPDIFs (SB0960) */ | 1195 | /* 1st 3 channels are SPDIFs (SB0960) */ |
| @@ -1637,6 +1643,13 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info) · 447 unmodified lines | |||
| 1637 | hw_write_20kx(hw, GPIO_DATA, data); | 1643 | hw_write_20kx(hw, GPIO_DATA, data); |
| 1638 | hw_dac_start(hw); | 1644 | hw_dac_start(hw); |
| 1639 | return 0; | 1645 | return 0; |
| 1646 | } else if (hw->model == CTOK0010) { | ||
| 1647 | hw_dac_stop(hw); | ||
| 1648 | data = hw_read_20kx(hw, GPIO_DATA); | ||
| 1649 | data |= 0x1000; | ||
| 1650 | hw_write_20kx(hw, GPIO_DATA, data); | ||
| 1651 | hw_dac_start(hw); | ||
| 1652 | return 0; | ||
| 1640 | } | 1653 | } |
| 1641 | 1654 | ||
| 1642 | /* Set DAC reset bit as output */ | 1655 | /* Set DAC reset bit as output */ |
| @@ -1756,9 +1769,11 @@ End: · 113 unmodified lines | |||
| 1756 | static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) | 1769 | static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type) |
| 1757 | { | 1770 | { |
| 1758 | u32 data; | 1771 | u32 data; |
| 1759 | if (hw->model == CTSB1270) { | 1772 | if ((hw->model == CTSB1270) || (hw->model == CTOK0010)) { |
| 1760 | /* Titanium HD has two ADC chips, one for line in and one */ | 1773 | /* Titanium HD has two ADC chips, one for line in and one */ |
| 1761 | /* for MIC. We don't need to switch the ADC input. */ | 1774 | /* for MIC. Also, SE-300PCIE has a single ADC chip that */ |
| 1775 | /* simultaneously supports 4-channel input. We don't need */ | ||
| 1776 | /* to switch the ADC input. */ | ||
| 1762 | return 1; | 1777 | return 1; |
| 1763 | } | 1778 | } |
| 1764 | data = hw_read_20kx(hw, GPIO_DATA); | 1779 | data = hw_read_20kx(hw, GPIO_DATA); |
| @@ -1826,6 +1841,32 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type) · 61 unmodified lines | |||
| 1826 | return 0; | 1841 | return 0; |
| 1827 | } | 1842 | } |
| 1828 | 1843 | ||
| 1844 | static void hw_adc_stop(struct hw *hw) | ||
| 1845 | { | ||
| 1846 | u32 data; | ||
| 1847 | /* Reset the ADC (reset is active low). */ | ||
| 1848 | data = hw_read_20kx(hw, GPIO_DATA); | ||
| 1849 | data &= ~(0x1 << 15); | ||
| 1850 | hw_write_20kx(hw, GPIO_DATA, data); | ||
| 1851 | usleep_range(10000, 11000); | ||
| 1852 | } | ||
| 1853 | |||
| 1854 | static void hw_adc_start(struct hw *hw) | ||
| 1855 | { | ||
| 1856 | u32 data; | ||
| 1857 | /* Return the ADC to normal operation. */ | ||
| 1858 | data = hw_read_20kx(hw, GPIO_DATA); | ||
| 1859 | data |= (0x1 << 15); | ||
| 1860 | hw_write_20kx(hw, GPIO_DATA, data); | ||
| 1861 | msleep(50); | ||
| 1862 | } | ||
| 1863 | |||
| 1864 | static void hw_adc_reset(struct hw *hw) | ||
| 1865 | { | ||
| 1866 | hw_adc_stop(hw); | ||
| 1867 | hw_adc_start(hw); | ||
| 1868 | } | ||
| 1869 | |||
| 1829 | static int hw_adc_init(struct hw *hw, const struct adc_conf *info) | 1870 | static int hw_adc_init(struct hw *hw, const struct adc_conf *info) |
| 1830 | { | 1871 | { |
| 1831 | int err; | 1872 | int err; |
| @@ -1836,6 +1877,12 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) · 4 unmodified lines | |||
| 1836 | data |= (0x1 << 15); | 1877 | data |= (0x1 << 15); |
| 1837 | hw_write_20kx(hw, GPIO_CTRL, data); | 1878 | hw_write_20kx(hw, GPIO_CTRL, data); |
| 1838 | 1879 | ||
| 1880 | if (hw->model == CTOK0010) { | ||
| 1881 | /* Manual ADC setup for SE-300PCIE is not needed. */ | ||
| 1882 | hw_adc_reset(hw); | ||
| 1883 | return 0; | ||
| 1884 | } | ||
| 1885 | |||
| 1839 | /* Initialize I2C */ | 1886 | /* Initialize I2C */ |
| 1840 | err = hw20k2_i2c_init(hw, 0x1A, 1, 1); | 1887 | err = hw20k2_i2c_init(hw, 0x1A, 1, 1); |
| 1841 | if (err < 0) { | 1888 | if (err < 0) { |
| @@ -1843,10 +1890,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) · 1 unmodified line | |||
| 1843 | goto error; | 1890 | goto error; |
| 1844 | } | 1891 | } |
| 1845 | 1892 | ||
| 1846 | /* Reset the ADC (reset is active low). */ | 1893 | hw_adc_stop(hw); |
| 1847 | data = hw_read_20kx(hw, GPIO_DATA); | ||
| 1848 | data &= ~(0x1 << 15); | ||
| 1849 | hw_write_20kx(hw, GPIO_DATA, data); | ||
| 1850 | 1894 | ||
| 1851 | if (hw->model == CTSB1270) { | 1895 | if (hw->model == CTSB1270) { |
| 1852 | /* Set up the PCM4220 ADC on Titanium HD */ | 1896 | /* Set up the PCM4220 ADC on Titanium HD */ |
| @@ -1860,11 +1904,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info) · 7 unmodified lines | |||
| 1860 | hw_write_20kx(hw, GPIO_DATA, data); | 1904 | hw_write_20kx(hw, GPIO_DATA, data); |
| 1861 | } | 1905 | } |
| 1862 | 1906 | ||
| 1863 | usleep_range(10000, 11000); | 1907 | hw_adc_start(hw); |
| 1864 | /* Return the ADC to normal operation. */ | ||
| 1865 | data |= (0x1 << 15); | ||
| 1866 | hw_write_20kx(hw, GPIO_DATA, data); | ||
| 1867 | msleep(50); | ||
| 1868 | 1908 | ||
| 1869 | /* I2C write to register offset 0x0B to set ADC LRCLK polarity */ | 1909 | /* I2C write to register offset 0x0B to set ADC LRCLK polarity */ |
| 1870 | /* invert bit, interface format to I2S, word length to 24-bit, */ | 1910 | /* invert bit, interface format to I2S, word length to 24-bit, */ |
| @@ -1910,7 +1950,8 @@ static struct capabilities hw_capabilities(struct hw *hw) · 39 unmodified lines | |||
| 1910 | struct capabilities cap; | 1950 | struct capabilities cap; |
| 1911 | 1951 | ||
| 1912 | cap.digit_io_switch = 0; | 1952 | cap.digit_io_switch = 0; |
| 1913 | cap.dedicated_mic = hw->model == CTSB1270; | 1953 | cap.dedicated_mic = (hw->model == CTSB1270) || (hw->model == CTOK0010); |
| 1954 | cap.dedicated_rca = hw->model == CTOK0010; | ||
| 1914 | cap.output_switch = hw->model == CTSB1270; | 1955 | cap.output_switch = hw->model == CTSB1270; |
| 1915 | cap.mic_source_switch = hw->model == CTSB1270; | 1956 | cap.mic_source_switch = hw->model == CTSB1270; |
| 1916 | 1957 | ||
| @@ -2147,15 +2188,17 @@ static int hw_card_init(struct hw *hw, struct card_conf *info) · 230 unmodified lines | |||
| 2147 | /* Reset all SRC pending interrupts */ | 2188 | /* Reset all SRC pending interrupts */ |
| 2148 | hw_write_20kx(hw, SRC_IP, 0); | 2189 | hw_write_20kx(hw, SRC_IP, 0); |
| 2149 | 2190 | ||
| 2150 | if (hw->model != CTSB1270) { | 2191 | if (hw->model == CTSB1270) { |
| 2192 | hw_write_20kx(hw, GPIO_CTRL, 0x9E5F); | ||
| 2193 | } else if (hw->model == CTOK0010) { | ||
| 2194 | hw_write_20kx(hw, GPIO_CTRL, 0x9902); | ||
| 2195 | } else { | ||
| 2151 | /* TODO: detect the card ID and configure GPIO accordingly. */ | 2196 | /* TODO: detect the card ID and configure GPIO accordingly. */ |
| 2152 | /* Configures GPIO (0xD802 0x98028) */ | 2197 | /* Configures GPIO (0xD802 0x98028) */ |
| 2153 | /*hw_write_20kx(hw, GPIO_CTRL, 0x7F07);*/ | 2198 | /*hw_write_20kx(hw, GPIO_CTRL, 0x7F07);*/ |
| 2154 | /* Configures GPIO (SB0880) */ | 2199 | /* Configures GPIO (SB0880) */ |
| 2155 | /*hw_write_20kx(hw, GPIO_CTRL, 0xFF07);*/ | 2200 | /*hw_write_20kx(hw, GPIO_CTRL, 0xFF07);*/ |
| 2156 | hw_write_20kx(hw, GPIO_CTRL, 0xD802); | 2201 | hw_write_20kx(hw, GPIO_CTRL, 0xD802); |
| 2157 | } else { | ||
| 2158 | hw_write_20kx(hw, GPIO_CTRL, 0x9E5F); | ||
| 2159 | } | 2202 | } |
| 2160 | /* Enable audio ring */ | 2203 | /* Enable audio ring */ |
| 2161 | hw_write_20kx(hw, MIXER_AR_ENABLE, 0x01); | 2204 | hw_write_20kx(hw, MIXER_AR_ENABLE, 0x01); |
| @@ -547,8 +547,14 @@ static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) · 546 unmodified lines | |||
| 547 | atc->mic_unmute(atc, state); | 547 | atc->mic_unmute(atc, state); |
| 548 | else if (MIXER_SPDIFI_C_S == type) | 548 | else if (MIXER_SPDIFI_C_S == type) |
| 549 | atc->spdif_in_unmute(atc, state); | 549 | atc->spdif_in_unmute(atc, state); |
| 550 | else if (MIXER_WAVEF_P_S == type) | 550 | else if (MIXER_WAVEF_P_S == type) { |
| 551 | atc->line_front_unmute(atc, state); | 551 | if (cap.dedicated_rca) { |
| 552 | atc->rca_unmute(atc, atc->rca_state ? 0 : state); | ||
| 553 | atc->line_front_unmute(atc, atc->rca_state ? state : 0); | ||
| 554 | } else { | ||
| 555 | atc->line_front_unmute(atc, state); | ||
| 556 | } | ||
| 557 | } | ||
| 552 | else if (MIXER_WAVES_P_S == type) | 558 | else if (MIXER_WAVES_P_S == type) |
| 553 | atc->line_surround_unmute(atc, state); | 559 | atc->line_surround_unmute(atc, state); |
| 554 | else if (MIXER_WAVEC_P_S == type) | 560 | else if (MIXER_WAVEC_P_S == type) |
| @@ -612,6 +618,57 @@ static struct snd_kcontrol_new swh_ctl = { · 57 unmodified lines | |||
| 612 | .put = ct_alsa_mix_switch_put | 618 | .put = ct_alsa_mix_switch_put |
| 613 | }; | 619 | }; |
| 614 | 620 | ||
| 621 | static int dedicated_rca_info(struct snd_kcontrol *kcontrol, | ||
| 622 | struct snd_ctl_elem_info *info) | ||
| 623 | { | ||
| 624 | static const char *const names[2] = { | ||
| 625 | "RCA", "Front" | ||
| 626 | }; | ||
| 627 | |||
| 628 | return snd_ctl_enum_info(info, 1, 2, names); | ||
| 629 | } | ||
| 630 | |||
| 631 | static int dedicated_rca_get(struct snd_kcontrol *kcontrol, | ||
| 632 | struct snd_ctl_elem_value *ucontrol) | ||
| 633 | { | ||
| 634 | struct ct_atc *atc = snd_kcontrol_chip(kcontrol); | ||
| 635 | |||
| 636 | ucontrol->value.enumerated.item[0] = atc->rca_state; | ||
| 637 | return 0; | ||
| 638 | } | ||
| 639 | |||
| 640 | static int dedicated_rca_put(struct snd_kcontrol *kcontrol, | ||
| 641 | struct snd_ctl_elem_value *ucontrol) | ||
| 642 | { | ||
| 643 | struct ct_atc *atc = snd_kcontrol_chip(kcontrol); | ||
| 644 | unsigned int rca_state = ucontrol->value.enumerated.item[0]; | ||
| 645 | unsigned char state; | ||
| 646 | |||
| 647 | if (rca_state > 1) | ||
| 648 | return -EINVAL; | ||
| 649 | |||
| 650 | if (rca_state == atc->rca_state) | ||
| 651 | return 0; | ||
| 652 | |||
| 653 | state = get_switch_state(atc->mixer, MIXER_WAVEF_P_S); | ||
| 654 | do_switch(atc, MIXER_WAVEF_P_S, 0); | ||
| 655 | |||
| 656 | atc->rca_state = rca_state; | ||
| 657 | atc->dedicated_rca_select(atc); | ||
| 658 | |||
| 659 | do_switch(atc, MIXER_WAVEF_P_S, state); | ||
| 660 | |||
| 661 | return 1; | ||
| 662 | } | ||
| 663 | |||
| 664 | static struct snd_kcontrol_new rca_ctl = { | ||
| 665 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 666 | .name = "Analog Playback Route", | ||
| 667 | .info = dedicated_rca_info, | ||
| 668 | .get = dedicated_rca_get, | ||
| 669 | .put = dedicated_rca_put, | ||
| 670 | }; | ||
| 671 | |||
| 615 | static int ct_spdif_info(struct snd_kcontrol *kcontrol, | 672 | static int ct_spdif_info(struct snd_kcontrol *kcontrol, |
| 616 | struct snd_ctl_elem_info *uinfo) | 673 | struct snd_ctl_elem_info *uinfo) |
| 617 | { | 674 | { |
| @@ -784,7 +841,17 @@ static int ct_mixer_kcontrols_create(struct ct_mixer *mixer) · 166 unmodified lines | |||
| 784 | if (err) | 841 | if (err) |
| 785 | return err; | 842 | return err; |
| 786 | } | 843 | } |
| 787 | atc->line_front_unmute(atc, 1); | 844 | |
| 845 | if (cap.dedicated_rca) { | ||
| 846 | err = ct_mixer_kcontrol_new(mixer, &rca_ctl); | ||
| 847 | if (err) | ||
| 848 | return err; | ||
| 849 | |||
| 850 | atc->line_front_unmute(atc, 0); | ||
| 851 | atc->rca_unmute(atc, 1); | ||
| 852 | } else { | ||
| 853 | atc->line_front_unmute(atc, 1); | ||
| 854 | } | ||
| 788 | set_switch_state(mixer, MIXER_WAVEF_P_S, 1); | 855 | set_switch_state(mixer, MIXER_WAVEF_P_S, 1); |
| 789 | atc->line_surround_unmute(atc, 0); | 856 | atc->line_surround_unmute(atc, 0); |
| 790 | set_switch_state(mixer, MIXER_WAVES_P_S, 0); | 857 | set_switch_state(mixer, MIXER_WAVES_P_S, 0); |
| @@ -2571,9 +2571,9 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci, · 2570 unmodified lines | |||
| 2571 | 2571 | ||
| 2572 | if (IS_ENABLED(CONFIG_PM_SLEEP)) { | 2572 | if (IS_ENABLED(CONFIG_PM_SLEEP)) { |
| 2573 | chip->suspend_mem = | 2573 | chip->suspend_mem = |
| 2574 | vmalloc(array_size(sizeof(u16), | 2574 | vmalloc_array(REV_B_CODE_MEMORY_LENGTH + |
| 2575 | REV_B_CODE_MEMORY_LENGTH + | 2575 | REV_B_DATA_MEMORY_LENGTH, |
| 2576 | REV_B_DATA_MEMORY_LENGTH)); | 2576 | sizeof(u16)); |
| 2577 | if (!chip->suspend_mem) | 2577 | if (!chip->suspend_mem) |
| 2578 | dev_warn(card->dev, "can't allocate apm buffer\n"); | 2578 | dev_warn(card->dev, "can't allocate apm buffer\n"); |
| 2579 | } | 2579 | } |
| @@ -127,6 +127,7 @@ source "sound/soc/renesas/Kconfig" · 126 unmodified lines | |||
| 127 | source "sound/soc/rockchip/Kconfig" | 127 | source "sound/soc/rockchip/Kconfig" |
| 128 | source "sound/soc/samsung/Kconfig" | 128 | source "sound/soc/samsung/Kconfig" |
| 129 | source "sound/soc/sdca/Kconfig" | 129 | source "sound/soc/sdca/Kconfig" |
| 130 | source "sound/soc/spacemit/Kconfig" | ||
| 130 | source "sound/soc/spear/Kconfig" | 131 | source "sound/soc/spear/Kconfig" |
| 131 | source "sound/soc/sprd/Kconfig" | 132 | source "sound/soc/sprd/Kconfig" |
| 132 | source "sound/soc/starfive/Kconfig" | 133 | source "sound/soc/starfive/Kconfig" |
| @@ -70,6 +70,7 @@ obj-$(CONFIG_SND_SOC) += rockchip/ · 69 unmodified lines | |||
| 70 | obj-$(CONFIG_SND_SOC) += samsung/ | 70 | obj-$(CONFIG_SND_SOC) += samsung/ |
| 71 | obj-$(CONFIG_SND_SOC) += sdca/ | 71 | obj-$(CONFIG_SND_SOC) += sdca/ |
| 72 | obj-$(CONFIG_SND_SOC) += sof/ | 72 | obj-$(CONFIG_SND_SOC) += sof/ |
| 73 | obj-$(CONFIG_SND_SOC) += spacemit/ | ||
| 73 | obj-$(CONFIG_SND_SOC) += spear/ | 74 | obj-$(CONFIG_SND_SOC) += spear/ |
| 74 | obj-$(CONFIG_SND_SOC) += sprd/ | 75 | obj-$(CONFIG_SND_SOC) += sprd/ |
| 75 | obj-$(CONFIG_SND_SOC) += starfive/ | 76 | obj-$(CONFIG_SND_SOC) += starfive/ |
| @@ -116,6 +116,7 @@ static const struct snd_soc_dapm_route rt5682_map[] = { · 115 unmodified lines | |||
| 116 | static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) | 116 | static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) |
| 117 | { | 117 | { |
| 118 | struct snd_soc_card *card = rtd->card; | 118 | struct snd_soc_card *card = rtd->card; |
| 119 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 119 | struct acp_card_drvdata *drvdata = card->drvdata; | 120 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 120 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); | 121 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); |
| 121 | struct snd_soc_component *component = codec_dai->component; | 122 | struct snd_soc_component *component = codec_dai->component; |
| @@ -129,7 +130,7 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines | |||
| 129 | drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); | 130 | drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk"); |
| 130 | drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); | 131 | drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); |
| 131 | 132 | ||
| 132 | ret = snd_soc_dapm_new_controls(&card->dapm, rt5682_widgets, | 133 | ret = snd_soc_dapm_new_controls(dapm, rt5682_widgets, |
| 133 | ARRAY_SIZE(rt5682_widgets)); | 134 | ARRAY_SIZE(rt5682_widgets)); |
| 134 | if (ret) { | 135 | if (ret) { |
| 135 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); | 136 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); |
| @@ -166,7 +167,7 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) · 30 unmodified lines | |||
| 166 | return ret; | 167 | return ret; |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682_map, ARRAY_SIZE(rt5682_map)); | 170 | return snd_soc_dapm_add_routes(dapm, rt5682_map, ARRAY_SIZE(rt5682_map)); |
| 170 | } | 171 | } |
| 171 | 172 | ||
| 172 | static int acp_card_hs_startup(struct snd_pcm_substream *substream) | 173 | static int acp_card_hs_startup(struct snd_pcm_substream *substream) |
| @@ -357,6 +358,7 @@ static const struct snd_soc_dapm_route rt5682s_map[] = { · 184 unmodified lines | |||
| 357 | static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) | 358 | static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) |
| 358 | { | 359 | { |
| 359 | struct snd_soc_card *card = rtd->card; | 360 | struct snd_soc_card *card = rtd->card; |
| 361 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 360 | struct acp_card_drvdata *drvdata = card->drvdata; | 362 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 361 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); | 363 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); |
| 362 | struct snd_soc_component *component = codec_dai->component; | 364 | struct snd_soc_component *component = codec_dai->component; |
| @@ -372,7 +374,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) · 9 unmodified lines | |||
| 372 | drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); | 374 | drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk"); |
| 373 | } | 375 | } |
| 374 | 376 | ||
| 375 | ret = snd_soc_dapm_new_controls(&card->dapm, rt5682s_widgets, | 377 | ret = snd_soc_dapm_new_controls(dapm, rt5682s_widgets, |
| 376 | ARRAY_SIZE(rt5682s_widgets)); | 378 | ARRAY_SIZE(rt5682s_widgets)); |
| 377 | if (ret) { | 379 | if (ret) { |
| 378 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); | 380 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); |
| @@ -409,7 +411,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) · 30 unmodified lines | |||
| 409 | return ret; | 411 | return ret; |
| 410 | } | 412 | } |
| 411 | 413 | ||
| 412 | return snd_soc_dapm_add_routes(&rtd->card->dapm, rt5682s_map, ARRAY_SIZE(rt5682s_map)); | 414 | return snd_soc_dapm_add_routes(dapm, rt5682s_map, ARRAY_SIZE(rt5682s_map)); |
| 413 | } | 415 | } |
| 414 | 416 | ||
| 415 | static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, | 417 | static int acp_card_rt5682s_hw_params(struct snd_pcm_substream *substream, |
| @@ -581,13 +583,14 @@ static struct snd_soc_codec_conf rt1019_conf[] = { · 165 unmodified lines | |||
| 581 | static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd) | 583 | static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd) |
| 582 | { | 584 | { |
| 583 | struct snd_soc_card *card = rtd->card; | 585 | struct snd_soc_card *card = rtd->card; |
| 586 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 584 | struct acp_card_drvdata *drvdata = card->drvdata; | 587 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 585 | int ret; | 588 | int ret; |
| 586 | 589 | ||
| 587 | if (drvdata->amp_codec_id != RT1019) | 590 | if (drvdata->amp_codec_id != RT1019) |
| 588 | return -EINVAL; | 591 | return -EINVAL; |
| 589 | 592 | ||
| 590 | ret = snd_soc_dapm_new_controls(&card->dapm, rt1019_widgets, | 593 | ret = snd_soc_dapm_new_controls(dapm, rt1019_widgets, |
| 591 | ARRAY_SIZE(rt1019_widgets)); | 594 | ARRAY_SIZE(rt1019_widgets)); |
| 592 | if (ret) { | 595 | if (ret) { |
| 593 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); | 596 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); |
| @@ -601,7 +604,7 @@ static int acp_card_rt1019_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines | |||
| 601 | return ret; | 604 | return ret; |
| 602 | } | 605 | } |
| 603 | 606 | ||
| 604 | return snd_soc_dapm_add_routes(&rtd->card->dapm, rt1019_map_lr, | 607 | return snd_soc_dapm_add_routes(dapm, rt1019_map_lr, |
| 605 | ARRAY_SIZE(rt1019_map_lr)); | 608 | ARRAY_SIZE(rt1019_map_lr)); |
| 606 | } | 609 | } |
| 607 | 610 | ||
| @@ -746,13 +749,14 @@ static const struct snd_soc_dapm_route max98360a_map[] = { · 138 unmodified lines | |||
| 746 | static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd) | 749 | static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd) |
| 747 | { | 750 | { |
| 748 | struct snd_soc_card *card = rtd->card; | 751 | struct snd_soc_card *card = rtd->card; |
| 752 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 749 | struct acp_card_drvdata *drvdata = card->drvdata; | 753 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 750 | int ret; | 754 | int ret; |
| 751 | 755 | ||
| 752 | if (drvdata->amp_codec_id != MAX98360A) | 756 | if (drvdata->amp_codec_id != MAX98360A) |
| 753 | return -EINVAL; | 757 | return -EINVAL; |
| 754 | 758 | ||
| 755 | ret = snd_soc_dapm_new_controls(&card->dapm, max98360a_widgets, | 759 | ret = snd_soc_dapm_new_controls(dapm, max98360a_widgets, |
| 756 | ARRAY_SIZE(max98360a_widgets)); | 760 | ARRAY_SIZE(max98360a_widgets)); |
| 757 | if (ret) { | 761 | if (ret) { |
| 758 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); | 762 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); |
| @@ -766,7 +770,7 @@ static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines | |||
| 766 | return ret; | 770 | return ret; |
| 767 | } | 771 | } |
| 768 | 772 | ||
| 769 | return snd_soc_dapm_add_routes(&rtd->card->dapm, max98360a_map, | 773 | return snd_soc_dapm_add_routes(dapm, max98360a_map, |
| 770 | ARRAY_SIZE(max98360a_map)); | 774 | ARRAY_SIZE(max98360a_map)); |
| 771 | } | 775 | } |
| 772 | 776 | ||
| @@ -882,13 +886,14 @@ static int acp_card_max98388_startup(struct snd_pcm_substream *substream) · 109 unmodified lines | |||
| 882 | static int acp_card_max98388_init(struct snd_soc_pcm_runtime *rtd) | 886 | static int acp_card_max98388_init(struct snd_soc_pcm_runtime *rtd) |
| 883 | { | 887 | { |
| 884 | struct snd_soc_card *card = rtd->card; | 888 | struct snd_soc_card *card = rtd->card; |
| 889 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 885 | struct acp_card_drvdata *drvdata = card->drvdata; | 890 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 886 | int ret; | 891 | int ret; |
| 887 | 892 | ||
| 888 | if (drvdata->amp_codec_id != MAX98388) | 893 | if (drvdata->amp_codec_id != MAX98388) |
| 889 | return -EINVAL; | 894 | return -EINVAL; |
| 890 | 895 | ||
| 891 | ret = snd_soc_dapm_new_controls(&card->dapm, max98388_widgets, | 896 | ret = snd_soc_dapm_new_controls(dapm, max98388_widgets, |
| 892 | ARRAY_SIZE(max98388_widgets)); | 897 | ARRAY_SIZE(max98388_widgets)); |
| 893 | 898 | ||
| 894 | if (ret) { | 899 | if (ret) { |
| @@ -904,7 +909,7 @@ static int acp_card_max98388_init(struct snd_soc_pcm_runtime *rtd) · 9 unmodified lines | |||
| 904 | return ret; | 909 | return ret; |
| 905 | } | 910 | } |
| 906 | 911 | ||
| 907 | return snd_soc_dapm_add_routes(&rtd->card->dapm, max98388_map, | 912 | return snd_soc_dapm_add_routes(dapm, max98388_map, |
| 908 | ARRAY_SIZE(max98388_map)); | 913 | ARRAY_SIZE(max98388_map)); |
| 909 | } | 914 | } |
| 910 | 915 | ||
| @@ -966,6 +971,7 @@ static const struct snd_soc_dapm_route nau8825_map[] = { · 55 unmodified lines | |||
| 966 | static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) | 971 | static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) |
| 967 | { | 972 | { |
| 968 | struct snd_soc_card *card = rtd->card; | 973 | struct snd_soc_card *card = rtd->card; |
| 974 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 969 | struct acp_card_drvdata *drvdata = card->drvdata; | 975 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 970 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); | 976 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); |
| 971 | struct snd_soc_component *component = codec_dai->component; | 977 | struct snd_soc_component *component = codec_dai->component; |
| @@ -976,7 +982,7 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) · 4 unmodified lines | |||
| 976 | if (drvdata->hs_codec_id != NAU8825) | 982 | if (drvdata->hs_codec_id != NAU8825) |
| 977 | return -EINVAL; | 983 | return -EINVAL; |
| 978 | 984 | ||
| 979 | ret = snd_soc_dapm_new_controls(&card->dapm, nau8825_widgets, | 985 | ret = snd_soc_dapm_new_controls(dapm, nau8825_widgets, |
| 980 | ARRAY_SIZE(nau8825_widgets)); | 986 | ARRAY_SIZE(nau8825_widgets)); |
| 981 | if (ret) { | 987 | if (ret) { |
| 982 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); | 988 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); |
| @@ -1013,7 +1019,7 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) · 30 unmodified lines | |||
| 1013 | return ret; | 1019 | return ret; |
| 1014 | } | 1020 | } |
| 1015 | 1021 | ||
| 1016 | return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8825_map, ARRAY_SIZE(nau8825_map)); | 1022 | return snd_soc_dapm_add_routes(dapm, nau8825_map, ARRAY_SIZE(nau8825_map)); |
| 1017 | } | 1023 | } |
| 1018 | 1024 | ||
| 1019 | static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, | 1025 | static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, |
| @@ -1102,8 +1108,7 @@ static const struct snd_soc_ops acp_card_nau8825_ops = { · 82 unmodified lines | |||
| 1102 | static int platform_clock_control(struct snd_soc_dapm_widget *w, | 1108 | static int platform_clock_control(struct snd_soc_dapm_widget *w, |
| 1103 | struct snd_kcontrol *k, int event) | 1109 | struct snd_kcontrol *k, int event) |
| 1104 | { | 1110 | { |
| 1105 | struct snd_soc_dapm_context *dapm = w->dapm; | 1111 | struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm); |
| 1106 | struct snd_soc_card *card = dapm->card; | ||
| 1107 | struct snd_soc_dai *codec_dai; | 1112 | struct snd_soc_dai *codec_dai; |
| 1108 | int ret = 0; | 1113 | int ret = 0; |
| 1109 | 1114 | ||
| @@ -1181,13 +1186,14 @@ static struct snd_pcm_hw_constraint_list constraints_sample_bits = { · 71 unmodified lines | |||
| 1181 | static int acp_8821_init(struct snd_soc_pcm_runtime *rtd) | 1186 | static int acp_8821_init(struct snd_soc_pcm_runtime *rtd) |
| 1182 | { | 1187 | { |
| 1183 | struct snd_soc_card *card = rtd->card; | 1188 | struct snd_soc_card *card = rtd->card; |
| 1189 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); | ||
| 1184 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); | 1190 | struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); |
| 1185 | struct snd_soc_component *component = codec_dai->component; | 1191 | struct snd_soc_component *component = codec_dai->component; |
| 1186 | int ret; | 1192 | int ret; |
| 1187 | 1193 | ||
| 1188 | dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); | 1194 | dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); |
| 1189 | 1195 | ||
| 1190 | ret = snd_soc_dapm_new_controls(&card->dapm, nau8821_widgets, | 1196 | ret = snd_soc_dapm_new_controls(dapm, nau8821_widgets, |
| 1191 | ARRAY_SIZE(nau8821_widgets)); | 1197 | ARRAY_SIZE(nau8821_widgets)); |
| 1192 | if (ret) { | 1198 | if (ret) { |
| 1193 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); | 1199 | dev_err(rtd->dev, "unable to add widget dapm controls, ret %d\n", ret); |
| @@ -1221,7 +1227,7 @@ static int acp_8821_init(struct snd_soc_pcm_runtime *rtd) · 27 unmodified lines | |||
| 1221 | 1227 | ||
| 1222 | nau8821_enable_jack_detect(component, &nau8821_jack); | 1228 | nau8821_enable_jack_detect(component, &nau8821_jack); |
| 1223 | 1229 | ||
| 1224 | return snd_soc_dapm_add_routes(&rtd->card->dapm, nau8821_audio_route, | 1230 | return snd_soc_dapm_add_routes(dapm, nau8821_audio_route, |
| 1225 | ARRAY_SIZE(nau8821_audio_route)); | 1231 | ARRAY_SIZE(nau8821_audio_route)); |
| 1226 | } | 1232 | } |
| 1227 | 1233 | ||
| @@ -1340,7 +1346,7 @@ static int acp_rtk_set_bias_level(struct snd_soc_card *card, · 112 unmodified lines | |||
| 1340 | struct snd_soc_dapm_context *dapm, | 1346 | struct snd_soc_dapm_context *dapm, |
| 1341 | enum snd_soc_bias_level level) | 1347 | enum snd_soc_bias_level level) |
| 1342 | { | 1348 | { |
| 1343 | struct snd_soc_component *component = dapm->component; | 1349 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); |
| 1344 | struct acp_card_drvdata *drvdata = card->drvdata; | 1350 | struct acp_card_drvdata *drvdata = card->drvdata; |
| 1345 | int ret = 0; | 1351 | int ret = 0; |
| 1346 | 1352 | ||
| @@ -360,20 +360,25 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 359 unmodified lines | |||
| 360 | struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; | 360 | struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; |
| 361 | struct asoc_sdw_endpoint *soc_ends __free(kfree) = NULL; | 361 | struct asoc_sdw_endpoint *soc_ends __free(kfree) = NULL; |
| 362 | struct asoc_sdw_dailink *soc_dais __free(kfree) = NULL; | 362 | struct asoc_sdw_dailink *soc_dais __free(kfree) = NULL; |
| 363 | struct snd_soc_aux_dev *soc_aux; | ||
| 363 | struct snd_soc_codec_conf *codec_conf; | 364 | struct snd_soc_codec_conf *codec_conf; |
| 364 | struct snd_soc_dai_link *dai_links; | 365 | struct snd_soc_dai_link *dai_links; |
| 365 | int num_devs = 0; | 366 | int num_devs = 0; |
| 366 | int num_ends = 0; | 367 | int num_ends = 0; |
| 368 | int num_aux = 0; | ||
| 369 | int num_confs; | ||
| 367 | int num_links; | 370 | int num_links; |
| 368 | int be_id = 0; | 371 | int be_id = 0; |
| 369 | int ret; | 372 | int ret; |
| 370 | 373 | ||
| 371 | ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends); | 374 | ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends, &num_aux); |
| 372 | if (ret < 0) { | 375 | if (ret < 0) { |
| 373 | dev_err(dev, "failed to count devices/endpoints: %d\n", ret); | 376 | dev_err(dev, "failed to count devices/endpoints: %d\n", ret); |
| 374 | return ret; | 377 | return ret; |
| 375 | } | 378 | } |
| 376 | 379 | ||
| 380 | num_confs = num_ends; | ||
| 381 | |||
| 377 | /* One per DAI link, worst case is a DAI link for every endpoint */ | 382 | /* One per DAI link, worst case is a DAI link for every endpoint */ |
| 378 | soc_dais = kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL); | 383 | soc_dais = kcalloc(num_ends, sizeof(*soc_dais), GFP_KERNEL); |
| 379 | if (!soc_dais) | 384 | if (!soc_dais) |
| @@ -384,7 +389,11 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 4 unmodified lines | |||
| 384 | if (!soc_ends) | 389 | if (!soc_ends) |
| 385 | return -ENOMEM; | 390 | return -ENOMEM; |
| 386 | 391 | ||
| 387 | ret = asoc_sdw_parse_sdw_endpoints(card, soc_dais, soc_ends, &num_devs); | 392 | soc_aux = devm_kcalloc(dev, num_aux, sizeof(*soc_aux), GFP_KERNEL); |
| 393 | if (!soc_aux) | ||
| 394 | return -ENOMEM; | ||
| 395 | |||
| 396 | ret = asoc_sdw_parse_sdw_endpoints(card, soc_aux, soc_dais, soc_ends, &num_confs); | ||
| 388 | if (ret < 0) | 397 | if (ret < 0) |
| 389 | return ret; | 398 | return ret; |
| 390 | 399 | ||
| @@ -396,7 +405,7 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 5 unmodified lines | |||
| 396 | 405 | ||
| 397 | dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num); | 406 | dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num); |
| 398 | 407 | ||
| 399 | codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL); | 408 | codec_conf = devm_kcalloc(dev, num_confs, sizeof(*codec_conf), GFP_KERNEL); |
| 400 | if (!codec_conf) | 409 | if (!codec_conf) |
| 401 | return -ENOMEM; | 410 | return -ENOMEM; |
| 402 | 411 | ||
| @@ -407,9 +416,11 @@ static int soc_card_dai_links_create(struct snd_soc_card *card) · 4 unmodified lines | |||
| 407 | return -ENOMEM; | 416 | return -ENOMEM; |
| 408 | 417 | ||
| 409 | card->codec_conf = codec_conf; | 418 | card->codec_conf = codec_conf; |
| 410 | card->num_configs = num_devs; | 419 | card->num_configs = num_confs; |
| 411 | card->dai_link = dai_links; | 420 | card->dai_link = dai_links; |
| 412 | card->num_links = num_links; | 421 | card->num_links = num_links; |
| 422 | card->aux_dev = soc_aux; | ||
| 423 | card->num_aux_devs = num_aux; | ||
| 413 | 424 | ||
| 414 | /* SDW */ | 425 | /* SDW */ |
| 415 | if (sdw_be_num) { | 426 | if (sdw_be_num) { |
| @@ -463,6 +474,10 @@ static int mc_probe(struct platform_device *pdev) · 47 unmodified lines | |||
| 463 | card->late_probe = asoc_sdw_card_late_probe; | 474 | card->late_probe = asoc_sdw_card_late_probe; |
| 464 | 475 | ||
| 465 | snd_soc_card_set_drvdata(card, ctx); | 476 | snd_soc_card_set_drvdata(card, ctx); |
| 477 | if (mach->mach_params.subsystem_id_set) | ||
| 478 | snd_soc_card_set_pci_ssid(card, | ||
| 479 | mach->mach_params.subsystem_vendor, | ||
| 480 | mach->mach_params.subsystem_device); | ||
| 466 | 481 | ||
| 467 | dmi_check_system(soc_sdw_quirk_table); | 482 | dmi_check_system(soc_sdw_quirk_table); |
| 468 | 483 | ||
| @@ -272,15 +272,17 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) · 271 unmodified lines | |||
| 272 | struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; | 272 | struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; |
| 273 | struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL; | 273 | struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL; |
| 274 | struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL; | 274 | struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL; |
| 275 | struct snd_soc_aux_dev *sof_aux; | ||
| 275 | struct snd_soc_codec_conf *codec_conf; | 276 | struct snd_soc_codec_conf *codec_conf; |
| 276 | struct snd_soc_dai_link *dai_links; | 277 | struct snd_soc_dai_link *dai_links; |
| 277 | int num_devs = 0; | 278 | int num_devs = 0; |
| 278 | int num_ends = 0; | 279 | int num_ends = 0; |
| 280 | int num_aux = 0; | ||
| 279 | int num_links; | 281 | int num_links; |
| 280 | int be_id = 0; | 282 | int be_id = 0; |
| 281 | int ret; | 283 | int ret; |
| 282 | 284 | ||
| 283 | ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends); | 285 | ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends, &num_aux); |
| 284 | if (ret < 0) { | 286 | if (ret < 0) { |
| 285 | dev_err(dev, "failed to count devices/endpoints: %d\n", ret); | 287 | dev_err(dev, "failed to count devices/endpoints: %d\n", ret); |
| 286 | return ret; | 288 | return ret; |
| @@ -296,7 +298,11 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) · 9 unmodified lines | |||
| 296 | if (!sof_ends) | 298 | if (!sof_ends) |
| 297 | return -ENOMEM; | 299 | return -ENOMEM; |
| 298 | 300 | ||
| 299 | ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); | 301 | sof_aux = devm_kcalloc(dev, num_aux, sizeof(*sof_aux), GFP_KERNEL); |
| 302 | if (!sof_aux) | ||
| 303 | return -ENOMEM; | ||
| 304 | |||
| 305 | ret = asoc_sdw_parse_sdw_endpoints(card, sof_aux, sof_dais, sof_ends, &num_devs); | ||
| 300 | if (ret < 0) | 306 | if (ret < 0) |
| 301 | return ret; | 307 | return ret; |
| 302 | 308 | ||
| @@ -322,6 +328,8 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) · 19 unmodified lines | |||
| 322 | card->num_configs = num_devs; | 328 | card->num_configs = num_devs; |
| 323 | card->dai_link = dai_links; | 329 | card->dai_link = dai_links; |
| 324 | card->num_links = num_links; | 330 | card->num_links = num_links; |
| 331 | card->aux_dev = sof_aux; | ||
| 332 | card->num_aux_devs = num_aux; | ||
| 325 | 333 | ||
| 326 | /* SDW */ | 334 | /* SDW */ |
| 327 | if (sdw_be_num) { | 335 | if (sdw_be_num) { |
| @@ -159,7 +159,8 @@ static int acp3x_es83xx_configure_widgets(struct snd_soc_card *card) · 158 unmodified lines | |||
| 159 | static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w, | 159 | static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w, |
| 160 | struct snd_kcontrol *kcontrol, int event) | 160 | struct snd_kcontrol *kcontrol, int event) |
| 161 | { | 161 | { |
| 162 | struct acp3x_es83xx_private *priv = get_mach_priv(w->dapm->card); | 162 | struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm); |
| 163 | struct acp3x_es83xx_private *priv = get_mach_priv(card); | ||
| 163 | 164 | ||
| 164 | dev_dbg(priv->codec_dev, "headphone power event = %d\n", event); | 165 | dev_dbg(priv->codec_dev, "headphone power event = %d\n", event); |
| 165 | if (SND_SOC_DAPM_EVENT_ON(event)) | 166 | if (SND_SOC_DAPM_EVENT_ON(event)) |
| @@ -176,7 +177,8 @@ static int acp3x_es83xx_headphone_power_event(struct snd_soc_dapm_widget *w, · 10 unmodified lines | |||
| 176 | static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w, | 177 | static int acp3x_es83xx_speaker_power_event(struct snd_soc_dapm_widget *w, |
| 177 | struct snd_kcontrol *kcontrol, int event) | 178 | struct snd_kcontrol *kcontrol, int event) |
| 178 | { | 179 | { |
| 179 | struct acp3x_es83xx_private *priv = get_mach_priv(w->dapm->card); | 180 | struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm); |
| 181 | struct acp3x_es83xx_private *priv = get_mach_priv(card); | ||
| 180 | 182 | ||
| 181 | dev_dbg(priv->codec_dev, "speaker power event: %d\n", event); | 183 | dev_dbg(priv->codec_dev, "speaker power event: %d\n", event); |
| 182 | if (SND_SOC_DAPM_EVENT_ON(event)) | 184 | if (SND_SOC_DAPM_EVENT_ON(event)) |
| @@ -314,7 +316,9 @@ static int acp3x_es83xx_init(struct snd_soc_pcm_runtime *runtime) · 131 unmodified lines | |||
| 314 | 316 | ||
| 315 | num_routes = acp3x_es83xx_configure_mics(priv); | 317 | num_routes = acp3x_es83xx_configure_mics(priv); |
| 316 | if (num_routes > 0) { | 318 | if (num_routes > 0) { |
| 317 | ret = snd_soc_dapm_add_routes(&card->dapm, priv->mic_map, num_routes); | 319 | struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); |
| 320 | |||
| 321 | ret = snd_soc_dapm_add_routes(dapm, priv->mic_map, num_routes); | ||
| 318 | if (ret != 0) | 322 | if (ret != 0) |
| 319 | device_remove_software_node(priv->codec_dev); | 323 | device_remove_software_node(priv->codec_dev); |
| 320 | } | 324 | } |
| @@ -370,6 +370,8 @@ struct acp63_dev_data { · 369 unmodified lines | |||
| 370 | u32 addr; | 370 | u32 addr; |
| 371 | u32 reg_range; | 371 | u32 reg_range; |
| 372 | u32 acp_rev; | 372 | u32 acp_rev; |
| 373 | u32 subsystem_vendor; | ||
| 374 | u32 subsystem_device; | ||
| 373 | u32 acp_sw_pad_keeper_en; | 375 | u32 acp_sw_pad_keeper_en; |
| 374 | u32 acp_pad_pulldown_ctrl; | 376 | u32 acp_pad_pulldown_ctrl; |
| 375 | u16 acp63_sdw0_dma_intr_stat[ACP63_SDW0_DMA_MAX_STREAMS]; | 377 | u16 acp63_sdw0_dma_intr_stat[ACP63_SDW0_DMA_MAX_STREAMS]; |
| @@ -335,6 +335,12 @@ static struct snd_soc_acpi_mach *acp63_sdw_machine_select(struct device *dev) · 334 unmodified lines | |||
| 335 | mach->mach_params.links = mach->links; | 335 | mach->mach_params.links = mach->links; |
| 336 | mach->mach_params.link_mask = mach->link_mask; | 336 | mach->mach_params.link_mask = mach->link_mask; |
| 337 | mach->mach_params.subsystem_rev = acp_data->acp_rev; | 337 | mach->mach_params.subsystem_rev = acp_data->acp_rev; |
| 338 | mach->mach_params.subsystem_vendor = acp_data->subsystem_vendor; | ||
| 339 | mach->mach_params.subsystem_device = acp_data->subsystem_device; | ||
| 340 | mach->mach_params.subsystem_id_set = true; | ||
| 341 | |||
| 342 | dev_dbg(dev, "SSID %x%x\n", mach->mach_params.subsystem_vendor, | ||
| 343 | mach->mach_params.subsystem_device); | ||
| 338 | return mach; | 344 | return mach; |
| 339 | } | 345 | } |
| 340 | } | 346 | } |
| @@ -617,6 +623,9 @@ static int snd_acp63_probe(struct pci_dev *pci, · 276 unmodified lines | |||
| 617 | adata->addr = addr; | 623 | adata->addr = addr; |
| 618 | adata->reg_range = ACP63_REG_END - ACP63_REG_START; | 624 | adata->reg_range = ACP63_REG_END - ACP63_REG_START; |
| 619 | adata->acp_rev = pci->revision; | 625 | adata->acp_rev = pci->revision; |
| 626 | adata->subsystem_vendor = pci->subsystem_vendor; | ||
| 627 | adata->subsystem_device = pci->subsystem_device; | ||
| 628 | |||
| 620 | pci_set_master(pci); | 629 | pci_set_master(pci); |
| 621 | pci_set_drvdata(pci, adata); | 630 | pci_set_drvdata(pci, adata); |
| 622 | mutex_init(&adata->acp_lock); | 631 | mutex_init(&adata->acp_lock); |
| @@ -61,8 +61,7 @@ static const struct snd_kcontrol_new acp5x_8821_controls[] = { · 60 unmodified lines | |||
| 61 | static int platform_clock_control(struct snd_soc_dapm_widget *w, | 61 | static int platform_clock_control(struct snd_soc_dapm_widget *w, |
| 62 | struct snd_kcontrol *k, int event) | 62 | struct snd_kcontrol *k, int event) |
| 63 | { | 63 | { |
| 64 | struct snd_soc_dapm_context *dapm = w->dapm; | 64 | struct snd_soc_card *card = snd_soc_dapm_to_card(w->dapm); |
| 65 | struct snd_soc_card *card = dapm->card; | ||
| 66 | struct snd_soc_dai *dai; | 65 | struct snd_soc_dai *dai; |
| 67 | int ret = 0; | 66 | int ret = 0; |
| 68 | 67 | ||
| @@ -280,7 +280,7 @@ static const DECLARE_TLV_DB_RANGE(mic_gain_tlv, · 279 unmodified lines | |||
| 280 | static int pdmic_get_mic_volsw(struct snd_kcontrol *kcontrol, | 280 | static int pdmic_get_mic_volsw(struct snd_kcontrol *kcontrol, |
| 281 | struct snd_ctl_elem_value *ucontrol) | 281 | struct snd_ctl_elem_value *ucontrol) |
| 282 | { | 282 | { |
| 283 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 283 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 284 | unsigned int dgain_val, scale_val; | 284 | unsigned int dgain_val, scale_val; |
| 285 | int i; | 285 | int i; |
| 286 | 286 | ||
| @@ -304,7 +304,7 @@ static int pdmic_put_mic_volsw(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 304 | { | 304 | { |
| 305 | struct soc_mixer_control *mc = | 305 | struct soc_mixer_control *mc = |
| 306 | (struct soc_mixer_control *)kcontrol->private_value; | 306 | (struct soc_mixer_control *)kcontrol->private_value; |
| 307 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 307 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 308 | int max = mc->max; | 308 | int max = mc->max; |
| 309 | unsigned int val; | 309 | unsigned int val; |
| 310 | int ret; | 310 | int ret; |
| @@ -80,7 +80,7 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) · 79 unmodified lines | |||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | #ifndef ENABLE_MIC_INPUT | 82 | #ifndef ENABLE_MIC_INPUT |
| 83 | snd_soc_dapm_nc_pin(&rtd->card->dapm, "Int Mic"); | 83 | snd_soc_dapm_disable_pin(snd_soc_card_to_dapm(rtd->card), "Int Mic"); |
| 84 | #endif | 84 | #endif |
| 85 | 85 | ||
| 86 | return 0; | 86 | return 0; |
| @@ -58,8 +58,8 @@ struct tse850_priv { · 57 unmodified lines | |||
| 58 | static int tse850_get_mux1(struct snd_kcontrol *kctrl, | 58 | static int tse850_get_mux1(struct snd_kcontrol *kctrl, |
| 59 | struct snd_ctl_elem_value *ucontrol) | 59 | struct snd_ctl_elem_value *ucontrol) |
| 60 | { | 60 | { |
| 61 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 61 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 62 | struct snd_soc_card *card = dapm->card; | 62 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 63 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 63 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 64 | 64 | ||
| 65 | ucontrol->value.enumerated.item[0] = tse850->loop1_cache; | 65 | ucontrol->value.enumerated.item[0] = tse850->loop1_cache; |
| @@ -70,8 +70,8 @@ static int tse850_get_mux1(struct snd_kcontrol *kctrl, · 4 unmodified lines | |||
| 70 | static int tse850_put_mux1(struct snd_kcontrol *kctrl, | 70 | static int tse850_put_mux1(struct snd_kcontrol *kctrl, |
| 71 | struct snd_ctl_elem_value *ucontrol) | 71 | struct snd_ctl_elem_value *ucontrol) |
| 72 | { | 72 | { |
| 73 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 73 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 74 | struct snd_soc_card *card = dapm->card; | 74 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 75 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 75 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 76 | struct soc_enum *e = (struct soc_enum *)kctrl->private_value; | 76 | struct soc_enum *e = (struct soc_enum *)kctrl->private_value; |
| 77 | unsigned int val = ucontrol->value.enumerated.item[0]; | 77 | unsigned int val = ucontrol->value.enumerated.item[0]; |
| @@ -88,8 +88,8 @@ static int tse850_put_mux1(struct snd_kcontrol *kctrl, · 10 unmodified lines | |||
| 88 | static int tse850_get_mux2(struct snd_kcontrol *kctrl, | 88 | static int tse850_get_mux2(struct snd_kcontrol *kctrl, |
| 89 | struct snd_ctl_elem_value *ucontrol) | 89 | struct snd_ctl_elem_value *ucontrol) |
| 90 | { | 90 | { |
| 91 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 91 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 92 | struct snd_soc_card *card = dapm->card; | 92 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 93 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 93 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 94 | 94 | ||
| 95 | ucontrol->value.enumerated.item[0] = tse850->loop2_cache; | 95 | ucontrol->value.enumerated.item[0] = tse850->loop2_cache; |
| @@ -100,8 +100,8 @@ static int tse850_get_mux2(struct snd_kcontrol *kctrl, · 4 unmodified lines | |||
| 100 | static int tse850_put_mux2(struct snd_kcontrol *kctrl, | 100 | static int tse850_put_mux2(struct snd_kcontrol *kctrl, |
| 101 | struct snd_ctl_elem_value *ucontrol) | 101 | struct snd_ctl_elem_value *ucontrol) |
| 102 | { | 102 | { |
| 103 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 103 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 104 | struct snd_soc_card *card = dapm->card; | 104 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 105 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 105 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 106 | struct soc_enum *e = (struct soc_enum *)kctrl->private_value; | 106 | struct soc_enum *e = (struct soc_enum *)kctrl->private_value; |
| 107 | unsigned int val = ucontrol->value.enumerated.item[0]; | 107 | unsigned int val = ucontrol->value.enumerated.item[0]; |
| @@ -118,8 +118,8 @@ static int tse850_put_mux2(struct snd_kcontrol *kctrl, · 10 unmodified lines | |||
| 118 | static int tse850_get_mix(struct snd_kcontrol *kctrl, | 118 | static int tse850_get_mix(struct snd_kcontrol *kctrl, |
| 119 | struct snd_ctl_elem_value *ucontrol) | 119 | struct snd_ctl_elem_value *ucontrol) |
| 120 | { | 120 | { |
| 121 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 121 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 122 | struct snd_soc_card *card = dapm->card; | 122 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 123 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 123 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 124 | 124 | ||
| 125 | ucontrol->value.enumerated.item[0] = tse850->add_cache; | 125 | ucontrol->value.enumerated.item[0] = tse850->add_cache; |
| @@ -130,8 +130,8 @@ static int tse850_get_mix(struct snd_kcontrol *kctrl, · 4 unmodified lines | |||
| 130 | static int tse850_put_mix(struct snd_kcontrol *kctrl, | 130 | static int tse850_put_mix(struct snd_kcontrol *kctrl, |
| 131 | struct snd_ctl_elem_value *ucontrol) | 131 | struct snd_ctl_elem_value *ucontrol) |
| 132 | { | 132 | { |
| 133 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 133 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 134 | struct snd_soc_card *card = dapm->card; | 134 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 135 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 135 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 136 | int connect = !!ucontrol->value.integer.value[0]; | 136 | int connect = !!ucontrol->value.integer.value[0]; |
| 137 | 137 | ||
| @@ -152,8 +152,8 @@ static int tse850_put_mix(struct snd_kcontrol *kctrl, · 14 unmodified lines | |||
| 152 | static int tse850_get_ana(struct snd_kcontrol *kctrl, | 152 | static int tse850_get_ana(struct snd_kcontrol *kctrl, |
| 153 | struct snd_ctl_elem_value *ucontrol) | 153 | struct snd_ctl_elem_value *ucontrol) |
| 154 | { | 154 | { |
| 155 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 155 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 156 | struct snd_soc_card *card = dapm->card; | 156 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 157 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 157 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 158 | int ret; | 158 | int ret; |
| 159 | 159 | ||
| @@ -185,8 +185,8 @@ static int tse850_get_ana(struct snd_kcontrol *kctrl, · 25 unmodified lines | |||
| 185 | static int tse850_put_ana(struct snd_kcontrol *kctrl, | 185 | static int tse850_put_ana(struct snd_kcontrol *kctrl, |
| 186 | struct snd_ctl_elem_value *ucontrol) | 186 | struct snd_ctl_elem_value *ucontrol) |
| 187 | { | 187 | { |
| 188 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kctrl); | 188 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kctrl); |
| 189 | struct snd_soc_card *card = dapm->card; | 189 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); |
| 190 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); | 190 | struct tse850_priv *tse850 = snd_soc_card_get_drvdata(card); |
| 191 | struct soc_enum *e = (struct soc_enum *)kctrl->private_value; | 191 | struct soc_enum *e = (struct soc_enum *)kctrl->private_value; |
| 192 | unsigned int uV = ucontrol->value.enumerated.item[0]; | 192 | unsigned int uV = ucontrol->value.enumerated.item[0]; |
| @@ -269,7 +269,7 @@ static int snd_soc_get_volsw_2r_st(struct snd_kcontrol *kcontrol, · 268 unmodified lines | |||
| 269 | { | 269 | { |
| 270 | struct soc_mixer_control *mc = | 270 | struct soc_mixer_control *mc = |
| 271 | (struct soc_mixer_control *)kcontrol->private_value; | 271 | (struct soc_mixer_control *)kcontrol->private_value; |
| 272 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 272 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 273 | unsigned int reg = mc->reg; | 273 | unsigned int reg = mc->reg; |
| 274 | unsigned int reg2 = mc->rreg; | 274 | unsigned int reg2 = mc->rreg; |
| 275 | int val[2], val2[2], i; | 275 | int val[2], val2[2], i; |
| @@ -293,7 +293,7 @@ static int snd_soc_put_volsw_2r_st(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 293 | { | 293 | { |
| 294 | struct soc_mixer_control *mc = | 294 | struct soc_mixer_control *mc = |
| 295 | (struct soc_mixer_control *)kcontrol->private_value; | 295 | (struct soc_mixer_control *)kcontrol->private_value; |
| 296 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 296 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 297 | unsigned int reg = mc->reg; | 297 | unsigned int reg = mc->reg; |
| 298 | unsigned int reg2 = mc->rreg; | 298 | unsigned int reg2 = mc->rreg; |
| 299 | int err; | 299 | int err; |
| @@ -326,7 +326,7 @@ static int snd_soc_get_volsw_2r_out(struct snd_kcontrol *kcontrol, · 26 unmodified lines | |||
| 326 | { | 326 | { |
| 327 | struct soc_mixer_control *mc = | 327 | struct soc_mixer_control *mc = |
| 328 | (struct soc_mixer_control *)kcontrol->private_value; | 328 | (struct soc_mixer_control *)kcontrol->private_value; |
| 329 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 329 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 330 | unsigned int reg = mc->reg; | 330 | unsigned int reg = mc->reg; |
| 331 | unsigned int reg2 = mc->rreg; | 331 | unsigned int reg2 = mc->rreg; |
| 332 | unsigned int shift = mc->shift; | 332 | unsigned int shift = mc->shift; |
| @@ -346,7 +346,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 346 | { | 346 | { |
| 347 | struct soc_mixer_control *mc = | 347 | struct soc_mixer_control *mc = |
| 348 | (struct soc_mixer_control *)kcontrol->private_value; | 348 | (struct soc_mixer_control *)kcontrol->private_value; |
| 349 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 349 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 350 | unsigned int reg = mc->reg; | 350 | unsigned int reg = mc->reg; |
| 351 | unsigned int reg2 = mc->rreg; | 351 | unsigned int reg2 = mc->rreg; |
| 352 | unsigned int shift = mc->shift; | 352 | unsigned int shift = mc->shift; |
| @@ -1106,6 +1106,7 @@ static int pm860x_set_bias_level(struct snd_soc_component *component, · 753 unmodified lines | |||
| 1106 | enum snd_soc_bias_level level) | 1106 | enum snd_soc_bias_level level) |
| 1107 | { | 1107 | { |
| 1108 | struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component); | 1108 | struct pm860x_priv *pm860x = snd_soc_component_get_drvdata(component); |
| 1109 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1109 | int data; | 1110 | int data; |
| 1110 | 1111 | ||
| 1111 | switch (level) { | 1112 | switch (level) { |
| @@ -1116,7 +1117,7 @@ static int pm860x_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines | |||
| 1116 | break; | 1117 | break; |
| 1117 | 1118 | ||
| 1118 | case SND_SOC_BIAS_STANDBY: | 1119 | case SND_SOC_BIAS_STANDBY: |
| 1119 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1120 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1120 | /* Enable Audio PLL & Audio section */ | 1121 | /* Enable Audio PLL & Audio section */ |
| 1121 | data = AUDIO_PLL | AUDIO_SECTION_ON; | 1122 | data = AUDIO_PLL | AUDIO_SECTION_ON; |
| 1122 | pm860x_reg_write(pm860x->i2c, REG_MISC2, data); | 1123 | pm860x_reg_write(pm860x->i2c, REG_MISC2, data); |
| @@ -106,6 +106,7 @@ config SND_SOC_ALL_CODECS · 105 unmodified lines | |||
| 106 | imply SND_SOC_CS48L32 | 106 | imply SND_SOC_CS48L32 |
| 107 | imply SND_SOC_CS53L30 | 107 | imply SND_SOC_CS53L30 |
| 108 | imply SND_SOC_CS530X_I2C | 108 | imply SND_SOC_CS530X_I2C |
| 109 | imply SND_SOC_CS530X_SPI | ||
| 109 | imply SND_SOC_CX20442 | 110 | imply SND_SOC_CX20442 |
| 110 | imply SND_SOC_CX2072X | 111 | imply SND_SOC_CX2072X |
| 111 | imply SND_SOC_DA7210 | 112 | imply SND_SOC_DA7210 |
| @@ -170,6 +171,7 @@ config SND_SOC_ALL_CODECS · 58 unmodified lines | |||
| 170 | imply SND_SOC_MT6359 | 171 | imply SND_SOC_MT6359 |
| 171 | imply SND_SOC_MT6660 | 172 | imply SND_SOC_MT6660 |
| 172 | imply SND_SOC_NAU8315 | 173 | imply SND_SOC_NAU8315 |
| 174 | imply SND_SOC_NAU8325 | ||
| 173 | imply SND_SOC_NAU8540 | 175 | imply SND_SOC_NAU8540 |
| 174 | imply SND_SOC_NAU8810 | 176 | imply SND_SOC_NAU8810 |
| 175 | imply SND_SOC_NAU8821 | 177 | imply SND_SOC_NAU8821 |
| @@ -896,6 +898,38 @@ config SND_SOC_CS35L56_SDW · 720 unmodified lines | |||
| 896 | help | 898 | help |
| 897 | Enable support for Cirrus Logic CS35L56 boosted amplifier with SoundWire control | 899 | Enable support for Cirrus Logic CS35L56 boosted amplifier with SoundWire control |
| 898 | 900 | ||
| 901 | config SND_SOC_CS35L56_CAL_DEBUGFS_COMMON | ||
| 902 | bool | ||
| 903 | |||
| 904 | menu "CS35L56 driver options" | ||
| 905 | depends on SND_SOC_CS35L56 | ||
| 906 | |||
| 907 | config SND_SOC_CS35L56_CAL_DEBUGFS | ||
| 908 | bool "CS35L56 create debugfs for factory calibration" | ||
| 909 | default N | ||
| 910 | depends on DEBUG_FS | ||
| 911 | select SND_SOC_CS35L56_CAL_DEBUGFS_COMMON | ||
| 912 | help | ||
| 913 | Create debugfs entries used during factory-line manufacture | ||
| 914 | for factory calibration. | ||
| 915 | |||
| 916 | If unsure select "N". | ||
| 917 | |||
| 918 | config SND_SOC_CS35L56_CAL_SET_CTRL | ||
| 919 | bool "CS35L56 ALSA control to restore factory calibration" | ||
| 920 | default N | ||
| 921 | select SND_SOC_CS35L56_CAL_SYSFS_COMMON | ||
| 922 | help | ||
| 923 | Allow restoring factory calibration data through an ALSA | ||
| 924 | control. This is only needed on platforms without UEFI or | ||
| 925 | some other method of non-volatile storage that the driver | ||
| 926 | can access directly. | ||
| 927 | |||
| 928 | On most platforms this is not needed. | ||
| 929 | |||
| 930 | If unsure select "N". | ||
| 931 | endmenu | ||
| 932 | |||
| 899 | config SND_SOC_CS40L50 | 933 | config SND_SOC_CS40L50 |
| 900 | tristate "Cirrus Logic CS40L50 CODEC" | 934 | tristate "Cirrus Logic CS40L50 CODEC" |
| 901 | depends on MFD_CS40L50_CORE | 935 | depends on MFD_CS40L50_CORE |
| @@ -1082,6 +1116,15 @@ config SND_SOC_CS530X_I2C · 180 unmodified lines | |||
| 1082 | Enable support for Cirrus Logic CS530X ADCs | 1116 | Enable support for Cirrus Logic CS530X ADCs |
| 1083 | with I2C control. | 1117 | with I2C control. |
| 1084 | 1118 | ||
| 1119 | config SND_SOC_CS530X_SPI | ||
| 1120 | tristate "Cirrus Logic CS530x ADCs (SPI)" | ||
| 1121 | depends on SPI_MASTER | ||
| 1122 | select REGMAP_SPI | ||
| 1123 | select SND_SOC_CS530X | ||
| 1124 | help | ||
| 1125 | Enable support for Cirrus Logic CS530X ADCs | ||
| 1126 | with SPI control. | ||
| 1127 | |||
| 1085 | config SND_SOC_CX20442 | 1128 | config SND_SOC_CX20442 |
| 1086 | tristate | 1129 | tristate |
| 1087 | depends on TTY | 1130 | depends on TTY |
| @@ -1567,6 +1610,7 @@ config SND_SOC_PEB2466 · 479 unmodified lines | |||
| 1567 | 1610 | ||
| 1568 | config SND_SOC_PM4125 | 1611 | config SND_SOC_PM4125 |
| 1569 | depends on SND_SOC_PM4125_SDW | 1612 | depends on SND_SOC_PM4125_SDW |
| 1613 | select SND_SOC_WCD_COMMON | ||
| 1570 | tristate | 1614 | tristate |
| 1571 | depends on SOUNDWIRE || !SOUNDWIRE | 1615 | depends on SOUNDWIRE || !SOUNDWIRE |
| 1572 | 1616 | ||
| @@ -1575,6 +1619,7 @@ config SND_SOC_PM4125_SDW · 2 unmodified lines | |||
| 1575 | select SND_SOC_PM4125 | 1619 | select SND_SOC_PM4125 |
| 1576 | select SND_SOC_WCD_MBHC | 1620 | select SND_SOC_WCD_MBHC |
| 1577 | select REGMAP_IRQ | 1621 | select REGMAP_IRQ |
| 1622 | select SND_SOC_WCD_COMMON | ||
| 1578 | depends on SOUNDWIRE | 1623 | depends on SOUNDWIRE |
| 1579 | select REGMAP_SOUNDWIRE | 1624 | select REGMAP_SOUNDWIRE |
| 1580 | help | 1625 | help |
| @@ -2310,6 +2355,7 @@ config SND_SOC_WCD934X · 729 unmodified lines | |||
| 2310 | tristate "WCD9340/WCD9341 Codec" | 2355 | tristate "WCD9340/WCD9341 Codec" |
| 2311 | depends on COMMON_CLK | 2356 | depends on COMMON_CLK |
| 2312 | depends on SLIMBUS | 2357 | depends on SLIMBUS |
| 2358 | depends on SOUNDWIRE || !SOUNDWIRE | ||
| 2313 | select REGMAP_IRQ | 2359 | select REGMAP_IRQ |
| 2314 | select REGMAP_SLIMBUS | 2360 | select REGMAP_SLIMBUS |
| 2315 | select SND_SOC_WCD_CLASSH | 2361 | select SND_SOC_WCD_CLASSH |
| @@ -2715,6 +2761,10 @@ config SND_SOC_MT6660 · 399 unmodified lines | |||
| 2715 | config SND_SOC_NAU8315 | 2761 | config SND_SOC_NAU8315 |
| 2716 | tristate "Nuvoton Technology Corporation NAU8315 CODEC" | 2762 | tristate "Nuvoton Technology Corporation NAU8315 CODEC" |
| 2717 | 2763 | ||
| 2764 | config SND_SOC_NAU8325 | ||
| 2765 | tristate "Nuvoton Technology Corporation NAU8325 CODEC" | ||
| 2766 | depends on I2C | ||
| 2767 | |||
| 2718 | config SND_SOC_NAU8540 | 2768 | config SND_SOC_NAU8540 |
| 2719 | tristate "Nuvoton Technology Corporation NAU85L40 CODEC" | 2769 | tristate "Nuvoton Technology Corporation NAU85L40 CODEC" |
| 2720 | depends on I2C | 2770 | depends on I2C |
| @@ -50,9 +50,9 @@ snd-soc-audio-iio-aux-y := audio-iio-aux.o · 49 unmodified lines | |||
| 50 | snd-soc-aw8738-y := aw8738.o | 50 | snd-soc-aw8738-y := aw8738.o |
| 51 | snd-soc-aw87390-y := aw87390.o | 51 | snd-soc-aw87390-y := aw87390.o |
| 52 | snd-soc-aw88081-y := aw88081.o | 52 | snd-soc-aw88081-y := aw88081.o |
| 53 | snd-soc-aw88395-lib-y := aw88395/aw88395_lib.o | 53 | snd-soc-aw88395-lib-y := aw88395/aw88395_lib.o \ |
| 54 | snd-soc-aw88395-y := aw88395/aw88395.o \ | ||
| 55 | aw88395/aw88395_device.o | 54 | aw88395/aw88395_device.o |
| 55 | snd-soc-aw88395-y := aw88395/aw88395.o | ||
| 56 | snd-soc-aw88166-y := aw88166.o | 56 | snd-soc-aw88166-y := aw88166.o |
| 57 | snd-soc-aw88261-y := aw88261.o | 57 | snd-soc-aw88261-y := aw88261.o |
| 58 | snd-soc-aw88399-y := aw88399.o | 58 | snd-soc-aw88399-y := aw88399.o |
| @@ -115,6 +115,7 @@ snd-soc-cs48l32-y := cs48l32.o cs48l32-tables.o · 56 unmodified lines | |||
| 115 | snd-soc-cs53l30-y := cs53l30.o | 115 | snd-soc-cs53l30-y := cs53l30.o |
| 116 | snd-soc-cs530x-y := cs530x.o | 116 | snd-soc-cs530x-y := cs530x.o |
| 117 | snd-soc-cs530x-i2c-y := cs530x-i2c.o | 117 | snd-soc-cs530x-i2c-y := cs530x-i2c.o |
| 118 | snd-soc-cs530x-spi-y := cs530x-spi.o | ||
| 118 | snd-soc-cx20442-y := cx20442.o | 119 | snd-soc-cx20442-y := cx20442.o |
| 119 | snd-soc-cx2072x-y := cx2072x.o | 120 | snd-soc-cx2072x-y := cx2072x.o |
| 120 | snd-soc-da7210-y := da7210.o | 121 | snd-soc-da7210-y := da7210.o |
| @@ -192,6 +193,7 @@ snd-soc-mt6359-y := mt6359.o · 71 unmodified lines | |||
| 192 | snd-soc-mt6359-accdet-y := mt6359-accdet.o | 193 | snd-soc-mt6359-accdet-y := mt6359-accdet.o |
| 193 | snd-soc-mt6660-y := mt6660.o | 194 | snd-soc-mt6660-y := mt6660.o |
| 194 | snd-soc-nau8315-y := nau8315.o | 195 | snd-soc-nau8315-y := nau8315.o |
| 196 | snd-soc-nau8325-y := nau8325.o | ||
| 195 | snd-soc-nau8540-y := nau8540.o | 197 | snd-soc-nau8540-y := nau8540.o |
| 196 | snd-soc-nau8810-y := nau8810.o | 198 | snd-soc-nau8810-y := nau8810.o |
| 197 | snd-soc-nau8821-y := nau8821.o | 199 | snd-soc-nau8821-y := nau8821.o |
| @@ -546,6 +548,7 @@ obj-$(CONFIG_SND_SOC_CS48L32) += snd-soc-cs48l32.o · 348 unmodified lines | |||
| 546 | obj-$(CONFIG_SND_SOC_CS53L30) += snd-soc-cs53l30.o | 548 | obj-$(CONFIG_SND_SOC_CS53L30) += snd-soc-cs53l30.o |
| 547 | obj-$(CONFIG_SND_SOC_CS530X) += snd-soc-cs530x.o | 549 | obj-$(CONFIG_SND_SOC_CS530X) += snd-soc-cs530x.o |
| 548 | obj-$(CONFIG_SND_SOC_CS530X_I2C) += snd-soc-cs530x-i2c.o | 550 | obj-$(CONFIG_SND_SOC_CS530X_I2C) += snd-soc-cs530x-i2c.o |
| 551 | obj-$(CONFIG_SND_SOC_CS530X_SPI) += snd-soc-cs530x-spi.o | ||
| 549 | obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o | 552 | obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o |
| 550 | obj-$(CONFIG_SND_SOC_CX2072X) += snd-soc-cx2072x.o | 553 | obj-$(CONFIG_SND_SOC_CX2072X) += snd-soc-cx2072x.o |
| 551 | obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o | 554 | obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o |
| @@ -618,6 +621,7 @@ obj-$(CONFIG_SND_SOC_MT6359) += snd-soc-mt6359.o · 66 unmodified lines | |||
| 618 | obj-$(CONFIG_SND_SOC_MT6359_ACCDET) += mt6359-accdet.o | 621 | obj-$(CONFIG_SND_SOC_MT6359_ACCDET) += mt6359-accdet.o |
| 619 | obj-$(CONFIG_SND_SOC_MT6660) += snd-soc-mt6660.o | 622 | obj-$(CONFIG_SND_SOC_MT6660) += snd-soc-mt6660.o |
| 620 | obj-$(CONFIG_SND_SOC_NAU8315) += snd-soc-nau8315.o | 623 | obj-$(CONFIG_SND_SOC_NAU8315) += snd-soc-nau8315.o |
| 624 | obj-$(CONFIG_SND_SOC_NAU8325) += snd-soc-nau8325.o | ||
| 621 | obj-$(CONFIG_SND_SOC_NAU8540) += snd-soc-nau8540.o | 625 | obj-$(CONFIG_SND_SOC_NAU8540) += snd-soc-nau8540.o |
| 622 | obj-$(CONFIG_SND_SOC_NAU8810) += snd-soc-nau8810.o | 626 | obj-$(CONFIG_SND_SOC_NAU8810) += snd-soc-nau8810.o |
| 623 | obj-$(CONFIG_SND_SOC_NAU8821) += snd-soc-nau8821.o | 627 | obj-$(CONFIG_SND_SOC_NAU8821) += snd-soc-nau8821.o |
| @@ -1114,7 +1114,7 @@ static void anc_configure(struct snd_soc_component *component, · 1113 unmodified lines | |||
| 1114 | static int sid_status_control_get(struct snd_kcontrol *kcontrol, | 1114 | static int sid_status_control_get(struct snd_kcontrol *kcontrol, |
| 1115 | struct snd_ctl_elem_value *ucontrol) | 1115 | struct snd_ctl_elem_value *ucontrol) |
| 1116 | { | 1116 | { |
| 1117 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1117 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1118 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); | 1118 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); |
| 1119 | 1119 | ||
| 1120 | mutex_lock(&drvdata->ctrl_lock); | 1120 | mutex_lock(&drvdata->ctrl_lock); |
| @@ -1128,7 +1128,7 @@ static int sid_status_control_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 1128 | static int sid_status_control_put(struct snd_kcontrol *kcontrol, | 1128 | static int sid_status_control_put(struct snd_kcontrol *kcontrol, |
| 1129 | struct snd_ctl_elem_value *ucontrol) | 1129 | struct snd_ctl_elem_value *ucontrol) |
| 1130 | { | 1130 | { |
| 1131 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1131 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1132 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); | 1132 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); |
| 1133 | unsigned int param, sidconf, val; | 1133 | unsigned int param, sidconf, val; |
| 1134 | int status = 1; | 1134 | int status = 1; |
| @@ -1183,7 +1183,7 @@ out: · 48 unmodified lines | |||
| 1183 | static int anc_status_control_get(struct snd_kcontrol *kcontrol, | 1183 | static int anc_status_control_get(struct snd_kcontrol *kcontrol, |
| 1184 | struct snd_ctl_elem_value *ucontrol) | 1184 | struct snd_ctl_elem_value *ucontrol) |
| 1185 | { | 1185 | { |
| 1186 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1186 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1187 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); | 1187 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); |
| 1188 | 1188 | ||
| 1189 | mutex_lock(&drvdata->ctrl_lock); | 1189 | mutex_lock(&drvdata->ctrl_lock); |
| @@ -1196,8 +1196,8 @@ static int anc_status_control_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 1196 | static int anc_status_control_put(struct snd_kcontrol *kcontrol, | 1196 | static int anc_status_control_put(struct snd_kcontrol *kcontrol, |
| 1197 | struct snd_ctl_elem_value *ucontrol) | 1197 | struct snd_ctl_elem_value *ucontrol) |
| 1198 | { | 1198 | { |
| 1199 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1199 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1200 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1200 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1201 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); | 1201 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(component->dev); |
| 1202 | struct device *dev = component->dev; | 1202 | struct device *dev = component->dev; |
| 1203 | bool apply_fir, apply_iir; | 1203 | bool apply_fir, apply_iir; |
| @@ -1279,7 +1279,7 @@ static int filter_control_info(struct snd_kcontrol *kcontrol, · 75 unmodified lines | |||
| 1279 | static int filter_control_get(struct snd_kcontrol *kcontrol, | 1279 | static int filter_control_get(struct snd_kcontrol *kcontrol, |
| 1280 | struct snd_ctl_elem_value *ucontrol) | 1280 | struct snd_ctl_elem_value *ucontrol) |
| 1281 | { | 1281 | { |
| 1282 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1282 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1283 | struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component); | 1283 | struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component); |
| 1284 | struct filter_control *fc = | 1284 | struct filter_control *fc = |
| 1285 | (struct filter_control *)kcontrol->private_value; | 1285 | (struct filter_control *)kcontrol->private_value; |
| @@ -1296,7 +1296,7 @@ static int filter_control_get(struct snd_kcontrol *kcontrol, · 10 unmodified lines | |||
| 1296 | static int filter_control_put(struct snd_kcontrol *kcontrol, | 1296 | static int filter_control_put(struct snd_kcontrol *kcontrol, |
| 1297 | struct snd_ctl_elem_value *ucontrol) | 1297 | struct snd_ctl_elem_value *ucontrol) |
| 1298 | { | 1298 | { |
| 1299 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1299 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1300 | struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component); | 1300 | struct ab8500_codec_drvdata *drvdata = snd_soc_component_get_drvdata(component); |
| 1301 | struct filter_control *fc = | 1301 | struct filter_control *fc = |
| 1302 | (struct filter_control *)kcontrol->private_value; | 1302 | (struct filter_control *)kcontrol->private_value; |
| @@ -1934,7 +1934,7 @@ static int ab8500_audio_init_audioblock(struct snd_soc_component *component) · 631 unmodified lines | |||
| 1934 | static int ab8500_audio_setup_mics(struct snd_soc_component *component, | 1934 | static int ab8500_audio_setup_mics(struct snd_soc_component *component, |
| 1935 | struct amic_settings *amics) | 1935 | struct amic_settings *amics) |
| 1936 | { | 1936 | { |
| 1937 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1937 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1938 | u8 value8; | 1938 | u8 value8; |
| 1939 | unsigned int value; | 1939 | unsigned int value; |
| 1940 | int status; | 1940 | int status; |
| @@ -2449,7 +2449,7 @@ static void ab8500_codec_of_probe(struct device *dev, struct device_node *np, · 508 unmodified lines | |||
| 2449 | 2449 | ||
| 2450 | static int ab8500_codec_probe(struct snd_soc_component *component) | 2450 | static int ab8500_codec_probe(struct snd_soc_component *component) |
| 2451 | { | 2451 | { |
| 2452 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 2452 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2453 | struct device *dev = component->dev; | 2453 | struct device *dev = component->dev; |
| 2454 | struct device_node *np = dev->of_node; | 2454 | struct device_node *np = dev->of_node; |
| 2455 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); | 2455 | struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); |
| @@ -250,7 +250,7 @@ static int ad1836_resume(struct snd_soc_component *component) · 249 unmodified lines | |||
| 250 | static int ad1836_probe(struct snd_soc_component *component) | 250 | static int ad1836_probe(struct snd_soc_component *component) |
| 251 | { | 251 | { |
| 252 | struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component); | 252 | struct ad1836_priv *ad1836 = snd_soc_component_get_drvdata(component); |
| 253 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 253 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 254 | int num_dacs, num_adcs; | 254 | int num_dacs, num_adcs; |
| 255 | int ret = 0; | 255 | int ret = 0; |
| 256 | int i; | 256 | int i; |
| @@ -282,7 +282,7 @@ static int ad193x_set_dai_sysclk(struct snd_soc_dai *codec_dai, · 281 unmodified lines | |||
| 282 | int clk_id, unsigned int freq, int dir) | 282 | int clk_id, unsigned int freq, int dir) |
| 283 | { | 283 | { |
| 284 | struct snd_soc_component *component = codec_dai->component; | 284 | struct snd_soc_component *component = codec_dai->component; |
| 285 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 285 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 286 | struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component); | 286 | struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component); |
| 287 | 287 | ||
| 288 | if (clk_id == AD193X_SYSCLK_MCLK) { | 288 | if (clk_id == AD193X_SYSCLK_MCLK) { |
| @@ -476,7 +476,7 @@ static void ad193x_reg_default_init(struct ad193x_priv *ad193x) · 187 unmodified lines | |||
| 476 | static int ad193x_component_probe(struct snd_soc_component *component) | 476 | static int ad193x_component_probe(struct snd_soc_component *component) |
| 477 | { | 477 | { |
| 478 | struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component); | 478 | struct ad193x_priv *ad193x = snd_soc_component_get_drvdata(component); |
| 479 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 479 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 480 | int num, ret; | 480 | int num, ret; |
| 481 | 481 | ||
| 482 | /* default setting for ad193x */ | 482 | /* default setting for ad193x */ |
| @@ -621,6 +621,7 @@ static int adau1761_set_bias_level(struct snd_soc_component *component, · 620 unmodified lines | |||
| 621 | enum snd_soc_bias_level level) | 621 | enum snd_soc_bias_level level) |
| 622 | { | 622 | { |
| 623 | struct adau *adau = snd_soc_component_get_drvdata(component); | 623 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 624 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 624 | 625 | ||
| 625 | switch (level) { | 626 | switch (level) { |
| 626 | case SND_SOC_BIAS_ON: | 627 | case SND_SOC_BIAS_ON: |
| @@ -632,7 +633,7 @@ static int adau1761_set_bias_level(struct snd_soc_component *component, · 5 unmodified lines | |||
| 632 | regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, | 633 | regmap_update_bits(adau->regmap, ADAU17X1_CLOCK_CONTROL, |
| 633 | ADAU17X1_CLOCK_CONTROL_SYSCLK_EN, | 634 | ADAU17X1_CLOCK_CONTROL_SYSCLK_EN, |
| 634 | ADAU17X1_CLOCK_CONTROL_SYSCLK_EN); | 635 | ADAU17X1_CLOCK_CONTROL_SYSCLK_EN); |
| 635 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 636 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 636 | regcache_sync(adau->regmap); | 637 | regcache_sync(adau->regmap); |
| 637 | break; | 638 | break; |
| 638 | case SND_SOC_BIAS_OFF: | 639 | case SND_SOC_BIAS_OFF: |
| @@ -658,7 +659,7 @@ static enum adau1761_output_mode adau1761_get_lineout_mode( · 19 unmodified lines | |||
| 658 | 659 | ||
| 659 | static int adau1761_setup_digmic_jackdetect(struct snd_soc_component *component) | 660 | static int adau1761_setup_digmic_jackdetect(struct snd_soc_component *component) |
| 660 | { | 661 | { |
| 661 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 662 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 662 | struct adau1761_platform_data *pdata = component->dev->platform_data; | 663 | struct adau1761_platform_data *pdata = component->dev->platform_data; |
| 663 | struct adau *adau = snd_soc_component_get_drvdata(component); | 664 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 664 | enum adau1761_digmic_jackdet_pin_mode mode; | 665 | enum adau1761_digmic_jackdet_pin_mode mode; |
| @@ -721,7 +722,7 @@ static int adau1761_setup_digmic_jackdetect(struct snd_soc_component *component) · 56 unmodified lines | |||
| 721 | 722 | ||
| 722 | static int adau1761_setup_headphone_mode(struct snd_soc_component *component) | 723 | static int adau1761_setup_headphone_mode(struct snd_soc_component *component) |
| 723 | { | 724 | { |
| 724 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 725 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 725 | struct adau *adau = snd_soc_component_get_drvdata(component); | 726 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 726 | struct adau1761_platform_data *pdata = component->dev->platform_data; | 727 | struct adau1761_platform_data *pdata = component->dev->platform_data; |
| 727 | enum adau1761_output_mode mode; | 728 | enum adau1761_output_mode mode; |
| @@ -819,7 +820,7 @@ static bool adau1761_readable_register(struct device *dev, unsigned int reg) · 91 unmodified lines | |||
| 819 | 820 | ||
| 820 | static int adau1761_component_probe(struct snd_soc_component *component) | 821 | static int adau1761_component_probe(struct snd_soc_component *component) |
| 821 | { | 822 | { |
| 822 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 823 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 823 | struct adau1761_platform_data *pdata = component->dev->platform_data; | 824 | struct adau1761_platform_data *pdata = component->dev->platform_data; |
| 824 | struct adau *adau = snd_soc_component_get_drvdata(component); | 825 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 825 | int ret; | 826 | int ret; |
| @@ -381,7 +381,7 @@ static int adau1781_set_input_mode(struct adau *adau, unsigned int reg, · 380 unmodified lines | |||
| 381 | 381 | ||
| 382 | static int adau1781_component_probe(struct snd_soc_component *component) | 382 | static int adau1781_component_probe(struct snd_soc_component *component) |
| 383 | { | 383 | { |
| 384 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 384 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 385 | struct adau1781_platform_data *pdata = dev_get_platdata(component->dev); | 385 | struct adau1781_platform_data *pdata = dev_get_platdata(component->dev); |
| 386 | struct adau *adau = snd_soc_component_get_drvdata(component); | 386 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 387 | int ret; | 387 | int ret; |
| @@ -185,8 +185,8 @@ static const struct snd_soc_dapm_route adau17x1_dapm_pll_route = { · 184 unmodified lines | |||
| 185 | static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, | 185 | static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 186 | struct snd_ctl_elem_value *ucontrol) | 186 | struct snd_ctl_elem_value *ucontrol) |
| 187 | { | 187 | { |
| 188 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 188 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 189 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 189 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 190 | struct adau *adau = snd_soc_component_get_drvdata(component); | 190 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 191 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 191 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 192 | struct snd_soc_dapm_update update = {}; | 192 | struct snd_soc_dapm_update update = {}; |
| @@ -230,7 +230,7 @@ static int adau17x1_dsp_mux_enum_put(struct snd_kcontrol *kcontrol, · 37 unmodified lines | |||
| 230 | static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol, | 230 | static int adau17x1_dsp_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 231 | struct snd_ctl_elem_value *ucontrol) | 231 | struct snd_ctl_elem_value *ucontrol) |
| 232 | { | 232 | { |
| 233 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 233 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 234 | struct adau *adau = snd_soc_component_get_drvdata(component); | 234 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 235 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 235 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 236 | unsigned int stream = e->shift_l; | 236 | unsigned int stream = e->shift_l; |
| @@ -383,7 +383,7 @@ static int adau17x1_set_dai_pll(struct snd_soc_dai *dai, int pll_id, · 146 unmodified lines | |||
| 383 | static int adau17x1_set_dai_sysclk(struct snd_soc_dai *dai, | 383 | static int adau17x1_set_dai_sysclk(struct snd_soc_dai *dai, |
| 384 | int clk_id, unsigned int freq, int dir) | 384 | int clk_id, unsigned int freq, int dir) |
| 385 | { | 385 | { |
| 386 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(dai->component); | 386 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(dai->component); |
| 387 | struct adau *adau = snd_soc_component_get_drvdata(dai->component); | 387 | struct adau *adau = snd_soc_component_get_drvdata(dai->component); |
| 388 | bool is_pll; | 388 | bool is_pll; |
| 389 | bool was_pll; | 389 | bool was_pll; |
| @@ -881,7 +881,7 @@ static int adau17x1_setup_firmware(struct snd_soc_component *component, · 491 unmodified lines | |||
| 881 | int ret; | 881 | int ret; |
| 882 | int dspsr, dsp_run; | 882 | int dspsr, dsp_run; |
| 883 | struct adau *adau = snd_soc_component_get_drvdata(component); | 883 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 884 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 884 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 885 | 885 | ||
| 886 | /* Check if sample rate is the same as before. If it is there is no | 886 | /* Check if sample rate is the same as before. If it is there is no |
| 887 | * point in performing the below steps as the call to | 887 | * point in performing the below steps as the call to |
| @@ -922,7 +922,7 @@ err: · 34 unmodified lines | |||
| 922 | 922 | ||
| 923 | int adau17x1_add_widgets(struct snd_soc_component *component) | 923 | int adau17x1_add_widgets(struct snd_soc_component *component) |
| 924 | { | 924 | { |
| 925 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 925 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 926 | struct adau *adau = snd_soc_component_get_drvdata(component); | 926 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 927 | int ret; | 927 | int ret; |
| 928 | 928 | ||
| @@ -958,7 +958,7 @@ EXPORT_SYMBOL_GPL(adau17x1_add_widgets); · 29 unmodified lines | |||
| 958 | 958 | ||
| 959 | int adau17x1_add_routes(struct snd_soc_component *component) | 959 | int adau17x1_add_routes(struct snd_soc_component *component) |
| 960 | { | 960 | { |
| 961 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 961 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 962 | struct adau *adau = snd_soc_component_get_drvdata(component); | 962 | struct adau *adau = snd_soc_component_get_drvdata(component); |
| 963 | int ret; | 963 | int ret; |
| 964 | 964 | ||
| @@ -473,6 +473,7 @@ static int adau1977_set_bias_level(struct snd_soc_component *component, · 472 unmodified lines | |||
| 473 | enum snd_soc_bias_level level) | 473 | enum snd_soc_bias_level level) |
| 474 | { | 474 | { |
| 475 | struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component); | 475 | struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component); |
| 476 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 476 | int ret = 0; | 477 | int ret = 0; |
| 477 | 478 | ||
| 478 | switch (level) { | 479 | switch (level) { |
| @@ -481,7 +482,7 @@ static int adau1977_set_bias_level(struct snd_soc_component *component, · 2 unmodified lines | |||
| 481 | case SND_SOC_BIAS_PREPARE: | 482 | case SND_SOC_BIAS_PREPARE: |
| 482 | break; | 483 | break; |
| 483 | case SND_SOC_BIAS_STANDBY: | 484 | case SND_SOC_BIAS_STANDBY: |
| 484 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 485 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 485 | ret = adau1977_power_enable(adau1977); | 486 | ret = adau1977_power_enable(adau1977); |
| 486 | break; | 487 | break; |
| 487 | case SND_SOC_BIAS_OFF: | 488 | case SND_SOC_BIAS_OFF: |
| @@ -845,7 +846,7 @@ static int adau1977_set_sysclk(struct snd_soc_component *component, · 357 unmodified lines | |||
| 845 | 846 | ||
| 846 | static int adau1977_component_probe(struct snd_soc_component *component) | 847 | static int adau1977_component_probe(struct snd_soc_component *component) |
| 847 | { | 848 | { |
| 848 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 849 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 849 | struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component); | 850 | struct adau1977 *adau1977 = snd_soc_component_get_drvdata(component); |
| 850 | int ret; | 851 | int ret; |
| 851 | 852 | ||
| @@ -335,6 +335,7 @@ static int adau7118_set_bias_level(struct snd_soc_component *component, · 334 unmodified lines | |||
| 335 | enum snd_soc_bias_level level) | 335 | enum snd_soc_bias_level level) |
| 336 | { | 336 | { |
| 337 | struct adau7118_data *st = snd_soc_component_get_drvdata(component); | 337 | struct adau7118_data *st = snd_soc_component_get_drvdata(component); |
| 338 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 338 | int ret = 0; | 339 | int ret = 0; |
| 339 | 340 | ||
| 340 | dev_dbg(st->dev, "Set bias level %d\n", level); | 341 | dev_dbg(st->dev, "Set bias level %d\n", level); |
| @@ -345,8 +346,7 @@ static int adau7118_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines | |||
| 345 | break; | 346 | break; |
| 346 | 347 | ||
| 347 | case SND_SOC_BIAS_STANDBY: | 348 | case SND_SOC_BIAS_STANDBY: |
| 348 | if (snd_soc_component_get_bias_level(component) == | 349 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 349 | SND_SOC_BIAS_OFF) { | ||
| 350 | /* power on */ | 350 | /* power on */ |
| 351 | ret = regulator_enable(st->iovdd); | 351 | ret = regulator_enable(st->iovdd); |
| 352 | if (ret) | 352 | if (ret) |
| @@ -393,8 +393,7 @@ static int adau7118_set_bias_level(struct snd_soc_component *component, · 40 unmodified lines | |||
| 393 | static int adau7118_component_probe(struct snd_soc_component *component) | 393 | static int adau7118_component_probe(struct snd_soc_component *component) |
| 394 | { | 394 | { |
| 395 | struct adau7118_data *st = snd_soc_component_get_drvdata(component); | 395 | struct adau7118_data *st = snd_soc_component_get_drvdata(component); |
| 396 | struct snd_soc_dapm_context *dapm = | 396 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 397 | snd_soc_component_get_dapm(component); | ||
| 398 | int ret = 0; | 397 | int ret = 0; |
| 399 | 398 | ||
| 400 | if (st->hw_mode) { | 399 | if (st->hw_mode) { |
| @@ -314,7 +314,7 @@ static int adav80x_set_deemph(struct snd_soc_component *component) · 313 unmodified lines | |||
| 314 | static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, | 314 | static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, |
| 315 | struct snd_ctl_elem_value *ucontrol) | 315 | struct snd_ctl_elem_value *ucontrol) |
| 316 | { | 316 | { |
| 317 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 317 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 318 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); | 318 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); |
| 319 | unsigned int deemph = ucontrol->value.integer.value[0]; | 319 | unsigned int deemph = ucontrol->value.integer.value[0]; |
| 320 | 320 | ||
| @@ -329,7 +329,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 329 | static int adav80x_get_deemph(struct snd_kcontrol *kcontrol, | 329 | static int adav80x_get_deemph(struct snd_kcontrol *kcontrol, |
| 330 | struct snd_ctl_elem_value *ucontrol) | 330 | struct snd_ctl_elem_value *ucontrol) |
| 331 | { | 331 | { |
| 332 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 332 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 333 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); | 333 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); |
| 334 | 334 | ||
| 335 | ucontrol->value.integer.value[0] = adav80x->deemph; | 335 | ucontrol->value.integer.value[0] = adav80x->deemph; |
| @@ -539,7 +539,7 @@ static int adav80x_set_sysclk(struct snd_soc_component *component, · 203 unmodified lines | |||
| 539 | unsigned int freq, int dir) | 539 | unsigned int freq, int dir) |
| 540 | { | 540 | { |
| 541 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); | 541 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); |
| 542 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 542 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 543 | 543 | ||
| 544 | if (dir == SND_SOC_CLOCK_IN) { | 544 | if (dir == SND_SOC_CLOCK_IN) { |
| 545 | switch (clk_id) { | 545 | switch (clk_id) { |
| @@ -622,7 +622,7 @@ static int adav80x_set_sysclk(struct snd_soc_component *component, · 76 unmodified lines | |||
| 622 | static int adav80x_set_pll(struct snd_soc_component *component, int pll_id, | 622 | static int adav80x_set_pll(struct snd_soc_component *component, int pll_id, |
| 623 | int source, unsigned int freq_in, unsigned int freq_out) | 623 | int source, unsigned int freq_in, unsigned int freq_out) |
| 624 | { | 624 | { |
| 625 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 625 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 626 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); | 626 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); |
| 627 | unsigned int pll_ctrl1 = 0; | 627 | unsigned int pll_ctrl1 = 0; |
| 628 | unsigned int pll_ctrl2 = 0; | 628 | unsigned int pll_ctrl2 = 0; |
| @@ -802,7 +802,7 @@ static struct snd_soc_dai_driver adav80x_dais[] = { · 173 unmodified lines | |||
| 802 | 802 | ||
| 803 | static int adav80x_probe(struct snd_soc_component *component) | 803 | static int adav80x_probe(struct snd_soc_component *component) |
| 804 | { | 804 | { |
| 805 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 805 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 806 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); | 806 | struct adav80x *adav80x = snd_soc_component_get_drvdata(component); |
| 807 | 807 | ||
| 808 | /* Force PLLs on for SYSCLK output */ | 808 | /* Force PLLs on for SYSCLK output */ |
| @@ -187,7 +187,7 @@ static const struct soc_enum ak4458_dif_enum = · 186 unmodified lines | |||
| 187 | static int get_digfil(struct snd_kcontrol *kcontrol, | 187 | static int get_digfil(struct snd_kcontrol *kcontrol, |
| 188 | struct snd_ctl_elem_value *ucontrol) | 188 | struct snd_ctl_elem_value *ucontrol) |
| 189 | { | 189 | { |
| 190 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 190 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 191 | struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); | 191 | struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); |
| 192 | 192 | ||
| 193 | ucontrol->value.enumerated.item[0] = ak4458->digfil; | 193 | ucontrol->value.enumerated.item[0] = ak4458->digfil; |
| @@ -198,7 +198,7 @@ static int get_digfil(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 198 | static int set_digfil(struct snd_kcontrol *kcontrol, | 198 | static int set_digfil(struct snd_kcontrol *kcontrol, |
| 199 | struct snd_ctl_elem_value *ucontrol) | 199 | struct snd_ctl_elem_value *ucontrol) |
| 200 | { | 200 | { |
| 201 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 201 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 202 | struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); | 202 | struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); |
| 203 | int num; | 203 | int num; |
| 204 | 204 | ||
| @@ -257,7 +257,7 @@ static void ak4619_set_deemph(struct snd_soc_component *component) · 256 unmodified lines | |||
| 257 | static int ak4619_put_deemph(struct snd_kcontrol *kcontrol, | 257 | static int ak4619_put_deemph(struct snd_kcontrol *kcontrol, |
| 258 | struct snd_ctl_elem_value *ucontrol) | 258 | struct snd_ctl_elem_value *ucontrol) |
| 259 | { | 259 | { |
| 260 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 260 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 261 | struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component); | 261 | struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component); |
| 262 | int deemph_en = ucontrol->value.integer.value[0]; | 262 | int deemph_en = ucontrol->value.integer.value[0]; |
| 263 | int ret = 0; | 263 | int ret = 0; |
| @@ -282,7 +282,7 @@ static int ak4619_put_deemph(struct snd_kcontrol *kcontrol, · 18 unmodified lines | |||
| 282 | static int ak4619_get_deemph(struct snd_kcontrol *kcontrol, | 282 | static int ak4619_get_deemph(struct snd_kcontrol *kcontrol, |
| 283 | struct snd_ctl_elem_value *ucontrol) | 283 | struct snd_ctl_elem_value *ucontrol) |
| 284 | { | 284 | { |
| 285 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 285 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 286 | struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component); | 286 | struct ak4619_priv *ak4619 = snd_soc_component_get_drvdata(component); |
| 287 | 287 | ||
| 288 | ucontrol->value.integer.value[0] = ak4619->deemph_en; | 288 | ucontrol->value.integer.value[0] = ak4619->deemph_en; |
| @@ -91,7 +91,7 @@ static int ak4641_set_deemph(struct snd_soc_component *component) · 90 unmodified lines | |||
| 91 | static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, | 91 | static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, |
| 92 | struct snd_ctl_elem_value *ucontrol) | 92 | struct snd_ctl_elem_value *ucontrol) |
| 93 | { | 93 | { |
| 94 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 94 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 95 | struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); | 95 | struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); |
| 96 | int deemph = ucontrol->value.integer.value[0]; | 96 | int deemph = ucontrol->value.integer.value[0]; |
| 97 | 97 | ||
| @@ -106,7 +106,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 106 | static int ak4641_get_deemph(struct snd_kcontrol *kcontrol, | 106 | static int ak4641_get_deemph(struct snd_kcontrol *kcontrol, |
| 107 | struct snd_ctl_elem_value *ucontrol) | 107 | struct snd_ctl_elem_value *ucontrol) |
| 108 | { | 108 | { |
| 109 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 109 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 110 | struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); | 110 | struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); |
| 111 | 111 | ||
| 112 | ucontrol->value.integer.value[0] = ak4641->deemph; | 112 | ucontrol->value.integer.value[0] = ak4641->deemph; |
| @@ -415,6 +415,7 @@ static int ak4641_mute(struct snd_soc_dai *dai, int mute, int direction) · 302 unmodified lines | |||
| 415 | static int ak4641_set_bias_level(struct snd_soc_component *component, | 415 | static int ak4641_set_bias_level(struct snd_soc_component *component, |
| 416 | enum snd_soc_bias_level level) | 416 | enum snd_soc_bias_level level) |
| 417 | { | 417 | { |
| 418 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 418 | struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); | 419 | struct ak4641_priv *ak4641 = snd_soc_component_get_drvdata(component); |
| 419 | struct ak4641_platform_data *pdata = component->dev->platform_data; | 420 | struct ak4641_platform_data *pdata = component->dev->platform_data; |
| 420 | int ret; | 421 | int ret; |
| @@ -429,7 +430,7 @@ static int ak4641_set_bias_level(struct snd_soc_component *component, · 8 unmodified lines | |||
| 429 | snd_soc_component_update_bits(component, AK4641_DAC, 0x20, 0x20); | 430 | snd_soc_component_update_bits(component, AK4641_DAC, 0x20, 0x20); |
| 430 | break; | 431 | break; |
| 431 | case SND_SOC_BIAS_STANDBY: | 432 | case SND_SOC_BIAS_STANDBY: |
| 432 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 433 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 433 | if (pdata && gpio_is_valid(pdata->gpio_power)) | 434 | if (pdata && gpio_is_valid(pdata->gpio_power)) |
| 434 | gpio_set_value(pdata->gpio_power, 1); | 435 | gpio_set_value(pdata->gpio_power, 1); |
| 435 | mdelay(1); | 436 | mdelay(1); |
| @@ -888,7 +888,7 @@ static int alc5623_resume(struct snd_soc_component *component) · 887 unmodified lines | |||
| 888 | static int alc5623_probe(struct snd_soc_component *component) | 888 | static int alc5623_probe(struct snd_soc_component *component) |
| 889 | { | 889 | { |
| 890 | struct alc5623_priv *alc5623 = snd_soc_component_get_drvdata(component); | 890 | struct alc5623_priv *alc5623 = snd_soc_component_get_drvdata(component); |
| 891 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 891 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 892 | 892 | ||
| 893 | alc5623_reset(component); | 893 | alc5623_reset(component); |
| 894 | 894 | ||
| @@ -212,17 +212,16 @@ static void arizona_extcon_pulse_micbias(struct arizona_priv *info) · 211 unmodified lines | |||
| 212 | struct arizona *arizona = info->arizona; | 212 | struct arizona *arizona = info->arizona; |
| 213 | const char *widget = arizona_extcon_get_micbias(info); | 213 | const char *widget = arizona_extcon_get_micbias(info); |
| 214 | struct snd_soc_dapm_context *dapm = arizona->dapm; | 214 | struct snd_soc_dapm_context *dapm = arizona->dapm; |
| 215 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); | ||
| 216 | int ret; | 215 | int ret; |
| 217 | 216 | ||
| 218 | ret = snd_soc_component_force_enable_pin(component, widget); | 217 | ret = snd_soc_dapm_force_enable_pin(dapm, widget); |
| 219 | if (ret) | 218 | if (ret) |
| 220 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", widget, ret); | 219 | dev_warn(arizona->dev, "Failed to enable %s: %d\n", widget, ret); |
| 221 | 220 | ||
| 222 | snd_soc_dapm_sync(dapm); | 221 | snd_soc_dapm_sync(dapm); |
| 223 | 222 | ||
| 224 | if (!arizona->pdata.micd_force_micbias) { | 223 | if (!arizona->pdata.micd_force_micbias) { |
| 225 | ret = snd_soc_component_disable_pin(component, widget); | 224 | ret = snd_soc_dapm_disable_pin(dapm, widget); |
| 226 | if (ret) | 225 | if (ret) |
| 227 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret); | 226 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret); |
| 228 | 227 | ||
| @@ -287,7 +286,6 @@ static void arizona_stop_mic(struct arizona_priv *info) · 58 unmodified lines | |||
| 287 | struct arizona *arizona = info->arizona; | 286 | struct arizona *arizona = info->arizona; |
| 288 | const char *widget = arizona_extcon_get_micbias(info); | 287 | const char *widget = arizona_extcon_get_micbias(info); |
| 289 | struct snd_soc_dapm_context *dapm = arizona->dapm; | 288 | struct snd_soc_dapm_context *dapm = arizona->dapm; |
| 290 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); | ||
| 291 | bool change = false; | 289 | bool change = false; |
| 292 | int ret; | 290 | int ret; |
| 293 | 291 | ||
| @@ -297,7 +295,7 @@ static void arizona_stop_mic(struct arizona_priv *info) · 3 unmodified lines | |||
| 297 | if (ret < 0) | 295 | if (ret < 0) |
| 298 | dev_err(arizona->dev, "Failed to disable micd: %d\n", ret); | 296 | dev_err(arizona->dev, "Failed to disable micd: %d\n", ret); |
| 299 | 297 | ||
| 300 | ret = snd_soc_component_disable_pin(component, widget); | 298 | ret = snd_soc_dapm_disable_pin(dapm, widget); |
| 301 | if (ret) | 299 | if (ret) |
| 302 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret); | 300 | dev_warn(arizona->dev, "Failed to disable %s: %d\n", widget, ret); |
| 303 | 301 | ||
| @@ -169,7 +169,7 @@ static const struct snd_soc_dapm_widget arizona_spkr = · 168 unmodified lines | |||
| 169 | 169 | ||
| 170 | int arizona_init_spk(struct snd_soc_component *component) | 170 | int arizona_init_spk(struct snd_soc_component *component) |
| 171 | { | 171 | { |
| 172 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 172 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 173 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); | 173 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); |
| 174 | struct arizona *arizona = priv->arizona; | 174 | struct arizona *arizona = priv->arizona; |
| 175 | int ret; | 175 | int ret; |
| @@ -238,7 +238,7 @@ static const struct snd_soc_dapm_route arizona_mono_routes[] = { · 62 unmodified lines | |||
| 238 | 238 | ||
| 239 | int arizona_init_mono(struct snd_soc_component *component) | 239 | int arizona_init_mono(struct snd_soc_component *component) |
| 240 | { | 240 | { |
| 241 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 241 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 242 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); | 242 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); |
| 243 | struct arizona *arizona = priv->arizona; | 243 | struct arizona *arizona = priv->arizona; |
| 244 | int i; | 244 | int i; |
| @@ -255,6 +255,7 @@ EXPORT_SYMBOL_GPL(arizona_init_mono); · 10 unmodified lines | |||
| 255 | 255 | ||
| 256 | int arizona_init_gpio(struct snd_soc_component *component) | 256 | int arizona_init_gpio(struct snd_soc_component *component) |
| 257 | { | 257 | { |
| 258 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 258 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); | 259 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); |
| 259 | struct arizona *arizona = priv->arizona; | 260 | struct arizona *arizona = priv->arizona; |
| 260 | int i; | 261 | int i; |
| @@ -262,24 +263,21 @@ int arizona_init_gpio(struct snd_soc_component *component) · 1 unmodified line | |||
| 262 | switch (arizona->type) { | 263 | switch (arizona->type) { |
| 263 | case WM5110: | 264 | case WM5110: |
| 264 | case WM8280: | 265 | case WM8280: |
| 265 | snd_soc_component_disable_pin(component, | 266 | snd_soc_dapm_disable_pin(dapm, "DRC2 Signal Activity"); |
| 266 | "DRC2 Signal Activity"); | ||
| 267 | break; | 267 | break; |
| 268 | default: | 268 | default: |
| 269 | break; | 269 | break; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | snd_soc_component_disable_pin(component, "DRC1 Signal Activity"); | 272 | snd_soc_dapm_disable_pin(dapm, "DRC1 Signal Activity"); |
| 273 | 273 | ||
| 274 | for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { | 274 | for (i = 0; i < ARRAY_SIZE(arizona->pdata.gpio_defaults); i++) { |
| 275 | switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) { | 275 | switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) { |
| 276 | case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT: | 276 | case ARIZONA_GP_FN_DRC1_SIGNAL_DETECT: |
| 277 | snd_soc_component_enable_pin(component, | 277 | snd_soc_dapm_enable_pin(dapm, "DRC1 Signal Activity"); |
| 278 | "DRC1 Signal Activity"); | ||
| 279 | break; | 278 | break; |
| 280 | case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT: | 279 | case ARIZONA_GP_FN_DRC2_SIGNAL_DETECT: |
| 281 | snd_soc_component_enable_pin(component, | 280 | snd_soc_dapm_enable_pin(dapm, "DRC2 Signal Activity"); |
| 282 | "DRC2 Signal Activity"); | ||
| 283 | break; | 281 | break; |
| 284 | default: | 282 | default: |
| 285 | break; | 283 | break; |
| @@ -1911,7 +1909,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, · 1625 unmodified lines | |||
| 1911 | int clk_id, unsigned int freq, int dir) | 1909 | int clk_id, unsigned int freq, int dir) |
| 1912 | { | 1910 | { |
| 1913 | struct snd_soc_component *component = dai->component; | 1911 | struct snd_soc_component *component = dai->component; |
| 1914 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1912 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1915 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); | 1913 | struct arizona_priv *priv = snd_soc_component_get_drvdata(component); |
| 1916 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; | 1914 | struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; |
| 1917 | struct snd_soc_dapm_route routes[2]; | 1915 | struct snd_soc_dapm_route routes[2]; |
| @@ -2724,7 +2722,7 @@ static bool arizona_eq_filter_unstable(bool mode, __be16 _a, __be16 _b) · 806 unmodified lines | |||
| 2724 | int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol, | 2722 | int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol, |
| 2725 | struct snd_ctl_elem_value *ucontrol) | 2723 | struct snd_ctl_elem_value *ucontrol) |
| 2726 | { | 2724 | { |
| 2727 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2725 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2728 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); | 2726 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); |
| 2729 | struct soc_bytes *params = (void *)kcontrol->private_value; | 2727 | struct soc_bytes *params = (void *)kcontrol->private_value; |
| 2730 | unsigned int val; | 2728 | unsigned int val; |
| @@ -2768,7 +2766,7 @@ EXPORT_SYMBOL_GPL(arizona_eq_coeff_put); · 37 unmodified lines | |||
| 2768 | int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, | 2766 | int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, |
| 2769 | struct snd_ctl_elem_value *ucontrol) | 2767 | struct snd_ctl_elem_value *ucontrol) |
| 2770 | { | 2768 | { |
| 2771 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2769 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2772 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); | 2770 | struct arizona *arizona = dev_get_drvdata(component->dev->parent); |
| 2773 | __be16 *data = (__be16 *)ucontrol->value.bytes.data; | 2771 | __be16 *data = (__be16 *)ucontrol->value.bytes.data; |
| 2774 | s16 val = be16_to_cpu(*data); | 2772 | s16 val = be16_to_cpu(*data); |
| @@ -131,7 +131,7 @@ static_assert(ARRAY_SIZE(routes) >= 2, "2 routes are needed"); · 130 unmodified lines | |||
| 131 | static int audio_iio_aux_add_dapms(struct snd_soc_component *component, | 131 | static int audio_iio_aux_add_dapms(struct snd_soc_component *component, |
| 132 | struct audio_iio_aux_chan *chan) | 132 | struct audio_iio_aux_chan *chan) |
| 133 | { | 133 | { |
| 134 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 134 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 135 | int ret; | 135 | int ret; |
| 136 | 136 | ||
| 137 | /* Allocated names are not needed afterwards (duplicated in ASoC internals) */ | 137 | /* Allocated names are not needed afterwards (duplicated in ASoC internals) */ |
| @@ -175,7 +175,7 @@ static int aw87390_dev_set_profile_index(struct aw_device *aw_dev, int index) · 174 unmodified lines | |||
| 175 | static int aw87390_profile_info(struct snd_kcontrol *kcontrol, | 175 | static int aw87390_profile_info(struct snd_kcontrol *kcontrol, |
| 176 | struct snd_ctl_elem_info *uinfo) | 176 | struct snd_ctl_elem_info *uinfo) |
| 177 | { | 177 | { |
| 178 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 178 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 179 | struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); | 179 | struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); |
| 180 | char *prof_name; | 180 | char *prof_name; |
| 181 | int count, ret; | 181 | int count, ret; |
| @@ -210,7 +210,7 @@ static int aw87390_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 210 | static int aw87390_profile_get(struct snd_kcontrol *kcontrol, | 210 | static int aw87390_profile_get(struct snd_kcontrol *kcontrol, |
| 211 | struct snd_ctl_elem_value *ucontrol) | 211 | struct snd_ctl_elem_value *ucontrol) |
| 212 | { | 212 | { |
| 213 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 213 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 214 | struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); | 214 | struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); |
| 215 | 215 | ||
| 216 | ucontrol->value.integer.value[0] = aw87390->aw_pa->prof_index; | 216 | ucontrol->value.integer.value[0] = aw87390->aw_pa->prof_index; |
| @@ -221,7 +221,7 @@ static int aw87390_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 221 | static int aw87390_profile_set(struct snd_kcontrol *kcontrol, | 221 | static int aw87390_profile_set(struct snd_kcontrol *kcontrol, |
| 222 | struct snd_ctl_elem_value *ucontrol) | 222 | struct snd_ctl_elem_value *ucontrol) |
| 223 | { | 223 | { |
| 224 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 224 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 225 | struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); | 225 | struct aw87390 *aw87390 = snd_soc_component_get_drvdata(codec); |
| 226 | int ret; | 226 | int ret; |
| 227 | 227 | ||
| @@ -360,7 +360,7 @@ static void aw87390_parse_channel_dt(struct aw87390 *aw87390) · 132 unmodified lines | |||
| 360 | aw_dev->channel = channel_value; | 360 | aw_dev->channel = channel_value; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | static int aw87390_init(struct aw87390 **aw87390, struct i2c_client *i2c, struct regmap *regmap) | 363 | static int aw87390_init(struct aw87390 *aw87390, struct i2c_client *i2c, struct regmap *regmap) |
| 364 | { | 364 | { |
| 365 | struct aw_device *aw_dev; | 365 | struct aw_device *aw_dev; |
| 366 | unsigned int chip_id; | 366 | unsigned int chip_id; |
| @@ -384,7 +384,7 @@ static int aw87390_init(struct aw87390 **aw87390, struct i2c_client *i2c, struct · 17 unmodified lines | |||
| 384 | if (!aw_dev) | 384 | if (!aw_dev) |
| 385 | return -ENOMEM; | 385 | return -ENOMEM; |
| 386 | 386 | ||
| 387 | (*aw87390)->aw_pa = aw_dev; | 387 | aw87390->aw_pa = aw_dev; |
| 388 | aw_dev->i2c = i2c; | 388 | aw_dev->i2c = i2c; |
| 389 | aw_dev->regmap = regmap; | 389 | aw_dev->regmap = regmap; |
| 390 | aw_dev->dev = &i2c->dev; | 390 | aw_dev->dev = &i2c->dev; |
| @@ -398,7 +398,7 @@ static int aw87390_init(struct aw87390 **aw87390, struct i2c_client *i2c, struct · 7 unmodified lines | |||
| 398 | aw_dev->prof_index = AW87390_INIT_PROFILE; | 398 | aw_dev->prof_index = AW87390_INIT_PROFILE; |
| 399 | aw_dev->status = AW87390_DEV_PW_OFF; | 399 | aw_dev->status = AW87390_DEV_PW_OFF; |
| 400 | 400 | ||
| 401 | aw87390_parse_channel_dt(*aw87390); | 401 | aw87390_parse_channel_dt(aw87390); |
| 402 | 402 | ||
| 403 | return 0; | 403 | return 0; |
| 404 | } | 404 | } |
| @@ -426,7 +426,7 @@ static int aw87390_i2c_probe(struct i2c_client *i2c) · 21 unmodified lines | |||
| 426 | "failed to init regmap\n"); | 426 | "failed to init regmap\n"); |
| 427 | 427 | ||
| 428 | /* aw pa init */ | 428 | /* aw pa init */ |
| 429 | ret = aw87390_init(&aw87390, i2c, aw87390->regmap); | 429 | ret = aw87390_init(aw87390, i2c, aw87390->regmap); |
| 430 | if (ret) | 430 | if (ret) |
| 431 | return ret; | 431 | return ret; |
| 432 | 432 | ||
| @@ -779,7 +779,7 @@ static void aw88081_start(struct aw88081 *aw88081, bool sync_start) · 778 unmodified lines | |||
| 779 | if (sync_start == AW88081_SYNC_START) | 779 | if (sync_start == AW88081_SYNC_START) |
| 780 | aw88081_start_pa(aw88081); | 780 | aw88081_start_pa(aw88081); |
| 781 | else | 781 | else |
| 782 | queue_delayed_work(system_wq, | 782 | queue_delayed_work(system_dfl_wq, |
| 783 | &aw88081->start_work, | 783 | &aw88081->start_work, |
| 784 | AW88081_START_WORK_DELAY_MS); | 784 | AW88081_START_WORK_DELAY_MS); |
| 785 | } | 785 | } |
| @@ -808,7 +808,7 @@ static struct snd_soc_dai_driver aw88081_dai[] = { · 22 unmodified lines | |||
| 808 | static int aw88081_get_fade_in_time(struct snd_kcontrol *kcontrol, | 808 | static int aw88081_get_fade_in_time(struct snd_kcontrol *kcontrol, |
| 809 | struct snd_ctl_elem_value *ucontrol) | 809 | struct snd_ctl_elem_value *ucontrol) |
| 810 | { | 810 | { |
| 811 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 811 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 812 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); | 812 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); |
| 813 | struct aw_device *aw_dev = aw88081->aw_pa; | 813 | struct aw_device *aw_dev = aw88081->aw_pa; |
| 814 | 814 | ||
| @@ -820,7 +820,7 @@ static int aw88081_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 820 | static int aw88081_set_fade_in_time(struct snd_kcontrol *kcontrol, | 820 | static int aw88081_set_fade_in_time(struct snd_kcontrol *kcontrol, |
| 821 | struct snd_ctl_elem_value *ucontrol) | 821 | struct snd_ctl_elem_value *ucontrol) |
| 822 | { | 822 | { |
| 823 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 823 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 824 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); | 824 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); |
| 825 | struct soc_mixer_control *mc = | 825 | struct soc_mixer_control *mc = |
| 826 | (struct soc_mixer_control *)kcontrol->private_value; | 826 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -843,7 +843,7 @@ static int aw88081_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 843 | static int aw88081_get_fade_out_time(struct snd_kcontrol *kcontrol, | 843 | static int aw88081_get_fade_out_time(struct snd_kcontrol *kcontrol, |
| 844 | struct snd_ctl_elem_value *ucontrol) | 844 | struct snd_ctl_elem_value *ucontrol) |
| 845 | { | 845 | { |
| 846 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 846 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 847 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); | 847 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); |
| 848 | struct aw_device *aw_dev = aw88081->aw_pa; | 848 | struct aw_device *aw_dev = aw88081->aw_pa; |
| 849 | 849 | ||
| @@ -855,7 +855,7 @@ static int aw88081_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 855 | static int aw88081_set_fade_out_time(struct snd_kcontrol *kcontrol, | 855 | static int aw88081_set_fade_out_time(struct snd_kcontrol *kcontrol, |
| 856 | struct snd_ctl_elem_value *ucontrol) | 856 | struct snd_ctl_elem_value *ucontrol) |
| 857 | { | 857 | { |
| 858 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 858 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 859 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); | 859 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(component); |
| 860 | struct soc_mixer_control *mc = | 860 | struct soc_mixer_control *mc = |
| 861 | (struct soc_mixer_control *)kcontrol->private_value; | 861 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -891,7 +891,7 @@ static int aw88081_dev_set_profile_index(struct aw_device *aw_dev, int index) · 29 unmodified lines | |||
| 891 | static int aw88081_profile_info(struct snd_kcontrol *kcontrol, | 891 | static int aw88081_profile_info(struct snd_kcontrol *kcontrol, |
| 892 | struct snd_ctl_elem_info *uinfo) | 892 | struct snd_ctl_elem_info *uinfo) |
| 893 | { | 893 | { |
| 894 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 894 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 895 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 895 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 896 | char *prof_name; | 896 | char *prof_name; |
| 897 | int count, ret; | 897 | int count, ret; |
| @@ -926,7 +926,7 @@ static int aw88081_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 926 | static int aw88081_profile_get(struct snd_kcontrol *kcontrol, | 926 | static int aw88081_profile_get(struct snd_kcontrol *kcontrol, |
| 927 | struct snd_ctl_elem_value *ucontrol) | 927 | struct snd_ctl_elem_value *ucontrol) |
| 928 | { | 928 | { |
| 929 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 929 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 930 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 930 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 931 | 931 | ||
| 932 | ucontrol->value.integer.value[0] = aw88081->aw_pa->prof_index; | 932 | ucontrol->value.integer.value[0] = aw88081->aw_pa->prof_index; |
| @@ -937,7 +937,7 @@ static int aw88081_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 937 | static int aw88081_profile_set(struct snd_kcontrol *kcontrol, | 937 | static int aw88081_profile_set(struct snd_kcontrol *kcontrol, |
| 938 | struct snd_ctl_elem_value *ucontrol) | 938 | struct snd_ctl_elem_value *ucontrol) |
| 939 | { | 939 | { |
| 940 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 940 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 941 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 941 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 942 | int ret; | 942 | int ret; |
| 943 | 943 | ||
| @@ -963,7 +963,7 @@ static int aw88081_profile_set(struct snd_kcontrol *kcontrol, · 19 unmodified lines | |||
| 963 | static int aw88081_volume_get(struct snd_kcontrol *kcontrol, | 963 | static int aw88081_volume_get(struct snd_kcontrol *kcontrol, |
| 964 | struct snd_ctl_elem_value *ucontrol) | 964 | struct snd_ctl_elem_value *ucontrol) |
| 965 | { | 965 | { |
| 966 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 966 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 967 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 967 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 968 | struct aw_volume_desc *vol_desc = &aw88081->aw_pa->volume_desc; | 968 | struct aw_volume_desc *vol_desc = &aw88081->aw_pa->volume_desc; |
| 969 | 969 | ||
| @@ -975,7 +975,7 @@ static int aw88081_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 975 | static int aw88081_volume_set(struct snd_kcontrol *kcontrol, | 975 | static int aw88081_volume_set(struct snd_kcontrol *kcontrol, |
| 976 | struct snd_ctl_elem_value *ucontrol) | 976 | struct snd_ctl_elem_value *ucontrol) |
| 977 | { | 977 | { |
| 978 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 978 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 979 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 979 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 980 | struct aw_volume_desc *vol_desc = &aw88081->aw_pa->volume_desc; | 980 | struct aw_volume_desc *vol_desc = &aw88081->aw_pa->volume_desc; |
| 981 | struct soc_mixer_control *mc = | 981 | struct soc_mixer_control *mc = |
| @@ -1003,7 +1003,7 @@ static int aw88081_volume_set(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 1003 | static int aw88081_get_fade_step(struct snd_kcontrol *kcontrol, | 1003 | static int aw88081_get_fade_step(struct snd_kcontrol *kcontrol, |
| 1004 | struct snd_ctl_elem_value *ucontrol) | 1004 | struct snd_ctl_elem_value *ucontrol) |
| 1005 | { | 1005 | { |
| 1006 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1006 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1007 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 1007 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 1008 | 1008 | ||
| 1009 | ucontrol->value.integer.value[0] = aw88081->aw_pa->fade_step; | 1009 | ucontrol->value.integer.value[0] = aw88081->aw_pa->fade_step; |
| @@ -1014,7 +1014,7 @@ static int aw88081_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1014 | static int aw88081_set_fade_step(struct snd_kcontrol *kcontrol, | 1014 | static int aw88081_set_fade_step(struct snd_kcontrol *kcontrol, |
| 1015 | struct snd_ctl_elem_value *ucontrol) | 1015 | struct snd_ctl_elem_value *ucontrol) |
| 1016 | { | 1016 | { |
| 1017 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1017 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1018 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); | 1018 | struct aw88081 *aw88081 = snd_soc_component_get_drvdata(codec); |
| 1019 | struct soc_mixer_control *mc = | 1019 | struct soc_mixer_control *mc = |
| 1020 | (struct soc_mixer_control *)kcontrol->private_value; | 1020 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -41,109 +41,6 @@ static const struct regmap_config aw88166_remap_config = { · 40 unmodified lines | |||
| 41 | .val_format_endian = REGMAP_ENDIAN_BIG, | 41 | .val_format_endian = REGMAP_ENDIAN_BIG, |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | static int aw_dev_dsp_write_16bit(struct aw_device *aw_dev, | ||
| 45 | unsigned short dsp_addr, unsigned int dsp_data) | ||
| 46 | { | ||
| 47 | int ret; | ||
| 48 | |||
| 49 | ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr); | ||
| 50 | if (ret) { | ||
| 51 | dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret); | ||
| 52 | return ret; | ||
| 53 | } | ||
| 54 | |||
| 55 | ret = regmap_write(aw_dev->regmap, AW88166_DSPMDAT_REG, (u16)dsp_data); | ||
| 56 | if (ret) { | ||
| 57 | dev_err(aw_dev->dev, "%s write data error, ret=%d", __func__, ret); | ||
| 58 | return ret; | ||
| 59 | } | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
| 64 | static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev, | ||
| 65 | unsigned short dsp_addr, unsigned int *dsp_data) | ||
| 66 | { | ||
| 67 | unsigned int temp_data; | ||
| 68 | int ret; | ||
| 69 | |||
| 70 | ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr); | ||
| 71 | if (ret) { | ||
| 72 | dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret); | ||
| 73 | return ret; | ||
| 74 | } | ||
| 75 | |||
| 76 | ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data); | ||
| 77 | if (ret) { | ||
| 78 | dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); | ||
| 79 | return ret; | ||
| 80 | } | ||
| 81 | *dsp_data = temp_data; | ||
| 82 | |||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | |||
| 86 | static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev, | ||
| 87 | unsigned short dsp_addr, unsigned int *dsp_data) | ||
| 88 | { | ||
| 89 | unsigned int temp_data; | ||
| 90 | int ret; | ||
| 91 | |||
| 92 | ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, dsp_addr); | ||
| 93 | if (ret) { | ||
| 94 | dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret); | ||
| 95 | return ret; | ||
| 96 | } | ||
| 97 | |||
| 98 | ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data); | ||
| 99 | if (ret) { | ||
| 100 | dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); | ||
| 101 | return ret; | ||
| 102 | } | ||
| 103 | *dsp_data = temp_data; | ||
| 104 | |||
| 105 | ret = regmap_read(aw_dev->regmap, AW88166_DSPMDAT_REG, &temp_data); | ||
| 106 | if (ret) { | ||
| 107 | dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); | ||
| 108 | return ret; | ||
| 109 | } | ||
| 110 | *dsp_data |= (temp_data << 16); | ||
| 111 | |||
| 112 | return 0; | ||
| 113 | } | ||
| 114 | |||
| 115 | static int aw_dev_dsp_read(struct aw_device *aw_dev, | ||
| 116 | unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type) | ||
| 117 | { | ||
| 118 | u32 reg_value; | ||
| 119 | int ret; | ||
| 120 | |||
| 121 | mutex_lock(&aw_dev->dsp_lock); | ||
| 122 | switch (data_type) { | ||
| 123 | case AW88166_DSP_16_DATA: | ||
| 124 | ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data); | ||
| 125 | if (ret) | ||
| 126 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit failed", (u32)dsp_addr); | ||
| 127 | break; | ||
| 128 | case AW88166_DSP_32_DATA: | ||
| 129 | ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data); | ||
| 130 | if (ret) | ||
| 131 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32-bit failed", (u32)dsp_addr); | ||
| 132 | break; | ||
| 133 | default: | ||
| 134 | dev_err(aw_dev->dev, "data type[%d] unsupported", data_type); | ||
| 135 | ret = -EINVAL; | ||
| 136 | break; | ||
| 137 | } | ||
| 138 | |||
| 139 | /* clear dsp chip select state */ | ||
| 140 | if (regmap_read(aw_dev->regmap, AW88166_ID_REG, ®_value)) | ||
| 141 | dev_err(aw_dev->dev, "%s fail to clear chip state. ret=%d\n", __func__, ret); | ||
| 142 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 143 | |||
| 144 | return ret; | ||
| 145 | } | ||
| 146 | |||
| 147 | static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd) | 44 | static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd) |
| 148 | { | 45 | { |
| 149 | int ret; | 46 | int ret; |
| @@ -904,25 +801,19 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev, · 754 unmodified lines | |||
| 904 | u32 tmp_len; | 801 | u32 tmp_len; |
| 905 | int i, ret; | 802 | int i, ret; |
| 906 | 803 | ||
| 907 | mutex_lock(&aw_dev->dsp_lock); | ||
| 908 | ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, base); | 804 | ret = regmap_write(aw_dev->regmap, AW88166_DSPMADD_REG, base); |
| 909 | if (ret) | 805 | if (ret) |
| 910 | goto error_operation; | 806 | return ret; |
| 911 | 807 | ||
| 912 | for (i = 0; i < len; i += AW88166_MAX_RAM_WRITE_BYTE_SIZE) { | 808 | for (i = 0; i < len; i += AW88166_MAX_RAM_WRITE_BYTE_SIZE) { |
| 913 | tmp_len = min(len - i, AW88166_MAX_RAM_WRITE_BYTE_SIZE); | 809 | tmp_len = min(len - i, AW88166_MAX_RAM_WRITE_BYTE_SIZE); |
| 914 | ret = regmap_raw_write(aw_dev->regmap, AW88166_DSPMDAT_REG, | 810 | ret = regmap_raw_write(aw_dev->regmap, AW88166_DSPMDAT_REG, |
| 915 | &data[i], tmp_len); | 811 | &data[i], tmp_len); |
| 916 | if (ret) | 812 | if (ret) |
| 917 | goto error_operation; | 813 | return ret; |
| 918 | } | 814 | } |
| 919 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 920 | 815 | ||
| 921 | return 0; | 816 | return 0; |
| 922 | |||
| 923 | error_operation: | ||
| 924 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 925 | return ret; | ||
| 926 | } | 817 | } |
| 927 | 818 | ||
| 928 | static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) | 819 | static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) |
| @@ -933,7 +824,7 @@ static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) · 4 unmodified lines | |||
| 933 | int ret; | 824 | int ret; |
| 934 | 825 | ||
| 935 | ret = aw_dev_dsp_read(aw_dev, AW88166_DSP_REG_CFG_ADPZ_RA, | 826 | ret = aw_dev_dsp_read(aw_dev, AW88166_DSP_REG_CFG_ADPZ_RA, |
| 936 | &dsp_ra, AW88166_DSP_32_DATA); | 827 | &dsp_ra, AW_DSP_32_DATA); |
| 937 | if (ret) { | 828 | if (ret) { |
| 938 | dev_err(aw_dev->dev, "read ra error\n"); | 829 | dev_err(aw_dev->dev, "read ra error\n"); |
| 939 | return ret; | 830 | return ret; |
| @@ -990,29 +881,25 @@ static int aw_dev_check_sram(struct aw_device *aw_dev) · 50 unmodified lines | |||
| 990 | { | 881 | { |
| 991 | unsigned int reg_val; | 882 | unsigned int reg_val; |
| 992 | 883 | ||
| 993 | mutex_lock(&aw_dev->dsp_lock); | ||
| 994 | /* read dsp_rom_check_reg */ | 884 | /* read dsp_rom_check_reg */ |
| 995 | aw_dev_dsp_read_16bit(aw_dev, AW88166_DSP_ROM_CHECK_ADDR, ®_val); | 885 | aw_dev_dsp_read(aw_dev, AW88166_DSP_ROM_CHECK_ADDR, ®_val, AW_DSP_16_DATA); |
| 996 | if (reg_val != AW88166_DSP_ROM_CHECK_DATA) { | 886 | if (reg_val != AW88166_DSP_ROM_CHECK_DATA) { |
| 997 | dev_err(aw_dev->dev, "check dsp rom failed, read[0x%x] != check[0x%x]\n", | 887 | dev_err(aw_dev->dev, "check dsp rom failed, read[0x%x] != check[0x%x]\n", |
| 998 | reg_val, AW88166_DSP_ROM_CHECK_DATA); | 888 | reg_val, AW88166_DSP_ROM_CHECK_DATA); |
| 999 | goto error; | 889 | return -EPERM; |
| 1000 | } | 890 | } |
| 1001 | 891 | ||
| 1002 | /* check dsp_cfg_base_addr */ | 892 | /* check dsp_cfg_base_addr */ |
| 1003 | aw_dev_dsp_write_16bit(aw_dev, AW88166_DSP_CFG_ADDR, AW88166_DSP_ODD_NUM_BIT_TEST); | 893 | aw_dev_dsp_write(aw_dev, AW88166_DSP_CFG_ADDR, |
| 1004 | aw_dev_dsp_read_16bit(aw_dev, AW88166_DSP_CFG_ADDR, ®_val); | 894 | AW88166_DSP_ODD_NUM_BIT_TEST, AW_DSP_16_DATA); |
| 895 | aw_dev_dsp_read(aw_dev, AW88166_DSP_CFG_ADDR, ®_val, AW_DSP_16_DATA); | ||
| 1005 | if (reg_val != AW88166_DSP_ODD_NUM_BIT_TEST) { | 896 | if (reg_val != AW88166_DSP_ODD_NUM_BIT_TEST) { |
| 1006 | dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]\n", | 897 | dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]\n", |
| 1007 | reg_val, AW88166_DSP_ODD_NUM_BIT_TEST); | 898 | reg_val, AW88166_DSP_ODD_NUM_BIT_TEST); |
| 1008 | goto error; | 899 | return -EPERM; |
| 1009 | } | 900 | } |
| 1010 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 1011 | 901 | ||
| 1012 | return 0; | 902 | return 0; |
| 1013 | error: | ||
| 1014 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 1015 | return -EPERM; | ||
| 1016 | } | 903 | } |
| 1017 | 904 | ||
| 1018 | static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag) | 905 | static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag) |
| @@ -1310,7 +1197,7 @@ static void aw88166_start(struct aw88166 *aw88166, bool sync_start) · 291 unmodified lines | |||
| 1310 | if (sync_start == AW88166_SYNC_START) | 1197 | if (sync_start == AW88166_SYNC_START) |
| 1311 | aw88166_start_pa(aw88166); | 1198 | aw88166_start_pa(aw88166); |
| 1312 | else | 1199 | else |
| 1313 | queue_delayed_work(system_wq, | 1200 | queue_delayed_work(system_dfl_wq, |
| 1314 | &aw88166->start_work, | 1201 | &aw88166->start_work, |
| 1315 | AW88166_START_WORK_DELAY_MS); | 1202 | AW88166_START_WORK_DELAY_MS); |
| 1316 | } | 1203 | } |
| @@ -1391,7 +1278,7 @@ static struct snd_soc_dai_driver aw88166_dai[] = { · 74 unmodified lines | |||
| 1391 | static int aw88166_get_fade_in_time(struct snd_kcontrol *kcontrol, | 1278 | static int aw88166_get_fade_in_time(struct snd_kcontrol *kcontrol, |
| 1392 | struct snd_ctl_elem_value *ucontrol) | 1279 | struct snd_ctl_elem_value *ucontrol) |
| 1393 | { | 1280 | { |
| 1394 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1281 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1395 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); | 1282 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); |
| 1396 | struct aw_device *aw_dev = aw88166->aw_pa; | 1283 | struct aw_device *aw_dev = aw88166->aw_pa; |
| 1397 | 1284 | ||
| @@ -1403,7 +1290,7 @@ static int aw88166_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1403 | static int aw88166_set_fade_in_time(struct snd_kcontrol *kcontrol, | 1290 | static int aw88166_set_fade_in_time(struct snd_kcontrol *kcontrol, |
| 1404 | struct snd_ctl_elem_value *ucontrol) | 1291 | struct snd_ctl_elem_value *ucontrol) |
| 1405 | { | 1292 | { |
| 1406 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1293 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1407 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); | 1294 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); |
| 1408 | struct soc_mixer_control *mc = | 1295 | struct soc_mixer_control *mc = |
| 1409 | (struct soc_mixer_control *)kcontrol->private_value; | 1296 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1426,7 +1313,7 @@ static int aw88166_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 1426 | static int aw88166_get_fade_out_time(struct snd_kcontrol *kcontrol, | 1313 | static int aw88166_get_fade_out_time(struct snd_kcontrol *kcontrol, |
| 1427 | struct snd_ctl_elem_value *ucontrol) | 1314 | struct snd_ctl_elem_value *ucontrol) |
| 1428 | { | 1315 | { |
| 1429 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1316 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1430 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); | 1317 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); |
| 1431 | struct aw_device *aw_dev = aw88166->aw_pa; | 1318 | struct aw_device *aw_dev = aw88166->aw_pa; |
| 1432 | 1319 | ||
| @@ -1438,7 +1325,7 @@ static int aw88166_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1438 | static int aw88166_set_fade_out_time(struct snd_kcontrol *kcontrol, | 1325 | static int aw88166_set_fade_out_time(struct snd_kcontrol *kcontrol, |
| 1439 | struct snd_ctl_elem_value *ucontrol) | 1326 | struct snd_ctl_elem_value *ucontrol) |
| 1440 | { | 1327 | { |
| 1441 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1328 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1442 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); | 1329 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(component); |
| 1443 | struct soc_mixer_control *mc = | 1330 | struct soc_mixer_control *mc = |
| 1444 | (struct soc_mixer_control *)kcontrol->private_value; | 1331 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1476,7 +1363,7 @@ static int aw88166_dev_set_profile_index(struct aw_device *aw_dev, int index) · 31 unmodified lines | |||
| 1476 | static int aw88166_profile_info(struct snd_kcontrol *kcontrol, | 1363 | static int aw88166_profile_info(struct snd_kcontrol *kcontrol, |
| 1477 | struct snd_ctl_elem_info *uinfo) | 1364 | struct snd_ctl_elem_info *uinfo) |
| 1478 | { | 1365 | { |
| 1479 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1366 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1480 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1367 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1481 | char *prof_name; | 1368 | char *prof_name; |
| 1482 | int count, ret; | 1369 | int count, ret; |
| @@ -1511,7 +1398,7 @@ static int aw88166_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 1511 | static int aw88166_profile_get(struct snd_kcontrol *kcontrol, | 1398 | static int aw88166_profile_get(struct snd_kcontrol *kcontrol, |
| 1512 | struct snd_ctl_elem_value *ucontrol) | 1399 | struct snd_ctl_elem_value *ucontrol) |
| 1513 | { | 1400 | { |
| 1514 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1401 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1515 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1402 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1516 | 1403 | ||
| 1517 | ucontrol->value.integer.value[0] = aw88166->aw_pa->prof_index; | 1404 | ucontrol->value.integer.value[0] = aw88166->aw_pa->prof_index; |
| @@ -1522,7 +1409,7 @@ static int aw88166_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1522 | static int aw88166_profile_set(struct snd_kcontrol *kcontrol, | 1409 | static int aw88166_profile_set(struct snd_kcontrol *kcontrol, |
| 1523 | struct snd_ctl_elem_value *ucontrol) | 1410 | struct snd_ctl_elem_value *ucontrol) |
| 1524 | { | 1411 | { |
| 1525 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1412 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1526 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1413 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1527 | int ret; | 1414 | int ret; |
| 1528 | 1415 | ||
| @@ -1547,7 +1434,7 @@ static int aw88166_profile_set(struct snd_kcontrol *kcontrol, · 18 unmodified lines | |||
| 1547 | static int aw88166_volume_get(struct snd_kcontrol *kcontrol, | 1434 | static int aw88166_volume_get(struct snd_kcontrol *kcontrol, |
| 1548 | struct snd_ctl_elem_value *ucontrol) | 1435 | struct snd_ctl_elem_value *ucontrol) |
| 1549 | { | 1436 | { |
| 1550 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1437 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1551 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1438 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1552 | struct aw_volume_desc *vol_desc = &aw88166->aw_pa->volume_desc; | 1439 | struct aw_volume_desc *vol_desc = &aw88166->aw_pa->volume_desc; |
| 1553 | 1440 | ||
| @@ -1559,7 +1446,7 @@ static int aw88166_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1559 | static int aw88166_volume_set(struct snd_kcontrol *kcontrol, | 1446 | static int aw88166_volume_set(struct snd_kcontrol *kcontrol, |
| 1560 | struct snd_ctl_elem_value *ucontrol) | 1447 | struct snd_ctl_elem_value *ucontrol) |
| 1561 | { | 1448 | { |
| 1562 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1449 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1563 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1450 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1564 | struct aw_volume_desc *vol_desc = &aw88166->aw_pa->volume_desc; | 1451 | struct aw_volume_desc *vol_desc = &aw88166->aw_pa->volume_desc; |
| 1565 | struct soc_mixer_control *mc = | 1452 | struct soc_mixer_control *mc = |
| @@ -1583,7 +1470,7 @@ static int aw88166_volume_set(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 1583 | static int aw88166_get_fade_step(struct snd_kcontrol *kcontrol, | 1470 | static int aw88166_get_fade_step(struct snd_kcontrol *kcontrol, |
| 1584 | struct snd_ctl_elem_value *ucontrol) | 1471 | struct snd_ctl_elem_value *ucontrol) |
| 1585 | { | 1472 | { |
| 1586 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1473 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1587 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1474 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1588 | 1475 | ||
| 1589 | ucontrol->value.integer.value[0] = aw88166->aw_pa->fade_step; | 1476 | ucontrol->value.integer.value[0] = aw88166->aw_pa->fade_step; |
| @@ -1594,7 +1481,7 @@ static int aw88166_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1594 | static int aw88166_set_fade_step(struct snd_kcontrol *kcontrol, | 1481 | static int aw88166_set_fade_step(struct snd_kcontrol *kcontrol, |
| 1595 | struct snd_ctl_elem_value *ucontrol) | 1482 | struct snd_ctl_elem_value *ucontrol) |
| 1596 | { | 1483 | { |
| 1597 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1484 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1598 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1485 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1599 | struct soc_mixer_control *mc = | 1486 | struct soc_mixer_control *mc = |
| 1600 | (struct soc_mixer_control *)kcontrol->private_value; | 1487 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1615,7 +1502,7 @@ static int aw88166_set_fade_step(struct snd_kcontrol *kcontrol, · 14 unmodified lines | |||
| 1615 | static int aw88166_re_get(struct snd_kcontrol *kcontrol, | 1502 | static int aw88166_re_get(struct snd_kcontrol *kcontrol, |
| 1616 | struct snd_ctl_elem_value *ucontrol) | 1503 | struct snd_ctl_elem_value *ucontrol) |
| 1617 | { | 1504 | { |
| 1618 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1505 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1619 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1506 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1620 | struct aw_device *aw_dev = aw88166->aw_pa; | 1507 | struct aw_device *aw_dev = aw88166->aw_pa; |
| 1621 | 1508 | ||
| @@ -1627,7 +1514,7 @@ static int aw88166_re_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1627 | static int aw88166_re_set(struct snd_kcontrol *kcontrol, | 1514 | static int aw88166_re_set(struct snd_kcontrol *kcontrol, |
| 1628 | struct snd_ctl_elem_value *ucontrol) | 1515 | struct snd_ctl_elem_value *ucontrol) |
| 1629 | { | 1516 | { |
| 1630 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1517 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1631 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); | 1518 | struct aw88166 *aw88166 = snd_soc_component_get_drvdata(codec); |
| 1632 | struct soc_mixer_control *mc = | 1519 | struct soc_mixer_control *mc = |
| 1633 | (struct soc_mixer_control *)kcontrol->private_value; | 1520 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -516,11 +516,6 @@ enum AW88166_DEV_DSP_CFG { · 515 unmodified lines | |||
| 516 | AW88166_DEV_DSP_BYPASS = 1, | 516 | AW88166_DEV_DSP_BYPASS = 1, |
| 517 | }; | 517 | }; |
| 518 | 518 | ||
| 519 | enum { | ||
| 520 | AW88166_DSP_16_DATA = 0, | ||
| 521 | AW88166_DSP_32_DATA = 1, | ||
| 522 | }; | ||
| 523 | |||
| 524 | enum { | 519 | enum { |
| 525 | AW88166_SYNC_START = 0, | 520 | AW88166_SYNC_START = 0, |
| 526 | AW88166_ASYNC_START, | 521 | AW88166_ASYNC_START, |
| @@ -705,7 +705,7 @@ static void aw88261_start(struct aw88261 *aw88261, bool sync_start) · 704 unmodified lines | |||
| 705 | if (sync_start == AW88261_SYNC_START) | 705 | if (sync_start == AW88261_SYNC_START) |
| 706 | aw88261_start_pa(aw88261); | 706 | aw88261_start_pa(aw88261); |
| 707 | else | 707 | else |
| 708 | queue_delayed_work(system_wq, | 708 | queue_delayed_work(system_dfl_wq, |
| 709 | &aw88261->start_work, | 709 | &aw88261->start_work, |
| 710 | AW88261_START_WORK_DELAY_MS); | 710 | AW88261_START_WORK_DELAY_MS); |
| 711 | } | 711 | } |
| @@ -734,7 +734,7 @@ static struct snd_soc_dai_driver aw88261_dai[] = { · 22 unmodified lines | |||
| 734 | static int aw88261_get_fade_in_time(struct snd_kcontrol *kcontrol, | 734 | static int aw88261_get_fade_in_time(struct snd_kcontrol *kcontrol, |
| 735 | struct snd_ctl_elem_value *ucontrol) | 735 | struct snd_ctl_elem_value *ucontrol) |
| 736 | { | 736 | { |
| 737 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 737 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 738 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); | 738 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); |
| 739 | struct aw_device *aw_dev = aw88261->aw_pa; | 739 | struct aw_device *aw_dev = aw88261->aw_pa; |
| 740 | 740 | ||
| @@ -746,7 +746,7 @@ static int aw88261_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 746 | static int aw88261_set_fade_in_time(struct snd_kcontrol *kcontrol, | 746 | static int aw88261_set_fade_in_time(struct snd_kcontrol *kcontrol, |
| 747 | struct snd_ctl_elem_value *ucontrol) | 747 | struct snd_ctl_elem_value *ucontrol) |
| 748 | { | 748 | { |
| 749 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 749 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 750 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); | 750 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); |
| 751 | struct soc_mixer_control *mc = | 751 | struct soc_mixer_control *mc = |
| 752 | (struct soc_mixer_control *)kcontrol->private_value; | 752 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -769,7 +769,7 @@ static int aw88261_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 769 | static int aw88261_get_fade_out_time(struct snd_kcontrol *kcontrol, | 769 | static int aw88261_get_fade_out_time(struct snd_kcontrol *kcontrol, |
| 770 | struct snd_ctl_elem_value *ucontrol) | 770 | struct snd_ctl_elem_value *ucontrol) |
| 771 | { | 771 | { |
| 772 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 772 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 773 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); | 773 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); |
| 774 | struct aw_device *aw_dev = aw88261->aw_pa; | 774 | struct aw_device *aw_dev = aw88261->aw_pa; |
| 775 | 775 | ||
| @@ -781,7 +781,7 @@ static int aw88261_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 781 | static int aw88261_set_fade_out_time(struct snd_kcontrol *kcontrol, | 781 | static int aw88261_set_fade_out_time(struct snd_kcontrol *kcontrol, |
| 782 | struct snd_ctl_elem_value *ucontrol) | 782 | struct snd_ctl_elem_value *ucontrol) |
| 783 | { | 783 | { |
| 784 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 784 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 785 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); | 785 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); |
| 786 | struct soc_mixer_control *mc = | 786 | struct soc_mixer_control *mc = |
| 787 | (struct soc_mixer_control *)kcontrol->private_value; | 787 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -817,7 +817,7 @@ static int aw88261_dev_set_profile_index(struct aw_device *aw_dev, int index) · 29 unmodified lines | |||
| 817 | static int aw88261_profile_info(struct snd_kcontrol *kcontrol, | 817 | static int aw88261_profile_info(struct snd_kcontrol *kcontrol, |
| 818 | struct snd_ctl_elem_info *uinfo) | 818 | struct snd_ctl_elem_info *uinfo) |
| 819 | { | 819 | { |
| 820 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 820 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 821 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 821 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 822 | char *prof_name; | 822 | char *prof_name; |
| 823 | int count, ret; | 823 | int count, ret; |
| @@ -852,7 +852,7 @@ static int aw88261_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 852 | static int aw88261_profile_get(struct snd_kcontrol *kcontrol, | 852 | static int aw88261_profile_get(struct snd_kcontrol *kcontrol, |
| 853 | struct snd_ctl_elem_value *ucontrol) | 853 | struct snd_ctl_elem_value *ucontrol) |
| 854 | { | 854 | { |
| 855 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 855 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 856 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 856 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 857 | 857 | ||
| 858 | ucontrol->value.integer.value[0] = aw88261->aw_pa->prof_index; | 858 | ucontrol->value.integer.value[0] = aw88261->aw_pa->prof_index; |
| @@ -863,7 +863,7 @@ static int aw88261_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 863 | static int aw88261_profile_set(struct snd_kcontrol *kcontrol, | 863 | static int aw88261_profile_set(struct snd_kcontrol *kcontrol, |
| 864 | struct snd_ctl_elem_value *ucontrol) | 864 | struct snd_ctl_elem_value *ucontrol) |
| 865 | { | 865 | { |
| 866 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 866 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 867 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 867 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 868 | int ret; | 868 | int ret; |
| 869 | 869 | ||
| @@ -889,7 +889,7 @@ static int aw88261_profile_set(struct snd_kcontrol *kcontrol, · 19 unmodified lines | |||
| 889 | static int aw88261_volume_get(struct snd_kcontrol *kcontrol, | 889 | static int aw88261_volume_get(struct snd_kcontrol *kcontrol, |
| 890 | struct snd_ctl_elem_value *ucontrol) | 890 | struct snd_ctl_elem_value *ucontrol) |
| 891 | { | 891 | { |
| 892 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 892 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 893 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 893 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 894 | struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; | 894 | struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; |
| 895 | 895 | ||
| @@ -901,7 +901,7 @@ static int aw88261_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 901 | static int aw88261_volume_set(struct snd_kcontrol *kcontrol, | 901 | static int aw88261_volume_set(struct snd_kcontrol *kcontrol, |
| 902 | struct snd_ctl_elem_value *ucontrol) | 902 | struct snd_ctl_elem_value *ucontrol) |
| 903 | { | 903 | { |
| 904 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 904 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 905 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 905 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 906 | struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; | 906 | struct aw_volume_desc *vol_desc = &aw88261->aw_pa->volume_desc; |
| 907 | struct soc_mixer_control *mc = | 907 | struct soc_mixer_control *mc = |
| @@ -926,7 +926,7 @@ static int aw88261_volume_set(struct snd_kcontrol *kcontrol, · 18 unmodified lines | |||
| 926 | static int aw88261_get_fade_step(struct snd_kcontrol *kcontrol, | 926 | static int aw88261_get_fade_step(struct snd_kcontrol *kcontrol, |
| 927 | struct snd_ctl_elem_value *ucontrol) | 927 | struct snd_ctl_elem_value *ucontrol) |
| 928 | { | 928 | { |
| 929 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 929 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 930 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 930 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 931 | 931 | ||
| 932 | ucontrol->value.integer.value[0] = aw88261->aw_pa->fade_step; | 932 | ucontrol->value.integer.value[0] = aw88261->aw_pa->fade_step; |
| @@ -937,7 +937,7 @@ static int aw88261_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 937 | static int aw88261_set_fade_step(struct snd_kcontrol *kcontrol, | 937 | static int aw88261_set_fade_step(struct snd_kcontrol *kcontrol, |
| 938 | struct snd_ctl_elem_value *ucontrol) | 938 | struct snd_ctl_elem_value *ucontrol) |
| 939 | { | 939 | { |
| 940 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 940 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 941 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); | 941 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(codec); |
| 942 | struct soc_mixer_control *mc = | 942 | struct soc_mixer_control *mc = |
| 943 | (struct soc_mixer_control *)kcontrol->private_value; | 943 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1131,7 +1131,7 @@ static int aw88261_request_firmware_file(struct aw88261 *aw88261) · 187 unmodified lines | |||
| 1131 | 1131 | ||
| 1132 | static int aw88261_codec_probe(struct snd_soc_component *component) | 1132 | static int aw88261_codec_probe(struct snd_soc_component *component) |
| 1133 | { | 1133 | { |
| 1134 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1134 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1135 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); | 1135 | struct aw88261 *aw88261 = snd_soc_component_get_drvdata(component); |
| 1136 | int ret; | 1136 | int ret; |
| 1137 | 1137 | ||
| @@ -1184,7 +1184,7 @@ static void aw88261_parse_channel_dt(struct aw88261 *aw88261) · 46 unmodified lines | |||
| 1184 | aw_dev->channel = channel_value; | 1184 | aw_dev->channel = channel_value; |
| 1185 | } | 1185 | } |
| 1186 | 1186 | ||
| 1187 | static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct regmap *regmap) | 1187 | static int aw88261_init(struct aw88261 *aw88261, struct i2c_client *i2c, struct regmap *regmap) |
| 1188 | { | 1188 | { |
| 1189 | struct aw_device *aw_dev; | 1189 | struct aw_device *aw_dev; |
| 1190 | unsigned int chip_id; | 1190 | unsigned int chip_id; |
| @@ -1207,7 +1207,7 @@ static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct · 16 unmodified lines | |||
| 1207 | if (!aw_dev) | 1207 | if (!aw_dev) |
| 1208 | return -ENOMEM; | 1208 | return -ENOMEM; |
| 1209 | 1209 | ||
| 1210 | (*aw88261)->aw_pa = aw_dev; | 1210 | aw88261->aw_pa = aw_dev; |
| 1211 | aw_dev->i2c = i2c; | 1211 | aw_dev->i2c = i2c; |
| 1212 | aw_dev->regmap = regmap; | 1212 | aw_dev->regmap = regmap; |
| 1213 | aw_dev->dev = &i2c->dev; | 1213 | aw_dev->dev = &i2c->dev; |
| @@ -1221,7 +1221,7 @@ static int aw88261_init(struct aw88261 **aw88261, struct i2c_client *i2c, struct · 7 unmodified lines | |||
| 1221 | aw_dev->fade_step = AW88261_VOLUME_STEP_DB; | 1221 | aw_dev->fade_step = AW88261_VOLUME_STEP_DB; |
| 1222 | aw_dev->volume_desc.ctl_volume = AW88261_VOL_DEFAULT_VALUE; | 1222 | aw_dev->volume_desc.ctl_volume = AW88261_VOL_DEFAULT_VALUE; |
| 1223 | aw_dev->volume_desc.mute_volume = AW88261_MUTE_VOL; | 1223 | aw_dev->volume_desc.mute_volume = AW88261_MUTE_VOL; |
| 1224 | aw88261_parse_channel_dt(*aw88261); | 1224 | aw88261_parse_channel_dt(aw88261); |
| 1225 | 1225 | ||
| 1226 | return ret; | 1226 | return ret; |
| 1227 | } | 1227 | } |
| @@ -1250,7 +1250,7 @@ static int aw88261_i2c_probe(struct i2c_client *i2c) · 22 unmodified lines | |||
| 1250 | } | 1250 | } |
| 1251 | 1251 | ||
| 1252 | /* aw pa init */ | 1252 | /* aw pa init */ |
| 1253 | ret = aw88261_init(&aw88261, i2c, aw88261->regmap); | 1253 | ret = aw88261_init(aw88261, i2c, aw88261->regmap); |
| 1254 | if (ret) | 1254 | if (ret) |
| 1255 | return ret; | 1255 | return ret; |
| 1256 | 1256 | ||
| @@ -75,7 +75,7 @@ static void aw88395_start(struct aw88395 *aw88395, bool sync_start) · 74 unmodified lines | |||
| 75 | if (sync_start == AW88395_SYNC_START) | 75 | if (sync_start == AW88395_SYNC_START) |
| 76 | aw88395_start_pa(aw88395); | 76 | aw88395_start_pa(aw88395); |
| 77 | else | 77 | else |
| 78 | queue_delayed_work(system_wq, | 78 | queue_delayed_work(system_dfl_wq, |
| 79 | &aw88395->start_work, | 79 | &aw88395->start_work, |
| 80 | AW88395_START_WORK_DELAY_MS); | 80 | AW88395_START_WORK_DELAY_MS); |
| 81 | } | 81 | } |
| @@ -104,7 +104,7 @@ static struct snd_soc_dai_driver aw88395_dai[] = { · 22 unmodified lines | |||
| 104 | static int aw88395_get_fade_in_time(struct snd_kcontrol *kcontrol, | 104 | static int aw88395_get_fade_in_time(struct snd_kcontrol *kcontrol, |
| 105 | struct snd_ctl_elem_value *ucontrol) | 105 | struct snd_ctl_elem_value *ucontrol) |
| 106 | { | 106 | { |
| 107 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 107 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 108 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); | 108 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); |
| 109 | struct aw_device *aw_dev = aw88395->aw_pa; | 109 | struct aw_device *aw_dev = aw88395->aw_pa; |
| 110 | 110 | ||
| @@ -116,7 +116,7 @@ static int aw88395_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 116 | static int aw88395_set_fade_in_time(struct snd_kcontrol *kcontrol, | 116 | static int aw88395_set_fade_in_time(struct snd_kcontrol *kcontrol, |
| 117 | struct snd_ctl_elem_value *ucontrol) | 117 | struct snd_ctl_elem_value *ucontrol) |
| 118 | { | 118 | { |
| 119 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 119 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 120 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); | 120 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); |
| 121 | struct soc_mixer_control *mc = | 121 | struct soc_mixer_control *mc = |
| 122 | (struct soc_mixer_control *)kcontrol->private_value; | 122 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -139,7 +139,7 @@ static int aw88395_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 139 | static int aw88395_get_fade_out_time(struct snd_kcontrol *kcontrol, | 139 | static int aw88395_get_fade_out_time(struct snd_kcontrol *kcontrol, |
| 140 | struct snd_ctl_elem_value *ucontrol) | 140 | struct snd_ctl_elem_value *ucontrol) |
| 141 | { | 141 | { |
| 142 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 142 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 143 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); | 143 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); |
| 144 | struct aw_device *aw_dev = aw88395->aw_pa; | 144 | struct aw_device *aw_dev = aw88395->aw_pa; |
| 145 | 145 | ||
| @@ -151,7 +151,7 @@ static int aw88395_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 151 | static int aw88395_set_fade_out_time(struct snd_kcontrol *kcontrol, | 151 | static int aw88395_set_fade_out_time(struct snd_kcontrol *kcontrol, |
| 152 | struct snd_ctl_elem_value *ucontrol) | 152 | struct snd_ctl_elem_value *ucontrol) |
| 153 | { | 153 | { |
| 154 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 154 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 155 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); | 155 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); |
| 156 | struct soc_mixer_control *mc = | 156 | struct soc_mixer_control *mc = |
| 157 | (struct soc_mixer_control *)kcontrol->private_value; | 157 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -173,7 +173,7 @@ static int aw88395_set_fade_out_time(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 173 | static int aw88395_profile_info(struct snd_kcontrol *kcontrol, | 173 | static int aw88395_profile_info(struct snd_kcontrol *kcontrol, |
| 174 | struct snd_ctl_elem_info *uinfo) | 174 | struct snd_ctl_elem_info *uinfo) |
| 175 | { | 175 | { |
| 176 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 176 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 177 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 177 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 178 | char *prof_name; | 178 | char *prof_name; |
| 179 | int count, ret; | 179 | int count, ret; |
| @@ -208,7 +208,7 @@ static int aw88395_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 208 | static int aw88395_profile_get(struct snd_kcontrol *kcontrol, | 208 | static int aw88395_profile_get(struct snd_kcontrol *kcontrol, |
| 209 | struct snd_ctl_elem_value *ucontrol) | 209 | struct snd_ctl_elem_value *ucontrol) |
| 210 | { | 210 | { |
| 211 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 211 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 212 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 212 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 213 | 213 | ||
| 214 | ucontrol->value.integer.value[0] = aw88395_dev_get_profile_index(aw88395->aw_pa); | 214 | ucontrol->value.integer.value[0] = aw88395_dev_get_profile_index(aw88395->aw_pa); |
| @@ -219,7 +219,7 @@ static int aw88395_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 219 | static int aw88395_profile_set(struct snd_kcontrol *kcontrol, | 219 | static int aw88395_profile_set(struct snd_kcontrol *kcontrol, |
| 220 | struct snd_ctl_elem_value *ucontrol) | 220 | struct snd_ctl_elem_value *ucontrol) |
| 221 | { | 221 | { |
| 222 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 222 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 223 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 223 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 224 | int ret; | 224 | int ret; |
| 225 | 225 | ||
| @@ -245,7 +245,7 @@ static int aw88395_profile_set(struct snd_kcontrol *kcontrol, · 19 unmodified lines | |||
| 245 | static int aw88395_volume_get(struct snd_kcontrol *kcontrol, | 245 | static int aw88395_volume_get(struct snd_kcontrol *kcontrol, |
| 246 | struct snd_ctl_elem_value *ucontrol) | 246 | struct snd_ctl_elem_value *ucontrol) |
| 247 | { | 247 | { |
| 248 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 248 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 249 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 249 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 250 | struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc; | 250 | struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc; |
| 251 | 251 | ||
| @@ -257,7 +257,7 @@ static int aw88395_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 257 | static int aw88395_volume_set(struct snd_kcontrol *kcontrol, | 257 | static int aw88395_volume_set(struct snd_kcontrol *kcontrol, |
| 258 | struct snd_ctl_elem_value *ucontrol) | 258 | struct snd_ctl_elem_value *ucontrol) |
| 259 | { | 259 | { |
| 260 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 260 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 261 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 261 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 262 | struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc; | 262 | struct aw_volume_desc *vol_desc = &aw88395->aw_pa->volume_desc; |
| 263 | struct soc_mixer_control *mc = | 263 | struct soc_mixer_control *mc = |
| @@ -281,7 +281,7 @@ static int aw88395_volume_set(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 281 | static int aw88395_get_fade_step(struct snd_kcontrol *kcontrol, | 281 | static int aw88395_get_fade_step(struct snd_kcontrol *kcontrol, |
| 282 | struct snd_ctl_elem_value *ucontrol) | 282 | struct snd_ctl_elem_value *ucontrol) |
| 283 | { | 283 | { |
| 284 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 284 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 285 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 285 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 286 | 286 | ||
| 287 | ucontrol->value.integer.value[0] = aw88395->aw_pa->fade_step; | 287 | ucontrol->value.integer.value[0] = aw88395->aw_pa->fade_step; |
| @@ -292,7 +292,7 @@ static int aw88395_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 292 | static int aw88395_set_fade_step(struct snd_kcontrol *kcontrol, | 292 | static int aw88395_set_fade_step(struct snd_kcontrol *kcontrol, |
| 293 | struct snd_ctl_elem_value *ucontrol) | 293 | struct snd_ctl_elem_value *ucontrol) |
| 294 | { | 294 | { |
| 295 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 295 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 296 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 296 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 297 | struct soc_mixer_control *mc = | 297 | struct soc_mixer_control *mc = |
| 298 | (struct soc_mixer_control *)kcontrol->private_value; | 298 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -313,7 +313,7 @@ static int aw88395_set_fade_step(struct snd_kcontrol *kcontrol, · 14 unmodified lines | |||
| 313 | static int aw88395_re_get(struct snd_kcontrol *kcontrol, | 313 | static int aw88395_re_get(struct snd_kcontrol *kcontrol, |
| 314 | struct snd_ctl_elem_value *ucontrol) | 314 | struct snd_ctl_elem_value *ucontrol) |
| 315 | { | 315 | { |
| 316 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 316 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 317 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 317 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 318 | struct aw_device *aw_dev = aw88395->aw_pa; | 318 | struct aw_device *aw_dev = aw88395->aw_pa; |
| 319 | 319 | ||
| @@ -325,7 +325,7 @@ static int aw88395_re_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 325 | static int aw88395_re_set(struct snd_kcontrol *kcontrol, | 325 | static int aw88395_re_set(struct snd_kcontrol *kcontrol, |
| 326 | struct snd_ctl_elem_value *ucontrol) | 326 | struct snd_ctl_elem_value *ucontrol) |
| 327 | { | 327 | { |
| 328 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 328 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 329 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); | 329 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(codec); |
| 330 | struct soc_mixer_control *mc = | 330 | struct soc_mixer_control *mc = |
| 331 | (struct soc_mixer_control *)kcontrol->private_value; | 331 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -401,7 +401,7 @@ static const struct snd_soc_dapm_route aw88395_audio_map[] = { · 69 unmodified lines | |||
| 401 | 401 | ||
| 402 | static int aw88395_codec_probe(struct snd_soc_component *component) | 402 | static int aw88395_codec_probe(struct snd_soc_component *component) |
| 403 | { | 403 | { |
| 404 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 404 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 405 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); | 405 | struct aw88395 *aw88395 = snd_soc_component_get_drvdata(component); |
| 406 | int ret; | 406 | int ret; |
| 407 | 407 | ||
| @@ -64,7 +64,7 @@ static int aw_dev_dsp_write_32bit(struct aw_device *aw_dev, · 63 unmodified lines | |||
| 64 | return 0; | 64 | return 0; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | static int aw_dev_dsp_write(struct aw_device *aw_dev, | 67 | int aw_dev_dsp_write(struct aw_device *aw_dev, |
| 68 | unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type) | 68 | unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type) |
| 69 | { | 69 | { |
| 70 | u32 reg_value; | 70 | u32 reg_value; |
| @@ -72,13 +72,13 @@ static int aw_dev_dsp_write(struct aw_device *aw_dev, · 1 unmodified line | |||
| 72 | 72 | ||
| 73 | mutex_lock(&aw_dev->dsp_lock); | 73 | mutex_lock(&aw_dev->dsp_lock); |
| 74 | switch (data_type) { | 74 | switch (data_type) { |
| 75 | case AW88395_DSP_16_DATA: | 75 | case AW_DSP_16_DATA: |
| 76 | ret = aw_dev_dsp_write_16bit(aw_dev, dsp_addr, dsp_data); | 76 | ret = aw_dev_dsp_write_16bit(aw_dev, dsp_addr, dsp_data); |
| 77 | if (ret) | 77 | if (ret) |
| 78 | dev_err(aw_dev->dev, "write dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", | 78 | dev_err(aw_dev->dev, "write dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", |
| 79 | (u32)dsp_addr, dsp_data); | 79 | (u32)dsp_addr, dsp_data); |
| 80 | break; | 80 | break; |
| 81 | case AW88395_DSP_32_DATA: | 81 | case AW_DSP_32_DATA: |
| 82 | ret = aw_dev_dsp_write_32bit(aw_dev, dsp_addr, dsp_data); | 82 | ret = aw_dev_dsp_write_32bit(aw_dev, dsp_addr, dsp_data); |
| 83 | if (ret) | 83 | if (ret) |
| 84 | dev_err(aw_dev->dev, "write dsp_addr[0x%x] 32-bit dsp_data[0x%x] failed", | 84 | dev_err(aw_dev->dev, "write dsp_addr[0x%x] 32-bit dsp_data[0x%x] failed", |
| @@ -97,6 +97,7 @@ static int aw_dev_dsp_write(struct aw_device *aw_dev, · 12 unmodified lines | |||
| 97 | 97 | ||
| 98 | return ret; | 98 | return ret; |
| 99 | } | 99 | } |
| 100 | EXPORT_SYMBOL_GPL(aw_dev_dsp_write); | ||
| 100 | 101 | ||
| 101 | static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev, | 102 | static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev, |
| 102 | unsigned short dsp_addr, unsigned int *dsp_data) | 103 | unsigned short dsp_addr, unsigned int *dsp_data) |
| @@ -149,7 +150,7 @@ static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev, · 46 unmodified lines | |||
| 149 | return 0; | 150 | return 0; |
| 150 | } | 151 | } |
| 151 | 152 | ||
| 152 | static int aw_dev_dsp_read(struct aw_device *aw_dev, | 153 | int aw_dev_dsp_read(struct aw_device *aw_dev, |
| 153 | unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type) | 154 | unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type) |
| 154 | { | 155 | { |
| 155 | u32 reg_value; | 156 | u32 reg_value; |
| @@ -157,13 +158,13 @@ static int aw_dev_dsp_read(struct aw_device *aw_dev, · 1 unmodified line | |||
| 157 | 158 | ||
| 158 | mutex_lock(&aw_dev->dsp_lock); | 159 | mutex_lock(&aw_dev->dsp_lock); |
| 159 | switch (data_type) { | 160 | switch (data_type) { |
| 160 | case AW88395_DSP_16_DATA: | 161 | case AW_DSP_16_DATA: |
| 161 | ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data); | 162 | ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data); |
| 162 | if (ret) | 163 | if (ret) |
| 163 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", | 164 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", |
| 164 | (u32)dsp_addr, *dsp_data); | 165 | (u32)dsp_addr, *dsp_data); |
| 165 | break; | 166 | break; |
| 166 | case AW88395_DSP_32_DATA: | 167 | case AW_DSP_32_DATA: |
| 167 | ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data); | 168 | ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data); |
| 168 | if (ret) | 169 | if (ret) |
| 169 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed", | 170 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed", |
| @@ -182,7 +183,7 @@ static int aw_dev_dsp_read(struct aw_device *aw_dev, · 12 unmodified lines | |||
| 182 | 183 | ||
| 183 | return ret; | 184 | return ret; |
| 184 | } | 185 | } |
| 185 | 186 | EXPORT_SYMBOL_GPL(aw_dev_dsp_read); | |
| 186 | 187 | ||
| 187 | static int aw_dev_read_chipid(struct aw_device *aw_dev, u16 *chip_id) | 188 | static int aw_dev_read_chipid(struct aw_device *aw_dev, u16 *chip_id) |
| 188 | { | 189 | { |
| @@ -231,7 +232,7 @@ static int aw_dev_dsp_fw_check(struct aw_device *aw_dev) · 42 unmodified lines | |||
| 231 | dsp_fw_desc = &set_prof_desc->sec_desc[AW88395_DATA_TYPE_DSP_FW]; | 232 | dsp_fw_desc = &set_prof_desc->sec_desc[AW88395_DATA_TYPE_DSP_FW]; |
| 232 | 233 | ||
| 233 | for (i = 0; i < AW88395_FW_CHECK_PART; i++) { | 234 | for (i = 0; i < AW88395_FW_CHECK_PART; i++) { |
| 234 | ret = aw_dev_dsp_read(aw_dev, addr, &dsp_val, AW88395_DSP_16_DATA); | 235 | ret = aw_dev_dsp_read(aw_dev, addr, &dsp_val, AW_DSP_16_DATA); |
| 235 | if (ret) { | 236 | if (ret) { |
| 236 | dev_err(aw_dev->dev, "dsp read failed"); | 237 | dev_err(aw_dev->dev, "dsp read failed"); |
| 237 | return ret; | 238 | return ret; |
| @@ -351,11 +352,11 @@ static int aw_dev_modify_dsp_cfg(struct aw_device *aw_dev, · 113 unmodified lines | |||
| 351 | return -EINVAL; | 352 | return -EINVAL; |
| 352 | } | 353 | } |
| 353 | switch (data_type) { | 354 | switch (data_type) { |
| 354 | case AW88395_DSP_16_DATA: | 355 | case AW_DSP_16_DATA: |
| 355 | data1 = cpu_to_le16((u16)dsp_data); | 356 | data1 = cpu_to_le16((u16)dsp_data); |
| 356 | memcpy(crc_dsp_cfg->data + addr_offset, (u8 *)&data1, 2); | 357 | memcpy(crc_dsp_cfg->data + addr_offset, (u8 *)&data1, 2); |
| 357 | break; | 358 | break; |
| 358 | case AW88395_DSP_32_DATA: | 359 | case AW_DSP_32_DATA: |
| 359 | data2 = cpu_to_le32(dsp_data); | 360 | data2 = cpu_to_le32(dsp_data); |
| 360 | memcpy(crc_dsp_cfg->data + addr_offset, (u8 *)&data2, 4); | 361 | memcpy(crc_dsp_cfg->data + addr_offset, (u8 *)&data2, 4); |
| 361 | break; | 362 | break; |
| @@ -377,14 +378,14 @@ static int aw_dev_dsp_set_cali_re(struct aw_device *aw_dev) · 15 unmodified lines | |||
| 377 | 378 | ||
| 378 | /* set cali re to device */ | 379 | /* set cali re to device */ |
| 379 | ret = aw_dev_dsp_write(aw_dev, | 380 | ret = aw_dev_dsp_write(aw_dev, |
| 380 | AW88395_DSP_REG_CFG_ADPZ_RE, cali_re, AW88395_DSP_32_DATA); | 381 | AW88395_DSP_REG_CFG_ADPZ_RE, cali_re, AW_DSP_32_DATA); |
| 381 | if (ret) { | 382 | if (ret) { |
| 382 | dev_err(aw_dev->dev, "set cali re error"); | 383 | dev_err(aw_dev->dev, "set cali re error"); |
| 383 | return ret; | 384 | return ret; |
| 384 | } | 385 | } |
| 385 | 386 | ||
| 386 | ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RE, | 387 | ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RE, |
| 387 | cali_re, AW88395_DSP_32_DATA); | 388 | cali_re, AW_DSP_32_DATA); |
| 388 | if (ret) | 389 | if (ret) |
| 389 | dev_err(aw_dev->dev, "modify dsp cfg failed"); | 390 | dev_err(aw_dev->dev, "modify dsp cfg failed"); |
| 390 | 391 | ||
| @@ -428,7 +429,7 @@ static int aw_dev_dsp_set_crc32(struct aw_device *aw_dev) · 37 unmodified lines | |||
| 428 | crc_value = crc32c(0xFFFFFFFF, crc_dsp_cfg->data, crc_data_len) ^ 0xFFFFFFFF; | 429 | crc_value = crc32c(0xFFFFFFFF, crc_dsp_cfg->data, crc_data_len) ^ 0xFFFFFFFF; |
| 429 | 430 | ||
| 430 | return aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_CRC_ADDR, crc_value, | 431 | return aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_CRC_ADDR, crc_value, |
| 431 | AW88395_DSP_32_DATA); | 432 | AW_DSP_32_DATA); |
| 432 | } | 433 | } |
| 433 | 434 | ||
| 434 | static void aw_dev_dsp_check_crc_enable(struct aw_device *aw_dev, bool flag) | 435 | static void aw_dev_dsp_check_crc_enable(struct aw_device *aw_dev, bool flag) |
| @@ -663,7 +664,7 @@ static int aw_dev_set_vcalb(struct aw_device *aw_dev) · 228 unmodified lines | |||
| 663 | int vcalb, vcalk; | 664 | int vcalb, vcalk; |
| 664 | int ret; | 665 | int ret; |
| 665 | 666 | ||
| 666 | ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VCALB, &vcalb_adj, AW88395_DSP_16_DATA); | 667 | ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VCALB, &vcalb_adj, AW_DSP_16_DATA); |
| 667 | if (ret) { | 668 | if (ret) { |
| 668 | dev_err(aw_dev->dev, "read vcalb_adj failed"); | 669 | dev_err(aw_dev->dev, "read vcalb_adj failed"); |
| 669 | return ret; | 670 | return ret; |
| @@ -720,14 +721,14 @@ static int aw_dev_set_vcalb(struct aw_device *aw_dev) · 50 unmodified lines | |||
| 720 | dev_dbg(aw_dev->dev, "vcalb=%d, reg_val=0x%x, vcalb_adj =0x%x", | 721 | dev_dbg(aw_dev->dev, "vcalb=%d, reg_val=0x%x, vcalb_adj =0x%x", |
| 721 | vcalb, reg_val, vcalb_adj); | 722 | vcalb, reg_val, vcalb_adj); |
| 722 | 723 | ||
| 723 | ret = aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_VCALB, reg_val, AW88395_DSP_16_DATA); | 724 | ret = aw_dev_dsp_write(aw_dev, AW88395_DSP_REG_VCALB, reg_val, AW_DSP_16_DATA); |
| 724 | if (ret) { | 725 | if (ret) { |
| 725 | dev_err(aw_dev->dev, "write vcalb failed"); | 726 | dev_err(aw_dev->dev, "write vcalb failed"); |
| 726 | return ret; | 727 | return ret; |
| 727 | } | 728 | } |
| 728 | 729 | ||
| 729 | ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_VCALB, | 730 | ret = aw_dev_modify_dsp_cfg(aw_dev, AW88395_DSP_REG_VCALB, |
| 730 | (u32)reg_val, AW88395_DSP_16_DATA); | 731 | (u32)reg_val, AW_DSP_16_DATA); |
| 731 | if (ret) | 732 | if (ret) |
| 732 | dev_err(aw_dev->dev, "modify dsp cfg failed"); | 733 | dev_err(aw_dev->dev, "modify dsp cfg failed"); |
| 733 | 734 | ||
| @@ -741,7 +742,7 @@ static int aw_dev_get_cali_f0_delay(struct aw_device *aw_dev) · 7 unmodified lines | |||
| 741 | int ret; | 742 | int ret; |
| 742 | 743 | ||
| 743 | ret = aw_dev_dsp_read(aw_dev, | 744 | ret = aw_dev_dsp_read(aw_dev, |
| 744 | AW88395_DSP_CALI_F0_DELAY, &cali_delay, AW88395_DSP_16_DATA); | 745 | AW88395_DSP_CALI_F0_DELAY, &cali_delay, AW_DSP_16_DATA); |
| 745 | if (ret) | 746 | if (ret) |
| 746 | dev_err(aw_dev->dev, "read cali delay failed, ret=%d", ret); | 747 | dev_err(aw_dev->dev, "read cali delay failed, ret=%d", ret); |
| 747 | else | 748 | else |
| @@ -991,7 +992,7 @@ static int aw_dev_get_dsp_status(struct aw_device *aw_dev) · 243 unmodified lines | |||
| 991 | 992 | ||
| 992 | static int aw_dev_get_vmax(struct aw_device *aw_dev, unsigned int *vmax) | 993 | static int aw_dev_get_vmax(struct aw_device *aw_dev, unsigned int *vmax) |
| 993 | { | 994 | { |
| 994 | return aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VMAX, vmax, AW88395_DSP_16_DATA); | 995 | return aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_VMAX, vmax, AW_DSP_16_DATA); |
| 995 | } | 996 | } |
| 996 | 997 | ||
| 997 | static int aw_dev_update_reg_container(struct aw_device *aw_dev, | 998 | static int aw_dev_update_reg_container(struct aw_device *aw_dev, |
| @@ -1089,7 +1090,7 @@ static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) · 91 unmodified lines | |||
| 1089 | int ret; | 1090 | int ret; |
| 1090 | 1091 | ||
| 1091 | ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RA, | 1092 | ret = aw_dev_dsp_read(aw_dev, AW88395_DSP_REG_CFG_ADPZ_RA, |
| 1092 | &dsp_ra, AW88395_DSP_32_DATA); | 1093 | &dsp_ra, AW_DSP_32_DATA); |
| 1093 | if (ret) { | 1094 | if (ret) { |
| 1094 | dev_err(aw_dev->dev, "read ra error"); | 1095 | dev_err(aw_dev->dev, "read ra error"); |
| 1095 | return ret; | 1096 | return ret; |
| @@ -89,8 +89,8 @@ enum AW88395_DEV_DSP_CFG { · 88 unmodified lines | |||
| 89 | }; | 89 | }; |
| 90 | 90 | ||
| 91 | enum { | 91 | enum { |
| 92 | AW88395_DSP_16_DATA = 0, | 92 | AW_DSP_16_DATA = 0, |
| 93 | AW88395_DSP_32_DATA = 1, | 93 | AW_DSP_32_DATA = 1, |
| 94 | }; | 94 | }; |
| 95 | 95 | ||
| 96 | enum { | 96 | enum { |
| @@ -210,5 +210,9 @@ int aw88395_dev_get_profile_count(struct aw_device *aw_dev); · 113 unmodified lines | |||
| 210 | int aw88395_dev_load_acf_check(struct aw_device *aw_dev, struct aw_container *aw_cfg); | 210 | int aw88395_dev_load_acf_check(struct aw_device *aw_dev, struct aw_container *aw_cfg); |
| 211 | int aw88395_dev_cfg_load(struct aw_device *aw_dev, struct aw_container *aw_cfg); | 211 | int aw88395_dev_cfg_load(struct aw_device *aw_dev, struct aw_container *aw_cfg); |
| 212 | void aw88395_dev_mute(struct aw_device *aw_dev, bool is_mute); | 212 | void aw88395_dev_mute(struct aw_device *aw_dev, bool is_mute); |
| 213 | int aw_dev_dsp_write(struct aw_device *aw_dev, | ||
| 214 | unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type); | ||
| 215 | int aw_dev_dsp_read(struct aw_device *aw_dev, | ||
| 216 | unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type); | ||
| 213 | 217 | ||
| 214 | #endif | 218 | #endif |
| @@ -26,172 +26,6 @@ static const struct regmap_config aw88399_remap_config = { · 25 unmodified lines | |||
| 26 | .val_format_endian = REGMAP_ENDIAN_BIG, | 26 | .val_format_endian = REGMAP_ENDIAN_BIG, |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | static int aw_dev_dsp_write_16bit(struct aw_device *aw_dev, | ||
| 30 | unsigned short dsp_addr, unsigned int dsp_data) | ||
| 31 | { | ||
| 32 | int ret; | ||
| 33 | |||
| 34 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr); | ||
| 35 | if (ret) { | ||
| 36 | dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret); | ||
| 37 | return ret; | ||
| 38 | } | ||
| 39 | |||
| 40 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMDAT_REG, (u16)dsp_data); | ||
| 41 | if (ret) { | ||
| 42 | dev_err(aw_dev->dev, "%s write data error, ret=%d", __func__, ret); | ||
| 43 | return ret; | ||
| 44 | } | ||
| 45 | |||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | static int aw_dev_dsp_write_32bit(struct aw_device *aw_dev, | ||
| 50 | unsigned short dsp_addr, unsigned int dsp_data) | ||
| 51 | { | ||
| 52 | unsigned int temp_data; | ||
| 53 | int ret; | ||
| 54 | |||
| 55 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr); | ||
| 56 | if (ret) { | ||
| 57 | dev_err(aw_dev->dev, "%s write addr error, ret=%d", __func__, ret); | ||
| 58 | return ret; | ||
| 59 | } | ||
| 60 | |||
| 61 | temp_data = dsp_data & AW88395_DSP_16_DATA_MASK; | ||
| 62 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMDAT_REG, temp_data); | ||
| 63 | if (ret) { | ||
| 64 | dev_err(aw_dev->dev, "%s write datal error, ret=%d", __func__, ret); | ||
| 65 | return ret; | ||
| 66 | } | ||
| 67 | |||
| 68 | temp_data = dsp_data >> 16; | ||
| 69 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMDAT_REG, temp_data); | ||
| 70 | if (ret) | ||
| 71 | dev_err(aw_dev->dev, "%s write datah error, ret=%d", __func__, ret); | ||
| 72 | |||
| 73 | return ret; | ||
| 74 | } | ||
| 75 | |||
| 76 | static int aw_dev_dsp_write(struct aw_device *aw_dev, | ||
| 77 | unsigned short dsp_addr, unsigned int dsp_data, unsigned char data_type) | ||
| 78 | { | ||
| 79 | unsigned int reg_value; | ||
| 80 | int ret; | ||
| 81 | |||
| 82 | mutex_lock(&aw_dev->dsp_lock); | ||
| 83 | switch (data_type) { | ||
| 84 | case AW88395_DSP_16_DATA: | ||
| 85 | ret = aw_dev_dsp_write_16bit(aw_dev, dsp_addr, dsp_data); | ||
| 86 | if (ret) | ||
| 87 | dev_err(aw_dev->dev, "write dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", | ||
| 88 | dsp_addr, dsp_data); | ||
| 89 | break; | ||
| 90 | case AW88395_DSP_32_DATA: | ||
| 91 | ret = aw_dev_dsp_write_32bit(aw_dev, dsp_addr, dsp_data); | ||
| 92 | if (ret) | ||
| 93 | dev_err(aw_dev->dev, "write dsp_addr[0x%x] 32-bit dsp_data[0x%x] failed", | ||
| 94 | dsp_addr, dsp_data); | ||
| 95 | break; | ||
| 96 | default: | ||
| 97 | dev_err(aw_dev->dev, "data type[%d] unsupported", data_type); | ||
| 98 | ret = -EINVAL; | ||
| 99 | break; | ||
| 100 | } | ||
| 101 | |||
| 102 | /* clear dsp chip select state */ | ||
| 103 | if (regmap_read(aw_dev->regmap, 0x00, ®_value)) | ||
| 104 | dev_err(aw_dev->dev, "%s fail to clear chip state. Err=%d\n", __func__, ret); | ||
| 105 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 106 | |||
| 107 | return ret; | ||
| 108 | } | ||
| 109 | |||
| 110 | static int aw_dev_dsp_read_16bit(struct aw_device *aw_dev, | ||
| 111 | unsigned short dsp_addr, unsigned int *dsp_data) | ||
| 112 | { | ||
| 113 | unsigned int temp_data; | ||
| 114 | int ret; | ||
| 115 | |||
| 116 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr); | ||
| 117 | if (ret) { | ||
| 118 | dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret); | ||
| 119 | return ret; | ||
| 120 | } | ||
| 121 | |||
| 122 | ret = regmap_read(aw_dev->regmap, AW88399_DSPMDAT_REG, &temp_data); | ||
| 123 | if (ret) { | ||
| 124 | dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); | ||
| 125 | return ret; | ||
| 126 | } | ||
| 127 | *dsp_data = temp_data; | ||
| 128 | |||
| 129 | return 0; | ||
| 130 | } | ||
| 131 | |||
| 132 | static int aw_dev_dsp_read_32bit(struct aw_device *aw_dev, | ||
| 133 | unsigned short dsp_addr, unsigned int *dsp_data) | ||
| 134 | { | ||
| 135 | unsigned int temp_data; | ||
| 136 | int ret; | ||
| 137 | |||
| 138 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, dsp_addr); | ||
| 139 | if (ret) { | ||
| 140 | dev_err(aw_dev->dev, "%s write error, ret=%d", __func__, ret); | ||
| 141 | return ret; | ||
| 142 | } | ||
| 143 | |||
| 144 | ret = regmap_read(aw_dev->regmap, AW88399_DSPMDAT_REG, &temp_data); | ||
| 145 | if (ret) { | ||
| 146 | dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); | ||
| 147 | return ret; | ||
| 148 | } | ||
| 149 | *dsp_data = temp_data; | ||
| 150 | |||
| 151 | ret = regmap_read(aw_dev->regmap, AW88399_DSPMDAT_REG, &temp_data); | ||
| 152 | if (ret) { | ||
| 153 | dev_err(aw_dev->dev, "%s read error, ret=%d", __func__, ret); | ||
| 154 | return ret; | ||
| 155 | } | ||
| 156 | *dsp_data |= (temp_data << 16); | ||
| 157 | |||
| 158 | return 0; | ||
| 159 | } | ||
| 160 | |||
| 161 | static int aw_dev_dsp_read(struct aw_device *aw_dev, | ||
| 162 | unsigned short dsp_addr, unsigned int *dsp_data, unsigned char data_type) | ||
| 163 | { | ||
| 164 | u32 reg_value; | ||
| 165 | int ret; | ||
| 166 | |||
| 167 | mutex_lock(&aw_dev->dsp_lock); | ||
| 168 | switch (data_type) { | ||
| 169 | case AW88399_DSP_16_DATA: | ||
| 170 | ret = aw_dev_dsp_read_16bit(aw_dev, dsp_addr, dsp_data); | ||
| 171 | if (ret) | ||
| 172 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 16-bit dsp_data[0x%x] failed", | ||
| 173 | (u32)dsp_addr, *dsp_data); | ||
| 174 | break; | ||
| 175 | case AW88399_DSP_32_DATA: | ||
| 176 | ret = aw_dev_dsp_read_32bit(aw_dev, dsp_addr, dsp_data); | ||
| 177 | if (ret) | ||
| 178 | dev_err(aw_dev->dev, "read dsp_addr[0x%x] 32r-bit dsp_data[0x%x] failed", | ||
| 179 | (u32)dsp_addr, *dsp_data); | ||
| 180 | break; | ||
| 181 | default: | ||
| 182 | dev_err(aw_dev->dev, "data type[%d] unsupported", data_type); | ||
| 183 | ret = -EINVAL; | ||
| 184 | break; | ||
| 185 | } | ||
| 186 | |||
| 187 | /* clear dsp chip select state */ | ||
| 188 | if (regmap_read(aw_dev->regmap, AW88399_ID_REG, ®_value)) | ||
| 189 | dev_err(aw_dev->dev, "%s fail to clear chip state. ret=%d\n", __func__, ret); | ||
| 190 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 191 | |||
| 192 | return ret; | ||
| 193 | } | ||
| 194 | |||
| 195 | static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd) | 29 | static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd) |
| 196 | { | 30 | { |
| 197 | int ret; | 31 | int ret; |
| @@ -929,25 +763,19 @@ static int aw_dev_dsp_update_container(struct aw_device *aw_dev, · 731 unmodified lines | |||
| 929 | u32 tmp_len; | 763 | u32 tmp_len; |
| 930 | int i, ret; | 764 | int i, ret; |
| 931 | 765 | ||
| 932 | mutex_lock(&aw_dev->dsp_lock); | ||
| 933 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, base); | 766 | ret = regmap_write(aw_dev->regmap, AW88399_DSPMADD_REG, base); |
| 934 | if (ret) | 767 | if (ret) |
| 935 | goto error_operation; | 768 | return ret; |
| 936 | 769 | ||
| 937 | for (i = 0; i < len; i += AW88399_MAX_RAM_WRITE_BYTE_SIZE) { | 770 | for (i = 0; i < len; i += AW88399_MAX_RAM_WRITE_BYTE_SIZE) { |
| 938 | tmp_len = min(len - i, AW88399_MAX_RAM_WRITE_BYTE_SIZE); | 771 | tmp_len = min(len - i, AW88399_MAX_RAM_WRITE_BYTE_SIZE); |
| 939 | ret = regmap_raw_write(aw_dev->regmap, AW88399_DSPMDAT_REG, | 772 | ret = regmap_raw_write(aw_dev->regmap, AW88399_DSPMDAT_REG, |
| 940 | &data[i], tmp_len); | 773 | &data[i], tmp_len); |
| 941 | if (ret) | 774 | if (ret) |
| 942 | goto error_operation; | 775 | return ret; |
| 943 | } | 776 | } |
| 944 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 945 | 777 | ||
| 946 | return 0; | 778 | return 0; |
| 947 | |||
| 948 | error_operation: | ||
| 949 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 950 | return ret; | ||
| 951 | } | 779 | } |
| 952 | 780 | ||
| 953 | static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) | 781 | static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) |
| @@ -958,7 +786,7 @@ static int aw_dev_get_ra(struct aw_cali_desc *cali_desc) · 4 unmodified lines | |||
| 958 | int ret; | 786 | int ret; |
| 959 | 787 | ||
| 960 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_ADPZ_RA, | 788 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_ADPZ_RA, |
| 961 | &dsp_ra, AW88399_DSP_32_DATA); | 789 | &dsp_ra, AW_DSP_32_DATA); |
| 962 | if (ret) { | 790 | if (ret) { |
| 963 | dev_err(aw_dev->dev, "read ra error"); | 791 | dev_err(aw_dev->dev, "read ra error"); |
| 964 | return ret; | 792 | return ret; |
| @@ -1015,29 +843,25 @@ static int aw_dev_check_sram(struct aw_device *aw_dev) · 50 unmodified lines | |||
| 1015 | { | 843 | { |
| 1016 | unsigned int reg_val; | 844 | unsigned int reg_val; |
| 1017 | 845 | ||
| 1018 | mutex_lock(&aw_dev->dsp_lock); | ||
| 1019 | /* read dsp_rom_check_reg */ | 846 | /* read dsp_rom_check_reg */ |
| 1020 | aw_dev_dsp_read_16bit(aw_dev, AW88399_DSP_ROM_CHECK_ADDR, ®_val); | 847 | aw_dev_dsp_read(aw_dev, AW88399_DSP_ROM_CHECK_ADDR, ®_val, AW_DSP_16_DATA); |
| 1021 | if (reg_val != AW88399_DSP_ROM_CHECK_DATA) { | 848 | if (reg_val != AW88399_DSP_ROM_CHECK_DATA) { |
| 1022 | dev_err(aw_dev->dev, "check dsp rom failed, read[0x%x] != check[0x%x]", | 849 | dev_err(aw_dev->dev, "check dsp rom failed, read[0x%x] != check[0x%x]", |
| 1023 | reg_val, AW88399_DSP_ROM_CHECK_DATA); | 850 | reg_val, AW88399_DSP_ROM_CHECK_DATA); |
| 1024 | goto error; | 851 | return -EPERM; |
| 1025 | } | 852 | } |
| 1026 | 853 | ||
| 1027 | /* check dsp_cfg_base_addr */ | 854 | /* check dsp_cfg_base_addr */ |
| 1028 | aw_dev_dsp_write_16bit(aw_dev, AW88399_DSP_CFG_ADDR, AW88399_DSP_ODD_NUM_BIT_TEST); | 855 | aw_dev_dsp_write(aw_dev, AW88399_DSP_CFG_ADDR, |
| 1029 | aw_dev_dsp_read_16bit(aw_dev, AW88399_DSP_CFG_ADDR, ®_val); | 856 | AW88399_DSP_ODD_NUM_BIT_TEST, AW_DSP_16_DATA); |
| 857 | aw_dev_dsp_read(aw_dev, AW88399_DSP_CFG_ADDR, ®_val, AW_DSP_16_DATA); | ||
| 1030 | if (reg_val != AW88399_DSP_ODD_NUM_BIT_TEST) { | 858 | if (reg_val != AW88399_DSP_ODD_NUM_BIT_TEST) { |
| 1031 | dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]", | 859 | dev_err(aw_dev->dev, "check dsp cfg failed, read[0x%x] != write[0x%x]", |
| 1032 | reg_val, AW88399_DSP_ODD_NUM_BIT_TEST); | 860 | reg_val, AW88399_DSP_ODD_NUM_BIT_TEST); |
| 1033 | goto error; | 861 | return -EPERM; |
| 1034 | } | 862 | } |
| 1035 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 1036 | 863 | ||
| 1037 | return 0; | 864 | return 0; |
| 1038 | error: | ||
| 1039 | mutex_unlock(&aw_dev->dsp_lock); | ||
| 1040 | return -EPERM; | ||
| 1041 | } | 865 | } |
| 1042 | 866 | ||
| 1043 | static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag) | 867 | static void aw_dev_select_memclk(struct aw_device *aw_dev, unsigned char flag) |
| @@ -1340,7 +1164,7 @@ static void aw88399_start(struct aw88399 *aw88399, bool sync_start) · 296 unmodified lines | |||
| 1340 | if (sync_start == AW88399_SYNC_START) | 1164 | if (sync_start == AW88399_SYNC_START) |
| 1341 | aw88399_start_pa(aw88399); | 1165 | aw88399_start_pa(aw88399); |
| 1342 | else | 1166 | else |
| 1343 | queue_delayed_work(system_wq, | 1167 | queue_delayed_work(system_dfl_wq, |
| 1344 | &aw88399->start_work, | 1168 | &aw88399->start_work, |
| 1345 | AW88399_START_WORK_DELAY_MS); | 1169 | AW88399_START_WORK_DELAY_MS); |
| 1346 | } | 1170 | } |
| @@ -1432,22 +1256,22 @@ static int aw_cali_svc_get_cali_cfg(struct aw_device *aw_dev) · 85 unmodified lines | |||
| 1432 | int ret; | 1256 | int ret; |
| 1433 | 1257 | ||
| 1434 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_MBMEC_ACTAMPTH, | 1258 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_MBMEC_ACTAMPTH, |
| 1435 | &cali_cfg->data[0], AW88399_DSP_32_DATA); | 1259 | &cali_cfg->data[0], AW_DSP_32_DATA); |
| 1436 | if (ret) | 1260 | if (ret) |
| 1437 | return ret; | 1261 | return ret; |
| 1438 | 1262 | ||
| 1439 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_MBMEC_NOISEAMPTH, | 1263 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_MBMEC_NOISEAMPTH, |
| 1440 | &cali_cfg->data[1], AW88399_DSP_32_DATA); | 1264 | &cali_cfg->data[1], AW_DSP_32_DATA); |
| 1441 | if (ret) | 1265 | if (ret) |
| 1442 | return ret; | 1266 | return ret; |
| 1443 | 1267 | ||
| 1444 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_ADPZ_USTEPN, | 1268 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_ADPZ_USTEPN, |
| 1445 | &cali_cfg->data[2], AW88399_DSP_16_DATA); | 1269 | &cali_cfg->data[2], AW_DSP_16_DATA); |
| 1446 | if (ret) | 1270 | if (ret) |
| 1447 | return ret; | 1271 | return ret; |
| 1448 | 1272 | ||
| 1449 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_RE_ALPHA, | 1273 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CFG_RE_ALPHA, |
| 1450 | &cali_cfg->data[3], AW88399_DSP_16_DATA); | 1274 | &cali_cfg->data[3], AW_DSP_16_DATA); |
| 1451 | 1275 | ||
| 1452 | return ret; | 1276 | return ret; |
| 1453 | } | 1277 | } |
| @@ -1458,22 +1282,22 @@ static int aw_cali_svc_set_cali_cfg(struct aw_device *aw_dev, · 4 unmodified lines | |||
| 1458 | int ret; | 1282 | int ret; |
| 1459 | 1283 | ||
| 1460 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_MBMEC_ACTAMPTH, | 1284 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_MBMEC_ACTAMPTH, |
| 1461 | cali_cfg.data[0], AW88399_DSP_32_DATA); | 1285 | cali_cfg.data[0], AW_DSP_32_DATA); |
| 1462 | if (ret) | 1286 | if (ret) |
| 1463 | return ret; | 1287 | return ret; |
| 1464 | 1288 | ||
| 1465 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_MBMEC_NOISEAMPTH, | 1289 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_MBMEC_NOISEAMPTH, |
| 1466 | cali_cfg.data[1], AW88399_DSP_32_DATA); | 1290 | cali_cfg.data[1], AW_DSP_32_DATA); |
| 1467 | if (ret) | 1291 | if (ret) |
| 1468 | return ret; | 1292 | return ret; |
| 1469 | 1293 | ||
| 1470 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_ADPZ_USTEPN, | 1294 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_ADPZ_USTEPN, |
| 1471 | cali_cfg.data[2], AW88399_DSP_16_DATA); | 1295 | cali_cfg.data[2], AW_DSP_16_DATA); |
| 1472 | if (ret) | 1296 | if (ret) |
| 1473 | return ret; | 1297 | return ret; |
| 1474 | 1298 | ||
| 1475 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_RE_ALPHA, | 1299 | ret = aw_dev_dsp_write(aw_dev, AW88399_DSP_REG_CFG_RE_ALPHA, |
| 1476 | cali_cfg.data[3], AW88399_DSP_16_DATA); | 1300 | cali_cfg.data[3], AW_DSP_16_DATA); |
| 1477 | 1301 | ||
| 1478 | return ret; | 1302 | return ret; |
| 1479 | } | 1303 | } |
| @@ -1488,7 +1312,7 @@ static int aw_cali_svc_cali_en(struct aw_device *aw_dev, bool cali_en) · 8 unmodified lines | |||
| 1488 | regmap_update_bits(aw_dev->regmap, AW88399_DBGCTRL_REG, | 1312 | regmap_update_bits(aw_dev->regmap, AW88399_DBGCTRL_REG, |
| 1489 | ~AW883XX_DSP_NG_EN_MASK, AW883XX_DSP_NG_EN_DISABLE_VALUE); | 1313 | ~AW883XX_DSP_NG_EN_MASK, AW883XX_DSP_NG_EN_DISABLE_VALUE); |
| 1490 | aw_dev_dsp_write(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, | 1314 | aw_dev_dsp_write(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, |
| 1491 | AW88399_DSP_LOW_POWER_SWITCH_DISABLE, AW88399_DSP_16_DATA); | 1315 | AW88399_DSP_LOW_POWER_SWITCH_DISABLE, AW_DSP_16_DATA); |
| 1492 | 1316 | ||
| 1493 | ret = aw_cali_svc_get_cali_cfg(aw_dev); | 1317 | ret = aw_cali_svc_get_cali_cfg(aw_dev); |
| 1494 | if (ret) { | 1318 | if (ret) { |
| @@ -1548,8 +1372,7 @@ static void aw_cali_svc_backup_info(struct aw_device *aw_dev) · 53 unmodified lines | |||
| 1548 | regmap_read(aw_dev->regmap, AW88399_DBGCTRL_REG, ®_val); | 1372 | regmap_read(aw_dev->regmap, AW88399_DBGCTRL_REG, ®_val); |
| 1549 | backup_desc->dsp_ng_cfg = reg_val & (~AW883XX_DSP_NG_EN_MASK); | 1373 | backup_desc->dsp_ng_cfg = reg_val & (~AW883XX_DSP_NG_EN_MASK); |
| 1550 | 1374 | ||
| 1551 | aw_dev_dsp_read(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, | 1375 | aw_dev_dsp_read(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, &dsp_val, AW_DSP_16_DATA); |
| 1552 | &dsp_val, AW88399_DSP_16_DATA); | ||
| 1553 | 1376 | ||
| 1554 | backup_desc->dsp_lp_cfg = dsp_val; | 1377 | backup_desc->dsp_lp_cfg = dsp_val; |
| 1555 | } | 1378 | } |
| @@ -1562,7 +1385,7 @@ static void aw_cali_svc_recover_info(struct aw_device *aw_dev) · 6 unmodified lines | |||
| 1562 | ~AW883XX_DSP_NG_EN_MASK, backup_desc->dsp_ng_cfg); | 1385 | ~AW883XX_DSP_NG_EN_MASK, backup_desc->dsp_ng_cfg); |
| 1563 | 1386 | ||
| 1564 | aw_dev_dsp_write(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, | 1387 | aw_dev_dsp_write(aw_dev, AW88399_DSP_LOW_POWER_SWITCH_CFG_ADDR, |
| 1565 | backup_desc->dsp_lp_cfg, AW88399_DSP_16_DATA); | 1388 | backup_desc->dsp_lp_cfg, AW_DSP_16_DATA); |
| 1566 | } | 1389 | } |
| 1567 | 1390 | ||
| 1568 | static int aw_cali_svc_cali_re_mode_enable(struct aw_device *aw_dev, bool is_enable) | 1391 | static int aw_cali_svc_cali_re_mode_enable(struct aw_device *aw_dev, bool is_enable) |
| @@ -1609,7 +1432,7 @@ static int aw_cali_svc_get_dev_re(struct aw_device *aw_dev, uint32_t *re) · 40 unmodified lines | |||
| 1609 | uint32_t dsp_re, show_re; | 1432 | uint32_t dsp_re, show_re; |
| 1610 | int ret; | 1433 | int ret; |
| 1611 | 1434 | ||
| 1612 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CALRE, &dsp_re, AW88399_DSP_16_DATA); | 1435 | ret = aw_dev_dsp_read(aw_dev, AW88399_DSP_REG_CALRE, &dsp_re, AW_DSP_16_DATA); |
| 1613 | if (ret) | 1436 | if (ret) |
| 1614 | return ret; | 1437 | return ret; |
| 1615 | 1438 | ||
| @@ -1744,7 +1567,7 @@ re_mode_err: · 128 unmodified lines | |||
| 1744 | static int aw88399_get_fade_in_time(struct snd_kcontrol *kcontrol, | 1567 | static int aw88399_get_fade_in_time(struct snd_kcontrol *kcontrol, |
| 1745 | struct snd_ctl_elem_value *ucontrol) | 1568 | struct snd_ctl_elem_value *ucontrol) |
| 1746 | { | 1569 | { |
| 1747 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1570 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1748 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); | 1571 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); |
| 1749 | struct aw_device *aw_dev = aw88399->aw_pa; | 1572 | struct aw_device *aw_dev = aw88399->aw_pa; |
| 1750 | 1573 | ||
| @@ -1756,7 +1579,7 @@ static int aw88399_get_fade_in_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1756 | static int aw88399_set_fade_in_time(struct snd_kcontrol *kcontrol, | 1579 | static int aw88399_set_fade_in_time(struct snd_kcontrol *kcontrol, |
| 1757 | struct snd_ctl_elem_value *ucontrol) | 1580 | struct snd_ctl_elem_value *ucontrol) |
| 1758 | { | 1581 | { |
| 1759 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1582 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1760 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); | 1583 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); |
| 1761 | struct soc_mixer_control *mc = | 1584 | struct soc_mixer_control *mc = |
| 1762 | (struct soc_mixer_control *)kcontrol->private_value; | 1585 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1779,7 +1602,7 @@ static int aw88399_set_fade_in_time(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 1779 | static int aw88399_get_fade_out_time(struct snd_kcontrol *kcontrol, | 1602 | static int aw88399_get_fade_out_time(struct snd_kcontrol *kcontrol, |
| 1780 | struct snd_ctl_elem_value *ucontrol) | 1603 | struct snd_ctl_elem_value *ucontrol) |
| 1781 | { | 1604 | { |
| 1782 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1605 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1783 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); | 1606 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); |
| 1784 | struct aw_device *aw_dev = aw88399->aw_pa; | 1607 | struct aw_device *aw_dev = aw88399->aw_pa; |
| 1785 | 1608 | ||
| @@ -1791,7 +1614,7 @@ static int aw88399_get_fade_out_time(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1791 | static int aw88399_set_fade_out_time(struct snd_kcontrol *kcontrol, | 1614 | static int aw88399_set_fade_out_time(struct snd_kcontrol *kcontrol, |
| 1792 | struct snd_ctl_elem_value *ucontrol) | 1615 | struct snd_ctl_elem_value *ucontrol) |
| 1793 | { | 1616 | { |
| 1794 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1617 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1795 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); | 1618 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(component); |
| 1796 | struct soc_mixer_control *mc = | 1619 | struct soc_mixer_control *mc = |
| 1797 | (struct soc_mixer_control *)kcontrol->private_value; | 1620 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1829,7 +1652,7 @@ static int aw88399_dev_set_profile_index(struct aw_device *aw_dev, int index) · 31 unmodified lines | |||
| 1829 | static int aw88399_profile_info(struct snd_kcontrol *kcontrol, | 1652 | static int aw88399_profile_info(struct snd_kcontrol *kcontrol, |
| 1830 | struct snd_ctl_elem_info *uinfo) | 1653 | struct snd_ctl_elem_info *uinfo) |
| 1831 | { | 1654 | { |
| 1832 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1655 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1833 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1656 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1834 | char *prof_name; | 1657 | char *prof_name; |
| 1835 | int count, ret; | 1658 | int count, ret; |
| @@ -1864,7 +1687,7 @@ static int aw88399_profile_info(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 1864 | static int aw88399_profile_get(struct snd_kcontrol *kcontrol, | 1687 | static int aw88399_profile_get(struct snd_kcontrol *kcontrol, |
| 1865 | struct snd_ctl_elem_value *ucontrol) | 1688 | struct snd_ctl_elem_value *ucontrol) |
| 1866 | { | 1689 | { |
| 1867 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1690 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1868 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1691 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1869 | 1692 | ||
| 1870 | ucontrol->value.integer.value[0] = aw88399->aw_pa->prof_index; | 1693 | ucontrol->value.integer.value[0] = aw88399->aw_pa->prof_index; |
| @@ -1875,7 +1698,7 @@ static int aw88399_profile_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1875 | static int aw88399_profile_set(struct snd_kcontrol *kcontrol, | 1698 | static int aw88399_profile_set(struct snd_kcontrol *kcontrol, |
| 1876 | struct snd_ctl_elem_value *ucontrol) | 1699 | struct snd_ctl_elem_value *ucontrol) |
| 1877 | { | 1700 | { |
| 1878 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1701 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1879 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1702 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1880 | int ret; | 1703 | int ret; |
| 1881 | 1704 | ||
| @@ -1900,7 +1723,7 @@ static int aw88399_profile_set(struct snd_kcontrol *kcontrol, · 18 unmodified lines | |||
| 1900 | static int aw88399_volume_get(struct snd_kcontrol *kcontrol, | 1723 | static int aw88399_volume_get(struct snd_kcontrol *kcontrol, |
| 1901 | struct snd_ctl_elem_value *ucontrol) | 1724 | struct snd_ctl_elem_value *ucontrol) |
| 1902 | { | 1725 | { |
| 1903 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1726 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1904 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1727 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1905 | struct aw_volume_desc *vol_desc = &aw88399->aw_pa->volume_desc; | 1728 | struct aw_volume_desc *vol_desc = &aw88399->aw_pa->volume_desc; |
| 1906 | 1729 | ||
| @@ -1912,7 +1735,7 @@ static int aw88399_volume_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1912 | static int aw88399_volume_set(struct snd_kcontrol *kcontrol, | 1735 | static int aw88399_volume_set(struct snd_kcontrol *kcontrol, |
| 1913 | struct snd_ctl_elem_value *ucontrol) | 1736 | struct snd_ctl_elem_value *ucontrol) |
| 1914 | { | 1737 | { |
| 1915 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1738 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1916 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1739 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1917 | struct aw_volume_desc *vol_desc = &aw88399->aw_pa->volume_desc; | 1740 | struct aw_volume_desc *vol_desc = &aw88399->aw_pa->volume_desc; |
| 1918 | struct soc_mixer_control *mc = | 1741 | struct soc_mixer_control *mc = |
| @@ -1936,7 +1759,7 @@ static int aw88399_volume_set(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 1936 | static int aw88399_get_fade_step(struct snd_kcontrol *kcontrol, | 1759 | static int aw88399_get_fade_step(struct snd_kcontrol *kcontrol, |
| 1937 | struct snd_ctl_elem_value *ucontrol) | 1760 | struct snd_ctl_elem_value *ucontrol) |
| 1938 | { | 1761 | { |
| 1939 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1762 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1940 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1763 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1941 | 1764 | ||
| 1942 | ucontrol->value.integer.value[0] = aw88399->aw_pa->fade_step; | 1765 | ucontrol->value.integer.value[0] = aw88399->aw_pa->fade_step; |
| @@ -1947,7 +1770,7 @@ static int aw88399_get_fade_step(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1947 | static int aw88399_set_fade_step(struct snd_kcontrol *kcontrol, | 1770 | static int aw88399_set_fade_step(struct snd_kcontrol *kcontrol, |
| 1948 | struct snd_ctl_elem_value *ucontrol) | 1771 | struct snd_ctl_elem_value *ucontrol) |
| 1949 | { | 1772 | { |
| 1950 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1773 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1951 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1774 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1952 | struct soc_mixer_control *mc = | 1775 | struct soc_mixer_control *mc = |
| 1953 | (struct soc_mixer_control *)kcontrol->private_value; | 1776 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1968,7 +1791,7 @@ static int aw88399_set_fade_step(struct snd_kcontrol *kcontrol, · 14 unmodified lines | |||
| 1968 | static int aw88399_re_get(struct snd_kcontrol *kcontrol, | 1791 | static int aw88399_re_get(struct snd_kcontrol *kcontrol, |
| 1969 | struct snd_ctl_elem_value *ucontrol) | 1792 | struct snd_ctl_elem_value *ucontrol) |
| 1970 | { | 1793 | { |
| 1971 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1794 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1972 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1795 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1973 | struct aw_device *aw_dev = aw88399->aw_pa; | 1796 | struct aw_device *aw_dev = aw88399->aw_pa; |
| 1974 | 1797 | ||
| @@ -1980,7 +1803,7 @@ static int aw88399_re_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1980 | static int aw88399_re_set(struct snd_kcontrol *kcontrol, | 1803 | static int aw88399_re_set(struct snd_kcontrol *kcontrol, |
| 1981 | struct snd_ctl_elem_value *ucontrol) | 1804 | struct snd_ctl_elem_value *ucontrol) |
| 1982 | { | 1805 | { |
| 1983 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1806 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1984 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1807 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 1985 | struct soc_mixer_control *mc = | 1808 | struct soc_mixer_control *mc = |
| 1986 | (struct soc_mixer_control *)kcontrol->private_value; | 1809 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -2002,7 +1825,7 @@ static int aw88399_re_set(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 2002 | static int aw88399_calib_switch_get(struct snd_kcontrol *kcontrol, | 1825 | static int aw88399_calib_switch_get(struct snd_kcontrol *kcontrol, |
| 2003 | struct snd_ctl_elem_value *ucontrol) | 1826 | struct snd_ctl_elem_value *ucontrol) |
| 2004 | { | 1827 | { |
| 2005 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1828 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 2006 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1829 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 2007 | struct aw_device *aw_dev = aw88399->aw_pa; | 1830 | struct aw_device *aw_dev = aw88399->aw_pa; |
| 2008 | 1831 | ||
| @@ -2014,7 +1837,7 @@ static int aw88399_calib_switch_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 2014 | static int aw88399_calib_switch_set(struct snd_kcontrol *kcontrol, | 1837 | static int aw88399_calib_switch_set(struct snd_kcontrol *kcontrol, |
| 2015 | struct snd_ctl_elem_value *ucontrol) | 1838 | struct snd_ctl_elem_value *ucontrol) |
| 2016 | { | 1839 | { |
| 2017 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1840 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 2018 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1841 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 2019 | struct aw_device *aw_dev = aw88399->aw_pa; | 1842 | struct aw_device *aw_dev = aw88399->aw_pa; |
| 2020 | 1843 | ||
| @@ -2036,7 +1859,7 @@ static int aw88399_calib_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 2036 | static int aw88399_calib_set(struct snd_kcontrol *kcontrol, | 1859 | static int aw88399_calib_set(struct snd_kcontrol *kcontrol, |
| 2037 | struct snd_ctl_elem_value *ucontrol) | 1860 | struct snd_ctl_elem_value *ucontrol) |
| 2038 | { | 1861 | { |
| 2039 | struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol); | 1862 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 2040 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); | 1863 | struct aw88399 *aw88399 = snd_soc_component_get_drvdata(codec); |
| 2041 | struct aw_device *aw_dev = aw88399->aw_pa; | 1864 | struct aw_device *aw_dev = aw88399->aw_pa; |
| 2042 | 1865 | ||
| @@ -602,11 +602,6 @@ enum AW88399_DEV_DSP_CFG { · 601 unmodified lines | |||
| 602 | AW88399_DEV_DSP_BYPASS = 1, | 602 | AW88399_DEV_DSP_BYPASS = 1, |
| 603 | }; | 603 | }; |
| 604 | 604 | ||
| 605 | enum { | ||
| 606 | AW88399_DSP_16_DATA = 0, | ||
| 607 | AW88399_DSP_32_DATA = 1, | ||
| 608 | }; | ||
| 609 | |||
| 610 | enum { | 605 | enum { |
| 611 | AW88399_NOT_RCV_MODE = 0, | 606 | AW88399_NOT_RCV_MODE = 0, |
| 612 | AW88399_RCV_MODE = 1, | 607 | AW88399_RCV_MODE = 1, |
| @@ -70,8 +70,7 @@ static void bd28623_power_off(struct bd28623_priv *bd) · 69 unmodified lines | |||
| 70 | static int bd28623_get_switch_spk(struct snd_kcontrol *kcontrol, | 70 | static int bd28623_get_switch_spk(struct snd_kcontrol *kcontrol, |
| 71 | struct snd_ctl_elem_value *ucontrol) | 71 | struct snd_ctl_elem_value *ucontrol) |
| 72 | { | 72 | { |
| 73 | struct snd_soc_component *component = | 73 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 74 | snd_soc_kcontrol_component(kcontrol); | ||
| 75 | struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); | 74 | struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); |
| 76 | 75 | ||
| 77 | ucontrol->value.integer.value[0] = bd->switch_spk; | 76 | ucontrol->value.integer.value[0] = bd->switch_spk; |
| @@ -82,8 +81,7 @@ static int bd28623_get_switch_spk(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 82 | static int bd28623_set_switch_spk(struct snd_kcontrol *kcontrol, | 81 | static int bd28623_set_switch_spk(struct snd_kcontrol *kcontrol, |
| 83 | struct snd_ctl_elem_value *ucontrol) | 82 | struct snd_ctl_elem_value *ucontrol) |
| 84 | { | 83 | { |
| 85 | struct snd_soc_component *component = | 84 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 86 | snd_soc_kcontrol_component(kcontrol); | ||
| 87 | struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); | 85 | struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); |
| 88 | 86 | ||
| 89 | if (bd->switch_spk == ucontrol->value.integer.value[0]) | 87 | if (bd->switch_spk == ucontrol->value.integer.value[0]) |
| @@ -380,7 +380,7 @@ static SOC_ENUM_SINGLE_DECL(cpcap_emu_r_mux_enum, 0, 8, cpcap_out_mux_texts); · 379 unmodified lines | |||
| 380 | static int cpcap_output_mux_get_enum(struct snd_kcontrol *kcontrol, | 380 | static int cpcap_output_mux_get_enum(struct snd_kcontrol *kcontrol, |
| 381 | struct snd_ctl_elem_value *ucontrol) | 381 | struct snd_ctl_elem_value *ucontrol) |
| 382 | { | 382 | { |
| 383 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 383 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 384 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); | 384 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); |
| 385 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 385 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 386 | unsigned int shift = e->shift_l; | 386 | unsigned int shift = e->shift_l; |
| @@ -423,10 +423,9 @@ static int cpcap_output_mux_get_enum(struct snd_kcontrol *kcontrol, · 36 unmodified lines | |||
| 423 | static int cpcap_output_mux_put_enum(struct snd_kcontrol *kcontrol, | 423 | static int cpcap_output_mux_put_enum(struct snd_kcontrol *kcontrol, |
| 424 | struct snd_ctl_elem_value *ucontrol) | 424 | struct snd_ctl_elem_value *ucontrol) |
| 425 | { | 425 | { |
| 426 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 426 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 427 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); | 427 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); |
| 428 | struct snd_soc_dapm_context *dapm = | 428 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 429 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 430 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 429 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 431 | unsigned int muxval = ucontrol->value.enumerated.item[0]; | 430 | unsigned int muxval = ucontrol->value.enumerated.item[0]; |
| 432 | unsigned int mask = BIT(e->shift_l); | 431 | unsigned int mask = BIT(e->shift_l); |
| @@ -468,7 +467,7 @@ static int cpcap_output_mux_put_enum(struct snd_kcontrol *kcontrol, · 35 unmodified lines | |||
| 468 | static int cpcap_input_right_mux_get_enum(struct snd_kcontrol *kcontrol, | 467 | static int cpcap_input_right_mux_get_enum(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) | 468 | struct snd_ctl_elem_value *ucontrol) |
| 470 | { | 469 | { |
| 471 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 470 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 472 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); | 471 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); |
| 473 | int regval, mask; | 472 | int regval, mask; |
| 474 | int err; | 473 | int err; |
| @@ -507,10 +506,9 @@ static int cpcap_input_right_mux_get_enum(struct snd_kcontrol *kcontrol, · 32 unmodified lines | |||
| 507 | static int cpcap_input_right_mux_put_enum(struct snd_kcontrol *kcontrol, | 506 | static int cpcap_input_right_mux_put_enum(struct snd_kcontrol *kcontrol, |
| 508 | struct snd_ctl_elem_value *ucontrol) | 507 | struct snd_ctl_elem_value *ucontrol) |
| 509 | { | 508 | { |
| 510 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 509 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 511 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); | 510 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); |
| 512 | struct snd_soc_dapm_context *dapm = | 511 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 513 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 514 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 512 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 515 | unsigned int muxval = ucontrol->value.enumerated.item[0]; | 513 | unsigned int muxval = ucontrol->value.enumerated.item[0]; |
| 516 | int regval = 0, mask; | 514 | int regval = 0, mask; |
| @@ -552,7 +550,7 @@ static int cpcap_input_right_mux_put_enum(struct snd_kcontrol *kcontrol, · 35 unmodified lines | |||
| 552 | static int cpcap_input_left_mux_get_enum(struct snd_kcontrol *kcontrol, | 550 | static int cpcap_input_left_mux_get_enum(struct snd_kcontrol *kcontrol, |
| 553 | struct snd_ctl_elem_value *ucontrol) | 551 | struct snd_ctl_elem_value *ucontrol) |
| 554 | { | 552 | { |
| 555 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 553 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 556 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); | 554 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); |
| 557 | int regval, mask; | 555 | int regval, mask; |
| 558 | int err; | 556 | int err; |
| @@ -583,10 +581,9 @@ static int cpcap_input_left_mux_get_enum(struct snd_kcontrol *kcontrol, · 24 unmodified lines | |||
| 583 | static int cpcap_input_left_mux_put_enum(struct snd_kcontrol *kcontrol, | 581 | static int cpcap_input_left_mux_put_enum(struct snd_kcontrol *kcontrol, |
| 584 | struct snd_ctl_elem_value *ucontrol) | 582 | struct snd_ctl_elem_value *ucontrol) |
| 585 | { | 583 | { |
| 586 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 584 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 587 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); | 585 | struct cpcap_audio *cpcap = snd_soc_component_get_drvdata(component); |
| 588 | struct snd_soc_dapm_context *dapm = | 586 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 589 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 590 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 587 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 591 | unsigned int muxval = ucontrol->value.enumerated.item[0]; | 588 | unsigned int muxval = ucontrol->value.enumerated.item[0]; |
| 592 | int regval = 0, mask; | 589 | int regval = 0, mask; |
| @@ -108,8 +108,7 @@ error: · 107 unmodified lines | |||
| 108 | static int dmic_get_gain(struct snd_kcontrol *kcontrol, | 108 | static int dmic_get_gain(struct snd_kcontrol *kcontrol, |
| 109 | struct snd_ctl_elem_value *ucontrol) | 109 | struct snd_ctl_elem_value *ucontrol) |
| 110 | { | 110 | { |
| 111 | struct snd_soc_component *component = | 111 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 112 | snd_soc_kcontrol_component(kcontrol); | ||
| 113 | struct cros_ec_codec_priv *priv = | 112 | struct cros_ec_codec_priv *priv = |
| 114 | snd_soc_component_get_drvdata(component); | 113 | snd_soc_component_get_drvdata(component); |
| 115 | struct ec_param_ec_codec_dmic p; | 114 | struct ec_param_ec_codec_dmic p; |
| @@ -140,8 +139,7 @@ static int dmic_get_gain(struct snd_kcontrol *kcontrol, · 24 unmodified lines | |||
| 140 | static int dmic_put_gain(struct snd_kcontrol *kcontrol, | 139 | static int dmic_put_gain(struct snd_kcontrol *kcontrol, |
| 141 | struct snd_ctl_elem_value *ucontrol) | 140 | struct snd_ctl_elem_value *ucontrol) |
| 142 | { | 141 | { |
| 143 | struct snd_soc_component *component = | 142 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 144 | snd_soc_kcontrol_component(kcontrol); | ||
| 145 | struct cros_ec_codec_priv *priv = | 143 | struct cros_ec_codec_priv *priv = |
| 146 | snd_soc_component_get_drvdata(component); | 144 | snd_soc_component_get_drvdata(component); |
| 147 | struct soc_mixer_control *control = | 145 | struct soc_mixer_control *control = |
| @@ -633,7 +631,7 @@ leave: · 485 unmodified lines | |||
| 633 | static int wov_enable_get(struct snd_kcontrol *kcontrol, | 631 | static int wov_enable_get(struct snd_kcontrol *kcontrol, |
| 634 | struct snd_ctl_elem_value *ucontrol) | 632 | struct snd_ctl_elem_value *ucontrol) |
| 635 | { | 633 | { |
| 636 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 634 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 637 | struct cros_ec_codec_priv *priv = snd_soc_component_get_drvdata(c); | 635 | struct cros_ec_codec_priv *priv = snd_soc_component_get_drvdata(c); |
| 638 | 636 | ||
| 639 | ucontrol->value.integer.value[0] = priv->wov_enabled; | 637 | ucontrol->value.integer.value[0] = priv->wov_enabled; |
| @@ -643,7 +641,7 @@ static int wov_enable_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 643 | static int wov_enable_put(struct snd_kcontrol *kcontrol, | 641 | static int wov_enable_put(struct snd_kcontrol *kcontrol, |
| 644 | struct snd_ctl_elem_value *ucontrol) | 642 | struct snd_ctl_elem_value *ucontrol) |
| 645 | { | 643 | { |
| 646 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 644 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 647 | struct cros_ec_codec_priv *priv = snd_soc_component_get_drvdata(c); | 645 | struct cros_ec_codec_priv *priv = snd_soc_component_get_drvdata(c); |
| 648 | int enabled = ucontrol->value.integer.value[0]; | 646 | int enabled = ucontrol->value.integer.value[0]; |
| 649 | struct ec_param_ec_codec_wov p; | 647 | struct ec_param_ec_codec_wov p; |
| @@ -20,6 +20,10 @@ · 19 unmodified lines | |||
| 20 | #include <linux/random.h> | 20 | #include <linux/random.h> |
| 21 | #include <sound/cs-amp-lib.h> | 21 | #include <sound/cs-amp-lib.h> |
| 22 | 22 | ||
| 23 | #define CIRRUS_LOGIC_CALIBRATION_EFI_NAME L"CirrusSmartAmpCalibrationData" | ||
| 24 | #define CIRRUS_LOGIC_CALIBRATION_EFI_GUID \ | ||
| 25 | EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, 0x5a, 0xa3, 0x5d, 0xb3) | ||
| 26 | |||
| 23 | #define LENOVO_SPEAKER_ID_EFI_NAME L"SdwSpeaker" | 27 | #define LENOVO_SPEAKER_ID_EFI_NAME L"SdwSpeaker" |
| 24 | #define LENOVO_SPEAKER_ID_EFI_GUID \ | 28 | #define LENOVO_SPEAKER_ID_EFI_GUID \ |
| 25 | EFI_GUID(0x48df970e, 0xe27f, 0x460a, 0xb5, 0x86, 0x77, 0x19, 0x80, 0x1d, 0x92, 0x82) | 29 | EFI_GUID(0x48df970e, 0xe27f, 0x460a, 0xb5, 0x86, 0x77, 0x19, 0x80, 0x1d, 0x92, 0x82) |
| @@ -28,6 +32,10 @@ · 2 unmodified lines | |||
| 28 | #define HP_SPEAKER_ID_EFI_GUID \ | 32 | #define HP_SPEAKER_ID_EFI_GUID \ |
| 29 | EFI_GUID(0xc49593a4, 0xd099, 0x419b, 0xa2, 0xc3, 0x67, 0xe9, 0x80, 0xe6, 0x1d, 0x1e) | 33 | EFI_GUID(0xc49593a4, 0xd099, 0x419b, 0xa2, 0xc3, 0x67, 0xe9, 0x80, 0xe6, 0x1d, 0x1e) |
| 30 | 34 | ||
| 35 | #define HP_CALIBRATION_EFI_NAME L"SmartAmpCalibrationData" | ||
| 36 | #define HP_CALIBRATION_EFI_GUID \ | ||
| 37 | EFI_GUID(0x53559579, 0x8753, 0x4f5c, 0x91, 0x30, 0xe8, 0x2a, 0xcf, 0xb8, 0xd8, 0x93) | ||
| 38 | |||
| 31 | KUNIT_DEFINE_ACTION_WRAPPER(faux_device_destroy_wrapper, faux_device_destroy, | 39 | KUNIT_DEFINE_ACTION_WRAPPER(faux_device_destroy_wrapper, faux_device_destroy, |
| 32 | struct faux_device *) | 40 | struct faux_device *) |
| 33 | 41 | ||
| @@ -36,6 +44,7 @@ struct cs_amp_lib_test_priv { · 2 unmodified lines | |||
| 36 | 44 | ||
| 37 | struct cirrus_amp_efi_data *cal_blob; | 45 | struct cirrus_amp_efi_data *cal_blob; |
| 38 | struct list_head ctl_write_list; | 46 | struct list_head ctl_write_list; |
| 47 | u32 efi_attr; | ||
| 39 | }; | 48 | }; |
| 40 | 49 | ||
| 41 | struct cs_amp_lib_test_ctl_write_entry { | 50 | struct cs_amp_lib_test_ctl_write_entry { |
| @@ -49,6 +58,20 @@ struct cs_amp_lib_test_param { · 7 unmodified lines | |||
| 49 | int amp_index; | 58 | int amp_index; |
| 50 | }; | 59 | }; |
| 51 | 60 | ||
| 61 | static struct cirrus_amp_efi_data *cs_amp_lib_test_cal_blob_dup(struct kunit *test) | ||
| 62 | { | ||
| 63 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 64 | struct cirrus_amp_efi_data *temp; | ||
| 65 | |||
| 66 | KUNIT_ASSERT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 67 | priv->cal_blob->size); | ||
| 68 | temp = kunit_kmalloc(test, priv->cal_blob->size, GFP_KERNEL); | ||
| 69 | KUNIT_ASSERT_NOT_NULL(test, temp); | ||
| 70 | memcpy(temp, priv->cal_blob, priv->cal_blob->size); | ||
| 71 | |||
| 72 | return temp; | ||
| 73 | } | ||
| 74 | |||
| 52 | static void cs_amp_lib_test_init_dummy_cal_blob(struct kunit *test, int num_amps) | 75 | static void cs_amp_lib_test_init_dummy_cal_blob(struct kunit *test, int num_amps) |
| 53 | { | 76 | { |
| 54 | struct cs_amp_lib_test_priv *priv = test->priv; | 77 | struct cs_amp_lib_test_priv *priv = test->priv; |
| @@ -69,9 +92,15 @@ static void cs_amp_lib_test_init_dummy_cal_blob(struct kunit *test, int num_amps · 14 unmodified lines | |||
| 69 | for (i = 0; i < num_amps; i++) | 92 | for (i = 0; i < num_amps; i++) |
| 70 | priv->cal_blob->data[i].calTime[0] |= 1; | 93 | priv->cal_blob->data[i].calTime[0] |= 1; |
| 71 | 94 | ||
| 72 | /* Ensure that all UIDs are non-zero and unique. */ | 95 | /* |
| 73 | for (i = 0; i < num_amps; i++) | 96 | * Ensure that all UIDs are non-zero and unique. |
| 97 | * Make both words non-zero and not equal values, so that | ||
| 98 | * tests can verify that both words were checked or changed. | ||
| 99 | */ | ||
| 100 | for (i = 0; i < num_amps; i++) { | ||
| 74 | *(u8 *)&priv->cal_blob->data[i].calTarget[0] = i + 1; | 101 | *(u8 *)&priv->cal_blob->data[i].calTarget[0] = i + 1; |
| 102 | *(u8 *)&priv->cal_blob->data[i].calTarget[1] = i; | ||
| 103 | } | ||
| 75 | } | 104 | } |
| 76 | 105 | ||
| 77 | static u64 cs_amp_lib_test_get_target_uid(struct kunit *test) | 106 | static u64 cs_amp_lib_test_get_target_uid(struct kunit *test) |
| @@ -90,6 +119,7 @@ static u64 cs_amp_lib_test_get_target_uid(struct kunit *test) · 12 unmodified lines | |||
| 90 | /* Redirected get_efi_variable to simulate that the file is too short */ | 119 | /* Redirected get_efi_variable to simulate that the file is too short */ |
| 91 | static efi_status_t cs_amp_lib_test_get_efi_variable_nohead(efi_char16_t *name, | 120 | static efi_status_t cs_amp_lib_test_get_efi_variable_nohead(efi_char16_t *name, |
| 92 | efi_guid_t *guid, | 121 | efi_guid_t *guid, |
| 122 | u32 *returned_attr, | ||
| 93 | unsigned long *size, | 123 | unsigned long *size, |
| 94 | void *buf) | 124 | void *buf) |
| 95 | { | 125 | { |
| @@ -115,13 +145,12 @@ static void cs_amp_lib_test_cal_data_too_short_test(struct kunit *test) · 19 unmodified lines | |||
| 115 | 145 | ||
| 116 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data); | 146 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data); |
| 117 | KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW); | 147 | KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW); |
| 118 | |||
| 119 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 120 | } | 148 | } |
| 121 | 149 | ||
| 122 | /* Redirected get_efi_variable to simulate that the count is larger than the file */ | 150 | /* Redirected get_efi_variable to simulate that the count is larger than the file */ |
| 123 | static efi_status_t cs_amp_lib_test_get_efi_variable_bad_count(efi_char16_t *name, | 151 | static efi_status_t cs_amp_lib_test_get_efi_variable_bad_count(efi_char16_t *name, |
| 124 | efi_guid_t *guid, | 152 | efi_guid_t *guid, |
| 153 | u32 *returned_attr, | ||
| 125 | unsigned long *size, | 154 | unsigned long *size, |
| 126 | void *buf) | 155 | void *buf) |
| 127 | { | 156 | { |
| @@ -158,13 +187,12 @@ static void cs_amp_lib_test_cal_count_too_big_test(struct kunit *test) · 30 unmodified lines | |||
| 158 | 187 | ||
| 159 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data); | 188 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data); |
| 160 | KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW); | 189 | KUNIT_EXPECT_EQ(test, ret, -EOVERFLOW); |
| 161 | |||
| 162 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 163 | } | 190 | } |
| 164 | 191 | ||
| 165 | /* Redirected get_efi_variable to simulate that the variable not found */ | 192 | /* Redirected get_efi_variable to simulate that the variable not found */ |
| 166 | static efi_status_t cs_amp_lib_test_get_efi_variable_none(efi_char16_t *name, | 193 | static efi_status_t cs_amp_lib_test_get_efi_variable_none(efi_char16_t *name, |
| 167 | efi_guid_t *guid, | 194 | efi_guid_t *guid, |
| 195 | u32 *returned_attr, | ||
| 168 | unsigned long *size, | 196 | unsigned long *size, |
| 169 | void *buf) | 197 | void *buf) |
| 170 | { | 198 | { |
| @@ -185,19 +213,17 @@ static void cs_amp_lib_test_no_cal_data_test(struct kunit *test) · 14 unmodified lines | |||
| 185 | 213 | ||
| 186 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data); | 214 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &result_data); |
| 187 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 215 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 188 | |||
| 189 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 190 | } | 216 | } |
| 191 | 217 | ||
| 192 | /* Redirected get_efi_variable to simulate reading a cal data blob */ | 218 | /* Redirected get_efi_variable to simulate reading a cal data blob */ |
| 193 | static efi_status_t cs_amp_lib_test_get_efi_variable(efi_char16_t *name, | 219 | static efi_status_t cs_amp_lib_test_get_efi_variable(efi_char16_t *name, |
| 194 | efi_guid_t *guid, | 220 | efi_guid_t *guid, |
| 221 | u32 *returned_attr, | ||
| 195 | unsigned long *size, | 222 | unsigned long *size, |
| 196 | void *buf) | 223 | void *buf) |
| 197 | { | 224 | { |
| 198 | static const efi_char16_t expected_name[] = L"CirrusSmartAmpCalibrationData"; | 225 | static const efi_char16_t expected_name[] = CIRRUS_LOGIC_CALIBRATION_EFI_NAME; |
| 199 | static const efi_guid_t expected_guid = | 226 | static const efi_guid_t expected_guid = CIRRUS_LOGIC_CALIBRATION_EFI_GUID; |
| 200 | EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, 0x5a, 0xa3, 0x5d, 0xb3); | ||
| 201 | struct kunit *test = kunit_get_current_test(); | 227 | struct kunit *test = kunit_get_current_test(); |
| 202 | struct cs_amp_lib_test_priv *priv = test->priv; | 228 | struct cs_amp_lib_test_priv *priv = test->priv; |
| 203 | 229 | ||
| @@ -218,11 +244,65 @@ static efi_status_t cs_amp_lib_test_get_efi_variable(efi_char16_t *name, · 14 unmodified lines | |||
| 218 | 244 | ||
| 219 | memcpy(buf, priv->cal_blob, priv->cal_blob->size); | 245 | memcpy(buf, priv->cal_blob, priv->cal_blob->size); |
| 220 | 246 | ||
| 247 | if (returned_attr) { | ||
| 248 | if (priv->efi_attr) | ||
| 249 | *returned_attr = priv->efi_attr; | ||
| 250 | else | ||
| 251 | *returned_attr = EFI_VARIABLE_NON_VOLATILE | | ||
| 252 | EFI_VARIABLE_BOOTSERVICE_ACCESS | | ||
| 253 | EFI_VARIABLE_RUNTIME_ACCESS; | ||
| 254 | } | ||
| 255 | |||
| 256 | return EFI_SUCCESS; | ||
| 257 | } | ||
| 258 | |||
| 259 | #define CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE \ | ||
| 260 | struct_size_t(struct cirrus_amp_efi_data, data, 8) | ||
| 261 | |||
| 262 | /* Redirected get_efi_variable to simulate reading a prealloced zero-filled blob */ | ||
| 263 | static efi_status_t cs_amp_lib_test_get_efi_variable_all_zeros(efi_char16_t *name, | ||
| 264 | efi_guid_t *guid, | ||
| 265 | u32 *returned_attr, | ||
| 266 | unsigned long *size, | ||
| 267 | void *buf) | ||
| 268 | { | ||
| 269 | static const efi_char16_t expected_name[] = CIRRUS_LOGIC_CALIBRATION_EFI_NAME; | ||
| 270 | static const efi_guid_t expected_guid = CIRRUS_LOGIC_CALIBRATION_EFI_GUID; | ||
| 271 | struct kunit *test = kunit_get_current_test(); | ||
| 272 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 273 | |||
| 274 | KUNIT_EXPECT_NOT_ERR_OR_NULL(test, name); | ||
| 275 | KUNIT_EXPECT_NOT_ERR_OR_NULL(test, guid); | ||
| 276 | |||
| 277 | if (memcmp(name, expected_name, sizeof(expected_name)) || | ||
| 278 | efi_guidcmp(*guid, expected_guid)) | ||
| 279 | return -EFI_NOT_FOUND; | ||
| 280 | |||
| 281 | if (!buf) { | ||
| 282 | *size = CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE; | ||
| 283 | return EFI_BUFFER_TOO_SMALL; | ||
| 284 | } | ||
| 285 | |||
| 286 | KUNIT_ASSERT_EQ(test, *size, struct_size(priv->cal_blob, data, 8)); | ||
| 287 | priv->cal_blob = kunit_kzalloc(test, CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE, GFP_KERNEL); | ||
| 288 | KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob); | ||
| 289 | memset(buf, 0, CS_AMP_LIB_ZERO_FILLED_BLOB_SIZE); | ||
| 290 | |||
| 291 | if (returned_attr) { | ||
| 292 | if (priv->efi_attr) | ||
| 293 | *returned_attr = priv->efi_attr; | ||
| 294 | else | ||
| 295 | *returned_attr = EFI_VARIABLE_NON_VOLATILE | | ||
| 296 | EFI_VARIABLE_BOOTSERVICE_ACCESS | | ||
| 297 | EFI_VARIABLE_RUNTIME_ACCESS; | ||
| 298 | } | ||
| 299 | |||
| 221 | return EFI_SUCCESS; | 300 | return EFI_SUCCESS; |
| 222 | } | 301 | } |
| 223 | 302 | ||
| 224 | static efi_status_t cs_amp_lib_test_get_hp_cal_efi_variable(efi_char16_t *name, | 303 | static efi_status_t cs_amp_lib_test_get_hp_cal_efi_variable(efi_char16_t *name, |
| 225 | efi_guid_t *guid, | 304 | efi_guid_t *guid, |
| 305 | u32 *returned_attr, | ||
| 226 | unsigned long *size, | 306 | unsigned long *size, |
| 227 | void *buf) | 307 | void *buf) |
| 228 | { | 308 | { |
| @@ -249,6 +329,12 @@ static efi_status_t cs_amp_lib_test_get_hp_cal_efi_variable(efi_char16_t *name, · 20 unmodified lines | |||
| 249 | 329 | ||
| 250 | memcpy(buf, priv->cal_blob, priv->cal_blob->size); | 330 | memcpy(buf, priv->cal_blob, priv->cal_blob->size); |
| 251 | 331 | ||
| 332 | if (returned_attr) { | ||
| 333 | *returned_attr = EFI_VARIABLE_NON_VOLATILE | | ||
| 334 | EFI_VARIABLE_BOOTSERVICE_ACCESS | | ||
| 335 | EFI_VARIABLE_RUNTIME_ACCESS; | ||
| 336 | } | ||
| 337 | |||
| 252 | return EFI_SUCCESS; | 338 | return EFI_SUCCESS; |
| 253 | } | 339 | } |
| 254 | 340 | ||
| @@ -291,8 +377,6 @@ static void cs_amp_lib_test_get_efi_cal_by_uid_test(struct kunit *test) · 36 unmodified lines | |||
| 291 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, target_uid, -1, &result_data); | 377 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, target_uid, -1, &result_data); |
| 292 | KUNIT_EXPECT_EQ(test, ret, 0); | 378 | KUNIT_EXPECT_EQ(test, ret, 0); |
| 293 | 379 | ||
| 294 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 295 | |||
| 296 | KUNIT_EXPECT_EQ(test, result_data.calTarget[0], target_uid & 0xFFFFFFFFULL); | 380 | KUNIT_EXPECT_EQ(test, result_data.calTarget[0], target_uid & 0xFFFFFFFFULL); |
| 297 | KUNIT_EXPECT_EQ(test, result_data.calTarget[1], target_uid >> 32); | 381 | KUNIT_EXPECT_EQ(test, result_data.calTarget[1], target_uid >> 32); |
| 298 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], | 382 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], |
| @@ -326,8 +410,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_unchecked_test(struct kunit *te · 27 unmodified lines | |||
| 326 | param->amp_index, &result_data); | 410 | param->amp_index, &result_data); |
| 327 | KUNIT_EXPECT_EQ(test, ret, 0); | 411 | KUNIT_EXPECT_EQ(test, ret, 0); |
| 328 | 412 | ||
| 329 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 330 | |||
| 331 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], | 413 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], |
| 332 | priv->cal_blob->data[param->amp_index].calTime[0]); | 414 | priv->cal_blob->data[param->amp_index].calTime[0]); |
| 333 | KUNIT_EXPECT_EQ(test, result_data.calTime[1], | 415 | KUNIT_EXPECT_EQ(test, result_data.calTime[1], |
| @@ -361,8 +443,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_checked_test(struct kunit *test · 27 unmodified lines | |||
| 361 | param->amp_index, &result_data); | 443 | param->amp_index, &result_data); |
| 362 | KUNIT_EXPECT_EQ(test, ret, 0); | 444 | KUNIT_EXPECT_EQ(test, ret, 0); |
| 363 | 445 | ||
| 364 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 365 | |||
| 366 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], | 446 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], |
| 367 | priv->cal_blob->data[param->amp_index].calTime[0]); | 447 | priv->cal_blob->data[param->amp_index].calTime[0]); |
| 368 | KUNIT_EXPECT_EQ(test, result_data.calTime[1], | 448 | KUNIT_EXPECT_EQ(test, result_data.calTime[1], |
| @@ -399,8 +479,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_uid_mismatch_test(struct kunit · 30 unmodified lines | |||
| 399 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, target_uid, | 479 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, target_uid, |
| 400 | param->amp_index, &result_data); | 480 | param->amp_index, &result_data); |
| 401 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 481 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 402 | |||
| 403 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 404 | } | 482 | } |
| 405 | 483 | ||
| 406 | /* | 484 | /* |
| @@ -432,8 +510,6 @@ static void cs_amp_lib_test_get_efi_cal_by_index_fallback_test(struct kunit *tes · 25 unmodified lines | |||
| 432 | param->amp_index, &result_data); | 510 | param->amp_index, &result_data); |
| 433 | KUNIT_EXPECT_EQ(test, ret, 0); | 511 | KUNIT_EXPECT_EQ(test, ret, 0); |
| 434 | 512 | ||
| 435 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 436 | |||
| 437 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], | 513 | KUNIT_EXPECT_EQ(test, result_data.calTime[0], |
| 438 | priv->cal_blob->data[param->amp_index].calTime[0]); | 514 | priv->cal_blob->data[param->amp_index].calTime[0]); |
| 439 | KUNIT_EXPECT_EQ(test, result_data.calTime[1], | 515 | KUNIT_EXPECT_EQ(test, result_data.calTime[1], |
| @@ -473,8 +549,6 @@ static void cs_amp_lib_test_get_efi_cal_uid_not_found_noindex_test(struct kunit · 33 unmodified lines | |||
| 473 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, bad_target_uid, -1, | 549 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, bad_target_uid, -1, |
| 474 | &result_data); | 550 | &result_data); |
| 475 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 551 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 476 | |||
| 477 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 478 | } | 552 | } |
| 479 | 553 | ||
| 480 | /* | 554 | /* |
| @@ -504,8 +578,6 @@ static void cs_amp_lib_test_get_efi_cal_uid_not_found_index_not_found_test(struc · 23 unmodified lines | |||
| 504 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, bad_target_uid, 99, | 578 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, bad_target_uid, 99, |
| 505 | &result_data); | 579 | &result_data); |
| 506 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 580 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 507 | |||
| 508 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 509 | } | 581 | } |
| 510 | 582 | ||
| 511 | /* | 583 | /* |
| @@ -527,8 +599,6 @@ static void cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test(struct kunit · 15 unmodified lines | |||
| 527 | 599 | ||
| 528 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 99, &result_data); | 600 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 99, &result_data); |
| 529 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 601 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 530 | |||
| 531 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 532 | } | 602 | } |
| 533 | 603 | ||
| 534 | /* If neither the target UID or the index is given the result should be -ENOENT. */ | 604 | /* If neither the target UID or the index is given the result should be -ENOENT. */ |
| @@ -547,8 +617,6 @@ static void cs_amp_lib_test_get_efi_cal_no_uid_no_index_test(struct kunit *test) · 12 unmodified lines | |||
| 547 | 617 | ||
| 548 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, -1, &result_data); | 618 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, -1, &result_data); |
| 549 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 619 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 550 | |||
| 551 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 552 | } | 620 | } |
| 553 | 621 | ||
| 554 | /* | 622 | /* |
| @@ -576,8 +644,6 @@ static void cs_amp_lib_test_get_efi_cal_zero_not_matched_test(struct kunit *test · 21 unmodified lines | |||
| 576 | 644 | ||
| 577 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, -1, &result_data); | 645 | ret = cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, -1, &result_data); |
| 578 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); | 646 | KUNIT_EXPECT_EQ(test, ret, -ENOENT); |
| 579 | |||
| 580 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 581 | } | 647 | } |
| 582 | 648 | ||
| 583 | /* | 649 | /* |
| @@ -619,8 +685,6 @@ static void cs_amp_lib_test_get_efi_cal_empty_entry_test(struct kunit *test) · 35 unmodified lines | |||
| 619 | 0, 2, | 685 | 0, 2, |
| 620 | &result_data), | 686 | &result_data), |
| 621 | -ENOENT); | 687 | -ENOENT); |
| 622 | |||
| 623 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->get_efi_variable); | ||
| 624 | } | 688 | } |
| 625 | 689 | ||
| 626 | static const struct cirrus_amp_cal_controls cs_amp_lib_test_calibration_controls = { | 690 | static const struct cirrus_amp_cal_controls cs_amp_lib_test_calibration_controls = { |
| @@ -676,9 +740,6 @@ static void cs_amp_lib_test_write_cal_data_test(struct kunit *test) · 49 unmodified lines | |||
| 676 | 740 | ||
| 677 | ret = cs_amp_write_cal_coeffs(dsp, &cs_amp_lib_test_calibration_controls, &data); | 741 | ret = cs_amp_write_cal_coeffs(dsp, &cs_amp_lib_test_calibration_controls, &data); |
| 678 | KUNIT_EXPECT_EQ(test, ret, 0); | 742 | KUNIT_EXPECT_EQ(test, ret, 0); |
| 679 | |||
| 680 | kunit_deactivate_static_stub(test, cs_amp_test_hooks->write_cal_coeff); | ||
| 681 | |||
| 682 | KUNIT_EXPECT_EQ(test, list_count_nodes(&priv->ctl_write_list), 4); | 743 | KUNIT_EXPECT_EQ(test, list_count_nodes(&priv->ctl_write_list), 4); |
| 683 | 744 | ||
| 684 | /* Checksum control must be written last */ | 745 | /* Checksum control must be written last */ |
| @@ -702,6 +763,1363 @@ static void cs_amp_lib_test_write_cal_data_test(struct kunit *test) · 17 unmodified lines | |||
| 702 | KUNIT_EXPECT_EQ(test, entry->value, data.calStatus); | 763 | KUNIT_EXPECT_EQ(test, entry->value, data.calStatus); |
| 703 | } | 764 | } |
| 704 | 765 | ||
| 766 | static int cs_amp_lib_test_read_cal_coeff(struct cs_dsp *dsp, | ||
| 767 | const struct cirrus_amp_cal_controls *controls, | ||
| 768 | const char *ctl_name, u32 *val) | ||
| 769 | { | ||
| 770 | struct kunit *test = kunit_get_current_test(); | ||
| 771 | |||
| 772 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctl_name); | ||
| 773 | KUNIT_EXPECT_PTR_EQ(test, controls, &cs_amp_lib_test_calibration_controls); | ||
| 774 | |||
| 775 | if (strcmp(ctl_name, controls->ambient) == 0) | ||
| 776 | *val = 19; | ||
| 777 | else if (strcmp(ctl_name, controls->calr) == 0) | ||
| 778 | *val = 1077; | ||
| 779 | else if (strcmp(ctl_name, controls->status) == 0) | ||
| 780 | *val = 2; | ||
| 781 | else | ||
| 782 | kunit_fail_current_test("Bad control '%s'\n", ctl_name); | ||
| 783 | |||
| 784 | return 0; | ||
| 785 | } | ||
| 786 | |||
| 787 | static void cs_amp_lib_test_read_cal_data_test(struct kunit *test) | ||
| 788 | { | ||
| 789 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 790 | struct cirrus_amp_cal_data data = { 0 }; | ||
| 791 | struct cs_dsp *dsp; | ||
| 792 | int ret; | ||
| 793 | |||
| 794 | dsp = kunit_kzalloc(test, sizeof(*dsp), GFP_KERNEL); | ||
| 795 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dsp); | ||
| 796 | dsp->dev = &priv->amp_dev->dev; | ||
| 797 | |||
| 798 | kunit_activate_static_stub(test, | ||
| 799 | cs_amp_test_hooks->read_cal_coeff, | ||
| 800 | cs_amp_lib_test_read_cal_coeff); | ||
| 801 | |||
| 802 | ret = cs_amp_read_cal_coeffs(dsp, &cs_amp_lib_test_calibration_controls, &data); | ||
| 803 | KUNIT_EXPECT_EQ(test, ret, 0); | ||
| 804 | |||
| 805 | KUNIT_EXPECT_EQ(test, 19, data.calAmbient); | ||
| 806 | KUNIT_EXPECT_EQ(test, 1077, data.calR); | ||
| 807 | KUNIT_EXPECT_EQ(test, 2, data.calStatus); | ||
| 808 | KUNIT_EXPECT_NE(test, 0, data.calTime[0] | data.calTime[1]); | ||
| 809 | } | ||
| 810 | |||
| 811 | static void cs_amp_lib_test_write_ambient_test(struct kunit *test) | ||
| 812 | { | ||
| 813 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 814 | struct cs_amp_lib_test_ctl_write_entry *entry; | ||
| 815 | struct cs_dsp *dsp; | ||
| 816 | int ret; | ||
| 817 | |||
| 818 | dsp = kunit_kzalloc(test, sizeof(*dsp), GFP_KERNEL); | ||
| 819 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dsp); | ||
| 820 | dsp->dev = &priv->amp_dev->dev; | ||
| 821 | |||
| 822 | /* Redirect calls to write firmware controls */ | ||
| 823 | kunit_activate_static_stub(test, | ||
| 824 | cs_amp_test_hooks->write_cal_coeff, | ||
| 825 | cs_amp_lib_test_write_cal_coeff); | ||
| 826 | |||
| 827 | ret = cs_amp_write_ambient_temp(dsp, &cs_amp_lib_test_calibration_controls, 18); | ||
| 828 | KUNIT_EXPECT_EQ(test, ret, 0); | ||
| 829 | |||
| 830 | KUNIT_EXPECT_EQ(test, list_count_nodes(&priv->ctl_write_list), 1); | ||
| 831 | |||
| 832 | entry = list_first_entry(&priv->ctl_write_list, typeof(*entry), list); | ||
| 833 | KUNIT_EXPECT_STREQ(test, entry->name, cs_amp_lib_test_calibration_controls.ambient); | ||
| 834 | KUNIT_EXPECT_EQ(test, entry->value, 18); | ||
| 835 | } | ||
| 836 | |||
| 837 | static efi_status_t cs_amp_lib_test_set_efi_variable(efi_char16_t *name, | ||
| 838 | efi_guid_t *guid, | ||
| 839 | u32 attr, | ||
| 840 | unsigned long size, | ||
| 841 | void *buf) | ||
| 842 | { | ||
| 843 | static const efi_char16_t expected_name[] = CIRRUS_LOGIC_CALIBRATION_EFI_NAME; | ||
| 844 | static const efi_guid_t expected_guid = CIRRUS_LOGIC_CALIBRATION_EFI_GUID; | ||
| 845 | struct kunit *test = kunit_get_current_test(); | ||
| 846 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 847 | |||
| 848 | KUNIT_ASSERT_NOT_NULL(test, name); | ||
| 849 | KUNIT_ASSERT_NOT_NULL(test, guid); | ||
| 850 | |||
| 851 | if (memcmp(name, expected_name, sizeof(expected_name)) || | ||
| 852 | efi_guidcmp(*guid, expected_guid)) | ||
| 853 | return -EFI_NOT_FOUND; | ||
| 854 | |||
| 855 | KUNIT_ASSERT_NOT_NULL(test, buf); | ||
| 856 | KUNIT_ASSERT_NE(test, 0, size); | ||
| 857 | |||
| 858 | kunit_kfree(test, priv->cal_blob); | ||
| 859 | priv->cal_blob = kunit_kmalloc(test, size, GFP_KERNEL); | ||
| 860 | KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob); | ||
| 861 | memcpy(priv->cal_blob, buf, size); | ||
| 862 | priv->efi_attr = attr; | ||
| 863 | |||
| 864 | return EFI_SUCCESS; | ||
| 865 | } | ||
| 866 | |||
| 867 | static efi_status_t cs_amp_lib_test_set_efi_variable_denied(efi_char16_t *name, | ||
| 868 | efi_guid_t *guid, | ||
| 869 | u32 attr, | ||
| 870 | unsigned long size, | ||
| 871 | void *buf) | ||
| 872 | { | ||
| 873 | return EFI_WRITE_PROTECTED; | ||
| 874 | } | ||
| 875 | |||
| 876 | #define CS_AMP_CAL_DEFAULT_EFI_ATTR \ | ||
| 877 | (EFI_VARIABLE_NON_VOLATILE | \ | ||
| 878 | EFI_VARIABLE_BOOTSERVICE_ACCESS | \ | ||
| 879 | EFI_VARIABLE_RUNTIME_ACCESS) | ||
| 880 | |||
| 881 | static void cs_amp_lib_test_create_new_cal_efi(struct kunit *test) | ||
| 882 | { | ||
| 883 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 884 | struct device *dev = &priv->amp_dev->dev; | ||
| 885 | struct cirrus_amp_cal_data data; | ||
| 886 | int i; | ||
| 887 | |||
| 888 | kunit_activate_static_stub(test, | ||
| 889 | cs_amp_test_hooks->get_efi_variable, | ||
| 890 | cs_amp_lib_test_get_efi_variable_none); | ||
| 891 | kunit_activate_static_stub(test, | ||
| 892 | cs_amp_test_hooks->set_efi_variable, | ||
| 893 | cs_amp_lib_test_set_efi_variable); | ||
| 894 | |||
| 895 | /* For unspecified number of amps */ | ||
| 896 | get_random_bytes(&data, sizeof(data)); | ||
| 897 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 898 | KUNIT_EXPECT_EQ(test, CS_AMP_CAL_DEFAULT_EFI_ATTR, priv->efi_attr); | ||
| 899 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1); | ||
| 900 | KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8); | ||
| 901 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 902 | priv->cal_blob->size); | ||
| 903 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 904 | for (i = 1; i < priv->cal_blob->count; i++) | ||
| 905 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 906 | |||
| 907 | /* For 2 amps */ | ||
| 908 | priv->cal_blob = NULL; | ||
| 909 | get_random_bytes(&data, sizeof(data)); | ||
| 910 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 2, &data)); | ||
| 911 | KUNIT_EXPECT_EQ(test, CS_AMP_CAL_DEFAULT_EFI_ATTR, priv->efi_attr); | ||
| 912 | KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count); | ||
| 913 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size); | ||
| 914 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 915 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 916 | |||
| 917 | /* For 4 amps */ | ||
| 918 | priv->cal_blob = NULL; | ||
| 919 | get_random_bytes(&data, sizeof(data)); | ||
| 920 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data)); | ||
| 921 | KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count); | ||
| 922 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size); | ||
| 923 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 924 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 925 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 926 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 927 | |||
| 928 | /* For 6 amps */ | ||
| 929 | priv->cal_blob = NULL; | ||
| 930 | get_random_bytes(&data, sizeof(data)); | ||
| 931 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data)); | ||
| 932 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 933 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 934 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 935 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 936 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 937 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 938 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 939 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 940 | } | ||
| 941 | |||
| 942 | static void cs_amp_lib_test_create_new_cal_efi_indexed(struct kunit *test) | ||
| 943 | { | ||
| 944 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 945 | struct device *dev = &priv->amp_dev->dev; | ||
| 946 | struct cirrus_amp_cal_data data; | ||
| 947 | |||
| 948 | kunit_activate_static_stub(test, | ||
| 949 | cs_amp_test_hooks->get_efi_variable, | ||
| 950 | cs_amp_lib_test_get_efi_variable_none); | ||
| 951 | kunit_activate_static_stub(test, | ||
| 952 | cs_amp_test_hooks->set_efi_variable, | ||
| 953 | cs_amp_lib_test_set_efi_variable); | ||
| 954 | |||
| 955 | /* In slot 0 */ | ||
| 956 | priv->cal_blob = NULL; | ||
| 957 | get_random_bytes(&data, sizeof(data)); | ||
| 958 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, 6, &data)); | ||
| 959 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 960 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 961 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 962 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 963 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 964 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 965 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 966 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 967 | |||
| 968 | /* In slot 1 */ | ||
| 969 | priv->cal_blob = NULL; | ||
| 970 | get_random_bytes(&data, sizeof(data)); | ||
| 971 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 6, &data)); | ||
| 972 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 973 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 974 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 975 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[0], sizeof(data))); | ||
| 976 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 977 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 978 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 979 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 980 | |||
| 981 | /* In slot 5 */ | ||
| 982 | priv->cal_blob = NULL; | ||
| 983 | get_random_bytes(&data, sizeof(data)); | ||
| 984 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 5, 6, &data)); | ||
| 985 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 986 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 987 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data)); | ||
| 988 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[0], sizeof(data))); | ||
| 989 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 990 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 991 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 992 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 993 | } | ||
| 994 | |||
| 995 | static void cs_amp_lib_test_create_new_cal_efi_indexed_no_max(struct kunit *test) | ||
| 996 | { | ||
| 997 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 998 | struct device *dev = &priv->amp_dev->dev; | ||
| 999 | struct cirrus_amp_cal_data data; | ||
| 1000 | int i; | ||
| 1001 | |||
| 1002 | kunit_activate_static_stub(test, | ||
| 1003 | cs_amp_test_hooks->get_efi_variable, | ||
| 1004 | cs_amp_lib_test_get_efi_variable_none); | ||
| 1005 | kunit_activate_static_stub(test, | ||
| 1006 | cs_amp_test_hooks->set_efi_variable, | ||
| 1007 | cs_amp_lib_test_set_efi_variable); | ||
| 1008 | |||
| 1009 | /* In slot 0 with unspecified number of amps */ | ||
| 1010 | priv->cal_blob = NULL; | ||
| 1011 | get_random_bytes(&data, sizeof(data)); | ||
| 1012 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, -1, &data)); | ||
| 1013 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1); | ||
| 1014 | KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8); | ||
| 1015 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1016 | priv->cal_blob->size); | ||
| 1017 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1018 | for (i = 1; i < priv->cal_blob->count; i++) | ||
| 1019 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1020 | |||
| 1021 | /* In slot 1 with unspecified number of amps */ | ||
| 1022 | priv->cal_blob = NULL; | ||
| 1023 | get_random_bytes(&data, sizeof(data)); | ||
| 1024 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data)); | ||
| 1025 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 2); | ||
| 1026 | KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8); | ||
| 1027 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1028 | priv->cal_blob->size); | ||
| 1029 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1030 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[0], sizeof(data))); | ||
| 1031 | for (i = 2; i < priv->cal_blob->count; i++) | ||
| 1032 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1033 | |||
| 1034 | /* In slot 5 with unspecified number of amps */ | ||
| 1035 | priv->cal_blob = NULL; | ||
| 1036 | get_random_bytes(&data, sizeof(data)); | ||
| 1037 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 5, -1, &data)); | ||
| 1038 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 6); | ||
| 1039 | KUNIT_EXPECT_LE(test, priv->cal_blob->count, 8); | ||
| 1040 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1041 | priv->cal_blob->size); | ||
| 1042 | for (i = 0; (i < 5) && (i < priv->cal_blob->count); i++) | ||
| 1043 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1044 | |||
| 1045 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data)); | ||
| 1046 | for (i = 6; i < priv->cal_blob->count; i++) | ||
| 1047 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | static void cs_amp_lib_test_grow_append_cal_efi(struct kunit *test) | ||
| 1051 | { | ||
| 1052 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1053 | struct device *dev = &priv->amp_dev->dev; | ||
| 1054 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1055 | struct cirrus_amp_cal_data data; | ||
| 1056 | |||
| 1057 | kunit_activate_static_stub(test, | ||
| 1058 | cs_amp_test_hooks->get_efi_variable, | ||
| 1059 | cs_amp_lib_test_get_efi_variable); | ||
| 1060 | kunit_activate_static_stub(test, | ||
| 1061 | cs_amp_test_hooks->set_efi_variable, | ||
| 1062 | cs_amp_lib_test_set_efi_variable); | ||
| 1063 | |||
| 1064 | /* Initially 1 used entry grown to 2 entries */ | ||
| 1065 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1066 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1067 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1068 | get_random_bytes(&data, sizeof(data)); | ||
| 1069 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1070 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 2, &data)); | ||
| 1071 | KUNIT_EXPECT_EQ(test, CS_AMP_CAL_DEFAULT_EFI_ATTR, priv->efi_attr); | ||
| 1072 | KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count); | ||
| 1073 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size); | ||
| 1074 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1075 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1076 | |||
| 1077 | /* Initially 1 entry grown to 4 entries */ | ||
| 1078 | priv->cal_blob = NULL; | ||
| 1079 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1080 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1081 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1082 | get_random_bytes(&data, sizeof(data)); | ||
| 1083 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1084 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data)); | ||
| 1085 | KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count); | ||
| 1086 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size); | ||
| 1087 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1088 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1089 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1090 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1091 | |||
| 1092 | /* Initially 2 entries grown to 4 entries */ | ||
| 1093 | priv->cal_blob = NULL; | ||
| 1094 | cs_amp_lib_test_init_dummy_cal_blob(test, 2); | ||
| 1095 | KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count); | ||
| 1096 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1097 | get_random_bytes(&data, sizeof(data)); | ||
| 1098 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1099 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data)); | ||
| 1100 | KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count); | ||
| 1101 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size); | ||
| 1102 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1103 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1104 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data)); | ||
| 1105 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1106 | |||
| 1107 | /* Initially 1 entry grown to 6 entries */ | ||
| 1108 | priv->cal_blob = NULL; | ||
| 1109 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1110 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1111 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1112 | get_random_bytes(&data, sizeof(data)); | ||
| 1113 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1114 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data)); | ||
| 1115 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1116 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1117 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1118 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1119 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1120 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1121 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1122 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1123 | |||
| 1124 | /* Initially 4 entries grown to 6 entries */ | ||
| 1125 | priv->cal_blob = NULL; | ||
| 1126 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1127 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1128 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1129 | get_random_bytes(&data, sizeof(data)); | ||
| 1130 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1131 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data)); | ||
| 1132 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1133 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1134 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1135 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1136 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1137 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1138 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1139 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1140 | } | ||
| 1141 | |||
| 1142 | static void cs_amp_lib_test_grow_append_cal_efi_indexed(struct kunit *test) | ||
| 1143 | { | ||
| 1144 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1145 | struct device *dev = &priv->amp_dev->dev; | ||
| 1146 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1147 | struct cirrus_amp_cal_data data; | ||
| 1148 | |||
| 1149 | kunit_activate_static_stub(test, | ||
| 1150 | cs_amp_test_hooks->get_efi_variable, | ||
| 1151 | cs_amp_lib_test_get_efi_variable); | ||
| 1152 | kunit_activate_static_stub(test, | ||
| 1153 | cs_amp_test_hooks->set_efi_variable, | ||
| 1154 | cs_amp_lib_test_set_efi_variable); | ||
| 1155 | |||
| 1156 | /* Initially 1 entry grown to 2 entries using slot 1 */ | ||
| 1157 | priv->cal_blob = NULL; | ||
| 1158 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1159 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1160 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1161 | get_random_bytes(&data, sizeof(data)); | ||
| 1162 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1163 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 2, &data)); | ||
| 1164 | KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count); | ||
| 1165 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size); | ||
| 1166 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1167 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1168 | |||
| 1169 | /* Initially 1 entry grown to 6 entries using slot 1 */ | ||
| 1170 | priv->cal_blob = NULL; | ||
| 1171 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1172 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1173 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1174 | get_random_bytes(&data, sizeof(data)); | ||
| 1175 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1176 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 6, &data)); | ||
| 1177 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1178 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1179 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1180 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1181 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1182 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1183 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1184 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1185 | |||
| 1186 | /* Initially 2 entries grown to 6 entries using slot 2 */ | ||
| 1187 | priv->cal_blob = NULL; | ||
| 1188 | cs_amp_lib_test_init_dummy_cal_blob(test, 2); | ||
| 1189 | KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count); | ||
| 1190 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1191 | get_random_bytes(&data, sizeof(data)); | ||
| 1192 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1193 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, 6, &data)); | ||
| 1194 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1195 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1196 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1197 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1198 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data)); | ||
| 1199 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1200 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1201 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1202 | |||
| 1203 | /* Initially 2 entries grown to 6 entries using slot 4 */ | ||
| 1204 | kunit_kfree(test, original_blob); | ||
| 1205 | kunit_kfree(test, priv->cal_blob); | ||
| 1206 | priv->cal_blob = NULL; | ||
| 1207 | cs_amp_lib_test_init_dummy_cal_blob(test, 2); | ||
| 1208 | KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count); | ||
| 1209 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1210 | get_random_bytes(&data, sizeof(data)); | ||
| 1211 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1212 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, 6, &data)); | ||
| 1213 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1214 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1215 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1216 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1217 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1218 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1219 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1220 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1221 | } | ||
| 1222 | |||
| 1223 | static void cs_amp_lib_test_cal_efi_all_zeros_add_first(struct kunit *test) | ||
| 1224 | { | ||
| 1225 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1226 | struct device *dev = &priv->amp_dev->dev; | ||
| 1227 | struct cirrus_amp_cal_data data; | ||
| 1228 | int i; | ||
| 1229 | |||
| 1230 | /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */ | ||
| 1231 | kunit_activate_static_stub(test, | ||
| 1232 | cs_amp_test_hooks->get_efi_variable, | ||
| 1233 | cs_amp_lib_test_get_efi_variable_all_zeros); | ||
| 1234 | kunit_activate_static_stub(test, | ||
| 1235 | cs_amp_test_hooks->set_efi_variable, | ||
| 1236 | cs_amp_lib_test_set_efi_variable); | ||
| 1237 | |||
| 1238 | /* | ||
| 1239 | * Add an entry. The header should be filled in to match the | ||
| 1240 | * original EFI variable size. | ||
| 1241 | */ | ||
| 1242 | get_random_bytes(&data, sizeof(data)); | ||
| 1243 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1244 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size); | ||
| 1245 | KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count); | ||
| 1246 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1247 | for (i = 1; i < priv->cal_blob->count; i++) { | ||
| 1248 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]); | ||
| 1249 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]); | ||
| 1250 | } | ||
| 1251 | } | ||
| 1252 | |||
| 1253 | static void cs_amp_lib_test_cal_efi_all_zeros_add_first_no_shrink(struct kunit *test) | ||
| 1254 | { | ||
| 1255 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1256 | struct device *dev = &priv->amp_dev->dev; | ||
| 1257 | struct cirrus_amp_cal_data data; | ||
| 1258 | int i; | ||
| 1259 | |||
| 1260 | /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */ | ||
| 1261 | kunit_activate_static_stub(test, | ||
| 1262 | cs_amp_test_hooks->get_efi_variable, | ||
| 1263 | cs_amp_lib_test_get_efi_variable_all_zeros); | ||
| 1264 | kunit_activate_static_stub(test, | ||
| 1265 | cs_amp_test_hooks->set_efi_variable, | ||
| 1266 | cs_amp_lib_test_set_efi_variable); | ||
| 1267 | |||
| 1268 | /* | ||
| 1269 | * Add an entry. The header should be filled in to match the | ||
| 1270 | * original EFI variable size. A number of amps less than the | ||
| 1271 | * available preallocated space does not shrink the EFI variable. | ||
| 1272 | */ | ||
| 1273 | get_random_bytes(&data, sizeof(data)); | ||
| 1274 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data)); | ||
| 1275 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size); | ||
| 1276 | KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count); | ||
| 1277 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1278 | for (i = 1; i < priv->cal_blob->count; i++) { | ||
| 1279 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]); | ||
| 1280 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]); | ||
| 1281 | } | ||
| 1282 | } | ||
| 1283 | |||
| 1284 | static void cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed(struct kunit *test) | ||
| 1285 | { | ||
| 1286 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1287 | struct device *dev = &priv->amp_dev->dev; | ||
| 1288 | struct cirrus_amp_cal_data data; | ||
| 1289 | int i; | ||
| 1290 | |||
| 1291 | /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */ | ||
| 1292 | kunit_activate_static_stub(test, | ||
| 1293 | cs_amp_test_hooks->get_efi_variable, | ||
| 1294 | cs_amp_lib_test_get_efi_variable_all_zeros); | ||
| 1295 | kunit_activate_static_stub(test, | ||
| 1296 | cs_amp_test_hooks->set_efi_variable, | ||
| 1297 | cs_amp_lib_test_set_efi_variable); | ||
| 1298 | |||
| 1299 | /* | ||
| 1300 | * Write entry to slot 2. The header should be filled in to match | ||
| 1301 | * the original EFI variable size. | ||
| 1302 | */ | ||
| 1303 | get_random_bytes(&data, sizeof(data)); | ||
| 1304 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, -1, &data)); | ||
| 1305 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size); | ||
| 1306 | KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count); | ||
| 1307 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]); | ||
| 1308 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]); | ||
| 1309 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]); | ||
| 1310 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]); | ||
| 1311 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data)); | ||
| 1312 | for (i = 3; i < priv->cal_blob->count; i++) { | ||
| 1313 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]); | ||
| 1314 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]); | ||
| 1315 | } | ||
| 1316 | } | ||
| 1317 | |||
| 1318 | static void cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed_no_shrink(struct kunit *test) | ||
| 1319 | { | ||
| 1320 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1321 | struct device *dev = &priv->amp_dev->dev; | ||
| 1322 | struct cirrus_amp_cal_data data; | ||
| 1323 | int i; | ||
| 1324 | |||
| 1325 | /* Simulate a BIOS reserving EFI space that is entirely zero-filled. */ | ||
| 1326 | kunit_activate_static_stub(test, | ||
| 1327 | cs_amp_test_hooks->get_efi_variable, | ||
| 1328 | cs_amp_lib_test_get_efi_variable_all_zeros); | ||
| 1329 | kunit_activate_static_stub(test, | ||
| 1330 | cs_amp_test_hooks->set_efi_variable, | ||
| 1331 | cs_amp_lib_test_set_efi_variable); | ||
| 1332 | |||
| 1333 | /* | ||
| 1334 | * Write entry to slot 2. The header should be filled in to match | ||
| 1335 | * the original EFI variable size. A number of amps less than the | ||
| 1336 | * available preallocated space does not shrink the EFI variable. | ||
| 1337 | */ | ||
| 1338 | get_random_bytes(&data, sizeof(data)); | ||
| 1339 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, 4, &data)); | ||
| 1340 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size); | ||
| 1341 | KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count); | ||
| 1342 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]); | ||
| 1343 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]); | ||
| 1344 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]); | ||
| 1345 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]); | ||
| 1346 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data)); | ||
| 1347 | for (i = 3; i < priv->cal_blob->count; i++) { | ||
| 1348 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[0]); | ||
| 1349 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[i].calTime[1]); | ||
| 1350 | } | ||
| 1351 | } | ||
| 1352 | |||
| 1353 | static void cs_amp_lib_test_grow_append_cal_efi_indexed_no_max(struct kunit *test) | ||
| 1354 | { | ||
| 1355 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1356 | struct device *dev = &priv->amp_dev->dev; | ||
| 1357 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1358 | struct cirrus_amp_cal_data data; | ||
| 1359 | int i; | ||
| 1360 | |||
| 1361 | kunit_activate_static_stub(test, | ||
| 1362 | cs_amp_test_hooks->get_efi_variable, | ||
| 1363 | cs_amp_lib_test_get_efi_variable); | ||
| 1364 | kunit_activate_static_stub(test, | ||
| 1365 | cs_amp_test_hooks->set_efi_variable, | ||
| 1366 | cs_amp_lib_test_set_efi_variable); | ||
| 1367 | |||
| 1368 | /* Initially 1 entry adding slot 1 */ | ||
| 1369 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1370 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1371 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1372 | get_random_bytes(&data, sizeof(data)); | ||
| 1373 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1374 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data)); | ||
| 1375 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 2); | ||
| 1376 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1377 | priv->cal_blob->size); | ||
| 1378 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1379 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1380 | for (i = 2; i < priv->cal_blob->count; i++) | ||
| 1381 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1382 | |||
| 1383 | /* Initially 1 entry adding slot 3 */ | ||
| 1384 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1385 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1386 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1387 | get_random_bytes(&data, sizeof(data)); | ||
| 1388 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1389 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, -1, &data)); | ||
| 1390 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 4); | ||
| 1391 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1392 | priv->cal_blob->size); | ||
| 1393 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1394 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 1395 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1396 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1397 | for (i = 4; i < priv->cal_blob->count; i++) | ||
| 1398 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1399 | |||
| 1400 | /* Initially 2 entries adding slot 3 */ | ||
| 1401 | priv->cal_blob = NULL; | ||
| 1402 | cs_amp_lib_test_init_dummy_cal_blob(test, 2); | ||
| 1403 | KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count); | ||
| 1404 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1405 | get_random_bytes(&data, sizeof(data)); | ||
| 1406 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1407 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, -1, &data)); | ||
| 1408 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1); | ||
| 1409 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1410 | priv->cal_blob->size); | ||
| 1411 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1412 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1413 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1414 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1415 | for (i = 4; i < priv->cal_blob->count; i++) | ||
| 1416 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1417 | |||
| 1418 | /* Initially 4 entries adding slot 4 */ | ||
| 1419 | priv->cal_blob = NULL; | ||
| 1420 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1421 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1422 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1423 | get_random_bytes(&data, sizeof(data)); | ||
| 1424 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1425 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, -1, &data)); | ||
| 1426 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1); | ||
| 1427 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1428 | priv->cal_blob->size); | ||
| 1429 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1430 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1431 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1432 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1433 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1434 | for (i = 5; i < priv->cal_blob->count; i++) | ||
| 1435 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1436 | |||
| 1437 | /* Initially 4 entries adding slot 6 */ | ||
| 1438 | priv->cal_blob = NULL; | ||
| 1439 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1440 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1441 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1442 | get_random_bytes(&data, sizeof(data)); | ||
| 1443 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1444 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 6, -1, &data)); | ||
| 1445 | KUNIT_EXPECT_GE(test, priv->cal_blob->count, 1); | ||
| 1446 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, priv->cal_blob->count), | ||
| 1447 | priv->cal_blob->size); | ||
| 1448 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1449 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1450 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1451 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1452 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1453 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1454 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[6], sizeof(data)); | ||
| 1455 | for (i = 7; i < priv->cal_blob->count; i++) | ||
| 1456 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[i], sizeof(data))); | ||
| 1457 | } | ||
| 1458 | |||
| 1459 | static void cs_amp_lib_test_grow_cal_efi_replace_indexed(struct kunit *test) | ||
| 1460 | { | ||
| 1461 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1462 | struct device *dev = &priv->amp_dev->dev; | ||
| 1463 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1464 | struct cirrus_amp_cal_data data; | ||
| 1465 | |||
| 1466 | kunit_activate_static_stub(test, | ||
| 1467 | cs_amp_test_hooks->get_efi_variable, | ||
| 1468 | cs_amp_lib_test_get_efi_variable); | ||
| 1469 | kunit_activate_static_stub(test, | ||
| 1470 | cs_amp_test_hooks->set_efi_variable, | ||
| 1471 | cs_amp_lib_test_set_efi_variable); | ||
| 1472 | |||
| 1473 | /* Initially 1 entry grown to 2 entries overwriting slot 0 */ | ||
| 1474 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1475 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1476 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1477 | get_random_bytes(&data, sizeof(data)); | ||
| 1478 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1479 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, 2, &data)); | ||
| 1480 | KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count); | ||
| 1481 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size); | ||
| 1482 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1483 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 1484 | |||
| 1485 | /* Initially 2 entries grown to 4 entries overwriting slot 1 */ | ||
| 1486 | priv->cal_blob = NULL; | ||
| 1487 | cs_amp_lib_test_init_dummy_cal_blob(test, 2); | ||
| 1488 | KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count); | ||
| 1489 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1490 | get_random_bytes(&data, sizeof(data)); | ||
| 1491 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1492 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 4, &data)); | ||
| 1493 | KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count); | ||
| 1494 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size); | ||
| 1495 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1496 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1497 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1498 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1499 | |||
| 1500 | /* Initially 4 entries grown to 6 entries overwriting slot 1 */ | ||
| 1501 | priv->cal_blob = NULL; | ||
| 1502 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1503 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1504 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1505 | get_random_bytes(&data, sizeof(data)); | ||
| 1506 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1507 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, 6, &data)); | ||
| 1508 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1509 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1510 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1511 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1512 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1513 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1514 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1515 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1516 | |||
| 1517 | /* Initially 4 entries grown to 6 entries overwriting slot 3 */ | ||
| 1518 | priv->cal_blob = NULL; | ||
| 1519 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1520 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1521 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1522 | get_random_bytes(&data, sizeof(data)); | ||
| 1523 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1524 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, 6, &data)); | ||
| 1525 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1526 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1527 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1528 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1529 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1530 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1531 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1532 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1533 | |||
| 1534 | /* Initially 6 entries grown to 8 entries overwriting slot 4 */ | ||
| 1535 | priv->cal_blob = NULL; | ||
| 1536 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 1537 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 1538 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1539 | get_random_bytes(&data, sizeof(data)); | ||
| 1540 | data.calTarget[0] = 0xaaaaaaaa; /* won't match */ | ||
| 1541 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, 8, &data)); | ||
| 1542 | KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count); | ||
| 1543 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size); | ||
| 1544 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1545 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1546 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1547 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1548 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1549 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1550 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[6], sizeof(data))); | ||
| 1551 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[7], sizeof(data))); | ||
| 1552 | } | ||
| 1553 | |||
| 1554 | static void cs_amp_lib_test_grow_cal_efi_replace_by_uid(struct kunit *test) | ||
| 1555 | { | ||
| 1556 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1557 | struct device *dev = &priv->amp_dev->dev; | ||
| 1558 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1559 | struct cirrus_amp_cal_data data; | ||
| 1560 | |||
| 1561 | kunit_activate_static_stub(test, | ||
| 1562 | cs_amp_test_hooks->get_efi_variable, | ||
| 1563 | cs_amp_lib_test_get_efi_variable); | ||
| 1564 | kunit_activate_static_stub(test, | ||
| 1565 | cs_amp_test_hooks->set_efi_variable, | ||
| 1566 | cs_amp_lib_test_set_efi_variable); | ||
| 1567 | |||
| 1568 | /* Initially 1 entry grown to 2 entries overwriting slot 0 */ | ||
| 1569 | cs_amp_lib_test_init_dummy_cal_blob(test, 1); | ||
| 1570 | KUNIT_ASSERT_EQ(test, 1, priv->cal_blob->count); | ||
| 1571 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1572 | get_random_bytes(&data, sizeof(data)); | ||
| 1573 | memcpy(data.calTarget, priv->cal_blob->data[0].calTarget, sizeof(data.calTarget)); | ||
| 1574 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 2, &data)); | ||
| 1575 | KUNIT_EXPECT_EQ(test, 2, priv->cal_blob->count); | ||
| 1576 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 2), priv->cal_blob->size); | ||
| 1577 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1578 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[1], sizeof(data))); | ||
| 1579 | |||
| 1580 | /* Initially 2 entries grown to 4 entries overwriting slot 1 */ | ||
| 1581 | priv->cal_blob = NULL; | ||
| 1582 | cs_amp_lib_test_init_dummy_cal_blob(test, 2); | ||
| 1583 | KUNIT_ASSERT_EQ(test, 2, priv->cal_blob->count); | ||
| 1584 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1585 | get_random_bytes(&data, sizeof(data)); | ||
| 1586 | memcpy(data.calTarget, priv->cal_blob->data[1].calTarget, sizeof(data.calTarget)); | ||
| 1587 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 4, &data)); | ||
| 1588 | KUNIT_EXPECT_EQ(test, 4, priv->cal_blob->count); | ||
| 1589 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 4), priv->cal_blob->size); | ||
| 1590 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1591 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1592 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[2], sizeof(data))); | ||
| 1593 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[3], sizeof(data))); | ||
| 1594 | |||
| 1595 | /* Initially 4 entries grown to 6 entries overwriting slot 1 */ | ||
| 1596 | priv->cal_blob = NULL; | ||
| 1597 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1598 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1599 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1600 | get_random_bytes(&data, sizeof(data)); | ||
| 1601 | memcpy(data.calTarget, priv->cal_blob->data[1].calTarget, sizeof(data.calTarget)); | ||
| 1602 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data)); | ||
| 1603 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1604 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1605 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1606 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1607 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1608 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1609 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1610 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1611 | |||
| 1612 | /* Initially 4 entries grown to 6 entries overwriting slot 3 */ | ||
| 1613 | priv->cal_blob = NULL; | ||
| 1614 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1615 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1616 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1617 | get_random_bytes(&data, sizeof(data)); | ||
| 1618 | memcpy(data.calTarget, priv->cal_blob->data[3].calTarget, sizeof(data.calTarget)); | ||
| 1619 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 6, &data)); | ||
| 1620 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1621 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1622 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1623 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1624 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1625 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1626 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[4], sizeof(data))); | ||
| 1627 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[5], sizeof(data))); | ||
| 1628 | |||
| 1629 | /* Initially 6 entries grown to 8 entries overwriting slot 4 */ | ||
| 1630 | priv->cal_blob = NULL; | ||
| 1631 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 1632 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 1633 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1634 | get_random_bytes(&data, sizeof(data)); | ||
| 1635 | memcpy(data.calTarget, priv->cal_blob->data[4].calTarget, sizeof(data.calTarget)); | ||
| 1636 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, 8, &data)); | ||
| 1637 | KUNIT_EXPECT_EQ(test, 8, priv->cal_blob->count); | ||
| 1638 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 8), priv->cal_blob->size); | ||
| 1639 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1640 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1641 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1642 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1643 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1644 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1645 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[6], sizeof(data))); | ||
| 1646 | KUNIT_EXPECT_TRUE(test, mem_is_zero(&priv->cal_blob->data[7], sizeof(data))); | ||
| 1647 | } | ||
| 1648 | |||
| 1649 | static void cs_amp_lib_test_cal_efi_replace_by_uid(struct kunit *test) | ||
| 1650 | { | ||
| 1651 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1652 | struct device *dev = &priv->amp_dev->dev; | ||
| 1653 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1654 | struct cirrus_amp_cal_data data; | ||
| 1655 | |||
| 1656 | kunit_activate_static_stub(test, | ||
| 1657 | cs_amp_test_hooks->get_efi_variable, | ||
| 1658 | cs_amp_lib_test_get_efi_variable); | ||
| 1659 | kunit_activate_static_stub(test, | ||
| 1660 | cs_amp_test_hooks->set_efi_variable, | ||
| 1661 | cs_amp_lib_test_set_efi_variable); | ||
| 1662 | |||
| 1663 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 1664 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 1665 | |||
| 1666 | /* Replace entry matching slot 0 */ | ||
| 1667 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1668 | get_random_bytes(&data, sizeof(data)); | ||
| 1669 | memcpy(data.calTarget, priv->cal_blob->data[0].calTarget, sizeof(data.calTarget)); | ||
| 1670 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1671 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1672 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1673 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1674 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1675 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1676 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1677 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1678 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1679 | |||
| 1680 | /* Replace entry matching slot 4 */ | ||
| 1681 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1682 | get_random_bytes(&data, sizeof(data)); | ||
| 1683 | memcpy(data.calTarget, priv->cal_blob->data[4].calTarget, sizeof(data.calTarget)); | ||
| 1684 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1685 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1686 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1687 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1688 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1689 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1690 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1691 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1692 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1693 | |||
| 1694 | /* Replace entry matching slot 3 */ | ||
| 1695 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1696 | get_random_bytes(&data, sizeof(data)); | ||
| 1697 | memcpy(data.calTarget, priv->cal_blob->data[3].calTarget, sizeof(data.calTarget)); | ||
| 1698 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1699 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1700 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1701 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1702 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1703 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1704 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1705 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1706 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1707 | |||
| 1708 | /* Replace entry matching slot 5 */ | ||
| 1709 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1710 | get_random_bytes(&data, sizeof(data)); | ||
| 1711 | memcpy(data.calTarget, priv->cal_blob->data[5].calTarget, sizeof(data.calTarget)); | ||
| 1712 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1713 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1714 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1715 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1716 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1717 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1718 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1719 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1720 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data)); | ||
| 1721 | } | ||
| 1722 | |||
| 1723 | static void cs_amp_lib_test_cal_efi_replace_by_index(struct kunit *test) | ||
| 1724 | { | ||
| 1725 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1726 | struct device *dev = &priv->amp_dev->dev; | ||
| 1727 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1728 | struct cirrus_amp_cal_data data; | ||
| 1729 | |||
| 1730 | kunit_activate_static_stub(test, | ||
| 1731 | cs_amp_test_hooks->get_efi_variable, | ||
| 1732 | cs_amp_lib_test_get_efi_variable); | ||
| 1733 | kunit_activate_static_stub(test, | ||
| 1734 | cs_amp_test_hooks->set_efi_variable, | ||
| 1735 | cs_amp_lib_test_set_efi_variable); | ||
| 1736 | |||
| 1737 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 1738 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 1739 | |||
| 1740 | /* | ||
| 1741 | * Replace entry matching slot 0. | ||
| 1742 | * data.calTarget is deliberately set different to current calTarget | ||
| 1743 | * of the slot to check that the index forces that slot to be used. | ||
| 1744 | */ | ||
| 1745 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1746 | get_random_bytes(&data, sizeof(data)); | ||
| 1747 | data.calTarget[0] = ~priv->cal_blob->data[0].calTarget[0]; | ||
| 1748 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, -1, &data)); | ||
| 1749 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1750 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1751 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1752 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1753 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1754 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1755 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1756 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1757 | |||
| 1758 | /* Replace entry matching slot 4 */ | ||
| 1759 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1760 | get_random_bytes(&data, sizeof(data)); | ||
| 1761 | data.calTarget[0] = ~priv->cal_blob->data[4].calTarget[0]; | ||
| 1762 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, -1, &data)); | ||
| 1763 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1764 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1765 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1766 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1767 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1768 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1769 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1770 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1771 | |||
| 1772 | /* Replace entry matching slot 3 */ | ||
| 1773 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1774 | get_random_bytes(&data, sizeof(data)); | ||
| 1775 | data.calTarget[0] = ~priv->cal_blob->data[3].calTarget[0]; | ||
| 1776 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 3, -1, &data)); | ||
| 1777 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1778 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1779 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1780 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1781 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1782 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1783 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1784 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1785 | |||
| 1786 | /* Replace entry matching slot 5 */ | ||
| 1787 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1788 | get_random_bytes(&data, sizeof(data)); | ||
| 1789 | data.calTarget[0] = ~priv->cal_blob->data[5].calTarget[0]; | ||
| 1790 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 5, -1, &data)); | ||
| 1791 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1792 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1793 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1794 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1795 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1796 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1797 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1798 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data)); | ||
| 1799 | } | ||
| 1800 | |||
| 1801 | static void cs_amp_lib_test_cal_efi_deduplicate(struct kunit *test) | ||
| 1802 | { | ||
| 1803 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1804 | struct device *dev = &priv->amp_dev->dev; | ||
| 1805 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1806 | struct cirrus_amp_cal_data data; | ||
| 1807 | int i; | ||
| 1808 | |||
| 1809 | kunit_activate_static_stub(test, | ||
| 1810 | cs_amp_test_hooks->get_efi_variable, | ||
| 1811 | cs_amp_lib_test_get_efi_variable); | ||
| 1812 | kunit_activate_static_stub(test, | ||
| 1813 | cs_amp_test_hooks->set_efi_variable, | ||
| 1814 | cs_amp_lib_test_set_efi_variable); | ||
| 1815 | |||
| 1816 | /* | ||
| 1817 | * Replace entry matching slot 0. | ||
| 1818 | * An active entry in slot 1 for the same UID should be marked empty. | ||
| 1819 | * Other entries are unaltered. | ||
| 1820 | */ | ||
| 1821 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1822 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1823 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1824 | get_random_bytes(&data, sizeof(data)); | ||
| 1825 | memcpy(data.calTarget, priv->cal_blob->data[1].calTarget, sizeof(data.calTarget)); | ||
| 1826 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 0, -1, &data)); | ||
| 1827 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1828 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]); | ||
| 1829 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]); | ||
| 1830 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1831 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1832 | |||
| 1833 | /* | ||
| 1834 | * Replace entry matching slot 1. | ||
| 1835 | * An active entry in slot 0 for the same UID should be marked empty. | ||
| 1836 | * Other entries are unaltered. | ||
| 1837 | */ | ||
| 1838 | priv->cal_blob = NULL; | ||
| 1839 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1840 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1841 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1842 | get_random_bytes(&data, sizeof(data)); | ||
| 1843 | memcpy(data.calTarget, priv->cal_blob->data[0].calTarget, sizeof(data.calTarget)); | ||
| 1844 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data)); | ||
| 1845 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]); | ||
| 1846 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]); | ||
| 1847 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1848 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1849 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1850 | |||
| 1851 | /* | ||
| 1852 | * Replace entry matching slot 1. | ||
| 1853 | * An active entry in slot 3 for the same UID should be marked empty. | ||
| 1854 | * Other entries are unaltered. | ||
| 1855 | */ | ||
| 1856 | priv->cal_blob = NULL; | ||
| 1857 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1858 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1859 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1860 | get_random_bytes(&data, sizeof(data)); | ||
| 1861 | memcpy(data.calTarget, priv->cal_blob->data[3].calTarget, sizeof(data.calTarget)); | ||
| 1862 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 1, -1, &data)); | ||
| 1863 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1864 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[1], sizeof(data)); | ||
| 1865 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1866 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[0]); | ||
| 1867 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[1]); | ||
| 1868 | |||
| 1869 | /* | ||
| 1870 | * Worst case, all entries have the same UID | ||
| 1871 | */ | ||
| 1872 | priv->cal_blob = NULL; | ||
| 1873 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1874 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 1875 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1876 | get_random_bytes(&data, sizeof(data)); | ||
| 1877 | for (i = 0; i < priv->cal_blob->count; i++) { | ||
| 1878 | priv->cal_blob->data[i].calTarget[0] = 0xe5e5e5e5; | ||
| 1879 | priv->cal_blob->data[i].calTarget[1] = 0xa7a7a7a7; | ||
| 1880 | } | ||
| 1881 | memcpy(data.calTarget, priv->cal_blob->data[2].calTarget, sizeof(data.calTarget)); | ||
| 1882 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 2, -1, &data)); | ||
| 1883 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[0]); | ||
| 1884 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[0].calTime[1]); | ||
| 1885 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[0]); | ||
| 1886 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[1].calTime[1]); | ||
| 1887 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[2], sizeof(data)); | ||
| 1888 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[0]); | ||
| 1889 | KUNIT_EXPECT_EQ(test, 0, priv->cal_blob->data[3].calTime[1]); | ||
| 1890 | } | ||
| 1891 | |||
| 1892 | static void cs_amp_lib_test_cal_efi_find_free(struct kunit *test) | ||
| 1893 | { | ||
| 1894 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1895 | struct device *dev = &priv->amp_dev->dev; | ||
| 1896 | const struct cirrus_amp_efi_data *original_blob; | ||
| 1897 | struct cirrus_amp_cal_data data; | ||
| 1898 | |||
| 1899 | kunit_activate_static_stub(test, | ||
| 1900 | cs_amp_test_hooks->get_efi_variable, | ||
| 1901 | cs_amp_lib_test_get_efi_variable); | ||
| 1902 | kunit_activate_static_stub(test, | ||
| 1903 | cs_amp_test_hooks->set_efi_variable, | ||
| 1904 | cs_amp_lib_test_set_efi_variable); | ||
| 1905 | |||
| 1906 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 1907 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 1908 | |||
| 1909 | /* | ||
| 1910 | * Slot 0 is empty. | ||
| 1911 | * data.calTarget is set to a value that won't match any existing entry. | ||
| 1912 | */ | ||
| 1913 | memset(&priv->cal_blob->data[0].calTime, 0, sizeof(priv->cal_blob->data[0].calTime)); | ||
| 1914 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1915 | get_random_bytes(&data, sizeof(data)); | ||
| 1916 | data.calTarget[0] = 0xaaaaaaaa; | ||
| 1917 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1918 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1919 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1920 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 1921 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1922 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1923 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1924 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1925 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1926 | |||
| 1927 | /* Slot 4 is empty */ | ||
| 1928 | memset(&priv->cal_blob->data[4].calTime, 0, sizeof(priv->cal_blob->data[4].calTime)); | ||
| 1929 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1930 | get_random_bytes(&data, sizeof(data)); | ||
| 1931 | data.calTarget[0] = 0xaaaaaaaa; | ||
| 1932 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1933 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1934 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1935 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1936 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1937 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1938 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1939 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 1940 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1941 | |||
| 1942 | /* Slot 3 is empty */ | ||
| 1943 | memset(&priv->cal_blob->data[3].calTime, 0, sizeof(priv->cal_blob->data[3].calTime)); | ||
| 1944 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1945 | get_random_bytes(&data, sizeof(data)); | ||
| 1946 | data.calTarget[0] = 0xaaaaaaaa; | ||
| 1947 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1948 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1949 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1950 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1951 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1952 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1953 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[3], sizeof(data)); | ||
| 1954 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1955 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 1956 | |||
| 1957 | /* Replace entry matching slot 5 */ | ||
| 1958 | memset(&priv->cal_blob->data[5].calTime, 0, sizeof(priv->cal_blob->data[5].calTime)); | ||
| 1959 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 1960 | get_random_bytes(&data, sizeof(data)); | ||
| 1961 | data.calTarget[0] = 0xaaaaaaaa; | ||
| 1962 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 1963 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 1964 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 1965 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 1966 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 1967 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 1968 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 1969 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[4], &priv->cal_blob->data[4], sizeof(data)); | ||
| 1970 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[5], sizeof(data)); | ||
| 1971 | } | ||
| 1972 | |||
| 1973 | static void cs_amp_lib_test_cal_efi_bad_cal_target(struct kunit *test) | ||
| 1974 | { | ||
| 1975 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1976 | struct device *dev = &priv->amp_dev->dev; | ||
| 1977 | struct cirrus_amp_cal_data data; | ||
| 1978 | |||
| 1979 | kunit_activate_static_stub(test, | ||
| 1980 | cs_amp_test_hooks->get_efi_variable, | ||
| 1981 | cs_amp_lib_test_get_efi_variable); | ||
| 1982 | kunit_activate_static_stub(test, | ||
| 1983 | cs_amp_test_hooks->set_efi_variable, | ||
| 1984 | cs_amp_lib_test_set_efi_variable); | ||
| 1985 | |||
| 1986 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 1987 | |||
| 1988 | /* Zero calTarget is illegal */ | ||
| 1989 | get_random_bytes(&data, sizeof(data)); | ||
| 1990 | memset(data.calTarget, 0, sizeof(data.calTarget)); | ||
| 1991 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, -1, -1, &data), 0); | ||
| 1992 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 0, -1, &data), 0); | ||
| 1993 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 0, 2, &data), 0); | ||
| 1994 | } | ||
| 1995 | |||
| 1996 | static void cs_amp_lib_test_cal_efi_write_denied(struct kunit *test) | ||
| 1997 | { | ||
| 1998 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 1999 | struct device *dev = &priv->amp_dev->dev; | ||
| 2000 | const struct cirrus_amp_efi_data *original_blob; | ||
| 2001 | struct cirrus_amp_cal_data data; | ||
| 2002 | |||
| 2003 | kunit_activate_static_stub(test, | ||
| 2004 | cs_amp_test_hooks->get_efi_variable, | ||
| 2005 | cs_amp_lib_test_get_efi_variable); | ||
| 2006 | kunit_activate_static_stub(test, | ||
| 2007 | cs_amp_test_hooks->set_efi_variable, | ||
| 2008 | cs_amp_lib_test_set_efi_variable_denied); | ||
| 2009 | |||
| 2010 | cs_amp_lib_test_init_dummy_cal_blob(test, 4); | ||
| 2011 | KUNIT_ASSERT_EQ(test, 4, priv->cal_blob->count); | ||
| 2012 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 2013 | get_random_bytes(&data, sizeof(data)); | ||
| 2014 | |||
| 2015 | /* Unspecified slot */ | ||
| 2016 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, -1, -1, &data), 0); | ||
| 2017 | KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size); | ||
| 2018 | |||
| 2019 | /* Unspecified slot with size */ | ||
| 2020 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, -1, 6, &data), 0); | ||
| 2021 | KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size); | ||
| 2022 | |||
| 2023 | /* Specified slot */ | ||
| 2024 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 1, -1, &data), 0); | ||
| 2025 | KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size); | ||
| 2026 | |||
| 2027 | /* Specified slot with size */ | ||
| 2028 | KUNIT_EXPECT_LT(test, cs_amp_set_efi_calibration_data(dev, 1, 6, &data), 0); | ||
| 2029 | KUNIT_EXPECT_MEMEQ(test, original_blob, priv->cal_blob, original_blob->size); | ||
| 2030 | } | ||
| 2031 | |||
| 2032 | static void cs_amp_lib_test_cal_efi_attr_preserved(struct kunit *test) | ||
| 2033 | { | ||
| 2034 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 2035 | struct device *dev = &priv->amp_dev->dev; | ||
| 2036 | struct cirrus_amp_cal_data data; | ||
| 2037 | |||
| 2038 | kunit_activate_static_stub(test, | ||
| 2039 | cs_amp_test_hooks->get_efi_variable, | ||
| 2040 | cs_amp_lib_test_get_efi_variable); | ||
| 2041 | kunit_activate_static_stub(test, | ||
| 2042 | cs_amp_test_hooks->set_efi_variable, | ||
| 2043 | cs_amp_lib_test_set_efi_variable); | ||
| 2044 | |||
| 2045 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 2046 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 2047 | memset(&priv->cal_blob->data[0], 0, sizeof(priv->cal_blob->data[0])); | ||
| 2048 | get_random_bytes(&data, sizeof(data)); | ||
| 2049 | |||
| 2050 | /* Set a non-standard attr to return from get_efi_variable() */ | ||
| 2051 | priv->efi_attr = EFI_VARIABLE_HARDWARE_ERROR_RECORD; | ||
| 2052 | |||
| 2053 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, -1, -1, &data)); | ||
| 2054 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[0], sizeof(data)); | ||
| 2055 | KUNIT_EXPECT_EQ(test, priv->efi_attr, EFI_VARIABLE_HARDWARE_ERROR_RECORD); | ||
| 2056 | } | ||
| 2057 | |||
| 2058 | static efi_status_t cs_amp_lib_test_set_hp_efi_cal_variable(efi_char16_t *name, | ||
| 2059 | efi_guid_t *guid, | ||
| 2060 | u32 attr, | ||
| 2061 | unsigned long size, | ||
| 2062 | void *buf) | ||
| 2063 | { | ||
| 2064 | static const efi_char16_t expected_name[] = HP_CALIBRATION_EFI_NAME; | ||
| 2065 | static const efi_guid_t expected_guid = HP_CALIBRATION_EFI_GUID; | ||
| 2066 | struct kunit *test = kunit_get_current_test(); | ||
| 2067 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 2068 | |||
| 2069 | KUNIT_ASSERT_NOT_NULL(test, name); | ||
| 2070 | KUNIT_ASSERT_NOT_NULL(test, guid); | ||
| 2071 | |||
| 2072 | if (memcmp(name, expected_name, sizeof(expected_name)) || | ||
| 2073 | efi_guidcmp(*guid, expected_guid)) | ||
| 2074 | return -EFI_ACCESS_DENIED; | ||
| 2075 | |||
| 2076 | KUNIT_ASSERT_NOT_NULL(test, buf); | ||
| 2077 | KUNIT_ASSERT_NE(test, 0, size); | ||
| 2078 | |||
| 2079 | kunit_kfree(test, priv->cal_blob); | ||
| 2080 | priv->cal_blob = kunit_kmalloc(test, size, GFP_KERNEL); | ||
| 2081 | KUNIT_ASSERT_NOT_NULL(test, priv->cal_blob); | ||
| 2082 | memcpy(priv->cal_blob, buf, size); | ||
| 2083 | priv->efi_attr = attr; | ||
| 2084 | |||
| 2085 | return EFI_SUCCESS; | ||
| 2086 | } | ||
| 2087 | |||
| 2088 | /* | ||
| 2089 | * If the HP EFI exists it should be the one that is updated. | ||
| 2090 | */ | ||
| 2091 | static void cs_amp_lib_test_cal_efi_update_hp(struct kunit *test) | ||
| 2092 | { | ||
| 2093 | struct cs_amp_lib_test_priv *priv = test->priv; | ||
| 2094 | struct device *dev = &priv->amp_dev->dev; | ||
| 2095 | const struct cirrus_amp_efi_data *original_blob; | ||
| 2096 | struct cirrus_amp_cal_data data; | ||
| 2097 | |||
| 2098 | kunit_activate_static_stub(test, | ||
| 2099 | cs_amp_test_hooks->get_efi_variable, | ||
| 2100 | cs_amp_lib_test_get_hp_cal_efi_variable); | ||
| 2101 | kunit_activate_static_stub(test, | ||
| 2102 | cs_amp_test_hooks->set_efi_variable, | ||
| 2103 | cs_amp_lib_test_set_hp_efi_cal_variable); | ||
| 2104 | |||
| 2105 | cs_amp_lib_test_init_dummy_cal_blob(test, 6); | ||
| 2106 | KUNIT_ASSERT_EQ(test, 6, priv->cal_blob->count); | ||
| 2107 | |||
| 2108 | /* Replace entry matching slot 4 */ | ||
| 2109 | original_blob = cs_amp_lib_test_cal_blob_dup(test); | ||
| 2110 | get_random_bytes(&data, sizeof(data)); | ||
| 2111 | data.calTarget[0] = ~priv->cal_blob->data[4].calTarget[0]; | ||
| 2112 | KUNIT_EXPECT_EQ(test, 0, cs_amp_set_efi_calibration_data(dev, 4, -1, &data)); | ||
| 2113 | KUNIT_EXPECT_EQ(test, 6, priv->cal_blob->count); | ||
| 2114 | KUNIT_EXPECT_EQ(test, struct_size(priv->cal_blob, data, 6), priv->cal_blob->size); | ||
| 2115 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[0], &priv->cal_blob->data[0], sizeof(data)); | ||
| 2116 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[1], &priv->cal_blob->data[1], sizeof(data)); | ||
| 2117 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[2], &priv->cal_blob->data[2], sizeof(data)); | ||
| 2118 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[3], &priv->cal_blob->data[3], sizeof(data)); | ||
| 2119 | KUNIT_EXPECT_MEMEQ(test, &data, &priv->cal_blob->data[4], sizeof(data)); | ||
| 2120 | KUNIT_EXPECT_MEMEQ(test, &original_blob->data[5], &priv->cal_blob->data[5], sizeof(data)); | ||
| 2121 | } | ||
| 2122 | |||
| 705 | static void cs_amp_lib_test_spkid_lenovo_not_present(struct kunit *test) | 2123 | static void cs_amp_lib_test_spkid_lenovo_not_present(struct kunit *test) |
| 706 | { | 2124 | { |
| 707 | struct cs_amp_lib_test_priv *priv = test->priv; | 2125 | struct cs_amp_lib_test_priv *priv = test->priv; |
| @@ -716,6 +2134,7 @@ static void cs_amp_lib_test_spkid_lenovo_not_present(struct kunit *test) · 8 unmodified lines | |||
| 716 | 2134 | ||
| 717 | static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d0(efi_char16_t *name, | 2135 | static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d0(efi_char16_t *name, |
| 718 | efi_guid_t *guid, | 2136 | efi_guid_t *guid, |
| 2137 | u32 *returned_attr, | ||
| 719 | unsigned long *size, | 2138 | unsigned long *size, |
| 720 | void *buf) | 2139 | void *buf) |
| 721 | { | 2140 | { |
| @@ -734,6 +2153,7 @@ static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d0(efi_char16_t *nam · 12 unmodified lines | |||
| 734 | 2153 | ||
| 735 | static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d1(efi_char16_t *name, | 2154 | static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d1(efi_char16_t *name, |
| 736 | efi_guid_t *guid, | 2155 | efi_guid_t *guid, |
| 2156 | u32 *returned_attr, | ||
| 737 | unsigned long *size, | 2157 | unsigned long *size, |
| 738 | void *buf) | 2158 | void *buf) |
| 739 | { | 2159 | { |
| @@ -752,6 +2172,7 @@ static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d1(efi_char16_t *nam · 12 unmodified lines | |||
| 752 | 2172 | ||
| 753 | static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_00(efi_char16_t *name, | 2173 | static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_00(efi_char16_t *name, |
| 754 | efi_guid_t *guid, | 2174 | efi_guid_t *guid, |
| 2175 | u32 *returned_attr, | ||
| 755 | unsigned long *size, | 2176 | unsigned long *size, |
| 756 | void *buf) | 2177 | void *buf) |
| 757 | { | 2178 | { |
| @@ -803,6 +2224,7 @@ static void cs_amp_lib_test_spkid_lenovo_illegal(struct kunit *test) · 45 unmodified lines | |||
| 803 | 2224 | ||
| 804 | static efi_status_t cs_amp_lib_test_get_efi_variable_buf_too_small(efi_char16_t *name, | 2225 | static efi_status_t cs_amp_lib_test_get_efi_variable_buf_too_small(efi_char16_t *name, |
| 805 | efi_guid_t *guid, | 2226 | efi_guid_t *guid, |
| 2227 | u32 *returned_attr, | ||
| 806 | unsigned long *size, | 2228 | unsigned long *size, |
| 807 | void *buf) | 2229 | void *buf) |
| 808 | { | 2230 | { |
| @@ -823,6 +2245,7 @@ static void cs_amp_lib_test_spkid_lenovo_oversize(struct kunit *test) · 14 unmodified lines | |||
| 823 | 2245 | ||
| 824 | static efi_status_t cs_amp_lib_test_get_efi_variable_hp_30(efi_char16_t *name, | 2246 | static efi_status_t cs_amp_lib_test_get_efi_variable_hp_30(efi_char16_t *name, |
| 825 | efi_guid_t *guid, | 2247 | efi_guid_t *guid, |
| 2248 | u32 *returned_attr, | ||
| 826 | unsigned long *size, | 2249 | unsigned long *size, |
| 827 | void *buf) | 2250 | void *buf) |
| 828 | { | 2251 | { |
| @@ -841,6 +2264,7 @@ static efi_status_t cs_amp_lib_test_get_efi_variable_hp_30(efi_char16_t *name, · 12 unmodified lines | |||
| 841 | 2264 | ||
| 842 | static efi_status_t cs_amp_lib_test_get_efi_variable_hp_31(efi_char16_t *name, | 2265 | static efi_status_t cs_amp_lib_test_get_efi_variable_hp_31(efi_char16_t *name, |
| 843 | efi_guid_t *guid, | 2266 | efi_guid_t *guid, |
| 2267 | u32 *returned_attr, | ||
| 844 | unsigned long *size, | 2268 | unsigned long *size, |
| 845 | void *buf) | 2269 | void *buf) |
| 846 | { | 2270 | { |
| @@ -974,8 +2398,32 @@ static struct kunit_case cs_amp_lib_test_cases[] = { · 127 unmodified lines | |||
| 974 | cs_amp_lib_test_get_cal_gen_params), | 2398 | cs_amp_lib_test_get_cal_gen_params), |
| 975 | KUNIT_CASE(cs_amp_lib_test_get_efi_cal_empty_entry_test), | 2399 | KUNIT_CASE(cs_amp_lib_test_get_efi_cal_empty_entry_test), |
| 976 | 2400 | ||
| 977 | /* Tests for writing calibration data */ | 2401 | /* Tests for writing and reading calibration data */ |
| 978 | KUNIT_CASE(cs_amp_lib_test_write_cal_data_test), | 2402 | KUNIT_CASE(cs_amp_lib_test_write_cal_data_test), |
| 2403 | KUNIT_CASE(cs_amp_lib_test_read_cal_data_test), | ||
| 2404 | KUNIT_CASE(cs_amp_lib_test_write_ambient_test), | ||
| 2405 | |||
| 2406 | /* Test cases for writing cal data to UEFI */ | ||
| 2407 | KUNIT_CASE(cs_amp_lib_test_create_new_cal_efi), | ||
| 2408 | KUNIT_CASE(cs_amp_lib_test_create_new_cal_efi_indexed), | ||
| 2409 | KUNIT_CASE(cs_amp_lib_test_create_new_cal_efi_indexed_no_max), | ||
| 2410 | KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first), | ||
| 2411 | KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first_no_shrink), | ||
| 2412 | KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed), | ||
| 2413 | KUNIT_CASE(cs_amp_lib_test_cal_efi_all_zeros_add_first_indexed_no_shrink), | ||
| 2414 | KUNIT_CASE(cs_amp_lib_test_grow_append_cal_efi), | ||
| 2415 | KUNIT_CASE(cs_amp_lib_test_grow_append_cal_efi_indexed), | ||
| 2416 | KUNIT_CASE(cs_amp_lib_test_grow_append_cal_efi_indexed_no_max), | ||
| 2417 | KUNIT_CASE(cs_amp_lib_test_grow_cal_efi_replace_indexed), | ||
| 2418 | KUNIT_CASE(cs_amp_lib_test_grow_cal_efi_replace_by_uid), | ||
| 2419 | KUNIT_CASE(cs_amp_lib_test_cal_efi_replace_by_uid), | ||
| 2420 | KUNIT_CASE(cs_amp_lib_test_cal_efi_replace_by_index), | ||
| 2421 | KUNIT_CASE(cs_amp_lib_test_cal_efi_deduplicate), | ||
| 2422 | KUNIT_CASE(cs_amp_lib_test_cal_efi_find_free), | ||
| 2423 | KUNIT_CASE(cs_amp_lib_test_cal_efi_bad_cal_target), | ||
| 2424 | KUNIT_CASE(cs_amp_lib_test_cal_efi_write_denied), | ||
| 2425 | KUNIT_CASE(cs_amp_lib_test_cal_efi_attr_preserved), | ||
| 2426 | KUNIT_CASE(cs_amp_lib_test_cal_efi_update_hp), | ||
| 979 | 2427 | ||
| 980 | /* Test cases for speaker ID */ | 2428 | /* Test cases for speaker ID */ |
| 981 | KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_not_present), | 2429 | KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_not_present), |
| @@ -7,12 +7,17 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #include <asm/byteorder.h> | 8 | #include <asm/byteorder.h> |
| 9 | #include <kunit/static_stub.h> | 9 | #include <kunit/static_stub.h> |
| 10 | #include <linux/cleanup.h> | ||
| 11 | #include <linux/debugfs.h> | ||
| 10 | #include <linux/dev_printk.h> | 12 | #include <linux/dev_printk.h> |
| 11 | #include <linux/efi.h> | 13 | #include <linux/efi.h> |
| 12 | #include <linux/firmware/cirrus/cs_dsp.h> | 14 | #include <linux/firmware/cirrus/cs_dsp.h> |
| 15 | #include <linux/math64.h> | ||
| 13 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/mutex.h> | ||
| 14 | #include <linux/overflow.h> | 18 | #include <linux/overflow.h> |
| 15 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 20 | #include <linux/timekeeping.h> | ||
| 16 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 17 | #include <sound/cs-amp-lib.h> | 22 | #include <sound/cs-amp-lib.h> |
| 18 | 23 | ||
| @@ -46,6 +51,23 @@ static const struct cs_amp_lib_cal_efivar { · 27 unmodified lines | |||
| 46 | }, | 51 | }, |
| 47 | }; | 52 | }; |
| 48 | 53 | ||
| 54 | #define CS_AMP_CAL_DEFAULT_EFI_ATTR \ | ||
| 55 | (EFI_VARIABLE_NON_VOLATILE | \ | ||
| 56 | EFI_VARIABLE_BOOTSERVICE_ACCESS | \ | ||
| 57 | EFI_VARIABLE_RUNTIME_ACCESS) | ||
| 58 | |||
| 59 | /* Offset from Unix time to Windows time (100ns since 1 Jan 1601) */ | ||
| 60 | #define UNIX_TIME_TO_WINDOWS_TIME_OFFSET 116444736000000000ULL | ||
| 61 | |||
| 62 | static DEFINE_MUTEX(cs_amp_efi_cal_write_lock); | ||
| 63 | |||
| 64 | static u64 cs_amp_time_now_in_windows_time(void) | ||
| 65 | { | ||
| 66 | u64 time_in_100ns = div_u64(ktime_get_real_ns(), 100); | ||
| 67 | |||
| 68 | return time_in_100ns + UNIX_TIME_TO_WINDOWS_TIME_OFFSET; | ||
| 69 | } | ||
| 70 | |||
| 49 | static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, | 71 | static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, |
| 50 | const struct cirrus_amp_cal_controls *controls, | 72 | const struct cirrus_amp_cal_controls *controls, |
| 51 | const char *ctl_name, u32 val) | 73 | const char *ctl_name, u32 val) |
| @@ -73,6 +95,34 @@ static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, · 21 unmodified lines | |||
| 73 | return -ENODEV; | 95 | return -ENODEV; |
| 74 | } | 96 | } |
| 75 | 97 | ||
| 98 | static int cs_amp_read_cal_coeff(struct cs_dsp *dsp, | ||
| 99 | const struct cirrus_amp_cal_controls *controls, | ||
| 100 | const char *ctl_name, u32 *val) | ||
| 101 | { | ||
| 102 | struct cs_dsp_coeff_ctl *cs_ctl; | ||
| 103 | __be32 beval; | ||
| 104 | int ret; | ||
| 105 | |||
| 106 | KUNIT_STATIC_STUB_REDIRECT(cs_amp_read_cal_coeff, dsp, controls, ctl_name, val); | ||
| 107 | |||
| 108 | if (!IS_REACHABLE(CONFIG_FW_CS_DSP)) | ||
| 109 | return -ENODEV; | ||
| 110 | |||
| 111 | scoped_guard(mutex, &dsp->pwr_lock) { | ||
| 112 | cs_ctl = cs_dsp_get_ctl(dsp, ctl_name, controls->mem_region, controls->alg_id); | ||
| 113 | ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &beval, sizeof(beval)); | ||
| 114 | } | ||
| 115 | |||
| 116 | if (ret < 0) { | ||
| 117 | dev_err(dsp->dev, "Failed to write to '%s': %d\n", ctl_name, ret); | ||
| 118 | return ret; | ||
| 119 | } | ||
| 120 | |||
| 121 | *val = be32_to_cpu(beval); | ||
| 122 | |||
| 123 | return 0; | ||
| 124 | } | ||
| 125 | |||
| 76 | static int _cs_amp_write_cal_coeffs(struct cs_dsp *dsp, | 126 | static int _cs_amp_write_cal_coeffs(struct cs_dsp *dsp, |
| 77 | const struct cirrus_amp_cal_controls *controls, | 127 | const struct cirrus_amp_cal_controls *controls, |
| 78 | const struct cirrus_amp_cal_data *data) | 128 | const struct cirrus_amp_cal_data *data) |
| @@ -106,6 +156,45 @@ static int _cs_amp_write_cal_coeffs(struct cs_dsp *dsp, · 27 unmodified lines | |||
| 106 | return 0; | 156 | return 0; |
| 107 | } | 157 | } |
| 108 | 158 | ||
| 159 | static int _cs_amp_read_cal_coeffs(struct cs_dsp *dsp, | ||
| 160 | const struct cirrus_amp_cal_controls *controls, | ||
| 161 | struct cirrus_amp_cal_data *data) | ||
| 162 | { | ||
| 163 | u64 time; | ||
| 164 | u32 val; | ||
| 165 | int ret; | ||
| 166 | |||
| 167 | if (list_empty(&dsp->ctl_list)) { | ||
| 168 | dev_info(dsp->dev, "Calibration disabled due to missing firmware controls\n"); | ||
| 169 | return -ENOENT; | ||
| 170 | } | ||
| 171 | |||
| 172 | ret = cs_amp_read_cal_coeff(dsp, controls, controls->ambient, &val); | ||
| 173 | if (ret) | ||
| 174 | return ret; | ||
| 175 | |||
| 176 | data->calAmbient = (s8)val; | ||
| 177 | |||
| 178 | ret = cs_amp_read_cal_coeff(dsp, controls, controls->calr, &val); | ||
| 179 | if (ret) | ||
| 180 | return ret; | ||
| 181 | |||
| 182 | data->calR = (u16)val; | ||
| 183 | |||
| 184 | ret = cs_amp_read_cal_coeff(dsp, controls, controls->status, &val); | ||
| 185 | if (ret) | ||
| 186 | return ret; | ||
| 187 | |||
| 188 | data->calStatus = (u8)val; | ||
| 189 | |||
| 190 | /* Fill in timestamp */ | ||
| 191 | time = cs_amp_time_now_in_windows_time(); | ||
| 192 | data->calTime[0] = (u32)time; | ||
| 193 | data->calTime[1] = (u32)(time >> 32); | ||
| 194 | |||
| 195 | return 0; | ||
| 196 | } | ||
| 197 | |||
| 109 | /** | 198 | /** |
| 110 | * cs_amp_write_cal_coeffs - Write calibration data to firmware controls. | 199 | * cs_amp_write_cal_coeffs - Write calibration data to firmware controls. |
| 111 | * @dsp: Pointer to struct cs_dsp. | 200 | * @dsp: Pointer to struct cs_dsp. |
| @@ -125,21 +214,78 @@ int cs_amp_write_cal_coeffs(struct cs_dsp *dsp, · 13 unmodified lines | |||
| 125 | } | 214 | } |
| 126 | EXPORT_SYMBOL_NS_GPL(cs_amp_write_cal_coeffs, "SND_SOC_CS_AMP_LIB"); | 215 | EXPORT_SYMBOL_NS_GPL(cs_amp_write_cal_coeffs, "SND_SOC_CS_AMP_LIB"); |
| 127 | 216 | ||
| 217 | /** | ||
| 218 | * cs_amp_read_cal_coeffs - Read calibration data from firmware controls. | ||
| 219 | * @dsp: Pointer to struct cs_dsp. | ||
| 220 | * @controls: Pointer to definition of firmware controls to be read. | ||
| 221 | * @data: Pointer to calibration data where results will be written. | ||
| 222 | * | ||
| 223 | * Returns: 0 on success, else negative error value. | ||
| 224 | */ | ||
| 225 | int cs_amp_read_cal_coeffs(struct cs_dsp *dsp, | ||
| 226 | const struct cirrus_amp_cal_controls *controls, | ||
| 227 | struct cirrus_amp_cal_data *data) | ||
| 228 | { | ||
| 229 | if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) | ||
| 230 | return _cs_amp_read_cal_coeffs(dsp, controls, data); | ||
| 231 | else | ||
| 232 | return -ENODEV; | ||
| 233 | } | ||
| 234 | EXPORT_SYMBOL_NS_GPL(cs_amp_read_cal_coeffs, "SND_SOC_CS_AMP_LIB"); | ||
| 235 | |||
| 236 | /** | ||
| 237 | * cs_amp_write_ambient_temp - write value to calibration ambient temperature | ||
| 238 | * @dsp: Pointer to struct cs_dsp. | ||
| 239 | * @controls: Pointer to definition of firmware controls to be read. | ||
| 240 | * @temp: Temperature in degrees celcius. | ||
| 241 | * | ||
| 242 | * Returns: 0 on success, else negative error value. | ||
| 243 | */ | ||
| 244 | int cs_amp_write_ambient_temp(struct cs_dsp *dsp, | ||
| 245 | const struct cirrus_amp_cal_controls *controls, | ||
| 246 | u32 temp) | ||
| 247 | { | ||
| 248 | if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) | ||
| 249 | return cs_amp_write_cal_coeff(dsp, controls, controls->ambient, temp); | ||
| 250 | else | ||
| 251 | return -ENODEV; | ||
| 252 | } | ||
| 253 | EXPORT_SYMBOL_NS_GPL(cs_amp_write_ambient_temp, "SND_SOC_CS_AMP_LIB"); | ||
| 254 | |||
| 128 | static efi_status_t cs_amp_get_efi_variable(efi_char16_t *name, | 255 | static efi_status_t cs_amp_get_efi_variable(efi_char16_t *name, |
| 129 | efi_guid_t *guid, | 256 | efi_guid_t *guid, |
| 257 | u32 *returned_attr, | ||
| 130 | unsigned long *size, | 258 | unsigned long *size, |
| 131 | void *buf) | 259 | void *buf) |
| 132 | { | 260 | { |
| 133 | u32 attr; | 261 | u32 attr; |
| 134 | 262 | ||
| 135 | KUNIT_STATIC_STUB_REDIRECT(cs_amp_get_efi_variable, name, guid, size, buf); | 263 | if (!returned_attr) |
| 264 | returned_attr = &attr; | ||
| 265 | |||
| 266 | KUNIT_STATIC_STUB_REDIRECT(cs_amp_get_efi_variable, name, guid, | ||
| 267 | returned_attr, size, buf); | ||
| 136 | 268 | ||
| 137 | if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) | 269 | if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE)) |
| 138 | return efi.get_variable(name, guid, &attr, size, buf); | 270 | return efi.get_variable(name, guid, returned_attr, size, buf); |
| 139 | 271 | ||
| 140 | return EFI_NOT_FOUND; | 272 | return EFI_NOT_FOUND; |
| 141 | } | 273 | } |
| 142 | 274 | ||
| 275 | static efi_status_t cs_amp_set_efi_variable(efi_char16_t *name, | ||
| 276 | efi_guid_t *guid, | ||
| 277 | u32 attr, | ||
| 278 | unsigned long size, | ||
| 279 | void *buf) | ||
| 280 | { | ||
| 281 | KUNIT_STATIC_STUB_REDIRECT(cs_amp_set_efi_variable, name, guid, attr, size, buf); | ||
| 282 | |||
| 283 | if (!efi_rt_services_supported(EFI_RT_SUPPORTED_SET_VARIABLE)) | ||
| 284 | return EFI_NOT_FOUND; | ||
| 285 | |||
| 286 | return efi.set_variable(name, guid, attr, size, buf); | ||
| 287 | } | ||
| 288 | |||
| 143 | static int cs_amp_convert_efi_status(efi_status_t status) | 289 | static int cs_amp_convert_efi_status(efi_status_t status) |
| 144 | { | 290 | { |
| 145 | switch (status) { | 291 | switch (status) { |
| @@ -149,6 +295,7 @@ static int cs_amp_convert_efi_status(efi_status_t status) · 3 unmodified lines | |||
| 149 | return -ENOENT; | 295 | return -ENOENT; |
| 150 | case EFI_BUFFER_TOO_SMALL: | 296 | case EFI_BUFFER_TOO_SMALL: |
| 151 | return -EFBIG; | 297 | return -EFBIG; |
| 298 | case EFI_WRITE_PROTECTED: | ||
| 152 | case EFI_UNSUPPORTED: | 299 | case EFI_UNSUPPORTED: |
| 153 | case EFI_ACCESS_DENIED: | 300 | case EFI_ACCESS_DENIED: |
| 154 | case EFI_SECURITY_VIOLATION: | 301 | case EFI_SECURITY_VIOLATION: |
| @@ -158,11 +305,13 @@ static int cs_amp_convert_efi_status(efi_status_t status) · 3 unmodified lines | |||
| 158 | } | 305 | } |
| 159 | } | 306 | } |
| 160 | 307 | ||
| 161 | static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) | 308 | static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev, |
| 309 | efi_char16_t **name, | ||
| 310 | efi_guid_t **guid, | ||
| 311 | u32 *attr) | ||
| 162 | { | 312 | { |
| 163 | struct cirrus_amp_efi_data *efi_data; | 313 | struct cirrus_amp_efi_data *efi_data __free(kfree) = NULL; |
| 164 | unsigned long data_size = 0; | 314 | unsigned long data_size = 0; |
| 165 | u8 *data; | ||
| 166 | efi_status_t status; | 315 | efi_status_t status; |
| 167 | int i, ret; | 316 | int i, ret; |
| 168 | 317 | ||
| @@ -170,7 +319,7 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) · 1 unmodified line | |||
| 170 | for (i = 0; i < ARRAY_SIZE(cs_amp_lib_cal_efivars); i++) { | 319 | for (i = 0; i < ARRAY_SIZE(cs_amp_lib_cal_efivars); i++) { |
| 171 | status = cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name, | 320 | status = cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name, |
| 172 | cs_amp_lib_cal_efivars[i].guid, | 321 | cs_amp_lib_cal_efivars[i].guid, |
| 173 | &data_size, NULL); | 322 | attr, &data_size, NULL); |
| 174 | if (status == EFI_BUFFER_TOO_SMALL) | 323 | if (status == EFI_BUFFER_TOO_SMALL) |
| 175 | break; | 324 | break; |
| 176 | } | 325 | } |
| @@ -178,25 +327,30 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) · 1 unmodified line | |||
| 178 | if (status != EFI_BUFFER_TOO_SMALL) | 327 | if (status != EFI_BUFFER_TOO_SMALL) |
| 179 | return ERR_PTR(-ENOENT); | 328 | return ERR_PTR(-ENOENT); |
| 180 | 329 | ||
| 330 | if (name) | ||
| 331 | *name = cs_amp_lib_cal_efivars[i].name; | ||
| 332 | |||
| 333 | if (guid) | ||
| 334 | *guid = cs_amp_lib_cal_efivars[i].guid; | ||
| 335 | |||
| 181 | if (data_size < sizeof(*efi_data)) { | 336 | if (data_size < sizeof(*efi_data)) { |
| 182 | dev_err(dev, "EFI cal variable truncated\n"); | 337 | dev_err(dev, "EFI cal variable truncated\n"); |
| 183 | return ERR_PTR(-EOVERFLOW); | 338 | return ERR_PTR(-EOVERFLOW); |
| 184 | } | 339 | } |
| 185 | 340 | ||
| 186 | /* Get variable contents into buffer */ | 341 | /* Get variable contents into buffer */ |
| 187 | data = kmalloc(data_size, GFP_KERNEL); | 342 | efi_data = kmalloc(data_size, GFP_KERNEL); |
| 188 | if (!data) | 343 | if (!efi_data) |
| 189 | return ERR_PTR(-ENOMEM); | 344 | return ERR_PTR(-ENOMEM); |
| 190 | 345 | ||
| 191 | status = cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name, | 346 | status = cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name, |
| 192 | cs_amp_lib_cal_efivars[i].guid, | 347 | cs_amp_lib_cal_efivars[i].guid, |
| 193 | &data_size, data); | 348 | attr, &data_size, efi_data); |
| 194 | if (status != EFI_SUCCESS) { | 349 | if (status != EFI_SUCCESS) { |
| 195 | ret = -EINVAL; | 350 | ret = -EINVAL; |
| 196 | goto err; | 351 | goto err; |
| 197 | } | 352 | } |
| 198 | 353 | ||
| 199 | efi_data = (struct cirrus_amp_efi_data *)data; | ||
| 200 | dev_dbg(dev, "Calibration: Size=%d, Amp Count=%d\n", efi_data->size, efi_data->count); | 354 | dev_dbg(dev, "Calibration: Size=%d, Amp Count=%d\n", efi_data->size, efi_data->count); |
| 201 | 355 | ||
| 202 | if ((efi_data->count > 128) || | 356 | if ((efi_data->count > 128) || |
| @@ -206,28 +360,40 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device *dev) · 3 unmodified lines | |||
| 206 | goto err; | 360 | goto err; |
| 207 | } | 361 | } |
| 208 | 362 | ||
| 209 | return efi_data; | 363 | /* This could be zero-filled space pre-allocated by the BIOS */ |
| 364 | if (efi_data->size == 0) | ||
| 365 | efi_data->size = data_size; | ||
| 366 | |||
| 367 | return_ptr(efi_data); | ||
| 210 | 368 | ||
| 211 | err: | 369 | err: |
| 212 | kfree(data); | ||
| 213 | dev_err(dev, "Failed to read calibration data from EFI: %d\n", ret); | 370 | dev_err(dev, "Failed to read calibration data from EFI: %d\n", ret); |
| 214 | 371 | ||
| 215 | return ERR_PTR(ret); | 372 | return ERR_PTR(ret); |
| 216 | } | 373 | } |
| 217 | 374 | ||
| 218 | static u64 cs_amp_cal_target_u64(const struct cirrus_amp_cal_data *data) | 375 | static int cs_amp_set_cal_efi_buffer(struct device *dev, |
| 376 | efi_char16_t *name, | ||
| 377 | efi_guid_t *guid, | ||
| 378 | u32 attr, | ||
| 379 | struct cirrus_amp_efi_data *data) | ||
| 219 | { | 380 | { |
| 220 | return ((u64)data->calTarget[1] << 32) | data->calTarget[0]; | 381 | efi_status_t status; |
| 382 | |||
| 383 | status = cs_amp_set_efi_variable(name, guid, attr, | ||
| 384 | struct_size(data, data, data->count), data); | ||
| 385 | |||
| 386 | return cs_amp_convert_efi_status(status); | ||
| 221 | } | 387 | } |
| 222 | 388 | ||
| 223 | static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_index, | 389 | static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_index, |
| 224 | struct cirrus_amp_cal_data *out_data) | 390 | struct cirrus_amp_cal_data *out_data) |
| 225 | { | 391 | { |
| 226 | struct cirrus_amp_efi_data *efi_data; | 392 | struct cirrus_amp_efi_data *efi_data __free(kfree) = NULL; |
| 227 | struct cirrus_amp_cal_data *cal = NULL; | 393 | struct cirrus_amp_cal_data *cal = NULL; |
| 228 | int i, ret; | 394 | int i; |
| 229 | 395 | ||
| 230 | efi_data = cs_amp_get_cal_efi_buffer(dev); | 396 | efi_data = cs_amp_get_cal_efi_buffer(dev, NULL, NULL, NULL); |
| 231 | if (IS_ERR(efi_data)) | 397 | if (IS_ERR(efi_data)) |
| 232 | return PTR_ERR(efi_data); | 398 | return PTR_ERR(efi_data); |
| 233 | 399 | ||
| @@ -266,17 +432,106 @@ static int _cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, · 32 unmodified lines | |||
| 266 | dev_warn(dev, "Calibration entry %d does not match silicon ID", amp_index); | 432 | dev_warn(dev, "Calibration entry %d does not match silicon ID", amp_index); |
| 267 | } | 433 | } |
| 268 | 434 | ||
| 269 | if (cal) { | 435 | if (!cal) { |
| 270 | memcpy(out_data, cal, sizeof(*out_data)); | ||
| 271 | ret = 0; | ||
| 272 | } else { | ||
| 273 | dev_warn(dev, "No calibration for silicon ID %#llx\n", target_uid); | 436 | dev_warn(dev, "No calibration for silicon ID %#llx\n", target_uid); |
| 274 | ret = -ENOENT; | 437 | return -ENOENT; |
| 438 | } | ||
| 439 | |||
| 440 | memcpy(out_data, cal, sizeof(*out_data)); | ||
| 441 | |||
| 442 | return 0; | ||
| 443 | } | ||
| 444 | |||
| 445 | static int _cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int num_amps, | ||
| 446 | const struct cirrus_amp_cal_data *in_data) | ||
| 447 | { | ||
| 448 | u64 cal_target = cs_amp_cal_target_u64(in_data); | ||
| 449 | unsigned long num_entries; | ||
| 450 | struct cirrus_amp_efi_data *data __free(kfree) = NULL; | ||
| 451 | efi_char16_t *name = CIRRUS_LOGIC_CALIBRATION_EFI_NAME; | ||
| 452 | efi_guid_t *guid = &CIRRUS_LOGIC_CALIBRATION_EFI_GUID; | ||
| 453 | u32 attr = CS_AMP_CAL_DEFAULT_EFI_ATTR; | ||
| 454 | int i, ret; | ||
| 455 | |||
| 456 | if (cal_target == 0) | ||
| 457 | return -EINVAL; | ||
| 458 | |||
| 459 | data = cs_amp_get_cal_efi_buffer(dev, &name, &guid, &attr); | ||
| 460 | ret = PTR_ERR_OR_ZERO(data); | ||
| 461 | if (ret == -ENOENT) { | ||
| 462 | data = NULL; | ||
| 463 | goto alloc_new; | ||
| 464 | } else if (ret) { | ||
| 465 | return ret; | ||
| 466 | } | ||
| 467 | |||
| 468 | /* | ||
| 469 | * If the EFI variable is just zero-filled reserved space the count | ||
| 470 | * must be set. | ||
| 471 | */ | ||
| 472 | if (data->count == 0) | ||
| 473 | data->count = (data->size - sizeof(data)) / sizeof(data->data[0]); | ||
| 474 | |||
| 475 | if (amp_index < 0) { | ||
| 476 | /* Is there already a slot for this target? */ | ||
| 477 | for (amp_index = 0; amp_index < data->count; amp_index++) { | ||
| 478 | if (cs_amp_cal_target_u64(&data->data[amp_index]) == cal_target) | ||
| 479 | break; | ||
| 480 | } | ||
| 481 | |||
| 482 | /* Else find an empty slot */ | ||
| 483 | if (amp_index >= data->count) { | ||
| 484 | for (amp_index = 0; amp_index < data->count; amp_index++) { | ||
| 485 | if ((data->data[amp_index].calTime[0] == 0) && | ||
| 486 | (data->data[amp_index].calTime[1] == 0)) | ||
| 487 | break; | ||
| 488 | } | ||
| 489 | } | ||
| 490 | } else { | ||
| 491 | /* | ||
| 492 | * If the index is forced there could be another active | ||
| 493 | * slot with the same calTarget. So deduplicate. | ||
| 494 | */ | ||
| 495 | for (i = 0; i < data->count; i++) { | ||
| 496 | if (i == amp_index) | ||
| 497 | continue; | ||
| 498 | |||
| 499 | if ((data->data[i].calTime[0] == 0) && (data->data[i].calTime[1] == 0)) | ||
| 500 | continue; | ||
| 501 | |||
| 502 | if (cs_amp_cal_target_u64(&data->data[i]) == cal_target) | ||
| 503 | memset(data->data[i].calTime, 0, sizeof(data->data[i].calTime)); | ||
| 504 | } | ||
| 275 | } | 505 | } |
| 276 | 506 | ||
| 277 | kfree(efi_data); | 507 | alloc_new: |
| 508 | if (amp_index < 0) | ||
| 509 | amp_index = 0; | ||
| 510 | |||
| 511 | num_entries = max(num_amps, amp_index + 1); | ||
| 512 | if (!data || (data->count < num_entries)) { | ||
| 513 | struct cirrus_amp_efi_data *old_data __free(kfree) = no_free_ptr(data); | ||
| 514 | unsigned int new_data_size = struct_size(data, data, num_entries); | ||
| 515 | |||
| 516 | data = kzalloc(new_data_size, GFP_KERNEL); | ||
| 517 | if (!data) | ||
| 518 | return -ENOMEM; | ||
| 278 | 519 | ||
| 279 | return ret; | 520 | if (old_data) |
| 521 | memcpy(data, old_data, struct_size(old_data, data, old_data->count)); | ||
| 522 | |||
| 523 | data->count = num_entries; | ||
| 524 | data->size = new_data_size; | ||
| 525 | } | ||
| 526 | |||
| 527 | data->data[amp_index] = *in_data; | ||
| 528 | ret = cs_amp_set_cal_efi_buffer(dev, name, guid, attr, data); | ||
| 529 | if (ret) { | ||
| 530 | dev_err(dev, "Failed writing calibration to EFI: %d\n", ret); | ||
| 531 | return ret; | ||
| 532 | } | ||
| 533 | |||
| 534 | return 0; | ||
| 280 | } | 535 | } |
| 281 | 536 | ||
| 282 | /** | 537 | /** |
| @@ -325,6 +580,46 @@ int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, int amp_ · 42 unmodified lines | |||
| 325 | } | 580 | } |
| 326 | EXPORT_SYMBOL_NS_GPL(cs_amp_get_efi_calibration_data, "SND_SOC_CS_AMP_LIB"); | 581 | EXPORT_SYMBOL_NS_GPL(cs_amp_get_efi_calibration_data, "SND_SOC_CS_AMP_LIB"); |
| 327 | 582 | ||
| 583 | /** | ||
| 584 | * cs_amp_set_efi_calibration_data - write a calibration data entry to EFI. | ||
| 585 | * @dev: struct device of the caller. | ||
| 586 | * @amp_index: Entry index to use, or -1 to use any available slot. | ||
| 587 | * @num_amps: Maximum number of amps to reserve slots for, or -1 to ignore. | ||
| 588 | * @in_data: struct cirrus_amp_cal_data entry to be written to EFI. | ||
| 589 | * | ||
| 590 | * If a Vendor-specific variable exists it will be updated, | ||
| 591 | * else if the Cirrus variable exists it will be updated | ||
| 592 | * else the Cirrus variable will be created. | ||
| 593 | * | ||
| 594 | * If amp_index >= 0 the data will be placed in this entry of the calibration | ||
| 595 | * data array, overwriting what was in that entry. Any other entries with the | ||
| 596 | * same calTarget will be marked empty. | ||
| 597 | * | ||
| 598 | * If amp_index < 0 and in_data->calTarget matches any existing entry, that | ||
| 599 | * entry will be overwritten. Else the first available free entry will be used, | ||
| 600 | * extending the size of the EFI variable if there are no free entries. | ||
| 601 | * | ||
| 602 | * If num_amps > 0 the EFI variable will be sized to contain at least this | ||
| 603 | * many calibration entries, with any new entries marked empty. | ||
| 604 | * | ||
| 605 | * Return: 0 if the write was successful, -EFBIG if space could not be made in | ||
| 606 | * the EFI file to add the entry, -EACCES if it was not possible to | ||
| 607 | * read or write the EFI variable. | ||
| 608 | */ | ||
| 609 | int cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int num_amps, | ||
| 610 | const struct cirrus_amp_cal_data *in_data) | ||
| 611 | { | ||
| 612 | if (IS_ENABLED(CONFIG_EFI) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) { | ||
| 613 | scoped_guard(mutex, &cs_amp_efi_cal_write_lock) { | ||
| 614 | return _cs_amp_set_efi_calibration_data(dev, amp_index, | ||
| 615 | num_amps, in_data); | ||
| 616 | } | ||
| 617 | } | ||
| 618 | |||
| 619 | return -ENOENT; | ||
| 620 | } | ||
| 621 | EXPORT_SYMBOL_NS_GPL(cs_amp_set_efi_calibration_data, "SND_SOC_CS_AMP_LIB"); | ||
| 622 | |||
| 328 | struct cs_amp_spkid_efi { | 623 | struct cs_amp_spkid_efi { |
| 329 | efi_char16_t *name; | 624 | efi_char16_t *name; |
| 330 | efi_guid_t *guid; | 625 | efi_guid_t *guid; |
| @@ -339,7 +634,7 @@ static int cs_amp_get_efi_byte_spkid(struct device *dev, const struct cs_amp_spk · 8 unmodified lines | |||
| 339 | int i, ret; | 634 | int i, ret; |
| 340 | 635 | ||
| 341 | size = sizeof(spkid); | 636 | size = sizeof(spkid); |
| 342 | status = cs_amp_get_efi_variable(info->name, info->guid, &size, &spkid); | 637 | status = cs_amp_get_efi_variable(info->name, info->guid, NULL, &size, &spkid); |
| 343 | ret = cs_amp_convert_efi_status(status); | 638 | ret = cs_amp_convert_efi_status(status); |
| 344 | if (ret < 0) | 639 | if (ret < 0) |
| 345 | return ret; | 640 | return ret; |
| @@ -400,9 +695,36 @@ int cs_amp_get_vendor_spkid(struct device *dev) · 54 unmodified lines | |||
| 400 | } | 695 | } |
| 401 | EXPORT_SYMBOL_NS_GPL(cs_amp_get_vendor_spkid, "SND_SOC_CS_AMP_LIB"); | 696 | EXPORT_SYMBOL_NS_GPL(cs_amp_get_vendor_spkid, "SND_SOC_CS_AMP_LIB"); |
| 402 | 697 | ||
| 698 | /** | ||
| 699 | * cs_amp_create_debugfs - create a debugfs directory for a device | ||
| 700 | * | ||
| 701 | * @dev: pointer to struct device | ||
| 702 | * | ||
| 703 | * Creates a node under "cirrus_logic" in the root of the debugfs filesystem. | ||
| 704 | * This is for Cirrus-specific debugfs functionality to be grouped in a | ||
| 705 | * defined way, independently of the debugfs provided by ALSA/ASoC. | ||
| 706 | * The general ALSA/ASoC debugfs may not be enabled, and does not necessarily | ||
| 707 | * have a stable layout or naming convention. | ||
| 708 | * | ||
| 709 | * Return: Pointer to the dentry for the created directory, or -ENODEV. | ||
| 710 | */ | ||
| 711 | struct dentry *cs_amp_create_debugfs(struct device *dev) | ||
| 712 | { | ||
| 713 | struct dentry *dir; | ||
| 714 | |||
| 715 | dir = debugfs_lookup("cirrus_logic", NULL); | ||
| 716 | if (!dir) | ||
| 717 | dir = debugfs_create_dir("cirrus_logic", NULL); | ||
| 718 | |||
| 719 | return debugfs_create_dir(dev_name(dev), dir); | ||
| 720 | } | ||
| 721 | EXPORT_SYMBOL_NS_GPL(cs_amp_create_debugfs, "SND_SOC_CS_AMP_LIB"); | ||
| 722 | |||
| 403 | static const struct cs_amp_test_hooks cs_amp_test_hook_ptrs = { | 723 | static const struct cs_amp_test_hooks cs_amp_test_hook_ptrs = { |
| 404 | .get_efi_variable = cs_amp_get_efi_variable, | 724 | .get_efi_variable = cs_amp_get_efi_variable, |
| 725 | .set_efi_variable = cs_amp_set_efi_variable, | ||
| 405 | .write_cal_coeff = cs_amp_write_cal_coeff, | 726 | .write_cal_coeff = cs_amp_write_cal_coeff, |
| 727 | .read_cal_coeff = cs_amp_read_cal_coeff, | ||
| 406 | }; | 728 | }; |
| 407 | 729 | ||
| 408 | const struct cs_amp_test_hooks * const cs_amp_test_hooks = | 730 | const struct cs_amp_test_hooks * const cs_amp_test_hooks = |
| @@ -547,7 +547,7 @@ static int cs35l33_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, · 546 unmodified lines | |||
| 547 | unsigned int rx_mask, int slots, int slot_width) | 547 | unsigned int rx_mask, int slots, int slot_width) |
| 548 | { | 548 | { |
| 549 | struct snd_soc_component *component = dai->component; | 549 | struct snd_soc_component *component = dai->component; |
| 550 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 550 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 551 | struct cs35l33_private *priv = snd_soc_component_get_drvdata(component); | 551 | struct cs35l33_private *priv = snd_soc_component_get_drvdata(component); |
| 552 | unsigned int reg, bit_pos, i; | 552 | unsigned int reg, bit_pos, i; |
| 553 | int slot, slot_num; | 553 | int slot, slot_num; |
| @@ -695,7 +695,7 @@ static int cs35l33_set_hg_data(struct snd_soc_component *component, · 141 unmodified lines | |||
| 695 | struct cs35l33_pdata *pdata) | 695 | struct cs35l33_pdata *pdata) |
| 696 | { | 696 | { |
| 697 | struct cs35l33_hg *hg_config = &pdata->hg_config; | 697 | struct cs35l33_hg *hg_config = &pdata->hg_config; |
| 698 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 698 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 699 | struct cs35l33_private *priv = snd_soc_component_get_drvdata(component); | 699 | struct cs35l33_private *priv = snd_soc_component_get_drvdata(component); |
| 700 | 700 | ||
| 701 | if (hg_config->enable_hg_algo) { | 701 | if (hg_config->enable_hg_algo) { |
| @@ -455,8 +455,7 @@ static SOC_ENUM_SINGLE_DECL(pcm_sft_ramp, CS35L36_AMP_DIG_VOL_CTRL, 0, · 454 unmodified lines | |||
| 455 | static int cs35l36_ldm_sel_get(struct snd_kcontrol *kcontrol, | 455 | static int cs35l36_ldm_sel_get(struct snd_kcontrol *kcontrol, |
| 456 | struct snd_ctl_elem_value *ucontrol) | 456 | struct snd_ctl_elem_value *ucontrol) |
| 457 | { | 457 | { |
| 458 | struct snd_soc_component *component = | 458 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 459 | snd_soc_kcontrol_component(kcontrol); | ||
| 460 | struct cs35l36_private *cs35l36 = | 459 | struct cs35l36_private *cs35l36 = |
| 461 | snd_soc_component_get_drvdata(component); | 460 | snd_soc_component_get_drvdata(component); |
| 462 | 461 | ||
| @@ -468,8 +467,7 @@ static int cs35l36_ldm_sel_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 468 | static int cs35l36_ldm_sel_put(struct snd_kcontrol *kcontrol, | 467 | static int cs35l36_ldm_sel_put(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) | 468 | struct snd_ctl_elem_value *ucontrol) |
| 470 | { | 469 | { |
| 471 | struct snd_soc_component *component = | 470 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 472 | snd_soc_kcontrol_component(kcontrol); | ||
| 473 | struct cs35l36_private *cs35l36 = | 471 | struct cs35l36_private *cs35l36 = |
| 474 | snd_soc_component_get_drvdata(component); | 472 | snd_soc_component_get_drvdata(component); |
| 475 | int val = (ucontrol->value.integer.value[0]) ? CS35L36_NG_AMP_EN_MASK : | 473 | int val = (ucontrol->value.integer.value[0]) ? CS35L36_NG_AMP_EN_MASK : |
| @@ -928,7 +928,7 @@ static const struct snd_soc_dapm_widget cs35l41_ext_bst_widget[] = { · 927 unmodified lines | |||
| 928 | static int cs35l41_component_probe(struct snd_soc_component *component) | 928 | static int cs35l41_component_probe(struct snd_soc_component *component) |
| 929 | { | 929 | { |
| 930 | struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component); | 930 | struct cs35l41_private *cs35l41 = snd_soc_component_get_drvdata(component); |
| 931 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 931 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 932 | int ret; | 932 | int ret; |
| 933 | 933 | ||
| 934 | if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) { | 934 | if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) { |
| @@ -198,8 +198,7 @@ static int cs35l45_activate_ctl(struct snd_soc_component *component, · 197 unmodified lines | |||
| 198 | static int cs35l45_amplifier_mode_get(struct snd_kcontrol *kcontrol, | 198 | static int cs35l45_amplifier_mode_get(struct snd_kcontrol *kcontrol, |
| 199 | struct snd_ctl_elem_value *ucontrol) | 199 | struct snd_ctl_elem_value *ucontrol) |
| 200 | { | 200 | { |
| 201 | struct snd_soc_component *component = | 201 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 202 | snd_soc_kcontrol_component(kcontrol); | ||
| 203 | struct cs35l45_private *cs35l45 = | 202 | struct cs35l45_private *cs35l45 = |
| 204 | snd_soc_component_get_drvdata(component); | 203 | snd_soc_component_get_drvdata(component); |
| 205 | 204 | ||
| @@ -211,12 +210,11 @@ static int cs35l45_amplifier_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 211 | static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol, | 210 | static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol, |
| 212 | struct snd_ctl_elem_value *ucontrol) | 211 | struct snd_ctl_elem_value *ucontrol) |
| 213 | { | 212 | { |
| 214 | struct snd_soc_component *component = | 213 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 215 | snd_soc_kcontrol_component(kcontrol); | ||
| 216 | struct cs35l45_private *cs35l45 = | 214 | struct cs35l45_private *cs35l45 = |
| 217 | snd_soc_component_get_drvdata(component); | 215 | snd_soc_component_get_drvdata(component); |
| 218 | struct snd_soc_dapm_context *dapm = | 216 | struct snd_soc_dapm_context *dapm = |
| 219 | snd_soc_component_get_dapm(component); | 217 | snd_soc_component_to_dapm(component); |
| 220 | unsigned int amp_state; | 218 | unsigned int amp_state; |
| 221 | int ret; | 219 | int ret; |
| 222 | 220 | ||
| @@ -235,7 +233,7 @@ static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines | |||
| 235 | 233 | ||
| 236 | regmap_clear_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES, | 234 | regmap_clear_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES, |
| 237 | CS35L45_AMP_EN_MASK); | 235 | CS35L45_AMP_EN_MASK); |
| 238 | snd_soc_component_disable_pin_unlocked(component, "SPK"); | 236 | snd_soc_dapm_disable_pin_unlocked(dapm, "SPK"); |
| 239 | snd_soc_dapm_sync_unlocked(dapm); | 237 | snd_soc_dapm_sync_unlocked(dapm); |
| 240 | 238 | ||
| 241 | if (ucontrol->value.integer.value[0] == AMP_MODE_SPK) { | 239 | if (ucontrol->value.integer.value[0] == AMP_MODE_SPK) { |
| @@ -289,7 +287,7 @@ static int cs35l45_amplifier_mode_put(struct snd_kcontrol *kcontrol, · 47 unmodified lines | |||
| 289 | regmap_set_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES, | 287 | regmap_set_bits(cs35l45->regmap, CS35L45_BLOCK_ENABLES, |
| 290 | CS35L45_AMP_EN_MASK); | 288 | CS35L45_AMP_EN_MASK); |
| 291 | 289 | ||
| 292 | snd_soc_component_enable_pin_unlocked(component, "SPK"); | 290 | snd_soc_dapm_enable_pin_unlocked(dapm, "SPK"); |
| 293 | snd_soc_dapm_sync_unlocked(dapm); | 291 | snd_soc_dapm_sync_unlocked(dapm); |
| 294 | snd_soc_dapm_mutex_unlock(dapm); | 292 | snd_soc_dapm_mutex_unlock(dapm); |
| 295 | 293 | ||
| @@ -6,11 +6,18 @@ · 5 unmodified lines | |||
| 6 | // Cirrus Logic International Semiconductor Ltd. | 6 | // Cirrus Logic International Semiconductor Ltd. |
| 7 | 7 | ||
| 8 | #include <linux/array_size.h> | 8 | #include <linux/array_size.h> |
| 9 | #include <linux/cleanup.h> | ||
| 10 | #include <linux/debugfs.h> | ||
| 9 | #include <linux/firmware/cirrus/wmfw.h> | 11 | #include <linux/firmware/cirrus/wmfw.h> |
| 12 | #include <linux/fs.h> | ||
| 10 | #include <linux/gpio/consumer.h> | 13 | #include <linux/gpio/consumer.h> |
| 14 | #include <linux/kstrtox.h> | ||
| 11 | #include <linux/regmap.h> | 15 | #include <linux/regmap.h> |
| 12 | #include <linux/regulator/consumer.h> | 16 | #include <linux/regulator/consumer.h> |
| 13 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
| 18 | #include <linux/stddef.h> | ||
| 19 | #include <linux/string.h> | ||
| 20 | #include <linux/string_choices.h> | ||
| 14 | #include <linux/types.h> | 21 | #include <linux/types.h> |
| 15 | #include <sound/cs-amp-lib.h> | 22 | #include <sound/cs-amp-lib.h> |
| 16 | 23 | ||
| @@ -206,6 +213,8 @@ static bool cs35l56_readable_reg(struct device *dev, unsigned int reg) · 189 unmodified lines | |||
| 206 | case CS35L56_IRQ1_MASK_8: | 213 | case CS35L56_IRQ1_MASK_8: |
| 207 | case CS35L56_IRQ1_MASK_18: | 214 | case CS35L56_IRQ1_MASK_18: |
| 208 | case CS35L56_IRQ1_MASK_20: | 215 | case CS35L56_IRQ1_MASK_20: |
| 216 | case CS35L56_MIXER_NGATE_CH1_CFG: | ||
| 217 | case CS35L56_MIXER_NGATE_CH2_CFG: | ||
| 209 | case CS35L56_DSP_VIRTUAL1_MBOX_1: | 218 | case CS35L56_DSP_VIRTUAL1_MBOX_1: |
| 210 | case CS35L56_DSP_VIRTUAL1_MBOX_2: | 219 | case CS35L56_DSP_VIRTUAL1_MBOX_2: |
| 211 | case CS35L56_DSP_VIRTUAL1_MBOX_3: | 220 | case CS35L56_DSP_VIRTUAL1_MBOX_3: |
| @@ -263,6 +272,8 @@ static bool cs35l56_common_volatile_reg(unsigned int reg) · 51 unmodified lines | |||
| 263 | case CS35L56_IRQ1_EINT_1 ... CS35L56_IRQ1_EINT_8: | 272 | case CS35L56_IRQ1_EINT_1 ... CS35L56_IRQ1_EINT_8: |
| 264 | case CS35L56_IRQ1_EINT_18: | 273 | case CS35L56_IRQ1_EINT_18: |
| 265 | case CS35L56_IRQ1_EINT_20: | 274 | case CS35L56_IRQ1_EINT_20: |
| 275 | case CS35L56_MIXER_NGATE_CH1_CFG: | ||
| 276 | case CS35L56_MIXER_NGATE_CH2_CFG: | ||
| 266 | case CS35L56_DSP_VIRTUAL1_MBOX_1: | 277 | case CS35L56_DSP_VIRTUAL1_MBOX_1: |
| 267 | case CS35L56_DSP_VIRTUAL1_MBOX_2: | 278 | case CS35L56_DSP_VIRTUAL1_MBOX_2: |
| 268 | case CS35L56_DSP_VIRTUAL1_MBOX_3: | 279 | case CS35L56_DSP_VIRTUAL1_MBOX_3: |
| @@ -724,15 +735,11 @@ static void cs35l56_issue_wake_event(struct cs35l56_base *cs35l56_base) · 455 unmodified lines | |||
| 724 | cs35l56_wait_control_port_ready(); | 735 | cs35l56_wait_control_port_ready(); |
| 725 | } | 736 | } |
| 726 | 737 | ||
| 727 | int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base) | 738 | static int cs35l56_wait_for_ps3(struct cs35l56_base *cs35l56_base) |
| 728 | { | 739 | { |
| 729 | unsigned int val; | 740 | unsigned int val; |
| 730 | int ret; | 741 | int ret; |
| 731 | 742 | ||
| 732 | if (!cs35l56_base->init_done) | ||
| 733 | return 0; | ||
| 734 | |||
| 735 | /* Firmware must have entered a power-save state */ | ||
| 736 | ret = regmap_read_poll_timeout(cs35l56_base->regmap, | 743 | ret = regmap_read_poll_timeout(cs35l56_base->regmap, |
| 737 | cs35l56_base->fw_reg->transducer_actual_ps, | 744 | cs35l56_base->fw_reg->transducer_actual_ps, |
| 738 | val, (val >= CS35L56_PS3), | 745 | val, (val >= CS35L56_PS3), |
| @@ -741,6 +748,17 @@ int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base) · 2 unmodified lines | |||
| 741 | if (ret) | 748 | if (ret) |
| 742 | dev_warn(cs35l56_base->dev, "PS3 wait failed: %d\n", ret); | 749 | dev_warn(cs35l56_base->dev, "PS3 wait failed: %d\n", ret); |
| 743 | 750 | ||
| 751 | return ret; | ||
| 752 | } | ||
| 753 | |||
| 754 | int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base) | ||
| 755 | { | ||
| 756 | if (!cs35l56_base->init_done) | ||
| 757 | return 0; | ||
| 758 | |||
| 759 | /* Firmware must have entered a power-save state */ | ||
| 760 | cs35l56_wait_for_ps3(cs35l56_base); | ||
| 761 | |||
| 744 | /* Clear BOOT_DONE so it can be used to detect a reboot */ | 762 | /* Clear BOOT_DONE so it can be used to detect a reboot */ |
| 745 | regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, CS35L56_OTP_BOOT_DONE_MASK); | 763 | regmap_write(cs35l56_base->regmap, CS35L56_IRQ1_EINT_4, CS35L56_OTP_BOOT_DONE_MASK); |
| 746 | 764 | ||
| @@ -839,6 +857,8 @@ void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_ds · 92 unmodified lines | |||
| 839 | cs_dsp->mem = cs35l56_dsp1_regions; | 857 | cs_dsp->mem = cs35l56_dsp1_regions; |
| 840 | cs_dsp->num_mems = ARRAY_SIZE(cs35l56_dsp1_regions); | 858 | cs_dsp->num_mems = ARRAY_SIZE(cs35l56_dsp1_regions); |
| 841 | cs_dsp->no_core_startstop = true; | 859 | cs_dsp->no_core_startstop = true; |
| 860 | |||
| 861 | cs35l56_base->dsp = cs_dsp; | ||
| 842 | } | 862 | } |
| 843 | EXPORT_SYMBOL_NS_GPL(cs35l56_init_cs_dsp, "SND_SOC_CS35L56_SHARED"); | 863 | EXPORT_SYMBOL_NS_GPL(cs35l56_init_cs_dsp, "SND_SOC_CS35L56_SHARED"); |
| 844 | 864 | ||
| @@ -853,7 +873,7 @@ struct cs35l56_pte { · 8 unmodified lines | |||
| 853 | } __packed; | 873 | } __packed; |
| 854 | static_assert((sizeof(struct cs35l56_pte) % sizeof(u32)) == 0); | 874 | static_assert((sizeof(struct cs35l56_pte) % sizeof(u32)) == 0); |
| 855 | 875 | ||
| 856 | static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) | 876 | static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base) |
| 857 | { | 877 | { |
| 858 | struct cs35l56_pte pte; | 878 | struct cs35l56_pte pte; |
| 859 | u64 unique_id; | 879 | u64 unique_id; |
| @@ -870,14 +890,15 @@ static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) · 10 unmodified lines | |||
| 870 | unique_id |= (u32)pte.x | ((u32)pte.y << 8) | ((u32)pte.wafer_id << 16) | | 890 | unique_id |= (u32)pte.x | ((u32)pte.y << 8) | ((u32)pte.wafer_id << 16) | |
| 871 | ((u32)pte.dvs << 24); | 891 | ((u32)pte.dvs << 24); |
| 872 | 892 | ||
| 873 | *uid = unique_id; | 893 | cs35l56_base->silicon_uid = unique_id; |
| 874 | 894 | ||
| 875 | return 0; | 895 | return 0; |
| 876 | } | 896 | } |
| 877 | 897 | ||
| 878 | static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) | 898 | static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base) |
| 879 | { | 899 | { |
| 880 | u32 tmp[2]; | 900 | u32 tmp[2]; |
| 901 | u64 unique_id; | ||
| 881 | int ret; | 902 | int ret; |
| 882 | 903 | ||
| 883 | ret = regmap_bulk_read(cs35l56_base->regmap, CS35L56_DIE_STS1, tmp, ARRAY_SIZE(tmp)); | 904 | ret = regmap_bulk_read(cs35l56_base->regmap, CS35L56_DIE_STS1, tmp, ARRAY_SIZE(tmp)); |
| @@ -886,9 +907,11 @@ static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) · 2 unmodified lines | |||
| 886 | return ret; | 907 | return ret; |
| 887 | } | 908 | } |
| 888 | 909 | ||
| 889 | *uid = tmp[1]; | 910 | unique_id = tmp[1]; |
| 890 | *uid <<= 32; | 911 | unique_id <<= 32; |
| 891 | *uid |= tmp[0]; | 912 | unique_id |= tmp[0]; |
| 913 | |||
| 914 | cs35l56_base->silicon_uid = unique_id; | ||
| 892 | 915 | ||
| 893 | return 0; | 916 | return 0; |
| 894 | } | 917 | } |
| @@ -915,48 +938,378 @@ static const struct cirrus_amp_cal_controls cs35l63_calibration_controls = { · 20 unmodified lines | |||
| 915 | 938 | ||
| 916 | int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base) | 939 | int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base) |
| 917 | { | 940 | { |
| 918 | u64 silicon_uid = 0; | ||
| 919 | int ret; | 941 | int ret; |
| 920 | 942 | ||
| 921 | /* Driver can't apply calibration to a secured part, so skip */ | 943 | /* Driver can't apply calibration to a secured part, so skip */ |
| 922 | if (cs35l56_base->secured) | 944 | if (cs35l56_base->secured) |
| 923 | return 0; | 945 | return 0; |
| 924 | 946 | ||
| 947 | ret = cs_amp_get_efi_calibration_data(cs35l56_base->dev, | ||
| 948 | cs35l56_base->silicon_uid, | ||
| 949 | cs35l56_base->cal_index, | ||
| 950 | &cs35l56_base->cal_data); | ||
| 951 | |||
| 952 | /* Only return an error status if probe should be aborted */ | ||
| 953 | if ((ret == -ENOENT) || (ret == -EOVERFLOW)) | ||
| 954 | return 0; | ||
| 955 | |||
| 956 | if (ret < 0) | ||
| 957 | return ret; | ||
| 958 | |||
| 959 | cs35l56_base->cal_data_valid = true; | ||
| 960 | |||
| 961 | return 0; | ||
| 962 | } | ||
| 963 | EXPORT_SYMBOL_NS_GPL(cs35l56_get_calibration, "SND_SOC_CS35L56_SHARED"); | ||
| 964 | |||
| 965 | int cs35l56_stash_calibration(struct cs35l56_base *cs35l56_base, | ||
| 966 | const struct cirrus_amp_cal_data *data) | ||
| 967 | { | ||
| 968 | |||
| 969 | /* Ignore if it is empty */ | ||
| 970 | if (!data->calTime[0] && !data->calTime[1]) | ||
| 971 | return -ENODATA; | ||
| 972 | |||
| 973 | if (cs_amp_cal_target_u64(data) != cs35l56_base->silicon_uid) { | ||
| 974 | dev_err(cs35l56_base->dev, "cal_data not for this silicon ID\n"); | ||
| 975 | return -EINVAL; | ||
| 976 | } | ||
| 977 | |||
| 978 | cs35l56_base->cal_data = *data; | ||
| 979 | cs35l56_base->cal_data_valid = true; | ||
| 980 | |||
| 981 | return 0; | ||
| 982 | } | ||
| 983 | EXPORT_SYMBOL_NS_GPL(cs35l56_stash_calibration, "SND_SOC_CS35L56_SHARED"); | ||
| 984 | |||
| 985 | static int cs35l56_perform_calibration(struct cs35l56_base *cs35l56_base) | ||
| 986 | { | ||
| 987 | const struct cirrus_amp_cal_controls *calibration_controls = | ||
| 988 | cs35l56_base->calibration_controls; | ||
| 989 | struct cs_dsp *dsp = cs35l56_base->dsp; | ||
| 990 | struct cirrus_amp_cal_data cal_data; | ||
| 991 | struct cs_dsp_coeff_ctl *ctl; | ||
| 992 | bool ngate_ch1_was_enabled = false; | ||
| 993 | bool ngate_ch2_was_enabled = false; | ||
| 994 | int cali_norm_en_alg_id, cali_norm_en_mem; | ||
| 995 | int ret; | ||
| 996 | __be32 val; | ||
| 997 | |||
| 998 | if (cs35l56_base->silicon_uid == 0) { | ||
| 999 | dev_err(cs35l56_base->dev, "Cannot calibrate: no silicon UID\n"); | ||
| 1000 | return -ENXIO; | ||
| 1001 | } | ||
| 1002 | |||
| 925 | switch (cs35l56_base->type) { | 1003 | switch (cs35l56_base->type) { |
| 926 | case 0x54: | 1004 | case 0x54: |
| 927 | case 0x56: | 1005 | case 0x56: |
| 928 | case 0x57: | 1006 | case 0x57: |
| 929 | ret = cs35l56_read_silicon_uid(cs35l56_base, &silicon_uid); | 1007 | if (cs35l56_base->rev < 0xb2) { |
| 930 | break; | 1008 | cali_norm_en_alg_id = 0x9f22f; |
| 931 | case 0x63: | 1009 | cali_norm_en_mem = WMFW_ADSP2_YM; |
| 932 | ret = cs35l63_read_silicon_uid(cs35l56_base, &silicon_uid); | 1010 | } else { |
| 1011 | cali_norm_en_alg_id = 0x9f210; | ||
| 1012 | cali_norm_en_mem = WMFW_ADSP2_XM; | ||
| 1013 | } | ||
| 933 | break; | 1014 | break; |
| 934 | default: | 1015 | default: |
| 935 | ret = -ENODEV; | 1016 | cali_norm_en_alg_id = 0xbf210; |
| 1017 | cali_norm_en_mem = WMFW_ADSP2_XM; | ||
| 936 | break; | 1018 | break; |
| 937 | } | 1019 | } |
| 938 | 1020 | ||
| 1021 | ret = pm_runtime_resume_and_get(cs35l56_base->dev); | ||
| 1022 | if (ret) | ||
| 1023 | return ret; | ||
| 1024 | |||
| 1025 | ret = cs35l56_wait_for_ps3(cs35l56_base); | ||
| 1026 | if (ret) { | ||
| 1027 | ret = -EBUSY; | ||
| 1028 | goto err_pm_put; | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | regmap_update_bits_check(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH1_CFG, | ||
| 1032 | CS35L56_AUX_NGATE_CHn_EN, 0, &ngate_ch1_was_enabled); | ||
| 1033 | regmap_update_bits_check(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH2_CFG, | ||
| 1034 | CS35L56_AUX_NGATE_CHn_EN, 0, &ngate_ch2_was_enabled); | ||
| 1035 | |||
| 1036 | scoped_guard(mutex, &dsp->pwr_lock) { | ||
| 1037 | ctl = cs_dsp_get_ctl(dsp, | ||
| 1038 | calibration_controls->status, | ||
| 1039 | calibration_controls->mem_region, | ||
| 1040 | calibration_controls->alg_id); | ||
| 1041 | if (!ctl) { | ||
| 1042 | dev_err(cs35l56_base->dev, "Could not get %s control\n", | ||
| 1043 | calibration_controls->status); | ||
| 1044 | ret = -EIO; | ||
| 1045 | goto err; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | val = cpu_to_be32(0); | ||
| 1049 | ret = cs_dsp_coeff_write_ctrl(cs_dsp_get_ctl(dsp, | ||
| 1050 | "CALI_NORM_EN", | ||
| 1051 | cali_norm_en_mem, | ||
| 1052 | cali_norm_en_alg_id), | ||
| 1053 | 0, &val, sizeof(val)); | ||
| 1054 | if (ret < 0) { | ||
| 1055 | dev_err(cs35l56_base->dev, "Could not write %s: %d\n", "CALI_NORM_EN", ret); | ||
| 1056 | ret = -EIO; | ||
| 1057 | goto err; | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | ret = cs35l56_mbox_send(cs35l56_base, CS35L56_MBOX_CMD_AUDIO_CALIBRATION); | ||
| 1061 | if (ret) { | ||
| 1062 | ret = -EIO; | ||
| 1063 | goto err; | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | if (read_poll_timeout(cs_dsp_coeff_read_ctrl, ret, | ||
| 1067 | (val == cpu_to_be32(1)), | ||
| 1068 | CS35L56_CALIBRATION_POLL_US, | ||
| 1069 | CS35L56_CALIBRATION_TIMEOUT_US, | ||
| 1070 | true, | ||
| 1071 | ctl, 0, &val, sizeof(val))) { | ||
| 1072 | dev_err(cs35l56_base->dev, "Calibration timed out (CAL_STATUS: %u)\n", | ||
| 1073 | be32_to_cpu(val)); | ||
| 1074 | switch (be32_to_cpu(val)) { | ||
| 1075 | case CS35L56_CAL_STATUS_OUT_OF_RANGE: | ||
| 1076 | ret = -ERANGE; | ||
| 1077 | goto err; | ||
| 1078 | default: | ||
| 1079 | ret = -ETIMEDOUT; | ||
| 1080 | goto err; | ||
| 1081 | } | ||
| 1082 | } | ||
| 1083 | } | ||
| 1084 | |||
| 1085 | cs35l56_base->cal_data_valid = false; | ||
| 1086 | memset(&cal_data, 0, sizeof(cal_data)); | ||
| 1087 | ret = cs_amp_read_cal_coeffs(dsp, calibration_controls, &cal_data); | ||
| 1088 | if (ret) { | ||
| 1089 | ret = -EIO; | ||
| 1090 | goto err; | ||
| 1091 | } | ||
| 1092 | |||
| 1093 | dev_info(cs35l56_base->dev, "Cal status:%d calR:%d ambient:%d\n", | ||
| 1094 | cal_data.calStatus, cal_data.calR, cal_data.calAmbient); | ||
| 1095 | |||
| 1096 | cal_data.calTarget[0] = (u32)cs35l56_base->silicon_uid; | ||
| 1097 | cal_data.calTarget[1] = (u32)(cs35l56_base->silicon_uid >> 32); | ||
| 1098 | cs35l56_base->cal_data = cal_data; | ||
| 1099 | cs35l56_base->cal_data_valid = true; | ||
| 1100 | |||
| 1101 | ret = 0; | ||
| 1102 | |||
| 1103 | err: | ||
| 1104 | if (ngate_ch1_was_enabled) { | ||
| 1105 | regmap_set_bits(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH1_CFG, | ||
| 1106 | CS35L56_AUX_NGATE_CHn_EN); | ||
| 1107 | } | ||
| 1108 | if (ngate_ch2_was_enabled) { | ||
| 1109 | regmap_set_bits(cs35l56_base->regmap, CS35L56_MIXER_NGATE_CH2_CFG, | ||
| 1110 | CS35L56_AUX_NGATE_CHn_EN); | ||
| 1111 | } | ||
| 1112 | err_pm_put: | ||
| 1113 | pm_runtime_put(cs35l56_base->dev); | ||
| 1114 | |||
| 1115 | return ret; | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | ssize_t cs35l56_calibrate_debugfs_write(struct cs35l56_base *cs35l56_base, | ||
| 1119 | const char __user *from, size_t count, | ||
| 1120 | loff_t *ppos) | ||
| 1121 | { | ||
| 1122 | static const char * const options[] = { "factory", "store_uefi" }; | ||
| 1123 | char buf[11] = { 0 }; | ||
| 1124 | int num_amps, ret; | ||
| 1125 | |||
| 1126 | if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON)) | ||
| 1127 | return -ENXIO; | ||
| 1128 | |||
| 1129 | if (*ppos) | ||
| 1130 | return -EINVAL; | ||
| 1131 | |||
| 1132 | ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, from, count); | ||
| 939 | if (ret < 0) | 1133 | if (ret < 0) |
| 940 | return ret; | 1134 | return ret; |
| 941 | 1135 | ||
| 942 | dev_dbg(cs35l56_base->dev, "UniqueID = %#llx\n", silicon_uid); | 1136 | switch (sysfs_match_string(options, buf)) { |
| 1137 | case 0: | ||
| 1138 | ret = cs35l56_perform_calibration(cs35l56_base); | ||
| 1139 | if (ret < 0) | ||
| 1140 | return ret; | ||
| 1141 | break; | ||
| 1142 | case 1: | ||
| 1143 | if (!cs35l56_base->cal_data_valid) | ||
| 1144 | return -ENODATA; | ||
| 1145 | |||
| 1146 | num_amps = cs35l56_base->num_amps; | ||
| 1147 | if (num_amps == 0) | ||
| 1148 | num_amps = -1; | ||
| 1149 | |||
| 1150 | ret = cs_amp_set_efi_calibration_data(cs35l56_base->dev, | ||
| 1151 | cs35l56_base->cal_index, | ||
| 1152 | num_amps, | ||
| 1153 | &cs35l56_base->cal_data); | ||
| 1154 | if (ret < 0) | ||
| 1155 | return ret; | ||
| 1156 | break; | ||
| 1157 | default: | ||
| 1158 | return -EOPNOTSUPP; | ||
| 1159 | } | ||
| 943 | 1160 | ||
| 944 | ret = cs_amp_get_efi_calibration_data(cs35l56_base->dev, silicon_uid, | 1161 | return count; |
| 945 | cs35l56_base->cal_index, | 1162 | } |
| 946 | &cs35l56_base->cal_data); | 1163 | EXPORT_SYMBOL_NS_GPL(cs35l56_calibrate_debugfs_write, "SND_SOC_CS35L56_SHARED"); |
| 947 | 1164 | ||
| 948 | /* Only return an error status if probe should be aborted */ | 1165 | ssize_t cs35l56_cal_ambient_debugfs_write(struct cs35l56_base *cs35l56_base, |
| 949 | if ((ret == -ENOENT) || (ret == -EOVERFLOW)) | 1166 | const char __user *from, size_t count, |
| 950 | return 0; | 1167 | loff_t *ppos) |
| 1168 | { | ||
| 1169 | unsigned long val; | ||
| 1170 | int ret; | ||
| 1171 | |||
| 1172 | if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON)) | ||
| 1173 | return -ENXIO; | ||
| 1174 | |||
| 1175 | if (*ppos) | ||
| 1176 | return -EINVAL; | ||
| 1177 | |||
| 1178 | ret = pm_runtime_resume_and_get(cs35l56_base->dev); | ||
| 1179 | if (ret) | ||
| 1180 | return ret; | ||
| 1181 | |||
| 1182 | ret = kstrtoul_from_user(from, count, 10, &val); | ||
| 1183 | if (ret < 0) | ||
| 1184 | goto out; | ||
| 1185 | |||
| 1186 | ret = cs_amp_write_ambient_temp(cs35l56_base->dsp, cs35l56_base->calibration_controls, val); | ||
| 1187 | if (ret) | ||
| 1188 | ret = -EIO; | ||
| 1189 | out: | ||
| 1190 | pm_runtime_put(cs35l56_base->dev); | ||
| 951 | 1191 | ||
| 952 | if (ret < 0) | 1192 | if (ret < 0) |
| 953 | return ret; | 1193 | return ret; |
| 954 | 1194 | ||
| 955 | cs35l56_base->cal_data_valid = true; | 1195 | return count; |
| 1196 | } | ||
| 1197 | EXPORT_SYMBOL_NS_GPL(cs35l56_cal_ambient_debugfs_write, "SND_SOC_CS35L56_SHARED"); | ||
| 956 | 1198 | ||
| 957 | return 0; | 1199 | ssize_t cs35l56_cal_data_debugfs_read(struct cs35l56_base *cs35l56_base, |
| 1200 | char __user *to, size_t count, | ||
| 1201 | loff_t *ppos) | ||
| 1202 | { | ||
| 1203 | if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON)) | ||
| 1204 | return -ENXIO; | ||
| 1205 | |||
| 1206 | if (!cs35l56_base->cal_data_valid) | ||
| 1207 | return 0; | ||
| 1208 | |||
| 1209 | return simple_read_from_buffer(to, count, ppos, &cs35l56_base->cal_data, | ||
| 1210 | sizeof(cs35l56_base->cal_data)); | ||
| 958 | } | 1211 | } |
| 959 | EXPORT_SYMBOL_NS_GPL(cs35l56_get_calibration, "SND_SOC_CS35L56_SHARED"); | 1212 | EXPORT_SYMBOL_NS_GPL(cs35l56_cal_data_debugfs_read, "SND_SOC_CS35L56_SHARED"); |
| 1213 | |||
| 1214 | ssize_t cs35l56_cal_data_debugfs_write(struct cs35l56_base *cs35l56_base, | ||
| 1215 | const char __user *from, size_t count, | ||
| 1216 | loff_t *ppos) | ||
| 1217 | { | ||
| 1218 | struct cirrus_amp_cal_data cal_data; | ||
| 1219 | int ret; | ||
| 1220 | |||
| 1221 | if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON)) | ||
| 1222 | return -ENXIO; | ||
| 1223 | |||
| 1224 | /* Only allow a full blob to be written */ | ||
| 1225 | if (*ppos || (count != sizeof(cal_data))) | ||
| 1226 | return -EMSGSIZE; | ||
| 1227 | |||
| 1228 | ret = simple_write_to_buffer(&cal_data, sizeof(cal_data), ppos, from, count); | ||
| 1229 | if (ret) | ||
| 1230 | return ret; | ||
| 1231 | |||
| 1232 | ret = cs35l56_stash_calibration(cs35l56_base, &cal_data); | ||
| 1233 | if (ret) | ||
| 1234 | return ret; | ||
| 1235 | |||
| 1236 | return count; | ||
| 1237 | } | ||
| 1238 | EXPORT_SYMBOL_NS_GPL(cs35l56_cal_data_debugfs_write, "SND_SOC_CS35L56_SHARED"); | ||
| 1239 | |||
| 1240 | void cs35l56_create_cal_debugfs(struct cs35l56_base *cs35l56_base, | ||
| 1241 | const struct cs35l56_cal_debugfs_fops *fops) | ||
| 1242 | { | ||
| 1243 | if (!IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS_COMMON)) | ||
| 1244 | return; | ||
| 1245 | |||
| 1246 | cs35l56_base->debugfs = cs_amp_create_debugfs(cs35l56_base->dev); | ||
| 1247 | |||
| 1248 | debugfs_create_file("calibrate", | ||
| 1249 | 0200, cs35l56_base->debugfs, cs35l56_base, | ||
| 1250 | &fops->calibrate); | ||
| 1251 | debugfs_create_file("cal_temperature", | ||
| 1252 | 0200, cs35l56_base->debugfs, cs35l56_base, | ||
| 1253 | &fops->cal_temperature); | ||
| 1254 | debugfs_create_file("cal_data", | ||
| 1255 | 0644, cs35l56_base->debugfs, cs35l56_base, | ||
| 1256 | &fops->cal_data); | ||
| 1257 | } | ||
| 1258 | EXPORT_SYMBOL_NS_GPL(cs35l56_create_cal_debugfs, "SND_SOC_CS35L56_SHARED"); | ||
| 1259 | |||
| 1260 | void cs35l56_remove_cal_debugfs(struct cs35l56_base *cs35l56_base) | ||
| 1261 | { | ||
| 1262 | debugfs_remove_recursive(cs35l56_base->debugfs); | ||
| 1263 | } | ||
| 1264 | EXPORT_SYMBOL_NS_GPL(cs35l56_remove_cal_debugfs, "SND_SOC_CS35L56_SHARED"); | ||
| 1265 | |||
| 1266 | const char * const cs35l56_cal_set_status_text[] = { | ||
| 1267 | "Unknown", "Default", "Set", | ||
| 1268 | }; | ||
| 1269 | EXPORT_SYMBOL_NS_GPL(cs35l56_cal_set_status_text, "SND_SOC_CS35L56_SHARED"); | ||
| 1270 | |||
| 1271 | int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base, | ||
| 1272 | struct snd_ctl_elem_value *uvalue) | ||
| 1273 | { | ||
| 1274 | struct cs_dsp *dsp = cs35l56_base->dsp; | ||
| 1275 | __be32 cal_set_status_be; | ||
| 1276 | int alg_id; | ||
| 1277 | int ret; | ||
| 1278 | |||
| 1279 | switch (cs35l56_base->type) { | ||
| 1280 | case 0x54: | ||
| 1281 | case 0x56: | ||
| 1282 | case 0x57: | ||
| 1283 | alg_id = 0x9f210; | ||
| 1284 | break; | ||
| 1285 | default: | ||
| 1286 | alg_id = 0xbf210; | ||
| 1287 | break; | ||
| 1288 | } | ||
| 1289 | |||
| 1290 | scoped_guard(mutex, &dsp->pwr_lock) { | ||
| 1291 | ret = cs_dsp_coeff_read_ctrl(cs_dsp_get_ctl(dsp, | ||
| 1292 | "CAL_SET_STATUS", | ||
| 1293 | WMFW_ADSP2_YM, alg_id), | ||
| 1294 | 0, &cal_set_status_be, | ||
| 1295 | sizeof(cal_set_status_be)); | ||
| 1296 | } | ||
| 1297 | if (ret) { | ||
| 1298 | uvalue->value.enumerated.item[0] = CS35L56_CAL_SET_STATUS_UNKNOWN; | ||
| 1299 | return 0; | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | switch (be32_to_cpu(cal_set_status_be)) { | ||
| 1303 | case CS35L56_CAL_SET_STATUS_DEFAULT: | ||
| 1304 | case CS35L56_CAL_SET_STATUS_SET: | ||
| 1305 | uvalue->value.enumerated.item[0] = be32_to_cpu(cal_set_status_be); | ||
| 1306 | return 0; | ||
| 1307 | default: | ||
| 1308 | uvalue->value.enumerated.item[0] = CS35L56_CAL_SET_STATUS_UNKNOWN; | ||
| 1309 | return 0; | ||
| 1310 | } | ||
| 1311 | } | ||
| 1312 | EXPORT_SYMBOL_NS_GPL(cs35l56_cal_set_status_get, "SND_SOC_CS35L56_SHARED"); | ||
| 960 | 1313 | ||
| 961 | int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, | 1314 | int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, |
| 962 | bool *fw_missing, unsigned int *fw_version) | 1315 | bool *fw_missing, unsigned int *fw_version) |
| @@ -984,6 +1337,23 @@ int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, · 21 unmodified lines | |||
| 984 | } | 1337 | } |
| 985 | EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED"); | 1338 | EXPORT_SYMBOL_NS_GPL(cs35l56_read_prot_status, "SND_SOC_CS35L56_SHARED"); |
| 986 | 1339 | ||
| 1340 | void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base) | ||
| 1341 | { | ||
| 1342 | unsigned int firmware_version; | ||
| 1343 | bool firmware_missing; | ||
| 1344 | int ret; | ||
| 1345 | |||
| 1346 | ret = cs35l56_read_prot_status(cs35l56_base, &firmware_missing, &firmware_version); | ||
| 1347 | if (ret) | ||
| 1348 | return; | ||
| 1349 | |||
| 1350 | if (!firmware_missing) | ||
| 1351 | return; | ||
| 1352 | |||
| 1353 | dev_warn(cs35l56_base->dev, "FIRMWARE_MISSING\n"); | ||
| 1354 | } | ||
| 1355 | EXPORT_SYMBOL_NS_GPL(cs35l56_warn_if_firmware_missing, "SND_SOC_CS35L56_SHARED"); | ||
| 1356 | |||
| 987 | void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp) | 1357 | void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp) |
| 988 | { | 1358 | { |
| 989 | __be32 pid, sid, tid; | 1359 | __be32 pid, sid, tid; |
| @@ -1111,6 +1481,21 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) · 121 unmodified lines | |||
| 1111 | CS35L56_TEMP_ERR_EINT1_MASK, | 1481 | CS35L56_TEMP_ERR_EINT1_MASK, |
| 1112 | 0); | 1482 | 0); |
| 1113 | 1483 | ||
| 1484 | switch (cs35l56_base->type) { | ||
| 1485 | case 0x54: | ||
| 1486 | case 0x56: | ||
| 1487 | case 0x57: | ||
| 1488 | ret = cs35l56_read_silicon_uid(cs35l56_base); | ||
| 1489 | break; | ||
| 1490 | default: | ||
| 1491 | ret = cs35l63_read_silicon_uid(cs35l56_base); | ||
| 1492 | break; | ||
| 1493 | } | ||
| 1494 | if (ret) | ||
| 1495 | return ret; | ||
| 1496 | |||
| 1497 | dev_dbg(cs35l56_base->dev, "SiliconID = %#llx\n", cs35l56_base->silicon_uid); | ||
| 1498 | |||
| 1114 | return 0; | 1499 | return 0; |
| 1115 | } | 1500 | } |
| 1116 | EXPORT_SYMBOL_NS_GPL(cs35l56_hw_init, "SND_SOC_CS35L56_SHARED"); | 1501 | EXPORT_SYMBOL_NS_GPL(cs35l56_hw_init, "SND_SOC_CS35L56_SHARED"); |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | #include <linux/completion.h> | 10 | #include <linux/completion.h> |
| 11 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
| 12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
| 13 | #include <linux/device.h> | ||
| 13 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 14 | #include <linux/gpio/consumer.h> | 15 | #include <linux/gpio/consumer.h> |
| 15 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
| @@ -65,6 +66,18 @@ static int cs35l56_dspwait_put_volsw(struct snd_kcontrol *kcontrol, · 49 unmodified lines | |||
| 65 | 66 | ||
| 66 | static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0); | 67 | static DECLARE_TLV_DB_SCALE(vol_tlv, -10000, 25, 0); |
| 67 | 68 | ||
| 69 | static SOC_ENUM_SINGLE_DECL(cs35l56_cal_set_status_enum, SND_SOC_NOPM, 0, | ||
| 70 | cs35l56_cal_set_status_text); | ||
| 71 | |||
| 72 | static int cs35l56_cal_set_status_ctl_get(struct snd_kcontrol *kcontrol, | ||
| 73 | struct snd_ctl_elem_value *ucontrol) | ||
| 74 | { | ||
| 75 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | ||
| 76 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); | ||
| 77 | |||
| 78 | return cs35l56_cal_set_status_get(&cs35l56->base, ucontrol); | ||
| 79 | } | ||
| 80 | |||
| 68 | static const struct snd_kcontrol_new cs35l56_controls[] = { | 81 | static const struct snd_kcontrol_new cs35l56_controls[] = { |
| 69 | SOC_SINGLE_EXT("Speaker Switch", | 82 | SOC_SINGLE_EXT("Speaker Switch", |
| 70 | CS35L56_MAIN_RENDER_USER_MUTE, 0, 1, 1, | 83 | CS35L56_MAIN_RENDER_USER_MUTE, 0, 1, 1, |
| @@ -82,6 +95,9 @@ static const struct snd_kcontrol_new cs35l56_controls[] = { · 11 unmodified lines | |||
| 82 | SOC_SINGLE_EXT("Posture Number", CS35L56_MAIN_POSTURE_NUMBER, | 95 | SOC_SINGLE_EXT("Posture Number", CS35L56_MAIN_POSTURE_NUMBER, |
| 83 | 0, 255, 0, | 96 | 0, 255, 0, |
| 84 | cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), | 97 | cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), |
| 98 | SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum, | ||
| 99 | cs35l56_cal_set_status_ctl_get, NULL, | ||
| 100 | SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE), | ||
| 85 | }; | 101 | }; |
| 86 | 102 | ||
| 87 | static const struct snd_kcontrol_new cs35l63_controls[] = { | 103 | static const struct snd_kcontrol_new cs35l63_controls[] = { |
| @@ -101,6 +117,9 @@ static const struct snd_kcontrol_new cs35l63_controls[] = { · 13 unmodified lines | |||
| 101 | SOC_SINGLE_EXT("Posture Number", CS35L63_MAIN_POSTURE_NUMBER, | 117 | SOC_SINGLE_EXT("Posture Number", CS35L63_MAIN_POSTURE_NUMBER, |
| 102 | 0, 255, 0, | 118 | 0, 255, 0, |
| 103 | cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), | 119 | cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), |
| 120 | SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum, | ||
| 121 | cs35l56_cal_set_status_ctl_get, NULL, | ||
| 122 | SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE), | ||
| 104 | }; | 123 | }; |
| 105 | 124 | ||
| 106 | static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum, | 125 | static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum, |
| @@ -250,6 +269,8 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = { · 143 unmodified lines | |||
| 250 | SND_SOC_DAPM_SIGGEN("VDDBMON ADC"), | 269 | SND_SOC_DAPM_SIGGEN("VDDBMON ADC"), |
| 251 | SND_SOC_DAPM_SIGGEN("VBSTMON ADC"), | 270 | SND_SOC_DAPM_SIGGEN("VBSTMON ADC"), |
| 252 | SND_SOC_DAPM_SIGGEN("TEMPMON ADC"), | 271 | SND_SOC_DAPM_SIGGEN("TEMPMON ADC"), |
| 272 | |||
| 273 | SND_SOC_DAPM_INPUT("Calibrate"), | ||
| 253 | }; | 274 | }; |
| 254 | 275 | ||
| 255 | #define CS35L56_SRC_ROUTE(name) \ | 276 | #define CS35L56_SRC_ROUTE(name) \ |
| @@ -286,6 +307,7 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = { · 30 unmodified lines | |||
| 286 | { "DSP1", NULL, "ASP1RX1" }, | 307 | { "DSP1", NULL, "ASP1RX1" }, |
| 287 | { "DSP1", NULL, "ASP1RX2" }, | 308 | { "DSP1", NULL, "ASP1RX2" }, |
| 288 | { "DSP1", NULL, "SDW1 Playback" }, | 309 | { "DSP1", NULL, "SDW1 Playback" }, |
| 310 | { "DSP1", NULL, "Calibrate" }, | ||
| 289 | { "AMP", NULL, "DSP1" }, | 311 | { "AMP", NULL, "DSP1" }, |
| 290 | { "SPK", NULL, "AMP" }, | 312 | { "SPK", NULL, "AMP" }, |
| 291 | 313 | ||
| @@ -801,6 +823,9 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56, bool firmware_missing · 509 unmodified lines | |||
| 801 | goto err_unlock; | 823 | goto err_unlock; |
| 802 | } | 824 | } |
| 803 | 825 | ||
| 826 | /* Check if the firmware is still reported missing */ | ||
| 827 | cs35l56_warn_if_firmware_missing(&cs35l56->base); | ||
| 828 | |||
| 804 | regmap_clear_bits(cs35l56->base.regmap, | 829 | regmap_clear_bits(cs35l56->base.regmap, |
| 805 | cs35l56->base.fw_reg->prot_sts, | 830 | cs35l56->base.fw_reg->prot_sts, |
| 806 | CS35L56_FIRMWARE_MISSING); | 831 | CS35L56_FIRMWARE_MISSING); |
| @@ -874,6 +899,214 @@ err: · 67 unmodified lines | |||
| 874 | pm_runtime_put_autosuspend(cs35l56->base.dev); | 899 | pm_runtime_put_autosuspend(cs35l56->base.dev); |
| 875 | } | 900 | } |
| 876 | 901 | ||
| 902 | static struct snd_soc_dapm_context *cs35l56_power_up_for_cal(struct cs35l56_private *cs35l56) | ||
| 903 | { | ||
| 904 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(cs35l56->component); | ||
| 905 | int ret; | ||
| 906 | |||
| 907 | ret = snd_soc_dapm_enable_pin(dapm, "Calibrate"); | ||
| 908 | if (ret) | ||
| 909 | return ERR_PTR(ret); | ||
| 910 | |||
| 911 | snd_soc_dapm_sync(dapm); | ||
| 912 | |||
| 913 | return dapm; | ||
| 914 | } | ||
| 915 | |||
| 916 | static void cs35l56_power_down_after_cal(struct cs35l56_private *cs35l56) | ||
| 917 | { | ||
| 918 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(cs35l56->component); | ||
| 919 | |||
| 920 | snd_soc_dapm_disable_pin(dapm, "Calibrate"); | ||
| 921 | snd_soc_dapm_sync(dapm); | ||
| 922 | } | ||
| 923 | |||
| 924 | static ssize_t cs35l56_debugfs_calibrate_write(struct file *file, | ||
| 925 | const char __user *from, | ||
| 926 | size_t count, loff_t *ppos) | ||
| 927 | { | ||
| 928 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 929 | struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base); | ||
| 930 | struct snd_soc_dapm_context *dapm; | ||
| 931 | ssize_t ret; | ||
| 932 | |||
| 933 | dapm = cs35l56_power_up_for_cal(cs35l56); | ||
| 934 | if (IS_ERR(dapm)) | ||
| 935 | return PTR_ERR(dapm); | ||
| 936 | |||
| 937 | snd_soc_dapm_mutex_lock(dapm); | ||
| 938 | ret = cs35l56_calibrate_debugfs_write(&cs35l56->base, from, count, ppos); | ||
| 939 | snd_soc_dapm_mutex_unlock(dapm); | ||
| 940 | |||
| 941 | cs35l56_power_down_after_cal(cs35l56); | ||
| 942 | |||
| 943 | return ret; | ||
| 944 | } | ||
| 945 | |||
| 946 | static ssize_t cs35l56_debugfs_cal_temperature_write(struct file *file, | ||
| 947 | const char __user *from, | ||
| 948 | size_t count, loff_t *ppos) | ||
| 949 | { | ||
| 950 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 951 | struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base); | ||
| 952 | struct snd_soc_dapm_context *dapm; | ||
| 953 | ssize_t ret; | ||
| 954 | |||
| 955 | dapm = cs35l56_power_up_for_cal(cs35l56); | ||
| 956 | if (IS_ERR(dapm)) | ||
| 957 | return PTR_ERR(dapm); | ||
| 958 | |||
| 959 | ret = cs35l56_cal_ambient_debugfs_write(&cs35l56->base, from, count, ppos); | ||
| 960 | cs35l56_power_down_after_cal(cs35l56); | ||
| 961 | |||
| 962 | return ret; | ||
| 963 | } | ||
| 964 | |||
| 965 | static ssize_t cs35l56_debugfs_cal_data_read(struct file *file, | ||
| 966 | char __user *to, | ||
| 967 | size_t count, loff_t *ppos) | ||
| 968 | { | ||
| 969 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 970 | struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base); | ||
| 971 | struct snd_soc_dapm_context *dapm; | ||
| 972 | ssize_t ret; | ||
| 973 | |||
| 974 | dapm = cs35l56_power_up_for_cal(cs35l56); | ||
| 975 | if (IS_ERR(dapm)) | ||
| 976 | return PTR_ERR(dapm); | ||
| 977 | |||
| 978 | ret = cs35l56_cal_data_debugfs_read(&cs35l56->base, to, count, ppos); | ||
| 979 | cs35l56_power_down_after_cal(cs35l56); | ||
| 980 | |||
| 981 | return ret; | ||
| 982 | } | ||
| 983 | |||
| 984 | static int cs35l56_new_cal_data_apply(struct cs35l56_private *cs35l56) | ||
| 985 | { | ||
| 986 | struct snd_soc_dapm_context *dapm; | ||
| 987 | int ret; | ||
| 988 | |||
| 989 | if (!cs35l56->base.cal_data_valid) | ||
| 990 | return -ENXIO; | ||
| 991 | |||
| 992 | if (cs35l56->base.secured) | ||
| 993 | return -EACCES; | ||
| 994 | |||
| 995 | dapm = cs35l56_power_up_for_cal(cs35l56); | ||
| 996 | if (IS_ERR(dapm)) | ||
| 997 | return PTR_ERR(dapm); | ||
| 998 | |||
| 999 | snd_soc_dapm_mutex_lock(dapm); | ||
| 1000 | ret = cs_amp_write_cal_coeffs(&cs35l56->dsp.cs_dsp, | ||
| 1001 | cs35l56->base.calibration_controls, | ||
| 1002 | &cs35l56->base.cal_data); | ||
| 1003 | if (ret == 0) | ||
| 1004 | cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_AUDIO_REINIT); | ||
| 1005 | else | ||
| 1006 | ret = -EIO; | ||
| 1007 | |||
| 1008 | snd_soc_dapm_mutex_unlock(dapm); | ||
| 1009 | cs35l56_power_down_after_cal(cs35l56); | ||
| 1010 | |||
| 1011 | return ret; | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | static ssize_t cs35l56_debugfs_cal_data_write(struct file *file, | ||
| 1015 | const char __user *from, | ||
| 1016 | size_t count, loff_t *ppos) | ||
| 1017 | { | ||
| 1018 | struct cs35l56_base *cs35l56_base = file->private_data; | ||
| 1019 | struct cs35l56_private *cs35l56 = cs35l56_private_from_base(cs35l56_base); | ||
| 1020 | int ret; | ||
| 1021 | |||
| 1022 | ret = cs35l56_cal_data_debugfs_write(&cs35l56->base, from, count, ppos); | ||
| 1023 | if (ret == -ENODATA) | ||
| 1024 | return count; /* Ignore writes of empty cal blobs */ | ||
| 1025 | else if (ret < 0) | ||
| 1026 | return -EIO; | ||
| 1027 | |||
| 1028 | ret = cs35l56_new_cal_data_apply(cs35l56); | ||
| 1029 | if (ret) | ||
| 1030 | return ret; | ||
| 1031 | |||
| 1032 | return count; | ||
| 1033 | } | ||
| 1034 | |||
| 1035 | static const struct cs35l56_cal_debugfs_fops cs35l56_cal_debugfs_fops = { | ||
| 1036 | .calibrate = { | ||
| 1037 | .write = cs35l56_debugfs_calibrate_write, | ||
| 1038 | }, | ||
| 1039 | .cal_temperature = { | ||
| 1040 | .write = cs35l56_debugfs_cal_temperature_write, | ||
| 1041 | }, | ||
| 1042 | .cal_data = { | ||
| 1043 | .read = cs35l56_debugfs_cal_data_read, | ||
| 1044 | .write = cs35l56_debugfs_cal_data_write, | ||
| 1045 | }, | ||
| 1046 | }; | ||
| 1047 | |||
| 1048 | static int cs35l56_cal_data_rb_ctl_get(struct snd_kcontrol *kcontrol, | ||
| 1049 | struct snd_ctl_elem_value *ucontrol) | ||
| 1050 | { | ||
| 1051 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | ||
| 1052 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); | ||
| 1053 | |||
| 1054 | if (!cs35l56->base.cal_data_valid) | ||
| 1055 | return -ENODATA; | ||
| 1056 | |||
| 1057 | memcpy(ucontrol->value.bytes.data, &cs35l56->base.cal_data, | ||
| 1058 | sizeof(cs35l56->base.cal_data)); | ||
| 1059 | |||
| 1060 | return 0; | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | static int cs35l56_cal_data_ctl_get(struct snd_kcontrol *kcontrol, | ||
| 1064 | struct snd_ctl_elem_value *ucontrol) | ||
| 1065 | { | ||
| 1066 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | ||
| 1067 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); | ||
| 1068 | |||
| 1069 | /* | ||
| 1070 | * This control is write-only but mixer libraries often try to read | ||
| 1071 | * a control before writing it. So we have to implement read. | ||
| 1072 | * Return zeros so a write of valid data will always be a change | ||
| 1073 | * from its "current value". | ||
| 1074 | */ | ||
| 1075 | memset(ucontrol->value.bytes.data, 0, sizeof(cs35l56->base.cal_data)); | ||
| 1076 | |||
| 1077 | return 0; | ||
| 1078 | } | ||
| 1079 | |||
| 1080 | static int cs35l56_cal_data_ctl_set(struct snd_kcontrol *kcontrol, | ||
| 1081 | struct snd_ctl_elem_value *ucontrol) | ||
| 1082 | { | ||
| 1083 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | ||
| 1084 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); | ||
| 1085 | const struct cirrus_amp_cal_data *cal_data = (const void *)ucontrol->value.bytes.data; | ||
| 1086 | int ret; | ||
| 1087 | |||
| 1088 | if (cs35l56->base.cal_data_valid) | ||
| 1089 | return -EACCES; | ||
| 1090 | |||
| 1091 | ret = cs35l56_stash_calibration(&cs35l56->base, cal_data); | ||
| 1092 | if (ret) | ||
| 1093 | return ret; | ||
| 1094 | |||
| 1095 | ret = cs35l56_new_cal_data_apply(cs35l56); | ||
| 1096 | if (ret < 0) | ||
| 1097 | return ret; | ||
| 1098 | |||
| 1099 | return 1; | ||
| 1100 | } | ||
| 1101 | |||
| 1102 | static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = { | ||
| 1103 | SND_SOC_BYTES_E("CAL_DATA", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32), | ||
| 1104 | cs35l56_cal_data_ctl_get, cs35l56_cal_data_ctl_set), | ||
| 1105 | SND_SOC_BYTES_E_ACC("CAL_DATA_RB", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32), | ||
| 1106 | cs35l56_cal_data_rb_ctl_get, NULL, | ||
| 1107 | SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE), | ||
| 1108 | }; | ||
| 1109 | |||
| 877 | static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) | 1110 | static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) |
| 878 | { | 1111 | { |
| 879 | if (cs35l56->dsp.fwf_suffix) | 1112 | if (cs35l56->dsp.fwf_suffix) |
| @@ -904,6 +1137,7 @@ static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) · 24 unmodified lines | |||
| 904 | 1137 | ||
| 905 | static int cs35l56_component_probe(struct snd_soc_component *component) | 1138 | static int cs35l56_component_probe(struct snd_soc_component *component) |
| 906 | { | 1139 | { |
| 1140 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 907 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); | 1141 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); |
| 908 | struct dentry *debugfs_root = component->debugfs_root; | 1142 | struct dentry *debugfs_root = component->debugfs_root; |
| 909 | unsigned short vendor, device; | 1143 | unsigned short vendor, device; |
| @@ -968,9 +1202,22 @@ static int cs35l56_component_probe(struct snd_soc_component *component) · 58 unmodified lines | |||
| 968 | break; | 1202 | break; |
| 969 | } | 1203 | } |
| 970 | 1204 | ||
| 1205 | if (!ret && IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_SET_CTRL)) { | ||
| 1206 | ret = snd_soc_add_component_controls(component, | ||
| 1207 | cs35l56_cal_data_restore_controls, | ||
| 1208 | ARRAY_SIZE(cs35l56_cal_data_restore_controls)); | ||
| 1209 | } | ||
| 1210 | |||
| 971 | if (ret) | 1211 | if (ret) |
| 972 | return dev_err_probe(cs35l56->base.dev, ret, "unable to add controls\n"); | 1212 | return dev_err_probe(cs35l56->base.dev, ret, "unable to add controls\n"); |
| 973 | 1213 | ||
| 1214 | ret = snd_soc_dapm_disable_pin(dapm, "Calibrate"); | ||
| 1215 | if (ret) | ||
| 1216 | return ret; | ||
| 1217 | |||
| 1218 | if (IS_ENABLED(CONFIG_SND_SOC_CS35L56_CAL_DEBUGFS)) | ||
| 1219 | cs35l56_create_cal_debugfs(&cs35l56->base, &cs35l56_cal_debugfs_fops); | ||
| 1220 | |||
| 974 | queue_work(cs35l56->dsp_wq, &cs35l56->dsp_work); | 1221 | queue_work(cs35l56->dsp_wq, &cs35l56->dsp_work); |
| 975 | 1222 | ||
| 976 | return 0; | 1223 | return 0; |
| @@ -982,6 +1229,8 @@ static void cs35l56_component_remove(struct snd_soc_component *component) · 5 unmodified lines | |||
| 982 | 1229 | ||
| 983 | cancel_work_sync(&cs35l56->dsp_work); | 1230 | cancel_work_sync(&cs35l56->dsp_work); |
| 984 | 1231 | ||
| 1232 | cs35l56_remove_cal_debugfs(&cs35l56->base); | ||
| 1233 | |||
| 985 | if (cs35l56->dsp.cs_dsp.booted) | 1234 | if (cs35l56->dsp.cs_dsp.booted) |
| 986 | wm_adsp_power_down(&cs35l56->dsp); | 1235 | wm_adsp_power_down(&cs35l56->dsp); |
| 987 | 1236 | ||
| @@ -1000,6 +1249,7 @@ static int cs35l56_set_bias_level(struct snd_soc_component *component, · 12 unmodified lines | |||
| 1000 | enum snd_soc_bias_level level) | 1249 | enum snd_soc_bias_level level) |
| 1001 | { | 1250 | { |
| 1002 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); | 1251 | struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component); |
| 1252 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1003 | 1253 | ||
| 1004 | switch (level) { | 1254 | switch (level) { |
| 1005 | case SND_SOC_BIAS_STANDBY: | 1255 | case SND_SOC_BIAS_STANDBY: |
| @@ -1007,7 +1257,7 @@ static int cs35l56_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 1007 | * Wait for patching to complete when transitioning from | 1257 | * Wait for patching to complete when transitioning from |
| 1008 | * BIAS_OFF to BIAS_STANDBY | 1258 | * BIAS_OFF to BIAS_STANDBY |
| 1009 | */ | 1259 | */ |
| 1010 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 1260 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 1011 | cs35l56_wait_dsp_ready(cs35l56); | 1261 | cs35l56_wait_dsp_ready(cs35l56); |
| 1012 | 1262 | ||
| 1013 | break; | 1263 | break; |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | #define CS35L56_H | 10 | #define CS35L56_H |
| 11 | 11 | ||
| 12 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
| 13 | #include <linux/container_of.h> | ||
| 13 | #include <linux/regulator/consumer.h> | 14 | #include <linux/regulator/consumer.h> |
| 14 | #include <linux/pm_runtime.h> | 15 | #include <linux/pm_runtime.h> |
| 15 | #include <linux/workqueue.h> | 16 | #include <linux/workqueue.h> |
| @@ -54,6 +55,11 @@ struct cs35l56_private { · 38 unmodified lines | |||
| 54 | u8 sdw_unique_id; | 55 | u8 sdw_unique_id; |
| 55 | }; | 56 | }; |
| 56 | 57 | ||
| 58 | static inline struct cs35l56_private *cs35l56_private_from_base(struct cs35l56_base *cs35l56_base) | ||
| 59 | { | ||
| 60 | return container_of(cs35l56_base, struct cs35l56_private, base); | ||
| 61 | } | ||
| 62 | |||
| 57 | extern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi; | 63 | extern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi; |
| 58 | 64 | ||
| 59 | int cs35l56_system_suspend(struct device *dev); | 65 | int cs35l56_system_suspend(struct device *dev); |
| @@ -85,9 +85,9 @@ static SOC_ENUM_SINGLE_DECL(cs4234_max_delay, CS4234_VOLUME_MODE, · 84 unmodified lines | |||
| 85 | static int cs4234_dac14_grp_delay_put(struct snd_kcontrol *kctrl, | 85 | static int cs4234_dac14_grp_delay_put(struct snd_kcontrol *kctrl, |
| 86 | struct snd_ctl_elem_value *uctrl) | 86 | struct snd_ctl_elem_value *uctrl) |
| 87 | { | 87 | { |
| 88 | struct snd_soc_component *component = snd_soc_kcontrol_component(kctrl); | 88 | struct snd_soc_component *component = snd_kcontrol_chip(kctrl); |
| 89 | struct cs4234 *cs4234 = snd_soc_component_get_drvdata(component); | 89 | struct cs4234 *cs4234 = snd_soc_component_get_drvdata(component); |
| 90 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 90 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 91 | unsigned int val = 0; | 91 | unsigned int val = 0; |
| 92 | int ret = 0; | 92 | int ret = 0; |
| 93 | 93 | ||
| @@ -126,10 +126,11 @@ static int cs4234_set_bias_level(struct snd_soc_component *component, · 32 unmodified lines | |||
| 126 | enum snd_soc_bias_level level) | 126 | enum snd_soc_bias_level level) |
| 127 | { | 127 | { |
| 128 | struct cs4234 *cs4234 = snd_soc_component_get_drvdata(component); | 128 | struct cs4234 *cs4234 = snd_soc_component_get_drvdata(component); |
| 129 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 129 | 130 | ||
| 130 | switch (level) { | 131 | switch (level) { |
| 131 | case SND_SOC_BIAS_PREPARE: | 132 | case SND_SOC_BIAS_PREPARE: |
| 132 | switch (snd_soc_component_get_bias_level(component)) { | 133 | switch (snd_soc_dapm_get_bias_level(dapm)) { |
| 133 | case SND_SOC_BIAS_STANDBY: | 134 | case SND_SOC_BIAS_STANDBY: |
| 134 | wait_for_completion(&cs4234->vq_ramp_complete); | 135 | wait_for_completion(&cs4234->vq_ramp_complete); |
| 135 | break; | 136 | break; |
| @@ -433,7 +433,7 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute, int direction) · 432 unmodified lines | |||
| 433 | static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol, | 433 | static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol, |
| 434 | struct snd_ctl_elem_value *ucontrol) | 434 | struct snd_ctl_elem_value *ucontrol) |
| 435 | { | 435 | { |
| 436 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 436 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 437 | struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); | 437 | struct cs4270_private *cs4270 = snd_soc_component_get_drvdata(component); |
| 438 | int left = !ucontrol->value.integer.value[0]; | 438 | int left = !ucontrol->value.integer.value[0]; |
| 439 | int right = !ucontrol->value.integer.value[1]; | 439 | int right = !ucontrol->value.integer.value[1]; |
| @@ -10,6 +10,7 @@ · 9 unmodified lines | |||
| 10 | * DAPM support not implemented. | 10 | * DAPM support not implemented. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #include <linux/clk.h> | ||
| 13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 14 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
| 15 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| @@ -163,6 +164,7 @@ struct cs4271_private { · 147 unmodified lines | |||
| 163 | /* enable soft reset workaround */ | 164 | /* enable soft reset workaround */ |
| 164 | bool enable_soft_reset; | 165 | bool enable_soft_reset; |
| 165 | struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; | 166 | struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; |
| 167 | struct clk *clk; | ||
| 166 | }; | 168 | }; |
| 167 | 169 | ||
| 168 | static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = { | 170 | static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = { |
| @@ -276,7 +278,7 @@ static int cs4271_set_deemph(struct snd_soc_component *component) · 107 unmodified lines | |||
| 276 | static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, | 278 | static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, |
| 277 | struct snd_ctl_elem_value *ucontrol) | 279 | struct snd_ctl_elem_value *ucontrol) |
| 278 | { | 280 | { |
| 279 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 281 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 280 | struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); | 282 | struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); |
| 281 | 283 | ||
| 282 | ucontrol->value.integer.value[0] = cs4271->deemph; | 284 | ucontrol->value.integer.value[0] = cs4271->deemph; |
| @@ -286,7 +288,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 286 | static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, | 288 | static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, |
| 287 | struct snd_ctl_elem_value *ucontrol) | 289 | struct snd_ctl_elem_value *ucontrol) |
| 288 | { | 290 | { |
| 289 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 291 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 290 | struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); | 292 | struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); |
| 291 | 293 | ||
| 292 | cs4271->deemph = ucontrol->value.integer.value[0]; | 294 | cs4271->deemph = ucontrol->value.integer.value[0]; |
| @@ -505,6 +507,7 @@ static int cs4271_soc_suspend(struct snd_soc_component *component) · 212 unmodified lines | |||
| 505 | return ret; | 507 | return ret; |
| 506 | 508 | ||
| 507 | regcache_mark_dirty(cs4271->regmap); | 509 | regcache_mark_dirty(cs4271->regmap); |
| 510 | clk_disable_unprepare(cs4271->clk); | ||
| 508 | regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); | 511 | regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); |
| 509 | 512 | ||
| 510 | return 0; | 513 | return 0; |
| @@ -522,6 +525,12 @@ static int cs4271_soc_resume(struct snd_soc_component *component) · 11 unmodified lines | |||
| 522 | return ret; | 525 | return ret; |
| 523 | } | 526 | } |
| 524 | 527 | ||
| 528 | ret = clk_prepare_enable(cs4271->clk); | ||
| 529 | if (ret) { | ||
| 530 | dev_err(component->dev, "Failed to enable clk: %d\n", ret); | ||
| 531 | return ret; | ||
| 532 | } | ||
| 533 | |||
| 525 | /* Do a proper reset after power up */ | 534 | /* Do a proper reset after power up */ |
| 526 | cs4271_reset(component); | 535 | cs4271_reset(component); |
| 527 | 536 | ||
| @@ -576,22 +585,30 @@ static int cs4271_component_probe(struct snd_soc_component *component) · 48 unmodified lines | |||
| 576 | cs4271->enable_soft_reset = cs4271plat->enable_soft_reset; | 585 | cs4271->enable_soft_reset = cs4271plat->enable_soft_reset; |
| 577 | } | 586 | } |
| 578 | 587 | ||
| 588 | ret = clk_prepare_enable(cs4271->clk); | ||
| 589 | if (ret) { | ||
| 590 | dev_err(component->dev, "Failed to enable clk: %d\n", ret); | ||
| 591 | goto err_disable_regulators; | ||
| 592 | } | ||
| 593 | |||
| 579 | /* Reset codec */ | 594 | /* Reset codec */ |
| 580 | cs4271_reset(component); | 595 | cs4271_reset(component); |
| 581 | 596 | ||
| 582 | ret = regcache_sync(cs4271->regmap); | 597 | ret = regcache_sync(cs4271->regmap); |
| 583 | if (ret < 0) | 598 | if (ret < 0) |
| 584 | goto err_disable_regulator; | 599 | goto err_disable_clk; |
| 585 | 600 | ||
| 586 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, | 601 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, |
| 587 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN, | 602 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN, |
| 588 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); | 603 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); |
| 589 | if (ret < 0) | 604 | if (ret < 0) |
| 590 | goto err_disable_regulator; | 605 | goto err_disable_clk; |
| 606 | |||
| 591 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, | 607 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, |
| 592 | CS4271_MODE2_PDN, 0); | 608 | CS4271_MODE2_PDN, 0); |
| 593 | if (ret < 0) | 609 | if (ret < 0) |
| 594 | goto err_disable_regulator; | 610 | goto err_disable_clk; |
| 611 | |||
| 595 | /* Power-up sequence requires 85 uS */ | 612 | /* Power-up sequence requires 85 uS */ |
| 596 | udelay(85); | 613 | udelay(85); |
| 597 | 614 | ||
| @@ -602,7 +619,9 @@ static int cs4271_component_probe(struct snd_soc_component *component) · 4 unmodified lines | |||
| 602 | 619 | ||
| 603 | return 0; | 620 | return 0; |
| 604 | 621 | ||
| 605 | err_disable_regulator: | 622 | err_disable_clk: |
| 623 | clk_disable_unprepare(cs4271->clk); | ||
| 624 | err_disable_regulators: | ||
| 606 | regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); | 625 | regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); |
| 607 | return ret; | 626 | return ret; |
| 608 | } | 627 | } |
| @@ -616,6 +635,7 @@ static void cs4271_component_remove(struct snd_soc_component *component) · 7 unmodified lines | |||
| 616 | 635 | ||
| 617 | regcache_mark_dirty(cs4271->regmap); | 636 | regcache_mark_dirty(cs4271->regmap); |
| 618 | regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); | 637 | regulator_bulk_disable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); |
| 638 | clk_disable_unprepare(cs4271->clk); | ||
| 619 | }; | 639 | }; |
| 620 | 640 | ||
| 621 | static const struct snd_soc_component_driver soc_component_dev_cs4271 = { | 641 | static const struct snd_soc_component_driver soc_component_dev_cs4271 = { |
| @@ -650,6 +670,10 @@ static int cs4271_common_probe(struct device *dev, · 28 unmodified lines | |||
| 650 | "error retrieving RESET GPIO\n"); | 670 | "error retrieving RESET GPIO\n"); |
| 651 | gpiod_set_consumer_name(cs4271->reset, "CS4271 Reset"); | 671 | gpiod_set_consumer_name(cs4271->reset, "CS4271 Reset"); |
| 652 | 672 | ||
| 673 | cs4271->clk = devm_clk_get_optional(dev, "mclk"); | ||
| 674 | if (IS_ERR(cs4271->clk)) | ||
| 675 | return dev_err_probe(dev, PTR_ERR(cs4271->clk), "Failed to get mclk\n"); | ||
| 676 | |||
| 653 | for (i = 0; i < ARRAY_SIZE(supply_names); i++) | 677 | for (i = 0; i < ARRAY_SIZE(supply_names); i++) |
| 654 | cs4271->supplies[i].supply = supply_names[i]; | 678 | cs4271->supplies[i].supply = supply_names[i]; |
| 655 | 679 | ||
| @@ -403,7 +403,7 @@ static DECLARE_TLV_DB_SCALE(mixer_tlv, -6300, 100, true); · 402 unmodified lines | |||
| 403 | static int cs42l42_slow_start_put(struct snd_kcontrol *kcontrol, | 403 | static int cs42l42_slow_start_put(struct snd_kcontrol *kcontrol, |
| 404 | struct snd_ctl_elem_value *ucontrol) | 404 | struct snd_ctl_elem_value *ucontrol) |
| 405 | { | 405 | { |
| 406 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 406 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 407 | u8 val; | 407 | u8 val; |
| 408 | 408 | ||
| 409 | /* all bits of SLOW_START_EN must change together */ | 409 | /* all bits of SLOW_START_EN must change together */ |
| @@ -300,7 +300,7 @@ irqreturn_t cs42l43_bias_detect_clamp(int irq, void *data) · 299 unmodified lines | |||
| 300 | { | 300 | { |
| 301 | struct cs42l43_codec *priv = data; | 301 | struct cs42l43_codec *priv = data; |
| 302 | 302 | ||
| 303 | queue_delayed_work(system_wq, &priv->bias_sense_timeout, | 303 | queue_delayed_work(system_dfl_wq, &priv->bias_sense_timeout, |
| 304 | msecs_to_jiffies(1000)); | 304 | msecs_to_jiffies(1000)); |
| 305 | 305 | ||
| 306 | return IRQ_HANDLED; | 306 | return IRQ_HANDLED; |
| @@ -502,7 +502,7 @@ static void cs42l43_start_load_detect(struct cs42l43_codec *priv) · 195 unmodified lines | |||
| 502 | 502 | ||
| 503 | dev_dbg(priv->dev, "Start load detect\n"); | 503 | dev_dbg(priv->dev, "Start load detect\n"); |
| 504 | 504 | ||
| 505 | snd_soc_dapm_mutex_lock(snd_soc_component_get_dapm(priv->component)); | 505 | snd_soc_dapm_mutex_lock(snd_soc_component_to_dapm(priv->component)); |
| 506 | 506 | ||
| 507 | priv->load_detect_running = true; | 507 | priv->load_detect_running = true; |
| 508 | 508 | ||
| @@ -539,7 +539,7 @@ static void cs42l43_start_load_detect(struct cs42l43_codec *priv) · 30 unmodified lines | |||
| 539 | CS42L43_HPLOAD_DET_EN_MASK, | 539 | CS42L43_HPLOAD_DET_EN_MASK, |
| 540 | CS42L43_HPLOAD_DET_EN_MASK); | 540 | CS42L43_HPLOAD_DET_EN_MASK); |
| 541 | 541 | ||
| 542 | snd_soc_dapm_mutex_unlock(snd_soc_component_get_dapm(priv->component)); | 542 | snd_soc_dapm_mutex_unlock(snd_soc_component_to_dapm(priv->component)); |
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | static void cs42l43_stop_load_detect(struct cs42l43_codec *priv) | 545 | static void cs42l43_stop_load_detect(struct cs42l43_codec *priv) |
| @@ -548,7 +548,7 @@ static void cs42l43_stop_load_detect(struct cs42l43_codec *priv) · 2 unmodified lines | |||
| 548 | 548 | ||
| 549 | dev_dbg(priv->dev, "Stop load detect\n"); | 549 | dev_dbg(priv->dev, "Stop load detect\n"); |
| 550 | 550 | ||
| 551 | snd_soc_dapm_mutex_lock(snd_soc_component_get_dapm(priv->component)); | 551 | snd_soc_dapm_mutex_lock(snd_soc_component_to_dapm(priv->component)); |
| 552 | 552 | ||
| 553 | regmap_update_bits(cs42l43->regmap, CS42L43_LOADDETENA, | 553 | regmap_update_bits(cs42l43->regmap, CS42L43_LOADDETENA, |
| 554 | CS42L43_HPLOAD_DET_EN_MASK, 0); | 554 | CS42L43_HPLOAD_DET_EN_MASK, 0); |
| @@ -587,7 +587,7 @@ static void cs42l43_stop_load_detect(struct cs42l43_codec *priv) · 32 unmodified lines | |||
| 587 | 587 | ||
| 588 | priv->load_detect_running = false; | 588 | priv->load_detect_running = false; |
| 589 | 589 | ||
| 590 | snd_soc_dapm_mutex_unlock(snd_soc_component_get_dapm(priv->component)); | 590 | snd_soc_dapm_mutex_unlock(snd_soc_component_to_dapm(priv->component)); |
| 591 | } | 591 | } |
| 592 | 592 | ||
| 593 | static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic) | 593 | static int cs42l43_run_load_detect(struct cs42l43_codec *priv, bool mic) |
| @@ -866,7 +866,7 @@ SOC_ENUM_SINGLE_VIRT_DECL(cs42l43_jack_enum, cs42l43_jack_text); · 272 unmodified lines | |||
| 866 | 866 | ||
| 867 | int cs42l43_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 867 | int cs42l43_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 868 | { | 868 | { |
| 869 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 869 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 870 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 870 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 871 | 871 | ||
| 872 | mutex_lock(&priv->jack_lock); | 872 | mutex_lock(&priv->jack_lock); |
| @@ -878,7 +878,7 @@ int cs42l43_jack_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u · 5 unmodified lines | |||
| 878 | 878 | ||
| 879 | int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 879 | int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 880 | { | 880 | { |
| 881 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 881 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 882 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 882 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 883 | struct cs42l43 *cs42l43 = priv->core; | 883 | struct cs42l43 *cs42l43 = priv->core; |
| 884 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 884 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| @@ -154,14 +154,14 @@ static void cs42l43_hp_ilimit_clear_work(struct work_struct *work) · 153 unmodified lines | |||
| 154 | { | 154 | { |
| 155 | struct cs42l43_codec *priv = container_of(work, struct cs42l43_codec, | 155 | struct cs42l43_codec *priv = container_of(work, struct cs42l43_codec, |
| 156 | hp_ilimit_clear_work.work); | 156 | hp_ilimit_clear_work.work); |
| 157 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(priv->component); | 157 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(priv->component); |
| 158 | 158 | ||
| 159 | snd_soc_dapm_mutex_lock(dapm); | 159 | snd_soc_dapm_mutex_lock(dapm); |
| 160 | 160 | ||
| 161 | priv->hp_ilimit_count--; | 161 | priv->hp_ilimit_count--; |
| 162 | 162 | ||
| 163 | if (priv->hp_ilimit_count) | 163 | if (priv->hp_ilimit_count) |
| 164 | queue_delayed_work(system_wq, &priv->hp_ilimit_clear_work, | 164 | queue_delayed_work(system_dfl_wq, &priv->hp_ilimit_clear_work, |
| 165 | msecs_to_jiffies(CS42L43_HP_ILIMIT_DECAY_MS)); | 165 | msecs_to_jiffies(CS42L43_HP_ILIMIT_DECAY_MS)); |
| 166 | 166 | ||
| 167 | snd_soc_dapm_mutex_unlock(dapm); | 167 | snd_soc_dapm_mutex_unlock(dapm); |
| @@ -170,7 +170,7 @@ static void cs42l43_hp_ilimit_clear_work(struct work_struct *work) · 2 unmodified lines | |||
| 170 | static irqreturn_t cs42l43_hp_ilimit(int irq, void *data) | 170 | static irqreturn_t cs42l43_hp_ilimit(int irq, void *data) |
| 171 | { | 171 | { |
| 172 | struct cs42l43_codec *priv = data; | 172 | struct cs42l43_codec *priv = data; |
| 173 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(priv->component); | 173 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(priv->component); |
| 174 | struct cs42l43 *cs42l43 = priv->core; | 174 | struct cs42l43 *cs42l43 = priv->core; |
| 175 | 175 | ||
| 176 | dev_dbg(priv->dev, "headphone ilimit IRQ\n"); | 176 | dev_dbg(priv->dev, "headphone ilimit IRQ\n"); |
| @@ -179,7 +179,7 @@ static irqreturn_t cs42l43_hp_ilimit(int irq, void *data) · 2 unmodified lines | |||
| 179 | 179 | ||
| 180 | if (priv->hp_ilimit_count < CS42L43_HP_ILIMIT_MAX_COUNT) { | 180 | if (priv->hp_ilimit_count < CS42L43_HP_ILIMIT_MAX_COUNT) { |
| 181 | if (!priv->hp_ilimit_count) | 181 | if (!priv->hp_ilimit_count) |
| 182 | queue_delayed_work(system_wq, &priv->hp_ilimit_clear_work, | 182 | queue_delayed_work(system_dfl_wq, &priv->hp_ilimit_clear_work, |
| 183 | msecs_to_jiffies(CS42L43_HP_ILIMIT_DECAY_MS)); | 183 | msecs_to_jiffies(CS42L43_HP_ILIMIT_DECAY_MS)); |
| 184 | 184 | ||
| 185 | priv->hp_ilimit_count++; | 185 | priv->hp_ilimit_count++; |
| @@ -451,7 +451,7 @@ static int cs42l43_asp_hw_params(struct snd_pcm_substream *substream, · 265 unmodified lines | |||
| 451 | static int cs42l43_asp_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 451 | static int cs42l43_asp_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
| 452 | { | 452 | { |
| 453 | struct snd_soc_component *component = dai->component; | 453 | struct snd_soc_component *component = dai->component; |
| 454 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 454 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 455 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 455 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 456 | struct cs42l43 *cs42l43 = priv->core; | 456 | struct cs42l43 *cs42l43 = priv->core; |
| 457 | int provider = regmap_test_bits(cs42l43->regmap, CS42L43_ASP_CLK_CONFIG2, | 457 | int provider = regmap_test_bits(cs42l43->regmap, CS42L43_ASP_CLK_CONFIG2, |
| @@ -949,8 +949,8 @@ CS42L43_DECL_MIXER(amp4, CS42L43_AMP4MIX_INPUT1); · 491 unmodified lines | |||
| 949 | static int cs42l43_dapm_get_volsw(struct snd_kcontrol *kcontrol, | 949 | static int cs42l43_dapm_get_volsw(struct snd_kcontrol *kcontrol, |
| 950 | struct snd_ctl_elem_value *ucontrol) | 950 | struct snd_ctl_elem_value *ucontrol) |
| 951 | { | 951 | { |
| 952 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 952 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 953 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 953 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 954 | int ret; | 954 | int ret; |
| 955 | 955 | ||
| 956 | snd_soc_dapm_mutex_lock(dapm); | 956 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -963,8 +963,8 @@ static int cs42l43_dapm_get_volsw(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 963 | static int cs42l43_dapm_put_volsw(struct snd_kcontrol *kcontrol, | 963 | static int cs42l43_dapm_put_volsw(struct snd_kcontrol *kcontrol, |
| 964 | struct snd_ctl_elem_value *ucontrol) | 964 | struct snd_ctl_elem_value *ucontrol) |
| 965 | { | 965 | { |
| 966 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 966 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 967 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 967 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 968 | int ret; | 968 | int ret; |
| 969 | 969 | ||
| 970 | snd_soc_dapm_mutex_lock(dapm); | 970 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -977,8 +977,8 @@ static int cs42l43_dapm_put_volsw(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 977 | static int cs42l43_dapm_get_enum(struct snd_kcontrol *kcontrol, | 977 | static int cs42l43_dapm_get_enum(struct snd_kcontrol *kcontrol, |
| 978 | struct snd_ctl_elem_value *ucontrol) | 978 | struct snd_ctl_elem_value *ucontrol) |
| 979 | { | 979 | { |
| 980 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 980 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 981 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 981 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 982 | int ret; | 982 | int ret; |
| 983 | 983 | ||
| 984 | snd_soc_dapm_mutex_lock(dapm); | 984 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -991,8 +991,8 @@ static int cs42l43_dapm_get_enum(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 991 | static int cs42l43_dapm_put_enum(struct snd_kcontrol *kcontrol, | 991 | static int cs42l43_dapm_put_enum(struct snd_kcontrol *kcontrol, |
| 992 | struct snd_ctl_elem_value *ucontrol) | 992 | struct snd_ctl_elem_value *ucontrol) |
| 993 | { | 993 | { |
| 994 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 994 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 995 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 995 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 996 | int ret; | 996 | int ret; |
| 997 | 997 | ||
| 998 | snd_soc_dapm_mutex_lock(dapm); | 998 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -1005,7 +1005,7 @@ static int cs42l43_dapm_put_enum(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 1005 | static int cs42l43_eq_get(struct snd_kcontrol *kcontrol, | 1005 | static int cs42l43_eq_get(struct snd_kcontrol *kcontrol, |
| 1006 | struct snd_ctl_elem_value *ucontrol) | 1006 | struct snd_ctl_elem_value *ucontrol) |
| 1007 | { | 1007 | { |
| 1008 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1008 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1009 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 1009 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 1010 | 1010 | ||
| 1011 | memcpy(ucontrol->value.integer.value, priv->eq_coeffs, sizeof(priv->eq_coeffs)); | 1011 | memcpy(ucontrol->value.integer.value, priv->eq_coeffs, sizeof(priv->eq_coeffs)); |
| @@ -1016,8 +1016,8 @@ static int cs42l43_eq_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1016 | static int cs42l43_eq_put(struct snd_kcontrol *kcontrol, | 1016 | static int cs42l43_eq_put(struct snd_kcontrol *kcontrol, |
| 1017 | struct snd_ctl_elem_value *ucontrol) | 1017 | struct snd_ctl_elem_value *ucontrol) |
| 1018 | { | 1018 | { |
| 1019 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1019 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1020 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1020 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1021 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 1021 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 1022 | 1022 | ||
| 1023 | snd_soc_dapm_mutex_lock(dapm); | 1023 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -1088,7 +1088,7 @@ error: · 64 unmodified lines | |||
| 1088 | static int cs42l43_decim_get(struct snd_kcontrol *kcontrol, | 1088 | static int cs42l43_decim_get(struct snd_kcontrol *kcontrol, |
| 1089 | struct snd_ctl_elem_value *ucontrol) | 1089 | struct snd_ctl_elem_value *ucontrol) |
| 1090 | { | 1090 | { |
| 1091 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1091 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1092 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 1092 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 1093 | int ret; | 1093 | int ret; |
| 1094 | 1094 | ||
| @@ -1104,7 +1104,7 @@ static int cs42l43_decim_get(struct snd_kcontrol *kcontrol, · 9 unmodified lines | |||
| 1104 | static int cs42l43_spk_get(struct snd_kcontrol *kcontrol, | 1104 | static int cs42l43_spk_get(struct snd_kcontrol *kcontrol, |
| 1105 | struct snd_ctl_elem_value *ucontrol) | 1105 | struct snd_ctl_elem_value *ucontrol) |
| 1106 | { | 1106 | { |
| 1107 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1107 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1108 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 1108 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 1109 | int ret; | 1109 | int ret; |
| 1110 | 1110 | ||
| @@ -1120,7 +1120,7 @@ static int cs42l43_spk_get(struct snd_kcontrol *kcontrol, · 9 unmodified lines | |||
| 1120 | static int cs42l43_spk_put(struct snd_kcontrol *kcontrol, | 1120 | static int cs42l43_spk_put(struct snd_kcontrol *kcontrol, |
| 1121 | struct snd_ctl_elem_value *ucontrol) | 1121 | struct snd_ctl_elem_value *ucontrol) |
| 1122 | { | 1122 | { |
| 1123 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1123 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1124 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); | 1124 | struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component); |
| 1125 | int ret; | 1125 | int ret; |
| 1126 | 1126 | ||
| @@ -57,7 +57,7 @@ struct cs42l51_private { · 56 unmodified lines | |||
| 57 | static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, | 57 | static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, |
| 58 | struct snd_ctl_elem_value *ucontrol) | 58 | struct snd_ctl_elem_value *ucontrol) |
| 59 | { | 59 | { |
| 60 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 60 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 61 | unsigned long value = snd_soc_component_read(component, CS42L51_PCM_MIXER)&3; | 61 | unsigned long value = snd_soc_component_read(component, CS42L51_PCM_MIXER)&3; |
| 62 | 62 | ||
| 63 | switch (value) { | 63 | switch (value) { |
| @@ -85,7 +85,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 85 | static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, | 85 | static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol, |
| 86 | struct snd_ctl_elem_value *ucontrol) | 86 | struct snd_ctl_elem_value *ucontrol) |
| 87 | { | 87 | { |
| 88 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 88 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 89 | unsigned char val; | 89 | unsigned char val; |
| 90 | 90 | ||
| 91 | switch (ucontrol->value.enumerated.item[0]) { | 91 | switch (ucontrol->value.enumerated.item[0]) { |
| @@ -567,7 +567,7 @@ static int cs42l51_component_probe(struct snd_soc_component *component) · 475 unmodified lines | |||
| 567 | struct cs42l51_private *cs42l51; | 567 | struct cs42l51_private *cs42l51; |
| 568 | 568 | ||
| 569 | cs42l51 = snd_soc_component_get_drvdata(component); | 569 | cs42l51 = snd_soc_component_get_drvdata(component); |
| 570 | dapm = snd_soc_component_get_dapm(component); | 570 | dapm = snd_soc_component_to_dapm(component); |
| 571 | 571 | ||
| 572 | if (cs42l51->mclk_handle) | 572 | if (cs42l51->mclk_handle) |
| 573 | snd_soc_dapm_new_controls(dapm, cs42l51_dapm_mclk_widgets, 1); | 573 | snd_soc_dapm_new_controls(dapm, cs42l51_dapm_mclk_widgets, 1); |
| @@ -851,6 +851,7 @@ static int cs42l52_set_bias_level(struct snd_soc_component *component, · 850 unmodified lines | |||
| 851 | enum snd_soc_bias_level level) | 851 | enum snd_soc_bias_level level) |
| 852 | { | 852 | { |
| 853 | struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component); | 853 | struct cs42l52_private *cs42l52 = snd_soc_component_get_drvdata(component); |
| 854 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 854 | 855 | ||
| 855 | switch (level) { | 856 | switch (level) { |
| 856 | case SND_SOC_BIAS_ON: | 857 | case SND_SOC_BIAS_ON: |
| @@ -860,7 +861,7 @@ static int cs42l52_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 860 | CS42L52_PWRCTL1_PDN_CODEC, 0); | 861 | CS42L52_PWRCTL1_PDN_CODEC, 0); |
| 861 | break; | 862 | break; |
| 862 | case SND_SOC_BIAS_STANDBY: | 863 | case SND_SOC_BIAS_STANDBY: |
| 863 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 864 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 864 | regcache_cache_only(cs42l52->regmap, false); | 865 | regcache_cache_only(cs42l52->regmap, false); |
| 865 | regcache_sync(cs42l52->regmap); | 866 | regcache_sync(cs42l52->regmap); |
| 866 | } | 867 | } |
| @@ -919,7 +920,7 @@ static void cs42l52_beep_work(struct work_struct *work) · 52 unmodified lines | |||
| 919 | struct cs42l52_private *cs42l52 = | 920 | struct cs42l52_private *cs42l52 = |
| 920 | container_of(work, struct cs42l52_private, beep_work); | 921 | container_of(work, struct cs42l52_private, beep_work); |
| 921 | struct snd_soc_component *component = cs42l52->component; | 922 | struct snd_soc_component *component = cs42l52->component; |
| 922 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 923 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 923 | int i; | 924 | int i; |
| 924 | int val = 0; | 925 | int val = 0; |
| 925 | int best = 0; | 926 | int best = 0; |
| @@ -911,6 +911,7 @@ static int cs42l56_set_bias_level(struct snd_soc_component *component, · 910 unmodified lines | |||
| 911 | enum snd_soc_bias_level level) | 911 | enum snd_soc_bias_level level) |
| 912 | { | 912 | { |
| 913 | struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component); | 913 | struct cs42l56_private *cs42l56 = snd_soc_component_get_drvdata(component); |
| 914 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 914 | int ret; | 915 | int ret; |
| 915 | 916 | ||
| 916 | switch (level) { | 917 | switch (level) { |
| @@ -923,7 +924,7 @@ static int cs42l56_set_bias_level(struct snd_soc_component *component, · 6 unmodified lines | |||
| 923 | CS42L56_PDN_ALL_MASK, 0); | 924 | CS42L56_PDN_ALL_MASK, 0); |
| 924 | break; | 925 | break; |
| 925 | case SND_SOC_BIAS_STANDBY: | 926 | case SND_SOC_BIAS_STANDBY: |
| 926 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 927 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 927 | regcache_cache_only(cs42l56->regmap, false); | 928 | regcache_cache_only(cs42l56->regmap, false); |
| 928 | regcache_sync(cs42l56->regmap); | 929 | regcache_sync(cs42l56->regmap); |
| 929 | ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies), | 930 | ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies), |
| @@ -996,7 +997,7 @@ static void cs42l56_beep_work(struct work_struct *work) · 66 unmodified lines | |||
| 996 | struct cs42l56_private *cs42l56 = | 997 | struct cs42l56_private *cs42l56 = |
| 997 | container_of(work, struct cs42l56_private, beep_work); | 998 | container_of(work, struct cs42l56_private, beep_work); |
| 998 | struct snd_soc_component *component = cs42l56->component; | 999 | struct snd_soc_component *component = cs42l56->component; |
| 999 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1000 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1000 | int i; | 1001 | int i; |
| 1001 | int val = 0; | 1002 | int val = 0; |
| 1002 | int best = 0; | 1003 | int best = 0; |
| @@ -1101,6 +1101,7 @@ static int cs42l73_set_bias_level(struct snd_soc_component *component, · 1100 unmodified lines | |||
| 1101 | enum snd_soc_bias_level level) | 1101 | enum snd_soc_bias_level level) |
| 1102 | { | 1102 | { |
| 1103 | struct cs42l73_private *cs42l73 = snd_soc_component_get_drvdata(component); | 1103 | struct cs42l73_private *cs42l73 = snd_soc_component_get_drvdata(component); |
| 1104 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1104 | 1105 | ||
| 1105 | switch (level) { | 1106 | switch (level) { |
| 1106 | case SND_SOC_BIAS_ON: | 1107 | case SND_SOC_BIAS_ON: |
| @@ -1112,7 +1113,7 @@ static int cs42l73_set_bias_level(struct snd_soc_component *component, · 5 unmodified lines | |||
| 1112 | break; | 1113 | break; |
| 1113 | 1114 | ||
| 1114 | case SND_SOC_BIAS_STANDBY: | 1115 | case SND_SOC_BIAS_STANDBY: |
| 1115 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1116 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1116 | regcache_cache_only(cs42l73->regmap, false); | 1117 | regcache_cache_only(cs42l73->regmap, false); |
| 1117 | regcache_sync(cs42l73->regmap); | 1118 | regcache_sync(cs42l73->regmap); |
| 1118 | } | 1119 | } |
| @@ -84,7 +84,7 @@ static const struct regmap_config cs42l84_regmap = { · 83 unmodified lines | |||
| 84 | static int cs42l84_put_dac_vol(struct snd_kcontrol *kctl, | 84 | static int cs42l84_put_dac_vol(struct snd_kcontrol *kctl, |
| 85 | struct snd_ctl_elem_value *val) | 85 | struct snd_ctl_elem_value *val) |
| 86 | { | 86 | { |
| 87 | struct snd_soc_component *component = snd_soc_kcontrol_component(kctl); | 87 | struct snd_soc_component *component = snd_kcontrol_chip(kctl); |
| 88 | struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value; | 88 | struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value; |
| 89 | int vola, volb; | 89 | int vola, volb; |
| 90 | int ret, ret2, updated = 0; | 90 | int ret, ret2, updated = 0; |
| @@ -138,7 +138,7 @@ bail: · 47 unmodified lines | |||
| 138 | static int cs42l84_get_dac_vol(struct snd_kcontrol *kctl, | 138 | static int cs42l84_get_dac_vol(struct snd_kcontrol *kctl, |
| 139 | struct snd_ctl_elem_value *val) | 139 | struct snd_ctl_elem_value *val) |
| 140 | { | 140 | { |
| 141 | struct snd_soc_component *component = snd_soc_kcontrol_component(kctl); | 141 | struct snd_soc_component *component = snd_kcontrol_chip(kctl); |
| 142 | struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value; | 142 | struct soc_mixer_control *mc = (struct soc_mixer_control *) kctl->private_value; |
| 143 | int vola, volb; | 143 | int vola, volb; |
| 144 | int ret; | 144 | int ret; |
| @@ -465,7 +465,7 @@ EXPORT_SYMBOL_GPL(cs42xx8_regmap_config); · 464 unmodified lines | |||
| 465 | static int cs42xx8_component_probe(struct snd_soc_component *component) | 465 | static int cs42xx8_component_probe(struct snd_soc_component *component) |
| 466 | { | 466 | { |
| 467 | struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); | 467 | struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); |
| 468 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 468 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 469 | 469 | ||
| 470 | switch (cs42xx8->drvdata->num_adcs) { | 470 | switch (cs42xx8->drvdata->num_adcs) { |
| 471 | case 3: | 471 | case 3: |
| @@ -1062,7 +1062,7 @@ static int cs43130_pcm_ch_put(struct snd_kcontrol *kcontrol, · 1061 unmodified lines | |||
| 1062 | { | 1062 | { |
| 1063 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1063 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 1064 | unsigned int *item = ucontrol->value.enumerated.item; | 1064 | unsigned int *item = ucontrol->value.enumerated.item; |
| 1065 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1065 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1066 | struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component); | 1066 | struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component); |
| 1067 | unsigned int val; | 1067 | unsigned int val; |
| 1068 | 1068 | ||
| @@ -106,8 +106,7 @@ static int cs47l15_adsp_power_ev(struct snd_soc_dapm_widget *w, · 105 unmodified lines | |||
| 106 | static int cs47l15_in1_adc_get(struct snd_kcontrol *kcontrol, | 106 | static int cs47l15_in1_adc_get(struct snd_kcontrol *kcontrol, |
| 107 | struct snd_ctl_elem_value *ucontrol) | 107 | struct snd_ctl_elem_value *ucontrol) |
| 108 | { | 108 | { |
| 109 | struct snd_soc_component *component = | 109 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 110 | snd_soc_kcontrol_component(kcontrol); | ||
| 111 | struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); | 110 | struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); |
| 112 | 111 | ||
| 113 | ucontrol->value.integer.value[0] = !!cs47l15->in1_lp_mode; | 112 | ucontrol->value.integer.value[0] = !!cs47l15->in1_lp_mode; |
| @@ -118,8 +117,7 @@ static int cs47l15_in1_adc_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 118 | static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol, | 117 | static int cs47l15_in1_adc_put(struct snd_kcontrol *kcontrol, |
| 119 | struct snd_ctl_elem_value *ucontrol) | 118 | struct snd_ctl_elem_value *ucontrol) |
| 120 | { | 119 | { |
| 121 | struct snd_soc_component *component = | 120 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 122 | snd_soc_kcontrol_component(kcontrol); | ||
| 123 | struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); | 121 | struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); |
| 124 | 122 | ||
| 125 | if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode) | 123 | if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode) |
| @@ -1280,6 +1278,7 @@ static const struct snd_soc_dapm_route cs47l15_mono_routes[] = { · 1154 unmodified lines | |||
| 1280 | 1278 | ||
| 1281 | static int cs47l15_component_probe(struct snd_soc_component *component) | 1279 | static int cs47l15_component_probe(struct snd_soc_component *component) |
| 1282 | { | 1280 | { |
| 1281 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1283 | struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); | 1282 | struct cs47l15 *cs47l15 = snd_soc_component_get_drvdata(component); |
| 1284 | struct madera *madera = cs47l15->core.madera; | 1283 | struct madera *madera = cs47l15->core.madera; |
| 1285 | int ret; | 1284 | int ret; |
| @@ -1287,7 +1286,7 @@ static int cs47l15_component_probe(struct snd_soc_component *component) · 1 unmodified line | |||
| 1287 | snd_soc_component_init_regmap(component, madera->regmap); | 1286 | snd_soc_component_init_regmap(component, madera->regmap); |
| 1288 | 1287 | ||
| 1289 | mutex_lock(&madera->dapm_ptr_lock); | 1288 | mutex_lock(&madera->dapm_ptr_lock); |
| 1290 | madera->dapm = snd_soc_component_get_dapm(component); | 1289 | madera->dapm = snd_soc_component_to_dapm(component); |
| 1291 | mutex_unlock(&madera->dapm_ptr_lock); | 1290 | mutex_unlock(&madera->dapm_ptr_lock); |
| 1292 | 1291 | ||
| 1293 | ret = madera_init_inputs(component); | 1292 | ret = madera_init_inputs(component); |
| @@ -1300,7 +1299,7 @@ static int cs47l15_component_probe(struct snd_soc_component *component) · 6 unmodified lines | |||
| 1300 | if (ret) | 1299 | if (ret) |
| 1301 | return ret; | 1300 | return ret; |
| 1302 | 1301 | ||
| 1303 | snd_soc_component_disable_pin(component, "HAPTICS"); | 1302 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 1304 | 1303 | ||
| 1305 | ret = snd_soc_add_component_controls(component, | 1304 | ret = snd_soc_add_component_controls(component, |
| 1306 | madera_adsp_rate_controls, | 1305 | madera_adsp_rate_controls, |
| @@ -1124,7 +1124,7 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data) · 1123 unmodified lines | |||
| 1124 | 1124 | ||
| 1125 | static int cs47l24_component_probe(struct snd_soc_component *component) | 1125 | static int cs47l24_component_probe(struct snd_soc_component *component) |
| 1126 | { | 1126 | { |
| 1127 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1127 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1128 | struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); | 1128 | struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); |
| 1129 | struct arizona *arizona = priv->core.arizona; | 1129 | struct arizona *arizona = priv->core.arizona; |
| 1130 | int ret; | 1130 | int ret; |
| @@ -1153,7 +1153,7 @@ static int cs47l24_component_probe(struct snd_soc_component *component) · 22 unmodified lines | |||
| 1153 | if (ret) | 1153 | if (ret) |
| 1154 | goto err_adsp2_codec_probe; | 1154 | goto err_adsp2_codec_probe; |
| 1155 | 1155 | ||
| 1156 | snd_soc_component_disable_pin(component, "HAPTICS"); | 1156 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 1157 | 1157 | ||
| 1158 | return 0; | 1158 | return 0; |
| 1159 | 1159 | ||
| @@ -1559,6 +1559,7 @@ static const struct snd_soc_dapm_route cs47l35_mono_routes[] = { · 1558 unmodified lines | |||
| 1559 | 1559 | ||
| 1560 | static int cs47l35_component_probe(struct snd_soc_component *component) | 1560 | static int cs47l35_component_probe(struct snd_soc_component *component) |
| 1561 | { | 1561 | { |
| 1562 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1562 | struct cs47l35 *cs47l35 = snd_soc_component_get_drvdata(component); | 1563 | struct cs47l35 *cs47l35 = snd_soc_component_get_drvdata(component); |
| 1563 | struct madera *madera = cs47l35->core.madera; | 1564 | struct madera *madera = cs47l35->core.madera; |
| 1564 | int i, ret; | 1565 | int i, ret; |
| @@ -1566,7 +1567,7 @@ static int cs47l35_component_probe(struct snd_soc_component *component) · 1 unmodified line | |||
| 1566 | snd_soc_component_init_regmap(component, madera->regmap); | 1567 | snd_soc_component_init_regmap(component, madera->regmap); |
| 1567 | 1568 | ||
| 1568 | mutex_lock(&madera->dapm_ptr_lock); | 1569 | mutex_lock(&madera->dapm_ptr_lock); |
| 1569 | madera->dapm = snd_soc_component_get_dapm(component); | 1570 | madera->dapm = snd_soc_component_to_dapm(component); |
| 1570 | mutex_unlock(&madera->dapm_ptr_lock); | 1571 | mutex_unlock(&madera->dapm_ptr_lock); |
| 1571 | 1572 | ||
| 1572 | ret = madera_init_inputs(component); | 1573 | ret = madera_init_inputs(component); |
| @@ -1579,7 +1580,7 @@ static int cs47l35_component_probe(struct snd_soc_component *component) · 6 unmodified lines | |||
| 1579 | if (ret) | 1580 | if (ret) |
| 1580 | return ret; | 1581 | return ret; |
| 1581 | 1582 | ||
| 1582 | snd_soc_component_disable_pin(component, "HAPTICS"); | 1583 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 1583 | 1584 | ||
| 1584 | ret = snd_soc_add_component_controls(component, | 1585 | ret = snd_soc_add_component_controls(component, |
| 1585 | madera_adsp_rate_controls, | 1586 | madera_adsp_rate_controls, |
| @@ -2497,6 +2497,7 @@ static irqreturn_t cs47l85_adsp2_irq(int irq, void *data) · 2496 unmodified lines | |||
| 2497 | 2497 | ||
| 2498 | static int cs47l85_component_probe(struct snd_soc_component *component) | 2498 | static int cs47l85_component_probe(struct snd_soc_component *component) |
| 2499 | { | 2499 | { |
| 2500 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2500 | struct cs47l85 *cs47l85 = snd_soc_component_get_drvdata(component); | 2501 | struct cs47l85 *cs47l85 = snd_soc_component_get_drvdata(component); |
| 2501 | struct madera *madera = cs47l85->core.madera; | 2502 | struct madera *madera = cs47l85->core.madera; |
| 2502 | int i, ret; | 2503 | int i, ret; |
| @@ -2504,7 +2505,7 @@ static int cs47l85_component_probe(struct snd_soc_component *component) · 1 unmodified line | |||
| 2504 | snd_soc_component_init_regmap(component, madera->regmap); | 2505 | snd_soc_component_init_regmap(component, madera->regmap); |
| 2505 | 2506 | ||
| 2506 | mutex_lock(&madera->dapm_ptr_lock); | 2507 | mutex_lock(&madera->dapm_ptr_lock); |
| 2507 | madera->dapm = snd_soc_component_get_dapm(component); | 2508 | madera->dapm = snd_soc_component_to_dapm(component); |
| 2508 | mutex_unlock(&madera->dapm_ptr_lock); | 2509 | mutex_unlock(&madera->dapm_ptr_lock); |
| 2509 | 2510 | ||
| 2510 | ret = madera_init_inputs(component); | 2511 | ret = madera_init_inputs(component); |
| @@ -2516,7 +2517,7 @@ static int cs47l85_component_probe(struct snd_soc_component *component) · 5 unmodified lines | |||
| 2516 | if (ret) | 2517 | if (ret) |
| 2517 | return ret; | 2518 | return ret; |
| 2518 | 2519 | ||
| 2519 | snd_soc_component_disable_pin(component, "HAPTICS"); | 2520 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 2520 | 2521 | ||
| 2521 | ret = snd_soc_add_component_controls(component, | 2522 | ret = snd_soc_add_component_controls(component, |
| 2522 | madera_adsp_rate_controls, | 2523 | madera_adsp_rate_controls, |
| @@ -2416,6 +2416,7 @@ static irqreturn_t cs47l90_adsp2_irq(int irq, void *data) · 2415 unmodified lines | |||
| 2416 | 2416 | ||
| 2417 | static int cs47l90_component_probe(struct snd_soc_component *component) | 2417 | static int cs47l90_component_probe(struct snd_soc_component *component) |
| 2418 | { | 2418 | { |
| 2419 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2419 | struct cs47l90 *cs47l90 = snd_soc_component_get_drvdata(component); | 2420 | struct cs47l90 *cs47l90 = snd_soc_component_get_drvdata(component); |
| 2420 | struct madera *madera = cs47l90->core.madera; | 2421 | struct madera *madera = cs47l90->core.madera; |
| 2421 | int ret, i; | 2422 | int ret, i; |
| @@ -2423,7 +2424,7 @@ static int cs47l90_component_probe(struct snd_soc_component *component) · 1 unmodified line | |||
| 2423 | snd_soc_component_init_regmap(component, madera->regmap); | 2424 | snd_soc_component_init_regmap(component, madera->regmap); |
| 2424 | 2425 | ||
| 2425 | mutex_lock(&madera->dapm_ptr_lock); | 2426 | mutex_lock(&madera->dapm_ptr_lock); |
| 2426 | madera->dapm = snd_soc_component_get_dapm(component); | 2427 | madera->dapm = snd_soc_component_to_dapm(component); |
| 2427 | mutex_unlock(&madera->dapm_ptr_lock); | 2428 | mutex_unlock(&madera->dapm_ptr_lock); |
| 2428 | 2429 | ||
| 2429 | ret = madera_init_inputs(component); | 2430 | ret = madera_init_inputs(component); |
| @@ -2435,7 +2436,7 @@ static int cs47l90_component_probe(struct snd_soc_component *component) · 5 unmodified lines | |||
| 2435 | if (ret) | 2436 | if (ret) |
| 2436 | return ret; | 2437 | return ret; |
| 2437 | 2438 | ||
| 2438 | snd_soc_component_disable_pin(component, "HAPTICS"); | 2439 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 2439 | 2440 | ||
| 2440 | ret = snd_soc_add_component_controls(component, | 2441 | ret = snd_soc_add_component_controls(component, |
| 2441 | madera_adsp_rate_controls, | 2442 | madera_adsp_rate_controls, |
| @@ -52,10 +52,8 @@ static const char * const cs47l92_outdemux_texts[] = { · 51 unmodified lines | |||
| 52 | static int cs47l92_put_demux(struct snd_kcontrol *kcontrol, | 52 | static int cs47l92_put_demux(struct snd_kcontrol *kcontrol, |
| 53 | struct snd_ctl_elem_value *ucontrol) | 53 | struct snd_ctl_elem_value *ucontrol) |
| 54 | { | 54 | { |
| 55 | struct snd_soc_component *component = | 55 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 56 | snd_soc_dapm_kcontrol_component(kcontrol); | 56 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 57 | struct snd_soc_dapm_context *dapm = | ||
| 58 | snd_soc_component_get_dapm(component); | ||
| 59 | struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component); | 57 | struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component); |
| 60 | struct madera_priv *priv = &cs47l92->core; | 58 | struct madera_priv *priv = &cs47l92->core; |
| 61 | struct madera *madera = priv->madera; | 59 | struct madera *madera = priv->madera; |
| @@ -1887,6 +1885,7 @@ static const struct snd_soc_dapm_route cs47l92_mono_routes[] = { · 1825 unmodified lines | |||
| 1887 | 1885 | ||
| 1888 | static int cs47l92_component_probe(struct snd_soc_component *component) | 1886 | static int cs47l92_component_probe(struct snd_soc_component *component) |
| 1889 | { | 1887 | { |
| 1888 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1890 | struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component); | 1889 | struct cs47l92 *cs47l92 = snd_soc_component_get_drvdata(component); |
| 1891 | struct madera *madera = cs47l92->core.madera; | 1890 | struct madera *madera = cs47l92->core.madera; |
| 1892 | int ret; | 1891 | int ret; |
| @@ -1894,7 +1893,7 @@ static int cs47l92_component_probe(struct snd_soc_component *component) · 1 unmodified line | |||
| 1894 | snd_soc_component_init_regmap(component, madera->regmap); | 1893 | snd_soc_component_init_regmap(component, madera->regmap); |
| 1895 | 1894 | ||
| 1896 | mutex_lock(&madera->dapm_ptr_lock); | 1895 | mutex_lock(&madera->dapm_ptr_lock); |
| 1897 | madera->dapm = snd_soc_component_get_dapm(component); | 1896 | madera->dapm = snd_soc_component_to_dapm(component); |
| 1898 | mutex_unlock(&madera->dapm_ptr_lock); | 1897 | mutex_unlock(&madera->dapm_ptr_lock); |
| 1899 | 1898 | ||
| 1900 | ret = madera_init_inputs(component); | 1899 | ret = madera_init_inputs(component); |
| @@ -1907,7 +1906,7 @@ static int cs47l92_component_probe(struct snd_soc_component *component) · 6 unmodified lines | |||
| 1907 | if (ret) | 1906 | if (ret) |
| 1908 | return ret; | 1907 | return ret; |
| 1909 | 1908 | ||
| 1910 | snd_soc_component_disable_pin(component, "HAPTICS"); | 1909 | snd_soc_dapm_disable_pin(dapm, "HAPTICS"); |
| 1911 | 1910 | ||
| 1912 | ret = snd_soc_add_component_controls(component, | 1911 | ret = snd_soc_add_component_controls(component, |
| 1913 | madera_adsp_rate_controls, | 1912 | madera_adsp_rate_controls, |
| @@ -231,7 +231,7 @@ static_assert(ARRAY_SIZE(cs48l32_rate_val) == ARRAY_SIZE(cs48l32_rate_text)); · 230 unmodified lines | |||
| 231 | 231 | ||
| 232 | static int cs48l32_rate_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 232 | static int cs48l32_rate_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 233 | { | 233 | { |
| 234 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 234 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 235 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 235 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 236 | int ret; | 236 | int ret; |
| 237 | 237 | ||
| @@ -320,8 +320,8 @@ static const struct soc_enum cs48l32_sample_rate[] = { · 82 unmodified lines | |||
| 320 | static int cs48l32_inmux_put(struct snd_kcontrol *kcontrol, | 320 | static int cs48l32_inmux_put(struct snd_kcontrol *kcontrol, |
| 321 | struct snd_ctl_elem_value *ucontrol) | 321 | struct snd_ctl_elem_value *ucontrol) |
| 322 | { | 322 | { |
| 323 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 323 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 324 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 324 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); |
| 325 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 325 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 326 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; | 326 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; |
| 327 | unsigned int mux, src_val, in_type; | 327 | unsigned int mux, src_val, in_type; |
| @@ -347,7 +347,7 @@ static int cs48l32_inmux_put(struct snd_kcontrol *kcontrol, · 19 unmodified lines | |||
| 347 | if (in_type == CS48L32_IN_TYPE_SE) | 347 | if (in_type == CS48L32_IN_TYPE_SE) |
| 348 | src_val |= 1 << CS48L32_INx_SRC_SHIFT; | 348 | src_val |= 1 << CS48L32_INx_SRC_SHIFT; |
| 349 | 349 | ||
| 350 | ret = snd_soc_component_update_bits(dapm->component, | 350 | ret = snd_soc_component_update_bits(component, |
| 351 | e->reg, | 351 | e->reg, |
| 352 | CS48L32_INx_SRC_MASK, | 352 | CS48L32_INx_SRC_MASK, |
| 353 | src_val); | 353 | src_val); |
| @@ -385,7 +385,7 @@ static const char * const cs48l32_dmode_texts[] = { · 31 unmodified lines | |||
| 385 | static int cs48l32_dmode_put(struct snd_kcontrol *kcontrol, | 385 | static int cs48l32_dmode_put(struct snd_kcontrol *kcontrol, |
| 386 | struct snd_ctl_elem_value *ucontrol) | 386 | struct snd_ctl_elem_value *ucontrol) |
| 387 | { | 387 | { |
| 388 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 388 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 389 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); | 389 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); |
| 390 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; | 390 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; |
| 391 | unsigned int mode; | 391 | unsigned int mode; |
| @@ -704,8 +704,8 @@ static bool cs48l32_is_input_enabled(struct snd_soc_component *component, · 312 unmodified lines | |||
| 704 | static int cs48l32_in_rate_put(struct snd_kcontrol *kcontrol, | 704 | static int cs48l32_in_rate_put(struct snd_kcontrol *kcontrol, |
| 705 | struct snd_ctl_elem_value *ucontrol) | 705 | struct snd_ctl_elem_value *ucontrol) |
| 706 | { | 706 | { |
| 707 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 707 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 708 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 708 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 709 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 709 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 710 | int ret; | 710 | int ret; |
| 711 | 711 | ||
| @@ -755,8 +755,8 @@ static int cs48l32_low_power_mode_put(struct snd_kcontrol *kcontrol, · 43 unmodified lines | |||
| 755 | struct snd_ctl_elem_value *ucontrol) | 755 | struct snd_ctl_elem_value *ucontrol) |
| 756 | { | 756 | { |
| 757 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | 757 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; |
| 758 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 758 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 759 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 759 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 760 | int ret; | 760 | int ret; |
| 761 | 761 | ||
| 762 | snd_soc_dapm_mutex_lock(dapm); | 762 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -912,7 +912,7 @@ static const struct soc_enum cs48l32_lhpf_mode[] = { · 149 unmodified lines | |||
| 912 | static int cs48l32_lhpf_coeff_put(struct snd_kcontrol *kcontrol, | 912 | static int cs48l32_lhpf_coeff_put(struct snd_kcontrol *kcontrol, |
| 913 | struct snd_ctl_elem_value *ucontrol) | 913 | struct snd_ctl_elem_value *ucontrol) |
| 914 | { | 914 | { |
| 915 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 915 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 916 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 916 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 917 | __be32 *data = (__be32 *)ucontrol->value.bytes.data; | 917 | __be32 *data = (__be32 *)ucontrol->value.bytes.data; |
| 918 | s16 val = (s16)be32_to_cpu(*data); | 918 | s16 val = (s16)be32_to_cpu(*data); |
| @@ -947,7 +947,7 @@ static const struct soc_enum cs48l32_eq_mode[] = { · 28 unmodified lines | |||
| 947 | static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol, | 947 | static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol, |
| 948 | struct snd_ctl_elem_value *ucontrol) | 948 | struct snd_ctl_elem_value *ucontrol) |
| 949 | { | 949 | { |
| 950 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 950 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 951 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 951 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 952 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; | 952 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; |
| 953 | unsigned int item; | 953 | unsigned int item; |
| @@ -961,8 +961,8 @@ static int cs48l32_eq_mode_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 961 | static int cs48l32_eq_mode_put(struct snd_kcontrol *kcontrol, | 961 | static int cs48l32_eq_mode_put(struct snd_kcontrol *kcontrol, |
| 962 | struct snd_ctl_elem_value *ucontrol) | 962 | struct snd_ctl_elem_value *ucontrol) |
| 963 | { | 963 | { |
| 964 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 964 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 965 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 965 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 966 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 966 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 967 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; | 967 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; |
| 968 | unsigned int *item = ucontrol->value.enumerated.item; | 968 | unsigned int *item = ucontrol->value.enumerated.item; |
| @@ -1000,7 +1000,7 @@ static int cs48l32_eq_coeff_info(struct snd_kcontrol *kcontrol, · 31 unmodified lines | |||
| 1000 | static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol, | 1000 | static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol, |
| 1001 | struct snd_ctl_elem_value *ucontrol) | 1001 | struct snd_ctl_elem_value *ucontrol) |
| 1002 | { | 1002 | { |
| 1003 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1003 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1004 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 1004 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 1005 | struct cs48l32_eq_control *params = (void *)kcontrol->private_value; | 1005 | struct cs48l32_eq_control *params = (void *)kcontrol->private_value; |
| 1006 | __be16 *coeffs; | 1006 | __be16 *coeffs; |
| @@ -1025,8 +1025,8 @@ static int cs48l32_eq_coeff_get(struct snd_kcontrol *kcontrol, · 18 unmodified lines | |||
| 1025 | static int cs48l32_eq_coeff_put(struct snd_kcontrol *kcontrol, | 1025 | static int cs48l32_eq_coeff_put(struct snd_kcontrol *kcontrol, |
| 1026 | struct snd_ctl_elem_value *ucontrol) | 1026 | struct snd_ctl_elem_value *ucontrol) |
| 1027 | { | 1027 | { |
| 1028 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1028 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1029 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1029 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1030 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 1030 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 1031 | struct cs48l32_eq_control *params = (void *)kcontrol->private_value; | 1031 | struct cs48l32_eq_control *params = (void *)kcontrol->private_value; |
| 1032 | __be16 *coeffs; | 1032 | __be16 *coeffs; |
| @@ -1062,7 +1062,7 @@ static const struct snd_kcontrol_new cs48l32_dsp_trigger_output_mux[] = { · 29 unmodified lines | |||
| 1062 | static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol, | 1062 | static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol, |
| 1063 | struct snd_ctl_elem_value *ucontrol) | 1063 | struct snd_ctl_elem_value *ucontrol) |
| 1064 | { | 1064 | { |
| 1065 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1065 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1066 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 1066 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 1067 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; | 1067 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; |
| 1068 | unsigned int cached_rate; | 1068 | unsigned int cached_rate; |
| @@ -1082,8 +1082,8 @@ static int cs48l32_dsp_rate_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 1082 | static int cs48l32_dsp_rate_put(struct snd_kcontrol *kcontrol, | 1082 | static int cs48l32_dsp_rate_put(struct snd_kcontrol *kcontrol, |
| 1083 | struct snd_ctl_elem_value *ucontrol) | 1083 | struct snd_ctl_elem_value *ucontrol) |
| 1084 | { | 1084 | { |
| 1085 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1085 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1086 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1086 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1087 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 1087 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 1088 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; | 1088 | struct soc_enum *e = (struct soc_enum *) kcontrol->private_value; |
| 1089 | const unsigned int rate_num = e->mask; | 1089 | const unsigned int rate_num = e->mask; |
| @@ -2465,7 +2465,7 @@ static int cs48l32_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kco · 1375 unmodified lines | |||
| 2465 | static int cs48l32_in_put_volsw(struct snd_kcontrol *kcontrol, | 2465 | static int cs48l32_in_put_volsw(struct snd_kcontrol *kcontrol, |
| 2466 | struct snd_ctl_elem_value *ucontrol) | 2466 | struct snd_ctl_elem_value *ucontrol) |
| 2467 | { | 2467 | { |
| 2468 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2468 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2469 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); | 2469 | struct cs48l32_codec *cs48l32_codec = snd_soc_component_get_drvdata(component); |
| 2470 | int ret; | 2470 | int ret; |
| 2471 | 2471 | ||
| @@ -2,8 +2,8 @@ · 1 unmodified line | |||
| 2 | // | 2 | // |
| 3 | // CS530x CODEC driver | 3 | // CS530x CODEC driver |
| 4 | // | 4 | // |
| 5 | // Copyright (C) 2024 Cirrus Logic, Inc. and | 5 | // Copyright (C) 2024-2025 Cirrus Logic, Inc. and |
| 6 | // Cirrus Logic International Semiconductor Ltd. | 6 | // Cirrus Logic International Semiconductor Ltd. |
| 7 | 7 | ||
| 8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
| 9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
| @@ -14,6 +14,18 @@ · 4 unmodified lines | |||
| 14 | 14 | ||
| 15 | static const struct of_device_id cs530x_of_match[] = { | 15 | static const struct of_device_id cs530x_of_match[] = { |
| 16 | { | 16 | { |
| 17 | .compatible = "cirrus,cs4282", | ||
| 18 | .data = (void *)CS4282, | ||
| 19 | }, { | ||
| 20 | .compatible = "cirrus,cs4302", | ||
| 21 | .data = (void *)CS4302, | ||
| 22 | }, { | ||
| 23 | .compatible = "cirrus,cs4304", | ||
| 24 | .data = (void *)CS4304, | ||
| 25 | }, { | ||
| 26 | .compatible = "cirrus,cs4308", | ||
| 27 | .data = (void *)CS4308, | ||
| 28 | }, { | ||
| 17 | .compatible = "cirrus,cs5302", | 29 | .compatible = "cirrus,cs5302", |
| 18 | .data = (void *)CS5302, | 30 | .data = (void *)CS5302, |
| 19 | }, { | 31 | }, { |
| @@ -28,6 +40,10 @@ static const struct of_device_id cs530x_of_match[] = { · 8 unmodified lines | |||
| 28 | MODULE_DEVICE_TABLE(of, cs530x_of_match); | 40 | MODULE_DEVICE_TABLE(of, cs530x_of_match); |
| 29 | 41 | ||
| 30 | static const struct i2c_device_id cs530x_i2c_id[] = { | 42 | static const struct i2c_device_id cs530x_i2c_id[] = { |
| 43 | { "cs4282", CS4282 }, | ||
| 44 | { "cs4302", CS4302 }, | ||
| 45 | { "cs4304", CS4304 }, | ||
| 46 | { "cs4308", CS4308 }, | ||
| 31 | { "cs5302", CS5302 }, | 47 | { "cs5302", CS5302 }, |
| 32 | { "cs5304", CS5304 }, | 48 | { "cs5304", CS5304 }, |
| 33 | { "cs5308", CS5308 }, | 49 | { "cs5308", CS5308 }, |
| @@ -45,10 +61,10 @@ static int cs530x_i2c_probe(struct i2c_client *client) · 11 unmodified lines | |||
| 45 | 61 | ||
| 46 | i2c_set_clientdata(client, cs530x); | 62 | i2c_set_clientdata(client, cs530x); |
| 47 | 63 | ||
| 48 | cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap); | 64 | cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap_i2c); |
| 49 | if (IS_ERR(cs530x->regmap)) | 65 | if (IS_ERR(cs530x->regmap)) |
| 50 | return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap), | 66 | return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap), |
| 51 | "Failed to allocate register map\n"); | 67 | "Failed to allocate register map\n"); |
| 52 | 68 | ||
| 53 | cs530x->devtype = (uintptr_t)i2c_get_match_data(client); | 69 | cs530x->devtype = (uintptr_t)i2c_get_match_data(client); |
| 54 | cs530x->dev = &client->dev; | 70 | cs530x->dev = &client->dev; |
| @@ -0,0 +1,92 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | // | ||
| 3 | // CS530x CODEC driver | ||
| 4 | // | ||
| 5 | // Copyright (C) 2025 Cirrus Logic, Inc. and | ||
| 6 | // Cirrus Logic International Semiconductor Ltd. | ||
| 7 | |||
| 8 | #include <linux/module.h> | ||
| 9 | #include <linux/platform_device.h> | ||
| 10 | #include <linux/spi/spi.h> | ||
| 11 | |||
| 12 | #include "cs530x.h" | ||
| 13 | |||
| 14 | static const struct of_device_id cs530x_of_match[] = { | ||
| 15 | { | ||
| 16 | .compatible = "cirrus,cs4282", | ||
| 17 | .data = (void *)CS4282, | ||
| 18 | }, { | ||
| 19 | .compatible = "cirrus,cs4302", | ||
| 20 | .data = (void *)CS4302, | ||
| 21 | }, { | ||
| 22 | .compatible = "cirrus,cs4304", | ||
| 23 | .data = (void *)CS4304, | ||
| 24 | }, { | ||
| 25 | .compatible = "cirrus,cs4308", | ||
| 26 | .data = (void *)CS4308, | ||
| 27 | }, { | ||
| 28 | .compatible = "cirrus,cs5302", | ||
| 29 | .data = (void *)CS5302, | ||
| 30 | }, { | ||
| 31 | .compatible = "cirrus,cs5304", | ||
| 32 | .data = (void *)CS5304, | ||
| 33 | }, { | ||
| 34 | .compatible = "cirrus,cs5304", | ||
| 35 | .data = (void *)CS5308, | ||
| 36 | }, | ||
| 37 | {} | ||
| 38 | }; | ||
| 39 | MODULE_DEVICE_TABLE(of, cs530x_of_match); | ||
| 40 | |||
| 41 | static const struct spi_device_id cs530x_spi_id[] = { | ||
| 42 | { "cs4282", CS4282 }, | ||
| 43 | { "cs4302", CS4302 }, | ||
| 44 | { "cs4304", CS4304 }, | ||
| 45 | { "cs4308", CS4308 }, | ||
| 46 | { "cs5302", CS5302 }, | ||
| 47 | { "cs5304", CS5304 }, | ||
| 48 | { "cs5308", CS5308 }, | ||
| 49 | { } | ||
| 50 | }; | ||
| 51 | MODULE_DEVICE_TABLE(spi, cs530x_spi_id); | ||
| 52 | |||
| 53 | static int cs530x_spi_probe(struct spi_device *spi) | ||
| 54 | { | ||
| 55 | struct cs530x_priv *cs530x; | ||
| 56 | struct device *dev = &spi->dev; | ||
| 57 | int ret; | ||
| 58 | |||
| 59 | cs530x = devm_kzalloc(dev, sizeof(struct cs530x_priv), GFP_KERNEL); | ||
| 60 | if (cs530x == NULL) | ||
| 61 | return -ENOMEM; | ||
| 62 | |||
| 63 | spi_set_drvdata(spi, cs530x); | ||
| 64 | |||
| 65 | cs530x->regmap = devm_regmap_init_spi(spi, &cs530x_regmap_spi); | ||
| 66 | if (IS_ERR(cs530x->regmap)) { | ||
| 67 | ret = PTR_ERR(cs530x->regmap); | ||
| 68 | dev_err(dev, "Failed to allocate register map: %d\n", ret); | ||
| 69 | return ret; | ||
| 70 | } | ||
| 71 | |||
| 72 | cs530x->devtype = (unsigned long)spi_get_device_match_data(spi); | ||
| 73 | cs530x->dev = &spi->dev; | ||
| 74 | |||
| 75 | return cs530x_probe(cs530x); | ||
| 76 | } | ||
| 77 | |||
| 78 | static struct spi_driver cs530x_spi_driver = { | ||
| 79 | .driver = { | ||
| 80 | .name = "cs530x", | ||
| 81 | .of_match_table = cs530x_of_match, | ||
| 82 | }, | ||
| 83 | .id_table = cs530x_spi_id, | ||
| 84 | .probe = cs530x_spi_probe, | ||
| 85 | }; | ||
| 86 | |||
| 87 | module_spi_driver(cs530x_spi_driver); | ||
| 88 | |||
| 89 | MODULE_DESCRIPTION("SPI CS530X driver"); | ||
| 90 | MODULE_IMPORT_NS("SND_SOC_CS530X"); | ||
| 91 | MODULE_AUTHOR("Vitaly Rodionov <vitalyr@opensource.cirrus.com>"); | ||
| 92 | MODULE_LICENSE("GPL"); | ||
| @@ -2,28 +2,26 @@ · 1 unmodified line | |||
| 2 | // | 2 | // |
| 3 | // CS530x CODEC driver | 3 | // CS530x CODEC driver |
| 4 | // | 4 | // |
| 5 | // Copyright (C) 2024 Cirrus Logic, Inc. and | 5 | // Copyright (C) 2024-2025 Cirrus Logic, Inc. and |
| 6 | // Cirrus Logic International Semiconductor Ltd. | 6 | // Cirrus Logic International Semiconductor Ltd. |
| 7 | 7 | ||
| 8 | #include <sound/core.h> | ||
| 9 | #include <linux/delay.h> | 8 | #include <linux/delay.h> |
| 10 | #include <linux/i2c.h> | 9 | #include <linux/i2c.h> |
| 11 | #include <linux/init.h> | 10 | #include <linux/init.h> |
| 12 | #include <sound/initval.h> | ||
| 13 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| 14 | #include <sound/pcm.h> | ||
| 15 | #include <sound/pcm_params.h> | ||
| 16 | #include <linux/pm.h> | 12 | #include <linux/pm.h> |
| 17 | #include <linux/property.h> | 13 | #include <linux/property.h> |
| 18 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
| 15 | #include <linux/spi/spi.h> | ||
| 16 | #include <sound/core.h> | ||
| 17 | #include <sound/initval.h> | ||
| 18 | #include <sound/pcm.h> | ||
| 19 | #include <sound/pcm_params.h> | ||
| 19 | #include <sound/soc.h> | 20 | #include <sound/soc.h> |
| 20 | #include <sound/tlv.h> | 21 | #include <sound/tlv.h> |
| 21 | 22 | ||
| 22 | #include "cs530x.h" | 23 | #include "cs530x.h" |
| 23 | 24 | ||
| 24 | #define CS530X_MAX_ADC_CH 8 | ||
| 25 | #define CS530X_MIN_ADC_CH 2 | ||
| 26 | |||
| 27 | static const char *cs530x_supply_names[CS530X_NUM_SUPPLIES] = { | 25 | static const char *cs530x_supply_names[CS530X_NUM_SUPPLIES] = { |
| 28 | "vdd-a", | 26 | "vdd-a", |
| 29 | "vdd-io", | 27 | "vdd-io", |
| @@ -48,6 +46,18 @@ static const struct reg_default cs530x_reg_defaults[] = { · 18 unmodified lines | |||
| 48 | { CS530X_IN_VOL_CTRL3_1, 0x8000 }, | 46 | { CS530X_IN_VOL_CTRL3_1, 0x8000 }, |
| 49 | { CS530X_IN_VOL_CTRL4_0, 0x8000 }, | 47 | { CS530X_IN_VOL_CTRL4_0, 0x8000 }, |
| 50 | { CS530X_IN_VOL_CTRL4_1, 0x8000 }, | 48 | { CS530X_IN_VOL_CTRL4_1, 0x8000 }, |
| 49 | { CS530X_OUT_ENABLES, 0 }, | ||
| 50 | { CS530X_OUT_RAMP_SUM, 0x0022 }, | ||
| 51 | { CS530X_OUT_FILTER, 0 }, | ||
| 52 | { CS530X_OUT_INV, 0 }, | ||
| 53 | { CS530X_OUT_VOL_CTRL1_0, 0x8000 }, | ||
| 54 | { CS530X_OUT_VOL_CTRL1_1, 0x8000 }, | ||
| 55 | { CS530X_OUT_VOL_CTRL2_0, 0x8000 }, | ||
| 56 | { CS530X_OUT_VOL_CTRL2_1, 0x8000 }, | ||
| 57 | { CS530X_OUT_VOL_CTRL3_0, 0x8000 }, | ||
| 58 | { CS530X_OUT_VOL_CTRL3_1, 0x8000 }, | ||
| 59 | { CS530X_OUT_VOL_CTRL4_0, 0x8000 }, | ||
| 60 | { CS530X_OUT_VOL_CTRL4_1, 0x8000 }, | ||
| 51 | { CS530X_PAD_FN, 0 }, | 61 | { CS530X_PAD_FN, 0 }, |
| 52 | { CS530X_PAD_LVL, 0 }, | 62 | { CS530X_PAD_LVL, 0 }, |
| 53 | }; | 63 | }; |
| @@ -73,6 +83,19 @@ static bool cs530x_read_and_write_regs(unsigned int reg) · 19 unmodified lines | |||
| 73 | case CS530X_IN_VOL_CTRL3_1: | 83 | case CS530X_IN_VOL_CTRL3_1: |
| 74 | case CS530X_IN_VOL_CTRL4_0: | 84 | case CS530X_IN_VOL_CTRL4_0: |
| 75 | case CS530X_IN_VOL_CTRL4_1: | 85 | case CS530X_IN_VOL_CTRL4_1: |
| 86 | case CS530X_OUT_ENABLES: | ||
| 87 | case CS530X_OUT_RAMP_SUM: | ||
| 88 | case CS530X_OUT_DEEMPH: | ||
| 89 | case CS530X_OUT_FILTER: | ||
| 90 | case CS530X_OUT_INV: | ||
| 91 | case CS530X_OUT_VOL_CTRL1_0: | ||
| 92 | case CS530X_OUT_VOL_CTRL1_1: | ||
| 93 | case CS530X_OUT_VOL_CTRL2_0: | ||
| 94 | case CS530X_OUT_VOL_CTRL2_1: | ||
| 95 | case CS530X_OUT_VOL_CTRL3_0: | ||
| 96 | case CS530X_OUT_VOL_CTRL3_1: | ||
| 97 | case CS530X_OUT_VOL_CTRL4_0: | ||
| 98 | case CS530X_OUT_VOL_CTRL4_1: | ||
| 76 | case CS530X_PAD_FN: | 99 | case CS530X_PAD_FN: |
| 77 | case CS530X_PAD_LVL: | 100 | case CS530X_PAD_LVL: |
| 78 | return true; | 101 | return true; |
| @@ -97,6 +120,7 @@ static bool cs530x_writeable_register(struct device *dev, unsigned int reg) · 18 unmodified lines | |||
| 97 | switch (reg) { | 120 | switch (reg) { |
| 98 | case CS530X_SW_RESET: | 121 | case CS530X_SW_RESET: |
| 99 | case CS530X_IN_VOL_CTRL5: | 122 | case CS530X_IN_VOL_CTRL5: |
| 123 | case CS530X_OUT_VOL_CTRL5: | ||
| 100 | return true; | 124 | return true; |
| 101 | default: | 125 | default: |
| 102 | return cs530x_read_and_write_regs(reg); | 126 | return cs530x_read_and_write_regs(reg); |
| @@ -104,10 +128,10 @@ static bool cs530x_writeable_register(struct device *dev, unsigned int reg) · 1 unmodified line | |||
| 104 | } | 128 | } |
| 105 | 129 | ||
| 106 | static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol, | 130 | static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol, |
| 107 | struct snd_ctl_elem_value *ucontrol) | 131 | struct snd_ctl_elem_value *ucontrol) |
| 108 | { | 132 | { |
| 109 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 133 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 110 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 134 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 111 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 135 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| 112 | struct regmap *regmap = cs530x->regmap; | 136 | struct regmap *regmap = cs530x->regmap; |
| 113 | int ret; | 137 | int ret; |
| @@ -118,8 +142,8 @@ static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 118 | if (ret) | 142 | if (ret) |
| 119 | goto volsw_err; | 143 | goto volsw_err; |
| 120 | 144 | ||
| 121 | /* Write IN_VU bit for the volume change to take effect */ | 145 | /* Write INOUT_VU bit for the volume change to take effect */ |
| 122 | regmap_write(regmap, CS530X_IN_VOL_CTRL5, CS530X_IN_VU); | 146 | regmap_write(regmap, CS530X_IN_VOL_CTRL5, CS530X_INOUT_VU); |
| 123 | 147 | ||
| 124 | volsw_err: | 148 | volsw_err: |
| 125 | snd_soc_dapm_mutex_unlock(dapm); | 149 | snd_soc_dapm_mutex_unlock(dapm); |
| @@ -129,7 +153,7 @@ volsw_err: · 3 unmodified lines | |||
| 129 | 153 | ||
| 130 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1270, 50, 0); | 154 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -1270, 50, 0); |
| 131 | 155 | ||
| 132 | static const char * const cs530x_in_filter_text[] = { | 156 | static const char * const cs530x_inout_filter_text[] = { |
| 133 | "Min Phase Slow Roll-off", | 157 | "Min Phase Slow Roll-off", |
| 134 | "Min Phase Fast Roll-off", | 158 | "Min Phase Fast Roll-off", |
| 135 | "Linear Phase Slow Roll-off", | 159 | "Linear Phase Slow Roll-off", |
| @@ -137,24 +161,36 @@ static const char * const cs530x_in_filter_text[] = { · 1 unmodified line | |||
| 137 | }; | 161 | }; |
| 138 | 162 | ||
| 139 | static SOC_ENUM_SINGLE_DECL(cs530x_in_filter_enum, CS530X_IN_FILTER, | 163 | static SOC_ENUM_SINGLE_DECL(cs530x_in_filter_enum, CS530X_IN_FILTER, |
| 140 | CS530X_IN_FILTER_SHIFT, | 164 | CS530X_INOUT_FILTER_SHIFT, |
| 141 | cs530x_in_filter_text); | 165 | cs530x_inout_filter_text); |
| 142 | 166 | ||
| 143 | static const char * const cs530x_in_4ch_sum_text[] = { | 167 | static SOC_ENUM_SINGLE_DECL(cs530x_out_filter_enum, CS530X_OUT_FILTER, |
| 168 | CS530X_INOUT_FILTER_SHIFT, | ||
| 169 | cs530x_inout_filter_text); | ||
| 170 | |||
| 171 | static const char * const cs530x_4ch_sum_text[] = { | ||
| 144 | "None", | 172 | "None", |
| 145 | "Groups of 2", | 173 | "Groups of 2", |
| 146 | "Groups of 4", | 174 | "Groups of 4", |
| 147 | }; | 175 | }; |
| 148 | 176 | ||
| 149 | static SOC_ENUM_SINGLE_DECL(cs530x_in_sum_ch4_enum, CS530X_IN_RAMP_SUM, | 177 | static SOC_ENUM_SINGLE_DECL(cs530x_in_sum_ch4_enum, CS530X_IN_RAMP_SUM, |
| 150 | CS530X_IN_SUM_MODE_SHIFT, | 178 | CS530X_INOUT_SUM_MODE_SHIFT, |
| 151 | cs530x_in_4ch_sum_text); | 179 | cs530x_4ch_sum_text); |
| 152 | 180 | ||
| 153 | static const struct snd_kcontrol_new cs530x_in_sum_4ch_controls[] = { | 181 | static const struct snd_kcontrol_new cs530x_in_sum_4ch_controls[] = { |
| 154 | SOC_ENUM("IN Sum Select", cs530x_in_sum_ch4_enum), | 182 | SOC_ENUM("IN Sum Select", cs530x_in_sum_ch4_enum), |
| 155 | }; | 183 | }; |
| 156 | 184 | ||
| 157 | static const char * const cs530x_in_8ch_sum_text[] = { | 185 | static SOC_ENUM_SINGLE_DECL(cs530x_out_sum_ch4_enum, CS530X_OUT_RAMP_SUM, |
| 186 | CS530X_INOUT_SUM_MODE_SHIFT, | ||
| 187 | cs530x_4ch_sum_text); | ||
| 188 | |||
| 189 | static const struct snd_kcontrol_new cs530x_out_sum_4ch_controls[] = { | ||
| 190 | SOC_ENUM("OUT Sum Select", cs530x_out_sum_ch4_enum), | ||
| 191 | }; | ||
| 192 | |||
| 193 | static const char * const cs530x_8ch_sum_text[] = { | ||
| 158 | "None", | 194 | "None", |
| 159 | "Groups of 2", | 195 | "Groups of 2", |
| 160 | "Groups of 4", | 196 | "Groups of 4", |
| @@ -162,13 +198,20 @@ static const char * const cs530x_in_8ch_sum_text[] = { · 1 unmodified line | |||
| 162 | }; | 198 | }; |
| 163 | 199 | ||
| 164 | static SOC_ENUM_SINGLE_DECL(cs530x_in_sum_ch8_enum, CS530X_IN_RAMP_SUM, | 200 | static SOC_ENUM_SINGLE_DECL(cs530x_in_sum_ch8_enum, CS530X_IN_RAMP_SUM, |
| 165 | CS530X_IN_SUM_MODE_SHIFT, | 201 | CS530X_INOUT_SUM_MODE_SHIFT, |
| 166 | cs530x_in_8ch_sum_text); | 202 | cs530x_8ch_sum_text); |
| 167 | 203 | ||
| 168 | static const struct snd_kcontrol_new cs530x_in_sum_8ch_controls[] = { | 204 | static const struct snd_kcontrol_new cs530x_in_sum_8ch_controls[] = { |
| 169 | SOC_ENUM("IN Sum Select", cs530x_in_sum_ch8_enum), | 205 | SOC_ENUM("IN Sum Select", cs530x_in_sum_ch8_enum), |
| 170 | }; | 206 | }; |
| 171 | 207 | ||
| 208 | static SOC_ENUM_SINGLE_DECL(cs530x_out_sum_ch8_enum, CS530X_OUT_RAMP_SUM, | ||
| 209 | CS530X_INOUT_SUM_MODE_SHIFT, | ||
| 210 | cs530x_8ch_sum_text); | ||
| 211 | |||
| 212 | static const struct snd_kcontrol_new cs530x_out_sum_8ch_controls[] = { | ||
| 213 | SOC_ENUM("OUT Sum Select", cs530x_out_sum_ch8_enum), | ||
| 214 | }; | ||
| 172 | 215 | ||
| 173 | static const char * const cs530x_vol_ramp_text[] = { | 216 | static const char * const cs530x_vol_ramp_text[] = { |
| 174 | "0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB", | 217 | "0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB", |
| @@ -193,8 +236,8 @@ SOC_ENUM("IN DEC Filter Select", cs530x_in_filter_enum), · 18 unmodified lines | |||
| 193 | SOC_ENUM("Input Ramp Up", cs530x_ramp_inc_enum), | 236 | SOC_ENUM("Input Ramp Up", cs530x_ramp_inc_enum), |
| 194 | SOC_ENUM("Input Ramp Down", cs530x_ramp_dec_enum), | 237 | SOC_ENUM("Input Ramp Down", cs530x_ramp_dec_enum), |
| 195 | 238 | ||
| 196 | SOC_SINGLE("ADC1 Invert Switch", CS530X_IN_INV, CS530X_IN1_INV_SHIFT, 1, 0), | 239 | SOC_SINGLE("ADC1 Invert Switch", CS530X_IN_INV, CS530X_INOUT1_INV_SHIFT, 1, 0), |
| 197 | SOC_SINGLE("ADC2 Invert Switch", CS530X_IN_INV, CS530X_IN2_INV_SHIFT, 1, 0), | 240 | SOC_SINGLE("ADC2 Invert Switch", CS530X_IN_INV, CS530X_INOUT2_INV_SHIFT, 1, 0), |
| 198 | }; | 241 | }; |
| 199 | 242 | ||
| 200 | static const struct snd_kcontrol_new cs530x_in_3_to_4_controls[] = { | 243 | static const struct snd_kcontrol_new cs530x_in_3_to_4_controls[] = { |
| @@ -203,8 +246,8 @@ SOC_SINGLE_EXT_TLV("IN3 Volume", CS530X_IN_VOL_CTRL2_0, 0, 255, 1, · 2 unmodified lines | |||
| 203 | SOC_SINGLE_EXT_TLV("IN4 Volume", CS530X_IN_VOL_CTRL2_1, 0, 255, 1, | 246 | SOC_SINGLE_EXT_TLV("IN4 Volume", CS530X_IN_VOL_CTRL2_1, 0, 255, 1, |
| 204 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | 247 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), |
| 205 | 248 | ||
| 206 | SOC_SINGLE("ADC3 Invert Switch", CS530X_IN_INV, CS530X_IN3_INV_SHIFT, 1, 0), | 249 | SOC_SINGLE("ADC3 Invert Switch", CS530X_IN_INV, CS530X_INOUT3_INV_SHIFT, 1, 0), |
| 207 | SOC_SINGLE("ADC4 Invert Switch", CS530X_IN_INV, CS530X_IN4_INV_SHIFT, 1, 0), | 250 | SOC_SINGLE("ADC4 Invert Switch", CS530X_IN_INV, CS530X_INOUT4_INV_SHIFT, 1, 0), |
| 208 | }; | 251 | }; |
| 209 | 252 | ||
| 210 | static const struct snd_kcontrol_new cs530x_in_5_to_8_controls[] = { | 253 | static const struct snd_kcontrol_new cs530x_in_5_to_8_controls[] = { |
| @@ -217,14 +260,14 @@ SOC_SINGLE_EXT_TLV("IN7 Volume", CS530X_IN_VOL_CTRL4_0, 0, 255, 1, · 6 unmodified lines | |||
| 217 | SOC_SINGLE_EXT_TLV("IN8 Volume", CS530X_IN_VOL_CTRL4_1, 0, 255, 1, | 260 | SOC_SINGLE_EXT_TLV("IN8 Volume", CS530X_IN_VOL_CTRL4_1, 0, 255, 1, |
| 218 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | 261 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), |
| 219 | 262 | ||
| 220 | SOC_SINGLE("ADC5 Invert Switch", CS530X_IN_INV, CS530X_IN5_INV_SHIFT, 1, 0), | 263 | SOC_SINGLE("ADC5 Invert Switch", CS530X_IN_INV, CS530X_INOUT5_INV_SHIFT, 1, 0), |
| 221 | SOC_SINGLE("ADC6 Invert Switch", CS530X_IN_INV, CS530X_IN6_INV_SHIFT, 1, 0), | 264 | SOC_SINGLE("ADC6 Invert Switch", CS530X_IN_INV, CS530X_INOUT6_INV_SHIFT, 1, 0), |
| 222 | SOC_SINGLE("ADC7 Invert Switch", CS530X_IN_INV, CS530X_IN7_INV_SHIFT, 1, 0), | 265 | SOC_SINGLE("ADC7 Invert Switch", CS530X_IN_INV, CS530X_INOUT7_INV_SHIFT, 1, 0), |
| 223 | SOC_SINGLE("ADC8 Invert Switch", CS530X_IN_INV, CS530X_IN8_INV_SHIFT, 1, 0), | 266 | SOC_SINGLE("ADC8 Invert Switch", CS530X_IN_INV, CS530X_INOUT8_INV_SHIFT, 1, 0), |
| 224 | }; | 267 | }; |
| 225 | 268 | ||
| 226 | static int cs530x_adc_event(struct snd_soc_dapm_widget *w, | 269 | static int cs530x_adc_event(struct snd_soc_dapm_widget *w, |
| 227 | struct snd_kcontrol *kcontrol, int event) | 270 | struct snd_kcontrol *kcontrol, int event) |
| 228 | { | 271 | { |
| 229 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | 272 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
| 230 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 273 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| @@ -236,24 +279,110 @@ static int cs530x_adc_event(struct snd_soc_dapm_widget *w, · 5 unmodified lines | |||
| 236 | break; | 279 | break; |
| 237 | case SND_SOC_DAPM_POST_PMU: | 280 | case SND_SOC_DAPM_POST_PMU: |
| 238 | regmap_clear_bits(regmap, CS530X_IN_VOL_CTRL1_0 + | 281 | regmap_clear_bits(regmap, CS530X_IN_VOL_CTRL1_0 + |
| 239 | (w->shift * 2), CS530X_IN_MUTE); | 282 | (w->shift * 2), CS530X_INOUT_MUTE); |
| 240 | regmap_clear_bits(regmap, CS530X_IN_VOL_CTRL1_0 + | 283 | regmap_clear_bits(regmap, CS530X_IN_VOL_CTRL1_0 + |
| 241 | ((w->shift+1) * 2), CS530X_IN_MUTE); | 284 | ((w->shift + 1) * 2), CS530X_INOUT_MUTE); |
| 242 | 285 | ||
| 243 | cs530x->adc_pairs_count--; | 286 | cs530x->adc_pairs_count--; |
| 244 | if (!cs530x->adc_pairs_count) { | 287 | if (!cs530x->adc_pairs_count) { |
| 245 | usleep_range(1000, 1100); | 288 | usleep_range(1000, 1100); |
| 246 | return regmap_write(regmap, CS530X_IN_VOL_CTRL5, | 289 | return regmap_write(regmap, CS530X_IN_VOL_CTRL5, |
| 247 | CS530X_IN_VU); | 290 | CS530X_INOUT_VU); |
| 248 | } | 291 | } |
| 249 | break; | 292 | break; |
| 250 | case SND_SOC_DAPM_PRE_PMD: | 293 | case SND_SOC_DAPM_PRE_PMD: |
| 251 | regmap_set_bits(regmap, CS530X_IN_VOL_CTRL1_0 + | 294 | regmap_set_bits(regmap, CS530X_IN_VOL_CTRL1_0 + |
| 252 | (w->shift * 2), CS530X_IN_MUTE); | 295 | (w->shift * 2), CS530X_INOUT_MUTE); |
| 253 | regmap_set_bits(regmap, CS530X_IN_VOL_CTRL1_0 + | 296 | regmap_set_bits(regmap, CS530X_IN_VOL_CTRL1_0 + |
| 254 | ((w->shift+1) * 2), CS530X_IN_MUTE); | 297 | ((w->shift + 1) * 2), CS530X_INOUT_MUTE); |
| 255 | return regmap_write(regmap, CS530X_IN_VOL_CTRL5, | 298 | return regmap_write(regmap, CS530X_IN_VOL_CTRL5, |
| 256 | CS530X_IN_VU); | 299 | CS530X_INOUT_VU); |
| 300 | default: | ||
| 301 | return -EINVAL; | ||
| 302 | } | ||
| 303 | |||
| 304 | return 0; | ||
| 305 | } | ||
| 306 | |||
| 307 | static SOC_ENUM_SINGLE_DECL(cs530x_ramp_out_inc_enum, CS530X_OUT_RAMP_SUM, | ||
| 308 | CS530X_RAMP_RATE_INC_SHIFT, | ||
| 309 | cs530x_vol_ramp_text); | ||
| 310 | |||
| 311 | static SOC_ENUM_SINGLE_DECL(cs530x_ramp_out_dec_enum, CS530X_OUT_RAMP_SUM, | ||
| 312 | CS530X_RAMP_RATE_DEC_SHIFT, | ||
| 313 | cs530x_vol_ramp_text); | ||
| 314 | |||
| 315 | static const struct snd_kcontrol_new cs530x_out_1_to_2_controls[] = { | ||
| 316 | SOC_SINGLE_EXT_TLV("OUT1 Volume", CS530X_OUT_VOL_CTRL1_0, 0, 255, 1, | ||
| 317 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 318 | SOC_SINGLE_EXT_TLV("OUT2 Volume", CS530X_OUT_VOL_CTRL1_1, 0, 255, 1, | ||
| 319 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 320 | |||
| 321 | SOC_ENUM("OUT DEC Filter Select", cs530x_out_filter_enum), | ||
| 322 | SOC_ENUM("Output Ramp Up", cs530x_ramp_out_inc_enum), | ||
| 323 | SOC_ENUM("Output Ramp Down", cs530x_ramp_out_dec_enum), | ||
| 324 | |||
| 325 | SOC_SINGLE("DAC1 Invert Switch", CS530X_OUT_INV, CS530X_INOUT1_INV_SHIFT, 1, 0), | ||
| 326 | SOC_SINGLE("DAC2 Invert Switch", CS530X_OUT_INV, CS530X_INOUT2_INV_SHIFT, 1, 0), | ||
| 327 | }; | ||
| 328 | |||
| 329 | static const struct snd_kcontrol_new cs530x_out_3_to_4_controls[] = { | ||
| 330 | SOC_SINGLE_EXT_TLV("OUT3 Volume", CS530X_OUT_VOL_CTRL2_0, 0, 255, 1, | ||
| 331 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 332 | SOC_SINGLE_EXT_TLV("OUT4 Volume", CS530X_OUT_VOL_CTRL2_1, 0, 255, 1, | ||
| 333 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 334 | |||
| 335 | SOC_SINGLE("DAC3 Invert Switch", CS530X_OUT_INV, CS530X_INOUT3_INV_SHIFT, 1, 0), | ||
| 336 | SOC_SINGLE("DAC4 Invert Switch", CS530X_OUT_INV, CS530X_INOUT4_INV_SHIFT, 1, 0), | ||
| 337 | }; | ||
| 338 | |||
| 339 | static const struct snd_kcontrol_new cs530x_out_5_to_8_controls[] = { | ||
| 340 | SOC_SINGLE_EXT_TLV("OUT5 Volume", CS530X_OUT_VOL_CTRL3_0, 0, 255, 1, | ||
| 341 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 342 | SOC_SINGLE_EXT_TLV("OUT6 Volume", CS530X_OUT_VOL_CTRL3_1, 0, 255, 1, | ||
| 343 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 344 | SOC_SINGLE_EXT_TLV("OUT7 Volume", CS530X_OUT_VOL_CTRL4_0, 0, 255, 1, | ||
| 345 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 346 | SOC_SINGLE_EXT_TLV("OUT8 Volume", CS530X_OUT_VOL_CTRL4_1, 0, 255, 1, | ||
| 347 | snd_soc_get_volsw, cs530x_put_volsw_vu, in_vol_tlv), | ||
| 348 | |||
| 349 | SOC_SINGLE("DAC5 Invert Switch", CS530X_OUT_INV, CS530X_INOUT5_INV_SHIFT, 1, 0), | ||
| 350 | SOC_SINGLE("DAC6 Invert Switch", CS530X_OUT_INV, CS530X_INOUT6_INV_SHIFT, 1, 0), | ||
| 351 | SOC_SINGLE("DAC7 Invert Switch", CS530X_OUT_INV, CS530X_INOUT7_INV_SHIFT, 1, 0), | ||
| 352 | SOC_SINGLE("DAC8 Invert Switch", CS530X_OUT_INV, CS530X_INOUT8_INV_SHIFT, 1, 0), | ||
| 353 | }; | ||
| 354 | |||
| 355 | static int cs530x_dac_event(struct snd_soc_dapm_widget *w, | ||
| 356 | struct snd_kcontrol *kcontrol, int event) | ||
| 357 | { | ||
| 358 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | ||
| 359 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | ||
| 360 | struct regmap *regmap = cs530x->regmap; | ||
| 361 | |||
| 362 | switch (event) { | ||
| 363 | case SND_SOC_DAPM_PRE_PMU: | ||
| 364 | cs530x->dac_pairs_count++; | ||
| 365 | break; | ||
| 366 | case SND_SOC_DAPM_POST_PMU: | ||
| 367 | regmap_clear_bits(regmap, CS530X_OUT_VOL_CTRL1_0 + | ||
| 368 | (w->shift * 2), CS530X_INOUT_MUTE); | ||
| 369 | regmap_clear_bits(regmap, CS530X_OUT_VOL_CTRL1_0 + | ||
| 370 | ((w->shift + 1) * 2), CS530X_INOUT_MUTE); | ||
| 371 | |||
| 372 | cs530x->dac_pairs_count--; | ||
| 373 | if (!cs530x->dac_pairs_count) { | ||
| 374 | usleep_range(1000, 1100); | ||
| 375 | return regmap_write(regmap, CS530X_OUT_VOL_CTRL5, | ||
| 376 | CS530X_INOUT_VU); | ||
| 377 | } | ||
| 378 | break; | ||
| 379 | case SND_SOC_DAPM_PRE_PMD: | ||
| 380 | regmap_set_bits(regmap, CS530X_OUT_VOL_CTRL1_0 + | ||
| 381 | (w->shift * 2), CS530X_INOUT_MUTE); | ||
| 382 | regmap_set_bits(regmap, CS530X_OUT_VOL_CTRL1_0 + | ||
| 383 | ((w->shift + 1) * 2), CS530X_INOUT_MUTE); | ||
| 384 | return regmap_write(regmap, CS530X_OUT_VOL_CTRL5, | ||
| 385 | CS530X_INOUT_VU); | ||
| 257 | default: | 386 | default: |
| 258 | return -EINVAL; | 387 | return -EINVAL; |
| 259 | } | 388 | } |
| @@ -263,18 +392,24 @@ static int cs530x_adc_event(struct snd_soc_dapm_widget *w, · 3 unmodified lines | |||
| 263 | 392 | ||
| 264 | static const struct snd_kcontrol_new adc12_ctrl = | 393 | static const struct snd_kcontrol_new adc12_ctrl = |
| 265 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | 394 | SOC_DAPM_SINGLE_VIRT("Switch", 1); |
| 266 | |||
| 267 | static const struct snd_kcontrol_new adc34_ctrl = | 395 | static const struct snd_kcontrol_new adc34_ctrl = |
| 268 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | 396 | SOC_DAPM_SINGLE_VIRT("Switch", 1); |
| 269 | |||
| 270 | static const struct snd_kcontrol_new adc56_ctrl = | 397 | static const struct snd_kcontrol_new adc56_ctrl = |
| 271 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | 398 | SOC_DAPM_SINGLE_VIRT("Switch", 1); |
| 272 | |||
| 273 | static const struct snd_kcontrol_new adc78_ctrl = | 399 | static const struct snd_kcontrol_new adc78_ctrl = |
| 274 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | 400 | SOC_DAPM_SINGLE_VIRT("Switch", 1); |
| 275 | 401 | static const struct snd_kcontrol_new dac12_ctrl = | |
| 402 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | ||
| 403 | static const struct snd_kcontrol_new dac34_ctrl = | ||
| 404 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | ||
| 405 | static const struct snd_kcontrol_new dac56_ctrl = | ||
| 406 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | ||
| 407 | static const struct snd_kcontrol_new dac78_ctrl = | ||
| 408 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | ||
| 276 | static const struct snd_kcontrol_new in_hpf_ctrl = | 409 | static const struct snd_kcontrol_new in_hpf_ctrl = |
| 277 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | 410 | SOC_DAPM_SINGLE_VIRT("Switch", 1); |
| 411 | static const struct snd_kcontrol_new out_hpf_ctrl = | ||
| 412 | SOC_DAPM_SINGLE_VIRT("Switch", 1); | ||
| 278 | 413 | ||
| 279 | /* General DAPM widgets for all devices */ | 414 | /* General DAPM widgets for all devices */ |
| 280 | static const struct snd_soc_dapm_widget cs530x_gen_dapm_widgets[] = { | 415 | static const struct snd_soc_dapm_widget cs530x_gen_dapm_widgets[] = { |
| @@ -291,7 +426,7 @@ SND_SOC_DAPM_ADC_E("ADC1", NULL, CS530X_IN_ENABLES, 0, 0, · 10 unmodified lines | |||
| 291 | SND_SOC_DAPM_PRE_PMU), | 426 | SND_SOC_DAPM_PRE_PMU), |
| 292 | SND_SOC_DAPM_ADC("ADC2", NULL, CS530X_IN_ENABLES, 1, 0), | 427 | SND_SOC_DAPM_ADC("ADC2", NULL, CS530X_IN_ENABLES, 1, 0), |
| 293 | SND_SOC_DAPM_SWITCH("ADC12 Enable", SND_SOC_NOPM, 0, 0, &adc12_ctrl), | 428 | SND_SOC_DAPM_SWITCH("ADC12 Enable", SND_SOC_NOPM, 0, 0, &adc12_ctrl), |
| 294 | SND_SOC_DAPM_SWITCH("IN HPF", CS530X_IN_FILTER, CS530X_IN_HPF_EN_SHIFT, | 429 | SND_SOC_DAPM_SWITCH("IN HPF", CS530X_IN_FILTER, CS530X_INOUT_HPF_EN_SHIFT, |
| 295 | 0, &in_hpf_ctrl), | 430 | 0, &in_hpf_ctrl), |
| 296 | }; | 431 | }; |
| 297 | 432 | ||
| @@ -387,7 +522,7 @@ static const struct snd_soc_dapm_route adc_ch5_8_routes[] = { · 89 unmodified lines | |||
| 387 | 522 | ||
| 388 | static void cs530x_add_12_adc_widgets(struct snd_soc_component *component) | 523 | static void cs530x_add_12_adc_widgets(struct snd_soc_component *component) |
| 389 | { | 524 | { |
| 390 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 525 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 391 | 526 | ||
| 392 | snd_soc_add_component_controls(component, | 527 | snd_soc_add_component_controls(component, |
| 393 | cs530x_in_1_to_2_controls, | 528 | cs530x_in_1_to_2_controls, |
| @@ -402,7 +537,7 @@ static void cs530x_add_12_adc_widgets(struct snd_soc_component *component) · 8 unmodified lines | |||
| 402 | 537 | ||
| 403 | static void cs530x_add_34_adc_widgets(struct snd_soc_component *component) | 538 | static void cs530x_add_34_adc_widgets(struct snd_soc_component *component) |
| 404 | { | 539 | { |
| 405 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 540 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 406 | 541 | ||
| 407 | snd_soc_add_component_controls(component, | 542 | snd_soc_add_component_controls(component, |
| 408 | cs530x_in_3_to_4_controls, | 543 | cs530x_in_3_to_4_controls, |
| @@ -415,6 +550,153 @@ static void cs530x_add_34_adc_widgets(struct snd_soc_component *component) · 6 unmodified lines | |||
| 415 | ARRAY_SIZE(adc_ch3_4_routes)); | 550 | ARRAY_SIZE(adc_ch3_4_routes)); |
| 416 | } | 551 | } |
| 417 | 552 | ||
| 553 | /* DAC's Channels 1 and 2 plus generic DAC DAPM events */ | ||
| 554 | static const struct snd_soc_dapm_widget cs530x_dac_ch12_dapm_widgets[] = { | ||
| 555 | SND_SOC_DAPM_OUTPUT("OUT1"), | ||
| 556 | SND_SOC_DAPM_OUTPUT("OUT2"), | ||
| 557 | SND_SOC_DAPM_DAC_E("DAC1", NULL, CS530X_OUT_ENABLES, 0, 0, | ||
| 558 | cs530x_dac_event, | ||
| 559 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU | | ||
| 560 | SND_SOC_DAPM_PRE_PMU), | ||
| 561 | SND_SOC_DAPM_DAC("DAC2", NULL, CS530X_OUT_ENABLES, 1, 0), | ||
| 562 | SND_SOC_DAPM_SWITCH("DAC12 Enable", SND_SOC_NOPM, 0, 0, &dac12_ctrl), | ||
| 563 | SND_SOC_DAPM_SWITCH("OUT HPF", CS530X_OUT_FILTER, CS530X_INOUT_HPF_EN_SHIFT, | ||
| 564 | 0, &out_hpf_ctrl), | ||
| 565 | }; | ||
| 566 | |||
| 567 | /* DAC's Channels 3 and 4 */ | ||
| 568 | static const struct snd_soc_dapm_widget cs530x_dac_ch34_dapm_widgets[] = { | ||
| 569 | SND_SOC_DAPM_OUTPUT("OUT3"), | ||
| 570 | SND_SOC_DAPM_OUTPUT("OUT4"), | ||
| 571 | SND_SOC_DAPM_DAC_E("DAC3", NULL, CS530X_OUT_ENABLES, 2, 0, | ||
| 572 | cs530x_dac_event, | ||
| 573 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU | | ||
| 574 | SND_SOC_DAPM_PRE_PMU), | ||
| 575 | SND_SOC_DAPM_DAC("DAC4", NULL, CS530X_OUT_ENABLES, 3, 0), | ||
| 576 | SND_SOC_DAPM_SWITCH("DAC34 Enable", SND_SOC_NOPM, 0, 0, &dac34_ctrl), | ||
| 577 | }; | ||
| 578 | |||
| 579 | /* DAC's Channels 5 to 8 */ | ||
| 580 | static const struct snd_soc_dapm_widget cs530x_dac_ch58_dapm_widgets[] = { | ||
| 581 | SND_SOC_DAPM_OUTPUT("OUT5"), | ||
| 582 | SND_SOC_DAPM_OUTPUT("OUT6"), | ||
| 583 | SND_SOC_DAPM_OUTPUT("OUT7"), | ||
| 584 | SND_SOC_DAPM_OUTPUT("OUT8"), | ||
| 585 | SND_SOC_DAPM_DAC_E("DAC5", NULL, CS530X_OUT_ENABLES, 4, 0, | ||
| 586 | cs530x_dac_event, | ||
| 587 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU | | ||
| 588 | SND_SOC_DAPM_PRE_PMU), | ||
| 589 | SND_SOC_DAPM_DAC("DAC6", NULL, CS530X_OUT_ENABLES, 5, 0), | ||
| 590 | SND_SOC_DAPM_SWITCH("DAC56 Enable", SND_SOC_NOPM, 0, 0, &dac56_ctrl), | ||
| 591 | SND_SOC_DAPM_DAC_E("DAC7", NULL, CS530X_OUT_ENABLES, 6, 0, | ||
| 592 | cs530x_dac_event, | ||
| 593 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU | | ||
| 594 | SND_SOC_DAPM_PRE_PMU), | ||
| 595 | SND_SOC_DAPM_DAC("DAC8", NULL, CS530X_OUT_ENABLES, 7, 0), | ||
| 596 | SND_SOC_DAPM_SWITCH("DAC78 Enable", SND_SOC_NOPM, 0, 0, &dac78_ctrl), | ||
| 597 | }; | ||
| 598 | |||
| 599 | static const struct snd_soc_dapm_route dac_ch1_2_routes[] = { | ||
| 600 | { "DAC1", NULL, "Global Enable" }, | ||
| 601 | { "DAC2", NULL, "Global Enable" }, | ||
| 602 | |||
| 603 | { "DAC12 Enable", "Switch", "OUT1" }, | ||
| 604 | { "DAC12 Enable", "Switch", "OUT2" }, | ||
| 605 | { "DAC1", NULL, "DAC12 Enable" }, | ||
| 606 | { "DAC2", NULL, "DAC12 Enable" }, | ||
| 607 | { "OUT HPF", "Switch", "DAC1" }, | ||
| 608 | { "OUT HPF", "Switch", "DAC2" }, | ||
| 609 | |||
| 610 | { "OUT HPF", NULL, "AIF Playback" }, | ||
| 611 | { "DAC1", NULL, "AIF Playback" }, | ||
| 612 | { "DAC2", NULL, "AIF Playback" }, | ||
| 613 | |||
| 614 | { "OUT1", NULL, "DAC1" }, | ||
| 615 | { "OUT2", NULL, "DAC2" }, | ||
| 616 | }; | ||
| 617 | |||
| 618 | static const struct snd_soc_dapm_route dac_ch3_4_routes[] = { | ||
| 619 | { "DAC3", NULL, "Global Enable" }, | ||
| 620 | { "DAC4", NULL, "Global Enable" }, | ||
| 621 | |||
| 622 | { "DAC34 Enable", "Switch", "OUT3" }, | ||
| 623 | { "DAC34 Enable", "Switch", "OUT4" }, | ||
| 624 | { "DAC3", NULL, "DAC34 Enable" }, | ||
| 625 | { "DAC4", NULL, "DAC34 Enable" }, | ||
| 626 | { "OUT HPF", "Switch", "DAC3" }, | ||
| 627 | { "OUT HPF", "Switch", "DAC4" }, | ||
| 628 | |||
| 629 | { "DAC3", NULL, "AIF Playback" }, | ||
| 630 | { "DAC4", NULL, "AIF Playback" }, | ||
| 631 | |||
| 632 | { "OUT3", NULL, "DAC3" }, | ||
| 633 | { "OUT4", NULL, "DAC4" }, | ||
| 634 | }; | ||
| 635 | |||
| 636 | static const struct snd_soc_dapm_route dac_ch5_8_routes[] = { | ||
| 637 | { "DAC5", NULL, "Global Enable" }, | ||
| 638 | { "DAC6", NULL, "Global Enable" }, | ||
| 639 | |||
| 640 | { "DAC56 Enable", "Switch", "OUT5" }, | ||
| 641 | { "DAC56 Enable", "Switch", "OUT6" }, | ||
| 642 | { "DAC5", NULL, "DAC56 Enable" }, | ||
| 643 | { "DAC6", NULL, "DAC56 Enable" }, | ||
| 644 | { "OUT HPF", "Switch", "DAC5" }, | ||
| 645 | { "OUT HPF", "Switch", "DAC6" }, | ||
| 646 | |||
| 647 | { "DAC5", NULL, "AIF Playback" }, | ||
| 648 | { "DAC6", NULL, "AIF Playback" }, | ||
| 649 | |||
| 650 | { "OUT5", NULL, "DAC5" }, | ||
| 651 | { "OUT6", NULL, "DAC6" }, | ||
| 652 | |||
| 653 | { "DAC7", NULL, "Global Enable" }, | ||
| 654 | { "DAC8", NULL, "Global Enable" }, | ||
| 655 | |||
| 656 | { "DAC78 Enable", "Switch", "OUT7" }, | ||
| 657 | { "DAC78 Enable", "Switch", "OUT8" }, | ||
| 658 | { "DAC7", NULL, "DAC78 Enable" }, | ||
| 659 | { "DAC8", NULL, "DAC78 Enable" }, | ||
| 660 | { "OUT HPF", "Switch", "DAC7" }, | ||
| 661 | { "OUT HPF", "Switch", "DAC8" }, | ||
| 662 | |||
| 663 | { "DAC7", NULL, "AIF Playback" }, | ||
| 664 | { "DAC8", NULL, "AIF Playback" }, | ||
| 665 | |||
| 666 | { "OUT7", NULL, "DAC7" }, | ||
| 667 | { "OUT8", NULL, "DAC8" }, | ||
| 668 | }; | ||
| 669 | |||
| 670 | static void cs530x_add_12_dac_widgets(struct snd_soc_component *component) | ||
| 671 | { | ||
| 672 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 673 | |||
| 674 | snd_soc_add_component_controls(component, | ||
| 675 | cs530x_out_1_to_2_controls, | ||
| 676 | ARRAY_SIZE(cs530x_out_1_to_2_controls)); | ||
| 677 | |||
| 678 | snd_soc_dapm_new_controls(dapm, cs530x_dac_ch12_dapm_widgets, | ||
| 679 | ARRAY_SIZE(cs530x_dac_ch12_dapm_widgets)); | ||
| 680 | |||
| 681 | snd_soc_dapm_add_routes(dapm, dac_ch1_2_routes, | ||
| 682 | ARRAY_SIZE(dac_ch1_2_routes)); | ||
| 683 | } | ||
| 684 | |||
| 685 | static void cs530x_add_34_dac_widgets(struct snd_soc_component *component) | ||
| 686 | { | ||
| 687 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 688 | |||
| 689 | snd_soc_add_component_controls(component, | ||
| 690 | cs530x_out_3_to_4_controls, | ||
| 691 | ARRAY_SIZE(cs530x_out_3_to_4_controls)); | ||
| 692 | |||
| 693 | snd_soc_dapm_new_controls(dapm, cs530x_dac_ch34_dapm_widgets, | ||
| 694 | ARRAY_SIZE(cs530x_dac_ch34_dapm_widgets)); | ||
| 695 | |||
| 696 | snd_soc_dapm_add_routes(dapm, dac_ch3_4_routes, | ||
| 697 | ARRAY_SIZE(dac_ch3_4_routes)); | ||
| 698 | } | ||
| 699 | |||
| 418 | static int cs530x_set_bclk(struct snd_soc_component *component, const int freq) | 700 | static int cs530x_set_bclk(struct snd_soc_component *component, const int freq) |
| 419 | { | 701 | { |
| 420 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 702 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| @@ -450,7 +732,7 @@ static int cs530x_set_bclk(struct snd_soc_component *component, const int freq) · 29 unmodified lines | |||
| 450 | } | 732 | } |
| 451 | 733 | ||
| 452 | static int cs530x_set_pll_refclk(struct snd_soc_component *component, | 734 | static int cs530x_set_pll_refclk(struct snd_soc_component *component, |
| 453 | const unsigned int freq) | 735 | const unsigned int freq) |
| 454 | { | 736 | { |
| 455 | struct cs530x_priv *priv = snd_soc_component_get_drvdata(component); | 737 | struct cs530x_priv *priv = snd_soc_component_get_drvdata(component); |
| 456 | struct regmap *regmap = priv->regmap; | 738 | struct regmap *regmap = priv->regmap; |
| @@ -492,37 +774,35 @@ static int cs530x_hw_params(struct snd_pcm_substream *substream, · 35 unmodified lines | |||
| 492 | int ret = 0, fs = params_rate(params), bclk; | 774 | int ret = 0, fs = params_rate(params), bclk; |
| 493 | unsigned int fs_val; | 775 | unsigned int fs_val; |
| 494 | 776 | ||
| 495 | |||
| 496 | switch (fs) { | 777 | switch (fs) { |
| 497 | case 32000: | 778 | case 32000: |
| 498 | fs_val = CS530X_FS_32K; | 779 | fs_val = CS530X_FS_32K; |
| 499 | break; | 780 | break; |
| 500 | case 44100: | 781 | case 44100: |
| 501 | case 48000: | 782 | case 48000: |
| 502 | fs_val = CS530X_FS_48K_44P1K; | 783 | fs_val = CS530X_FS_44P1K_48K; |
| 503 | break; | 784 | break; |
| 504 | case 88200: | 785 | case 88200: |
| 505 | case 96000: | 786 | case 96000: |
| 506 | fs_val = CS530X_FS_96K_88P2K; | 787 | fs_val = CS530X_FS_88P2K_96K; |
| 507 | break; | 788 | break; |
| 508 | case 176400: | 789 | case 176400: |
| 509 | case 192000: | 790 | case 192000: |
| 510 | fs_val = CS530X_FS_192K_176P4K; | 791 | fs_val = CS530X_FS_176P4K_192K; |
| 511 | break; | 792 | break; |
| 512 | case 356800: | 793 | case 356800: |
| 513 | case 384000: | 794 | case 384000: |
| 514 | fs_val = CS530X_FS_384K_356P8K; | 795 | fs_val = CS530X_FS_356P8K_384K; |
| 515 | break; | 796 | break; |
| 516 | case 705600: | 797 | case 705600: |
| 517 | case 768000: | 798 | case 768000: |
| 518 | fs_val = CS530X_FS_768K_705P6K; | 799 | fs_val = CS530X_FS_705P6K_768K; |
| 519 | break; | 800 | break; |
| 520 | default: | 801 | default: |
| 521 | dev_err(component->dev, "Invalid sample rate %d\n", fs); | 802 | dev_err(component->dev, "Invalid sample rate %d\n", fs); |
| 522 | return -EINVAL; | 803 | return -EINVAL; |
| 523 | } | 804 | } |
| 524 | 805 | ||
| 525 | cs530x->fs = fs; | ||
| 526 | regmap_update_bits(regmap, CS530X_CLK_CFG_1, | 806 | regmap_update_bits(regmap, CS530X_CLK_CFG_1, |
| 527 | CS530X_SAMPLE_RATE_MASK, fs_val); | 807 | CS530X_SAMPLE_RATE_MASK, fs_val); |
| 528 | 808 | ||
| @@ -540,7 +820,7 @@ static int cs530x_hw_params(struct snd_pcm_substream *substream, · 11 unmodified lines | |||
| 540 | } | 820 | } |
| 541 | 821 | ||
| 542 | if (!regmap_test_bits(regmap, CS530X_CLK_CFG_0, | 822 | if (!regmap_test_bits(regmap, CS530X_CLK_CFG_0, |
| 543 | CS530X_PLL_REFCLK_SRC_MASK)) { | 823 | CS530X_PLL_REFCLK_SRC_MASK)) { |
| 544 | ret = cs530x_set_pll_refclk(component, bclk); | 824 | ret = cs530x_set_pll_refclk(component, bclk); |
| 545 | if (ret) | 825 | if (ret) |
| 546 | return ret; | 826 | return ret; |
| @@ -614,7 +894,7 @@ static bool cs530x_check_mclk_freq(struct snd_soc_component *component, · 67 unmodified lines | |||
| 614 | } | 894 | } |
| 615 | 895 | ||
| 616 | static int cs530x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | 896 | static int cs530x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
| 617 | unsigned int rx_mask, int slots, int slot_width) | 897 | unsigned int rx_mask, int slots, int slot_width) |
| 618 | { | 898 | { |
| 619 | struct snd_soc_component *component = dai->component; | 899 | struct snd_soc_component *component = dai->component; |
| 620 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 900 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| @@ -675,8 +955,11 @@ static const struct snd_soc_dai_driver cs530x_dai = { · 54 unmodified lines | |||
| 675 | .name = "cs530x-dai", | 955 | .name = "cs530x-dai", |
| 676 | .capture = { | 956 | .capture = { |
| 677 | .stream_name = "AIF Capture", | 957 | .stream_name = "AIF Capture", |
| 678 | .channels_min = 2, | 958 | .rates = SNDRV_PCM_RATE_KNOT, |
| 679 | .channels_max = 8, | 959 | .formats = SNDRV_PCM_FMTBIT_S32_LE, |
| 960 | }, | ||
| 961 | .playback = { | ||
| 962 | .stream_name = "AIF Playback", | ||
| 680 | .rates = SNDRV_PCM_RATE_KNOT, | 963 | .rates = SNDRV_PCM_RATE_KNOT, |
| 681 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | 964 | .formats = SNDRV_PCM_FMTBIT_S32_LE, |
| 682 | }, | 965 | }, |
| @@ -686,8 +969,8 @@ static const struct snd_soc_dai_driver cs530x_dai = { · 3 unmodified lines | |||
| 686 | }; | 969 | }; |
| 687 | 970 | ||
| 688 | static int cs530x_set_pll(struct snd_soc_component *component, int pll_id, | 971 | static int cs530x_set_pll(struct snd_soc_component *component, int pll_id, |
| 689 | int source, unsigned int freq_in, | 972 | int source, unsigned int freq_in, |
| 690 | unsigned int freq_out) | 973 | unsigned int freq_out) |
| 691 | { | 974 | { |
| 692 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 975 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| 693 | struct regmap *regmap = cs530x->regmap; | 976 | struct regmap *regmap = cs530x->regmap; |
| @@ -724,13 +1007,50 @@ static int cs530x_set_pll(struct snd_soc_component *component, int pll_id, · 30 unmodified lines | |||
| 724 | static int cs530x_component_probe(struct snd_soc_component *component) | 1007 | static int cs530x_component_probe(struct snd_soc_component *component) |
| 725 | { | 1008 | { |
| 726 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 1009 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| 727 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1010 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 728 | int num_widgets; | 1011 | int num_widgets; |
| 729 | 1012 | ||
| 730 | snd_soc_dapm_new_controls(dapm, cs530x_gen_dapm_widgets, | 1013 | snd_soc_dapm_new_controls(dapm, cs530x_gen_dapm_widgets, |
| 731 | ARRAY_SIZE(cs530x_gen_dapm_widgets)); | 1014 | ARRAY_SIZE(cs530x_gen_dapm_widgets)); |
| 732 | 1015 | ||
| 733 | switch (cs530x->devtype) { | 1016 | switch (cs530x->devtype) { |
| 1017 | case CS4282: | ||
| 1018 | cs530x_add_12_adc_widgets(component); | ||
| 1019 | cs530x_add_12_dac_widgets(component); | ||
| 1020 | break; | ||
| 1021 | case CS4302: | ||
| 1022 | cs530x_add_12_dac_widgets(component); | ||
| 1023 | break; | ||
| 1024 | case CS4304: | ||
| 1025 | cs530x_add_12_dac_widgets(component); | ||
| 1026 | cs530x_add_34_dac_widgets(component); | ||
| 1027 | |||
| 1028 | num_widgets = ARRAY_SIZE(cs530x_out_sum_4ch_controls); | ||
| 1029 | snd_soc_add_component_controls(component, | ||
| 1030 | cs530x_out_sum_4ch_controls, | ||
| 1031 | num_widgets); | ||
| 1032 | break; | ||
| 1033 | case CS4308: | ||
| 1034 | cs530x_add_12_dac_widgets(component); | ||
| 1035 | cs530x_add_34_dac_widgets(component); | ||
| 1036 | |||
| 1037 | num_widgets = ARRAY_SIZE(cs530x_out_5_to_8_controls); | ||
| 1038 | snd_soc_add_component_controls(component, | ||
| 1039 | cs530x_out_5_to_8_controls, | ||
| 1040 | num_widgets); | ||
| 1041 | |||
| 1042 | num_widgets = ARRAY_SIZE(cs530x_out_sum_8ch_controls); | ||
| 1043 | snd_soc_add_component_controls(component, | ||
| 1044 | cs530x_out_sum_8ch_controls, | ||
| 1045 | num_widgets); | ||
| 1046 | |||
| 1047 | num_widgets = ARRAY_SIZE(cs530x_dac_ch58_dapm_widgets); | ||
| 1048 | snd_soc_dapm_new_controls(dapm, cs530x_dac_ch58_dapm_widgets, | ||
| 1049 | num_widgets); | ||
| 1050 | |||
| 1051 | snd_soc_dapm_add_routes(dapm, dac_ch5_8_routes, | ||
| 1052 | ARRAY_SIZE(dac_ch5_8_routes)); | ||
| 1053 | break; | ||
| 734 | case CS5302: | 1054 | case CS5302: |
| 735 | cs530x_add_12_adc_widgets(component); | 1055 | cs530x_add_12_adc_widgets(component); |
| 736 | break; | 1056 | break; |
| @@ -743,7 +1063,6 @@ static int cs530x_component_probe(struct snd_soc_component *component) · 6 unmodified lines | |||
| 743 | cs530x_in_sum_4ch_controls, | 1063 | cs530x_in_sum_4ch_controls, |
| 744 | num_widgets); | 1064 | num_widgets); |
| 745 | break; | 1065 | break; |
| 746 | |||
| 747 | case CS5308: | 1066 | case CS5308: |
| 748 | cs530x_add_12_adc_widgets(component); | 1067 | cs530x_add_12_adc_widgets(component); |
| 749 | cs530x_add_34_adc_widgets(component); | 1068 | cs530x_add_34_adc_widgets(component); |
| @@ -775,20 +1094,21 @@ static int cs530x_component_probe(struct snd_soc_component *component) · 25 unmodified lines | |||
| 775 | } | 1094 | } |
| 776 | 1095 | ||
| 777 | static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id, | 1096 | static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id, |
| 778 | int source, unsigned int freq, int dir) | 1097 | int source, unsigned int freq, int dir) |
| 779 | { | 1098 | { |
| 780 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); | 1099 | struct cs530x_priv *cs530x = snd_soc_component_get_drvdata(component); |
| 781 | struct regmap *regmap = cs530x->regmap; | 1100 | struct regmap *regmap = cs530x->regmap; |
| 782 | 1101 | ||
| 783 | switch (source) { | 1102 | switch (source) { |
| 784 | case CS530X_SYSCLK_SRC_MCLK: | 1103 | case CS530X_SYSCLK_SRC_MCLK: |
| 785 | if (freq != 24560000 && freq != 22572000) { | 1104 | switch (freq) { |
| 786 | dev_err(component->dev, "Invalid MCLK source rate %d\n", | 1105 | case CS530X_SYSCLK_REF_45_1MHZ: |
| 787 | freq); | 1106 | case CS530X_SYSCLK_REF_49_1MHZ: |
| 1107 | break; | ||
| 1108 | default: | ||
| 1109 | dev_err(component->dev, "Invalid MCLK source rate %d\n", freq); | ||
| 788 | return -EINVAL; | 1110 | return -EINVAL; |
| 789 | } | 1111 | } |
| 790 | |||
| 791 | cs530x->mclk_rate = freq; | ||
| 792 | break; | 1112 | break; |
| 793 | case CS530X_SYSCLK_SRC_PLL: | 1113 | case CS530X_SYSCLK_SRC_PLL: |
| 794 | break; | 1114 | break; |
| @@ -809,7 +1129,7 @@ static const struct snd_soc_component_driver soc_component_dev_cs530x = { · 14 unmodified lines | |||
| 809 | .endianness = 1, | 1129 | .endianness = 1, |
| 810 | }; | 1130 | }; |
| 811 | 1131 | ||
| 812 | const struct regmap_config cs530x_regmap = { | 1132 | const struct regmap_config cs530x_regmap_i2c = { |
| 813 | .reg_bits = 16, | 1133 | .reg_bits = 16, |
| 814 | .val_bits = 16, | 1134 | .val_bits = 16, |
| 815 | 1135 | ||
| @@ -821,7 +1141,27 @@ const struct regmap_config cs530x_regmap = { · 5 unmodified lines | |||
| 821 | .reg_defaults = cs530x_reg_defaults, | 1141 | .reg_defaults = cs530x_reg_defaults, |
| 822 | .num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults), | 1142 | .num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults), |
| 823 | }; | 1143 | }; |
| 824 | EXPORT_SYMBOL_NS_GPL(cs530x_regmap, "SND_SOC_CS530X"); | 1144 | EXPORT_SYMBOL_NS_GPL(cs530x_regmap_i2c, "SND_SOC_CS530X"); |
| 1145 | |||
| 1146 | const struct regmap_config cs530x_regmap_spi = { | ||
| 1147 | .reg_bits = 16, | ||
| 1148 | .pad_bits = 16, | ||
| 1149 | .val_bits = 16, | ||
| 1150 | |||
| 1151 | .reg_stride = 2, | ||
| 1152 | |||
| 1153 | .reg_format_endian = REGMAP_ENDIAN_BIG, | ||
| 1154 | .val_format_endian = REGMAP_ENDIAN_BIG, | ||
| 1155 | |||
| 1156 | .max_register = CS530X_MAX_REGISTER, | ||
| 1157 | .writeable_reg = cs530x_writeable_register, | ||
| 1158 | .readable_reg = cs530x_readable_register, | ||
| 1159 | |||
| 1160 | .cache_type = REGCACHE_MAPLE, | ||
| 1161 | .reg_defaults = cs530x_reg_defaults, | ||
| 1162 | .num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults), | ||
| 1163 | }; | ||
| 1164 | EXPORT_SYMBOL_NS_GPL(cs530x_regmap_spi, "SND_SOC_CS530X"); | ||
| 825 | 1165 | ||
| 826 | static int cs530x_check_device_id(struct cs530x_priv *cs530x) | 1166 | static int cs530x_check_device_id(struct cs530x_priv *cs530x) |
| 827 | { | 1167 | { |
| @@ -837,9 +1177,20 @@ static int cs530x_check_device_id(struct cs530x_priv *cs530x) · 9 unmodified lines | |||
| 837 | if (ret) | 1177 | if (ret) |
| 838 | return dev_err_probe(dev, ret, "Can't read REV ID\n"); | 1178 | return dev_err_probe(dev, ret, "Can't read REV ID\n"); |
| 839 | 1179 | ||
| 840 | dev_dbg(dev, "Device ID 0x%x Rev ID 0x%x\n", dev_id, rev); | ||
| 841 | |||
| 842 | switch (dev_id) { | 1180 | switch (dev_id) { |
| 1181 | case CS530X_2CH_CODEC_DEV_ID: | ||
| 1182 | cs530x->num_dacs = 2; | ||
| 1183 | cs530x->num_adcs = 2; | ||
| 1184 | break; | ||
| 1185 | case CS530X_2CH_DAC_DEV_ID: | ||
| 1186 | cs530x->num_dacs = 2; | ||
| 1187 | break; | ||
| 1188 | case CS530X_4CH_DAC_DEV_ID: | ||
| 1189 | cs530x->num_dacs = 4; | ||
| 1190 | break; | ||
| 1191 | case CS530X_8CH_DAC_DEV_ID: | ||
| 1192 | cs530x->num_dacs = 8; | ||
| 1193 | break; | ||
| 843 | case CS530X_2CH_ADC_DEV_ID: | 1194 | case CS530X_2CH_ADC_DEV_ID: |
| 844 | cs530x->num_adcs = 2; | 1195 | cs530x->num_adcs = 2; |
| 845 | break; | 1196 | break; |
| @@ -854,6 +1205,15 @@ static int cs530x_check_device_id(struct cs530x_priv *cs530x) · 8 unmodified lines | |||
| 854 | dev_id); | 1205 | dev_id); |
| 855 | } | 1206 | } |
| 856 | 1207 | ||
| 1208 | if (cs530x->devtype != dev_id) { | ||
| 1209 | dev_err(dev, "Read device ID 0x%x is not the expected devtype 0x%x\n", | ||
| 1210 | dev_id, cs530x->devtype); | ||
| 1211 | return -EINVAL; | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | dev_dbg(dev, "Device ID 0x%x Rev ID 0x%x (%d in %d out)\n", dev_id, rev, | ||
| 1215 | cs530x->num_adcs, cs530x->num_dacs); | ||
| 1216 | |||
| 857 | return 0; | 1217 | return 0; |
| 858 | } | 1218 | } |
| 859 | 1219 | ||
| @@ -882,6 +1242,9 @@ static int cs530x_parse_device_properties(struct cs530x_priv *cs530x) · 22 unmodified lines | |||
| 882 | val |= CS530X_IN12_HIZ; | 1242 | val |= CS530X_IN12_HIZ; |
| 883 | 1243 | ||
| 884 | return regmap_set_bits(regmap, CS530X_IN_HIZ, val); | 1244 | return regmap_set_bits(regmap, CS530X_IN_HIZ, val); |
| 1245 | case 0: | ||
| 1246 | /* No ADCs */ | ||
| 1247 | return 0; | ||
| 885 | default: | 1248 | default: |
| 886 | return dev_err_probe(dev, -EINVAL, | 1249 | return dev_err_probe(dev, -EINVAL, |
| 887 | "Invalid number of adcs %d\n", | 1250 | "Invalid number of adcs %d\n", |
| @@ -895,8 +1258,8 @@ int cs530x_probe(struct cs530x_priv *cs530x) · 7 unmodified lines | |||
| 895 | int ret, i; | 1258 | int ret, i; |
| 896 | 1259 | ||
| 897 | cs530x->dev_dai = devm_kmemdup(dev, &cs530x_dai, | 1260 | cs530x->dev_dai = devm_kmemdup(dev, &cs530x_dai, |
| 898 | sizeof(*(cs530x->dev_dai)), | 1261 | sizeof(*(cs530x->dev_dai)), |
| 899 | GFP_KERNEL); | 1262 | GFP_KERNEL); |
| 900 | if (!cs530x->dev_dai) | 1263 | if (!cs530x->dev_dai) |
| 901 | return -ENOMEM; | 1264 | return -ENOMEM; |
| 902 | 1265 | ||
| @@ -914,10 +1277,10 @@ int cs530x_probe(struct cs530x_priv *cs530x) · 11 unmodified lines | |||
| 914 | return dev_err_probe(dev, ret, "Failed to enable supplies"); | 1277 | return dev_err_probe(dev, ret, "Failed to enable supplies"); |
| 915 | 1278 | ||
| 916 | cs530x->reset_gpio = devm_gpiod_get_optional(dev, "reset", | 1279 | cs530x->reset_gpio = devm_gpiod_get_optional(dev, "reset", |
| 917 | GPIOD_OUT_HIGH); | 1280 | GPIOD_OUT_HIGH); |
| 918 | if (IS_ERR(cs530x->reset_gpio)) { | 1281 | if (IS_ERR(cs530x->reset_gpio)) { |
| 919 | ret = dev_err_probe(dev, PTR_ERR(cs530x->reset_gpio), | 1282 | ret = dev_err_probe(dev, PTR_ERR(cs530x->reset_gpio), |
| 920 | "Reset gpio not available\n"); | 1283 | "Reset gpio not available\n"); |
| 921 | goto err_regulator; | 1284 | goto err_regulator; |
| 922 | } | 1285 | } |
| 923 | 1286 | ||
| @@ -944,10 +1307,19 @@ int cs530x_probe(struct cs530x_priv *cs530x) · 20 unmodified lines | |||
| 944 | if (ret) | 1307 | if (ret) |
| 945 | goto err_reset; | 1308 | goto err_reset; |
| 946 | 1309 | ||
| 947 | cs530x->dev_dai->capture.channels_max = cs530x->num_adcs; | 1310 | if (cs530x->num_adcs) { |
| 1311 | cs530x->dev_dai->capture.channels_min = 2; | ||
| 1312 | cs530x->dev_dai->capture.channels_max = cs530x->num_adcs; | ||
| 1313 | } | ||
| 1314 | |||
| 1315 | if (cs530x->num_dacs) { | ||
| 1316 | cs530x->dev_dai->playback.channels_min = 2; | ||
| 1317 | cs530x->dev_dai->playback.channels_max = cs530x->num_dacs; | ||
| 1318 | } | ||
| 948 | 1319 | ||
| 949 | ret = devm_snd_soc_register_component(dev, | 1320 | ret = devm_snd_soc_register_component(dev, |
| 950 | &soc_component_dev_cs530x, cs530x->dev_dai, 1); | 1321 | &soc_component_dev_cs530x, |
| 1322 | cs530x->dev_dai, 1); | ||
| 951 | if (ret) { | 1323 | if (ret) { |
| 952 | dev_err_probe(dev, ret, "Can't register cs530x component\n"); | 1324 | dev_err_probe(dev, ret, "Can't register cs530x component\n"); |
| 953 | goto err_reset; | 1325 | goto err_reset; |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | /* | 2 | /* |
| 3 | * CS530x CODEC driver internal data | 3 | * CS530x CODEC driver internal data |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2023-2024 Cirrus Logic, Inc. and | 5 | * Copyright (C) 2023-2025 Cirrus Logic, Inc. and |
| 6 | * Cirrus Logic International Semiconductor Ltd. | 6 | * Cirrus Logic International Semiconductor Ltd. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| @@ -15,6 +15,10 @@ · 6 unmodified lines | |||
| 15 | #include <linux/regulator/consumer.h> | 15 | #include <linux/regulator/consumer.h> |
| 16 | 16 | ||
| 17 | /* Devices */ | 17 | /* Devices */ |
| 18 | #define CS530X_2CH_CODEC_DEV_ID 0x4282 | ||
| 19 | #define CS530X_2CH_DAC_DEV_ID 0x4302 | ||
| 20 | #define CS530X_4CH_DAC_DEV_ID 0x4304 | ||
| 21 | #define CS530X_8CH_DAC_DEV_ID 0x4308 | ||
| 18 | #define CS530X_2CH_ADC_DEV_ID 0x5302 | 22 | #define CS530X_2CH_ADC_DEV_ID 0x5302 |
| 19 | #define CS530X_4CH_ADC_DEV_ID 0x5304 | 23 | #define CS530X_4CH_ADC_DEV_ID 0x5304 |
| 20 | #define CS530X_8CH_ADC_DEV_ID 0x5308 | 24 | #define CS530X_8CH_ADC_DEV_ID 0x5308 |
| @@ -45,6 +49,21 @@ · 24 unmodified lines | |||
| 45 | #define CS530X_IN_VOL_CTRL4_1 0x000009E | 49 | #define CS530X_IN_VOL_CTRL4_1 0x000009E |
| 46 | #define CS530X_IN_VOL_CTRL5 0x00000A0 | 50 | #define CS530X_IN_VOL_CTRL5 0x00000A0 |
| 47 | 51 | ||
| 52 | #define CS530X_OUT_ENABLES 0x00000C0 | ||
| 53 | #define CS530X_OUT_RAMP_SUM 0x00000C2 | ||
| 54 | #define CS530X_OUT_DEEMPH 0x00000C4 | ||
| 55 | #define CS530X_OUT_FILTER 0x00000C6 | ||
| 56 | #define CS530X_OUT_INV 0x00000CA | ||
| 57 | #define CS530X_OUT_VOL_CTRL1_0 0x00000D0 | ||
| 58 | #define CS530X_OUT_VOL_CTRL1_1 0x00000D2 | ||
| 59 | #define CS530X_OUT_VOL_CTRL2_0 0x00000D4 | ||
| 60 | #define CS530X_OUT_VOL_CTRL2_1 0x00000D6 | ||
| 61 | #define CS530X_OUT_VOL_CTRL3_0 0x00000D8 | ||
| 62 | #define CS530X_OUT_VOL_CTRL3_1 0x00000DA | ||
| 63 | #define CS530X_OUT_VOL_CTRL4_0 0x00000DC | ||
| 64 | #define CS530X_OUT_VOL_CTRL4_1 0x00000DE | ||
| 65 | #define CS530X_OUT_VOL_CTRL5 0x00000E0 | ||
| 66 | |||
| 48 | #define CS530X_PAD_FN 0x0003D24 | 67 | #define CS530X_PAD_FN 0x0003D24 |
| 49 | #define CS530X_PAD_LVL 0x0003D28 | 68 | #define CS530X_PAD_LVL 0x0003D28 |
| 50 | 69 | ||
| @@ -73,11 +92,11 @@ · 22 unmodified lines | |||
| 73 | /* CLK_CFG_1 */ | 92 | /* CLK_CFG_1 */ |
| 74 | #define CS530X_SAMPLE_RATE_MASK GENMASK(2, 0) | 93 | #define CS530X_SAMPLE_RATE_MASK GENMASK(2, 0) |
| 75 | #define CS530X_FS_32K 0 | 94 | #define CS530X_FS_32K 0 |
| 76 | #define CS530X_FS_48K_44P1K 1 | 95 | #define CS530X_FS_44P1K_48K 1 |
| 77 | #define CS530X_FS_96K_88P2K 2 | 96 | #define CS530X_FS_88P2K_96K 2 |
| 78 | #define CS530X_FS_192K_176P4K 3 | 97 | #define CS530X_FS_176P4K_192K 3 |
| 79 | #define CS530X_FS_384K_356P8K 4 | 98 | #define CS530X_FS_356P8K_384K 4 |
| 80 | #define CS530X_FS_768K_705P6K 5 | 99 | #define CS530X_FS_705P6K_768K 5 |
| 81 | 100 | ||
| 82 | /* CHIP_ENABLE */ | 101 | /* CHIP_ENABLE */ |
| 83 | #define CS530X_GLOBAL_EN BIT(0) | 102 | #define CS530X_GLOBAL_EN BIT(0) |
| @@ -99,7 +118,7 @@ · 15 unmodified lines | |||
| 99 | #define CS530X_TDM_EN_MASK BIT(2) | 118 | #define CS530X_TDM_EN_MASK BIT(2) |
| 100 | #define CS530X_ASP_FMT_I2S 0 | 119 | #define CS530X_ASP_FMT_I2S 0 |
| 101 | #define CS530X_ASP_FMT_LJ 1 | 120 | #define CS530X_ASP_FMT_LJ 1 |
| 102 | #define CS530X_ASP_FMT_DSP_A 0x6 | 121 | #define CS530X_ASP_FMT_DSP_A 6 |
| 103 | 122 | ||
| 104 | /* TDM Slots */ | 123 | /* TDM Slots */ |
| 105 | #define CS530X_0_1_TDM_SLOT_MASK GENMASK(1, 0) | 124 | #define CS530X_0_1_TDM_SLOT_MASK GENMASK(1, 0) |
| @@ -132,14 +151,14 @@ · 26 unmodified lines | |||
| 132 | #define CS530X_14_15_TDM_SLOT_MASK GENMASK(15, 14) | 151 | #define CS530X_14_15_TDM_SLOT_MASK GENMASK(15, 14) |
| 133 | #define CS530X_14_15_TDM_SLOT_VAL 7 | 152 | #define CS530X_14_15_TDM_SLOT_VAL 7 |
| 134 | 153 | ||
| 135 | /* IN_RAMP_SUM */ | 154 | /* IN_RAMP_SUM and OUT_RAMP_SUM */ |
| 136 | #define CS530X_RAMP_RATE_INC_SHIFT 0 | 155 | #define CS530X_RAMP_RATE_INC_SHIFT 0 |
| 137 | #define CS530X_RAMP_RATE_DEC_SHIFT 4 | 156 | #define CS530X_RAMP_RATE_DEC_SHIFT 4 |
| 138 | #define CS530X_IN_SUM_MODE_SHIFT 13 | 157 | #define CS530X_INOUT_SUM_MODE_SHIFT 13 |
| 139 | 158 | ||
| 140 | /* IN_FILTER */ | 159 | /* IN_FILTER and OUT_FILTER */ |
| 141 | #define CS530X_IN_FILTER_SHIFT 8 | 160 | #define CS530X_INOUT_FILTER_SHIFT 8 |
| 142 | #define CS530X_IN_HPF_EN_SHIFT 12 | 161 | #define CS530X_INOUT_HPF_EN_SHIFT 12 |
| 143 | 162 | ||
| 144 | /* IN_HIZ */ | 163 | /* IN_HIZ */ |
| 145 | #define CS530X_IN12_HIZ BIT(0) | 164 | #define CS530X_IN12_HIZ BIT(0) |
| @@ -147,18 +166,18 @@ · 1 unmodified line | |||
| 147 | #define CS530X_IN56_HIZ BIT(2) | 166 | #define CS530X_IN56_HIZ BIT(2) |
| 148 | #define CS530X_IN78_HIZ BIT(3) | 167 | #define CS530X_IN78_HIZ BIT(3) |
| 149 | 168 | ||
| 150 | /* IN_INV */ | 169 | /* IN_INV and OUT_INV */ |
| 151 | #define CS530X_IN1_INV_SHIFT 0 | 170 | #define CS530X_INOUT1_INV_SHIFT 0 |
| 152 | #define CS530X_IN2_INV_SHIFT 1 | 171 | #define CS530X_INOUT2_INV_SHIFT 1 |
| 153 | #define CS530X_IN3_INV_SHIFT 2 | 172 | #define CS530X_INOUT3_INV_SHIFT 2 |
| 154 | #define CS530X_IN4_INV_SHIFT 3 | 173 | #define CS530X_INOUT4_INV_SHIFT 3 |
| 155 | #define CS530X_IN5_INV_SHIFT 4 | 174 | #define CS530X_INOUT5_INV_SHIFT 4 |
| 156 | #define CS530X_IN6_INV_SHIFT 5 | 175 | #define CS530X_INOUT6_INV_SHIFT 5 |
| 157 | #define CS530X_IN7_INV_SHIFT 6 | 176 | #define CS530X_INOUT7_INV_SHIFT 6 |
| 158 | #define CS530X_IN8_INV_SHIFT 7 | 177 | #define CS530X_INOUT8_INV_SHIFT 7 |
| 159 | 178 | ||
| 160 | /* IN_VOL_CTLy_z */ | 179 | /* IN_VOL_CTLy_z and OUT_VOL_CTLy_z */ |
| 161 | #define CS530X_IN_MUTE BIT(15) | 180 | #define CS530X_INOUT_MUTE BIT(15) |
| 162 | 181 | ||
| 163 | /* IN_VOL_CTL5 */ | 182 | /* IN_VOL_CTL5 */ |
| 164 | #define CS530X_IN_VU BIT(0) | 183 | #define CS530X_IN_VU BIT(0) |
| @@ -178,6 +197,14 @@ · 13 unmodified lines | |||
| 178 | #define CS530X_CONFIG3_LVL BIT(7) | 197 | #define CS530X_CONFIG3_LVL BIT(7) |
| 179 | #define CS530X_CONFIG4_LVL BIT(8) | 198 | #define CS530X_CONFIG4_LVL BIT(8) |
| 180 | #define CS530X_CONFIG5_LVL BIT(9) | 199 | #define CS530X_CONFIG5_LVL BIT(9) |
| 200 | /* IN_VOL_CTL5 and OUT_VOL_CTL5 */ | ||
| 201 | #define CS530X_INOUT_VU BIT(0) | ||
| 202 | |||
| 203 | /* MCLK Reference Source Frequency */ | ||
| 204 | /* 41KHz related */ | ||
| 205 | #define CS530X_SYSCLK_REF_45_1MHZ 45158400 | ||
| 206 | /* 48KHz related */ | ||
| 207 | #define CS530X_SYSCLK_REF_49_1MHZ 49152000 | ||
| 181 | 208 | ||
| 182 | /* System Clock Source */ | 209 | /* System Clock Source */ |
| 183 | #define CS530X_SYSCLK_SRC_MCLK 0 | 210 | #define CS530X_SYSCLK_SRC_MCLK 0 |
| @@ -190,9 +217,13 @@ · 6 unmodified lines | |||
| 190 | #define CS530X_NUM_SUPPLIES 2 | 217 | #define CS530X_NUM_SUPPLIES 2 |
| 191 | 218 | ||
| 192 | enum cs530x_type { | 219 | enum cs530x_type { |
| 193 | CS5302, | 220 | CS4282 = CS530X_2CH_CODEC_DEV_ID, |
| 194 | CS5304, | 221 | CS4302 = CS530X_2CH_DAC_DEV_ID, |
| 195 | CS5308, | 222 | CS4304 = CS530X_4CH_DAC_DEV_ID, |
| 223 | CS4308 = CS530X_8CH_DAC_DEV_ID, | ||
| 224 | CS5302 = CS530X_2CH_ADC_DEV_ID, | ||
| 225 | CS5304 = CS530X_4CH_ADC_DEV_ID, | ||
| 226 | CS5308 = CS530X_8CH_ADC_DEV_ID, | ||
| 196 | }; | 227 | }; |
| 197 | 228 | ||
| 198 | /* codec private data */ | 229 | /* codec private data */ |
| @@ -207,17 +238,16 @@ struct cs530x_priv { · 8 unmodified lines | |||
| 207 | 238 | ||
| 208 | struct regulator_bulk_data supplies[CS530X_NUM_SUPPLIES]; | 239 | struct regulator_bulk_data supplies[CS530X_NUM_SUPPLIES]; |
| 209 | 240 | ||
| 210 | unsigned int mclk_rate; | ||
| 211 | |||
| 212 | int tdm_width; | 241 | int tdm_width; |
| 213 | int tdm_slots; | 242 | int tdm_slots; |
| 214 | int fs; | ||
| 215 | int adc_pairs_count; | 243 | int adc_pairs_count; |
| 244 | int dac_pairs_count; | ||
| 216 | 245 | ||
| 217 | struct gpio_desc *reset_gpio; | 246 | struct gpio_desc *reset_gpio; |
| 218 | }; | 247 | }; |
| 219 | 248 | ||
| 220 | extern const struct regmap_config cs530x_regmap; | 249 | extern const struct regmap_config cs530x_regmap_i2c; |
| 250 | extern const struct regmap_config cs530x_regmap_spi; | ||
| 221 | int cs530x_probe(struct cs530x_priv *cs530x); | 251 | int cs530x_probe(struct cs530x_priv *cs530x); |
| 222 | 252 | ||
| 223 | #endif | 253 | #endif |
| @@ -649,8 +649,9 @@ static int cs53l30_pcm_hw_params(struct snd_pcm_substream *substream, · 648 unmodified lines | |||
| 649 | static int cs53l30_set_bias_level(struct snd_soc_component *component, | 649 | static int cs53l30_set_bias_level(struct snd_soc_component *component, |
| 650 | enum snd_soc_bias_level level) | 650 | enum snd_soc_bias_level level) |
| 651 | { | 651 | { |
| 652 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 652 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 653 | struct cs53l30_private *priv = snd_soc_component_get_drvdata(component); | 653 | struct cs53l30_private *priv = snd_soc_component_get_drvdata(component); |
| 654 | enum snd_soc_bias_level bias_level = snd_soc_dapm_get_bias_level(dapm); | ||
| 654 | unsigned int reg; | 655 | unsigned int reg; |
| 655 | int i, inter_max_check, ret; | 656 | int i, inter_max_check, ret; |
| 656 | 657 | ||
| @@ -658,12 +659,12 @@ static int cs53l30_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 658 | case SND_SOC_BIAS_ON: | 659 | case SND_SOC_BIAS_ON: |
| 659 | break; | 660 | break; |
| 660 | case SND_SOC_BIAS_PREPARE: | 661 | case SND_SOC_BIAS_PREPARE: |
| 661 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) | 662 | if (bias_level == SND_SOC_BIAS_STANDBY) |
| 662 | regmap_update_bits(priv->regmap, CS53L30_PWRCTL, | 663 | regmap_update_bits(priv->regmap, CS53L30_PWRCTL, |
| 663 | CS53L30_PDN_LP_MASK, 0); | 664 | CS53L30_PDN_LP_MASK, 0); |
| 664 | break; | 665 | break; |
| 665 | case SND_SOC_BIAS_STANDBY: | 666 | case SND_SOC_BIAS_STANDBY: |
| 666 | if (dapm->bias_level == SND_SOC_BIAS_OFF) { | 667 | if (bias_level == SND_SOC_BIAS_OFF) { |
| 667 | ret = clk_prepare_enable(priv->mclk); | 668 | ret = clk_prepare_enable(priv->mclk); |
| 668 | if (ret) { | 669 | if (ret) { |
| 669 | dev_err(component->dev, | 670 | dev_err(component->dev, |
| @@ -857,7 +858,7 @@ static struct snd_soc_dai_driver cs53l30_dai = { · 187 unmodified lines | |||
| 857 | static int cs53l30_component_probe(struct snd_soc_component *component) | 858 | static int cs53l30_component_probe(struct snd_soc_component *component) |
| 858 | { | 859 | { |
| 859 | struct cs53l30_private *priv = snd_soc_component_get_drvdata(component); | 860 | struct cs53l30_private *priv = snd_soc_component_get_drvdata(component); |
| 860 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 861 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 861 | 862 | ||
| 862 | if (priv->use_sdout2) | 863 | if (priv->use_sdout2) |
| 863 | snd_soc_dapm_add_routes(dapm, cs53l30_dapm_routes_sdout2, | 864 | snd_soc_dapm_add_routes(dapm, cs53l30_dapm_routes_sdout2, |
| @@ -315,11 +315,12 @@ static int cx20442_set_bias_level(struct snd_soc_component *component, · 314 unmodified lines | |||
| 315 | enum snd_soc_bias_level level) | 315 | enum snd_soc_bias_level level) |
| 316 | { | 316 | { |
| 317 | struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component); | 317 | struct cx20442_priv *cx20442 = snd_soc_component_get_drvdata(component); |
| 318 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 318 | int err = 0; | 319 | int err = 0; |
| 319 | 320 | ||
| 320 | switch (level) { | 321 | switch (level) { |
| 321 | case SND_SOC_BIAS_PREPARE: | 322 | case SND_SOC_BIAS_PREPARE: |
| 322 | if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_STANDBY) | 323 | if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_STANDBY) |
| 323 | break; | 324 | break; |
| 324 | if (IS_ERR(cx20442->por)) | 325 | if (IS_ERR(cx20442->por)) |
| 325 | err = PTR_ERR(cx20442->por); | 326 | err = PTR_ERR(cx20442->por); |
| @@ -327,7 +328,7 @@ static int cx20442_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 327 | err = regulator_enable(cx20442->por); | 328 | err = regulator_enable(cx20442->por); |
| 328 | break; | 329 | break; |
| 329 | case SND_SOC_BIAS_STANDBY: | 330 | case SND_SOC_BIAS_STANDBY: |
| 330 | if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_PREPARE) | 331 | if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_PREPARE) |
| 331 | break; | 332 | break; |
| 332 | if (IS_ERR(cx20442->por)) | 333 | if (IS_ERR(cx20442->por)) |
| 333 | err = PTR_ERR(cx20442->por); | 334 | err = PTR_ERR(cx20442->por); |
| @@ -1341,8 +1341,8 @@ static int cx2072x_set_bias_level(struct snd_soc_component *codec, · 1340 unmodified lines | |||
| 1341 | enum snd_soc_bias_level level) | 1341 | enum snd_soc_bias_level level) |
| 1342 | { | 1342 | { |
| 1343 | struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec); | 1343 | struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec); |
| 1344 | const enum snd_soc_bias_level old_level = | 1344 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); |
| 1345 | snd_soc_component_get_bias_level(codec); | 1345 | const enum snd_soc_bias_level old_level = snd_soc_dapm_get_bias_level(dapm); |
| 1346 | 1346 | ||
| 1347 | if (level == SND_SOC_BIAS_STANDBY && old_level == SND_SOC_BIAS_OFF) | 1347 | if (level == SND_SOC_BIAS_STANDBY && old_level == SND_SOC_BIAS_OFF) |
| 1348 | regmap_write(cx2072x->regmap, CX2072X_AFG_POWER_STATE, 0); | 1348 | regmap_write(cx2072x->regmap, CX2072X_AFG_POWER_STATE, 0); |
| @@ -1363,7 +1363,7 @@ static int cx2072x_set_bias_level(struct snd_soc_component *codec, · 14 unmodified lines | |||
| 1363 | static void cx2072x_enable_jack_detect(struct snd_soc_component *codec) | 1363 | static void cx2072x_enable_jack_detect(struct snd_soc_component *codec) |
| 1364 | { | 1364 | { |
| 1365 | struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec); | 1365 | struct cx2072x_priv *cx2072x = snd_soc_component_get_drvdata(codec); |
| 1366 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec); | 1366 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); |
| 1367 | 1367 | ||
| 1368 | /* No-sticky input type */ | 1368 | /* No-sticky input type */ |
| 1369 | regmap_write(cx2072x->regmap, CX2072X_GPIO_STICKY_MASK, 0x1f); | 1369 | regmap_write(cx2072x->regmap, CX2072X_GPIO_STICKY_MASK, 0x1f); |
| @@ -326,7 +326,7 @@ static SOC_ENUM_SINGLE_DECL(da7210_hp_mode_sel, · 325 unmodified lines | |||
| 326 | static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol, | 326 | static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol, |
| 327 | struct snd_ctl_elem_value *ucontrol) | 327 | struct snd_ctl_elem_value *ucontrol) |
| 328 | { | 328 | { |
| 329 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 329 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 330 | 330 | ||
| 331 | if (ucontrol->value.integer.value[0]) { | 331 | if (ucontrol->value.integer.value[0]) { |
| 332 | /* Check if noise suppression is enabled */ | 332 | /* Check if noise suppression is enabled */ |
| @@ -349,7 +349,7 @@ static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 349 | static int da7210_put_noise_sup_sw(struct snd_kcontrol *kcontrol, | 349 | static int da7210_put_noise_sup_sw(struct snd_kcontrol *kcontrol, |
| 350 | struct snd_ctl_elem_value *ucontrol) | 350 | struct snd_ctl_elem_value *ucontrol) |
| 351 | { | 351 | { |
| 352 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 352 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 353 | u8 val; | 353 | u8 val; |
| 354 | 354 | ||
| 355 | if (ucontrol->value.integer.value[0]) { | 355 | if (ucontrol->value.integer.value[0]) { |
| @@ -214,7 +214,7 @@ static SOC_ENUM_SINGLE_DECL(da7213_alc_integ_release_rate, · 213 unmodified lines | |||
| 214 | static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol, | 214 | static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol, |
| 215 | struct snd_ctl_elem_value *ucontrol) | 215 | struct snd_ctl_elem_value *ucontrol) |
| 216 | { | 216 | { |
| 217 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 217 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 218 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 218 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 219 | int ret; | 219 | int ret; |
| 220 | 220 | ||
| @@ -228,7 +228,7 @@ static int da7213_volsw_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 228 | static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol, | 228 | static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol, |
| 229 | struct snd_ctl_elem_value *ucontrol) | 229 | struct snd_ctl_elem_value *ucontrol) |
| 230 | { | 230 | { |
| 231 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 231 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 232 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 232 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 233 | int ret; | 233 | int ret; |
| 234 | 234 | ||
| @@ -242,7 +242,7 @@ static int da7213_volsw_locked_put(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 242 | static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol, | 242 | static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol, |
| 243 | struct snd_ctl_elem_value *ucontrol) | 243 | struct snd_ctl_elem_value *ucontrol) |
| 244 | { | 244 | { |
| 245 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 245 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 246 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 246 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 247 | int ret; | 247 | int ret; |
| 248 | 248 | ||
| @@ -256,7 +256,7 @@ static int da7213_enum_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 256 | static int da7213_enum_locked_put(struct snd_kcontrol *kcontrol, | 256 | static int da7213_enum_locked_put(struct snd_kcontrol *kcontrol, |
| 257 | struct snd_ctl_elem_value *ucontrol) | 257 | struct snd_ctl_elem_value *ucontrol) |
| 258 | { | 258 | { |
| 259 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 259 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 260 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 260 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 261 | int ret; | 261 | int ret; |
| 262 | 262 | ||
| @@ -420,7 +420,7 @@ static void da7213_alc_calib(struct snd_soc_component *component) · 157 unmodified lines | |||
| 420 | static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol, | 420 | static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol, |
| 421 | struct snd_ctl_elem_value *ucontrol) | 421 | struct snd_ctl_elem_value *ucontrol) |
| 422 | { | 422 | { |
| 423 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 423 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 424 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 424 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 425 | int ret; | 425 | int ret; |
| 426 | 426 | ||
| @@ -436,7 +436,7 @@ static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol, · 9 unmodified lines | |||
| 436 | static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol, | 436 | static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol, |
| 437 | struct snd_ctl_elem_value *ucontrol) | 437 | struct snd_ctl_elem_value *ucontrol) |
| 438 | { | 438 | { |
| 439 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 439 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 440 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 440 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 441 | 441 | ||
| 442 | /* Force ALC offset calibration if enabling ALC */ | 442 | /* Force ALC offset calibration if enabling ALC */ |
| @@ -457,7 +457,7 @@ static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol, · 14 unmodified lines | |||
| 457 | static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol, | 457 | static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol, |
| 458 | struct snd_ctl_elem_value *ucontrol) | 458 | struct snd_ctl_elem_value *ucontrol) |
| 459 | { | 459 | { |
| 460 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 460 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 461 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 461 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 462 | struct soc_mixer_control *mixer_ctrl = | 462 | struct soc_mixer_control *mixer_ctrl = |
| 463 | (struct soc_mixer_control *) kcontrol->private_value; | 463 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -484,7 +484,7 @@ static int da7213_tonegen_freq_get(struct snd_kcontrol *kcontrol, · 20 unmodified lines | |||
| 484 | static int da7213_tonegen_freq_put(struct snd_kcontrol *kcontrol, | 484 | static int da7213_tonegen_freq_put(struct snd_kcontrol *kcontrol, |
| 485 | struct snd_ctl_elem_value *ucontrol) | 485 | struct snd_ctl_elem_value *ucontrol) |
| 486 | { | 486 | { |
| 487 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 487 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 488 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 488 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 489 | struct soc_mixer_control *mixer_ctrl = | 489 | struct soc_mixer_control *mixer_ctrl = |
| 490 | (struct soc_mixer_control *) kcontrol->private_value; | 490 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -1816,6 +1816,7 @@ static int da7213_set_bias_level(struct snd_soc_component *component, · 1325 unmodified lines | |||
| 1816 | enum snd_soc_bias_level level) | 1816 | enum snd_soc_bias_level level) |
| 1817 | { | 1817 | { |
| 1818 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); | 1818 | struct da7213_priv *da7213 = snd_soc_component_get_drvdata(component); |
| 1819 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1819 | int ret; | 1820 | int ret; |
| 1820 | 1821 | ||
| 1821 | switch (level) { | 1822 | switch (level) { |
| @@ -1823,7 +1824,7 @@ static int da7213_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 1823 | break; | 1824 | break; |
| 1824 | case SND_SOC_BIAS_PREPARE: | 1825 | case SND_SOC_BIAS_PREPARE: |
| 1825 | /* Enable MCLK for transition to ON state */ | 1826 | /* Enable MCLK for transition to ON state */ |
| 1826 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { | 1827 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) { |
| 1827 | if (da7213->mclk) { | 1828 | if (da7213->mclk) { |
| 1828 | ret = clk_prepare_enable(da7213->mclk); | 1829 | ret = clk_prepare_enable(da7213->mclk); |
| 1829 | if (ret) { | 1830 | if (ret) { |
| @@ -1837,7 +1838,7 @@ static int da7213_set_bias_level(struct snd_soc_component *component, · 7 unmodified lines | |||
| 1837 | } | 1838 | } |
| 1838 | break; | 1839 | break; |
| 1839 | case SND_SOC_BIAS_STANDBY: | 1840 | case SND_SOC_BIAS_STANDBY: |
| 1840 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1841 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1841 | /* Enable VMID reference & master bias */ | 1842 | /* Enable VMID reference & master bias */ |
| 1842 | snd_soc_component_update_bits(component, DA7213_REFERENCES, | 1843 | snd_soc_component_update_bits(component, DA7213_REFERENCES, |
| 1843 | DA7213_VMID_EN | DA7213_BIAS_EN, | 1844 | DA7213_VMID_EN | DA7213_BIAS_EN, |
| @@ -425,7 +425,7 @@ static void da7218_alc_calib(struct snd_soc_component *component) · 424 unmodified lines | |||
| 425 | static int da7218_mixin_gain_put(struct snd_kcontrol *kcontrol, | 425 | static int da7218_mixin_gain_put(struct snd_kcontrol *kcontrol, |
| 426 | struct snd_ctl_elem_value *ucontrol) | 426 | struct snd_ctl_elem_value *ucontrol) |
| 427 | { | 427 | { |
| 428 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 428 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 429 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 429 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 430 | int ret; | 430 | int ret; |
| 431 | 431 | ||
| @@ -446,7 +446,7 @@ static int da7218_alc_sw_put(struct snd_kcontrol *kcontrol, · 14 unmodified lines | |||
| 446 | { | 446 | { |
| 447 | struct soc_mixer_control *mc = | 447 | struct soc_mixer_control *mc = |
| 448 | (struct soc_mixer_control *) kcontrol->private_value; | 448 | (struct soc_mixer_control *) kcontrol->private_value; |
| 449 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 449 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 450 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 450 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 451 | unsigned int lvalue = ucontrol->value.integer.value[0]; | 451 | unsigned int lvalue = ucontrol->value.integer.value[0]; |
| 452 | unsigned int rvalue = ucontrol->value.integer.value[1]; | 452 | unsigned int rvalue = ucontrol->value.integer.value[1]; |
| @@ -469,7 +469,7 @@ static int da7218_alc_sw_put(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 469 | static int da7218_tonegen_freq_get(struct snd_kcontrol *kcontrol, | 469 | static int da7218_tonegen_freq_get(struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) | 470 | struct snd_ctl_elem_value *ucontrol) |
| 471 | { | 471 | { |
| 472 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 472 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 473 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 473 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 474 | struct soc_mixer_control *mixer_ctrl = | 474 | struct soc_mixer_control *mixer_ctrl = |
| 475 | (struct soc_mixer_control *) kcontrol->private_value; | 475 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -493,7 +493,7 @@ static int da7218_tonegen_freq_get(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 493 | static int da7218_tonegen_freq_put(struct snd_kcontrol *kcontrol, | 493 | static int da7218_tonegen_freq_put(struct snd_kcontrol *kcontrol, |
| 494 | struct snd_ctl_elem_value *ucontrol) | 494 | struct snd_ctl_elem_value *ucontrol) |
| 495 | { | 495 | { |
| 496 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 496 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 497 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 497 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 498 | struct soc_mixer_control *mixer_ctrl = | 498 | struct soc_mixer_control *mixer_ctrl = |
| 499 | (struct soc_mixer_control *) kcontrol->private_value; | 499 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -513,7 +513,7 @@ static int da7218_tonegen_freq_put(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 513 | static int da7218_mic_lvl_det_sw_put(struct snd_kcontrol *kcontrol, | 513 | static int da7218_mic_lvl_det_sw_put(struct snd_kcontrol *kcontrol, |
| 514 | struct snd_ctl_elem_value *ucontrol) | 514 | struct snd_ctl_elem_value *ucontrol) |
| 515 | { | 515 | { |
| 516 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 516 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 517 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 517 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 518 | struct soc_mixer_control *mixer_ctrl = | 518 | struct soc_mixer_control *mixer_ctrl = |
| 519 | (struct soc_mixer_control *) kcontrol->private_value; | 519 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -540,7 +540,7 @@ static int da7218_mic_lvl_det_sw_put(struct snd_kcontrol *kcontrol, · 20 unmodified lines | |||
| 540 | static int da7218_mic_lvl_det_sw_get(struct snd_kcontrol *kcontrol, | 540 | static int da7218_mic_lvl_det_sw_get(struct snd_kcontrol *kcontrol, |
| 541 | struct snd_ctl_elem_value *ucontrol) | 541 | struct snd_ctl_elem_value *ucontrol) |
| 542 | { | 542 | { |
| 543 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 543 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 544 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 544 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 545 | struct soc_mixer_control *mixer_ctrl = | 545 | struct soc_mixer_control *mixer_ctrl = |
| 546 | (struct soc_mixer_control *) kcontrol->private_value; | 546 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -560,7 +560,7 @@ static int da7218_mic_lvl_det_sw_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 560 | static int da7218_biquad_coeff_get(struct snd_kcontrol *kcontrol, | 560 | static int da7218_biquad_coeff_get(struct snd_kcontrol *kcontrol, |
| 561 | struct snd_ctl_elem_value *ucontrol) | 561 | struct snd_ctl_elem_value *ucontrol) |
| 562 | { | 562 | { |
| 563 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 563 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 564 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 564 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 565 | struct soc_bytes_ext *bytes_ext = | 565 | struct soc_bytes_ext *bytes_ext = |
| 566 | (struct soc_bytes_ext *) kcontrol->private_value; | 566 | (struct soc_bytes_ext *) kcontrol->private_value; |
| @@ -585,7 +585,7 @@ static int da7218_biquad_coeff_get(struct snd_kcontrol *kcontrol, · 18 unmodified lines | |||
| 585 | static int da7218_biquad_coeff_put(struct snd_kcontrol *kcontrol, | 585 | static int da7218_biquad_coeff_put(struct snd_kcontrol *kcontrol, |
| 586 | struct snd_ctl_elem_value *ucontrol) | 586 | struct snd_ctl_elem_value *ucontrol) |
| 587 | { | 587 | { |
| 588 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 588 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 589 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 589 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 590 | struct soc_bytes_ext *bytes_ext = | 590 | struct soc_bytes_ext *bytes_ext = |
| 591 | (struct soc_bytes_ext *) kcontrol->private_value; | 591 | (struct soc_bytes_ext *) kcontrol->private_value; |
| @@ -2562,6 +2562,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, · 1970 unmodified lines | |||
| 2562 | enum snd_soc_bias_level level) | 2562 | enum snd_soc_bias_level level) |
| 2563 | { | 2563 | { |
| 2564 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); | 2564 | struct da7218_priv *da7218 = snd_soc_component_get_drvdata(component); |
| 2565 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2565 | int ret; | 2566 | int ret; |
| 2566 | 2567 | ||
| 2567 | switch (level) { | 2568 | switch (level) { |
| @@ -2569,7 +2570,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 2569 | break; | 2570 | break; |
| 2570 | case SND_SOC_BIAS_PREPARE: | 2571 | case SND_SOC_BIAS_PREPARE: |
| 2571 | /* Enable MCLK for transition to ON state */ | 2572 | /* Enable MCLK for transition to ON state */ |
| 2572 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { | 2573 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) { |
| 2573 | if (da7218->mclk) { | 2574 | if (da7218->mclk) { |
| 2574 | ret = clk_prepare_enable(da7218->mclk); | 2575 | ret = clk_prepare_enable(da7218->mclk); |
| 2575 | if (ret) { | 2576 | if (ret) { |
| @@ -2581,7 +2582,7 @@ static int da7218_set_bias_level(struct snd_soc_component *component, · 5 unmodified lines | |||
| 2581 | 2582 | ||
| 2582 | break; | 2583 | break; |
| 2583 | case SND_SOC_BIAS_STANDBY: | 2584 | case SND_SOC_BIAS_STANDBY: |
| 2584 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 2585 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 2585 | /* Master bias */ | 2586 | /* Master bias */ |
| 2586 | snd_soc_component_update_bits(component, DA7218_REFERENCES, | 2587 | snd_soc_component_update_bits(component, DA7218_REFERENCES, |
| 2587 | DA7218_BIAS_EN_MASK, | 2588 | DA7218_BIAS_EN_MASK, |
| @@ -53,7 +53,7 @@ static void da7219_aad_btn_det_work(struct work_struct *work) · 52 unmodified lines | |||
| 53 | struct da7219_aad_priv *da7219_aad = | 53 | struct da7219_aad_priv *da7219_aad = |
| 54 | container_of(work, struct da7219_aad_priv, btn_det_work); | 54 | container_of(work, struct da7219_aad_priv, btn_det_work); |
| 55 | struct snd_soc_component *component = da7219_aad->component; | 55 | struct snd_soc_component *component = da7219_aad->component; |
| 56 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 56 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 57 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 57 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 58 | u8 statusa, micbias_ctrl; | 58 | u8 statusa, micbias_ctrl; |
| 59 | bool micbias_up = false; | 59 | bool micbias_up = false; |
| @@ -109,7 +109,7 @@ static void da7219_aad_hptest_work(struct work_struct *work) · 49 unmodified lines | |||
| 109 | struct da7219_aad_priv *da7219_aad = | 109 | struct da7219_aad_priv *da7219_aad = |
| 110 | container_of(work, struct da7219_aad_priv, hptest_work); | 110 | container_of(work, struct da7219_aad_priv, hptest_work); |
| 111 | struct snd_soc_component *component = da7219_aad->component; | 111 | struct snd_soc_component *component = da7219_aad->component; |
| 112 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 112 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 113 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 113 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 114 | 114 | ||
| 115 | __le16 tonegen_freq_hptest; | 115 | __le16 tonegen_freq_hptest; |
| @@ -351,7 +351,7 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data) · 235 unmodified lines | |||
| 351 | { | 351 | { |
| 352 | struct da7219_aad_priv *da7219_aad = data; | 352 | struct da7219_aad_priv *da7219_aad = data; |
| 353 | struct snd_soc_component *component = da7219_aad->component; | 353 | struct snd_soc_component *component = da7219_aad->component; |
| 354 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 354 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 355 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 355 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 356 | u8 events[DA7219_AAD_IRQ_REG_MAX]; | 356 | u8 events[DA7219_AAD_IRQ_REG_MAX]; |
| 357 | u8 statusa; | 357 | u8 statusa; |
| @@ -928,7 +928,7 @@ void da7219_aad_suspend(struct snd_soc_component *component) · 570 unmodified lines | |||
| 928 | { | 928 | { |
| 929 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 929 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 930 | struct da7219_aad_priv *da7219_aad = da7219->aad; | 930 | struct da7219_aad_priv *da7219_aad = da7219->aad; |
| 931 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 931 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 932 | u8 micbias_ctrl; | 932 | u8 micbias_ctrl; |
| 933 | 933 | ||
| 934 | disable_irq(da7219_aad->irq); | 934 | disable_irq(da7219_aad->irq); |
| @@ -962,7 +962,7 @@ void da7219_aad_resume(struct snd_soc_component *component) · 27 unmodified lines | |||
| 962 | { | 962 | { |
| 963 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 963 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 964 | struct da7219_aad_priv *da7219_aad = da7219->aad; | 964 | struct da7219_aad_priv *da7219_aad = da7219->aad; |
| 965 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 965 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 966 | 966 | ||
| 967 | if (da7219_aad->jack) { | 967 | if (da7219_aad->jack) { |
| 968 | /* Re-enable micbias if previously enabled for 4-pole jack */ | 968 | /* Re-enable micbias if previously enabled for 4-pole jack */ |
| @@ -254,7 +254,7 @@ static const struct soc_enum da7219_cp_track_mode = · 253 unmodified lines | |||
| 254 | static int da7219_volsw_locked_get(struct snd_kcontrol *kcontrol, | 254 | static int da7219_volsw_locked_get(struct snd_kcontrol *kcontrol, |
| 255 | struct snd_ctl_elem_value *ucontrol) | 255 | struct snd_ctl_elem_value *ucontrol) |
| 256 | { | 256 | { |
| 257 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 257 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 258 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 258 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 259 | int ret; | 259 | int ret; |
| 260 | 260 | ||
| @@ -268,7 +268,7 @@ static int da7219_volsw_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 268 | static int da7219_volsw_locked_put(struct snd_kcontrol *kcontrol, | 268 | static int da7219_volsw_locked_put(struct snd_kcontrol *kcontrol, |
| 269 | struct snd_ctl_elem_value *ucontrol) | 269 | struct snd_ctl_elem_value *ucontrol) |
| 270 | { | 270 | { |
| 271 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 271 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 272 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 272 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 273 | int ret; | 273 | int ret; |
| 274 | 274 | ||
| @@ -282,7 +282,7 @@ static int da7219_volsw_locked_put(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 282 | static int da7219_enum_locked_get(struct snd_kcontrol *kcontrol, | 282 | static int da7219_enum_locked_get(struct snd_kcontrol *kcontrol, |
| 283 | struct snd_ctl_elem_value *ucontrol) | 283 | struct snd_ctl_elem_value *ucontrol) |
| 284 | { | 284 | { |
| 285 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 285 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 286 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 286 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 287 | int ret; | 287 | int ret; |
| 288 | 288 | ||
| @@ -296,7 +296,7 @@ static int da7219_enum_locked_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 296 | static int da7219_enum_locked_put(struct snd_kcontrol *kcontrol, | 296 | static int da7219_enum_locked_put(struct snd_kcontrol *kcontrol, |
| 297 | struct snd_ctl_elem_value *ucontrol) | 297 | struct snd_ctl_elem_value *ucontrol) |
| 298 | { | 298 | { |
| 299 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 299 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 300 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 300 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 301 | int ret; | 301 | int ret; |
| 302 | 302 | ||
| @@ -376,7 +376,7 @@ static void da7219_alc_calib(struct snd_soc_component *component) · 73 unmodified lines | |||
| 376 | static int da7219_mixin_gain_put(struct snd_kcontrol *kcontrol, | 376 | static int da7219_mixin_gain_put(struct snd_kcontrol *kcontrol, |
| 377 | struct snd_ctl_elem_value *ucontrol) | 377 | struct snd_ctl_elem_value *ucontrol) |
| 378 | { | 378 | { |
| 379 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 379 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 380 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 380 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 381 | int ret; | 381 | int ret; |
| 382 | 382 | ||
| @@ -395,7 +395,7 @@ static int da7219_mixin_gain_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines | |||
| 395 | static int da7219_alc_sw_put(struct snd_kcontrol *kcontrol, | 395 | static int da7219_alc_sw_put(struct snd_kcontrol *kcontrol, |
| 396 | struct snd_ctl_elem_value *ucontrol) | 396 | struct snd_ctl_elem_value *ucontrol) |
| 397 | { | 397 | { |
| 398 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 398 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 399 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 399 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 400 | 400 | ||
| 401 | 401 | ||
| @@ -414,7 +414,7 @@ static int da7219_alc_sw_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines | |||
| 414 | static int da7219_tonegen_freq_get(struct snd_kcontrol *kcontrol, | 414 | static int da7219_tonegen_freq_get(struct snd_kcontrol *kcontrol, |
| 415 | struct snd_ctl_elem_value *ucontrol) | 415 | struct snd_ctl_elem_value *ucontrol) |
| 416 | { | 416 | { |
| 417 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 417 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 418 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 418 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 419 | struct soc_mixer_control *mixer_ctrl = | 419 | struct soc_mixer_control *mixer_ctrl = |
| 420 | (struct soc_mixer_control *) kcontrol->private_value; | 420 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -441,7 +441,7 @@ static int da7219_tonegen_freq_get(struct snd_kcontrol *kcontrol, · 20 unmodified lines | |||
| 441 | static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol, | 441 | static int da7219_tonegen_freq_put(struct snd_kcontrol *kcontrol, |
| 442 | struct snd_ctl_elem_value *ucontrol) | 442 | struct snd_ctl_elem_value *ucontrol) |
| 443 | { | 443 | { |
| 444 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 444 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 445 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 445 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 446 | struct soc_mixer_control *mixer_ctrl = | 446 | struct soc_mixer_control *mixer_ctrl = |
| 447 | (struct soc_mixer_control *) kcontrol->private_value; | 447 | (struct soc_mixer_control *) kcontrol->private_value; |
| @@ -1807,6 +1807,7 @@ static int da7219_set_bias_level(struct snd_soc_component *component, · 1359 unmodified lines | |||
| 1807 | enum snd_soc_bias_level level) | 1807 | enum snd_soc_bias_level level) |
| 1808 | { | 1808 | { |
| 1809 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 1809 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 1810 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1810 | int ret; | 1811 | int ret; |
| 1811 | 1812 | ||
| 1812 | switch (level) { | 1813 | switch (level) { |
| @@ -1814,7 +1815,7 @@ static int da7219_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 1814 | break; | 1815 | break; |
| 1815 | case SND_SOC_BIAS_PREPARE: | 1816 | case SND_SOC_BIAS_PREPARE: |
| 1816 | /* Enable MCLK for transition to ON state */ | 1817 | /* Enable MCLK for transition to ON state */ |
| 1817 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_STANDBY) { | 1818 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) { |
| 1818 | if (da7219->mclk) { | 1819 | if (da7219->mclk) { |
| 1819 | ret = clk_prepare_enable(da7219->mclk); | 1820 | ret = clk_prepare_enable(da7219->mclk); |
| 1820 | if (ret) { | 1821 | if (ret) { |
| @@ -1827,13 +1828,13 @@ static int da7219_set_bias_level(struct snd_soc_component *component, · 6 unmodified lines | |||
| 1827 | 1828 | ||
| 1828 | break; | 1829 | break; |
| 1829 | case SND_SOC_BIAS_STANDBY: | 1830 | case SND_SOC_BIAS_STANDBY: |
| 1830 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 1831 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 1831 | /* Master bias */ | 1832 | /* Master bias */ |
| 1832 | snd_soc_component_update_bits(component, DA7219_REFERENCES, | 1833 | snd_soc_component_update_bits(component, DA7219_REFERENCES, |
| 1833 | DA7219_BIAS_EN_MASK, | 1834 | DA7219_BIAS_EN_MASK, |
| 1834 | DA7219_BIAS_EN_MASK); | 1835 | DA7219_BIAS_EN_MASK); |
| 1835 | 1836 | ||
| 1836 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_PREPARE) { | 1837 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_PREPARE) { |
| 1837 | /* Remove MCLK */ | 1838 | /* Remove MCLK */ |
| 1838 | if (da7219->mclk) | 1839 | if (da7219->mclk) |
| 1839 | clk_disable_unprepare(da7219->mclk); | 1840 | clk_disable_unprepare(da7219->mclk); |
| @@ -2613,12 +2614,13 @@ static void da7219_remove(struct snd_soc_component *component) · 773 unmodified lines | |||
| 2613 | static int da7219_suspend(struct snd_soc_component *component) | 2614 | static int da7219_suspend(struct snd_soc_component *component) |
| 2614 | { | 2615 | { |
| 2615 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 2616 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 2617 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2616 | 2618 | ||
| 2617 | /* Suspend AAD if we're not a wake-up source */ | 2619 | /* Suspend AAD if we're not a wake-up source */ |
| 2618 | if (!da7219->wakeup_source) | 2620 | if (!da7219->wakeup_source) |
| 2619 | da7219_aad_suspend(component); | 2621 | da7219_aad_suspend(component); |
| 2620 | 2622 | ||
| 2621 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 2623 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 2622 | 2624 | ||
| 2623 | return 0; | 2625 | return 0; |
| 2624 | } | 2626 | } |
| @@ -2626,8 +2628,9 @@ static int da7219_suspend(struct snd_soc_component *component) · 1 unmodified line | |||
| 2626 | static int da7219_resume(struct snd_soc_component *component) | 2628 | static int da7219_resume(struct snd_soc_component *component) |
| 2627 | { | 2629 | { |
| 2628 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); | 2630 | struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component); |
| 2631 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2629 | 2632 | ||
| 2630 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); | 2633 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY); |
| 2631 | 2634 | ||
| 2632 | /* Resume AAD if previously suspended */ | 2635 | /* Resume AAD if previously suspended */ |
| 2633 | if (!da7219->wakeup_source) | 2636 | if (!da7219->wakeup_source) |
| @@ -323,7 +323,7 @@ static SOC_ENUM_SINGLE_DECL(da732x_adc2_voice_filter_enum, · 322 unmodified lines | |||
| 323 | static int da732x_hpf_set(struct snd_kcontrol *kcontrol, | 323 | static int da732x_hpf_set(struct snd_kcontrol *kcontrol, |
| 324 | struct snd_ctl_elem_value *ucontrol) | 324 | struct snd_ctl_elem_value *ucontrol) |
| 325 | { | 325 | { |
| 326 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 326 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 327 | struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value; | 327 | struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value; |
| 328 | unsigned int reg = enum_ctrl->reg; | 328 | unsigned int reg = enum_ctrl->reg; |
| 329 | unsigned int sel = ucontrol->value.enumerated.item[0]; | 329 | unsigned int sel = ucontrol->value.enumerated.item[0]; |
| @@ -351,7 +351,7 @@ static int da732x_hpf_set(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 351 | static int da732x_hpf_get(struct snd_kcontrol *kcontrol, | 351 | static int da732x_hpf_get(struct snd_kcontrol *kcontrol, |
| 352 | struct snd_ctl_elem_value *ucontrol) | 352 | struct snd_ctl_elem_value *ucontrol) |
| 353 | { | 353 | { |
| 354 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 354 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 355 | struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value; | 355 | struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value; |
| 356 | unsigned int reg = enum_ctrl->reg; | 356 | unsigned int reg = enum_ctrl->reg; |
| 357 | int val; | 357 | int val; |
| @@ -1408,6 +1408,7 @@ static int da732x_set_bias_level(struct snd_soc_component *component, · 1050 unmodified lines | |||
| 1408 | enum snd_soc_bias_level level) | 1408 | enum snd_soc_bias_level level) |
| 1409 | { | 1409 | { |
| 1410 | struct da732x_priv *da732x = snd_soc_component_get_drvdata(component); | 1410 | struct da732x_priv *da732x = snd_soc_component_get_drvdata(component); |
| 1411 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1411 | 1412 | ||
| 1412 | switch (level) { | 1413 | switch (level) { |
| 1413 | case SND_SOC_BIAS_ON: | 1414 | case SND_SOC_BIAS_ON: |
| @@ -1418,7 +1419,7 @@ static int da732x_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines | |||
| 1418 | case SND_SOC_BIAS_PREPARE: | 1419 | case SND_SOC_BIAS_PREPARE: |
| 1419 | break; | 1420 | break; |
| 1420 | case SND_SOC_BIAS_STANDBY: | 1421 | case SND_SOC_BIAS_STANDBY: |
| 1421 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1422 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1422 | /* Init Codec */ | 1423 | /* Init Codec */ |
| 1423 | snd_soc_component_write(component, DA732X_REG_REF1, | 1424 | snd_soc_component_write(component, DA732X_REG_REF1, |
| 1424 | DA732X_VMID_FASTCHG); | 1425 | DA732X_VMID_FASTCHG); |
| @@ -476,7 +476,7 @@ static int da9055_get_alc_data(struct snd_soc_component *component, u8 reg_val) · 475 unmodified lines | |||
| 476 | static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol, | 476 | static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol, |
| 477 | struct snd_ctl_elem_value *ucontrol) | 477 | struct snd_ctl_elem_value *ucontrol) |
| 478 | { | 478 | { |
| 479 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 479 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 480 | u8 reg_val, adc_left, adc_right, mic_left, mic_right; | 480 | u8 reg_val, adc_left, adc_right, mic_left, mic_right; |
| 481 | int avg_left_data, avg_right_data, offset_l, offset_r; | 481 | int avg_left_data, avg_right_data, offset_l, offset_r; |
| 482 | 482 | ||
| @@ -1352,12 +1352,14 @@ static struct snd_soc_dai_driver da9055_dai = { · 869 unmodified lines | |||
| 1352 | static int da9055_set_bias_level(struct snd_soc_component *component, | 1352 | static int da9055_set_bias_level(struct snd_soc_component *component, |
| 1353 | enum snd_soc_bias_level level) | 1353 | enum snd_soc_bias_level level) |
| 1354 | { | 1354 | { |
| 1355 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1356 | |||
| 1355 | switch (level) { | 1357 | switch (level) { |
| 1356 | case SND_SOC_BIAS_ON: | 1358 | case SND_SOC_BIAS_ON: |
| 1357 | case SND_SOC_BIAS_PREPARE: | 1359 | case SND_SOC_BIAS_PREPARE: |
| 1358 | break; | 1360 | break; |
| 1359 | case SND_SOC_BIAS_STANDBY: | 1361 | case SND_SOC_BIAS_STANDBY: |
| 1360 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1362 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1361 | /* Enable VMID reference & master bias */ | 1363 | /* Enable VMID reference & master bias */ |
| 1362 | snd_soc_component_update_bits(component, DA9055_REFERENCES, | 1364 | snd_soc_component_update_bits(component, DA9055_REFERENCES, |
| 1363 | DA9055_VMID_EN | DA9055_BIAS_EN, | 1365 | DA9055_VMID_EN | DA9055_BIAS_EN, |
| @@ -104,7 +104,7 @@ static int es7134_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 103 unmodified lines | |||
| 104 | 104 | ||
| 105 | static int es7134_component_probe(struct snd_soc_component *c) | 105 | static int es7134_component_probe(struct snd_soc_component *c) |
| 106 | { | 106 | { |
| 107 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(c); | 107 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(c); |
| 108 | struct es7134_data *priv = snd_soc_component_get_drvdata(c); | 108 | struct es7134_data *priv = snd_soc_component_get_drvdata(c); |
| 109 | const struct es7134_chip *chip = priv->chip; | 109 | const struct es7134_chip *chip = priv->chip; |
| 110 | int ret; | 110 | int ret; |
| @@ -760,6 +760,7 @@ static int es8311_set_bias_level(struct snd_soc_component *component, · 759 unmodified lines | |||
| 760 | enum snd_soc_bias_level level) | 760 | enum snd_soc_bias_level level) |
| 761 | { | 761 | { |
| 762 | struct es8311_priv *es8311 = snd_soc_component_get_drvdata(component); | 762 | struct es8311_priv *es8311 = snd_soc_component_get_drvdata(component); |
| 763 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 763 | 764 | ||
| 764 | switch (level) { | 765 | switch (level) { |
| 765 | case SND_SOC_BIAS_ON: | 766 | case SND_SOC_BIAS_ON: |
| @@ -767,7 +768,7 @@ static int es8311_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 767 | case SND_SOC_BIAS_PREPARE: | 768 | case SND_SOC_BIAS_PREPARE: |
| 768 | break; | 769 | break; |
| 769 | case SND_SOC_BIAS_STANDBY: | 770 | case SND_SOC_BIAS_STANDBY: |
| 770 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 771 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 771 | int ret = clk_prepare_enable(es8311->mclk); | 772 | int ret = clk_prepare_enable(es8311->mclk); |
| 772 | if (ret) { | 773 | if (ret) { |
| 773 | dev_err(component->dev, | 774 | dev_err(component->dev, |
| @@ -590,7 +590,7 @@ static struct snd_soc_dai_driver es8316_dai = { · 589 unmodified lines | |||
| 590 | static void es8316_enable_micbias_for_mic_gnd_short_detect( | 590 | static void es8316_enable_micbias_for_mic_gnd_short_detect( |
| 591 | struct snd_soc_component *component) | 591 | struct snd_soc_component *component) |
| 592 | { | 592 | { |
| 593 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 593 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 594 | 594 | ||
| 595 | snd_soc_dapm_mutex_lock(dapm); | 595 | snd_soc_dapm_mutex_lock(dapm); |
| 596 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "Bias"); | 596 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "Bias"); |
| @@ -605,7 +605,7 @@ static void es8316_enable_micbias_for_mic_gnd_short_detect( · 8 unmodified lines | |||
| 605 | static void es8316_disable_micbias_for_mic_gnd_short_detect( | 605 | static void es8316_disable_micbias_for_mic_gnd_short_detect( |
| 606 | struct snd_soc_component *component) | 606 | struct snd_soc_component *component) |
| 607 | { | 607 | { |
| 608 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 608 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 609 | 609 | ||
| 610 | snd_soc_dapm_mutex_lock(dapm); | 610 | snd_soc_dapm_mutex_lock(dapm); |
| 611 | snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Bias"); | 611 | snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Bias"); |
| @@ -737,7 +737,7 @@ static struct snd_soc_dai_driver es8326_dai = { · 736 unmodified lines | |||
| 737 | 737 | ||
| 738 | static void es8326_enable_micbias(struct snd_soc_component *component) | 738 | static void es8326_enable_micbias(struct snd_soc_component *component) |
| 739 | { | 739 | { |
| 740 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 740 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 741 | 741 | ||
| 742 | snd_soc_dapm_mutex_lock(dapm); | 742 | snd_soc_dapm_mutex_lock(dapm); |
| 743 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "MICBIAS1"); | 743 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "MICBIAS1"); |
| @@ -748,7 +748,7 @@ static void es8326_enable_micbias(struct snd_soc_component *component) · 4 unmodified lines | |||
| 748 | 748 | ||
| 749 | static void es8326_disable_micbias(struct snd_soc_component *component) | 749 | static void es8326_disable_micbias(struct snd_soc_component *component) |
| 750 | { | 750 | { |
| 751 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 751 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 752 | 752 | ||
| 753 | snd_soc_dapm_mutex_lock(dapm); | 753 | snd_soc_dapm_mutex_lock(dapm); |
| 754 | snd_soc_dapm_disable_pin_unlocked(dapm, "MICBIAS1"); | 754 | snd_soc_dapm_disable_pin_unlocked(dapm, "MICBIAS1"); |
| @@ -812,12 +812,12 @@ static void es8326_jack_button_handler(struct work_struct *work) · 57 unmodified lines | |||
| 812 | press_count = 0; | 812 | press_count = 0; |
| 813 | } | 813 | } |
| 814 | button_to_report = cur_button; | 814 | button_to_report = cur_button; |
| 815 | queue_delayed_work(system_wq, &es8326->button_press_work, | 815 | queue_delayed_work(system_dfl_wq, &es8326->button_press_work, |
| 816 | msecs_to_jiffies(35)); | 816 | msecs_to_jiffies(35)); |
| 817 | } else if (prev_button != cur_button) { | 817 | } else if (prev_button != cur_button) { |
| 818 | /* mismatch, detect again */ | 818 | /* mismatch, detect again */ |
| 819 | prev_button = cur_button; | 819 | prev_button = cur_button; |
| 820 | queue_delayed_work(system_wq, &es8326->button_press_work, | 820 | queue_delayed_work(system_dfl_wq, &es8326->button_press_work, |
| 821 | msecs_to_jiffies(35)); | 821 | msecs_to_jiffies(35)); |
| 822 | } else { | 822 | } else { |
| 823 | /* released or no pressed */ | 823 | /* released or no pressed */ |
| @@ -912,7 +912,7 @@ static void es8326_jack_detect_handler(struct work_struct *work) · 88 unmodified lines | |||
| 912 | (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON)); | 912 | (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON)); |
| 913 | regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f); | 913 | regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f); |
| 914 | regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x0d); | 914 | regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x0d); |
| 915 | queue_delayed_work(system_wq, &es8326->jack_detect_work, | 915 | queue_delayed_work(system_dfl_wq, &es8326->jack_detect_work, |
| 916 | msecs_to_jiffies(400)); | 916 | msecs_to_jiffies(400)); |
| 917 | es8326->hp = 1; | 917 | es8326->hp = 1; |
| 918 | goto exit; | 918 | goto exit; |
| @@ -923,7 +923,7 @@ static void es8326_jack_detect_handler(struct work_struct *work) · 4 unmodified lines | |||
| 923 | regmap_write(es8326->regmap, ES8326_INT_SOURCE, | 923 | regmap_write(es8326->regmap, ES8326_INT_SOURCE, |
| 924 | (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON)); | 924 | (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON)); |
| 925 | es8326_enable_micbias(es8326->component); | 925 | es8326_enable_micbias(es8326->component); |
| 926 | queue_delayed_work(system_wq, &es8326->button_press_work, 10); | 926 | queue_delayed_work(system_dfl_wq, &es8326->button_press_work, 10); |
| 927 | goto exit; | 927 | goto exit; |
| 928 | } | 928 | } |
| 929 | if ((iface & ES8326_HPBUTTON_FLAG) == 0x01) { | 929 | if ((iface & ES8326_HPBUTTON_FLAG) == 0x01) { |
| @@ -958,10 +958,10 @@ static irqreturn_t es8326_irq(int irq, void *dev_id) · 28 unmodified lines | |||
| 958 | goto out; | 958 | goto out; |
| 959 | 959 | ||
| 960 | if (es8326->jack->status & SND_JACK_HEADSET) | 960 | if (es8326->jack->status & SND_JACK_HEADSET) |
| 961 | queue_delayed_work(system_wq, &es8326->jack_detect_work, | 961 | queue_delayed_work(system_dfl_wq, &es8326->jack_detect_work, |
| 962 | msecs_to_jiffies(10)); | 962 | msecs_to_jiffies(10)); |
| 963 | else | 963 | else |
| 964 | queue_delayed_work(system_wq, &es8326->jack_detect_work, | 964 | queue_delayed_work(system_dfl_wq, &es8326->jack_detect_work, |
| 965 | msecs_to_jiffies(300)); | 965 | msecs_to_jiffies(300)); |
| 966 | 966 | ||
| 967 | out: | 967 | out: |
| @@ -142,7 +142,7 @@ static int es8328_set_deemph(struct snd_soc_component *component) · 141 unmodified lines | |||
| 142 | static int es8328_get_deemph(struct snd_kcontrol *kcontrol, | 142 | static int es8328_get_deemph(struct snd_kcontrol *kcontrol, |
| 143 | struct snd_ctl_elem_value *ucontrol) | 143 | struct snd_ctl_elem_value *ucontrol) |
| 144 | { | 144 | { |
| 145 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 145 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 146 | struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component); | 146 | struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component); |
| 147 | 147 | ||
| 148 | ucontrol->value.integer.value[0] = es8328->deemph; | 148 | ucontrol->value.integer.value[0] = es8328->deemph; |
| @@ -152,7 +152,7 @@ static int es8328_get_deemph(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 152 | static int es8328_put_deemph(struct snd_kcontrol *kcontrol, | 152 | static int es8328_put_deemph(struct snd_kcontrol *kcontrol, |
| 153 | struct snd_ctl_elem_value *ucontrol) | 153 | struct snd_ctl_elem_value *ucontrol) |
| 154 | { | 154 | { |
| 155 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 155 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 156 | struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component); | 156 | struct es8328_priv *es8328 = snd_soc_component_get_drvdata(component); |
| 157 | unsigned int deemph = ucontrol->value.integer.value[0]; | 157 | unsigned int deemph = ucontrol->value.integer.value[0]; |
| 158 | int ret; | 158 | int ret; |
| @@ -643,6 +643,8 @@ static int es8328_set_dai_fmt(struct snd_soc_dai *codec_dai, · 484 unmodified lines | |||
| 643 | static int es8328_set_bias_level(struct snd_soc_component *component, | 643 | static int es8328_set_bias_level(struct snd_soc_component *component, |
| 644 | enum snd_soc_bias_level level) | 644 | enum snd_soc_bias_level level) |
| 645 | { | 645 | { |
| 646 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 647 | |||
| 646 | switch (level) { | 648 | switch (level) { |
| 647 | case SND_SOC_BIAS_ON: | 649 | case SND_SOC_BIAS_ON: |
| 648 | break; | 650 | break; |
| @@ -658,7 +660,7 @@ static int es8328_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines | |||
| 658 | break; | 660 | break; |
| 659 | 661 | ||
| 660 | case SND_SOC_BIAS_STANDBY: | 662 | case SND_SOC_BIAS_STANDBY: |
| 661 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 663 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 662 | snd_soc_component_update_bits(component, ES8328_CONTROL1, | 664 | snd_soc_component_update_bits(component, ES8328_CONTROL1, |
| 663 | ES8328_CONTROL1_VMIDSEL_MASK | | 665 | ES8328_CONTROL1_VMIDSEL_MASK | |
| 664 | ES8328_CONTROL1_ENREF, | 666 | ES8328_CONTROL1_ENREF, |
| @@ -57,8 +57,8 @@ static const DECLARE_TLV_DB_SCALE(alc_max_level, -3200, 200, 0); · 56 unmodified lines | |||
| 57 | static int es8389_dmic_set(struct snd_kcontrol *kcontrol, | 57 | static int es8389_dmic_set(struct snd_kcontrol *kcontrol, |
| 58 | struct snd_ctl_elem_value *ucontrol) | 58 | struct snd_ctl_elem_value *ucontrol) |
| 59 | { | 59 | { |
| 60 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 60 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 61 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | 61 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 62 | struct es8389_private *es8389 = snd_soc_component_get_drvdata(component); | 62 | struct es8389_private *es8389 = snd_soc_component_get_drvdata(component); |
| 63 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 63 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 64 | unsigned int val; | 64 | unsigned int val; |
| @@ -924,7 +924,7 @@ static int fs210x_get_drvdata_from_kctrl(struct snd_kcontrol *kctrl, · 923 unmodified lines | |||
| 924 | return -EINVAL; | 924 | return -EINVAL; |
| 925 | } | 925 | } |
| 926 | 926 | ||
| 927 | cmpnt = snd_soc_kcontrol_component(kctrl); | 927 | cmpnt = snd_kcontrol_chip(kctrl); |
| 928 | if (!cmpnt) { | 928 | if (!cmpnt) { |
| 929 | pr_err("fs210x: component is null\n"); | 929 | pr_err("fs210x: component is null\n"); |
| 930 | return -EINVAL; | 930 | return -EINVAL; |
| @@ -96,7 +96,7 @@ static int hda_codec_register_dais(struct hda_codec *codec, struct snd_soc_compo · 95 unmodified lines | |||
| 96 | if (ret < 0) | 96 | if (ret < 0) |
| 97 | return ret; | 97 | return ret; |
| 98 | 98 | ||
| 99 | dapm = snd_soc_component_get_dapm(component); | 99 | dapm = snd_soc_component_to_dapm(component); |
| 100 | 100 | ||
| 101 | list_for_each_entry(pcm, &codec->pcm_list_head, list) { | 101 | list_for_each_entry(pcm, &codec->pcm_list_head, list) { |
| 102 | struct snd_soc_dai *dai; | 102 | struct snd_soc_dai *dai; |
| @@ -405,8 +405,6 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) · 404 unmodified lines | |||
| 405 | { | 405 | { |
| 406 | struct hdac_hda_priv *hda_pvt = | 406 | struct hdac_hda_priv *hda_pvt = |
| 407 | snd_soc_component_get_drvdata(component); | 407 | snd_soc_component_get_drvdata(component); |
| 408 | struct snd_soc_dapm_context *dapm = | ||
| 409 | snd_soc_component_get_dapm(component); | ||
| 410 | struct hdac_device *hdev = &hda_pvt->codec->core; | 408 | struct hdac_device *hdev = &hda_pvt->codec->core; |
| 411 | struct hda_codec *hcodec = hda_pvt->codec; | 409 | struct hda_codec *hcodec = hda_pvt->codec; |
| 412 | struct hda_codec_driver *driver = hda_codec_to_driver(hcodec); | 410 | struct hda_codec_driver *driver = hda_codec_to_driver(hcodec); |
| @@ -470,7 +468,7 @@ static int hdac_hda_codec_probe(struct snd_soc_component *component) · 57 unmodified lines | |||
| 470 | */ | 468 | */ |
| 471 | pm_runtime_get_noresume(&hdev->dev); | 469 | pm_runtime_get_noresume(&hdev->dev); |
| 472 | 470 | ||
| 473 | hcodec->bus->card = dapm->card->snd_card; | 471 | hcodec->bus->card = component->card->snd_card; |
| 474 | 472 | ||
| 475 | ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name); | 473 | ret = snd_hda_codec_set_name(hcodec, hcodec->preset->name); |
| 476 | if (ret < 0) { | 474 | if (ret < 0) { |
| @@ -769,7 +769,8 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w, · 768 unmodified lines | |||
| 769 | struct snd_kcontrol *kc, int event) | 769 | struct snd_kcontrol *kc, int event) |
| 770 | { | 770 | { |
| 771 | struct hdac_hdmi_port *port = w->priv; | 771 | struct hdac_hdmi_port *port = w->priv; |
| 772 | struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev); | 772 | struct device *dev = snd_soc_dapm_to_dev(w->dapm); |
| 773 | struct hdac_device *hdev = dev_to_hdac_dev(dev); | ||
| 773 | struct hdac_hdmi_pcm *pcm; | 774 | struct hdac_hdmi_pcm *pcm; |
| 774 | 775 | ||
| 775 | dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", | 776 | dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", |
| @@ -814,7 +815,8 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w, · 38 unmodified lines | |||
| 814 | struct snd_kcontrol *kc, int event) | 815 | struct snd_kcontrol *kc, int event) |
| 815 | { | 816 | { |
| 816 | struct hdac_hdmi_cvt *cvt = w->priv; | 817 | struct hdac_hdmi_cvt *cvt = w->priv; |
| 817 | struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev); | 818 | struct device *dev = snd_soc_dapm_to_dev(w->dapm); |
| 819 | struct hdac_device *hdev = dev_to_hdac_dev(dev); | ||
| 818 | struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); | 820 | struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); |
| 819 | struct hdac_hdmi_pcm *pcm; | 821 | struct hdac_hdmi_pcm *pcm; |
| 820 | 822 | ||
| @@ -869,7 +871,8 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w, · 48 unmodified lines | |||
| 869 | struct snd_kcontrol *kc, int event) | 871 | struct snd_kcontrol *kc, int event) |
| 870 | { | 872 | { |
| 871 | struct hdac_hdmi_port *port = w->priv; | 873 | struct hdac_hdmi_port *port = w->priv; |
| 872 | struct hdac_device *hdev = dev_to_hdac_dev(w->dapm->dev); | 874 | struct device *dev = snd_soc_dapm_to_dev(w->dapm); |
| 875 | struct hdac_device *hdev = dev_to_hdac_dev(dev); | ||
| 873 | int mux_idx; | 876 | int mux_idx; |
| 874 | 877 | ||
| 875 | dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", | 878 | dev_dbg(&hdev->dev, "%s: widget: %s event: %x\n", |
| @@ -878,7 +881,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w, · 2 unmodified lines | |||
| 878 | if (!kc) | 881 | if (!kc) |
| 879 | kc = w->kcontrols[0]; | 882 | kc = w->kcontrols[0]; |
| 880 | 883 | ||
| 881 | mux_idx = dapm_kcontrol_get_value(kc); | 884 | mux_idx = snd_soc_dapm_kcontrol_get_value(kc); |
| 882 | 885 | ||
| 883 | /* set the device if pin is mst_capable */ | 886 | /* set the device if pin is mst_capable */ |
| 884 | if (hdac_hdmi_port_select_set(hdev, port) < 0) | 887 | if (hdac_hdmi_port_select_set(hdev, port) < 0) |
| @@ -901,10 +904,11 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 901 | int ret; | 904 | int ret; |
| 902 | struct hdac_hdmi_port *p, *p_next; | 905 | struct hdac_hdmi_port *p, *p_next; |
| 903 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 906 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 904 | struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kcontrol); | 907 | struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 905 | struct snd_soc_dapm_context *dapm = w->dapm; | 908 | struct snd_soc_dapm_context *dapm = w->dapm; |
| 909 | struct device *dev = snd_soc_dapm_to_dev(dapm); | ||
| 906 | struct hdac_hdmi_port *port = w->priv; | 910 | struct hdac_hdmi_port *port = w->priv; |
| 907 | struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev); | 911 | struct hdac_device *hdev = dev_to_hdac_dev(dev); |
| 908 | struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); | 912 | struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); |
| 909 | struct hdac_hdmi_pcm *pcm; | 913 | struct hdac_hdmi_pcm *pcm; |
| 910 | const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; | 914 | const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; |
| @@ -1070,9 +1074,11 @@ static void hdac_hdmi_add_pinmux_cvt_route(struct hdac_device *hdev, · 159 unmodified lines | |||
| 1070 | */ | 1074 | */ |
| 1071 | static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) | 1075 | static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) |
| 1072 | { | 1076 | { |
| 1077 | struct device *dev = snd_soc_dapm_to_dev(dapm); | ||
| 1078 | struct snd_soc_card *card = snd_soc_dapm_to_card(dapm); | ||
| 1073 | struct snd_soc_dapm_widget *widgets; | 1079 | struct snd_soc_dapm_widget *widgets; |
| 1074 | struct snd_soc_dapm_route *route; | 1080 | struct snd_soc_dapm_route *route; |
| 1075 | struct hdac_device *hdev = dev_to_hdac_dev(dapm->dev); | 1081 | struct hdac_device *hdev = dev_to_hdac_dev(dev); |
| 1076 | struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); | 1082 | struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev); |
| 1077 | struct snd_soc_dai_driver *dai_drv = hdmi->dai_drv; | 1083 | struct snd_soc_dai_driver *dai_drv = hdmi->dai_drv; |
| 1078 | char widget_name[NAME_SIZE]; | 1084 | char widget_name[NAME_SIZE]; |
| @@ -1083,7 +1089,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 4 unmodified lines | |||
| 1083 | if (list_empty(&hdmi->cvt_list) || list_empty(&hdmi->pin_list)) | 1089 | if (list_empty(&hdmi->cvt_list) || list_empty(&hdmi->pin_list)) |
| 1084 | return -EINVAL; | 1090 | return -EINVAL; |
| 1085 | 1091 | ||
| 1086 | widgets = devm_kzalloc(dapm->dev, (sizeof(*widgets) * | 1092 | widgets = devm_kzalloc(dev, (sizeof(*widgets) * |
| 1087 | ((2 * hdmi->num_ports) + hdmi->num_cvt)), | 1093 | ((2 * hdmi->num_ports) + hdmi->num_cvt)), |
| 1088 | GFP_KERNEL); | 1094 | GFP_KERNEL); |
| 1089 | 1095 | ||
| @@ -1093,7 +1099,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 3 unmodified lines | |||
| 1093 | /* DAPM widgets to represent each converter widget */ | 1099 | /* DAPM widgets to represent each converter widget */ |
| 1094 | list_for_each_entry(cvt, &hdmi->cvt_list, head) { | 1100 | list_for_each_entry(cvt, &hdmi->cvt_list, head) { |
| 1095 | sprintf(widget_name, "Converter %d", cvt->nid); | 1101 | sprintf(widget_name, "Converter %d", cvt->nid); |
| 1096 | ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i], | 1102 | ret = hdac_hdmi_fill_widget_info(dev, &widgets[i], |
| 1097 | snd_soc_dapm_aif_in, cvt, | 1103 | snd_soc_dapm_aif_in, cvt, |
| 1098 | widget_name, dai_drv[i].playback.stream_name, NULL, 0, | 1104 | widget_name, dai_drv[i].playback.stream_name, NULL, 0, |
| 1099 | hdac_hdmi_cvt_output_widget_event, | 1105 | hdac_hdmi_cvt_output_widget_event, |
| @@ -1107,7 +1113,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 7 unmodified lines | |||
| 1107 | for (j = 0; j < pin->num_ports; j++) { | 1113 | for (j = 0; j < pin->num_ports; j++) { |
| 1108 | sprintf(widget_name, "hif%d-%d Output", | 1114 | sprintf(widget_name, "hif%d-%d Output", |
| 1109 | pin->nid, pin->ports[j].id); | 1115 | pin->nid, pin->ports[j].id); |
| 1110 | ret = hdac_hdmi_fill_widget_info(dapm->dev, &widgets[i], | 1116 | ret = hdac_hdmi_fill_widget_info(dev, &widgets[i], |
| 1111 | snd_soc_dapm_output, &pin->ports[j], | 1117 | snd_soc_dapm_output, &pin->ports[j], |
| 1112 | widget_name, NULL, NULL, 0, | 1118 | widget_name, NULL, NULL, 0, |
| 1113 | hdac_hdmi_pin_output_widget_event, | 1119 | hdac_hdmi_pin_output_widget_event, |
| @@ -1140,7 +1146,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 26 unmodified lines | |||
| 1140 | } | 1146 | } |
| 1141 | } | 1147 | } |
| 1142 | 1148 | ||
| 1143 | route = devm_kzalloc(dapm->dev, (sizeof(*route) * num_routes), | 1149 | route = devm_kzalloc(dev, (sizeof(*route) * num_routes), |
| 1144 | GFP_KERNEL); | 1150 | GFP_KERNEL); |
| 1145 | if (!route) | 1151 | if (!route) |
| 1146 | return -ENOMEM; | 1152 | return -ENOMEM; |
| @@ -1166,7 +1172,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) · 19 unmodified lines | |||
| 1166 | ((2 * hdmi->num_ports) + hdmi->num_cvt)); | 1172 | ((2 * hdmi->num_ports) + hdmi->num_cvt)); |
| 1167 | 1173 | ||
| 1168 | snd_soc_dapm_add_routes(dapm, route, num_routes); | 1174 | snd_soc_dapm_add_routes(dapm, route, num_routes); |
| 1169 | snd_soc_dapm_new_widgets(dapm->card); | 1175 | snd_soc_dapm_new_widgets(card); |
| 1170 | 1176 | ||
| 1171 | return 0; | 1177 | return 0; |
| 1172 | 1178 | ||
| @@ -1666,8 +1672,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component) · 493 unmodified lines | |||
| 1666 | { | 1672 | { |
| 1667 | struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); | 1673 | struct hdac_hdmi_priv *hdmi = snd_soc_component_get_drvdata(component); |
| 1668 | struct hdac_device *hdev = hdmi->hdev; | 1674 | struct hdac_device *hdev = hdmi->hdev; |
| 1669 | struct snd_soc_dapm_context *dapm = | 1675 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1670 | snd_soc_component_get_dapm(component); | ||
| 1671 | struct hdac_ext_link *hlink; | 1676 | struct hdac_ext_link *hlink; |
| 1672 | int ret; | 1677 | int ret; |
| 1673 | 1678 | ||
| @@ -1698,7 +1703,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component) · 24 unmodified lines | |||
| 1698 | 1703 | ||
| 1699 | hdac_hdmi_present_sense_all_pins(hdev, hdmi, true); | 1704 | hdac_hdmi_present_sense_all_pins(hdev, hdmi, true); |
| 1700 | /* Imp: Store the card pointer in hda_codec */ | 1705 | /* Imp: Store the card pointer in hda_codec */ |
| 1701 | hdmi->card = dapm->card->snd_card; | 1706 | hdmi->card = component->card->snd_card; |
| 1702 | 1707 | ||
| 1703 | /* | 1708 | /* |
| 1704 | * Setup a device_link between card device and HDMI codec device. | 1709 | * Setup a device_link between card device and HDMI codec device. |
| @@ -908,7 +908,7 @@ static int hdmi_dai_probe(struct snd_soc_dai *dai) · 907 unmodified lines | |||
| 908 | }; | 908 | }; |
| 909 | int ret, i; | 909 | int ret, i; |
| 910 | 910 | ||
| 911 | dapm = snd_soc_component_get_dapm(dai->component); | 911 | dapm = snd_soc_component_to_dapm(dai->component); |
| 912 | 912 | ||
| 913 | /* One of the directions might be omitted for unidirectional DAIs */ | 913 | /* One of the directions might be omitted for unidirectional DAIs */ |
| 914 | for (i = 0; i < ARRAY_SIZE(route); i++) { | 914 | for (i = 0; i < ARRAY_SIZE(route); i++) { |
| @@ -402,7 +402,7 @@ static int idt821034_kctrl_gain_get(struct snd_kcontrol *kcontrol, · 401 unmodified lines | |||
| 402 | struct snd_ctl_elem_value *ucontrol) | 402 | struct snd_ctl_elem_value *ucontrol) |
| 403 | { | 403 | { |
| 404 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | 404 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; |
| 405 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 405 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 406 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); | 406 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); |
| 407 | int min = mc->min; | 407 | int min = mc->min; |
| 408 | int max = mc->max; | 408 | int max = mc->max; |
| @@ -433,7 +433,7 @@ static int idt821034_kctrl_gain_put(struct snd_kcontrol *kcontrol, · 24 unmodified lines | |||
| 433 | struct snd_ctl_elem_value *ucontrol) | 433 | struct snd_ctl_elem_value *ucontrol) |
| 434 | { | 434 | { |
| 435 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | 435 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; |
| 436 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 436 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 437 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); | 437 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); |
| 438 | struct idt821034_amp *amp; | 438 | struct idt821034_amp *amp; |
| 439 | int min = mc->min; | 439 | int min = mc->min; |
| @@ -487,7 +487,7 @@ end: · 47 unmodified lines | |||
| 487 | static int idt821034_kctrl_mute_get(struct snd_kcontrol *kcontrol, | 487 | static int idt821034_kctrl_mute_get(struct snd_kcontrol *kcontrol, |
| 488 | struct snd_ctl_elem_value *ucontrol) | 488 | struct snd_ctl_elem_value *ucontrol) |
| 489 | { | 489 | { |
| 490 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 490 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 491 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); | 491 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); |
| 492 | int id = kcontrol->private_value; | 492 | int id = kcontrol->private_value; |
| 493 | bool is_muted; | 493 | bool is_muted; |
| @@ -509,7 +509,7 @@ static int idt821034_kctrl_mute_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 509 | static int idt821034_kctrl_mute_put(struct snd_kcontrol *kcontrol, | 509 | static int idt821034_kctrl_mute_put(struct snd_kcontrol *kcontrol, |
| 510 | struct snd_ctl_elem_value *ucontrol) | 510 | struct snd_ctl_elem_value *ucontrol) |
| 511 | { | 511 | { |
| 512 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 512 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 513 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); | 513 | struct idt821034 *idt821034 = snd_soc_component_get_drvdata(component); |
| 514 | int id = kcontrol->private_value; | 514 | int id = kcontrol->private_value; |
| 515 | struct idt821034_amp *amp; | 515 | struct idt821034_amp *amp; |
| @@ -231,6 +231,7 @@ static void jz4740_codec_wakeup(struct regmap *regmap) · 230 unmodified lines | |||
| 231 | static int jz4740_codec_set_bias_level(struct snd_soc_component *component, | 231 | static int jz4740_codec_set_bias_level(struct snd_soc_component *component, |
| 232 | enum snd_soc_bias_level level) | 232 | enum snd_soc_bias_level level) |
| 233 | { | 233 | { |
| 234 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 234 | struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); | 235 | struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); |
| 235 | struct regmap *regmap = jz4740_codec->regmap; | 236 | struct regmap *regmap = jz4740_codec->regmap; |
| 236 | unsigned int mask; | 237 | unsigned int mask; |
| @@ -247,7 +248,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_component *component, · 10 unmodified lines | |||
| 247 | break; | 248 | break; |
| 248 | case SND_SOC_BIAS_STANDBY: | 249 | case SND_SOC_BIAS_STANDBY: |
| 249 | /* The only way to clear the suspend flag is to reset the codec */ | 250 | /* The only way to clear the suspend flag is to reset the codec */ |
| 250 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 251 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 251 | jz4740_codec_wakeup(regmap); | 252 | jz4740_codec_wakeup(regmap); |
| 252 | 253 | ||
| 253 | mask = JZ4740_CODEC_1_VREF_DISABLE | | 254 | mask = JZ4740_CODEC_1_VREF_DISABLE | |
| @@ -197,7 +197,7 @@ static int jz4760_codec_startup(struct snd_pcm_substream *substream, · 196 unmodified lines | |||
| 197 | struct snd_soc_dai *dai) | 197 | struct snd_soc_dai *dai) |
| 198 | { | 198 | { |
| 199 | struct snd_soc_component *codec = dai->component; | 199 | struct snd_soc_component *codec = dai->component; |
| 200 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec); | 200 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); |
| 201 | int ret = 0; | 201 | int ret = 0; |
| 202 | 202 | ||
| 203 | /* | 203 | /* |
| @@ -214,7 +214,7 @@ static void jz4760_codec_shutdown(struct snd_pcm_substream *substream, · 10 unmodified lines | |||
| 214 | struct snd_soc_dai *dai) | 214 | struct snd_soc_dai *dai) |
| 215 | { | 215 | { |
| 216 | struct snd_soc_component *codec = dai->component; | 216 | struct snd_soc_component *codec = dai->component; |
| 217 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec); | 217 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); |
| 218 | 218 | ||
| 219 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 219 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 220 | snd_soc_dapm_disable_pin(dapm, "SYSCLK"); | 220 | snd_soc_dapm_disable_pin(dapm, "SYSCLK"); |
| @@ -225,6 +225,7 @@ static int jz4760_codec_pcm_trigger(struct snd_pcm_substream *substream, · 4 unmodified lines | |||
| 225 | int cmd, struct snd_soc_dai *dai) | 225 | int cmd, struct snd_soc_dai *dai) |
| 226 | { | 226 | { |
| 227 | struct snd_soc_component *codec = dai->component; | 227 | struct snd_soc_component *codec = dai->component; |
| 228 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); | ||
| 228 | int ret = 0; | 229 | int ret = 0; |
| 229 | 230 | ||
| 230 | switch (cmd) { | 231 | switch (cmd) { |
| @@ -232,7 +233,7 @@ static int jz4760_codec_pcm_trigger(struct snd_pcm_substream *substream, · 1 unmodified line | |||
| 232 | case SNDRV_PCM_TRIGGER_RESUME: | 233 | case SNDRV_PCM_TRIGGER_RESUME: |
| 233 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 234 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
| 234 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) | 235 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) |
| 235 | snd_soc_component_force_bias_level(codec, SND_SOC_BIAS_ON); | 236 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_ON); |
| 236 | break; | 237 | break; |
| 237 | case SNDRV_PCM_TRIGGER_STOP: | 238 | case SNDRV_PCM_TRIGGER_STOP: |
| 238 | case SNDRV_PCM_TRIGGER_SUSPEND: | 239 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| @@ -217,7 +217,7 @@ static int jz4770_codec_startup(struct snd_pcm_substream *substream, · 216 unmodified lines | |||
| 217 | struct snd_soc_dai *dai) | 217 | struct snd_soc_dai *dai) |
| 218 | { | 218 | { |
| 219 | struct snd_soc_component *codec = dai->component; | 219 | struct snd_soc_component *codec = dai->component; |
| 220 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec); | 220 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); |
| 221 | 221 | ||
| 222 | /* | 222 | /* |
| 223 | * SYSCLK output from the codec to the AIC is required to keep the | 223 | * SYSCLK output from the codec to the AIC is required to keep the |
| @@ -234,7 +234,7 @@ static void jz4770_codec_shutdown(struct snd_pcm_substream *substream, · 10 unmodified lines | |||
| 234 | struct snd_soc_dai *dai) | 234 | struct snd_soc_dai *dai) |
| 235 | { | 235 | { |
| 236 | struct snd_soc_component *codec = dai->component; | 236 | struct snd_soc_component *codec = dai->component; |
| 237 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(codec); | 237 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); |
| 238 | 238 | ||
| 239 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 239 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 240 | snd_soc_dapm_disable_pin(dapm, "SYSCLK"); | 240 | snd_soc_dapm_disable_pin(dapm, "SYSCLK"); |
| @@ -245,6 +245,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream, · 4 unmodified lines | |||
| 245 | int cmd, struct snd_soc_dai *dai) | 245 | int cmd, struct snd_soc_dai *dai) |
| 246 | { | 246 | { |
| 247 | struct snd_soc_component *codec = dai->component; | 247 | struct snd_soc_component *codec = dai->component; |
| 248 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(codec); | ||
| 248 | int ret = 0; | 249 | int ret = 0; |
| 249 | 250 | ||
| 250 | switch (cmd) { | 251 | switch (cmd) { |
| @@ -252,8 +253,7 @@ static int jz4770_codec_pcm_trigger(struct snd_pcm_substream *substream, · 1 unmodified line | |||
| 252 | case SNDRV_PCM_TRIGGER_RESUME: | 253 | case SNDRV_PCM_TRIGGER_RESUME: |
| 253 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 254 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
| 254 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) | 255 | if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) |
| 255 | snd_soc_component_force_bias_level(codec, | 256 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_ON); |
| 256 | SND_SOC_BIAS_ON); | ||
| 257 | break; | 257 | break; |
| 258 | case SNDRV_PCM_TRIGGER_STOP: | 258 | case SNDRV_PCM_TRIGGER_STOP: |
| 259 | case SNDRV_PCM_TRIGGER_SUSPEND: | 259 | case SNDRV_PCM_TRIGGER_SUSPEND: |
| @@ -1255,6 +1255,7 @@ static int lm49453_set_bias_level(struct snd_soc_component *component, · 1254 unmodified lines | |||
| 1255 | enum snd_soc_bias_level level) | 1255 | enum snd_soc_bias_level level) |
| 1256 | { | 1256 | { |
| 1257 | struct lm49453_priv *lm49453 = snd_soc_component_get_drvdata(component); | 1257 | struct lm49453_priv *lm49453 = snd_soc_component_get_drvdata(component); |
| 1258 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1258 | 1259 | ||
| 1259 | switch (level) { | 1260 | switch (level) { |
| 1260 | case SND_SOC_BIAS_ON: | 1261 | case SND_SOC_BIAS_ON: |
| @@ -1262,7 +1263,7 @@ static int lm49453_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 1262 | break; | 1263 | break; |
| 1263 | 1264 | ||
| 1264 | case SND_SOC_BIAS_STANDBY: | 1265 | case SND_SOC_BIAS_STANDBY: |
| 1265 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 1266 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 1266 | regcache_sync(lm49453->regmap); | 1267 | regcache_sync(lm49453->regmap); |
| 1267 | 1268 | ||
| 1268 | snd_soc_component_update_bits(component, LM49453_P0_PMC_SETUP_REG, | 1269 | snd_soc_component_update_bits(component, LM49453_P0_PMC_SETUP_REG, |
| @@ -1682,7 +1682,7 @@ static const struct regmap_config rx_regmap_config = { · 1681 unmodified lines | |||
| 1682 | static int rx_macro_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol, | 1682 | static int rx_macro_int_dem_inp_mux_put(struct snd_kcontrol *kcontrol, |
| 1683 | struct snd_ctl_elem_value *ucontrol) | 1683 | struct snd_ctl_elem_value *ucontrol) |
| 1684 | { | 1684 | { |
| 1685 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 1685 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 1686 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 1686 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 1687 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 1687 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 1688 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1688 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| @@ -1905,52 +1905,48 @@ static int rx_macro_digital_mute(struct snd_soc_dai *dai, int mute, int stream) · 216 unmodified lines | |||
| 1905 | { | 1905 | { |
| 1906 | struct snd_soc_component *component = dai->component; | 1906 | struct snd_soc_component *component = dai->component; |
| 1907 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 1907 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 1908 | uint16_t j, reg, mix_reg, dsm_reg; | 1908 | u32 port, j, reg, mix_reg, int_mux_cfg0, int_mux_cfg1; |
| 1909 | u16 int_mux_cfg0, int_mux_cfg1; | 1909 | u32 mask, val; |
| 1910 | u8 int_mux_cfg0_val, int_mux_cfg1_val; | 1910 | u8 int_mux_cfg0_val, int_mux_cfg1_val; |
| 1911 | 1911 | ||
| 1912 | switch (dai->id) { | 1912 | if (stream != SNDRV_PCM_STREAM_PLAYBACK) |
| 1913 | case RX_MACRO_AIF1_PB: | 1913 | return 0; |
| 1914 | case RX_MACRO_AIF2_PB: | 1914 | |
| 1915 | case RX_MACRO_AIF3_PB: | 1915 | for (j = 0; j < INTERP_MAX; j++) { |
| 1916 | case RX_MACRO_AIF4_PB: | 1916 | reg = CDC_RX_RXn_RX_PATH_CTL(rx, j); |
| 1917 | for (j = 0; j < INTERP_MAX; j++) { | 1917 | mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j); |
| 1918 | reg = CDC_RX_RXn_RX_PATH_CTL(rx, j); | 1918 | |
| 1919 | mix_reg = CDC_RX_RXn_RX_PATH_MIX_CTL(rx, j); | 1919 | mask = CDC_RX_PATH_PGA_MUTE_MASK; |
| 1920 | dsm_reg = CDC_RX_RXn_RX_PATH_DSM_CTL(rx, j); | 1920 | val = 0; |
| 1921 | 1921 | if (mute) | |
| 1922 | if (mute) { | 1922 | val |= CDC_RX_PATH_PGA_MUTE_ENABLE; |
| 1923 | snd_soc_component_update_bits(component, reg, | 1923 | if (rx->main_clk_users[j] > 0) { |
| 1924 | CDC_RX_PATH_PGA_MUTE_MASK, | 1924 | mask |= CDC_RX_PATH_CLK_EN_MASK; |
| 1925 | CDC_RX_PATH_PGA_MUTE_ENABLE); | 1925 | val |= CDC_RX_PATH_CLK_ENABLE; |
| 1926 | snd_soc_component_update_bits(component, mix_reg, | 1926 | } |
| 1927 | CDC_RX_PATH_PGA_MUTE_MASK, | 1927 | |
| 1928 | CDC_RX_PATH_PGA_MUTE_ENABLE); | 1928 | int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8; |
| 1929 | } else { | 1929 | int_mux_cfg1 = int_mux_cfg0 + 4; |
| 1930 | snd_soc_component_update_bits(component, reg, | 1930 | int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0); |
| 1931 | CDC_RX_PATH_PGA_MUTE_MASK, 0x0); | 1931 | int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1); |
| 1932 | snd_soc_component_update_bits(component, mix_reg, | 1932 | |
| 1933 | CDC_RX_PATH_PGA_MUTE_MASK, 0x0); | 1933 | for_each_set_bit(port, &rx->active_ch_mask[dai->id], RX_MACRO_PORTS_MAX) { |
| 1934 | if (((int_mux_cfg0_val & 0x0f) == port + INTn_1_INP_SEL_RX0) || | ||
| 1935 | ((int_mux_cfg0_val >> 4) == port + INTn_1_INP_SEL_RX0) || | ||
| 1936 | ((int_mux_cfg1_val >> 4) == port + INTn_1_INP_SEL_RX0)) { | ||
| 1937 | snd_soc_component_update_bits(component, reg, mask, val); | ||
| 1934 | } | 1938 | } |
| 1935 | 1939 | ||
| 1936 | int_mux_cfg0 = CDC_RX_INP_MUX_RX_INT0_CFG0 + j * 8; | 1940 | if ((int_mux_cfg1_val & 0x0f) == port + INTn_2_INP_SEL_RX0) { |
| 1937 | int_mux_cfg1 = int_mux_cfg0 + 4; | 1941 | snd_soc_component_update_bits(component, mix_reg, mask, val); |
| 1938 | int_mux_cfg0_val = snd_soc_component_read(component, int_mux_cfg0); | 1942 | /* main clock needs to be enabled for mix to be useful: */ |
| 1939 | int_mux_cfg1_val = snd_soc_component_read(component, int_mux_cfg1); | 1943 | if (rx->main_clk_users[j] > 0) { |
| 1940 | 1944 | snd_soc_component_update_bits(component, reg, | |
| 1941 | if (snd_soc_component_read(component, dsm_reg) & 0x01) { | 1945 | CDC_RX_PATH_CLK_EN_MASK, |
| 1942 | if (int_mux_cfg0_val || (int_mux_cfg1_val & 0xF0)) | 1946 | CDC_RX_PATH_CLK_ENABLE); |
| 1943 | snd_soc_component_update_bits(component, reg, 0x20, 0x20); | ||
| 1944 | if (int_mux_cfg1_val & 0x0F) { | ||
| 1945 | snd_soc_component_update_bits(component, reg, 0x20, 0x20); | ||
| 1946 | snd_soc_component_update_bits(component, mix_reg, 0x20, | ||
| 1947 | 0x20); | ||
| 1948 | } | 1947 | } |
| 1949 | } | 1948 | } |
| 1950 | } | 1949 | } |
| 1951 | break; | ||
| 1952 | default: | ||
| 1953 | break; | ||
| 1954 | } | 1950 | } |
| 1955 | return 0; | 1951 | return 0; |
| 1956 | } | 1952 | } |
| @@ -2434,8 +2430,7 @@ static void rx_macro_hd2_control(struct snd_soc_component *component, · 477 unmodified lines | |||
| 2434 | static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, | 2430 | static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, |
| 2435 | struct snd_ctl_elem_value *ucontrol) | 2431 | struct snd_ctl_elem_value *ucontrol) |
| 2436 | { | 2432 | { |
| 2437 | struct snd_soc_component *component = | 2433 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2438 | snd_soc_kcontrol_component(kcontrol); | ||
| 2439 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2434 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2440 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2435 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2441 | 2436 | ||
| @@ -2446,7 +2441,7 @@ static int rx_macro_get_compander(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2446 | static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, | 2441 | static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, |
| 2447 | struct snd_ctl_elem_value *ucontrol) | 2442 | struct snd_ctl_elem_value *ucontrol) |
| 2448 | { | 2443 | { |
| 2449 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2444 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2450 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2445 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2451 | int value = ucontrol->value.integer.value[0]; | 2446 | int value = ucontrol->value.integer.value[0]; |
| 2452 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2447 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| @@ -2459,7 +2454,7 @@ static int rx_macro_set_compander(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 2459 | static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, | 2454 | static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, |
| 2460 | struct snd_ctl_elem_value *ucontrol) | 2455 | struct snd_ctl_elem_value *ucontrol) |
| 2461 | { | 2456 | { |
| 2462 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 2457 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 2463 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 2458 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 2464 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2459 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2465 | 2460 | ||
| @@ -2471,7 +2466,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 2471 | static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, | 2466 | static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, |
| 2472 | struct snd_ctl_elem_value *ucontrol) | 2467 | struct snd_ctl_elem_value *ucontrol) |
| 2473 | { | 2468 | { |
| 2474 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 2469 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 2475 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 2470 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 2476 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 2471 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 2477 | struct snd_soc_dapm_update *update = NULL; | 2472 | struct snd_soc_dapm_update *update = NULL; |
| @@ -2548,7 +2543,7 @@ static const struct snd_kcontrol_new rx_macro_rx5_mux = · 70 unmodified lines | |||
| 2548 | static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, | 2543 | static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, |
| 2549 | struct snd_ctl_elem_value *ucontrol) | 2544 | struct snd_ctl_elem_value *ucontrol) |
| 2550 | { | 2545 | { |
| 2551 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2546 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2552 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2547 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2553 | 2548 | ||
| 2554 | ucontrol->value.integer.value[0] = rx->is_ear_mode_on; | 2549 | ucontrol->value.integer.value[0] = rx->is_ear_mode_on; |
| @@ -2558,7 +2553,7 @@ static int rx_macro_get_ear_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 2558 | static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, | 2553 | static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, |
| 2559 | struct snd_ctl_elem_value *ucontrol) | 2554 | struct snd_ctl_elem_value *ucontrol) |
| 2560 | { | 2555 | { |
| 2561 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2556 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2562 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2557 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2563 | 2558 | ||
| 2564 | rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true); | 2559 | rx->is_ear_mode_on = (!ucontrol->value.integer.value[0] ? false : true); |
| @@ -2568,7 +2563,7 @@ static int rx_macro_put_ear_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 2568 | static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, | 2563 | static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, |
| 2569 | struct snd_ctl_elem_value *ucontrol) | 2564 | struct snd_ctl_elem_value *ucontrol) |
| 2570 | { | 2565 | { |
| 2571 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2566 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2572 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2567 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2573 | 2568 | ||
| 2574 | ucontrol->value.integer.value[0] = rx->hph_hd2_mode; | 2569 | ucontrol->value.integer.value[0] = rx->hph_hd2_mode; |
| @@ -2578,7 +2573,7 @@ static int rx_macro_get_hph_hd2_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 2578 | static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, | 2573 | static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, |
| 2579 | struct snd_ctl_elem_value *ucontrol) | 2574 | struct snd_ctl_elem_value *ucontrol) |
| 2580 | { | 2575 | { |
| 2581 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2576 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2582 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2577 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2583 | 2578 | ||
| 2584 | rx->hph_hd2_mode = ucontrol->value.integer.value[0]; | 2579 | rx->hph_hd2_mode = ucontrol->value.integer.value[0]; |
| @@ -2588,7 +2583,7 @@ static int rx_macro_put_hph_hd2_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 2588 | static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, | 2583 | static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, |
| 2589 | struct snd_ctl_elem_value *ucontrol) | 2584 | struct snd_ctl_elem_value *ucontrol) |
| 2590 | { | 2585 | { |
| 2591 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2586 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2592 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2587 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2593 | 2588 | ||
| 2594 | ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode; | 2589 | ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode; |
| @@ -2598,7 +2593,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 2598 | static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, | 2593 | static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, |
| 2599 | struct snd_ctl_elem_value *ucontrol) | 2594 | struct snd_ctl_elem_value *ucontrol) |
| 2600 | { | 2595 | { |
| 2601 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2596 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2602 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2597 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2603 | 2598 | ||
| 2604 | rx->hph_pwr_mode = ucontrol->value.enumerated.item[0]; | 2599 | rx->hph_pwr_mode = ucontrol->value.enumerated.item[0]; |
| @@ -2608,7 +2603,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 2608 | static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, | 2603 | static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, |
| 2609 | struct snd_ctl_elem_value *ucontrol) | 2604 | struct snd_ctl_elem_value *ucontrol) |
| 2610 | { | 2605 | { |
| 2611 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2606 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2612 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2607 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2613 | 2608 | ||
| 2614 | ucontrol->value.integer.value[0] = rx->is_softclip_on; | 2609 | ucontrol->value.integer.value[0] = rx->is_softclip_on; |
| @@ -2619,7 +2614,7 @@ static int rx_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2619 | static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, | 2614 | static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, |
| 2620 | struct snd_ctl_elem_value *ucontrol) | 2615 | struct snd_ctl_elem_value *ucontrol) |
| 2621 | { | 2616 | { |
| 2622 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2617 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2623 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2618 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2624 | 2619 | ||
| 2625 | rx->is_softclip_on = ucontrol->value.integer.value[0]; | 2620 | rx->is_softclip_on = ucontrol->value.integer.value[0]; |
| @@ -2630,7 +2625,7 @@ static int rx_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2630 | static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, | 2625 | static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, |
| 2631 | struct snd_ctl_elem_value *ucontrol) | 2626 | struct snd_ctl_elem_value *ucontrol) |
| 2632 | { | 2627 | { |
| 2633 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2628 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2634 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2629 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2635 | 2630 | ||
| 2636 | ucontrol->value.integer.value[0] = rx->is_aux_hpf_on; | 2631 | ucontrol->value.integer.value[0] = rx->is_aux_hpf_on; |
| @@ -2641,7 +2636,7 @@ static int rx_macro_aux_hpf_mode_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2641 | static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol, | 2636 | static int rx_macro_aux_hpf_mode_put(struct snd_kcontrol *kcontrol, |
| 2642 | struct snd_ctl_elem_value *ucontrol) | 2637 | struct snd_ctl_elem_value *ucontrol) |
| 2643 | { | 2638 | { |
| 2644 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2639 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2645 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 2640 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 2646 | 2641 | ||
| 2647 | rx->is_aux_hpf_on = ucontrol->value.integer.value[0]; | 2642 | rx->is_aux_hpf_on = ucontrol->value.integer.value[0]; |
| @@ -2930,8 +2925,7 @@ static int rx_macro_put_iir_band_audio_mixer( · 282 unmodified lines | |||
| 2930 | struct snd_kcontrol *kcontrol, | 2925 | struct snd_kcontrol *kcontrol, |
| 2931 | struct snd_ctl_elem_value *ucontrol) | 2926 | struct snd_ctl_elem_value *ucontrol) |
| 2932 | { | 2927 | { |
| 2933 | struct snd_soc_component *component = | 2928 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2934 | snd_soc_kcontrol_component(kcontrol); | ||
| 2935 | struct wcd_iir_filter_ctl *ctl = | 2929 | struct wcd_iir_filter_ctl *ctl = |
| 2936 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; | 2930 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; |
| 2937 | struct soc_bytes_ext *params = &ctl->bytes_ext; | 2931 | struct soc_bytes_ext *params = &ctl->bytes_ext; |
| @@ -2959,8 +2953,7 @@ static int rx_macro_put_iir_band_audio_mixer( · 21 unmodified lines | |||
| 2959 | static int rx_macro_get_iir_band_audio_mixer(struct snd_kcontrol *kcontrol, | 2953 | static int rx_macro_get_iir_band_audio_mixer(struct snd_kcontrol *kcontrol, |
| 2960 | struct snd_ctl_elem_value *ucontrol) | 2954 | struct snd_ctl_elem_value *ucontrol) |
| 2961 | { | 2955 | { |
| 2962 | struct snd_soc_component *component = | 2956 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2963 | snd_soc_kcontrol_component(kcontrol); | ||
| 2964 | struct wcd_iir_filter_ctl *ctl = | 2957 | struct wcd_iir_filter_ctl *ctl = |
| 2965 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; | 2958 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; |
| 2966 | struct soc_bytes_ext *params = &ctl->bytes_ext; | 2959 | struct soc_bytes_ext *params = &ctl->bytes_ext; |
| @@ -3612,7 +3605,7 @@ static const struct snd_soc_dapm_route rx_audio_map[] = { · 645 unmodified lines | |||
| 3612 | 3605 | ||
| 3613 | static int rx_macro_component_probe(struct snd_soc_component *component) | 3606 | static int rx_macro_component_probe(struct snd_soc_component *component) |
| 3614 | { | 3607 | { |
| 3615 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 3608 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3616 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); | 3609 | struct rx_macro *rx = snd_soc_component_get_drvdata(component); |
| 3617 | const struct snd_soc_dapm_widget *widgets; | 3610 | const struct snd_soc_dapm_widget *widgets; |
| 3618 | const struct snd_kcontrol_new *controls; | 3611 | const struct snd_kcontrol_new *controls; |
| @@ -3954,6 +3947,9 @@ static const struct of_device_id rx_macro_dt_match[] = { · 335 unmodified lines | |||
| 3954 | .compatible = "qcom,sc7280-lpass-rx-macro", | 3947 | .compatible = "qcom,sc7280-lpass-rx-macro", |
| 3955 | .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, | 3948 | .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, |
| 3956 | 3949 | ||
| 3950 | }, { | ||
| 3951 | .compatible = "qcom,sm6115-lpass-rx-macro", | ||
| 3952 | .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, | ||
| 3957 | }, { | 3953 | }, { |
| 3958 | .compatible = "qcom,sm8250-lpass-rx-macro", | 3954 | .compatible = "qcom,sm8250-lpass-rx-macro", |
| 3959 | .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, | 3955 | .data = (void *)LPASS_MACRO_FLAG_HAS_NPL_CLOCK, |
| @@ -800,7 +800,7 @@ static void tx_macro_update_smic_sel_v9_2(struct snd_soc_component *component, · 799 unmodified lines | |||
| 800 | static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol, | 800 | static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol, |
| 801 | struct snd_ctl_elem_value *ucontrol) | 801 | struct snd_ctl_elem_value *ucontrol) |
| 802 | { | 802 | { |
| 803 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 803 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 804 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 804 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 805 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 805 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 806 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); | 806 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); |
| @@ -859,7 +859,7 @@ static int tx_macro_put_dec_enum(struct snd_kcontrol *kcontrol, · 52 unmodified lines | |||
| 859 | static int tx_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, | 859 | static int tx_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, |
| 860 | struct snd_ctl_elem_value *ucontrol) | 860 | struct snd_ctl_elem_value *ucontrol) |
| 861 | { | 861 | { |
| 862 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 862 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 863 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 863 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 864 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | 864 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; |
| 865 | u32 dai_id = widget->shift; | 865 | u32 dai_id = widget->shift; |
| @@ -877,7 +877,7 @@ static int tx_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, · 11 unmodified lines | |||
| 877 | static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, | 877 | static int tx_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, |
| 878 | struct snd_ctl_elem_value *ucontrol) | 878 | struct snd_ctl_elem_value *ucontrol) |
| 879 | { | 879 | { |
| 880 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 880 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 881 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 881 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 882 | struct snd_soc_dapm_update *update = NULL; | 882 | struct snd_soc_dapm_update *update = NULL; |
| 883 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | 883 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1070,7 +1070,7 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w, · 186 unmodified lines | |||
| 1070 | static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol, | 1070 | static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol, |
| 1071 | struct snd_ctl_elem_value *ucontrol) | 1071 | struct snd_ctl_elem_value *ucontrol) |
| 1072 | { | 1072 | { |
| 1073 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1073 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1074 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); | 1074 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); |
| 1075 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1075 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 1076 | int path = e->shift_l; | 1076 | int path = e->shift_l; |
| @@ -1083,7 +1083,7 @@ static int tx_macro_dec_mode_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 1083 | static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, | 1083 | static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, |
| 1084 | struct snd_ctl_elem_value *ucontrol) | 1084 | struct snd_ctl_elem_value *ucontrol) |
| 1085 | { | 1085 | { |
| 1086 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1086 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1087 | int value = ucontrol->value.integer.value[0]; | 1087 | int value = ucontrol->value.integer.value[0]; |
| 1088 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1088 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 1089 | int path = e->shift_l; | 1089 | int path = e->shift_l; |
| @@ -1100,7 +1100,7 @@ static int tx_macro_dec_mode_put(struct snd_kcontrol *kcontrol, · 10 unmodified lines | |||
| 1100 | static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, | 1100 | static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, |
| 1101 | struct snd_ctl_elem_value *ucontrol) | 1101 | struct snd_ctl_elem_value *ucontrol) |
| 1102 | { | 1102 | { |
| 1103 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1103 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1104 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); | 1104 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); |
| 1105 | 1105 | ||
| 1106 | ucontrol->value.integer.value[0] = tx->bcs_enable; | 1106 | ucontrol->value.integer.value[0] = tx->bcs_enable; |
| @@ -1111,7 +1111,7 @@ static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 1111 | static int tx_macro_set_bcs(struct snd_kcontrol *kcontrol, | 1111 | static int tx_macro_set_bcs(struct snd_kcontrol *kcontrol, |
| 1112 | struct snd_ctl_elem_value *ucontrol) | 1112 | struct snd_ctl_elem_value *ucontrol) |
| 1113 | { | 1113 | { |
| 1114 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1114 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1115 | int value = ucontrol->value.integer.value[0]; | 1115 | int value = ucontrol->value.integer.value[0]; |
| 1116 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); | 1116 | struct tx_macro *tx = snd_soc_component_get_drvdata(component); |
| 1117 | 1117 | ||
| @@ -2081,7 +2081,7 @@ static const struct snd_kcontrol_new tx_macro_snd_controls[] = { · 963 unmodified lines | |||
| 2081 | 2081 | ||
| 2082 | static int tx_macro_component_extend(struct snd_soc_component *comp) | 2082 | static int tx_macro_component_extend(struct snd_soc_component *comp) |
| 2083 | { | 2083 | { |
| 2084 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(comp); | 2084 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp); |
| 2085 | struct tx_macro *tx = snd_soc_component_get_drvdata(comp); | 2085 | struct tx_macro *tx = snd_soc_component_get_drvdata(comp); |
| 2086 | int ret; | 2086 | int ret; |
| 2087 | 2087 | ||
| @@ -2473,7 +2473,8 @@ static const struct tx_macro_data lpass_ver_9_2 = { · 385 unmodified lines | |||
| 2473 | }; | 2473 | }; |
| 2474 | 2474 | ||
| 2475 | static const struct tx_macro_data lpass_ver_10_sm6115 = { | 2475 | static const struct tx_macro_data lpass_ver_10_sm6115 = { |
| 2476 | .flags = LPASS_MACRO_FLAG_HAS_NPL_CLOCK, | 2476 | .flags = LPASS_MACRO_FLAG_HAS_NPL_CLOCK | |
| 2477 | LPASS_MACRO_FLAG_RESET_SWR, | ||
| 2477 | .ver = LPASS_VER_10_0_0, | 2478 | .ver = LPASS_VER_10_0_0, |
| 2478 | .extra_widgets = tx_macro_dapm_widgets_v9_2, | 2479 | .extra_widgets = tx_macro_dapm_widgets_v9_2, |
| 2479 | .extra_widgets_num = ARRAY_SIZE(tx_macro_dapm_widgets_v9_2), | 2480 | .extra_widgets_num = ARRAY_SIZE(tx_macro_dapm_widgets_v9_2), |
| @@ -1,6 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. | 2 | // Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |
| 3 | 3 | ||
| 4 | #include <linux/bitfield.h> | ||
| 4 | #include <linux/clk.h> | 5 | #include <linux/clk.h> |
| 5 | #include <linux/clk-provider.h> | 6 | #include <linux/clk-provider.h> |
| 6 | #include <linux/init.h> | 7 | #include <linux/init.h> |
| @@ -64,8 +65,15 @@ · 57 unmodified lines | |||
| 64 | #define CDC_VA_TOP_CSR_I2S_CLK (0x00A8) | 65 | #define CDC_VA_TOP_CSR_I2S_CLK (0x00A8) |
| 65 | #define CDC_VA_TOP_CSR_I2S_RESET (0x00AC) | 66 | #define CDC_VA_TOP_CSR_I2S_RESET (0x00AC) |
| 66 | #define CDC_VA_TOP_CSR_CORE_ID_0 (0x00C0) | 67 | #define CDC_VA_TOP_CSR_CORE_ID_0 (0x00C0) |
| 68 | #define CORE_ID_0_REV_MAJ GENMASK(7, 0) | ||
| 67 | #define CDC_VA_TOP_CSR_CORE_ID_1 (0x00C4) | 69 | #define CDC_VA_TOP_CSR_CORE_ID_1 (0x00C4) |
| 70 | #define CORE_ID_1_HAS_WSAMACRO BIT(0) | ||
| 71 | #define CORE_ID_1_HAS_RXMACRO BIT(1) | ||
| 72 | #define CORE_ID_1_HAS_TXMACRO BIT(2) | ||
| 73 | #define CORE_ID_1_HAS_VAMACRO BIT(3) | ||
| 68 | #define CDC_VA_TOP_CSR_CORE_ID_2 (0x00C8) | 74 | #define CDC_VA_TOP_CSR_CORE_ID_2 (0x00C8) |
| 75 | #define CORE_ID_2_REV_MIN GENMASK(7, 4) | ||
| 76 | #define CORE_ID_2_REV_STEP GENMASK(3, 0) | ||
| 69 | #define CDC_VA_TOP_CSR_CORE_ID_3 (0x00CC) | 77 | #define CDC_VA_TOP_CSR_CORE_ID_3 (0x00CC) |
| 70 | #define CDC_VA_TOP_CSR_SWR_MIC_CTL0 (0x00D0) | 78 | #define CDC_VA_TOP_CSR_SWR_MIC_CTL0 (0x00D0) |
| 71 | #define CDC_VA_TOP_CSR_SWR_MIC_CTL1 (0x00D4) | 79 | #define CDC_VA_TOP_CSR_SWR_MIC_CTL1 (0x00D4) |
| @@ -516,8 +524,7 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w, · 444 unmodified lines | |||
| 516 | static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol, | 524 | static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol, |
| 517 | struct snd_ctl_elem_value *ucontrol) | 525 | struct snd_ctl_elem_value *ucontrol) |
| 518 | { | 526 | { |
| 519 | struct snd_soc_dapm_widget *widget = | 527 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 520 | snd_soc_dapm_kcontrol_widget(kcontrol); | ||
| 521 | struct snd_soc_component *component = | 528 | struct snd_soc_component *component = |
| 522 | snd_soc_dapm_to_component(widget->dapm); | 529 | snd_soc_dapm_to_component(widget->dapm); |
| 523 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 530 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| @@ -556,8 +563,7 @@ static int va_macro_put_dec_enum(struct snd_kcontrol *kcontrol, · 32 unmodified lines | |||
| 556 | static int va_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, | 563 | static int va_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) | 564 | struct snd_ctl_elem_value *ucontrol) |
| 558 | { | 565 | { |
| 559 | struct snd_soc_dapm_widget *widget = | 566 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 560 | snd_soc_dapm_kcontrol_widget(kcontrol); | ||
| 561 | struct snd_soc_component *component = | 567 | struct snd_soc_component *component = |
| 562 | snd_soc_dapm_to_component(widget->dapm); | 568 | snd_soc_dapm_to_component(widget->dapm); |
| 563 | struct soc_mixer_control *mc = | 569 | struct soc_mixer_control *mc = |
| @@ -577,8 +583,7 @@ static int va_macro_tx_mixer_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 577 | static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, | 583 | static int va_macro_tx_mixer_put(struct snd_kcontrol *kcontrol, |
| 578 | struct snd_ctl_elem_value *ucontrol) | 584 | struct snd_ctl_elem_value *ucontrol) |
| 579 | { | 585 | { |
| 580 | struct snd_soc_dapm_widget *widget = | 586 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 581 | snd_soc_dapm_kcontrol_widget(kcontrol); | ||
| 582 | struct snd_soc_component *component = | 587 | struct snd_soc_component *component = |
| 583 | snd_soc_dapm_to_component(widget->dapm); | 588 | snd_soc_dapm_to_component(widget->dapm); |
| 584 | struct snd_soc_dapm_update *update = NULL; | 589 | struct snd_soc_dapm_update *update = NULL; |
| @@ -819,7 +824,7 @@ static int va_macro_enable_dec(struct snd_soc_dapm_widget *w, · 234 unmodified lines | |||
| 819 | static int va_macro_dec_mode_get(struct snd_kcontrol *kcontrol, | 824 | static int va_macro_dec_mode_get(struct snd_kcontrol *kcontrol, |
| 820 | struct snd_ctl_elem_value *ucontrol) | 825 | struct snd_ctl_elem_value *ucontrol) |
| 821 | { | 826 | { |
| 822 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 827 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 823 | struct va_macro *va = snd_soc_component_get_drvdata(comp); | 828 | struct va_macro *va = snd_soc_component_get_drvdata(comp); |
| 824 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 829 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 825 | int path = e->shift_l; | 830 | int path = e->shift_l; |
| @@ -832,7 +837,7 @@ static int va_macro_dec_mode_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 832 | static int va_macro_dec_mode_put(struct snd_kcontrol *kcontrol, | 837 | static int va_macro_dec_mode_put(struct snd_kcontrol *kcontrol, |
| 833 | struct snd_ctl_elem_value *ucontrol) | 838 | struct snd_ctl_elem_value *ucontrol) |
| 834 | { | 839 | { |
| 835 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 840 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 836 | int value = ucontrol->value.enumerated.item[0]; | 841 | int value = ucontrol->value.enumerated.item[0]; |
| 837 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 842 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 838 | int path = e->shift_l; | 843 | int path = e->shift_l; |
| @@ -1462,39 +1467,63 @@ undefined_rate: · 623 unmodified lines | |||
| 1462 | return dmic_sample_rate; | 1467 | return dmic_sample_rate; |
| 1463 | } | 1468 | } |
| 1464 | 1469 | ||
| 1465 | static void va_macro_set_lpass_codec_version(struct va_macro *va) | 1470 | static int va_macro_set_lpass_codec_version(struct va_macro *va) |
| 1466 | { | 1471 | { |
| 1467 | int core_id_0 = 0, core_id_1 = 0, core_id_2 = 0; | ||
| 1468 | int version = LPASS_CODEC_VERSION_UNKNOWN; | 1472 | int version = LPASS_CODEC_VERSION_UNKNOWN; |
| 1473 | u32 maj, min, step; | ||
| 1474 | u32 val; | ||
| 1469 | 1475 | ||
| 1470 | regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_0, &core_id_0); | 1476 | regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_0, &val); |
| 1471 | regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_1, &core_id_1); | 1477 | maj = FIELD_GET(CORE_ID_0_REV_MAJ, val); |
| 1472 | regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_2, &core_id_2); | ||
| 1473 | 1478 | ||
| 1474 | if ((core_id_0 == 0x01) && (core_id_1 == 0x0F)) | 1479 | regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_1, &val); |
| 1475 | version = LPASS_CODEC_VERSION_2_0; | 1480 | if (!FIELD_GET(CORE_ID_1_HAS_VAMACRO, val)) { |
| 1476 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && core_id_2 == 0x01) | 1481 | dev_err(va->dev, "This is not a VA macro instance\n"); |
| 1482 | return -ENODEV; | ||
| 1483 | } | ||
| 1484 | |||
| 1485 | regmap_read(va->regmap, CDC_VA_TOP_CSR_CORE_ID_2, &val); | ||
| 1486 | min = FIELD_GET(CORE_ID_2_REV_MIN, val); | ||
| 1487 | step = FIELD_GET(CORE_ID_2_REV_STEP, val); | ||
| 1488 | |||
| 1489 | if (maj == 1) { | ||
| 1477 | version = LPASS_CODEC_VERSION_2_0; | 1490 | version = LPASS_CODEC_VERSION_2_0; |
| 1478 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0E)) | 1491 | } else if (maj == 2) { |
| 1479 | version = LPASS_CODEC_VERSION_2_1; | 1492 | switch (min) { |
| 1480 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x50 || core_id_2 == 0x51)) | 1493 | case 0: |
| 1481 | version = LPASS_CODEC_VERSION_2_5; | 1494 | version = LPASS_CODEC_VERSION_2_0; |
| 1482 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x60 || core_id_2 == 0x61)) | 1495 | break; |
| 1483 | version = LPASS_CODEC_VERSION_2_6; | 1496 | case 5: |
| 1484 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x70 || core_id_2 == 0x71)) | 1497 | version = LPASS_CODEC_VERSION_2_5; |
| 1485 | version = LPASS_CODEC_VERSION_2_7; | 1498 | break; |
| 1486 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x80 || core_id_2 == 0x81)) | 1499 | case 6: |
| 1487 | version = LPASS_CODEC_VERSION_2_8; | 1500 | version = LPASS_CODEC_VERSION_2_6; |
| 1488 | if ((core_id_0 == 0x02) && (core_id_1 == 0x0F) && (core_id_2 == 0x90 || core_id_2 == 0x91)) | 1501 | break; |
| 1489 | version = LPASS_CODEC_VERSION_2_9; | 1502 | case 7: |
| 1490 | 1503 | version = LPASS_CODEC_VERSION_2_7; | |
| 1491 | if (version == LPASS_CODEC_VERSION_UNKNOWN) | 1504 | break; |
| 1492 | dev_warn(va->dev, "Unknown Codec version, ID: %02x / %02x / %02x\n", | 1505 | case 8: |
| 1493 | core_id_0, core_id_1, core_id_2); | 1506 | version = LPASS_CODEC_VERSION_2_8; |
| 1507 | break; | ||
| 1508 | case 9: | ||
| 1509 | version = LPASS_CODEC_VERSION_2_9; | ||
| 1510 | break; | ||
| 1511 | default: | ||
| 1512 | break; | ||
| 1513 | } | ||
| 1514 | } | ||
| 1515 | |||
| 1516 | if (version == LPASS_CODEC_VERSION_UNKNOWN) { | ||
| 1517 | dev_err(va->dev, "VA Macro v%u.%u.%u is not supported\n", | ||
| 1518 | maj, min, step); | ||
| 1519 | return -EOPNOTSUPP; | ||
| 1520 | } | ||
| 1494 | 1521 | ||
| 1495 | lpass_macro_set_codec_version(version); | 1522 | lpass_macro_set_codec_version(version); |
| 1496 | 1523 | ||
| 1497 | dev_dbg(va->dev, "LPASS Codec Version %s\n", lpass_macro_get_codec_version_string(version)); | 1524 | dev_dbg(va->dev, "LPASS Codec Version %s\n", lpass_macro_get_codec_version_string(version)); |
| 1525 | |||
| 1526 | return 0; | ||
| 1498 | } | 1527 | } |
| 1499 | 1528 | ||
| 1500 | static int va_macro_probe(struct platform_device *pdev) | 1529 | static int va_macro_probe(struct platform_device *pdev) |
| @@ -1594,10 +1623,14 @@ static int va_macro_probe(struct platform_device *pdev) · 93 unmodified lines | |||
| 1594 | * old version of codecs do not have a reliable way to determine the | 1623 | * old version of codecs do not have a reliable way to determine the |
| 1595 | * version from registers, get them from soc specific data | 1624 | * version from registers, get them from soc specific data |
| 1596 | */ | 1625 | */ |
| 1597 | if (data->version) | 1626 | if (data->version) { |
| 1598 | lpass_macro_set_codec_version(data->version); | 1627 | lpass_macro_set_codec_version(data->version); |
| 1599 | else /* read version from register */ | 1628 | } else { |
| 1600 | va_macro_set_lpass_codec_version(va); | 1629 | /* read version from register */ |
| 1630 | ret = va_macro_set_lpass_codec_version(va); | ||
| 1631 | if (ret) | ||
| 1632 | goto err_clkout; | ||
| 1633 | } | ||
| 1601 | 1634 | ||
| 1602 | if (va->has_swr_master) { | 1635 | if (va->has_swr_master) { |
| 1603 | /* Set default CLK div to 1 */ | 1636 | /* Set default CLK div to 1 */ |
| @@ -1723,6 +1756,7 @@ static const struct dev_pm_ops va_macro_pm_ops = { · 119 unmodified lines | |||
| 1723 | 1756 | ||
| 1724 | static const struct of_device_id va_macro_dt_match[] = { | 1757 | static const struct of_device_id va_macro_dt_match[] = { |
| 1725 | { .compatible = "qcom,sc7280-lpass-va-macro", .data = &sm8250_va_data }, | 1758 | { .compatible = "qcom,sc7280-lpass-va-macro", .data = &sm8250_va_data }, |
| 1759 | { .compatible = "qcom,sm6115-lpass-va-macro", .data = &sm8450_va_data }, | ||
| 1726 | { .compatible = "qcom,sm8250-lpass-va-macro", .data = &sm8250_va_data }, | 1760 | { .compatible = "qcom,sm8250-lpass-va-macro", .data = &sm8250_va_data }, |
| 1727 | { .compatible = "qcom,sm8450-lpass-va-macro", .data = &sm8450_va_data }, | 1761 | { .compatible = "qcom,sm8450-lpass-va-macro", .data = &sm8450_va_data }, |
| 1728 | { .compatible = "qcom,sm8550-lpass-va-macro", .data = &sm8550_va_data }, | 1762 | { .compatible = "qcom,sm8550-lpass-va-macro", .data = &sm8550_va_data }, |
| @@ -297,8 +297,7 @@ enum { · 296 unmodified lines | |||
| 297 | enum { | 297 | enum { |
| 298 | WSA_MACRO_RX0 = 0, | 298 | WSA_MACRO_RX0 = 0, |
| 299 | WSA_MACRO_RX1, | 299 | WSA_MACRO_RX1, |
| 300 | WSA_MACRO_RX_MIX, | 300 | WSA_MACRO_RX_MIX0, |
| 301 | WSA_MACRO_RX_MIX0 = WSA_MACRO_RX_MIX, | ||
| 302 | WSA_MACRO_RX_MIX1, | 301 | WSA_MACRO_RX_MIX1, |
| 303 | WSA_MACRO_RX_MAX, | 302 | WSA_MACRO_RX_MAX, |
| 304 | }; | 303 | }; |
| @@ -1168,12 +1167,6 @@ static int wsa_macro_set_prim_interpolator_rate(struct snd_soc_dai *dai, · 863 unmodified lines | |||
| 1168 | 1167 | ||
| 1169 | for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) { | 1168 | for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) { |
| 1170 | int_1_mix1_inp = port; | 1169 | int_1_mix1_inp = port; |
| 1171 | if ((int_1_mix1_inp < WSA_MACRO_RX0) || (int_1_mix1_inp > WSA_MACRO_RX_MIX1)) { | ||
| 1172 | dev_err(component->dev, "%s: Invalid RX port, Dai ID is %d\n", | ||
| 1173 | __func__, dai->id); | ||
| 1174 | return -EINVAL; | ||
| 1175 | } | ||
| 1176 | |||
| 1177 | int_mux_cfg0 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG0; | 1170 | int_mux_cfg0 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG0; |
| 1178 | 1171 | ||
| 1179 | /* | 1172 | /* |
| @@ -1220,11 +1213,6 @@ static int wsa_macro_set_mix_interpolator_rate(struct snd_soc_dai *dai, · 40 unmodified lines | |||
| 1220 | 1213 | ||
| 1221 | for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) { | 1214 | for_each_set_bit(port, &wsa->active_ch_mask[dai->id], WSA_MACRO_RX_MAX) { |
| 1222 | int_2_inp = port; | 1215 | int_2_inp = port; |
| 1223 | if ((int_2_inp < WSA_MACRO_RX0) || (int_2_inp > WSA_MACRO_RX_MIX1)) { | ||
| 1224 | dev_err(component->dev, "%s: Invalid RX port, Dai ID is %d\n", | ||
| 1225 | __func__, dai->id); | ||
| 1226 | return -EINVAL; | ||
| 1227 | } | ||
| 1228 | 1216 | ||
| 1229 | int_mux_cfg1 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG1; | 1217 | int_mux_cfg1 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG1; |
| 1230 | for (j = 0; j < NUM_INTERPOLATORS; j++) { | 1218 | for (j = 0; j < NUM_INTERPOLATORS; j++) { |
| @@ -1574,41 +1562,6 @@ static int wsa_macro_enable_vi_feedback(struct snd_soc_dapm_widget *w, · 343 unmodified lines | |||
| 1574 | return 0; | 1562 | return 0; |
| 1575 | } | 1563 | } |
| 1576 | 1564 | ||
| 1577 | static int wsa_macro_enable_mix_path(struct snd_soc_dapm_widget *w, | ||
| 1578 | struct snd_kcontrol *kcontrol, int event) | ||
| 1579 | { | ||
| 1580 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | ||
| 1581 | u16 path_reg, gain_reg; | ||
| 1582 | int val; | ||
| 1583 | |||
| 1584 | switch (w->shift) { | ||
| 1585 | case WSA_MACRO_RX_MIX0: | ||
| 1586 | path_reg = CDC_WSA_RX0_RX_PATH_MIX_CTL; | ||
| 1587 | gain_reg = CDC_WSA_RX0_RX_VOL_MIX_CTL; | ||
| 1588 | break; | ||
| 1589 | case WSA_MACRO_RX_MIX1: | ||
| 1590 | path_reg = CDC_WSA_RX1_RX_PATH_MIX_CTL; | ||
| 1591 | gain_reg = CDC_WSA_RX1_RX_VOL_MIX_CTL; | ||
| 1592 | break; | ||
| 1593 | default: | ||
| 1594 | return 0; | ||
| 1595 | } | ||
| 1596 | |||
| 1597 | switch (event) { | ||
| 1598 | case SND_SOC_DAPM_POST_PMU: | ||
| 1599 | val = snd_soc_component_read(component, gain_reg); | ||
| 1600 | snd_soc_component_write(component, gain_reg, val); | ||
| 1601 | break; | ||
| 1602 | case SND_SOC_DAPM_POST_PMD: | ||
| 1603 | snd_soc_component_update_bits(component, path_reg, | ||
| 1604 | CDC_WSA_RX_PATH_MIX_CLK_EN_MASK, | ||
| 1605 | CDC_WSA_RX_PATH_MIX_CLK_DISABLE); | ||
| 1606 | break; | ||
| 1607 | } | ||
| 1608 | |||
| 1609 | return 0; | ||
| 1610 | } | ||
| 1611 | |||
| 1612 | static void wsa_macro_hd2_control(struct snd_soc_component *component, | 1565 | static void wsa_macro_hd2_control(struct snd_soc_component *component, |
| 1613 | u16 reg, int event) | 1566 | u16 reg, int event) |
| 1614 | { | 1567 | { |
| @@ -1772,59 +1725,6 @@ static int wsa_macro_config_softclip(struct snd_soc_component *component, · 157 unmodified lines | |||
| 1772 | return 0; | 1725 | return 0; |
| 1773 | } | 1726 | } |
| 1774 | 1727 | ||
| 1775 | static bool wsa_macro_adie_lb(struct snd_soc_component *component, | ||
| 1776 | int interp_idx) | ||
| 1777 | { | ||
| 1778 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | ||
| 1779 | u16 int_mux_cfg0, int_mux_cfg1; | ||
| 1780 | u8 int_n_inp0, int_n_inp1, int_n_inp2; | ||
| 1781 | |||
| 1782 | int_mux_cfg0 = CDC_WSA_RX_INP_MUX_RX_INT0_CFG0 + interp_idx * 8; | ||
| 1783 | int_mux_cfg1 = int_mux_cfg0 + 4; | ||
| 1784 | |||
| 1785 | int_n_inp0 = snd_soc_component_read_field(component, int_mux_cfg0, | ||
| 1786 | wsa->reg_layout->rx_intx_1_mix_inp0_sel_mask); | ||
| 1787 | if (int_n_inp0 == INTn_1_INP_SEL_DEC0 || | ||
| 1788 | int_n_inp0 == INTn_1_INP_SEL_DEC1) | ||
| 1789 | return true; | ||
| 1790 | |||
| 1791 | int_n_inp1 = snd_soc_component_read_field(component, int_mux_cfg0, | ||
| 1792 | wsa->reg_layout->rx_intx_1_mix_inp1_sel_mask); | ||
| 1793 | if (int_n_inp1 == INTn_1_INP_SEL_DEC0 || | ||
| 1794 | int_n_inp1 == INTn_1_INP_SEL_DEC1) | ||
| 1795 | return true; | ||
| 1796 | |||
| 1797 | int_n_inp2 = snd_soc_component_read_field(component, int_mux_cfg1, | ||
| 1798 | wsa->reg_layout->rx_intx_1_mix_inp2_sel_mask); | ||
| 1799 | if (int_n_inp2 == INTn_1_INP_SEL_DEC0 || | ||
| 1800 | int_n_inp2 == INTn_1_INP_SEL_DEC1) | ||
| 1801 | return true; | ||
| 1802 | |||
| 1803 | return false; | ||
| 1804 | } | ||
| 1805 | |||
| 1806 | static int wsa_macro_enable_main_path(struct snd_soc_dapm_widget *w, | ||
| 1807 | struct snd_kcontrol *kcontrol, | ||
| 1808 | int event) | ||
| 1809 | { | ||
| 1810 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | ||
| 1811 | u16 reg; | ||
| 1812 | |||
| 1813 | reg = CDC_WSA_RX0_RX_PATH_CTL + WSA_MACRO_RX_PATH_OFFSET * w->shift; | ||
| 1814 | switch (event) { | ||
| 1815 | case SND_SOC_DAPM_PRE_PMU: | ||
| 1816 | if (wsa_macro_adie_lb(component, w->shift)) { | ||
| 1817 | snd_soc_component_update_bits(component, reg, | ||
| 1818 | CDC_WSA_RX_PATH_CLK_EN_MASK, | ||
| 1819 | CDC_WSA_RX_PATH_CLK_ENABLE); | ||
| 1820 | } | ||
| 1821 | break; | ||
| 1822 | default: | ||
| 1823 | break; | ||
| 1824 | } | ||
| 1825 | return 0; | ||
| 1826 | } | ||
| 1827 | |||
| 1828 | static int wsa_macro_interp_get_primary_reg(u16 reg, u16 *ind) | 1728 | static int wsa_macro_interp_get_primary_reg(u16 reg, u16 *ind) |
| 1829 | { | 1729 | { |
| 1830 | u16 prim_int_reg = 0; | 1730 | u16 prim_int_reg = 0; |
| @@ -1942,7 +1842,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 111 unmodified lines | |||
| 1942 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | 1842 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
| 1943 | u16 gain_reg; | 1843 | u16 gain_reg; |
| 1944 | u16 reg; | 1844 | u16 reg; |
| 1945 | int val; | ||
| 1946 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 1845 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 1947 | 1846 | ||
| 1948 | if (w->shift == WSA_MACRO_COMP1) { | 1847 | if (w->shift == WSA_MACRO_COMP1) { |
| @@ -1982,8 +1881,6 @@ static int wsa_macro_enable_interpolator(struct snd_soc_dapm_widget *w, · 33 unmodified lines | |||
| 1982 | CDC_WSA_RX_PGA_HALF_DB_MASK, | 1881 | CDC_WSA_RX_PGA_HALF_DB_MASK, |
| 1983 | CDC_WSA_RX_PGA_HALF_DB_ENABLE); | 1882 | CDC_WSA_RX_PGA_HALF_DB_ENABLE); |
| 1984 | } | 1883 | } |
| 1985 | val = snd_soc_component_read(component, gain_reg); | ||
| 1986 | snd_soc_component_write(component, gain_reg, val); | ||
| 1987 | wsa_macro_config_ear_spkr_gain(component, wsa, | 1884 | wsa_macro_config_ear_spkr_gain(component, wsa, |
| 1988 | event, gain_reg); | 1885 | event, gain_reg); |
| 1989 | break; | 1886 | break; |
| @@ -2114,7 +2011,7 @@ static int wsa_macro_get_ec_hq(struct snd_kcontrol *kcontrol, · 124 unmodified lines | |||
| 2114 | struct snd_ctl_elem_value *ucontrol) | 2011 | struct snd_ctl_elem_value *ucontrol) |
| 2115 | { | 2012 | { |
| 2116 | 2013 | ||
| 2117 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2014 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2118 | int ec_tx = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2015 | int ec_tx = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2119 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2016 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 2120 | 2017 | ||
| @@ -2126,7 +2023,7 @@ static int wsa_macro_get_ec_hq(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 2126 | static int wsa_macro_set_ec_hq(struct snd_kcontrol *kcontrol, | 2023 | static int wsa_macro_set_ec_hq(struct snd_kcontrol *kcontrol, |
| 2127 | struct snd_ctl_elem_value *ucontrol) | 2024 | struct snd_ctl_elem_value *ucontrol) |
| 2128 | { | 2025 | { |
| 2129 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2026 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2130 | int ec_tx = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2027 | int ec_tx = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2131 | int value = ucontrol->value.integer.value[0]; | 2028 | int value = ucontrol->value.integer.value[0]; |
| 2132 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2029 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| @@ -2140,7 +2037,7 @@ static int wsa_macro_get_compander(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 2140 | struct snd_ctl_elem_value *ucontrol) | 2037 | struct snd_ctl_elem_value *ucontrol) |
| 2141 | { | 2038 | { |
| 2142 | 2039 | ||
| 2143 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2040 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2144 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2041 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2145 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2042 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 2146 | 2043 | ||
| @@ -2151,7 +2048,7 @@ static int wsa_macro_get_compander(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2151 | static int wsa_macro_set_compander(struct snd_kcontrol *kcontrol, | 2048 | static int wsa_macro_set_compander(struct snd_kcontrol *kcontrol, |
| 2152 | struct snd_ctl_elem_value *ucontrol) | 2049 | struct snd_ctl_elem_value *ucontrol) |
| 2153 | { | 2050 | { |
| 2154 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2051 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2155 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2052 | int comp = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2156 | int value = ucontrol->value.integer.value[0]; | 2053 | int value = ucontrol->value.integer.value[0]; |
| 2157 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2054 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| @@ -2164,7 +2061,7 @@ static int wsa_macro_set_compander(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 2164 | static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol, | 2061 | static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol, |
| 2165 | struct snd_ctl_elem_value *ucontrol) | 2062 | struct snd_ctl_elem_value *ucontrol) |
| 2166 | { | 2063 | { |
| 2167 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2064 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2168 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2065 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 2169 | 2066 | ||
| 2170 | ucontrol->value.integer.value[0] = wsa->ear_spkr_gain; | 2067 | ucontrol->value.integer.value[0] = wsa->ear_spkr_gain; |
| @@ -2175,7 +2072,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2175 | static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol, | 2072 | static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol, |
| 2176 | struct snd_ctl_elem_value *ucontrol) | 2073 | struct snd_ctl_elem_value *ucontrol) |
| 2177 | { | 2074 | { |
| 2178 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2075 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2179 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2076 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 2180 | 2077 | ||
| 2181 | wsa->ear_spkr_gain = ucontrol->value.integer.value[0]; | 2078 | wsa->ear_spkr_gain = ucontrol->value.integer.value[0]; |
| @@ -2186,8 +2083,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 2186 | static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol, | 2083 | static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol, |
| 2187 | struct snd_ctl_elem_value *ucontrol) | 2084 | struct snd_ctl_elem_value *ucontrol) |
| 2188 | { | 2085 | { |
| 2189 | struct snd_soc_dapm_widget *widget = | 2086 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 2190 | snd_soc_dapm_kcontrol_widget(kcontrol); | ||
| 2191 | struct snd_soc_component *component = | 2087 | struct snd_soc_component *component = |
| 2192 | snd_soc_dapm_to_component(widget->dapm); | 2088 | snd_soc_dapm_to_component(widget->dapm); |
| 2193 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2089 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| @@ -2200,8 +2096,7 @@ static int wsa_macro_rx_mux_get(struct snd_kcontrol *kcontrol, · 6 unmodified lines | |||
| 2200 | static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol, | 2096 | static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol, |
| 2201 | struct snd_ctl_elem_value *ucontrol) | 2097 | struct snd_ctl_elem_value *ucontrol) |
| 2202 | { | 2098 | { |
| 2203 | struct snd_soc_dapm_widget *widget = | 2099 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 2204 | snd_soc_dapm_kcontrol_widget(kcontrol); | ||
| 2205 | struct snd_soc_component *component = | 2100 | struct snd_soc_component *component = |
| 2206 | snd_soc_dapm_to_component(widget->dapm); | 2101 | snd_soc_dapm_to_component(widget->dapm); |
| 2207 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 2102 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| @@ -2259,7 +2154,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *kcontrol, · 51 unmodified lines | |||
| 2259 | static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, | 2154 | static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, |
| 2260 | struct snd_ctl_elem_value *ucontrol) | 2155 | struct snd_ctl_elem_value *ucontrol) |
| 2261 | { | 2156 | { |
| 2262 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2157 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2263 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2158 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 2264 | int path = ((struct soc_mixer_control *)kcontrol->private_value)->shift; | 2159 | int path = ((struct soc_mixer_control *)kcontrol->private_value)->shift; |
| 2265 | 2160 | ||
| @@ -2271,7 +2166,7 @@ static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 2271 | static int wsa_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, | 2166 | static int wsa_macro_soft_clip_enable_put(struct snd_kcontrol *kcontrol, |
| 2272 | struct snd_ctl_elem_value *ucontrol) | 2167 | struct snd_ctl_elem_value *ucontrol) |
| 2273 | { | 2168 | { |
| 2274 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 2169 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2275 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2170 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| 2276 | int path = ((struct soc_mixer_control *) kcontrol->private_value)->shift; | 2171 | int path = ((struct soc_mixer_control *) kcontrol->private_value)->shift; |
| 2277 | 2172 | ||
| @@ -2297,6 +2192,10 @@ static const struct snd_kcontrol_new wsa_macro_snd_controls[] = { · 19 unmodified lines | |||
| 2297 | -84, 40, digital_gain), | 2192 | -84, 40, digital_gain), |
| 2298 | SOC_SINGLE_S8_TLV("WSA_RX1 Digital Volume", CDC_WSA_RX1_RX_VOL_CTL, | 2193 | SOC_SINGLE_S8_TLV("WSA_RX1 Digital Volume", CDC_WSA_RX1_RX_VOL_CTL, |
| 2299 | -84, 40, digital_gain), | 2194 | -84, 40, digital_gain), |
| 2195 | SOC_SINGLE_S8_TLV("WSA_RX0_MIX Digital Volume", CDC_WSA_RX0_RX_VOL_MIX_CTL, | ||
| 2196 | -84, 40, digital_gain), | ||
| 2197 | SOC_SINGLE_S8_TLV("WSA_RX1_MIX Digital Volume", CDC_WSA_RX1_RX_VOL_MIX_CTL, | ||
| 2198 | -84, 40, digital_gain), | ||
| 2300 | 2199 | ||
| 2301 | SOC_SINGLE("WSA_RX0 Digital Mute", CDC_WSA_RX0_RX_PATH_CTL, 4, 1, 0), | 2200 | SOC_SINGLE("WSA_RX0 Digital Mute", CDC_WSA_RX0_RX_PATH_CTL, 4, 1, 0), |
| 2302 | SOC_SINGLE("WSA_RX1 Digital Mute", CDC_WSA_RX1_RX_PATH_CTL, 4, 1, 0), | 2201 | SOC_SINGLE("WSA_RX1 Digital Mute", CDC_WSA_RX1_RX_PATH_CTL, 4, 1, 0), |
| @@ -2331,7 +2230,7 @@ static const struct snd_kcontrol_new rx_mux[WSA_MACRO_RX_MAX] = { · 28 unmodified lines | |||
| 2331 | static int wsa_macro_vi_feed_mixer_get(struct snd_kcontrol *kcontrol, | 2230 | static int wsa_macro_vi_feed_mixer_get(struct snd_kcontrol *kcontrol, |
| 2332 | struct snd_ctl_elem_value *ucontrol) | 2231 | struct snd_ctl_elem_value *ucontrol) |
| 2333 | { | 2232 | { |
| 2334 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 2233 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 2335 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 2234 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 2336 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; | 2235 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; |
| 2337 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2236 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| @@ -2349,7 +2248,7 @@ static int wsa_macro_vi_feed_mixer_get(struct snd_kcontrol *kcontrol, · 11 unmodified lines | |||
| 2349 | static int wsa_macro_vi_feed_mixer_put(struct snd_kcontrol *kcontrol, | 2248 | static int wsa_macro_vi_feed_mixer_put(struct snd_kcontrol *kcontrol, |
| 2350 | struct snd_ctl_elem_value *ucontrol) | 2249 | struct snd_ctl_elem_value *ucontrol) |
| 2351 | { | 2250 | { |
| 2352 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_widget(kcontrol); | 2251 | struct snd_soc_dapm_widget *widget = snd_soc_dapm_kcontrol_to_widget(kcontrol); |
| 2353 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); | 2252 | struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); |
| 2354 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; | 2253 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; |
| 2355 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); | 2254 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(component); |
| @@ -2440,10 +2339,8 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets[] = { · 84 unmodified lines | |||
| 2440 | SND_SOC_DAPM_MIXER("WSA RX_MIX0", SND_SOC_NOPM, 0, 0, NULL, 0), | 2339 | SND_SOC_DAPM_MIXER("WSA RX_MIX0", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2441 | SND_SOC_DAPM_MIXER("WSA RX_MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), | 2340 | SND_SOC_DAPM_MIXER("WSA RX_MIX1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2442 | 2341 | ||
| 2443 | SND_SOC_DAPM_MIXER_E("WSA_RX INT0 MIX", SND_SOC_NOPM, 0, 0, NULL, 0, | 2342 | SND_SOC_DAPM_MIXER("WSA_RX INT0 MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2444 | wsa_macro_enable_main_path, SND_SOC_DAPM_PRE_PMU), | 2343 | SND_SOC_DAPM_MIXER("WSA_RX INT1 MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2445 | SND_SOC_DAPM_MIXER_E("WSA_RX INT1 MIX", SND_SOC_NOPM, 1, 0, NULL, 0, | ||
| 2446 | wsa_macro_enable_main_path, SND_SOC_DAPM_PRE_PMU), | ||
| 2447 | 2344 | ||
| 2448 | SND_SOC_DAPM_MIXER("WSA_RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), | 2345 | SND_SOC_DAPM_MIXER("WSA_RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2449 | SND_SOC_DAPM_MIXER("WSA_RX INT1 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), | 2346 | SND_SOC_DAPM_MIXER("WSA_RX INT1 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| @@ -2494,30 +2391,22 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets_v2_1[] = { · 44 unmodified lines | |||
| 2494 | SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux_v2_1), | 2391 | SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux_v2_1), |
| 2495 | SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux_v2_1), | 2392 | SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux_v2_1), |
| 2496 | SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux_v2_1), | 2393 | SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux_v2_1), |
| 2497 | SND_SOC_DAPM_MUX_E("WSA_RX0 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX0, | 2394 | SND_SOC_DAPM_MUX("WSA_RX0 MIX INP", SND_SOC_NOPM, 0, 0, &rx0_mix_mux_v2_1), |
| 2498 | 0, &rx0_mix_mux_v2_1, wsa_macro_enable_mix_path, | ||
| 2499 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 2500 | SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux_v2_1), | 2395 | SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux_v2_1), |
| 2501 | SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux_v2_1), | 2396 | SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux_v2_1), |
| 2502 | SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux_v2_1), | 2397 | SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux_v2_1), |
| 2503 | SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX1, | 2398 | SND_SOC_DAPM_MUX("WSA_RX1 MIX INP", SND_SOC_NOPM, 0, 0, &rx1_mix_mux_v2_1), |
| 2504 | 0, &rx1_mix_mux_v2_1, wsa_macro_enable_mix_path, | ||
| 2505 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 2506 | }; | 2399 | }; |
| 2507 | 2400 | ||
| 2508 | static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets_v2_5[] = { | 2401 | static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets_v2_5[] = { |
| 2509 | SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux_v2_5), | 2402 | SND_SOC_DAPM_MUX("WSA_RX0 INP0", SND_SOC_NOPM, 0, 0, &rx0_prim_inp0_mux_v2_5), |
| 2510 | SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux_v2_5), | 2403 | SND_SOC_DAPM_MUX("WSA_RX0 INP1", SND_SOC_NOPM, 0, 0, &rx0_prim_inp1_mux_v2_5), |
| 2511 | SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux_v2_5), | 2404 | SND_SOC_DAPM_MUX("WSA_RX0 INP2", SND_SOC_NOPM, 0, 0, &rx0_prim_inp2_mux_v2_5), |
| 2512 | SND_SOC_DAPM_MUX_E("WSA_RX0 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX0, | 2405 | SND_SOC_DAPM_MUX("WSA_RX0 MIX INP", SND_SOC_NOPM, 0, 0, &rx0_mix_mux_v2_5), |
| 2513 | 0, &rx0_mix_mux_v2_5, wsa_macro_enable_mix_path, | ||
| 2514 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 2515 | SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux_v2_5), | 2406 | SND_SOC_DAPM_MUX("WSA_RX1 INP0", SND_SOC_NOPM, 0, 0, &rx1_prim_inp0_mux_v2_5), |
| 2516 | SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux_v2_5), | 2407 | SND_SOC_DAPM_MUX("WSA_RX1 INP1", SND_SOC_NOPM, 0, 0, &rx1_prim_inp1_mux_v2_5), |
| 2517 | SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux_v2_5), | 2408 | SND_SOC_DAPM_MUX("WSA_RX1 INP2", SND_SOC_NOPM, 0, 0, &rx1_prim_inp2_mux_v2_5), |
| 2518 | SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM, WSA_MACRO_RX_MIX1, | 2409 | SND_SOC_DAPM_MUX("WSA_RX1 MIX INP", SND_SOC_NOPM, 0, 0, &rx1_mix_mux_v2_5), |
| 2519 | 0, &rx1_mix_mux_v2_5, wsa_macro_enable_mix_path, | ||
| 2520 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
| 2521 | }; | 2410 | }; |
| 2522 | 2411 | ||
| 2523 | static const struct snd_soc_dapm_route wsa_audio_map[] = { | 2412 | static const struct snd_soc_dapm_route wsa_audio_map[] = { |
| @@ -2553,10 +2442,8 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = { · 29 unmodified lines | |||
| 2553 | {"WSA RX_MIX0", NULL, "WSA RX_MIX0 MUX"}, | 2442 | {"WSA RX_MIX0", NULL, "WSA RX_MIX0 MUX"}, |
| 2554 | {"WSA RX_MIX1", NULL, "WSA RX_MIX1 MUX"}, | 2443 | {"WSA RX_MIX1", NULL, "WSA RX_MIX1 MUX"}, |
| 2555 | 2444 | ||
| 2556 | {"WSA RX0", NULL, "WSA_RX0_CLK"}, | 2445 | {"WSA_RX INT0 MIX", NULL, "WSA_RX0_CLK"}, |
| 2557 | {"WSA RX1", NULL, "WSA_RX1_CLK"}, | 2446 | {"WSA_RX INT1 MIX", NULL, "WSA_RX1_CLK"}, |
| 2558 | {"WSA RX_MIX0", NULL, "WSA_RX_MIX0_CLK"}, | ||
| 2559 | {"WSA RX_MIX1", NULL, "WSA_RX_MIX1_CLK"}, | ||
| 2560 | 2447 | ||
| 2561 | {"WSA_RX0 INP0", "RX0", "WSA RX0"}, | 2448 | {"WSA_RX0 INP0", "RX0", "WSA RX0"}, |
| 2562 | {"WSA_RX0 INP0", "RX1", "WSA RX1"}, | 2449 | {"WSA_RX0 INP0", "RX1", "WSA RX1"}, |
| @@ -2586,6 +2473,8 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = { · 23 unmodified lines | |||
| 2586 | {"WSA_RX0 MIX INP", "RX1", "WSA RX1"}, | 2473 | {"WSA_RX0 MIX INP", "RX1", "WSA RX1"}, |
| 2587 | {"WSA_RX0 MIX INP", "RX_MIX0", "WSA RX_MIX0"}, | 2474 | {"WSA_RX0 MIX INP", "RX_MIX0", "WSA RX_MIX0"}, |
| 2588 | {"WSA_RX0 MIX INP", "RX_MIX1", "WSA RX_MIX1"}, | 2475 | {"WSA_RX0 MIX INP", "RX_MIX1", "WSA RX_MIX1"}, |
| 2476 | {"WSA_RX0 MIX INP", NULL, "WSA_RX0_CLK"}, | ||
| 2477 | {"WSA_RX0 MIX INP", NULL, "WSA_RX_MIX0_CLK"}, | ||
| 2589 | {"WSA_RX INT0 SEC MIX", NULL, "WSA_RX0 MIX INP"}, | 2478 | {"WSA_RX INT0 SEC MIX", NULL, "WSA_RX0 MIX INP"}, |
| 2590 | 2479 | ||
| 2591 | {"WSA_RX INT0 SEC MIX", NULL, "WSA_RX INT0 MIX"}, | 2480 | {"WSA_RX INT0 SEC MIX", NULL, "WSA_RX INT0 MIX"}, |
| @@ -2625,6 +2514,8 @@ static const struct snd_soc_dapm_route wsa_audio_map[] = { · 33 unmodified lines | |||
| 2625 | {"WSA_RX1 MIX INP", "RX1", "WSA RX1"}, | 2514 | {"WSA_RX1 MIX INP", "RX1", "WSA RX1"}, |
| 2626 | {"WSA_RX1 MIX INP", "RX_MIX0", "WSA RX_MIX0"}, | 2515 | {"WSA_RX1 MIX INP", "RX_MIX0", "WSA RX_MIX0"}, |
| 2627 | {"WSA_RX1 MIX INP", "RX_MIX1", "WSA RX_MIX1"}, | 2516 | {"WSA_RX1 MIX INP", "RX_MIX1", "WSA RX_MIX1"}, |
| 2517 | {"WSA_RX1 MIX INP", NULL, "WSA_RX1_CLK"}, | ||
| 2518 | {"WSA_RX1 MIX INP", NULL, "WSA_RX_MIX1_CLK"}, | ||
| 2628 | {"WSA_RX INT1 SEC MIX", NULL, "WSA_RX1 MIX INP"}, | 2519 | {"WSA_RX INT1 SEC MIX", NULL, "WSA_RX1 MIX INP"}, |
| 2629 | 2520 | ||
| 2630 | {"WSA_RX INT1 SEC MIX", NULL, "WSA_RX INT1 MIX"}, | 2521 | {"WSA_RX INT1 SEC MIX", NULL, "WSA_RX INT1 MIX"}, |
| @@ -2665,7 +2556,7 @@ static int wsa_swrm_clock(struct wsa_macro *wsa, bool enable) · 34 unmodified lines | |||
| 2665 | 2556 | ||
| 2666 | static int wsa_macro_component_probe(struct snd_soc_component *comp) | 2557 | static int wsa_macro_component_probe(struct snd_soc_component *comp) |
| 2667 | { | 2558 | { |
| 2668 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(comp); | 2559 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(comp); |
| 2669 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(comp); | 2560 | struct wsa_macro *wsa = snd_soc_component_get_drvdata(comp); |
| 2670 | const struct snd_soc_dapm_widget *widgets; | 2561 | const struct snd_soc_dapm_widget *widgets; |
| 2671 | unsigned int num_widgets; | 2562 | unsigned int num_widgets; |
| @@ -541,10 +541,8 @@ EXPORT_SYMBOL_GPL(madera_domain_clk_ev); · 540 unmodified lines | |||
| 541 | int madera_out1_demux_put(struct snd_kcontrol *kcontrol, | 541 | int madera_out1_demux_put(struct snd_kcontrol *kcontrol, |
| 542 | struct snd_ctl_elem_value *ucontrol) | 542 | struct snd_ctl_elem_value *ucontrol) |
| 543 | { | 543 | { |
| 544 | struct snd_soc_component *component = | 544 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 545 | snd_soc_dapm_kcontrol_component(kcontrol); | 545 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 546 | struct snd_soc_dapm_context *dapm = | ||
| 547 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 548 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 546 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 549 | struct madera *madera = priv->madera; | 547 | struct madera *madera = priv->madera; |
| 550 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 548 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| @@ -632,8 +630,7 @@ EXPORT_SYMBOL_GPL(madera_out1_demux_put); · 81 unmodified lines | |||
| 632 | int madera_out1_demux_get(struct snd_kcontrol *kcontrol, | 630 | int madera_out1_demux_get(struct snd_kcontrol *kcontrol, |
| 633 | struct snd_ctl_elem_value *ucontrol) | 631 | struct snd_ctl_elem_value *ucontrol) |
| 634 | { | 632 | { |
| 635 | struct snd_soc_component *component = | 633 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 636 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 637 | unsigned int val; | 634 | unsigned int val; |
| 638 | 635 | ||
| 639 | val = snd_soc_component_read(component, MADERA_OUTPUT_ENABLES_1); | 636 | val = snd_soc_component_read(component, MADERA_OUTPUT_ENABLES_1); |
| @@ -648,10 +645,8 @@ EXPORT_SYMBOL_GPL(madera_out1_demux_get); · 8 unmodified lines | |||
| 648 | static int madera_inmux_put(struct snd_kcontrol *kcontrol, | 645 | static int madera_inmux_put(struct snd_kcontrol *kcontrol, |
| 649 | struct snd_ctl_elem_value *ucontrol) | 646 | struct snd_ctl_elem_value *ucontrol) |
| 650 | { | 647 | { |
| 651 | struct snd_soc_component *component = | 648 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 652 | snd_soc_dapm_kcontrol_component(kcontrol); | 649 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 653 | struct snd_soc_dapm_context *dapm = | ||
| 654 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 655 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 650 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 656 | struct madera *madera = priv->madera; | 651 | struct madera *madera = priv->madera; |
| 657 | struct regmap *regmap = madera->regmap; | 652 | struct regmap *regmap = madera->regmap; |
| @@ -873,8 +868,7 @@ static bool madera_can_change_grp_rate(const struct madera_priv *priv, · 215 unmodified lines | |||
| 873 | static int madera_adsp_rate_get(struct snd_kcontrol *kcontrol, | 868 | static int madera_adsp_rate_get(struct snd_kcontrol *kcontrol, |
| 874 | struct snd_ctl_elem_value *ucontrol) | 869 | struct snd_ctl_elem_value *ucontrol) |
| 875 | { | 870 | { |
| 876 | struct snd_soc_component *component = | 871 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 877 | snd_soc_kcontrol_component(kcontrol); | ||
| 878 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 872 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 879 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 873 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 880 | unsigned int cached_rate; | 874 | unsigned int cached_rate; |
| @@ -894,8 +888,7 @@ static int madera_adsp_rate_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 894 | static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol, | 888 | static int madera_adsp_rate_put(struct snd_kcontrol *kcontrol, |
| 895 | struct snd_ctl_elem_value *ucontrol) | 889 | struct snd_ctl_elem_value *ucontrol) |
| 896 | { | 890 | { |
| 897 | struct snd_soc_component *component = | 891 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 898 | snd_soc_kcontrol_component(kcontrol); | ||
| 899 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 892 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 900 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 893 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 901 | const int adsp_num = e->shift_l; | 894 | const int adsp_num = e->shift_l; |
| @@ -1054,8 +1047,7 @@ EXPORT_SYMBOL_GPL(madera_set_adsp_clk); · 152 unmodified lines | |||
| 1054 | int madera_rate_put(struct snd_kcontrol *kcontrol, | 1047 | int madera_rate_put(struct snd_kcontrol *kcontrol, |
| 1055 | struct snd_ctl_elem_value *ucontrol) | 1048 | struct snd_ctl_elem_value *ucontrol) |
| 1056 | { | 1049 | { |
| 1057 | struct snd_soc_component *component = | 1050 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1058 | snd_soc_kcontrol_component(kcontrol); | ||
| 1059 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 1051 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 1060 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 1052 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 1061 | unsigned int item = ucontrol->value.enumerated.item[0]; | 1053 | unsigned int item = ucontrol->value.enumerated.item[0]; |
| @@ -1214,8 +1206,7 @@ int madera_init_outputs(struct snd_soc_component *component, · 152 unmodified lines | |||
| 1214 | const struct snd_soc_dapm_route *routes, | 1206 | const struct snd_soc_dapm_route *routes, |
| 1215 | int n_mono_routes, int n_real) | 1207 | int n_mono_routes, int n_real) |
| 1216 | { | 1208 | { |
| 1217 | struct snd_soc_dapm_context *dapm = | 1209 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1218 | snd_soc_component_get_dapm(component); | ||
| 1219 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 1210 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 1220 | struct madera *madera = priv->madera; | 1211 | struct madera *madera = priv->madera; |
| 1221 | const struct madera_codec_pdata *pdata = &madera->pdata.codec; | 1212 | const struct madera_codec_pdata *pdata = &madera->pdata.codec; |
| @@ -2163,10 +2154,8 @@ EXPORT_SYMBOL_GPL(madera_output_anc_src); · 941 unmodified lines | |||
| 2163 | int madera_dfc_put(struct snd_kcontrol *kcontrol, | 2154 | int madera_dfc_put(struct snd_kcontrol *kcontrol, |
| 2164 | struct snd_ctl_elem_value *ucontrol) | 2155 | struct snd_ctl_elem_value *ucontrol) |
| 2165 | { | 2156 | { |
| 2166 | struct snd_soc_component *component = | 2157 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2167 | snd_soc_kcontrol_component(kcontrol); | 2158 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2168 | struct snd_soc_dapm_context *dapm = | ||
| 2169 | snd_soc_component_get_dapm(component); | ||
| 2170 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 2159 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 2171 | unsigned int reg = e->reg; | 2160 | unsigned int reg = e->reg; |
| 2172 | unsigned int val; | 2161 | unsigned int val; |
| @@ -2196,10 +2185,8 @@ int madera_lp_mode_put(struct snd_kcontrol *kcontrol, · 23 unmodified lines | |||
| 2196 | { | 2185 | { |
| 2197 | struct soc_mixer_control *mc = | 2186 | struct soc_mixer_control *mc = |
| 2198 | (struct soc_mixer_control *)kcontrol->private_value; | 2187 | (struct soc_mixer_control *)kcontrol->private_value; |
| 2199 | struct snd_soc_component *component = | 2188 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 2200 | snd_soc_kcontrol_component(kcontrol); | 2189 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2201 | struct snd_soc_dapm_context *dapm = | ||
| 2202 | snd_soc_component_get_dapm(component); | ||
| 2203 | unsigned int val, mask; | 2190 | unsigned int val, mask; |
| 2204 | int ret; | 2191 | int ret; |
| 2205 | 2192 | ||
| @@ -3241,8 +3228,7 @@ static int madera_dai_set_sysclk(struct snd_soc_dai *dai, · 1035 unmodified lines | |||
| 3241 | int clk_id, unsigned int freq, int dir) | 3228 | int clk_id, unsigned int freq, int dir) |
| 3242 | { | 3229 | { |
| 3243 | struct snd_soc_component *component = dai->component; | 3230 | struct snd_soc_component *component = dai->component; |
| 3244 | struct snd_soc_dapm_context *dapm = | 3231 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3245 | snd_soc_component_get_dapm(component); | ||
| 3246 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 3232 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 3247 | struct madera_dai_priv *dai_priv = &priv->dai[dai->id - 1]; | 3233 | struct madera_dai_priv *dai_priv = &priv->dai[dai->id - 1]; |
| 3248 | struct snd_soc_dapm_route routes[2]; | 3234 | struct snd_soc_dapm_route routes[2]; |
| @@ -4742,8 +4728,7 @@ static bool madera_eq_filter_unstable(bool mode, __be16 _a, __be16 _b) · 1493 unmodified lines | |||
| 4742 | int madera_eq_coeff_put(struct snd_kcontrol *kcontrol, | 4728 | int madera_eq_coeff_put(struct snd_kcontrol *kcontrol, |
| 4743 | struct snd_ctl_elem_value *ucontrol) | 4729 | struct snd_ctl_elem_value *ucontrol) |
| 4744 | { | 4730 | { |
| 4745 | struct snd_soc_component *component = | 4731 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 4746 | snd_soc_kcontrol_component(kcontrol); | ||
| 4747 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 4732 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 4748 | struct madera *madera = priv->madera; | 4733 | struct madera *madera = priv->madera; |
| 4749 | struct soc_bytes *params = (void *)kcontrol->private_value; | 4734 | struct soc_bytes *params = (void *)kcontrol->private_value; |
| @@ -4789,8 +4774,7 @@ EXPORT_SYMBOL_GPL(madera_eq_coeff_put); · 39 unmodified lines | |||
| 4789 | int madera_lhpf_coeff_put(struct snd_kcontrol *kcontrol, | 4774 | int madera_lhpf_coeff_put(struct snd_kcontrol *kcontrol, |
| 4790 | struct snd_ctl_elem_value *ucontrol) | 4775 | struct snd_ctl_elem_value *ucontrol) |
| 4791 | { | 4776 | { |
| 4792 | struct snd_soc_component *component = | 4777 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 4793 | snd_soc_kcontrol_component(kcontrol); | ||
| 4794 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); | 4778 | struct madera_priv *priv = snd_soc_component_get_drvdata(component); |
| 4795 | struct madera *madera = priv->madera; | 4779 | struct madera *madera = priv->madera; |
| 4796 | __be16 *data = (__be16 *)ucontrol->value.bytes.data; | 4780 | __be16 *data = (__be16 *)ucontrol->value.bytes.data; |
| @@ -42,7 +42,7 @@ static const DECLARE_TLV_DB_SCALE(speaker_gain_tlv, 600, 600, 0); · 41 unmodified lines | |||
| 42 | static int speaker_gain_control_get(struct snd_kcontrol *kcontrol, | 42 | static int speaker_gain_control_get(struct snd_kcontrol *kcontrol, |
| 43 | struct snd_ctl_elem_value *ucontrol) | 43 | struct snd_ctl_elem_value *ucontrol) |
| 44 | { | 44 | { |
| 45 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 45 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 46 | struct max9759 *priv = snd_soc_component_get_drvdata(c); | 46 | struct max9759 *priv = snd_soc_component_get_drvdata(c); |
| 47 | 47 | ||
| 48 | ucontrol->value.integer.value[0] = priv->gain; | 48 | ucontrol->value.integer.value[0] = priv->gain; |
| @@ -61,7 +61,7 @@ static const bool speaker_gain_table[4][2] = { · 12 unmodified lines | |||
| 61 | static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, | 61 | static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, |
| 62 | struct snd_ctl_elem_value *ucontrol) | 62 | struct snd_ctl_elem_value *ucontrol) |
| 63 | { | 63 | { |
| 64 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 64 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 65 | struct max9759 *priv = snd_soc_component_get_drvdata(c); | 65 | struct max9759 *priv = snd_soc_component_get_drvdata(c); |
| 66 | 66 | ||
| 67 | if (ucontrol->value.integer.value[0] < 0 || | 67 | if (ucontrol->value.integer.value[0] < 0 || |
| @@ -83,7 +83,7 @@ static int speaker_gain_control_put(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 83 | static int speaker_mute_get(struct snd_kcontrol *kcontrol, | 83 | static int speaker_mute_get(struct snd_kcontrol *kcontrol, |
| 84 | struct snd_ctl_elem_value *ucontrol) | 84 | struct snd_ctl_elem_value *ucontrol) |
| 85 | { | 85 | { |
| 86 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 86 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 87 | struct max9759 *priv = snd_soc_component_get_drvdata(c); | 87 | struct max9759 *priv = snd_soc_component_get_drvdata(c); |
| 88 | 88 | ||
| 89 | ucontrol->value.integer.value[0] = !priv->is_mute; | 89 | ucontrol->value.integer.value[0] = !priv->is_mute; |
| @@ -94,7 +94,7 @@ static int speaker_mute_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 94 | static int speaker_mute_put(struct snd_kcontrol *kcontrol, | 94 | static int speaker_mute_put(struct snd_kcontrol *kcontrol, |
| 95 | struct snd_ctl_elem_value *ucontrol) | 95 | struct snd_ctl_elem_value *ucontrol) |
| 96 | { | 96 | { |
| 97 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 97 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 98 | struct max9759 *priv = snd_soc_component_get_drvdata(c); | 98 | struct max9759 *priv = snd_soc_component_get_drvdata(c); |
| 99 | 99 | ||
| 100 | priv->is_mute = !ucontrol->value.integer.value[0]; | 100 | priv->is_mute = !ucontrol->value.integer.value[0]; |
| @@ -40,7 +40,7 @@ static const struct reg_default max9768_default_regs[] = { · 39 unmodified lines | |||
| 40 | static int max9768_get_gpio(struct snd_kcontrol *kcontrol, | 40 | static int max9768_get_gpio(struct snd_kcontrol *kcontrol, |
| 41 | struct snd_ctl_elem_value *ucontrol) | 41 | struct snd_ctl_elem_value *ucontrol) |
| 42 | { | 42 | { |
| 43 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 43 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 44 | struct max9768 *max9768 = snd_soc_component_get_drvdata(c); | 44 | struct max9768 *max9768 = snd_soc_component_get_drvdata(c); |
| 45 | int val = gpiod_get_value_cansleep(max9768->mute); | 45 | int val = gpiod_get_value_cansleep(max9768->mute); |
| 46 | 46 | ||
| @@ -52,7 +52,7 @@ static int max9768_get_gpio(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 52 | static int max9768_set_gpio(struct snd_kcontrol *kcontrol, | 52 | static int max9768_set_gpio(struct snd_kcontrol *kcontrol, |
| 53 | struct snd_ctl_elem_value *ucontrol) | 53 | struct snd_ctl_elem_value *ucontrol) |
| 54 | { | 54 | { |
| 55 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 55 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 56 | struct max9768 *max9768 = snd_soc_component_get_drvdata(c); | 56 | struct max9768 *max9768 = snd_soc_component_get_drvdata(c); |
| 57 | bool val = !ucontrol->value.integer.value[0]; | 57 | bool val = !ucontrol->value.integer.value[0]; |
| 58 | int ret; | 58 | int ret; |
| @@ -380,7 +380,7 @@ static SOC_ENUM_SINGLE_DECL(max98088_dai1_adc_filter_enum, · 379 unmodified lines | |||
| 380 | static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol, | 380 | static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol, |
| 381 | struct snd_ctl_elem_value *ucontrol) | 381 | struct snd_ctl_elem_value *ucontrol) |
| 382 | { | 382 | { |
| 383 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 383 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 384 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 384 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 385 | unsigned int sel = ucontrol->value.integer.value[0]; | 385 | unsigned int sel = ucontrol->value.integer.value[0]; |
| 386 | 386 | ||
| @@ -394,7 +394,7 @@ static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 394 | static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol, | 394 | static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol, |
| 395 | struct snd_ctl_elem_value *ucontrol) | 395 | struct snd_ctl_elem_value *ucontrol) |
| 396 | { | 396 | { |
| 397 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 397 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 398 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 398 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 399 | 399 | ||
| 400 | ucontrol->value.integer.value[0] = max98088->mic1pre; | 400 | ucontrol->value.integer.value[0] = max98088->mic1pre; |
| @@ -404,7 +404,7 @@ static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 404 | static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol, | 404 | static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol, |
| 405 | struct snd_ctl_elem_value *ucontrol) | 405 | struct snd_ctl_elem_value *ucontrol) |
| 406 | { | 406 | { |
| 407 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 407 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 408 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 408 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 409 | unsigned int sel = ucontrol->value.integer.value[0]; | 409 | unsigned int sel = ucontrol->value.integer.value[0]; |
| 410 | 410 | ||
| @@ -418,7 +418,7 @@ static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 418 | static int max98088_mic2pre_get(struct snd_kcontrol *kcontrol, | 418 | static int max98088_mic2pre_get(struct snd_kcontrol *kcontrol, |
| 419 | struct snd_ctl_elem_value *ucontrol) | 419 | struct snd_ctl_elem_value *ucontrol) |
| 420 | { | 420 | { |
| 421 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 421 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 422 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 422 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 423 | 423 | ||
| 424 | ucontrol->value.integer.value[0] = max98088->mic2pre; | 424 | ucontrol->value.integer.value[0] = max98088->mic2pre; |
| @@ -1296,6 +1296,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, · 871 unmodified lines | |||
| 1296 | enum snd_soc_bias_level level) | 1296 | enum snd_soc_bias_level level) |
| 1297 | { | 1297 | { |
| 1298 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 1298 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 1299 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1299 | int ret; | 1300 | int ret; |
| 1300 | 1301 | ||
| 1301 | switch (level) { | 1302 | switch (level) { |
| @@ -1311,8 +1312,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines | |||
| 1311 | * enable it. | 1312 | * enable it. |
| 1312 | */ | 1313 | */ |
| 1313 | if (!IS_ERR(max98088->mclk)) { | 1314 | if (!IS_ERR(max98088->mclk)) { |
| 1314 | if (snd_soc_component_get_bias_level(component) == | 1315 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1315 | SND_SOC_BIAS_ON) { | ||
| 1316 | clk_disable_unprepare(max98088->mclk); | 1316 | clk_disable_unprepare(max98088->mclk); |
| 1317 | } else { | 1317 | } else { |
| 1318 | ret = clk_prepare_enable(max98088->mclk); | 1318 | ret = clk_prepare_enable(max98088->mclk); |
| @@ -1323,7 +1323,7 @@ static int max98088_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines | |||
| 1323 | break; | 1323 | break; |
| 1324 | 1324 | ||
| 1325 | case SND_SOC_BIAS_STANDBY: | 1325 | case SND_SOC_BIAS_STANDBY: |
| 1326 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 1326 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 1327 | regcache_sync(max98088->regmap); | 1327 | regcache_sync(max98088->regmap); |
| 1328 | 1328 | ||
| 1329 | snd_soc_component_update_bits(component, M98088_REG_4C_PWR_EN_IN, | 1329 | snd_soc_component_update_bits(component, M98088_REG_4C_PWR_EN_IN, |
| @@ -1500,7 +1500,7 @@ static void max98088_setup_eq2(struct snd_soc_component *component) · 170 unmodified lines | |||
| 1500 | static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol, | 1500 | static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol, |
| 1501 | struct snd_ctl_elem_value *ucontrol) | 1501 | struct snd_ctl_elem_value *ucontrol) |
| 1502 | { | 1502 | { |
| 1503 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1503 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1504 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 1504 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 1505 | struct max98088_pdata *pdata = max98088->pdata; | 1505 | struct max98088_pdata *pdata = max98088->pdata; |
| 1506 | int channel = max98088_get_channel(component, kcontrol->id.name); | 1506 | int channel = max98088_get_channel(component, kcontrol->id.name); |
| @@ -1532,7 +1532,7 @@ static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol, · 25 unmodified lines | |||
| 1532 | static int max98088_get_eq_enum(struct snd_kcontrol *kcontrol, | 1532 | static int max98088_get_eq_enum(struct snd_kcontrol *kcontrol, |
| 1533 | struct snd_ctl_elem_value *ucontrol) | 1533 | struct snd_ctl_elem_value *ucontrol) |
| 1534 | { | 1534 | { |
| 1535 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1535 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1536 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); | 1536 | struct max98088_priv *max98088 = snd_soc_component_get_drvdata(component); |
| 1537 | int channel = max98088_get_channel(component, kcontrol->id.name); | 1537 | int channel = max98088_get_channel(component, kcontrol->id.name); |
| 1538 | struct max98088_cdata *cdata; | 1538 | struct max98088_cdata *cdata; |
| @@ -347,7 +347,7 @@ static const DECLARE_TLV_DB_RANGE(max98090_rcv_lout_tlv, · 346 unmodified lines | |||
| 347 | static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol, | 347 | static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol, |
| 348 | struct snd_ctl_elem_value *ucontrol) | 348 | struct snd_ctl_elem_value *ucontrol) |
| 349 | { | 349 | { |
| 350 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 350 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 351 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); | 351 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); |
| 352 | struct soc_mixer_control *mc = | 352 | struct soc_mixer_control *mc = |
| 353 | (struct soc_mixer_control *)kcontrol->private_value; | 353 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -387,7 +387,7 @@ static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol, · 33 unmodified lines | |||
| 387 | static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol, | 387 | static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol, |
| 388 | struct snd_ctl_elem_value *ucontrol) | 388 | struct snd_ctl_elem_value *ucontrol) |
| 389 | { | 389 | { |
| 390 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 390 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 391 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); | 391 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); |
| 392 | struct soc_mixer_control *mc = | 392 | struct soc_mixer_control *mc = |
| 393 | (struct soc_mixer_control *)kcontrol->private_value; | 393 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -817,6 +817,16 @@ static SOC_ENUM_SINGLE_VIRT_DECL(dmic_mux_enum, dmic_mux_text); · 423 unmodified lines | |||
| 817 | static const struct snd_kcontrol_new max98090_dmic_mux = | 817 | static const struct snd_kcontrol_new max98090_dmic_mux = |
| 818 | SOC_DAPM_ENUM("DMIC Mux", dmic_mux_enum); | 818 | SOC_DAPM_ENUM("DMIC Mux", dmic_mux_enum); |
| 819 | 819 | ||
| 820 | static const char * const dmic_mX_mux_text[] = { "Enable", "Disable" }; | ||
| 821 | |||
| 822 | static SOC_ENUM_SINGLE_VIRT_DECL(dmic_m1_enum, dmic_mX_mux_text); | ||
| 823 | static const struct snd_kcontrol_new max98090_dmic_m1_mux = | ||
| 824 | SOC_DAPM_ENUM("DMIC M1 Mux", dmic_m1_enum); | ||
| 825 | |||
| 826 | static SOC_ENUM_SINGLE_VIRT_DECL(dmic_m2_enum, dmic_mX_mux_text); | ||
| 827 | static const struct snd_kcontrol_new max98090_dmic_m2_mux = | ||
| 828 | SOC_DAPM_ENUM("DMIC M2 Mux", dmic_m2_enum); | ||
| 829 | |||
| 820 | /* LINEA mixer switch */ | 830 | /* LINEA mixer switch */ |
| 821 | static const struct snd_kcontrol_new max98090_linea_mixer_controls[] = { | 831 | static const struct snd_kcontrol_new max98090_linea_mixer_controls[] = { |
| 822 | SOC_DAPM_SINGLE("IN1 Switch", M98090_REG_LINE_INPUT_CONFIG, | 832 | SOC_DAPM_SINGLE("IN1 Switch", M98090_REG_LINE_INPUT_CONFIG, |
| @@ -1106,6 +1116,9 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = { · 283 unmodified lines | |||
| 1106 | 1116 | ||
| 1107 | SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &max98090_dmic_mux), | 1117 | SND_SOC_DAPM_MUX("DMIC Mux", SND_SOC_NOPM, 0, 0, &max98090_dmic_mux), |
| 1108 | 1118 | ||
| 1119 | SND_SOC_DAPM_MUX("DMIC M1 Mux", SND_SOC_NOPM, 0, 0, | ||
| 1120 | &max98090_dmic_m1_mux), | ||
| 1121 | |||
| 1109 | SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL, | 1122 | SND_SOC_DAPM_PGA_E("MIC1 Input", M98090_REG_MIC1_INPUT_LEVEL, |
| 1110 | M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event, | 1123 | M98090_MIC_PA1EN_SHIFT, 0, NULL, 0, max98090_micinput_event, |
| 1111 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 1124 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
| @@ -1144,7 +1157,7 @@ static const struct snd_soc_dapm_widget max98090_dapm_widgets[] = { · 32 unmodified lines | |||
| 1144 | 1157 | ||
| 1145 | SND_SOC_DAPM_AIF_OUT("AIFOUTL", "HiFi Capture", 0, | 1158 | SND_SOC_DAPM_AIF_OUT("AIFOUTL", "HiFi Capture", 0, |
| 1146 | SND_SOC_NOPM, 0, 0), | 1159 | SND_SOC_NOPM, 0, 0), |
| 1147 | SND_SOC_DAPM_AIF_OUT("AIFOUTR", "HiFi Capture", 1, | 1160 | SND_SOC_DAPM_AIF_OUT("AIFOUTR", "HiFi Capture", 0, |
| 1148 | SND_SOC_NOPM, 0, 0), | 1161 | SND_SOC_NOPM, 0, 0), |
| 1149 | 1162 | ||
| 1150 | SND_SOC_DAPM_MUX("LBENL Mux", SND_SOC_NOPM, | 1163 | SND_SOC_DAPM_MUX("LBENL Mux", SND_SOC_NOPM, |
| @@ -1241,6 +1254,14 @@ static const struct snd_soc_dapm_widget max98091_dapm_widgets[] = { · 90 unmodified lines | |||
| 1241 | SND_SOC_DAPM_POST_PMU), | 1254 | SND_SOC_DAPM_POST_PMU), |
| 1242 | SND_SOC_DAPM_SUPPLY("DMIC34_HPF", M98090_REG_FILTER_CONFIG, | 1255 | SND_SOC_DAPM_SUPPLY("DMIC34_HPF", M98090_REG_FILTER_CONFIG, |
| 1243 | M98090_FLT_DMIC34HPF_SHIFT, 0, NULL, 0), | 1256 | M98090_FLT_DMIC34HPF_SHIFT, 0, NULL, 0), |
| 1257 | |||
| 1258 | SND_SOC_DAPM_MUX("DMIC M2 Mux", SND_SOC_NOPM, 0, 0, | ||
| 1259 | &max98090_dmic_m2_mux), | ||
| 1260 | |||
| 1261 | SND_SOC_DAPM_AIF_OUT("AIFOUT2L", "HiFi Capture", 0, | ||
| 1262 | SND_SOC_NOPM, 0, 0), | ||
| 1263 | SND_SOC_DAPM_AIF_OUT("AIFOUT2R", "HiFi Capture", 0, | ||
| 1264 | SND_SOC_NOPM, 0, 0), | ||
| 1244 | }; | 1265 | }; |
| 1245 | 1266 | ||
| 1246 | static const struct snd_soc_dapm_route max98090_dapm_routes[] = { | 1267 | static const struct snd_soc_dapm_route max98090_dapm_routes[] = { |
| @@ -1304,10 +1325,12 @@ static const struct snd_soc_dapm_route max98090_dapm_routes[] = { · 57 unmodified lines | |||
| 1304 | {"ADCL", NULL, "SHDN"}, | 1325 | {"ADCL", NULL, "SHDN"}, |
| 1305 | {"ADCR", NULL, "SHDN"}, | 1326 | {"ADCR", NULL, "SHDN"}, |
| 1306 | 1327 | ||
| 1328 | {"DMIC M1 Mux", "Enable", "DMICL"}, | ||
| 1329 | {"DMIC M1 Mux", "Enable", "DMICR"}, | ||
| 1330 | |||
| 1307 | {"DMIC Mux", "ADC", "ADCL"}, | 1331 | {"DMIC Mux", "ADC", "ADCL"}, |
| 1308 | {"DMIC Mux", "ADC", "ADCR"}, | 1332 | {"DMIC Mux", "ADC", "ADCR"}, |
| 1309 | {"DMIC Mux", "DMIC", "DMICL"}, | 1333 | {"DMIC Mux", "DMIC", "DMIC M1 Mux"}, |
| 1310 | {"DMIC Mux", "DMIC", "DMICR"}, | ||
| 1311 | 1334 | ||
| 1312 | {"LBENL Mux", "Normal", "DMIC Mux"}, | 1335 | {"LBENL Mux", "Normal", "DMIC Mux"}, |
| 1313 | {"LBENL Mux", "Loopback", "LTENL Mux"}, | 1336 | {"LBENL Mux", "Loopback", "LTENL Mux"}, |
| @@ -1431,12 +1454,22 @@ static const struct snd_soc_dapm_route max98091_dapm_routes[] = { · 117 unmodified lines | |||
| 1431 | {"DMIC4", NULL, "DMIC4_ENA"}, | 1454 | {"DMIC4", NULL, "DMIC4_ENA"}, |
| 1432 | {"DMIC3", NULL, "DMIC34_HPF"}, | 1455 | {"DMIC3", NULL, "DMIC34_HPF"}, |
| 1433 | {"DMIC4", NULL, "DMIC34_HPF"}, | 1456 | {"DMIC4", NULL, "DMIC34_HPF"}, |
| 1457 | |||
| 1458 | {"DMIC M2 Mux", "Enable", "DMIC3"}, | ||
| 1459 | {"DMIC M2 Mux", "Enable", "DMIC4"}, | ||
| 1460 | |||
| 1461 | {"AIFOUT2L", NULL, "DMIC M2 Mux"}, | ||
| 1462 | {"AIFOUT2R", NULL, "DMIC M2 Mux"}, | ||
| 1463 | {"AIFOUT2L", NULL, "SHDN"}, | ||
| 1464 | {"AIFOUT2R", NULL, "SHDN"}, | ||
| 1465 | {"AIFOUT2L", NULL, "SDOEN"}, | ||
| 1466 | {"AIFOUT2R", NULL, "SDOEN"}, | ||
| 1434 | }; | 1467 | }; |
| 1435 | 1468 | ||
| 1436 | static int max98090_add_widgets(struct snd_soc_component *component) | 1469 | static int max98090_add_widgets(struct snd_soc_component *component) |
| 1437 | { | 1470 | { |
| 1438 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); | 1471 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); |
| 1439 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1472 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1440 | 1473 | ||
| 1441 | snd_soc_add_component_controls(component, max98090_snd_controls, | 1474 | snd_soc_add_component_controls(component, max98090_snd_controls, |
| 1442 | ARRAY_SIZE(max98090_snd_controls)); | 1475 | ARRAY_SIZE(max98090_snd_controls)); |
| @@ -1718,6 +1751,7 @@ static int max98090_set_bias_level(struct snd_soc_component *component, · 275 unmodified lines | |||
| 1718 | enum snd_soc_bias_level level) | 1751 | enum snd_soc_bias_level level) |
| 1719 | { | 1752 | { |
| 1720 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); | 1753 | struct max98090_priv *max98090 = snd_soc_component_get_drvdata(component); |
| 1754 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1721 | int ret; | 1755 | int ret; |
| 1722 | 1756 | ||
| 1723 | switch (level) { | 1757 | switch (level) { |
| @@ -1735,7 +1769,7 @@ static int max98090_set_bias_level(struct snd_soc_component *component, · 11 unmodified lines | |||
| 1735 | if (IS_ERR(max98090->mclk)) | 1769 | if (IS_ERR(max98090->mclk)) |
| 1736 | break; | 1770 | break; |
| 1737 | 1771 | ||
| 1738 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { | 1772 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1739 | clk_disable_unprepare(max98090->mclk); | 1773 | clk_disable_unprepare(max98090->mclk); |
| 1740 | } else { | 1774 | } else { |
| 1741 | ret = clk_prepare_enable(max98090->mclk); | 1775 | ret = clk_prepare_enable(max98090->mclk); |
| @@ -1745,7 +1779,7 @@ static int max98090_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 1745 | break; | 1779 | break; |
| 1746 | 1780 | ||
| 1747 | case SND_SOC_BIAS_STANDBY: | 1781 | case SND_SOC_BIAS_STANDBY: |
| 1748 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1782 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1749 | ret = regcache_sync(max98090->regmap); | 1783 | ret = regcache_sync(max98090->regmap); |
| 1750 | if (ret != 0) { | 1784 | if (ret != 0) { |
| 1751 | dev_err(component->dev, | 1785 | dev_err(component->dev, |
| @@ -2371,11 +2405,11 @@ static struct snd_soc_dai_driver max98090_dai = { · 619 unmodified lines | |||
| 2371 | .capture = { | 2405 | .capture = { |
| 2372 | .stream_name = "HiFi Capture", | 2406 | .stream_name = "HiFi Capture", |
| 2373 | .channels_min = 1, | 2407 | .channels_min = 1, |
| 2374 | .channels_max = 2, | 2408 | .channels_max = 4, |
| 2375 | .rates = MAX98090_RATES, | 2409 | .rates = MAX98090_RATES, |
| 2376 | .formats = MAX98090_FORMATS, | 2410 | .formats = MAX98090_FORMATS, |
| 2377 | }, | 2411 | }, |
| 2378 | .ops = &max98090_dai_ops, | 2412 | .ops = &max98090_dai_ops, |
| 2379 | }; | 2413 | }; |
| 2380 | 2414 | ||
| 2381 | static int max98090_probe(struct snd_soc_component *component) | 2415 | static int max98090_probe(struct snd_soc_component *component) |
| @@ -350,7 +350,7 @@ static SOC_ENUM_SINGLE_DECL(max98095_dai3_dac_filter_enum, · 349 unmodified lines | |||
| 350 | static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol, | 350 | static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol, |
| 351 | struct snd_ctl_elem_value *ucontrol) | 351 | struct snd_ctl_elem_value *ucontrol) |
| 352 | { | 352 | { |
| 353 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 353 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 354 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 354 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 355 | unsigned int sel = ucontrol->value.integer.value[0]; | 355 | unsigned int sel = ucontrol->value.integer.value[0]; |
| 356 | 356 | ||
| @@ -364,7 +364,7 @@ static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 364 | static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol, | 364 | static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol, |
| 365 | struct snd_ctl_elem_value *ucontrol) | 365 | struct snd_ctl_elem_value *ucontrol) |
| 366 | { | 366 | { |
| 367 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 367 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 368 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 368 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 369 | 369 | ||
| 370 | ucontrol->value.integer.value[0] = max98095->mic1pre; | 370 | ucontrol->value.integer.value[0] = max98095->mic1pre; |
| @@ -374,7 +374,7 @@ static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 374 | static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol, | 374 | static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol, |
| 375 | struct snd_ctl_elem_value *ucontrol) | 375 | struct snd_ctl_elem_value *ucontrol) |
| 376 | { | 376 | { |
| 377 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 377 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 378 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 378 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 379 | unsigned int sel = ucontrol->value.integer.value[0]; | 379 | unsigned int sel = ucontrol->value.integer.value[0]; |
| 380 | 380 | ||
| @@ -388,7 +388,7 @@ static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 388 | static int max98095_mic2pre_get(struct snd_kcontrol *kcontrol, | 388 | static int max98095_mic2pre_get(struct snd_kcontrol *kcontrol, |
| 389 | struct snd_ctl_elem_value *ucontrol) | 389 | struct snd_ctl_elem_value *ucontrol) |
| 390 | { | 390 | { |
| 391 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 391 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 392 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 392 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 393 | 393 | ||
| 394 | ucontrol->value.integer.value[0] = max98095->mic2pre; | 394 | ucontrol->value.integer.value[0] = max98095->mic2pre; |
| @@ -1359,6 +1359,7 @@ static int max98095_set_bias_level(struct snd_soc_component *component, · 964 unmodified lines | |||
| 1359 | enum snd_soc_bias_level level) | 1359 | enum snd_soc_bias_level level) |
| 1360 | { | 1360 | { |
| 1361 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1361 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1362 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1362 | int ret; | 1363 | int ret; |
| 1363 | 1364 | ||
| 1364 | switch (level) { | 1365 | switch (level) { |
| @@ -1376,7 +1377,7 @@ static int max98095_set_bias_level(struct snd_soc_component *component, · 11 unmodified lines | |||
| 1376 | if (IS_ERR(max98095->mclk)) | 1377 | if (IS_ERR(max98095->mclk)) |
| 1377 | break; | 1378 | break; |
| 1378 | 1379 | ||
| 1379 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { | 1380 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1380 | clk_disable_unprepare(max98095->mclk); | 1381 | clk_disable_unprepare(max98095->mclk); |
| 1381 | } else { | 1382 | } else { |
| 1382 | ret = clk_prepare_enable(max98095->mclk); | 1383 | ret = clk_prepare_enable(max98095->mclk); |
| @@ -1386,7 +1387,7 @@ static int max98095_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 1386 | break; | 1387 | break; |
| 1387 | 1388 | ||
| 1388 | case SND_SOC_BIAS_STANDBY: | 1389 | case SND_SOC_BIAS_STANDBY: |
| 1389 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1390 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1390 | ret = regcache_sync(max98095->regmap); | 1391 | ret = regcache_sync(max98095->regmap); |
| 1391 | 1392 | ||
| 1392 | if (ret != 0) { | 1393 | if (ret != 0) { |
| @@ -1485,7 +1486,7 @@ static int max98095_get_eq_channel(const char *name) · 92 unmodified lines | |||
| 1485 | static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, | 1486 | static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, |
| 1486 | struct snd_ctl_elem_value *ucontrol) | 1487 | struct snd_ctl_elem_value *ucontrol) |
| 1487 | { | 1488 | { |
| 1488 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1489 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1489 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1490 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1490 | struct max98095_pdata *pdata = max98095->pdata; | 1491 | struct max98095_pdata *pdata = max98095->pdata; |
| 1491 | int channel = max98095_get_eq_channel(kcontrol->id.name); | 1492 | int channel = max98095_get_eq_channel(kcontrol->id.name); |
| @@ -1549,7 +1550,7 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol, · 57 unmodified lines | |||
| 1549 | static int max98095_get_eq_enum(struct snd_kcontrol *kcontrol, | 1550 | static int max98095_get_eq_enum(struct snd_kcontrol *kcontrol, |
| 1550 | struct snd_ctl_elem_value *ucontrol) | 1551 | struct snd_ctl_elem_value *ucontrol) |
| 1551 | { | 1552 | { |
| 1552 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1553 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1553 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1554 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1554 | int channel = max98095_get_eq_channel(kcontrol->id.name); | 1555 | int channel = max98095_get_eq_channel(kcontrol->id.name); |
| 1555 | struct max98095_cdata *cdata; | 1556 | struct max98095_cdata *cdata; |
| @@ -1636,7 +1637,7 @@ static int max98095_get_bq_channel(struct snd_soc_component *component, · 80 unmodified lines | |||
| 1636 | static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, | 1637 | static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, |
| 1637 | struct snd_ctl_elem_value *ucontrol) | 1638 | struct snd_ctl_elem_value *ucontrol) |
| 1638 | { | 1639 | { |
| 1639 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1640 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1640 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1641 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1641 | struct max98095_pdata *pdata = max98095->pdata; | 1642 | struct max98095_pdata *pdata = max98095->pdata; |
| 1642 | int channel = max98095_get_bq_channel(component, kcontrol->id.name); | 1643 | int channel = max98095_get_bq_channel(component, kcontrol->id.name); |
| @@ -1697,7 +1698,7 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol, · 54 unmodified lines | |||
| 1697 | static int max98095_get_bq_enum(struct snd_kcontrol *kcontrol, | 1698 | static int max98095_get_bq_enum(struct snd_kcontrol *kcontrol, |
| 1698 | struct snd_ctl_elem_value *ucontrol) | 1699 | struct snd_ctl_elem_value *ucontrol) |
| 1699 | { | 1700 | { |
| 1700 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1701 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1701 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1702 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1702 | int channel = max98095_get_bq_channel(component, kcontrol->id.name); | 1703 | int channel = max98095_get_bq_channel(component, kcontrol->id.name); |
| 1703 | struct max98095_cdata *cdata; | 1704 | struct max98095_cdata *cdata; |
| @@ -1917,11 +1918,12 @@ EXPORT_SYMBOL_GPL(max98095_jack_detect); · 213 unmodified lines | |||
| 1917 | static int max98095_suspend(struct snd_soc_component *component) | 1918 | static int max98095_suspend(struct snd_soc_component *component) |
| 1918 | { | 1919 | { |
| 1919 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1920 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1921 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1920 | 1922 | ||
| 1921 | if (max98095->headphone_jack || max98095->mic_jack) | 1923 | if (max98095->headphone_jack || max98095->mic_jack) |
| 1922 | max98095_jack_detect_disable(component); | 1924 | max98095_jack_detect_disable(component); |
| 1923 | 1925 | ||
| 1924 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 1926 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 1925 | 1927 | ||
| 1926 | return 0; | 1928 | return 0; |
| 1927 | } | 1929 | } |
| @@ -1930,8 +1932,9 @@ static int max98095_resume(struct snd_soc_component *component) · 2 unmodified lines | |||
| 1930 | { | 1932 | { |
| 1931 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); | 1933 | struct max98095_priv *max98095 = snd_soc_component_get_drvdata(component); |
| 1932 | struct i2c_client *client = to_i2c_client(component->dev); | 1934 | struct i2c_client *client = to_i2c_client(component->dev); |
| 1935 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1933 | 1936 | ||
| 1934 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); | 1937 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY); |
| 1935 | 1938 | ||
| 1936 | if (max98095->headphone_jack || max98095->mic_jack) { | 1939 | if (max98095->headphone_jack || max98095->mic_jack) { |
| 1937 | max98095_jack_detect_enable(component); | 1940 | max98095_jack_detect_enable(component); |
| @@ -174,12 +174,13 @@ static int max98373_feedback_get(struct snd_kcontrol *kcontrol, · 173 unmodified lines | |||
| 174 | struct snd_ctl_elem_value *ucontrol) | 174 | struct snd_ctl_elem_value *ucontrol) |
| 175 | { | 175 | { |
| 176 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 176 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 177 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 177 | struct soc_mixer_control *mc = | 178 | struct soc_mixer_control *mc = |
| 178 | (struct soc_mixer_control *)kcontrol->private_value; | 179 | (struct soc_mixer_control *)kcontrol->private_value; |
| 179 | struct max98373_priv *max98373 = snd_soc_component_get_drvdata(component); | 180 | struct max98373_priv *max98373 = snd_soc_component_get_drvdata(component); |
| 180 | int i; | 181 | int i; |
| 181 | 182 | ||
| 182 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 183 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 183 | /* | 184 | /* |
| 184 | * Register values will be cached before suspend. The cached value | 185 | * Register values will be cached before suspend. The cached value |
| 185 | * will be a valid value and userspace will happy with that. | 186 | * will be a valid value and userspace will happy with that. |
| @@ -534,8 +534,7 @@ static SOC_ENUM_SINGLE_DECL(max98390_current_limit, · 533 unmodified lines | |||
| 534 | static int max98390_ref_rdc_put(struct snd_kcontrol *kcontrol, | 534 | static int max98390_ref_rdc_put(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) | 535 | struct snd_ctl_elem_value *ucontrol) |
| 536 | { | 536 | { |
| 537 | struct snd_soc_component *component = | 537 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 538 | snd_soc_kcontrol_component(kcontrol); | ||
| 539 | struct max98390_priv *max98390 = | 538 | struct max98390_priv *max98390 = |
| 540 | snd_soc_component_get_drvdata(component); | 539 | snd_soc_component_get_drvdata(component); |
| 541 | 540 | ||
| @@ -554,8 +553,7 @@ static int max98390_ref_rdc_put(struct snd_kcontrol *kcontrol, · 12 unmodified lines | |||
| 554 | static int max98390_ref_rdc_get(struct snd_kcontrol *kcontrol, | 553 | static int max98390_ref_rdc_get(struct snd_kcontrol *kcontrol, |
| 555 | struct snd_ctl_elem_value *ucontrol) | 554 | struct snd_ctl_elem_value *ucontrol) |
| 556 | { | 555 | { |
| 557 | struct snd_soc_component *component = | 556 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 558 | snd_soc_kcontrol_component(kcontrol); | ||
| 559 | struct max98390_priv *max98390 = | 557 | struct max98390_priv *max98390 = |
| 560 | snd_soc_component_get_drvdata(component); | 558 | snd_soc_component_get_drvdata(component); |
| 561 | 559 | ||
| @@ -567,8 +565,7 @@ static int max98390_ref_rdc_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 567 | static int max98390_ambient_temp_put(struct snd_kcontrol *kcontrol, | 565 | static int max98390_ambient_temp_put(struct snd_kcontrol *kcontrol, |
| 568 | struct snd_ctl_elem_value *ucontrol) | 566 | struct snd_ctl_elem_value *ucontrol) |
| 569 | { | 567 | { |
| 570 | struct snd_soc_component *component = | 568 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 571 | snd_soc_kcontrol_component(kcontrol); | ||
| 572 | struct max98390_priv *max98390 = | 569 | struct max98390_priv *max98390 = |
| 573 | snd_soc_component_get_drvdata(component); | 570 | snd_soc_component_get_drvdata(component); |
| 574 | 571 | ||
| @@ -585,8 +582,7 @@ static int max98390_ambient_temp_put(struct snd_kcontrol *kcontrol, · 10 unmodified lines | |||
| 585 | static int max98390_ambient_temp_get(struct snd_kcontrol *kcontrol, | 582 | static int max98390_ambient_temp_get(struct snd_kcontrol *kcontrol, |
| 586 | struct snd_ctl_elem_value *ucontrol) | 583 | struct snd_ctl_elem_value *ucontrol) |
| 587 | { | 584 | { |
| 588 | struct snd_soc_component *component = | 585 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 589 | snd_soc_kcontrol_component(kcontrol); | ||
| 590 | struct max98390_priv *max98390 = | 586 | struct max98390_priv *max98390 = |
| 591 | snd_soc_component_get_drvdata(component); | 587 | snd_soc_component_get_drvdata(component); |
| 592 | 588 | ||
| @@ -598,8 +594,7 @@ static int max98390_ambient_temp_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 598 | static int max98390_adaptive_rdc_put(struct snd_kcontrol *kcontrol, | 594 | static int max98390_adaptive_rdc_put(struct snd_kcontrol *kcontrol, |
| 599 | struct snd_ctl_elem_value *ucontrol) | 595 | struct snd_ctl_elem_value *ucontrol) |
| 600 | { | 596 | { |
| 601 | struct snd_soc_component *component = | 597 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 602 | snd_soc_kcontrol_component(kcontrol); | ||
| 603 | 598 | ||
| 604 | dev_warn(component->dev, "Put adaptive rdc not supported\n"); | 599 | dev_warn(component->dev, "Put adaptive rdc not supported\n"); |
| 605 | 600 | ||
| @@ -610,8 +605,7 @@ static int max98390_adaptive_rdc_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 610 | struct snd_ctl_elem_value *ucontrol) | 605 | struct snd_ctl_elem_value *ucontrol) |
| 611 | { | 606 | { |
| 612 | int rdc, rdc0; | 607 | int rdc, rdc0; |
| 613 | struct snd_soc_component *component = | 608 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 614 | snd_soc_kcontrol_component(kcontrol); | ||
| 615 | struct max98390_priv *max98390 = | 609 | struct max98390_priv *max98390 = |
| 616 | snd_soc_component_get_drvdata(component); | 610 | snd_soc_component_get_drvdata(component); |
| 617 | 611 | ||
| @@ -632,9 +626,9 @@ static int max98390_dsm_calib_get(struct snd_kcontrol *kcontrol, · 14 unmodified lines | |||
| 632 | static int max98390_dsm_calib_put(struct snd_kcontrol *kcontrol, | 626 | static int max98390_dsm_calib_put(struct snd_kcontrol *kcontrol, |
| 633 | struct snd_ctl_elem_value *ucontrol) | 627 | struct snd_ctl_elem_value *ucontrol) |
| 634 | { | 628 | { |
| 635 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 629 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 636 | struct max98390_priv *max98390 = snd_soc_component_get_drvdata(component); | 630 | struct max98390_priv *max98390 = snd_soc_component_get_drvdata(component); |
| 637 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 631 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 638 | unsigned int rdc, rdc_cal_result, rdc_integer, rdc_factor, temp, val; | 632 | unsigned int rdc, rdc_cal_result, rdc_integer, rdc_factor, temp, val; |
| 639 | 633 | ||
| 640 | snd_soc_dapm_mutex_lock(dapm); | 634 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -953,8 +953,7 @@ static const DECLARE_TLV_DB_RANGE(max98397_spk_tlv, · 952 unmodified lines | |||
| 953 | static int max98396_mux_get(struct snd_kcontrol *kcontrol, | 953 | static int max98396_mux_get(struct snd_kcontrol *kcontrol, |
| 954 | struct snd_ctl_elem_value *ucontrol) | 954 | struct snd_ctl_elem_value *ucontrol) |
| 955 | { | 955 | { |
| 956 | struct snd_soc_component *component = | 956 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 957 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 958 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); | 957 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); |
| 959 | int reg, val; | 958 | int reg, val; |
| 960 | 959 | ||
| @@ -973,9 +972,8 @@ static int max98396_mux_get(struct snd_kcontrol *kcontrol, · 12 unmodified lines | |||
| 973 | static int max98396_mux_put(struct snd_kcontrol *kcontrol, | 972 | static int max98396_mux_put(struct snd_kcontrol *kcontrol, |
| 974 | struct snd_ctl_elem_value *ucontrol) | 973 | struct snd_ctl_elem_value *ucontrol) |
| 975 | { | 974 | { |
| 976 | struct snd_soc_component *component = | 975 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 977 | snd_soc_dapm_kcontrol_component(kcontrol); | 976 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 978 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 979 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); | 977 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); |
| 980 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 978 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 981 | unsigned int *item = ucontrol->value.enumerated.item; | 979 | unsigned int *item = ucontrol->value.enumerated.item; |
| @@ -1107,6 +1105,7 @@ static int max98396_adc_value_get(struct snd_kcontrol *kcontrol, · 125 unmodified lines | |||
| 1107 | struct snd_ctl_elem_value *ucontrol) | 1105 | struct snd_ctl_elem_value *ucontrol) |
| 1108 | { | 1106 | { |
| 1109 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 1107 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1108 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1110 | struct soc_mixer_control *mc = | 1109 | struct soc_mixer_control *mc = |
| 1111 | (struct soc_mixer_control *)kcontrol->private_value; | 1110 | (struct soc_mixer_control *)kcontrol->private_value; |
| 1112 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); | 1111 | struct max98396_priv *max98396 = snd_soc_component_get_drvdata(component); |
| @@ -1115,7 +1114,7 @@ static int max98396_adc_value_get(struct snd_kcontrol *kcontrol, · 2 unmodified lines | |||
| 1115 | int reg = mc->reg; | 1114 | int reg = mc->reg; |
| 1116 | 1115 | ||
| 1117 | /* ADC value is not available if the device is powered down */ | 1116 | /* ADC value is not available if the device is powered down */ |
| 1118 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 1117 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 1119 | goto exit; | 1118 | goto exit; |
| 1120 | 1119 | ||
| 1121 | if (max98396->device_id == CODEC_TYPE_MAX98397) { | 1120 | if (max98396->device_id == CODEC_TYPE_MAX98397) { |
| @@ -225,6 +225,7 @@ static int max9850_set_bias_level(struct snd_soc_component *component, · 224 unmodified lines | |||
| 225 | enum snd_soc_bias_level level) | 225 | enum snd_soc_bias_level level) |
| 226 | { | 226 | { |
| 227 | struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); | 227 | struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); |
| 228 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 228 | int ret; | 229 | int ret; |
| 229 | 230 | ||
| 230 | switch (level) { | 231 | switch (level) { |
| @@ -233,7 +234,7 @@ static int max9850_set_bias_level(struct snd_soc_component *component, · 2 unmodified lines | |||
| 233 | case SND_SOC_BIAS_PREPARE: | 234 | case SND_SOC_BIAS_PREPARE: |
| 234 | break; | 235 | break; |
| 235 | case SND_SOC_BIAS_STANDBY: | 236 | case SND_SOC_BIAS_STANDBY: |
| 236 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 237 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 237 | ret = regcache_sync(max9850->regmap); | 238 | ret = regcache_sync(max9850->regmap); |
| 238 | if (ret) { | 239 | if (ret) { |
| 239 | dev_err(component->dev, | 240 | dev_err(component->dev, |
| @@ -78,7 +78,7 @@ static int max9867_adc_dac_event(struct snd_soc_dapm_widget *w, · 77 unmodified lines | |||
| 78 | static int max9867_filter_get(struct snd_kcontrol *kcontrol, | 78 | static int max9867_filter_get(struct snd_kcontrol *kcontrol, |
| 79 | struct snd_ctl_elem_value *ucontrol) | 79 | struct snd_ctl_elem_value *ucontrol) |
| 80 | { | 80 | { |
| 81 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 81 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 82 | struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); | 82 | struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); |
| 83 | unsigned int reg; | 83 | unsigned int reg; |
| 84 | int ret; | 84 | int ret; |
| @@ -98,7 +98,7 @@ static int max9867_filter_get(struct snd_kcontrol *kcontrol, · 13 unmodified lines | |||
| 98 | static int max9867_filter_set(struct snd_kcontrol *kcontrol, | 98 | static int max9867_filter_set(struct snd_kcontrol *kcontrol, |
| 99 | struct snd_ctl_elem_value *ucontrol) | 99 | struct snd_ctl_elem_value *ucontrol) |
| 100 | { | 100 | { |
| 101 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 101 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 102 | struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); | 102 | struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); |
| 103 | unsigned int reg, mode = ucontrol->value.enumerated.item[0]; | 103 | unsigned int reg, mode = ucontrol->value.enumerated.item[0]; |
| 104 | int ret; | 104 | int ret; |
| @@ -556,14 +556,18 @@ static struct snd_soc_dai_driver max9867_dai[] = { · 451 unmodified lines | |||
| 556 | #ifdef CONFIG_PM | 556 | #ifdef CONFIG_PM |
| 557 | static int max9867_suspend(struct snd_soc_component *component) | 557 | static int max9867_suspend(struct snd_soc_component *component) |
| 558 | { | 558 | { |
| 559 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 559 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 560 | |||
| 561 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); | ||
| 560 | 562 | ||
| 561 | return 0; | 563 | return 0; |
| 562 | } | 564 | } |
| 563 | 565 | ||
| 564 | static int max9867_resume(struct snd_soc_component *component) | 566 | static int max9867_resume(struct snd_soc_component *component) |
| 565 | { | 567 | { |
| 566 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); | 568 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 569 | |||
| 570 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY); | ||
| 567 | 571 | ||
| 568 | return 0; | 572 | return 0; |
| 569 | } | 573 | } |
| @@ -577,6 +581,7 @@ static int max9867_set_bias_level(struct snd_soc_component *component, · 7 unmodified lines | |||
| 577 | { | 581 | { |
| 578 | int err; | 582 | int err; |
| 579 | struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); | 583 | struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); |
| 584 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 580 | 585 | ||
| 581 | switch (level) { | 586 | switch (level) { |
| 582 | case SND_SOC_BIAS_ON: | 587 | case SND_SOC_BIAS_ON: |
| @@ -585,7 +590,7 @@ static int max9867_set_bias_level(struct snd_soc_component *component, · 2 unmodified lines | |||
| 585 | return err; | 590 | return err; |
| 586 | break; | 591 | break; |
| 587 | case SND_SOC_BIAS_STANDBY: | 592 | case SND_SOC_BIAS_STANDBY: |
| 588 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 593 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 589 | err = regcache_sync(max9867->regmap); | 594 | err = regcache_sync(max9867->regmap); |
| 590 | if (err) | 595 | if (err) |
| 591 | return err; | 596 | return err; |
| @@ -97,7 +97,7 @@ static const struct snd_kcontrol_new max98925_dai_sel_mux = · 96 unmodified lines | |||
| 97 | static int max98925_dac_event(struct snd_soc_dapm_widget *w, | 97 | static int max98925_dac_event(struct snd_soc_dapm_widget *w, |
| 98 | struct snd_kcontrol *kcontrol, int event) | 98 | struct snd_kcontrol *kcontrol, int event) |
| 99 | { | 99 | { |
| 100 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 100 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 101 | struct max98925_priv *max98925 = snd_soc_component_get_drvdata(component); | 101 | struct max98925_priv *max98925 = snd_soc_component_get_drvdata(component); |
| 102 | 102 | ||
| 103 | switch (event) { | 103 | switch (event) { |
| @@ -459,6 +459,7 @@ static int ml26124_set_bias_level(struct snd_soc_component *component, · 458 unmodified lines | |||
| 459 | enum snd_soc_bias_level level) | 459 | enum snd_soc_bias_level level) |
| 460 | { | 460 | { |
| 461 | struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); | 461 | struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); |
| 462 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 462 | 463 | ||
| 463 | switch (level) { | 464 | switch (level) { |
| 464 | case SND_SOC_BIAS_ON: | 465 | case SND_SOC_BIAS_ON: |
| @@ -473,7 +474,7 @@ static int ml26124_set_bias_level(struct snd_soc_component *component, · 8 unmodified lines | |||
| 473 | break; | 474 | break; |
| 474 | case SND_SOC_BIAS_STANDBY: | 475 | case SND_SOC_BIAS_STANDBY: |
| 475 | /* VMID ON */ | 476 | /* VMID ON */ |
| 476 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 477 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 477 | snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, | 478 | snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, |
| 478 | ML26124_VMID, ML26124_VMID); | 479 | ML26124_VMID, ML26124_VMID); |
| 479 | msleep(500); | 480 | msleep(500); |
| @@ -423,8 +423,7 @@ static int msm8x16_wcd_get_iir_band_audio_mixer( · 422 unmodified lines | |||
| 423 | struct snd_ctl_elem_value *ucontrol) | 423 | struct snd_ctl_elem_value *ucontrol) |
| 424 | { | 424 | { |
| 425 | 425 | ||
| 426 | struct snd_soc_component *component = | 426 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 427 | snd_soc_kcontrol_component(kcontrol); | ||
| 428 | struct wcd_iir_filter_ctl *ctl = | 427 | struct wcd_iir_filter_ctl *ctl = |
| 429 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; | 428 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; |
| 430 | struct soc_bytes_ext *params = &ctl->bytes_ext; | 429 | struct soc_bytes_ext *params = &ctl->bytes_ext; |
| @@ -469,8 +468,7 @@ static int msm8x16_wcd_put_iir_band_audio_mixer( · 38 unmodified lines | |||
| 469 | struct snd_kcontrol *kcontrol, | 468 | struct snd_kcontrol *kcontrol, |
| 470 | struct snd_ctl_elem_value *ucontrol) | 469 | struct snd_ctl_elem_value *ucontrol) |
| 471 | { | 470 | { |
| 472 | struct snd_soc_component *component = | 471 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 473 | snd_soc_kcontrol_component(kcontrol); | ||
| 474 | struct wcd_iir_filter_ctl *ctl = | 472 | struct wcd_iir_filter_ctl *ctl = |
| 475 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; | 473 | (struct wcd_iir_filter_ctl *)kcontrol->private_value; |
| 476 | struct soc_bytes_ext *params = &ctl->bytes_ext; | 474 | struct soc_bytes_ext *params = &ctl->bytes_ext; |
| @@ -597,7 +597,7 @@ static int mt_mic_type_event(struct snd_soc_dapm_widget *w, · 596 unmodified lines | |||
| 597 | { | 597 | { |
| 598 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 598 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 599 | struct mt6357_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 599 | struct mt6357_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 600 | unsigned int mic_type = dapm_kcontrol_get_value(w->kcontrols[0]); | 600 | unsigned int mic_type = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 601 | 601 | ||
| 602 | switch (event) { | 602 | switch (event) { |
| 603 | case SND_SOC_DAPM_PRE_PMU: | 603 | case SND_SOC_DAPM_PRE_PMU: |
| @@ -320,8 +320,7 @@ static void headset_volume_ramp(struct mt6358_priv *priv, int from, int to) · 319 unmodified lines | |||
| 320 | static int mt6358_put_volsw(struct snd_kcontrol *kcontrol, | 320 | static int mt6358_put_volsw(struct snd_kcontrol *kcontrol, |
| 321 | struct snd_ctl_elem_value *ucontrol) | 321 | struct snd_ctl_elem_value *ucontrol) |
| 322 | { | 322 | { |
| 323 | struct snd_soc_component *component = | 323 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 324 | snd_soc_kcontrol_component(kcontrol); | ||
| 325 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(component); | 324 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(component); |
| 326 | struct soc_mixer_control *mc = | 325 | struct soc_mixer_control *mc = |
| 327 | (struct soc_mixer_control *)kcontrol->private_value; | 326 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -442,7 +441,7 @@ static int mt6358_disable_wov_phase2(struct mt6358_priv *priv) · 114 unmodified lines | |||
| 442 | static int mt6358_get_wov(struct snd_kcontrol *kcontrol, | 441 | static int mt6358_get_wov(struct snd_kcontrol *kcontrol, |
| 443 | struct snd_ctl_elem_value *ucontrol) | 442 | struct snd_ctl_elem_value *ucontrol) |
| 444 | { | 443 | { |
| 445 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 444 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 446 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); | 445 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); |
| 447 | 446 | ||
| 448 | ucontrol->value.integer.value[0] = priv->wov_enabled; | 447 | ucontrol->value.integer.value[0] = priv->wov_enabled; |
| @@ -452,7 +451,7 @@ static int mt6358_get_wov(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 452 | static int mt6358_put_wov(struct snd_kcontrol *kcontrol, | 451 | static int mt6358_put_wov(struct snd_kcontrol *kcontrol, |
| 453 | struct snd_ctl_elem_value *ucontrol) | 452 | struct snd_ctl_elem_value *ucontrol) |
| 454 | { | 453 | { |
| 455 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 454 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 456 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); | 455 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); |
| 457 | int enabled = ucontrol->value.integer.value[0]; | 456 | int enabled = ucontrol->value.integer.value[0]; |
| 458 | 457 | ||
| @@ -476,7 +475,7 @@ static int mt6358_put_wov(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 476 | static int mt6358_dmic_mode_get(struct snd_kcontrol *kcontrol, | 475 | static int mt6358_dmic_mode_get(struct snd_kcontrol *kcontrol, |
| 477 | struct snd_ctl_elem_value *ucontrol) | 476 | struct snd_ctl_elem_value *ucontrol) |
| 478 | { | 477 | { |
| 479 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 478 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 480 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); | 479 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); |
| 481 | 480 | ||
| 482 | ucontrol->value.integer.value[0] = priv->dmic_one_wire_mode; | 481 | ucontrol->value.integer.value[0] = priv->dmic_one_wire_mode; |
| @@ -488,7 +487,7 @@ static int mt6358_dmic_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 488 | static int mt6358_dmic_mode_set(struct snd_kcontrol *kcontrol, | 487 | static int mt6358_dmic_mode_set(struct snd_kcontrol *kcontrol, |
| 489 | struct snd_ctl_elem_value *ucontrol) | 488 | struct snd_ctl_elem_value *ucontrol) |
| 490 | { | 489 | { |
| 491 | struct snd_soc_component *c = snd_soc_kcontrol_component(kcontrol); | 490 | struct snd_soc_component *c = snd_kcontrol_chip(kcontrol); |
| 492 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); | 491 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(c); |
| 493 | int enabled = ucontrol->value.integer.value[0]; | 492 | int enabled = ucontrol->value.integer.value[0]; |
| 494 | 493 | ||
| @@ -1288,7 +1287,7 @@ static int mt_hp_event(struct snd_soc_dapm_widget *w, · 793 unmodified lines | |||
| 1288 | { | 1287 | { |
| 1289 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1288 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1290 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1289 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1291 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1290 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1292 | int device = DEVICE_HP; | 1291 | int device = DEVICE_HP; |
| 1293 | 1292 | ||
| 1294 | dev_info(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n", | 1293 | dev_info(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n", |
| @@ -1350,7 +1349,7 @@ static int mt_rcv_event(struct snd_soc_dapm_widget *w, · 55 unmodified lines | |||
| 1350 | dev_info(priv->dev, "%s(), event 0x%x, mux %u\n", | 1349 | dev_info(priv->dev, "%s(), event 0x%x, mux %u\n", |
| 1351 | __func__, | 1350 | __func__, |
| 1352 | event, | 1351 | event, |
| 1353 | dapm_kcontrol_get_value(w->kcontrols[0])); | 1352 | snd_soc_dapm_kcontrol_get_value(w->kcontrols[0])); |
| 1354 | 1353 | ||
| 1355 | switch (event) { | 1354 | switch (event) { |
| 1356 | case SND_SOC_DAPM_PRE_PMU: | 1355 | case SND_SOC_DAPM_PRE_PMU: |
| @@ -1829,7 +1828,7 @@ static int mt_mic_type_event(struct snd_soc_dapm_widget *w, · 472 unmodified lines | |||
| 1829 | { | 1828 | { |
| 1830 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1829 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1831 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1830 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1832 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1831 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1833 | 1832 | ||
| 1834 | dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", | 1833 | dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", |
| 1835 | __func__, event, mux); | 1834 | __func__, event, mux); |
| @@ -1875,7 +1874,7 @@ static int mt_adc_l_event(struct snd_soc_dapm_widget *w, · 39 unmodified lines | |||
| 1875 | { | 1874 | { |
| 1876 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1875 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1877 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1876 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1878 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1877 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1879 | 1878 | ||
| 1880 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", | 1879 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", |
| 1881 | __func__, event, mux); | 1880 | __func__, event, mux); |
| @@ -1891,7 +1890,7 @@ static int mt_adc_r_event(struct snd_soc_dapm_widget *w, · 9 unmodified lines | |||
| 1891 | { | 1890 | { |
| 1892 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1891 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1893 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1892 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1894 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1893 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1895 | 1894 | ||
| 1896 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", | 1895 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", |
| 1897 | __func__, event, mux); | 1896 | __func__, event, mux); |
| @@ -1907,7 +1906,7 @@ static int mt_pga_left_event(struct snd_soc_dapm_widget *w, · 9 unmodified lines | |||
| 1907 | { | 1906 | { |
| 1908 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1907 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1909 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1908 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1910 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1909 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1911 | 1910 | ||
| 1912 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", | 1911 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", |
| 1913 | __func__, event, mux); | 1912 | __func__, event, mux); |
| @@ -1923,7 +1922,7 @@ static int mt_pga_right_event(struct snd_soc_dapm_widget *w, · 9 unmodified lines | |||
| 1923 | { | 1922 | { |
| 1924 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1923 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1925 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1924 | struct mt6358_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1926 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1925 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1927 | 1926 | ||
| 1928 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", | 1927 | dev_dbg(priv->dev, "%s(), event = 0x%x, mux %u\n", |
| 1929 | __func__, event, mux); | 1928 | __func__, event, mux); |
| @@ -367,8 +367,7 @@ static void headset_volume_ramp(struct mt6359_priv *priv, · 366 unmodified lines | |||
| 367 | static int mt6359_put_volsw(struct snd_kcontrol *kcontrol, | 367 | static int mt6359_put_volsw(struct snd_kcontrol *kcontrol, |
| 368 | struct snd_ctl_elem_value *ucontrol) | 368 | struct snd_ctl_elem_value *ucontrol) |
| 369 | { | 369 | { |
| 370 | struct snd_soc_component *component = | 370 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 371 | snd_soc_kcontrol_component(kcontrol); | ||
| 372 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(component); | 371 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(component); |
| 373 | struct soc_mixer_control *mc = | 372 | struct soc_mixer_control *mc = |
| 374 | (struct soc_mixer_control *)kcontrol->private_value; | 373 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -468,8 +467,7 @@ static int mt6359_put_volsw(struct snd_kcontrol *kcontrol, · 93 unmodified lines | |||
| 468 | static int mt6359_get_playback_volsw(struct snd_kcontrol *kcontrol, | 467 | static int mt6359_get_playback_volsw(struct snd_kcontrol *kcontrol, |
| 469 | struct snd_ctl_elem_value *ucontrol) | 468 | struct snd_ctl_elem_value *ucontrol) |
| 470 | { | 469 | { |
| 471 | struct snd_soc_component *component = | 470 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 472 | snd_soc_kcontrol_component(kcontrol); | ||
| 473 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(component); | 471 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(component); |
| 474 | struct soc_mixer_control *mc = | 472 | struct soc_mixer_control *mc = |
| 475 | (struct soc_mixer_control *)kcontrol->private_value; | 473 | (struct soc_mixer_control *)kcontrol->private_value; |
| @@ -1045,7 +1043,7 @@ static int mt_hp_event(struct snd_soc_dapm_widget *w, · 569 unmodified lines | |||
| 1045 | { | 1043 | { |
| 1046 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1044 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1047 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1045 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1048 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1046 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1049 | int device = DEVICE_HP; | 1047 | int device = DEVICE_HP; |
| 1050 | 1048 | ||
| 1051 | dev_dbg(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n", | 1049 | dev_dbg(priv->dev, "%s(), event 0x%x, dev_counter[DEV_HP] %d, mux %u\n", |
| @@ -1077,7 +1075,7 @@ static int mt_rcv_event(struct snd_soc_dapm_widget *w, · 25 unmodified lines | |||
| 1077 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1075 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1078 | 1076 | ||
| 1079 | dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", | 1077 | dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", |
| 1080 | __func__, event, dapm_kcontrol_get_value(w->kcontrols[0])); | 1078 | __func__, event, snd_soc_dapm_kcontrol_get_value(w->kcontrols[0])); |
| 1081 | 1079 | ||
| 1082 | switch (event) { | 1080 | switch (event) { |
| 1083 | case SND_SOC_DAPM_PRE_PMU: | 1081 | case SND_SOC_DAPM_PRE_PMU: |
| @@ -1159,7 +1157,7 @@ static int mt_lo_event(struct snd_soc_dapm_widget *w, · 75 unmodified lines | |||
| 1159 | { | 1157 | { |
| 1160 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1158 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1161 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1159 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1162 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1160 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1163 | 1161 | ||
| 1164 | dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", | 1162 | dev_dbg(priv->dev, "%s(), event 0x%x, mux %u\n", |
| 1165 | __func__, event, mux); | 1163 | __func__, event, mux); |
| @@ -1639,7 +1637,7 @@ static int mt_pga_l_mux_event(struct snd_soc_dapm_widget *w, · 473 unmodified lines | |||
| 1639 | { | 1637 | { |
| 1640 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1638 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1641 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1639 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1642 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1640 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1643 | 1641 | ||
| 1644 | dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); | 1642 | dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); |
| 1645 | priv->mux_select[MUX_PGA_L] = mux >> RG_AUDPREAMPLINPUTSEL_SFT; | 1643 | priv->mux_select[MUX_PGA_L] = mux >> RG_AUDPREAMPLINPUTSEL_SFT; |
| @@ -1652,7 +1650,7 @@ static int mt_pga_r_mux_event(struct snd_soc_dapm_widget *w, · 6 unmodified lines | |||
| 1652 | { | 1650 | { |
| 1653 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1651 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1654 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1652 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1655 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1653 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1656 | 1654 | ||
| 1657 | dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); | 1655 | dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); |
| 1658 | priv->mux_select[MUX_PGA_R] = mux >> RG_AUDPREAMPRINPUTSEL_SFT; | 1656 | priv->mux_select[MUX_PGA_R] = mux >> RG_AUDPREAMPRINPUTSEL_SFT; |
| @@ -1665,7 +1663,7 @@ static int mt_pga_3_mux_event(struct snd_soc_dapm_widget *w, · 6 unmodified lines | |||
| 1665 | { | 1663 | { |
| 1666 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); | 1664 | struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm); |
| 1667 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); | 1665 | struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt); |
| 1668 | unsigned int mux = dapm_kcontrol_get_value(w->kcontrols[0]); | 1666 | unsigned int mux = snd_soc_dapm_kcontrol_get_value(w->kcontrols[0]); |
| 1669 | 1667 | ||
| 1670 | dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); | 1668 | dev_dbg(priv->dev, "%s(), mux %d\n", __func__, mux); |
| 1671 | priv->mux_select[MUX_PGA_3] = mux >> RG_AUDPREAMP3INPUTSEL_SFT; | 1669 | priv->mux_select[MUX_PGA_3] = mux >> RG_AUDPREAMP3INPUTSEL_SFT; |
| @@ -187,8 +187,7 @@ static const struct snd_soc_dapm_route mt6660_component_dapm_routes[] = { · 186 unmodified lines | |||
| 187 | static int mt6660_component_get_volsw(struct snd_kcontrol *kcontrol, | 187 | static int mt6660_component_get_volsw(struct snd_kcontrol *kcontrol, |
| 188 | struct snd_ctl_elem_value *ucontrol) | 188 | struct snd_ctl_elem_value *ucontrol) |
| 189 | { | 189 | { |
| 190 | struct snd_soc_component *component = | 190 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 191 | snd_soc_kcontrol_component(kcontrol); | ||
| 192 | struct mt6660_chip *chip = (struct mt6660_chip *) | 191 | struct mt6660_chip *chip = (struct mt6660_chip *) |
| 193 | snd_soc_component_get_drvdata(component); | 192 | snd_soc_component_get_drvdata(component); |
| 194 | 193 | ||
| @@ -422,7 +422,7 @@ static int nau8325_clksrc_choose(struct nau8325 *nau8325, · 421 unmodified lines | |||
| 422 | *n1_sel = i; | 422 | *n1_sel = i; |
| 423 | *mult_sel = j; | 423 | *mult_sel = j; |
| 424 | ratio_sel = ratio; | 424 | ratio_sel = ratio; |
| 425 | goto proc_done; | 425 | goto proc_done; |
| 426 | } | 426 | } |
| 427 | } | 427 | } |
| 428 | } | 428 | } |
| @@ -829,8 +829,7 @@ static int nau8325_read_device_properties(struct device *dev, · 400 unmodified lines | |||
| 829 | return 0; | 829 | return 0; |
| 830 | } | 830 | } |
| 831 | 831 | ||
| 832 | static int nau8325_i2c_probe(struct i2c_client *i2c, | 832 | static int nau8325_i2c_probe(struct i2c_client *i2c) |
| 833 | const struct i2c_device_id *id) | ||
| 834 | { | 833 | { |
| 835 | struct device *dev = &i2c->dev; | 834 | struct device *dev = &i2c->dev; |
| 836 | struct nau8325 *nau8325 = dev_get_platdata(dev); | 835 | struct nau8325 *nau8325 = dev_get_platdata(dev); |
| @@ -164,7 +164,7 @@ static bool nau8810_volatile_reg(struct device *dev, unsigned int reg) · 163 unmodified lines | |||
| 164 | static int nau8810_eq_get(struct snd_kcontrol *kcontrol, | 164 | static int nau8810_eq_get(struct snd_kcontrol *kcontrol, |
| 165 | struct snd_ctl_elem_value *ucontrol) | 165 | struct snd_ctl_elem_value *ucontrol) |
| 166 | { | 166 | { |
| 167 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 167 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 168 | struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component); | 168 | struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component); |
| 169 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; | 169 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; |
| 170 | int i, reg, reg_val; | 170 | int i, reg, reg_val; |
| @@ -196,7 +196,7 @@ static int nau8810_eq_get(struct snd_kcontrol *kcontrol, · 25 unmodified lines | |||
| 196 | static int nau8810_eq_put(struct snd_kcontrol *kcontrol, | 196 | static int nau8810_eq_put(struct snd_kcontrol *kcontrol, |
| 197 | struct snd_ctl_elem_value *ucontrol) | 197 | struct snd_ctl_elem_value *ucontrol) |
| 198 | { | 198 | { |
| 199 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 199 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 200 | struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component); | 200 | struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component); |
| 201 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; | 201 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; |
| 202 | void *data; | 202 | void *data; |
| @@ -775,6 +775,7 @@ static int nau8810_pcm_hw_params(struct snd_pcm_substream *substream, · 572 unmodified lines | |||
| 775 | static int nau8810_set_bias_level(struct snd_soc_component *component, | 775 | static int nau8810_set_bias_level(struct snd_soc_component *component, |
| 776 | enum snd_soc_bias_level level) | 776 | enum snd_soc_bias_level level) |
| 777 | { | 777 | { |
| 778 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 778 | struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component); | 779 | struct nau8810 *nau8810 = snd_soc_component_get_drvdata(component); |
| 779 | struct regmap *map = nau8810->regmap; | 780 | struct regmap *map = nau8810->regmap; |
| 780 | 781 | ||
| @@ -790,7 +791,7 @@ static int nau8810_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines | |||
| 790 | NAU8810_IOBUF_EN | NAU8810_ABIAS_EN, | 791 | NAU8810_IOBUF_EN | NAU8810_ABIAS_EN, |
| 791 | NAU8810_IOBUF_EN | NAU8810_ABIAS_EN); | 792 | NAU8810_IOBUF_EN | NAU8810_ABIAS_EN); |
| 792 | 793 | ||
| 793 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 794 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 794 | regcache_sync(map); | 795 | regcache_sync(map); |
| 795 | regmap_update_bits(map, NAU8810_REG_POWER1, | 796 | regmap_update_bits(map, NAU8810_REG_POWER1, |
| 796 | NAU8810_REFIMP_MASK, NAU8810_REFIMP_3K); | 797 | NAU8810_REFIMP_MASK, NAU8810_REFIMP_3K); |
| @@ -1047,7 +1047,6 @@ static void nau8821_eject_jack(struct nau8821 *nau8821) · 1046 unmodified lines | |||
| 1047 | { | 1047 | { |
| 1048 | struct snd_soc_dapm_context *dapm = nau8821->dapm; | 1048 | struct snd_soc_dapm_context *dapm = nau8821->dapm; |
| 1049 | struct regmap *regmap = nau8821->regmap; | 1049 | struct regmap *regmap = nau8821->regmap; |
| 1050 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); | ||
| 1051 | 1050 | ||
| 1052 | /* Detach 2kOhm Resistors from MICBIAS to MICGND */ | 1051 | /* Detach 2kOhm Resistors from MICBIAS to MICGND */ |
| 1053 | regmap_update_bits(regmap, NAU8821_R74_MIC_BIAS, | 1052 | regmap_update_bits(regmap, NAU8821_R74_MIC_BIAS, |
| @@ -1055,7 +1054,7 @@ static void nau8821_eject_jack(struct nau8821 *nau8821) · 1 unmodified line | |||
| 1055 | /* HPL/HPR short to ground */ | 1054 | /* HPL/HPR short to ground */ |
| 1056 | regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL, | 1055 | regmap_update_bits(regmap, NAU8821_R0D_JACK_DET_CTRL, |
| 1057 | NAU8821_SPKR_DWN1R | NAU8821_SPKR_DWN1L, 0); | 1056 | NAU8821_SPKR_DWN1R | NAU8821_SPKR_DWN1L, 0); |
| 1058 | snd_soc_component_disable_pin(component, "MICBIAS"); | 1057 | snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
| 1059 | snd_soc_dapm_sync(dapm); | 1058 | snd_soc_dapm_sync(dapm); |
| 1060 | 1059 | ||
| 1061 | /* Disable & mask both insertion & ejection IRQs */ | 1060 | /* Disable & mask both insertion & ejection IRQs */ |
| @@ -1080,7 +1079,7 @@ static void nau8821_eject_jack(struct nau8821 *nau8821) · 18 unmodified lines | |||
| 1080 | NAU8821_JACK_DET_DB_BYPASS, NAU8821_JACK_DET_DB_BYPASS); | 1079 | NAU8821_JACK_DET_DB_BYPASS, NAU8821_JACK_DET_DB_BYPASS); |
| 1081 | 1080 | ||
| 1082 | /* Close clock for jack type detection at manual mode */ | 1081 | /* Close clock for jack type detection at manual mode */ |
| 1083 | if (dapm->bias_level < SND_SOC_BIAS_PREPARE) | 1082 | if (snd_soc_dapm_get_bias_level(dapm) < SND_SOC_BIAS_PREPARE) |
| 1084 | nau8821_configure_sysclk(nau8821, NAU8821_CLK_DIS, 0); | 1083 | nau8821_configure_sysclk(nau8821, NAU8821_CLK_DIS, 0); |
| 1085 | 1084 | ||
| 1086 | /* Recover to normal channel input */ | 1085 | /* Recover to normal channel input */ |
| @@ -1106,7 +1105,6 @@ static void nau8821_jdet_work(struct work_struct *work) · 19 unmodified lines | |||
| 1106 | struct nau8821 *nau8821 = | 1105 | struct nau8821 *nau8821 = |
| 1107 | container_of(work, struct nau8821, jdet_work.work); | 1106 | container_of(work, struct nau8821, jdet_work.work); |
| 1108 | struct snd_soc_dapm_context *dapm = nau8821->dapm; | 1107 | struct snd_soc_dapm_context *dapm = nau8821->dapm; |
| 1109 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); | ||
| 1110 | struct regmap *regmap = nau8821->regmap; | 1108 | struct regmap *regmap = nau8821->regmap; |
| 1111 | int jack_status_reg, mic_detected, event = 0, event_mask = 0; | 1109 | int jack_status_reg, mic_detected, event = 0, event_mask = 0; |
| 1112 | 1110 | ||
| @@ -1133,13 +1131,13 @@ static void nau8821_jdet_work(struct work_struct *work) · 20 unmodified lines | |||
| 1133 | NAU8821_IRQ_KEY_RELEASE_DIS | | 1131 | NAU8821_IRQ_KEY_RELEASE_DIS | |
| 1134 | NAU8821_IRQ_KEY_PRESS_DIS, 0); | 1132 | NAU8821_IRQ_KEY_PRESS_DIS, 0); |
| 1135 | } else { | 1133 | } else { |
| 1136 | snd_soc_component_disable_pin(component, "MICBIAS"); | 1134 | snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
| 1137 | snd_soc_dapm_sync(nau8821->dapm); | 1135 | snd_soc_dapm_sync(dapm); |
| 1138 | } | 1136 | } |
| 1139 | } else { | 1137 | } else { |
| 1140 | dev_dbg(nau8821->dev, "Headphone connected\n"); | 1138 | dev_dbg(nau8821->dev, "Headphone connected\n"); |
| 1141 | event |= SND_JACK_HEADPHONE; | 1139 | event |= SND_JACK_HEADPHONE; |
| 1142 | snd_soc_component_disable_pin(component, "MICBIAS"); | 1140 | snd_soc_dapm_disable_pin(dapm, "MICBIAS"); |
| 1143 | snd_soc_dapm_sync(dapm); | 1141 | snd_soc_dapm_sync(dapm); |
| 1144 | } | 1142 | } |
| 1145 | 1143 | ||
| @@ -1162,7 +1160,7 @@ static void nau8821_setup_inserted_irq(struct nau8821 *nau8821) · 16 unmodified lines | |||
| 1162 | nau8821_irq_status_clear(regmap, NAU8821_JACK_INSERT_DETECTED); | 1160 | nau8821_irq_status_clear(regmap, NAU8821_JACK_INSERT_DETECTED); |
| 1163 | 1161 | ||
| 1164 | /* Enable internal VCO needed for interruptions */ | 1162 | /* Enable internal VCO needed for interruptions */ |
| 1165 | if (nau8821->dapm->bias_level < SND_SOC_BIAS_PREPARE) | 1163 | if (snd_soc_dapm_get_bias_level(nau8821->dapm) < SND_SOC_BIAS_PREPARE) |
| 1166 | nau8821_configure_sysclk(nau8821, NAU8821_CLK_INTERNAL, 0); | 1164 | nau8821_configure_sysclk(nau8821, NAU8821_CLK_INTERNAL, 0); |
| 1167 | 1165 | ||
| 1168 | /* Chip needs one FSCLK cycle in order to generate interruptions, | 1166 | /* Chip needs one FSCLK cycle in order to generate interruptions, |
| @@ -1191,7 +1189,6 @@ static irqreturn_t nau8821_interrupt(int irq, void *data) · 22 unmodified lines | |||
| 1191 | { | 1189 | { |
| 1192 | struct nau8821 *nau8821 = (struct nau8821 *)data; | 1190 | struct nau8821 *nau8821 = (struct nau8821 *)data; |
| 1193 | struct regmap *regmap = nau8821->regmap; | 1191 | struct regmap *regmap = nau8821->regmap; |
| 1194 | struct snd_soc_component *component; | ||
| 1195 | int active_irq, event = 0, event_mask = 0; | 1192 | int active_irq, event = 0, event_mask = 0; |
| 1196 | 1193 | ||
| 1197 | if (regmap_read(regmap, NAU8821_R10_IRQ_STATUS, &active_irq)) { | 1194 | if (regmap_read(regmap, NAU8821_R10_IRQ_STATUS, &active_irq)) { |
| @@ -1222,8 +1219,7 @@ static irqreturn_t nau8821_interrupt(int irq, void *data) · 24 unmodified lines | |||
| 1222 | NAU8821_MICDET_MASK, NAU8821_MICDET_EN); | 1219 | NAU8821_MICDET_MASK, NAU8821_MICDET_EN); |
| 1223 | if (nau8821_is_jack_inserted(regmap)) { | 1220 | if (nau8821_is_jack_inserted(regmap)) { |
| 1224 | /* Detect microphone and jack type */ | 1221 | /* Detect microphone and jack type */ |
| 1225 | component = snd_soc_dapm_to_component(nau8821->dapm); | 1222 | snd_soc_dapm_force_enable_pin(nau8821->dapm, "MICBIAS"); |
| 1226 | snd_soc_component_force_enable_pin(component, "MICBIAS"); | ||
| 1227 | snd_soc_dapm_sync(nau8821->dapm); | 1223 | snd_soc_dapm_sync(nau8821->dapm); |
| 1228 | schedule_delayed_work(&nau8821->jdet_work, msecs_to_jiffies(20)); | 1224 | schedule_delayed_work(&nau8821->jdet_work, msecs_to_jiffies(20)); |
| 1229 | /* Turn off insertion interruption at manual mode */ | 1225 | /* Turn off insertion interruption at manual mode */ |
| @@ -1261,8 +1257,7 @@ static const struct regmap_config nau8821_regmap_config = { · 31 unmodified lines | |||
| 1261 | static int nau8821_component_probe(struct snd_soc_component *component) | 1257 | static int nau8821_component_probe(struct snd_soc_component *component) |
| 1262 | { | 1258 | { |
| 1263 | struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component); | 1259 | struct nau8821 *nau8821 = snd_soc_component_get_drvdata(component); |
| 1264 | struct snd_soc_dapm_context *dapm = | 1260 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1265 | snd_soc_component_get_dapm(component); | ||
| 1266 | 1261 | ||
| 1267 | nau8821->dapm = dapm; | 1262 | nau8821->dapm = dapm; |
| 1268 | 1263 | ||
| @@ -1564,8 +1559,7 @@ static int nau8821_set_bias_level(struct snd_soc_component *component, · 295 unmodified lines | |||
| 1564 | 1559 | ||
| 1565 | case SND_SOC_BIAS_STANDBY: | 1560 | case SND_SOC_BIAS_STANDBY: |
| 1566 | /* Setup codec configuration after resume */ | 1561 | /* Setup codec configuration after resume */ |
| 1567 | if (snd_soc_component_get_bias_level(component) == | 1562 | if (snd_soc_dapm_get_bias_level(nau8821->dapm) == SND_SOC_BIAS_OFF) |
| 1568 | SND_SOC_BIAS_OFF) | ||
| 1569 | nau8821_resume_setup(nau8821); | 1563 | nau8821_resume_setup(nau8821); |
| 1570 | break; | 1564 | break; |
| 1571 | 1565 | ||
| @@ -1603,9 +1597,9 @@ static int __maybe_unused nau8821_suspend(struct snd_soc_component *component) · 31 unmodified lines | |||
| 1603 | 1597 | ||
| 1604 | if (nau8821->irq) | 1598 | if (nau8821->irq) |
| 1605 | disable_irq(nau8821->irq); | 1599 | disable_irq(nau8821->irq); |
| 1606 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 1600 | snd_soc_dapm_force_bias_level(nau8821->dapm, SND_SOC_BIAS_OFF); |
| 1607 | /* Power down codec power; don't support button wakeup */ | 1601 | /* Power down codec power; don't support button wakeup */ |
| 1608 | snd_soc_component_disable_pin(component, "MICBIAS"); | 1602 | snd_soc_dapm_disable_pin(nau8821->dapm, "MICBIAS"); |
| 1609 | snd_soc_dapm_sync(nau8821->dapm); | 1603 | snd_soc_dapm_sync(nau8821->dapm); |
| 1610 | regcache_cache_only(nau8821->regmap, true); | 1604 | regcache_cache_only(nau8821->regmap, true); |
| 1611 | regcache_mark_dirty(nau8821->regmap); | 1605 | regcache_mark_dirty(nau8821->regmap); |
| @@ -180,8 +180,7 @@ static bool nau8822_volatile(struct device *dev, unsigned int reg) · 179 unmodified lines | |||
| 180 | static int nau8822_eq_get(struct snd_kcontrol *kcontrol, | 180 | static int nau8822_eq_get(struct snd_kcontrol *kcontrol, |
| 181 | struct snd_ctl_elem_value *ucontrol) | 181 | struct snd_ctl_elem_value *ucontrol) |
| 182 | { | 182 | { |
| 183 | struct snd_soc_component *component = | 183 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 184 | snd_soc_kcontrol_component(kcontrol); | ||
| 185 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; | 184 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; |
| 186 | int i, reg; | 185 | int i, reg; |
| 187 | u16 reg_val, *val; | 186 | u16 reg_val, *val; |
| @@ -212,8 +211,7 @@ static int nau8822_eq_get(struct snd_kcontrol *kcontrol, · 24 unmodified lines | |||
| 212 | static int nau8822_eq_put(struct snd_kcontrol *kcontrol, | 211 | static int nau8822_eq_put(struct snd_kcontrol *kcontrol, |
| 213 | struct snd_ctl_elem_value *ucontrol) | 212 | struct snd_ctl_elem_value *ucontrol) |
| 214 | { | 213 | { |
| 215 | struct snd_soc_component *component = | 214 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 216 | snd_soc_kcontrol_component(kcontrol); | ||
| 217 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; | 215 | struct soc_bytes_ext *params = (void *)kcontrol->private_value; |
| 218 | void *data; | 216 | void *data; |
| 219 | u16 *val, value; | 217 | u16 *val, value; |
| @@ -959,6 +957,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 739 unmodified lines | |||
| 959 | enum snd_soc_bias_level level) | 957 | enum snd_soc_bias_level level) |
| 960 | { | 958 | { |
| 961 | struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component); | 959 | struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component); |
| 960 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 962 | 961 | ||
| 963 | switch (level) { | 962 | switch (level) { |
| 964 | case SND_SOC_BIAS_ON: | 963 | case SND_SOC_BIAS_ON: |
| @@ -966,7 +965,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 966 | 965 | ||
| 967 | case SND_SOC_BIAS_PREPARE: | 966 | case SND_SOC_BIAS_PREPARE: |
| 968 | if (nau8822->mclk && | 967 | if (nau8822->mclk && |
| 969 | snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_ON) { | 968 | snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_ON) { |
| 970 | int ret = clk_prepare_enable(nau8822->mclk); | 969 | int ret = clk_prepare_enable(nau8822->mclk); |
| 971 | 970 | ||
| 972 | if (ret) { | 971 | if (ret) { |
| @@ -983,7 +982,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 10 unmodified lines | |||
| 983 | 982 | ||
| 984 | case SND_SOC_BIAS_STANDBY: | 983 | case SND_SOC_BIAS_STANDBY: |
| 985 | if (nau8822->mclk && | 984 | if (nau8822->mclk && |
| 986 | snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_OFF) | 985 | snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_OFF) |
| 987 | clk_disable_unprepare(nau8822->mclk); | 986 | clk_disable_unprepare(nau8822->mclk); |
| 988 | 987 | ||
| 989 | snd_soc_component_update_bits(component, | 988 | snd_soc_component_update_bits(component, |
| @@ -991,8 +990,7 @@ static int nau8822_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 991 | NAU8822_IOBUF_EN | NAU8822_ABIAS_EN, | 990 | NAU8822_IOBUF_EN | NAU8822_ABIAS_EN, |
| 992 | NAU8822_IOBUF_EN | NAU8822_ABIAS_EN); | 991 | NAU8822_IOBUF_EN | NAU8822_ABIAS_EN); |
| 993 | 992 | ||
| 994 | if (snd_soc_component_get_bias_level(component) == | 993 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 995 | SND_SOC_BIAS_OFF) { | ||
| 996 | snd_soc_component_update_bits(component, | 994 | snd_soc_component_update_bits(component, |
| 997 | NAU8822_REG_POWER_MANAGEMENT_1, | 995 | NAU8822_REG_POWER_MANAGEMENT_1, |
| 998 | NAU8822_REFIMP_MASK, NAU8822_REFIMP_3K); | 996 | NAU8822_REFIMP_MASK, NAU8822_REFIMP_3K); |
| @@ -1055,8 +1053,9 @@ static struct snd_soc_dai_driver nau8822_dai = { · 56 unmodified lines | |||
| 1055 | static int nau8822_suspend(struct snd_soc_component *component) | 1053 | static int nau8822_suspend(struct snd_soc_component *component) |
| 1056 | { | 1054 | { |
| 1057 | struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component); | 1055 | struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component); |
| 1056 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1058 | 1057 | ||
| 1059 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 1058 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 1060 | 1059 | ||
| 1061 | regcache_mark_dirty(nau8822->regmap); | 1060 | regcache_mark_dirty(nau8822->regmap); |
| 1062 | 1061 | ||
| @@ -1066,10 +1065,11 @@ static int nau8822_suspend(struct snd_soc_component *component) · 3 unmodified lines | |||
| 1066 | static int nau8822_resume(struct snd_soc_component *component) | 1065 | static int nau8822_resume(struct snd_soc_component *component) |
| 1067 | { | 1066 | { |
| 1068 | struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component); | 1067 | struct nau8822 *nau8822 = snd_soc_component_get_drvdata(component); |
| 1068 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1069 | 1069 | ||
| 1070 | regcache_sync(nau8822->regmap); | 1070 | regcache_sync(nau8822->regmap); |
| 1071 | 1071 | ||
| 1072 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY); | 1072 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_STANDBY); |
| 1073 | 1073 | ||
| 1074 | return 0; | 1074 | return 0; |
| 1075 | } | 1075 | } |
| @@ -876,7 +876,7 @@ static void nau8824_eject_jack(struct nau8824 *nau8824) · 875 unmodified lines | |||
| 876 | NAU8824_JD_SLEEP_MODE, NAU8824_JD_SLEEP_MODE); | 876 | NAU8824_JD_SLEEP_MODE, NAU8824_JD_SLEEP_MODE); |
| 877 | 877 | ||
| 878 | /* Close clock for jack type detection at manual mode */ | 878 | /* Close clock for jack type detection at manual mode */ |
| 879 | if (dapm->bias_level < SND_SOC_BIAS_PREPARE) | 879 | if (snd_soc_dapm_get_bias_level(dapm) < SND_SOC_BIAS_PREPARE) |
| 880 | nau8824_config_sysclk(nau8824, NAU8824_CLK_DIS, 0); | 880 | nau8824_config_sysclk(nau8824, NAU8824_CLK_DIS, 0); |
| 881 | } | 881 | } |
| 882 | 882 | ||
| @@ -931,7 +931,7 @@ static void nau8824_setup_auto_irq(struct nau8824 *nau8824) · 48 unmodified lines | |||
| 931 | regmap_update_bits(regmap, NAU8824_REG_INTERRUPT_SETTING, | 931 | regmap_update_bits(regmap, NAU8824_REG_INTERRUPT_SETTING, |
| 932 | NAU8824_IRQ_EJECT_DIS, 0); | 932 | NAU8824_IRQ_EJECT_DIS, 0); |
| 933 | /* Enable internal VCO needed for interruptions */ | 933 | /* Enable internal VCO needed for interruptions */ |
| 934 | if (nau8824->dapm->bias_level < SND_SOC_BIAS_PREPARE) | 934 | if (snd_soc_dapm_get_bias_level(nau8824->dapm) < SND_SOC_BIAS_PREPARE) |
| 935 | nau8824_config_sysclk(nau8824, NAU8824_CLK_INTERNAL, 0); | 935 | nau8824_config_sysclk(nau8824, NAU8824_CLK_INTERNAL, 0); |
| 936 | regmap_update_bits(regmap, NAU8824_REG_ENA_CTRL, | 936 | regmap_update_bits(regmap, NAU8824_REG_ENA_CTRL, |
| 937 | NAU8824_JD_SLEEP_MODE, 0); | 937 | NAU8824_JD_SLEEP_MODE, 0); |
| @@ -1498,7 +1498,7 @@ static int nau8824_set_bias_level(struct snd_soc_component *component, · 560 unmodified lines | |||
| 1498 | break; | 1498 | break; |
| 1499 | 1499 | ||
| 1500 | case SND_SOC_BIAS_STANDBY: | 1500 | case SND_SOC_BIAS_STANDBY: |
| 1501 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1501 | if (snd_soc_dapm_get_bias_level(nau8824->dapm) == SND_SOC_BIAS_OFF) { |
| 1502 | /* Setup codec configuration after resume */ | 1502 | /* Setup codec configuration after resume */ |
| 1503 | nau8824_resume_setup(nau8824); | 1503 | nau8824_resume_setup(nau8824); |
| 1504 | } | 1504 | } |
| @@ -1519,7 +1519,7 @@ static int nau8824_set_bias_level(struct snd_soc_component *component, · 14 unmodified lines | |||
| 1519 | static int nau8824_component_probe(struct snd_soc_component *component) | 1519 | static int nau8824_component_probe(struct snd_soc_component *component) |
| 1520 | { | 1520 | { |
| 1521 | struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component); | 1521 | struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component); |
| 1522 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1522 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1523 | 1523 | ||
| 1524 | nau8824->dapm = dapm; | 1524 | nau8824->dapm = dapm; |
| 1525 | 1525 | ||
| @@ -1532,7 +1532,7 @@ static int __maybe_unused nau8824_suspend(struct snd_soc_component *component) · 6 unmodified lines | |||
| 1532 | 1532 | ||
| 1533 | if (nau8824->irq) { | 1533 | if (nau8824->irq) { |
| 1534 | disable_irq(nau8824->irq); | 1534 | disable_irq(nau8824->irq); |
| 1535 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 1535 | snd_soc_dapm_force_bias_level(nau8824->dapm, SND_SOC_BIAS_OFF); |
| 1536 | } | 1536 | } |
| 1537 | regcache_cache_only(nau8824->regmap, true); | 1537 | regcache_cache_only(nau8824->regmap, true); |
| 1538 | regcache_mark_dirty(nau8824->regmap); | 1538 | regcache_mark_dirty(nau8824->regmap); |
| @@ -2226,7 +2226,7 @@ static const struct regmap_config nau8825_regmap_config = { · 2225 unmodified lines | |||
| 2226 | static int nau8825_component_probe(struct snd_soc_component *component) | 2226 | static int nau8825_component_probe(struct snd_soc_component *component) |
| 2227 | { | 2227 | { |
| 2228 | struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component); | 2228 | struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component); |
| 2229 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 2229 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2230 | 2230 | ||
| 2231 | nau8825->dapm = dapm; | 2231 | nau8825->dapm = dapm; |
| 2232 | 2232 | ||
| @@ -2630,7 +2630,7 @@ static int nau8825_set_bias_level(struct snd_soc_component *component, · 397 unmodified lines | |||
| 2630 | break; | 2630 | break; |
| 2631 | 2631 | ||
| 2632 | case SND_SOC_BIAS_STANDBY: | 2632 | case SND_SOC_BIAS_STANDBY: |
| 2633 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 2633 | if (snd_soc_dapm_get_bias_level(nau8825->dapm) == SND_SOC_BIAS_OFF) { |
| 2634 | if (nau8825->mclk_freq) { | 2634 | if (nau8825->mclk_freq) { |
| 2635 | ret = clk_prepare_enable(nau8825->mclk); | 2635 | ret = clk_prepare_enable(nau8825->mclk); |
| 2636 | if (ret) { | 2636 | if (ret) { |
| @@ -2673,7 +2673,7 @@ static int __maybe_unused nau8825_suspend(struct snd_soc_component *component) · 36 unmodified lines | |||
| 2673 | struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component); | 2673 | struct nau8825 *nau8825 = snd_soc_component_get_drvdata(component); |
| 2674 | 2674 | ||
| 2675 | disable_irq(nau8825->irq); | 2675 | disable_irq(nau8825->irq); |
| 2676 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 2676 | snd_soc_dapm_force_bias_level(nau8825->dapm, SND_SOC_BIAS_OFF); |
| 2677 | /* Power down codec power; don't suppoet button wakeup */ | 2677 | /* Power down codec power; don't suppoet button wakeup */ |
| 2678 | snd_soc_dapm_disable_pin(nau8825->dapm, "SAR"); | 2678 | snd_soc_dapm_disable_pin(nau8825->dapm, "SAR"); |
| 2679 | snd_soc_dapm_disable_pin(nau8825->dapm, "MICBIAS"); | 2679 | snd_soc_dapm_disable_pin(nau8825->dapm, "MICBIAS"); |
| @@ -92,7 +92,7 @@ static int ntp8835_mute_info(struct snd_kcontrol *kcontrol, · 91 unmodified lines | |||
| 92 | static int ntp8835_mute_get(struct snd_kcontrol *kcontrol, | 92 | static int ntp8835_mute_get(struct snd_kcontrol *kcontrol, |
| 93 | struct snd_ctl_elem_value *ucontrol) | 93 | struct snd_ctl_elem_value *ucontrol) |
| 94 | { | 94 | { |
| 95 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 95 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 96 | unsigned int val; | 96 | unsigned int val; |
| 97 | 97 | ||
| 98 | val = snd_soc_component_read(component, NTP8835_SOFT_MUTE); | 98 | val = snd_soc_component_read(component, NTP8835_SOFT_MUTE); |
| @@ -104,7 +104,7 @@ static int ntp8835_mute_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 104 | static int ntp8835_mute_put(struct snd_kcontrol *kcontrol, | 104 | static int ntp8835_mute_put(struct snd_kcontrol *kcontrol, |
| 105 | struct snd_ctl_elem_value *ucontrol) | 105 | struct snd_ctl_elem_value *ucontrol) |
| 106 | { | 106 | { |
| 107 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 107 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 108 | unsigned int val; | 108 | unsigned int val; |
| 109 | 109 | ||
| 110 | val = ucontrol->value.integer.value[0] ? 0 : 7; | 110 | val = ucontrol->value.integer.value[0] ? 0 : 7; |
| @@ -108,7 +108,7 @@ static int pcm1681_set_deemph(struct snd_soc_component *component) · 107 unmodified lines | |||
| 108 | static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol, | 108 | static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol, |
| 109 | struct snd_ctl_elem_value *ucontrol) | 109 | struct snd_ctl_elem_value *ucontrol) |
| 110 | { | 110 | { |
| 111 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 111 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 112 | struct pcm1681_private *priv = snd_soc_component_get_drvdata(component); | 112 | struct pcm1681_private *priv = snd_soc_component_get_drvdata(component); |
| 113 | 113 | ||
| 114 | ucontrol->value.integer.value[0] = priv->deemph; | 114 | ucontrol->value.integer.value[0] = priv->deemph; |
| @@ -119,7 +119,7 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 119 | static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol, | 119 | static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol, |
| 120 | struct snd_ctl_elem_value *ucontrol) | 120 | struct snd_ctl_elem_value *ucontrol) |
| 121 | { | 121 | { |
| 122 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 122 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 123 | struct pcm1681_private *priv = snd_soc_component_get_drvdata(component); | 123 | struct pcm1681_private *priv = snd_soc_component_get_drvdata(component); |
| 124 | 124 | ||
| 125 | priv->deemph = ucontrol->value.integer.value[0]; | 125 | priv->deemph = ucontrol->value.integer.value[0]; |
| @@ -546,8 +546,10 @@ static int pcm186x_power_off(struct snd_soc_component *component) · 545 unmodified lines | |||
| 546 | static int pcm186x_set_bias_level(struct snd_soc_component *component, | 546 | static int pcm186x_set_bias_level(struct snd_soc_component *component, |
| 547 | enum snd_soc_bias_level level) | 547 | enum snd_soc_bias_level level) |
| 548 | { | 548 | { |
| 549 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 550 | |||
| 549 | dev_dbg(component->dev, "## %s: %d -> %d\n", __func__, | 551 | dev_dbg(component->dev, "## %s: %d -> %d\n", __func__, |
| 550 | snd_soc_component_get_bias_level(component), level); | 552 | snd_soc_dapm_get_bias_level(dapm), level); |
| 551 | 553 | ||
| 552 | switch (level) { | 554 | switch (level) { |
| 553 | case SND_SOC_BIAS_ON: | 555 | case SND_SOC_BIAS_ON: |
| @@ -555,7 +557,7 @@ static int pcm186x_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 555 | case SND_SOC_BIAS_PREPARE: | 557 | case SND_SOC_BIAS_PREPARE: |
| 556 | break; | 558 | break; |
| 557 | case SND_SOC_BIAS_STANDBY: | 559 | case SND_SOC_BIAS_STANDBY: |
| 558 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 560 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 559 | pcm186x_power_on(component); | 561 | pcm186x_power_on(component); |
| 560 | break; | 562 | break; |
| 561 | case SND_SOC_BIAS_OFF: | 563 | case SND_SOC_BIAS_OFF: |
| @@ -224,7 +224,7 @@ static bool pcm512x_volatile(struct device *dev, unsigned int reg) · 223 unmodified lines | |||
| 224 | static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol, | 224 | static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol, |
| 225 | struct snd_ctl_elem_value *ucontrol) | 225 | struct snd_ctl_elem_value *ucontrol) |
| 226 | { | 226 | { |
| 227 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 227 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 228 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 228 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 229 | 229 | ||
| 230 | ucontrol->value.integer.value[0] = pcm512x->overclock_pll; | 230 | ucontrol->value.integer.value[0] = pcm512x->overclock_pll; |
| @@ -234,10 +234,11 @@ static int pcm512x_overclock_pll_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 234 | static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, | 234 | static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, |
| 235 | struct snd_ctl_elem_value *ucontrol) | 235 | struct snd_ctl_elem_value *ucontrol) |
| 236 | { | 236 | { |
| 237 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 237 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 238 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); | ||
| 238 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 239 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 239 | 240 | ||
| 240 | switch (snd_soc_component_get_bias_level(component)) { | 241 | switch (snd_soc_dapm_get_bias_level(dapm)) { |
| 241 | case SND_SOC_BIAS_OFF: | 242 | case SND_SOC_BIAS_OFF: |
| 242 | case SND_SOC_BIAS_STANDBY: | 243 | case SND_SOC_BIAS_STANDBY: |
| 243 | break; | 244 | break; |
| @@ -252,7 +253,7 @@ static int pcm512x_overclock_pll_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 252 | static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol, | 253 | static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol, |
| 253 | struct snd_ctl_elem_value *ucontrol) | 254 | struct snd_ctl_elem_value *ucontrol) |
| 254 | { | 255 | { |
| 255 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 256 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 256 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 257 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 257 | 258 | ||
| 258 | ucontrol->value.integer.value[0] = pcm512x->overclock_dsp; | 259 | ucontrol->value.integer.value[0] = pcm512x->overclock_dsp; |
| @@ -262,10 +263,11 @@ static int pcm512x_overclock_dsp_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 262 | static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, | 263 | static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, |
| 263 | struct snd_ctl_elem_value *ucontrol) | 264 | struct snd_ctl_elem_value *ucontrol) |
| 264 | { | 265 | { |
| 265 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 266 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 267 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); | ||
| 266 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 268 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 267 | 269 | ||
| 268 | switch (snd_soc_component_get_bias_level(component)) { | 270 | switch (snd_soc_dapm_get_bias_level(dapm)) { |
| 269 | case SND_SOC_BIAS_OFF: | 271 | case SND_SOC_BIAS_OFF: |
| 270 | case SND_SOC_BIAS_STANDBY: | 272 | case SND_SOC_BIAS_STANDBY: |
| 271 | break; | 273 | break; |
| @@ -280,7 +282,7 @@ static int pcm512x_overclock_dsp_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 280 | static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol, | 282 | static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol, |
| 281 | struct snd_ctl_elem_value *ucontrol) | 283 | struct snd_ctl_elem_value *ucontrol) |
| 282 | { | 284 | { |
| 283 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 285 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 284 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 286 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 285 | 287 | ||
| 286 | ucontrol->value.integer.value[0] = pcm512x->overclock_dac; | 288 | ucontrol->value.integer.value[0] = pcm512x->overclock_dac; |
| @@ -290,10 +292,11 @@ static int pcm512x_overclock_dac_get(struct snd_kcontrol *kcontrol, · 3 unmodified lines | |||
| 290 | static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol, | 292 | static int pcm512x_overclock_dac_put(struct snd_kcontrol *kcontrol, |
| 291 | struct snd_ctl_elem_value *ucontrol) | 293 | struct snd_ctl_elem_value *ucontrol) |
| 292 | { | 294 | { |
| 293 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 295 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 296 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); | ||
| 294 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 297 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 295 | 298 | ||
| 296 | switch (snd_soc_component_get_bias_level(component)) { | 299 | switch (snd_soc_dapm_get_bias_level(dapm)) { |
| 297 | case SND_SOC_BIAS_OFF: | 300 | case SND_SOC_BIAS_OFF: |
| 298 | case SND_SOC_BIAS_STANDBY: | 301 | case SND_SOC_BIAS_STANDBY: |
| 299 | break; | 302 | break; |
| @@ -393,7 +396,7 @@ static int pcm512x_update_mute(struct pcm512x_priv *pcm512x) · 93 unmodified lines | |||
| 393 | static int pcm512x_digital_playback_switch_get(struct snd_kcontrol *kcontrol, | 396 | static int pcm512x_digital_playback_switch_get(struct snd_kcontrol *kcontrol, |
| 394 | struct snd_ctl_elem_value *ucontrol) | 397 | struct snd_ctl_elem_value *ucontrol) |
| 395 | { | 398 | { |
| 396 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 399 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 397 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 400 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 398 | 401 | ||
| 399 | mutex_lock(&pcm512x->mutex); | 402 | mutex_lock(&pcm512x->mutex); |
| @@ -407,7 +410,7 @@ static int pcm512x_digital_playback_switch_get(struct snd_kcontrol *kcontrol, · 7 unmodified lines | |||
| 407 | static int pcm512x_digital_playback_switch_put(struct snd_kcontrol *kcontrol, | 410 | static int pcm512x_digital_playback_switch_put(struct snd_kcontrol *kcontrol, |
| 408 | struct snd_ctl_elem_value *ucontrol) | 411 | struct snd_ctl_elem_value *ucontrol) |
| 409 | { | 412 | { |
| 410 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 413 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 411 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); | 414 | struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); |
| 412 | int ret, changed = 0; | 415 | int ret, changed = 0; |
| 413 | 416 | ||
| @@ -1139,8 +1139,7 @@ static int pcmdevice_info_profile( · 1138 unmodified lines | |||
| 1139 | struct snd_kcontrol *kcontrol, | 1139 | struct snd_kcontrol *kcontrol, |
| 1140 | struct snd_ctl_elem_info *uinfo) | 1140 | struct snd_ctl_elem_info *uinfo) |
| 1141 | { | 1141 | { |
| 1142 | struct snd_soc_component *codec | 1142 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1143 | = snd_soc_kcontrol_component(kcontrol); | ||
| 1144 | struct pcmdevice_priv *pcm_dev = | 1143 | struct pcmdevice_priv *pcm_dev = |
| 1145 | snd_soc_component_get_drvdata(codec); | 1144 | snd_soc_component_get_drvdata(codec); |
| 1146 | 1145 | ||
| @@ -1156,8 +1155,7 @@ static int pcmdevice_get_profile_id( · 9 unmodified lines | |||
| 1156 | struct snd_kcontrol *kcontrol, | 1155 | struct snd_kcontrol *kcontrol, |
| 1157 | struct snd_ctl_elem_value *ucontrol) | 1156 | struct snd_ctl_elem_value *ucontrol) |
| 1158 | { | 1157 | { |
| 1159 | struct snd_soc_component *codec | 1158 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1160 | = snd_soc_kcontrol_component(kcontrol); | ||
| 1161 | struct pcmdevice_priv *pcm_dev = | 1159 | struct pcmdevice_priv *pcm_dev = |
| 1162 | snd_soc_component_get_drvdata(codec); | 1160 | snd_soc_component_get_drvdata(codec); |
| 1163 | 1161 | ||
| @@ -1170,8 +1168,7 @@ static int pcmdevice_set_profile_id( · 6 unmodified lines | |||
| 1170 | struct snd_kcontrol *kcontrol, | 1168 | struct snd_kcontrol *kcontrol, |
| 1171 | struct snd_ctl_elem_value *ucontrol) | 1169 | struct snd_ctl_elem_value *ucontrol) |
| 1172 | { | 1170 | { |
| 1173 | struct snd_soc_component *codec | 1171 | struct snd_soc_component *codec = snd_kcontrol_chip(kcontrol); |
| 1174 | = snd_soc_kcontrol_component(kcontrol); | ||
| 1175 | struct pcmdevice_priv *pcm_dev = | 1172 | struct pcmdevice_priv *pcm_dev = |
| 1176 | snd_soc_component_get_drvdata(codec); | 1173 | snd_soc_component_get_drvdata(codec); |
| 1177 | int nr_profile = ucontrol->value.integer.value[0]; | 1174 | int nr_profile = ucontrol->value.integer.value[0]; |
| @@ -276,7 +276,7 @@ static int peb2466_lkup_ctrl_put(struct snd_kcontrol *kcontrol, · 275 unmodified lines | |||
| 276 | { | 276 | { |
| 277 | struct peb2466_lkup_ctrl *lkup_ctrl = | 277 | struct peb2466_lkup_ctrl *lkup_ctrl = |
| 278 | (struct peb2466_lkup_ctrl *)kcontrol->private_value; | 278 | (struct peb2466_lkup_ctrl *)kcontrol->private_value; |
| 279 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 279 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 280 | struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component); | 280 | struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component); |
| 281 | unsigned int index; | 281 | unsigned int index; |
| 282 | int ret; | 282 | int ret; |
| @@ -377,7 +377,7 @@ static const struct soc_enum peb2466_tg_freq[][2] = { · 94 unmodified lines | |||
| 377 | static int peb2466_tg_freq_get(struct snd_kcontrol *kcontrol, | 377 | static int peb2466_tg_freq_get(struct snd_kcontrol *kcontrol, |
| 378 | struct snd_ctl_elem_value *ucontrol) | 378 | struct snd_ctl_elem_value *ucontrol) |
| 379 | { | 379 | { |
| 380 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 380 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 381 | struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component); | 381 | struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component); |
| 382 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 382 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 383 | 383 | ||
| @@ -415,7 +415,7 @@ static int peb2466_tg_freq_get(struct snd_kcontrol *kcontrol, · 31 unmodified lines | |||
| 415 | static int peb2466_tg_freq_put(struct snd_kcontrol *kcontrol, | 415 | static int peb2466_tg_freq_put(struct snd_kcontrol *kcontrol, |
| 416 | struct snd_ctl_elem_value *ucontrol) | 416 | struct snd_ctl_elem_value *ucontrol) |
| 417 | { | 417 | { |
| 418 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 418 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 419 | struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component); | 419 | struct peb2466 *peb2466 = snd_soc_component_get_drvdata(component); |
| 420 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 420 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 421 | unsigned int *tg_freq_item; | 421 | unsigned int *tg_freq_item; |
| @@ -20,12 +20,12 @@ · 19 unmodified lines | |||
| 20 | #include <sound/soc.h> | 20 | #include <sound/soc.h> |
| 21 | #include "pm4125.h" | 21 | #include "pm4125.h" |
| 22 | 22 | ||
| 23 | static struct pm4125_sdw_ch_info pm4125_sdw_rx_ch_info[] = { | 23 | static struct wcd_sdw_ch_info pm4125_sdw_rx_ch_info[] = { |
| 24 | WCD_SDW_CH(PM4125_HPH_L, PM4125_HPH_PORT, BIT(0)), | 24 | WCD_SDW_CH(PM4125_HPH_L, PM4125_HPH_PORT, BIT(0)), |
| 25 | WCD_SDW_CH(PM4125_HPH_R, PM4125_HPH_PORT, BIT(1)), | 25 | WCD_SDW_CH(PM4125_HPH_R, PM4125_HPH_PORT, BIT(1)), |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | static struct pm4125_sdw_ch_info pm4125_sdw_tx_ch_info[] = { | 28 | static struct wcd_sdw_ch_info pm4125_sdw_tx_ch_info[] = { |
| 29 | WCD_SDW_CH(PM4125_ADC1, PM4125_ADC_1_2_DMIC1L_BCS_PORT, BIT(0)), | 29 | WCD_SDW_CH(PM4125_ADC1, PM4125_ADC_1_2_DMIC1L_BCS_PORT, BIT(0)), |
| 30 | WCD_SDW_CH(PM4125_ADC2, PM4125_ADC_1_2_DMIC1L_BCS_PORT, BIT(1)), | 30 | WCD_SDW_CH(PM4125_ADC2, PM4125_ADC_1_2_DMIC1L_BCS_PORT, BIT(1)), |
| 31 | }; | 31 | }; |
| @@ -46,12 +46,6 @@ static struct sdw_dpn_prop pm4125_dpn_prop[PM4125_MAX_SWR_PORTS] = { · 14 unmodified lines | |||
| 46 | } | 46 | } |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
| 49 | struct device *pm4125_sdw_device_get(struct device_node *np) | ||
| 50 | { | ||
| 51 | return bus_find_device_by_of_node(&sdw_bus_type, np); | ||
| 52 | } | ||
| 53 | EXPORT_SYMBOL_GPL(pm4125_sdw_device_get); | ||
| 54 | |||
| 55 | int pm4125_sdw_hw_params(struct pm4125_sdw_priv *priv, struct snd_pcm_substream *substream, | 49 | int pm4125_sdw_hw_params(struct pm4125_sdw_priv *priv, struct snd_pcm_substream *substream, |
| 56 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 50 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
| 57 | { | 51 | { |
| @@ -83,19 +77,6 @@ int pm4125_sdw_hw_params(struct pm4125_sdw_priv *priv, struct snd_pcm_substream · 25 unmodified lines | |||
| 83 | } | 77 | } |
| 84 | EXPORT_SYMBOL_GPL(pm4125_sdw_hw_params); | 78 | EXPORT_SYMBOL_GPL(pm4125_sdw_hw_params); |
| 85 | 79 | ||
| 86 | static int pm4125_update_status(struct sdw_slave *slave, enum sdw_slave_status status) | ||
| 87 | { | ||
| 88 | struct pm4125_sdw_priv *priv = dev_get_drvdata(&slave->dev); | ||
| 89 | |||
| 90 | if (priv->regmap && status == SDW_SLAVE_ATTACHED) { | ||
| 91 | /* Write out any cached changes that happened between probe and attach */ | ||
| 92 | regcache_cache_only(priv->regmap, false); | ||
| 93 | return regcache_sync(priv->regmap); | ||
| 94 | } | ||
| 95 | |||
| 96 | return 0; | ||
| 97 | } | ||
| 98 | |||
| 99 | /* | 80 | /* |
| 100 | * Handle Soundwire out-of-band interrupt event by triggering the first irq of the slave_irq | 81 | * Handle Soundwire out-of-band interrupt event by triggering the first irq of the slave_irq |
| 101 | * irq domain, which then will be handled by the regmap_irq threaded irq. | 82 | * irq domain, which then will be handled by the regmap_irq threaded irq. |
| @@ -104,18 +85,9 @@ static int pm4125_update_status(struct sdw_slave *slave, enum sdw_slave_status s · 2 unmodified lines | |||
| 104 | static int pm4125_interrupt_callback(struct sdw_slave *slave, struct sdw_slave_intr_status *status) | 85 | static int pm4125_interrupt_callback(struct sdw_slave *slave, struct sdw_slave_intr_status *status) |
| 105 | { | 86 | { |
| 106 | struct pm4125_sdw_priv *priv = dev_get_drvdata(&slave->dev); | 87 | struct pm4125_sdw_priv *priv = dev_get_drvdata(&slave->dev); |
| 107 | struct irq_domain *slave_irq = priv->slave_irq; | ||
| 108 | u32 sts1, sts2, sts3; | ||
| 109 | |||
| 110 | do { | ||
| 111 | handle_nested_irq(irq_find_mapping(slave_irq, 0)); | ||
| 112 | regmap_read(priv->regmap, PM4125_DIG_SWR_INTR_STATUS_0, &sts1); | ||
| 113 | regmap_read(priv->regmap, PM4125_DIG_SWR_INTR_STATUS_1, &sts2); | ||
| 114 | regmap_read(priv->regmap, PM4125_DIG_SWR_INTR_STATUS_2, &sts3); | ||
| 115 | 88 | ||
| 116 | } while (sts1 || sts2 || sts3); | 89 | return wcd_interrupt_callback(slave, priv->slave_irq, PM4125_DIG_SWR_INTR_STATUS_0, |
| 117 | 90 | PM4125_DIG_SWR_INTR_STATUS_1, PM4125_DIG_SWR_INTR_STATUS_2); | |
| 118 | return IRQ_HANDLED; | ||
| 119 | } | 91 | } |
| 120 | 92 | ||
| 121 | static const struct reg_default pm4125_defaults[] = { | 93 | static const struct reg_default pm4125_defaults[] = { |
| @@ -369,32 +341,10 @@ static const struct regmap_config pm4125_regmap_config = { · 247 unmodified lines | |||
| 369 | }; | 341 | }; |
| 370 | 342 | ||
| 371 | static const struct sdw_slave_ops pm4125_slave_ops = { | 343 | static const struct sdw_slave_ops pm4125_slave_ops = { |
| 372 | .update_status = pm4125_update_status, | 344 | .update_status = wcd_update_status, |
| 373 | .interrupt_callback = pm4125_interrupt_callback, | 345 | .interrupt_callback = pm4125_interrupt_callback, |
| 374 | }; | 346 | }; |
| 375 | 347 | ||
| 376 | static int pm4125_sdw_component_bind(struct device *dev, struct device *master, void *data) | ||
| 377 | { | ||
| 378 | pm_runtime_set_autosuspend_delay(dev, 3000); | ||
| 379 | pm_runtime_use_autosuspend(dev); | ||
| 380 | pm_runtime_set_active(dev); | ||
| 381 | pm_runtime_enable(dev); | ||
| 382 | |||
| 383 | return 0; | ||
| 384 | } | ||
| 385 | |||
| 386 | static void pm4125_sdw_component_unbind(struct device *dev, struct device *master, void *data) | ||
| 387 | { | ||
| 388 | pm_runtime_disable(dev); | ||
| 389 | pm_runtime_set_suspended(dev); | ||
| 390 | pm_runtime_dont_use_autosuspend(dev); | ||
| 391 | } | ||
| 392 | |||
| 393 | static const struct component_ops pm4125_sdw_component_ops = { | ||
| 394 | .bind = pm4125_sdw_component_bind, | ||
| 395 | .unbind = pm4125_sdw_component_unbind, | ||
| 396 | }; | ||
| 397 | |||
| 398 | static int pm4125_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) | 348 | static int pm4125_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) |
| 399 | { | 349 | { |
| 400 | struct device *dev = &pdev->dev; | 350 | struct device *dev = &pdev->dev; |
| @@ -476,7 +426,7 @@ static int pm4125_probe(struct sdw_slave *pdev, const struct sdw_device_id *id) · 75 unmodified lines | |||
| 476 | priv->ch_info[i].master_ch_mask = PM4125_SWRM_CH_MASK(master_ch_mask[i]); | 426 | priv->ch_info[i].master_ch_mask = PM4125_SWRM_CH_MASK(master_ch_mask[i]); |
| 477 | } | 427 | } |
| 478 | 428 | ||
| 479 | ret = component_add(dev, &pm4125_sdw_component_ops); | 429 | ret = component_add(dev, &wcd_sdw_component_ops); |
| 480 | if (ret) | 430 | if (ret) |
| 481 | return ret; | 431 | return ret; |
| 482 | 432 | ||
| @@ -490,7 +440,7 @@ static int pm4125_remove(struct sdw_slave *pdev) · 7 unmodified lines | |||
| 490 | { | 440 | { |
| 491 | struct device *dev = &pdev->dev; | 441 | struct device *dev = &pdev->dev; |
| 492 | 442 | ||
| 493 | component_del(dev, &pm4125_sdw_component_ops); | 443 | component_del(dev, &wcd_sdw_component_ops); |
| 494 | 444 | ||
| 495 | return 0; | 445 | return 0; |
| 496 | } | 446 | } |
| @@ -69,16 +69,14 @@ struct pm4125_priv { · 68 unmodified lines | |||
| 69 | struct wcd_mbhc *wcd_mbhc; | 69 | struct wcd_mbhc *wcd_mbhc; |
| 70 | struct wcd_mbhc_config mbhc_cfg; | 70 | struct wcd_mbhc_config mbhc_cfg; |
| 71 | struct wcd_mbhc_intr intr_ids; | 71 | struct wcd_mbhc_intr intr_ids; |
| 72 | struct wcd_common common; | ||
| 72 | struct irq_domain *virq; | 73 | struct irq_domain *virq; |
| 73 | const struct regmap_irq_chip *pm4125_regmap_irq_chip; | 74 | const struct regmap_irq_chip *chip_desc; |
| 74 | struct regmap_irq_chip_data *irq_chip; | 75 | struct regmap_irq_chip_data *irq_chip; |
| 75 | struct snd_soc_jack *jack; | 76 | struct snd_soc_jack *jack; |
| 76 | unsigned long status_mask; | 77 | unsigned long status_mask; |
| 77 | s32 micb_ref[PM4125_MAX_MICBIAS]; | 78 | s32 micb_ref[PM4125_MAX_MICBIAS]; |
| 78 | s32 pullup_ref[PM4125_MAX_MICBIAS]; | 79 | s32 pullup_ref[PM4125_MAX_MICBIAS]; |
| 79 | u32 micb1_mv; | ||
| 80 | u32 micb2_mv; | ||
| 81 | u32 micb3_mv; | ||
| 82 | 80 | ||
| 83 | int hphr_pdm_wd_int; | 81 | int hphr_pdm_wd_int; |
| 84 | int hphl_pdm_wd_int; | 82 | int hphl_pdm_wd_int; |
| @@ -179,7 +177,7 @@ static const u32 pm4125_config_regs[] = { · 94 unmodified lines | |||
| 179 | PM4125_DIG_SWR_INTR_LEVEL_0, | 177 | PM4125_DIG_SWR_INTR_LEVEL_0, |
| 180 | }; | 178 | }; |
| 181 | 179 | ||
| 182 | static struct regmap_irq_chip pm4125_regmap_irq_chip = { | 180 | static const struct regmap_irq_chip pm4125_regmap_irq_chip = { |
| 183 | .name = "pm4125", | 181 | .name = "pm4125", |
| 184 | .irqs = pm4125_irqs, | 182 | .irqs = pm4125_irqs, |
| 185 | .num_irqs = ARRAY_SIZE(pm4125_irqs), | 183 | .num_irqs = ARRAY_SIZE(pm4125_irqs), |
| @@ -644,16 +642,6 @@ static int pm4125_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, · 458 unmodified lines | |||
| 644 | return 0; | 642 | return 0; |
| 645 | } | 643 | } |
| 646 | 644 | ||
| 647 | static int pm4125_get_micb_vout_ctl_val(struct device *dev, u32 micb_mv) | ||
| 648 | { | ||
| 649 | if (micb_mv < 1600 || micb_mv > 2850) { | ||
| 650 | dev_err(dev, "%s: unsupported micbias voltage (%u mV)\n", __func__, micb_mv); | ||
| 651 | return -EINVAL; | ||
| 652 | } | ||
| 653 | |||
| 654 | return (micb_mv - 1600) / 50; | ||
| 655 | } | ||
| 656 | |||
| 657 | static int pm4125_codec_enable_adc(struct snd_soc_dapm_widget *w, | 645 | static int pm4125_codec_enable_adc(struct snd_soc_dapm_widget *w, |
| 658 | struct snd_kcontrol *kcontrol, int event) | 646 | struct snd_kcontrol *kcontrol, int event) |
| 659 | { | 647 | { |
| @@ -691,7 +679,7 @@ static int pm4125_codec_enable_adc(struct snd_soc_dapm_widget *w, · 31 unmodified lines | |||
| 691 | 0x00); | 679 | 0x00); |
| 692 | pm4125_global_mbias_disable(component); | 680 | pm4125_global_mbias_disable(component); |
| 693 | break; | 681 | break; |
| 694 | }; | 682 | } |
| 695 | 683 | ||
| 696 | return 0; | 684 | return 0; |
| 697 | } | 685 | } |
| @@ -756,7 +744,7 @@ static int pm4125_micbias_control(struct snd_soc_component *component, int micb_ · 58 unmodified lines | |||
| 756 | dev_err(component->dev, "%s: Invalid micbias number: %d\n", | 744 | dev_err(component->dev, "%s: Invalid micbias number: %d\n", |
| 757 | __func__, micb_num); | 745 | __func__, micb_num); |
| 758 | return -EINVAL; | 746 | return -EINVAL; |
| 759 | }; | 747 | } |
| 760 | 748 | ||
| 761 | switch (req) { | 749 | switch (req) { |
| 762 | case MICB_PULLUP_ENABLE: | 750 | case MICB_PULLUP_ENABLE: |
| @@ -799,7 +787,7 @@ static int pm4125_micbias_control(struct snd_soc_component *component, int micb_ · 36 unmodified lines | |||
| 799 | pm4125_global_mbias_disable(component); | 787 | pm4125_global_mbias_disable(component); |
| 800 | } | 788 | } |
| 801 | break; | 789 | break; |
| 802 | }; | 790 | } |
| 803 | 791 | ||
| 804 | return 0; | 792 | return 0; |
| 805 | } | 793 | } |
| @@ -855,7 +843,7 @@ static int pm4125_codec_enable_micbias_pullup(struct snd_soc_dapm_widget *w, · 49 unmodified lines | |||
| 855 | static int pm4125_connect_port(struct pm4125_sdw_priv *sdw_priv, u8 port_idx, u8 ch_id, bool enable) | 843 | static int pm4125_connect_port(struct pm4125_sdw_priv *sdw_priv, u8 port_idx, u8 ch_id, bool enable) |
| 856 | { | 844 | { |
| 857 | struct sdw_port_config *port_config = &sdw_priv->port_config[port_idx - 1]; | 845 | struct sdw_port_config *port_config = &sdw_priv->port_config[port_idx - 1]; |
| 858 | const struct pm4125_sdw_ch_info *ch_info = &sdw_priv->ch_info[ch_id]; | 846 | const struct wcd_sdw_ch_info *ch_info = &sdw_priv->ch_info[ch_id]; |
| 859 | struct sdw_slave *sdev = sdw_priv->sdev; | 847 | struct sdw_slave *sdev = sdw_priv->sdev; |
| 860 | u8 port_num = ch_info->port_num; | 848 | u8 port_num = ch_info->port_num; |
| 861 | u8 ch_mask = ch_info->ch_mask; | 849 | u8 ch_mask = ch_info->ch_mask; |
| @@ -879,7 +867,7 @@ static int pm4125_connect_port(struct pm4125_sdw_priv *sdw_priv, u8 port_idx, u8 · 17 unmodified lines | |||
| 879 | 867 | ||
| 880 | static int pm4125_get_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 868 | static int pm4125_get_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 881 | { | 869 | { |
| 882 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 870 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 883 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(component); | 871 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(component); |
| 884 | struct soc_mixer_control *mc; | 872 | struct soc_mixer_control *mc; |
| 885 | bool hphr; | 873 | bool hphr; |
| @@ -893,7 +881,7 @@ static int pm4125_get_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_el · 7 unmodified lines | |||
| 893 | 881 | ||
| 894 | static int pm4125_set_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 882 | static int pm4125_set_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 895 | { | 883 | { |
| 896 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 884 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 897 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(component); | 885 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(component); |
| 898 | struct pm4125_sdw_priv *sdw_priv = pm4125->sdw_priv[AIF1_PB]; | 886 | struct pm4125_sdw_priv *sdw_priv = pm4125->sdw_priv[AIF1_PB]; |
| 899 | int value = ucontrol->value.integer.value[0]; | 887 | int value = ucontrol->value.integer.value[0]; |
| @@ -926,7 +914,7 @@ static int pm4125_set_compander(struct snd_kcontrol *kcontrol, struct snd_ctl_el · 26 unmodified lines | |||
| 926 | static int pm4125_get_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 914 | static int pm4125_get_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 927 | { | 915 | { |
| 928 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; | 916 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; |
| 929 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 917 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 930 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(comp); | 918 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(comp); |
| 931 | struct pm4125_sdw_priv *sdw_priv; | 919 | struct pm4125_sdw_priv *sdw_priv; |
| 932 | int dai_id = mixer->shift; | 920 | int dai_id = mixer->shift; |
| @@ -944,7 +932,7 @@ static int pm4125_get_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_ele · 11 unmodified lines | |||
| 944 | static int pm4125_set_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 932 | static int pm4125_set_swr_port(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 945 | { | 933 | { |
| 946 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; | 934 | struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value; |
| 947 | struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); | 935 | struct snd_soc_component *comp = snd_kcontrol_chip(kcontrol); |
| 948 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(comp); | 936 | struct pm4125_priv *pm4125 = snd_soc_component_get_drvdata(comp); |
| 949 | struct pm4125_sdw_priv *sdw_priv; | 937 | struct pm4125_sdw_priv *sdw_priv; |
| 950 | int dai_id = mixer->shift; | 938 | int dai_id = mixer->shift; |
| @@ -1266,15 +1254,8 @@ static const struct snd_soc_dapm_route pm4125_audio_map[] = { · 315 unmodified lines | |||
| 1266 | 1254 | ||
| 1267 | static int pm4125_set_micbias_data(struct device *dev, struct pm4125_priv *pm4125) | 1255 | static int pm4125_set_micbias_data(struct device *dev, struct pm4125_priv *pm4125) |
| 1268 | { | 1256 | { |
| 1269 | int vout_ctl; | ||
| 1270 | |||
| 1271 | /* Set micbias voltage */ | ||
| 1272 | vout_ctl = pm4125_get_micb_vout_ctl_val(dev, pm4125->micb1_mv); | ||
| 1273 | if (vout_ctl < 0) | ||
| 1274 | return -EINVAL; | ||
| 1275 | |||
| 1276 | regmap_update_bits(pm4125->regmap, PM4125_ANA_MICBIAS_LDO_1_SETTING, | 1257 | regmap_update_bits(pm4125->regmap, PM4125_ANA_MICBIAS_LDO_1_SETTING, |
| 1277 | PM4125_ANA_MICBIAS_MICB_OUT_VAL_MASK, vout_ctl << 3); | 1258 | PM4125_ANA_MICBIAS_MICB_OUT_VAL_MASK, pm4125->common.micb_vout[0]); |
| 1278 | return 0; | 1259 | return 0; |
| 1279 | } | 1260 | } |
| 1280 | 1261 | ||
| @@ -1320,10 +1301,8 @@ static int pm4125_irq_init(struct pm4125_priv *pm4125, struct device *dev) · 39 unmodified lines | |||
| 1320 | return -EINVAL; | 1301 | return -EINVAL; |
| 1321 | } | 1302 | } |
| 1322 | 1303 | ||
| 1323 | pm4125_regmap_irq_chip.irq_drv_data = pm4125; | ||
| 1324 | |||
| 1325 | return devm_regmap_add_irq_chip(dev, pm4125->regmap, irq_create_mapping(pm4125->virq, 0), | 1304 | return devm_regmap_add_irq_chip(dev, pm4125->regmap, irq_create_mapping(pm4125->virq, 0), |
| 1326 | IRQF_ONESHOT, 0, &pm4125_regmap_irq_chip, | 1305 | IRQF_ONESHOT, 0, pm4125->chip_desc, |
| 1327 | &pm4125->irq_chip); | 1306 | &pm4125->irq_chip); |
| 1328 | } | 1307 | } |
| 1329 | 1308 | ||
| @@ -1418,31 +1397,6 @@ static const struct snd_soc_component_driver soc_codec_dev_pm4125 = { · 88 unmodified lines | |||
| 1418 | .endianness = 1, | 1397 | .endianness = 1, |
| 1419 | }; | 1398 | }; |
| 1420 | 1399 | ||
| 1421 | static void pm4125_dt_parse_micbias_info(struct device *dev, struct pm4125_priv *priv) | ||
| 1422 | { | ||
| 1423 | struct device_node *np = dev->of_node; | ||
| 1424 | u32 prop_val = 0; | ||
| 1425 | int ret; | ||
| 1426 | |||
| 1427 | ret = of_property_read_u32(np, "qcom,micbias1-microvolt", &prop_val); | ||
| 1428 | if (!ret) | ||
| 1429 | priv->micb1_mv = prop_val / 1000; | ||
| 1430 | else | ||
| 1431 | dev_warn(dev, "Micbias1 DT property not found\n"); | ||
| 1432 | |||
| 1433 | ret = of_property_read_u32(np, "qcom,micbias2-microvolt", &prop_val); | ||
| 1434 | if (!ret) | ||
| 1435 | priv->micb2_mv = prop_val / 1000; | ||
| 1436 | else | ||
| 1437 | dev_warn(dev, "Micbias2 DT property not found\n"); | ||
| 1438 | |||
| 1439 | ret = of_property_read_u32(np, "qcom,micbias3-microvolt", &prop_val); | ||
| 1440 | if (!ret) | ||
| 1441 | priv->micb3_mv = prop_val / 1000; | ||
| 1442 | else | ||
| 1443 | dev_warn(dev, "Micbias3 DT property not found\n"); | ||
| 1444 | } | ||
| 1445 | |||
| 1446 | static int pm4125_codec_hw_params(struct snd_pcm_substream *substream, | 1400 | static int pm4125_codec_hw_params(struct snd_pcm_substream *substream, |
| 1447 | struct snd_pcm_hw_params *params, | 1401 | struct snd_pcm_hw_params *params, |
| 1448 | struct snd_soc_dai *dai) | 1402 | struct snd_soc_dai *dai) |
| @@ -1551,6 +1505,10 @@ static int pm4125_bind(struct device *dev) · 102 unmodified lines | |||
| 1551 | struct device_link *devlink; | 1505 | struct device_link *devlink; |
| 1552 | int ret; | 1506 | int ret; |
| 1553 | 1507 | ||
| 1508 | /* Initialize device pointers to NULL for safe cleanup */ | ||
| 1509 | pm4125->rxdev = NULL; | ||
| 1510 | pm4125->txdev = NULL; | ||
| 1511 | |||
| 1554 | /* Give the soundwire subdevices some more time to settle */ | 1512 | /* Give the soundwire subdevices some more time to settle */ |
| 1555 | usleep_range(15000, 15010); | 1513 | usleep_range(15000, 15010); |
| 1556 | 1514 | ||
| @@ -1560,7 +1518,7 @@ static int pm4125_bind(struct device *dev) · 3 unmodified lines | |||
| 1560 | return ret; | 1518 | return ret; |
| 1561 | } | 1519 | } |
| 1562 | 1520 | ||
| 1563 | pm4125->rxdev = pm4125_sdw_device_get(pm4125->rxnode); | 1521 | pm4125->rxdev = of_sdw_find_device_by_node(pm4125->rxnode); |
| 1564 | if (!pm4125->rxdev) { | 1522 | if (!pm4125->rxdev) { |
| 1565 | dev_err(dev, "could not find rxslave with matching of node\n"); | 1523 | dev_err(dev, "could not find rxslave with matching of node\n"); |
| 1566 | ret = -EINVAL; | 1524 | ret = -EINVAL; |
| @@ -1570,11 +1528,11 @@ static int pm4125_bind(struct device *dev) · 3 unmodified lines | |||
| 1570 | pm4125->sdw_priv[AIF1_PB] = dev_get_drvdata(pm4125->rxdev); | 1528 | pm4125->sdw_priv[AIF1_PB] = dev_get_drvdata(pm4125->rxdev); |
| 1571 | pm4125->sdw_priv[AIF1_PB]->pm4125 = pm4125; | 1529 | pm4125->sdw_priv[AIF1_PB]->pm4125 = pm4125; |
| 1572 | 1530 | ||
| 1573 | pm4125->txdev = pm4125_sdw_device_get(pm4125->txnode); | 1531 | pm4125->txdev = of_sdw_find_device_by_node(pm4125->txnode); |
| 1574 | if (!pm4125->txdev) { | 1532 | if (!pm4125->txdev) { |
| 1575 | dev_err(dev, "could not find txslave with matching of node\n"); | 1533 | dev_err(dev, "could not find txslave with matching of node\n"); |
| 1576 | ret = -EINVAL; | 1534 | ret = -EINVAL; |
| 1577 | goto error_unbind_all; | 1535 | goto error_put_rx; |
| 1578 | } | 1536 | } |
| 1579 | 1537 | ||
| 1580 | pm4125->sdw_priv[AIF1_CAP] = dev_get_drvdata(pm4125->txdev); | 1538 | pm4125->sdw_priv[AIF1_CAP] = dev_get_drvdata(pm4125->txdev); |
| @@ -1584,7 +1542,7 @@ static int pm4125_bind(struct device *dev) · 3 unmodified lines | |||
| 1584 | if (!pm4125->tx_sdw_dev) { | 1542 | if (!pm4125->tx_sdw_dev) { |
| 1585 | dev_err(dev, "could not get txslave with matching of dev\n"); | 1543 | dev_err(dev, "could not get txslave with matching of dev\n"); |
| 1586 | ret = -EINVAL; | 1544 | ret = -EINVAL; |
| 1587 | goto error_unbind_all; | 1545 | goto error_put_tx; |
| 1588 | } | 1546 | } |
| 1589 | 1547 | ||
| 1590 | /* | 1548 | /* |
| @@ -1596,7 +1554,7 @@ static int pm4125_bind(struct device *dev) · 5 unmodified lines | |||
| 1596 | if (!devlink) { | 1554 | if (!devlink) { |
| 1597 | dev_err(dev, "Could not devlink TX and RX\n"); | 1555 | dev_err(dev, "Could not devlink TX and RX\n"); |
| 1598 | ret = -EINVAL; | 1556 | ret = -EINVAL; |
| 1599 | goto error_unbind_all; | 1557 | goto error_put_tx; |
| 1600 | } | 1558 | } |
| 1601 | 1559 | ||
| 1602 | devlink = device_link_add(dev, pm4125->txdev, | 1560 | devlink = device_link_add(dev, pm4125->txdev, |
| @@ -1615,7 +1573,7 @@ static int pm4125_bind(struct device *dev) · 12 unmodified lines | |||
| 1615 | goto link_remove_dev_tx; | 1573 | goto link_remove_dev_tx; |
| 1616 | } | 1574 | } |
| 1617 | 1575 | ||
| 1618 | pm4125->regmap = dev_get_regmap(&pm4125->tx_sdw_dev->dev, NULL); | 1576 | pm4125->regmap = pm4125->sdw_priv[AIF1_CAP]->regmap; |
| 1619 | if (!pm4125->regmap) { | 1577 | if (!pm4125->regmap) { |
| 1620 | dev_err(dev, "could not get TX device regmap\n"); | 1578 | dev_err(dev, "could not get TX device regmap\n"); |
| 1621 | ret = -EINVAL; | 1579 | ret = -EINVAL; |
| @@ -1631,11 +1589,7 @@ static int pm4125_bind(struct device *dev) · 9 unmodified lines | |||
| 1631 | pm4125->sdw_priv[AIF1_PB]->slave_irq = pm4125->virq; | 1589 | pm4125->sdw_priv[AIF1_PB]->slave_irq = pm4125->virq; |
| 1632 | pm4125->sdw_priv[AIF1_CAP]->slave_irq = pm4125->virq; | 1590 | pm4125->sdw_priv[AIF1_CAP]->slave_irq = pm4125->virq; |
| 1633 | 1591 | ||
| 1634 | ret = pm4125_set_micbias_data(dev, pm4125); | 1592 | pm4125_set_micbias_data(dev, pm4125); |
| 1635 | if (ret < 0) { | ||
| 1636 | dev_err(dev, "Bad micbias pdata\n"); | ||
| 1637 | goto link_remove_dev_rx; | ||
| 1638 | } | ||
| 1639 | 1593 | ||
| 1640 | ret = snd_soc_register_component(dev, &soc_codec_dev_pm4125, | 1594 | ret = snd_soc_register_component(dev, &soc_codec_dev_pm4125, |
| 1641 | pm4125_dais, ARRAY_SIZE(pm4125_dais)); | 1595 | pm4125_dais, ARRAY_SIZE(pm4125_dais)); |
| @@ -1650,6 +1604,10 @@ link_remove_dev_tx: · 8 unmodified lines | |||
| 1650 | device_link_remove(dev, pm4125->txdev); | 1604 | device_link_remove(dev, pm4125->txdev); |
| 1651 | link_remove_rx_tx: | 1605 | link_remove_rx_tx: |
| 1652 | device_link_remove(pm4125->rxdev, pm4125->txdev); | 1606 | device_link_remove(pm4125->rxdev, pm4125->txdev); |
| 1607 | error_put_tx: | ||
| 1608 | put_device(pm4125->txdev); | ||
| 1609 | error_put_rx: | ||
| 1610 | put_device(pm4125->rxdev); | ||
| 1653 | error_unbind_all: | 1611 | error_unbind_all: |
| 1654 | component_unbind_all(dev, pm4125); | 1612 | component_unbind_all(dev, pm4125); |
| 1655 | return ret; | 1613 | return ret; |
| @@ -1660,9 +1618,18 @@ static void pm4125_unbind(struct device *dev) · 4 unmodified lines | |||
| 1660 | struct pm4125_priv *pm4125 = dev_get_drvdata(dev); | 1618 | struct pm4125_priv *pm4125 = dev_get_drvdata(dev); |
| 1661 | 1619 | ||
| 1662 | snd_soc_unregister_component(dev); | 1620 | snd_soc_unregister_component(dev); |
| 1621 | devm_regmap_del_irq_chip(dev, irq_find_mapping(pm4125->virq, 0), | ||
| 1622 | pm4125->irq_chip); | ||
| 1663 | device_link_remove(dev, pm4125->txdev); | 1623 | device_link_remove(dev, pm4125->txdev); |
| 1664 | device_link_remove(dev, pm4125->rxdev); | 1624 | device_link_remove(dev, pm4125->rxdev); |
| 1665 | device_link_remove(pm4125->rxdev, pm4125->txdev); | 1625 | device_link_remove(pm4125->rxdev, pm4125->txdev); |
| 1626 | |||
| 1627 | /* Release device references acquired in bind */ | ||
| 1628 | if (pm4125->txdev) | ||
| 1629 | put_device(pm4125->txdev); | ||
| 1630 | if (pm4125->rxdev) | ||
| 1631 | put_device(pm4125->rxdev); | ||
| 1632 | |||
| 1666 | component_unbind_all(dev, pm4125); | 1633 | component_unbind_all(dev, pm4125); |
| 1667 | } | 1634 | } |
| 1668 | 1635 | ||
| @@ -1695,6 +1662,7 @@ static int pm4125_probe(struct platform_device *pdev) · 26 unmodified lines | |||
| 1695 | { | 1662 | { |
| 1696 | struct component_match *match = NULL; | 1663 | struct component_match *match = NULL; |
| 1697 | struct device *dev = &pdev->dev; | 1664 | struct device *dev = &pdev->dev; |
| 1665 | struct regmap_irq_chip *chip_desc; | ||
| 1698 | struct pm4125_priv *pm4125; | 1666 | struct pm4125_priv *pm4125; |
| 1699 | struct wcd_mbhc_config *cfg; | 1667 | struct wcd_mbhc_config *cfg; |
| 1700 | int ret; | 1668 | int ret; |
| @@ -1705,6 +1673,14 @@ static int pm4125_probe(struct platform_device *pdev) · 4 unmodified lines | |||
| 1705 | 1673 | ||
| 1706 | dev_set_drvdata(dev, pm4125); | 1674 | dev_set_drvdata(dev, pm4125); |
| 1707 | 1675 | ||
| 1676 | chip_desc = devm_kmemdup(dev, &pm4125_regmap_irq_chip, | ||
| 1677 | sizeof(pm4125_regmap_irq_chip), | ||
| 1678 | GFP_KERNEL); | ||
| 1679 | if (!chip_desc) | ||
| 1680 | return -ENOMEM; | ||
| 1681 | chip_desc->irq_drv_data = pm4125; | ||
| 1682 | pm4125->chip_desc = chip_desc; | ||
| 1683 | |||
| 1708 | ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(pm4125_power_supplies), | 1684 | ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(pm4125_power_supplies), |
| 1709 | pm4125_power_supplies); | 1685 | pm4125_power_supplies); |
| 1710 | if (ret) | 1686 | if (ret) |
| @@ -1716,7 +1692,12 @@ static int pm4125_probe(struct platform_device *pdev) · 5 unmodified lines | |||
| 1716 | 1692 | ||
| 1717 | pm4125_reset(pm4125); | 1693 | pm4125_reset(pm4125); |
| 1718 | 1694 | ||
| 1719 | pm4125_dt_parse_micbias_info(dev, pm4125); | 1695 | pm4125->common.dev = dev; |
| 1696 | pm4125->common.max_bias = 3; | ||
| 1697 | ret = wcd_dt_parse_micbias_info(&pm4125->common); | ||
| 1698 | if (ret) | ||
| 1699 | return dev_err_probe(dev, ret, "Failed to get micbias\n"); | ||
| 1700 | |||
| 1720 | atomic_set(&pm4125->gloal_mbias_cnt, 0); | 1701 | atomic_set(&pm4125->gloal_mbias_cnt, 0); |
| 1721 | 1702 | ||
| 1722 | cfg = &pm4125->mbhc_cfg; | 1703 | cfg = &pm4125->mbhc_cfg; |
| @@ -1724,7 +1705,7 @@ static int pm4125_probe(struct platform_device *pdev) · 1 unmodified line | |||
| 1724 | cfg->anc_micbias = MIC_BIAS_2; | 1705 | cfg->anc_micbias = MIC_BIAS_2; |
| 1725 | cfg->v_hs_max = WCD_MBHC_HS_V_MAX; | 1706 | cfg->v_hs_max = WCD_MBHC_HS_V_MAX; |
| 1726 | cfg->num_btn = PM4125_MBHC_MAX_BUTTONS; | 1707 | cfg->num_btn = PM4125_MBHC_MAX_BUTTONS; |
| 1727 | cfg->micb_mv = pm4125->micb2_mv; | 1708 | cfg->micb_mv = pm4125->common.micb_mv[1]; |
| 1728 | cfg->linein_th = 5000; | 1709 | cfg->linein_th = 5000; |
| 1729 | cfg->hs_thr = 1700; | 1710 | cfg->hs_thr = 1700; |
| 1730 | cfg->hph_thr = 50; | 1711 | cfg->hph_thr = 50; |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | #include <linux/soundwire/sdw.h> | 8 | #include <linux/soundwire/sdw.h> |
| 9 | #include <linux/soundwire/sdw_type.h> | 9 | #include <linux/soundwire/sdw_type.h> |
| 10 | #include "wcd-common.h" | ||
| 10 | 11 | ||
| 11 | #define PM4125_ANA_BASE_ADDR 0x3000 | 12 | #define PM4125_ANA_BASE_ADDR 0x3000 |
| 12 | #define PM4125_DIG_BASE_ADDR 0x3400 | 13 | #define PM4125_DIG_BASE_ADDR 0x3400 |
| @@ -202,26 +203,13 @@ enum pm4125_rx_sdw_ports { · 189 unmodified lines | |||
| 202 | PM4125_MAX_SWR_PORTS = PM4125_COMP_PORT, | 203 | PM4125_MAX_SWR_PORTS = PM4125_COMP_PORT, |
| 203 | }; | 204 | }; |
| 204 | 205 | ||
| 205 | struct pm4125_sdw_ch_info { | ||
| 206 | int port_num; | ||
| 207 | unsigned int ch_mask; | ||
| 208 | unsigned int master_ch_mask; | ||
| 209 | }; | ||
| 210 | |||
| 211 | #define WCD_SDW_CH(id, pn, cmask) \ | ||
| 212 | [id] = { \ | ||
| 213 | .port_num = pn, \ | ||
| 214 | .ch_mask = cmask, \ | ||
| 215 | .master_ch_mask = cmask, \ | ||
| 216 | } | ||
| 217 | |||
| 218 | struct pm4125_priv; | 206 | struct pm4125_priv; |
| 219 | struct pm4125_sdw_priv { | 207 | struct pm4125_sdw_priv { |
| 220 | struct sdw_slave *sdev; | 208 | struct sdw_slave *sdev; |
| 221 | struct sdw_stream_config sconfig; | 209 | struct sdw_stream_config sconfig; |
| 222 | struct sdw_stream_runtime *sruntime; | 210 | struct sdw_stream_runtime *sruntime; |
| 223 | struct sdw_port_config port_config[PM4125_MAX_SWR_PORTS]; | 211 | struct sdw_port_config port_config[PM4125_MAX_SWR_PORTS]; |
| 224 | struct pm4125_sdw_ch_info *ch_info; | 212 | struct wcd_sdw_ch_info *ch_info; |
| 225 | bool port_enable[PM4125_MAX_SWR_CH_IDS]; | 213 | bool port_enable[PM4125_MAX_SWR_CH_IDS]; |
| 226 | unsigned int master_channel_map[SDW_MAX_PORTS]; | 214 | unsigned int master_channel_map[SDW_MAX_PORTS]; |
| 227 | int active_ports; | 215 | int active_ports; |
| @@ -240,8 +228,6 @@ int pm4125_sdw_set_sdw_stream(struct pm4125_sdw_priv *pm4125, struct snd_soc_dai · 12 unmodified lines | |||
| 240 | int pm4125_sdw_hw_params(struct pm4125_sdw_priv *pm4125, struct snd_pcm_substream *substream, | 228 | int pm4125_sdw_hw_params(struct pm4125_sdw_priv *pm4125, struct snd_pcm_substream *substream, |
| 241 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai); | 229 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai); |
| 242 | 230 | ||
| 243 | struct device *pm4125_sdw_device_get(struct device_node *np); | ||
| 244 | |||
| 245 | #else | 231 | #else |
| 246 | static inline int pm4125_sdw_free(struct pm4125_sdw_priv *pm4125, | 232 | static inline int pm4125_sdw_free(struct pm4125_sdw_priv *pm4125, |
| 247 | struct snd_pcm_substream *substream, struct snd_soc_dai *dai) | 233 | struct snd_pcm_substream *substream, struct snd_soc_dai *dai) |
| @@ -786,6 +786,7 @@ static int rk3308_codec_set_bias_level(struct snd_soc_component *component, · 785 unmodified lines | |||
| 786 | enum snd_soc_bias_level level) | 786 | enum snd_soc_bias_level level) |
| 787 | { | 787 | { |
| 788 | struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); | 788 | struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component); |
| 789 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 789 | 790 | ||
| 790 | switch (level) { | 791 | switch (level) { |
| 791 | case SND_SOC_BIAS_ON: | 792 | case SND_SOC_BIAS_ON: |
| @@ -793,7 +794,7 @@ static int rk3308_codec_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 793 | case SND_SOC_BIAS_PREPARE: | 794 | case SND_SOC_BIAS_PREPARE: |
| 794 | break; | 795 | break; |
| 795 | case SND_SOC_BIAS_STANDBY: | 796 | case SND_SOC_BIAS_STANDBY: |
| 796 | if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_OFF) | 797 | if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_OFF) |
| 797 | break; | 798 | break; |
| 798 | 799 | ||
| 799 | /* Sequence from TRM Section 8.6.3 "Power Up" */ | 800 | /* Sequence from TRM Section 8.6.3 "Power Up" */ |
| @@ -1034,8 +1034,7 @@ static void rt1011_reset(struct regmap *regmap) · 1033 unmodified lines | |||
| 1034 | static int rt1011_recv_spk_mode_get(struct snd_kcontrol *kcontrol, | 1034 | static int rt1011_recv_spk_mode_get(struct snd_kcontrol *kcontrol, |
| 1035 | struct snd_ctl_elem_value *ucontrol) | 1035 | struct snd_ctl_elem_value *ucontrol) |
| 1036 | { | 1036 | { |
| 1037 | struct snd_soc_component *component = | 1037 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1038 | snd_soc_kcontrol_component(kcontrol); | ||
| 1039 | struct rt1011_priv *rt1011 = | 1038 | struct rt1011_priv *rt1011 = |
| 1040 | snd_soc_component_get_drvdata(component); | 1039 | snd_soc_component_get_drvdata(component); |
| 1041 | 1040 | ||
| @@ -1047,15 +1046,15 @@ static int rt1011_recv_spk_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1047 | static int rt1011_recv_spk_mode_put(struct snd_kcontrol *kcontrol, | 1046 | static int rt1011_recv_spk_mode_put(struct snd_kcontrol *kcontrol, |
| 1048 | struct snd_ctl_elem_value *ucontrol) | 1047 | struct snd_ctl_elem_value *ucontrol) |
| 1049 | { | 1048 | { |
| 1050 | struct snd_soc_component *component = | 1049 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1051 | snd_soc_kcontrol_component(kcontrol); | 1050 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 1052 | struct rt1011_priv *rt1011 = | 1051 | struct rt1011_priv *rt1011 = |
| 1053 | snd_soc_component_get_drvdata(component); | 1052 | snd_soc_component_get_drvdata(component); |
| 1054 | 1053 | ||
| 1055 | if (ucontrol->value.integer.value[0] == rt1011->recv_spk_mode) | 1054 | if (ucontrol->value.integer.value[0] == rt1011->recv_spk_mode) |
| 1056 | return 0; | 1055 | return 0; |
| 1057 | 1056 | ||
| 1058 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1057 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1059 | rt1011->recv_spk_mode = ucontrol->value.integer.value[0]; | 1058 | rt1011->recv_spk_mode = ucontrol->value.integer.value[0]; |
| 1060 | 1059 | ||
| 1061 | if (rt1011->recv_spk_mode) { | 1060 | if (rt1011->recv_spk_mode) { |
| @@ -1110,8 +1109,7 @@ static bool rt1011_validate_bq_drc_coeff(unsigned short reg) · 48 unmodified lines | |||
| 1110 | static int rt1011_bq_drc_coeff_get(struct snd_kcontrol *kcontrol, | 1109 | static int rt1011_bq_drc_coeff_get(struct snd_kcontrol *kcontrol, |
| 1111 | struct snd_ctl_elem_value *ucontrol) | 1110 | struct snd_ctl_elem_value *ucontrol) |
| 1112 | { | 1111 | { |
| 1113 | struct snd_soc_component *component = | 1112 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1114 | snd_soc_kcontrol_component(kcontrol); | ||
| 1115 | struct rt1011_priv *rt1011 = | 1113 | struct rt1011_priv *rt1011 = |
| 1116 | snd_soc_component_get_drvdata(component); | 1114 | snd_soc_component_get_drvdata(component); |
| 1117 | struct rt1011_bq_drc_params *bq_drc_info; | 1115 | struct rt1011_bq_drc_params *bq_drc_info; |
| @@ -1147,8 +1145,7 @@ static int rt1011_bq_drc_coeff_get(struct snd_kcontrol *kcontrol, · 29 unmodified lines | |||
| 1147 | static int rt1011_bq_drc_coeff_put(struct snd_kcontrol *kcontrol, | 1145 | static int rt1011_bq_drc_coeff_put(struct snd_kcontrol *kcontrol, |
| 1148 | struct snd_ctl_elem_value *ucontrol) | 1146 | struct snd_ctl_elem_value *ucontrol) |
| 1149 | { | 1147 | { |
| 1150 | struct snd_soc_component *component = | 1148 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1151 | snd_soc_kcontrol_component(kcontrol); | ||
| 1152 | struct rt1011_priv *rt1011 = | 1149 | struct rt1011_priv *rt1011 = |
| 1153 | snd_soc_component_get_drvdata(component); | 1150 | snd_soc_component_get_drvdata(component); |
| 1154 | struct rt1011_bq_drc_params *bq_drc_info; | 1151 | struct rt1011_bq_drc_params *bq_drc_info; |
| @@ -1224,10 +1221,11 @@ static int rt1011_r0_cali_put(struct snd_kcontrol *kcontrol, · 69 unmodified lines | |||
| 1224 | struct snd_ctl_elem_value *ucontrol) | 1221 | struct snd_ctl_elem_value *ucontrol) |
| 1225 | { | 1222 | { |
| 1226 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 1223 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1224 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1227 | struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); | 1225 | struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); |
| 1228 | 1226 | ||
| 1229 | rt1011->cali_done = 0; | 1227 | rt1011->cali_done = 0; |
| 1230 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF && | 1228 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF && |
| 1231 | ucontrol->value.integer.value[0]) | 1229 | ucontrol->value.integer.value[0]) |
| 1232 | rt1011_calibrate(rt1011, 1); | 1230 | rt1011_calibrate(rt1011, 1); |
| 1233 | 1231 | ||
| @@ -1264,6 +1262,7 @@ static int rt1011_r0_load_mode_put(struct snd_kcontrol *kcontrol, · 30 unmodified lines | |||
| 1264 | struct snd_ctl_elem_value *ucontrol) | 1262 | struct snd_ctl_elem_value *ucontrol) |
| 1265 | { | 1263 | { |
| 1266 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 1264 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1265 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1267 | struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); | 1266 | struct rt1011_priv *rt1011 = snd_soc_component_get_drvdata(component); |
| 1268 | struct device *dev; | 1267 | struct device *dev; |
| 1269 | unsigned int r0_integer, r0_factor, format; | 1268 | unsigned int r0_integer, r0_factor, format; |
| @@ -1275,7 +1274,7 @@ static int rt1011_r0_load_mode_put(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 1275 | return -EINVAL; | 1274 | return -EINVAL; |
| 1276 | 1275 | ||
| 1277 | dev = regmap_get_device(rt1011->regmap); | 1276 | dev = regmap_get_device(rt1011->regmap); |
| 1278 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1277 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1279 | rt1011->r0_reg = ucontrol->value.integer.value[0]; | 1278 | rt1011->r0_reg = ucontrol->value.integer.value[0]; |
| 1280 | 1279 | ||
| 1281 | format = 2147483648U; /* 2^24 * 128 */ | 1280 | format = 2147483648U; /* 2^24 * 128 */ |
| @@ -1319,8 +1318,7 @@ static SOC_ENUM_SINGLE_DECL(rt1011_i2s_ref_enum, 0, 0, · 37 unmodified lines | |||
| 1319 | static int rt1011_i2s_ref_put(struct snd_kcontrol *kcontrol, | 1318 | static int rt1011_i2s_ref_put(struct snd_kcontrol *kcontrol, |
| 1320 | struct snd_ctl_elem_value *ucontrol) | 1319 | struct snd_ctl_elem_value *ucontrol) |
| 1321 | { | 1320 | { |
| 1322 | struct snd_soc_component *component = | 1321 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1323 | snd_soc_kcontrol_component(kcontrol); | ||
| 1324 | struct rt1011_priv *rt1011 = | 1322 | struct rt1011_priv *rt1011 = |
| 1325 | snd_soc_component_get_drvdata(component); | 1323 | snd_soc_component_get_drvdata(component); |
| 1326 | 1324 | ||
| @@ -1348,8 +1346,7 @@ static int rt1011_i2s_ref_put(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 1348 | static int rt1011_i2s_ref_get(struct snd_kcontrol *kcontrol, | 1346 | static int rt1011_i2s_ref_get(struct snd_kcontrol *kcontrol, |
| 1349 | struct snd_ctl_elem_value *ucontrol) | 1347 | struct snd_ctl_elem_value *ucontrol) |
| 1350 | { | 1348 | { |
| 1351 | struct snd_soc_component *component = | 1349 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1352 | snd_soc_kcontrol_component(kcontrol); | ||
| 1353 | struct rt1011_priv *rt1011 = | 1350 | struct rt1011_priv *rt1011 = |
| 1354 | snd_soc_component_get_drvdata(component); | 1351 | snd_soc_component_get_drvdata(component); |
| 1355 | 1352 | ||
| @@ -1664,8 +1661,7 @@ static int rt1011_hw_params(struct snd_pcm_substream *substream, · 308 unmodified lines | |||
| 1664 | static int rt1011_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 1661 | static int rt1011_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
| 1665 | { | 1662 | { |
| 1666 | struct snd_soc_component *component = dai->component; | 1663 | struct snd_soc_component *component = dai->component; |
| 1667 | struct snd_soc_dapm_context *dapm = | 1664 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1668 | snd_soc_component_get_dapm(component); | ||
| 1669 | unsigned int reg_val = 0, reg_bclk_inv = 0; | 1665 | unsigned int reg_val = 0, reg_bclk_inv = 0; |
| 1670 | int ret = 0; | 1666 | int ret = 0; |
| 1671 | 1667 | ||
| @@ -1845,8 +1841,7 @@ static int rt1011_set_tdm_slot(struct snd_soc_dai *dai, · 173 unmodified lines | |||
| 1845 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) | 1841 | unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) |
| 1846 | { | 1842 | { |
| 1847 | struct snd_soc_component *component = dai->component; | 1843 | struct snd_soc_component *component = dai->component; |
| 1848 | struct snd_soc_dapm_context *dapm = | 1844 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1849 | snd_soc_component_get_dapm(component); | ||
| 1850 | unsigned int val = 0, tdm_en = 0, rx_slotnum, tx_slotnum; | 1845 | unsigned int val = 0, tdm_en = 0, rx_slotnum, tx_slotnum; |
| 1851 | int ret = 0, first_bit, last_bit; | 1846 | int ret = 0, first_bit, last_bit; |
| 1852 | 1847 | ||
| @@ -2218,8 +2213,7 @@ static int rt1011_calibrate(struct rt1011_priv *rt1011, unsigned char cali_flag) · 365 unmodified lines | |||
| 2218 | unsigned int dc_offset; | 2213 | unsigned int dc_offset; |
| 2219 | unsigned int r0_integer, r0_factor, format; | 2214 | unsigned int r0_integer, r0_factor, format; |
| 2220 | struct device *dev = regmap_get_device(rt1011->regmap); | 2215 | struct device *dev = regmap_get_device(rt1011->regmap); |
| 2221 | struct snd_soc_dapm_context *dapm = | 2216 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt1011->component); |
| 2222 | snd_soc_component_get_dapm(rt1011->component); | ||
| 2223 | int ret = 0; | 2217 | int ret = 0; |
| 2224 | 2218 | ||
| 2225 | snd_soc_dapm_mutex_lock(dapm); | 2219 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -427,8 +427,7 @@ static SOC_ENUM_SINGLE_DECL(rt1015_boost_mode_enum, 0, 0, · 426 unmodified lines | |||
| 427 | static int rt1015_boost_mode_get(struct snd_kcontrol *kcontrol, | 427 | static int rt1015_boost_mode_get(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_value *ucontrol) | 428 | struct snd_ctl_elem_value *ucontrol) |
| 429 | { | 429 | { |
| 430 | struct snd_soc_component *component = | 430 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 431 | snd_soc_kcontrol_component(kcontrol); | ||
| 432 | struct rt1015_priv *rt1015 = | 431 | struct rt1015_priv *rt1015 = |
| 433 | snd_soc_component_get_drvdata(component); | 432 | snd_soc_component_get_drvdata(component); |
| 434 | 433 | ||
| @@ -440,8 +439,7 @@ static int rt1015_boost_mode_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 440 | static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol, | 439 | static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol, |
| 441 | struct snd_ctl_elem_value *ucontrol) | 440 | struct snd_ctl_elem_value *ucontrol) |
| 442 | { | 441 | { |
| 443 | struct snd_soc_component *component = | 442 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 444 | snd_soc_kcontrol_component(kcontrol); | ||
| 445 | struct rt1015_priv *rt1015 = | 443 | struct rt1015_priv *rt1015 = |
| 446 | snd_soc_component_get_drvdata(component); | 444 | snd_soc_component_get_drvdata(component); |
| 447 | int boost_mode = ucontrol->value.integer.value[0]; | 445 | int boost_mode = ucontrol->value.integer.value[0]; |
| @@ -481,8 +479,7 @@ static int rt1015_boost_mode_put(struct snd_kcontrol *kcontrol, · 33 unmodified lines | |||
| 481 | static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol, | 479 | static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol, |
| 482 | struct snd_ctl_elem_value *ucontrol) | 480 | struct snd_ctl_elem_value *ucontrol) |
| 483 | { | 481 | { |
| 484 | struct snd_soc_component *component = | 482 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 485 | snd_soc_kcontrol_component(kcontrol); | ||
| 486 | struct rt1015_priv *rt1015 = | 483 | struct rt1015_priv *rt1015 = |
| 487 | snd_soc_component_get_drvdata(component); | 484 | snd_soc_component_get_drvdata(component); |
| 488 | 485 | ||
| @@ -494,9 +491,10 @@ static int rt1015_bypass_boost_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 494 | static void rt1015_calibrate(struct rt1015_priv *rt1015) | 491 | static void rt1015_calibrate(struct rt1015_priv *rt1015) |
| 495 | { | 492 | { |
| 496 | struct snd_soc_component *component = rt1015->component; | 493 | struct snd_soc_component *component = rt1015->component; |
| 494 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 497 | struct regmap *regmap = rt1015->regmap; | 495 | struct regmap *regmap = rt1015->regmap; |
| 498 | 496 | ||
| 499 | snd_soc_dapm_mutex_lock(&component->dapm); | 497 | snd_soc_dapm_mutex_lock(dapm); |
| 500 | regcache_cache_bypass(regmap, true); | 498 | regcache_cache_bypass(regmap, true); |
| 501 | 499 | ||
| 502 | regmap_write(regmap, RT1015_CLK_DET, 0x0000); | 500 | regmap_write(regmap, RT1015_CLK_DET, 0x0000); |
| @@ -518,14 +516,13 @@ static void rt1015_calibrate(struct rt1015_priv *rt1015) · 15 unmodified lines | |||
| 518 | regcache_cache_bypass(regmap, false); | 516 | regcache_cache_bypass(regmap, false); |
| 519 | regcache_mark_dirty(regmap); | 517 | regcache_mark_dirty(regmap); |
| 520 | regcache_sync(regmap); | 518 | regcache_sync(regmap); |
| 521 | snd_soc_dapm_mutex_unlock(&component->dapm); | 519 | snd_soc_dapm_mutex_unlock(dapm); |
| 522 | } | 520 | } |
| 523 | 521 | ||
| 524 | static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol, | 522 | static int rt1015_bypass_boost_put(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) | 523 | struct snd_ctl_elem_value *ucontrol) |
| 526 | { | 524 | { |
| 527 | struct snd_soc_component *component = | 525 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 528 | snd_soc_kcontrol_component(kcontrol); | ||
| 529 | struct rt1015_priv *rt1015 = | 526 | struct rt1015_priv *rt1015 = |
| 530 | snd_soc_component_get_drvdata(component); | 527 | snd_soc_component_get_drvdata(component); |
| 531 | 528 | ||
| @@ -505,7 +505,7 @@ static int rt1318_dac_event(struct snd_soc_dapm_widget *w, · 504 unmodified lines | |||
| 505 | static int rt1318_dvol_put(struct snd_kcontrol *kcontrol, | 505 | static int rt1318_dvol_put(struct snd_kcontrol *kcontrol, |
| 506 | struct snd_ctl_elem_value *ucontrol) | 506 | struct snd_ctl_elem_value *ucontrol) |
| 507 | { | 507 | { |
| 508 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 508 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 509 | struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component); | 509 | struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component); |
| 510 | 510 | ||
| 511 | rt1318->rt1318_dvol = ucontrol->value.integer.value[0]; | 511 | rt1318->rt1318_dvol = ucontrol->value.integer.value[0]; |
| @@ -528,7 +528,7 @@ static int rt1318_dvol_put(struct snd_kcontrol *kcontrol, · 16 unmodified lines | |||
| 528 | static int rt1318_dvol_get(struct snd_kcontrol *kcontrol, | 528 | static int rt1318_dvol_get(struct snd_kcontrol *kcontrol, |
| 529 | struct snd_ctl_elem_value *ucontrol) | 529 | struct snd_ctl_elem_value *ucontrol) |
| 530 | { | 530 | { |
| 531 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 531 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 532 | struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component); | 532 | struct rt1318_priv *rt1318 = snd_soc_component_get_drvdata(component); |
| 533 | 533 | ||
| 534 | ucontrol->value.integer.value[0] = rt1318->rt1318_dvol; | 534 | ucontrol->value.integer.value[0] = rt1318->rt1318_dvol; |
| @@ -925,10 +925,11 @@ static int rt274_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, · 924 unmodified lines | |||
| 925 | static int rt274_set_bias_level(struct snd_soc_component *component, | 925 | static int rt274_set_bias_level(struct snd_soc_component *component, |
| 926 | enum snd_soc_bias_level level) | 926 | enum snd_soc_bias_level level) |
| 927 | { | 927 | { |
| 928 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 929 | |||
| 928 | switch (level) { | 930 | switch (level) { |
| 929 | case SND_SOC_BIAS_PREPARE: | 931 | case SND_SOC_BIAS_PREPARE: |
| 930 | if (SND_SOC_BIAS_STANDBY == | 932 | if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) { |
| 931 | snd_soc_component_get_bias_level(component)) { | ||
| 932 | snd_soc_component_write(component, | 933 | snd_soc_component_write(component, |
| 933 | RT274_SET_AUDIO_POWER, AC_PWRST_D0); | 934 | RT274_SET_AUDIO_POWER, AC_PWRST_D0); |
| 934 | } | 935 | } |
| @@ -223,7 +223,7 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) · 222 unmodified lines | |||
| 223 | if (!rt286->component) | 223 | if (!rt286->component) |
| 224 | return -EINVAL; | 224 | return -EINVAL; |
| 225 | 225 | ||
| 226 | dapm = snd_soc_component_get_dapm(rt286->component); | 226 | dapm = snd_soc_component_to_dapm(rt286->component); |
| 227 | 227 | ||
| 228 | if (rt286->pdata.cbj_en) { | 228 | if (rt286->pdata.cbj_en) { |
| 229 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); | 229 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); |
| @@ -314,7 +314,7 @@ static void rt286_jack_detect_work(struct work_struct *work) · 84 unmodified lines | |||
| 314 | static int rt286_mic_detect(struct snd_soc_component *component, | 314 | static int rt286_mic_detect(struct snd_soc_component *component, |
| 315 | struct snd_soc_jack *jack, void *data) | 315 | struct snd_soc_jack *jack, void *data) |
| 316 | { | 316 | { |
| 317 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 317 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 318 | struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); | 318 | struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); |
| 319 | 319 | ||
| 320 | rt286->jack = jack; | 320 | rt286->jack = jack; |
| @@ -887,9 +887,11 @@ static int rt286_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) · 566 unmodified lines | |||
| 887 | static int rt286_set_bias_level(struct snd_soc_component *component, | 887 | static int rt286_set_bias_level(struct snd_soc_component *component, |
| 888 | enum snd_soc_bias_level level) | 888 | enum snd_soc_bias_level level) |
| 889 | { | 889 | { |
| 890 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 891 | |||
| 890 | switch (level) { | 892 | switch (level) { |
| 891 | case SND_SOC_BIAS_PREPARE: | 893 | case SND_SOC_BIAS_PREPARE: |
| 892 | if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) { | 894 | if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) { |
| 893 | snd_soc_component_write(component, | 895 | snd_soc_component_write(component, |
| 894 | RT286_SET_AUDIO_POWER, AC_PWRST_D0); | 896 | RT286_SET_AUDIO_POWER, AC_PWRST_D0); |
| 895 | snd_soc_component_update_bits(component, | 897 | snd_soc_component_update_bits(component, |
| @@ -227,7 +227,7 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) · 226 unmodified lines | |||
| 227 | if (!rt298->component) | 227 | if (!rt298->component) |
| 228 | return -EINVAL; | 228 | return -EINVAL; |
| 229 | 229 | ||
| 230 | dapm = snd_soc_component_get_dapm(rt298->component); | 230 | dapm = snd_soc_component_to_dapm(rt298->component); |
| 231 | 231 | ||
| 232 | if (rt298->pdata.cbj_en) { | 232 | if (rt298->pdata.cbj_en) { |
| 233 | regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf); | 233 | regmap_read(rt298->regmap, RT298_GET_HP_SENSE, &buf); |
| @@ -329,7 +329,7 @@ static void rt298_jack_detect_work(struct work_struct *work) · 95 unmodified lines | |||
| 329 | static int rt298_mic_detect(struct snd_soc_component *component, | 329 | static int rt298_mic_detect(struct snd_soc_component *component, |
| 330 | struct snd_soc_jack *jack, void *data) | 330 | struct snd_soc_jack *jack, void *data) |
| 331 | { | 331 | { |
| 332 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 332 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 333 | struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); | 333 | struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); |
| 334 | 334 | ||
| 335 | rt298->jack = jack; | 335 | rt298->jack = jack; |
| @@ -949,10 +949,11 @@ static int rt298_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) · 613 unmodified lines | |||
| 949 | static int rt298_set_bias_level(struct snd_soc_component *component, | 949 | static int rt298_set_bias_level(struct snd_soc_component *component, |
| 950 | enum snd_soc_bias_level level) | 950 | enum snd_soc_bias_level level) |
| 951 | { | 951 | { |
| 952 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 953 | |||
| 952 | switch (level) { | 954 | switch (level) { |
| 953 | case SND_SOC_BIAS_PREPARE: | 955 | case SND_SOC_BIAS_PREPARE: |
| 954 | if (SND_SOC_BIAS_STANDBY == | 956 | if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) { |
| 955 | snd_soc_component_get_bias_level(component)) { | ||
| 956 | snd_soc_component_write(component, | 957 | snd_soc_component_write(component, |
| 957 | RT298_SET_AUDIO_POWER, AC_PWRST_D0); | 958 | RT298_SET_AUDIO_POWER, AC_PWRST_D0); |
| 958 | snd_soc_component_update_bits(component, 0x0d, 0x200, 0x200); | 959 | snd_soc_component_update_bits(component, 0x0d, 0x200, 0x200); |
| @@ -325,6 +325,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, · 324 unmodified lines | |||
| 325 | struct snd_ctl_elem_value *ucontrol) | 325 | struct snd_ctl_elem_value *ucontrol) |
| 326 | { | 326 | { |
| 327 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 327 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 328 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 328 | struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); | 329 | struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); |
| 329 | const struct firmware *fw = NULL; | 330 | const struct firmware *fw = NULL; |
| 330 | u8 buf[8]; | 331 | u8 buf[8]; |
| @@ -332,7 +333,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, · 1 unmodified line | |||
| 332 | if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled) | 333 | if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled) |
| 333 | return 0; | 334 | return 0; |
| 334 | 335 | ||
| 335 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 336 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 336 | rt5514->dsp_enabled = ucontrol->value.integer.value[0]; | 337 | rt5514->dsp_enabled = ucontrol->value.integer.value[0]; |
| 337 | 338 | ||
| 338 | if (rt5514->dsp_enabled) { | 339 | if (rt5514->dsp_enabled) { |
| @@ -1050,11 +1051,12 @@ static int rt5514_set_bias_level(struct snd_soc_component *component, · 711 unmodified lines | |||
| 1050 | enum snd_soc_bias_level level) | 1051 | enum snd_soc_bias_level level) |
| 1051 | { | 1052 | { |
| 1052 | struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); | 1053 | struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); |
| 1054 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1053 | int ret; | 1055 | int ret; |
| 1054 | 1056 | ||
| 1055 | switch (level) { | 1057 | switch (level) { |
| 1056 | case SND_SOC_BIAS_PREPARE: | 1058 | case SND_SOC_BIAS_PREPARE: |
| 1057 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { | 1059 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1058 | clk_disable_unprepare(rt5514->mclk); | 1060 | clk_disable_unprepare(rt5514->mclk); |
| 1059 | } else { | 1061 | } else { |
| 1060 | ret = clk_prepare_enable(rt5514->mclk); | 1062 | ret = clk_prepare_enable(rt5514->mclk); |
| @@ -1064,7 +1066,7 @@ static int rt5514_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 1064 | break; | 1066 | break; |
| 1065 | 1067 | ||
| 1066 | case SND_SOC_BIAS_STANDBY: | 1068 | case SND_SOC_BIAS_STANDBY: |
| 1067 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1069 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1068 | /* | 1070 | /* |
| 1069 | * If the DSP is enabled in start of recording, the DSP | 1071 | * If the DSP is enabled in start of recording, the DSP |
| 1070 | * should be disabled, and sync back to normal recording | 1072 | * should be disabled, and sync back to normal recording |
| @@ -1159,6 +1159,7 @@ static int rt5616_set_bias_level(struct snd_soc_component *component, · 1158 unmodified lines | |||
| 1159 | enum snd_soc_bias_level level) | 1159 | enum snd_soc_bias_level level) |
| 1160 | { | 1160 | { |
| 1161 | struct rt5616_priv *rt5616 = snd_soc_component_get_drvdata(component); | 1161 | struct rt5616_priv *rt5616 = snd_soc_component_get_drvdata(component); |
| 1162 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1162 | int ret; | 1163 | int ret; |
| 1163 | 1164 | ||
| 1164 | switch (level) { | 1165 | switch (level) { |
| @@ -1174,7 +1175,7 @@ static int rt5616_set_bias_level(struct snd_soc_component *component, · 9 unmodified lines | |||
| 1174 | * away from ON. Disable the clock in that case, otherwise | 1175 | * away from ON. Disable the clock in that case, otherwise |
| 1175 | * enable it. | 1176 | * enable it. |
| 1176 | */ | 1177 | */ |
| 1177 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { | 1178 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1178 | clk_disable_unprepare(rt5616->mclk); | 1179 | clk_disable_unprepare(rt5616->mclk); |
| 1179 | } else { | 1180 | } else { |
| 1180 | ret = clk_prepare_enable(rt5616->mclk); | 1181 | ret = clk_prepare_enable(rt5616->mclk); |
| @@ -1184,7 +1185,7 @@ static int rt5616_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 1184 | break; | 1185 | break; |
| 1185 | 1186 | ||
| 1186 | case SND_SOC_BIAS_STANDBY: | 1187 | case SND_SOC_BIAS_STANDBY: |
| 1187 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1188 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1188 | snd_soc_component_update_bits(component, RT5616_PWR_ANLG1, | 1189 | snd_soc_component_update_bits(component, RT5616_PWR_ANLG1, |
| 1189 | RT5616_PWR_VREF1 | RT5616_PWR_MB | | 1190 | RT5616_PWR_VREF1 | RT5616_PWR_MB | |
| 1190 | RT5616_PWR_BG | RT5616_PWR_VREF2, | 1191 | RT5616_PWR_BG | RT5616_PWR_VREF2, |
| @@ -183,7 +183,7 @@ static const DECLARE_TLV_DB_RANGE(mic_bst_tlv, · 182 unmodified lines | |||
| 183 | static int rt5631_dmic_get(struct snd_kcontrol *kcontrol, | 183 | static int rt5631_dmic_get(struct snd_kcontrol *kcontrol, |
| 184 | struct snd_ctl_elem_value *ucontrol) | 184 | struct snd_ctl_elem_value *ucontrol) |
| 185 | { | 185 | { |
| 186 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 186 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 187 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); | 187 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); |
| 188 | 188 | ||
| 189 | ucontrol->value.integer.value[0] = rt5631->dmic_used_flag; | 189 | ucontrol->value.integer.value[0] = rt5631->dmic_used_flag; |
| @@ -194,7 +194,7 @@ static int rt5631_dmic_get(struct snd_kcontrol *kcontrol, · 4 unmodified lines | |||
| 194 | static int rt5631_dmic_put(struct snd_kcontrol *kcontrol, | 194 | static int rt5631_dmic_put(struct snd_kcontrol *kcontrol, |
| 195 | struct snd_ctl_elem_value *ucontrol) | 195 | struct snd_ctl_elem_value *ucontrol) |
| 196 | { | 196 | { |
| 197 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 197 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 198 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); | 198 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); |
| 199 | 199 | ||
| 200 | rt5631->dmic_used_flag = ucontrol->value.integer.value[0]; | 200 | rt5631->dmic_used_flag = ucontrol->value.integer.value[0]; |
| @@ -1535,6 +1535,7 @@ static int rt5631_set_bias_level(struct snd_soc_component *component, · 1334 unmodified lines | |||
| 1535 | enum snd_soc_bias_level level) | 1535 | enum snd_soc_bias_level level) |
| 1536 | { | 1536 | { |
| 1537 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); | 1537 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); |
| 1538 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1538 | 1539 | ||
| 1539 | switch (level) { | 1540 | switch (level) { |
| 1540 | case SND_SOC_BIAS_ON: | 1541 | case SND_SOC_BIAS_ON: |
| @@ -1545,7 +1546,7 @@ static int rt5631_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines | |||
| 1545 | break; | 1546 | break; |
| 1546 | 1547 | ||
| 1547 | case SND_SOC_BIAS_STANDBY: | 1548 | case SND_SOC_BIAS_STANDBY: |
| 1548 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1549 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1549 | snd_soc_component_update_bits(component, RT5631_PWR_MANAG_ADD3, | 1550 | snd_soc_component_update_bits(component, RT5631_PWR_MANAG_ADD3, |
| 1550 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS, | 1551 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS, |
| 1551 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS); | 1552 | RT5631_PWR_VREF | RT5631_PWR_MAIN_BIAS); |
| @@ -1575,6 +1576,7 @@ static int rt5631_set_bias_level(struct snd_soc_component *component, · 23 unmodified lines | |||
| 1575 | static int rt5631_probe(struct snd_soc_component *component) | 1576 | static int rt5631_probe(struct snd_soc_component *component) |
| 1576 | { | 1577 | { |
| 1577 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); | 1578 | struct rt5631_priv *rt5631 = snd_soc_component_get_drvdata(component); |
| 1579 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1578 | unsigned int val; | 1580 | unsigned int val; |
| 1579 | 1581 | ||
| 1580 | val = rt5631_read_index(component, RT5631_ADDA_MIXER_INTL_REG3); | 1582 | val = rt5631_read_index(component, RT5631_ADDA_MIXER_INTL_REG3); |
| @@ -1613,7 +1615,7 @@ static int rt5631_probe(struct snd_soc_component *component) · 32 unmodified lines | |||
| 1613 | RT5631_DMIC_R_CH_LATCH_RISING); | 1615 | RT5631_DMIC_R_CH_LATCH_RISING); |
| 1614 | } | 1616 | } |
| 1615 | 1617 | ||
| 1616 | snd_soc_component_init_bias_level(component, SND_SOC_BIAS_STANDBY); | 1618 | snd_soc_dapm_init_bias_level(dapm, SND_SOC_BIAS_STANDBY); |
| 1617 | 1619 | ||
| 1618 | return 0; | 1620 | return 0; |
| 1619 | } | 1621 | } |
| @@ -1935,6 +1935,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 1934 unmodified lines | |||
| 1935 | enum snd_soc_bias_level level) | 1935 | enum snd_soc_bias_level level) |
| 1936 | { | 1936 | { |
| 1937 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); | 1937 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
| 1938 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1938 | int ret; | 1939 | int ret; |
| 1939 | 1940 | ||
| 1940 | switch (level) { | 1941 | switch (level) { |
| @@ -1949,7 +1950,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 8 unmodified lines | |||
| 1949 | * away from ON. Disable the clock in that case, otherwise | 1950 | * away from ON. Disable the clock in that case, otherwise |
| 1950 | * enable it. | 1951 | * enable it. |
| 1951 | */ | 1952 | */ |
| 1952 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { | 1953 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1953 | clk_disable_unprepare(rt5640->mclk); | 1954 | clk_disable_unprepare(rt5640->mclk); |
| 1954 | } else { | 1955 | } else { |
| 1955 | ret = clk_prepare_enable(rt5640->mclk); | 1956 | ret = clk_prepare_enable(rt5640->mclk); |
| @@ -1959,7 +1960,7 @@ static int rt5640_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 1959 | break; | 1960 | break; |
| 1960 | 1961 | ||
| 1961 | case SND_SOC_BIAS_STANDBY: | 1962 | case SND_SOC_BIAS_STANDBY: |
| 1962 | if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) { | 1963 | if (SND_SOC_BIAS_OFF == snd_soc_dapm_get_bias_level(dapm)) { |
| 1963 | snd_soc_component_update_bits(component, RT5640_PWR_ANLG1, | 1964 | snd_soc_component_update_bits(component, RT5640_PWR_ANLG1, |
| 1964 | RT5640_PWR_VREF1 | RT5640_PWR_MB | | 1965 | RT5640_PWR_VREF1 | RT5640_PWR_MB | |
| 1965 | RT5640_PWR_BG | RT5640_PWR_VREF2, | 1966 | RT5640_PWR_BG | RT5640_PWR_VREF2, |
| @@ -2098,7 +2099,7 @@ EXPORT_SYMBOL_GPL(rt5640_sel_asrc_clk_src); · 132 unmodified lines | |||
| 2098 | 2099 | ||
| 2099 | void rt5640_enable_micbias1_for_ovcd(struct snd_soc_component *component) | 2100 | void rt5640_enable_micbias1_for_ovcd(struct snd_soc_component *component) |
| 2100 | { | 2101 | { |
| 2101 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 2102 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2102 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); | 2103 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
| 2103 | 2104 | ||
| 2104 | snd_soc_dapm_mutex_lock(dapm); | 2105 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -2114,7 +2115,7 @@ EXPORT_SYMBOL_GPL(rt5640_enable_micbias1_for_ovcd); · 9 unmodified lines | |||
| 2114 | 2115 | ||
| 2115 | void rt5640_disable_micbias1_for_ovcd(struct snd_soc_component *component) | 2116 | void rt5640_disable_micbias1_for_ovcd(struct snd_soc_component *component) |
| 2116 | { | 2117 | { |
| 2117 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 2118 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2118 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); | 2119 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
| 2119 | 2120 | ||
| 2120 | snd_soc_dapm_mutex_lock(dapm); | 2121 | snd_soc_dapm_mutex_lock(dapm); |
| @@ -2586,8 +2587,7 @@ static void rt5640_enable_hda_jack_detect( · 465 unmodified lines | |||
| 2586 | struct snd_soc_component *component, struct snd_soc_jack *jack) | 2587 | struct snd_soc_component *component, struct snd_soc_jack *jack) |
| 2587 | { | 2588 | { |
| 2588 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); | 2589 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
| 2589 | struct snd_soc_dapm_context *dapm = | 2590 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2590 | snd_soc_component_get_dapm(component); | ||
| 2591 | int ret; | 2591 | int ret; |
| 2592 | 2592 | ||
| 2593 | /* Select JD1 for Mic */ | 2593 | /* Select JD1 for Mic */ |
| @@ -2652,7 +2652,7 @@ static int rt5640_set_jack(struct snd_soc_component *component, · 58 unmodified lines | |||
| 2652 | 2652 | ||
| 2653 | static int rt5640_probe(struct snd_soc_component *component) | 2653 | static int rt5640_probe(struct snd_soc_component *component) |
| 2654 | { | 2654 | { |
| 2655 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 2655 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2656 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); | 2656 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
| 2657 | u32 dmic1_data_pin = 0; | 2657 | u32 dmic1_data_pin = 0; |
| 2658 | u32 dmic2_data_pin = 0; | 2658 | u32 dmic2_data_pin = 0; |
| @@ -2666,7 +2666,7 @@ static int rt5640_probe(struct snd_soc_component *component) · 7 unmodified lines | |||
| 2666 | 2666 | ||
| 2667 | rt5640->component = component; | 2667 | rt5640->component = component; |
| 2668 | 2668 | ||
| 2669 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 2669 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 2670 | 2670 | ||
| 2671 | snd_soc_component_update_bits(component, RT5640_GCTL1, 0x0301, 0x0301); | 2671 | snd_soc_component_update_bits(component, RT5640_GCTL1, 0x0301, 0x0301); |
| 2672 | snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030); | 2672 | snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030); |
| @@ -2796,6 +2796,7 @@ static void rt5640_remove(struct snd_soc_component *component) · 123 unmodified lines | |||
| 2796 | static int rt5640_suspend(struct snd_soc_component *component) | 2796 | static int rt5640_suspend(struct snd_soc_component *component) |
| 2797 | { | 2797 | { |
| 2798 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); | 2798 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
| 2799 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2799 | 2800 | ||
| 2800 | if (rt5640->jack) { | 2801 | if (rt5640->jack) { |
| 2801 | /* disable jack interrupts during system suspend */ | 2802 | /* disable jack interrupts during system suspend */ |
| @@ -2804,7 +2805,7 @@ static int rt5640_suspend(struct snd_soc_component *component) · 2 unmodified lines | |||
| 2804 | cancel_delayed_work_sync(&rt5640->bp_work); | 2805 | cancel_delayed_work_sync(&rt5640->bp_work); |
| 2805 | } | 2806 | } |
| 2806 | 2807 | ||
| 2807 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 2808 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 2808 | rt5640_reset(component); | 2809 | rt5640_reset(component); |
| 2809 | regcache_cache_only(rt5640->regmap, true); | 2810 | regcache_cache_only(rt5640->regmap, true); |
| 2810 | regcache_mark_dirty(rt5640->regmap); | 2811 | regcache_mark_dirty(rt5640->regmap); |
| @@ -3071,10 +3071,11 @@ static int rt5645_set_bias_level(struct snd_soc_component *component, · 3070 unmodified lines | |||
| 3071 | enum snd_soc_bias_level level) | 3071 | enum snd_soc_bias_level level) |
| 3072 | { | 3072 | { |
| 3073 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); | 3073 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
| 3074 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 3074 | 3075 | ||
| 3075 | switch (level) { | 3076 | switch (level) { |
| 3076 | case SND_SOC_BIAS_PREPARE: | 3077 | case SND_SOC_BIAS_PREPARE: |
| 3077 | if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) { | 3078 | if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) { |
| 3078 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, | 3079 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
| 3079 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 3080 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
| 3080 | RT5645_PWR_BG | RT5645_PWR_VREF2, | 3081 | RT5645_PWR_BG | RT5645_PWR_VREF2, |
| @@ -3099,7 +3100,7 @@ static int rt5645_set_bias_level(struct snd_soc_component *component, · 18 unmodified lines | |||
| 3099 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, | 3100 | snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, |
| 3100 | RT5645_PWR_FV1 | RT5645_PWR_FV2, | 3101 | RT5645_PWR_FV1 | RT5645_PWR_FV2, |
| 3101 | RT5645_PWR_FV1 | RT5645_PWR_FV2); | 3102 | RT5645_PWR_FV1 | RT5645_PWR_FV2); |
| 3102 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 3103 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 3103 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); | 3104 | snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); |
| 3104 | msleep(40); | 3105 | msleep(40); |
| 3105 | if (rt5645->en_button_func) | 3106 | if (rt5645->en_button_func) |
| @@ -3130,7 +3131,7 @@ static int rt5645_set_bias_level(struct snd_soc_component *component, · 24 unmodified lines | |||
| 3130 | static void rt5645_enable_push_button_irq(struct snd_soc_component *component, | 3131 | static void rt5645_enable_push_button_irq(struct snd_soc_component *component, |
| 3131 | bool enable) | 3132 | bool enable) |
| 3132 | { | 3133 | { |
| 3133 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 3134 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3134 | int ret; | 3135 | int ret; |
| 3135 | 3136 | ||
| 3136 | if (enable) { | 3137 | if (enable) { |
| @@ -3169,7 +3170,7 @@ static void rt5645_enable_push_button_irq(struct snd_soc_component *component, · 32 unmodified lines | |||
| 3169 | 3170 | ||
| 3170 | static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insert) | 3171 | static int rt5645_jack_detect(struct snd_soc_component *component, int jack_insert) |
| 3171 | { | 3172 | { |
| 3172 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 3173 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3173 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); | 3174 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
| 3174 | unsigned int val; | 3175 | unsigned int val; |
| 3175 | 3176 | ||
| @@ -3180,7 +3181,7 @@ static int rt5645_jack_detect(struct snd_soc_component *component, int jack_inse · 4 unmodified lines | |||
| 3180 | snd_soc_dapm_force_enable_pin(dapm, "LDO2"); | 3181 | snd_soc_dapm_force_enable_pin(dapm, "LDO2"); |
| 3181 | snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power"); | 3182 | snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power"); |
| 3182 | snd_soc_dapm_sync(dapm); | 3183 | snd_soc_dapm_sync(dapm); |
| 3183 | if (!snd_soc_card_is_instantiated(dapm->card)) { | 3184 | if (!snd_soc_card_is_instantiated(component->card)) { |
| 3184 | /* Power up necessary bits for JD if dapm is | 3185 | /* Power up necessary bits for JD if dapm is |
| 3185 | not ready yet */ | 3186 | not ready yet */ |
| 3186 | regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1, | 3187 | regmap_update_bits(rt5645->regmap, RT5645_PWR_ANLG1, |
| @@ -3449,7 +3450,7 @@ static void rt5645_btn_check_callback(struct timer_list *t) · 262 unmodified lines | |||
| 3449 | 3450 | ||
| 3450 | static int rt5645_probe(struct snd_soc_component *component) | 3451 | static int rt5645_probe(struct snd_soc_component *component) |
| 3451 | { | 3452 | { |
| 3452 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 3453 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3453 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); | 3454 | struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); |
| 3454 | 3455 | ||
| 3455 | rt5645->component = component; | 3456 | rt5645->component = component; |
| @@ -3478,7 +3479,7 @@ static int rt5645_probe(struct snd_soc_component *component) · 22 unmodified lines | |||
| 3478 | break; | 3479 | break; |
| 3479 | } | 3480 | } |
| 3480 | 3481 | ||
| 3481 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 3482 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 3482 | 3483 | ||
| 3483 | /* for JD function */ | 3484 | /* for JD function */ |
| 3484 | if (rt5645->pdata.jd_mode) { | 3485 | if (rt5645->pdata.jd_mode) { |
| @@ -1511,16 +1511,18 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, · 1510 unmodified lines | |||
| 1511 | static int rt5651_set_bias_level(struct snd_soc_component *component, | 1511 | static int rt5651_set_bias_level(struct snd_soc_component *component, |
| 1512 | enum snd_soc_bias_level level) | 1512 | enum snd_soc_bias_level level) |
| 1513 | { | 1513 | { |
| 1514 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1515 | |||
| 1514 | switch (level) { | 1516 | switch (level) { |
| 1515 | case SND_SOC_BIAS_PREPARE: | 1517 | case SND_SOC_BIAS_PREPARE: |
| 1516 | if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) { | 1518 | if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) { |
| 1517 | if (snd_soc_component_read(component, RT5651_PLL_MODE_1) & 0x9200) | 1519 | if (snd_soc_component_read(component, RT5651_PLL_MODE_1) & 0x9200) |
| 1518 | snd_soc_component_update_bits(component, RT5651_D_MISC, | 1520 | snd_soc_component_update_bits(component, RT5651_D_MISC, |
| 1519 | 0xc00, 0xc00); | 1521 | 0xc00, 0xc00); |
| 1520 | } | 1522 | } |
| 1521 | break; | 1523 | break; |
| 1522 | case SND_SOC_BIAS_STANDBY: | 1524 | case SND_SOC_BIAS_STANDBY: |
| 1523 | if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) { | 1525 | if (SND_SOC_BIAS_OFF == snd_soc_dapm_get_bias_level(dapm)) { |
| 1524 | snd_soc_component_update_bits(component, RT5651_PWR_ANLG1, | 1526 | snd_soc_component_update_bits(component, RT5651_PWR_ANLG1, |
| 1525 | RT5651_PWR_VREF1 | RT5651_PWR_MB | | 1527 | RT5651_PWR_VREF1 | RT5651_PWR_MB | |
| 1526 | RT5651_PWR_BG | RT5651_PWR_VREF2, | 1528 | RT5651_PWR_BG | RT5651_PWR_VREF2, |
| @@ -1557,7 +1559,7 @@ static int rt5651_set_bias_level(struct snd_soc_component *component, · 30 unmodified lines | |||
| 1557 | 1559 | ||
| 1558 | static void rt5651_enable_micbias1_for_ovcd(struct snd_soc_component *component) | 1560 | static void rt5651_enable_micbias1_for_ovcd(struct snd_soc_component *component) |
| 1559 | { | 1561 | { |
| 1560 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1562 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1561 | 1563 | ||
| 1562 | snd_soc_dapm_mutex_lock(dapm); | 1564 | snd_soc_dapm_mutex_lock(dapm); |
| 1563 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO"); | 1565 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO"); |
| @@ -1570,7 +1572,7 @@ static void rt5651_enable_micbias1_for_ovcd(struct snd_soc_component *component) · 6 unmodified lines | |||
| 1570 | 1572 | ||
| 1571 | static void rt5651_disable_micbias1_for_ovcd(struct snd_soc_component *component) | 1573 | static void rt5651_disable_micbias1_for_ovcd(struct snd_soc_component *component) |
| 1572 | { | 1574 | { |
| 1573 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1575 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1574 | 1576 | ||
| 1575 | snd_soc_dapm_mutex_lock(dapm); | 1577 | snd_soc_dapm_mutex_lock(dapm); |
| 1576 | snd_soc_dapm_disable_pin_unlocked(dapm, "Platform Clock"); | 1578 | snd_soc_dapm_disable_pin_unlocked(dapm, "Platform Clock"); |
| @@ -2058,13 +2060,14 @@ static void rt5651_apply_properties(struct snd_soc_component *component) · 481 unmodified lines | |||
| 2058 | static int rt5651_probe(struct snd_soc_component *component) | 2060 | static int rt5651_probe(struct snd_soc_component *component) |
| 2059 | { | 2061 | { |
| 2060 | struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); | 2062 | struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component); |
| 2063 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2061 | 2064 | ||
| 2062 | rt5651->component = component; | 2065 | rt5651->component = component; |
| 2063 | 2066 | ||
| 2064 | snd_soc_component_update_bits(component, RT5651_PWR_ANLG1, | 2067 | snd_soc_component_update_bits(component, RT5651_PWR_ANLG1, |
| 2065 | RT5651_PWR_LDO_DVO_MASK, RT5651_PWR_LDO_DVO_1_2V); | 2068 | RT5651_PWR_LDO_DVO_MASK, RT5651_PWR_LDO_DVO_1_2V); |
| 2066 | 2069 | ||
| 2067 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 2070 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 2068 | 2071 | ||
| 2069 | rt5651_apply_properties(component); | 2072 | rt5651_apply_properties(component); |
| 2070 | 2073 | ||
| @@ -1197,7 +1197,7 @@ static const struct snd_kcontrol_new rt5659_if3_adc_swap_mux = · 1196 unmodified lines | |||
| 1197 | static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol, | 1197 | static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol, |
| 1198 | struct snd_ctl_elem_value *ucontrol) | 1198 | struct snd_ctl_elem_value *ucontrol) |
| 1199 | { | 1199 | { |
| 1200 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1200 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1201 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); | 1201 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); |
| 1202 | 1202 | ||
| 1203 | if (snd_soc_component_read(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) { | 1203 | if (snd_soc_component_read(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) { |
| @@ -1213,7 +1213,7 @@ static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol, · 9 unmodified lines | |||
| 1213 | static void rt5659_enable_push_button_irq(struct snd_soc_component *component, | 1213 | static void rt5659_enable_push_button_irq(struct snd_soc_component *component, |
| 1214 | bool enable) | 1214 | bool enable) |
| 1215 | { | 1215 | { |
| 1216 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1216 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1217 | 1217 | ||
| 1218 | if (enable) { | 1218 | if (enable) { |
| 1219 | snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, 0x000b); | 1219 | snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, 0x000b); |
| @@ -1257,7 +1257,7 @@ static void rt5659_enable_push_button_irq(struct snd_soc_component *component, · 37 unmodified lines | |||
| 1257 | 1257 | ||
| 1258 | static int rt5659_headset_detect(struct snd_soc_component *component, int jack_insert) | 1258 | static int rt5659_headset_detect(struct snd_soc_component *component, int jack_insert) |
| 1259 | { | 1259 | { |
| 1260 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1260 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1261 | int val, i = 0, sleep_time[5] = {300, 150, 100, 50, 30}; | 1261 | int val, i = 0, sleep_time[5] = {300, 150, 100, 50, 30}; |
| 1262 | int reg_63; | 1262 | int reg_63; |
| 1263 | 1263 | ||
| @@ -3611,7 +3611,7 @@ static int rt5659_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) · 2347 unmodified lines | |||
| 3611 | static int rt5659_set_bias_level(struct snd_soc_component *component, | 3611 | static int rt5659_set_bias_level(struct snd_soc_component *component, |
| 3612 | enum snd_soc_bias_level level) | 3612 | enum snd_soc_bias_level level) |
| 3613 | { | 3613 | { |
| 3614 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 3614 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3615 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); | 3615 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); |
| 3616 | int ret; | 3616 | int ret; |
| 3617 | 3617 | ||
| @@ -3631,7 +3631,7 @@ static int rt5659_set_bias_level(struct snd_soc_component *component, · 13 unmodified lines | |||
| 3631 | break; | 3631 | break; |
| 3632 | 3632 | ||
| 3633 | case SND_SOC_BIAS_STANDBY: | 3633 | case SND_SOC_BIAS_STANDBY: |
| 3634 | if (dapm->bias_level == SND_SOC_BIAS_OFF) { | 3634 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 3635 | ret = clk_prepare_enable(rt5659->mclk); | 3635 | ret = clk_prepare_enable(rt5659->mclk); |
| 3636 | if (ret) { | 3636 | if (ret) { |
| 3637 | dev_err(component->dev, | 3637 | dev_err(component->dev, |
| @@ -3662,8 +3662,7 @@ static int rt5659_set_bias_level(struct snd_soc_component *component, · 24 unmodified lines | |||
| 3662 | 3662 | ||
| 3663 | static int rt5659_probe(struct snd_soc_component *component) | 3663 | static int rt5659_probe(struct snd_soc_component *component) |
| 3664 | { | 3664 | { |
| 3665 | struct snd_soc_dapm_context *dapm = | 3665 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3666 | snd_soc_component_get_dapm(component); | ||
| 3667 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); | 3666 | struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component); |
| 3668 | 3667 | ||
| 3669 | rt5659->component = component; | 3668 | rt5659->component = component; |
| @@ -1069,6 +1069,7 @@ static int rt5660_set_bias_level(struct snd_soc_component *component, · 1068 unmodified lines | |||
| 1069 | enum snd_soc_bias_level level) | 1069 | enum snd_soc_bias_level level) |
| 1070 | { | 1070 | { |
| 1071 | struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); | 1071 | struct rt5660_priv *rt5660 = snd_soc_component_get_drvdata(component); |
| 1072 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 1072 | int ret; | 1073 | int ret; |
| 1073 | 1074 | ||
| 1074 | switch (level) { | 1075 | switch (level) { |
| @@ -1079,7 +1080,7 @@ static int rt5660_set_bias_level(struct snd_soc_component *component, · 4 unmodified lines | |||
| 1079 | snd_soc_component_update_bits(component, RT5660_GEN_CTRL1, | 1080 | snd_soc_component_update_bits(component, RT5660_GEN_CTRL1, |
| 1080 | RT5660_DIG_GATE_CTRL, RT5660_DIG_GATE_CTRL); | 1081 | RT5660_DIG_GATE_CTRL, RT5660_DIG_GATE_CTRL); |
| 1081 | 1082 | ||
| 1082 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) { | 1083 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_ON) { |
| 1083 | clk_disable_unprepare(rt5660->mclk); | 1084 | clk_disable_unprepare(rt5660->mclk); |
| 1084 | } else { | 1085 | } else { |
| 1085 | ret = clk_prepare_enable(rt5660->mclk); | 1086 | ret = clk_prepare_enable(rt5660->mclk); |
| @@ -1089,7 +1090,7 @@ static int rt5660_set_bias_level(struct snd_soc_component *component, · 3 unmodified lines | |||
| 1089 | break; | 1090 | break; |
| 1090 | 1091 | ||
| 1091 | case SND_SOC_BIAS_STANDBY: | 1092 | case SND_SOC_BIAS_STANDBY: |
| 1092 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { | 1093 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) { |
| 1093 | snd_soc_component_update_bits(component, RT5660_PWR_ANLG1, | 1094 | snd_soc_component_update_bits(component, RT5660_PWR_ANLG1, |
| 1094 | RT5660_PWR_VREF1 | RT5660_PWR_MB | | 1095 | RT5660_PWR_VREF1 | RT5660_PWR_MB | |
| 1095 | RT5660_PWR_BG | RT5660_PWR_VREF2, | 1096 | RT5660_PWR_BG | RT5660_PWR_VREF2, |
| @@ -1463,7 +1463,7 @@ static void rt5663_enable_push_button_irq(struct snd_soc_component *component, · 1462 unmodified lines | |||
| 1463 | 1463 | ||
| 1464 | static int rt5663_v2_jack_detect(struct snd_soc_component *component, int jack_insert) | 1464 | static int rt5663_v2_jack_detect(struct snd_soc_component *component, int jack_insert) |
| 1465 | { | 1465 | { |
| 1466 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1466 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1467 | struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component); | 1467 | struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component); |
| 1468 | int val, i = 0, sleep_time[5] = {300, 150, 100, 50, 30}; | 1468 | int val, i = 0, sleep_time[5] = {300, 150, 100, 50, 30}; |
| 1469 | 1469 | ||
| @@ -1859,7 +1859,7 @@ static irqreturn_t rt5663_irq(int irq, void *data) · 389 unmodified lines | |||
| 1859 | dev_dbg(regmap_get_device(rt5663->regmap), "%s IRQ queue work\n", | 1859 | dev_dbg(regmap_get_device(rt5663->regmap), "%s IRQ queue work\n", |
| 1860 | __func__); | 1860 | __func__); |
| 1861 | 1861 | ||
| 1862 | queue_delayed_work(system_wq, &rt5663->jack_detect_work, | 1862 | queue_delayed_work(system_dfl_wq, &rt5663->jack_detect_work, |
| 1863 | msecs_to_jiffies(250)); | 1863 | msecs_to_jiffies(250)); |
| 1864 | 1864 | ||
| 1865 | return IRQ_HANDLED; | 1865 | return IRQ_HANDLED; |
| @@ -1974,7 +1974,7 @@ static void rt5663_jack_detect_work(struct work_struct *work) · 108 unmodified lines | |||
| 1974 | cancel_delayed_work_sync( | 1974 | cancel_delayed_work_sync( |
| 1975 | &rt5663->jd_unplug_work); | 1975 | &rt5663->jd_unplug_work); |
| 1976 | } else { | 1976 | } else { |
| 1977 | queue_delayed_work(system_wq, | 1977 | queue_delayed_work(system_dfl_wq, |
| 1978 | &rt5663->jd_unplug_work, | 1978 | &rt5663->jd_unplug_work, |
| 1979 | msecs_to_jiffies(500)); | 1979 | msecs_to_jiffies(500)); |
| 1980 | } | 1980 | } |
| @@ -2024,7 +2024,7 @@ static void rt5663_jd_unplug_work(struct work_struct *work) · 43 unmodified lines | |||
| 2024 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | | 2024 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | |
| 2025 | SND_JACK_BTN_2 | SND_JACK_BTN_3); | 2025 | SND_JACK_BTN_2 | SND_JACK_BTN_3); |
| 2026 | } else { | 2026 | } else { |
| 2027 | queue_delayed_work(system_wq, &rt5663->jd_unplug_work, | 2027 | queue_delayed_work(system_dfl_wq, &rt5663->jd_unplug_work, |
| 2028 | msecs_to_jiffies(500)); | 2028 | msecs_to_jiffies(500)); |
| 2029 | } | 2029 | } |
| 2030 | } | 2030 | } |
| @@ -3140,7 +3140,7 @@ static int rt5663_set_bias_level(struct snd_soc_component *component, · 1109 unmodified lines | |||
| 3140 | 3140 | ||
| 3141 | static int rt5663_probe(struct snd_soc_component *component) | 3141 | static int rt5663_probe(struct snd_soc_component *component) |
| 3142 | { | 3142 | { |
| 3143 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 3143 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 3144 | struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component); | 3144 | struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component); |
| 3145 | 3145 | ||
| 3146 | rt5663->component = component; | 3146 | rt5663->component = component; |
| @@ -993,7 +993,7 @@ static const struct snd_kcontrol_new rt5665_if3_adc_swap_mux = · 992 unmodified lines | |||
| 993 | static int rt5665_hp_vol_put(struct snd_kcontrol *kcontrol, | 993 | static int rt5665_hp_vol_put(struct snd_kcontrol *kcontrol, |
| 994 | struct snd_ctl_elem_value *ucontrol) | 994 | struct snd_ctl_elem_value *ucontrol) |
| 995 | { | 995 | { |
| 996 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 996 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 997 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); | 997 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); |
| 998 | 998 | ||
| 999 | if (snd_soc_component_read(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) { | 999 | if (snd_soc_component_read(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) { |
| @@ -1009,7 +1009,7 @@ static int rt5665_hp_vol_put(struct snd_kcontrol *kcontrol, · 9 unmodified lines | |||
| 1009 | static int rt5665_mono_vol_put(struct snd_kcontrol *kcontrol, | 1009 | static int rt5665_mono_vol_put(struct snd_kcontrol *kcontrol, |
| 1010 | struct snd_ctl_elem_value *ucontrol) | 1010 | struct snd_ctl_elem_value *ucontrol) |
| 1011 | { | 1011 | { |
| 1012 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 1012 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 1013 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); | 1013 | int ret = snd_soc_put_volsw(kcontrol, ucontrol); |
| 1014 | 1014 | ||
| 1015 | if (snd_soc_component_read(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) { | 1015 | if (snd_soc_component_read(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) { |
| @@ -1067,7 +1067,7 @@ static void rt5665_enable_push_button_irq(struct snd_soc_component *component, · 51 unmodified lines | |||
| 1067 | static int rt5665_headset_detect(struct snd_soc_component *component, int jack_insert) | 1067 | static int rt5665_headset_detect(struct snd_soc_component *component, int jack_insert) |
| 1068 | { | 1068 | { |
| 1069 | struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component); | 1069 | struct rt5665_priv *rt5665 = snd_soc_component_get_drvdata(component); |
| 1070 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 1070 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 1071 | unsigned int sar_hs_type, val; | 1071 | unsigned int sar_hs_type, val; |
| 1072 | 1072 | ||
| 1073 | if (jack_insert) { | 1073 | if (jack_insert) { |
| @@ -853,8 +853,7 @@ static int rt5668_headset_detect(struct snd_soc_component *component, · 852 unmodified lines | |||
| 853 | int jack_insert) | 853 | int jack_insert) |
| 854 | { | 854 | { |
| 855 | struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); | 855 | struct rt5668_priv *rt5668 = snd_soc_component_get_drvdata(component); |
| 856 | struct snd_soc_dapm_context *dapm = | 856 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 857 | snd_soc_component_get_dapm(component); | ||
| 858 | unsigned int val, count; | 857 | unsigned int val, count; |
| 859 | 858 | ||
| 860 | if (jack_insert) { | 859 | if (jack_insert) { |
| @@ -431,7 +431,7 @@ static bool rt5670_readable_register(struct device *dev, unsigned int reg) · 430 unmodified lines | |||
| 431 | static int rt5670_headset_detect(struct snd_soc_component *component, int jack_insert) | 431 | static int rt5670_headset_detect(struct snd_soc_component *component, int jack_insert) |
| 432 | { | 432 | { |
| 433 | int val; | 433 | int val; |
| 434 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 434 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 435 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | 435 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); |
| 436 | 436 | ||
| 437 | if (jack_insert) { | 437 | if (jack_insert) { |
| @@ -652,7 +652,7 @@ static void rt5670_update_ad_da_mixer_dac1_m_bits(struct rt5670_priv *rt5670) · 214 unmodified lines | |||
| 652 | static int rt5670_dac1_playback_switch_get(struct snd_kcontrol *kcontrol, | 652 | static int rt5670_dac1_playback_switch_get(struct snd_kcontrol *kcontrol, |
| 653 | struct snd_ctl_elem_value *ucontrol) | 653 | struct snd_ctl_elem_value *ucontrol) |
| 654 | { | 654 | { |
| 655 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 655 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 656 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | 656 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); |
| 657 | 657 | ||
| 658 | ucontrol->value.integer.value[0] = rt5670->dac1_playback_switch_l; | 658 | ucontrol->value.integer.value[0] = rt5670->dac1_playback_switch_l; |
| @@ -664,7 +664,7 @@ static int rt5670_dac1_playback_switch_get(struct snd_kcontrol *kcontrol, · 5 unmodified lines | |||
| 664 | static int rt5670_dac1_playback_switch_put(struct snd_kcontrol *kcontrol, | 664 | static int rt5670_dac1_playback_switch_put(struct snd_kcontrol *kcontrol, |
| 665 | struct snd_ctl_elem_value *ucontrol) | 665 | struct snd_ctl_elem_value *ucontrol) |
| 666 | { | 666 | { |
| 667 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 667 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 668 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | 668 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); |
| 669 | 669 | ||
| 670 | if (rt5670->dac1_playback_switch_l == ucontrol->value.integer.value[0] && | 670 | if (rt5670->dac1_playback_switch_l == ucontrol->value.integer.value[0] && |
| @@ -966,7 +966,7 @@ static int rt5670_put_dac1_mix_dac1_switch(struct snd_kcontrol *kcontrol, · 295 unmodified lines | |||
| 966 | struct snd_ctl_elem_value *ucontrol) | 966 | struct snd_ctl_elem_value *ucontrol) |
| 967 | { | 967 | { |
| 968 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; | 968 | struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; |
| 969 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); | 969 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 970 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | 970 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); |
| 971 | int ret; | 971 | int ret; |
| 972 | 972 | ||
| @@ -1153,25 +1153,29 @@ static SOC_ENUM_SINGLE_DECL(rt5670_dac1r_enum, RT5670_AD_DA_MIXER, · 180 unmodified lines | |||
| 1153 | static const struct snd_kcontrol_new rt5670_dac1r_mux = | 1153 | static const struct snd_kcontrol_new rt5670_dac1r_mux = |
| 1154 | SOC_DAPM_ENUM("DAC1 R source", rt5670_dac1r_enum); | 1154 | SOC_DAPM_ENUM("DAC1 R source", rt5670_dac1r_enum); |
| 1155 | 1155 | ||
| 1156 | /*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */ | 1156 | /* DAC2 L source*/ /* MX-1B [6:4] */ |
| 1157 | /* TODO Use SOC_VALUE_ENUM_SINGLE_DECL */ | 1157 | static const char *const rt5670_dac12_src[] = { |
| 1158 | static const char * const rt5670_dac12_src[] = { | 1158 | "IF1 DAC", "IF2 DAC", "TxDC DAC", "VAD_ADC" |
| 1159 | "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", | 1159 | }; /* VAD_ADC or TxDP_ADC_R */ |
| 1160 | "Bass", "VAD_ADC", "IF4 DAC" | 1160 | |
| 1161 | }; | 1161 | static const unsigned int rt5670_dac12_values[] = { 0, 1, 3, 5 }; |
| 1162 | 1162 | ||
| 1163 | static SOC_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL, | 1163 | static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL, |
| 1164 | RT5670_DAC2_L_SEL_SFT, rt5670_dac12_src); | 1164 | RT5670_DAC2_L_SEL_SFT, RT5670_DAC2_L_SEL_MASK, |
| 1165 | rt5670_dac12_src, rt5670_dac12_values); | ||
| 1165 | 1166 | ||
| 1166 | static const struct snd_kcontrol_new rt5670_dac_l2_mux = | 1167 | static const struct snd_kcontrol_new rt5670_dac_l2_mux = |
| 1167 | SOC_DAPM_ENUM("DAC2 L source", rt5670_dac2l_enum); | 1168 | SOC_DAPM_ENUM("DAC2 L source", rt5670_dac2l_enum); |
| 1168 | 1169 | ||
| 1169 | static const char * const rt5670_dacr2_src[] = { | 1170 | /*DAC2 R source*/ /* MX-1B [2:0] */ |
| 1170 | "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", "TxDP ADC", "IF4 DAC" | 1171 | static const char *const rt5670_dacr2_src[] = { "IF1 DAC", "IF2 DAC", |
| 1171 | }; | 1172 | "TxDC DAC", "TxDP ADC" }; |
| 1173 | |||
| 1174 | static const unsigned int rt5670_dacr2_values[] = { 0, 1, 3, 4 }; | ||
| 1172 | 1175 | ||
| 1173 | static SOC_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL, | 1176 | static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL, |
| 1174 | RT5670_DAC2_R_SEL_SFT, rt5670_dacr2_src); | 1177 | RT5670_DAC2_R_SEL_SFT, RT5670_DAC2_R_SEL_MASK, |
| 1178 | rt5670_dacr2_src, rt5670_dacr2_values); | ||
| 1175 | 1179 | ||
| 1176 | static const struct snd_kcontrol_new rt5670_dac_r2_mux = | 1180 | static const struct snd_kcontrol_new rt5670_dac_r2_mux = |
| 1177 | SOC_DAPM_ENUM("DAC2 R source", rt5670_dac2r_enum); | 1181 | SOC_DAPM_ENUM("DAC2 R source", rt5670_dac2r_enum); |
| @@ -2666,10 +2670,11 @@ static int rt5670_set_bias_level(struct snd_soc_component *component, · 1488 unmodified lines | |||
| 2666 | enum snd_soc_bias_level level) | 2670 | enum snd_soc_bias_level level) |
| 2667 | { | 2671 | { |
| 2668 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | 2672 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); |
| 2673 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2669 | 2674 | ||
| 2670 | switch (level) { | 2675 | switch (level) { |
| 2671 | case SND_SOC_BIAS_PREPARE: | 2676 | case SND_SOC_BIAS_PREPARE: |
| 2672 | if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) { | 2677 | if (SND_SOC_BIAS_STANDBY == snd_soc_dapm_get_bias_level(dapm)) { |
| 2673 | snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, | 2678 | snd_soc_component_update_bits(component, RT5670_PWR_ANLG1, |
| 2674 | RT5670_PWR_VREF1 | RT5670_PWR_MB | | 2679 | RT5670_PWR_VREF1 | RT5670_PWR_MB | |
| 2675 | RT5670_PWR_BG | RT5670_PWR_VREF2, | 2680 | RT5670_PWR_BG | RT5670_PWR_VREF2, |
| @@ -2719,7 +2724,7 @@ static int rt5670_set_bias_level(struct snd_soc_component *component, · 43 unmodified lines | |||
| 2719 | 2724 | ||
| 2720 | static int rt5670_probe(struct snd_soc_component *component) | 2725 | static int rt5670_probe(struct snd_soc_component *component) |
| 2721 | { | 2726 | { |
| 2722 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 2727 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 2723 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); | 2728 | struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component); |
| 2724 | 2729 | ||
| 2725 | switch (snd_soc_component_read(component, RT5670_RESET) & RT5670_ID_MASK) { | 2730 | switch (snd_soc_component_read(component, RT5670_RESET) & RT5670_ID_MASK) { |
| @@ -706,8 +706,7 @@ static void rt5677_set_dsp_mode(struct rt5677_priv *rt5677, bool on) · 705 unmodified lines | |||
| 706 | 706 | ||
| 707 | static unsigned int rt5677_set_vad_source(struct rt5677_priv *rt5677) | 707 | static unsigned int rt5677_set_vad_source(struct rt5677_priv *rt5677) |
| 708 | { | 708 | { |
| 709 | struct snd_soc_dapm_context *dapm = | 709 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt5677->component); |
| 710 | snd_soc_component_get_dapm(rt5677->component); | ||
| 711 | /* Force dapm to sync before we enable the | 710 | /* Force dapm to sync before we enable the |
| 712 | * DSP to prevent write corruption | 711 | * DSP to prevent write corruption |
| 713 | */ | 712 | */ |
| @@ -2733,11 +2732,12 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w, · 2019 unmodified lines | |||
| 2733 | struct snd_kcontrol *kcontrol, int event) | 2732 | struct snd_kcontrol *kcontrol, int event) |
| 2734 | { | 2733 | { |
| 2735 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); | 2734 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
| 2735 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2736 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); | 2736 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
| 2737 | 2737 | ||
| 2738 | switch (event) { | 2738 | switch (event) { |
| 2739 | case SND_SOC_DAPM_POST_PMU: | 2739 | case SND_SOC_DAPM_POST_PMU: |
| 2740 | if (snd_soc_component_get_bias_level(component) != SND_SOC_BIAS_ON && | 2740 | if (snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_ON && |
| 2741 | !rt5677->is_vref_slow) { | 2741 | !rt5677->is_vref_slow) { |
| 2742 | mdelay(20); | 2742 | mdelay(20); |
| 2743 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, | 2743 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
| @@ -4643,8 +4643,8 @@ static int rt5677_set_bias_level(struct snd_soc_component *component, · 1899 unmodified lines | |||
| 4643 | enum snd_soc_bias_level level) | 4643 | enum snd_soc_bias_level level) |
| 4644 | { | 4644 | { |
| 4645 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); | 4645 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
| 4646 | enum snd_soc_bias_level prev_bias = | 4646 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 4647 | snd_soc_component_get_bias_level(component); | 4647 | enum snd_soc_bias_level prev_bias = snd_soc_dapm_get_bias_level(dapm); |
| 4648 | 4648 | ||
| 4649 | switch (level) { | 4649 | switch (level) { |
| 4650 | case SND_SOC_BIAS_ON: | 4650 | case SND_SOC_BIAS_ON: |
| @@ -4880,7 +4880,7 @@ static void rt5677_free_gpio(struct i2c_client *i2c) · 229 unmodified lines | |||
| 4880 | 4880 | ||
| 4881 | static int rt5677_probe(struct snd_soc_component *component) | 4881 | static int rt5677_probe(struct snd_soc_component *component) |
| 4882 | { | 4882 | { |
| 4883 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); | 4883 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 4884 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); | 4884 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
| 4885 | int i; | 4885 | int i; |
| 4886 | 4886 | ||
| @@ -4896,7 +4896,7 @@ static int rt5677_probe(struct snd_soc_component *component) · 9 unmodified lines | |||
| 4896 | ARRAY_SIZE(rt5677_dmic2_clk_1)); | 4896 | ARRAY_SIZE(rt5677_dmic2_clk_1)); |
| 4897 | } | 4897 | } |
| 4898 | 4898 | ||
| 4899 | snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF); | 4899 | snd_soc_dapm_force_bias_level(dapm, SND_SOC_BIAS_OFF); |
| 4900 | 4900 | ||
| 4901 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, | 4901 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, |
| 4902 | ~RT5677_IRQ_DEBOUNCE_SEL_MASK, 0x0020); | 4902 | ~RT5677_IRQ_DEBOUNCE_SEL_MASK, 0x0020); |
| @@ -928,7 +928,7 @@ static void rt5682_enable_push_button_irq(struct snd_soc_component *component, · 927 unmodified lines | |||
| 928 | static int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) | 928 | static int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert) |
| 929 | { | 929 | { |
| 930 | struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); | 930 | struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); |
| 931 | struct snd_soc_dapm_context *dapm = &component->dapm; | 931 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 932 | unsigned int val, count; | 932 | unsigned int val, count; |
| 933 | 933 | ||
| 934 | if (jack_insert) { | 934 | if (jack_insert) { |
| @@ -1115,7 +1115,7 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 180 unmodified lines | |||
| 1115 | } | 1115 | } |
| 1116 | } | 1116 | } |
| 1117 | 1117 | ||
| 1118 | dapm = snd_soc_component_get_dapm(rt5682->component); | 1118 | dapm = snd_soc_component_to_dapm(rt5682->component); |
| 1119 | 1119 | ||
| 1120 | snd_soc_dapm_mutex_lock(dapm); | 1120 | snd_soc_dapm_mutex_lock(dapm); |
| 1121 | mutex_lock(&rt5682->calibrate_mutex); | 1121 | mutex_lock(&rt5682->calibrate_mutex); |
| @@ -2595,7 +2595,7 @@ static int rt5682_wclk_prepare(struct clk_hw *hw) · 1473 unmodified lines | |||
| 2595 | return -EINVAL; | 2595 | return -EINVAL; |
| 2596 | 2596 | ||
| 2597 | component = rt5682->component; | 2597 | component = rt5682->component; |
| 2598 | dapm = snd_soc_component_get_dapm(component); | 2598 | dapm = snd_soc_component_to_dapm(component); |
| 2599 | 2599 | ||
| 2600 | snd_soc_dapm_mutex_lock(dapm); | 2600 | snd_soc_dapm_mutex_lock(dapm); |
| 2601 | 2601 | ||
| @@ -2633,7 +2633,7 @@ static void rt5682_wclk_unprepare(struct clk_hw *hw) · 31 unmodified lines | |||
| 2633 | return; | 2633 | return; |
| 2634 | 2634 | ||
| 2635 | component = rt5682->component; | 2635 | component = rt5682->component; |
| 2636 | dapm = snd_soc_component_get_dapm(component); | 2636 | dapm = snd_soc_component_to_dapm(component); |
| 2637 | 2637 | ||
| 2638 | snd_soc_dapm_mutex_lock(dapm); | 2638 | snd_soc_dapm_mutex_lock(dapm); |
| 2639 | 2639 | ||
| @@ -2928,9 +2928,9 @@ EXPORT_SYMBOL_GPL(rt5682_register_dai_clks); · 288 unmodified lines | |||
| 2928 | static int rt5682_probe(struct snd_soc_component *component) | 2928 | static int rt5682_probe(struct snd_soc_component *component) |
| 2929 | { | 2929 | { |
| 2930 | struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); | 2930 | struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); |
| 2931 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2931 | struct sdw_slave *slave; | 2932 | struct sdw_slave *slave; |
| 2932 | unsigned long time; | 2933 | unsigned long time; |
| 2933 | struct snd_soc_dapm_context *dapm = &component->dapm; | ||
| 2934 | 2934 | ||
| 2935 | rt5682->component = component; | 2935 | rt5682->component = component; |
| 2936 | 2936 | ||
| @@ -841,7 +841,7 @@ static void rt5682s_jack_detect_handler(struct work_struct *work) · 840 unmodified lines | |||
| 841 | return; | 841 | return; |
| 842 | } | 842 | } |
| 843 | 843 | ||
| 844 | dapm = snd_soc_component_get_dapm(rt5682s->component); | 844 | dapm = snd_soc_component_to_dapm(rt5682s->component); |
| 845 | 845 | ||
| 846 | snd_soc_dapm_mutex_lock(dapm); | 846 | snd_soc_dapm_mutex_lock(dapm); |
| 847 | mutex_lock(&rt5682s->calibrate_mutex); | 847 | mutex_lock(&rt5682s->calibrate_mutex); |
| @@ -2485,6 +2485,7 @@ static int rt5682s_set_bias_level(struct snd_soc_component *component, · 1637 unmodified lines | |||
| 2485 | enum snd_soc_bias_level level) | 2485 | enum snd_soc_bias_level level) |
| 2486 | { | 2486 | { |
| 2487 | struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component); | 2487 | struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component); |
| 2488 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); | ||
| 2488 | 2489 | ||
| 2489 | switch (level) { | 2490 | switch (level) { |
| 2490 | case SND_SOC_BIAS_PREPARE: | 2491 | case SND_SOC_BIAS_PREPARE: |
| @@ -2492,7 +2493,7 @@ static int rt5682s_set_bias_level(struct snd_soc_component *component, · 1 unmodified line | |||
| 2492 | RT5682S_PWR_LDO, RT5682S_PWR_LDO); | 2493 | RT5682S_PWR_LDO, RT5682S_PWR_LDO); |
| 2493 | break; | 2494 | break; |
| 2494 | case SND_SOC_BIAS_STANDBY: | 2495 | case SND_SOC_BIAS_STANDBY: |
| 2495 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) | 2496 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_OFF) |
| 2496 | regmap_update_bits(rt5682s->regmap, RT5682S_PWR_DIG_1, | 2497 | regmap_update_bits(rt5682s->regmap, RT5682S_PWR_DIG_1, |
| 2497 | RT5682S_DIG_GATE_CTRL, RT5682S_DIG_GATE_CTRL); | 2498 | RT5682S_DIG_GATE_CTRL, RT5682S_DIG_GATE_CTRL); |
| 2498 | break; | 2499 | break; |
| @@ -272,11 +272,10 @@ io_error: · 271 unmodified lines | |||
| 272 | 272 | ||
| 273 | static void rt700_jack_init(struct rt700_priv *rt700) | 273 | static void rt700_jack_init(struct rt700_priv *rt700) |
| 274 | { | 274 | { |
| 275 | struct snd_soc_dapm_context *dapm = | 275 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt700->component); |
| 276 | snd_soc_component_get_dapm(rt700->component); | ||
| 277 | 276 | ||
| 278 | /* power on */ | 277 | /* power on */ |
| 279 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 278 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 280 | regmap_write(rt700->regmap, | 279 | regmap_write(rt700->regmap, |
| 281 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D0); | 280 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D0); |
| 282 | 281 | ||
| @@ -307,7 +306,7 @@ static void rt700_jack_init(struct rt700_priv *rt700) · 24 unmodified lines | |||
| 307 | } | 306 | } |
| 308 | 307 | ||
| 309 | /* power off */ | 308 | /* power off */ |
| 310 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 309 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 311 | regmap_write(rt700->regmap, | 310 | regmap_write(rt700->regmap, |
| 312 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); | 311 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); |
| 313 | } | 312 | } |
| @@ -362,8 +361,7 @@ static int rt700_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 48 unmodified lines | |||
| 362 | struct snd_ctl_elem_value *ucontrol) | 361 | struct snd_ctl_elem_value *ucontrol) |
| 363 | { | 362 | { |
| 364 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 363 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 365 | struct snd_soc_dapm_context *dapm = | 364 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 366 | snd_soc_component_get_dapm(component); | ||
| 367 | struct soc_mixer_control *mc = | 365 | struct soc_mixer_control *mc = |
| 368 | (struct soc_mixer_control *)kcontrol->private_value; | 366 | (struct soc_mixer_control *)kcontrol->private_value; |
| 369 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); | 367 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); |
| @@ -398,7 +396,7 @@ static int rt700_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 28 unmodified lines | |||
| 398 | val_ll |= read_ll; | 396 | val_ll |= read_ll; |
| 399 | } | 397 | } |
| 400 | 398 | ||
| 401 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 399 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 402 | regmap_write(rt700->regmap, | 400 | regmap_write(rt700->regmap, |
| 403 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D0); | 401 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D0); |
| 404 | 402 | ||
| @@ -450,7 +448,7 @@ static int rt700_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 45 unmodified lines | |||
| 450 | break; | 448 | break; |
| 451 | } | 449 | } |
| 452 | 450 | ||
| 453 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 451 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 454 | regmap_write(rt700->regmap, | 452 | regmap_write(rt700->regmap, |
| 455 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); | 453 | RT700_SET_AUDIO_POWER_STATE, AC_PWRST_D3); |
| 456 | return 0; | 454 | return 0; |
| @@ -524,8 +522,7 @@ static const struct snd_kcontrol_new rt700_snd_controls[] = { · 67 unmodified lines | |||
| 524 | static int rt700_mux_get(struct snd_kcontrol *kcontrol, | 522 | static int rt700_mux_get(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) | 523 | struct snd_ctl_elem_value *ucontrol) |
| 526 | { | 524 | { |
| 527 | struct snd_soc_component *component = | 525 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 528 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 529 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); | 526 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); |
| 530 | unsigned int reg, val = 0, nid; | 527 | unsigned int reg, val = 0, nid; |
| 531 | int ret; | 528 | int ret; |
| @@ -553,10 +550,8 @@ static int rt700_mux_get(struct snd_kcontrol *kcontrol, · 21 unmodified lines | |||
| 553 | static int rt700_mux_put(struct snd_kcontrol *kcontrol, | 550 | static int rt700_mux_put(struct snd_kcontrol *kcontrol, |
| 554 | struct snd_ctl_elem_value *ucontrol) | 551 | struct snd_ctl_elem_value *ucontrol) |
| 555 | { | 552 | { |
| 556 | struct snd_soc_component *component = | 553 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 557 | snd_soc_dapm_kcontrol_component(kcontrol); | 554 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 558 | struct snd_soc_dapm_context *dapm = | ||
| 559 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 560 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); | 555 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); |
| 561 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 556 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 562 | unsigned int *item = ucontrol->value.enumerated.item; | 557 | unsigned int *item = ucontrol->value.enumerated.item; |
| @@ -839,13 +834,12 @@ static int rt700_probe(struct snd_soc_component *component) · 276 unmodified lines | |||
| 839 | static int rt700_set_bias_level(struct snd_soc_component *component, | 834 | static int rt700_set_bias_level(struct snd_soc_component *component, |
| 840 | enum snd_soc_bias_level level) | 835 | enum snd_soc_bias_level level) |
| 841 | { | 836 | { |
| 842 | struct snd_soc_dapm_context *dapm = | 837 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 843 | snd_soc_component_get_dapm(component); | ||
| 844 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); | 838 | struct rt700_priv *rt700 = snd_soc_component_get_drvdata(component); |
| 845 | 839 | ||
| 846 | switch (level) { | 840 | switch (level) { |
| 847 | case SND_SOC_BIAS_PREPARE: | 841 | case SND_SOC_BIAS_PREPARE: |
| 848 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { | 842 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) { |
| 849 | regmap_write(rt700->regmap, | 843 | regmap_write(rt700->regmap, |
| 850 | RT700_SET_AUDIO_POWER_STATE, | 844 | RT700_SET_AUDIO_POWER_STATE, |
| 851 | AC_PWRST_D0); | 845 | AC_PWRST_D0); |
| @@ -813,7 +813,7 @@ static int rt711_sdca_ge_select_get(struct snd_kcontrol *kcontrol, · 812 unmodified lines | |||
| 813 | struct snd_ctl_elem_value *ucontrol) | 813 | struct snd_ctl_elem_value *ucontrol) |
| 814 | { | 814 | { |
| 815 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 815 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 816 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 816 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 817 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); | 817 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 818 | unsigned int val, item; | 818 | unsigned int val, item; |
| 819 | 819 | ||
| @@ -828,7 +828,7 @@ static int rt711_sdca_ge_select_put(struct snd_kcontrol *kcontrol, · 8 unmodified lines | |||
| 828 | { | 828 | { |
| 829 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 829 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 830 | unsigned int *item = ucontrol->value.enumerated.item; | 830 | unsigned int *item = ucontrol->value.enumerated.item; |
| 831 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); | 831 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 832 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); | 832 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 833 | unsigned int val, change = 0; | 833 | unsigned int val, change = 0; |
| 834 | 834 | ||
| @@ -900,8 +900,7 @@ static const struct snd_kcontrol_new rt711_sdca_snd_controls[] = { · 65 unmodified lines | |||
| 900 | static int rt711_sdca_mux_get(struct snd_kcontrol *kcontrol, | 900 | static int rt711_sdca_mux_get(struct snd_kcontrol *kcontrol, |
| 901 | struct snd_ctl_elem_value *ucontrol) | 901 | struct snd_ctl_elem_value *ucontrol) |
| 902 | { | 902 | { |
| 903 | struct snd_soc_component *component = | 903 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 904 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 905 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); | 904 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 906 | unsigned int val = 0, mask_sft; | 905 | unsigned int val = 0, mask_sft; |
| 907 | 906 | ||
| @@ -923,10 +922,8 @@ static int rt711_sdca_mux_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 923 | static int rt711_sdca_mux_put(struct snd_kcontrol *kcontrol, | 922 | static int rt711_sdca_mux_put(struct snd_kcontrol *kcontrol, |
| 924 | struct snd_ctl_elem_value *ucontrol) | 923 | struct snd_ctl_elem_value *ucontrol) |
| 925 | { | 924 | { |
| 926 | struct snd_soc_component *component = | 925 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 927 | snd_soc_dapm_kcontrol_component(kcontrol); | 926 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 928 | struct snd_soc_dapm_context *dapm = | ||
| 929 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 930 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); | 927 | struct rt711_sdca_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 931 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 928 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 932 | unsigned int *item = ucontrol->value.enumerated.item; | 929 | unsigned int *item = ucontrol->value.enumerated.item; |
| @@ -360,12 +360,11 @@ io_error: · 359 unmodified lines | |||
| 360 | 360 | ||
| 361 | static void rt711_jack_init(struct rt711_priv *rt711) | 361 | static void rt711_jack_init(struct rt711_priv *rt711) |
| 362 | { | 362 | { |
| 363 | struct snd_soc_dapm_context *dapm = | 363 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(rt711->component); |
| 364 | snd_soc_component_get_dapm(rt711->component); | ||
| 365 | 364 | ||
| 366 | mutex_lock(&rt711->calibrate_mutex); | 365 | mutex_lock(&rt711->calibrate_mutex); |
| 367 | /* power on */ | 366 | /* power on */ |
| 368 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 367 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 369 | regmap_write(rt711->regmap, | 368 | regmap_write(rt711->regmap, |
| 370 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D0); | 369 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D0); |
| 371 | 370 | ||
| @@ -448,7 +447,7 @@ static void rt711_jack_init(struct rt711_priv *rt711) · 76 unmodified lines | |||
| 448 | } | 447 | } |
| 449 | 448 | ||
| 450 | /* power off */ | 449 | /* power off */ |
| 451 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 450 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 452 | regmap_write(rt711->regmap, | 451 | regmap_write(rt711->regmap, |
| 453 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3); | 452 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3); |
| 454 | mutex_unlock(&rt711->calibrate_mutex); | 453 | mutex_unlock(&rt711->calibrate_mutex); |
| @@ -504,8 +503,7 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 49 unmodified lines | |||
| 504 | struct snd_ctl_elem_value *ucontrol) | 503 | struct snd_ctl_elem_value *ucontrol) |
| 505 | { | 504 | { |
| 506 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); | 505 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 507 | struct snd_soc_dapm_context *dapm = | 506 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 508 | snd_soc_component_get_dapm(component); | ||
| 509 | struct soc_mixer_control *mc = | 507 | struct soc_mixer_control *mc = |
| 510 | (struct soc_mixer_control *)kcontrol->private_value; | 508 | (struct soc_mixer_control *)kcontrol->private_value; |
| 511 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); | 509 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); |
| @@ -543,7 +541,7 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 31 unmodified lines | |||
| 543 | val_ll |= read_ll; | 541 | val_ll |= read_ll; |
| 544 | } | 542 | } |
| 545 | 543 | ||
| 546 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 544 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 547 | regmap_write(rt711->regmap, | 545 | regmap_write(rt711->regmap, |
| 548 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D0); | 546 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D0); |
| 549 | 547 | ||
| @@ -597,7 +595,7 @@ static int rt711_set_amp_gain_put(struct snd_kcontrol *kcontrol, · 47 unmodified lines | |||
| 597 | break; | 595 | break; |
| 598 | } | 596 | } |
| 599 | 597 | ||
| 600 | if (dapm->bias_level <= SND_SOC_BIAS_STANDBY) | 598 | if (snd_soc_dapm_get_bias_level(dapm) <= SND_SOC_BIAS_STANDBY) |
| 601 | regmap_write(rt711->regmap, | 599 | regmap_write(rt711->regmap, |
| 602 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3); | 600 | RT711_SET_AUDIO_POWER_STATE, AC_PWRST_D3); |
| 603 | 601 | ||
| @@ -682,8 +680,7 @@ static const struct snd_kcontrol_new rt711_snd_controls[] = { · 78 unmodified lines | |||
| 682 | static int rt711_mux_get(struct snd_kcontrol *kcontrol, | 680 | static int rt711_mux_get(struct snd_kcontrol *kcontrol, |
| 683 | struct snd_ctl_elem_value *ucontrol) | 681 | struct snd_ctl_elem_value *ucontrol) |
| 684 | { | 682 | { |
| 685 | struct snd_soc_component *component = | 683 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 686 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 687 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); | 684 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 688 | unsigned int reg, val = 0, nid; | 685 | unsigned int reg, val = 0, nid; |
| 689 | int ret; | 686 | int ret; |
| @@ -712,10 +709,8 @@ static int rt711_mux_get(struct snd_kcontrol *kcontrol, · 22 unmodified lines | |||
| 712 | static int rt711_mux_put(struct snd_kcontrol *kcontrol, | 709 | static int rt711_mux_put(struct snd_kcontrol *kcontrol, |
| 713 | struct snd_ctl_elem_value *ucontrol) | 710 | struct snd_ctl_elem_value *ucontrol) |
| 714 | { | 711 | { |
| 715 | struct snd_soc_component *component = | 712 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 716 | snd_soc_dapm_kcontrol_component(kcontrol); | 713 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 717 | struct snd_soc_dapm_context *dapm = | ||
| 718 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 719 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); | 714 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 720 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 715 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 721 | unsigned int *item = ucontrol->value.enumerated.item; | 716 | unsigned int *item = ucontrol->value.enumerated.item; |
| @@ -900,13 +895,12 @@ static const struct snd_soc_dapm_route rt711_audio_map[] = { · 178 unmodified lines | |||
| 900 | static int rt711_set_bias_level(struct snd_soc_component *component, | 895 | static int rt711_set_bias_level(struct snd_soc_component *component, |
| 901 | enum snd_soc_bias_level level) | 896 | enum snd_soc_bias_level level) |
| 902 | { | 897 | { |
| 903 | struct snd_soc_dapm_context *dapm = | 898 | struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); |
| 904 | snd_soc_component_get_dapm(component); | ||
| 905 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); | 899 | struct rt711_priv *rt711 = snd_soc_component_get_drvdata(component); |
| 906 | 900 | ||
| 907 | switch (level) { | 901 | switch (level) { |
| 908 | case SND_SOC_BIAS_PREPARE: | 902 | case SND_SOC_BIAS_PREPARE: |
| 909 | if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { | 903 | if (snd_soc_dapm_get_bias_level(dapm) == SND_SOC_BIAS_STANDBY) { |
| 910 | regmap_write(rt711->regmap, | 904 | regmap_write(rt711->regmap, |
| 911 | RT711_SET_AUDIO_POWER_STATE, | 905 | RT711_SET_AUDIO_POWER_STATE, |
| 912 | AC_PWRST_D0); | 906 | AC_PWRST_D0); |
| @@ -429,8 +429,7 @@ static const struct snd_kcontrol_new rt712_sdca_dmic_snd_controls[] = { · 428 unmodified lines | |||
| 429 | static int rt712_sdca_dmic_mux_get(struct snd_kcontrol *kcontrol, | 429 | static int rt712_sdca_dmic_mux_get(struct snd_kcontrol *kcontrol, |
| 430 | struct snd_ctl_elem_value *ucontrol) | 430 | struct snd_ctl_elem_value *ucontrol) |
| 431 | { | 431 | { |
| 432 | struct snd_soc_component *component = | 432 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 433 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 434 | struct rt712_sdca_dmic_priv *rt712 = snd_soc_component_get_drvdata(component); | 433 | struct rt712_sdca_dmic_priv *rt712 = snd_soc_component_get_drvdata(component); |
| 435 | unsigned int val = 0, mask_sft; | 434 | unsigned int val = 0, mask_sft; |
| 436 | 435 | ||
| @@ -452,10 +451,8 @@ static int rt712_sdca_dmic_mux_get(struct snd_kcontrol *kcontrol, · 15 unmodified lines | |||
| 452 | static int rt712_sdca_dmic_mux_put(struct snd_kcontrol *kcontrol, | 451 | static int rt712_sdca_dmic_mux_put(struct snd_kcontrol *kcontrol, |
| 453 | struct snd_ctl_elem_value *ucontrol) | 452 | struct snd_ctl_elem_value *ucontrol) |
| 454 | { | 453 | { |
| 455 | struct snd_soc_component *component = | 454 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 456 | snd_soc_dapm_kcontrol_component(kcontrol); | 455 | struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol); |
| 457 | struct snd_soc_dapm_context *dapm = | ||
| 458 | snd_soc_dapm_kcontrol_dapm(kcontrol); | ||
| 459 | struct rt712_sdca_dmic_priv *rt712 = snd_soc_component_get_drvdata(component); | 456 | struct rt712_sdca_dmic_priv *rt712 = snd_soc_component_get_drvdata(component); |
| 460 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; | 457 | struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| 461 | unsigned int *item = ucontrol->value.enumerated.item; | 458 | unsigned int *item = ucontrol->value.enumerated.item; |
| @@ -743,8 +743,7 @@ static const struct snd_kcontrol_new rt712_sdca_spk_controls[] = { · 742 unmodified lines | |||
| 743 | static int rt712_sdca_mux_get(struct snd_kcontrol *kcontrol, | 743 | static int rt712_sdca_mux_get(struct snd_kcontrol *kcontrol, |
| 744 | struct snd_ctl_elem_value *ucontrol) | 744 | struct snd_ctl_elem_value *ucontrol) |
| 745 | { | 745 | { |
| 746 | struct snd_soc_component *component = | 746 | struct snd_soc_component *component = snd_soc_dapm_kcontrol_to_component(kcontrol); |
| 747 | snd_soc_dapm_kcontrol_component(kcontrol); | ||
| 748 | struct rt712_sdca_priv *rt712 = snd_soc_component_get_drvdata(component); | 747 | struct rt712_sdca_priv *rt712 = snd_soc_component_get_drvdata(component); |
| 749 | unsigned int val = 0, mask = 0x3300; | 748 | unsigned int val = 0, mask = 0x3300; |
| 750 | 749 | ||
| @@ -768,10 +767,8 @@ static int rt712_sdca_mux_get(struct snd_kcontrol *kcontrol, · 17 unmodified lines | |||
| 768 | static int rt712_sdca_mux_put(struct snd_kcontrol *kcontrol, | 767 | static int rt712_sdca_mux_put(struct snd_kcontrol *kcontrol, |
43 more lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 242 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 436 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 191 lines aren’t shown here.
This diff is large: its 118 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 211 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 226 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 66 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 161 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 751 lines aren’t shown here.
This diff is large: its 77 lines aren’t shown here.
This diff is large: its 241 lines aren’t shown here.
This diff is large: its 2616 lines aren’t shown here.
This diff is large: its 1229 lines aren’t shown here.
This diff is large: its 1464 lines aren’t shown here.
This diff is large: its 333 lines aren’t shown here.
This diff is large: its 673 lines aren’t shown here.
This diff is large: its 98 lines aren’t shown here.
This diff is large: its 1179 lines aren’t shown here.
This diff is large: its 10774 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 453 lines aren’t shown here.
This diff is large: its 256 lines aren’t shown here.
This diff is large: its 163 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 267 lines aren’t shown here.
This diff is large: its 531 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 117 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 186 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 148 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 152 lines aren’t shown here.
This diff is large: its 305 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 461 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 505 lines aren’t shown here.
This diff is large: its 118 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 524 lines aren’t shown here.
This diff is large: its 95 lines aren’t shown here.
This diff is large: its 484 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 263 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 81 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 484 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 827 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 68 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 255 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 83 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 462 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 167 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.