mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
update cs35l35 driver from Payton
the old came from github site of cirrus driver v4.9-cs35l35 branch Change-Id: I182e2bb0d1e041c72307c6b9541a7b2755e64ad2 Signed-off-by: huangys <huangys@motorola.com> Reviewed-on: https://gerrit.mot.com/1160165 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Guobin Zhang <zhanggb@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
fa3cc721ff
commit
08e4828a96
4 changed files with 518 additions and 786 deletions
|
|
@ -1,183 +0,0 @@
|
|||
CS35L35 Boosted Speaker Amplifier
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible : "cirrus,cs35l35"
|
||||
|
||||
- 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.
|
||||
|
||||
- interrupt-parent : Specifies the phandle of the interrupt controller to
|
||||
which the IRQs from CS35L35 are delivered to.
|
||||
- interrupts : IRQ line info CS35L35.
|
||||
(See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
|
||||
for further information relating to interrupt properties)
|
||||
|
||||
- cirrus,boost-ind-nanohenry: Inductor value for boost converter. The value is
|
||||
in nH and they can be values of 1000nH, 1200nH, 1500nH, and 2200nH.
|
||||
|
||||
Optional properties:
|
||||
- reset-gpios : gpio used to reset the amplifier
|
||||
|
||||
- cirrus,stereo-config : Boolean to determine if there are 2 AMPs for a
|
||||
Stereo configuration
|
||||
|
||||
- cirrus,audio-channel : Set Location of Audio Signal on Serial Port
|
||||
0 = Data Packet received on Left I2S Channel
|
||||
1 = Data Packet received on Right I2S Channel
|
||||
|
||||
- cirrus,advisory-channel : Set Location of Advisory Signal on Serial Port
|
||||
0 = Data Packet received on Left I2S Channel
|
||||
1 = Data Packet received on Right I2S Channel
|
||||
|
||||
- cirrus,shared-boost : Boolean to enable ClassH tracking of Advisory Signal
|
||||
if 2 Devices share Boost BST_CTL
|
||||
|
||||
- cirrus,external-boost : Boolean to specify the device is using an external
|
||||
boost supply, note that sharing a boost from another cs35l35 would constitute
|
||||
using an external supply for the slave device
|
||||
|
||||
- cirrus,sp-drv-strength : Value for setting the Serial Port drive strength
|
||||
Table 3-10 of the datasheet lists drive-strength specifications
|
||||
0 = 1x (Default)
|
||||
1 = .5x
|
||||
- cirrus,sp-drv-unused : Determines how unused slots should be driven on the
|
||||
Serial Port.
|
||||
0 - Hi-Z
|
||||
2 - Drive 0's (Default)
|
||||
3 - Drive 1's
|
||||
|
||||
- cirrus,bst-pdn-fet-on : Boolean to determine if the Boost PDN control
|
||||
powers down with a rectification FET On or Off. If VSPK is supplied
|
||||
externally then FET is off.
|
||||
|
||||
- cirrus,boost-ctl-millivolt : Boost Voltage Value. Configures the boost
|
||||
converter's output voltage in mV. The range is from 2600mV to 9000mV with
|
||||
increments of 100mV.
|
||||
(Default) VP
|
||||
|
||||
- cirrus,boost-peak-milliamp : Boost-converter peak current limit in mA.
|
||||
Configures the peak current by monitoring the current through the boost FET.
|
||||
Range starts at 1680mA and goes to a maximum of 4480mA with increments of
|
||||
110mA.
|
||||
(Default) 2.46 Amps
|
||||
|
||||
- cirrus,amp-gain-zc : Boolean to determine if to use Amplifier gain-change
|
||||
zero-cross
|
||||
|
||||
Optional H/G Algorithm sub-node:
|
||||
|
||||
The cs35l35 node can have a single "cirrus,classh-internal-algo" sub-node
|
||||
that will disable automatic control of the internal H/G Algorithm.
|
||||
|
||||
It is strongly recommended that the Datasheet be referenced when adjusting
|
||||
or using these Class H Algorithm controls over the internal Algorithm.
|
||||
Serious damage can occur to the Device and surrounding components.
|
||||
|
||||
- cirrus,classh-internal-algo : Sub-node for the Internal Class H Algorithm
|
||||
See Section 4.3 Internal Class H Algorithm in the Datasheet.
|
||||
If not used, the device manages the ClassH Algorithm internally.
|
||||
|
||||
Optional properties for the "cirrus,classh-internal-algo" Sub-node
|
||||
|
||||
Section 7.29 Class H Control
|
||||
- cirrus,classh-bst-overide : Boolean
|
||||
- cirrus,classh-bst-max-limit
|
||||
- cirrus,classh-mem-depth
|
||||
|
||||
Section 7.30 Class H Headroom Control
|
||||
- cirrus,classh-headroom
|
||||
|
||||
Section 7.31 Class H Release Rate
|
||||
- cirrus,classh-release-rate
|
||||
|
||||
Section 7.32 Class H Weak FET Drive Control
|
||||
- cirrus,classh-wk-fet-disable
|
||||
- cirrus,classh-wk-fet-delay
|
||||
- cirrus,classh-wk-fet-thld
|
||||
|
||||
Section 7.34 Class H VP Control
|
||||
- cirrus,classh-vpch-auto
|
||||
- cirrus,classh-vpch-rate
|
||||
- cirrus,classh-vpch-man
|
||||
|
||||
Optional Monitor Signal Format sub-node:
|
||||
|
||||
The cs35l35 node can have a single "cirrus,monitor-signal-format" sub-node
|
||||
for adjusting the Depth, Location and Frame of the Monitoring Signals
|
||||
for Algorithms.
|
||||
|
||||
See Sections 4.8.2 through 4.8.4 Serial-Port Control in the Datasheet
|
||||
|
||||
-cirrus,monitor-signal-format : Sub-node for the Monitor Signaling Formating
|
||||
on the I2S Port. Each of the 3 8 bit values in the array contain the settings
|
||||
for depth, location, and frame.
|
||||
|
||||
If not used, the defaults for the 6 monitor signals is used.
|
||||
|
||||
Sections 7.44 - 7.53 lists values for the depth, location, and frame
|
||||
for each monitoring signal.
|
||||
|
||||
- cirrus,imon : 4 8 bit values to set the depth, location, frame and ADC
|
||||
scale of the IMON monitor signal.
|
||||
|
||||
- cirrus,vmon : 3 8 bit values to set the depth, location, and frame
|
||||
of the VMON monitor signal.
|
||||
|
||||
- cirrus,vpmon : 3 8 bit values to set the depth, location, and frame
|
||||
of the VPMON monitor signal.
|
||||
|
||||
- cirrus,vbstmon : 3 8 bit values to set the depth, location, and frame
|
||||
of the VBSTMON monitor signal
|
||||
|
||||
- cirrus,vpbrstat : 3 8 bit values to set the depth, location, and frame
|
||||
of the VPBRSTAT monitor signal
|
||||
|
||||
- cirrus,zerofill : 3 8 bit values to set the depth, location, and frame\
|
||||
of the ZEROFILL packet in the monitor signal
|
||||
|
||||
Example:
|
||||
|
||||
cs35l35: cs35l35@20 {
|
||||
compatible = "cirrus,cs35l35";
|
||||
reg = <0x20>;
|
||||
VA-supply = <&dummy_vreg>;
|
||||
VP-supply = <&dummy_vreg>;
|
||||
reset-gpios = <&axi_gpio 54 0>;
|
||||
interrupt-parent = <&gpio8>;
|
||||
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
|
||||
cirrus,boost-ctl-millivolt = <9000>;
|
||||
|
||||
cirrus,stereo-config;
|
||||
cirrus,audio-channel = <0x00>;
|
||||
cirrus,advisory-channel = <0x01>;
|
||||
cirrus,shared-boost;
|
||||
|
||||
cirrus,classh-internal-algo {
|
||||
cirrus,classh-bst-overide;
|
||||
cirrus,classh-bst-max-limit = <0x01>;
|
||||
cirrus,classh-mem-depth = <0x01>;
|
||||
cirrus,classh-release-rate = <0x08>;
|
||||
cirrus,classh-headroom-millivolt = <0x0B>;
|
||||
cirrus,classh-wk-fet-disable = <0x01>;
|
||||
cirrus,classh-wk-fet-delay = <0x04>;
|
||||
cirrus,classh-wk-fet-thld = <0x01>;
|
||||
cirrus,classh-vpch-auto = <0x01>;
|
||||
cirrus,classh-vpch-rate = <0x02>;
|
||||
cirrus,classh-vpch-man = <0x05>;
|
||||
};
|
||||
|
||||
/* Depth, Location, Frame */
|
||||
cirrus,monitor-signal-format {
|
||||
cirrus,imon = /bits/ 8 <0x03 0x00 0x01>;
|
||||
cirrus,vmon = /bits/ 8 <0x03 0x00 0x00>;
|
||||
cirrus,vpmon = /bits/ 8 <0x03 0x04 0x00>;
|
||||
cirrus,vbstmon = /bits/ 8 <0x03 0x04 0x01>;
|
||||
cirrus,vpbrstat = /bits/ 8 <0x00 0x04 0x00>;
|
||||
cirrus,zerofill = /bits/ 8 <0x00 0x00 0x00>;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -24,6 +24,7 @@ struct classh_cfg {
|
|||
*
|
||||
* Section 4.3 of the datasheet
|
||||
*/
|
||||
/* Internal ClassH Algorithm */
|
||||
bool classh_bst_override;
|
||||
bool classh_algo_enable;
|
||||
int classh_bst_max_limit;
|
||||
|
|
@ -57,7 +58,6 @@ struct monitor_cfg {
|
|||
u8 imon_dpth;
|
||||
u8 imon_loc;
|
||||
u8 imon_frm;
|
||||
u8 imon_scale;
|
||||
u8 vmon_dpth;
|
||||
u8 vmon_loc;
|
||||
u8 vmon_frm;
|
||||
|
|
@ -81,14 +81,10 @@ struct cs35l35_platform_data {
|
|||
bool stereo;
|
||||
/* serial port drive strength */
|
||||
int sp_drv_str;
|
||||
/* serial port drive in unused slots */
|
||||
int sp_drv_unused;
|
||||
/* Boost Power Down with FET */
|
||||
bool bst_pdn_fet_on;
|
||||
/* Boost Voltage : used if ClassH Algo Enabled */
|
||||
int bst_vctl;
|
||||
/* Boost Converter Peak Current CTRL */
|
||||
int bst_ipk;
|
||||
/* Amp Gain Zero Cross */
|
||||
bool gain_zc;
|
||||
/* Audio Input Location */
|
||||
|
|
@ -97,10 +93,6 @@ struct cs35l35_platform_data {
|
|||
int adv_channel;
|
||||
/* Shared Boost for stereo */
|
||||
bool shared_bst;
|
||||
/* Specifies this amp is using an external boost supply */
|
||||
bool ext_bst;
|
||||
/* Inductor Value */
|
||||
int boost_ind;
|
||||
/* ClassH Algorithm */
|
||||
struct classh_cfg classh_algo;
|
||||
/* Monitor Config */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -111,7 +111,7 @@
|
|||
|
||||
#define CS35L35_AUDIN_DEPTH_MASK 0x03
|
||||
#define CS35L35_AUDIN_DEPTH_SHIFT 0
|
||||
#define CS35L35_ADVIN_DEPTH_MASK 0x0C
|
||||
#define CS35L35_ADVIN_DEPTH_MASK 0x12
|
||||
#define CS35L35_ADVIN_DEPTH_SHIFT 2
|
||||
#define CS35L35_SDIN_DEPTH_8 0x01
|
||||
#define CS35L35_SDIN_DEPTH_16 0x02
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
#define CS35L35_VBSTMON_DEPTH_SHIFT 0
|
||||
#define CS35L35_VPMON_DEPTH_MASK 0x0C
|
||||
#define CS35L35_VPMON_DEPTH_SHIFT 2
|
||||
#define CS35L35_VPBRSTAT_DEPTH_MASK 0x30
|
||||
#define CS35L35_VPBRSTAT_DEPTH_MASK 0x18
|
||||
#define CS35L35_VPBRSTAT_DEPTH_SHIFT 4
|
||||
#define CS35L35_ZEROFILL_DEPTH_MASK 0x03
|
||||
#define CS35L35_ZEROFILL_DEPTH_SHIFT 0x00
|
||||
|
|
@ -148,15 +148,13 @@
|
|||
#define CS35L35_MON_FRM_MASK 0x80
|
||||
#define CS35L35_MON_FRM_SHIFT 7
|
||||
|
||||
#define CS35L35_IMON_SCALE_MASK 0xF8
|
||||
#define CS35L35_IMON_SCALE_SHIFT 3
|
||||
|
||||
#define CS35L35_MS_MASK 0x80
|
||||
#define CS35L35_MS_SHIFT 7
|
||||
#define CS35L35_SPMODE_MASK 0x40
|
||||
#define CS35L35_SP_DRV_MASK 0x10
|
||||
#define CS35L35_SP_DRV_SHIFT 4
|
||||
#define CS35L35_CLK_CTL2_MASK 0xFF
|
||||
#define CS35L35_CLK_DIV_MASK 0x3
|
||||
#define CS35L35_PDM_MODE_MASK 0x40
|
||||
#define CS35L35_PDM_MODE_SHIFT 6
|
||||
#define CS35L35_CLK_SOURCE_MASK 0x03
|
||||
|
|
@ -186,26 +184,11 @@
|
|||
|
||||
#define CS35L35_BST_CTL_MASK 0x7F
|
||||
#define CS35L35_BST_CTL_SHIFT 0
|
||||
#define CS35L35_BST_IPK_MASK 0x1F
|
||||
#define CS35L35_BST_IPK_SHIFT 0
|
||||
#define CS35L35_AMP_MUTE_MASK 0x20
|
||||
#define CS35L35_AMP_MUTE_SHIFT 5
|
||||
#define CS35L35_AMP_GAIN_ZC_MASK 0x10
|
||||
#define CS35L35_AMP_GAIN_ZC_SHIFT 4
|
||||
|
||||
#define CS35L35_AMP_DIGSFT_MASK 0x02
|
||||
#define CS35L35_AMP_DIGSFT_SHIFT 1
|
||||
|
||||
/* CS35L35_SP_FMT_CTL3 */
|
||||
#define CS35L35_SP_I2S_DRV_MASK 0x03
|
||||
#define CS35L35_SP_I2S_DRV_SHIFT 0
|
||||
|
||||
/* Boost Converter Config */
|
||||
#define CS35L35_BST_CONV_COEFF_MASK 0xFF
|
||||
#define CS35L35_BST_CONV_SLOPE_MASK 0xFF
|
||||
#define CS35L35_BST_CONV_LBST_MASK 0x03
|
||||
#define CS35L35_BST_CONV_SWFREQ_MASK 0xF0
|
||||
|
||||
/* Class H Algorithm Control */
|
||||
#define CS35L35_CH_STEREO_MASK 0x40
|
||||
#define CS35L35_CH_STEREO_SHIFT 6
|
||||
|
|
@ -273,32 +256,30 @@
|
|||
#define CS35L35_VMON_OVFL 0x08
|
||||
#define CS35L35_IMON_OVFL 0x04
|
||||
|
||||
/* Mulit-Device Sync */
|
||||
#define CS35L35_SYNC_EN_MASK 0x01
|
||||
#define CS35L35_SYNC_MS_MASK 0x20
|
||||
#define CS35L35_SYNC_MS_SHIFT 5
|
||||
#define CS35L35_SYNC_MS_CTRL_MASK 0x10
|
||||
#define CS35L35_SYNC_MS_CTRL_SHIFT 4
|
||||
#define CS35L35_SYNC_CLK_SEL_MASK 0x02
|
||||
#define CS35L35_SYNC_CLK_SEL_SHIFT 1
|
||||
|
||||
|
||||
#define CS35L35_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | \
|
||||
SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
|
||||
SNDRV_PCM_FMTBIT_S24_LE)
|
||||
|
||||
struct cs35l35_private {
|
||||
struct device *dev;
|
||||
struct i2c_client *i2c_client;
|
||||
struct snd_soc_codec *codec;
|
||||
struct cs35l35_platform_data pdata;
|
||||
struct regmap *regmap;
|
||||
struct regulator_bulk_data supplies[2];
|
||||
int num_supplies;
|
||||
int sysclk;
|
||||
int sclk;
|
||||
int mclk_pll;
|
||||
int mclk_div;
|
||||
int mclk_sp_base;
|
||||
bool tdm_mode;
|
||||
bool pdm_mode;
|
||||
bool i2s_mode;
|
||||
bool i2s_enabled;
|
||||
bool slave_mode;
|
||||
bool pdm_mclk_switch;
|
||||
/* GPIO for /RST */
|
||||
struct gpio_desc *reset_gpio;
|
||||
/* GPIO for INT */
|
||||
struct gpio_desc *irq_gpio;
|
||||
struct completion pdn_done;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue