forked from Minki/linux
Merge remote-tracking branches 'asoc/topic/nau8824', 'asoc/topic/omap', 'asoc/topic/pxa' and 'asoc/topic/qcom' into asoc-next
This commit is contained in:
commit
757fc30a1a
88
Documentation/devicetree/bindings/sound/nau8824.txt
Normal file
88
Documentation/devicetree/bindings/sound/nau8824.txt
Normal file
@ -0,0 +1,88 @@
|
||||
Nuvoton NAU8824 audio codec
|
||||
|
||||
This device supports I2C only.
|
||||
|
||||
Required properties:
|
||||
- compatible : Must be "nuvoton,nau8824"
|
||||
|
||||
- reg : the I2C address of the device. This is either 0x1a (CSB=0) or 0x1b (CSB=1).
|
||||
|
||||
Optional properties:
|
||||
- nuvoton,jkdet-polarity: JKDET pin polarity. 0 - active high, 1 - active low.
|
||||
|
||||
- nuvoton,vref-impedance: VREF Impedance selection
|
||||
0 - Open
|
||||
1 - 25 kOhm
|
||||
2 - 125 kOhm
|
||||
3 - 2.5 kOhm
|
||||
|
||||
- nuvoton,micbias-voltage: Micbias voltage level.
|
||||
0 - VDDA
|
||||
1 - VDDA
|
||||
2 - VDDA * 1.1
|
||||
3 - VDDA * 1.2
|
||||
4 - VDDA * 1.3
|
||||
5 - VDDA * 1.4
|
||||
6 - VDDA * 1.53
|
||||
7 - VDDA * 1.53
|
||||
|
||||
- nuvoton,sar-threshold-num: Number of buttons supported
|
||||
- nuvoton,sar-threshold: Impedance threshold for each button. Array that contains up to 8 buttons configuration. SAR value is calculated as
|
||||
SAR = 255 * MICBIAS / SAR_VOLTAGE * R / (2000 + R)
|
||||
where MICBIAS is configured by 'nuvoton,micbias-voltage', SAR_VOLTAGE is configured by 'nuvoton,sar-voltage', R - button impedance.
|
||||
Refer datasheet section 10.2 for more information about threshold calculation.
|
||||
|
||||
- nuvoton,sar-hysteresis: Button impedance measurement hysteresis.
|
||||
|
||||
- nuvoton,sar-voltage: Reference voltage for button impedance measurement.
|
||||
0 - VDDA
|
||||
1 - VDDA
|
||||
2 - VDDA * 1.1
|
||||
3 - VDDA * 1.2
|
||||
4 - VDDA * 1.3
|
||||
5 - VDDA * 1.4
|
||||
6 - VDDA * 1.53
|
||||
7 - VDDA * 1.53
|
||||
|
||||
- nuvoton,sar-compare-time: SAR compare time
|
||||
0 - 500 ns
|
||||
1 - 1 us
|
||||
2 - 2 us
|
||||
3 - 4 us
|
||||
|
||||
- nuvoton,sar-sampling-time: SAR sampling time
|
||||
0 - 2 us
|
||||
1 - 4 us
|
||||
2 - 8 us
|
||||
3 - 16 us
|
||||
|
||||
- nuvoton,short-key-debounce: Button short key press debounce time.
|
||||
0 - 30 ms
|
||||
1 - 50 ms
|
||||
2 - 100 ms
|
||||
|
||||
- nuvoton,jack-eject-debounce: Jack ejection debounce time.
|
||||
0 - 0 ms
|
||||
1 - 1 ms
|
||||
2 - 10 ms
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
headset: nau8824@1a {
|
||||
compatible = "nuvoton,nau8824";
|
||||
reg = <0x1a>;
|
||||
interrupt-parent = <&gpio>;
|
||||
interrupts = <TEGRA_GPIO(E, 6) IRQ_TYPE_LEVEL_LOW>;
|
||||
nuvoton,vref-impedance = <2>;
|
||||
nuvoton,micbias-voltage = <6>;
|
||||
// Setup 4 buttons impedance according to Android specification
|
||||
nuvoton,sar-threshold-num = <4>;
|
||||
nuvoton,sar-threshold = <0xc 0x1e 0x38 0x60>;
|
||||
nuvoton,sar-hysteresis = <0>;
|
||||
nuvoton,sar-voltage = <6>;
|
||||
nuvoton,sar-compare-time = <1>;
|
||||
nuvoton,sar-sampling-time = <1>;
|
||||
nuvoton,short-key-debounce = <0>;
|
||||
nuvoton,jack-eject-debounce = <1>;
|
||||
};
|
@ -101,6 +101,7 @@ config SND_SOC_ALL_CODECS
|
||||
select SND_SOC_ML26124 if I2C
|
||||
select SND_SOC_NAU8540 if I2C
|
||||
select SND_SOC_NAU8810 if I2C
|
||||
select SND_SOC_NAU8824 if I2C
|
||||
select SND_SOC_NAU8825 if I2C
|
||||
select SND_SOC_HDMI_CODEC
|
||||
select SND_SOC_PCM1681 if I2C
|
||||
@ -1137,6 +1138,10 @@ config SND_SOC_NAU8810
|
||||
tristate "Nuvoton Technology Corporation NAU88C10 CODEC"
|
||||
depends on I2C
|
||||
|
||||
config SND_SOC_NAU8824
|
||||
tristate "Nuvoton Technology Corporation NAU88L24 CODEC"
|
||||
depends on I2C
|
||||
|
||||
config SND_SOC_NAU8825
|
||||
tristate
|
||||
|
||||
|
@ -95,6 +95,7 @@ snd-soc-msm8916-analog-objs := msm8916-wcd-analog.o
|
||||
snd-soc-msm8916-digital-objs := msm8916-wcd-digital.o
|
||||
snd-soc-nau8540-objs := nau8540.o
|
||||
snd-soc-nau8810-objs := nau8810.o
|
||||
snd-soc-nau8824-objs := nau8824.o
|
||||
snd-soc-nau8825-objs := nau8825.o
|
||||
snd-soc-hdmi-codec-objs := hdmi-codec.o
|
||||
snd-soc-pcm1681-objs := pcm1681.o
|
||||
@ -328,6 +329,7 @@ obj-$(CONFIG_SND_SOC_MSM8916_WCD_ANALOG) +=snd-soc-msm8916-analog.o
|
||||
obj-$(CONFIG_SND_SOC_MSM8916_WCD_DIGITAL) +=snd-soc-msm8916-digital.o
|
||||
obj-$(CONFIG_SND_SOC_NAU8540) += snd-soc-nau8540.o
|
||||
obj-$(CONFIG_SND_SOC_NAU8810) += snd-soc-nau8810.o
|
||||
obj-$(CONFIG_SND_SOC_NAU8824) += snd-soc-nau8824.o
|
||||
obj-$(CONFIG_SND_SOC_NAU8825) += snd-soc-nau8825.o
|
||||
obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
|
||||
obj-$(CONFIG_SND_SOC_PCM1681) += snd-soc-pcm1681.o
|
||||
|
1831
sound/soc/codecs/nau8824.c
Normal file
1831
sound/soc/codecs/nau8824.c
Normal file
File diff suppressed because it is too large
Load Diff
466
sound/soc/codecs/nau8824.h
Normal file
466
sound/soc/codecs/nau8824.h
Normal file
@ -0,0 +1,466 @@
|
||||
/*
|
||||
* NAU88L24 ALSA SoC audio driver
|
||||
*
|
||||
* Copyright 2016 Nuvoton Technology Corp.
|
||||
* Author: John Hsu <KCHSU0@nuvoton.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#ifndef __NAU8824_H__
|
||||
#define __NAU8824_H__
|
||||
|
||||
#define NAU8824_REG_RESET 0x00
|
||||
#define NAU8824_REG_ENA_CTRL 0x01
|
||||
#define NAU8824_REG_CLK_GATING_ENA 0x02
|
||||
#define NAU8824_REG_CLK_DIVIDER 0x03
|
||||
#define NAU8824_REG_FLL1 0x04
|
||||
#define NAU8824_REG_FLL2 0x05
|
||||
#define NAU8824_REG_FLL3 0x06
|
||||
#define NAU8824_REG_FLL4 0x07
|
||||
#define NAU8824_REG_FLL5 0x08
|
||||
#define NAU8824_REG_FLL6 0x09
|
||||
#define NAU8824_REG_FLL_VCO_RSV 0x0A
|
||||
#define NAU8824_REG_JACK_DET_CTRL 0x0D
|
||||
#define NAU8824_REG_INTERRUPT_SETTING_1 0x0F
|
||||
#define NAU8824_REG_IRQ 0x10
|
||||
#define NAU8824_REG_CLEAR_INT_REG 0x11
|
||||
#define NAU8824_REG_INTERRUPT_SETTING 0x12
|
||||
#define NAU8824_REG_SAR_ADC 0x13
|
||||
#define NAU8824_REG_VDET_COEFFICIENT 0x14
|
||||
#define NAU8824_REG_VDET_THRESHOLD_1 0x15
|
||||
#define NAU8824_REG_VDET_THRESHOLD_2 0x16
|
||||
#define NAU8824_REG_VDET_THRESHOLD_3 0x17
|
||||
#define NAU8824_REG_VDET_THRESHOLD_4 0x18
|
||||
#define NAU8824_REG_GPIO_SEL 0x1A
|
||||
#define NAU8824_REG_PORT0_I2S_PCM_CTRL_1 0x1C
|
||||
#define NAU8824_REG_PORT0_I2S_PCM_CTRL_2 0x1D
|
||||
#define NAU8824_REG_PORT0_LEFT_TIME_SLOT 0x1E
|
||||
#define NAU8824_REG_PORT0_RIGHT_TIME_SLOT 0x1F
|
||||
#define NAU8824_REG_TDM_CTRL 0x20
|
||||
#define NAU8824_REG_ADC_HPF_FILTER 0x23
|
||||
#define NAU8824_REG_ADC_FILTER_CTRL 0x24
|
||||
#define NAU8824_REG_DAC_FILTER_CTRL_1 0x25
|
||||
#define NAU8824_REG_DAC_FILTER_CTRL_2 0x26
|
||||
#define NAU8824_REG_NOTCH_FILTER_1 0x27
|
||||
#define NAU8824_REG_NOTCH_FILTER_2 0x28
|
||||
#define NAU8824_REG_EQ1_LOW 0x29
|
||||
#define NAU8824_REG_EQ2_EQ3 0x2A
|
||||
#define NAU8824_REG_EQ4_EQ5 0x2B
|
||||
#define NAU8824_REG_ADC_CH0_DGAIN_CTRL 0x2D
|
||||
#define NAU8824_REG_ADC_CH1_DGAIN_CTRL 0x2E
|
||||
#define NAU8824_REG_ADC_CH2_DGAIN_CTRL 0x2F
|
||||
#define NAU8824_REG_ADC_CH3_DGAIN_CTRL 0x30
|
||||
#define NAU8824_REG_DAC_MUTE_CTRL 0x31
|
||||
#define NAU8824_REG_DAC_CH0_DGAIN_CTRL 0x32
|
||||
#define NAU8824_REG_DAC_CH1_DGAIN_CTRL 0x33
|
||||
#define NAU8824_REG_ADC_TO_DAC_ST 0x34
|
||||
#define NAU8824_REG_DRC_KNEE_IP12_ADC_CH01 0x38
|
||||
#define NAU8824_REG_DRC_KNEE_IP34_ADC_CH01 0x39
|
||||
#define NAU8824_REG_DRC_SLOPE_ADC_CH01 0x3A
|
||||
#define NAU8824_REG_DRC_ATKDCY_ADC_CH01 0x3B
|
||||
#define NAU8824_REG_DRC_KNEE_IP12_ADC_CH23 0x3C
|
||||
#define NAU8824_REG_DRC_KNEE_IP34_ADC_CH23 0x3D
|
||||
#define NAU8824_REG_DRC_SLOPE_ADC_CH23 0x3E
|
||||
#define NAU8824_REG_DRC_ATKDCY_ADC_CH23 0x3F
|
||||
#define NAU8824_REG_DRC_GAINL_ADC0 0x40
|
||||
#define NAU8824_REG_DRC_GAINL_ADC1 0x41
|
||||
#define NAU8824_REG_DRC_GAINL_ADC2 0x42
|
||||
#define NAU8824_REG_DRC_GAINL_ADC3 0x43
|
||||
#define NAU8824_REG_DRC_KNEE_IP12_DAC 0x45
|
||||
#define NAU8824_REG_DRC_KNEE_IP34_DAC 0x46
|
||||
#define NAU8824_REG_DRC_SLOPE_DAC 0x47
|
||||
#define NAU8824_REG_DRC_ATKDCY_DAC 0x48
|
||||
#define NAU8824_REG_DRC_GAIN_DAC_CH0 0x49
|
||||
#define NAU8824_REG_DRC_GAIN_DAC_CH1 0x4A
|
||||
#define NAU8824_REG_MODE 0x4C
|
||||
#define NAU8824_REG_MODE1 0x4D
|
||||
#define NAU8824_REG_MODE2 0x4E
|
||||
#define NAU8824_REG_CLASSG 0x50
|
||||
#define NAU8824_REG_OTP_EFUSE 0x51
|
||||
#define NAU8824_REG_OTPDOUT_1 0x53
|
||||
#define NAU8824_REG_OTPDOUT_2 0x54
|
||||
#define NAU8824_REG_MISC_CTRL 0x55
|
||||
#define NAU8824_REG_I2C_TIMEOUT 0x56
|
||||
#define NAU8824_REG_TEST_MODE 0x57
|
||||
#define NAU8824_REG_I2C_DEVICE_ID 0x58
|
||||
#define NAU8824_REG_SAR_ADC_DATA_OUT 0x59
|
||||
#define NAU8824_REG_BIAS_ADJ 0x66
|
||||
#define NAU8824_REG_PGA_GAIN 0x67
|
||||
#define NAU8824_REG_TRIM_SETTINGS 0x68
|
||||
#define NAU8824_REG_ANALOG_CONTROL_1 0x69
|
||||
#define NAU8824_REG_ANALOG_CONTROL_2 0x6A
|
||||
#define NAU8824_REG_ENABLE_LO 0x6B
|
||||
#define NAU8824_REG_GAIN_LO 0x6C
|
||||
#define NAU8824_REG_CLASSD_GAIN_1 0x6D
|
||||
#define NAU8824_REG_CLASSD_GAIN_2 0x6E
|
||||
#define NAU8824_REG_ANALOG_ADC_1 0x71
|
||||
#define NAU8824_REG_ANALOG_ADC_2 0x72
|
||||
#define NAU8824_REG_RDAC 0x73
|
||||
#define NAU8824_REG_MIC_BIAS 0x74
|
||||
#define NAU8824_REG_HS_VOLUME_CONTROL 0x75
|
||||
#define NAU8824_REG_BOOST 0x76
|
||||
#define NAU8824_REG_FEPGA 0x77
|
||||
#define NAU8824_REG_FEPGA_II 0x78
|
||||
#define NAU8824_REG_FEPGA_SE 0x79
|
||||
#define NAU8824_REG_FEPGA_ATTENUATION 0x7A
|
||||
#define NAU8824_REG_ATT_PORT0 0x7B
|
||||
#define NAU8824_REG_ATT_PORT1 0x7C
|
||||
#define NAU8824_REG_POWER_UP_CONTROL 0x7F
|
||||
#define NAU8824_REG_CHARGE_PUMP_CONTROL 0x80
|
||||
#define NAU8824_REG_CHARGE_PUMP_INPUT 0x81
|
||||
#define NAU8824_REG_MAX NAU8824_REG_CHARGE_PUMP_INPUT
|
||||
/* 16-bit control register address, and 16-bits control register data */
|
||||
#define NAU8824_REG_ADDR_LEN 16
|
||||
#define NAU8824_REG_DATA_LEN 16
|
||||
|
||||
|
||||
/* ENA_CTRL (0x1) */
|
||||
#define NAU8824_DMIC_LCH_EDGE_CH23 (0x1 << 12)
|
||||
#define NAU8824_DMIC_LCH_EDGE_CH01 (0x1 << 11)
|
||||
#define NAU8824_JD_SLEEP_MODE (0x1 << 10)
|
||||
#define NAU8824_ADC_CH3_DMIC_SFT 9
|
||||
#define NAU8824_ADC_CH3_DMIC_EN (0x1 << NAU8824_ADC_CH3_DMIC_SFT)
|
||||
#define NAU8824_ADC_CH2_DMIC_SFT 8
|
||||
#define NAU8824_ADC_CH2_DMIC_EN (0x1 << NAU8824_ADC_CH2_DMIC_SFT)
|
||||
#define NAU8824_ADC_CH1_DMIC_SFT 7
|
||||
#define NAU8824_ADC_CH1_DMIC_EN (0x1 << NAU8824_ADC_CH1_DMIC_SFT)
|
||||
#define NAU8824_ADC_CH0_DMIC_SFT 6
|
||||
#define NAU8824_ADC_CH0_DMIC_EN (0x1 << NAU8824_ADC_CH0_DMIC_SFT)
|
||||
#define NAU8824_DAC_CH1_EN (0x1 << 5)
|
||||
#define NAU8824_DAC_CH0_EN (0x1 << 4)
|
||||
#define NAU8824_ADC_CH3_EN (0x1 << 3)
|
||||
#define NAU8824_ADC_CH2_EN (0x1 << 2)
|
||||
#define NAU8824_ADC_CH1_EN (0x1 << 1)
|
||||
#define NAU8824_ADC_CH0_EN 0x1
|
||||
|
||||
/* CLK_GATING_ENA (0x02) */
|
||||
#define NAU8824_CLK_ADC_CH23_EN (0x1 << 15)
|
||||
#define NAU8824_CLK_ADC_CH01_EN (0x1 << 14)
|
||||
#define NAU8824_CLK_DAC_CH1_EN (0x1 << 13)
|
||||
#define NAU8824_CLK_DAC_CH0_EN (0x1 << 12)
|
||||
#define NAU8824_CLK_I2S_EN (0x1 << 7)
|
||||
#define NAU8824_CLK_GAIN_EN (0x1 << 5)
|
||||
#define NAU8824_CLK_SAR_EN (0x1 << 3)
|
||||
#define NAU8824_CLK_DMIC_CH23_EN (0x1 << 1)
|
||||
|
||||
/* CLK_DIVIDER (0x3) */
|
||||
#define NAU8824_CLK_SRC_SFT 15
|
||||
#define NAU8824_CLK_SRC_MASK (1 << NAU8824_CLK_SRC_SFT)
|
||||
#define NAU8824_CLK_SRC_VCO (1 << NAU8824_CLK_SRC_SFT)
|
||||
#define NAU8824_CLK_SRC_MCLK (0 << NAU8824_CLK_SRC_SFT)
|
||||
#define NAU8824_CLK_MCLK_SRC_MASK (0xf << 0)
|
||||
#define NAU8824_CLK_DMIC_SRC_SFT 10
|
||||
#define NAU8824_CLK_DMIC_SRC_MASK (0x7 << NAU8824_CLK_DMIC_SRC_SFT)
|
||||
#define NAU8824_CLK_ADC_SRC_SFT 6
|
||||
#define NAU8824_CLK_ADC_SRC_MASK (0x3 << NAU8824_CLK_ADC_SRC_SFT)
|
||||
#define NAU8824_CLK_DAC_SRC_SFT 4
|
||||
#define NAU8824_CLK_DAC_SRC_MASK (0x3 << NAU8824_CLK_DAC_SRC_SFT)
|
||||
|
||||
/* FLL1 (0x04) */
|
||||
#define NAU8824_FLL_RATIO_MASK (0x7f << 0)
|
||||
|
||||
/* FLL3 (0x06) */
|
||||
#define NAU8824_FLL_INTEGER_MASK (0x3ff << 0)
|
||||
#define NAU8824_FLL_CLK_SRC_SFT 10
|
||||
#define NAU8824_FLL_CLK_SRC_MASK (0x3 << NAU8824_FLL_CLK_SRC_SFT)
|
||||
#define NAU8824_FLL_CLK_SRC_MCLK (0 << NAU8824_FLL_CLK_SRC_SFT)
|
||||
#define NAU8824_FLL_CLK_SRC_BLK (0x2 << NAU8824_FLL_CLK_SRC_SFT)
|
||||
#define NAU8824_FLL_CLK_SRC_FS (0x3 << NAU8824_FLL_CLK_SRC_SFT)
|
||||
|
||||
/* FLL4 (0x07) */
|
||||
#define NAU8824_FLL_REF_DIV_SFT 10
|
||||
#define NAU8824_FLL_REF_DIV_MASK (0x3 << NAU8824_FLL_REF_DIV_SFT)
|
||||
|
||||
/* FLL5 (0x08) */
|
||||
#define NAU8824_FLL_PDB_DAC_EN (0x1 << 15)
|
||||
#define NAU8824_FLL_LOOP_FTR_EN (0x1 << 14)
|
||||
#define NAU8824_FLL_CLK_SW_MASK (0x1 << 13)
|
||||
#define NAU8824_FLL_CLK_SW_N2 (0x1 << 13)
|
||||
#define NAU8824_FLL_CLK_SW_REF (0x0 << 13)
|
||||
#define NAU8824_FLL_FTR_SW_MASK (0x1 << 12)
|
||||
#define NAU8824_FLL_FTR_SW_ACCU (0x1 << 12)
|
||||
#define NAU8824_FLL_FTR_SW_FILTER (0x0 << 12)
|
||||
|
||||
/* FLL6 (0x9) */
|
||||
#define NAU8824_DCO_EN (0x1 << 15)
|
||||
#define NAU8824_SDM_EN (0x1 << 14)
|
||||
|
||||
/* IRQ (0x10) */
|
||||
#define NAU8824_SHORT_CIRCUIT_IRQ (0x1 << 7)
|
||||
#define NAU8824_IMPEDANCE_MEAS_IRQ (0x1 << 6)
|
||||
#define NAU8824_KEY_RELEASE_IRQ (0x1 << 5)
|
||||
#define NAU8824_KEY_LONG_PRESS_IRQ (0x1 << 4)
|
||||
#define NAU8824_KEY_SHORT_PRESS_IRQ (0x1 << 3)
|
||||
#define NAU8824_JACK_EJECTION_DETECTED (0x1 << 1)
|
||||
#define NAU8824_JACK_INSERTION_DETECTED 0x1
|
||||
|
||||
/* JACK_DET_CTRL (0x0D) */
|
||||
#define NAU8824_JACK_EJECT_DT_SFT 2
|
||||
#define NAU8824_JACK_EJECT_DT_MASK (0x3 << NAU8824_JACK_EJECT_DT_SFT)
|
||||
#define NAU8824_JACK_LOGIC 0x1
|
||||
|
||||
|
||||
/* INTERRUPT_SETTING_1 (0x0F) */
|
||||
#define NAU8824_IRQ_EJECT_EN (0x1 << 9)
|
||||
#define NAU8824_IRQ_INSERT_EN (0x1 << 8)
|
||||
|
||||
/* INTERRUPT_SETTING (0x12) */
|
||||
#define NAU8824_IRQ_KEY_RELEASE_DIS (0x1 << 5)
|
||||
#define NAU8824_IRQ_KEY_SHORT_PRESS_DIS (0x1 << 3)
|
||||
#define NAU8824_IRQ_EJECT_DIS (0x1 << 1)
|
||||
#define NAU8824_IRQ_INSERT_DIS 0x1
|
||||
|
||||
/* SAR_ADC (0x13) */
|
||||
#define NAU8824_SAR_ADC_EN_SFT 12
|
||||
#define NAU8824_SAR_TRACKING_GAIN_SFT 8
|
||||
#define NAU8824_SAR_TRACKING_GAIN_MASK (0x7 << NAU8824_SAR_TRACKING_GAIN_SFT)
|
||||
#define NAU8824_SAR_COMPARE_TIME_SFT 2
|
||||
#define NAU8824_SAR_COMPARE_TIME_MASK (3 << 2)
|
||||
#define NAU8824_SAR_SAMPLING_TIME_SFT 0
|
||||
#define NAU8824_SAR_SAMPLING_TIME_MASK (3 << 0)
|
||||
|
||||
/* VDET_COEFFICIENT (0x14) */
|
||||
#define NAU8824_SHORTKEY_DEBOUNCE_SFT 12
|
||||
#define NAU8824_SHORTKEY_DEBOUNCE_MASK (0x3 << NAU8824_SHORTKEY_DEBOUNCE_SFT)
|
||||
#define NAU8824_LEVELS_NR_SFT 8
|
||||
#define NAU8824_LEVELS_NR_MASK (0x7 << 8)
|
||||
#define NAU8824_HYSTERESIS_SFT 0
|
||||
#define NAU8824_HYSTERESIS_MASK 0xf
|
||||
|
||||
/* PORT0_I2S_PCM_CTRL_1 (0x1C) */
|
||||
#define NAU8824_I2S_BP_SFT 7
|
||||
#define NAU8824_I2S_BP_MASK (1 << NAU8824_I2S_BP_SFT)
|
||||
#define NAU8824_I2S_BP_INV (1 << NAU8824_I2S_BP_SFT)
|
||||
#define NAU8824_I2S_PCMB_SFT 6
|
||||
#define NAU8824_I2S_PCMB_EN (1 << NAU8824_I2S_PCMB_SFT)
|
||||
#define NAU8824_I2S_DL_SFT 2
|
||||
#define NAU8824_I2S_DL_MASK (0x3 << NAU8824_I2S_DL_SFT)
|
||||
#define NAU8824_I2S_DL_16 (0 << NAU8824_I2S_DL_SFT)
|
||||
#define NAU8824_I2S_DL_20 (1 << NAU8824_I2S_DL_SFT)
|
||||
#define NAU8824_I2S_DL_24 (2 << NAU8824_I2S_DL_SFT)
|
||||
#define NAU8824_I2S_DL_32 (3 << NAU8824_I2S_DL_SFT)
|
||||
#define NAU8824_I2S_DF_MASK 0x3
|
||||
#define NAU8824_I2S_DF_RIGTH 0
|
||||
#define NAU8824_I2S_DF_LEFT 1
|
||||
#define NAU8824_I2S_DF_I2S 2
|
||||
#define NAU8824_I2S_DF_PCM_AB 3
|
||||
|
||||
|
||||
/* PORT0_I2S_PCM_CTRL_2 (0x1D) */
|
||||
#define NAU8824_I2S_LRC_DIV_SFT 12
|
||||
#define NAU8824_I2S_LRC_DIV_MASK (0x3 << NAU8824_I2S_LRC_DIV_SFT)
|
||||
#define NAU8824_I2S_MS_SFT 3
|
||||
#define NAU8824_I2S_MS_MASK (1 << NAU8824_I2S_MS_SFT)
|
||||
#define NAU8824_I2S_MS_MASTER (1 << NAU8824_I2S_MS_SFT)
|
||||
#define NAU8824_I2S_MS_SLAVE (0 << NAU8824_I2S_MS_SFT)
|
||||
#define NAU8824_I2S_BLK_DIV_MASK 0x7
|
||||
|
||||
/* ADC_FILTER_CTRL (0x24) */
|
||||
#define NAU8824_ADC_SYNC_DOWN_MASK 0x3
|
||||
#define NAU8824_ADC_SYNC_DOWN_32 0
|
||||
#define NAU8824_ADC_SYNC_DOWN_64 1
|
||||
#define NAU8824_ADC_SYNC_DOWN_128 2
|
||||
#define NAU8824_ADC_SYNC_DOWN_256 3
|
||||
|
||||
/* DAC_FILTER_CTRL_1 (0x25) */
|
||||
#define NAU8824_DAC_CICCLP_OFF (0x1 << 7)
|
||||
#define NAU8824_DAC_OVERSAMPLE_MASK 0x7
|
||||
#define NAU8824_DAC_OVERSAMPLE_64 0
|
||||
#define NAU8824_DAC_OVERSAMPLE_256 1
|
||||
#define NAU8824_DAC_OVERSAMPLE_128 2
|
||||
#define NAU8824_DAC_OVERSAMPLE_32 4
|
||||
|
||||
/* DAC_MUTE_CTRL (0x31) */
|
||||
#define NAU8824_DAC_CH01_MIX 0x3
|
||||
#define NAU8824_DAC_ZC_EN (0x1 << 11)
|
||||
|
||||
/* DAC_CH0_DGAIN_CTRL (0x32) */
|
||||
#define NAU8824_DAC_CH0_SEL_SFT 9
|
||||
#define NAU8824_DAC_CH0_SEL_MASK (0x1 << NAU8824_DAC_CH0_SEL_SFT)
|
||||
#define NAU8824_DAC_CH0_SEL_I2S0 (0x0 << NAU8824_DAC_CH0_SEL_SFT)
|
||||
#define NAU8824_DAC_CH0_SEL_I2S1 (0x1 << NAU8824_DAC_CH0_SEL_SFT)
|
||||
#define NAU8824_DAC_CH0_VOL_MASK 0x1ff
|
||||
|
||||
/* DAC_CH1_DGAIN_CTRL (0x33) */
|
||||
#define NAU8824_DAC_CH1_SEL_SFT 9
|
||||
#define NAU8824_DAC_CH1_SEL_MASK (0x1 << NAU8824_DAC_CH1_SEL_SFT)
|
||||
#define NAU8824_DAC_CH1_SEL_I2S0 (0x0 << NAU8824_DAC_CH1_SEL_SFT)
|
||||
#define NAU8824_DAC_CH1_SEL_I2S1 (0x1 << NAU8824_DAC_CH1_SEL_SFT)
|
||||
#define NAU8824_DAC_CH1_VOL_MASK 0x1ff
|
||||
|
||||
/* CLASSG (0x50) */
|
||||
#define NAU8824_CLASSG_TIMER_SFT 8
|
||||
#define NAU8824_CLASSG_TIMER_MASK (0x3f << NAU8824_CLASSG_TIMER_SFT)
|
||||
#define NAU8824_CLASSG_LDAC_EN_SFT 2
|
||||
#define NAU8824_CLASSG_RDAC_EN_SFT 1
|
||||
#define NAU8824_CLASSG_EN_SFT 0
|
||||
|
||||
/* SAR_ADC_DATA_OUT (0x59) */
|
||||
#define NAU8824_SAR_ADC_DATA_MASK 0xff
|
||||
|
||||
/* BIAS_ADJ (0x66) */
|
||||
#define NAU8824_VMID (1 << 6)
|
||||
#define NAU8824_VMID_SEL_SFT 4
|
||||
#define NAU8824_VMID_SEL_MASK (3 << NAU8824_VMID_SEL_SFT)
|
||||
#define NAU8824_DMIC2_EN_SFT 3
|
||||
#define NAU8824_DMIC1_EN_SFT 2
|
||||
|
||||
/* TRIM_SETTINGS (0x68) */
|
||||
#define NAU8824_DRV_CURR_INC (1 << 15)
|
||||
|
||||
/* ANALOG_CONTROL_1 (0x69) */
|
||||
#define NAU8824_DMIC_CLK_DRV_STRG (1 << 3)
|
||||
#define NAU8824_DMIC_CLK_SLEW_FAST (0x7)
|
||||
|
||||
/* ANALOG_CONTROL_2 (0x6A) */
|
||||
#define NAU8824_CLASSD_CLAMP_DIS_SFT 3
|
||||
#define NAU8824_CLASSD_CLAMP_DIS (0x1 << NAU8824_CLASSD_CLAMP_DIS_SFT)
|
||||
|
||||
/* ENABLE_LO (0x6B) */
|
||||
#define NAU8824_TEST_DAC_SFT 14
|
||||
#define NAU8824_TEST_DAC_EN (0x3 << NAU8824_TEST_DAC_SFT)
|
||||
#define NAU8824_DACL_HPR_EN_SFT 3
|
||||
#define NAU8824_DACL_HPR_EN (0x1 << NAU8824_DACL_HPR_EN_SFT)
|
||||
#define NAU8824_DACR_HPR_EN_SFT 2
|
||||
#define NAU8824_DACR_HPR_EN (0x1 << NAU8824_DACR_HPR_EN_SFT)
|
||||
#define NAU8824_DACR_HPL_EN_SFT 1
|
||||
#define NAU8824_DACR_HPL_EN (0x1 << NAU8824_DACR_HPL_EN_SFT)
|
||||
#define NAU8824_DACL_HPL_EN_SFT 0
|
||||
#define NAU8824_DACL_HPL_EN 0x1
|
||||
|
||||
/* CLASSD_GAIN_1 (0x6D) */
|
||||
#define NAU8824_CLASSD_GAIN_1R_SFT 8
|
||||
#define NAU8824_CLASSD_GAIN_1R_MASK (0x1f << NAU8824_CLASSD_GAIN_1R_SFT)
|
||||
#define NAU8824_CLASSD_EN_SFT 7
|
||||
#define NAU8824_CLASSD_EN (0x1 << NAU8824_CLASSD_EN_SFT)
|
||||
#define NAU8824_CLASSD_GAIN_1L_MASK 0x1f
|
||||
|
||||
/* CLASSD_GAIN_2 (0x6E) */
|
||||
#define NAU8824_CLASSD_GAIN_2R_SFT 8
|
||||
#define NAU8824_CLASSD_GAIN_2R_MASK (0x1f << NAU8824_CLASSD_GAIN_1R_SFT)
|
||||
#define NAU8824_CLASSD_EN_SFT 7
|
||||
#define NAU8824_CLASSD_EN (0x1 << NAU8824_CLASSD_EN_SFT)
|
||||
#define NAU8824_CLASSD_GAIN_2L_MASK 0x1f
|
||||
|
||||
/* ANALOG_ADC_2 (0x72) */
|
||||
#define NAU8824_ADCR_EN_SFT 7
|
||||
#define NAU8824_ADCL_EN_SFT 6
|
||||
|
||||
/* RDAC (0x73) */
|
||||
#define NAU8824_DACR_EN_SFT 13
|
||||
#define NAU8824_DACL_EN_SFT 12
|
||||
#define NAU8824_DACR_CLK_SFT 9
|
||||
#define NAU8824_DACL_CLK_SFT 8
|
||||
#define NAU8824_RDAC_CLK_DELAY_SFT 4
|
||||
#define NAU8824_RDAC_CLK_DELAY_MASK (0x7 << NAU8824_RDAC_CLK_DELAY_SFT)
|
||||
#define NAU8824_RDAC_VREF_SFT 2
|
||||
#define NAU8824_RDAC_VREF_MASK (0x3 << NAU8824_RDAC_VREF_SFT)
|
||||
|
||||
/* MIC_BIAS (0x74) */
|
||||
#define NAU8824_MICBIAS_JKSLV (1 << 14)
|
||||
#define NAU8824_MICBIAS_JKR2 (1 << 12)
|
||||
#define NAU8824_MICBIAS_POWERUP_SFT 8
|
||||
#define NAU8824_MICBIAS_VOLTAGE_SFT 0
|
||||
#define NAU8824_MICBIAS_VOLTAGE_MASK 0x7
|
||||
|
||||
/* BOOST (0x76) */
|
||||
#define NAU8824_PRECHARGE_DIS (0x1 << 13)
|
||||
#define NAU8824_GLOBAL_BIAS_EN (0x1 << 12)
|
||||
#define NAU8824_HP_BOOST_DIS_SFT 9
|
||||
#define NAU8824_HP_BOOST_DIS (0x1 << NAU8824_HP_BOOST_DIS_SFT)
|
||||
#define NAU8824_HP_BOOST_G_DIS_SFT 8
|
||||
#define NAU8824_HP_BOOST_G_DIS (0x1 << NAU8824_HP_BOOST_G_DIS_SFT)
|
||||
#define NAU8824_SHORT_SHUTDOWN_DIG_EN (1 << 7)
|
||||
#define NAU8824_SHORT_SHUTDOWN_EN (1 << 6)
|
||||
|
||||
/* FEPGA (0x77) */
|
||||
#define NAU8824_FEPGA_MODER_SHORT_SFT 7
|
||||
#define NAU8824_FEPGA_MODER_SHORT_EN (0x1 << NAU8824_FEPGA_MODER_SHORT_SFT)
|
||||
#define NAU8824_FEPGA_MODER_MIC2_SFT 5
|
||||
#define NAU8824_FEPGA_MODER_MIC2_EN (0x1 << NAU8824_FEPGA_MODER_MIC2_SFT)
|
||||
#define NAU8824_FEPGA_MODER_HSMIC_SFT 4
|
||||
#define NAU8824_FEPGA_MODER_HSMIC_EN (0x1 << NAU8824_FEPGA_MODER_HSMIC_SFT)
|
||||
#define NAU8824_FEPGA_MODEL_SHORT_SFT 3
|
||||
#define NAU8824_FEPGA_MODEL_SHORT_EN (0x1 << NAU8824_FEPGA_MODEL_SHORT_SFT)
|
||||
#define NAU8824_FEPGA_MODEL_MIC1_SFT 1
|
||||
#define NAU8824_FEPGA_MODEL_MIC1_EN (0x1 << NAU8824_FEPGA_MODEL_MIC1_SFT)
|
||||
#define NAU8824_FEPGA_MODEL_HSMIC_SFT 0
|
||||
#define NAU8824_FEPGA_MODEL_HSMIC_EN (0x1 << NAU8824_FEPGA_MODEL_HSMIC_SFT)
|
||||
|
||||
/* FEPGA_II (0x78) */
|
||||
#define NAU8824_FEPGA_GAINR_SFT 5
|
||||
#define NAU8824_FEPGA_GAINR_MASK (0x1f << NAU8824_FEPGA_GAINR_SFT)
|
||||
#define NAU8824_FEPGA_GAINL_SFT 0
|
||||
#define NAU8824_FEPGA_GAINL_MASK 0x1f
|
||||
|
||||
/* CHARGE_PUMP_CONTROL (0x80) */
|
||||
#define NAU8824_JAMNODCLOW (0x1 << 15)
|
||||
#define NAU8824_SPKR_PULL_DOWN (0x1 << 13)
|
||||
#define NAU8824_SPKL_PULL_DOWN (0x1 << 12)
|
||||
#define NAU8824_POWER_DOWN_DACR (0x1 << 9)
|
||||
#define NAU8824_POWER_DOWN_DACL (0x1 << 8)
|
||||
#define NAU8824_CHARGE_PUMP_EN_SFT 5
|
||||
#define NAU8824_CHARGE_PUMP_EN (0x1 << NAU8824_CHARGE_PUMP_EN_SFT)
|
||||
|
||||
|
||||
#define NAU8824_CODEC_DAI "nau8824-hifi"
|
||||
|
||||
/* System Clock Source */
|
||||
enum {
|
||||
NAU8824_CLK_DIS,
|
||||
NAU8824_CLK_MCLK,
|
||||
NAU8824_CLK_INTERNAL,
|
||||
NAU8824_CLK_FLL_MCLK,
|
||||
NAU8824_CLK_FLL_BLK,
|
||||
NAU8824_CLK_FLL_FS,
|
||||
};
|
||||
|
||||
struct nau8824 {
|
||||
struct device *dev;
|
||||
struct regmap *regmap;
|
||||
struct snd_soc_dapm_context *dapm;
|
||||
struct snd_soc_jack *jack;
|
||||
struct work_struct jdet_work;
|
||||
struct semaphore jd_sem;
|
||||
int fs;
|
||||
int irq;
|
||||
int micbias_voltage;
|
||||
int vref_impedance;
|
||||
int jkdet_polarity;
|
||||
int sar_threshold_num;
|
||||
int sar_threshold[8];
|
||||
int sar_hysteresis;
|
||||
int sar_voltage;
|
||||
int sar_compare_time;
|
||||
int sar_sampling_time;
|
||||
int key_debounce;
|
||||
int jack_eject_debounce;
|
||||
};
|
||||
|
||||
struct nau8824_fll {
|
||||
int mclk_src;
|
||||
int ratio;
|
||||
int fll_frac;
|
||||
int fll_int;
|
||||
int clk_ref_div;
|
||||
};
|
||||
|
||||
struct nau8824_fll_attr {
|
||||
unsigned int param;
|
||||
unsigned int val;
|
||||
};
|
||||
|
||||
struct nau8824_osr_attr {
|
||||
unsigned int osr;
|
||||
unsigned int clk_src;
|
||||
};
|
||||
|
||||
|
||||
int nau8824_enable_jack_detect(struct snd_soc_codec *codec,
|
||||
struct snd_soc_jack *jack);
|
||||
|
||||
#endif /* _NAU8824_H */
|
||||
|
@ -49,7 +49,7 @@ static int am3517evm_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops am3517evm_ops = {
|
||||
static const struct snd_soc_ops am3517evm_ops = {
|
||||
.hw_params = am3517evm_hw_params,
|
||||
};
|
||||
|
||||
|
@ -124,7 +124,7 @@ static int n810_hw_params(struct snd_pcm_substream *substream,
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops n810_ops = {
|
||||
static const struct snd_soc_ops n810_ops = {
|
||||
.startup = n810_startup,
|
||||
.hw_params = n810_hw_params,
|
||||
.shutdown = n810_shutdown,
|
||||
|
@ -70,7 +70,7 @@ static int omap_abe_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops omap_abe_ops = {
|
||||
static const struct snd_soc_ops omap_abe_ops = {
|
||||
.hw_params = omap_abe_hw_params,
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ static int omap_twl4030_hw_params(struct snd_pcm_substream *substream,
|
||||
return snd_soc_runtime_set_dai_fmt(rtd, fmt);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops omap_twl4030_ops = {
|
||||
static const struct snd_soc_ops omap_twl4030_ops = {
|
||||
.hw_params = omap_twl4030_hw_params,
|
||||
};
|
||||
|
||||
|
@ -184,7 +184,7 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops omap3pandora_ops = {
|
||||
static const struct snd_soc_ops omap3pandora_ops = {
|
||||
.hw_params = omap3pandora_hw_params,
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,7 @@ static int osk_hw_params(struct snd_pcm_substream *substream,
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops osk_ops = {
|
||||
static const struct snd_soc_ops osk_ops = {
|
||||
.startup = osk_startup,
|
||||
.hw_params = osk_hw_params,
|
||||
.shutdown = osk_shutdown,
|
||||
|
@ -123,7 +123,7 @@ static int rx51_hw_params(struct snd_pcm_substream *substream,
|
||||
SND_SOC_CLOCK_IN);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops rx51_ops = {
|
||||
static const struct snd_soc_ops rx51_ops = {
|
||||
.startup = rx51_startup,
|
||||
.hw_params = rx51_hw_params,
|
||||
};
|
||||
@ -433,10 +433,9 @@ static int rx51_soc_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (pdata == NULL) {
|
||||
dev_err(card->dev, "failed to create private data\n");
|
||||
if (pdata == NULL)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
snd_soc_card_set_drvdata(card, pdata);
|
||||
|
||||
pdata->tvout_selection_gpio = devm_gpiod_get(card->dev,
|
||||
|
@ -74,7 +74,7 @@ static int brownstone_wm8994_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
/* machine stream operations */
|
||||
static struct snd_soc_ops brownstone_ops = {
|
||||
static const struct snd_soc_ops brownstone_ops = {
|
||||
.hw_params = brownstone_wm8994_hw_params,
|
||||
};
|
||||
|
||||
|
@ -154,7 +154,7 @@ static int corgi_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops corgi_ops = {
|
||||
static const struct snd_soc_ops corgi_ops = {
|
||||
.startup = corgi_startup,
|
||||
.hw_params = corgi_hw_params,
|
||||
.shutdown = corgi_shutdown,
|
||||
|
@ -81,7 +81,7 @@ static struct snd_soc_dai_link e750_dai[] = {
|
||||
.name = "AC97 Aux",
|
||||
.stream_name = "AC97 Aux",
|
||||
.cpu_dai_name = "pxa2xx-ac97-aux",
|
||||
.codec_dai_name ="wm9705-aux",
|
||||
.codec_dai_name = "wm9705-aux",
|
||||
.platform_name = "pxa-pcm-audio",
|
||||
.codec_name = "wm9705-codec",
|
||||
},
|
||||
|
@ -81,7 +81,7 @@ static struct snd_soc_dai_link e800_dai[] = {
|
||||
.name = "AC97 Aux",
|
||||
.stream_name = "AC97 Aux",
|
||||
.cpu_dai_name = "pxa2xx-ac97-aux",
|
||||
.codec_dai_name ="wm9712-aux",
|
||||
.codec_dai_name = "wm9712-aux",
|
||||
.platform_name = "pxa-pcm-audio",
|
||||
.codec_name = "wm9712-codec",
|
||||
},
|
||||
|
@ -43,7 +43,7 @@ static struct snd_soc_dai_link em_x270_dai[] = {
|
||||
.name = "AC97 Aux",
|
||||
.stream_name = "AC97 Aux",
|
||||
.cpu_dai_name = "pxa2xx-ac97-aux",
|
||||
.codec_dai_name ="wm9712-aux",
|
||||
.codec_dai_name = "wm9712-aux",
|
||||
.platform_name = "pxa-pcm-audio",
|
||||
.codec_name = "wm9712-codec",
|
||||
},
|
||||
|
@ -79,7 +79,7 @@ static int hx4700_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops hx4700_ops = {
|
||||
static const struct snd_soc_ops hx4700_ops = {
|
||||
.hw_params = hx4700_hw_params,
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ static int imote2_asoc_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops imote2_asoc_ops = {
|
||||
static const struct snd_soc_ops imote2_asoc_ops = {
|
||||
.hw_params = imote2_asoc_hw_params,
|
||||
};
|
||||
|
||||
|
@ -255,12 +255,12 @@ static int magician_capture_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops magician_capture_ops = {
|
||||
static const struct snd_soc_ops magician_capture_ops = {
|
||||
.startup = magician_startup,
|
||||
.hw_params = magician_capture_hw_params,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops magician_playback_ops = {
|
||||
static const struct snd_soc_ops magician_playback_ops = {
|
||||
.startup = magician_startup,
|
||||
.hw_params = magician_playback_hw_params,
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ static struct snd_soc_dai_link mioa701_dai[] = {
|
||||
.name = "AC97 Aux",
|
||||
.stream_name = "AC97 Aux",
|
||||
.cpu_dai_name = "pxa2xx-ac97-aux",
|
||||
.codec_dai_name ="wm9713-aux",
|
||||
.codec_dai_name = "wm9713-aux",
|
||||
.codec_name = "wm9713-codec",
|
||||
.platform_name = "pxa-pcm-audio",
|
||||
.ops = &mioa701_ops,
|
||||
|
@ -166,7 +166,6 @@ static void mmp_pcm_free_dma_buffers(struct snd_pcm *pcm)
|
||||
buf->area = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int mmp_pcm_preallocate_dma_buffer(struct snd_pcm_substream *substream,
|
||||
|
@ -119,7 +119,6 @@ static void mmp_sspa_shutdown(struct snd_pcm_substream *substream,
|
||||
clk_disable(priv->sspa->clk);
|
||||
clk_disable(priv->sysclk);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -129,7 +129,7 @@ static int poodle_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops poodle_ops = {
|
||||
static const struct snd_soc_ops poodle_ops = {
|
||||
.startup = poodle_startup,
|
||||
.hw_params = poodle_hw_params,
|
||||
.shutdown = poodle_shutdown,
|
||||
|
@ -354,6 +354,7 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
|
||||
if (ssp->type == PXA3xx_SSP) {
|
||||
u32 val;
|
||||
u64 tmp = 19968;
|
||||
|
||||
tmp *= 1000000;
|
||||
do_div(tmp, freq_out);
|
||||
val = tmp;
|
||||
@ -590,13 +591,13 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
if ((pxa_ssp_get_scr(ssp) == 4) && (width == 16)) {
|
||||
/* This is a special case where the bitclk is 64fs
|
||||
* and we're not dealing with 2*32 bits of audio
|
||||
* samples.
|
||||
*
|
||||
* The SSP values used for that are all found out by
|
||||
* trying and failing a lot; some of the registers
|
||||
* needed for that mode are only available on PXA3xx.
|
||||
*/
|
||||
* and we're not dealing with 2*32 bits of audio
|
||||
* samples.
|
||||
*
|
||||
* The SSP values used for that are all found out by
|
||||
* trying and failing a lot; some of the registers
|
||||
* needed for that mode are only available on PXA3xx.
|
||||
*/
|
||||
if (ssp->type != PXA3xx_SSP)
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -140,9 +140,8 @@ static int pxa2xx_ac97_mic_startup(struct snd_pcm_substream *substream,
|
||||
{
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
|
||||
return -ENODEV;
|
||||
else
|
||||
snd_soc_dai_set_dma_data(cpu_dai, substream,
|
||||
&pxa2xx_ac97_pcm_mic_mono_in);
|
||||
snd_soc_dai_set_dma_data(cpu_dai, substream,
|
||||
&pxa2xx_ac97_pcm_mic_mono_in);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -46,10 +46,10 @@
|
||||
#define SACR0_STRF (1 << 5) /* FIFO Select for EFWR Special Function */
|
||||
#define SACR0_EFWR (1 << 4) /* Enable EFWR Function */
|
||||
#define SACR0_RST (1 << 3) /* FIFO, i2s Register Reset */
|
||||
#define SACR0_BCKD (1 << 2) /* Bit Clock Direction */
|
||||
#define SACR0_BCKD (1 << 2) /* Bit Clock Direction */
|
||||
#define SACR0_ENB (1 << 0) /* Enable I2S Link */
|
||||
#define SACR1_ENLBF (1 << 5) /* Enable Loopback */
|
||||
#define SACR1_DRPL (1 << 4) /* Disable Replaying Function */
|
||||
#define SACR1_DRPL (1 << 4) /* Disable Replaying Function */
|
||||
#define SACR1_DREC (1 << 3) /* Disable Recording Function */
|
||||
#define SACR1_AMSL (1 << 0) /* Specify Alternate Mode */
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
#define SASR0_TFS (1 << 3) /* Tx FIFO Service Request */
|
||||
#define SASR0_BSY (1 << 2) /* I2S Busy */
|
||||
#define SASR0_RNE (1 << 1) /* Rx FIFO Not Empty */
|
||||
#define SASR0_TNF (1 << 0) /* Tx FIFO Not Empty */
|
||||
#define SASR0_TNF (1 << 0) /* Tx FIFO Not Empty */
|
||||
|
||||
#define SAICR_ROR (1 << 6) /* Clear Rx FIFO Overrun Interrupt */
|
||||
#define SAICR_TUR (1 << 5) /* Clear Tx FIFO Underrun Interrupt */
|
||||
@ -119,7 +119,7 @@ static int pxa_i2s_wait(void)
|
||||
int i;
|
||||
|
||||
/* flush the Rx FIFO */
|
||||
for(i = 0; i < 16; i++)
|
||||
for (i = 0; i < 16; i++)
|
||||
SADR;
|
||||
return 0;
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver pxa2xx_soc_platform = {
|
||||
.ops = &pxa2xx_pcm_ops,
|
||||
.ops = &pxa2xx_pcm_ops,
|
||||
.pcm_new = pxa2xx_soc_pcm_new,
|
||||
.pcm_free = pxa2xx_pcm_free_dma_buffers,
|
||||
};
|
||||
|
@ -132,7 +132,7 @@ static int raumfeld_cs4270_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops raumfeld_cs4270_ops = {
|
||||
static const struct snd_soc_ops raumfeld_cs4270_ops = {
|
||||
.startup = raumfeld_cs4270_startup,
|
||||
.shutdown = raumfeld_cs4270_shutdown,
|
||||
.hw_params = raumfeld_cs4270_hw_params,
|
||||
@ -228,14 +228,12 @@ static struct snd_soc_ops raumfeld_ak4104_ops = {
|
||||
.codec_name = "spi0.0", \
|
||||
}
|
||||
|
||||
static struct snd_soc_dai_link snd_soc_raumfeld_connector_dai[] =
|
||||
{
|
||||
static struct snd_soc_dai_link snd_soc_raumfeld_connector_dai[] = {
|
||||
DAI_LINK_CS4270,
|
||||
DAI_LINK_AK4104,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_link snd_soc_raumfeld_speaker_dai[] =
|
||||
{
|
||||
static struct snd_soc_dai_link snd_soc_raumfeld_speaker_dai[] = {
|
||||
DAI_LINK_CS4270,
|
||||
};
|
||||
|
||||
|
@ -156,7 +156,7 @@ static int spitz_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops spitz_ops = {
|
||||
static const struct snd_soc_ops spitz_ops = {
|
||||
.startup = spitz_startup,
|
||||
.hw_params = spitz_hw_params,
|
||||
};
|
||||
@ -230,8 +230,8 @@ static const struct snd_soc_dapm_route spitz_audio_map[] = {
|
||||
{"Headset Jack", NULL, "ROUT1"},
|
||||
|
||||
/* ext speaker connected to LOUT2, ROUT2 */
|
||||
{"Ext Spk", NULL , "ROUT2"},
|
||||
{"Ext Spk", NULL , "LOUT2"},
|
||||
{"Ext Spk", NULL, "ROUT2"},
|
||||
{"Ext Spk", NULL, "LOUT2"},
|
||||
|
||||
/* mic is connected to input 1 - with bias */
|
||||
{"LINPUT1", NULL, "Mic Bias"},
|
||||
|
@ -85,7 +85,7 @@ static int tosa_startup(struct snd_pcm_substream *substream)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops tosa_ops = {
|
||||
static const struct snd_soc_ops tosa_ops = {
|
||||
.startup = tosa_startup,
|
||||
};
|
||||
|
||||
@ -133,7 +133,7 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
|
||||
static int tosa_hp_event(struct snd_soc_dapm_widget *w,
|
||||
struct snd_kcontrol *k, int event)
|
||||
{
|
||||
gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 :0);
|
||||
gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 : 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ static const struct snd_soc_dapm_route z2_audio_map[] = {
|
||||
{"Headphone Jack", NULL, "ROUT1"},
|
||||
|
||||
/* ext speaker connected to LOUT2, ROUT2 */
|
||||
{"Ext Spk", NULL , "ROUT2"},
|
||||
{"Ext Spk", NULL , "LOUT2"},
|
||||
{"Ext Spk", NULL, "ROUT2"},
|
||||
{"Ext Spk", NULL, "LOUT2"},
|
||||
|
||||
/* mic is connected to R input 2 - with bias */
|
||||
{"RINPUT2", NULL, "Mic Bias"},
|
||||
@ -152,7 +152,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops z2_ops = {
|
||||
static const struct snd_soc_ops z2_ops = {
|
||||
.hw_params = z2_hw_params,
|
||||
};
|
||||
|
||||
|
@ -132,7 +132,7 @@ static int zylonite_voice_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops zylonite_voice_ops = {
|
||||
static const struct snd_soc_ops zylonite_voice_ops = {
|
||||
.hw_params = zylonite_voice_hw_params,
|
||||
};
|
||||
|
||||
|
@ -231,6 +231,18 @@ static struct lpass_variant apq8016_data = {
|
||||
.wrdma_channels = 2,
|
||||
.dai_driver = apq8016_lpass_cpu_dai_driver,
|
||||
.num_dai = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver),
|
||||
.dai_osr_clk_names = (const char *[]) {
|
||||
"mi2s-osr-clk0",
|
||||
"mi2s-osr-clk1",
|
||||
"mi2s-osr-clk2",
|
||||
"mi2s-osr-clk3",
|
||||
},
|
||||
.dai_bit_clk_names = (const char *[]) {
|
||||
"mi2s-bit-clk0",
|
||||
"mi2s-bit-clk1",
|
||||
"mi2s-bit-clk2",
|
||||
"mi2s-bit-clk3",
|
||||
},
|
||||
.init = apq8016_lpass_init,
|
||||
.exit = apq8016_lpass_exit,
|
||||
.alloc_dma_channel = apq8016_lpass_alloc_dma_channel,
|
||||
|
@ -429,7 +429,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
|
||||
struct lpass_variant *variant;
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct of_device_id *match;
|
||||
char clk_name[16];
|
||||
int ret, i, dai_id;
|
||||
|
||||
dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
|
||||
@ -477,31 +476,24 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
|
||||
|
||||
for (i = 0; i < variant->num_dai; i++) {
|
||||
dai_id = variant->dai_driver[i].id;
|
||||
if (variant->num_dai > 1)
|
||||
sprintf(clk_name, "mi2s-osr-clk%d", i);
|
||||
else
|
||||
sprintf(clk_name, "mi2s-osr-clk");
|
||||
|
||||
drvdata->mi2s_osr_clk[dai_id] = devm_clk_get(&pdev->dev,
|
||||
clk_name);
|
||||
variant->dai_osr_clk_names[i]);
|
||||
if (IS_ERR(drvdata->mi2s_osr_clk[dai_id])) {
|
||||
dev_warn(&pdev->dev,
|
||||
"error getting optional mi2s-osr-clk: %ld\n",
|
||||
"%s() error getting optional %s: %ld\n",
|
||||
__func__,
|
||||
variant->dai_osr_clk_names[i],
|
||||
PTR_ERR(drvdata->mi2s_osr_clk[dai_id]));
|
||||
|
||||
drvdata->mi2s_osr_clk[dai_id] = NULL;
|
||||
}
|
||||
|
||||
if (variant->num_dai > 1)
|
||||
sprintf(clk_name, "mi2s-bit-clk%d", i);
|
||||
else
|
||||
sprintf(clk_name, "mi2s-bit-clk");
|
||||
|
||||
drvdata->mi2s_bit_clk[dai_id] = devm_clk_get(&pdev->dev,
|
||||
clk_name);
|
||||
variant->dai_bit_clk_names[i]);
|
||||
if (IS_ERR(drvdata->mi2s_bit_clk[dai_id])) {
|
||||
dev_err(&pdev->dev,
|
||||
"error getting mi2s-bit-clk: %ld\n",
|
||||
"error getting %s: %ld\n",
|
||||
variant->dai_bit_clk_names[i],
|
||||
PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
|
||||
return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
|
||||
}
|
||||
|
@ -92,6 +92,12 @@ static struct lpass_variant ipq806x_data = {
|
||||
.wrdma_channels = 4,
|
||||
.dai_driver = &ipq806x_lpass_cpu_dai_driver,
|
||||
.num_dai = 1,
|
||||
.dai_osr_clk_names = (const char *[]) {
|
||||
"mi2s-osr-clk",
|
||||
},
|
||||
.dai_bit_clk_names = (const char *[]) {
|
||||
"mi2s-bit-clk",
|
||||
},
|
||||
.alloc_dma_channel = ipq806x_lpass_alloc_dma_channel,
|
||||
.free_dma_channel = ipq806x_lpass_free_dma_channel,
|
||||
};
|
||||
|
@ -91,6 +91,8 @@ struct lpass_variant {
|
||||
/* SOC specific dais */
|
||||
struct snd_soc_dai_driver *dai_driver;
|
||||
int num_dai;
|
||||
const char * const *dai_osr_clk_names;
|
||||
const char * const *dai_bit_clk_names;
|
||||
};
|
||||
|
||||
/* register the platform driver from the CPU DAI driver */
|
||||
|
Loading…
Reference in New Issue
Block a user