Merge remote-tracking branches 'asoc/topic/compress', 'asoc/topic/const' and 'asoc/topic/cs35l34' into asoc-next
This commit is contained in:
commit
cc9624790d
64
Documentation/devicetree/bindings/sound/cs35l34.txt
Normal file
64
Documentation/devicetree/bindings/sound/cs35l34.txt
Normal file
@ -0,0 +1,64 @@
|
||||
CS35L34 Speaker Amplifier
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : "cirrus,cs35l34"
|
||||
|
||||
- reg : the I2C address of the device for I2C.
|
||||
|
||||
- VA-supply, VP-supply : power supplies for the device,
|
||||
as covered in
|
||||
Documentation/devicetree/bindings/regulator/regulator.txt.
|
||||
|
||||
- cirrus,boost-vtge-millivolt : Boost Voltage Value. Configures the boost
|
||||
converter's output voltage in mV. The range is from VP to 8V with
|
||||
increments of 100mV.
|
||||
|
||||
- cirrus,boost-nanohenry: Inductor value for boost converter. The value is
|
||||
in nH and they can be values of 1000nH, 1100nH, 1200nH, 1500nH, and 2200nH.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- reset-gpios: GPIO used to reset the amplifier.
|
||||
|
||||
- interrupt-parent : Specifies the phandle of the interrupt controller to
|
||||
which the IRQs from CS35L34 are delivered to.
|
||||
- interrupts : IRQ line info CS35L34.
|
||||
(See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
|
||||
for further information relating to interrupt properties)
|
||||
|
||||
- cirrus,boost-peak-milliamp : Boost converter peak current limit in mA. The
|
||||
range starts at 1200mA and goes to a maximum of 3840mA with increments of
|
||||
80mA. The default value is 2480mA.
|
||||
|
||||
- cirrus,i2s-sdinloc : ADSP SDIN I2S channel location. Indicates whether the
|
||||
received mono data is in the left or right portion of the I2S frame
|
||||
according to the AD0 pin or directly via this configuration.
|
||||
0x0 (Default) = Selected by AD0 input (if AD0 = LOW, use left channel),
|
||||
0x2 = Left,
|
||||
0x1 = Selected by the inversion of the AD0 input (if AD0 = LOW, use right
|
||||
channel),
|
||||
0x3 = Right.
|
||||
|
||||
- cirrus,gain-zc-disable: Boolean property. If set, the gain change will take
|
||||
effect without waiting for a zero cross.
|
||||
|
||||
- cirrus,tdm-rising-edge: Boolean property. If set, data is on the rising edge of
|
||||
SCLK. Otherwise, data is on the falling edge of SCLK.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
cs35l34: cs35l34@40 {
|
||||
compatible = "cirrus,cs35l34";
|
||||
reg = <0x40>;
|
||||
|
||||
interrupt-parent = <&gpio8>;
|
||||
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
|
||||
|
||||
reset-gpios = <&gpio 10 0>;
|
||||
|
||||
cirrus,boost-vtge-milltvolt = <8000>; /* 8V */
|
||||
cirrus,boost-ind-nanohenry = <1000>; /* 1uH */
|
||||
cirrus,boost-peak-milliamp = <3000>; /* 3A */
|
||||
};
|
35
include/sound/cs35l34.h
Normal file
35
include/sound/cs35l34.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* linux/sound/cs35l34.h -- Platform data for CS35l34
|
||||
*
|
||||
* Copyright (c) 2016 Cirrus Logic Inc.
|
||||
*
|
||||
* 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 __CS35L34_H
|
||||
#define __CS35L34_H
|
||||
|
||||
struct cs35l34_platform_data {
|
||||
/* Set AIF to half drive strength */
|
||||
bool aif_half_drv;
|
||||
/* Digital Soft Ramp Disable */
|
||||
bool digsft_disable;
|
||||
/* Amplifier Invert */
|
||||
bool amp_inv;
|
||||
/* Peak current (mA) */
|
||||
unsigned int boost_peak;
|
||||
/* Boost inductor value (nH) */
|
||||
unsigned int boost_ind;
|
||||
/* Boost Controller Voltage Setting (mV) */
|
||||
unsigned int boost_vtge;
|
||||
/* Gain Change Zero Cross */
|
||||
bool gain_zc_disable;
|
||||
/* SDIN Left/Right Selection */
|
||||
unsigned int i2s_sdinloc;
|
||||
/* TDM Rising Edge */
|
||||
bool tdm_rising_edge;
|
||||
};
|
||||
|
||||
#endif /* __CS35L34_H */
|
@ -207,6 +207,30 @@ struct snd_soc_dai_ops {
|
||||
struct snd_soc_dai *);
|
||||
};
|
||||
|
||||
struct snd_soc_cdai_ops {
|
||||
/*
|
||||
* for compress ops
|
||||
*/
|
||||
int (*startup)(struct snd_compr_stream *,
|
||||
struct snd_soc_dai *);
|
||||
int (*shutdown)(struct snd_compr_stream *,
|
||||
struct snd_soc_dai *);
|
||||
int (*set_params)(struct snd_compr_stream *,
|
||||
struct snd_compr_params *, struct snd_soc_dai *);
|
||||
int (*get_params)(struct snd_compr_stream *,
|
||||
struct snd_codec *, struct snd_soc_dai *);
|
||||
int (*set_metadata)(struct snd_compr_stream *,
|
||||
struct snd_compr_metadata *, struct snd_soc_dai *);
|
||||
int (*get_metadata)(struct snd_compr_stream *,
|
||||
struct snd_compr_metadata *, struct snd_soc_dai *);
|
||||
int (*trigger)(struct snd_compr_stream *, int,
|
||||
struct snd_soc_dai *);
|
||||
int (*pointer)(struct snd_compr_stream *,
|
||||
struct snd_compr_tstamp *, struct snd_soc_dai *);
|
||||
int (*ack)(struct snd_compr_stream *, size_t,
|
||||
struct snd_soc_dai *);
|
||||
};
|
||||
|
||||
/*
|
||||
* Digital Audio Interface Driver.
|
||||
*
|
||||
@ -236,6 +260,7 @@ struct snd_soc_dai_driver {
|
||||
|
||||
/* ops */
|
||||
const struct snd_soc_dai_ops *ops;
|
||||
const struct snd_soc_cdai_ops *cops;
|
||||
|
||||
/* DAI capabilities */
|
||||
struct snd_soc_pcm_stream capture;
|
||||
|
@ -48,6 +48,7 @@ config SND_SOC_ALL_CODECS
|
||||
select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
|
||||
select SND_SOC_CS35L32 if I2C
|
||||
select SND_SOC_CS35L33 if I2C
|
||||
select SND_SOC_CS35L34 if I2C
|
||||
select SND_SOC_CS42L51_I2C if I2C
|
||||
select SND_SOC_CS42L52 if I2C && INPUT
|
||||
select SND_SOC_CS42L56 if I2C && INPUT
|
||||
@ -399,6 +400,10 @@ config SND_SOC_CS35L33
|
||||
tristate "Cirrus Logic CS35L33 CODEC"
|
||||
depends on I2C
|
||||
|
||||
config SND_SOC_CS35L34
|
||||
tristate "Cirrus Logic CS35L34 CODEC"
|
||||
depends on I2C
|
||||
|
||||
config SND_SOC_CS42L51
|
||||
tristate
|
||||
|
||||
|
@ -38,6 +38,7 @@ snd-soc-bt-sco-objs := bt-sco.o
|
||||
snd-soc-cq93vc-objs := cq93vc.o
|
||||
snd-soc-cs35l32-objs := cs35l32.o
|
||||
snd-soc-cs35l33-objs := cs35l33.o
|
||||
snd-soc-cs35l34-objs := cs35l34.o
|
||||
snd-soc-cs42l51-objs := cs42l51.o
|
||||
snd-soc-cs42l51-i2c-objs := cs42l51-i2c.o
|
||||
snd-soc-cs42l52-objs := cs42l52.o
|
||||
@ -263,6 +264,7 @@ obj-$(CONFIG_SND_SOC_BT_SCO) += snd-soc-bt-sco.o
|
||||
obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
|
||||
obj-$(CONFIG_SND_SOC_CS35L32) += snd-soc-cs35l32.o
|
||||
obj-$(CONFIG_SND_SOC_CS35L33) += snd-soc-cs35l33.o
|
||||
obj-$(CONFIG_SND_SOC_CS35L34) += snd-soc-cs35l34.o
|
||||
obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o
|
||||
obj-$(CONFIG_SND_SOC_CS42L51_I2C) += snd-soc-cs42l51-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_CS42L52) += snd-soc-cs42l52.o
|
||||
|
1251
sound/soc/codecs/cs35l34.c
Normal file
1251
sound/soc/codecs/cs35l34.c
Normal file
File diff suppressed because it is too large
Load Diff
269
sound/soc/codecs/cs35l34.h
Normal file
269
sound/soc/codecs/cs35l34.h
Normal file
@ -0,0 +1,269 @@
|
||||
/*
|
||||
* cs35l34.h -- CS35L34 ALSA SoC audio driver
|
||||
*
|
||||
* Copyright 2016 Cirrus Logic, Inc.
|
||||
*
|
||||
* Author: Paul Handrigan <Paul.Handrigan@cirrus.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 __CS35L34_H__
|
||||
#define __CS35L34_H__
|
||||
|
||||
#define CS35L34_CHIP_ID 0x00035A34
|
||||
#define CS35L34_DEVID_AB 0x01 /* Device ID A & B [RO] */
|
||||
#define CS35L34_DEVID_CD 0x02 /* Device ID C & D [RO] */
|
||||
#define CS35L34_DEVID_E 0x03 /* Device ID E [RO] */
|
||||
#define CS35L34_FAB_ID 0x04 /* Fab ID [RO] */
|
||||
#define CS35L34_REV_ID 0x05 /* Revision ID [RO] */
|
||||
#define CS35L34_PWRCTL1 0x06 /* Power Ctl 1 */
|
||||
#define CS35L34_PWRCTL2 0x07 /* Power Ctl 2 */
|
||||
#define CS35L34_PWRCTL3 0x08 /* Power Ctl 3 */
|
||||
#define CS35L34_ADSP_CLK_CTL 0x0A /* (ADSP) Clock Ctl */
|
||||
#define CS35L34_MCLK_CTL 0x0B /* Master Clocking Ctl */
|
||||
#define CS35L34_AMP_INP_DRV_CTL 0x14 /* Amp Input Drive Ctl */
|
||||
#define CS35L34_AMP_DIG_VOL_CTL 0x15 /* Amplifier Dig Volume Ctl */
|
||||
#define CS35L34_AMP_DIG_VOL 0x16 /* Amplifier Dig Volume */
|
||||
#define CS35L34_AMP_ANLG_GAIN_CTL 0x17 /* Amplifier Analog Gain Ctl */
|
||||
#define CS35L34_PROTECT_CTL 0x18 /* Amp Gain - Prot Ctl Param */
|
||||
#define CS35L34_AMP_KEEP_ALIVE_CTL 0x1A /* Amplifier Keep Alive Ctl */
|
||||
#define CS35L34_BST_CVTR_V_CTL 0x1D /* Boost Conv Voltage Ctl */
|
||||
#define CS35L34_BST_PEAK_I 0x1E /* Boost Conv Peak Current */
|
||||
#define CS35L34_BST_RAMP_CTL 0x20 /* Boost Conv Soft Ramp Ctl */
|
||||
#define CS35L34_BST_CONV_COEF_1 0x21 /* Boost Conv Coefficients 1 */
|
||||
#define CS35L34_BST_CONV_COEF_2 0x22 /* Boost Conv Coefficients 2 */
|
||||
#define CS35L34_BST_CONV_SLOPE_COMP 0x23 /* Boost Conv Slope Comp */
|
||||
#define CS35L34_BST_CONV_SW_FREQ 0x24 /* Boost Conv L BST SW Freq */
|
||||
#define CS35L34_CLASS_H_CTL 0x30 /* CLS H Control */
|
||||
#define CS35L34_CLASS_H_HEADRM_CTL 0x31 /* CLS H Headroom Ctl */
|
||||
#define CS35L34_CLASS_H_RELEASE_RATE 0x32 /* CLS H Release Rate */
|
||||
#define CS35L34_CLASS_H_FET_DRIVE_CTL 0x33 /* CLS H Weak FET Drive Ctl */
|
||||
#define CS35L34_CLASS_H_STATUS 0x38 /* CLS H Status */
|
||||
#define CS35L34_VPBR_CTL 0x3A /* VPBR Ctl */
|
||||
#define CS35L34_VPBR_VOL_CTL 0x3B /* VPBR Volume Ctl */
|
||||
#define CS35L34_VPBR_TIMING_CTL 0x3C /* VPBR Timing Ctl */
|
||||
#define CS35L34_PRED_MAX_ATTEN_SPK_LOAD 0x40 /* PRD Max Atten / Spkr Load */
|
||||
#define CS35L34_PRED_BROWNOUT_THRESH 0x41 /* PRD Brownout Threshold */
|
||||
#define CS35L34_PRED_BROWNOUT_VOL_CTL 0x42 /* PRD Brownout Volume Ctl */
|
||||
#define CS35L34_PRED_BROWNOUT_RATE_CTL 0x43 /* PRD Brownout Rate Ctl */
|
||||
#define CS35L34_PRED_WAIT_CTL 0x44 /* PRD Wait Ctl */
|
||||
#define CS35L34_PRED_ZVP_INIT_IMP_CTL 0x46 /* PRD ZVP Initial Imp Ctl */
|
||||
#define CS35L34_PRED_MAN_SAFE_VPI_CTL 0x47 /* PRD Manual Safe VPI Ctl */
|
||||
#define CS35L34_VPBR_ATTEN_STATUS 0x4B /* VPBR Attenuation Status */
|
||||
#define CS35L34_PRED_BRWNOUT_ATT_STATUS 0x4C /* PRD Brownout Atten Status */
|
||||
#define CS35L34_SPKR_MON_CTL 0x4E /* Speaker Monitoring Ctl */
|
||||
#define CS35L34_ADSP_I2S_CTL 0x50 /* ADSP I2S Ctl */
|
||||
#define CS35L34_ADSP_TDM_CTL 0x51 /* ADSP TDM Ctl */
|
||||
#define CS35L34_TDM_TX_CTL_1_VMON 0x52 /* TDM TX Ctl 1 (VMON) */
|
||||
#define CS35L34_TDM_TX_CTL_2_IMON 0x53 /* TDM TX Ctl 2 (IMON) */
|
||||
#define CS35L34_TDM_TX_CTL_3_VPMON 0x54 /* TDM TX Ctl 3 (VPMON) */
|
||||
#define CS35L34_TDM_TX_CTL_4_VBSTMON 0x55 /* TDM TX Ctl 4 (VBSTMON) */
|
||||
#define CS35L34_TDM_TX_CTL_5_FLAG1 0x56 /* TDM TX Ctl 5 (FLAG1) */
|
||||
#define CS35L34_TDM_TX_CTL_6_FLAG2 0x57 /* TDM TX Ctl 6 (FLAG2) */
|
||||
#define CS35L34_TDM_TX_SLOT_EN_1 0x5A /* TDM TX Slot Enable */
|
||||
#define CS35L34_TDM_TX_SLOT_EN_2 0x5B /* TDM TX Slot Enable */
|
||||
#define CS35L34_TDM_TX_SLOT_EN_3 0x5C /* TDM TX Slot Enable */
|
||||
#define CS35L34_TDM_TX_SLOT_EN_4 0x5D /* TDM TX Slot Enable */
|
||||
#define CS35L34_TDM_RX_CTL_1_AUDIN 0x5E /* TDM RX Ctl 1 */
|
||||
#define CS35L34_TDM_RX_CTL_3_ALIVE 0x60 /* TDM RX Ctl 3 (ALIVE) */
|
||||
#define CS35L34_MULT_DEV_SYNCH1 0x62 /* Multidevice Synch */
|
||||
#define CS35L34_MULT_DEV_SYNCH2 0x63 /* Multidevice Synch 2 */
|
||||
#define CS35L34_PROT_RELEASE_CTL 0x64 /* Protection Release Ctl */
|
||||
#define CS35L34_DIAG_MODE_REG_LOCK 0x68 /* Diagnostic Mode Reg Lock */
|
||||
#define CS35L34_DIAG_MODE_CTL_1 0x69 /* Diagnostic Mode Ctl 1 */
|
||||
#define CS35L34_DIAG_MODE_CTL_2 0x6A /* Diagnostic Mode Ctl 2 */
|
||||
#define CS35L34_INT_MASK_1 0x70 /* Interrupt Mask 1 */
|
||||
#define CS35L34_INT_MASK_2 0x71 /* Interrupt Mask 2 */
|
||||
#define CS35L34_INT_MASK_3 0x72 /* Interrupt Mask 3 */
|
||||
#define CS35L34_INT_MASK_4 0x73 /* Interrupt Mask 4 */
|
||||
#define CS35L34_INT_STATUS_1 0x74 /* Interrupt Status 1 */
|
||||
#define CS35L34_INT_STATUS_2 0x75 /* Interrupt Status 2 */
|
||||
#define CS35L34_INT_STATUS_3 0x76 /* Interrupt Status 3 */
|
||||
#define CS35L34_INT_STATUS_4 0x77 /* Interrupt Status 4 */
|
||||
#define CS35L34_OTP_TRIM_STATUS 0x7E /* OTP Trim Status */
|
||||
|
||||
#define CS35L34_MAX_REGISTER 0x7F
|
||||
#define CS35L34_REGISTER_COUNT 0x4E
|
||||
|
||||
#define CS35L34_MCLK_5644 5644800
|
||||
#define CS35L34_MCLK_6144 6144000
|
||||
#define CS35L34_MCLK_6 6000000
|
||||
#define CS35L34_MCLK_11289 11289600
|
||||
#define CS35L34_MCLK_12 12000000
|
||||
#define CS35L34_MCLK_12288 12288000
|
||||
|
||||
/* CS35L34_PWRCTL1 */
|
||||
#define CS35L34_SFT_RST (1 << 7)
|
||||
#define CS35L34_DISCHG_FLT (1 << 1)
|
||||
#define CS35L34_PDN_ALL 1
|
||||
|
||||
/* CS35L34_PWRCTL2 */
|
||||
#define CS35L34_PDN_VMON (1 << 7)
|
||||
#define CS35L34_PDN_IMON (1 << 6)
|
||||
#define CS35L34_PDN_CLASSH (1 << 5)
|
||||
#define CS35L34_PDN_VPBR (1 << 4)
|
||||
#define CS35L34_PDN_PRED (1 << 3)
|
||||
#define CS35L34_PDN_BST (1 << 2)
|
||||
#define CS35L34_PDN_AMP 1
|
||||
|
||||
/* CS35L34_PWRCTL3 */
|
||||
#define CS35L34_MCLK_DIS (1 << 7)
|
||||
#define CS35L34_PDN_VBSTMON_OUT (1 << 4)
|
||||
#define CS35L34_PDN_VMON_OUT (1 << 3)
|
||||
/* Tristate the ADSP SDOUT when in I2C mode */
|
||||
#define CS35L34_PDN_SDOUT (1 << 2)
|
||||
#define CS35L34_PDN_SDIN (1 << 1)
|
||||
#define CS35L34_PDN_TDM 1
|
||||
|
||||
/* CS35L34_ADSP_CLK_CTL */
|
||||
#define CS35L34_ADSP_RATE 0xF
|
||||
#define CS35L34_ADSP_DRIVE (1 << 4)
|
||||
#define CS35L34_ADSP_M_S (1 << 7)
|
||||
|
||||
/* CS35L34_MCLK_CTL */
|
||||
#define CS35L34_MCLK_DIV (1 << 4)
|
||||
#define CS35L34_MCLK_RATE_MASK 0x7
|
||||
#define CS35L34_MCLK_RATE_6P1440 0x2
|
||||
#define CS35L34_MCLK_RATE_6P0000 0x1
|
||||
#define CS35L34_MCLK_RATE_5P6448 0x0
|
||||
#define CS35L34_MCLKDIS (1 << 7)
|
||||
#define CS35L34_MCLKDIV2 (1 << 6)
|
||||
#define CS35L34_SDOUT_3ST_TDM (1 << 5)
|
||||
#define CS35L34_INT_FS_RATE (1 << 4)
|
||||
#define CS35L34_ADSP_FS 0xF
|
||||
|
||||
/* CS35L34_AMP_INP_DRV_CTL */
|
||||
#define CS35L34_DRV_STR_SRC (1 << 1)
|
||||
#define CS35L34_DRV_STR 1
|
||||
|
||||
/* CS35L34_AMP_DIG_VOL_CTL */
|
||||
#define CS35L34_AMP_DSR_RATE_MASK 0xF0
|
||||
#define CS35L34_AMP_DSR_RATE_SHIFT (1 << 4)
|
||||
#define CS35L34_NOTCH_DIS (1 << 3)
|
||||
#define CS35L34_AMP_DIGSFT (1 << 1)
|
||||
#define CS35L34_INV 1
|
||||
|
||||
/* CS35L34_PROTECT_CTL */
|
||||
#define CS35L34_OTW_ATTN_MASK 0xC
|
||||
#define CS35L34_OTW_THRD_MASK 0x3
|
||||
#define CS35L34_MUTE (1 << 5)
|
||||
#define CS35L34_GAIN_ZC (1 << 4)
|
||||
#define CS35L34_GAIN_ZC_MASK 0x10
|
||||
#define CS35L34_GAIN_ZC_SHIFT 4
|
||||
|
||||
/* CS35L34_AMP_KEEP_ALIVE_CTL */
|
||||
#define CS35L34_ALIVE_WD_DIS (1 << 2)
|
||||
|
||||
/* CS35L34_BST_CVTR_V_CTL */
|
||||
#define CS35L34_BST_CVTL_MASK 0x3F
|
||||
|
||||
/* CS35L34_BST_PEAK_I */
|
||||
#define CS35L34_BST_PEAK_MASK 0x3F
|
||||
|
||||
/* CS35L34_ADSP_I2S_CTL */
|
||||
#define CS35L34_I2S_LOC_MASK 0xC
|
||||
#define CS35L34_I2S_LOC_SHIFT 2
|
||||
|
||||
/* CS35L34_MULT_DEV_SYNCH2 */
|
||||
#define CS35L34_SYNC2_MASK 0xF
|
||||
|
||||
/* CS35L34_PROT_RELEASE_CTL */
|
||||
#define CS35L34_CAL_ERR_RLS (1 << 7)
|
||||
#define CS35L34_SHORT_RLS (1 << 2)
|
||||
#define CS35L34_OTW_RLS (1 << 1)
|
||||
#define CS35L34_OTE_RLS 1
|
||||
|
||||
/* CS35L34_INT_MASK_1 */
|
||||
#define CS35L34_M_CAL_ERR_SHIFT 7
|
||||
#define CS35L34_M_CAL_ERR (1 << CS35L34_M_CAL_ERR_SHIFT)
|
||||
#define CS35L34_M_ALIVE_ERR_SHIFT 5
|
||||
#define CS35L34_M_ALIVE_ERR (1 << CS35L34_M_ALIVE_ERR_SHIFT)
|
||||
#define CS35L34_M_ADSP_CLK_SHIFT 4
|
||||
#define CS35L34_M_ADSP_CLK_ERR (1 << CS35L34_M_ADSP_CLK_SHIFT)
|
||||
#define CS35L34_M_MCLK_SHIFT 3
|
||||
#define CS35L34_M_MCLK_ERR (1 << CS35L34_M_MCLK_SHIFT)
|
||||
#define CS35L34_M_AMP_SHORT_SHIFT 2
|
||||
#define CS35L34_M_AMP_SHORT (1 << CS35L34_M_AMP_SHORT_SHIFT)
|
||||
#define CS35L34_M_OTW_SHIFT 1
|
||||
#define CS35L34_M_OTW (1 << CS35L34_M_OTW_SHIFT)
|
||||
#define CS35L34_M_OTE_SHIFT 0
|
||||
#define CS35L34_M_OTE (1 << CS35L34_M_OTE_SHIFT)
|
||||
|
||||
/* CS35L34_INT_MASK_2 */
|
||||
#define CS35L34_M_PDN_DONE_SHIFT 4
|
||||
#define CS35L34_M_PDN_DONE (1 << CS35L34_M_PDN_DONE_SHIFT)
|
||||
#define CS35L34_M_PRED_SHIFT 3
|
||||
#define CS35L34_M_PRED_ERR (1 << CS35L34_M_PRED_SHIFT)
|
||||
#define CS35L34_M_PRED_CLR_SHIFT 2
|
||||
#define CS35L34_M_PRED_CLR (1 << CS35L34_M_PRED_CLR_SHIFT)
|
||||
#define CS35L34_M_VPBR_SHIFT 1
|
||||
#define CS35L34_M_VPBR_ERR (1 << CS35L34_M_VPBR_SHIFT)
|
||||
#define CS35L34_M_VPBR_CLR_SHIFT 0
|
||||
#define CS35L34_M_VPBR_CLR (1 << CS35L34_M_VPBR_CLR_SHIFT)
|
||||
|
||||
/* CS35L34_INT_MASK_3 */
|
||||
#define CS35L34_M_BST_HIGH_SHIFT 4
|
||||
#define CS35L34_M_BST_HIGH (1 << CS35L34_M_BST_HIGH_SHIFT)
|
||||
#define CS35L34_M_BST_HIGH_FLAG_SHIFT 3
|
||||
#define CS35L34_M_BST_HIGH_FLAG (1 << CS35L34_M_BST_HIGH_FLAG_SHIFT)
|
||||
#define CS35L34_M_BST_IPK_FLAG_SHIFT 2
|
||||
#define CS35L34_M_BST_IPK_FLAG (1 << CS35L34_M_BST_IPK_FLAG_SHIFT)
|
||||
#define CS35L34_M_LBST_SHORT_SHIFT 0
|
||||
#define CS35L34_M_LBST_SHORT (1 << CS35L34_M_LBST_SHORT_SHIFT)
|
||||
|
||||
/* CS35L34_INT_MASK_4 */
|
||||
#define CS35L34_M_VMON_OVFL_SHIFT 3
|
||||
#define CS35L34_M_VMON_OVFL (1 << CS35L34_M_VMON_OVFL_SHIFT)
|
||||
#define CS35L34_M_IMON_OVFL_SHIFT 2
|
||||
#define CS35L34_M_IMON_OVFL (1 << CS35L34_M_IMON_OVFL_SHIFT)
|
||||
#define CS35L34_M_VPMON_OVFL_SHIFT 1
|
||||
#define CS35L34_M_VPMON_OVFL (1 << CS35L34_M_VPMON_OVFL_SHIFT)
|
||||
#define CS35L34_M_VBSTMON_OVFL_SHIFT 1
|
||||
#define CS35L34_M_VBSTMON_OVFL (1 << CS35L34_M_VBSTMON_OVFL_SHIFT)
|
||||
|
||||
/* CS35L34_INT_1 */
|
||||
#define CS35L34_CAL_ERR (1 << CS35L34_M_CAL_ERR_SHIFT)
|
||||
#define CS35L34_ALIVE_ERR (1 << CS35L34_M_ALIVE_ERR_SHIFT)
|
||||
#define CS35L34_M_ADSP_CLK_ERR (1 << CS35L34_M_ADSP_CLK_SHIFT)
|
||||
#define CS35L34_MCLK_ERR (1 << CS35L34_M_MCLK_SHIFT)
|
||||
#define CS35L34_AMP_SHORT (1 << CS35L34_M_AMP_SHORT_SHIFT)
|
||||
#define CS35L34_OTW (1 << CS35L34_M_OTW_SHIFT)
|
||||
#define CS35L34_OTE (1 << CS35L34_M_OTE_SHIFT)
|
||||
|
||||
/* CS35L34_INT_2 */
|
||||
#define CS35L34_PDN_DONE (1 << CS35L34_M_PDN_DONE_SHIFT)
|
||||
#define CS35L34_PRED_ERR (1 << CS35L34_M_PRED_SHIFT)
|
||||
#define CS35L34_PRED_CLR (1 << CS35L34_M_PRED_CLR_SHIFT)
|
||||
#define CS35L34_VPBR_ERR (1 << CS35L34_M_VPBR_SHIFT)
|
||||
#define CS35L34_VPBR_CLR (1 << CS35L34_M_VPBR_CLR_SHIFT)
|
||||
|
||||
/* CS35L34_INT_3 */
|
||||
#define CS35L34_BST_HIGH (1 << CS35L34_M_BST_HIGH_SHIFT)
|
||||
#define CS35L34_BST_HIGH_FLAG (1 << CS35L34_M_BST_HIGH_FLAG_SHIFT)
|
||||
#define CS35L34_BST_IPK_FLAG (1 << CS35L34_M_BST_IPK_FLAG_SHIFT)
|
||||
#define CS35L34_LBST_SHORT (1 << CS35L34_M_LBST_SHORT_SHIFT)
|
||||
|
||||
/* CS35L34_INT_4 */
|
||||
#define CS35L34_VMON_OVFL (1 << CS35L34_M_VMON_OVFL_SHIFT)
|
||||
#define CS35L34_IMON_OVFL (1 << CS35L34_M_IMON_OVFL_SHIFT)
|
||||
#define CS35L34_VPMON_OVFL (1 << CS35L34_M_VPMON_OVFL_SHIFT)
|
||||
#define CS35L34_VBSTMON_OVFL (1 << CS35L34_M_VBSTMON_OVFL_SHIFT)
|
||||
|
||||
/* CS35L34_{RX,TX}_X */
|
||||
#define CS35L34_X_STATE_SHIFT 7
|
||||
#define CS35L34_X_STATE (1 << CS35L34_X_STATE_SHIFT)
|
||||
#define CS35L34_X_LOC_SHIFT 0
|
||||
#define CS35L34_X_LOC (0x1F << CS35L34_X_LOC_SHIFT)
|
||||
|
||||
#define CS35L34_RATES (SNDRV_PCM_RATE_48000 | \
|
||||
SNDRV_PCM_RATE_44100 | \
|
||||
SNDRV_PCM_RATE_32000)
|
||||
#define CS35L34_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
|
||||
SNDRV_PCM_FMTBIT_S24_LE | \
|
||||
SNDRV_PCM_FMTBIT_S32_LE)
|
||||
|
||||
#endif
|
@ -183,7 +183,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops fsl_asoc_card_ops = {
|
||||
static const struct snd_soc_ops fsl_asoc_card_ops = {
|
||||
.hw_params = fsl_asoc_card_hw_params,
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,7 @@ static int imx_hifi_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops imx_hifi_ops = {
|
||||
static const struct snd_soc_ops imx_hifi_ops = {
|
||||
.hw_params = imx_hifi_hw_params,
|
||||
};
|
||||
|
||||
|
@ -174,7 +174,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops asoc_simple_card_ops = {
|
||||
static const struct snd_soc_ops asoc_simple_card_ops = {
|
||||
.startup = asoc_simple_card_startup,
|
||||
.shutdown = asoc_simple_card_shutdown,
|
||||
.hw_params = asoc_simple_card_hw_params,
|
||||
|
@ -59,7 +59,7 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
|
||||
clk_disable_unprepare(dai_props->clk);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops asoc_simple_card_ops = {
|
||||
static const struct snd_soc_ops asoc_simple_card_ops = {
|
||||
.startup = asoc_simple_card_startup,
|
||||
.shutdown = asoc_simple_card_shutdown,
|
||||
};
|
||||
|
@ -156,7 +156,7 @@ static int bdw_rt5677_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops bdw_rt5677_ops = {
|
||||
static const struct snd_soc_ops bdw_rt5677_ops = {
|
||||
.hw_params = bdw_rt5677_hw_params,
|
||||
};
|
||||
|
||||
|
@ -259,7 +259,7 @@ static int broxton_da7219_hw_free(struct snd_pcm_substream *substream)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops broxton_da7219_ops = {
|
||||
static const struct snd_soc_ops broxton_da7219_ops = {
|
||||
.hw_params = broxton_da7219_hw_params,
|
||||
.hw_free = broxton_da7219_hw_free,
|
||||
};
|
||||
@ -309,7 +309,7 @@ static int broxton_refcap_startup(struct snd_pcm_substream *substream)
|
||||
&constraints_16000);
|
||||
};
|
||||
|
||||
static struct snd_soc_ops broxton_refcap_ops = {
|
||||
static const struct snd_soc_ops broxton_refcap_ops = {
|
||||
.startup = broxton_refcap_startup,
|
||||
};
|
||||
|
||||
|
@ -181,7 +181,7 @@ static int broxton_rt298_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops broxton_rt298_ops = {
|
||||
static const struct snd_soc_ops broxton_rt298_ops = {
|
||||
.hw_params = broxton_rt298_hw_params,
|
||||
};
|
||||
|
||||
@ -230,7 +230,7 @@ static int broxton_dmic_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops broxton_dmic_ops = {
|
||||
static const struct snd_soc_ops broxton_dmic_ops = {
|
||||
.startup = broxton_dmic_startup,
|
||||
};
|
||||
|
||||
|
@ -595,11 +595,11 @@ static int byt_rt5640_aif1_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, 48000);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops byt_rt5640_aif1_ops = {
|
||||
static const struct snd_soc_ops byt_rt5640_aif1_ops = {
|
||||
.startup = byt_rt5640_aif1_startup,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops byt_rt5640_be_ssp2_ops = {
|
||||
static const struct snd_soc_ops byt_rt5640_be_ssp2_ops = {
|
||||
.hw_params = byt_rt5640_aif1_hw_params,
|
||||
};
|
||||
|
||||
|
@ -219,11 +219,11 @@ static int byt_rt5651_aif1_startup(struct snd_pcm_substream *substream)
|
||||
&constraints_48000);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops byt_rt5651_aif1_ops = {
|
||||
static const struct snd_soc_ops byt_rt5651_aif1_ops = {
|
||||
.startup = byt_rt5651_aif1_startup,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops byt_rt5651_be_ssp2_ops = {
|
||||
static const struct snd_soc_ops byt_rt5651_be_ssp2_ops = {
|
||||
.hw_params = byt_rt5651_aif1_hw_params,
|
||||
};
|
||||
|
||||
|
@ -204,11 +204,11 @@ static int cht_max98090_headset_init(struct snd_soc_component *component)
|
||||
return ts3a227e_enable_jack_detect(component, &ctx->jack);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops cht_aif1_ops = {
|
||||
static const struct snd_soc_ops cht_aif1_ops = {
|
||||
.startup = cht_aif1_startup,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops cht_be_ssp2_ops = {
|
||||
static const struct snd_soc_ops cht_be_ssp2_ops = {
|
||||
.hw_params = cht_aif1_hw_params,
|
||||
};
|
||||
|
||||
|
@ -251,11 +251,11 @@ static int cht_aif1_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, 48000);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops cht_aif1_ops = {
|
||||
static const struct snd_soc_ops cht_aif1_ops = {
|
||||
.startup = cht_aif1_startup,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops cht_be_ssp2_ops = {
|
||||
static const struct snd_soc_ops cht_be_ssp2_ops = {
|
||||
.hw_params = cht_aif1_hw_params,
|
||||
};
|
||||
|
||||
|
@ -227,11 +227,11 @@ static int cht_aif1_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, 48000);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops cht_aif1_ops = {
|
||||
static const struct snd_soc_ops cht_aif1_ops = {
|
||||
.startup = cht_aif1_startup,
|
||||
};
|
||||
|
||||
static struct snd_soc_ops cht_be_ssp2_ops = {
|
||||
static const struct snd_soc_ops cht_be_ssp2_ops = {
|
||||
.hw_params = cht_aif1_hw_params,
|
||||
};
|
||||
|
||||
|
@ -81,7 +81,7 @@ static int haswell_rt5640_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops haswell_rt5640_ops = {
|
||||
static const struct snd_soc_ops haswell_rt5640_ops = {
|
||||
.hw_params = haswell_rt5640_hw_params,
|
||||
};
|
||||
|
||||
|
@ -332,7 +332,7 @@ static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylake_nau8825_ops = {
|
||||
static const struct snd_soc_ops skylake_nau8825_ops = {
|
||||
.hw_params = skylake_nau8825_hw_params,
|
||||
};
|
||||
|
||||
@ -382,7 +382,7 @@ static int skylake_dmic_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylake_dmic_ops = {
|
||||
static const struct snd_soc_ops skylake_dmic_ops = {
|
||||
.startup = skylake_dmic_startup,
|
||||
};
|
||||
|
||||
@ -416,7 +416,7 @@ static int skylake_refcap_startup(struct snd_pcm_substream *substream)
|
||||
&constraints_16000);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylaye_refcap_ops = {
|
||||
static const struct snd_soc_ops skylaye_refcap_ops = {
|
||||
.startup = skylake_refcap_startup,
|
||||
};
|
||||
|
||||
|
@ -394,7 +394,7 @@ static int skylake_nau8825_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylake_nau8825_ops = {
|
||||
static const struct snd_soc_ops skylake_nau8825_ops = {
|
||||
.hw_params = skylake_nau8825_hw_params,
|
||||
};
|
||||
|
||||
@ -430,7 +430,7 @@ static int skylake_dmic_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylake_dmic_ops = {
|
||||
static const struct snd_soc_ops skylake_dmic_ops = {
|
||||
.startup = skylake_dmic_startup,
|
||||
};
|
||||
|
||||
@ -464,7 +464,7 @@ static int skylake_refcap_startup(struct snd_pcm_substream *substream)
|
||||
&constraints_16000);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylaye_refcap_ops = {
|
||||
static const struct snd_soc_ops skylaye_refcap_ops = {
|
||||
.startup = skylake_refcap_startup,
|
||||
};
|
||||
|
||||
|
@ -250,7 +250,7 @@ static int skylake_rt286_hw_params(struct snd_pcm_substream *substream,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylake_rt286_ops = {
|
||||
static const struct snd_soc_ops skylake_rt286_ops = {
|
||||
.hw_params = skylake_rt286_hw_params,
|
||||
};
|
||||
|
||||
@ -289,7 +289,7 @@ static int skylake_dmic_startup(struct snd_pcm_substream *substream)
|
||||
SNDRV_PCM_HW_PARAM_RATE, &constraints_rates);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops skylake_dmic_ops = {
|
||||
static const struct snd_soc_ops skylake_dmic_ops = {
|
||||
.startup = skylake_dmic_startup,
|
||||
};
|
||||
|
||||
|
@ -42,7 +42,7 @@ static int a370db_hw_params(struct snd_pcm_substream *substream,
|
||||
return snd_soc_dai_set_sysclk(codec_dai, 0, freq, SND_SOC_CLOCK_IN);
|
||||
}
|
||||
|
||||
static struct snd_soc_ops a370db_ops = {
|
||||
static const struct snd_soc_ops a370db_ops = {
|
||||
.hw_params = a370db_hw_params,
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,7 @@ static int mxs_sgtl5000_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_ops mxs_sgtl5000_hifi_ops = {
|
||||
static const struct snd_soc_ops mxs_sgtl5000_hifi_ops = {
|
||||
.hw_params = mxs_sgtl5000_hw_params,
|
||||
};
|
||||
|
||||
|
@ -30,16 +30,26 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) {
|
||||
ret = cpu_dai->driver->cops->startup(cstream, cpu_dai);
|
||||
if (ret < 0) {
|
||||
dev_err(cpu_dai->dev, "Compress ASoC: can't open interface %s: %d\n",
|
||||
cpu_dai->name, ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
|
||||
ret = platform->driver->compr_ops->open(cstream);
|
||||
if (ret < 0) {
|
||||
pr_err("compress asoc: can't open platform %s\n",
|
||||
platform->component.name);
|
||||
goto out;
|
||||
goto plat_err;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +70,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream)
|
||||
machine_err:
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->free)
|
||||
platform->driver->compr_ops->free(cstream);
|
||||
plat_err:
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
|
||||
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
|
||||
out:
|
||||
mutex_unlock(&rtd->pcm_mutex);
|
||||
return ret;
|
||||
@ -70,6 +83,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
|
||||
struct snd_soc_pcm_runtime *fe = cstream->private_data;
|
||||
struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream;
|
||||
struct snd_soc_platform *platform = fe->platform;
|
||||
struct snd_soc_dai *cpu_dai = fe->cpu_dai;
|
||||
struct snd_soc_dpcm *dpcm;
|
||||
struct snd_soc_dapm_widget_list *list;
|
||||
int stream;
|
||||
@ -82,12 +96,22 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
|
||||
|
||||
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) {
|
||||
ret = cpu_dai->driver->cops->startup(cstream, cpu_dai);
|
||||
if (ret < 0) {
|
||||
dev_err(cpu_dai->dev, "Compress ASoC: can't open interface %s: %d\n",
|
||||
cpu_dai->name, ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->open) {
|
||||
ret = platform->driver->compr_ops->open(cstream);
|
||||
if (ret < 0) {
|
||||
pr_err("compress asoc: can't open platform %s\n",
|
||||
platform->component.name);
|
||||
goto out;
|
||||
goto plat_err;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +168,9 @@ fe_err:
|
||||
machine_err:
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->free)
|
||||
platform->driver->compr_ops->free(cstream);
|
||||
plat_err:
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
|
||||
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
|
||||
out:
|
||||
fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
|
||||
mutex_unlock(&fe->card->mutex);
|
||||
@ -210,6 +237,9 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->free)
|
||||
platform->driver->compr_ops->free(cstream);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
|
||||
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
|
||||
|
||||
if (cstream->direction == SND_COMPRESS_PLAYBACK) {
|
||||
if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
|
||||
snd_soc_dapm_stream_event(rtd,
|
||||
@ -236,6 +266,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *fe = cstream->private_data;
|
||||
struct snd_soc_platform *platform = fe->platform;
|
||||
struct snd_soc_dai *cpu_dai = fe->cpu_dai;
|
||||
struct snd_soc_dpcm *dpcm;
|
||||
int stream, ret;
|
||||
|
||||
@ -275,6 +306,9 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->free)
|
||||
platform->driver->compr_ops->free(cstream);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
|
||||
cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
|
||||
|
||||
mutex_unlock(&fe->card->mutex);
|
||||
return 0;
|
||||
}
|
||||
@ -285,6 +319,7 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *codec_dai = rtd->codec_dai;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
|
||||
@ -295,6 +330,10 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger)
|
||||
cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai);
|
||||
|
||||
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
snd_soc_dai_digital_mute(codec_dai, 0, cstream->direction);
|
||||
@ -313,6 +352,7 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *fe = cstream->private_data;
|
||||
struct snd_soc_platform *platform = fe->platform;
|
||||
struct snd_soc_dai *cpu_dai = fe->cpu_dai;
|
||||
int ret = 0, stream;
|
||||
|
||||
if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN ||
|
||||
@ -332,6 +372,12 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd)
|
||||
|
||||
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger) {
|
||||
ret = cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->trigger) {
|
||||
ret = platform->driver->compr_ops->trigger(cstream, cmd);
|
||||
if (ret < 0)
|
||||
@ -368,6 +414,7 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
|
||||
@ -378,6 +425,12 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream,
|
||||
* expectation is that platform and machine will configure everything
|
||||
* for this compress path, like configuring pcm port for codec
|
||||
*/
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_params) {
|
||||
ret = cpu_dai->driver->cops->set_params(cstream, params, cpu_dai);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) {
|
||||
ret = platform->driver->compr_ops->set_params(cstream, params);
|
||||
if (ret < 0)
|
||||
@ -416,6 +469,7 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
|
||||
struct snd_soc_pcm_runtime *fe = cstream->private_data;
|
||||
struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream;
|
||||
struct snd_soc_platform *platform = fe->platform;
|
||||
struct snd_soc_dai *cpu_dai = fe->cpu_dai;
|
||||
int ret = 0, stream;
|
||||
|
||||
if (cstream->direction == SND_COMPRESS_PLAYBACK)
|
||||
@ -425,6 +479,12 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream,
|
||||
|
||||
mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_params) {
|
||||
ret = cpu_dai->driver->cops->set_params(cstream, params, cpu_dai);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->set_params) {
|
||||
ret = platform->driver->compr_ops->set_params(cstream, params);
|
||||
if (ret < 0)
|
||||
@ -469,13 +529,21 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream,
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_params) {
|
||||
ret = cpu_dai->driver->cops->get_params(cstream, params, cpu_dai);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->get_params)
|
||||
ret = platform->driver->compr_ops->get_params(cstream, params);
|
||||
|
||||
err:
|
||||
mutex_unlock(&rtd->pcm_mutex);
|
||||
return ret;
|
||||
}
|
||||
@ -516,13 +584,21 @@ static int soc_compr_ack(struct snd_compr_stream *cstream, size_t bytes)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->ack) {
|
||||
ret = cpu_dai->driver->cops->ack(cstream, bytes, cpu_dai);
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->ack)
|
||||
ret = platform->driver->compr_ops->ack(cstream, bytes);
|
||||
|
||||
err:
|
||||
mutex_unlock(&rtd->pcm_mutex);
|
||||
return ret;
|
||||
}
|
||||
@ -533,9 +609,13 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream,
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
int ret = 0;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
|
||||
mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer)
|
||||
cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai);
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->pointer)
|
||||
ret = platform->driver->compr_ops->pointer(cstream, tstamp);
|
||||
|
||||
@ -564,8 +644,15 @@ static int soc_compr_set_metadata(struct snd_compr_stream *cstream,
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->set_metadata) {
|
||||
ret = cpu_dai->driver->cops->set_metadata(cstream, metadata, cpu_dai);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->set_metadata)
|
||||
ret = platform->driver->compr_ops->set_metadata(cstream, metadata);
|
||||
|
||||
@ -577,8 +664,15 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream,
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
int ret = 0;
|
||||
|
||||
if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) {
|
||||
ret = cpu_dai->driver->cops->get_metadata(cstream, metadata, cpu_dai);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (platform->driver->compr_ops && platform->driver->compr_ops->get_metadata)
|
||||
ret = platform->driver->compr_ops->get_metadata(cstream, metadata);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user